@cuemath/leap 2.8.51 → 2.8.52-link.1
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/features/trial-session/api/trial-nodes.js +6 -5
- package/dist/features/trial-session/api/trial-nodes.js.map +1 -1
- package/dist/features/trial-session/api/trial-pricing.js.map +1 -1
- package/dist/features/trial-session/comps/pricing/pricing.js +66 -65
- package/dist/features/trial-session/comps/pricing/pricing.js.map +1 -1
- package/dist/features/trial-session/comps/school-goals/school-goals.js +54 -54
- package/dist/features/trial-session/comps/school-goals/school-goals.js.map +1 -1
- package/dist/features/trial-session/comps/student-enrichment/student-enrichment.js +41 -41
- package/dist/features/trial-session/comps/student-enrichment/student-enrichment.js.map +1 -1
- package/dist/features/trial-session/comps/student-info/student-info.js +35 -35
- package/dist/features/trial-session/comps/student-info/student-info.js.map +1 -1
- package/dist/features/trial-session/comps/test-prep/test-prep.js +45 -42
- package/dist/features/trial-session/comps/test-prep/test-prep.js.map +1 -1
- package/dist/features/trial-session/comps/worksheet/worksheet.js +23 -23
- package/dist/features/trial-session/comps/worksheet/worksheet.js.map +1 -1
- package/dist/features/trial-session/helper.js +52 -52
- package/dist/features/trial-session/helper.js.map +1 -1
- package/dist/features/trial-session/trial-session-types.js.map +1 -1
- package/package.json +1 -1
@@ -1,9 +1,10 @@
|
|
1
|
-
import { createPatchAPI as
|
2
|
-
import { BASE_URL_V2 as
|
3
|
-
|
4
|
-
|
1
|
+
import { createPatchAPI as r } from "@cuemath/rest-api";
|
2
|
+
import { BASE_URL_V2 as o } from "../../../constants/api.js";
|
3
|
+
import { stringify as s } from "../../../helpers/query-string.js";
|
4
|
+
const { usePatch: u } = r({
|
5
|
+
getURL: (e, t) => `${o}/students/${e}/nodes/trial/resume/?${s(t)}`
|
5
6
|
});
|
6
7
|
export {
|
7
|
-
|
8
|
+
u as useResumeTrialWorksheet
|
8
9
|
};
|
9
10
|
//# sourceMappingURL=trial-nodes.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"trial-nodes.js","sources":["../../../../src/features/trial-session/api/trial-nodes.ts"],"sourcesContent":["import type { IResumeWorksheetModel } from '../../../types/models/worksheet';\n\nimport { createPatchAPI } from '@cuemath/rest-api';\n\nimport { BASE_URL_V2 } from '../../../constants/api';\n\nconst { usePatch: useResumeTrialWorksheet } = createPatchAPI<\n IResumeWorksheetModel,\n Record<string, unknown>\n>({\n getURL: studentId
|
1
|
+
{"version":3,"file":"trial-nodes.js","sources":["../../../../src/features/trial-session/api/trial-nodes.ts"],"sourcesContent":["import type { IResumeWorksheetModel } from '../../../types/models/worksheet';\n\nimport { createPatchAPI } from '@cuemath/rest-api';\n\nimport { BASE_URL_V2 } from '../../../constants/api';\nimport { stringify } from '../../../helpers/query-string';\n\nconst { usePatch: useResumeTrialWorksheet } = createPatchAPI<\n IResumeWorksheetModel,\n Record<string, unknown>\n>({\n getURL: (studentId, query) =>\n `${BASE_URL_V2}/students/${studentId}/nodes/trial/resume/?${stringify(query)}`,\n});\n\nexport { useResumeTrialWorksheet };\n"],"names":["useResumeTrialWorksheet","createPatchAPI","studentId","query","BASE_URL_V2","stringify"],"mappings":";;;AAOA,MAAM,EAAE,UAAUA,EAAwB,IAAIC,EAG5C;AAAA,EACA,QAAQ,CAACC,GAAWC,MAClB,GAAGC,CAAW,aAAaF,CAAS,wBAAwBG,EAAUF,CAAK,CAAC;AAChF,CAAC;"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"trial-pricing.js","sources":["../../../../src/features/trial-session/api/trial-pricing.ts"],"sourcesContent":["import { createGetAPI } from '@cuemath/rest-api';\n\nimport { BASE_URL_V1 } from '../../../constants/api';\nimport { stringify } from '../../../helpers/query-string';\n\ninterface IGetPricingQuery {\n student_id: string;\n}\n\ntype TDiscountDetails = {\n discount_duration: number;\n original_plan_details: { duration: number };\n};\n\ntype TPricingDetails = {\n amount: number;\n amount_after_coupon: number;\n classes_per_week: number;\n currency_symbol: string;\n discount_details: TDiscountDetails;\n fee_per_class_after_discount: number;\n meta_text: string;\n no_of_classes: number;\n}[];\n\nconst { useGet: useGetTrialPricing } = createGetAPI<TPricingDetails, IGetPricingQuery>({\n getURL: (_, query) => `${BASE_URL_V1}/trial/pricing/?${stringify(query)}`,\n});\n\nexport { useGetTrialPricing };\n"],"names":["useGetTrialPricing","createGetAPI","_","query","BASE_URL_V1","stringify"],"mappings":";;;
|
1
|
+
{"version":3,"file":"trial-pricing.js","sources":["../../../../src/features/trial-session/api/trial-pricing.ts"],"sourcesContent":["import { createGetAPI } from '@cuemath/rest-api';\n\nimport { BASE_URL_V1 } from '../../../constants/api';\nimport { stringify } from '../../../helpers/query-string';\n\ninterface IGetPricingQuery {\n student_id: string;\n}\n\ntype TDiscountDetails = {\n discount_duration: number;\n original_plan_details: { duration: number };\n};\n\ntype TPricingDetails = {\n amount: number;\n amount_after_coupon: number;\n classes_per_week: number;\n currency_symbol: string;\n discount_details: TDiscountDetails;\n fee_per_class_after_discount: number;\n meta_text: string;\n no_of_classes: number;\n duration: number;\n}[];\n\nconst { useGet: useGetTrialPricing } = createGetAPI<TPricingDetails, IGetPricingQuery>({\n getURL: (_, query) => `${BASE_URL_V1}/trial/pricing/?${stringify(query)}`,\n});\n\nexport { useGetTrialPricing };\n"],"names":["useGetTrialPricing","createGetAPI","_","query","BASE_URL_V1","stringify"],"mappings":";;;AA0BA,MAAM,EAAE,QAAQA,EAAmB,IAAIC,EAAgD;AAAA,EACrF,QAAQ,CAACC,GAAGC,MAAU,GAAGC,CAAW,mBAAmBC,EAAUF,CAAK,CAAC;AACzE,CAAC;"}
|
@@ -1,64 +1,65 @@
|
|
1
1
|
import { jsx as e, jsxs as r } from "react/jsx-runtime";
|
2
|
-
import { memo as w, useCallback as D, useEffect as
|
3
|
-
import { ILLUSTRATIONS as
|
4
|
-
import
|
5
|
-
import
|
6
|
-
import
|
7
|
-
import
|
8
|
-
import
|
2
|
+
import { memo as w, useCallback as D, useEffect as _ } from "react";
|
3
|
+
import { ILLUSTRATIONS as v } from "../../../../assets/illustrations/illustrations.js";
|
4
|
+
import S from "../../../ui/error/error.js";
|
5
|
+
import H from "../../../ui/image/image.js";
|
6
|
+
import L from "../../../ui/layout/flex-view.js";
|
7
|
+
import R from "../../../ui/loader/app-loader/app-loader.js";
|
8
|
+
import h from "../../../ui/separator/separator.js";
|
9
9
|
import i from "../../../ui/text/text.js";
|
10
|
-
import { useGetTrialPricing as
|
11
|
-
import { useTrialSessionContext as
|
12
|
-
import
|
13
|
-
import
|
14
|
-
import { Container as
|
15
|
-
const
|
10
|
+
import { useGetTrialPricing as G } from "../../api/trial-pricing.js";
|
11
|
+
import { useTrialSessionContext as j } from "../../context/use-trial-session-context.js";
|
12
|
+
import B from "../slide-header/index.js";
|
13
|
+
import F from "./board-comp.js";
|
14
|
+
import { Container as N, PricingWrapper as O, PricingBoard as M, ImageWrapper as U, OfferText as b, PolicyWrapper as X, RefundImageWrapper as q } from "./pricing-styled.js";
|
15
|
+
const u = {
|
16
16
|
0: "WHITE_4",
|
17
17
|
1: "GREEN_1"
|
18
|
-
},
|
19
|
-
const { isTeacher:
|
18
|
+
}, se = w(() => {
|
19
|
+
const { isTeacher: A, studentId: t, updateButtonState: m } = j(), {
|
20
20
|
data: o,
|
21
|
-
get:
|
21
|
+
get: p,
|
22
22
|
isProcessed: a,
|
23
23
|
isProcessing: s,
|
24
|
-
isProcessingFailed:
|
25
|
-
} =
|
24
|
+
isProcessingFailed: P
|
25
|
+
} = G("trial-v3-pricing", {
|
26
26
|
student_id: t
|
27
27
|
}), c = D(() => {
|
28
|
-
t && !a &&
|
29
|
-
}, [
|
30
|
-
return
|
28
|
+
t && !a && p("trial-v3-pricing", { student_id: t });
|
29
|
+
}, [p, a, t]);
|
30
|
+
return _(() => {
|
31
31
|
c();
|
32
|
-
}, [c]),
|
33
|
-
|
34
|
-
}, [s,
|
35
|
-
/* @__PURE__ */ e(
|
36
|
-
/* @__PURE__ */ e(
|
37
|
-
/* @__PURE__ */ r(
|
32
|
+
}, [c]), _(() => {
|
33
|
+
m("right", { isDisabled: s, isLoading: !1 });
|
34
|
+
}, [s, A, m]), s ? /* @__PURE__ */ e(R, { height: "100vh" }) : P ? /* @__PURE__ */ e(S, { height: "100vh", onTryAgain: c }) : a ? /* @__PURE__ */ r(N, { children: [
|
35
|
+
/* @__PURE__ */ e(h, { height: 60 }),
|
36
|
+
/* @__PURE__ */ e(B, { marginBottom: 38 }),
|
37
|
+
/* @__PURE__ */ r(O, { children: [
|
38
38
|
/* @__PURE__ */ e(
|
39
|
-
|
39
|
+
L,
|
40
40
|
{
|
41
41
|
$width: "100%",
|
42
42
|
$flexDirection: "row",
|
43
43
|
$justifyContent: "space-between",
|
44
44
|
$flexGap: 20,
|
45
45
|
$flexWrap: !0,
|
46
|
-
children: o && Array.isArray(o) && o.map((
|
46
|
+
children: o && Array.isArray(o) && o.map((T, n) => {
|
47
47
|
const {
|
48
|
-
amount:
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
48
|
+
amount: f,
|
49
|
+
duration: y,
|
50
|
+
amount_after_coupon: l,
|
51
|
+
classes_per_week: E,
|
52
|
+
currency_symbol: d,
|
53
|
+
discount_details: C,
|
54
|
+
fee_per_class_after_discount: W,
|
55
|
+
meta_text: g,
|
56
|
+
no_of_classes: x
|
57
|
+
} = T || {}, {
|
58
|
+
discount_duration: $,
|
58
59
|
original_plan_details: I
|
59
|
-
} =
|
60
|
+
} = C || {}, { duration: k } = I || {};
|
60
61
|
return /* @__PURE__ */ r(
|
61
|
-
|
62
|
+
M,
|
62
63
|
{
|
63
64
|
$width: 287,
|
64
65
|
$height: 393,
|
@@ -66,58 +67,58 @@ const d = {
|
|
66
67
|
$gapX: 2.125,
|
67
68
|
$justifyContent: "space-between",
|
68
69
|
children: [
|
69
|
-
/* @__PURE__ */ e(
|
70
|
+
/* @__PURE__ */ e(U, { $color: u[n % 2] ?? "WHITE_4", children: /* @__PURE__ */ e(F, { width: 287, height: 393 }) }),
|
70
71
|
/* @__PURE__ */ r("div", { children: [
|
71
|
-
/* @__PURE__ */ e(
|
72
|
+
/* @__PURE__ */ e(h, { height: 30 }),
|
72
73
|
/* @__PURE__ */ r(i, { $renderAs: "ah2-black", children: [
|
73
|
-
|
74
|
+
k || y,
|
74
75
|
" ",
|
75
76
|
/* @__PURE__ */ e(i, { $renderAs: "ac2-black", $inline: !0, children: "Months" })
|
76
77
|
] }),
|
77
|
-
|
78
|
-
|
78
|
+
$ && /* @__PURE__ */ r(
|
79
|
+
b,
|
79
80
|
{
|
80
81
|
$renderAs: "ub3-bold",
|
81
|
-
$background:
|
82
|
+
$background: u[n % 2] ?? "WHITE_4",
|
82
83
|
children: [
|
83
84
|
"Get extra ",
|
84
|
-
|
85
|
+
$,
|
85
86
|
" Months FREE"
|
86
87
|
]
|
87
88
|
}
|
88
89
|
)
|
89
90
|
] }),
|
90
91
|
/* @__PURE__ */ r("div", { children: [
|
91
|
-
/* @__PURE__ */ r(i, { $renderAs: "ab1", $textDecoration: "line-through", children: [
|
92
|
-
|
92
|
+
l !== f ? /* @__PURE__ */ r(i, { $renderAs: "ab1", $textDecoration: "line-through", children: [
|
93
|
+
d + f,
|
93
94
|
/* @__PURE__ */ r(i, { $renderAs: "ab1-black", $inline: !0, children: [
|
94
95
|
" ",
|
95
|
-
|
96
|
+
d + l
|
96
97
|
] })
|
97
|
-
] }),
|
98
|
+
] }) : /* @__PURE__ */ e(i, { $renderAs: "ab1-black", $inline: !0, children: d + l }),
|
98
99
|
/* @__PURE__ */ r(i, { $renderAs: "ub3", children: [
|
99
100
|
"(",
|
100
|
-
|
101
|
+
W,
|
101
102
|
"/class)"
|
102
103
|
] })
|
103
104
|
] }),
|
104
105
|
/* @__PURE__ */ r("div", { children: [
|
105
106
|
/* @__PURE__ */ r(i, { $renderAs: "ab1", children: [
|
106
|
-
|
107
|
+
x,
|
107
108
|
" classes"
|
108
109
|
] }),
|
109
110
|
/* @__PURE__ */ r(i, { $renderAs: "ub2", children: [
|
110
111
|
"(",
|
111
|
-
|
112
|
+
E * 4,
|
112
113
|
" classes/mo)"
|
113
114
|
] })
|
114
115
|
] }),
|
115
|
-
|
116
|
-
|
116
|
+
g && /* @__PURE__ */ e(
|
117
|
+
b,
|
117
118
|
{
|
118
119
|
$renderAs: "ub3-bold",
|
119
|
-
$background:
|
120
|
-
children:
|
120
|
+
$background: u[n % 2] ?? "WHITE_4",
|
121
|
+
children: g
|
121
122
|
}
|
122
123
|
)
|
123
124
|
]
|
@@ -127,13 +128,13 @@ const d = {
|
|
127
128
|
})
|
128
129
|
}
|
129
130
|
),
|
130
|
-
/* @__PURE__ */ e(
|
131
|
-
/* @__PURE__ */ r(
|
131
|
+
/* @__PURE__ */ e(h, { height: 50 }),
|
132
|
+
/* @__PURE__ */ r(X, { children: [
|
132
133
|
/* @__PURE__ */ e(i, { $renderAs: "ab1-bold", $color: "GREEN_6", children: "We have a no-questions-asked refund policy" }),
|
133
|
-
/* @__PURE__ */ e(
|
134
|
-
|
134
|
+
/* @__PURE__ */ e(q, { children: /* @__PURE__ */ e(
|
135
|
+
H,
|
135
136
|
{
|
136
|
-
src:
|
137
|
+
src: v.REFUND_POLICY,
|
137
138
|
width: 168,
|
138
139
|
height: 100,
|
139
140
|
withLoader: !1
|
@@ -144,6 +145,6 @@ const d = {
|
|
144
145
|
] }) : null;
|
145
146
|
});
|
146
147
|
export {
|
147
|
-
|
148
|
+
se as default
|
148
149
|
};
|
149
150
|
//# sourceMappingURL=pricing.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"pricing.js","sources":["../../../../../src/features/trial-session/comps/pricing/pricing.tsx"],"sourcesContent":["import type { TColorNames } from '../../../ui/types';\n\nimport { memo, useCallback, useEffect } from 'react';\n\nimport { ILLUSTRATIONS } from '../../../../assets/illustrations/illustrations';\nimport Error from '../../../ui/error/error';\nimport Image from '../../../ui/image/image';\nimport FlexView from '../../../ui/layout/flex-view';\nimport AppLoader from '../../../ui/loader/app-loader/app-loader';\nimport Separator from '../../../ui/separator/separator';\nimport Text from '../../../ui/text/text';\nimport { useGetTrialPricing } from '../../api/trial-pricing';\nimport { useTrialSessionContext } from '../../context/use-trial-session-context';\nimport SlideHeader from '../slide-header';\nimport HangingBoardComp from './board-comp';\nimport * as Styled from './pricing-styled';\n\nconst layoutPrimaryColor: Record<number, TColorNames> = {\n 0: 'WHITE_4',\n 1: 'GREEN_1',\n};\n\nconst SessionPricing = memo(() => {\n const { isTeacher, studentId, updateButtonState } = useTrialSessionContext();\n\n const {\n data: pricingData,\n get: getTrialPricing,\n isProcessed,\n isProcessing,\n isProcessingFailed,\n } = useGetTrialPricing('trial-v3-pricing', {\n student_id: studentId,\n });\n\n const fetchData = useCallback(() => {\n if (studentId && !isProcessed) {\n getTrialPricing('trial-v3-pricing', { student_id: studentId });\n }\n }, [getTrialPricing, isProcessed, studentId]);\n\n useEffect(() => {\n fetchData();\n }, [fetchData]);\n\n useEffect(() => {\n updateButtonState('right', { isDisabled: isProcessing, isLoading: false });\n }, [isProcessing, isTeacher, updateButtonState]);\n\n if (isProcessing) {\n return <AppLoader height=\"100vh\" />;\n }\n\n if (isProcessingFailed) {\n return <Error height=\"100vh\" onTryAgain={fetchData} />;\n }\n\n if (isProcessed) {\n return (\n <Styled.Container>\n <Separator height={60} />\n <SlideHeader marginBottom={38} />\n <Styled.PricingWrapper>\n <FlexView\n $width=\"100%\"\n $flexDirection=\"row\"\n $justifyContent=\"space-between\"\n $flexGap={20}\n $flexWrap\n >\n {pricingData &&\n Array.isArray(pricingData) &&\n pricingData.map((pricing, index) => {\n const {\n amount,\n amount_after_coupon: amountAfterCoupon,\n classes_per_week: classesPerWeek,\n currency_symbol: currencySymbol,\n discount_details: discountDetails,\n fee_per_class_after_discount: feePerClassAfterDiscount,\n meta_text: metaText,\n no_of_classes: noOfClasses,\n } = pricing || {};\n const {\n discount_duration: discountDuration,\n original_plan_details: originalPlanDetails,\n } = discountDetails || {};\n const { duration } = originalPlanDetails || {};\n\n return (\n <Styled.PricingBoard\n key={`price-${index}`}\n $width={287}\n $height={393}\n $gutterX={2.5}\n $gapX={2.125}\n $justifyContent=\"space-between\"\n >\n <Styled.ImageWrapper $color={layoutPrimaryColor[index % 2] ?? 'WHITE_4'}>\n <HangingBoardComp width={287} height={393} />\n </Styled.ImageWrapper>\n <div>\n <Separator height={30} />\n <Text $renderAs=\"ah2-black\">\n {duration} \n <Text $renderAs=\"ac2-black\" $inline>\n Months\n </Text>\n </Text>\n {discountDuration && (\n <Styled.OfferText\n $renderAs=\"ub3-bold\"\n $background={layoutPrimaryColor[index % 2] ?? 'WHITE_4'}\n >\n Get extra {discountDuration} Months FREE\n </Styled.OfferText>\n )}\n </div>\n\n <div>\n <Text $renderAs=\"ab1\" $textDecoration=\"line-through\">\n {currencySymbol + amount}\n <Text $renderAs=\"ab1-black\" $inline>\n \n {currencySymbol + amountAfterCoupon}\n </Text>\n </Text>\n <Text $renderAs=\"ub3\">({feePerClassAfterDiscount}/class)</Text>\n </div>\n\n <div>\n <Text $renderAs=\"ab1\">{noOfClasses} classes</Text>\n <Text $renderAs=\"ub2\">({classesPerWeek * 4} classes/mo)</Text>\n </div>\n\n {metaText && (\n <Styled.OfferText\n $renderAs=\"ub3-bold\"\n $background={layoutPrimaryColor[index % 2] ?? 'WHITE_4'}\n >\n {metaText}\n </Styled.OfferText>\n )}\n </Styled.PricingBoard>\n );\n })}\n </FlexView>\n <Separator height={50} />\n <Styled.PolicyWrapper>\n <Text $renderAs=\"ab1-bold\" $color=\"GREEN_6\">\n We have a no-questions-asked refund policy\n </Text>\n <Styled.RefundImageWrapper>\n <Image\n src={ILLUSTRATIONS.REFUND_POLICY}\n width={168}\n height={100}\n withLoader={false}\n />\n </Styled.RefundImageWrapper>\n </Styled.PolicyWrapper>\n </Styled.PricingWrapper>\n </Styled.Container>\n );\n }\n\n return null;\n});\n\nexport default SessionPricing;\n"],"names":["layoutPrimaryColor","SessionPricing","memo","isTeacher","studentId","updateButtonState","useTrialSessionContext","pricingData","getTrialPricing","isProcessed","isProcessing","isProcessingFailed","useGetTrialPricing","fetchData","useCallback","useEffect","jsx","AppLoader","Error","jsxs","Styled.Container","Separator","SlideHeader","Styled.PricingWrapper","FlexView","pricing","index","amount","amountAfterCoupon","classesPerWeek","currencySymbol","discountDetails","feePerClassAfterDiscount","metaText","noOfClasses","discountDuration","originalPlanDetails","duration","Styled.PricingBoard","Styled.ImageWrapper","HangingBoardComp","Text","Styled.OfferText","Styled.PolicyWrapper","Styled.RefundImageWrapper","Image","ILLUSTRATIONS"],"mappings":";;;;;;;;;;;;;;AAiBA,MAAMA,IAAkD;AAAA,EACtD,GAAG;AAAA,EACH,GAAG;AACL,GAEMC,KAAiBC,EAAK,MAAM;AAChC,QAAM,EAAE,WAAAC,GAAW,WAAAC,GAAW,mBAAAC,MAAsBC,EAAuB,GAErE;AAAA,IACJ,MAAMC;AAAA,IACN,KAAKC;AAAA,IACL,aAAAC;AAAA,IACA,cAAAC;AAAA,IACA,oBAAAC;AAAA,EAAA,IACEC,EAAmB,oBAAoB;AAAA,IACzC,YAAYR;AAAA,EAAA,CACb,GAEKS,IAAYC,EAAY,MAAM;AAC9B,IAAAV,KAAa,CAACK,KAChBD,EAAgB,oBAAoB,EAAE,YAAYJ,EAAW,CAAA;AAAA,EAE9D,GAAA,CAACI,GAAiBC,GAAaL,CAAS,CAAC;AAU5C,SARAW,EAAU,MAAM;AACJ,IAAAF;EAAA,GACT,CAACA,CAAS,CAAC,GAEdE,EAAU,MAAM;AACd,IAAAV,EAAkB,SAAS,EAAE,YAAYK,GAAc,WAAW,IAAO;AAAA,EACxE,GAAA,CAACA,GAAcP,GAAWE,CAAiB,CAAC,GAE3CK,IACK,gBAAAM,EAACC,GAAU,EAAA,QAAO,QAAQ,CAAA,IAG/BN,IACM,gBAAAK,EAAAE,GAAA,EAAM,QAAO,SAAQ,YAAYL,EAAW,CAAA,IAG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;AAAA,cAlDG,SAASP,CAAK;AAAA,YAAA;AAAA,UAoDrB,CAEH;AAAA,QAAA;AAAA,MACL;AAAA,MACA,gBAAAV,EAACK,GAAU,EAAA,QAAQ,GAAI,CAAA;AAAA,MACvB,gBAAAF,EAACwB,GAAA,EACC,UAAA;AAAA,QAAA,gBAAA3B,EAACyB,GAAK,EAAA,WAAU,YAAW,QAAO,WAAU,UAE5C,8CAAA;AAAA,QACA,gBAAAzB,EAAC4B,GAAA,EACC,UAAA,gBAAA5B;AAAA,UAAC6B;AAAA,UAAA;AAAA,YACC,KAAKC,EAAc;AAAA,YACnB,OAAO;AAAA,YACP,QAAQ;AAAA,YACR,YAAY;AAAA,UAAA;AAAA,QAAA,GAEhB;AAAA,MAAA,GACF;AAAA,IAAA,GACF;AAAA,EACF,EAAA,CAAA,IAIG;AACT,CAAC;"}
|
1
|
+
{"version":3,"file":"pricing.js","sources":["../../../../../src/features/trial-session/comps/pricing/pricing.tsx"],"sourcesContent":["import type { TColorNames } from '../../../ui/types';\n\nimport { memo, useCallback, useEffect } from 'react';\n\nimport { ILLUSTRATIONS } from '../../../../assets/illustrations/illustrations';\nimport Error from '../../../ui/error/error';\nimport Image from '../../../ui/image/image';\nimport FlexView from '../../../ui/layout/flex-view';\nimport AppLoader from '../../../ui/loader/app-loader/app-loader';\nimport Separator from '../../../ui/separator/separator';\nimport Text from '../../../ui/text/text';\nimport { useGetTrialPricing } from '../../api/trial-pricing';\nimport { useTrialSessionContext } from '../../context/use-trial-session-context';\nimport SlideHeader from '../slide-header';\nimport HangingBoardComp from './board-comp';\nimport * as Styled from './pricing-styled';\n\nconst layoutPrimaryColor: Record<number, TColorNames> = {\n 0: 'WHITE_4',\n 1: 'GREEN_1',\n};\n\nconst SessionPricing = memo(() => {\n const { isTeacher, studentId, updateButtonState } = useTrialSessionContext();\n\n const {\n data: pricingData,\n get: getTrialPricing,\n isProcessed,\n isProcessing,\n isProcessingFailed,\n } = useGetTrialPricing('trial-v3-pricing', {\n student_id: studentId,\n });\n\n const fetchData = useCallback(() => {\n if (studentId && !isProcessed) {\n getTrialPricing('trial-v3-pricing', { student_id: studentId });\n }\n }, [getTrialPricing, isProcessed, studentId]);\n\n useEffect(() => {\n fetchData();\n }, [fetchData]);\n\n useEffect(() => {\n updateButtonState('right', { isDisabled: isProcessing, isLoading: false });\n }, [isProcessing, isTeacher, updateButtonState]);\n\n if (isProcessing) {\n return <AppLoader height=\"100vh\" />;\n }\n\n if (isProcessingFailed) {\n return <Error height=\"100vh\" onTryAgain={fetchData} />;\n }\n\n if (isProcessed) {\n return (\n <Styled.Container>\n <Separator height={60} />\n <SlideHeader marginBottom={38} />\n <Styled.PricingWrapper>\n <FlexView\n $width=\"100%\"\n $flexDirection=\"row\"\n $justifyContent=\"space-between\"\n $flexGap={20}\n $flexWrap\n >\n {pricingData &&\n Array.isArray(pricingData) &&\n pricingData.map((pricing, index) => {\n const {\n amount,\n duration: durationWithoutCoupon,\n amount_after_coupon: amountAfterCoupon,\n classes_per_week: classesPerWeek,\n currency_symbol: currencySymbol,\n discount_details: discountDetails,\n fee_per_class_after_discount: feePerClassAfterDiscount,\n meta_text: metaText,\n no_of_classes: noOfClasses,\n } = pricing || {};\n const {\n discount_duration: discountDuration,\n original_plan_details: originalPlanDetails,\n } = discountDetails || {};\n const { duration } = originalPlanDetails || {};\n\n return (\n <Styled.PricingBoard\n key={`price-${index}`}\n $width={287}\n $height={393}\n $gutterX={2.5}\n $gapX={2.125}\n $justifyContent=\"space-between\"\n >\n <Styled.ImageWrapper $color={layoutPrimaryColor[index % 2] ?? 'WHITE_4'}>\n <HangingBoardComp width={287} height={393} />\n </Styled.ImageWrapper>\n <div>\n <Separator height={30} />\n <Text $renderAs=\"ah2-black\">\n {duration || durationWithoutCoupon} \n <Text $renderAs=\"ac2-black\" $inline>\n Months\n </Text>\n </Text>\n {discountDuration && (\n <Styled.OfferText\n $renderAs=\"ub3-bold\"\n $background={layoutPrimaryColor[index % 2] ?? 'WHITE_4'}\n >\n Get extra {discountDuration} Months FREE\n </Styled.OfferText>\n )}\n </div>\n\n <div>\n {amountAfterCoupon !== amount ? (\n <Text $renderAs=\"ab1\" $textDecoration=\"line-through\">\n {currencySymbol + amount}\n <Text $renderAs=\"ab1-black\" $inline>\n \n {currencySymbol + amountAfterCoupon}\n </Text>\n </Text>\n ) : (\n <Text $renderAs=\"ab1-black\" $inline>\n {currencySymbol + amountAfterCoupon}\n </Text>\n )}\n <Text $renderAs=\"ub3\">({feePerClassAfterDiscount}/class)</Text>\n </div>\n\n <div>\n <Text $renderAs=\"ab1\">{noOfClasses} classes</Text>\n <Text $renderAs=\"ub2\">({classesPerWeek * 4} classes/mo)</Text>\n </div>\n\n {metaText && (\n <Styled.OfferText\n $renderAs=\"ub3-bold\"\n $background={layoutPrimaryColor[index % 2] ?? 'WHITE_4'}\n >\n {metaText}\n </Styled.OfferText>\n )}\n </Styled.PricingBoard>\n );\n })}\n </FlexView>\n <Separator height={50} />\n <Styled.PolicyWrapper>\n <Text $renderAs=\"ab1-bold\" $color=\"GREEN_6\">\n We have a no-questions-asked refund policy\n </Text>\n <Styled.RefundImageWrapper>\n <Image\n src={ILLUSTRATIONS.REFUND_POLICY}\n width={168}\n height={100}\n withLoader={false}\n />\n </Styled.RefundImageWrapper>\n </Styled.PolicyWrapper>\n </Styled.PricingWrapper>\n </Styled.Container>\n );\n }\n\n return null;\n});\n\nexport default SessionPricing;\n"],"names":["layoutPrimaryColor","SessionPricing","memo","isTeacher","studentId","updateButtonState","useTrialSessionContext","pricingData","getTrialPricing","isProcessed","isProcessing","isProcessingFailed","useGetTrialPricing","fetchData","useCallback","useEffect","jsx","AppLoader","Error","jsxs","Styled.Container","Separator","SlideHeader","Styled.PricingWrapper","FlexView","pricing","index","amount","durationWithoutCoupon","amountAfterCoupon","classesPerWeek","currencySymbol","discountDetails","feePerClassAfterDiscount","metaText","noOfClasses","discountDuration","originalPlanDetails","duration","Styled.PricingBoard","Styled.ImageWrapper","HangingBoardComp","Text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AK,EAAA,WAAU,YAAW,QAAO,WAAU,UAE5C,8CAAA;AAAA,QACA,gBAAA1B,EAAC6B,GAAA,EACC,UAAA,gBAAA7B;AAAA,UAAC8B;AAAA,UAAA;AAAA,YACC,KAAKC,EAAc;AAAA,YACnB,OAAO;AAAA,YACP,QAAQ;AAAA,YACR,YAAY;AAAA,UAAA;AAAA,QAAA,GAEhB;AAAA,MAAA,GACF;AAAA,IAAA,GACF;AAAA,EACF,EAAA,CAAA,IAIG;AACT,CAAC;"}
|
@@ -1,43 +1,43 @@
|
|
1
|
-
import { jsx as
|
2
|
-
import { memo as
|
1
|
+
import { jsx as A } from "react/jsx-runtime";
|
2
|
+
import { memo as B, useMemo as C, useCallback as s, useEffect as S } from "react";
|
3
3
|
import { GOAL_CATEGORY as m } from "../../../milestone/constants.js";
|
4
|
-
import { getCategorizedCurriculumStandards as
|
5
|
-
import { getGradesFromConfig as
|
6
|
-
import { epochTimestampAfterOneYear as
|
7
|
-
import { useTrialSessionContext as
|
8
|
-
import { updateGoalInFormData as
|
9
|
-
import
|
10
|
-
const
|
4
|
+
import { getCategorizedCurriculumStandards as Y } from "../../../milestone/create/comps/class-details-step/class-details-utils.js";
|
5
|
+
import { getGradesFromConfig as j, getGoalsFromConfig as q } from "../../../milestone/create/milestone-create-helpers.js";
|
6
|
+
import { epochTimestampAfterOneYear as G } from "../../../utils/utils.js";
|
7
|
+
import { useTrialSessionContext as v } from "../../context/use-trial-session-context.js";
|
8
|
+
import { updateGoalInFormData as O } from "../../helper.js";
|
9
|
+
import w from "./school-goals-view.js";
|
10
|
+
const X = B(() => {
|
11
11
|
const {
|
12
12
|
milestoneConfig: r,
|
13
|
-
formData:
|
13
|
+
formData: L,
|
14
14
|
updateSlideConfig: n,
|
15
|
-
updateButtonState:
|
16
|
-
onRemoveOptionalSlides:
|
17
|
-
trialHomeData:
|
18
|
-
} =
|
19
|
-
() =>
|
20
|
-
countryCode:
|
15
|
+
updateButtonState: f,
|
16
|
+
onRemoveOptionalSlides: g,
|
17
|
+
trialHomeData: E
|
18
|
+
} = v(), { name: p, grade: e, goals: a, curriculum: i } = L || {}, { demo_info: U } = E, { stream: c, region_data: y } = U || {}, { opportunity_country: u = "US" } = y || {}, H = j(r), N = C(
|
19
|
+
() => Y(r, {
|
20
|
+
countryCode: u,
|
21
21
|
grade: e ?? "",
|
22
22
|
goalCategory: m.SCHOOL_SUCCESS,
|
23
|
-
courseStream:
|
23
|
+
courseStream: c,
|
24
24
|
enrollmentType: "ONLINE"
|
25
25
|
}),
|
26
|
-
[r, e,
|
27
|
-
),
|
28
|
-
() =>
|
29
|
-
countryCode:
|
26
|
+
[r, u, e, c]
|
27
|
+
), d = C(
|
28
|
+
() => q(r, {
|
29
|
+
countryCode: u,
|
30
30
|
grade: e ?? "",
|
31
31
|
goalCategory: m.SCHOOL_SUCCESS,
|
32
|
-
courseStream:
|
33
|
-
curriculumStandard:
|
32
|
+
courseStream: c,
|
33
|
+
curriculumStandard: i,
|
34
34
|
enrollmentType: "ONLINE"
|
35
35
|
}),
|
36
|
-
[r, e,
|
37
|
-
), { goal_code:
|
36
|
+
[r, u, e, c, i]
|
37
|
+
), { goal_code: _ } = C(
|
38
38
|
() => (a == null ? void 0 : a.find((o) => o.goal_category === m.SCHOOL_SUCCESS)) ?? {},
|
39
39
|
[a]
|
40
|
-
), h = !!(
|
40
|
+
), h = !!(p && e && i && _), t = s(
|
41
41
|
(o, l) => {
|
42
42
|
n({
|
43
43
|
[o]: l,
|
@@ -45,57 +45,57 @@ const Q = x(() => {
|
|
45
45
|
});
|
46
46
|
},
|
47
47
|
[n]
|
48
|
-
),
|
48
|
+
), T = s((o) => t("name", o.target.value), [t]), D = s(
|
49
49
|
(o, l) => {
|
50
|
-
const { label:
|
50
|
+
const { label: F } = l, x = O(a, m.SCHOOL_SUCCESS, {
|
51
51
|
goal_code: o,
|
52
|
-
milestone_name:
|
53
|
-
milestone_date_ts:
|
52
|
+
milestone_name: F,
|
53
|
+
milestone_date_ts: G()
|
54
54
|
});
|
55
|
-
n({ goals:
|
55
|
+
n({ goals: x });
|
56
56
|
},
|
57
57
|
[a, n]
|
58
|
-
),
|
58
|
+
), I = s(
|
59
59
|
(o) => t("curriculum", o),
|
60
60
|
[t]
|
61
|
-
),
|
61
|
+
), b = s(
|
62
62
|
(o) => {
|
63
63
|
t("grade", o), t("curriculum", "");
|
64
64
|
},
|
65
65
|
[t]
|
66
66
|
);
|
67
|
-
return
|
68
|
-
|
69
|
-
}, [h,
|
70
|
-
e && (
|
71
|
-
}, [e]),
|
72
|
-
const o =
|
67
|
+
return S(() => {
|
68
|
+
f("right", { isDisabled: !h, isLoading: !1 });
|
69
|
+
}, [h, f]), S(() => {
|
70
|
+
e && (g == null || g(e));
|
71
|
+
}, [e]), S(() => {
|
72
|
+
const o = d.length === 1 ? d[0] : void 0;
|
73
73
|
if (o) {
|
74
|
-
const l =
|
74
|
+
const l = O(a, m.SCHOOL_SUCCESS, {
|
75
75
|
goal_code: o.id ?? "",
|
76
76
|
milestone_name: o.label ?? "",
|
77
|
-
milestone_date_ts:
|
77
|
+
milestone_date_ts: G()
|
78
78
|
});
|
79
79
|
n({ goals: l });
|
80
80
|
}
|
81
|
-
}, [
|
82
|
-
|
81
|
+
}, [d]), /* @__PURE__ */ A(
|
82
|
+
w,
|
83
83
|
{
|
84
|
-
name:
|
84
|
+
name: p,
|
85
85
|
grade: e,
|
86
|
-
curriculum:
|
87
|
-
grades:
|
88
|
-
curriculumStandards:
|
89
|
-
goalsList:
|
90
|
-
selectedGoal:
|
91
|
-
onNameChange:
|
92
|
-
onGoalChange:
|
93
|
-
onGradeChange:
|
94
|
-
onCurriculumChange:
|
86
|
+
curriculum: i,
|
87
|
+
grades: H,
|
88
|
+
curriculumStandards: N,
|
89
|
+
goalsList: d,
|
90
|
+
selectedGoal: _,
|
91
|
+
onNameChange: T,
|
92
|
+
onGoalChange: D,
|
93
|
+
onGradeChange: b,
|
94
|
+
onCurriculumChange: I
|
95
95
|
}
|
96
96
|
);
|
97
97
|
});
|
98
98
|
export {
|
99
|
-
|
99
|
+
X as default
|
100
100
|
};
|
101
101
|
//# sourceMappingURL=school-goals.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"school-goals.js","sources":["../../../../../src/features/trial-session/comps/school-goals/school-goals.tsx"],"sourcesContent":["import type { ISelectOption } from '../../../ui/inputs/base-select-input/base-select-input-types';\n\nimport { memo, useCallback, useEffect, useMemo } from 'react';\n\nimport { GOAL_CATEGORY } from '../../../milestone/constants';\nimport { getCategorizedCurriculumStandards } from '../../../milestone/create/comps/class-details-step/class-details-utils';\nimport {\n getGoalsFromConfig,\n getGradesFromConfig,\n} from '../../../milestone/create/milestone-create-helpers';\nimport { epochTimestampAfterOneYear } from '../../../utils/utils';\nimport { useTrialSessionContext } from '../../context/use-trial-session-context';\nimport { updateGoalInFormData } from '../../helper';\nimport SchoolGoalsView from './school-goals-view';\n\nconst SchoolGoals = memo(() => {\n const {\n milestoneConfig,\n formData,\n updateSlideConfig,\n updateButtonState,\n onRemoveOptionalSlides,\n trialHomeData,\n } = useTrialSessionContext();\n const { name, grade, goals, curriculum } = formData || {};\n\n const { demo_info: demoInfo } = trialHomeData;\n const { stream } = demoInfo || {};\n const grades = getGradesFromConfig(milestoneConfig);\n\n const curriculumStandards = useMemo(\n () =>\n getCategorizedCurriculumStandards(milestoneConfig, {\n countryCode
|
1
|
+
{"version":3,"file":"school-goals.js","sources":["../../../../../src/features/trial-session/comps/school-goals/school-goals.tsx"],"sourcesContent":["import type { ISelectOption } from '../../../ui/inputs/base-select-input/base-select-input-types';\n\nimport { memo, useCallback, useEffect, useMemo } from 'react';\n\nimport { GOAL_CATEGORY } from '../../../milestone/constants';\nimport { getCategorizedCurriculumStandards } from '../../../milestone/create/comps/class-details-step/class-details-utils';\nimport {\n getGoalsFromConfig,\n getGradesFromConfig,\n} from '../../../milestone/create/milestone-create-helpers';\nimport { epochTimestampAfterOneYear } from '../../../utils/utils';\nimport { useTrialSessionContext } from '../../context/use-trial-session-context';\nimport { updateGoalInFormData } from '../../helper';\nimport SchoolGoalsView from './school-goals-view';\n\nconst SchoolGoals = memo(() => {\n const {\n milestoneConfig,\n formData,\n updateSlideConfig,\n updateButtonState,\n onRemoveOptionalSlides,\n trialHomeData,\n } = useTrialSessionContext();\n const { name, grade, goals, curriculum } = formData || {};\n\n const { demo_info: demoInfo } = trialHomeData;\n const { stream, region_data: regionData } = demoInfo || {};\n const { opportunity_country: countryCode = 'US' } = regionData || {};\n const grades = getGradesFromConfig(milestoneConfig);\n\n const curriculumStandards = useMemo(\n () =>\n getCategorizedCurriculumStandards(milestoneConfig, {\n countryCode,\n grade: grade ?? '',\n goalCategory: GOAL_CATEGORY.SCHOOL_SUCCESS,\n courseStream: stream,\n enrollmentType: 'ONLINE',\n }),\n [milestoneConfig, countryCode, grade, stream],\n );\n\n const goalsList = useMemo(\n () =>\n getGoalsFromConfig(milestoneConfig, {\n countryCode,\n grade: grade ?? '',\n goalCategory: GOAL_CATEGORY.SCHOOL_SUCCESS,\n courseStream: stream,\n curriculumStandard: curriculum,\n enrollmentType: 'ONLINE',\n }),\n [milestoneConfig, countryCode, grade, stream, curriculum],\n );\n\n const { goal_code: selectedGoal } = useMemo(\n () => goals?.find(goal => goal.goal_category === GOAL_CATEGORY.SCHOOL_SUCCESS) ?? {},\n [goals],\n );\n\n const hasRequiredFields = Boolean(name && grade && curriculum && selectedGoal);\n\n const updateStudentInformation = useCallback(\n (key: string, value: string) => {\n updateSlideConfig({\n [key]: value,\n ...(key === 'grade' || key === 'curriculum' ? { goals: [] } : {}),\n });\n },\n [updateSlideConfig],\n );\n\n const handleNameChange = useCallback<\n NonNullable<React.InputHTMLAttributes<HTMLInputElement>['onChange']>\n >(event => updateStudentInformation('name', event.target.value), [updateStudentInformation]);\n\n const handleGoalChange = useCallback(\n (value: string, option: ISelectOption<string | number>) => {\n const { label } = option;\n\n const updatedGoals = updateGoalInFormData(goals, GOAL_CATEGORY.SCHOOL_SUCCESS, {\n goal_code: value,\n milestone_name: label,\n milestone_date_ts: epochTimestampAfterOneYear(),\n });\n\n updateSlideConfig({ goals: updatedGoals });\n },\n [goals, updateSlideConfig],\n );\n\n const handleCurriculumChange = useCallback(\n (value: string) => updateStudentInformation('curriculum', value),\n [updateStudentInformation],\n );\n\n const handleGradeChange = useCallback(\n (value: string) => {\n updateStudentInformation('grade', value);\n updateStudentInformation('curriculum', '');\n },\n [updateStudentInformation],\n );\n\n useEffect(() => {\n updateButtonState('right', { isDisabled: !hasRequiredFields, isLoading: false });\n }, [hasRequiredFields, updateButtonState]);\n\n useEffect(() => {\n if (grade) {\n onRemoveOptionalSlides?.(grade);\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [grade]);\n\n useEffect(() => {\n // If there is only one goal in the list, set it as the selected goal\n // and update the form data with the goal code, milestone name, and date\n const defaultGoal = goalsList.length === 1 ? goalsList[0] : undefined;\n\n if (defaultGoal) {\n const goalToUpdate = updateGoalInFormData(goals, GOAL_CATEGORY.SCHOOL_SUCCESS, {\n goal_code: defaultGoal.id ?? '',\n milestone_name: defaultGoal.label ?? '',\n milestone_date_ts: epochTimestampAfterOneYear(),\n });\n\n updateSlideConfig({ goals: goalToUpdate });\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [goalsList]);\n\n return (\n <SchoolGoalsView\n name={name}\n grade={grade}\n curriculum={curriculum}\n grades={grades}\n curriculumStandards={curriculumStandards}\n goalsList={goalsList}\n selectedGoal={selectedGoal}\n onNameChange={handleNameChange}\n onGoalChange={handleGoalChange}\n onGradeChange={handleGradeChange}\n onCurriculumChange={handleCurriculumChange}\n />\n );\n});\n\nexport default SchoolGoals;\n"],"names":["SchoolGoals","memo","milestoneConfig","formData","updateSlideConfig","updateButtonState","onRemoveOptionalSlides","trialHomeData","useTrialSessionContext","name","grade","goals","curriculum","demoInfo","stream","regionData","countryCode","grades","getGradesFromConfig","curriculumStandards","useMemo","getCategorizedCurriculumStandards","GOAL_CATEGORY","goalsList","getGoalsFromConfig","selectedGoal","goal","hasRequiredFields","updateStudentInformation","useCallback","key","value","handleNameChange","event","handleGoalChange","option","label","updatedGoals","updateGoalInFormData","epochTimestampAfterOneYear","handleCurriculumChange","handleGradeChange","useEffect","defaultGoal","goalToUpdate","jsx","SchoolGoalsView"],"mappings":";;;;;;;;;AAeM,MAAAA,IAAcC,EAAK,MAAM;AACvB,QAAA;AAAA,IACJ,iBAAAC;AAAA,IACA,UAAAC;AAAA,IACA,mBAAAC;AAAA,IACA,mBAAAC;AAAA,IACA,wBAAAC;AAAA,IACA,eAAAC;AAAA,MACEC,EAAuB,GACrB,EAAE,MAAAC,GAAM,OAAAC,GAAO,OAAAC,GAAO,YAAAC,EAAW,IAAIT,KAAY,IAEjD,EAAE,WAAWU,EAAa,IAAAN,GAC1B,EAAE,QAAAO,GAAQ,aAAaC,EAAW,IAAIF,KAAY,CAAA,GAClD,EAAE,qBAAqBG,IAAc,KAAK,IAAID,KAAc,CAAA,GAC5DE,IAASC,EAAoBhB,CAAe,GAE5CiB,IAAsBC;AAAA,IAC1B,MACEC,EAAkCnB,GAAiB;AAAA,MACjD,aAAAc;AAAA,MACA,OAAON,KAAS;AAAA,MAChB,cAAcY,EAAc;AAAA,MAC5B,cAAcR;AAAA,MACd,gBAAgB;AAAA,IAAA,CACjB;AAAA,IACH,CAACZ,GAAiBc,GAAaN,GAAOI,CAAM;AAAA,EAAA,GAGxCS,IAAYH;AAAA,IAChB,MACEI,EAAmBtB,GAAiB;AAAA,MAClC,aAAAc;AAAA,MACA,OAAON,KAAS;AAAA,MAChB,cAAcY,EAAc;AAAA,MAC5B,cAAcR;AAAA,MACd,oBAAoBF;AAAA,MACpB,gBAAgB;AAAA,IAAA,CACjB;AAAA,IACH,CAACV,GAAiBc,GAAaN,GAAOI,GAAQF,CAAU;AAAA,EAAA,GAGpD,EAAE,WAAWa,EAAA,IAAiBL;AAAA,IAClC,OAAMT,KAAA,gBAAAA,EAAO,KAAK,CAAAe,MAAQ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