@sparkle-learning/core 0.0.52 → 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 (148) 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 +289 -3279
  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_2.cjs.entry.js → ion-select_3.cjs.entry.js} +127 -0
  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-0d5da1d3.js +2985 -0
  14. package/dist/cjs/sparkle-animation-player.cjs.entry.js +2 -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 +281 -0
  19. package/dist/cjs/sparkle-discussion.cjs.entry.js +42 -0
  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 +6 -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-animation-player/sparkle-animation-player.js +1 -0
  35. package/dist/collection/components/sparkle-assignment/sparkle-assignment.css +3 -0
  36. package/dist/collection/components/sparkle-assignment/sparkle-assignment.js +25 -0
  37. package/dist/collection/components/sparkle-character-intro/sparkle-character-intro.css +8 -1
  38. package/dist/collection/components/sparkle-character-intro/sparkle-character-intro.js +10 -6
  39. package/dist/collection/components/sparkle-course-root/sparkle-course-root.js +12 -1
  40. package/dist/collection/components/sparkle-discussion/sparkle-discussion-questions/sparkle-discussion-questions.css +157 -0
  41. package/dist/collection/components/sparkle-discussion/sparkle-discussion-questions/sparkle-discussion-questions.js +232 -0
  42. package/dist/collection/components/sparkle-discussion/sparkle-discussion-results/sparkle-discussion-results.css +158 -0
  43. package/dist/collection/components/sparkle-discussion/sparkle-discussion-results/sparkle-discussion-results.js +274 -0
  44. package/dist/collection/components/sparkle-discussion/sparkle-discussion.css +5 -0
  45. package/dist/collection/components/sparkle-discussion/sparkle-discussion.js +112 -0
  46. package/dist/collection/components/sparkle-feed-post/sparkle-feed-post.js +54 -67
  47. package/dist/collection/components/sparkle-login/sparkle-login.js +2 -1
  48. package/dist/collection/components/sparkle-quiz/{sparkle-quiz/sparkle-quiz.css → sparkle-quiz-old/sparkle-quiz-old.css} +1 -1
  49. package/dist/collection/components/sparkle-quiz/{sparkle-quiz/sparkle-quiz.js → sparkle-quiz-old/sparkle-quiz-old.js} +4 -4
  50. package/dist/collection/components/sparkle-quiz/{sparkle-quiz-v1.js → sparkle-quiz.js} +23 -25
  51. package/dist/collection/components/sparkle-quiz-container/sparkle-quiz-container.js +1 -1
  52. package/dist/collection/components/sparkle-root/sparkle-root.js +12 -10
  53. package/dist/collection/services/assignment.service.js +14 -0
  54. package/dist/collection/services/auth/auth.service.js +15 -14
  55. package/dist/collection/services/environment/environment-config.js +1 -1
  56. package/dist/collection/services/environment/environment-config.service.js +0 -1
  57. package/dist/collection/services/httpService.js +12 -10
  58. package/dist/collection/services/signalR.service.js +17 -19
  59. package/dist/collection/services/token.service.js +68 -0
  60. package/dist/collection/util.js +5 -2
  61. package/dist/esm/{PrivateRoute-c5441f35.js → PrivateRoute-c6e80d5d.js} +17 -29
  62. package/dist/esm/{feed.service-8fbe4ce3.js → appdata.service-d1058e00.js} +5 -55
  63. package/dist/esm/{assets.service-66e848b8.js → assets.service-def1d63c.js} +1 -1
  64. package/dist/esm/{environment-config.service-2b5d692b.js → environment-config.service-b191f276.js} +0 -1
  65. package/dist/esm/{facilitator.service-b0292f7f.js → facilitator.service-53e05a01.js} +1 -1
  66. package/dist/esm/feed.service-8385ad7a.js +54 -0
  67. package/dist/esm/header-mobile-collapse_61.entry.js +278 -3268
  68. package/dist/esm/{httpService-7b75b095.js → httpService-db476835.js} +13 -11
  69. package/dist/esm/index.js +5 -4
  70. package/dist/esm/{ion-select_2.entry.js → ion-select_3.entry.js} +127 -1
  71. package/dist/esm/loader.js +1 -1
  72. package/dist/esm/media.service-b68cbfff.js +37 -0
  73. package/dist/esm/signalR.service-4a2d5a92.js +2982 -0
  74. package/dist/esm/sparkle-animation-player.entry.js +2 -1
  75. package/dist/esm/sparkle-assignment.entry.js +21 -0
  76. package/dist/esm/sparkle-character-intro.entry.js +3 -3
  77. package/dist/esm/sparkle-core.js +1 -1
  78. package/dist/esm/sparkle-discussion-questions_2.entry.js +276 -0
  79. package/dist/esm/sparkle-discussion.entry.js +38 -0
  80. package/dist/esm/sparkle-facilitator-notes-form.entry.js +5 -3
  81. package/dist/esm/sparkle-feedback.entry.js +5 -3
  82. package/dist/esm/sparkle-goal-form.entry.js +8 -5
  83. package/dist/esm/sparkle-quiz-container.entry.js +1 -1
  84. package/dist/esm/sparkle-quiz-old.entry.js +116 -0
  85. package/dist/esm/sparkle-quiz.entry.js +31 -48
  86. package/dist/esm/{student.service-0746418b.js → student.service-6457aaa0.js} +1 -1
  87. package/dist/esm/token.service-20f1a256.js +83 -0
  88. package/dist/esm/{util-6ef753e9.js → util-57cc8006.js} +2 -2
  89. package/dist/sparkle-core/index.esm.js +1 -1
  90. package/dist/sparkle-core/p-11ac00b0.js +1 -0
  91. package/dist/sparkle-core/p-13ec39db.entry.js +1 -0
  92. package/dist/sparkle-core/{p-5efc6566.js → p-17b6b07e.js} +1 -1
  93. package/dist/sparkle-core/p-33a7151d.entry.js +1 -0
  94. package/dist/sparkle-core/{p-fbccd30c.js → p-38f707fb.js} +1 -1
  95. package/dist/sparkle-core/p-38fa5987.js +1 -0
  96. package/dist/sparkle-core/{p-9a443f51.js → p-408176ba.js} +1 -1
  97. package/dist/sparkle-core/p-630a4fa0.js +1 -0
  98. package/dist/sparkle-core/{p-0335c863.entry.js → p-6a1fc0af.entry.js} +26 -26
  99. package/dist/sparkle-core/p-6fab3a4b.js +1 -0
  100. package/dist/sparkle-core/p-71720d6e.entry.js +1 -0
  101. package/dist/sparkle-core/{p-162bff1a.entry.js → p-72053ae0.entry.js} +1 -1
  102. package/dist/sparkle-core/p-85d4cd5c.entry.js +1 -0
  103. package/dist/sparkle-core/p-967a2ed7.js +1 -0
  104. package/dist/sparkle-core/{p-ff0e0d4e.entry.js → p-98daeddb.entry.js} +1 -1
  105. package/dist/sparkle-core/p-98f7780c.entry.js +1 -0
  106. package/dist/sparkle-core/p-bd90903e.js +1 -0
  107. package/dist/sparkle-core/{p-a49ab4e8.entry.js → p-c64a34cd.entry.js} +1 -1
  108. package/dist/sparkle-core/{p-564e64fc.entry.js → p-ca907214.entry.js} +2 -2
  109. package/dist/sparkle-core/p-d51f30ca.js +1 -0
  110. package/dist/sparkle-core/p-dcff298d.entry.js +1 -0
  111. package/dist/sparkle-core/p-e50c8b04.entry.js +1 -0
  112. package/dist/sparkle-core/p-ed9de327.js +1 -0
  113. package/dist/sparkle-core/p-f891c79a.entry.js +1 -0
  114. package/dist/sparkle-core/sparkle-core.esm.js +1 -1
  115. package/dist/types/components/layout/page/page.d.ts +2 -0
  116. package/dist/types/components/sparkle-assignment/sparkle-assignment.d.ts +6 -0
  117. package/dist/types/components/sparkle-course-root/sparkle-course-root.d.ts +1 -0
  118. package/dist/types/components/sparkle-discussion/sparkle-discussion-questions/sparkle-discussion-questions.d.ts +28 -0
  119. package/dist/types/components/sparkle-discussion/sparkle-discussion-results/sparkle-discussion-results.d.ts +45 -0
  120. package/dist/types/components/sparkle-discussion/sparkle-discussion.d.ts +11 -0
  121. package/dist/types/components/sparkle-feed-post/sparkle-feed-post.d.ts +3 -2
  122. package/dist/types/components/sparkle-quiz/{sparkle-quiz/sparkle-quiz.d.ts → sparkle-quiz-old/sparkle-quiz-old.d.ts} +1 -1
  123. package/dist/types/components/sparkle-quiz/sparkle-quiz.d.ts +36 -36
  124. package/dist/types/components.d.ts +115 -37
  125. package/dist/types/models/class.model.d.ts +4 -0
  126. package/dist/types/services/assignment.service.d.ts +8 -0
  127. package/dist/types/services/auth/auth.service.d.ts +1 -1
  128. package/dist/types/services/environment/environment-config.d.ts +3 -0
  129. package/dist/types/services/token.service.d.ts +12 -0
  130. package/dist/types/util.d.ts +1 -0
  131. package/package.json +1 -1
  132. package/dist/cjs/sparkle-feed-post.cjs.entry.js +0 -124
  133. package/dist/cjs/sparkle-quiz-v1.cjs.entry.js +0 -105
  134. package/dist/esm/sparkle-feed-post.entry.js +0 -120
  135. package/dist/esm/sparkle-quiz-v1.entry.js +0 -101
  136. package/dist/sparkle-core/p-15403881.entry.js +0 -1
  137. package/dist/sparkle-core/p-1d4c7c11.js +0 -1
  138. package/dist/sparkle-core/p-370609ba.entry.js +0 -1
  139. package/dist/sparkle-core/p-41a9ece7.entry.js +0 -1
  140. package/dist/sparkle-core/p-462bffba.js +0 -1
  141. package/dist/sparkle-core/p-58e4bbe5.entry.js +0 -1
  142. package/dist/sparkle-core/p-600cf6a3.js +0 -1
  143. package/dist/sparkle-core/p-80d6b0e6.entry.js +0 -1
  144. package/dist/sparkle-core/p-af3cc111.entry.js +0 -1
  145. package/dist/sparkle-core/p-b226f54d.js +0 -1
  146. package/dist/types/components/sparkle-quiz/sparkle-quiz-v1.d.ts +0 -41
  147. /package/dist/collection/components/sparkle-quiz/{sparkle-quiz-v1.css → sparkle-quiz.css} +0 -0
  148. /package/dist/sparkle-core/{p-935e7cfc.js → p-8b56f734.js} +0 -0
@@ -1,9 +1,11 @@
1
1
  import { r as registerInstance, h, H as Host, e as getElement } from './index-c04b9ed5.js';
2
- import { S as StudentService } from './student.service-0746418b.js';
2
+ import { S as StudentService } from './student.service-6457aaa0.js';
3
3
  import { t as toastController } from './overlays-3b4dca92.js';
4
- import './httpService-7b75b095.js';
4
+ import './httpService-db476835.js';
5
5
  import './auth.store-dba2c2da.js';
6
- import './environment-config.service-2b5d692b.js';
6
+ import './environment-config.service-b191f276.js';
7
+ import './token.service-20f1a256.js';
8
+ import './localstorage.service-4bf408c8.js';
7
9
  import './ionic-global-4903e23e.js';
8
10
  import './hardware-back-button-fa04d6e9.js';
9
11
  import './helpers-bf0e23d6.js';
@@ -1,14 +1,17 @@
1
1
  import { r as registerInstance, h, e as getElement } from './index-c04b9ed5.js';
2
- import { S as SparkleGlobal, G as GetGoalAppData, e as MyGoalTemplate, f as MyGoalTemplateJSON } from './util-6ef753e9.js';
3
- import { E as EnvironmentConfigService } from './environment-config.service-2b5d692b.js';
4
- import { A as AssetsService } from './assets.service-66e848b8.js';
5
- import { A as AppDataService, F as FeedService, g as goalStore, f as feedStore } from './feed.service-8fbe4ce3.js';
6
- import './httpService-7b75b095.js';
2
+ import { S as SparkleGlobal, G as GetGoalAppData, e as MyGoalTemplate, f as MyGoalTemplateJSON } from './util-57cc8006.js';
3
+ import { E as EnvironmentConfigService } from './environment-config.service-b191f276.js';
4
+ import { A as AssetsService } from './assets.service-def1d63c.js';
5
+ import { A as AppDataService, g as goalStore } from './appdata.service-d1058e00.js';
6
+ import { F as FeedService, f as feedStore } from './feed.service-8385ad7a.js';
7
+ import './httpService-db476835.js';
7
8
  import './auth.store-dba2c2da.js';
8
9
  import './overlays-3b4dca92.js';
9
10
  import './ionic-global-4903e23e.js';
10
11
  import './hardware-back-button-fa04d6e9.js';
11
12
  import './helpers-bf0e23d6.js';
13
+ import './token.service-20f1a256.js';
14
+ import './localstorage.service-4bf408c8.js';
12
15
 
13
16
  const sparkleGoalFormCss = ":host{display:block}";
14
17
 
@@ -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-db476835.js';
2
2
  import { d as createStore } from './auth.store-dba2c2da.js';
3
3
 
4
4
  const { state, onChange, reset } = createStore({
@@ -0,0 +1,83 @@
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
+ async getTokenExpiry() {
61
+ let authUser = await get(AppConsts.AUTH_USER_LOCALSTORAGE);
62
+ if (!authUser) {
63
+ return 0;
64
+ }
65
+ let timeDiff = 0;
66
+ if (authUser.ExpiresOn) {
67
+ timeDiff = new Date(authUser.ExpiresOn).getTime() - new Date().getTime();
68
+ }
69
+ return Math.max(0, timeDiff);
70
+ }
71
+ async saveAuthUser(authUser) {
72
+ AuthStore.state.authUser = Object.assign({}, authUser);
73
+ AuthStore.state.isAuthenticated = true;
74
+ await set(AppConsts.AUTH_USER_LOCALSTORAGE, authUser);
75
+ }
76
+ async removeAuthUser() {
77
+ AuthStore.state.authUser = null;
78
+ AuthStore.state.isAuthenticated = false;
79
+ await remove(AppConsts.AUTH_USER_LOCALSTORAGE);
80
+ }
81
+ }
82
+
83
+ 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-38fa5987.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-967a2ed7.js";import"./p-2ff67662.js";import"./p-871106e0.js";import"./p-add30d46.js";import"./p-d68092b7.js";import"./p-ed9de327.js";
@@ -0,0 +1 @@
1
+ import{H as t}from"./p-967a2ed7.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{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}
@@ -1 +1 @@
1
- import{H as e}from"./p-1d4c7c11.js";import{d as t}from"./p-2f569553.js";const{state:a,onChange:s,reset:r}=t({user:{FirstName:"",LastName:"",ProfileText:"",ProfileImage:"",IsVerified:!1,Roles:[],FacilitatorClassList:[]},loaded:!1,updateLoading:!1,enrollmentList:[]}),n={state:a,onChange:s,reset:r};class i{constructor(){}static getInstance(){return i.instance||(i.instance=new i),i.instance}async enrollClass(t){let a=await e.http.post("api/v1/Student/EnrollClass",t);return a&&(n.state.enrollmentList=[...n.state.enrollmentList,a.Data]),a}async leaveClass(t){let a=await e.http.post("api/v1/Student/LeaveClass",t);return a&&(n.state.enrollmentList=n.state.enrollmentList.filter((e=>e.Id!=a.Data))),a}async fetchUserConfiguration(){let t=await e.http.get("api/v1/Student/UserConfiguration");return t&&(n.state.enrollmentList=t.Data.EnrollmentList,n.state.user.FirstName=t.Data.FirstName,n.state.user.LastName=t.Data.LastName,n.state.user.ProfileText=t.Data.ProfileText,n.state.user.ProfileImage=t.Data.ProfileImage,n.state.user.IsVerified=t.Data.IsVerified,n.state.user.Roles=t.Data.Roles,n.state.user.FacilitatorClassList=t.Data.FacilitatorClassList),t}async updateProfile(t){n.state.updateLoading=!0;let a=await e.http.post("api/Account/update-profile",t);return console.log("after fetch",a),a&&(n.state.updateLoading=!1,n.state.user=Object.assign(Object.assign({},n.state.user),{FirstName:a.Data.FirstName,LastName:a.Data.LastName,ProfileText:a.Data.ProfileText,ProfileImage:a.Data.ProfileImage})),a}async submitFeedback(t){return await e.http.post("api/v1/Feedback",t)}}export{i as S,n as u}
1
+ import{H as e}from"./p-967a2ed7.js";import{d as t}from"./p-2f569553.js";const{state:a,onChange:s,reset:r}=t({user:{FirstName:"",LastName:"",ProfileText:"",ProfileImage:"",IsVerified:!1,Roles:[],FacilitatorClassList:[]},loaded:!1,updateLoading:!1,enrollmentList:[]}),n={state:a,onChange:s,reset:r};class i{constructor(){}static getInstance(){return i.instance||(i.instance=new i),i.instance}async enrollClass(t){let a=await e.http.post("api/v1/Student/EnrollClass",t);return a&&(n.state.enrollmentList=[...n.state.enrollmentList,a.Data]),a}async leaveClass(t){let a=await e.http.post("api/v1/Student/LeaveClass",t);return a&&(n.state.enrollmentList=n.state.enrollmentList.filter((e=>e.Id!=a.Data))),a}async fetchUserConfiguration(){let t=await e.http.get("api/v1/Student/UserConfiguration");return t&&(n.state.enrollmentList=t.Data.EnrollmentList,n.state.user.FirstName=t.Data.FirstName,n.state.user.LastName=t.Data.LastName,n.state.user.ProfileText=t.Data.ProfileText,n.state.user.ProfileImage=t.Data.ProfileImage,n.state.user.IsVerified=t.Data.IsVerified,n.state.user.Roles=t.Data.Roles,n.state.user.FacilitatorClassList=t.Data.FacilitatorClassList),t}async updateProfile(t){n.state.updateLoading=!0;let a=await e.http.post("api/Account/update-profile",t);return console.log("after fetch",a),a&&(n.state.updateLoading=!1,n.state.user=Object.assign(Object.assign({},n.state.user),{FirstName:a.Data.FirstName,LastName:a.Data.LastName,ProfileText:a.Data.ProfileText,ProfileImage:a.Data.ProfileImage})),a}async submitFeedback(t){return await e.http.post("api/v1/Feedback",t)}}export{i as S,n as u}
@@ -0,0 +1 @@
1
+ import{r as s,h as t,e,H as r}from"./p-ee1e0eb4.js";const n=class{constructor(t){s(this,t),this.submitted=!0}async onSubmit(s){s.preventDefault(),this.submitted=!0}render(){return t(r,null,"Assignment")}get el(){return e(this)}};n.style=":host{display:block}";export{n as sparkle_assignment}
@@ -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-967a2ed7.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}
@@ -0,0 +1 @@
1
+ import{c as t,h as e}from"./p-ee1e0eb4.js";import{r,g as n}from"./p-5d409601.js";import{H as a}from"./p-967a2ed7.js";import{T as o,A as i}from"./p-ed9de327.js";import{A as s}from"./p-2f569553.js";const c=new class{constructor(){this.sample=t=>t[Math.floor(Math.random()*t.length)],this.keyBy=(t,e,r)=>t.reduce(((t,n)=>(t[e(n)]=r?r(n):n,t)),{}),this.debounce=(t,e)=>{let r=null;return(...n)=>{clearTimeout(r),r=setTimeout(t,e,...n)}}}loadScript(t){var e=document.createElement("script");e.type="text/javascript",e.src=t,document.body.appendChild(e)}loadScriptAsync(t){return new Promise((function(e,r){const n=document.createElement("script");let a=!1;n.type="text/javascript",n.src=t,n.async=!0,n.onerror=function(t){r(t)},n.onload=n.onreadystatechange=function(){a||this.readyState&&"complete"!=this.readyState||(a=!0,e(!0))};const o=document.getElementsByTagName("script")[0];o.parentElement.insertBefore(n,o)}))}extend(...t){let e,r,n,a,o,i,s,c=t[0]||{},l=1,u=t.length,p=!1;for("boolean"==typeof c&&(p=c,c=t[l]||{},l++),"object"!=typeof c&&"function"!=typeof c&&(c={}),l===u&&(c=this,l--);l<u;l++)if(null!==(e=t[l]))for(r in e)n=c[r],o=e[r],c!==o&&(a=Array.isArray(n)?"array":typeof n,p&&o&&((i=Array.isArray(o))||"object"==typeof o)?(i?(i=!1,s=n&&"array"===a?n:[]):s=n&&"object"===a?n:{},c[r]=this.extend(p,s,o)):void 0!==o&&(c[r]=o));return c}setLocalization(){if(!sparkle.utils.getCookieValue("Sparkle.Localization.CultureName")){let t=navigator.language;sparkle.utils.setCookieValue("Sparkle.Localization.CultureName",t,new Date((new Date).getTime()+15768e7),sparkle.appPath)}}};async function l(t){if(!window)return;const e=window,r=e.Sparkle;if(!r||!r.config||"Object"===r.config.constructor.name)return e.Sparkle=e.Sparkle||{},e.Sparkle.config=Object.assign(Object.assign({},e.Sparkle.config),t),e.Sparkle.config;console.error("Sparkle config was already initialized")}async function u(e){await c.loadScriptAsync(t("../assets/lib/sparkle.js")),await l(e)}class p{constructor(){}static getInstance(){return p.instance||(p.instance=new p),p.instance}async authenticate(t){const e={"Content-Type":"application/json"};let r;s.state.loading=!0;try{if(r=await a.http.post("api/Account/Authenticate",t,{headers:e}),r){const t=r.Data,e={Id:t.Id,UserName:t.UserName,Email:t.Email,Roles:t.Roles,IsVerified:t.IsVerified,JWToken:t.JWToken,IssuedOn:t.IssuedOn,ExpiresOn:t.ExpiresOn,RefreshToken:t.RefreshToken,PhotoUrl:"",IsFacilitator:t.Roles.indexOf("Facilitator")>0};return await o.getInstance().saveAuthUser(e),s.state.loading=!1,e}}catch(t){return s.state.loading=!1,t}}async signOut(){await r(i.AUTH_USER_LOCALSTORAGE),await o.getInstance().removeAuthUser(),sessionStorage.clear()}async getLocalAuthUser(){return n(i.AUTH_USER_LOCALSTORAGE)}}const f=t=>{var{component:r,permission:n,render:a}=t,o=function(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(n=Object.getOwnPropertySymbols(t);a<n.length;a++)e.indexOf(n[a])<0&&Object.prototype.propertyIsEnumerable.call(t,n[a])&&(r[n[a]]=t[n[a]])}return r}(t,["component","permission","render"]);const i=r;return e("stencil-route",Object.assign({},o,{routeRender:t=>s.state.isAuthenticated?n&&!sparkle.auth.isGranted(n)?e("stencil-router-redirect",{url:"/unauthorized"}):i?e(i,Object.assign({},t,t.componentProps)):a(t):e("stencil-router-redirect",{url:"/login"})}))};export{p as A,f as P,u as i,l as s}
@@ -1 +1 @@
1
- import{E as t}from"./p-b226f54d.js";class s{constructor(){this.assetsList=void 0}static getInstance(){return s.instance||(s.instance=new s),s.instance}async assets(){return void 0===this.assetsList&&(this.assetsList=await this.init()),this.assetsList}async init(){try{const s=t.getInstance().get("sparkle"),a=await fetch(`${s.globalAssetsUrl}/assets.json`);if(!a)return;return await a.json()}catch(t){return}}async loadJsonFile(t){try{const s=await fetch(`${t}`);if(!s)return;return await s.json()}catch(t){return}}}export{s as A}
1
+ import{E as t}from"./p-bd90903e.js";class s{constructor(){this.assetsList=void 0}static getInstance(){return s.instance||(s.instance=new s),s.instance}async assets(){return void 0===this.assetsList&&(this.assetsList=await this.init()),this.assetsList}async init(){try{const s=t.getInstance().get("sparkle"),a=await fetch(`${s.globalAssetsUrl}/assets.json`);if(!a)return;return await a.json()}catch(t){return}}async loadJsonFile(t){try{const s=await fetch(`${t}`);if(!s)return;return await s.json()}catch(t){return}}}export{s as A}
@@ -0,0 +1 @@
1
+ import{H as t}from"./p-967a2ed7.js";import{d as e}from"./p-2f569553.js";const{state:s,reset:a}=e({posts:[],postsLoading:!1,createPostLoading:!1,postIdLoading:null}),o={state:s,reset:a};class n{constructor(){}static getInstance(){return n.instance||(n.instance=new n),n.instance}async getAllPosts(){o.state.postsLoading=!0;let e=await t.http.get("api/v1/Feed/GetAll");return e&&(o.state.posts=e.Data,o.state.postsLoading=!1),e}async createPost(e){o.state.createPostLoading=!0;let s=await t.http.post("api/v1/Feed/PostFeed",e);return s&&(o.state.posts=[s.Data,...o.state.posts],o.state.createPostLoading=!1),s}async createPostComment(e){o.state.postIdLoading=e.PostId;let s=await t.http.post("api/v1/Feed/Comment",e);return s&&(o.state.posts=o.state.posts.map((t=>t.Id==s.Data.ClassFeedPostId?Object.assign(Object.assign({},t),{Comments:[...t.Comments,s.Data]}):t)),o.state.postIdLoading=null),s}}export{n as F,o as f}