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,314 @@
1
+ import i18n from "../language/i18n";
2
+ import { filterGradeLevelOptionList } from "./ManagementUtilization";
3
+
4
+ export const retrieveCategoryVersionCodeOptionList = () => {
5
+ return [
6
+ {
7
+ value: "MEB-IO-MAT-2024",
8
+ text: i18n.t("MEB-IO-MAT-2024"),
9
+ type: "MATHEMATICS",
10
+ availableLevelList: [5],
11
+ },
12
+ {
13
+ value: "MEB-IO-MAT-2018",
14
+ text: i18n.t("MEB-IO-MAT-2018"),
15
+ type: "MATHEMATICS",
16
+ availableLevelList: [4, 6, 7, 8],
17
+ },
18
+ {
19
+ value: "MEB-IO-TUR-2024",
20
+ text: i18n.t("MEB-IO-TUR-2024"),
21
+ type: "TURKISH",
22
+ availableLevelList: [5],
23
+ },
24
+ {
25
+ value: "MEB-IO-TUR-2019",
26
+ text: i18n.t("MEB-IO-TUR-2019"),
27
+ type: "TURKISH",
28
+ availableLevelList: [4, 6, 7, 8],
29
+ },
30
+ {
31
+ value: "MEB-IO-HAY-2018",
32
+ text: i18n.t("MEB-IO-HAY-2018"),
33
+ type: "LIFE_STUDIES",
34
+ availableLevelList: [3],
35
+ },
36
+ {
37
+ value: "MEB-IO-TRAF-2018",
38
+ text: i18n.t("MEB-IO-TRAF-2018"),
39
+ type: "TRAFFIC_SAFETY",
40
+ availableLevelList: [4],
41
+ },
42
+ {
43
+ value: "MEB-IO-FEN-2024",
44
+ text: i18n.t("MEB-IO-FEN-2024"),
45
+ type: "SCIENCE",
46
+ availableLevelList: [5],
47
+ },
48
+ {
49
+ value: "MEB-IO-SCI-2018",
50
+ text: i18n.t("MEB-IO-SCI-2018"),
51
+ type: "SCIENCE",
52
+ availableLevelList: [4, 6, 7, 8],
53
+ },
54
+ {
55
+ value: "MEB-IO-SOS-2024",
56
+ text: i18n.t("MEB-IO-SOS-2024"),
57
+ type: "SOCIAL_STUDIES",
58
+ availableLevelList: [5],
59
+ },
60
+ {
61
+ value: "MEB-IO-SOS-2018",
62
+ text: i18n.t("MEB-IO-SOS-2018"),
63
+ type: "SOCIAL_STUDIES",
64
+ availableLevelList: [4, 6, 7],
65
+ },
66
+ {
67
+ value: "MEB-IO-ITA-2018",
68
+ text: i18n.t("MEB-IO-ITA-2018"),
69
+ type: "SOCIAL_STUDIES",
70
+ availableLevelList: [8],
71
+ },
72
+ {
73
+ value: "MEB-IO-ENG-2018",
74
+ text: i18n.t("MEB-IO-ENG-2018"),
75
+ type: "ENGLISH",
76
+ availableLevelList: [4, 5, 6, 7, 8],
77
+ },
78
+ {
79
+ value: "MEB-AL-MAT-2024",
80
+ text: i18n.t("MEB-AL-MAT-2024"),
81
+ type: "MATHEMATICS",
82
+ availableLevelList: [9],
83
+ },
84
+ {
85
+ value: "MEB-AL-MAT-2018",
86
+ text: i18n.t("MEB-AL-MAT-2018"),
87
+ type: "MATHEMATICS",
88
+ availableLevelList: [10, 11, 12],
89
+ },
90
+ {
91
+ value: "MEB-AL-FİZ-2024",
92
+ text: i18n.t("MEB-AL-FİZ-2024"),
93
+ type: "PHYSICS",
94
+ availableLevelList: [9],
95
+ },
96
+ {
97
+ value: "MEB-AL-FIZ-2018",
98
+ text: i18n.t("MEB-AL-FIZ-2018"),
99
+ type: "PHYSICS",
100
+ availableLevelList: [10, 11, 12],
101
+ },
102
+ {
103
+ value: "MEB-AL-BİY-2024",
104
+ text: i18n.t("MEB-AL-BİY-2024"),
105
+ type: "BIOLOGY",
106
+ availableLevelList: [9],
107
+ },
108
+ {
109
+ value: "MEB-AL-BIO-2018",
110
+ text: i18n.t("MEB-AL-BIO-2018"),
111
+ type: "BIOLOGY",
112
+ availableLevelList: [10, 11, 12],
113
+ },
114
+ {
115
+ value: "MEB-AL-KİM-2024",
116
+ text: i18n.t("MEB-AL-KİM-2024"),
117
+ type: "CHEMISTRY",
118
+ availableLevelList: [9],
119
+ },
120
+ {
121
+ value: "MEB-AL-KIM-2018",
122
+ text: i18n.t("MEB-AL-KIM-2018"),
123
+ type: "CHEMISTRY",
124
+ availableLevelList: [10, 11, 12],
125
+ },
126
+ {
127
+ value: "MEB-AL-TAR-2024",
128
+ text: i18n.t("MEB-AL-TAR-2024"),
129
+ type: "HISTORY",
130
+ availableLevelList: [9],
131
+ },
132
+ {
133
+ value: "MEB-AL-TAR-2018",
134
+ text: i18n.t("MEB-AL-TAR-2018"),
135
+ type: "HISTORY",
136
+ availableLevelList: [10, 11],
137
+ },
138
+ {
139
+ value: "MEB-AL-ITA-2018",
140
+ text: i18n.t("MEB-AL-ITA-2018"),
141
+ type: "HISTORY",
142
+ availableLevelList: [12],
143
+ },
144
+ {
145
+ value: "MEB-AL-COĞ-2024",
146
+ text: i18n.t("MEB-AL-COĞ-2024"),
147
+ type: "GEOGRAPHY",
148
+ availableLevelList: [9],
149
+ },
150
+ {
151
+ value: "MEB-AL-COĞ-2018",
152
+ text: i18n.t("MEB-AL-COĞ-2018"),
153
+ type: "GEOGRAPHY",
154
+ availableLevelList: [10, 11, 12],
155
+ },
156
+ {
157
+ value: "MEB-IO-DKAB-2018",
158
+ text: i18n.t("MEB-IO-DKAB-2018"),
159
+ type: "CULTURE_AND_RELIGION_KNOWLEDGE",
160
+ availableLevelList: [4, 5, 6, 7, 8],
161
+ },
162
+ {
163
+ value: "MEB-AL-DKAB-2018",
164
+ text: i18n.t("MEB-AL-DKAB-2018"),
165
+ type: "CULTURE_AND_RELIGION_KNOWLEDGE",
166
+ availableLevelList: [9, 10, 11, 12],
167
+ },
168
+ {
169
+ value: "MEB-AL-FEL-2018",
170
+ text: i18n.t("MEB-AL-FEL-2018"),
171
+ type: "PHILOSOPHY",
172
+ availableLevelList: [10, 11],
173
+ },
174
+ {
175
+ value: "MEB-AL-TDE-2024",
176
+ text: i18n.t("MEB-AL-TDE-2024"),
177
+ type: "LITERATURE",
178
+ availableLevelList: [9],
179
+ },
180
+ {
181
+ value: "MEB-AL-LIT-2018",
182
+ text: i18n.t("MEB-AL-LIT-2018"),
183
+ type: "LITERATURE",
184
+ availableLevelList: [10, 11, 12],
185
+ },
186
+ // {
187
+ // value: "CEFR-STANDARDS-A1",
188
+ // text: i18n.t("CEFR-STANDARDS-A1"),
189
+ // type: "ENGLISH",
190
+ // availableLevelList: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12],
191
+ // },
192
+ // {
193
+ // value: "CEFR-STANDARDS-A2",
194
+ // text: i18n.t("CEFR-STANDARDS-A2"),
195
+ // type: "ENGLISH",
196
+ // availableLevelList: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12],
197
+ // },
198
+ // {
199
+ // value: "CEFR-STANDARDS-B1",
200
+ // text: i18n.t("CEFR-STANDARDS-B1"),
201
+ // type: "ENGLISH",
202
+ // availableLevelList: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12],
203
+ // },
204
+ // {
205
+ // value: "CEFR-STANDARDS-B2",
206
+ // text: i18n.t("CEFR-STANDARDS-B2"),
207
+ // type: "ENGLISH",
208
+ // availableLevelList: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12],
209
+ // },
210
+ {
211
+ value: "GENERAL-CULTURE",
212
+ text: i18n.t("GENERAL-CULTURE"),
213
+ type: "GENERAL_CULTURE",
214
+ availableLevelList: [8, 12],
215
+ },
216
+ {
217
+ value: "SPE-TYT-TUR-2024",
218
+ text: i18n.t("SPE-TYT-TUR-2024"),
219
+ type: "TURKISH",
220
+ availableLevelList: [12],
221
+ },
222
+ {
223
+ value: "SPE-LGS-TUR-2024",
224
+ text: i18n.t("SPE-LGS-TUR-2024"),
225
+ type: "TURKISH",
226
+ availableLevelList: [8],
227
+ },
228
+ ];
229
+ };
230
+
231
+ export const filterCategoryVersionCodeOptionList = (
232
+ categoryVersionCodeOptionList: any,
233
+ coterieType: string,
234
+ level: any
235
+ ) => {
236
+ if (coterieType && coterieType === "DEFAULT_OPTION") return [];
237
+ if (level && level === "DEFAULT_OPTION") return [];
238
+ let currentCategoryVersionCodeOptionList = categoryVersionCodeOptionList;
239
+ if (coterieType !== "MANAGEMENT") {
240
+ currentCategoryVersionCodeOptionList =
241
+ currentCategoryVersionCodeOptionList.filter(
242
+ (categoryVersionCode: any) => categoryVersionCode.type === coterieType
243
+ );
244
+ }
245
+ if (level) {
246
+ currentCategoryVersionCodeOptionList =
247
+ currentCategoryVersionCodeOptionList.filter((categoryVersionCode: any) =>
248
+ categoryVersionCode.availableLevelList.includes(level)
249
+ );
250
+ }
251
+
252
+ return currentCategoryVersionCodeOptionList;
253
+ };
254
+
255
+ export const filterCategoryVersionCodeOptionListByGradeDTO = (
256
+ categoryVersionCodeOptionList: any,
257
+ coterieType: string,
258
+ gradeDTO: any
259
+ ) => {
260
+ if (coterieType && coterieType === "DEFAULT_OPTION") return [];
261
+
262
+ let currentCategoryVersionCodeOptionList = categoryVersionCodeOptionList;
263
+
264
+ if (coterieType !== "MANAGEMENT") {
265
+ currentCategoryVersionCodeOptionList =
266
+ currentCategoryVersionCodeOptionList.filter(
267
+ (categoryVersionCode: any) => categoryVersionCode.type === coterieType
268
+ );
269
+ }
270
+ if (gradeDTO) {
271
+ currentCategoryVersionCodeOptionList =
272
+ currentCategoryVersionCodeOptionList.filter(
273
+ (categoryVersionCodeOption: any) =>
274
+ categoryVersionCodeOption.availableLevelList.includes(gradeDTO.level)
275
+ );
276
+ }
277
+
278
+ return currentCategoryVersionCodeOptionList;
279
+ };
280
+
281
+ export const filterCategoryVersionCodeOptionListByInstitutionDTO = (
282
+ categoryVersionCodeOptionList: any,
283
+ coterieType: string,
284
+ institutionDTO: any
285
+ ) => {
286
+ if (coterieType && coterieType === "DEFAULT_OPTION") return [];
287
+
288
+ let currentCategoryVersionCodeOptionList = categoryVersionCodeOptionList;
289
+
290
+ if (coterieType !== "MANAGEMENT") {
291
+ currentCategoryVersionCodeOptionList =
292
+ currentCategoryVersionCodeOptionList.filter(
293
+ (categoryVersionCodeOption: any) =>
294
+ categoryVersionCodeOption.type === coterieType
295
+ );
296
+ }
297
+ if (institutionDTO) {
298
+ const gradeLevelList = filterGradeLevelOptionList(institutionDTO, null).map(
299
+ (option) => option.value
300
+ );
301
+ currentCategoryVersionCodeOptionList =
302
+ currentCategoryVersionCodeOptionList.filter(
303
+ (categoryVersionCodeOption: any) => {
304
+ return (
305
+ gradeLevelList.find((gradeLevel) =>
306
+ categoryVersionCodeOption.availableLevelList.includes(gradeLevel)
307
+ ) !== undefined
308
+ );
309
+ }
310
+ );
311
+ }
312
+
313
+ return currentCategoryVersionCodeOptionList;
314
+ };
@@ -0,0 +1,85 @@
1
+ import i18n from "../language/i18n";
2
+
3
+ export const ONE_HOUR = 3600000;
4
+ export const ONE_DAY = 86400000;
5
+ export const ONE_WEEK = 604800000;
6
+ export const ONE_MONTH = 2419200000;
7
+ export const THREE_MONTHS = 7257600000;
8
+
9
+ export const retrieveMonthNameByIndex = (index: number) => {
10
+ if (index === 0) {
11
+ return i18n.t("january");
12
+ } else if (index === 1) {
13
+ return i18n.t("february");
14
+ } else if (index === 2) {
15
+ return i18n.t("march");
16
+ } else if (index === 3) {
17
+ return i18n.t("april");
18
+ } else if (index === 4) {
19
+ return i18n.t("may");
20
+ } else if (index === 5) {
21
+ return i18n.t("june");
22
+ } else if (index === 6) {
23
+ return i18n.t("july");
24
+ } else if (index === 7) {
25
+ return i18n.t("august");
26
+ } else if (index === 8) {
27
+ return i18n.t("september");
28
+ } else if (index === 9) {
29
+ return i18n.t("october");
30
+ } else if (index === 10) {
31
+ return i18n.t("november");
32
+ } else if (index === 11) {
33
+ return i18n.t("december");
34
+ }
35
+ };
36
+
37
+ export const retrieveDateIntervalOptionList = () => {
38
+ return [
39
+ {
40
+ value: "LAST_DAY",
41
+ text: i18n.t("last_day"),
42
+ },
43
+ {
44
+ value: "LAST_WEEK",
45
+ text: i18n.t("last_week"),
46
+ },
47
+ {
48
+ value: "LAST_MONTH",
49
+ text: i18n.t("last_month"),
50
+ },
51
+ {
52
+ value: "LAST_THREE_MONTHS",
53
+ text: i18n.t("last_three_months"),
54
+ },
55
+ ];
56
+ };
57
+
58
+ export const constructWeekName = (beginDate: any, endDate: any) => {
59
+ let currentEndDate;
60
+ if (endDate) {
61
+ currentEndDate = endDate;
62
+ } else {
63
+ currentEndDate = new Date(beginDate);
64
+ currentEndDate.setDate(beginDate.getDate() + 4);
65
+ }
66
+ if (beginDate.getFullYear() !== currentEndDate.getFullYear()) {
67
+ return `${beginDate.getDate()} ${retrieveMonthNameByIndex(
68
+ beginDate.getMonth()
69
+ )} ${beginDate.getFullYear()} - ${currentEndDate.getDate()} ${retrieveMonthNameByIndex(
70
+ currentEndDate.getMonth()
71
+ )} ${currentEndDate.getFullYear()}`;
72
+ } else {
73
+ if (beginDate.getMonth() !== currentEndDate.getMonth()) {
74
+ return `${beginDate.getDate()} ${retrieveMonthNameByIndex(
75
+ beginDate.getMonth()
76
+ )} - ${currentEndDate.getDate()} ${retrieveMonthNameByIndex(
77
+ currentEndDate.getMonth()
78
+ )} ${currentEndDate.getFullYear()}`;
79
+ } else {
80
+ return `${beginDate.getDate()} - ${currentEndDate.getDate()} ${retrieveMonthNameByIndex(
81
+ currentEndDate.getMonth()
82
+ )} ${currentEndDate.getFullYear()}`;
83
+ }
84
+ }
85
+ };
@@ -0,0 +1,50 @@
1
+ export const calculateLevenshteinDistance = (s: any, t: any) => {
2
+ if (!s.length) return t.length;
3
+ if (!t.length) return s.length;
4
+ const arr = [];
5
+ for (let i = 0; i <= t.length; i++) {
6
+ arr[i] = [i];
7
+ for (let j = 1; j <= s.length; j++) {
8
+ arr[i][j] =
9
+ i === 0
10
+ ? j
11
+ : Math.min(
12
+ arr[i - 1][j] + 1,
13
+ arr[i][j - 1] + 1,
14
+ arr[i - 1][j - 1] + (s[j - 1] === t[i - 1] ? 0 : 1)
15
+ );
16
+ }
17
+ }
18
+ return arr[t.length][s.length];
19
+ };
20
+
21
+ export const convertTurkishCharactersToEnglish = (text: string) => {
22
+ return text
23
+ .replaceAll("Ğ", "g")
24
+ .replaceAll("Ü", "u")
25
+ .replaceAll("Ş", "s")
26
+ .replaceAll("I", "i")
27
+ .replaceAll("İ", "i")
28
+ .replaceAll("Ö", "o")
29
+ .replaceAll("Ç", "c")
30
+ .replaceAll("ğ", "g")
31
+ .replaceAll("ü", "u")
32
+ .replaceAll("ş", "s")
33
+ .replaceAll("ı", "i")
34
+ .replaceAll("ö", "o")
35
+ .replaceAll("ç", "c");
36
+ };
37
+
38
+ export function convertToBase64(arrayBuffer: any) {
39
+ return new Promise((resolve, reject) => {
40
+ const blob = new Blob([arrayBuffer], { type: "image/png" });
41
+ const reader = new FileReader();
42
+ reader.onloadend = () => {
43
+ const base64data =
44
+ typeof reader.result === "string" ? reader.result.split(",")[1] : null; // Remove "data:image/png;base64," part
45
+ resolve(base64data);
46
+ };
47
+ reader.onerror = reject;
48
+ reader.readAsDataURL(blob);
49
+ });
50
+ }