@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
@@ -1,5 +1,9 @@
1
1
  import { Component, Element, State, Prop, Method, h, Host } from '@stencil/core';
2
- import { EnvironmentConfigService } from '../../services';
2
+ import { AssignmentService } from '../../services/assignment.service';
3
+ import { FeedService } from '../../services/feed.service';
4
+ import { MediaService } from '../../services/media.service';
5
+ import { TokenService } from '../../services/token.service';
6
+ import { SparkleGlobal } from '../../util';
3
7
  export class SparkleFeedPost {
4
8
  // @Prop({ connect: 'ion-toast-controller' })
5
9
  // toastCtrl: HTMLIonToastControllerElement;
@@ -13,34 +17,11 @@ export class SparkleFeedPost {
13
17
  setText(text) {
14
18
  this.postText = text;
15
19
  }
16
- // async postToFeed() {
17
- // const sparkleConfig: EnvironmentSparkleConfig = EnvironmentConfigService.getInstance().get('sparkle');
18
- // const tocData = await AssetsService.getInstance().loadJsonFile<ICourse>(sparkleConfig.tocPath);
19
- // var model = {
20
- // CourseId: tocData.id,
21
- // MiniAppId: SparkleGlobal.MY_GOALS_APP_ID,
22
- // PostText: MyGoalTemplate(this.name.value, this.goalUpdateText.value, this.progress),
23
- // PostTextJSON: MyGoalTemplateJSON(this.name.value, this.goalUpdateText.value, this.progress),
24
- // IsPublic: this.public,
25
- // ExternalResourceUrl: "",
26
- // }
27
- // const result = await FeedService.getInstance().createPost(model);
28
- // if (result.Succeeded) {
29
- // //show success toast
30
- // }
31
- // }
32
20
  isAuthenticated() {
33
- try {
34
- var sparkleConfig = EnvironmentConfigService.getInstance().get('sparkle');
35
- if (!!sparkleConfig && !!sparkleConfig.auth && !!sparkleConfig.auth.getToken()) {
36
- return true;
37
- }
38
- }
39
- catch (_a) {
40
- return false;
41
- }
21
+ return TokenService.getInstance().isAuthenticated();
42
22
  }
43
- submitPost() {
23
+ async submitPost() {
24
+ this.postLoading = true;
44
25
  this.errorMessage = '';
45
26
  this.successMessage = '';
46
27
  //let formData = new FormData(this.el.querySelector("form")) as any;
@@ -51,60 +32,56 @@ export class SparkleFeedPost {
51
32
  PostText: this.postText,
52
33
  IsPublic: isPublic.checked,
53
34
  ExternalResourceUrl: postExternalUrl.value,
54
- MiniAppId: 1,
35
+ MiniAppId: SparkleGlobal.MY_GOALS_APP_ID,
55
36
  AssignmentName: this.assignmentName,
56
37
  AssignmentData: '',
38
+ PostTextJSON: null,
57
39
  };
58
- // this.dataSvc.saveData(data, '/api/class/feed').subscribe(
59
- // x => {
60
- // this.successMessage = 'Posted Successfully.';
61
- // // this.presentToast('Success');
62
- // },
63
- // error => {
64
- // this.errorMessage = 'There is an error while posting.';
65
- // // this.presentToast('There is an error');
66
- // },
67
- // );
68
- //TODO can we return data from the dataSvc so we know if it's successful and can update the form? (Perhaps replace it with the post itself?)
69
- // if (this.assignmentName) {
70
- // data.AssignmentData = JSON.stringify({ text: data.PostText, url: data.ExternalResourceUrl });
71
- // this.dataSvc.saveData(data, '/api/student/assignment-response').subscribe(
72
- // x => {
73
- // this.successMessage = 'Posted Successfully.';
74
- // // this.presentToast('Success');
75
- // },
76
- // error => {
77
- // this.errorMessage = 'There is an error while posting.';
78
- // // this.presentToast('There is an error');
79
- // },
80
- // );
81
- // }
40
+ const result = await FeedService.getInstance().createPost(data);
41
+ if (result.Succeeded) {
42
+ this.postLoading = false;
43
+ //show success toast
44
+ this.successMessage = 'Posted Successfully.';
45
+ this.postText = '';
46
+ this.externalResourceUrl = '';
47
+ this.uploadedImage = '';
48
+ }
49
+ else {
50
+ this.postLoading = false;
51
+ this.errorMessage = 'There is an error while posting to feed.';
52
+ }
53
+ if (this.assignmentName) {
54
+ var assignmentModel = {
55
+ AssignmentData: JSON.stringify({ text: data.PostText, url: data.ExternalResourceUrl }),
56
+ AssignmentName: this.assignmentName,
57
+ };
58
+ await AssignmentService.getInstance().createAssignment(assignmentModel);
59
+ }
82
60
  }
83
- uploadImage(evt) {
84
- // this.uploadImageLoading = true;
85
- // var files = evt.target.files;
86
- // this.dataSvc.uploadImage(files, '/api/mediaitems/upload').subscribe(
87
- // x => {
88
- // this.uploadImageLoading = false;
89
- // this.uploadedImage = x.length > 0 ? x[0].FullImageUrl : '';
90
- // this.externalResourceUrl = x.length > 0 ? x[0].FullImageUrl : '';
91
- // //this.successMessage = 'Posted Successfully.'
92
- // // this.presentToast('Success');
93
- // },
94
- // error => {
95
- // this.uploadImageLoading = false;
96
- // this.errorMessage = 'There is an error while uploading an image.';
97
- // },
98
- // );
61
+ async uploadImage(evt) {
62
+ this.uploadImageLoading = true;
63
+ var files = evt.target.files;
64
+ let result = await MediaService.getInstance().uploadImage(files);
65
+ if (result.Succeeded) {
66
+ console.log(result);
67
+ this.uploadImageLoading = false;
68
+ this.uploadedImage = result.Data.length > 0 ? result.Data[0].FullImageUrl : '';
69
+ this.externalResourceUrl = result.Data.length > 0 ? result.Data[0].FullImageUrl : '';
70
+ }
71
+ else {
72
+ this.uploadImageLoading = false;
73
+ this.errorMessage = 'There is an error while uploading an image.';
74
+ }
99
75
  }
100
76
  selectFile() {
101
- var fileInput = document.getElementById('fileInput');
77
+ var fileInput = this.el.querySelector('#fileInput');
102
78
  fileInput.click();
103
79
  }
104
80
  renderUserInfo() {
105
- var tokenInfo = { Token: null, ProfileImageUrl: null };
106
- if (tokenInfo != null && tokenInfo.Token) {
107
- return (h("ion-avatar", { class: "header-avatar", slot: "end" }, tokenInfo.ProfileImageUrl ? h("img", { src: tokenInfo.ProfileImageUrl }) : h("img", { src: "/assets/img/avatar.png" })));
81
+ let authUser = TokenService.getInstance().getAuthUserSync();
82
+ //var tokenInfo = { Token: null, ProfileImageUrl: null };
83
+ if (authUser && authUser.JWToken) {
84
+ return (h("ion-avatar", { class: "header-avatar", slot: "end" }, authUser.PhotoUrl ? h("img", { src: authUser.PhotoUrl }) : h("img", { src: "/assets/img/user.png" })));
108
85
  }
109
86
  else {
110
87
  return (h("ion-button", { slot: "end", href: "/login" }, "Login to Post"));
@@ -124,7 +101,7 @@ export class SparkleFeedPost {
124
101
  h("ion-textarea", { class: "PostText", required: true, placeholder: "Post Text", name: "PostText", value: this.postText })),
125
102
  h("ion-item", { class: "padding" },
126
103
  h("ion-input", { class: "PostExternalUrl", required: true, type: "text", placeholder: "URL", name: "ExternalResourceUrl", value: this.externalResourceUrl })),
127
- this.uploadedImage ? (h("ion-item", { class: "padding" },
104
+ this.uploadedImage ? (h("ion-item", { class: "ion-padding", lines: "none" },
128
105
  h("img", { class: "uploaded-image", src: this.uploadedImage }))) : (''),
129
106
  h("ion-item", { lines: "none" },
130
107
  h("input", { type: "file", id: "fileInput", onChange: evt => this.uploadImage(evt), style: { display: 'none' }, accept: "image/*" }),
@@ -140,7 +117,8 @@ export class SparkleFeedPost {
140
117
  h("div", null,
141
118
  h("div", { class: "error" }, this.errorMessage),
142
119
  h("div", { class: "success" }, this.successMessage)),
143
- h("ion-button", { slot: "end", size: "default", onClick: evt => this.submitPost(), disabled: !this.isAuthenticated() }, "Post")))))))));
120
+ h("div", null, this.postLoading ? h("ion-spinner", { color: "primary" }) : ''),
121
+ h("ion-button", { slot: "end", size: "default", onClick: evt => this.submitPost(), disabled: this.postLoading || !this.isAuthenticated() }, "Post")))))))));
144
122
  }
145
123
  static get is() { return "sparkle-feed-post"; }
146
124
  static get originalStyleUrls() { return {
@@ -191,7 +169,8 @@ export class SparkleFeedPost {
191
169
  "uploadedImage": {},
192
170
  "successMessage": {},
193
171
  "externalResourceUrl": {},
194
- "uploadImageLoading": {}
172
+ "uploadImageLoading": {},
173
+ "postLoading": {}
195
174
  }; }
196
175
  static get methods() { return {
197
176
  "setText": {
@@ -0,0 +1,105 @@
1
+ import { Component, Element, Event, State, Prop, h, Host } from '@stencil/core';
2
+ import { MediaService } from '../../services/media.service';
3
+ export class SparkleFileUpload {
4
+ constructor() {
5
+ this.uploadImageLoading = false;
6
+ }
7
+ componentDidLoad() { }
8
+ async uploadImage(evt) {
9
+ this.uploadImageLoading = true;
10
+ var files = evt.target.files;
11
+ let result = await MediaService.getInstance().uploadImage(files);
12
+ if (result.Succeeded) {
13
+ console.log(result);
14
+ this.uploadImageLoading = false;
15
+ this.uploadedImage = result.Data.length > 0 ? result.Data[0].FullImageUrl : '';
16
+ this.value = this.uploadedImage;
17
+ this.fileUploaded.emit(this.uploadedImage);
18
+ }
19
+ else {
20
+ this.uploadImageLoading = false;
21
+ this.errorMessage = 'There is an error while uploading an image.';
22
+ }
23
+ }
24
+ selectFile() {
25
+ var fileInput = this.el.shadowRoot.querySelector('#fileInput');
26
+ fileInput.click();
27
+ }
28
+ render() {
29
+ return (h(Host, null,
30
+ this.uploadedImage ? (h("ion-item", { class: "ion-padding", lines: "none" },
31
+ h("img", { class: "uploaded-image", src: this.uploadedImage }))) : (''),
32
+ h("ion-item", { lines: "none" },
33
+ h("input", { type: "file", id: "fileInput", onChange: evt => this.uploadImage(evt), style: { display: 'none' }, accept: "image/*,application/pdf,application/msword,application/vnd.ms-excel,application/vnd.ms-powerpoint,text/plain" }),
34
+ this.uploadImageLoading ? h("ion-spinner", { color: "primary" }) : '',
35
+ h("ion-button", { slot: "start", onClick: evt => this.selectFile() },
36
+ h("ion-icon", { name: "add" }),
37
+ "Upload Image"))));
38
+ }
39
+ static get is() { return "sparkle-file-upload"; }
40
+ static get encapsulation() { return "shadow"; }
41
+ static get originalStyleUrls() { return {
42
+ "$": ["sparkle-file-upload.scss"]
43
+ }; }
44
+ static get styleUrls() { return {
45
+ "$": ["sparkle-file-upload.css"]
46
+ }; }
47
+ static get properties() { return {
48
+ "value": {
49
+ "type": "string",
50
+ "mutable": true,
51
+ "complexType": {
52
+ "original": "string",
53
+ "resolved": "string",
54
+ "references": {}
55
+ },
56
+ "required": false,
57
+ "optional": false,
58
+ "docs": {
59
+ "tags": [],
60
+ "text": ""
61
+ },
62
+ "attribute": "value",
63
+ "reflect": false
64
+ },
65
+ "name": {
66
+ "type": "string",
67
+ "mutable": true,
68
+ "complexType": {
69
+ "original": "string",
70
+ "resolved": "string",
71
+ "references": {}
72
+ },
73
+ "required": false,
74
+ "optional": false,
75
+ "docs": {
76
+ "tags": [],
77
+ "text": ""
78
+ },
79
+ "attribute": "name",
80
+ "reflect": false
81
+ }
82
+ }; }
83
+ static get states() { return {
84
+ "errorMessage": {},
85
+ "uploadedImage": {},
86
+ "uploadImageLoading": {}
87
+ }; }
88
+ static get events() { return [{
89
+ "method": "fileUploaded",
90
+ "name": "fileUploaded",
91
+ "bubbles": true,
92
+ "cancelable": true,
93
+ "composed": true,
94
+ "docs": {
95
+ "tags": [],
96
+ "text": ""
97
+ },
98
+ "complexType": {
99
+ "original": "any",
100
+ "resolved": "any",
101
+ "references": {}
102
+ }
103
+ }]; }
104
+ static get elementRef() { return "el"; }
105
+ }
@@ -0,0 +1,212 @@
1
+ import { Component, h, Event, Prop, Watch } from '@stencil/core';
2
+ export class SparkleInput {
3
+ arrayDataWatcher(newValue) {
4
+ if (typeof newValue === 'string') {
5
+ this._options = JSON.parse(newValue);
6
+ }
7
+ else {
8
+ this._options = newValue;
9
+ }
10
+ }
11
+ componentWillLoad() {
12
+ if (this.type == 'select') {
13
+ this.arrayDataWatcher(this.options);
14
+ }
15
+ }
16
+ handleChange(event) {
17
+ const value = this.type === 'checkbox' ? event.target.checked : event.target.value;
18
+ this.value = value;
19
+ this.valueChanged.emit(value);
20
+ if (this.type === 'checkbox') {
21
+ this.checkedChanged.emit(value);
22
+ }
23
+ }
24
+ render() {
25
+ switch (this.type) {
26
+ case 'text' || 'email' || 'number' || 'tel' || 'url':
27
+ return (h("div", null,
28
+ h("ion-item", null,
29
+ h("ion-label", null, this.label),
30
+ h("ion-input", { type: this.type, value: this.value, placeholder: this.placeholder, onInput: (event) => this.handleChange(event), required: true }))));
31
+ case 'textarea':
32
+ return (h("div", null,
33
+ h("ion-item", null,
34
+ h("ion-label", null, this.label),
35
+ h("ion-textarea", { value: this.value, placeholder: this.placeholder, onInput: (event) => this.handleChange(event), required: true }))));
36
+ case 'checkbox':
37
+ return (h("div", null,
38
+ h("ion-item", null,
39
+ h("ion-checkbox", { slot: "start", checked: this.checked, onChange: (event) => this.handleChange(event) }),
40
+ h("ion-label", null, this.label))));
41
+ case 'select':
42
+ return (h("div", null,
43
+ h("ion-item", null,
44
+ 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)))))));
45
+ default:
46
+ return null;
47
+ }
48
+ }
49
+ static get is() { return "sparkle-input"; }
50
+ static get originalStyleUrls() { return {
51
+ "$": ["sparkle-input.scss"]
52
+ }; }
53
+ static get styleUrls() { return {
54
+ "$": ["sparkle-input.css"]
55
+ }; }
56
+ static get properties() { return {
57
+ "type": {
58
+ "type": "string",
59
+ "mutable": false,
60
+ "complexType": {
61
+ "original": "'text' | 'textarea' | 'checkbox' | 'select'",
62
+ "resolved": "\"checkbox\" | \"select\" | \"text\" | \"textarea\"",
63
+ "references": {}
64
+ },
65
+ "required": false,
66
+ "optional": false,
67
+ "docs": {
68
+ "tags": [],
69
+ "text": ""
70
+ },
71
+ "attribute": "type",
72
+ "reflect": false
73
+ },
74
+ "value": {
75
+ "type": "any",
76
+ "mutable": true,
77
+ "complexType": {
78
+ "original": "string | boolean",
79
+ "resolved": "boolean | string",
80
+ "references": {}
81
+ },
82
+ "required": false,
83
+ "optional": false,
84
+ "docs": {
85
+ "tags": [],
86
+ "text": ""
87
+ },
88
+ "attribute": "value",
89
+ "reflect": false
90
+ },
91
+ "label": {
92
+ "type": "string",
93
+ "mutable": false,
94
+ "complexType": {
95
+ "original": "string",
96
+ "resolved": "string",
97
+ "references": {}
98
+ },
99
+ "required": false,
100
+ "optional": false,
101
+ "docs": {
102
+ "tags": [],
103
+ "text": ""
104
+ },
105
+ "attribute": "label",
106
+ "reflect": false
107
+ },
108
+ "name": {
109
+ "type": "string",
110
+ "mutable": false,
111
+ "complexType": {
112
+ "original": "string",
113
+ "resolved": "string",
114
+ "references": {}
115
+ },
116
+ "required": false,
117
+ "optional": false,
118
+ "docs": {
119
+ "tags": [],
120
+ "text": ""
121
+ },
122
+ "attribute": "name",
123
+ "reflect": false
124
+ },
125
+ "placeholder": {
126
+ "type": "string",
127
+ "mutable": false,
128
+ "complexType": {
129
+ "original": "string",
130
+ "resolved": "string",
131
+ "references": {}
132
+ },
133
+ "required": false,
134
+ "optional": false,
135
+ "docs": {
136
+ "tags": [],
137
+ "text": ""
138
+ },
139
+ "attribute": "placeholder",
140
+ "reflect": false
141
+ },
142
+ "checked": {
143
+ "type": "boolean",
144
+ "mutable": false,
145
+ "complexType": {
146
+ "original": "boolean",
147
+ "resolved": "boolean",
148
+ "references": {}
149
+ },
150
+ "required": false,
151
+ "optional": false,
152
+ "docs": {
153
+ "tags": [],
154
+ "text": ""
155
+ },
156
+ "attribute": "checked",
157
+ "reflect": false
158
+ },
159
+ "options": {
160
+ "type": "string",
161
+ "mutable": false,
162
+ "complexType": {
163
+ "original": "{ value: string; label: string }[] | string",
164
+ "resolved": "string | { value: string; label: string; }[]",
165
+ "references": {}
166
+ },
167
+ "required": false,
168
+ "optional": false,
169
+ "docs": {
170
+ "tags": [],
171
+ "text": ""
172
+ },
173
+ "attribute": "options",
174
+ "reflect": false
175
+ }
176
+ }; }
177
+ static get events() { return [{
178
+ "method": "valueChanged",
179
+ "name": "valueChanged",
180
+ "bubbles": true,
181
+ "cancelable": true,
182
+ "composed": true,
183
+ "docs": {
184
+ "tags": [],
185
+ "text": ""
186
+ },
187
+ "complexType": {
188
+ "original": "string | boolean",
189
+ "resolved": "boolean | string",
190
+ "references": {}
191
+ }
192
+ }, {
193
+ "method": "checkedChanged",
194
+ "name": "checkedChanged",
195
+ "bubbles": true,
196
+ "cancelable": true,
197
+ "composed": true,
198
+ "docs": {
199
+ "tags": [],
200
+ "text": ""
201
+ },
202
+ "complexType": {
203
+ "original": "boolean",
204
+ "resolved": "boolean",
205
+ "references": {}
206
+ }
207
+ }]; }
208
+ static get watchers() { return [{
209
+ "propName": "options",
210
+ "methodName": "arrayDataWatcher"
211
+ }]; }
212
+ }
@@ -69,7 +69,8 @@ export class PageLogin {
69
69
  Password: this.password.value,
70
70
  RememberClient: this.rememberMe.value
71
71
  });
72
- sessionStorage.setItem('rememberMe', this.rememberMe.value == true ? '1' : '0');
72
+ console.log(result);
73
+ //sessionStorage.setItem('rememberMe', this.rememberMe.value == true ? '1' : '0');
73
74
  this.userDidLogIn.emit({ loginStatus: true });
74
75
  }
75
76
  }
@@ -1,4 +1,4 @@
1
- sparkle-quiz {
1
+ sparkle-quiz-old {
2
2
  display: block;
3
3
  font-family: var(--font-family);
4
4
  --sparkle-quiz-question-container-padding: 10px 0px;
@@ -1,5 +1,5 @@
1
1
  import { Component, Prop, Listen, State, Event, Element, h } from '@stencil/core';
2
- export class SparkleQuiz {
2
+ export class SparkleQuizOld {
3
3
  constructor() {
4
4
  this.type = 'TEXT';
5
5
  this.scale = 'FIVE-POINTS';
@@ -110,12 +110,12 @@ export class SparkleQuiz {
110
110
  return h("p", null, "No question found.");
111
111
  }
112
112
  }
113
- static get is() { return "sparkle-quiz"; }
113
+ static get is() { return "sparkle-quiz-old"; }
114
114
  static get originalStyleUrls() { return {
115
- "$": ["sparkle-quiz.scss"]
115
+ "$": ["sparkle-quiz-old.scss"]
116
116
  }; }
117
117
  static get styleUrls() { return {
118
- "$": ["sparkle-quiz.css"]
118
+ "$": ["sparkle-quiz-old.css"]
119
119
  }; }
120
120
  static get properties() { return {
121
121
  "questionId": {
@@ -1,53 +1,52 @@
1
1
  import { Component, Prop, Watch, Listen, State, Event, Element, h } from '@stencil/core';
2
2
  import { AssetsService } from '../../services/core/assets.service';
3
- import { EnvironmentConfigService } from "../../services/environment/environment-config.service";
4
- export class SparkleQuizV1 {
3
+ import { EnvironmentConfigService } from '../../services/environment/environment-config.service';
4
+ export class SparkleQuiz {
5
5
  async loadQuestion() {
6
6
  if (this.quizData) {
7
7
  this.question = this.quizData[+this.questionId];
8
8
  }
9
9
  }
10
- async componentWillLoad() {
11
- }
10
+ async componentWillLoad() { }
12
11
  async componentDidLoad() {
13
12
  const config = EnvironmentConfigService.getInstance().get('sparkle');
14
13
  this.quizData = await AssetsService.getInstance().loadJsonFile(config.quizPath);
15
14
  await this.loadQuestion();
16
15
  this.quizAnswerChanged.emit({
17
16
  question: null,
18
- answer: "1"
17
+ answer: '1',
19
18
  });
20
19
  }
21
20
  quizInputChangeHandler(event) {
22
21
  this.quizAnswerChanged.emit({
23
22
  question: event.detail.question,
24
- answer: event.detail.value
23
+ answer: event.detail.value,
25
24
  });
26
25
  }
27
26
  quizFeedbackChangeHandler(event) {
28
27
  this.quizAnswerChanged.emit({
29
28
  question: event.detail.question,
30
- answer: event.detail.value
29
+ answer: event.detail.value,
31
30
  });
32
31
  }
33
32
  quizSelectChangeHandler(event) {
34
33
  this.quizAnswerChanged.emit({
35
34
  question: event.detail.question,
36
- answer: event.detail.value
35
+ answer: event.detail.value,
37
36
  });
38
37
  }
39
38
  quizOpinionChangeHandler(event) {
40
39
  this.quizAnswerChanged.emit({
41
40
  question: event.detail.question,
42
- answer: event.detail.value
41
+ answer: event.detail.value,
43
42
  });
44
43
  }
45
44
  getQuestionFeedback() {
46
- if (this.question.questionType == "MULTIPLE-CHOICE") {
45
+ if (this.question.questionType == 'MULTIPLE-CHOICE') {
47
46
  const feedbacks = this.question.options.filter(x => x.correct == true).map(x => x.feedback);
48
47
  return feedbacks.length > 0 && feedbacks.map(feedback => h("small", null, feedback));
49
48
  }
50
- else if (this.question.questionType == "FEEDBACK" || this.question.questionType == "TEXT") {
49
+ else if (this.question.questionType == 'FEEDBACK' || this.question.questionType == 'TEXT') {
51
50
  return this.question.feedback && h("small", null,
52
51
  " ",
53
52
  this.question.feedback);
@@ -57,43 +56,42 @@ export class SparkleQuizV1 {
57
56
  return h("div", null, this.correct ? h("strong", null, "Good job!") : h("strong", null, "Incorrect answer, please try again."));
58
57
  }
59
58
  renderQuestion() {
60
- if (this.question.questionType == "MULTIPLE-CHOICE") {
59
+ if (this.question.questionType == 'MULTIPLE-CHOICE') {
61
60
  return h("sparkle-quiz-select", { question: this.question, allowMultiple: true });
62
61
  }
63
- else if (this.question.questionType == "FEEDBACK") {
62
+ else if (this.question.questionType == 'FEEDBACK') {
64
63
  return h("sparkle-quiz-feedback", { question: this.question });
65
64
  }
66
- else if (this.question.questionType == "TEXT") {
65
+ else if (this.question.questionType == 'TEXT') {
67
66
  return h("sparkle-quiz-input", { question: this.question });
68
67
  }
69
- else if (this.question.questionType == "OPINION") {
68
+ else if (this.question.questionType == 'OPINION') {
70
69
  return h("sparkle-quiz-opinion", { question: this.question });
71
70
  }
72
- else if (this.question.questionType == "POLL") {
71
+ else if (this.question.questionType == 'POLL') {
73
72
  return h("sparkle-quiz-poll", { question: this.question });
74
73
  }
75
74
  }
76
75
  render() {
77
76
  if (this.question) {
78
77
  let classes = {
79
- 'correct': this.submitted && this.correct,
80
- 'incorrect': this.submitted && !this.correct
78
+ correct: this.submitted && this.correct,
79
+ incorrect: this.submitted && !this.correct,
81
80
  };
82
- return h("div", { class: classes },
81
+ return (h("div", { class: classes },
83
82
  this.renderQuestion(),
84
- this.submitted && this.showInstantResult && h("div", { class: "feedback-container" }, [this.showAnswerStatus(),
85
- this.getQuestionFeedback()]));
83
+ this.submitted && this.showInstantResult && h("div", { class: "feedback-container" }, [this.showAnswerStatus(), this.getQuestionFeedback()])));
86
84
  }
87
85
  else {
88
86
  return h("p", null, "No question found.");
89
87
  }
90
88
  }
91
- static get is() { return "sparkle-quiz-v1"; }
89
+ static get is() { return "sparkle-quiz"; }
92
90
  static get originalStyleUrls() { return {
93
- "$": ["sparkle-quiz-v1.scss"]
91
+ "$": ["sparkle-quiz.scss"]
94
92
  }; }
95
93
  static get styleUrls() { return {
96
- "$": ["sparkle-quiz-v1.css"]
94
+ "$": ["sparkle-quiz.css"]
97
95
  }; }
98
96
  static get properties() { return {
99
97
  "questionId": {
@@ -180,7 +178,7 @@ export class SparkleQuizV1 {
180
178
  "text": ""
181
179
  },
182
180
  "complexType": {
183
- "original": "{ answer: any, question: SparkleQuizQuestion }",
181
+ "original": "{ answer: any; question: SparkleQuizQuestion }",
184
182
  "resolved": "{ answer: any; question: SparkleQuizQuestion; }",
185
183
  "references": {
186
184
  "SparkleQuizQuestion": {