@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,17 +1,18 @@
1
1
  import * as signalR from '@microsoft/signalr';
2
2
  import { EnvironmentConfigService } from '.';
3
3
  import signalRStore from '../stores/signalR.store';
4
+ import { TokenService } from './token.service';
4
5
  export class SignalRService {
5
6
  constructor() {
6
- console.log("Starting signalR");
7
+ console.log('Starting signalR');
7
8
  //TODO: update courseClassId
8
9
  var defaultCourseClassId = 1;
9
10
  var sparkleConfig = EnvironmentConfigService.getInstance().get('sparkle');
10
11
  this.connection = new signalR.HubConnectionBuilder()
11
- .withUrl(`${sparkleConfig.apiUrl}hubs/sparkle?url=${window.location.href}${defaultCourseClassId > 0 ? "&courseClassId=" + defaultCourseClassId : ""}`, {
12
+ .withUrl(`${sparkleConfig.apiUrl}hubs/sparkle?url=${window.location.href}${defaultCourseClassId > 0 ? '&courseClassId=' + defaultCourseClassId : ''}`, {
12
13
  accessTokenFactory: () => this.getToken(),
13
14
  skipNegotiation: true,
14
- transport: signalR.HttpTransportType.WebSockets
15
+ transport: signalR.HttpTransportType.WebSockets,
15
16
  })
16
17
  .configureLogging(signalR.LogLevel.Debug)
17
18
  //.withAutomaticReconnect()
@@ -26,15 +27,14 @@ export class SignalRService {
26
27
  // If we've been reconnecting for more than 60 seconds so far, stop reconnecting.
27
28
  return null;
28
29
  }
29
- }
30
+ },
30
31
  })
31
32
  .build();
32
- this.connection.on("SendMessage", (user, data) => {
33
+ this.connection.on('SendMessage', (user, data) => {
33
34
  let payload = JSON.parse(data);
34
- console.log("Server said ", user, payload);
35
- });
36
- this.connection.onclose(error => {
35
+ console.log('Server said ', user, payload);
37
36
  });
37
+ this.connection.onclose(error => { });
38
38
  this.connection.onreconnecting(error => {
39
39
  console.assert(this.connection.state === signalR.HubConnectionState.Reconnecting);
40
40
  });
@@ -49,36 +49,34 @@ export class SignalRService {
49
49
  return SignalRService.instance;
50
50
  }
51
51
  async start() {
52
- console.log("start");
52
+ console.log('start');
53
53
  try {
54
54
  signalRStore.state.connecting = true;
55
55
  signalRStore.state.connected = !signalRStore.state.connecting;
56
56
  await this.connection.start();
57
57
  console.log(this.connection);
58
58
  signalRStore.state.connecting = false;
59
- signalRStore.state.connected = !signalRStore.state.connecting;
59
+ signalRStore.state.connected = this.connection.state === signalR.HubConnectionState.Connected;
60
60
  console.assert(this.connection.state === signalR.HubConnectionState.Connected);
61
- console.log("SignalR Connected.");
61
+ console.log('SignalR Connected.');
62
62
  }
63
63
  catch (err) {
64
64
  console.assert(this.connection.state === signalR.HubConnectionState.Disconnected);
65
65
  console.log(err);
66
66
  }
67
67
  }
68
- ;
69
68
  async callSignalR(hub, data) {
70
- console.log('signalR invoke', hub, this.connection.connectionState);
71
- if (!this.getToken()) {
72
- console.log("Cannot connect to signalR. Not logged in");
69
+ let token = await this.getToken();
70
+ if (!token) {
71
+ console.log('Cannot connect to signalR. Not logged in');
73
72
  return;
74
73
  }
75
74
  this.connection.invoke(hub, JSON.stringify(data));
76
- console.log('After signalR invoke', hub, this.connection.connectionState);
77
75
  }
78
76
  getToken() {
79
- var sparkleConfig = EnvironmentConfigService.getInstance().get('sparkle');
80
- if (!!sparkleConfig && !!sparkleConfig.auth && !!sparkleConfig.auth.getToken()) {
81
- return sparkle.auth.getToken();
77
+ var token = TokenService.getInstance().getTokenSync();
78
+ if (token) {
79
+ return token;
82
80
  }
83
81
  return null;
84
82
  }
@@ -0,0 +1,68 @@
1
+ import AppConsts from '../appconst';
2
+ import { AuthStore } from '../stores';
3
+ import { get, remove, set } from './core/localstorage.service';
4
+ export class TokenService {
5
+ static getInstance() {
6
+ if (!TokenService.instance) {
7
+ TokenService.instance = new TokenService();
8
+ }
9
+ return TokenService.instance;
10
+ }
11
+ async getToken() {
12
+ let authUser = await get(AppConsts.AUTH_USER_LOCALSTORAGE);
13
+ if (authUser && authUser.JWToken) {
14
+ if (new Date(authUser.ExpiresOn).getTime() > new Date().getTime()) {
15
+ return authUser.JWToken;
16
+ }
17
+ }
18
+ return null;
19
+ }
20
+ async getAuthUser() {
21
+ let authUser = await get(AppConsts.AUTH_USER_LOCALSTORAGE);
22
+ if (authUser && authUser.JWToken) {
23
+ if (new Date(authUser.ExpiresOn).getTime() > new Date().getTime()) {
24
+ return authUser;
25
+ }
26
+ }
27
+ return null;
28
+ }
29
+ getAuthUserSync() {
30
+ let authUser = JSON.parse(localStorage.getItem(AppConsts.AUTH_USER_LOCALSTORAGE));
31
+ if (authUser && authUser.JWToken) {
32
+ if (new Date(authUser.ExpiresOn).getTime() > new Date().getTime()) {
33
+ return authUser;
34
+ }
35
+ }
36
+ return null;
37
+ }
38
+ getTokenSync() {
39
+ let authUser = JSON.parse(localStorage.getItem(AppConsts.AUTH_USER_LOCALSTORAGE));
40
+ if (authUser && authUser.JWToken) {
41
+ if (new Date(authUser.ExpiresOn).getTime() > new Date().getTime()) {
42
+ return authUser.JWToken;
43
+ }
44
+ }
45
+ return null;
46
+ }
47
+ async getTokenExpiry() {
48
+ let authUser = await get(AppConsts.AUTH_USER_LOCALSTORAGE);
49
+ if (!authUser) {
50
+ return 0;
51
+ }
52
+ let timeDiff = 0;
53
+ if (authUser.ExpiresOn) {
54
+ timeDiff = new Date(authUser.ExpiresOn).getTime() - new Date().getTime();
55
+ }
56
+ return Math.max(0, timeDiff);
57
+ }
58
+ async saveAuthUser(authUser) {
59
+ AuthStore.state.authUser = Object.assign({}, authUser);
60
+ AuthStore.state.isAuthenticated = true;
61
+ await set(AppConsts.AUTH_USER_LOCALSTORAGE, authUser);
62
+ }
63
+ async removeAuthUser() {
64
+ AuthStore.state.authUser = null;
65
+ AuthStore.state.isAuthenticated = false;
66
+ await remove(AppConsts.AUTH_USER_LOCALSTORAGE);
67
+ }
68
+ }
@@ -20,7 +20,7 @@ export function GetGoalAppData(title, description, category, percentage, goalTex
20
20
  Description: description,
21
21
  Category: category,
22
22
  Percentage: percentage,
23
- GoalText: goalText
23
+ GoalText: goalText,
24
24
  };
25
25
  }
26
26
  export function MyMoodTemplate(feeling, intensity, location) {
@@ -41,12 +41,15 @@ export function MyGoalTemplate(goalName, text, progress) {
41
41
  export function MyGoalTemplateJSON(goalName, goalUpdateText, progress) {
42
42
  return JSON.stringify({ GoalTitle: goalName, GoalText: goalUpdateText, GoalProgress: progress });
43
43
  }
44
+ export function FeedPostJSON(postText) {
45
+ return JSON.stringify({ PostText: postText });
46
+ }
44
47
  export class SparkleGlobal {
45
48
  }
46
49
  SparkleGlobal.MY_GOALS_APP_ID = 1;
47
50
  SparkleGlobal.MY_HEALTH_APP_ID = 2;
48
51
  SparkleGlobal.MY_MOOD_APP_ID = 3;
49
- SparkleGlobal.LOCALSTORAGE_CLASSROOM_MODE = "SPARKLE_CLASSROOM_MODE";
52
+ SparkleGlobal.LOCALSTORAGE_CLASSROOM_MODE = 'SPARKLE_CLASSROOM_MODE';
50
53
  export function date(date) {
51
54
  return format(new Date(date), 'DD MMM YYYY');
52
55
  }
@@ -1,6 +1,7 @@
1
1
  import { c as getAssetPath, h } from './index-c04b9ed5.js';
2
- import { s as set, r as remove, g as get } from './localstorage.service-4bf408c8.js';
3
- import { H as HttpService } from './httpService-7b75b095.js';
2
+ import { r as remove, g as get } from './localstorage.service-4bf408c8.js';
3
+ import { H as HttpService } from './httpService-db476835.js';
4
+ import { T as TokenService, A as AppConsts } from './token.service-20f1a256.js';
4
5
  import { A as AuthStore } from './auth.store-dba2c2da.js';
5
6
 
6
7
  //import * as abpTypings from '../lib/abp';
@@ -119,19 +120,6 @@ async function initSetupConfig(config) {
119
120
  await setupConfig(config);
120
121
  }
121
122
 
122
- const AppConsts = {
123
- AUTH_USER_LOCALSTORAGE: "CurrentUser",
124
- userManagement: {
125
- defaultAdminUserName: 'admin',
126
- },
127
- localization: {
128
- defaultLocalizationSourceName: 'Test',
129
- },
130
- authorization: {
131
- encrptedAuthTokenName: 'enc_auth_token',
132
- }
133
- };
134
-
135
123
  class AuthService {
136
124
  constructor() { }
137
125
  static getInstance() {
@@ -148,7 +136,7 @@ class AuthService {
148
136
  let result;
149
137
  try {
150
138
  result = await HttpService.http.post('api/Account/Authenticate', authenticationInput, {
151
- headers: headers
139
+ headers: headers,
152
140
  });
153
141
  if (result) {
154
142
  const authData = result.Data;
@@ -162,15 +150,17 @@ class AuthService {
162
150
  IssuedOn: authData.IssuedOn,
163
151
  ExpiresOn: authData.ExpiresOn,
164
152
  RefreshToken: authData.RefreshToken,
165
- PhotoUrl: "",
166
- IsFacilitator: authData.Roles.indexOf("Facilitator") > 0
153
+ PhotoUrl: '',
154
+ IsFacilitator: authData.Roles.indexOf('Facilitator') > 0,
167
155
  };
168
- const expireDate = authenticationInput.RememberClient ? new Date(authUser.ExpiresOn) : undefined;
169
- sparkle.auth.setToken(authUser.JWToken, expireDate);
170
- //TODO: change authUser.JWToken to encrypted
171
- sparkle.utils.setCookieValue(AppConsts.authorization.encrptedAuthTokenName, authUser.JWToken, expireDate, sparkle.appPath);
172
- await set(AppConsts.AUTH_USER_LOCALSTORAGE, authUser);
173
- AuthStore.state.authUser = Object.assign({}, authUser);
156
+ //const expireDate = authenticationInput.RememberClient ? new Date(authUser.ExpiresOn) : undefined;
157
+ // let authObj: EnvironmentAuthConfig = {
158
+ // token: authUser.JWToken,
159
+ // expiryDate: expireDate,
160
+ // };
161
+ // EnvironmentConfigService.getInstance().setupAuth(authObj);
162
+ //sparkle.utils.setCookieValue(AppConsts.authorization.encrptedAuthTokenName, authUser.JWToken, expireDate, sparkle.appPath);
163
+ await TokenService.getInstance().saveAuthUser(authUser);
174
164
  AuthStore.state.loading = false;
175
165
  return authUser;
176
166
  }
@@ -182,10 +172,8 @@ class AuthService {
182
172
  }
183
173
  async signOut() {
184
174
  await remove(AppConsts.AUTH_USER_LOCALSTORAGE);
175
+ await TokenService.getInstance().removeAuthUser();
185
176
  sessionStorage.clear();
186
- sparkle.auth.clearToken();
187
- AuthStore.state.authUser = null;
188
- AuthStore.state.isAuthenticated = false;
189
177
  }
190
178
  async getLocalAuthUser() {
191
179
  return get(AppConsts.AUTH_USER_LOCALSTORAGE);
@@ -212,9 +200,9 @@ const Route = (_a) => {
212
200
  const Component = component;
213
201
  return (h("stencil-route", Object.assign({}, props, { routeRender: (props) => {
214
202
  if (!AuthStore.state.isAuthenticated)
215
- return (h("stencil-router-redirect", { url: "/login" }));
203
+ return h("stencil-router-redirect", { url: "/login" });
216
204
  if (permission && !isGranted(permission)) {
217
- return (h("stencil-router-redirect", { url: "/unauthorized" }));
205
+ return h("stencil-router-redirect", { url: "/unauthorized" });
218
206
  }
219
207
  return Component ? h(Component, Object.assign({}, props, props.componentProps)) : render(props);
220
208
  } })));
@@ -1,13 +1,13 @@
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
- import { S as SparkleGlobal } from './util-6ef753e9.js';
3
+ import { S as SparkleGlobal } from './util-57cc8006.js';
4
4
 
5
- const { state: state$1, onChange } = createStore({
5
+ const { state, onChange } = createStore({
6
6
  goals: [],
7
7
  goalsLoading: false,
8
8
  goalLoading: false
9
9
  });
10
- const goalStore = { state: state$1, onChange };
10
+ const goalStore = { state, onChange };
11
11
 
12
12
  class AppDataService {
13
13
  constructor() { }
@@ -67,54 +67,4 @@ class AppDataService {
67
67
  }
68
68
  }
69
69
 
70
- const { state, reset } = createStore({
71
- posts: [],
72
- postsLoading: false,
73
- createPostLoading: false,
74
- postIdLoading: null
75
- });
76
- const feedStore = { state, reset };
77
-
78
- class FeedService {
79
- constructor() { }
80
- static getInstance() {
81
- if (!FeedService.instance) {
82
- FeedService.instance = new FeedService();
83
- }
84
- return FeedService.instance;
85
- }
86
- async getAllPosts() {
87
- feedStore.state.postsLoading = true;
88
- let result = await HttpService.http.get(`api/v1/Feed/GetAll`);
89
- if (result) {
90
- feedStore.state.posts = result.Data;
91
- feedStore.state.postsLoading = false;
92
- }
93
- return result;
94
- }
95
- async createPost(payload) {
96
- feedStore.state.createPostLoading = true;
97
- let result = await HttpService.http.post(`api/v1/Feed/PostFeed`, payload);
98
- if (result) {
99
- feedStore.state.posts = [result.Data, ...feedStore.state.posts];
100
- feedStore.state.createPostLoading = false;
101
- }
102
- return result;
103
- }
104
- async createPostComment(payload) {
105
- feedStore.state.postIdLoading = payload.PostId;
106
- let result = await HttpService.http.post(`api/v1/Feed/Comment`, payload);
107
- if (result) {
108
- feedStore.state.posts = feedStore.state.posts.map((item) => {
109
- if (item.Id == result.Data.ClassFeedPostId) {
110
- return Object.assign(Object.assign({}, item), { Comments: [...item.Comments, result.Data] });
111
- }
112
- return item;
113
- });
114
- feedStore.state.postIdLoading = null;
115
- }
116
- return result;
117
- }
118
- }
119
-
120
- export { AppDataService as A, FeedService as F, feedStore as f, goalStore as g };
70
+ export { AppDataService as A, goalStore as g };
@@ -1,4 +1,4 @@
1
- import { E as EnvironmentConfigService } from './environment-config.service-2b5d692b.js';
1
+ import { E as EnvironmentConfigService } from './environment-config.service-b191f276.js';
2
2
 
3
3
  class AssetsService {
4
4
  constructor() {
@@ -15,7 +15,6 @@ class EnvironmentConfigService {
15
15
  }
16
16
  const win = window;
17
17
  const Sparkle = win.Sparkle;
18
- console.log('getting info');
19
18
  this.m = new Map(Object.entries(Sparkle.config));
20
19
  }
21
20
  get(key, fallback) {
@@ -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 } = createStore({
@@ -0,0 +1,54 @@
1
+ import { H as HttpService } from './httpService-db476835.js';
2
+ import { d as createStore } from './auth.store-dba2c2da.js';
3
+
4
+ const { state, reset } = createStore({
5
+ posts: [],
6
+ postsLoading: false,
7
+ createPostLoading: false,
8
+ postIdLoading: null
9
+ });
10
+ const feedStore = { state, reset };
11
+
12
+ class FeedService {
13
+ constructor() { }
14
+ static getInstance() {
15
+ if (!FeedService.instance) {
16
+ FeedService.instance = new FeedService();
17
+ }
18
+ return FeedService.instance;
19
+ }
20
+ async getAllPosts() {
21
+ feedStore.state.postsLoading = true;
22
+ let result = await HttpService.http.get(`api/v1/Feed/GetAll`);
23
+ if (result) {
24
+ feedStore.state.posts = result.Data;
25
+ feedStore.state.postsLoading = false;
26
+ }
27
+ return result;
28
+ }
29
+ async createPost(payload) {
30
+ feedStore.state.createPostLoading = true;
31
+ let result = await HttpService.http.post(`api/v1/Feed/PostFeed`, payload);
32
+ if (result) {
33
+ feedStore.state.posts = [result.Data, ...feedStore.state.posts];
34
+ feedStore.state.createPostLoading = false;
35
+ }
36
+ return result;
37
+ }
38
+ async createPostComment(payload) {
39
+ feedStore.state.postIdLoading = payload.PostId;
40
+ let result = await HttpService.http.post(`api/v1/Feed/Comment`, payload);
41
+ if (result) {
42
+ feedStore.state.posts = feedStore.state.posts.map((item) => {
43
+ if (item.Id == result.Data.ClassFeedPostId) {
44
+ return Object.assign(Object.assign({}, item), { Comments: [...item.Comments, result.Data] });
45
+ }
46
+ return item;
47
+ });
48
+ feedStore.state.postIdLoading = null;
49
+ }
50
+ return result;
51
+ }
52
+ }
53
+
54
+ export { FeedService as F, feedStore as f };