@edx/frontend-app-subscription-manage 1.3.1 → 1.4.0
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/app.js +2 -2
- package/dist/app.js.map +1 -1
- package/dist/components/ActiveSubscription/ActiveSubscription.d.ts +7 -0
- package/dist/components/ActiveSubscription/ActiveSubscription.js +24 -0
- package/dist/components/ActiveSubscription/ActiveSubscription.js.map +1 -0
- package/dist/components/BecomeSubscriber/BecomeSubscriber.d.ts +7 -0
- package/dist/components/BecomeSubscriber/BecomeSubscriber.js +19 -0
- package/dist/components/BecomeSubscriber/BecomeSubscriber.js.map +1 -0
- package/dist/components/CancelConfirmation/CancelConfirmation.d.ts +12 -0
- package/dist/components/CancelConfirmation/CancelConfirmation.js +21 -0
- package/dist/components/CancelConfirmation/CancelConfirmation.js.map +1 -0
- package/dist/components/CancelSuccess/CancelSuccess.d.ts +7 -0
- package/dist/components/CancelSuccess/CancelSuccess.js +17 -0
- package/dist/components/CancelSuccess/CancelSuccess.js.map +1 -0
- package/dist/components/CanceledSubscription/CanceledSubscription.d.ts +13 -0
- package/dist/components/CanceledSubscription/CanceledSubscription.js +27 -0
- package/dist/components/CanceledSubscription/CanceledSubscription.js.map +1 -0
- package/dist/components/EnrolledCoursesList/EnrolledCoursesList.d.ts +8 -0
- package/dist/components/EnrolledCoursesList/EnrolledCoursesList.js +20 -0
- package/dist/components/EnrolledCoursesList/EnrolledCoursesList.js.map +1 -0
- package/dist/components/HelpFooter/HelpFooter.d.ts +3 -0
- package/dist/components/HelpFooter/HelpFooter.js +12 -0
- package/dist/components/HelpFooter/HelpFooter.js.map +1 -0
- package/dist/components/OrderHistoryHeader/OrderHistoryHeader.d.ts +3 -0
- package/dist/components/OrderHistoryHeader/OrderHistoryHeader.js +9 -0
- package/dist/components/OrderHistoryHeader/OrderHistoryHeader.js.map +1 -0
- package/dist/components/PaymentHistory/PaymentHistory.d.ts +10 -0
- package/dist/components/PaymentHistory/PaymentHistory.js +23 -0
- package/dist/components/PaymentHistory/PaymentHistory.js.map +1 -0
- package/dist/components/RenewSubscriptionModal/RenewSubscriptionModal.d.ts +17 -0
- package/dist/components/RenewSubscriptionModal/RenewSubscriptionModal.js +63 -0
- package/dist/components/RenewSubscriptionModal/RenewSubscriptionModal.js.map +1 -0
- package/dist/components/ResubscribeCard/ResubscribeCard.d.ts +9 -0
- package/dist/components/ResubscribeCard/ResubscribeCard.js +25 -0
- package/dist/components/ResubscribeCard/ResubscribeCard.js.map +1 -0
- package/dist/components/SubscriptionTabs/SubscriptionTabs.d.ts +8 -0
- package/dist/components/SubscriptionTabs/SubscriptionTabs.js +9 -0
- package/dist/components/SubscriptionTabs/SubscriptionTabs.js.map +1 -0
- package/dist/components/UpdatePaymentMethodModal/UpdatePaymentMethodModal.d.ts +9 -0
- package/dist/components/UpdatePaymentMethodModal/UpdatePaymentMethodModal.js +135 -0
- package/dist/components/UpdatePaymentMethodModal/UpdatePaymentMethodModal.js.map +1 -0
- package/dist/components/messages.d.ts +473 -0
- package/dist/components/messages.js +482 -0
- package/dist/components/messages.js.map +1 -0
- package/dist/constants.d.ts +14 -56
- package/dist/constants.js +23 -272
- package/dist/constants.js.map +1 -1
- package/dist/data/hooks/keys.d.ts +8 -13
- package/dist/data/hooks/keys.js +8 -13
- package/dist/data/hooks/keys.js.map +1 -1
- package/dist/data/hooks/useManageQueries.d.ts +37 -0
- package/dist/data/hooks/useManageQueries.js +206 -0
- package/dist/data/hooks/useManageQueries.js.map +1 -0
- package/dist/data/services/subs/urls.d.ts +2 -2
- package/dist/data/services/subs/urls.js.map +1 -1
- package/dist/data/services/subscription/cancelSubscription.d.ts +6 -0
- package/dist/data/services/subscription/cancelSubscription.js +31 -0
- package/dist/data/services/subscription/cancelSubscription.js.map +1 -0
- package/dist/data/services/subscription/getBillingPlans.d.ts +3 -0
- package/dist/{utils/fetchBillingPlans.js → data/services/subscription/getBillingPlans.js} +10 -21
- package/dist/data/services/subscription/getBillingPlans.js.map +1 -0
- package/dist/data/services/subscription/getIsCurrentUserSubscriber.d.ts +3 -0
- package/dist/data/services/subscription/getIsCurrentUserSubscriber.js +35 -0
- package/dist/data/services/subscription/getIsCurrentUserSubscriber.js.map +1 -0
- package/dist/data/services/subscription/getPaymentHistory.d.ts +6 -0
- package/dist/data/services/subscription/getPaymentHistory.js +65 -0
- package/dist/data/services/subscription/getPaymentHistory.js.map +1 -0
- package/dist/data/services/subscription/getSubscriptionEnrollments.d.ts +7 -0
- package/dist/data/services/subscription/getSubscriptionEnrollments.js +98 -0
- package/dist/data/services/subscription/getSubscriptionEnrollments.js.map +1 -0
- package/dist/data/services/subscription/getSubscriptionPaymentMethod.d.ts +8 -0
- package/dist/data/services/subscription/getSubscriptionPaymentMethod.js +42 -0
- package/dist/data/services/subscription/getSubscriptionPaymentMethod.js.map +1 -0
- package/dist/data/services/subscription/reactivateSubscription.d.ts +6 -0
- package/dist/data/services/subscription/reactivateSubscription.js +30 -0
- package/dist/data/services/subscription/reactivateSubscription.js.map +1 -0
- package/dist/data/services/subscription/updateSubscriptionPaymentMethod.d.ts +10 -0
- package/dist/data/services/subscription/updateSubscriptionPaymentMethod.js +31 -0
- package/dist/data/services/subscription/updateSubscriptionPaymentMethod.js.map +1 -0
- package/dist/icons/ExternalLinkIcon.d.ts +6 -0
- package/dist/icons/ExternalLinkIcon.js +18 -0
- package/dist/icons/ExternalLinkIcon.js.map +1 -0
- package/dist/icons/index.d.ts +1 -0
- package/dist/icons/index.js +2 -0
- package/dist/icons/index.js.map +1 -0
- package/dist/manageSubscriptionPage/CancelSubscriptionPage.d.ts +3 -0
- package/dist/manageSubscriptionPage/CancelSubscriptionPage.js +53 -0
- package/dist/manageSubscriptionPage/CancelSubscriptionPage.js.map +1 -0
- package/dist/manageSubscriptionPage/CancelSuccessPage.d.ts +3 -0
- package/dist/manageSubscriptionPage/CancelSuccessPage.js +24 -0
- package/dist/manageSubscriptionPage/CancelSuccessPage.js.map +1 -0
- package/dist/manageSubscriptionPage/ManageSubscriptionPage.d.ts +3 -0
- package/dist/manageSubscriptionPage/ManageSubscriptionPage.js +87 -0
- package/dist/manageSubscriptionPage/ManageSubscriptionPage.js.map +1 -0
- package/dist/messages.js +2 -2
- package/dist/messages.js.map +1 -1
- package/dist/routes.d.ts +9 -2
- package/dist/routes.js +26 -6
- package/dist/routes.js.map +1 -1
- package/dist/style.scss +1 -14
- package/dist/styles/components/manageSubscription.scss +454 -0
- package/dist/types.d.ts +57 -201
- package/dist/types.js +3 -0
- package/dist/types.js.map +1 -1
- package/dist/utils/billingDetails.d.ts +3 -20
- package/dist/utils/billingDetails.js +4 -25
- package/dist/utils/billingDetails.js.map +1 -1
- package/dist/utils/edxSession.d.ts +18 -0
- package/dist/utils/edxSession.js +72 -0
- package/dist/utils/edxSession.js.map +1 -0
- package/dist/utils/formatDate.d.ts +16 -0
- package/dist/utils/formatDate.js +69 -0
- package/dist/utils/formatDate.js.map +1 -0
- package/dist/utils/graphqlClient.d.ts +9 -10
- package/dist/utils/graphqlClient.js +22 -11
- package/dist/utils/graphqlClient.js.map +1 -1
- package/dist/utils/invoiceAmount.d.ts +22 -0
- package/dist/utils/invoiceAmount.js +59 -0
- package/dist/utils/invoiceAmount.js.map +1 -0
- package/dist/utils/queries.d.ts +38 -33
- package/dist/utils/queries.js +83 -123
- package/dist/utils/queries.js.map +1 -1
- package/dist/utils/subscriptionView.d.ts +15 -0
- package/dist/utils/subscriptionView.js +50 -0
- package/dist/utils/subscriptionView.js.map +1 -0
- package/dist/utils/urls.d.ts +13 -0
- package/dist/utils/urls.js +52 -0
- package/dist/utils/urls.js.map +1 -0
- package/package.json +7 -2
- package/dist/checkoutPage/CheckoutPage.d.ts +0 -3
- package/dist/checkoutPage/CheckoutPage.js +0 -30
- package/dist/checkoutPage/CheckoutPage.js.map +0 -1
- package/dist/components/BrandMarks/BrandMarks.d.ts +0 -3
- package/dist/components/BrandMarks/BrandMarks.js +0 -9
- package/dist/components/BrandMarks/BrandMarks.js.map +0 -1
- package/dist/components/CartSummary/CartSummary.d.ts +0 -21
- package/dist/components/CartSummary/CartSummary.js +0 -30
- package/dist/components/CartSummary/CartSummary.js.map +0 -1
- package/dist/components/CartSummary/Messages.d.ts +0 -73
- package/dist/components/CartSummary/Messages.js +0 -76
- package/dist/components/CartSummary/Messages.js.map +0 -1
- package/dist/components/Checkout/Checkout.d.ts +0 -4
- package/dist/components/Checkout/Checkout.js +0 -40
- package/dist/components/Checkout/Checkout.js.map +0 -1
- package/dist/components/CheckoutGate/CheckoutGate.d.ts +0 -7
- package/dist/components/CheckoutGate/CheckoutGate.js +0 -35
- package/dist/components/CheckoutGate/CheckoutGate.js.map +0 -1
- package/dist/components/CourseEnrollmentCard/CourseEnrollmentCard.d.ts +0 -9
- package/dist/components/CourseEnrollmentCard/CourseEnrollmentCard.js +0 -31
- package/dist/components/CourseEnrollmentCard/CourseEnrollmentCard.js.map +0 -1
- package/dist/components/CourseEnrollmentCard/Messages.d.ts +0 -33
- package/dist/components/CourseEnrollmentCard/Messages.js +0 -35
- package/dist/components/CourseEnrollmentCard/Messages.js.map +0 -1
- package/dist/components/EdxUnlimitedBanner/EdxUnlimitedBanner.d.ts +0 -13
- package/dist/components/EdxUnlimitedBanner/EdxUnlimitedBanner.js +0 -11
- package/dist/components/EdxUnlimitedBanner/EdxUnlimitedBanner.js.map +0 -1
- package/dist/components/EnrollmentSummary/EnrollmentSummary.d.ts +0 -15
- package/dist/components/EnrollmentSummary/EnrollmentSummary.js +0 -21
- package/dist/components/EnrollmentSummary/EnrollmentSummary.js.map +0 -1
- package/dist/components/EnrollmentSummary/Messages.d.ts +0 -33
- package/dist/components/EnrollmentSummary/Messages.js +0 -35
- package/dist/components/EnrollmentSummary/Messages.js.map +0 -1
- package/dist/components/PaymentFields/PaymentFields.d.ts +0 -9
- package/dist/components/PaymentFields/PaymentFields.js +0 -7
- package/dist/components/PaymentFields/PaymentFields.js.map +0 -1
- package/dist/components/PaymentForm/Messages.d.ts +0 -88
- package/dist/components/PaymentForm/Messages.js +0 -95
- package/dist/components/PaymentForm/Messages.js.map +0 -1
- package/dist/components/PaymentForm/PaymentForm.d.ts +0 -21
- package/dist/components/PaymentForm/PaymentForm.js +0 -69
- package/dist/components/PaymentForm/PaymentForm.js.map +0 -1
- package/dist/components/StatusScreens/Messages.d.ts +0 -103
- package/dist/components/StatusScreens/Messages.js +0 -108
- package/dist/components/StatusScreens/Messages.js.map +0 -1
- package/dist/components/StatusScreens/StatusScreens.d.ts +0 -23
- package/dist/components/StatusScreens/StatusScreens.js +0 -25
- package/dist/components/StatusScreens/StatusScreens.js.map +0 -1
- package/dist/data/hooks/useCheckout.d.ts +0 -57
- package/dist/data/hooks/useCheckout.js +0 -249
- package/dist/data/hooks/useCheckout.js.map +0 -1
- package/dist/data/hooks/useCheckoutGate.d.ts +0 -15
- package/dist/data/hooks/useCheckoutGate.js +0 -39
- package/dist/data/hooks/useCheckoutGate.js.map +0 -1
- package/dist/data/hooks/useCheckoutMutations.d.ts +0 -16
- package/dist/data/hooks/useCheckoutMutations.js +0 -131
- package/dist/data/hooks/useCheckoutMutations.js.map +0 -1
- package/dist/data/hooks/useCheckoutQueries.d.ts +0 -30
- package/dist/data/hooks/useCheckoutQueries.js +0 -97
- package/dist/data/hooks/useCheckoutQueries.js.map +0 -1
- package/dist/styles/components/brandMarks.scss +0 -54
- package/dist/styles/components/cartSummary.scss +0 -18
- package/dist/styles/components/checkout.scss +0 -29
- package/dist/styles/components/checkoutStepper.scss +0 -9
- package/dist/styles/components/courseEnrollmentCard.scss +0 -38
- package/dist/styles/components/edxUnlimitedBanner.scss +0 -138
- package/dist/styles/components/enrollmentSummary.scss +0 -13
- package/dist/styles/components/paymentFields.scss +0 -15
- package/dist/styles/components/paymentForm.scss +0 -105
- package/dist/styles/components/statusScreens.scss +0 -29
- package/dist/styles/components/successScreen.scss +0 -0
- package/dist/utils/auth.d.ts +0 -7
- package/dist/utils/auth.js +0 -28
- package/dist/utils/auth.js.map +0 -1
- package/dist/utils/bootstrapApi.d.ts +0 -20
- package/dist/utils/bootstrapApi.js +0 -142
- package/dist/utils/bootstrapApi.js.map +0 -1
- package/dist/utils/cartApi.d.ts +0 -16
- package/dist/utils/cartApi.js +0 -118
- package/dist/utils/cartApi.js.map +0 -1
- package/dist/utils/checkout.d.ts +0 -6
- package/dist/utils/checkout.js +0 -28
- package/dist/utils/checkout.js.map +0 -1
- package/dist/utils/fetchActiveSubscriptions.d.ts +0 -4
- package/dist/utils/fetchActiveSubscriptions.js +0 -36
- package/dist/utils/fetchActiveSubscriptions.js.map +0 -1
- package/dist/utils/fetchBillingPlans.d.ts +0 -2
- package/dist/utils/fetchBillingPlans.js.map +0 -1
- package/dist/utils/index.d.ts +0 -3
- package/dist/utils/index.js +0 -17
- package/dist/utils/index.js.map +0 -1
- package/dist/utils/provision.d.ts +0 -25
- package/dist/utils/provision.js +0 -95
- package/dist/utils/provision.js.map +0 -1
- package/dist/utils/stripe.d.ts +0 -7
- package/dist/utils/stripe.js +0 -43
- package/dist/utils/stripe.js.map +0 -1
|
@@ -1,138 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
.edx-banner {
|
|
3
|
-
background: #0a1628;
|
|
4
|
-
border-radius: 10px;
|
|
5
|
-
overflow: hidden;
|
|
6
|
-
display: flex;
|
|
7
|
-
align-items: stretch;
|
|
8
|
-
min-height: 120px;
|
|
9
|
-
position: relative;
|
|
10
|
-
|
|
11
|
-
&__content {
|
|
12
|
-
flex: 1 1 0;
|
|
13
|
-
padding: 28px 32px 28px 28px;
|
|
14
|
-
display: flex;
|
|
15
|
-
flex-direction: column;
|
|
16
|
-
justify-content: center;
|
|
17
|
-
gap: 10px;
|
|
18
|
-
z-index: 1;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
&__eyebrow {
|
|
22
|
-
display: flex;
|
|
23
|
-
align-items: center;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
&__headline {
|
|
27
|
-
margin: 0;
|
|
28
|
-
color: #fff;
|
|
29
|
-
font-size: clamp(1.1rem, 2.2vw, 1.55rem);
|
|
30
|
-
font-weight: 700;
|
|
31
|
-
line-height: 1.25;
|
|
32
|
-
letter-spacing: -0.01em;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
&__body {
|
|
36
|
-
margin: 0;
|
|
37
|
-
color: rgba(255, 255, 255, 0.78);
|
|
38
|
-
font-size: clamp(0.78rem, 1.3vw, 0.88rem);
|
|
39
|
-
line-height: 1.55;
|
|
40
|
-
max-width: 540px;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
&__cta-wrapper {
|
|
44
|
-
margin-top: 4px;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
&__cta {
|
|
48
|
-
display: inline-block;
|
|
49
|
-
background: #e2522a;
|
|
50
|
-
color: #fff;
|
|
51
|
-
font-weight: 700;
|
|
52
|
-
font-size: 0.82rem;
|
|
53
|
-
padding: 9px 20px;
|
|
54
|
-
border-radius: 6px;
|
|
55
|
-
text-decoration: none;
|
|
56
|
-
letter-spacing: 0.01em;
|
|
57
|
-
transition: background 0.15s;
|
|
58
|
-
white-space: nowrap;
|
|
59
|
-
|
|
60
|
-
&:hover {
|
|
61
|
-
background: #c94420;
|
|
62
|
-
color: #fff;
|
|
63
|
-
text-decoration: none;
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
&__bullet {
|
|
68
|
-
display: inline-flex;
|
|
69
|
-
align-items: center;
|
|
70
|
-
justify-content: center;
|
|
71
|
-
width: 28px;
|
|
72
|
-
height: 28px;
|
|
73
|
-
border-radius: 50%;
|
|
74
|
-
background: rgba(255, 255, 255, 0.15);
|
|
75
|
-
flex-shrink: 0;
|
|
76
|
-
margin-right: 10px;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
&__badge {
|
|
80
|
-
display: inline-flex;
|
|
81
|
-
align-items: center;
|
|
82
|
-
gap: 0;
|
|
83
|
-
vertical-align: middle;
|
|
84
|
-
position: relative;
|
|
85
|
-
top: -2px;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
&__badge-edx {
|
|
89
|
-
background: #fff;
|
|
90
|
-
border-radius: 4px 0 0 4px;
|
|
91
|
-
padding: 2px 5px 2px 6px;
|
|
92
|
-
font-weight: 800;
|
|
93
|
-
font-size: 0.78em;
|
|
94
|
-
letter-spacing: -0.02em;
|
|
95
|
-
color: #000;
|
|
96
|
-
line-height: 1.15;
|
|
97
|
-
font-style: normal;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
&__badge-unlimited {
|
|
101
|
-
background: #000;
|
|
102
|
-
border-radius: 0 4px 4px 0;
|
|
103
|
-
padding: 2px 6px 2px 4px;
|
|
104
|
-
font-weight: 600;
|
|
105
|
-
font-size: 0.64em;
|
|
106
|
-
letter-spacing: 0.02em;
|
|
107
|
-
color: #c5b8ff;
|
|
108
|
-
line-height: 1.15;
|
|
109
|
-
font-style: normal;
|
|
110
|
-
text-transform: lowercase;
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
&__photo {
|
|
114
|
-
flex-shrink: 0;
|
|
115
|
-
width: clamp(120px, 22%, 240px);
|
|
116
|
-
position: relative;
|
|
117
|
-
overflow: hidden;
|
|
118
|
-
|
|
119
|
-
img {
|
|
120
|
-
position: absolute;
|
|
121
|
-
inset: 0;
|
|
122
|
-
width: 100%;
|
|
123
|
-
height: 100%;
|
|
124
|
-
object-fit: cover;
|
|
125
|
-
object-position: center top;
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
&__placeholder {
|
|
131
|
-
flex-shrink: 0;
|
|
132
|
-
width: clamp(100px, 20%, 200px);
|
|
133
|
-
background: rgba(255, 255, 255, 0.06);
|
|
134
|
-
display: flex;
|
|
135
|
-
align-items: center;
|
|
136
|
-
justify-content: center;
|
|
137
|
-
}
|
|
138
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
.enrolled__banner {
|
|
2
|
-
div:first-child {
|
|
3
|
-
border-top-left-radius: var(--pgn-size-border-radius-base);
|
|
4
|
-
border-top-right-radius: var(--pgn-size-border-radius-base);
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
div:last-child {
|
|
8
|
-
border: 1px solid var(--pgn-color-light-400);
|
|
9
|
-
border-top: 0;
|
|
10
|
-
border-bottom-left-radius: var(--pgn-size-border-radius-base);
|
|
11
|
-
border-bottom-right-radius: var(--pgn-size-border-radius-base);
|
|
12
|
-
}
|
|
13
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
.payment--field {
|
|
2
|
-
.card__expiry,
|
|
3
|
-
.card__cvc {
|
|
4
|
-
width: 10.75rem;
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
.form-control {
|
|
8
|
-
border-radius: 5px;
|
|
9
|
-
border: 1px solid #E6E6E6;
|
|
10
|
-
background: #FFF;
|
|
11
|
-
|
|
12
|
-
/* default/box-shadow-default */
|
|
13
|
-
box-shadow: 0 3px 6px 0 rgba(0, 0, 0, 0.02), 0 1px 1px 0 rgba(0, 0, 0, 0.03);
|
|
14
|
-
}
|
|
15
|
-
}
|
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
// styles/components/paymentForm.scss
|
|
2
|
-
|
|
3
|
-
.payment-form {
|
|
4
|
-
&__heading {
|
|
5
|
-
font-size: 1.1rem;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
&__help {
|
|
9
|
-
a {
|
|
10
|
-
text-decoration: underline;
|
|
11
|
-
text-underline-offset: 0.2rem;
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
// ── Payment method accordion ─────────────────────────────────────────────
|
|
16
|
-
|
|
17
|
-
&__method {
|
|
18
|
-
border-radius: 8px;
|
|
19
|
-
border: 1px solid #E7E9EF;
|
|
20
|
-
background: #FFF;
|
|
21
|
-
overflow: hidden;
|
|
22
|
-
background: #F6F8FA;
|
|
23
|
-
&--selected {
|
|
24
|
-
background-color: white;
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
// Header row: radio + icon(s) + name — full-width clickable label
|
|
29
|
-
&__method-header {
|
|
30
|
-
display: flex;
|
|
31
|
-
align-items: center;
|
|
32
|
-
gap: 0.6rem;
|
|
33
|
-
padding: 0.9rem 1rem;
|
|
34
|
-
margin: 0;
|
|
35
|
-
cursor: pointer;
|
|
36
|
-
width: 100%;
|
|
37
|
-
font-weight: 600;
|
|
38
|
-
font-size: 0.95rem;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
&__radio {
|
|
42
|
-
flex-shrink: 0;
|
|
43
|
-
width: 1.1rem;
|
|
44
|
-
height: 1.1rem;
|
|
45
|
-
accent-color: #000000;
|
|
46
|
-
cursor: pointer;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
&__method-name {
|
|
50
|
-
flex: 1;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
// Expanded card panel — no extra heading, just fields
|
|
54
|
-
&__card-panel {
|
|
55
|
-
padding: 0 1rem 1rem;
|
|
56
|
-
background: #fff;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
// Icon badges for Google Pay / PayPal
|
|
60
|
-
&__method-icon {
|
|
61
|
-
display: inline-flex;
|
|
62
|
-
align-items: center;
|
|
63
|
-
justify-content: center;
|
|
64
|
-
width: 1.5rem;
|
|
65
|
-
height: 1.5rem;
|
|
66
|
-
border-radius: 4px;
|
|
67
|
-
color: #fff;
|
|
68
|
-
font-weight: 800;
|
|
69
|
-
font-size: 0.7rem;
|
|
70
|
-
flex-shrink: 0;
|
|
71
|
-
|
|
72
|
-
&--gpay {
|
|
73
|
-
background: #4285f4;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
&--paypal {
|
|
77
|
-
background: #003087;
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
.payment__field--country {
|
|
82
|
-
select {
|
|
83
|
-
border-radius: 5px;
|
|
84
|
-
border: 1px solid #E6E6E6;
|
|
85
|
-
box-shadow: 0 3px 6px 0 rgba(0, 0, 0, 0.02), 0 1px 1px 0 rgba(0, 0, 0, 0.03);
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
// ── Submit button ────────────────────────────────────────────────────────
|
|
90
|
-
&__submit {
|
|
91
|
-
border-radius: 2rem;
|
|
92
|
-
font-weight: 700;
|
|
93
|
-
padding: 0.75rem 1.5rem;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
&__terms {
|
|
97
|
-
line-height: 1.6;
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
@media (--pgn-size-breakpoint-min-width-lg) {
|
|
102
|
-
.payment-form {
|
|
103
|
-
padding: 32px;
|
|
104
|
-
}
|
|
105
|
-
}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
// styles/components/successScreen.scss
|
|
2
|
-
|
|
3
|
-
.success-screen {
|
|
4
|
-
&__headline {
|
|
5
|
-
font-size: clamp(1.6rem, 3vw, 2.2rem);
|
|
6
|
-
color: #1a3a2a; // dark green as in design
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
&__ctas {
|
|
10
|
-
flex-wrap: wrap;
|
|
11
|
-
gap: 0.75rem;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
&__cta-primary {
|
|
15
|
-
border-radius: 2rem;
|
|
16
|
-
font-weight: 700;
|
|
17
|
-
padding: 0.65rem 1.5rem;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
&__benefits {
|
|
21
|
-
list-style: disc;
|
|
22
|
-
padding-left: 1.25rem;
|
|
23
|
-
|
|
24
|
-
li {
|
|
25
|
-
color: var(--gray-700, #495057);
|
|
26
|
-
line-height: 1.6;
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
}
|
|
File without changes
|
package/dist/utils/auth.d.ts
DELETED
package/dist/utils/auth.js
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* api/index.ts — composes the pieces into a single checkout client and
|
|
3
|
-
* re-exports the API utilities.
|
|
4
|
-
*/
|
|
5
|
-
import { createGqlClient } from './graphqlClient';
|
|
6
|
-
import * as cart from './cartApi';
|
|
7
|
-
import * as bootstrap from './bootstrapApi';
|
|
8
|
-
export function createCheckoutClient({ apiUrl }) {
|
|
9
|
-
const { gql, setToken } = createGqlClient({ apiUrl });
|
|
10
|
-
const fetchStatus = (biId) => cart.getCartStatus(gql, biId);
|
|
11
|
-
return {
|
|
12
|
-
gql,
|
|
13
|
-
setToken,
|
|
14
|
-
createCart: (vars) => cart.createCart(gql, vars),
|
|
15
|
-
getCartItem: (biId) => cart.getCartItem(gql, biId),
|
|
16
|
-
updateCartItem: (args) => cart.updateCartItem(gql, args),
|
|
17
|
-
updateCartConsent: (args) => cart.updateCartConsent(gql, args),
|
|
18
|
-
placeOrder: (cartUid) => cart.placeOrder(gql, cartUid),
|
|
19
|
-
getCartStatus: fetchStatus,
|
|
20
|
-
findSubscriptionBiId: (biId) => cart.findSubscriptionBiId(gql, biId),
|
|
21
|
-
getSalableUid: (maId) => bootstrap.getSalableUid(gql, maId),
|
|
22
|
-
getBillingPlans: () => bootstrap.getBillingPlans(gql),
|
|
23
|
-
getActiveSubscriptions: () => bootstrap.getActiveSubscriptions(gql),
|
|
24
|
-
isCurrentUserSubscriber: () => bootstrap.isCurrentUserSubscriber(gql),
|
|
25
|
-
getCourseDetail: (courseKey) => bootstrap.getCourseDetail(gql, courseKey),
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
//# sourceMappingURL=auth.js.map
|
package/dist/utils/auth.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../../src/utils/auth.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,KAAK,IAAI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AE,GAAG,EAAE,CAAC,SAAS,CAAC,uBAAuB,CAAC,GAAG,CAAC;QACrE,eAAe,EAAE,CAAC,SAAS,EAAE,EAAE,CAAC,SAAS,CAAC,eAAe,CAAC,GAAG,EAAE,SAAS,CAAC;KAC1E,CAAC;AACJ,CAAC","sourcesContent":["/**\n * api/index.ts — composes the pieces into a single checkout client and\n * re-exports the API utilities.\n */\nimport { createGqlClient } from './graphqlClient';\nimport * as cart from './cartApi';\nimport * as bootstrap from './bootstrapApi';\nimport type {\n CheckoutClient, CartIds, UpdateCartItemArgs, UpdateCartConsentArgs,\n} from '../types';\n\ninterface CheckoutClientConfig {\n apiUrl: string,\n confirmIntentUrl?: string,\n}\n\nexport function createCheckoutClient(\n { apiUrl }: CheckoutClientConfig,\n): CheckoutClient {\n const { gql, setToken } = createGqlClient({ apiUrl });\n const fetchStatus = (biId: string) => cart.getCartStatus(gql, biId);\n\n return {\n gql,\n setToken,\n createCart: (vars: CartIds) => cart.createCart(gql, vars),\n getCartItem: (biId) => cart.getCartItem(gql, biId),\n updateCartItem: (args: UpdateCartItemArgs) => cart.updateCartItem(gql, args),\n updateCartConsent: (args: UpdateCartConsentArgs) => cart.updateCartConsent(gql, args),\n placeOrder: (cartUid) => cart.placeOrder(gql, cartUid),\n getCartStatus: fetchStatus,\n findSubscriptionBiId: (biId) => cart.findSubscriptionBiId(gql, biId),\n getSalableUid: (maId) => bootstrap.getSalableUid(gql, maId),\n getBillingPlans: () => bootstrap.getBillingPlans(gql),\n getActiveSubscriptions: () => bootstrap.getActiveSubscriptions(gql),\n isCurrentUserSubscriber: () => bootstrap.isCurrentUserSubscriber(gql),\n getCourseDetail: (courseKey) => bootstrap.getCourseDetail(gql, courseKey),\n };\n}\n"]}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import type { GqlRunner, BillingPlansResult, ProductInfo, CurrentUserSubscriberResult, CourseDetail } from '../types';
|
|
2
|
-
/** Resolve the viax customer uid for the authenticated user by email. */
|
|
3
|
-
export declare function getCustomerUid(gql: GqlRunner, userEmail: string): Promise<string>;
|
|
4
|
-
/**
|
|
5
|
-
* Fetch the TwouSubscriptionPlan uid to use as biiSalable in createTwouCart.
|
|
6
|
-
* The maId is the product market-area identifier, e.g. "TWOU-SUB-PLAN-001".
|
|
7
|
-
* The returned `uid` is passed as biiSalable when creating the cart.
|
|
8
|
-
*/
|
|
9
|
-
export declare function getSalableUid(gql: GqlRunner, maId: string): Promise<ProductInfo>;
|
|
10
|
-
/** Fetch all available customer billing plans. */
|
|
11
|
-
export declare function getBillingPlans(gql: GqlRunner): Promise<BillingPlansResult>;
|
|
12
|
-
/** Check whether the currently authenticated user already has an active subscription. */
|
|
13
|
-
export declare function isCurrentUserSubscriber(gql: GqlRunner): Promise<CurrentUserSubscriberResult | null>;
|
|
14
|
-
/** Fetch the number of active subscriptions. */
|
|
15
|
-
export declare function getActiveSubscriptions(gql: GqlRunner): Promise<{
|
|
16
|
-
active: number;
|
|
17
|
-
}>;
|
|
18
|
-
/** Fetch course details for the enrollment card by tCourseKey.
|
|
19
|
-
* Sends the course key to Viax exactly as provided (e.g. HarvardX+CS50+X). */
|
|
20
|
-
export declare function getCourseDetail(gql: GqlRunner, courseKey: string): Promise<CourseDetail | null>;
|
|
@@ -1,142 +0,0 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
/**
|
|
11
|
-
* api/bootstrapApi.ts — fetch the runtime ids needed to create a cart.
|
|
12
|
-
*
|
|
13
|
-
* customerUid — looked up by the user's email from their viax party record.
|
|
14
|
-
* salableUid — the product uid from getProduct(maId), used as biiSalable.
|
|
15
|
-
* billingPlanUid — selected from filterCustomerBillingPlan by the caller.
|
|
16
|
-
*/
|
|
17
|
-
import { GET_CUSTOMER, GET_BILLING_PLANS, GET_PRODUCT, GET_ACTIVE_SUBSCRIPTIONS_STATE, GET_IS_CURRENT_USER_SUBSCRIBER, GET_COURSE_DETAIL } from './queries';
|
|
18
|
-
/** Resolve the viax customer uid for the authenticated user by email. */
|
|
19
|
-
export function getCustomerUid(gql, userEmail) {
|
|
20
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
21
|
-
var _a, _b, _c;
|
|
22
|
-
const filter = `parParty.paContacts.email = '${userEmail}'`;
|
|
23
|
-
const data = yield gql(GET_CUSTOMER, { filter });
|
|
24
|
-
const node = (_c = (_b = (_a = data === null || data === void 0 ? void 0 : data.filterTwouCustomer) === null || _a === void 0 ? void 0 : _a.edges) === null || _b === void 0 ? void 0 : _b[0]) === null || _c === void 0 ? void 0 : _c.node;
|
|
25
|
-
if (!(node === null || node === void 0 ? void 0 : node.uid))
|
|
26
|
-
throw new Error(`No viax customer found for ${userEmail}. Ensure your account is linked.`);
|
|
27
|
-
return node.uid;
|
|
28
|
-
});
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* Fetch the TwouSubscriptionPlan uid to use as biiSalable in createTwouCart.
|
|
32
|
-
* The maId is the product market-area identifier, e.g. "TWOU-SUB-PLAN-001".
|
|
33
|
-
* The returned `uid` is passed as biiSalable when creating the cart.
|
|
34
|
-
*/
|
|
35
|
-
export function getSalableUid(gql, maId) {
|
|
36
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
37
|
-
var _a, _b;
|
|
38
|
-
const data = yield gql(GET_PRODUCT, { maId });
|
|
39
|
-
const product = data === null || data === void 0 ? void 0 : data.getProduct;
|
|
40
|
-
if (!(product === null || product === void 0 ? void 0 : product.uid))
|
|
41
|
-
throw new Error(`Product "${maId}" not found.`);
|
|
42
|
-
return {
|
|
43
|
-
uid: product.uid,
|
|
44
|
-
maName: (_a = product.maName) !== null && _a !== void 0 ? _a : '',
|
|
45
|
-
ownershipModels: ((_b = product.saOwnershipModels) !== null && _b !== void 0 ? _b : []).map((m) => ({ uid: m.uid, omName: m.omName })),
|
|
46
|
-
};
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
/** Fetch all available customer billing plans. */
|
|
50
|
-
export function getBillingPlans(gql) {
|
|
51
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
52
|
-
var _a, _b;
|
|
53
|
-
const data = yield gql(GET_BILLING_PLANS);
|
|
54
|
-
const edges = (_b = (_a = data === null || data === void 0 ? void 0 : data.filterCustomerBillingPlan) === null || _a === void 0 ? void 0 : _a.edges) !== null && _b !== void 0 ? _b : [];
|
|
55
|
-
if (!edges.length)
|
|
56
|
-
throw new Error('No billing plans found.');
|
|
57
|
-
const plans = edges.map(({ node }) => {
|
|
58
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
59
|
-
return ({
|
|
60
|
-
uid: node.uid,
|
|
61
|
-
stripePriceId: node.tStripePriceId,
|
|
62
|
-
amount: (_b = (_a = node.tStripeAmount) === null || _a === void 0 ? void 0 : _a.amount) !== null && _b !== void 0 ? _b : '0',
|
|
63
|
-
currency: (_e = (_d = (_c = node.tStripeAmount) === null || _c === void 0 ? void 0 : _c.units) === null || _d === void 0 ? void 0 : _d.code) !== null && _e !== void 0 ? _e : 'USD',
|
|
64
|
-
isTemplate: node.bipIsTemplate,
|
|
65
|
-
ownershipModel: {
|
|
66
|
-
uid: (_g = (_f = node.bipOwnershipModel) === null || _f === void 0 ? void 0 : _f.uid) !== null && _g !== void 0 ? _g : '',
|
|
67
|
-
omName: (_j = (_h = node.bipOwnershipModel) === null || _h === void 0 ? void 0 : _h.omName) !== null && _j !== void 0 ? _j : '',
|
|
68
|
-
},
|
|
69
|
-
});
|
|
70
|
-
});
|
|
71
|
-
return { plans };
|
|
72
|
-
});
|
|
73
|
-
}
|
|
74
|
-
/** Check whether the currently authenticated user already has an active subscription. */
|
|
75
|
-
export function isCurrentUserSubscriber(gql) {
|
|
76
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
77
|
-
var _a, _b, _c, _d;
|
|
78
|
-
const data = yield gql(GET_IS_CURRENT_USER_SUBSCRIBER);
|
|
79
|
-
const result = data === null || data === void 0 ? void 0 : data.tIsCurrentUserSubscriber;
|
|
80
|
-
if (!result)
|
|
81
|
-
return null;
|
|
82
|
-
return {
|
|
83
|
-
isSubscriber: result.isSubscriber === true,
|
|
84
|
-
subscriptionBiId: (_a = result.subscriptionBiId) !== null && _a !== void 0 ? _a : null,
|
|
85
|
-
status: (_b = result.status) !== null && _b !== void 0 ? _b : null,
|
|
86
|
-
subscriptionStartDate: (_c = result.subscriptionStartDate) !== null && _c !== void 0 ? _c : null,
|
|
87
|
-
currentPeriodEnd: (_d = result.currentPeriodEnd) !== null && _d !== void 0 ? _d : null,
|
|
88
|
-
};
|
|
89
|
-
});
|
|
90
|
-
}
|
|
91
|
-
/** Fetch the number of active subscriptions. */
|
|
92
|
-
export function getActiveSubscriptions(gql) {
|
|
93
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
94
|
-
var _a;
|
|
95
|
-
const data = yield gql(GET_ACTIVE_SUBSCRIPTIONS_STATE);
|
|
96
|
-
const active = (_a = data === null || data === void 0 ? void 0 : data.tActiveSubscriptionsState) === null || _a === void 0 ? void 0 : _a.active;
|
|
97
|
-
if (typeof active !== 'number') {
|
|
98
|
-
throw new Error('Unexpected response shape for tActiveSubscriptionsState');
|
|
99
|
-
}
|
|
100
|
-
return { active };
|
|
101
|
-
});
|
|
102
|
-
}
|
|
103
|
-
/** Fetch course details for the enrollment card by tCourseKey.
|
|
104
|
-
* Sends the course key to Viax exactly as provided (e.g. HarvardX+CS50+X). */
|
|
105
|
-
export function getCourseDetail(gql, courseKey) {
|
|
106
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
107
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1;
|
|
108
|
-
const key = courseKey.trim();
|
|
109
|
-
if (!key)
|
|
110
|
-
return null;
|
|
111
|
-
// Escape single quotes for the filter string only — do not alter `+` or other chars.
|
|
112
|
-
const filter = `tCourseKey = '${key.replace(/'/g, "''")}'`;
|
|
113
|
-
const data = yield gql(GET_COURSE_DETAIL, { filter });
|
|
114
|
-
const node = (_c = (_b = (_a = data === null || data === void 0 ? void 0 : data.filterTwouCourse) === null || _a === void 0 ? void 0 : _a.edges) === null || _b === void 0 ? void 0 : _b[0]) === null || _c === void 0 ? void 0 : _c.node;
|
|
115
|
-
if (!(node === null || node === void 0 ? void 0 : node.maId))
|
|
116
|
-
return null;
|
|
117
|
-
return {
|
|
118
|
-
maId: node.maId,
|
|
119
|
-
maName: (_d = node.maName) !== null && _d !== void 0 ? _d : '',
|
|
120
|
-
maDescription: (_e = node.maDescription) !== null && _e !== void 0 ? _e : null,
|
|
121
|
-
tShortDescription: (_f = node.tShortDescription) !== null && _f !== void 0 ? _f : null,
|
|
122
|
-
imageUrl: (_g = node.imageUrl) !== null && _g !== void 0 ? _g : null,
|
|
123
|
-
tCourseKey: (_h = node.tCourseKey) !== null && _h !== void 0 ? _h : null,
|
|
124
|
-
tBrandText: (_j = node.tBrandText) !== null && _j !== void 0 ? _j : null,
|
|
125
|
-
tPrimarySubjectArea: (_k = node.tPrimarySubjectArea) !== null && _k !== void 0 ? _k : null,
|
|
126
|
-
tLevelType: (_l = node.tLevelType) !== null && _l !== void 0 ? _l : null,
|
|
127
|
-
tLanguage: (_m = node.tLanguage) !== null && _m !== void 0 ? _m : null,
|
|
128
|
-
tPacingType: (_p = (_o = node.tPacingType) === null || _o === void 0 ? void 0 : _o.code) !== null && _p !== void 0 ? _p : null,
|
|
129
|
-
tDurationLow: (_q = node.tDurationLow) !== null && _q !== void 0 ? _q : null,
|
|
130
|
-
tDurationHigh: (_r = node.tDurationHigh) !== null && _r !== void 0 ? _r : null,
|
|
131
|
-
tDurationUnit: (_t = (_s = node.tDurationUnit) === null || _s === void 0 ? void 0 : _s.code) !== null && _t !== void 0 ? _t : null,
|
|
132
|
-
tEffortLow: (_u = node.tEffortLow) !== null && _u !== void 0 ? _u : null,
|
|
133
|
-
tEffortHigh: (_v = node.tEffortHigh) !== null && _v !== void 0 ? _v : null,
|
|
134
|
-
tEffortUnit: (_x = (_w = node.tEffortUnit) === null || _w === void 0 ? void 0 : _w.code) !== null && _x !== void 0 ? _x : null,
|
|
135
|
-
tUrlCourse: (_y = node.tUrlCourse) !== null && _y !== void 0 ? _y : null,
|
|
136
|
-
tB2cSubscriptionInclusion: (_z = node.tB2cSubscriptionInclusion) !== null && _z !== void 0 ? _z : null,
|
|
137
|
-
tHasOfacRestrictions: (_0 = node.tHasOfacRestrictions) !== null && _0 !== void 0 ? _0 : null,
|
|
138
|
-
tCatalogActive: (_1 = node.tCatalogActive) !== null && _1 !== void 0 ? _1 : null,
|
|
139
|
-
};
|
|
140
|
-
});
|
|
141
|
-
}
|
|
142
|
-
//# sourceMappingURL=bootstrapApi.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"bootstrapApi.js","sourceRoot":"","sources":["../../src/utils/bootstrapApi.ts"],"names":[],"mappings":";;;;;;;;;AAAA;;;;;;GAMG;AACH,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,WAAW,EAAE,8BAA8B,EAAE,8BAA8B,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAG5J,yEAAyE;AACzE,MAAM,UAAgB,cAAc,CAAC,GAAc,EAAE,SAAiB;;;QACpE,MAAM,MAAM,GAAG,gCAAgC,SAAS,GAAG,CAAC;QAC5D,MAAM,IAAI,GAAG,MAAM,GAAG,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**\n * api/bootstrapApi.ts — fetch the runtime ids needed to create a cart.\n *\n * customerUid — looked up by the user's email from their viax party record.\n * salableUid — the product uid from getProduct(maId), used as biiSalable.\n * billingPlanUid — selected from filterCustomerBillingPlan by the caller.\n */\nimport { GET_CUSTOMER, GET_BILLING_PLANS, GET_PRODUCT, GET_ACTIVE_SUBSCRIPTIONS_STATE, GET_IS_CURRENT_USER_SUBSCRIBER, GET_COURSE_DETAIL } from './queries';\nimport type { GqlRunner, BillingPlansResult, BillingPlan, TwouCustomer, ProductInfo, CurrentUserSubscriberResult, CourseDetail } from '../types';\n\n/** Resolve the viax customer uid for the authenticated user by email. */\nexport async function getCustomerUid(gql: GqlRunner, userEmail: string): Promise<string> {\n const filter = `parParty.paContacts.email = '${userEmail}'`;\n const data = await gql(GET_CUSTOMER, { filter });\n const node: TwouCustomer | undefined = data?.filterTwouCustomer?.edges?.[0]?.node;\n if (!node?.uid) throw new Error(`No viax customer found for ${userEmail}. Ensure your account is linked.`);\n return node.uid;\n}\n\n/**\n * Fetch the TwouSubscriptionPlan uid to use as biiSalable in createTwouCart.\n * The maId is the product market-area identifier, e.g. \"TWOU-SUB-PLAN-001\".\n * The returned `uid` is passed as biiSalable when creating the cart.\n */\nexport async function getSalableUid(gql: GqlRunner, maId: string): Promise<ProductInfo> {\n const data = await gql(GET_PRODUCT, { maId });\n const product = data?.getProduct;\n if (!product?.uid) throw new Error(`Product \"${maId}\" not found.`);\n return {\n uid: product.uid,\n maName: product.maName ?? '',\n ownershipModels: (product.saOwnershipModels ?? []).map(\n (m: { uid: string, omName: string }) => ({ uid: m.uid, omName: m.omName }),\n ),\n };\n}\n\n/** Fetch all available customer billing plans. */\nexport async function getBillingPlans(gql: GqlRunner): Promise<BillingPlansResult> {\n const data = await gql(GET_BILLING_PLANS);\n const edges: {\n node: {\n uid: string,\n tStripePriceId: string,\n tStripeAmount?: { amount: string, units?: { code: string } },\n bipIsTemplate: boolean,\n bipOwnershipModel?: { uid: string, omName: string },\n },\n }[] = data?.filterCustomerBillingPlan?.edges ?? [];\n\n if (!edges.length) throw new Error('No billing plans found.');\n\n const plans: BillingPlan[] = edges.map(({ node }) => ({\n uid: node.uid,\n stripePriceId: node.tStripePriceId,\n amount: node.tStripeAmount?.amount ?? '0',\n currency: node.tStripeAmount?.units?.code ?? 'USD',\n isTemplate: node.bipIsTemplate,\n ownershipModel: {\n uid: node.bipOwnershipModel?.uid ?? '',\n omName: node.bipOwnershipModel?.omName ?? '',\n },\n }));\n\n return { plans };\n}\n\n/** Check whether the currently authenticated user already has an active subscription. */\nexport async function isCurrentUserSubscriber(gql: GqlRunner): Promise<CurrentUserSubscriberResult | null> {\n const data = await gql(GET_IS_CURRENT_USER_SUBSCRIBER);\n const result = data?.tIsCurrentUserSubscriber;\n if (!result) return null;\n return {\n isSubscriber: result.isSubscriber === true,\n subscriptionBiId: result.subscriptionBiId ?? null,\n status: result.status ?? null,\n subscriptionStartDate: result.subscriptionStartDate ?? null,\n currentPeriodEnd: result.currentPeriodEnd ?? null,\n };\n}\n\n/** Fetch the number of active subscriptions. */\nexport async function getActiveSubscriptions(gql: GqlRunner): Promise<{ active: number }> {\n const data = await gql(GET_ACTIVE_SUBSCRIPTIONS_STATE);\n const active = data?.tActiveSubscriptionsState?.active;\n if (typeof active !== 'number') {\n throw new Error('Unexpected response shape for tActiveSubscriptionsState');\n }\n return { active };\n}\n\n/** Fetch course details for the enrollment card by tCourseKey.\n * Sends the course key to Viax exactly as provided (e.g. HarvardX+CS50+X). */\nexport async function getCourseDetail(gql: GqlRunner, courseKey: string): Promise<CourseDetail | null> {\n const key = courseKey.trim();\n if (!key) return null;\n\n // Escape single quotes for the filter string only — do not alter `+` or other chars.\n const filter = `tCourseKey = '${key.replace(/'/g, \"''\")}'`;\n const data = await gql(GET_COURSE_DETAIL, { filter });\n const node = data?.filterTwouCourse?.edges?.[0]?.node;\n if (!node?.maId) return null;\n\n return {\n maId: node.maId,\n maName: node.maName ?? '',\n maDescription: node.maDescription ?? null,\n tShortDescription: node.tShortDescription ?? null,\n imageUrl: node.imageUrl ?? null,\n tCourseKey: node.tCourseKey ?? null,\n tBrandText: node.tBrandText ?? null,\n tPrimarySubjectArea: node.tPrimarySubjectArea ?? null,\n tLevelType: node.tLevelType ?? null,\n tLanguage: node.tLanguage ?? null,\n tPacingType: node.tPacingType?.code ?? null,\n tDurationLow: node.tDurationLow ?? null,\n tDurationHigh: node.tDurationHigh ?? null,\n tDurationUnit: node.tDurationUnit?.code ?? null,\n tEffortLow: node.tEffortLow ?? null,\n tEffortHigh: node.tEffortHigh ?? null,\n tEffortUnit: node.tEffortUnit?.code ?? null,\n tUrlCourse: node.tUrlCourse ?? null,\n tB2cSubscriptionInclusion: node.tB2cSubscriptionInclusion ?? null,\n tHasOfacRestrictions: node.tHasOfacRestrictions ?? null,\n tCatalogActive: node.tCatalogActive ?? null,\n };\n}\n"]}
|
package/dist/utils/cartApi.d.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import type { GqlRunner, Cart, CartIds, CartStatusResult, UpdateCartItemArgs, UpdateCartConsentArgs, SubscriptionDetails } from '../types';
|
|
2
|
-
/** createTwouCart → { biId, uid } */
|
|
3
|
-
export declare function createCart(gql: GqlRunner, { customerUid, salableUid, billingPlanUid }: CartIds): Promise<Cart>;
|
|
4
|
-
/** → { cartUid, cartItemUid } */
|
|
5
|
-
export declare function getCartItem(gql: GqlRunner, biId: string): Promise<{
|
|
6
|
-
cartUid: string;
|
|
7
|
-
cartItemUid: string;
|
|
8
|
-
}>;
|
|
9
|
-
export declare function updateCartItem(gql: GqlRunner, { cartItemUid, billingAddress, paymentMethodId }: UpdateCartItemArgs): Promise<void>;
|
|
10
|
-
/** Persist checkout consent checkboxes onto the TwouCart BI. */
|
|
11
|
-
export declare function updateCartConsent(gql: GqlRunner, { cartUid, consent }: UpdateCartConsentArgs): Promise<void>;
|
|
12
|
-
/** "Place order" — triggers the server-side workflow. */
|
|
13
|
-
export declare function placeOrder(gql: GqlRunner, cartUid: string): Promise<unknown>;
|
|
14
|
-
/** → { status, stripeSubscriptionId, lastComment } */
|
|
15
|
-
export declare function getCartStatus(gql: GqlRunner, biId: string): Promise<CartStatusResult>;
|
|
16
|
-
export declare function findSubscriptionBiId(gql: GqlRunner, cartBiId: string): Promise<SubscriptionDetails | null>;
|