@edx/frontend-app-subscription-checkout 1.2.0 → 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 +6 -3
- package/dist/app.js.map +1 -1
- package/dist/checkoutPage/CheckoutPage.js +2 -1
- package/dist/checkoutPage/CheckoutPage.js.map +1 -1
- package/dist/components/CartSummary/CartSummary.d.ts +12 -2
- package/dist/components/CartSummary/CartSummary.js +17 -17
- package/dist/components/CartSummary/CartSummary.js.map +1 -1
- package/dist/components/CartSummary/Messages.d.ts +10 -0
- package/dist/components/CartSummary/Messages.js +12 -2
- package/dist/components/CartSummary/Messages.js.map +1 -1
- package/dist/components/Checkout/Checkout.d.ts +10 -2
- package/dist/components/Checkout/Checkout.js +43 -5
- package/dist/components/Checkout/Checkout.js.map +1 -1
- package/dist/components/CheckoutGate/CheckoutGate.d.ts +4 -2
- package/dist/components/CheckoutGate/CheckoutGate.js +5 -4
- package/dist/components/CheckoutGate/CheckoutGate.js.map +1 -1
- package/dist/components/CountryUnavailableModal/CountryUnavailableModal.d.ts +9 -0
- package/dist/components/CountryUnavailableModal/CountryUnavailableModal.js +10 -0
- package/dist/components/CountryUnavailableModal/CountryUnavailableModal.js.map +1 -0
- package/dist/components/CountryUnavailableModal/Messages.d.ts +18 -0
- package/dist/components/CountryUnavailableModal/Messages.js +20 -0
- package/dist/components/CountryUnavailableModal/Messages.js.map +1 -0
- package/dist/components/EnrollmentSummary/EnrollmentSummary.d.ts +3 -2
- package/dist/components/EnrollmentSummary/EnrollmentSummary.js +5 -3
- package/dist/components/EnrollmentSummary/EnrollmentSummary.js.map +1 -1
- package/dist/components/EnrollmentSummary/Messages.js +2 -2
- package/dist/components/EnrollmentSummary/Messages.js.map +1 -1
- package/dist/components/PaymentForm/PaymentForm.js +3 -3
- package/dist/components/PaymentForm/PaymentForm.js.map +1 -1
- package/dist/constants.d.ts +2 -1
- package/dist/constants.js +201 -196
- package/dist/constants.js.map +1 -1
- package/dist/data/hooks/useCheckout.js +5 -0
- package/dist/data/hooks/useCheckout.js.map +1 -1
- package/dist/data/hooks/useCheckoutMutations.d.ts +3 -1
- package/dist/data/hooks/useCheckoutMutations.js +7 -4
- package/dist/data/hooks/useCheckoutMutations.js.map +1 -1
- package/dist/routes.js +1 -1
- package/dist/routes.js.map +1 -1
- package/dist/styles/components/cartSummary.scss +4 -0
- package/dist/styles/components/paymentForm.scss +4 -0
- package/dist/utils/billingDetails.d.ts +1 -1
- package/dist/utils/billingDetails.js +6 -5
- package/dist/utils/billingDetails.js.map +1 -1
- package/dist/utils/cartApi.js +11 -9
- package/dist/utils/cartApi.js.map +1 -1
- package/dist/utils/provision.js +2 -2
- package/dist/utils/provision.js.map +1 -1
- package/dist/utils/queries.d.ts +1 -1
- package/dist/utils/queries.js +0 -2
- package/dist/utils/queries.js.map +1 -1
- package/package.json +2 -2
package/dist/constants.js
CHANGED
|
@@ -49,7 +49,8 @@ export const DEFAULTS = {
|
|
|
49
49
|
confirmIntentUrl: '/api/stripe/confirm-pi',
|
|
50
50
|
customerUid: '019d2bde-f769-743d-88f9-8bf0d1a7a002',
|
|
51
51
|
salableUid: '019d2ce7-05bc-7dd6-b141-e32df9ac86c1',
|
|
52
|
-
|
|
52
|
+
// Monthly Subscription template uid (not Annual)
|
|
53
|
+
billingPlanUid: '019d2ce7-05bf-733c-ba56-0fcafafeb69b',
|
|
53
54
|
};
|
|
54
55
|
export const LS_KEYS = { biId: 'twou.cartBiId', uid: 'twou.cartUid' };
|
|
55
56
|
// ─── Checkout gate feature flags (dev controls) ───────────────────────────────
|
|
@@ -68,202 +69,206 @@ export const ALLOWED_CHECKOUT_COUNTRIES = ['US', 'CA'];
|
|
|
68
69
|
* Add or remove codes here to control which residents see the second checkbox.
|
|
69
70
|
*/
|
|
70
71
|
export const COUNTRIES_REQUIRING_EXTRA_CONFIRM = ['GB', 'CA'];
|
|
71
|
-
export const COUNTRIES = [
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
72
|
+
// export const COUNTRIES: readonly (readonly [string, string])[] = [
|
|
73
|
+
// ['AF', 'Afghanistan'],
|
|
74
|
+
// ['AL', 'Albania'],
|
|
75
|
+
// ['DZ', 'Algeria'],
|
|
76
|
+
// ['AD', 'Andorra'],
|
|
77
|
+
// ['AO', 'Angola'],
|
|
78
|
+
// ['AG', 'Antigua and Barbuda'],
|
|
79
|
+
// ['AR', 'Argentina'],
|
|
80
|
+
// ['AM', 'Armenia'],
|
|
81
|
+
// ['AU', 'Australia'],
|
|
82
|
+
// ['AT', 'Austria'],
|
|
83
|
+
// ['AZ', 'Azerbaijan'],
|
|
84
|
+
// ['BS', 'Bahamas'],
|
|
85
|
+
// ['BH', 'Bahrain'],
|
|
86
|
+
// ['BD', 'Bangladesh'],
|
|
87
|
+
// ['BB', 'Barbados'],
|
|
88
|
+
// ['BY', 'Belarus'],
|
|
89
|
+
// ['BE', 'Belgium'],
|
|
90
|
+
// ['BZ', 'Belize'],
|
|
91
|
+
// ['BJ', 'Benin'],
|
|
92
|
+
// ['BT', 'Bhutan'],
|
|
93
|
+
// ['BO', 'Bolivia'],
|
|
94
|
+
// ['BA', 'Bosnia and Herzegovina'],
|
|
95
|
+
// ['BW', 'Botswana'],
|
|
96
|
+
// ['BR', 'Brazil'],
|
|
97
|
+
// ['BN', 'Brunei'],
|
|
98
|
+
// ['BG', 'Bulgaria'],
|
|
99
|
+
// ['BF', 'Burkina Faso'],
|
|
100
|
+
// ['BI', 'Burundi'],
|
|
101
|
+
// ['CV', 'Cabo Verde'],
|
|
102
|
+
// ['KH', 'Cambodia'],
|
|
103
|
+
// ['CM', 'Cameroon'],
|
|
104
|
+
// ['CA', 'Canada'],
|
|
105
|
+
// ['CF', 'Central African Republic'],
|
|
106
|
+
// ['TD', 'Chad'],
|
|
107
|
+
// ['CL', 'Chile'],
|
|
108
|
+
// ['CN', 'China'],
|
|
109
|
+
// ['CO', 'Colombia'],
|
|
110
|
+
// ['KM', 'Comoros'],
|
|
111
|
+
// ['CG', 'Congo (Congo-Brazzaville)'],
|
|
112
|
+
// ['CR', 'Costa Rica'],
|
|
113
|
+
// ['HR', 'Croatia'],
|
|
114
|
+
// ['CU', 'Cuba'],
|
|
115
|
+
// ['CY', 'Cyprus'],
|
|
116
|
+
// ['CZ', 'Czechia (Czech Republic)'],
|
|
117
|
+
// ['CD', 'Democratic Republic of the Congo'],
|
|
118
|
+
// ['DK', 'Denmark'],
|
|
119
|
+
// ['DJ', 'Djibouti'],
|
|
120
|
+
// ['DM', 'Dominica'],
|
|
121
|
+
// ['DO', 'Dominican Republic'],
|
|
122
|
+
// ['EC', 'Ecuador'],
|
|
123
|
+
// ['EG', 'Egypt'],
|
|
124
|
+
// ['SV', 'El Salvador'],
|
|
125
|
+
// ['GQ', 'Equatorial Guinea'],
|
|
126
|
+
// ['ER', 'Eritrea'],
|
|
127
|
+
// ['EE', 'Estonia'],
|
|
128
|
+
// ['SZ', 'Eswatini'],
|
|
129
|
+
// ['ET', 'Ethiopia'],
|
|
130
|
+
// ['FJ', 'Fiji'],
|
|
131
|
+
// ['FI', 'Finland'],
|
|
132
|
+
// ['FR', 'France'],
|
|
133
|
+
// ['GA', 'Gabon'],
|
|
134
|
+
// ['GM', 'Gambia'],
|
|
135
|
+
// ['GE', 'Georgia'],
|
|
136
|
+
// ['DE', 'Germany'],
|
|
137
|
+
// ['GH', 'Ghana'],
|
|
138
|
+
// ['GR', 'Greece'],
|
|
139
|
+
// ['GD', 'Grenada'],
|
|
140
|
+
// ['GT', 'Guatemala'],
|
|
141
|
+
// ['GN', 'Guinea'],
|
|
142
|
+
// ['GW', 'Guinea-Bissau'],
|
|
143
|
+
// ['GY', 'Guyana'],
|
|
144
|
+
// ['HT', 'Haiti'],
|
|
145
|
+
// ['VA', 'Holy See (Vatican City)'],
|
|
146
|
+
// ['HN', 'Honduras'],
|
|
147
|
+
// ['HU', 'Hungary'],
|
|
148
|
+
// ['IS', 'Iceland'],
|
|
149
|
+
// ['IN', 'India'],
|
|
150
|
+
// ['ID', 'Indonesia'],
|
|
151
|
+
// ['IR', 'Iran'],
|
|
152
|
+
// ['IQ', 'Iraq'],
|
|
153
|
+
// ['IE', 'Ireland'],
|
|
154
|
+
// ['IL', 'Israel'],
|
|
155
|
+
// ['IT', 'Italy'],
|
|
156
|
+
// ['CI', "Ivory Coast (Côte d'Ivoire)"],
|
|
157
|
+
// ['JM', 'Jamaica'],
|
|
158
|
+
// ['JP', 'Japan'],
|
|
159
|
+
// ['JO', 'Jordan'],
|
|
160
|
+
// ['KZ', 'Kazakhstan'],
|
|
161
|
+
// ['KE', 'Kenya'],
|
|
162
|
+
// ['KI', 'Kiribati'],
|
|
163
|
+
// ['KW', 'Kuwait'],
|
|
164
|
+
// ['KG', 'Kyrgyzstan'],
|
|
165
|
+
// ['LA', 'Laos'],
|
|
166
|
+
// ['LV', 'Latvia'],
|
|
167
|
+
// ['LB', 'Lebanon'],
|
|
168
|
+
// ['LS', 'Lesotho'],
|
|
169
|
+
// ['LR', 'Liberia'],
|
|
170
|
+
// ['LY', 'Libya'],
|
|
171
|
+
// ['LI', 'Liechtenstein'],
|
|
172
|
+
// ['LT', 'Lithuania'],
|
|
173
|
+
// ['LU', 'Luxembourg'],
|
|
174
|
+
// ['MG', 'Madagascar'],
|
|
175
|
+
// ['MW', 'Malawi'],
|
|
176
|
+
// ['MY', 'Malaysia'],
|
|
177
|
+
// ['MV', 'Maldives'],
|
|
178
|
+
// ['ML', 'Mali'],
|
|
179
|
+
// ['MT', 'Malta'],
|
|
180
|
+
// ['MH', 'Marshall Islands'],
|
|
181
|
+
// ['MR', 'Mauritania'],
|
|
182
|
+
// ['MU', 'Mauritius'],
|
|
183
|
+
// ['MX', 'Mexico'],
|
|
184
|
+
// ['FM', 'Micronesia'],
|
|
185
|
+
// ['MD', 'Moldova'],
|
|
186
|
+
// ['MC', 'Monaco'],
|
|
187
|
+
// ['MN', 'Mongolia'],
|
|
188
|
+
// ['ME', 'Montenegro'],
|
|
189
|
+
// ['MA', 'Morocco'],
|
|
190
|
+
// ['MZ', 'Mozambique'],
|
|
191
|
+
// ['MM', 'Myanmar (Burma)'],
|
|
192
|
+
// ['NA', 'Namibia'],
|
|
193
|
+
// ['NR', 'Nauru'],
|
|
194
|
+
// ['NP', 'Nepal'],
|
|
195
|
+
// ['NL', 'Netherlands'],
|
|
196
|
+
// ['NZ', 'New Zealand'],
|
|
197
|
+
// ['NI', 'Nicaragua'],
|
|
198
|
+
// ['NE', 'Niger'],
|
|
199
|
+
// ['NG', 'Nigeria'],
|
|
200
|
+
// ['KP', 'North Korea'],
|
|
201
|
+
// ['MK', 'North Macedonia'],
|
|
202
|
+
// ['NO', 'Norway'],
|
|
203
|
+
// ['OM', 'Oman'],
|
|
204
|
+
// ['PK', 'Pakistan'],
|
|
205
|
+
// ['PW', 'Palau'],
|
|
206
|
+
// ['PS', 'Palestine State'],
|
|
207
|
+
// ['PA', 'Panama'],
|
|
208
|
+
// ['PG', 'Papua New Guinea'],
|
|
209
|
+
// ['PY', 'Paraguay'],
|
|
210
|
+
// ['PE', 'Peru'],
|
|
211
|
+
// ['PH', 'Philippines'],
|
|
212
|
+
// ['PL', 'Poland'],
|
|
213
|
+
// ['PT', 'Portugal'],
|
|
214
|
+
// ['QA', 'Qatar'],
|
|
215
|
+
// ['RO', 'Romania'],
|
|
216
|
+
// ['RU', 'Russia'],
|
|
217
|
+
// ['RW', 'Rwanda'],
|
|
218
|
+
// ['KN', 'Saint Kitts and Nevis'],
|
|
219
|
+
// ['LC', 'Saint Lucia'],
|
|
220
|
+
// ['VC', 'Saint Vincent and the Grenadines'],
|
|
221
|
+
// ['WS', 'Samoa'],
|
|
222
|
+
// ['SM', 'San Marino'],
|
|
223
|
+
// ['ST', 'Sao Tome and Principe'],
|
|
224
|
+
// ['SA', 'Saudi Arabia'],
|
|
225
|
+
// ['SN', 'Senegal'],
|
|
226
|
+
// ['RS', 'Serbia'],
|
|
227
|
+
// ['SC', 'Seychelles'],
|
|
228
|
+
// ['SL', 'Sierra Leone'],
|
|
229
|
+
// ['SG', 'Singapore'],
|
|
230
|
+
// ['SK', 'Slovakia'],
|
|
231
|
+
// ['SI', 'Slovenia'],
|
|
232
|
+
// ['SB', 'Solomon Islands'],
|
|
233
|
+
// ['SO', 'Somalia'],
|
|
234
|
+
// ['ZA', 'South Africa'],
|
|
235
|
+
// ['KR', 'South Korea'],
|
|
236
|
+
// ['SS', 'South Sudan'],
|
|
237
|
+
// ['ES', 'Spain'],
|
|
238
|
+
// ['LK', 'Sri Lanka'],
|
|
239
|
+
// ['SD', 'Sudan'],
|
|
240
|
+
// ['SR', 'Suriname'],
|
|
241
|
+
// ['SE', 'Sweden'],
|
|
242
|
+
// ['CH', 'Switzerland'],
|
|
243
|
+
// ['SY', 'Syria'],
|
|
244
|
+
// ['TJ', 'Tajikistan'],
|
|
245
|
+
// ['TZ', 'Tanzania'],
|
|
246
|
+
// ['TH', 'Thailand'],
|
|
247
|
+
// ['TL', 'Timor-Leste'],
|
|
248
|
+
// ['TG', 'Togo'],
|
|
249
|
+
// ['TO', 'Tonga'],
|
|
250
|
+
// ['TT', 'Trinidad and Tobago'],
|
|
251
|
+
// ['TN', 'Tunisia'],
|
|
252
|
+
// ['TR', 'Turkey'],
|
|
253
|
+
// ['TM', 'Turkmenistan'],
|
|
254
|
+
// ['TV', 'Tuvalu'],
|
|
255
|
+
// ['UG', 'Uganda'],
|
|
256
|
+
// ['UA', 'Ukraine'],
|
|
257
|
+
// ['AE', 'United Arab Emirates'],
|
|
258
|
+
// ['GB', 'United Kingdom'],
|
|
259
|
+
// ['US', 'United States'],
|
|
260
|
+
// ['UY', 'Uruguay'],
|
|
261
|
+
// ['UZ', 'Uzbekistan'],
|
|
262
|
+
// ['VU', 'Vanuatu'],
|
|
263
|
+
// ['VE', 'Venezuela'],
|
|
264
|
+
// ['VN', 'Vietnam'],
|
|
265
|
+
// ['YE', 'Yemen'],
|
|
266
|
+
// ['ZM', 'Zambia'],
|
|
267
|
+
// ['ZW', 'Zimbabwe'],
|
|
268
|
+
// ];
|
|
269
|
+
/** Billing country dropdown options. Swap back to COUNTRIES when expanding internationally. */
|
|
270
|
+
export const BILLING_COUNTRIES = [
|
|
258
271
|
['US', 'United States'],
|
|
259
|
-
['UY', 'Uruguay'],
|
|
260
|
-
['UZ', 'Uzbekistan'],
|
|
261
|
-
['VU', 'Vanuatu'],
|
|
262
|
-
['VE', 'Venezuela'],
|
|
263
|
-
['VN', 'Vietnam'],
|
|
264
|
-
['YE', 'Yemen'],
|
|
265
|
-
['ZM', 'Zambia'],
|
|
266
|
-
['ZW', 'Zimbabwe'],
|
|
267
272
|
];
|
|
268
273
|
// --- Stripe Element presentation ---------------------------------------------
|
|
269
274
|
// A div that hosts a Stripe Element but reads like a Paragon input.
|
package/dist/constants.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,KAAK,GAAG,gDAAgD,CAAC;AACtE,MAAM,CAAC,MAAM,wBAAwB,GAAG,iDAAiD,CAAC;AAE1F,gFAAgF;AAChF,MAAM,CAAC,MAAM,MAAM,GAAG;IACpB,OAAO,EAAE,SAAS;IAClB,OAAO,EAAE,SAAS;IAClB,gBAAgB,EAAE,kBAAkB;IACpC,eAAe,EAAE,iBAAiB;IAClC,cAAc,EAAE,gBAAgB;IAChC,cAAc,EAAE,gBAAgB;IAChC,iBAAiB,EAAE,mBAAmB;IACtC,4BAA4B,EAAE,8BAA8B;IAC5D,WAAW,EAAE,aAAa;IAC1B,oBAAoB,EAAE,sBAAsB;CACpC,CAAC;AAMX,MAAM,CAAC,MAAM,eAAe,GAAa;IACvC,MAAM,CAAC,oBAAoB;IAC3B,MAAM,CAAC,cAAc;IACrB,MAAM,CAAC,WAAW;CACnB,CAAC;AAEF,MAAM,CAAC,MAAM,aAAa,GAA2B;IACnD,OAAO,EAAE,cAAc;IACvB,OAAO,EAAE,iBAAiB;IAC1B,gBAAgB,EAAE,qBAAqB;IACvC,eAAe,EAAE,6CAA6C;IAC9D,cAAc,EAAE,eAAe;IAC/B,cAAc,EAAE,+BAA+B;IAC/C,4BAA4B,EAAE,4BAA4B;IAC1D,iBAAiB,EAAE,6BAA6B;IAChD,WAAW,EAAE,gBAAgB;IAC7B,oBAAoB,EAAE,sBAAsB;CAC7C,CAAC;AAEF,MA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AAE,EAAE,EAAE;CAC/F,CAAC","sourcesContent":["import type { CSSProperties } from 'react';\n\nexport const appId = 'org.openedx.frontend.app.subscription.checkout';\nexport const subscriptionCheckoutRole = 'org.openedx.frontend.role.subscription.checkout';\n\n// --- Cart BI state machine ---------------------------------------------------\nexport const STATUS = {\n IN_CART: 'IN_CART',\n CONFIRM: 'CONFIRM',\n SANCTION_STARTED: 'SANCTION_STARTED',\n SANCTION_PASSED: 'SANCTION_PASSED',\n SANCTION_BLOCK: 'SANCTION_BLOCK',\n STRIPE_STARTED: 'STRIPE_STARTED',\n STRIPE_SUBSCRIBED: 'STRIPE_SUBSCRIBED',\n STRIPE_CONFIRMATION_REQUIRED: 'STRIPE_CONFIRMATION_REQUIRED',\n STRIPE_FAIL: 'STRIPE_FAIL',\n SUBSCRIPTION_CREATED: 'SUBSCRIPTION_CREATED',\n} as const;\n\nexport type Status = typeof STATUS[keyof typeof STATUS];\n\nexport type Phase = 'init' | 'ready' | 'processing' | 'threeds' | 'success' | 'blocked' | 'failed';\n\nexport const TERMINAL_STATES: Status[] = [\n STATUS.SUBSCRIPTION_CREATED,\n STATUS.SANCTION_BLOCK,\n STATUS.STRIPE_FAIL,\n];\n\nexport const STATUS_LABELS: Record<string, string> = {\n IN_CART: 'Cart created',\n CONFIRM: 'Order confirmed',\n SANCTION_STARTED: 'Checking sanctions…',\n SANCTION_PASSED: 'Sanctions passed — setting up your account…',\n SANCTION_BLOCK: 'Order blocked',\n STRIPE_STARTED: 'Setting up your subscription…',\n STRIPE_CONFIRMATION_REQUIRED: 'Card verification required',\n STRIPE_SUBSCRIBED: 'Card verified — finalizing…',\n STRIPE_FAIL: 'Payment failed',\n SUBSCRIPTION_CREATED: 'Subscription created',\n};\n\nexport const isTerminalStatus = (status: Status | null | undefined): boolean =>\n TERMINAL_STATES.includes(status as Status);\n\n/** UI phase derived from the raw bpStatus code + cart readiness. */\nexport function phaseFor(status: Status | null, ready: boolean): Phase {\n if (status === STATUS.SUBSCRIPTION_CREATED) return 'success';\n if (status === STATUS.SANCTION_BLOCK) return 'blocked';\n if (status === STATUS.STRIPE_FAIL) return 'failed';\n if (status && status !== STATUS.IN_CART) return 'processing';\n return ready ? 'ready' : 'init';\n}\n\n// --- Dev defaults (match the local test harness) -----------------------------\nexport const DEFAULTS = {\n apiUrl: '/api/graphql',\n confirmIntentUrl: '/api/stripe/confirm-pi',\n customerUid: '019d2bde-f769-743d-88f9-8bf0d1a7a002',\n salableUid: '019d2ce7-05bc-7dd6-b141-e32df9ac86c1',\n billingPlanUid: '019d2ce7-05c0-7188-81b0-8eb747b41b0f',\n};\n\nexport const LS_KEYS = { biId: 'twou.cartBiId', uid: 'twou.cartUid' };\n\n// ─── Checkout gate feature flags (dev controls) ───────────────────────────────\n// Set to false during development to bypass the country gate check.\n// Should be true in production. Subscriber access is enforced outside this app.\n\n/** When false, the country check is skipped — all countries can access checkout. */\nexport const GATE_CHECK_COUNTRY = true;\n\n/**\n * ISO 3166-1 alpha-2 country codes that are permitted to complete checkout.\n * Add or remove codes here to open or restrict access by country.\n * e.g. ['US', 'CA', 'GB'] to allow US, Canada, and UK.\n */\nexport const ALLOWED_CHECKOUT_COUNTRIES: readonly string[] = ['US', 'CA'];\n\n/**\n * ISO 3166-1 alpha-2 country codes that require the extra billing-consent checkbox.\n * Add or remove codes here to control which residents see the second checkbox.\n */\nexport const COUNTRIES_REQUIRING_EXTRA_CONFIRM: readonly string[] = ['GB', 'CA'];\n\nexport const COUNTRIES: readonly (readonly [string, string])[] = [\n ['AF', 'Afghanistan'],\n ['AL', 'Albania'],\n ['DZ', 'Algeria'],\n ['AD', 'Andorra'],\n ['AO', 'Angola'],\n ['AG', 'Antigua and Barbuda'],\n ['AR', 'Argentina'],\n ['AM', 'Armenia'],\n ['AU', 'Australia'],\n ['AT', 'Austria'],\n ['AZ', 'Azerbaijan'],\n ['BS', 'Bahamas'],\n ['BH', 'Bahrain'],\n ['BD', 'Bangladesh'],\n ['BB', 'Barbados'],\n ['BY', 'Belarus'],\n ['BE', 'Belgium'],\n ['BZ', 'Belize'],\n ['BJ', 'Benin'],\n ['BT', 'Bhutan'],\n ['BO', 'Bolivia'],\n ['BA', 'Bosnia and Herzegovina'],\n ['BW', 'Botswana'],\n ['BR', 'Brazil'],\n ['BN', 'Brunei'],\n ['BG', 'Bulgaria'],\n ['BF', 'Burkina Faso'],\n ['BI', 'Burundi'],\n ['CV', 'Cabo Verde'],\n ['KH', 'Cambodia'],\n ['CM', 'Cameroon'],\n ['CA', 'Canada'],\n ['CF', 'Central African Republic'],\n ['TD', 'Chad'],\n ['CL', 'Chile'],\n ['CN', 'China'],\n ['CO', 'Colombia'],\n ['KM', 'Comoros'],\n ['CG', 'Congo (Congo-Brazzaville)'],\n ['CR', 'Costa Rica'],\n ['HR', 'Croatia'],\n ['CU', 'Cuba'],\n ['CY', 'Cyprus'],\n ['CZ', 'Czechia (Czech Republic)'],\n ['CD', 'Democratic Republic of the Congo'],\n ['DK', 'Denmark'],\n ['DJ', 'Djibouti'],\n ['DM', 'Dominica'],\n ['DO', 'Dominican Republic'],\n ['EC', 'Ecuador'],\n ['EG', 'Egypt'],\n ['SV', 'El Salvador'],\n ['GQ', 'Equatorial Guinea'],\n ['ER', 'Eritrea'],\n ['EE', 'Estonia'],\n ['SZ', 'Eswatini'],\n ['ET', 'Ethiopia'],\n ['FJ', 'Fiji'],\n ['FI', 'Finland'],\n ['FR', 'France'],\n ['GA', 'Gabon'],\n ['GM', 'Gambia'],\n ['GE', 'Georgia'],\n ['DE', 'Germany'],\n ['GH', 'Ghana'],\n ['GR', 'Greece'],\n ['GD', 'Grenada'],\n ['GT', 'Guatemala'],\n ['GN', 'Guinea'],\n ['GW', 'Guinea-Bissau'],\n ['GY', 'Guyana'],\n ['HT', 'Haiti'],\n ['VA', 'Holy See (Vatican City)'],\n ['HN', 'Honduras'],\n ['HU', 'Hungary'],\n ['IS', 'Iceland'],\n ['IN', 'India'],\n ['ID', 'Indonesia'],\n ['IR', 'Iran'],\n ['IQ', 'Iraq'],\n ['IE', 'Ireland'],\n ['IL', 'Israel'],\n ['IT', 'Italy'],\n ['CI', \"Ivory Coast (Côte d'Ivoire)\"],\n ['JM', 'Jamaica'],\n ['JP', 'Japan'],\n ['JO', 'Jordan'],\n ['KZ', 'Kazakhstan'],\n ['KE', 'Kenya'],\n ['KI', 'Kiribati'],\n ['KW', 'Kuwait'],\n ['KG', 'Kyrgyzstan'],\n ['LA', 'Laos'],\n ['LV', 'Latvia'],\n ['LB', 'Lebanon'],\n ['LS', 'Lesotho'],\n ['LR', 'Liberia'],\n ['LY', 'Libya'],\n ['LI', 'Liechtenstein'],\n ['LT', 'Lithuania'],\n ['LU', 'Luxembourg'],\n ['MG', 'Madagascar'],\n ['MW', 'Malawi'],\n ['MY', 'Malaysia'],\n ['MV', 'Maldives'],\n ['ML', 'Mali'],\n ['MT', 'Malta'],\n ['MH', 'Marshall Islands'],\n ['MR', 'Mauritania'],\n ['MU', 'Mauritius'],\n ['MX', 'Mexico'],\n ['FM', 'Micronesia'],\n ['MD', 'Moldova'],\n ['MC', 'Monaco'],\n ['MN', 'Mongolia'],\n ['ME', 'Montenegro'],\n ['MA', 'Morocco'],\n ['MZ', 'Mozambique'],\n ['MM', 'Myanmar (Burma)'],\n ['NA', 'Namibia'],\n ['NR', 'Nauru'],\n ['NP', 'Nepal'],\n ['NL', 'Netherlands'],\n ['NZ', 'New Zealand'],\n ['NI', 'Nicaragua'],\n ['NE', 'Niger'],\n ['NG', 'Nigeria'],\n ['KP', 'North Korea'],\n ['MK', 'North Macedonia'],\n ['NO', 'Norway'],\n ['OM', 'Oman'],\n ['PK', 'Pakistan'],\n ['PW', 'Palau'],\n ['PS', 'Palestine State'],\n ['PA', 'Panama'],\n ['PG', 'Papua New Guinea'],\n ['PY', 'Paraguay'],\n ['PE', 'Peru'],\n ['PH', 'Philippines'],\n ['PL', 'Poland'],\n ['PT', 'Portugal'],\n ['QA', 'Qatar'],\n ['RO', 'Romania'],\n ['RU', 'Russia'],\n ['RW', 'Rwanda'],\n ['KN', 'Saint Kitts and Nevis'],\n ['LC', 'Saint Lucia'],\n ['VC', 'Saint Vincent and the Grenadines'],\n ['WS', 'Samoa'],\n ['SM', 'San Marino'],\n ['ST', 'Sao Tome and Principe'],\n ['SA', 'Saudi Arabia'],\n ['SN', 'Senegal'],\n ['RS', 'Serbia'],\n ['SC', 'Seychelles'],\n ['SL', 'Sierra Leone'],\n ['SG', 'Singapore'],\n ['SK', 'Slovakia'],\n ['SI', 'Slovenia'],\n ['SB', 'Solomon Islands'],\n ['SO', 'Somalia'],\n ['ZA', 'South Africa'],\n ['KR', 'South Korea'],\n ['SS', 'South Sudan'],\n ['ES', 'Spain'],\n ['LK', 'Sri Lanka'],\n ['SD', 'Sudan'],\n ['SR', 'Suriname'],\n ['SE', 'Sweden'],\n ['CH', 'Switzerland'],\n ['SY', 'Syria'],\n ['TJ', 'Tajikistan'],\n ['TZ', 'Tanzania'],\n ['TH', 'Thailand'],\n ['TL', 'Timor-Leste'],\n ['TG', 'Togo'],\n ['TO', 'Tonga'],\n ['TT', 'Trinidad and Tobago'],\n ['TN', 'Tunisia'],\n ['TR', 'Turkey'],\n ['TM', 'Turkmenistan'],\n ['TV', 'Tuvalu'],\n ['UG', 'Uganda'],\n ['UA', 'Ukraine'],\n ['AE', 'United Arab Emirates'],\n ['GB', 'United Kingdom'],\n ['US', 'United States'],\n ['UY', 'Uruguay'],\n ['UZ', 'Uzbekistan'],\n ['VU', 'Vanuatu'],\n ['VE', 'Venezuela'],\n ['VN', 'Vietnam'],\n ['YE', 'Yemen'],\n ['ZM', 'Zambia'],\n ['ZW', 'Zimbabwe'],\n];\n\n// --- Stripe Element presentation ---------------------------------------------\n// A div that hosts a Stripe Element but reads like a Paragon input.\nexport const STRIPE_FIELD_STYLE: CSSProperties = {\n height: 'auto', minHeight: '2.875rem', display: 'flex', alignItems: 'center',\n};\nexport const STRIPE_ELEMENT_OPTS = {\n style: { base: { fontSize: '16px', color: '#1a1a1a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B,0BAA0B;AAC1B,uBAAuB;AACvB,yBAAyB;AACzB,uBAAuB;AACvB,qBAAqB;AACrB,sBAAsB;AACtB,wBAAwB;AACxB,KAAK;AAEL,+FAA+F;AAC/F,MAAM,CAAC,MAAM,iBAAiB,GAA2C;IACvE,CAAC,IAAI,EAAE,eAAe,CAAC;CACxB,CAAC;AAEF,gFAAgF;AAChF,oEAAoE;AACpE,MAAM,CAAC,MAAM,kBAAkB,GAAkB;IAC/C,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,QAAQ;CAC7E,CAAC;AACF,MAAM,CAAC,MAAM,mBAAmB,GAAG;IACjC,KAAK,EAAE,EAAE,IAAI,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,eAAe,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,EAAE,EAAE;CAC/F,CAAC","sourcesContent":["import type { CSSProperties } from 'react';\n\nexport const appId = 'org.openedx.frontend.app.subscription.checkout';\nexport const subscriptionCheckoutRole = 'org.openedx.frontend.role.subscription.checkout';\n\n// --- Cart BI state machine ---------------------------------------------------\nexport const STATUS = {\n IN_CART: 'IN_CART',\n CONFIRM: 'CONFIRM',\n SANCTION_STARTED: 'SANCTION_STARTED',\n SANCTION_PASSED: 'SANCTION_PASSED',\n SANCTION_BLOCK: 'SANCTION_BLOCK',\n STRIPE_STARTED: 'STRIPE_STARTED',\n STRIPE_SUBSCRIBED: 'STRIPE_SUBSCRIBED',\n STRIPE_CONFIRMATION_REQUIRED: 'STRIPE_CONFIRMATION_REQUIRED',\n STRIPE_FAIL: 'STRIPE_FAIL',\n SUBSCRIPTION_CREATED: 'SUBSCRIPTION_CREATED',\n} as const;\n\nexport type Status = typeof STATUS[keyof typeof STATUS];\n\nexport type Phase = 'init' | 'ready' | 'processing' | 'threeds' | 'success' | 'blocked' | 'failed';\n\nexport const TERMINAL_STATES: Status[] = [\n STATUS.SUBSCRIPTION_CREATED,\n STATUS.SANCTION_BLOCK,\n STATUS.STRIPE_FAIL,\n];\n\nexport const STATUS_LABELS: Record<string, string> = {\n IN_CART: 'Cart created',\n CONFIRM: 'Order confirmed',\n SANCTION_STARTED: 'Checking sanctions…',\n SANCTION_PASSED: 'Sanctions passed — setting up your account…',\n SANCTION_BLOCK: 'Order blocked',\n STRIPE_STARTED: 'Setting up your subscription…',\n STRIPE_CONFIRMATION_REQUIRED: 'Card verification required',\n STRIPE_SUBSCRIBED: 'Card verified — finalizing…',\n STRIPE_FAIL: 'Payment failed',\n SUBSCRIPTION_CREATED: 'Subscription created',\n};\n\nexport const isTerminalStatus = (status: Status | null | undefined): boolean =>\n TERMINAL_STATES.includes(status as Status);\n\n/** UI phase derived from the raw bpStatus code + cart readiness. */\nexport function phaseFor(status: Status | null, ready: boolean): Phase {\n if (status === STATUS.SUBSCRIPTION_CREATED) return 'success';\n if (status === STATUS.SANCTION_BLOCK) return 'blocked';\n if (status === STATUS.STRIPE_FAIL) return 'failed';\n if (status && status !== STATUS.IN_CART) return 'processing';\n return ready ? 'ready' : 'init';\n}\n\n// --- Dev defaults (match the local test harness) -----------------------------\nexport const DEFAULTS = {\n apiUrl: '/api/graphql',\n confirmIntentUrl: '/api/stripe/confirm-pi',\n customerUid: '019d2bde-f769-743d-88f9-8bf0d1a7a002',\n salableUid: '019d2ce7-05bc-7dd6-b141-e32df9ac86c1',\n // Monthly Subscription template uid (not Annual)\n billingPlanUid: '019d2ce7-05bf-733c-ba56-0fcafafeb69b',\n};\n\nexport const LS_KEYS = { biId: 'twou.cartBiId', uid: 'twou.cartUid' };\n\n// ─── Checkout gate feature flags (dev controls) ───────────────────────────────\n// Set to false during development to bypass the country gate check.\n// Should be true in production. Subscriber access is enforced outside this app.\n\n/** When false, the country check is skipped — all countries can access checkout. */\nexport const GATE_CHECK_COUNTRY = true;\n\n/**\n * ISO 3166-1 alpha-2 country codes that are permitted to complete checkout.\n * Add or remove codes here to open or restrict access by country.\n * e.g. ['US', 'CA', 'GB'] to allow US, Canada, and UK.\n */\nexport const ALLOWED_CHECKOUT_COUNTRIES: readonly string[] = ['US', 'CA'];\n\n/**\n * ISO 3166-1 alpha-2 country codes that require the extra billing-consent checkbox.\n * Add or remove codes here to control which residents see the second checkbox.\n */\nexport const COUNTRIES_REQUIRING_EXTRA_CONFIRM: readonly string[] = ['GB', 'CA'];\n\n// export const COUNTRIES: readonly (readonly [string, string])[] = [\n// ['AF', 'Afghanistan'],\n// ['AL', 'Albania'],\n// ['DZ', 'Algeria'],\n// ['AD', 'Andorra'],\n// ['AO', 'Angola'],\n// ['AG', 'Antigua and Barbuda'],\n// ['AR', 'Argentina'],\n// ['AM', 'Armenia'],\n// ['AU', 'Australia'],\n// ['AT', 'Austria'],\n// ['AZ', 'Azerbaijan'],\n// ['BS', 'Bahamas'],\n// ['BH', 'Bahrain'],\n// ['BD', 'Bangladesh'],\n// ['BB', 'Barbados'],\n// ['BY', 'Belarus'],\n// ['BE', 'Belgium'],\n// ['BZ', 'Belize'],\n// ['BJ', 'Benin'],\n// ['BT', 'Bhutan'],\n// ['BO', 'Bolivia'],\n// ['BA', 'Bosnia and Herzegovina'],\n// ['BW', 'Botswana'],\n// ['BR', 'Brazil'],\n// ['BN', 'Brunei'],\n// ['BG', 'Bulgaria'],\n// ['BF', 'Burkina Faso'],\n// ['BI', 'Burundi'],\n// ['CV', 'Cabo Verde'],\n// ['KH', 'Cambodia'],\n// ['CM', 'Cameroon'],\n// ['CA', 'Canada'],\n// ['CF', 'Central African Republic'],\n// ['TD', 'Chad'],\n// ['CL', 'Chile'],\n// ['CN', 'China'],\n// ['CO', 'Colombia'],\n// ['KM', 'Comoros'],\n// ['CG', 'Congo (Congo-Brazzaville)'],\n// ['CR', 'Costa Rica'],\n// ['HR', 'Croatia'],\n// ['CU', 'Cuba'],\n// ['CY', 'Cyprus'],\n// ['CZ', 'Czechia (Czech Republic)'],\n// ['CD', 'Democratic Republic of the Congo'],\n// ['DK', 'Denmark'],\n// ['DJ', 'Djibouti'],\n// ['DM', 'Dominica'],\n// ['DO', 'Dominican Republic'],\n// ['EC', 'Ecuador'],\n// ['EG', 'Egypt'],\n// ['SV', 'El Salvador'],\n// ['GQ', 'Equatorial Guinea'],\n// ['ER', 'Eritrea'],\n// ['EE', 'Estonia'],\n// ['SZ', 'Eswatini'],\n// ['ET', 'Ethiopia'],\n// ['FJ', 'Fiji'],\n// ['FI', 'Finland'],\n// ['FR', 'France'],\n// ['GA', 'Gabon'],\n// ['GM', 'Gambia'],\n// ['GE', 'Georgia'],\n// ['DE', 'Germany'],\n// ['GH', 'Ghana'],\n// ['GR', 'Greece'],\n// ['GD', 'Grenada'],\n// ['GT', 'Guatemala'],\n// ['GN', 'Guinea'],\n// ['GW', 'Guinea-Bissau'],\n// ['GY', 'Guyana'],\n// ['HT', 'Haiti'],\n// ['VA', 'Holy See (Vatican City)'],\n// ['HN', 'Honduras'],\n// ['HU', 'Hungary'],\n// ['IS', 'Iceland'],\n// ['IN', 'India'],\n// ['ID', 'Indonesia'],\n// ['IR', 'Iran'],\n// ['IQ', 'Iraq'],\n// ['IE', 'Ireland'],\n// ['IL', 'Israel'],\n// ['IT', 'Italy'],\n// ['CI', \"Ivory Coast (Côte d'Ivoire)\"],\n// ['JM', 'Jamaica'],\n// ['JP', 'Japan'],\n// ['JO', 'Jordan'],\n// ['KZ', 'Kazakhstan'],\n// ['KE', 'Kenya'],\n// ['KI', 'Kiribati'],\n// ['KW', 'Kuwait'],\n// ['KG', 'Kyrgyzstan'],\n// ['LA', 'Laos'],\n// ['LV', 'Latvia'],\n// ['LB', 'Lebanon'],\n// ['LS', 'Lesotho'],\n// ['LR', 'Liberia'],\n// ['LY', 'Libya'],\n// ['LI', 'Liechtenstein'],\n// ['LT', 'Lithuania'],\n// ['LU', 'Luxembourg'],\n// ['MG', 'Madagascar'],\n// ['MW', 'Malawi'],\n// ['MY', 'Malaysia'],\n// ['MV', 'Maldives'],\n// ['ML', 'Mali'],\n// ['MT', 'Malta'],\n// ['MH', 'Marshall Islands'],\n// ['MR', 'Mauritania'],\n// ['MU', 'Mauritius'],\n// ['MX', 'Mexico'],\n// ['FM', 'Micronesia'],\n// ['MD', 'Moldova'],\n// ['MC', 'Monaco'],\n// ['MN', 'Mongolia'],\n// ['ME', 'Montenegro'],\n// ['MA', 'Morocco'],\n// ['MZ', 'Mozambique'],\n// ['MM', 'Myanmar (Burma)'],\n// ['NA', 'Namibia'],\n// ['NR', 'Nauru'],\n// ['NP', 'Nepal'],\n// ['NL', 'Netherlands'],\n// ['NZ', 'New Zealand'],\n// ['NI', 'Nicaragua'],\n// ['NE', 'Niger'],\n// ['NG', 'Nigeria'],\n// ['KP', 'North Korea'],\n// ['MK', 'North Macedonia'],\n// ['NO', 'Norway'],\n// ['OM', 'Oman'],\n// ['PK', 'Pakistan'],\n// ['PW', 'Palau'],\n// ['PS', 'Palestine State'],\n// ['PA', 'Panama'],\n// ['PG', 'Papua New Guinea'],\n// ['PY', 'Paraguay'],\n// ['PE', 'Peru'],\n// ['PH', 'Philippines'],\n// ['PL', 'Poland'],\n// ['PT', 'Portugal'],\n// ['QA', 'Qatar'],\n// ['RO', 'Romania'],\n// ['RU', 'Russia'],\n// ['RW', 'Rwanda'],\n// ['KN', 'Saint Kitts and Nevis'],\n// ['LC', 'Saint Lucia'],\n// ['VC', 'Saint Vincent and the Grenadines'],\n// ['WS', 'Samoa'],\n// ['SM', 'San Marino'],\n// ['ST', 'Sao Tome and Principe'],\n// ['SA', 'Saudi Arabia'],\n// ['SN', 'Senegal'],\n// ['RS', 'Serbia'],\n// ['SC', 'Seychelles'],\n// ['SL', 'Sierra Leone'],\n// ['SG', 'Singapore'],\n// ['SK', 'Slovakia'],\n// ['SI', 'Slovenia'],\n// ['SB', 'Solomon Islands'],\n// ['SO', 'Somalia'],\n// ['ZA', 'South Africa'],\n// ['KR', 'South Korea'],\n// ['SS', 'South Sudan'],\n// ['ES', 'Spain'],\n// ['LK', 'Sri Lanka'],\n// ['SD', 'Sudan'],\n// ['SR', 'Suriname'],\n// ['SE', 'Sweden'],\n// ['CH', 'Switzerland'],\n// ['SY', 'Syria'],\n// ['TJ', 'Tajikistan'],\n// ['TZ', 'Tanzania'],\n// ['TH', 'Thailand'],\n// ['TL', 'Timor-Leste'],\n// ['TG', 'Togo'],\n// ['TO', 'Tonga'],\n// ['TT', 'Trinidad and Tobago'],\n// ['TN', 'Tunisia'],\n// ['TR', 'Turkey'],\n// ['TM', 'Turkmenistan'],\n// ['TV', 'Tuvalu'],\n// ['UG', 'Uganda'],\n// ['UA', 'Ukraine'],\n// ['AE', 'United Arab Emirates'],\n// ['GB', 'United Kingdom'],\n// ['US', 'United States'],\n// ['UY', 'Uruguay'],\n// ['UZ', 'Uzbekistan'],\n// ['VU', 'Vanuatu'],\n// ['VE', 'Venezuela'],\n// ['VN', 'Vietnam'],\n// ['YE', 'Yemen'],\n// ['ZM', 'Zambia'],\n// ['ZW', 'Zimbabwe'],\n// ];\n\n/** Billing country dropdown options. Swap back to COUNTRIES when expanding internationally. */\nexport const BILLING_COUNTRIES: readonly (readonly [string, string])[] = [\n ['US', 'United States'],\n];\n\n// --- Stripe Element presentation ---------------------------------------------\n// A div that hosts a Stripe Element but reads like a Paragon input.\nexport const STRIPE_FIELD_STYLE: CSSProperties = {\n height: 'auto', minHeight: '2.875rem', display: 'flex', alignItems: 'center',\n};\nexport const STRIPE_ELEMENT_OPTS = {\n style: { base: { fontSize: '16px', color: '#1a1a1a', '::placeholder': { color: '#8f8f8f' } } },\n};\n"]}
|
|
@@ -93,12 +93,16 @@ export default function useCheckout(options = {}) {
|
|
|
93
93
|
// Mirror state into refs so mutations can read current values without stale closures.
|
|
94
94
|
const cartRef = useRef(null);
|
|
95
95
|
const billingRef = useRef(billing);
|
|
96
|
+
const selectedCycleRef = useRef(selectedCycle);
|
|
96
97
|
useEffect(() => {
|
|
97
98
|
cartRef.current = cart;
|
|
98
99
|
}, [cart]);
|
|
99
100
|
useEffect(() => {
|
|
100
101
|
billingRef.current = billing;
|
|
101
102
|
}, [billing]);
|
|
103
|
+
useEffect(() => {
|
|
104
|
+
selectedCycleRef.current = selectedCycle;
|
|
105
|
+
}, [selectedCycle]);
|
|
102
106
|
useEffect(() => {
|
|
103
107
|
stripeInstanceRef.current = stripe;
|
|
104
108
|
}, [stripe]);
|
|
@@ -116,6 +120,7 @@ export default function useCheckout(options = {}) {
|
|
|
116
120
|
stripeRef: stripeInstanceRef,
|
|
117
121
|
cardNumberElRef: cardNumberElementRef,
|
|
118
122
|
billingRef,
|
|
123
|
+
selectedCycleRef,
|
|
119
124
|
setError: (msg) => {
|
|
120
125
|
setProcessingSubscription(false);
|
|
121
126
|
setError(msg);
|