@cuemath/leap 2.8.52-link.0 → 2.8.52-link.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.
@@ -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;AAC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AA;AAAA,oBAAC,gBAAAb,EAAAsB,GAAA,EAAK,WAAU,OAAO,UAAA;AAAA,sBAAAP;AAAA,sBAAY;AAAA,oBAAA,GAAQ;AAAA,oBAC3C,gBAAAf,EAACsB,GAAK,EAAA,WAAU,OAAM,UAAA;AAAA,sBAAA;AAAA,sBAAEZ,IAAiB;AAAA,sBAAE;AAAA,oBAAA,GAAY;AAAA,kBAAA,GACzD;AAAA,kBAECI,KACC,gBAAAjB;AAAA,oBAAC0B;AAAAA,oBAAA;AAAA,sBACC,WAAU;AAAA,sBACV,aAAa1C,EAAmB0B,IAAQ,CAAC,KAAK;AAAA,sBAE7C,UAAAO;AAAA,oBAAA;AAAA,kBACH;AAAA,gBAAA;AAAA,cAAA;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","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,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