catchup-library-web 1.0.2 → 1.0.4

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 (32) hide show
  1. package/dist/index.d.mts +305 -2
  2. package/dist/index.d.ts +305 -2
  3. package/dist/index.js +2768 -334
  4. package/dist/index.mjs +2657 -292
  5. package/package.json +1 -1
  6. package/src/components/boxes/SelectionBox.tsx +41 -0
  7. package/src/components/boxes/SelectionCheckbox.tsx +66 -0
  8. package/src/components/labels/ActivityTemplateLabel.tsx +15 -0
  9. package/src/components/labels/BrandLabel.tsx +19 -0
  10. package/src/components/labels/CoterieLabel.tsx +11 -0
  11. package/src/components/labels/GradeLabel.tsx +11 -0
  12. package/src/components/labels/OutcomeLabel.tsx +15 -0
  13. package/src/components/labels/PersonalLabel.tsx +23 -0
  14. package/src/components/labels/PublishingHouseLabel.tsx +23 -0
  15. package/src/components/modals/BaseModal.tsx +56 -0
  16. package/src/components/tabs/SelectionTab.tsx +45 -0
  17. package/src/index.ts +25 -0
  18. package/src/properties/BoxProperties.ts +12 -0
  19. package/src/properties/GroupProperties.ts +1 -1
  20. package/src/properties/LabelProperties.ts +33 -0
  21. package/src/properties/ModalProperties.ts +8 -0
  22. package/src/properties/TabProperties.ts +9 -0
  23. package/src/utilization/AuthorizationUtilization.ts +15 -0
  24. package/src/utilization/CategoryUtilization.ts +314 -0
  25. package/src/utilization/DateUtilization.ts +85 -0
  26. package/src/utilization/FunctionUtilization.ts +50 -0
  27. package/src/utilization/GamificationUtilization.ts +495 -0
  28. package/src/utilization/IndividualModelUtilization.ts +48 -0
  29. package/src/utilization/ManagementUtilization.ts +1201 -0
  30. package/src/utilization/NotificationUtilization.ts +59 -0
  31. package/src/utilization/ReportUtilization.ts +42 -0
  32. package/src/utilization/TokenUtilization.ts +39 -0
@@ -0,0 +1,495 @@
1
+ import i18n from "../language/i18n";
2
+
3
+ const retrieveSourceTypeOptionList = (coterieOnly: boolean) => {
4
+ const currentSourceTypeOptionList = [
5
+ {
6
+ value: "CATCHTIVITY",
7
+ text: i18n.t("CATCHTIVITY"),
8
+ },
9
+ {
10
+ value: "CATCHXAM",
11
+ text: i18n.t("CATCHXAM"),
12
+ },
13
+ // {
14
+ // value: "STANDARD_EXAM",
15
+ // text: i18n.t("STANDARD_EXAM"),
16
+ // },
17
+ {
18
+ value: "ETUDE",
19
+ text: i18n.t("ETUDE"),
20
+ },
21
+ {
22
+ value: "CONTEST",
23
+ text: i18n.t("CONTEST"),
24
+ },
25
+ {
26
+ value: "ACTIVITY",
27
+ text: i18n.t("ACTIVITY"),
28
+ },
29
+ ];
30
+ if (!coterieOnly) {
31
+ currentSourceTypeOptionList.push({
32
+ value: "LOGIN",
33
+ text: i18n.t("LOGIN"),
34
+ });
35
+ }
36
+ return currentSourceTypeOptionList;
37
+ };
38
+
39
+ const retrieveBadgeTypeOptionList = (isActivity: boolean) => {
40
+ const currentBadgeTypeOptionList = [
41
+ {
42
+ value: "COUNT",
43
+ text: i18n.t("COUNT"),
44
+ },
45
+ ];
46
+ if (isActivity) {
47
+ currentBadgeTypeOptionList.push({
48
+ value: "CORRECT",
49
+ text: i18n.t("CORRECT"),
50
+ });
51
+ // currentBadgeTypeOptionList.push({
52
+ // value: "INCORRECT",
53
+ // text: i18n.t("INCORRECT"),
54
+ // });
55
+ currentBadgeTypeOptionList.push({
56
+ value: "REVIEW",
57
+ text: i18n.t("REVIEW"),
58
+ });
59
+ currentBadgeTypeOptionList.push({
60
+ value: "TIME_SPENT",
61
+ text: i18n.t("TIME_SPENT"),
62
+ });
63
+ }
64
+ return currentBadgeTypeOptionList;
65
+ };
66
+
67
+ export const retrieveOtherBadgeDTOList = () => {
68
+ const badgeList = [];
69
+ const sourceTypeOptionList = retrieveSourceTypeOptionList(false);
70
+ const filteredSourceTypeOptionList = sourceTypeOptionList.filter(
71
+ (sourceTypeOption) => sourceTypeOption.value === "LOGIN"
72
+ );
73
+ for (let i = 1; i <= 5; i++) {
74
+ for (const sourceTypeOption of filteredSourceTypeOptionList) {
75
+ const badgeTypeOptionList = retrieveBadgeTypeOptionList(
76
+ sourceTypeOption.value === "ACTIVITY"
77
+ );
78
+ for (const badgeTypeOption of badgeTypeOptionList) {
79
+ badgeList.push({
80
+ badgeDTO: {
81
+ coterieType: "MANAGEMENT",
82
+ sourceType: sourceTypeOption.value,
83
+ badgeType: badgeTypeOption.value,
84
+ },
85
+ level: i,
86
+ });
87
+ }
88
+ }
89
+ }
90
+ return badgeList;
91
+ };
92
+
93
+ export const retrieveAllEarnedBadgeDTOListByCoterieTypeList = (
94
+ coterieTypeList: any
95
+ ) => {
96
+ const badgeList = [];
97
+ for (const coterieType of coterieTypeList) {
98
+ badgeList.push(...retrieveAllEarnedBadgeDTOListByCoterieType(coterieType));
99
+ }
100
+ return badgeList;
101
+ };
102
+
103
+ export const retrieveAllEarnedBadgeDTOListByCoterieType = (
104
+ coterieType: string
105
+ ) => {
106
+ const sourceTypeOptionList = retrieveSourceTypeOptionList(true);
107
+ const badgeList = [];
108
+ for (let i = 1; i <= 5; i++) {
109
+ for (const sourceTypeOption of sourceTypeOptionList) {
110
+ const badgeTypeOptionList = retrieveBadgeTypeOptionList(
111
+ sourceTypeOption.value === "ACTIVITY"
112
+ );
113
+ for (const badgeTypeOption of badgeTypeOptionList) {
114
+ badgeList.push({
115
+ badgeDTO: {
116
+ coterieType,
117
+ sourceType: sourceTypeOption.value,
118
+ badgeType: badgeTypeOption.value,
119
+ },
120
+ level: i,
121
+ });
122
+ }
123
+ }
124
+ }
125
+ return badgeList.sort((a, b) => {
126
+ if (a.badgeDTO.sourceType !== b.badgeDTO.sourceType) {
127
+ return a.badgeDTO.sourceType.localeCompare(b.badgeDTO.sourceType);
128
+ }
129
+ return a.badgeDTO.badgeType.localeCompare(b.badgeDTO.badgeType);
130
+ });
131
+ };
132
+
133
+ export const retrieveBadgeRuleListByParams = (
134
+ coterieType: string,
135
+ sourceType: string,
136
+ badgeType: string
137
+ ) => {
138
+ if (coterieType === "MANAGEMENT") {
139
+ if (sourceType === "ACTIVITY") {
140
+ if (badgeType === "COUNT") {
141
+ return [
142
+ {
143
+ level: 1,
144
+ value: 50,
145
+ },
146
+ {
147
+ level: 2,
148
+ value: 100,
149
+ },
150
+ {
151
+ level: 3,
152
+ value: 500,
153
+ },
154
+ {
155
+ level: 4,
156
+ value: 1000,
157
+ },
158
+ {
159
+ level: 5,
160
+ value: 5000,
161
+ },
162
+ ];
163
+ }
164
+ } else if (sourceType === "LOGIN") {
165
+ return [
166
+ {
167
+ level: 1,
168
+ value: 3,
169
+ },
170
+ {
171
+ level: 2,
172
+ value: 7,
173
+ },
174
+ {
175
+ level: 3,
176
+ value: 15,
177
+ },
178
+ {
179
+ level: 4,
180
+ value: 30,
181
+ },
182
+ {
183
+ level: 5,
184
+ value: 90,
185
+ },
186
+ ];
187
+ } else {
188
+ if (badgeType === "COUNT") {
189
+ return [
190
+ {
191
+ level: 1,
192
+ value: 5,
193
+ },
194
+ {
195
+ level: 2,
196
+ value: 10,
197
+ },
198
+ {
199
+ level: 3,
200
+ value: 50,
201
+ },
202
+ {
203
+ level: 4,
204
+ value: 100,
205
+ },
206
+ {
207
+ level: 5,
208
+ value: 500,
209
+ },
210
+ ];
211
+ } else {
212
+ return [
213
+ {
214
+ level: 1,
215
+ value: 25,
216
+ },
217
+ {
218
+ level: 2,
219
+ value: 50,
220
+ },
221
+ {
222
+ level: 3,
223
+ value: 250,
224
+ },
225
+ {
226
+ level: 4,
227
+ value: 500,
228
+ },
229
+ {
230
+ level: 5,
231
+ value: 1000,
232
+ },
233
+ ];
234
+ }
235
+ }
236
+ } else {
237
+ if (sourceType === "ACTIVITY") {
238
+ if (badgeType === "COUNT") {
239
+ return [
240
+ {
241
+ level: 1,
242
+ value: 10,
243
+ },
244
+ {
245
+ level: 2,
246
+ value: 50,
247
+ },
248
+ {
249
+ level: 3,
250
+ value: 100,
251
+ },
252
+ {
253
+ level: 4,
254
+ value: 500,
255
+ },
256
+ {
257
+ level: 5,
258
+ value: 1000,
259
+ },
260
+ ];
261
+ } else {
262
+ return [
263
+ {
264
+ level: 1,
265
+ value: 5,
266
+ },
267
+ {
268
+ level: 2,
269
+ value: 25,
270
+ },
271
+ {
272
+ level: 3,
273
+ value: 50,
274
+ },
275
+ {
276
+ level: 4,
277
+ value: 250,
278
+ },
279
+ {
280
+ level: 5,
281
+ value: 500,
282
+ },
283
+ ];
284
+ }
285
+ } else if (sourceType === "LOGIN") {
286
+ return [];
287
+ } else {
288
+ if (badgeType === "COUNT") {
289
+ return [
290
+ {
291
+ level: 1,
292
+ value: 1,
293
+ },
294
+ {
295
+ level: 2,
296
+ value: 5,
297
+ },
298
+ {
299
+ level: 3,
300
+ value: 25,
301
+ },
302
+ {
303
+ level: 4,
304
+ value: 50,
305
+ },
306
+ {
307
+ level: 5,
308
+ value: 100,
309
+ },
310
+ ];
311
+ }
312
+ }
313
+ }
314
+ return [];
315
+ };
316
+
317
+ export const retrieveBadgeRuleTextByParams = (
318
+ coterieType: string,
319
+ sourceType: string,
320
+ badgeType: string,
321
+ level: number
322
+ ) => {
323
+ const badgeRuleList = retrieveBadgeRuleListByParams(
324
+ coterieType,
325
+ sourceType,
326
+ badgeType
327
+ );
328
+ const foundBadgeRule = badgeRuleList[level - 1];
329
+
330
+ if (coterieType === "MANAGEMENT") {
331
+ if (sourceType === "ACTIVITY") {
332
+ if (badgeType === "COUNT") {
333
+ if (foundBadgeRule) {
334
+ return `${i18n.t("total_activity_count_text_1")}${
335
+ foundBadgeRule.value
336
+ }${i18n.t("total_activity_count_text_2")}`;
337
+ } else {
338
+ return i18n.t("none_activity_count_text");
339
+ }
340
+ } else if (badgeType === "CORRECT") {
341
+ if (foundBadgeRule) {
342
+ return `${i18n.t("total_activity_correct_text_1")}${
343
+ foundBadgeRule.value
344
+ }${i18n.t("total_activity_correct_text_2")}`;
345
+ } else {
346
+ return i18n.t("none_activity_correct_text");
347
+ }
348
+ } else if (badgeType === "REVIEW") {
349
+ if (foundBadgeRule) {
350
+ return `${i18n.t("total_activity_review_text_1")}${
351
+ foundBadgeRule.value
352
+ }${i18n.t("total_activity_review_text_2")}`;
353
+ } else {
354
+ return i18n.t("none_activity_review_text");
355
+ }
356
+ } else if (badgeType === "TIME_SPENT") {
357
+ if (foundBadgeRule) {
358
+ return `${i18n.t("total_activity_time_spent_text_1")}${
359
+ foundBadgeRule.value
360
+ }${i18n.t("total_activity_time_spent_text_2")}`;
361
+ } else {
362
+ return i18n.t("none_activity_time_spent_text");
363
+ }
364
+ }
365
+ } else if (sourceType === "CATCHTIVITY") {
366
+ if (badgeType === "COUNT") {
367
+ if (foundBadgeRule) {
368
+ return `${i18n.t("total_catchtivity_count_text_1")}${
369
+ foundBadgeRule.value
370
+ }${i18n.t("total_catchtivity_count_text_2")}`;
371
+ } else {
372
+ return i18n.t("none_catchtivity_count_text");
373
+ }
374
+ }
375
+ } else if (sourceType === "CATCHXAM") {
376
+ if (badgeType === "COUNT") {
377
+ if (foundBadgeRule) {
378
+ return `${i18n.t("total_catchxam_count_text_1")}${
379
+ foundBadgeRule.value
380
+ }${i18n.t("total_catchxam_count_text_2")}`;
381
+ } else {
382
+ return i18n.t("none_catchxam_count_text");
383
+ }
384
+ }
385
+ } else if (sourceType === "ETUDE") {
386
+ if (badgeType === "COUNT") {
387
+ if (foundBadgeRule) {
388
+ return `${i18n.t("total_etude_count_text_1")}${
389
+ foundBadgeRule.value
390
+ }${i18n.t("total_etude_count_text_2")}`;
391
+ } else {
392
+ return i18n.t("none_etude_count_text");
393
+ }
394
+ }
395
+ } else if (sourceType === "CONTEST") {
396
+ if (badgeType === "COUNT") {
397
+ if (foundBadgeRule) {
398
+ return `${i18n.t("total_contest_count_text_1")}${
399
+ foundBadgeRule.value
400
+ }${i18n.t("total_contest_count_text_2")}`;
401
+ } else {
402
+ return i18n.t("none_contest_count_text");
403
+ }
404
+ }
405
+ } else if (sourceType === "LOGIN") {
406
+ if (badgeType === "COUNT") {
407
+ if (foundBadgeRule) {
408
+ return `${i18n.t("total_login_count_text_1")}${
409
+ foundBadgeRule.value
410
+ }${i18n.t("total_login_count_text_2")}`;
411
+ } else {
412
+ return i18n.t("none_login_count_text");
413
+ }
414
+ }
415
+ }
416
+ } else {
417
+ if (sourceType === "ACTIVITY") {
418
+ if (badgeType === "COUNT") {
419
+ if (foundBadgeRule) {
420
+ return `${i18n.t("coterie_activity_count_text_1")}${
421
+ foundBadgeRule.value
422
+ }${i18n.t("coterie_activity_count_text_2")}`;
423
+ } else {
424
+ return i18n.t("none_activity_count_text");
425
+ }
426
+ } else if (badgeType === "CORRECT") {
427
+ if (foundBadgeRule) {
428
+ return `${i18n.t("coterie_activity_correct_text_1")}${
429
+ foundBadgeRule.value
430
+ }${i18n.t("coterie_activity_correct_text_2")}`;
431
+ } else {
432
+ return i18n.t("none_activity_correct_text");
433
+ }
434
+ } else if (badgeType === "REVIEW") {
435
+ if (foundBadgeRule) {
436
+ return `${i18n.t("coterie_activity_review_text_1")}${
437
+ foundBadgeRule.value
438
+ }${i18n.t("coterie_activity_review_text_2")}`;
439
+ } else {
440
+ return i18n.t("none_activity_review_text");
441
+ }
442
+ } else if (badgeType === "TIME_SPENT") {
443
+ if (foundBadgeRule) {
444
+ return `${i18n.t("coterie_activity_time_spent_text_1")}${
445
+ foundBadgeRule.value
446
+ }${i18n.t("coterie_activity_time_spent_text_2")}`;
447
+ } else {
448
+ return i18n.t("none_activity_time_spent_text");
449
+ }
450
+ }
451
+ } else if (sourceType === "CATCHTIVITY") {
452
+ if (badgeType === "COUNT") {
453
+ if (foundBadgeRule) {
454
+ return `${i18n.t("coterie_catchtivity_count_text_1")}${
455
+ foundBadgeRule.value
456
+ }${i18n.t("coterie_catchtivity_count_text_2")}`;
457
+ } else {
458
+ return i18n.t("none_catchtivity_count_text");
459
+ }
460
+ }
461
+ } else if (sourceType === "CATCHXAM") {
462
+ if (badgeType === "COUNT") {
463
+ if (foundBadgeRule) {
464
+ return `${i18n.t("coterie_catchxam_count_text_1")}${
465
+ foundBadgeRule.value
466
+ }${i18n.t("coterie_catchxam_count_text_2")}`;
467
+ } else {
468
+ return i18n.t("none_catchxam_count_text");
469
+ }
470
+ }
471
+ } else if (sourceType === "ETUDE") {
472
+ if (badgeType === "COUNT") {
473
+ if (foundBadgeRule) {
474
+ return `${i18n.t("coterie_etude_count_text_1")}${
475
+ foundBadgeRule.value
476
+ }${i18n.t("coterie_etude_count_text_2")}`;
477
+ } else {
478
+ return i18n.t("none_etude_count_text");
479
+ }
480
+ }
481
+ } else if (sourceType === "CONTEST") {
482
+ if (badgeType === "COUNT") {
483
+ if (foundBadgeRule) {
484
+ return `${i18n.t("coterie_contest_count_text_1")}${
485
+ foundBadgeRule.value
486
+ }${i18n.t("coterie_contest_count_text_2")}`;
487
+ } else {
488
+ return i18n.t("none_contest_count_text");
489
+ }
490
+ }
491
+ } else if (sourceType === "LOGIN") {
492
+ }
493
+ }
494
+ return null;
495
+ };
@@ -0,0 +1,48 @@
1
+ const NUMBER_OF_ACTIVITY_TEMPLATE = 9;
2
+ const NUMBER_OF_TAXONOMY = 6;
3
+ const INITIAL_TAXONOMY_VALUE = 1 / NUMBER_OF_TAXONOMY;
4
+ const INITIAL_TEMPLATE_VALUE = 1 / NUMBER_OF_ACTIVITY_TEMPLATE;
5
+
6
+ export const constructBaseVerbalIndvidualModel = (userId: any) => {
7
+ return {
8
+ bloomBloomAnalyze: INITIAL_TAXONOMY_VALUE,
9
+ bloomBloomApply: INITIAL_TAXONOMY_VALUE,
10
+ bloomBloomCreate: INITIAL_TAXONOMY_VALUE,
11
+ bloomBloomEvaluate: INITIAL_TAXONOMY_VALUE,
12
+ bloomBloomRemember: INITIAL_TAXONOMY_VALUE,
13
+ bloomBloomUnderstand: INITIAL_TAXONOMY_VALUE,
14
+ dropdown: INITIAL_TEMPLATE_VALUE,
15
+ coterieField: "VERBAL",
16
+ fillInTheBlanks: INITIAL_TEMPLATE_VALUE,
17
+ grouping: INITIAL_TEMPLATE_VALUE,
18
+ matching: INITIAL_TEMPLATE_VALUE,
19
+ mcma: INITIAL_TEMPLATE_VALUE,
20
+ mcsa: INITIAL_TEMPLATE_VALUE,
21
+ openEnded: INITIAL_TEMPLATE_VALUE,
22
+ ordering: INITIAL_TEMPLATE_VALUE,
23
+ trueFalse: INITIAL_TEMPLATE_VALUE,
24
+ userId,
25
+ };
26
+ };
27
+
28
+ export const constructBaseNumericIndividualModel = (userId: any) => {
29
+ return {
30
+ bloomBloomAnalyze: INITIAL_TAXONOMY_VALUE,
31
+ bloomBloomApply: INITIAL_TAXONOMY_VALUE,
32
+ bloomBloomCreate: INITIAL_TAXONOMY_VALUE,
33
+ bloomBloomEvaluate: INITIAL_TAXONOMY_VALUE,
34
+ bloomBloomRemember: INITIAL_TAXONOMY_VALUE,
35
+ bloomBloomUnderstand: INITIAL_TAXONOMY_VALUE,
36
+ dropdown: INITIAL_TEMPLATE_VALUE,
37
+ coterieField: "NUMERIC",
38
+ fillInTheBlanks: INITIAL_TEMPLATE_VALUE,
39
+ grouping: INITIAL_TEMPLATE_VALUE,
40
+ matching: INITIAL_TEMPLATE_VALUE,
41
+ mcma: INITIAL_TEMPLATE_VALUE,
42
+ mcsa: INITIAL_TEMPLATE_VALUE,
43
+ openEnded: INITIAL_TEMPLATE_VALUE,
44
+ ordering: INITIAL_TEMPLATE_VALUE,
45
+ trueFalse: INITIAL_TEMPLATE_VALUE,
46
+ userId,
47
+ };
48
+ };