@cuemath/web-utils 0.0.1-beta.2 → 0.0.1-beta.3

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.
package/dist/index.js CHANGED
@@ -18,4 +18,7 @@ __exportStar(require("./cookie"), exports);
18
18
  __exportStar(require("./constants"), exports);
19
19
  __exportStar(require("./local-storage"), exports);
20
20
  __exportStar(require("./e-cna"), exports);
21
+ __exportStar(require("./date-time-helper"), exports);
22
+ __exportStar(require("./country"), exports);
23
+ __exportStar(require("./object"), exports);
21
24
  //# sourceMappingURL=index.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cuemath/web-utils",
3
- "version": "0.0.1-beta.2",
3
+ "version": "0.0.1-beta.3",
4
4
  "description": "Shareable utils package",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -9,8 +9,7 @@
9
9
  "build-watch": "tsc -w",
10
10
  "prepublishOnly": "rm -rf dist && yarn build",
11
11
  "prepare": "husky install",
12
- "precommit": "lint-staged",
13
- "release": "lerna publish from-package"
12
+ "precommit": "lint-staged"
14
13
  },
15
14
  "repository": {
16
15
  "type": "git",
@@ -41,8 +40,7 @@
41
40
  },
42
41
  "dependencies": {
43
42
  "@types/node": "^18.11.18",
44
- "dayjs": "^1.11.7",
45
- "lerna": "^6.4.1"
43
+ "dayjs": "^1.11.7"
46
44
  },
47
45
  "lint-staged": {
48
46
  "*.{js,json,css,scss,html,md,ts}": [
@@ -1,4 +1,2 @@
1
1
  export { COUNTRY_NAME_COUNTRY_CODE_MAP as ISO_COUNTRY_CODE } from './iso-country-code';
2
- export const AB_IDENTIFIER_KEY = '__ab_experiment__';
3
- export const CUE_COUNTRY_CODE_KEY = 'cue_country_code';
4
- export const CACHE_COUNTRIES = ['IN', 'US', 'CA'];
2
+ export const CUE_COUNTRY_CODE_KEY = 'cue_country_code';
@@ -1,38 +1,3 @@
1
- export const DATE: string[] = [
2
- '',
3
- '1st',
4
- '2nd',
5
- '3rd',
6
- '4th',
7
- '5th',
8
- '6th',
9
- '7th',
10
- '8th',
11
- '9th',
12
- '10th',
13
- '11th',
14
- '12th',
15
- '13th',
16
- '14th',
17
- '15th',
18
- '16th',
19
- '17th',
20
- '18th',
21
- '19th',
22
- '20th',
23
- '21st',
24
- '22nd',
25
- '23rd',
26
- '24th',
27
- '25th',
28
- '26th',
29
- '27th',
30
- '28th',
31
- '29th',
32
- '30th',
33
- '31st',
34
- ];
35
-
36
1
  export const DAY = {
37
2
  Sun: 'Sunday',
38
3
  Mon: 'Monday',
@@ -1,356 +1,25 @@
1
1
  import { CUE_COUNTRY_CODE_KEY } from '../../constants/country';
2
2
  import { getCookie } from '../../cookie';
3
+ import { getCountryCode } from '../../country';
3
4
  import { COUNTRY_NAME_COUNTRY_CODE_MAP as ISO_COUNTRY_CODE } from '../country/iso-country-code';
4
5
 
5
- interface FormLabel {
6
- label: string;
7
- value: string;
8
- }
9
-
10
- export const ECNA_HASH = {
11
- PARENT_STUDENT_DETAILS: '#/e-cna/parent_student_details',
12
- FIRST_QUESTION: '#/e-cna/question/1',
13
- INTRO: '#/e-cna/intro',
14
- SLOT_PICK: '#/e-cna/slot-pick',
15
- START: '#/e-cna/start',
16
- EXIT_PARENT: '#/e-cna/exit-parent',
17
- EXIT_SLOTS: '#/e-cna/exit-slots',
18
- CLASS_NOT_CONFIRMED: '#/e-cna/class-not-confirmed',
19
- CLASS_THANK_YOU: '#/e-cna/class-thankyou',
20
- COURSE_NOT_AVAILABE: '#/e-cna/course-not-available',
21
- };
22
-
23
6
  export const ASSESSMENT_ID = 'assessmentId';
24
7
 
25
8
  export const SLIDE_TYPES = {
26
9
  INTRO: 'intro',
27
10
  SLOT_PICK: 'slot-pick',
28
11
  PARENT_STUDENT_DETAILS: 'parent_student_details',
29
- CLASS_CONFIRMED: 'class-confirmed',
30
- CLASS_THANK_YOU: 'class-thankyou',
12
+ CLASS_CONFIRMED: 'class_confirmed',
13
+ CLASS_THANK_YOU: 'class_thankyou',
31
14
  QUESTION: 'question',
32
15
  EXIT_PARENT: 'exit-parent',
33
16
  EXIT_SLOTS: 'exit-slots',
34
17
  EXIT_THANK_YOU: 'exit-thankyou',
35
18
  CLASS_NOT_CONFIRMED: 'class-not-confirmed',
36
19
  COURSE_NOT_AVAILABLE: 'course-not-available',
37
- };
38
-
39
- export const CURRICULUM_COURSES = {
40
- CBSE: 'CBSE',
41
- ICSE: 'ICSE',
42
- BRITISH_NATIONAL_CURRICULUM: 'British National Curriculum',
43
- US_COMMON_CORE: 'US Common Core',
44
- SINGAPORE_NATIONAL_CURRICULUM: 'Singapore National Curriculum',
45
- HOMESCHOOLING: 'Homeschooling',
46
- OTHERS: 'Others',
47
- AUSTRALIAN_CURRICULUM: 'Australian Curriculum',
48
- NEW_ZEALAND_CURRICULUM: 'The New Zealand Curriculum',
49
- INTERNATIONAL_BACCALAUREATE_IB: 'International Baccalaureate (IB)',
50
- };
51
-
52
- export const MIDDLE_EAST_COUNTRIES = ['AE', 'QA', 'SA', 'OM', 'KW', 'BH'];
53
-
54
- export const MIDDLE_EAST_COUNTRIES_COURSE: FormLabel[] = [
55
- {
56
- label: CURRICULUM_COURSES.CBSE,
57
- value: CURRICULUM_COURSES.CBSE,
58
- },
59
- {
60
- label: CURRICULUM_COURSES.ICSE,
61
- value: CURRICULUM_COURSES.ICSE,
62
- },
63
- {
64
- label: CURRICULUM_COURSES.BRITISH_NATIONAL_CURRICULUM,
65
- value: CURRICULUM_COURSES.BRITISH_NATIONAL_CURRICULUM,
66
- },
67
- {
68
- label: CURRICULUM_COURSES.US_COMMON_CORE,
69
- value: CURRICULUM_COURSES.US_COMMON_CORE,
70
- },
71
- {
72
- label: CURRICULUM_COURSES.SINGAPORE_NATIONAL_CURRICULUM,
73
- value: CURRICULUM_COURSES.SINGAPORE_NATIONAL_CURRICULUM,
74
- },
75
- {
76
- label: CURRICULUM_COURSES.HOMESCHOOLING,
77
- value: CURRICULUM_COURSES.HOMESCHOOLING,
78
- },
79
- {
80
- label: CURRICULUM_COURSES.INTERNATIONAL_BACCALAUREATE_IB,
81
- value: CURRICULUM_COURSES.INTERNATIONAL_BACCALAUREATE_IB,
82
- },
83
- {
84
- label: CURRICULUM_COURSES.OTHERS,
85
- value: CURRICULUM_COURSES.OTHERS,
86
- },
87
- ];
88
-
89
- export const DEFAULT_OPTIONS_FOR_ROW_COUNTRIES: FormLabel[] = [
90
- {
91
- label: CURRICULUM_COURSES.US_COMMON_CORE,
92
- value: CURRICULUM_COURSES.US_COMMON_CORE,
93
- },
94
- {
95
- label: CURRICULUM_COURSES.BRITISH_NATIONAL_CURRICULUM,
96
- value: CURRICULUM_COURSES.BRITISH_NATIONAL_CURRICULUM,
97
- },
98
- {
99
- label: CURRICULUM_COURSES.SINGAPORE_NATIONAL_CURRICULUM,
100
- value: CURRICULUM_COURSES.SINGAPORE_NATIONAL_CURRICULUM,
101
- },
102
- {
103
- label: CURRICULUM_COURSES.CBSE,
104
- value: CURRICULUM_COURSES.CBSE,
105
- },
106
- {
107
- label: CURRICULUM_COURSES.ICSE,
108
- value: CURRICULUM_COURSES.ICSE,
109
- },
110
- {
111
- label: CURRICULUM_COURSES.HOMESCHOOLING,
112
- value: CURRICULUM_COURSES.HOMESCHOOLING,
113
- },
114
- {
115
- label: CURRICULUM_COURSES.INTERNATIONAL_BACCALAUREATE_IB,
116
- value: CURRICULUM_COURSES.INTERNATIONAL_BACCALAUREATE_IB,
117
- },
118
- {
119
- label: CURRICULUM_COURSES.OTHERS,
120
- value: CURRICULUM_COURSES.OTHERS,
121
- },
122
- ];
123
-
124
- export const MIDDLE_EAST_CURRICULUM_OPTIONS = {
125
- ...Object.fromEntries(
126
- MIDDLE_EAST_COUNTRIES.map(key => [key, MIDDLE_EAST_COUNTRIES_COURSE]),
127
- ),
128
- };
129
-
130
- export const CURRICULUM_OPTIONS: { [country: string]: FormLabel[] } = {
131
- AU: [
132
- {
133
- label: CURRICULUM_COURSES.AUSTRALIAN_CURRICULUM,
134
- value: CURRICULUM_COURSES.AUSTRALIAN_CURRICULUM,
135
- },
136
- {
137
- label: CURRICULUM_COURSES.US_COMMON_CORE,
138
- value: CURRICULUM_COURSES.US_COMMON_CORE,
139
- },
140
- {
141
- label: CURRICULUM_COURSES.BRITISH_NATIONAL_CURRICULUM,
142
- value: CURRICULUM_COURSES.BRITISH_NATIONAL_CURRICULUM,
143
- },
144
- {
145
- label: CURRICULUM_COURSES.SINGAPORE_NATIONAL_CURRICULUM,
146
- value: CURRICULUM_COURSES.SINGAPORE_NATIONAL_CURRICULUM,
147
- },
148
- {
149
- label: CURRICULUM_COURSES.NEW_ZEALAND_CURRICULUM,
150
- value: CURRICULUM_COURSES.NEW_ZEALAND_CURRICULUM,
151
- },
152
- {
153
- label: CURRICULUM_COURSES.HOMESCHOOLING,
154
- value: CURRICULUM_COURSES.HOMESCHOOLING,
155
- },
156
- {
157
- label: CURRICULUM_COURSES.INTERNATIONAL_BACCALAUREATE_IB,
158
- value: CURRICULUM_COURSES.INTERNATIONAL_BACCALAUREATE_IB,
159
- },
160
- ],
161
- NZ: [
162
- {
163
- label: CURRICULUM_COURSES.NEW_ZEALAND_CURRICULUM,
164
- value: CURRICULUM_COURSES.NEW_ZEALAND_CURRICULUM,
165
- },
166
- {
167
- label: CURRICULUM_COURSES.AUSTRALIAN_CURRICULUM,
168
- value: CURRICULUM_COURSES.AUSTRALIAN_CURRICULUM,
169
- },
170
- {
171
- label: CURRICULUM_COURSES.US_COMMON_CORE,
172
- value: CURRICULUM_COURSES.US_COMMON_CORE,
173
- },
174
- {
175
- label: CURRICULUM_COURSES.BRITISH_NATIONAL_CURRICULUM,
176
- value: CURRICULUM_COURSES.BRITISH_NATIONAL_CURRICULUM,
177
- },
178
- {
179
- label: CURRICULUM_COURSES.SINGAPORE_NATIONAL_CURRICULUM,
180
- value: CURRICULUM_COURSES.SINGAPORE_NATIONAL_CURRICULUM,
181
- },
182
- {
183
- label: CURRICULUM_COURSES.HOMESCHOOLING,
184
- value: CURRICULUM_COURSES.HOMESCHOOLING,
185
- },
186
- {
187
- label: CURRICULUM_COURSES.INTERNATIONAL_BACCALAUREATE_IB,
188
- value: CURRICULUM_COURSES.INTERNATIONAL_BACCALAUREATE_IB,
189
- },
190
- ],
191
- SG: [
192
- {
193
- label: CURRICULUM_COURSES.SINGAPORE_NATIONAL_CURRICULUM,
194
- value: CURRICULUM_COURSES.SINGAPORE_NATIONAL_CURRICULUM,
195
- },
196
- {
197
- label: CURRICULUM_COURSES.US_COMMON_CORE,
198
- value: CURRICULUM_COURSES.US_COMMON_CORE,
199
- },
200
- {
201
- label: CURRICULUM_COURSES.BRITISH_NATIONAL_CURRICULUM,
202
- value: CURRICULUM_COURSES.BRITISH_NATIONAL_CURRICULUM,
203
- },
204
- {
205
- label: CURRICULUM_COURSES.HOMESCHOOLING,
206
- value: CURRICULUM_COURSES.HOMESCHOOLING,
207
- },
208
- {
209
- label: CURRICULUM_COURSES.INTERNATIONAL_BACCALAUREATE_IB,
210
- value: CURRICULUM_COURSES.INTERNATIONAL_BACCALAUREATE_IB,
211
- },
212
- ],
213
- GB: [
214
- {
215
- label: CURRICULUM_COURSES.BRITISH_NATIONAL_CURRICULUM,
216
- value: CURRICULUM_COURSES.BRITISH_NATIONAL_CURRICULUM,
217
- },
218
- {
219
- label: CURRICULUM_COURSES.US_COMMON_CORE,
220
- value: CURRICULUM_COURSES.US_COMMON_CORE,
221
- },
222
- {
223
- label: CURRICULUM_COURSES.SINGAPORE_NATIONAL_CURRICULUM,
224
- value: CURRICULUM_COURSES.SINGAPORE_NATIONAL_CURRICULUM,
225
- },
226
- {
227
- label: CURRICULUM_COURSES.HOMESCHOOLING,
228
- value: CURRICULUM_COURSES.HOMESCHOOLING,
229
- },
230
- {
231
- label: CURRICULUM_COURSES.INTERNATIONAL_BACCALAUREATE_IB,
232
- value: CURRICULUM_COURSES.INTERNATIONAL_BACCALAUREATE_IB,
233
- },
234
- {
235
- label: CURRICULUM_COURSES.OTHERS,
236
- value: CURRICULUM_COURSES.OTHERS,
237
- },
238
- ],
239
- IE: [
240
- {
241
- label: CURRICULUM_COURSES.BRITISH_NATIONAL_CURRICULUM,
242
- value: CURRICULUM_COURSES.BRITISH_NATIONAL_CURRICULUM,
243
- },
244
- {
245
- label: CURRICULUM_COURSES.US_COMMON_CORE,
246
- value: CURRICULUM_COURSES.US_COMMON_CORE,
247
- },
248
- {
249
- label: CURRICULUM_COURSES.SINGAPORE_NATIONAL_CURRICULUM,
250
- value: CURRICULUM_COURSES.SINGAPORE_NATIONAL_CURRICULUM,
251
- },
252
- {
253
- label: CURRICULUM_COURSES.HOMESCHOOLING,
254
- value: CURRICULUM_COURSES.HOMESCHOOLING,
255
- },
256
- {
257
- label: CURRICULUM_COURSES.INTERNATIONAL_BACCALAUREATE_IB,
258
- value: CURRICULUM_COURSES.INTERNATIONAL_BACCALAUREATE_IB,
259
- },
260
- {
261
- label: CURRICULUM_COURSES.OTHERS,
262
- value: CURRICULUM_COURSES.OTHERS,
263
- },
264
- ],
265
- NL: [
266
- {
267
- label: CURRICULUM_COURSES.BRITISH_NATIONAL_CURRICULUM,
268
- value: CURRICULUM_COURSES.BRITISH_NATIONAL_CURRICULUM,
269
- },
270
- {
271
- label: CURRICULUM_COURSES.US_COMMON_CORE,
272
- value: CURRICULUM_COURSES.US_COMMON_CORE,
273
- },
274
- {
275
- label: CURRICULUM_COURSES.SINGAPORE_NATIONAL_CURRICULUM,
276
- value: CURRICULUM_COURSES.SINGAPORE_NATIONAL_CURRICULUM,
277
- },
278
- {
279
- label: CURRICULUM_COURSES.HOMESCHOOLING,
280
- value: CURRICULUM_COURSES.HOMESCHOOLING,
281
- },
282
- {
283
- label: CURRICULUM_COURSES.INTERNATIONAL_BACCALAUREATE_IB,
284
- value: CURRICULUM_COURSES.INTERNATIONAL_BACCALAUREATE_IB,
285
- },
286
- {
287
- label: CURRICULUM_COURSES.OTHERS,
288
- value: CURRICULUM_COURSES.OTHERS,
289
- },
290
- ],
291
- ROW: [
292
- {
293
- label: CURRICULUM_COURSES.US_COMMON_CORE,
294
- value: CURRICULUM_COURSES.US_COMMON_CORE,
295
- },
296
- {
297
- label: CURRICULUM_COURSES.BRITISH_NATIONAL_CURRICULUM,
298
- value: CURRICULUM_COURSES.BRITISH_NATIONAL_CURRICULUM,
299
- },
300
- {
301
- label: CURRICULUM_COURSES.SINGAPORE_NATIONAL_CURRICULUM,
302
- value: CURRICULUM_COURSES.SINGAPORE_NATIONAL_CURRICULUM,
303
- },
304
- {
305
- label: CURRICULUM_COURSES.CBSE,
306
- value: CURRICULUM_COURSES.CBSE,
307
- },
308
- {
309
- label: CURRICULUM_COURSES.ICSE,
310
- value: CURRICULUM_COURSES.ICSE,
311
- },
312
- {
313
- label: CURRICULUM_COURSES.HOMESCHOOLING,
314
- value: CURRICULUM_COURSES.HOMESCHOOLING,
315
- },
316
- {
317
- label: CURRICULUM_COURSES.INTERNATIONAL_BACCALAUREATE_IB,
318
- value: CURRICULUM_COURSES.INTERNATIONAL_BACCALAUREATE_IB,
319
- },
320
- {
321
- label: CURRICULUM_COURSES.OTHERS,
322
- value: CURRICULUM_COURSES.OTHERS,
323
- },
324
- ],
325
- ...MIDDLE_EAST_CURRICULUM_OPTIONS,
326
- };
327
-
328
- export const getCourseOptionsAccordingToCountry = () => {
329
- const countryCode: string =
330
- getCookie(CUE_COUNTRY_CODE_KEY) || ISO_COUNTRY_CODE.AUSTRALIA;
331
-
332
- return CURRICULUM_OPTIONS[countryCode]
333
- ? CURRICULUM_OPTIONS[countryCode]
334
- : CURRICULUM_OPTIONS.ROW;
335
- };
336
-
337
- export const defaultCourseToBeSelectedInCountries: string[] = [
338
- 'AU',
339
- 'NZ',
340
- 'SG',
341
- 'GB',
342
- 'IE',
343
- ];
344
-
345
- export const defaultCourseOptionAccordingToCountry = (): string => {
346
- const countryCode = getCookie(CUE_COUNTRY_CODE_KEY) || ISO_COUNTRY_CODE.AUSTRALIA;
347
- const countryCourses = getCourseOptionsAccordingToCountry();
348
-
349
- if (defaultCourseToBeSelectedInCountries.includes(countryCode)) {
350
- return countryCourses[0].label;
351
- }
352
-
353
- return '';
20
+ SCHOOL_PERFORMANCE_KG_4: 'school_performance_kg_4',
21
+ SCHOOL_PERFORMANCE_5_12: 'school_performance_5_12',
22
+ STUDENT_GRADE: 'student_grade',
354
23
  };
355
24
 
356
25
  export const QUESTION_ID = {
@@ -358,145 +27,19 @@ export const QUESTION_ID = {
358
27
  OTHER_CURRICULUM: 'other_curriculum',
359
28
  };
360
29
 
361
- export const CUEMATH_CURRICULUM_FOR_EVERYONE = 'The Cuemath curriculum is for everyone!';
362
-
363
- export const CUEMATH_CURRICULA_DESCRIPTION =
364
- 'Over 200,000 students from 80 countries have learnt the Cuemath Way so far. Our curriculum is aligned to seven International math curricula including US Common Core and British National Curriculum.';
365
-
366
- export const GRADE_OPTIONS: FormLabel[] = [
367
- {
368
- label: 'KG',
369
- value: 'KG',
370
- },
371
- {
372
- label: '1',
373
- value: '1',
374
- },
375
- {
376
- label: '2',
377
- value: '2',
378
- },
379
- {
380
- label: '3',
381
- value: '3',
382
- },
383
- {
384
- label: '4',
385
- value: '4',
386
- },
387
- {
388
- label: '5',
389
- value: '5',
390
- },
391
- {
392
- label: '6',
393
- value: '6',
394
- },
395
- {
396
- label: '7',
397
- value: '7',
398
- },
399
- {
400
- label: '8',
401
- value: '8',
402
- },
30
+ export const LOCAL_STORAGE_KEYS = {
31
+ STUDENT_GRADE: 'student_grade',
32
+ KEY_NEED_L1: 'key_need_l1',
33
+ };
403
34
 
404
- {
405
- label: '9',
406
- value: '9',
407
- },
408
- {
409
- label: '10',
410
- value: '10',
411
- },
412
- {
413
- label: '11',
414
- value: '11',
415
- },
416
- {
417
- label: '12',
418
- value: '12',
419
- },
420
- ];
35
+ export const QUESTION_TYPES = {
36
+ OPTIONS: 'options',
37
+ OPTIONS_GRID: 'options_grid',
38
+ OPTIONS_THIN: 'options_thin',
39
+ OPTIONS_MULTISELECT: 'options_multiselect',
40
+ FREE_FLOWING_TEXT: 'freeFlowingText',
41
+ };
421
42
 
422
- export const NON_FOCUS_COUNTRIES: string[] = [
423
- ISO_COUNTRY_CODE.MALAYSIA,
424
- ISO_COUNTRY_CODE.PHILIPPINES,
425
- ISO_COUNTRY_CODE.INDONESIA,
426
- ISO_COUNTRY_CODE.JAPAN,
427
- ISO_COUNTRY_CODE.THAILAND,
428
- ISO_COUNTRY_CODE['HONG KONG'],
429
- ISO_COUNTRY_CODE['SOUTH AFRICA'],
430
- ISO_COUNTRY_CODE.NIGERIA,
431
- ISO_COUNTRY_CODE.KENYA,
432
- ISO_COUNTRY_CODE.GHANA,
433
- ISO_COUNTRY_CODE.SWEDEN,
434
- ISO_COUNTRY_CODE.SWITZERLAND,
435
- ISO_COUNTRY_CODE.GERMANY,
436
- ISO_COUNTRY_CODE.EGYPT,
437
- ISO_COUNTRY_CODE.MAURITIUS,
438
- ISO_COUNTRY_CODE.ETHIOPIA,
439
- ISO_COUNTRY_CODE.TANZANIA,
440
- ISO_COUNTRY_CODE.VIETNAM,
441
- ISO_COUNTRY_CODE.CAMBODIA,
442
- ISO_COUNTRY_CODE.DENMARK,
443
- ISO_COUNTRY_CODE.JORDAN,
444
- ISO_COUNTRY_CODE.IRAQ,
445
- ISO_COUNTRY_CODE.ISRAEL,
446
- ISO_COUNTRY_CODE.MYANMAR,
447
- ISO_COUNTRY_CODE.IRELAND,
448
- ISO_COUNTRY_CODE.UGANDA,
449
- ISO_COUNTRY_CODE.NETHERLANDS,
450
- ISO_COUNTRY_CODE.ZAMBIA,
451
- ISO_COUNTRY_CODE.AZERBAIJAN,
452
- ISO_COUNTRY_CODE.ANGUILLA,
453
- ISO_COUNTRY_CODE.LIBERIA,
454
- ISO_COUNTRY_CODE['IRAN, ISLAMIC REPUBLIC OF'],
455
- ISO_COUNTRY_CODE.UKRAINE,
456
- ISO_COUNTRY_CODE.UZBEKISTAN,
457
- ISO_COUNTRY_CODE.ALGERIA,
458
- ISO_COUNTRY_CODE.NAMIBIA,
459
- ISO_COUNTRY_CODE.ITALY,
460
- ISO_COUNTRY_CODE.TURKEY,
461
- ISO_COUNTRY_CODE.KYRGYZSTAN,
462
- ISO_COUNTRY_CODE.FRANCE,
463
- ISO_COUNTRY_CODE.RWANDA,
464
- ISO_COUNTRY_CODE.SOMALIA,
465
- ISO_COUNTRY_CODE.AFGHANISTAN,
466
- ISO_COUNTRY_CODE.LEBANON,
467
- ISO_COUNTRY_CODE.TUNISIA,
468
- ISO_COUNTRY_CODE['LIBYAN ARAB JAMAHIRIYA'],
469
- ISO_COUNTRY_CODE.SENEGAL,
470
- ISO_COUNTRY_CODE.KAZAKHSTAN,
471
- ISO_COUNTRY_CODE.MEXICO,
472
- ISO_COUNTRY_CODE.YEMEN,
473
- ISO_COUNTRY_CODE.BELARUS,
474
- ISO_COUNTRY_CODE.BELGIUM,
475
- ISO_COUNTRY_CODE.COLOMBIA,
476
- ISO_COUNTRY_CODE.NORWAY,
477
- ISO_COUNTRY_CODE['SYRIAN ARAB REPUBLIC'],
478
- ISO_COUNTRY_CODE.CAMEROON,
479
- ISO_COUNTRY_CODE.FINLAND,
480
- ISO_COUNTRY_CODE.MALAWI,
481
- ISO_COUNTRY_CODE.MOROCCO,
482
- ISO_COUNTRY_CODE['SIERRA LEONE'],
483
- ISO_COUNTRY_CODE.BHUTAN,
484
- ISO_COUNTRY_CODE.SPAIN,
485
- ISO_COUNTRY_CODE.MONGOLIA,
486
- ISO_COUNTRY_CODE.ARMENIA,
487
- ISO_COUNTRY_CODE.ROMANIA,
488
- ISO_COUNTRY_CODE.CHINA,
489
- ISO_COUNTRY_CODE['BOSNIA AND HERZEGOVINA'],
490
- ISO_COUNTRY_CODE.ECUADOR,
491
- ISO_COUNTRY_CODE['PAPUA NEW GUINEA'],
492
- ISO_COUNTRY_CODE.LESOTHO,
493
- ISO_COUNTRY_CODE.ALBANIA,
494
- ISO_COUNTRY_CODE.POLAND,
495
- ISO_COUNTRY_CODE.KOREA,
496
- ISO_COUNTRY_CODE['CONGO, DEMOCRATIC REPUBLIC'],
497
- ISO_COUNTRY_CODE.GAMBIA,
498
- ISO_COUNTRY_CODE.MALI,
499
- ISO_COUNTRY_CODE.BRAZIL,
500
- ISO_COUNTRY_CODE['ANTIGUA AND BARBUDA'],
501
- ISO_COUNTRY_CODE.NIGER,
502
- ];
43
+ export const FLOWS = {
44
+ DEFAULT: 'default',
45
+ }
@@ -19,7 +19,7 @@ export const getCookie = (name: string, cookie: string = document.cookie): strin
19
19
  return '';
20
20
  };
21
21
 
22
- export function removeCookie(name: string) {
22
+ export function removeCookie(name: string): void {
23
23
  const date = new Date();
24
24
 
25
25
  // Set it expire in -1 days
@@ -29,7 +29,7 @@ export function removeCookie(name: string) {
29
29
  document.cookie = `${name}=; expires=${date.toUTCString()}; path=/`;
30
30
  }
31
31
 
32
- export function createCookie(name: string, value: string, days: number) {
32
+ export function createCookie(name: string, value: string, days: number): void {
33
33
  let expires = '';
34
34
 
35
35
  if (days) {
@@ -41,37 +41,11 @@ export function createCookie(name: string, value: string, days: number) {
41
41
  document.cookie = `${name}=${encodeURIComponent(value)}${expires}; path=/`;
42
42
  }
43
43
 
44
- export function createCookieWithMidnightExp(name: string, value: string) {
44
+ export function createCookieWithMidnightExp(name: string, value: string): void {
45
45
  const date = new Date();
46
46
 
47
47
  date.setHours(24, 0, 0, 0);
48
48
  const expires = `; expires=${date}`;
49
49
 
50
50
  document.cookie = `${name}=${value}${expires}; path=/`;
51
- }
52
-
53
- export function isEmpty(obj: object): boolean {
54
- return Object.keys(obj).length === 0;
55
- }
56
-
57
- // In this case both object have same key names Don't use to compare objects
58
- export function isMapEqual(
59
- map1: { [x: string]: any },
60
- map2: { [x: string]: any },
61
- ): boolean {
62
- const map1Keys = Object.keys(map1);
63
- const map2Keys = Object.keys(map2);
64
-
65
- if (map1Keys.length !== map2Keys.length) {
66
- return false;
67
- }
68
- for (let i = 0; i < map1Keys.length; i += 1) {
69
- const key = map1Keys[i];
70
-
71
- if (map1[key] !== map2[key]) {
72
- return false;
73
- }
74
- }
75
-
76
- return true;
77
- }
51
+ }
@@ -0,0 +1,9 @@
1
+ import { CUE_COUNTRY_CODE_KEY } from "../constants";
2
+ import { getCookie } from "../cookie";
3
+ import { ISO_COUNTRY_CODE } from "../constants";
4
+
5
+ export const getCountryCode = () : string => {
6
+ return getCookie(CUE_COUNTRY_CODE_KEY)
7
+ ? getCookie(CUE_COUNTRY_CODE_KEY).toUpperCase()
8
+ : ISO_COUNTRY_CODE.INDIA;
9
+ }