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

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 (56) hide show
  1. package/.eslintignore +2 -0
  2. package/.husky/pre-commit +1 -0
  3. package/.huskyrc +5 -0
  4. package/.lintstagedrc.yml +5 -0
  5. package/dist/index.js +3 -0
  6. package/lerna.json +8 -0
  7. package/package-lock.json +7528 -0
  8. package/package.json +22 -5
  9. package/src/constants/country/index.ts +4 -0
  10. package/src/constants/country/iso-country-code.ts +248 -0
  11. package/src/constants/date-time/e-cna-international-timezones.ts +157 -0
  12. package/src/constants/date-time/index.ts +78 -0
  13. package/src/constants/e-cna/index.ts +502 -0
  14. package/src/constants/index.ts +2 -0
  15. package/src/cookie/index.ts +59 -1
  16. package/src/date-time-helper/index.ts +363 -0
  17. package/src/e-cna/flow/aggregator.ts +6 -0
  18. package/src/e-cna/flow/index.ts +1 -0
  19. package/src/e-cna/flow/variants/default.ts +40 -0
  20. package/src/e-cna/flow/variants/index.ts +1 -0
  21. package/src/e-cna/index.ts +264 -0
  22. package/src/e-cna/slides/child_hobbies/index.ts +1 -0
  23. package/src/e-cna/slides/child_hobbies/variants.ts +13 -0
  24. package/src/e-cna/slides/child_personality/index.ts +1 -0
  25. package/src/e-cna/slides/child_personality/variants.ts +12 -0
  26. package/src/e-cna/slides/grade/index.ts +1 -0
  27. package/src/e-cna/slides/grade/variants.ts +27 -0
  28. package/src/e-cna/slides/index.ts +16 -0
  29. package/src/e-cna/slides/intro/index.ts +1 -0
  30. package/src/e-cna/slides/intro/variants.ts +7 -0
  31. package/src/e-cna/slides/key_need_l1/index.ts +1 -0
  32. package/src/e-cna/slides/key_need_l1/variants.ts +44 -0
  33. package/src/e-cna/slides/key_need_l2/index.ts +1 -0
  34. package/src/e-cna/slides/key_need_l2/variants.ts +143 -0
  35. package/src/e-cna/slides/key_need_l3/index.ts +1 -0
  36. package/src/e-cna/slides/key_need_l3/variants.ts +13 -0
  37. package/src/e-cna/slides/math-perception/index.ts +1 -0
  38. package/src/e-cna/slides/math-perception/variants.ts +30 -0
  39. package/src/e-cna/slides/other_curriculum/index.ts +1 -0
  40. package/src/e-cna/slides/other_curriculum/variants.ts +14 -0
  41. package/src/e-cna/slides/school_performance_5_12/index.ts +1 -0
  42. package/src/e-cna/slides/school_performance_5_12/variants.ts +23 -0
  43. package/src/e-cna/slides/school_performance_kg_4/index.ts +1 -0
  44. package/src/e-cna/slides/school_performance_kg_4/variants.ts +25 -0
  45. package/src/e-cna/slides/secondary_needs/index.ts +1 -0
  46. package/src/e-cna/slides/secondary_needs/variants.ts +26 -0
  47. package/src/e-cna/slides/signup/index.ts +1 -0
  48. package/src/e-cna/slides/signup/variants.ts +7 -0
  49. package/src/e-cna/slides/signup_refer/index.ts +1 -0
  50. package/src/e-cna/slides/signup_refer/variants.ts +16 -0
  51. package/src/e-cna/slides/slot_pick/index.ts +1 -0
  52. package/src/e-cna/slides/slot_pick/variants.ts +7 -0
  53. package/src/e-cna/utils/index.ts +29 -0
  54. package/src/index.ts +3 -0
  55. package/src/local-storage/index.ts +191 -0
  56. package/.vscode/settings.json +0 -1
@@ -0,0 +1,12 @@
1
+ export const child_personality = {
2
+ DEFAULT: {
3
+ id: 14,
4
+ questionID: 'child_personality',
5
+ type: 'freeFlowingText',
6
+ question: "We'd like to know a little more about your child's personality.",
7
+ description: 'This helps us better understand their math needs.',
8
+ defaultNextquestionID: 'child_hobbies',
9
+ questionUUID: 'ea6d4fd6-a819-45dd-8c6b-484db63265f3',
10
+ placeholderText: "Too fidgety, can't sit & focus continuously",
11
+ },
12
+ };
@@ -0,0 +1 @@
1
+ export * from './variants';
@@ -0,0 +1,27 @@
1
+ export const grade = {
2
+ DEFAULT: {
3
+ id: 1,
4
+ questionID: 'student_grade',
5
+ type: 'options_grid',
6
+ question: 'What grade is your child in?',
7
+ description:
8
+ "We'll use this information to surface the right recommendations in the next few questions.",
9
+ options: [
10
+ { value: '10' },
11
+ { value: '11' },
12
+ { value: '12' },
13
+ { value: '7' },
14
+ { value: '8' },
15
+ { value: '9' },
16
+ { value: '4' },
17
+ { value: '5' },
18
+ { value: '6' },
19
+ { value: '1' },
20
+ { value: '2' },
21
+ { value: '3' },
22
+ { value: 'KG' },
23
+ ], // Options
24
+ defaultNextquestionID: 'math_perception',
25
+ questionUUID: '3d8688bf-ad00-4cbf-a5f9-ba9cac27af46',
26
+ },
27
+ };
@@ -0,0 +1,16 @@
1
+ export * from './intro';
2
+ export * from './grade';
3
+ export * from './key_need_l1';
4
+ export * from './key_need_l2';
5
+ export * from './math-perception';
6
+ export * from './school_performance_5_12';
7
+ export * from './school_performance_kg_4';
8
+ export * from './child_hobbies';
9
+ export * from './child_personality';
10
+ export * from './key_need_l3';
11
+ export * from './other_curriculum';
12
+ export * from './secondary_needs';
13
+ export * from './secondary_needs';
14
+ export * from './signup_refer';
15
+ export * from './signup';
16
+ export * from './slot_pick';
@@ -0,0 +1 @@
1
+ export * from './variants';
@@ -0,0 +1,7 @@
1
+ export const intro = {
2
+ DEFAULT: {
3
+ id: 'intro',
4
+ questionID: 'intro',
5
+ nextSlide: 'question/grade',
6
+ },
7
+ };
@@ -0,0 +1 @@
1
+ export * from './variants';
@@ -0,0 +1,44 @@
1
+ const getPrimaryKeyNeeds = () => {
2
+ return [
3
+ {
4
+ value:
5
+ "I'd like them to build strong math foundation and get support for schoolwork.",
6
+ nextQuestionID: 'strong_math_foundation',
7
+ },
8
+ {
9
+ value: "I'd like them to be faster at calculations / Mental math.",
10
+ nextQuestionID: 'mental_math',
11
+ },
12
+ {
13
+ value: "I'd like them to bridge learning gaps from previous and current grades.",
14
+ nextQuestionID: 'learning_gaps',
15
+ },
16
+ {
17
+ value: 'I want my child to practice math regulalry.',
18
+ nextQuestionID: 'more_practice',
19
+ },
20
+ {
21
+ value: "I'd like them to develop interest and start enjoying math without fear.",
22
+ nextQuestionID: 'develop_interest',
23
+ },
24
+ {
25
+ value: 'I want my child to practice advanced and competitive math.',
26
+ nextQuestionID: 'advanced_and_competitive_maths',
27
+ },
28
+ ];
29
+ };
30
+
31
+ export const key_need_l1 = {
32
+ DEFAULT: {
33
+ id: 5,
34
+ questionID: 'key_need_l1',
35
+ type: 'options_thin',
36
+ question: 'What does your child need the most help with?',
37
+ description:
38
+ "We'd like you choose the most important one! It's okay if there are other things, it helps us drill down to the main problem to solve!",
39
+ get options() {
40
+ return getPrimaryKeyNeeds();
41
+ },
42
+ questionUUID: '7d4f13a2-c5ec-4711-bd26-507f22fd81ae',
43
+ },
44
+ };
@@ -0,0 +1 @@
1
+ export * from './variants';
@@ -0,0 +1,143 @@
1
+ import { isUSK4Student, isAUK6Student } from '../../utils';
2
+
3
+ const getPrimaryNeedSubcategoryOptions = (questionID: string) => {
4
+ const mentalMathOptions = [
5
+ { value: 'Calculate without using pen and paper' },
6
+ {
7
+ value: 'Calculate faster in exams',
8
+ },
9
+ {
10
+ value: 'Calculate faster in practical situations',
11
+ },
12
+ ];
13
+
14
+ const strongMathFoundationOptions = [
15
+ { value: 'Apply concepts in real life', nextQuestionID: 'secondary_needs' },
16
+ {
17
+ value: 'Learn and remember concepts',
18
+ nextQuestionID: 'secondary_needs',
19
+ },
20
+ {
21
+ value: 'Score better in school exams',
22
+ nextQuestionID: 'secondary_needs',
23
+ },
24
+ {
25
+ value: 'Develop logical and analytical thinking',
26
+ nextQuestionID: 'secondary_needs',
27
+ },
28
+ {
29
+ value: 'Get help in school homework',
30
+ nextQuestionID: 'secondary_needs',
31
+ },
32
+ {
33
+ value: 'Help with specific topic or type of problem',
34
+ nextQuestionID: 'key_need_l3',
35
+ },
36
+ ];
37
+
38
+ if (!isUSK4Student() && !isAUK6Student()) {
39
+ return questionID === 'mentalMath' ? mentalMathOptions : strongMathFoundationOptions;
40
+ }
41
+
42
+ switch (questionID) {
43
+ case 'mentalMath':
44
+ return mentalMathOptions.filter(option => !option.value.includes('exam'));
45
+ case 'strongMathFoundation':
46
+ return strongMathFoundationOptions.filter(option => !option.value.includes('exam'));
47
+ default:
48
+ return strongMathFoundationOptions;
49
+ }
50
+ };
51
+
52
+ const getDevelopInterestOptions = () => {
53
+ const interestOptions = [
54
+ { value: 'Practice math in fun way' },
55
+ { value: "Shouldn't lose interest in math over time" },
56
+ { value: 'Should be confident before the exam' },
57
+ { value: 'Improve their focus and concentration' },
58
+ ];
59
+
60
+ if (!isUSK4Student() && !isAUK6Student()) {
61
+ return interestOptions;
62
+ }
63
+
64
+ return interestOptions.filter(option => !option.value.includes('exam'));
65
+ };
66
+
67
+ export const key_need_l2 = {
68
+ STRONG_MATH_FOUNDATION: {
69
+ id: 6,
70
+ questionID: 'key_need_l2',
71
+ type: 'options_thin',
72
+ question: 'What specific help do you need with strong math foundation?',
73
+ get options() {
74
+ return getPrimaryNeedSubcategoryOptions('strongMathFoundation');
75
+ },
76
+ questionUUID: '5fbee82c-e4dc-47cf-b89c-00162b4656bb',
77
+ },
78
+ MENTAL_MATH: {
79
+ id: 7,
80
+ questionID: 'key_need_l2',
81
+ type: 'options_thin',
82
+ question: 'What specific help do you need with mental math?',
83
+ get options() {
84
+ return getPrimaryNeedSubcategoryOptions('mentalMath');
85
+ },
86
+ defaultNextquestionID: 'secondary_needs',
87
+ questionUUID: 'f3b0b498-38e4-49b7-8a6f-3d6522db2b41',
88
+ },
89
+ LEARNING_GAPS: {
90
+ id: 8,
91
+ questionID: 'key_need_l2',
92
+ type: 'options_thin',
93
+ question: 'What specific help is needed with learning gaps?',
94
+ options: [
95
+ { value: 'Brigde learning gaps from previous grades' },
96
+ {
97
+ value: 'Brigde learning gaps from current grade',
98
+ },
99
+ ],
100
+ defaultNextquestionID: 'secondary_needs',
101
+ questionUUID: '5895fe89-feee-45a8-a7a6-014295ca37f3',
102
+ },
103
+ MORE_PRACTICE: {
104
+ id: 9,
105
+ questionID: 'key_need_l2',
106
+ type: 'options_thin',
107
+ question: 'What specific help is needed with more practice?',
108
+ options: [
109
+ { value: 'Learn and remember concepts' },
110
+ {
111
+ value: 'Avoid silly mistakes',
112
+ },
113
+ ],
114
+ defaultNextquestionID: 'secondary_needs',
115
+ questionUUID: '40d92855-1ab1-4dc1-a3cb-cdcca1ad2e8d',
116
+ },
117
+ DEVELOP_INTEREST: {
118
+ id: 10,
119
+ questionID: 'key_need_l2',
120
+ type: 'options_thin',
121
+ question: 'What specific help is needed to develop interest in math?',
122
+ get options() {
123
+ return getDevelopInterestOptions();
124
+ },
125
+ defaultNextquestionID: 'secondary_needs',
126
+ questionUUID: '7ec57e7c-c50a-4f5b-b897-069116f21a40',
127
+ },
128
+ ADVANCE_AND_COMPETITIVE_MATHS: {
129
+ id: 11,
130
+ questionID: 'key_need_l2',
131
+ type: 'options_thin',
132
+ question: 'What specific help is needed with advance & competitive math?',
133
+ options: [
134
+ { value: 'Practice difficult level worksheets of same grade' },
135
+ { value: 'Practice worksheets of higher grades' },
136
+ {
137
+ value: 'Prepare for competitive exams like math olympiad',
138
+ },
139
+ ],
140
+ defaultNextquestionID: 'secondary_needs',
141
+ questionUUID: '316ec3ec-1d5e-4fc5-82df-248bf93931d1',
142
+ },
143
+ };
@@ -0,0 +1 @@
1
+ export * from './variants';
@@ -0,0 +1,13 @@
1
+ export const key_need_l3 = {
2
+ DEFAULT: {
3
+ id: 12,
4
+ questionID: 'key_need_l3',
5
+ type: 'freeFlowingText',
6
+ question:
7
+ 'Please mention the specific topic or type of problem your child needs help with.',
8
+ defaultNextquestionID: 13,
9
+ questionUUID: 'd50d0e6c-8dd0-444f-bb34-aa6a5d40d6e9',
10
+ placeholderText:
11
+ 'He is slow in calculating maths mentally, mostly discounts and percentages',
12
+ },
13
+ };
@@ -0,0 +1 @@
1
+ export * from './variants';
@@ -0,0 +1,30 @@
1
+ import { getPerformanceQuestionAccordingToGrade } from '../../utils';
2
+
3
+ export const math_perception = {
4
+ DEFAULT: {
5
+ id: 2,
6
+ questionID: 'math_perception',
7
+ description:
8
+ "It's okay to be anxious, glad or sad about math. We'd like to know so we can be mindful about their needs!",
9
+ type: 'options',
10
+ question: 'How does your child feel about math?',
11
+ options: [
12
+ {
13
+ value: 'ANXIOUS',
14
+ logo: '/static/e-cna-form/anxious-emoji.svg',
15
+ },
16
+ {
17
+ value: 'COMFORTABLE',
18
+ logo: '/static/e-cna-form/comfortable-emoji.svg',
19
+ },
20
+ {
21
+ value: 'LOVES IT',
22
+ logo: '/static/e-cna-form/loves-it-emoji.svg',
23
+ },
24
+ ],
25
+ get defaultNextquestionID() {
26
+ return getPerformanceQuestionAccordingToGrade();
27
+ },
28
+ questionUUID: 'fbb26cf1-1480-4e99-b1e2-3d015bd9c334',
29
+ },
30
+ };
@@ -0,0 +1 @@
1
+ export * from './variants';
@@ -0,0 +1,14 @@
1
+ import { QUESTION_ID } from '../../../constants';
2
+
3
+ export const other_curriculum = {
4
+ DEFAULT: {
5
+ id: 17,
6
+ questionID: QUESTION_ID.OTHER_CURRICULUM,
7
+ type: 'freeFlowingText',
8
+ question: 'Please enter the curriculum followed at your child’s school',
9
+ description: 'This information will help us find the right tutor for your child.',
10
+ placeholderText: 'Child’s school curriculum',
11
+ questionUUID: 'ea8f4ed7-4214-4dcd-a818-701bf1843626',
12
+ textAreaHeight: '44px',
13
+ },
14
+ };
@@ -0,0 +1 @@
1
+ export * from './variants';
@@ -0,0 +1,23 @@
1
+ export const school_performance_5_12 = {
2
+ DEFAULT: {
3
+ id: 3,
4
+ questionID: 'school_performance_5_12',
5
+ type: 'options',
6
+ question: 'How did they perform at school on their last assessment?',
7
+ description:
8
+ "Don't worry, we're just trying to understand what would work best for your child, so we can recommend the right program!",
9
+ options: [
10
+ { value: 'BELOW 70%', logo: '/static/e-cna-form/one-star.svg' },
11
+ {
12
+ value: '70% TO 90%',
13
+ logo: '/static/e-cna-form/two-stars.svg',
14
+ },
15
+ {
16
+ value: 'ABOVE 90%',
17
+ logo: '/static/e-cna-form/three-stars.svg',
18
+ },
19
+ ],
20
+ defaultNextquestionID: 'key_need_l1',
21
+ questionUUID: 'eea3d36a-405d-47f3-ba23-ef748bc24298',
22
+ },
23
+ };
@@ -0,0 +1 @@
1
+ export * from './variants';
@@ -0,0 +1,25 @@
1
+ export const school_performance_kg_4 = {
2
+ DEFAULT: {
3
+ id: 4,
4
+ questionID: 'school_performance_kg_4',
5
+ type: 'options_thin',
6
+ question: "What does your child's teacher say about math performance at school?",
7
+ options: [
8
+ {
9
+ value: "Can improve. You've got potential.",
10
+ logo: '/static/e-cna-form/one-star.svg',
11
+ },
12
+ {
13
+ value: 'Pretty good but you can do even better',
14
+ logo: '/static/e-cna-form/two-stars.svg',
15
+ },
16
+ {
17
+ value: "Awesome job! You're on track!",
18
+ logo: '/static/e-cna-form/three-stars.svg',
19
+ },
20
+ ],
21
+
22
+ defaultNextquestionID: 'key_need_l1',
23
+ questionUUID: 'a3fdfdf8-6d34-42b9-8bbe-d9568b797881',
24
+ },
25
+ };
@@ -0,0 +1 @@
1
+ export * from './variants';
@@ -0,0 +1,26 @@
1
+ const getSecondaryKeyNeeds = () => [
2
+ {
3
+ value:
4
+ "I'd like them to build strong math foundation and get support for schoolwork.",
5
+ },
6
+ { value: "I'd like them to be faster at calculations / Mental math." },
7
+ { value: "I'd like them to bridge learning gaps from previous and current grades." },
8
+ { value: 'I want my child to practice math regulalry.' },
9
+ { value: "I'd like them to develop interest and start enjoying math without fear." },
10
+ { value: 'I want my child to practice advanced and competitive math.' },
11
+ ];
12
+
13
+ export const secondary_needs = {
14
+ DEFAULT: {
15
+ id: 13,
16
+ questionID: 'secondary_needs',
17
+ type: 'options_multiselect',
18
+ question: 'Is there anything else we should focus on?',
19
+ description: 'You can select more than 1.',
20
+ get options() {
21
+ return getSecondaryKeyNeeds();
22
+ },
23
+ defaultNextquestionID: 'child_personality',
24
+ questionUUID: '4e1830f2-d37d-4c6f-9e56-1bd1e6660984',
25
+ },
26
+ };
@@ -0,0 +1 @@
1
+ export * from './variants';
@@ -0,0 +1,7 @@
1
+ export const signup = {
2
+ DEFAULT: {
3
+ id: 'parent_student_details',
4
+ questionID: 'demo',
5
+ nextSlide: 'parent_student_details',
6
+ },
7
+ };
@@ -0,0 +1 @@
1
+ export * from './variants';
@@ -0,0 +1,16 @@
1
+ export const signup_refer = {
2
+ DEFAULT: {
3
+ id: 16,
4
+ questionID: 'signup_refer',
5
+ type: 'options',
6
+ question: 'How did you learn about Cuemath?',
7
+ options: [
8
+ { value: 'Friends/Family' },
9
+ { value: 'Online Search' },
10
+ { value: 'Social Media' },
11
+ { value: 'App Store/Play Store' },
12
+ { value: 'Others' },
13
+ ],
14
+ questionUUID: 'ea8f4ed7-4214-4dcd-a818-701bf1843626',
15
+ },
16
+ };
@@ -0,0 +1 @@
1
+ export * from './variants';
@@ -0,0 +1,7 @@
1
+ export const slot_pick = {
2
+ DEFAULT: {
3
+ id: 'slot_pick',
4
+ questionID: 'demo',
5
+ nextSlide: 'parent_student_details',
6
+ },
7
+ };
@@ -0,0 +1,29 @@
1
+ import { getCookie } from '../../cookie';
2
+ import { localStorageGet } from '../../local-storage';
3
+
4
+ export function checkGradeCountry(
5
+ country: string[],
6
+ currentGrade: string,
7
+ lessThanGrade: number,
8
+ ): boolean {
9
+ if (
10
+ country.includes(getCookie('cue_country_code')) &&
11
+ (parseInt(currentGrade, 10) <= lessThanGrade || currentGrade === 'KG')
12
+ ) {
13
+ return true;
14
+ }
15
+
16
+ return false;
17
+ }
18
+
19
+ export function isUSK4Student() {
20
+ return checkGradeCountry(['US', 'UK'], localStorageGet('student_grade'), 4);
21
+ }
22
+
23
+ export function isAUK6Student() {
24
+ return checkGradeCountry(['AU', 'NZ'], localStorageGet('student_grade'), 6);
25
+ }
26
+
27
+ export function getPerformanceQuestionAccordingToGrade() {
28
+ return isUSK4Student() ? 'school_performance_kg_4' : 'school_performance_5_12';
29
+ }
package/src/index.ts CHANGED
@@ -1 +1,4 @@
1
1
  export * from './cookie';
2
+ export * from './constants';
3
+ export * from './local-storage';
4
+ export * from './e-cna';