@sparkle-learning/core 0.0.53 → 0.0.54

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (140) hide show
  1. package/dist/cjs/{PrivateRoute-074c584e.js → PrivateRoute-e2047db2.js} +18 -30
  2. package/dist/cjs/{feed.service-b4f09441.js → appdata.service-d28cf2d6.js} +4 -56
  3. package/dist/cjs/{assets.service-0c759d51.js → assets.service-bfa75092.js} +1 -1
  4. package/dist/cjs/{environment-config.service-0e02b049.js → environment-config.service-c8ff1f3d.js} +0 -1
  5. package/dist/cjs/{facilitator.service-9e990274.js → facilitator.service-0b9f6ac7.js} +1 -1
  6. package/dist/cjs/feed.service-6df9382f.js +57 -0
  7. package/dist/cjs/header-mobile-collapse_61.cjs.entry.js +76 -87
  8. package/dist/cjs/{httpService-7211d93b.js → httpService-d8a5b474.js} +13 -11
  9. package/dist/cjs/index.cjs.js +5 -4
  10. package/dist/cjs/ion-select_3.cjs.entry.js +77 -68
  11. package/dist/cjs/loader.cjs.js +1 -1
  12. package/dist/cjs/media.service-2bc73d37.js +40 -0
  13. package/dist/cjs/{signalR.service-5672eebc.js → signalR.service-0d5da1d3.js} +18 -20
  14. package/dist/cjs/sparkle-animation-player.cjs.entry.js +1 -1
  15. package/dist/cjs/sparkle-assignment.cjs.entry.js +25 -0
  16. package/dist/cjs/sparkle-character-intro.cjs.entry.js +2 -2
  17. package/dist/cjs/sparkle-core.cjs.js +1 -1
  18. package/dist/cjs/sparkle-discussion-questions_2.cjs.entry.js +20 -11
  19. package/dist/cjs/sparkle-discussion.cjs.entry.js +6 -4
  20. package/dist/cjs/sparkle-facilitator-notes-form.cjs.entry.js +5 -3
  21. package/dist/cjs/sparkle-feedback.cjs.entry.js +5 -3
  22. package/dist/cjs/sparkle-goal-form.cjs.entry.js +11 -8
  23. package/dist/cjs/sparkle-quiz-container.cjs.entry.js +1 -1
  24. package/dist/cjs/sparkle-quiz-old.cjs.entry.js +120 -0
  25. package/dist/cjs/sparkle-quiz.cjs.entry.js +31 -48
  26. package/dist/cjs/{student.service-2e58f237.js → student.service-d8ec2551.js} +1 -1
  27. package/dist/cjs/token.service-bfb0089b.js +86 -0
  28. package/dist/cjs/{util-d383acb8.js → util-47e320b2.js} +2 -2
  29. package/dist/collection/PrivateRoute.js +2 -2
  30. package/dist/collection/collection-manifest.json +3 -2
  31. package/dist/collection/components/layout/facilitator/facilitator-page.js +2 -3
  32. package/dist/collection/components/layout/page/page.css +4 -0
  33. package/dist/collection/components/layout/page/page.js +39 -26
  34. package/dist/collection/components/sparkle-assignment/sparkle-assignment.css +3 -0
  35. package/dist/collection/components/sparkle-assignment/sparkle-assignment.js +25 -0
  36. package/dist/collection/components/sparkle-character-intro/sparkle-character-intro.css +8 -1
  37. package/dist/collection/components/sparkle-character-intro/sparkle-character-intro.js +10 -6
  38. package/dist/collection/components/sparkle-course-root/sparkle-course-root.js +13 -2
  39. package/dist/collection/components/sparkle-discussion/sparkle-discussion-questions/sparkle-discussion-questions.js +4 -2
  40. package/dist/collection/components/sparkle-discussion/sparkle-discussion-results/sparkle-discussion-results.js +15 -9
  41. package/dist/collection/components/sparkle-discussion/sparkle-discussion.css +5 -0
  42. package/dist/collection/components/sparkle-discussion/sparkle-discussion.js +5 -3
  43. package/dist/collection/components/sparkle-feed-post/sparkle-feed-post.js +54 -67
  44. package/dist/collection/components/sparkle-login/sparkle-login.js +2 -1
  45. package/dist/collection/components/sparkle-quiz/{sparkle-quiz/sparkle-quiz.css → sparkle-quiz-old/sparkle-quiz-old.css} +1 -1
  46. package/dist/collection/components/sparkle-quiz/{sparkle-quiz/sparkle-quiz.js → sparkle-quiz-old/sparkle-quiz-old.js} +4 -4
  47. package/dist/collection/components/sparkle-quiz/{sparkle-quiz-v1.js → sparkle-quiz.js} +23 -25
  48. package/dist/collection/components/sparkle-quiz-container/sparkle-quiz-container.js +1 -1
  49. package/dist/collection/components/sparkle-root/sparkle-root.js +12 -10
  50. package/dist/collection/services/assignment.service.js +14 -0
  51. package/dist/collection/services/auth/auth.service.js +15 -14
  52. package/dist/collection/services/environment/environment-config.js +1 -1
  53. package/dist/collection/services/environment/environment-config.service.js +0 -1
  54. package/dist/collection/services/httpService.js +12 -10
  55. package/dist/collection/services/signalR.service.js +17 -19
  56. package/dist/collection/services/token.service.js +68 -0
  57. package/dist/collection/util.js +5 -2
  58. package/dist/esm/{PrivateRoute-c5441f35.js → PrivateRoute-c6e80d5d.js} +17 -29
  59. package/dist/esm/{feed.service-8fbe4ce3.js → appdata.service-d1058e00.js} +5 -55
  60. package/dist/esm/{assets.service-66e848b8.js → assets.service-def1d63c.js} +1 -1
  61. package/dist/esm/{environment-config.service-2b5d692b.js → environment-config.service-b191f276.js} +0 -1
  62. package/dist/esm/{facilitator.service-b0292f7f.js → facilitator.service-53e05a01.js} +1 -1
  63. package/dist/esm/feed.service-8385ad7a.js +54 -0
  64. package/dist/esm/header-mobile-collapse_61.entry.js +70 -81
  65. package/dist/esm/{httpService-7b75b095.js → httpService-db476835.js} +13 -11
  66. package/dist/esm/index.js +5 -4
  67. package/dist/esm/ion-select_3.entry.js +77 -68
  68. package/dist/esm/loader.js +1 -1
  69. package/dist/esm/media.service-b68cbfff.js +37 -0
  70. package/dist/esm/{signalR.service-9d5b9f36.js → signalR.service-4a2d5a92.js} +18 -20
  71. package/dist/esm/sparkle-animation-player.entry.js +1 -1
  72. package/dist/esm/sparkle-assignment.entry.js +21 -0
  73. package/dist/esm/sparkle-character-intro.entry.js +3 -3
  74. package/dist/esm/sparkle-core.js +1 -1
  75. package/dist/esm/sparkle-discussion-questions_2.entry.js +20 -11
  76. package/dist/esm/sparkle-discussion.entry.js +6 -4
  77. package/dist/esm/sparkle-facilitator-notes-form.entry.js +5 -3
  78. package/dist/esm/sparkle-feedback.entry.js +5 -3
  79. package/dist/esm/sparkle-goal-form.entry.js +8 -5
  80. package/dist/esm/sparkle-quiz-container.entry.js +1 -1
  81. package/dist/esm/sparkle-quiz-old.entry.js +116 -0
  82. package/dist/esm/sparkle-quiz.entry.js +31 -48
  83. package/dist/esm/{student.service-0746418b.js → student.service-6457aaa0.js} +1 -1
  84. package/dist/esm/token.service-20f1a256.js +83 -0
  85. package/dist/esm/{util-6ef753e9.js → util-57cc8006.js} +2 -2
  86. package/dist/sparkle-core/index.esm.js +1 -1
  87. package/dist/sparkle-core/p-11ac00b0.js +1 -0
  88. package/dist/sparkle-core/p-13ec39db.entry.js +1 -0
  89. package/dist/sparkle-core/{p-5efc6566.js → p-17b6b07e.js} +1 -1
  90. package/dist/sparkle-core/p-33a7151d.entry.js +1 -0
  91. package/dist/sparkle-core/{p-fbccd30c.js → p-38f707fb.js} +1 -1
  92. package/dist/sparkle-core/p-38fa5987.js +1 -0
  93. package/dist/sparkle-core/{p-9a443f51.js → p-408176ba.js} +1 -1
  94. package/dist/sparkle-core/p-630a4fa0.js +1 -0
  95. package/dist/sparkle-core/{p-0a5d7c4f.entry.js → p-6a1fc0af.entry.js} +26 -26
  96. package/dist/sparkle-core/p-6fab3a4b.js +1 -0
  97. package/dist/sparkle-core/p-71720d6e.entry.js +1 -0
  98. package/dist/sparkle-core/{p-162bff1a.entry.js → p-72053ae0.entry.js} +1 -1
  99. package/dist/sparkle-core/{p-18cdd458.entry.js → p-85d4cd5c.entry.js} +1 -1
  100. package/dist/sparkle-core/p-967a2ed7.js +1 -0
  101. package/dist/sparkle-core/{p-ff0e0d4e.entry.js → p-98daeddb.entry.js} +1 -1
  102. package/dist/sparkle-core/p-98f7780c.entry.js +1 -0
  103. package/dist/sparkle-core/p-bd90903e.js +1 -0
  104. package/dist/sparkle-core/{p-a49ab4e8.entry.js → p-c64a34cd.entry.js} +1 -1
  105. package/dist/sparkle-core/{p-44334ef3.entry.js → p-ca907214.entry.js} +2 -2
  106. package/dist/sparkle-core/p-d51f30ca.js +1 -0
  107. package/dist/sparkle-core/p-dcff298d.entry.js +1 -0
  108. package/dist/sparkle-core/p-e50c8b04.entry.js +1 -0
  109. package/dist/sparkle-core/p-ed9de327.js +1 -0
  110. package/dist/sparkle-core/p-f891c79a.entry.js +1 -0
  111. package/dist/sparkle-core/sparkle-core.esm.js +1 -1
  112. package/dist/types/components/layout/page/page.d.ts +2 -0
  113. package/dist/types/components/sparkle-assignment/sparkle-assignment.d.ts +6 -0
  114. package/dist/types/components/sparkle-course-root/sparkle-course-root.d.ts +1 -0
  115. package/dist/types/components/sparkle-feed-post/sparkle-feed-post.d.ts +3 -2
  116. package/dist/types/components/sparkle-quiz/{sparkle-quiz/sparkle-quiz.d.ts → sparkle-quiz-old/sparkle-quiz-old.d.ts} +1 -1
  117. package/dist/types/components/sparkle-quiz/{sparkle-quiz-v1.d.ts → sparkle-quiz.d.ts} +1 -1
  118. package/dist/types/components.d.ts +49 -36
  119. package/dist/types/models/class.model.d.ts +4 -0
  120. package/dist/types/services/assignment.service.d.ts +8 -0
  121. package/dist/types/services/auth/auth.service.d.ts +1 -1
  122. package/dist/types/services/environment/environment-config.d.ts +3 -0
  123. package/dist/types/services/token.service.d.ts +12 -0
  124. package/dist/types/util.d.ts +1 -0
  125. package/package.json +1 -1
  126. package/dist/cjs/sparkle-quiz-v1.cjs.entry.js +0 -105
  127. package/dist/esm/sparkle-quiz-v1.entry.js +0 -101
  128. package/dist/sparkle-core/p-1d4c7c11.js +0 -1
  129. package/dist/sparkle-core/p-30767c1c.entry.js +0 -1
  130. package/dist/sparkle-core/p-3265ed87.entry.js +0 -1
  131. package/dist/sparkle-core/p-370609ba.entry.js +0 -1
  132. package/dist/sparkle-core/p-462bffba.js +0 -1
  133. package/dist/sparkle-core/p-4c9f994f.js +0 -1
  134. package/dist/sparkle-core/p-58e4bbe5.entry.js +0 -1
  135. package/dist/sparkle-core/p-600cf6a3.js +0 -1
  136. package/dist/sparkle-core/p-80d6b0e6.entry.js +0 -1
  137. package/dist/sparkle-core/p-af3cc111.entry.js +0 -1
  138. package/dist/sparkle-core/p-b226f54d.js +0 -1
  139. /package/dist/collection/components/sparkle-quiz/{sparkle-quiz-v1.css → sparkle-quiz.css} +0 -0
  140. /package/dist/sparkle-core/{p-935e7cfc.js → p-8b56f734.js} +0 -0
@@ -3,35 +3,26 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const index = require('./index-51e8292e.js');
6
+ const assets_service = require('./assets.service-bfa75092.js');
7
+ const environmentConfig_service = require('./environment-config.service-c8ff1f3d.js');
6
8
 
7
- const sparkleQuizCss = "sparkle-quiz{display:block;font-family:var(--font-family);--sparkle-quiz-question-container-padding:10px 0px;--sparkle-quiz-question-container-margin:0px;--sparkle-quiz-question-text-padding:10px 0px;--sparkle-quiz-option-border:2px solid var(--line-rule-color);--sparkle-quiz-selected-option-border:2px solid var(--text-color--dark);--sparkle-quiz-option-border-radius:4px;--sparkle-quiz-option-padding:5px 10px;--sparkle-quiz-option-width:100%;--sparkle-quiz-error-bg-color:#fbaeae;--sparkle-quiz-success-bg-color:#fbaeae;padding:var(--sparkle-quiz-question-container-padding);margin:var(--sparkle-quiz-question-container-margin)}.question-text{padding:var(--sparkle-quiz-question-text-padding)}.option{padding:5px 0px}.number{padding:0px 14px;border:1px solid #ebebeb;border-radius:4px;margin-right:10px;font-size:14px;width:14px;display:inline-flex;justify-content:center}.feedback-container{padding:10px;border-radius:4px}.incorrect .feedback-container{background-color:var(--sparkle-quiz-error-bg-color, #fbaeae)}.correct .feedback-container{background-color:var(--sparkle-quiz-success-bg-color, #fbaeae)}";
9
+ const sparkleQuizCss = "sparkle-quiz-v1{display:block;font-family:var(--font-family);--sparkle-quiz-question-container-padding:10px 0px;--sparkle-quiz-question-container-margin:0px;--sparkle-quiz-question-text-padding:10px 0px;--sparkle-quiz-option-border:2px solid var(--line-rule-color);--sparkle-quiz-selected-option-border:2px solid var(--text-color--dark);--sparkle-quiz-option-border-radius:4px;--sparkle-quiz-option-padding:5px 10px;--sparkle-quiz-option-width:100%;--sparkle-quiz-error-bg-color:#fbaeae;--sparkle-quiz-success-bg-color:#fbaeae;padding:var(--sparkle-quiz-question-container-padding);margin:var(--sparkle-quiz-question-container-margin)}.question-text{padding:var(--sparkle-quiz-question-text-padding)}.option{padding:5px 0px}.number{padding:0px 14px;border:1px solid #ebebeb;border-radius:4px;margin-right:10px;font-size:14px;width:14px;display:inline-flex;justify-content:center}.feedback-container{padding:10px;border-radius:4px}.incorrect .feedback-container{background-color:var(--sparkle-quiz-error-bg-color, #fbaeae)}.correct .feedback-container{background-color:var(--sparkle-quiz-success-bg-color, #fbaeae)}";
8
10
 
9
11
  const SparkleQuiz = class {
10
12
  constructor(hostRef) {
11
13
  index.registerInstance(this, hostRef);
12
14
  this.quizAnswerChanged = index.createEvent(this, "quizAnswerChanged", 7);
13
- this.type = 'TEXT';
14
- this.scale = 'FIVE-POINTS';
15
- this.options = [];
16
15
  }
17
- // private pageInfo: any;
18
- // @Watch('questionId')
19
- // async loadQuestion() {
20
- // if (this.quizData) {
21
- // this.question = this.quizData[+this.questionId];
22
- // }
23
- // }
24
- //@State() question: SparkleQuizQuestion;
25
- //@State() quizData: { [key: string]: SparkleQuizQuestion };
16
+ async loadQuestion() {
17
+ if (this.quizData) {
18
+ this.question = this.quizData[+this.questionId];
19
+ }
20
+ }
26
21
  async componentWillLoad() { }
27
22
  async componentDidLoad() {
28
- this.options = [];
29
- if (this.el.querySelector("[slot='options']")) {
30
- Array.from(this.el.querySelector("[slot='options']").querySelectorAll('option')).forEach(el => {
31
- this.options = [...this.options, { option: el.innerText }];
32
- });
33
- console.log(this.questionText, this.options);
34
- }
23
+ const config = environmentConfig_service.EnvironmentConfigService.getInstance().get('sparkle');
24
+ this.quizData = await assets_service.AssetsService.getInstance().loadJsonFile(config.quizPath);
25
+ await this.loadQuestion();
35
26
  this.quizAnswerChanged.emit({
36
27
  question: null,
37
28
  answer: '1',
@@ -62,58 +53,50 @@ const SparkleQuiz = class {
62
53
  });
63
54
  }
64
55
  getQuestionFeedback() {
65
- if (this.type == 'MULTIPLE-CHOICE') {
66
- // const feedbacks = this.question.options.filter(x => x.correct == true).map(x => x.feedback);
67
- // return feedbacks.length > 0 && feedbacks.map(feedback => <small>{feedback}</small>);
68
- return index.h("small", null);
56
+ if (this.question.questionType == 'MULTIPLE-CHOICE') {
57
+ const feedbacks = this.question.options.filter(x => x.correct == true).map(x => x.feedback);
58
+ return feedbacks.length > 0 && feedbacks.map(feedback => index.h("small", null, feedback));
69
59
  }
70
- else if (this.type == 'FEEDBACK' || this.type == 'TEXT') {
71
- return this.feedback && index.h("small", null, " ", this.feedback);
60
+ else if (this.question.questionType == 'FEEDBACK' || this.question.questionType == 'TEXT') {
61
+ return this.question.feedback && index.h("small", null, " ", this.question.feedback);
72
62
  }
73
63
  }
74
64
  showAnswerStatus() {
75
65
  return index.h("div", null, this.correct ? index.h("strong", null, "Good job!") : index.h("strong", null, "Incorrect answer, please try again."));
76
66
  }
77
67
  renderQuestion() {
78
- var question = {
79
- questionId: this.questionId,
80
- questionText: this.questionText,
81
- questionType: this.type,
82
- scale: this.scale,
83
- showOptionNumber: this.showOptionNumber,
84
- options: this.options,
85
- //options: Array<SparkleQuizQuestionOption>;
86
- feedback: this.feedback,
87
- };
88
- if (this.type == 'MULTIPLE-CHOICE') {
89
- return index.h("sparkle-quiz-select", { question: question, allowMultiple: true });
68
+ if (this.question.questionType == 'MULTIPLE-CHOICE') {
69
+ return index.h("sparkle-quiz-select", { question: this.question, allowMultiple: true });
90
70
  }
91
- else if (this.type == 'FEEDBACK') {
92
- return index.h("sparkle-quiz-feedback", { question: question });
71
+ else if (this.question.questionType == 'FEEDBACK') {
72
+ return index.h("sparkle-quiz-feedback", { question: this.question });
93
73
  }
94
- else if (this.type == 'TEXT') {
95
- return index.h("sparkle-quiz-input", { question: question });
74
+ else if (this.question.questionType == 'TEXT') {
75
+ return index.h("sparkle-quiz-input", { question: this.question });
96
76
  }
97
- else if (this.type == 'OPINION') {
98
- return index.h("sparkle-quiz-opinion", { question: question });
77
+ else if (this.question.questionType == 'OPINION') {
78
+ return index.h("sparkle-quiz-opinion", { question: this.question });
99
79
  }
100
- else if (this.type == 'POLL') {
101
- return index.h("sparkle-quiz-poll", { question: question });
80
+ else if (this.question.questionType == 'POLL') {
81
+ return index.h("sparkle-quiz-poll", { question: this.question });
102
82
  }
103
83
  }
104
84
  render() {
105
- if (this.questionText) {
85
+ if (this.question) {
106
86
  let classes = {
107
87
  correct: this.submitted && this.correct,
108
88
  incorrect: this.submitted && !this.correct,
109
89
  };
110
- return (index.h("div", { class: classes, ref: el => (this.containerRef = el) }, index.h("div", { hidden: true }, index.h("slot", null)), this.renderQuestion(), this.submitted && this.showInstantResult && index.h("div", { class: "feedback-container" }, [this.showAnswerStatus(), this.getQuestionFeedback()])));
90
+ return (index.h("div", { class: classes }, this.renderQuestion(), this.submitted && this.showInstantResult && index.h("div", { class: "feedback-container" }, [this.showAnswerStatus(), this.getQuestionFeedback()])));
111
91
  }
112
92
  else {
113
93
  return index.h("p", null, "No question found.");
114
94
  }
115
95
  }
116
96
  get el() { return index.getElement(this); }
97
+ static get watchers() { return {
98
+ "questionId": ["loadQuestion"]
99
+ }; }
117
100
  };
118
101
  SparkleQuiz.style = sparkleQuizCss;
119
102
 
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- const httpService = require('./httpService-7211d93b.js');
3
+ const httpService = require('./httpService-d8a5b474.js');
4
4
  const auth_store = require('./auth.store-1e630a7d.js');
5
5
 
6
6
  const { state, onChange, reset } = auth_store.createStore({
@@ -0,0 +1,86 @@
1
+ 'use strict';
2
+
3
+ const auth_store = require('./auth.store-1e630a7d.js');
4
+ const localstorage_service = require('./localstorage.service-6346a41d.js');
5
+
6
+ const AppConsts = {
7
+ AUTH_USER_LOCALSTORAGE: "CurrentUser",
8
+ userManagement: {
9
+ defaultAdminUserName: 'admin',
10
+ },
11
+ localization: {
12
+ defaultLocalizationSourceName: 'Test',
13
+ },
14
+ authorization: {
15
+ encrptedAuthTokenName: 'enc_auth_token',
16
+ }
17
+ };
18
+
19
+ class TokenService {
20
+ static getInstance() {
21
+ if (!TokenService.instance) {
22
+ TokenService.instance = new TokenService();
23
+ }
24
+ return TokenService.instance;
25
+ }
26
+ async getToken() {
27
+ let authUser = await localstorage_service.get(AppConsts.AUTH_USER_LOCALSTORAGE);
28
+ if (authUser && authUser.JWToken) {
29
+ if (new Date(authUser.ExpiresOn).getTime() > new Date().getTime()) {
30
+ return authUser.JWToken;
31
+ }
32
+ }
33
+ return null;
34
+ }
35
+ async getAuthUser() {
36
+ let authUser = await localstorage_service.get(AppConsts.AUTH_USER_LOCALSTORAGE);
37
+ if (authUser && authUser.JWToken) {
38
+ if (new Date(authUser.ExpiresOn).getTime() > new Date().getTime()) {
39
+ return authUser;
40
+ }
41
+ }
42
+ return null;
43
+ }
44
+ getAuthUserSync() {
45
+ let authUser = JSON.parse(localStorage.getItem(AppConsts.AUTH_USER_LOCALSTORAGE));
46
+ if (authUser && authUser.JWToken) {
47
+ if (new Date(authUser.ExpiresOn).getTime() > new Date().getTime()) {
48
+ return authUser;
49
+ }
50
+ }
51
+ return null;
52
+ }
53
+ getTokenSync() {
54
+ let authUser = JSON.parse(localStorage.getItem(AppConsts.AUTH_USER_LOCALSTORAGE));
55
+ if (authUser && authUser.JWToken) {
56
+ if (new Date(authUser.ExpiresOn).getTime() > new Date().getTime()) {
57
+ return authUser.JWToken;
58
+ }
59
+ }
60
+ return null;
61
+ }
62
+ async getTokenExpiry() {
63
+ let authUser = await localstorage_service.get(AppConsts.AUTH_USER_LOCALSTORAGE);
64
+ if (!authUser) {
65
+ return 0;
66
+ }
67
+ let timeDiff = 0;
68
+ if (authUser.ExpiresOn) {
69
+ timeDiff = new Date(authUser.ExpiresOn).getTime() - new Date().getTime();
70
+ }
71
+ return Math.max(0, timeDiff);
72
+ }
73
+ async saveAuthUser(authUser) {
74
+ auth_store.AuthStore.state.authUser = Object.assign({}, authUser);
75
+ auth_store.AuthStore.state.isAuthenticated = true;
76
+ await localstorage_service.set(AppConsts.AUTH_USER_LOCALSTORAGE, authUser);
77
+ }
78
+ async removeAuthUser() {
79
+ auth_store.AuthStore.state.authUser = null;
80
+ auth_store.AuthStore.state.isAuthenticated = false;
81
+ await localstorage_service.remove(AppConsts.AUTH_USER_LOCALSTORAGE);
82
+ }
83
+ }
84
+
85
+ exports.AppConsts = AppConsts;
86
+ exports.TokenService = TokenService;
@@ -2419,7 +2419,7 @@ function GetGoalAppData(title, description, category, percentage, goalText) {
2419
2419
  Description: description,
2420
2420
  Category: category,
2421
2421
  Percentage: percentage,
2422
- GoalText: goalText
2422
+ GoalText: goalText,
2423
2423
  };
2424
2424
  }
2425
2425
  function MyMoodTemplate(feeling, intensity, location) {
@@ -2445,7 +2445,7 @@ class SparkleGlobal {
2445
2445
  SparkleGlobal.MY_GOALS_APP_ID = 1;
2446
2446
  SparkleGlobal.MY_HEALTH_APP_ID = 2;
2447
2447
  SparkleGlobal.MY_MOOD_APP_ID = 3;
2448
- SparkleGlobal.LOCALSTORAGE_CLASSROOM_MODE = "SPARKLE_CLASSROOM_MODE";
2448
+ SparkleGlobal.LOCALSTORAGE_CLASSROOM_MODE = 'SPARKLE_CLASSROOM_MODE';
2449
2449
  function date(date) {
2450
2450
  return format(new Date(date), 'DD MMM YYYY');
2451
2451
  }
@@ -17,9 +17,9 @@ const Route = (_a) => {
17
17
  const Component = component;
18
18
  return (h("stencil-route", Object.assign({}, props, { routeRender: (props) => {
19
19
  if (!AuthStore.state.isAuthenticated)
20
- return (h("stencil-router-redirect", { url: "/login" }));
20
+ return h("stencil-router-redirect", { url: "/login" });
21
21
  if (permission && !isGranted(permission)) {
22
- return (h("stencil-router-redirect", { url: "/unauthorized" }));
22
+ return h("stencil-router-redirect", { url: "/unauthorized" });
23
23
  }
24
24
  return Component ? h(Component, Object.assign({}, props, props.componentProps)) : render(props);
25
25
  } })));
@@ -21,6 +21,7 @@
21
21
  "./components/mini-apps/sparkle-mood/sparkle-mood.js",
22
22
  "./components/modal-image/modal-image.js",
23
23
  "./components/sparkle-animation-player/sparkle-animation-player.js",
24
+ "./components/sparkle-assignment/sparkle-assignment.js",
24
25
  "./components/sparkle-character-intro/sparkle-character-intro.js",
25
26
  "./components/sparkle-compass/sparkle-compass.js",
26
27
  "./components/sparkle-compass/sparkle-compass-post/sparkle-compass-post.js",
@@ -35,10 +36,10 @@
35
36
  "./components/sparkle-intro/sparkle-intro.js",
36
37
  "./components/sparkle-login/sparkle-login.js",
37
38
  "./components/sparkle-poll/sparkle-poll.js",
38
- "./components/sparkle-quiz/sparkle-quiz-v1.js",
39
- "./components/sparkle-quiz/sparkle-quiz/sparkle-quiz.js",
39
+ "./components/sparkle-quiz/sparkle-quiz.js",
40
40
  "./components/sparkle-quiz/sparkle-quiz-feedback/sparkle-quiz-feedback.js",
41
41
  "./components/sparkle-quiz/sparkle-quiz-input/sparkle-quiz-input.js",
42
+ "./components/sparkle-quiz/sparkle-quiz-old/sparkle-quiz-old.js",
42
43
  "./components/sparkle-quiz/sparkle-quiz-opinion/sparkle-quiz-opinion.js",
43
44
  "./components/sparkle-quiz/sparkle-quiz-poll/sparkle-quiz-poll.js",
44
45
  "./components/sparkle-quiz/sparkle-quiz-select/sparkle-quiz-select.js",
@@ -71,7 +71,7 @@ export class FacilitatorPage {
71
71
  }
72
72
  path = /^\/docs\/pages\/[a-z]{2}\.json$/.test(path) ? path.replace('.json', '/index.json') : path;
73
73
  let lessonPath = this.getLessonPath(path);
74
- console.log(lessonPath);
74
+ console.log("lessonPath", lessonPath);
75
75
  return fetch(path).then(this.validateFetch).then(this.handleNotesPage).catch(this.handleBadFetch) &&
76
76
  fetch(lessonPath).then(this.validateFetch).then(this.handleLessonNotesPage).catch(this.handleLessonNotesBadFetch);
77
77
  }
@@ -84,7 +84,7 @@ export class FacilitatorPage {
84
84
  if (path === null || path === oldPath) {
85
85
  return;
86
86
  }
87
- if (SignalRService.getInstance().connection.connectionState == "Connected") {
87
+ if (SignalRService.getInstance().connection._connectionState == "Connected") {
88
88
  SignalRService.getInstance().callSignalR("NavigateFacilitatorPresentationCourseTo", { url: this.path.replace(".json", "") });
89
89
  }
90
90
  path = /^\/docs\/pages\/[a-z]{2}\.json$/.test(path) ? path.replace('.json', '/index.json') : path;
@@ -185,7 +185,6 @@ export class FacilitatorPage {
185
185
  return h(Template, { page: notesPage });
186
186
  }
187
187
  render() {
188
- console.log(facilitatorStore.state.classes);
189
188
  const { page } = this;
190
189
  const content = this.renderTabs();
191
190
  return h("div", { class: "container" },
@@ -177,3 +177,7 @@ sparkle-page .controls {
177
177
  display: flex;
178
178
  justify-content: flex-end;
179
179
  }
180
+
181
+ .controls ion-button ion-icon {
182
+ color: #fff;
183
+ }
@@ -3,7 +3,7 @@ import templates from './templates';
3
3
  import { modalController, alertController } from '@ionic/core';
4
4
  import { AuthStore } from '../../../stores/auth.store';
5
5
  import userStore from '../../../stores/user.store';
6
- import { StoreService } from "../../../services/store.service";
6
+ import { StoreService } from '../../../services/store.service';
7
7
  import { SignalRService } from '../../../services/signalR.service';
8
8
  import signalRStore from '../../../stores/signalR.store';
9
9
  export class SparklePage {
@@ -11,7 +11,15 @@ export class SparklePage {
11
11
  this.presentation = false;
12
12
  this.page = { title: null, path: null, body: null, pageInfo: null };
13
13
  this.isLesson = false;
14
- this.handleFacilitatorNavigationChange = (url) => {
14
+ this.eventEmitter = (user, data) => {
15
+ let event = new CustomEvent('receivedSignalREvent', { detail: JSON.parse(data) });
16
+ document.body.dispatchEvent(event);
17
+ };
18
+ this.pollSubmissionEventEmitter = (type, data) => {
19
+ let event = new CustomEvent('receivedPollSubmissionSignalREvent', { detail: { data: data, type: type } });
20
+ document.body.dispatchEvent(event);
21
+ };
22
+ this.handleFacilitatorNavigationChange = url => {
15
23
  this.history.replace(url, {});
16
24
  };
17
25
  this.validateFetch = (response) => {
@@ -24,7 +32,7 @@ export class SparklePage {
24
32
  this.badFetch = null;
25
33
  this.page = page;
26
34
  if (this.presentation) {
27
- this.page = Object.assign(Object.assign({}, this.page), { previousUrl: "/presentation" + this.page.previousUrl, nextUrl: "/presentation" + this.page.nextUrl });
35
+ this.page = Object.assign(Object.assign({}, this.page), { previousUrl: '/presentation' + this.page.previousUrl, nextUrl: '/presentation' + this.page.nextUrl });
28
36
  }
29
37
  StoreService.getInstance().UpdateTocPageInfo(this.page.pageInfo);
30
38
  this.isLesson = this.page.pageInfo.pageId > 0;
@@ -36,7 +44,7 @@ export class SparklePage {
36
44
  title: error.statusText,
37
45
  body: null,
38
46
  path: null,
39
- pageInfo: null
47
+ pageInfo: null,
40
48
  };
41
49
  };
42
50
  }
@@ -47,19 +55,25 @@ export class SparklePage {
47
55
  }
48
56
  componentDidLoad() {
49
57
  if (this.presentation) {
50
- signalRStore.onChange("connected", (connected) => {
58
+ signalRStore.onChange('connected', connected => {
51
59
  if (connected) {
52
- SignalRService.getInstance().connection.on("NavigateFacilitatorPresentationCourseTo", this.handleFacilitatorNavigationChange);
60
+ SignalRService.getInstance().connection.on('SendMessage', this.eventEmitter);
61
+ SignalRService.getInstance().connection.on('NavigateFacilitatorPresentationCourseTo', this.handleFacilitatorNavigationChange);
62
+ SignalRService.getInstance().connection.on('PollSubmission', this.pollSubmissionEventEmitter);
63
+ }
64
+ else {
65
+ SignalRService.getInstance().connection.off('SendMessage', this.eventEmitter);
66
+ SignalRService.getInstance().connection.off('PollSubmission', this.eventEmitter);
67
+ SignalRService.getInstance().connection.off('NavigateFacilitatorPresentationCourseTo', this.handleFacilitatorNavigationChange);
53
68
  }
54
69
  });
55
70
  }
56
71
  }
57
72
  fetchPage(path, oldPath) {
58
- if (SignalRService.getInstance().connection.connectionState == "Connected") {
59
- SignalRService.getInstance().callSignalR("OnStudentNavigate", { url: window.location.href });
73
+ if (SignalRService.getInstance().connection._connectionState == 'Connected') {
74
+ SignalRService.getInstance().callSignalR('OnStudentNavigate', { url: window.location.href });
60
75
  if (this.presentation) {
61
- console.log('register listener');
62
- SignalRService.getInstance().connection.on("NavigateFacilitatorPresentationCourseTo", this.handleFacilitatorNavigationChange);
76
+ SignalRService.getInstance().connection.on('NavigateFacilitatorPresentationCourseTo', this.handleFacilitatorNavigationChange);
63
77
  }
64
78
  }
65
79
  if (path === null || path === oldPath) {
@@ -130,7 +144,7 @@ export class SparklePage {
130
144
  async presentFeedbackModal() {
131
145
  const modal = await modalController.create({
132
146
  component: 'sparkle-feedback',
133
- cssClass: 'sparkle-modal sparkle-feedback-modal'
147
+ cssClass: 'sparkle-modal sparkle-feedback-modal',
134
148
  });
135
149
  await modal.present();
136
150
  }
@@ -161,22 +175,21 @@ export class SparklePage {
161
175
  text: 'Cancel',
162
176
  role: 'cancel',
163
177
  cssClass: 'secondary',
164
- handler: () => {
165
- }
166
- }, {
178
+ handler: () => { },
179
+ },
180
+ {
167
181
  text: 'Ok',
168
- handler: (data) => {
169
- }
170
- }
171
- ]
182
+ handler: data => { },
183
+ },
184
+ ],
172
185
  });
173
186
  await alert.present();
174
187
  }
175
188
  openWindows() {
176
189
  //this.jwtService.updateDefaultCourseClassId(data);
177
- window.open(window.location.origin + "/presentation" + this.path.replace(".json", ""), "_blank");
190
+ window.open(window.location.origin + '/presentation' + this.path.replace('.json', ''), '_blank');
178
191
  setTimeout(() => {
179
- window.open(window.location.origin + "/presentation" + '/teacher' + this.path.replace(".json", ""), "_blank");
192
+ window.open(window.location.origin + '/presentation' + '/teacher' + this.path.replace('.json', ''), '_blank');
180
193
  }, 500);
181
194
  }
182
195
  renderControls() {
@@ -184,10 +197,10 @@ export class SparklePage {
184
197
  return (h("div", { class: "controls" },
185
198
  h("ion-button", { onClick: () => this.presentFeedbackModal() },
186
199
  h("ion-icon", { name: "chatbox-outline" })),
187
- this.isLesson && userStore.state.user && userStore.state.user.Roles.indexOf('Facilitator') > -1 && h("ion-button", { onClick: () => this.openProjectorPage() },
188
- h("ion-icon", { name: "desktop-outline" }))));
200
+ this.isLesson && userStore.state.user && userStore.state.user.Roles.indexOf('Facilitator') > -1 && (h("ion-button", { onClick: () => this.openProjectorPage() },
201
+ h("ion-icon", { name: "desktop-outline" })))));
189
202
  }
190
- return "";
203
+ return '';
191
204
  }
192
205
  render() {
193
206
  if (this.path) {
@@ -199,13 +212,13 @@ export class SparklePage {
199
212
  const content = [
200
213
  h("main", { class: 'no-demo' },
201
214
  this.renderControls(),
202
- h(Template, { page: page }))
215
+ h(Template, { page: page })),
203
216
  ];
204
217
  return content;
205
218
  }
206
219
  else {
207
- return h("main", { class: 'no-demo' },
208
- h("slot", null));
220
+ return (h("main", { class: 'no-demo' },
221
+ h("slot", null)));
209
222
  }
210
223
  }
211
224
  static get is() { return "sparkle-page"; }
@@ -0,0 +1,3 @@
1
+ :host {
2
+ display: block;
3
+ }
@@ -0,0 +1,25 @@
1
+ import { Component, Element, State, Host, h } from '@stencil/core';
2
+ export class SparkleAssignment {
3
+ constructor() {
4
+ this.submitted = true;
5
+ }
6
+ async onSubmit(e) {
7
+ e.preventDefault();
8
+ this.submitted = true;
9
+ let isFormValid = true;
10
+ }
11
+ render() {
12
+ return h(Host, null, "Assignment");
13
+ }
14
+ static get is() { return "sparkle-assignment"; }
15
+ static get originalStyleUrls() { return {
16
+ "$": ["sparkle-assignment.scss"]
17
+ }; }
18
+ static get styleUrls() { return {
19
+ "$": ["sparkle-assignment.css"]
20
+ }; }
21
+ static get states() { return {
22
+ "submitted": {}
23
+ }; }
24
+ static get elementRef() { return "el"; }
25
+ }
@@ -8,6 +8,13 @@ sparkle-character-intro .character-phrase-block {
8
8
  align-items: center;
9
9
  padding: 20px;
10
10
  }
11
+ sparkle-character-intro.shift-up .character-phrase-block {
12
+ padding-top: 0px !important;
13
+ }
14
+ sparkle-character-intro.shift-up-overlap .character-phrase-block {
15
+ padding-top: 0px !important;
16
+ margin-top: -50px !important;
17
+ }
11
18
  sparkle-character-intro .character-phrase-block.right {
12
19
  justify-content: flex-end;
13
20
  }
@@ -21,7 +28,7 @@ sparkle-character-intro .character-phrase-block.left .character-image-block {
21
28
  order: 1;
22
29
  }
23
30
  sparkle-character-intro .character-box {
24
- min-width: 300px;
31
+ width: 80%;
25
32
  border-radius: 15px;
26
33
  background: var(--sparkle-character-background-color);
27
34
  color: var(--text-color);
@@ -1,4 +1,4 @@
1
- import { Component, Element, Prop, getAssetPath, h } from '@stencil/core';
1
+ import { Component, Element, Prop, getAssetPath, Host, h } from '@stencil/core';
2
2
  export class SparkleCharacterIntro {
3
3
  constructor() {
4
4
  this.character = 'jen';
@@ -8,11 +8,12 @@ export class SparkleCharacterIntro {
8
8
  console.log(this.character);
9
9
  }
10
10
  render() {
11
- return (h("div", { class: `character-phrase-block ${this.position}` },
12
- h("div", { class: `character-box ${this.position}` },
13
- h("slot", null)),
14
- h("div", { class: `character-image-block ${this.position}` },
15
- h("img", { class: "image-animation", src: getAssetPath('./assets/characters/' + this.character + '.png') }))));
11
+ return (h(Host, null,
12
+ h("div", { class: `character-phrase-block ${this.position}` },
13
+ h("div", { class: `character-box ${this.position}` },
14
+ h("slot", null)),
15
+ h("div", { class: `character-image-block ${this.position}` },
16
+ h("img", { class: "image-animation", src: getAssetPath('./assets/characters/' + this.character + '.png') })))));
16
17
  }
17
18
  static get is() { return "sparkle-character-intro"; }
18
19
  static get originalStyleUrls() { return {
@@ -62,3 +63,6 @@ export class SparkleCharacterIntro {
62
63
  }; }
63
64
  static get elementRef() { return "el"; }
64
65
  }
66
+ //README
67
+ //To set custom margin top use following class selector
68
+ //sparkle-character-intro.shift-up-overlap .character-phrase-block { maring-top:-100px !important;}
@@ -1,4 +1,4 @@
1
- import { Component, State, Event, Watch, Build, h } from '@stencil/core';
1
+ import { Component, State, Event, Watch, Build, h, Listen } from '@stencil/core';
2
2
  import { injectHistory } from '@stencil/router';
3
3
  import { PrivateRoute } from '../../PrivateRoute';
4
4
  import { AssetsService } from '../../services/core/assets.service';
@@ -14,7 +14,7 @@ export class SparkleCourseRoot {
14
14
  this.config = {
15
15
  appUrl: 'http://localhost:3333',
16
16
  globalAssetsUrl: 'http://localhost:3333/assets',
17
- apiUrl: 'https://localhost:44399/',
17
+ apiUrl: 'https://localhost:44369/',
18
18
  quizPath: this.quizPath,
19
19
  tocPath: this.tocPath,
20
20
  menu: {
@@ -63,6 +63,10 @@ export class SparkleCourseRoot {
63
63
  var sidebar = document.getElementById('onlineStudents');
64
64
  await sidebar.show();
65
65
  }
66
+ useDidLogin(event) {
67
+ console.log('Received the userDidLogInevent: ', event.detail);
68
+ return h("stencil-router-redirect", { url: "/home" });
69
+ }
66
70
  renderPage(path) {
67
71
  return (h("stencil-route", { url: '/' + path, routeRender: props => [
68
72
  this.renderHeaderAndMenu(),
@@ -181,5 +185,12 @@ export class SparkleCourseRoot {
181
185
  "propName": "isMenuToggled",
182
186
  "methodName": "lockScroll"
183
187
  }]; }
188
+ static get listeners() { return [{
189
+ "name": "userDidLogIn",
190
+ "method": "useDidLogin",
191
+ "target": undefined,
192
+ "capture": false,
193
+ "passive": false
194
+ }]; }
184
195
  }
185
196
  injectHistory(SparkleCourseRoot);
@@ -23,9 +23,10 @@ export class SparkleDiscussionQuestions {
23
23
  //console.log(question, option);
24
24
  SignalRService.getInstance().callSignalR('PollSubmission', {
25
25
  questionId: question.questionId,
26
- question: question.question,
26
+ question: question.questionText,
27
27
  answer: option.option,
28
- responseType: question.responseType,
28
+ responseType: question.questionType,
29
+ pageUrl: window.location.href,
29
30
  });
30
31
  }
31
32
  addSuggestion(evt, question) {
@@ -39,6 +40,7 @@ export class SparkleDiscussionQuestions {
39
40
  question: question.questionText,
40
41
  answer: inputVal.value,
41
42
  responseType: question.questionType,
43
+ pageUrl: window.location.href,
42
44
  });
43
45
  // this.dataSvc.callSignalR(
44
46
  // {