@sparkle-learning/core 0.0.53 → 0.0.55

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 (177) hide show
  1. package/dist/cjs/{PrivateRoute-074c584e.js → PrivateRoute-f97245ce.js} +18 -30
  2. package/dist/cjs/{feed.service-b4f09441.js → appdata.service-c8d71e05.js} +4 -56
  3. package/dist/cjs/{assets.service-0c759d51.js → assets.service-bfa75092.js} +1 -1
  4. package/dist/cjs/assignment.service-690fb59c.js +19 -0
  5. package/dist/cjs/{environment-config.service-0e02b049.js → environment-config.service-c8ff1f3d.js} +0 -1
  6. package/dist/cjs/{facilitator.service-9e990274.js → facilitator.service-ff0e1659.js} +1 -1
  7. package/dist/cjs/feed.service-8eca4de6.js +57 -0
  8. package/dist/cjs/header-mobile-collapse_61.cjs.entry.js +76 -87
  9. package/dist/cjs/{httpService-7211d93b.js → httpService-d2e7bf8f.js} +13 -11
  10. package/dist/cjs/index.cjs.js +5 -4
  11. package/dist/cjs/{ion-action-sheet_4.cjs.entry.js → ion-action-sheet_7.cjs.entry.js} +728 -0
  12. package/dist/cjs/loader.cjs.js +1 -1
  13. package/dist/cjs/media.service-8a1b9bc5.js +40 -0
  14. package/dist/cjs/{signalR.service-5672eebc.js → signalR.service-bd6b42f9.js} +18 -20
  15. package/dist/cjs/sparkle-animation-player.cjs.entry.js +1 -1
  16. package/dist/cjs/sparkle-assignment.cjs.entry.js +110 -0
  17. package/dist/cjs/sparkle-character-intro.cjs.entry.js +2 -2
  18. package/dist/cjs/sparkle-core.cjs.js +1 -1
  19. package/dist/cjs/sparkle-discussion-questions_2.cjs.entry.js +20 -11
  20. package/dist/cjs/sparkle-discussion.cjs.entry.js +6 -4
  21. package/dist/cjs/sparkle-facilitator-notes-form.cjs.entry.js +5 -3
  22. package/dist/cjs/sparkle-feed-post.cjs.entry.js +116 -0
  23. package/dist/cjs/sparkle-feedback.cjs.entry.js +5 -3
  24. package/dist/cjs/sparkle-file-upload.cjs.entry.js +53 -0
  25. package/dist/cjs/sparkle-goal-form.cjs.entry.js +11 -8
  26. package/dist/cjs/sparkle-input.cjs.entry.js +56 -0
  27. package/dist/cjs/sparkle-quiz-container.cjs.entry.js +1 -1
  28. package/dist/cjs/sparkle-quiz-old.cjs.entry.js +120 -0
  29. package/dist/cjs/sparkle-quiz.cjs.entry.js +31 -48
  30. package/dist/cjs/{student.service-2e58f237.js → student.service-7e5385be.js} +1 -1
  31. package/dist/cjs/token.service-7a41953d.js +97 -0
  32. package/dist/cjs/{util-d383acb8.js → util-47e320b2.js} +2 -2
  33. package/dist/collection/PrivateRoute.js +2 -2
  34. package/dist/collection/collection-manifest.json +5 -2
  35. package/dist/collection/components/layout/facilitator/facilitator-page.js +2 -3
  36. package/dist/collection/components/layout/page/page.css +4 -0
  37. package/dist/collection/components/layout/page/page.js +39 -26
  38. package/dist/collection/components/sparkle-assignment/sparkle-assignment.css +30 -0
  39. package/dist/collection/components/sparkle-assignment/sparkle-assignment.js +159 -0
  40. package/dist/collection/components/sparkle-character-intro/sparkle-character-intro.css +8 -1
  41. package/dist/collection/components/sparkle-character-intro/sparkle-character-intro.js +10 -6
  42. package/dist/collection/components/sparkle-course-root/sparkle-course-root.js +13 -2
  43. package/dist/collection/components/sparkle-discussion/sparkle-discussion-questions/sparkle-discussion-questions.js +4 -2
  44. package/dist/collection/components/sparkle-discussion/sparkle-discussion-results/sparkle-discussion-results.js +15 -9
  45. package/dist/collection/components/sparkle-discussion/sparkle-discussion.css +5 -0
  46. package/dist/collection/components/sparkle-discussion/sparkle-discussion.js +5 -3
  47. package/dist/collection/components/sparkle-feed-post/sparkle-feed-post.js +54 -75
  48. package/dist/collection/components/sparkle-file-upload/sparkle-file-upload.css +0 -0
  49. package/dist/collection/components/sparkle-file-upload/sparkle-file-upload.js +105 -0
  50. package/dist/collection/components/sparkle-input/sparkle-input.css +0 -0
  51. package/dist/collection/components/sparkle-input/sparkle-input.js +212 -0
  52. package/dist/collection/components/sparkle-login/sparkle-login.js +2 -1
  53. package/dist/collection/components/sparkle-quiz/{sparkle-quiz/sparkle-quiz.css → sparkle-quiz-old/sparkle-quiz-old.css} +1 -1
  54. package/dist/collection/components/sparkle-quiz/{sparkle-quiz/sparkle-quiz.js → sparkle-quiz-old/sparkle-quiz-old.js} +4 -4
  55. package/dist/collection/components/sparkle-quiz/{sparkle-quiz-v1.js → sparkle-quiz.js} +23 -25
  56. package/dist/collection/components/sparkle-quiz-container/sparkle-quiz-container.js +1 -1
  57. package/dist/collection/components/sparkle-root/sparkle-root.js +12 -10
  58. package/dist/collection/services/assignment.service.js +14 -0
  59. package/dist/collection/services/auth/auth.service.js +15 -14
  60. package/dist/collection/services/environment/environment-config.js +1 -1
  61. package/dist/collection/services/environment/environment-config.service.js +0 -1
  62. package/dist/collection/services/httpService.js +12 -10
  63. package/dist/collection/services/signalR.service.js +17 -19
  64. package/dist/collection/services/token.service.js +79 -0
  65. package/dist/collection/util.js +5 -2
  66. package/dist/esm/{PrivateRoute-c5441f35.js → PrivateRoute-90ac95b8.js} +17 -29
  67. package/dist/esm/{feed.service-8fbe4ce3.js → appdata.service-2e84e167.js} +5 -55
  68. package/dist/esm/{assets.service-66e848b8.js → assets.service-def1d63c.js} +1 -1
  69. package/dist/esm/assignment.service-8d31f141.js +17 -0
  70. package/dist/esm/{environment-config.service-2b5d692b.js → environment-config.service-b191f276.js} +0 -1
  71. package/dist/esm/{facilitator.service-b0292f7f.js → facilitator.service-18c47bdf.js} +1 -1
  72. package/dist/esm/feed.service-b4f3cae4.js +54 -0
  73. package/dist/esm/header-mobile-collapse_61.entry.js +71 -82
  74. package/dist/esm/{httpService-7b75b095.js → httpService-7986aeed.js} +14 -12
  75. package/dist/esm/index.js +6 -5
  76. package/dist/esm/{ion-action-sheet_4.entry.js → ion-action-sheet_7.entry.js} +729 -4
  77. package/dist/esm/ion-loading.entry.js +1 -1
  78. package/dist/esm/ion-menu.entry.js +1 -1
  79. package/dist/esm/ion-modal.entry.js +1 -1
  80. package/dist/esm/ion-picker.entry.js +1 -1
  81. package/dist/esm/ion-toast.entry.js +1 -1
  82. package/dist/esm/loader.js +1 -1
  83. package/dist/esm/media.service-6e90bc41.js +37 -0
  84. package/dist/esm/{overlays-3b4dca92.js → overlays-4233a39d.js} +1 -1
  85. package/dist/esm/{signalR.service-9d5b9f36.js → signalR.service-c33fba50.js} +18 -20
  86. package/dist/esm/sparkle-animation-player.entry.js +1 -1
  87. package/dist/esm/sparkle-assignment.entry.js +106 -0
  88. package/dist/esm/sparkle-character-intro.entry.js +3 -3
  89. package/dist/esm/sparkle-core.js +1 -1
  90. package/dist/esm/sparkle-discussion-questions_2.entry.js +20 -11
  91. package/dist/esm/sparkle-discussion.entry.js +6 -4
  92. package/dist/esm/sparkle-facilitator-notes-form.entry.js +6 -4
  93. package/dist/esm/sparkle-feed-post.entry.js +112 -0
  94. package/dist/esm/sparkle-feedback.entry.js +6 -4
  95. package/dist/esm/sparkle-file-upload.entry.js +49 -0
  96. package/dist/esm/sparkle-goal-form.entry.js +9 -6
  97. package/dist/esm/sparkle-input.entry.js +52 -0
  98. package/dist/esm/sparkle-quiz-container.entry.js +1 -1
  99. package/dist/esm/sparkle-quiz-old.entry.js +116 -0
  100. package/dist/esm/sparkle-quiz.entry.js +31 -48
  101. package/dist/esm/{student.service-0746418b.js → student.service-08af124f.js} +1 -1
  102. package/dist/esm/token.service-71a5d33f.js +94 -0
  103. package/dist/esm/{util-6ef753e9.js → util-57cc8006.js} +2 -2
  104. package/dist/sparkle-core/index.esm.js +1 -1
  105. package/dist/sparkle-core/p-08420531.entry.js +1 -0
  106. package/dist/sparkle-core/p-08cca80d.entry.js +1 -0
  107. package/dist/sparkle-core/p-0e8e539f.entry.js +1 -0
  108. package/dist/sparkle-core/p-13ec39db.entry.js +1 -0
  109. package/dist/sparkle-core/p-1adc98f6.js +1 -0
  110. package/dist/sparkle-core/p-38c842d5.entry.js +1 -0
  111. package/dist/sparkle-core/{p-fbccd30c.js → p-39a31e43.js} +1 -1
  112. package/dist/sparkle-core/{p-0a5d7c4f.entry.js → p-3daf2915.entry.js} +26 -26
  113. package/dist/sparkle-core/{p-9a443f51.js → p-408176ba.js} +1 -1
  114. package/dist/sparkle-core/p-42ed7d5f.entry.js +1 -0
  115. package/dist/sparkle-core/p-4b4a8703.js +1 -0
  116. package/dist/sparkle-core/p-4d1cfcbe.entry.js +1 -0
  117. package/dist/sparkle-core/p-4fba3e4c.js +1 -0
  118. package/dist/sparkle-core/{p-54dd894f.entry.js → p-6bde0192.entry.js} +1 -1
  119. package/dist/sparkle-core/{p-6faa194c.entry.js → p-6d2f4093.entry.js} +1 -1
  120. package/dist/sparkle-core/{p-162bff1a.entry.js → p-72053ae0.entry.js} +1 -1
  121. package/dist/sparkle-core/p-7dae0f0e.js +1 -0
  122. package/dist/sparkle-core/{p-18cdd458.entry.js → p-85d4cd5c.entry.js} +1 -1
  123. package/dist/sparkle-core/p-973fe404.entry.js +22 -0
  124. package/dist/sparkle-core/{p-ff0e0d4e.entry.js → p-98daeddb.entry.js} +1 -1
  125. package/dist/sparkle-core/p-b06e2bef.js +1 -0
  126. package/dist/sparkle-core/{p-e863bf1d.entry.js → p-b6fec622.entry.js} +1 -1
  127. package/dist/sparkle-core/p-b8d71ff4.js +1 -0
  128. package/dist/sparkle-core/p-bd90903e.js +1 -0
  129. package/dist/sparkle-core/{p-a49ab4e8.entry.js → p-c64a34cd.entry.js} +1 -1
  130. package/dist/sparkle-core/{p-5efc6566.js → p-c9f753a4.js} +1 -1
  131. package/dist/sparkle-core/p-da391f3f.js +1 -0
  132. package/dist/sparkle-core/p-e0cad1bb.js +1 -0
  133. package/dist/sparkle-core/{p-ce4b22f7.entry.js → p-f196c124.entry.js} +1 -1
  134. package/dist/sparkle-core/p-f47fe1fe.entry.js +1 -0
  135. package/dist/sparkle-core/p-f714f77a.entry.js +1 -0
  136. package/dist/sparkle-core/p-f891c79a.entry.js +1 -0
  137. package/dist/sparkle-core/{p-377b04c2.entry.js → p-ff080f82.entry.js} +1 -1
  138. package/dist/sparkle-core/{p-2ff67662.js → p-ff7a8a71.js} +1 -1
  139. package/dist/sparkle-core/sparkle-core.esm.js +1 -1
  140. package/dist/types/components/layout/page/page.d.ts +2 -0
  141. package/dist/types/components/sparkle-assignment/sparkle-assignment.d.ts +16 -0
  142. package/dist/types/components/sparkle-course-root/sparkle-course-root.d.ts +1 -0
  143. package/dist/types/components/sparkle-feed-post/sparkle-feed-post.d.ts +4 -3
  144. package/dist/types/components/sparkle-file-upload/sparkle-file-upload.d.ts +15 -0
  145. package/dist/types/components/sparkle-input/sparkle-input.d.ts +23 -0
  146. package/dist/types/components/sparkle-quiz/{sparkle-quiz/sparkle-quiz.d.ts → sparkle-quiz-old/sparkle-quiz-old.d.ts} +1 -1
  147. package/dist/types/components/sparkle-quiz/{sparkle-quiz-v1.d.ts → sparkle-quiz.d.ts} +1 -1
  148. package/dist/types/components.d.ts +111 -36
  149. package/dist/types/models/class.model.d.ts +4 -0
  150. package/dist/types/services/assignment.service.d.ts +8 -0
  151. package/dist/types/services/auth/auth.service.d.ts +1 -1
  152. package/dist/types/services/environment/environment-config.d.ts +3 -0
  153. package/dist/types/services/token.service.d.ts +13 -0
  154. package/dist/types/util.d.ts +1 -0
  155. package/package.json +1 -1
  156. package/dist/cjs/ion-select_3.cjs.entry.js +0 -618
  157. package/dist/cjs/ion-textarea.cjs.entry.js +0 -248
  158. package/dist/cjs/sparkle-quiz-v1.cjs.entry.js +0 -105
  159. package/dist/esm/ion-select_3.entry.js +0 -612
  160. package/dist/esm/ion-textarea.entry.js +0 -244
  161. package/dist/esm/sparkle-quiz-v1.entry.js +0 -101
  162. package/dist/sparkle-core/p-0f1c5899.entry.js +0 -18
  163. package/dist/sparkle-core/p-1d4c7c11.js +0 -1
  164. package/dist/sparkle-core/p-30767c1c.entry.js +0 -1
  165. package/dist/sparkle-core/p-3265ed87.entry.js +0 -1
  166. package/dist/sparkle-core/p-370609ba.entry.js +0 -1
  167. package/dist/sparkle-core/p-44334ef3.entry.js +0 -4
  168. package/dist/sparkle-core/p-462bffba.js +0 -1
  169. package/dist/sparkle-core/p-4c9f994f.js +0 -1
  170. package/dist/sparkle-core/p-58e4bbe5.entry.js +0 -1
  171. package/dist/sparkle-core/p-600cf6a3.js +0 -1
  172. package/dist/sparkle-core/p-641bfc92.entry.js +0 -1
  173. package/dist/sparkle-core/p-80d6b0e6.entry.js +0 -1
  174. package/dist/sparkle-core/p-af3cc111.entry.js +0 -1
  175. package/dist/sparkle-core/p-b226f54d.js +0 -1
  176. /package/dist/collection/components/sparkle-quiz/{sparkle-quiz-v1.css → sparkle-quiz.css} +0 -0
  177. /package/dist/sparkle-core/{p-935e7cfc.js → p-8b56f734.js} +0 -0
@@ -0,0 +1,52 @@
1
+ import { r as registerInstance, i as createEvent, h } from './index-c04b9ed5.js';
2
+
3
+ const sparkleInputCss = "";
4
+
5
+ const SparkleInput = class {
6
+ constructor(hostRef) {
7
+ registerInstance(this, hostRef);
8
+ this.valueChanged = createEvent(this, "valueChanged", 7);
9
+ this.checkedChanged = createEvent(this, "checkedChanged", 7);
10
+ }
11
+ arrayDataWatcher(newValue) {
12
+ if (typeof newValue === 'string') {
13
+ this._options = JSON.parse(newValue);
14
+ }
15
+ else {
16
+ this._options = newValue;
17
+ }
18
+ }
19
+ componentWillLoad() {
20
+ if (this.type == 'select') {
21
+ this.arrayDataWatcher(this.options);
22
+ }
23
+ }
24
+ handleChange(event) {
25
+ const value = this.type === 'checkbox' ? event.target.checked : event.target.value;
26
+ this.value = value;
27
+ this.valueChanged.emit(value);
28
+ if (this.type === 'checkbox') {
29
+ this.checkedChanged.emit(value);
30
+ }
31
+ }
32
+ render() {
33
+ switch (this.type) {
34
+ case 'text' :
35
+ return (h("div", null, h("ion-item", null, h("ion-label", null, this.label), h("ion-input", { type: this.type, value: this.value, placeholder: this.placeholder, onInput: (event) => this.handleChange(event), required: true }))));
36
+ case 'textarea':
37
+ return (h("div", null, h("ion-item", null, h("ion-label", null, this.label), h("ion-textarea", { value: this.value, placeholder: this.placeholder, onInput: (event) => this.handleChange(event), required: true }))));
38
+ case 'checkbox':
39
+ return (h("div", null, h("ion-item", null, h("ion-checkbox", { slot: "start", checked: this.checked, onChange: (event) => this.handleChange(event) }), h("ion-label", null, this.label))));
40
+ case 'select':
41
+ return (h("div", null, h("ion-item", null, h("ion-select", { value: this.value, placeholder: this.label, onIonChange: event => this.handleChange(event) }, this._options.map(option => (h("ion-select-option", { key: option.value, value: option.value }, option.label)))))));
42
+ default:
43
+ return null;
44
+ }
45
+ }
46
+ static get watchers() { return {
47
+ "options": ["arrayDataWatcher"]
48
+ }; }
49
+ };
50
+ SparkleInput.style = sparkleInputCss;
51
+
52
+ export { SparkleInput as sparkle_input };
@@ -35,7 +35,7 @@ const SparkleQuizContainer = class {
35
35
  //post api
36
36
  }
37
37
  render() {
38
- return (h(Host, null, this.questionIds && this.questionIds.split(",").map((id => h("sparkle-quiz", { questionId: +id, submitted: this.submitted, showInstantResult: this.showInstantResult }))), h("ion-button", { slot: "end", onClick: () => this.submitQuiz() }, "Submit")));
38
+ return (h(Host, null, this.questionIds && this.questionIds.split(",").map((id => h("sparkle-quiz-v1", { questionId: +id, submitted: this.submitted, showInstantResult: this.showInstantResult }))), h("ion-button", { slot: "end", onClick: () => this.submitQuiz() }, "Submit")));
39
39
  }
40
40
  };
41
41
  SparkleQuizContainer.style = sparkleQuizContainerCss;
@@ -0,0 +1,116 @@
1
+ import { r as registerInstance, i as createEvent, h, e as getElement } from './index-c04b9ed5.js';
2
+
3
+ const sparkleQuizOldCss = "sparkle-quiz-old{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)}";
4
+
5
+ const SparkleQuizOld = class {
6
+ constructor(hostRef) {
7
+ registerInstance(this, hostRef);
8
+ this.quizAnswerChanged = createEvent(this, "quizAnswerChanged", 7);
9
+ this.type = 'TEXT';
10
+ this.scale = 'FIVE-POINTS';
11
+ this.options = [];
12
+ }
13
+ // private pageInfo: any;
14
+ // @Watch('questionId')
15
+ // async loadQuestion() {
16
+ // if (this.quizData) {
17
+ // this.question = this.quizData[+this.questionId];
18
+ // }
19
+ // }
20
+ //@State() question: SparkleQuizQuestion;
21
+ //@State() quizData: { [key: string]: SparkleQuizQuestion };
22
+ async componentWillLoad() { }
23
+ async componentDidLoad() {
24
+ this.options = [];
25
+ if (this.el.querySelector("[slot='options']")) {
26
+ Array.from(this.el.querySelector("[slot='options']").querySelectorAll('option')).forEach(el => {
27
+ this.options = [...this.options, { option: el.innerText }];
28
+ });
29
+ console.log(this.questionText, this.options);
30
+ }
31
+ this.quizAnswerChanged.emit({
32
+ question: null,
33
+ answer: '1',
34
+ });
35
+ }
36
+ quizInputChangeHandler(event) {
37
+ this.quizAnswerChanged.emit({
38
+ question: event.detail.question,
39
+ answer: event.detail.value,
40
+ });
41
+ }
42
+ quizFeedbackChangeHandler(event) {
43
+ this.quizAnswerChanged.emit({
44
+ question: event.detail.question,
45
+ answer: event.detail.value,
46
+ });
47
+ }
48
+ quizSelectChangeHandler(event) {
49
+ this.quizAnswerChanged.emit({
50
+ question: event.detail.question,
51
+ answer: event.detail.value,
52
+ });
53
+ }
54
+ quizOpinionChangeHandler(event) {
55
+ this.quizAnswerChanged.emit({
56
+ question: event.detail.question,
57
+ answer: event.detail.value,
58
+ });
59
+ }
60
+ getQuestionFeedback() {
61
+ if (this.type == 'MULTIPLE-CHOICE') {
62
+ // const feedbacks = this.question.options.filter(x => x.correct == true).map(x => x.feedback);
63
+ // return feedbacks.length > 0 && feedbacks.map(feedback => <small>{feedback}</small>);
64
+ return h("small", null);
65
+ }
66
+ else if (this.type == 'FEEDBACK' || this.type == 'TEXT') {
67
+ return this.feedback && h("small", null, " ", this.feedback);
68
+ }
69
+ }
70
+ showAnswerStatus() {
71
+ return h("div", null, this.correct ? h("strong", null, "Good job!") : h("strong", null, "Incorrect answer, please try again."));
72
+ }
73
+ renderQuestion() {
74
+ var question = {
75
+ questionId: this.questionId,
76
+ questionText: this.questionText,
77
+ questionType: this.type,
78
+ scale: this.scale,
79
+ showOptionNumber: this.showOptionNumber,
80
+ options: this.options,
81
+ //options: Array<SparkleQuizQuestionOption>;
82
+ feedback: this.feedback,
83
+ };
84
+ if (this.type == 'MULTIPLE-CHOICE') {
85
+ return h("sparkle-quiz-select", { question: question, allowMultiple: true });
86
+ }
87
+ else if (this.type == 'FEEDBACK') {
88
+ return h("sparkle-quiz-feedback", { question: question });
89
+ }
90
+ else if (this.type == 'TEXT') {
91
+ return h("sparkle-quiz-input", { question: question });
92
+ }
93
+ else if (this.type == 'OPINION') {
94
+ return h("sparkle-quiz-opinion", { question: question });
95
+ }
96
+ else if (this.type == 'POLL') {
97
+ return h("sparkle-quiz-poll", { question: question });
98
+ }
99
+ }
100
+ render() {
101
+ if (this.questionText) {
102
+ let classes = {
103
+ correct: this.submitted && this.correct,
104
+ incorrect: this.submitted && !this.correct,
105
+ };
106
+ return (h("div", { class: classes, ref: el => (this.containerRef = el) }, h("div", { hidden: true }, h("slot", null)), this.renderQuestion(), this.submitted && this.showInstantResult && h("div", { class: "feedback-container" }, [this.showAnswerStatus(), this.getQuestionFeedback()])));
107
+ }
108
+ else {
109
+ return h("p", null, "No question found.");
110
+ }
111
+ }
112
+ get el() { return getElement(this); }
113
+ };
114
+ SparkleQuizOld.style = sparkleQuizOldCss;
115
+
116
+ export { SparkleQuizOld as sparkle_quiz_old };
@@ -1,33 +1,24 @@
1
1
  import { r as registerInstance, i as createEvent, h, e as getElement } from './index-c04b9ed5.js';
2
+ import { A as AssetsService } from './assets.service-def1d63c.js';
3
+ import { E as EnvironmentConfigService } from './environment-config.service-b191f276.js';
2
4
 
3
- 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)}";
5
+ 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)}";
4
6
 
5
7
  const SparkleQuiz = class {
6
8
  constructor(hostRef) {
7
9
  registerInstance(this, hostRef);
8
10
  this.quizAnswerChanged = createEvent(this, "quizAnswerChanged", 7);
9
- this.type = 'TEXT';
10
- this.scale = 'FIVE-POINTS';
11
- this.options = [];
12
11
  }
13
- // private pageInfo: any;
14
- // @Watch('questionId')
15
- // async loadQuestion() {
16
- // if (this.quizData) {
17
- // this.question = this.quizData[+this.questionId];
18
- // }
19
- // }
20
- //@State() question: SparkleQuizQuestion;
21
- //@State() quizData: { [key: string]: SparkleQuizQuestion };
12
+ async loadQuestion() {
13
+ if (this.quizData) {
14
+ this.question = this.quizData[+this.questionId];
15
+ }
16
+ }
22
17
  async componentWillLoad() { }
23
18
  async componentDidLoad() {
24
- this.options = [];
25
- if (this.el.querySelector("[slot='options']")) {
26
- Array.from(this.el.querySelector("[slot='options']").querySelectorAll('option')).forEach(el => {
27
- this.options = [...this.options, { option: el.innerText }];
28
- });
29
- console.log(this.questionText, this.options);
30
- }
19
+ const config = EnvironmentConfigService.getInstance().get('sparkle');
20
+ this.quizData = await AssetsService.getInstance().loadJsonFile(config.quizPath);
21
+ await this.loadQuestion();
31
22
  this.quizAnswerChanged.emit({
32
23
  question: null,
33
24
  answer: '1',
@@ -58,58 +49,50 @@ const SparkleQuiz = class {
58
49
  });
59
50
  }
60
51
  getQuestionFeedback() {
61
- if (this.type == 'MULTIPLE-CHOICE') {
62
- // const feedbacks = this.question.options.filter(x => x.correct == true).map(x => x.feedback);
63
- // return feedbacks.length > 0 && feedbacks.map(feedback => <small>{feedback}</small>);
64
- return h("small", null);
52
+ if (this.question.questionType == 'MULTIPLE-CHOICE') {
53
+ const feedbacks = this.question.options.filter(x => x.correct == true).map(x => x.feedback);
54
+ return feedbacks.length > 0 && feedbacks.map(feedback => h("small", null, feedback));
65
55
  }
66
- else if (this.type == 'FEEDBACK' || this.type == 'TEXT') {
67
- return this.feedback && h("small", null, " ", this.feedback);
56
+ else if (this.question.questionType == 'FEEDBACK' || this.question.questionType == 'TEXT') {
57
+ return this.question.feedback && h("small", null, " ", this.question.feedback);
68
58
  }
69
59
  }
70
60
  showAnswerStatus() {
71
61
  return h("div", null, this.correct ? h("strong", null, "Good job!") : h("strong", null, "Incorrect answer, please try again."));
72
62
  }
73
63
  renderQuestion() {
74
- var question = {
75
- questionId: this.questionId,
76
- questionText: this.questionText,
77
- questionType: this.type,
78
- scale: this.scale,
79
- showOptionNumber: this.showOptionNumber,
80
- options: this.options,
81
- //options: Array<SparkleQuizQuestionOption>;
82
- feedback: this.feedback,
83
- };
84
- if (this.type == 'MULTIPLE-CHOICE') {
85
- return h("sparkle-quiz-select", { question: question, allowMultiple: true });
64
+ if (this.question.questionType == 'MULTIPLE-CHOICE') {
65
+ return h("sparkle-quiz-select", { question: this.question, allowMultiple: true });
86
66
  }
87
- else if (this.type == 'FEEDBACK') {
88
- return h("sparkle-quiz-feedback", { question: question });
67
+ else if (this.question.questionType == 'FEEDBACK') {
68
+ return h("sparkle-quiz-feedback", { question: this.question });
89
69
  }
90
- else if (this.type == 'TEXT') {
91
- return h("sparkle-quiz-input", { question: question });
70
+ else if (this.question.questionType == 'TEXT') {
71
+ return h("sparkle-quiz-input", { question: this.question });
92
72
  }
93
- else if (this.type == 'OPINION') {
94
- return h("sparkle-quiz-opinion", { question: question });
73
+ else if (this.question.questionType == 'OPINION') {
74
+ return h("sparkle-quiz-opinion", { question: this.question });
95
75
  }
96
- else if (this.type == 'POLL') {
97
- return h("sparkle-quiz-poll", { question: question });
76
+ else if (this.question.questionType == 'POLL') {
77
+ return h("sparkle-quiz-poll", { question: this.question });
98
78
  }
99
79
  }
100
80
  render() {
101
- if (this.questionText) {
81
+ if (this.question) {
102
82
  let classes = {
103
83
  correct: this.submitted && this.correct,
104
84
  incorrect: this.submitted && !this.correct,
105
85
  };
106
- return (h("div", { class: classes, ref: el => (this.containerRef = el) }, h("div", { hidden: true }, h("slot", null)), this.renderQuestion(), this.submitted && this.showInstantResult && h("div", { class: "feedback-container" }, [this.showAnswerStatus(), this.getQuestionFeedback()])));
86
+ return (h("div", { class: classes }, this.renderQuestion(), this.submitted && this.showInstantResult && h("div", { class: "feedback-container" }, [this.showAnswerStatus(), this.getQuestionFeedback()])));
107
87
  }
108
88
  else {
109
89
  return h("p", null, "No question found.");
110
90
  }
111
91
  }
112
92
  get el() { return getElement(this); }
93
+ static get watchers() { return {
94
+ "questionId": ["loadQuestion"]
95
+ }; }
113
96
  };
114
97
  SparkleQuiz.style = sparkleQuizCss;
115
98
 
@@ -1,4 +1,4 @@
1
- import { H as HttpService } from './httpService-7b75b095.js';
1
+ import { H as HttpService } from './httpService-7986aeed.js';
2
2
  import { d as createStore } from './auth.store-dba2c2da.js';
3
3
 
4
4
  const { state, onChange, reset } = createStore({
@@ -0,0 +1,94 @@
1
+ import { A as AuthStore } from './auth.store-dba2c2da.js';
2
+ import { g as get, s as set, r as remove } from './localstorage.service-4bf408c8.js';
3
+
4
+ const AppConsts = {
5
+ AUTH_USER_LOCALSTORAGE: "CurrentUser",
6
+ userManagement: {
7
+ defaultAdminUserName: 'admin',
8
+ },
9
+ localization: {
10
+ defaultLocalizationSourceName: 'Test',
11
+ },
12
+ authorization: {
13
+ encrptedAuthTokenName: 'enc_auth_token',
14
+ }
15
+ };
16
+
17
+ class TokenService {
18
+ static getInstance() {
19
+ if (!TokenService.instance) {
20
+ TokenService.instance = new TokenService();
21
+ }
22
+ return TokenService.instance;
23
+ }
24
+ async getToken() {
25
+ let authUser = await get(AppConsts.AUTH_USER_LOCALSTORAGE);
26
+ if (authUser && authUser.JWToken) {
27
+ if (new Date(authUser.ExpiresOn).getTime() > new Date().getTime()) {
28
+ return authUser.JWToken;
29
+ }
30
+ }
31
+ return null;
32
+ }
33
+ async getAuthUser() {
34
+ let authUser = await get(AppConsts.AUTH_USER_LOCALSTORAGE);
35
+ if (authUser && authUser.JWToken) {
36
+ if (new Date(authUser.ExpiresOn).getTime() > new Date().getTime()) {
37
+ return authUser;
38
+ }
39
+ }
40
+ return null;
41
+ }
42
+ getAuthUserSync() {
43
+ let authUser = JSON.parse(localStorage.getItem(AppConsts.AUTH_USER_LOCALSTORAGE));
44
+ if (authUser && authUser.JWToken) {
45
+ if (new Date(authUser.ExpiresOn).getTime() > new Date().getTime()) {
46
+ return authUser;
47
+ }
48
+ }
49
+ return null;
50
+ }
51
+ getTokenSync() {
52
+ let authUser = JSON.parse(localStorage.getItem(AppConsts.AUTH_USER_LOCALSTORAGE));
53
+ if (authUser && authUser.JWToken) {
54
+ if (new Date(authUser.ExpiresOn).getTime() > new Date().getTime()) {
55
+ return authUser.JWToken;
56
+ }
57
+ }
58
+ return null;
59
+ }
60
+ isAuthenticated() {
61
+ try {
62
+ let token = this.getTokenSync();
63
+ if (!!token) {
64
+ return true;
65
+ }
66
+ }
67
+ catch (_a) {
68
+ return false;
69
+ }
70
+ }
71
+ async getTokenExpiry() {
72
+ let authUser = await get(AppConsts.AUTH_USER_LOCALSTORAGE);
73
+ if (!authUser) {
74
+ return 0;
75
+ }
76
+ let timeDiff = 0;
77
+ if (authUser.ExpiresOn) {
78
+ timeDiff = new Date(authUser.ExpiresOn).getTime() - new Date().getTime();
79
+ }
80
+ return Math.max(0, timeDiff);
81
+ }
82
+ async saveAuthUser(authUser) {
83
+ AuthStore.state.authUser = Object.assign({}, authUser);
84
+ AuthStore.state.isAuthenticated = true;
85
+ await set(AppConsts.AUTH_USER_LOCALSTORAGE, authUser);
86
+ }
87
+ async removeAuthUser() {
88
+ AuthStore.state.authUser = null;
89
+ AuthStore.state.isAuthenticated = false;
90
+ await remove(AppConsts.AUTH_USER_LOCALSTORAGE);
91
+ }
92
+ }
93
+
94
+ export { AppConsts as A, TokenService as T };
@@ -2417,7 +2417,7 @@ function GetGoalAppData(title, description, category, percentage, goalText) {
2417
2417
  Description: description,
2418
2418
  Category: category,
2419
2419
  Percentage: percentage,
2420
- GoalText: goalText
2420
+ GoalText: goalText,
2421
2421
  };
2422
2422
  }
2423
2423
  function MyMoodTemplate(feeling, intensity, location) {
@@ -2443,7 +2443,7 @@ class SparkleGlobal {
2443
2443
  SparkleGlobal.MY_GOALS_APP_ID = 1;
2444
2444
  SparkleGlobal.MY_HEALTH_APP_ID = 2;
2445
2445
  SparkleGlobal.MY_MOOD_APP_ID = 3;
2446
- SparkleGlobal.LOCALSTORAGE_CLASSROOM_MODE = "SPARKLE_CLASSROOM_MODE";
2446
+ SparkleGlobal.LOCALSTORAGE_CLASSROOM_MODE = 'SPARKLE_CLASSROOM_MODE';
2447
2447
  function date(date) {
2448
2448
  return format(new Date(date), 'DD MMM YYYY');
2449
2449
  }
@@ -1 +1 @@
1
- export{A as AuthService,P as PrivateRoute,i as initSetupEnvironmentConfig,s as setupEnvironmentConfig}from"./p-462bffba.js";export{E as EnvironmentConfigService}from"./p-b226f54d.js";export{A as AssetsService}from"./p-9a443f51.js";export{A as AuthStore}from"./p-2f569553.js";import"./p-ee1e0eb4.js";import"./p-5d409601.js";import"./p-1d4c7c11.js";import"./p-2ff67662.js";import"./p-871106e0.js";import"./p-add30d46.js";import"./p-d68092b7.js";
1
+ export{A as AuthService,P as PrivateRoute,i as initSetupEnvironmentConfig,s as setupEnvironmentConfig}from"./p-e0cad1bb.js";export{E as EnvironmentConfigService}from"./p-bd90903e.js";export{A as AssetsService}from"./p-408176ba.js";export{A as AuthStore}from"./p-2f569553.js";import"./p-ee1e0eb4.js";import"./p-5d409601.js";import"./p-b06e2bef.js";import"./p-ff7a8a71.js";import"./p-871106e0.js";import"./p-add30d46.js";import"./p-d68092b7.js";import"./p-7dae0f0e.js";
@@ -0,0 +1 @@
1
+ import{r as t,i as e,h as i}from"./p-ee1e0eb4.js";const s=class{constructor(i){t(this,i),this.valueChanged=e(this,"valueChanged",7),this.checkedChanged=e(this,"checkedChanged",7)}arrayDataWatcher(t){this._options="string"==typeof t?JSON.parse(t):t}componentWillLoad(){"select"==this.type&&this.arrayDataWatcher(this.options)}handleChange(t){const e="checkbox"===this.type?t.target.checked:t.target.value;this.value=e,this.valueChanged.emit(e),"checkbox"===this.type&&this.checkedChanged.emit(e)}render(){switch(this.type){case"text":return i("div",null,i("ion-item",null,i("ion-label",null,this.label),i("ion-input",{type:this.type,value:this.value,placeholder:this.placeholder,onInput:t=>this.handleChange(t),required:!0})));case"textarea":return i("div",null,i("ion-item",null,i("ion-label",null,this.label),i("ion-textarea",{value:this.value,placeholder:this.placeholder,onInput:t=>this.handleChange(t),required:!0})));case"checkbox":return i("div",null,i("ion-item",null,i("ion-checkbox",{slot:"start",checked:this.checked,onChange:t=>this.handleChange(t)}),i("ion-label",null,this.label)));case"select":return i("div",null,i("ion-item",null,i("ion-select",{value:this.value,placeholder:this.label,onIonChange:t=>this.handleChange(t)},this._options.map((t=>i("ion-select-option",{key:t.value,value:t.value},t.label))))));default:return null}}static get watchers(){return{options:["arrayDataWatcher"]}}};s.style="";export{s as sparkle_input}
@@ -0,0 +1 @@
1
+ import{r as s,h as t,H as i,e}from"./p-ee1e0eb4.js";import{A as o}from"./p-4fba3e4c.js";import{F as n}from"./p-b8d71ff4.js";import{M as a}from"./p-1adc98f6.js";import{T as l}from"./p-7dae0f0e.js";import{S as r}from"./p-8b56f734.js";import"./p-b06e2bef.js";import"./p-2f569553.js";import"./p-ff7a8a71.js";import"./p-871106e0.js";import"./p-add30d46.js";import"./p-d68092b7.js";import"./p-bd90903e.js";import"./p-5d409601.js";const p=class{constructor(t){s(this,t)}componentDidLoad(){this.postText=this.textValue,this.ref&&this.ref.innerText&&(this.assignmentName=this.ref.innerText,console.log(this.assignmentName))}setText(s){this.postText=s}isAuthenticated(){return l.getInstance().isAuthenticated()}async submitPost(){this.postLoading=!0,this.errorMessage="",this.successMessage="";var s=this.el.getElementsByClassName("PostExternalUrl")[0],t=this.el.getElementsByClassName("IsPublic")[0],i={PostText:this.postText,IsPublic:t.checked,ExternalResourceUrl:s.value,MiniAppId:r.MY_GOALS_APP_ID,AssignmentName:this.assignmentName,AssignmentData:"",PostTextJSON:null};if((await n.getInstance().createPost(i)).Succeeded?(this.postLoading=!1,this.successMessage="Posted Successfully.",this.postText="",this.externalResourceUrl="",this.uploadedImage=""):(this.postLoading=!1,this.errorMessage="There is an error while posting to feed."),this.assignmentName){var e={AssignmentData:JSON.stringify({text:i.PostText,url:i.ExternalResourceUrl}),AssignmentName:this.assignmentName};await o.getInstance().createAssignment(e)}}async uploadImage(s){this.uploadImageLoading=!0;var t=s.target.files;let i=await a.getInstance().uploadImage(t);i.Succeeded?(console.log(i),this.uploadImageLoading=!1,this.uploadedImage=i.Data.length>0?i.Data[0].FullImageUrl:"",this.externalResourceUrl=i.Data.length>0?i.Data[0].FullImageUrl:""):(this.uploadImageLoading=!1,this.errorMessage="There is an error while uploading an image.")}selectFile(){this.el.querySelector("#fileInput").click()}renderUserInfo(){let s=l.getInstance().getAuthUserSync();return s&&s.JWToken?t("ion-avatar",{class:"header-avatar",slot:"end"},t("img",s.PhotoUrl?{src:s.PhotoUrl}:{src:"/assets/img/user.png"})):t("ion-button",{slot:"end",href:"/login"},"Login to Post")}render(){const s=this.renderUserInfo();return t(i,null,t("div",{class:"assignment-name",ref:s=>this.ref=s},t("slot",null)),t("ion-card",null,t("ion-item",{class:"header",lines:"full"},s),t("ion-card-content",null,t("form",null,t("ion-list",null,t("ion-item",{class:"padding"},t("ion-textarea",{class:"PostText",required:!0,placeholder:"Post Text",name:"PostText",value:this.postText})),t("ion-item",{class:"padding"},t("ion-input",{class:"PostExternalUrl",required:!0,type:"text",placeholder:"URL",name:"ExternalResourceUrl",value:this.externalResourceUrl})),this.uploadedImage?t("ion-item",{class:"ion-padding",lines:"none"},t("img",{class:"uploaded-image",src:this.uploadedImage})):"",t("ion-item",{lines:"none"},t("input",{type:"file",id:"fileInput",onChange:s=>this.uploadImage(s),style:{display:"none"},accept:"image/*"}),this.uploadImageLoading?t("ion-spinner",{color:"primary"}):"",t("ion-button",{slot:"start",onClick:()=>this.selectFile()},t("ion-icon",{name:"add"}),"Upload Image")),t("div",{class:"public-post-toggle"},t("ion-toggle",{class:"IsPublic",color:"primary",name:"IsPublic"}),t("div",null,"Public Post")),t("div",{class:"post-footer-container"},t("div",{class:"post-footer"},t("div",null,t("div",{class:"error"},this.errorMessage),t("div",{class:"success"},this.successMessage)),t("div",null,this.postLoading?t("ion-spinner",{color:"primary"}):""),t("ion-button",{slot:"end",size:"default",onClick:()=>this.submitPost(),disabled:this.postLoading||!this.isAuthenticated()},"Post"))))))))}get el(){return e(this)}};p.style=":host{display:block}.post-footer-container{display:flex;justify-content:flex-end}.post-footer{display:flex;justify-content:space-between;align-items:center}.error{color:red;margin-right:10px}.success{color:green;margin-right:10px}.uploaded-image{display:block;max-height:140px;width:auto !important}.public-post-toggle{display:flex;justify-content:flex-end;align-items:center}.assignment-name{display:none}";export{p as sparkle_feed_post}
@@ -0,0 +1 @@
1
+ import{r as i,i as t,h as s,H as e,e as o}from"./p-ee1e0eb4.js";import{M as p}from"./p-1adc98f6.js";import"./p-b06e2bef.js";import"./p-2f569553.js";import"./p-ff7a8a71.js";import"./p-871106e0.js";import"./p-add30d46.js";import"./p-d68092b7.js";import"./p-bd90903e.js";import"./p-7dae0f0e.js";import"./p-5d409601.js";const a=class{constructor(s){i(this,s),this.fileUploaded=t(this,"fileUploaded",7),this.uploadImageLoading=!1}componentDidLoad(){}async uploadImage(i){this.uploadImageLoading=!0;var t=i.target.files;let s=await p.getInstance().uploadImage(t);s.Succeeded?(console.log(s),this.uploadImageLoading=!1,this.uploadedImage=s.Data.length>0?s.Data[0].FullImageUrl:"",this.value=this.uploadedImage,this.fileUploaded.emit(this.uploadedImage)):(this.uploadImageLoading=!1,this.errorMessage="There is an error while uploading an image.")}selectFile(){this.el.shadowRoot.querySelector("#fileInput").click()}render(){return s(e,null,this.uploadedImage?s("ion-item",{class:"ion-padding",lines:"none"},s("img",{class:"uploaded-image",src:this.uploadedImage})):"",s("ion-item",{lines:"none"},s("input",{type:"file",id:"fileInput",onChange:i=>this.uploadImage(i),style:{display:"none"},accept:"image/*,application/pdf,application/msword,application/vnd.ms-excel,application/vnd.ms-powerpoint,text/plain"}),this.uploadImageLoading?s("ion-spinner",{color:"primary"}):"",s("ion-button",{slot:"start",onClick:()=>this.selectFile()},s("ion-icon",{name:"add"}),"Upload Image")))}get el(){return o(this)}};a.style="";export{a as sparkle_file_upload}
@@ -0,0 +1 @@
1
+ import{r,h as a,c as t,H as e,e as c}from"./p-ee1e0eb4.js";const o=class{constructor(a){r(this,a),this.character="jen",this.position="right"}componentDidLoad(){console.log(this.character)}render(){return a(e,null,a("div",{class:`character-phrase-block ${this.position}`},a("div",{class:`character-box ${this.position}`},a("slot",null)),a("div",{class:`character-image-block ${this.position}`},a("img",{class:"image-animation",src:t("./assets/characters/"+this.character+".png")}))))}static get assetsDirs(){return["assets"]}get el(){return c(this)}};o.style='sparkle-character-intro{--sparkle-character-background-color:#e7e7e7}sparkle-character-intro .character-phrase-block{display:flex;width:100%;min-height:200px;align-items:center;padding:20px}sparkle-character-intro.shift-up .character-phrase-block{padding-top:0px !important}sparkle-character-intro.shift-up-overlap .character-phrase-block{padding-top:0px !important;margin-top:-50px !important}sparkle-character-intro .character-phrase-block.right{justify-content:flex-end}sparkle-character-intro .character-phrase-block.left{justify-content:flex-start}sparkle-character-intro .character-phrase-block.left .character-box{order:2}sparkle-character-intro .character-phrase-block.left .character-image-block{order:1}sparkle-character-intro .character-box{width:80%;border-radius:15px;background:var(--sparkle-character-background-color);color:var(--text-color);padding:20px;text-align:center;position:relative;box-shadow:0px 1px 3px rgba(2, 8, 20, 0.06), 0px 1px 2px rgba(2, 8, 20, 0.04)}sparkle-character-intro .character-box.right:before{content:"";width:0px;height:0px;position:absolute;border-left:15px solid var(--sparkle-character-background-color);border-right:15px solid transparent;border-top:15px solid var(--sparkle-character-background-color);border-bottom:15px solid transparent;right:-16px;top:0px}sparkle-character-intro .character-box.left:before{content:"";width:0px;height:0px;position:absolute;border-left:15px solid transparent;border-right:15px solid var(--sparkle-character-background-color);border-top:15px solid var(--sparkle-character-background-color);border-bottom:15px solid transparent;left:-16px;top:0px}sparkle-character-intro img{max-width:100%;border:0}sparkle-character-intro .character-image-block{float:left;width:20%}sparkle-character-intro .character-image-block.right{transform:rotateY(180deg)}';export{o as sparkle_character_intro}
@@ -0,0 +1 @@
1
+ import{H as t}from"./p-b06e2bef.js";import{d as a}from"./p-2f569553.js";const{state:e,reset:s}=a({mediaUploading:!1}),r={state:e,reset:s};class o{constructor(){}static getInstance(){return o.instance||(o.instance=new o),o.instance}async uploadImage(a){let e,s=new FormData;for(let t=0;t<a.length;t++)s.append("uploads[]",a[t],a[t].name);r.state.mediaUploading=!0;try{e=await t.http.post("api/v1/MediaItems/Upload",s),e&&(r.state.mediaUploading=!1)}catch(t){r.state.mediaUploading=!1}return e}}export{o as M,r as m}
@@ -0,0 +1 @@
1
+ import{h as t,r as s,H as e,e as i}from"./p-ee1e0eb4.js";import{t as a}from"./p-ff7a8a71.js";import{F as o,f as l}from"./p-39a31e43.js";import"./p-871106e0.js";import"./p-add30d46.js";import"./p-d68092b7.js";import"./p-b06e2bef.js";import"./p-2f569553.js";import"./p-bd90903e.js";import"./p-7dae0f0e.js";import"./p-5d409601.js";const r=()=>t("div",{class:"spinner-border",role:"status"}),n=class{constructor(t){s(this,t),this.formControls={noteText:{isValid:!0,value:"",errorMessage:"",validate:t=>(console.log(t),t&&t.length>0?{valid:!0,errorMessage:""}:{valid:!1,errorMessage:"Notes is required"})}},this.submitted=!1}componentDidLoad(){this.initialValues&&this.changeFormValue("noteText",this.initialValues.NoteText)}async onSubmit(t){t.preventDefault(),this.submitted=!0;let s=!0;for(let t in this.formControls){let e=this.formControls[t];e.isValid=e.validate(e.value).valid,e.errorMessage=e.validate(e.value).errorMessage,e.isValid||(s=!1)}if(s)if(this.initialValues&&this.initialValues.Id>0){let t=await o.getInstance().updateFacilitatorNote({NoteText:this.formControls.noteText.value,Id:this.initialValues.Id});t.Succeeded?((await a.create({message:"Notes updated successfully",duration:3e3})).present(),this.dismiss()):(await a.create({message:t.Message,duration:3e3})).present()}else{let t=await o.getInstance().addFacilitatorNote({NoteText:this.formControls.noteText.value});t.Succeeded?((await a.create({message:"Notes added successfully",duration:3e3})).present(),this.dismiss()):(await a.create({message:t.Message,duration:3e3})).present()}}dismiss(t){this.el.closest("ion-modal").dismiss({dismissed:!0})}changeFormValue(t,s){this.formControls=Object.assign(Object.assign({},this.formControls),{[t]:Object.assign(Object.assign({},this.formControls[t]),{value:s,isValid:this.formControls[t].validate(s).valid,errorMessage:this.formControls[t].validate(s).errorMessage})})}render(){const s=this.formControls.noteText.isValid?"is-valid":"is-invalid";return t(e,null,t("ion-header",{translucent:!0},t("ion-toolbar",null,t("ion-title",null,"Facilitator Note"),t("ion-buttons",{slot:"end"},t("ion-button",{onClick:()=>this.dismiss()},"Close")))),t("ion-content",{class:"ion-padding"},t("form",{onSubmit:t=>this.onSubmit(t),novalidate:!0},t("div",{class:"mb-3"},t("label",{htmlFor:"validationTextarea",class:"form-label"},"Notes"),t("textarea",{class:`form-control ${this.submitted&&s}`,placeholder:"Notes",value:this.formControls.noteText.value,onChange:t=>this.changeFormValue("noteText",t.target.value)}),this.formControls.noteText.errorMessage&&t("div",{class:"invalid-feedback"},this.formControls.noteText.errorMessage)),t("div",{class:"mb-3"},l.state.notesLoading&&t(r,null),t("button",{class:"btn btn-primary",type:"submit",disabled:l.state.notesLoading},"Submit")))))}get el(){return i(this)}};n.style=":host{display:block}";export{n as sparkle_facilitator_notes_form}
@@ -1 +1 @@
1
- import{H as a}from"./p-1d4c7c11.js";import{d as e}from"./p-2f569553.js";const{state:t,onChange:s}=e({pageNotes:[],allPageNotes:[],onlineStudents:[],dashboardData:null,isConnected:!1,loading:!1,dashboardDataLoading:!1,notesLoading:!1,classes:[],classesLoading:!1}),o={state:t,onChange:s};class r{constructor(){}static getInstance(){return r.instance||(r.instance=new r),r.instance}async fetchClasses(){o.state.classesLoading=!0;let e=await a.http.get("api/v1/Teacher/Classes");return e&&(o.state.classes=e.Data,o.state.classesLoading=!1),e}async fetchDashboardData(e){o.state.dashboardDataLoading=!0;let t=await a.http.get(`api/v1/Teacher/Dashboard/${e.ClassId}`);return t&&(o.state.dashboardData=t.Data,o.state.dashboardDataLoading=!1),t}async fetchNotes(e){o.state.notesLoading=!0;let t=await a.http.get(`api/v1/Teacher/Notes/${e.showAllNotes}`);return t&&(e.showAllNotes?o.state.allPageNotes=t.Data:o.state.pageNotes=t.Data,o.state.notesLoading=!1),t}async addFacilitatorNote(e){o.state.notesLoading=!0;let t=await a.http.post("api/v1/Teacher/Notes",e);return t&&(o.state.pageNotes=[...o.state.pageNotes,t.Data]),o.state.notesLoading=!1,t}async updateFacilitatorNote(e){o.state.notesLoading=!0;let t=await a.http.put(`api/v1/Teacher/Notes/${e.Id}`,e);return t&&(o.state.pageNotes=o.state.pageNotes.map((a=>a.Id==t.Data.Id?t.Data:a))),o.state.notesLoading=!1,t}async deleteFacilitatorNote(e){o.state.notesLoading=!0;let t=await a.http.delete(`api/v1/Teacher/Notes/${e}`);return t&&(o.state.pageNotes=o.state.pageNotes.filter((a=>a.Id!=e))),o.state.notesLoading=!1,t}}export{r as F,o as f}
1
+ import{H as a}from"./p-b06e2bef.js";import{d as e}from"./p-2f569553.js";const{state:t,onChange:s}=e({pageNotes:[],allPageNotes:[],onlineStudents:[],dashboardData:null,isConnected:!1,loading:!1,dashboardDataLoading:!1,notesLoading:!1,classes:[],classesLoading:!1}),o={state:t,onChange:s};class r{constructor(){}static getInstance(){return r.instance||(r.instance=new r),r.instance}async fetchClasses(){o.state.classesLoading=!0;let e=await a.http.get("api/v1/Teacher/Classes");return e&&(o.state.classes=e.Data,o.state.classesLoading=!1),e}async fetchDashboardData(e){o.state.dashboardDataLoading=!0;let t=await a.http.get(`api/v1/Teacher/Dashboard/${e.ClassId}`);return t&&(o.state.dashboardData=t.Data,o.state.dashboardDataLoading=!1),t}async fetchNotes(e){o.state.notesLoading=!0;let t=await a.http.get(`api/v1/Teacher/Notes/${e.showAllNotes}`);return t&&(e.showAllNotes?o.state.allPageNotes=t.Data:o.state.pageNotes=t.Data,o.state.notesLoading=!1),t}async addFacilitatorNote(e){o.state.notesLoading=!0;let t=await a.http.post("api/v1/Teacher/Notes",e);return t&&(o.state.pageNotes=[...o.state.pageNotes,t.Data]),o.state.notesLoading=!1,t}async updateFacilitatorNote(e){o.state.notesLoading=!0;let t=await a.http.put(`api/v1/Teacher/Notes/${e.Id}`,e);return t&&(o.state.pageNotes=o.state.pageNotes.map((a=>a.Id==t.Data.Id?t.Data:a))),o.state.notesLoading=!1,t}async deleteFacilitatorNote(e){o.state.notesLoading=!0;let t=await a.http.delete(`api/v1/Teacher/Notes/${e}`);return t&&(o.state.pageNotes=o.state.pageNotes.filter((a=>a.Id!=e))),o.state.notesLoading=!1,t}}export{r as F,o as f}