Refactor typescript declarations and interfaces to be loaded via the -types repository.

parent 9fcf5a4c
......@@ -258,9 +258,9 @@
}
},
"@types/jasmine": {
"version": "2.8.1",
"resolved": "https://registry.npmjs.org/@types/jasmine/-/jasmine-2.8.1.tgz",
"integrity": "sha512-hJnkWdWBb7/mfsalKsAv123F2AgL392BZ+OoB+6fbUdqDDIz8dCHNmwu1hlBeHMnV87lS11yS3kSEvm1fivlCA==",
"version": "2.8.2",
"resolved": "https://registry.npmjs.org/@types/jasmine/-/jasmine-2.8.2.tgz",
"integrity": "sha512-RabEJPjYMpjWqW1qYj4k0rlgP5uzyguoc0yxedJdq7t5h19MYvqhjCR1evM3raZ/peHRxp1Qfl24iawvkibSug==",
"dev": true
},
"@types/jasminewd2": {
......@@ -269,13 +269,13 @@
"integrity": "sha512-hYDVmQZT5VA2kigd4H4bv7vl/OhlympwREUemqBdOqtrYTo5Ytm12a5W5/nGgGYdanGVxj0x/VhZ7J3hOg/YKg==",
"dev": true,
"requires": {
"@types/jasmine": "2.8.1"
"@types/jasmine": "2.8.2"
}
},
"@types/node": {
"version": "8.0.52",
"resolved": "https://registry.npmjs.org/@types/node/-/node-8.0.52.tgz",
"integrity": "sha512-wOU/VRodnI/4Chxuu6R6bcyN9aE3rztO0i8R76PZO7+DxTXWy60nseGN4ujspucmxrfj5mzgCYPXiXqrD6KC3Q==",
"version": "8.0.53",
"resolved": "https://registry.npmjs.org/@types/node/-/node-8.0.53.tgz",
"integrity": "sha512-54Dm6NwYeiSQmRB1BLXKr5GELi0wFapR1npi8bnZhEcu84d/yQKqnwwXQ56hZ0RUbTG6L5nqDZaN3dgByQXQRQ==",
"dev": true
},
"@types/q": {
......@@ -570,6 +570,248 @@
"integrity": "sha1-iYUI2iIm84DfkEcoRWhJwVAaSw0=",
"dev": true
},
"arsnova-click-v2-types": {
"version": "file:../arsnova-click-v2-types",
"dev": true,
"dependencies": {
"@types/node": {
"version": "8.0.53",
"bundled": true
},
"@types/ws": {
"version": "3.2.0",
"bundled": true,
"requires": {
"@types/node": "8.0.53"
}
},
"ansi-regex": {
"version": "2.1.1",
"bundled": true
},
"ansi-styles": {
"version": "2.2.1",
"bundled": true
},
"babel-code-frame": {
"version": "6.26.0",
"bundled": true,
"requires": {
"chalk": "1.1.3",
"esutils": "2.0.2",
"js-tokens": "3.0.2"
},
"dependencies": {
"chalk": {
"version": "1.1.3",
"bundled": true,
"requires": {
"ansi-styles": "2.2.1",
"escape-string-regexp": "1.0.5",
"has-ansi": "2.0.0",
"strip-ansi": "3.0.1",
"supports-color": "2.0.0"
}
}
}
},
"balanced-match": {
"version": "1.0.0",
"bundled": true
},
"brace-expansion": {
"version": "1.1.8",
"bundled": true,
"requires": {
"balanced-match": "1.0.0",
"concat-map": "0.0.1"
}
},
"builtin-modules": {
"version": "1.1.1",
"bundled": true
},
"chalk": {
"version": "2.3.0",
"bundled": true,
"requires": {
"ansi-styles": "3.2.0",
"escape-string-regexp": "1.0.5",
"supports-color": "4.5.0"
},
"dependencies": {
"ansi-styles": {
"version": "3.2.0",
"bundled": true,
"requires": {
"color-convert": "1.9.1"
}
},
"supports-color": {
"version": "4.5.0",
"bundled": true,
"requires": {
"has-flag": "2.0.0"
}
}
}
},
"color-convert": {
"version": "1.9.1",
"bundled": true,
"requires": {
"color-name": "1.1.3"
}
},
"color-name": {
"version": "1.1.3",
"bundled": true
},
"commander": {
"version": "2.11.0",
"bundled": true
},
"concat-map": {
"version": "0.0.1",
"bundled": true
},
"diff": {
"version": "3.4.0",
"bundled": true
},
"escape-string-regexp": {
"version": "1.0.5",
"bundled": true
},
"esutils": {
"version": "2.0.2",
"bundled": true
},
"fs.realpath": {
"version": "1.0.0",
"bundled": true
},
"glob": {
"version": "7.1.2",
"bundled": true,
"requires": {
"fs.realpath": "1.0.0",
"inflight": "1.0.6",
"inherits": "2.0.3",
"minimatch": "3.0.4",
"once": "1.4.0",
"path-is-absolute": "1.0.1"
}
},
"has-ansi": {
"version": "2.0.0",
"bundled": true,
"requires": {
"ansi-regex": "2.1.1"
}
},
"has-flag": {
"version": "2.0.0",
"bundled": true
},
"inflight": {
"version": "1.0.6",
"bundled": true,
"requires": {
"once": "1.4.0",
"wrappy": "1.0.2"
}
},
"inherits": {
"version": "2.0.3",
"bundled": true
},
"js-tokens": {
"version": "3.0.2",
"bundled": true
},
"minimatch": {
"version": "3.0.4",
"bundled": true,
"requires": {
"brace-expansion": "1.1.8"
}
},
"once": {
"version": "1.4.0",
"bundled": true,
"requires": {
"wrappy": "1.0.2"
}
},
"path-is-absolute": {
"version": "1.0.1",
"bundled": true
},
"path-parse": {
"version": "1.0.5",
"bundled": true
},
"resolve": {
"version": "1.5.0",
"bundled": true,
"requires": {
"path-parse": "1.0.5"
}
},
"semver": {
"version": "5.4.1",
"bundled": true
},
"strip-ansi": {
"version": "3.0.1",
"bundled": true,
"requires": {
"ansi-regex": "2.1.1"
}
},
"supports-color": {
"version": "2.0.0",
"bundled": true
},
"tslib": {
"version": "1.8.0",
"bundled": true
},
"tslint": {
"version": "5.8.0",
"bundled": true,
"requires": {
"babel-code-frame": "6.26.0",
"builtin-modules": "1.1.1",
"chalk": "2.3.0",
"commander": "2.11.0",
"diff": "3.4.0",
"glob": "7.1.2",
"minimatch": "3.0.4",
"resolve": "1.5.0",
"semver": "5.4.1",
"tslib": "1.8.0",
"tsutils": "2.12.2"
}
},
"tsutils": {
"version": "2.12.2",
"bundled": true,
"requires": {
"tslib": "1.8.0"
}
},
"typescript": {
"version": "2.6.1",
"bundled": true
},
"wrappy": {
"version": "1.0.2",
"bundled": true
}
}
},
"asap": {
"version": "2.0.6",
"resolved": "https://registry.npmjs.org/asap/-/asap-2.0.6.tgz",
......@@ -8430,9 +8672,9 @@
}
},
"popper.js": {
"version": "1.12.8",
"resolved": "https://registry.npmjs.org/popper.js/-/popper.js-1.12.8.tgz",
"integrity": "sha1-tZtXRzYh/q8Dcm4avnwXxLI8hWQ="
"version": "1.12.9",
"resolved": "https://registry.npmjs.org/popper.js/-/popper.js-1.12.9.tgz",
"integrity": "sha1-DfvC3/lsRRuzMu3Pz6r1ZtMx1bM="
},
"portfinder": {
"version": "1.0.13",
......
import {NgModule} from '@angular/core';
import {FooterBarComponent} from './footer-bar/footer-bar.component';
import {SharedModule} from '../shared/shared.module';
import {HttpModule} from '@angular/http';
@NgModule({
imports: [
SharedModule,
HttpModule
SharedModule
],
declarations: [FooterBarComponent],
providers: [SharedModule],
......
......@@ -4,7 +4,7 @@ import {Subscription} from 'rxjs/Subscription';
import {DEVICE_TYPES, LIVE_PREVIEW_ENVIRONMENT} from '../../../environments/environment';
import {ActiveQuestionGroupService} from '../../service/active-question-group.service';
import {ActivatedRoute} from '@angular/router';
import {IQuestionChoice} from '../../../lib/questions/interfaces';
import {IQuestionChoice} from 'arsnova-click-v2-types/src/questions/interfaces';
import {DomSanitizer, SafeHtml} from '@angular/platform-browser';
@Component({
......
......@@ -2,8 +2,8 @@ import {Component, OnInit} from '@angular/core';
import {NgbActiveModal} from '@ng-bootstrap/ng-bootstrap';
import {ModalI} from '../modals.module';
import {ActiveQuestionGroupService} from '../../service/active-question-group.service';
import {questionGroupReflection} from '../../../lib/questions/questionGroup_reflection';
import {IQuestionGroup} from '../../../lib/questions/interfaces';
import {questionGroupReflection} from 'arsnova-click-v2-types/src/questions/questionGroup_reflection';
import {IQuestionGroup} from 'arsnova-click-v2-types/src/questions/interfaces';
import {DefaultSettings} from '../../../lib/default.settings';
import {HttpClient} from '@angular/common/http';
import {IMessage} from '../../quiz/quiz-flow/quiz-lobby/quiz-lobby.component';
......@@ -52,19 +52,44 @@ export class AvailableQuizzesComponent implements OnInit, ModalI {
}
startQuiz(session: IQuestionGroup): void {
this.http.put(`${DefaultSettings.httpApiEndpoint}/lobby`, {
quiz: session.serialize()
}).subscribe(
(data: IMessage) => {
new Promise((resolve, reject) => {
this.http.get(`${DefaultSettings.httpApiEndpoint}/quiz/status/${session.hashtag}`).subscribe((data: IMessage) => {
if (data.status === 'STATUS:SUCCESSFUL') {
const questionGroup = new questionGroupReflection[data.payload.quiz.originalObject.TYPE](data.payload.quiz.originalObject);
this.activeQuestionGroupService.activeQuestionGroup = questionGroup;
this.currentQuizService.quiz = questionGroup;
this.router.navigate([session.isValid() ? '/quiz/flow' : '/quiz/manager']);
if (data.step === 'QUIZ:UNDEFINED') {
this.http.post(`${DefaultSettings.httpApiEndpoint}/quiz/reserve/override`, {
quizName: session.hashtag,
privateKey: window.localStorage.getItem('config.private_key')
}).subscribe((reserveResponse: IMessage) => {
if (reserveResponse.status === 'STATUS:SUCCESSFUL') {
resolve();
} else {
reject([data, reserveResponse]);
}
});
} else {
resolve();
}
} else {
reject(data);
}
this.next();
}
);
});
}).then(() => {
this.http.put(`${DefaultSettings.httpApiEndpoint}/lobby`, {
quiz: session.serialize()
}).subscribe(
(data: IMessage) => {
if (data.status === 'STATUS:SUCCESSFUL') {
const questionGroup = new questionGroupReflection[data.payload.quiz.originalObject.TYPE](data.payload.quiz.originalObject);
this.activeQuestionGroupService.activeQuestionGroup = questionGroup;
this.currentQuizService.quiz = questionGroup;
this.router.navigate([session.isValid() ? '/quiz/flow' : '/quiz/manager']);
}
this.next();
}
);
}, (reason => {
console.log(reason);
}));
}
editQuiz(session: IQuestionGroup): void {
......
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import {async, ComponentFixture, TestBed} from '@angular/core/testing';
import { ConfidenceRateComponent } from './confidence-rate.component';
import {ConfidenceRateComponent} from './confidence-rate.component';
describe('ConfidenceRateComponent', () => {
let component: ConfidenceRateComponent;
......
......@@ -10,8 +10,8 @@ import {ThemesModule} from '../../themes/themes.module';
import {QuizResultsModule} from './quiz-results/quiz-results.module';
import {AttendeeService} from '../../service/attendee.service';
import {QuestionDetailsComponent} from './quiz-results/question-details/question-details.component';
import { ReadingConfirmationComponent } from './reading-confirmation/reading-confirmation.component';
import { ConfidenceRateComponent } from './confidence-rate/confidence-rate.component';
import {ReadingConfirmationComponent} from './reading-confirmation/reading-confirmation.component';
import {ConfidenceRateComponent} from './confidence-rate/confidence-rate.component';
import {NgxQRCodeModule} from '@techiediaries/ngx-qrcode';
const quizFlowRoutes: Routes = [
......
import {Component, Input, OnInit} from '@angular/core';
import {DomSanitizer, SafeHtml, SafeStyle} from '@angular/platform-browser';
import {CurrentQuizService} from '../../../../../service/current-quiz.service';
@Component({
selector: 'app-progress-bar-ranged',
......
import {Component, Input, OnInit} from '@angular/core';
import {DomSanitizer, SafeStyle, SafeHtml} from '@angular/platform-browser';
import {DomSanitizer, SafeHtml, SafeStyle} from '@angular/platform-browser';
@Component({
selector: 'app-progress-bar-single-choice',
......
import {Component, Input, OnDestroy, OnInit} from '@angular/core';
import {IQuestion} from '../../../../../lib/questions/interfaces';
import {IQuestion} from 'arsnova-click-v2-types/src/questions/interfaces';
import {AttendeeService} from '../../../../service/attendee.service';
import {I18nService, NumberTypes} from '../../../../service/i18n.service';
import {RangedQuestion} from '../../../../../lib/questions/question_ranged';
import {FreeTextQuestion} from '../../../../../lib/questions/question_freetext';
import {RangedQuestion} from 'arsnova-click-v2-types/src/questions/question_ranged';
import {FreeTextQuestion} from 'arsnova-click-v2-types/src/questions/question_freetext';
import {CurrentQuizService} from '../../../../service/current-quiz.service';
import {TranslateService} from '@ngx-translate/core';
import {IFreetextAnswerOption} from '../../../../../lib/answeroptions/interfaces';
import {IFreetextAnswerOption} from 'arsnova-click-v2-types/src/answeroptions/interfaces';
@Component({
selector: 'app-progress-bar',
......
......@@ -2,7 +2,7 @@ import {Component, OnDestroy, OnInit} from '@angular/core';
import {Subscription} from 'rxjs/Subscription';
import {FooterBarService} from '../../../../service/footer-bar.service';
import {ActivatedRoute, Router} from '@angular/router';
import {IQuestion} from '../../../../../lib/questions/interfaces';
import {IQuestion} from 'arsnova-click-v2-types/src/questions/interfaces';
import {CurrentQuizService} from '../../../../service/current-quiz.service';
import {DomSanitizer, SafeHtml} from '@angular/platform-browser';
import {QuestionTextService} from '../../../../service/question-text.service';
......
import {Component, EventEmitter, OnDestroy, OnInit} from '@angular/core';
import {FooterBarService} from '../../../service/footer-bar.service';
import {IQuestion} from '../../../../lib/questions/interfaces';
import {IQuestion} from 'arsnova-click-v2-types/src/questions/interfaces';
import {AttendeeService, INickname} from '../../../service/attendee.service';
import {IMessage} from '../quiz-lobby/quiz-lobby.component';
import {DefaultSettings} from '../../../../lib/default.settings';
......@@ -11,9 +11,9 @@ import {Router} from '@angular/router';
import {CurrentQuizService} from '../../../service/current-quiz.service';
import {I18nService, NumberTypes} from '../../../service/i18n.service';
import {QuestionTextService} from '../../../service/question-text.service';
import {RangedQuestion} from '../../../../lib/questions/question_ranged';
import {FreeTextQuestion} from '../../../../lib/questions/question_freetext';
import {SurveyQuestion} from '../../../../lib/questions/question_survey';
import {RangedQuestion} from 'arsnova-click-v2-types/src/questions/question_ranged';
import {FreeTextQuestion} from 'arsnova-click-v2-types/src/questions/question_freetext';
import {SurveyQuestion} from 'arsnova-click-v2-types/src/questions/question_survey';
export class Countdown {
get isRunning(): boolean {
......
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import {async, ComponentFixture, TestBed} from '@angular/core/testing';
import { ReadingConfirmationComponent } from './reading-confirmation.component';
import {ReadingConfirmationComponent} from './reading-confirmation.component';
describe('ReadingConfirmationComponent', () => {
let component: ReadingConfirmationComponent;
......
......@@ -8,14 +8,14 @@ import {Router} from '@angular/router';
import {AttendeeService} from '../../../service/attendee.service';
import {FooterBarService} from '../../../service/footer-bar.service';
import {ConnectionService} from '../../../service/connection.service';
import {SingleChoiceQuestion} from '../../../../lib/questions/question_choice_single';
import {SurveyQuestion} from '../../../../lib/questions/question_survey';
import {SingleChoiceQuestion} from 'arsnova-click-v2-types/src/questions/question_choice_single';
import {SurveyQuestion} from 'arsnova-click-v2-types/src/questions/question_survey';
import {QuestionTextService} from '../../../service/question-text.service';
import {DomSanitizer, SafeHtml} from '@angular/platform-browser';
import {HeaderLabelService} from '../../../service/header-label.service';
import {MultipleChoiceQuestion} from '../../../../lib/questions/question_choice_multiple';
import {RangedQuestion} from '../../../../lib/questions/question_ranged';
import {FreeTextQuestion} from '../../../../lib/questions/question_freetext';
import {MultipleChoiceQuestion} from 'arsnova-click-v2-types/src/questions/question_choice_multiple';
import {RangedQuestion} from 'arsnova-click-v2-types/src/questions/question_ranged';
import {FreeTextQuestion} from 'arsnova-click-v2-types/src/questions/question_freetext';
@Component({
selector: 'app-voting',
......
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import {async, ComponentFixture, TestBed} from '@angular/core/testing';
import { QuizJoinComponent } from './quiz-join.component';
import {QuizJoinComponent} from './quiz-join.component';
describe('QuizJoinComponent', () => {
let component: QuizJoinComponent;
......
......@@ -6,7 +6,7 @@ import {DefaultSettings} from '../../../lib/default.settings';
import {IMessage} from '../quiz-flow/quiz-lobby/quiz-lobby.component';
import {CasService} from '../../service/cas.service';
import {CurrentQuizService} from '../../service/current-quiz.service';
import {questionGroupReflection} from '../../../lib/questions/questionGroup_reflection';
import {questionGroupReflection} from 'arsnova-click-v2-types/src/questions/questionGroup_reflection';
import {ThemesService} from '../../service/themes.service';
@Component({
......@@ -32,7 +32,7 @@ export class QuizJoinComponent implements OnInit, OnDestroy {
this._routerSubscription = this.route.params.subscribe(params => {
const quizname = params.quizName;
this.http.get(`${DefaultSettings.httpApiEndpoint}/quiz/status/${quizname}`).subscribe((value: IMessage) => {
if (value.status === 'STATUS:SUCCESS' && value.step === 'QUIZ:AVAILABLE') {
if (value.status === 'STATUS:SUCCESSFUL' && value.step === 'QUIZ:AVAILABLE') {
this.casService.casLoginRequired = value.payload.authorizeViaCas;
if (this.casService.casLoginRequired) {
this.casService.quizName = quizname;
......
......@@ -2,7 +2,7 @@ import {Component, HostListener, OnDestroy, OnInit} from '@angular/core';
import {Subscription} from 'rxjs/Subscription';
import {ActiveQuestionGroupService} from '../../../../../service/active-question-group.service';
import {ActivatedRoute} from '@angular/router';
import {IQuestionChoice, IQuestionSurvey} from '../../../../../../lib/questions/interfaces';
import {IQuestionChoice, IQuestionSurvey} from 'arsnova-click-v2-types/src/questions/interfaces';
import {DEVICE_TYPES, LIVE_PREVIEW_ENVIRONMENT} from '../../../../../../environments/environment';
import {QuestionTextService} from '../../../../../service/question-text.service';
......
import {Component, HostListener, OnDestroy, OnInit} from '@angular/core';
import {Subscription} from 'rxjs/Subscription';
import {ActiveQuestionGroupService} from '../../../../../service/active-question-group.service';
import {TranslateService} from '@ngx-translate/core';
import {ActivatedRoute} from '@angular/router';
import {FreeTextAnswerOption} from '../../../../../../lib/answeroptions/answeroption_freetext';
import {IQuestion} from '../../../../../../lib/questions/interfaces';
import {IFreetextAnswerOption} from '../../../../../../lib/answeroptions/interfaces';
import {FreeTextAnswerOption} from 'arsnova-click-v2-types/src/answeroptions/answeroption_freetext';
import {IQuestion} from 'arsnova-click-v2-types/src/questions/interfaces';
import {IFreetextAnswerOption} from 'arsnova-click-v2-types/src/answeroptions/interfaces';
@Component({
selector: 'app-answeroptions-freetext',
......
import {Component, HostListener, OnDestroy, OnInit} from '@angular/core';
import {ActiveQuestionGroupService} from '../../../../../service/active-question-group.service';
import {Subscription} from 'rxjs/Subscription';
import {TranslateService} from '@ngx-translate/core';
import {ActivatedRoute} from '@angular/router';
import {IQuestionRanged} from '../../../../../../lib/questions/interfaces';
import {IQuestionRanged} from 'arsnova-click-v2-types/src/questions/interfaces';
@Component({
selector: 'app-answeroptions-ranged',
......
......@@ -3,7 +3,7 @@ import {Subscription} from 'rxjs/Subscription';
import {ActiveQuestionGroupService} from '../../../../service/active-question-group.service';
import {ActivatedRoute} from '@angular/router';
import {FooterBarService} from '../../../../service/footer-bar.service';
import {IQuestion} from '../../../../../lib/questions/interfaces';
import {IQuestion} from 'arsnova-click-v2-types/src/questions/interfaces';
@Component({
selector: 'app-answeroptions',
......
......@@ -4,7 +4,7 @@ import {ActiveQuestionGroupService} from '../../../../service/active-question-gr
import {TranslateService} from '@ngx-translate/core';
import {FooterBarService} from '../../../../service/footer-bar.service';
import {ActivatedRoute} from '@angular/router';
import {IQuestion} from '../../../../../lib/questions/interfaces';
import {IQuestion} from 'arsnova-click-v2-types/src/questions/interfaces';
@Component({
selector: 'app-countdown',
......
......@@ -4,7 +4,7 @@ import {TranslateService} from '@ngx-translate/core';
import {ActivatedRoute} from '@angular/router';
import {Subscription} from 'rxjs/Subscription';
import {FooterBarService} from '../../../../service/footer-bar.service';
import {IQuestion} from '../../../../../lib/questions/interfaces';
import {IQuestion} from 'arsnova-click-v2-types/src/questions/interfaces';
@Component({
selector: 'app-overview',
......
......@@ -4,8 +4,8 @@ import {TranslateService} from '@ngx-translate/core';
import {ActivatedRoute} from '@angular/router';
import {FooterBarService} from '../../../../service/footer-bar.service';
import {Subscription} from 'rxjs/Subscription';
import {questionReflection} from '../../../../../lib/questions/question_reflection';
import {IQuestion} from '../../../../../lib/questions/interfaces';
import {questionReflection} from 'arsnova-click-v2-types/src/questions/question_reflection';
import {IQuestion} from 'arsnova-click-v2-types/src/questions/interfaces';
@Component({
selector: 'app-questiontype',
......
......@@ -3,14 +3,14 @@ import {DOCUMENT} from '@angular/common';
import {FooterBarService} from '../../../service/footer-bar.service';
import {HeaderLabelService} from '../../../service/header-label.service';
import {ActiveQuestionGroupService} from '../../../service/active-question-group.service';
import {questionReflection} from '<