@edx/frontend-app-subscription-manage 1.1.0 → 1.2.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/Main.js +1 -1
- package/dist/Main.js.map +1 -1
- package/dist/app.js +3 -0
- package/dist/app.js.map +1 -1
- package/dist/checkoutPage/CheckoutPage.d.ts +3 -0
- package/dist/checkoutPage/CheckoutPage.js +24 -0
- package/dist/checkoutPage/CheckoutPage.js.map +1 -0
- package/dist/components/BrandMarks/BrandMarks.d.ts +3 -0
- package/dist/components/BrandMarks/BrandMarks.js +9 -0
- package/dist/components/BrandMarks/BrandMarks.js.map +1 -0
- package/dist/components/CartSummary/CartSummary.d.ts +21 -0
- package/dist/components/CartSummary/CartSummary.js +30 -0
- package/dist/components/CartSummary/CartSummary.js.map +1 -0
- package/dist/components/CartSummary/Messages.d.ts +73 -0
- package/dist/components/CartSummary/Messages.js +76 -0
- package/dist/components/CartSummary/Messages.js.map +1 -0
- package/dist/components/Checkout/Checkout.d.ts +4 -0
- package/dist/components/Checkout/Checkout.js +37 -0
- package/dist/components/Checkout/Checkout.js.map +1 -0
- package/dist/components/CheckoutGate/CheckoutGate.d.ts +9 -0
- package/dist/components/CheckoutGate/CheckoutGate.js +34 -0
- package/dist/components/CheckoutGate/CheckoutGate.js.map +1 -0
- package/dist/components/CourseEnrollmentCard/CourseEnrollmentCard.d.ts +9 -0
- package/dist/components/CourseEnrollmentCard/CourseEnrollmentCard.js +28 -0
- package/dist/components/CourseEnrollmentCard/CourseEnrollmentCard.js.map +1 -0
- package/dist/components/CourseEnrollmentCard/Messages.d.ts +33 -0
- package/dist/components/CourseEnrollmentCard/Messages.js +35 -0
- package/dist/components/CourseEnrollmentCard/Messages.js.map +1 -0
- package/dist/components/EdxUnlimitedBanner/EdxUnlimitedBanner.d.ts +13 -0
- package/dist/components/EdxUnlimitedBanner/EdxUnlimitedBanner.js +11 -0
- package/dist/components/EdxUnlimitedBanner/EdxUnlimitedBanner.js.map +1 -0
- package/dist/components/EnrollmentSummary/EnrollmentSummary.d.ts +15 -0
- package/dist/components/EnrollmentSummary/EnrollmentSummary.js +21 -0
- package/dist/components/EnrollmentSummary/EnrollmentSummary.js.map +1 -0
- package/dist/components/EnrollmentSummary/Messages.d.ts +33 -0
- package/dist/components/EnrollmentSummary/Messages.js +35 -0
- package/dist/components/EnrollmentSummary/Messages.js.map +1 -0
- package/dist/components/PaymentFields/PaymentFields.d.ts +9 -0
- package/dist/components/PaymentFields/PaymentFields.js +7 -0
- package/dist/components/PaymentFields/PaymentFields.js.map +1 -0
- package/dist/components/PaymentForm/Messages.d.ts +88 -0
- package/dist/components/PaymentForm/Messages.js +95 -0
- package/dist/components/PaymentForm/Messages.js.map +1 -0
- package/dist/components/PaymentForm/PaymentForm.d.ts +21 -0
- package/dist/components/PaymentForm/PaymentForm.js +69 -0
- package/dist/components/PaymentForm/PaymentForm.js.map +1 -0
- package/dist/components/StatusScreens/Messages.d.ts +103 -0
- package/dist/components/StatusScreens/Messages.js +108 -0
- package/dist/components/StatusScreens/Messages.js.map +1 -0
- package/dist/components/StatusScreens/StatusScreens.d.ts +23 -0
- package/dist/components/StatusScreens/StatusScreens.js +25 -0
- package/dist/components/StatusScreens/StatusScreens.js.map +1 -0
- package/dist/constants.d.ts +59 -0
- package/dist/constants.js +275 -0
- package/dist/constants.js.map +1 -1
- package/dist/data/hooks/keys.d.ts +14 -0
- package/dist/data/hooks/keys.js +15 -0
- package/dist/data/hooks/keys.js.map +1 -0
- package/dist/data/hooks/useCheckout.d.ts +57 -0
- package/dist/data/hooks/useCheckout.js +249 -0
- package/dist/data/hooks/useCheckout.js.map +1 -0
- package/dist/data/hooks/useCheckoutGate.d.ts +15 -0
- package/dist/data/hooks/useCheckoutGate.js +54 -0
- package/dist/data/hooks/useCheckoutGate.js.map +1 -0
- package/dist/data/hooks/useCheckoutMutations.d.ts +16 -0
- package/dist/data/hooks/useCheckoutMutations.js +131 -0
- package/dist/data/hooks/useCheckoutMutations.js.map +1 -0
- package/dist/data/hooks/useCheckoutQueries.d.ts +35 -0
- package/dist/data/hooks/useCheckoutQueries.js +110 -0
- package/dist/data/hooks/useCheckoutQueries.js.map +1 -0
- package/dist/routes.d.ts +1 -1
- package/dist/routes.js +7 -5
- package/dist/routes.js.map +1 -1
- package/dist/style.scss +13 -0
- package/dist/styles/components/brandMarks.scss +54 -0
- package/dist/styles/components/cartSummary.scss +18 -0
- package/dist/styles/components/checkout.scss +29 -0
- package/dist/styles/components/checkoutStepper.scss +9 -0
- package/dist/styles/components/courseEnrollmentCard.scss +38 -0
- package/dist/styles/components/edxUnlimitedBanner.scss +138 -0
- package/dist/styles/components/enrollmentSummary.scss +13 -0
- package/dist/styles/components/paymentFields.scss +15 -0
- package/dist/styles/components/paymentForm.scss +105 -0
- package/dist/styles/components/statusScreens.scss +29 -0
- package/dist/styles/components/successScreen.scss +0 -0
- package/dist/types.d.ts +222 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/dist/utils/auth.d.ts +7 -0
- package/dist/utils/auth.js +28 -0
- package/dist/utils/auth.js.map +1 -0
- package/dist/utils/billingDetails.d.ts +30 -0
- package/dist/utils/billingDetails.js +47 -0
- package/dist/utils/billingDetails.js.map +1 -0
- package/dist/utils/bootstrapApi.d.ts +20 -0
- package/dist/utils/bootstrapApi.js +142 -0
- package/dist/utils/bootstrapApi.js.map +1 -0
- package/dist/utils/cartApi.d.ts +16 -0
- package/dist/utils/cartApi.js +118 -0
- package/dist/utils/cartApi.js.map +1 -0
- package/dist/utils/checkout.d.ts +6 -0
- package/dist/utils/checkout.js +28 -0
- package/dist/utils/checkout.js.map +1 -0
- package/dist/utils/fetchActiveSubscriptions.d.ts +4 -0
- package/dist/utils/fetchActiveSubscriptions.js +36 -0
- package/dist/utils/fetchActiveSubscriptions.js.map +1 -0
- package/dist/utils/fetchBillingPlans.d.ts +2 -0
- package/dist/utils/fetchBillingPlans.js +48 -0
- package/dist/utils/fetchBillingPlans.js.map +1 -0
- package/dist/utils/graphqlClient.d.ts +16 -0
- package/dist/utils/graphqlClient.js +39 -0
- package/dist/utils/graphqlClient.js.map +1 -0
- package/dist/utils/index.d.ts +3 -0
- package/dist/utils/index.js +17 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/provision.d.ts +25 -0
- package/dist/utils/provision.js +107 -0
- package/dist/utils/provision.js.map +1 -0
- package/dist/utils/queries.d.ts +35 -0
- package/dist/utils/queries.js +168 -0
- package/dist/utils/queries.js.map +1 -0
- package/dist/utils/stripe.d.ts +7 -0
- package/dist/utils/stripe.js +43 -0
- package/dist/utils/stripe.js.map +1 -0
- package/package.json +2 -2
- package/dist/example/ExamplePage.d.ts +0 -2
- package/dist/example/ExamplePage.js +0 -6
- package/dist/example/ExamplePage.js.map +0 -1
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
declare const messages: {
|
|
2
|
+
successHeadline: {
|
|
3
|
+
id: string;
|
|
4
|
+
defaultMessage: string;
|
|
5
|
+
description: string;
|
|
6
|
+
};
|
|
7
|
+
successSubheadline: {
|
|
8
|
+
id: string;
|
|
9
|
+
defaultMessage: string;
|
|
10
|
+
description: string;
|
|
11
|
+
};
|
|
12
|
+
successSubheadlineWithCourse: {
|
|
13
|
+
id: string;
|
|
14
|
+
defaultMessage: string;
|
|
15
|
+
description: string;
|
|
16
|
+
};
|
|
17
|
+
findACourse: {
|
|
18
|
+
id: string;
|
|
19
|
+
defaultMessage: string;
|
|
20
|
+
description: string;
|
|
21
|
+
};
|
|
22
|
+
startCourse: {
|
|
23
|
+
id: string;
|
|
24
|
+
defaultMessage: string;
|
|
25
|
+
description: string;
|
|
26
|
+
};
|
|
27
|
+
viewReceipt: {
|
|
28
|
+
id: string;
|
|
29
|
+
defaultMessage: string;
|
|
30
|
+
description: string;
|
|
31
|
+
};
|
|
32
|
+
whatsIncluded: {
|
|
33
|
+
id: string;
|
|
34
|
+
defaultMessage: string;
|
|
35
|
+
description: string;
|
|
36
|
+
};
|
|
37
|
+
benefit1: {
|
|
38
|
+
id: string;
|
|
39
|
+
defaultMessage: string;
|
|
40
|
+
description: string;
|
|
41
|
+
};
|
|
42
|
+
benefit1WithCourse: {
|
|
43
|
+
id: string;
|
|
44
|
+
defaultMessage: string;
|
|
45
|
+
description: string;
|
|
46
|
+
};
|
|
47
|
+
benefit2: {
|
|
48
|
+
id: string;
|
|
49
|
+
defaultMessage: string;
|
|
50
|
+
description: string;
|
|
51
|
+
};
|
|
52
|
+
benefit3: {
|
|
53
|
+
id: string;
|
|
54
|
+
defaultMessage: string;
|
|
55
|
+
description: string;
|
|
56
|
+
};
|
|
57
|
+
benefit4: {
|
|
58
|
+
id: string;
|
|
59
|
+
defaultMessage: string;
|
|
60
|
+
description: string;
|
|
61
|
+
};
|
|
62
|
+
orderNumber: {
|
|
63
|
+
id: string;
|
|
64
|
+
defaultMessage: string;
|
|
65
|
+
description: string;
|
|
66
|
+
};
|
|
67
|
+
purchaseDate: {
|
|
68
|
+
id: string;
|
|
69
|
+
defaultMessage: string;
|
|
70
|
+
description: string;
|
|
71
|
+
};
|
|
72
|
+
cancelNotice: {
|
|
73
|
+
id: string;
|
|
74
|
+
defaultMessage: string;
|
|
75
|
+
description: string;
|
|
76
|
+
};
|
|
77
|
+
blockedHeading: {
|
|
78
|
+
id: string;
|
|
79
|
+
defaultMessage: string;
|
|
80
|
+
description: string;
|
|
81
|
+
};
|
|
82
|
+
blockedDefault: {
|
|
83
|
+
id: string;
|
|
84
|
+
defaultMessage: string;
|
|
85
|
+
description: string;
|
|
86
|
+
};
|
|
87
|
+
paymentFailedHeading: {
|
|
88
|
+
id: string;
|
|
89
|
+
defaultMessage: string;
|
|
90
|
+
description: string;
|
|
91
|
+
};
|
|
92
|
+
paymentFailedDefault: {
|
|
93
|
+
id: string;
|
|
94
|
+
defaultMessage: string;
|
|
95
|
+
description: string;
|
|
96
|
+
};
|
|
97
|
+
tryAgain: {
|
|
98
|
+
id: string;
|
|
99
|
+
defaultMessage: string;
|
|
100
|
+
description: string;
|
|
101
|
+
};
|
|
102
|
+
};
|
|
103
|
+
export default messages;
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { defineMessages } from '@openedx/frontend-base';
|
|
2
|
+
const messages = defineMessages({
|
|
3
|
+
// SuccessScreen
|
|
4
|
+
successHeadline: {
|
|
5
|
+
id: 'checkout.successScreen.headline',
|
|
6
|
+
defaultMessage: "You're ready to begin learning.",
|
|
7
|
+
description: 'Main headline on the success screen',
|
|
8
|
+
},
|
|
9
|
+
successSubheadline: {
|
|
10
|
+
id: 'checkout.successScreen.subheadline',
|
|
11
|
+
defaultMessage: 'Your subscription is now active. Below is a summary of your order.',
|
|
12
|
+
description: 'Subheadline on the success screen',
|
|
13
|
+
},
|
|
14
|
+
successSubheadlineWithCourse: {
|
|
15
|
+
id: 'checkout.successScreen.subheadlineWithCourse',
|
|
16
|
+
defaultMessage: "Your subscription is now active (and you're enrolled in {courseLabel}). Below is a summary of your order.",
|
|
17
|
+
description: 'Subheadline on the success screen when the user enrolled in a specific course',
|
|
18
|
+
},
|
|
19
|
+
findACourse: {
|
|
20
|
+
id: 'checkout.successScreen.findACourse',
|
|
21
|
+
defaultMessage: "Let's find a course",
|
|
22
|
+
description: 'Primary CTA button on the success screen',
|
|
23
|
+
},
|
|
24
|
+
startCourse: {
|
|
25
|
+
id: 'checkout.successScreen.startCourse',
|
|
26
|
+
defaultMessage: 'Start course',
|
|
27
|
+
description: 'Primary CTA when the user enrolled in a specific course at checkout',
|
|
28
|
+
},
|
|
29
|
+
viewReceipt: {
|
|
30
|
+
id: 'checkout.successScreen.viewReceipt',
|
|
31
|
+
defaultMessage: 'View receipt',
|
|
32
|
+
description: 'View receipt link on the success screen',
|
|
33
|
+
},
|
|
34
|
+
whatsIncluded: {
|
|
35
|
+
id: 'checkout.successScreen.whatsIncluded',
|
|
36
|
+
defaultMessage: "What's included in your subscription",
|
|
37
|
+
description: 'Section heading for subscription benefits list',
|
|
38
|
+
},
|
|
39
|
+
benefit1: {
|
|
40
|
+
id: 'checkout.successScreen.benefit1',
|
|
41
|
+
defaultMessage: 'Access to graded assignments and exams in all courses you enroll in',
|
|
42
|
+
description: 'First subscription benefit',
|
|
43
|
+
},
|
|
44
|
+
benefit1WithCourse: {
|
|
45
|
+
id: 'checkout.successScreen.benefit1WithCourse',
|
|
46
|
+
defaultMessage: 'Access to graded assignments and exams in {courseLabel} and all courses you enroll in',
|
|
47
|
+
description: 'First subscription benefit when a specific course was enrolled at checkout',
|
|
48
|
+
},
|
|
49
|
+
benefit2: {
|
|
50
|
+
id: 'checkout.successScreen.benefit2',
|
|
51
|
+
defaultMessage: 'Shareable certificate upon completion',
|
|
52
|
+
description: 'Second subscription benefit',
|
|
53
|
+
},
|
|
54
|
+
benefit3: {
|
|
55
|
+
id: 'checkout.successScreen.benefit3',
|
|
56
|
+
defaultMessage: '24/7 global support',
|
|
57
|
+
description: 'Third subscription benefit',
|
|
58
|
+
},
|
|
59
|
+
benefit4: {
|
|
60
|
+
id: 'checkout.successScreen.benefit4',
|
|
61
|
+
defaultMessage: 'Early access to edX learning features',
|
|
62
|
+
description: 'Fourth subscription benefit',
|
|
63
|
+
},
|
|
64
|
+
orderNumber: {
|
|
65
|
+
id: 'checkout.successScreen.orderNumber',
|
|
66
|
+
defaultMessage: 'Order number',
|
|
67
|
+
description: 'Order number label',
|
|
68
|
+
},
|
|
69
|
+
purchaseDate: {
|
|
70
|
+
id: 'checkout.successScreen.purchaseDate',
|
|
71
|
+
defaultMessage: 'Purchase date',
|
|
72
|
+
description: 'Purchase date label',
|
|
73
|
+
},
|
|
74
|
+
cancelNotice: {
|
|
75
|
+
id: 'checkout.successScreen.cancelNotice',
|
|
76
|
+
defaultMessage: 'To avoid being charged, cancel your subscription by {trialEnd} from your dashboard.',
|
|
77
|
+
description: 'Trial cancellation reminder at the bottom of the success screen',
|
|
78
|
+
},
|
|
79
|
+
// BlockedScreen
|
|
80
|
+
blockedHeading: {
|
|
81
|
+
id: 'checkout.blockedScreen.heading',
|
|
82
|
+
defaultMessage: 'Order blocked',
|
|
83
|
+
description: 'Heading shown when order is blocked',
|
|
84
|
+
},
|
|
85
|
+
blockedDefault: {
|
|
86
|
+
id: 'checkout.blockedScreen.defaultMessage',
|
|
87
|
+
defaultMessage: 'We were unable to complete this order. Please contact support if you believe this is an error.',
|
|
88
|
+
description: 'Default blocked message when no detail is provided',
|
|
89
|
+
},
|
|
90
|
+
// PaymentFailedScreen
|
|
91
|
+
paymentFailedHeading: {
|
|
92
|
+
id: 'checkout.paymentFailedScreen.heading',
|
|
93
|
+
defaultMessage: 'Payment failed',
|
|
94
|
+
description: 'Heading shown when payment fails',
|
|
95
|
+
},
|
|
96
|
+
paymentFailedDefault: {
|
|
97
|
+
id: 'checkout.paymentFailedScreen.defaultMessage',
|
|
98
|
+
defaultMessage: 'Your card could not be processed. Please check your card details and try again.',
|
|
99
|
+
description: 'Default payment failed message',
|
|
100
|
+
},
|
|
101
|
+
tryAgain: {
|
|
102
|
+
id: 'checkout.paymentFailedScreen.tryAgain',
|
|
103
|
+
defaultMessage: 'Try again',
|
|
104
|
+
description: 'Try again button label',
|
|
105
|
+
},
|
|
106
|
+
});
|
|
107
|
+
export default messages;
|
|
108
|
+
//# sourceMappingURL=Messages.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Messages.js","sourceRoot":"","sources":["../../../src/components/StatusScreens/Messages.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAExD,MAAM,QAAQ,GAAG,cAAc,CAAC;IAC9B,gBAAgB;IAChB,eAAe,EAAE;QACf,EAAE,EAAE,iCAAiC;QACrC,cAAc,EAAE,iCAAiC;QACjD,WAAW,EAAE,qCAAqC;KACnD;IACD,kBAAkB,EAAE;QAClB,EAAE,EAAE,oCAAoC;QACxC,cAAc,EAAE,oEAAoE;QACpF,WAAW,EAAE,mCAAmC;KACjD;IACD,4BAA4B,EAAE;QA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Z,EAAE,EAAE,qCAAqC;QACzC,cAAc,EAAE,qFAAqF;QACrG,WAAW,EAAE,iEAAiE;KAC/E;IAED,gBAAgB;IAChB,cAAc,EAAE;QACd,EAAE,EAAE,gCAAgC;QACpC,cAAc,EAAE,eAAe;QAC/B,WAAW,EAAE,qCAAqC;KACnD;IACD,cAAc,EAAE;QACd,EAAE,EAAE,uCAAuC;QAC3C,cAAc,EAAE,gGAAgG;QAChH,WAAW,EAAE,oDAAoD;KAClE;IAED,sBAAsB;IACtB,oBAAoB,EAAE;QACpB,EAAE,EAAE,sCAAsC;QAC1C,cAAc,EAAE,gBAAgB;QAChC,WAAW,EAAE,kCAAkC;KAChD;IACD,oBAAoB,EAAE;QACpB,EAAE,EAAE,6CAA6C;QACjD,cAAc,EAAE,iFAAiF;QACjG,WAAW,EAAE,gCAAgC;KAC9C;IACD,QAAQ,EAAE;QACR,EAAE,EAAE,uCAAuC;QAC3C,cAAc,EAAE,WAAW;QAC3B,WAAW,EAAE,wBAAwB;KACtC;CACF,CAAC,CAAC;AAEH,eAAe,QAAQ,CAAC","sourcesContent":["import { defineMessages } from '@openedx/frontend-base';\n\nconst messages = defineMessages({\n // SuccessScreen\n successHeadline: {\n id: 'checkout.successScreen.headline',\n defaultMessage: \"You're ready to begin learning.\",\n description: 'Main headline on the success screen',\n },\n successSubheadline: {\n id: 'checkout.successScreen.subheadline',\n defaultMessage: 'Your subscription is now active. Below is a summary of your order.',\n description: 'Subheadline on the success screen',\n },\n successSubheadlineWithCourse: {\n id: 'checkout.successScreen.subheadlineWithCourse',\n defaultMessage: \"Your subscription is now active (and you're enrolled in {courseLabel}). Below is a summary of your order.\",\n description: 'Subheadline on the success screen when the user enrolled in a specific course',\n },\n findACourse: {\n id: 'checkout.successScreen.findACourse',\n defaultMessage: \"Let's find a course\",\n description: 'Primary CTA button on the success screen',\n },\n startCourse: {\n id: 'checkout.successScreen.startCourse',\n defaultMessage: 'Start course',\n description: 'Primary CTA when the user enrolled in a specific course at checkout',\n },\n viewReceipt: {\n id: 'checkout.successScreen.viewReceipt',\n defaultMessage: 'View receipt',\n description: 'View receipt link on the success screen',\n },\n whatsIncluded: {\n id: 'checkout.successScreen.whatsIncluded',\n defaultMessage: \"What's included in your subscription\",\n description: 'Section heading for subscription benefits list',\n },\n benefit1: {\n id: 'checkout.successScreen.benefit1',\n defaultMessage: 'Access to graded assignments and exams in all courses you enroll in',\n description: 'First subscription benefit',\n },\n benefit1WithCourse: {\n id: 'checkout.successScreen.benefit1WithCourse',\n defaultMessage: 'Access to graded assignments and exams in {courseLabel} and all courses you enroll in',\n description: 'First subscription benefit when a specific course was enrolled at checkout',\n },\n benefit2: {\n id: 'checkout.successScreen.benefit2',\n defaultMessage: 'Shareable certificate upon completion',\n description: 'Second subscription benefit',\n },\n benefit3: {\n id: 'checkout.successScreen.benefit3',\n defaultMessage: '24/7 global support',\n description: 'Third subscription benefit',\n },\n benefit4: {\n id: 'checkout.successScreen.benefit4',\n defaultMessage: 'Early access to edX learning features',\n description: 'Fourth subscription benefit',\n },\n orderNumber: {\n id: 'checkout.successScreen.orderNumber',\n defaultMessage: 'Order number',\n description: 'Order number label',\n },\n purchaseDate: {\n id: 'checkout.successScreen.purchaseDate',\n defaultMessage: 'Purchase date',\n description: 'Purchase date label',\n },\n cancelNotice: {\n id: 'checkout.successScreen.cancelNotice',\n defaultMessage: 'To avoid being charged, cancel your subscription by {trialEnd} from your dashboard.',\n description: 'Trial cancellation reminder at the bottom of the success screen',\n },\n\n // BlockedScreen\n blockedHeading: {\n id: 'checkout.blockedScreen.heading',\n defaultMessage: 'Order blocked',\n description: 'Heading shown when order is blocked',\n },\n blockedDefault: {\n id: 'checkout.blockedScreen.defaultMessage',\n defaultMessage: 'We were unable to complete this order. Please contact support if you believe this is an error.',\n description: 'Default blocked message when no detail is provided',\n },\n\n // PaymentFailedScreen\n paymentFailedHeading: {\n id: 'checkout.paymentFailedScreen.heading',\n defaultMessage: 'Payment failed',\n description: 'Heading shown when payment fails',\n },\n paymentFailedDefault: {\n id: 'checkout.paymentFailedScreen.defaultMessage',\n defaultMessage: 'Your card could not be processed. Please check your card details and try again.',\n description: 'Default payment failed message',\n },\n tryAgain: {\n id: 'checkout.paymentFailedScreen.tryAgain',\n defaultMessage: 'Try again',\n description: 'Try again button label',\n },\n});\n\nexport default messages;\n"]}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export interface SuccessScreenProps {
|
|
2
|
+
subscriptionBiId?: string;
|
|
3
|
+
orderNumber?: string;
|
|
4
|
+
purchaseDate?: string;
|
|
5
|
+
trialStart?: string;
|
|
6
|
+
trialEnd?: string;
|
|
7
|
+
onFindCourse?: () => void;
|
|
8
|
+
cardLast4?: string;
|
|
9
|
+
priceToShow?: string;
|
|
10
|
+
cycleToShow?: string;
|
|
11
|
+
/** e.g. "StanfordOnline: Algorithms: Design and Analysis" — enables course-aware copy. */
|
|
12
|
+
courseLabel?: string | null;
|
|
13
|
+
}
|
|
14
|
+
export declare const SuccessScreen: ({ subscriptionBiId, orderNumber, purchaseDate, trialEnd, onFindCourse, courseLabel, }: SuccessScreenProps) => import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
export interface BlockedScreenProps {
|
|
16
|
+
detail?: string;
|
|
17
|
+
}
|
|
18
|
+
export declare const BlockedScreen: ({ detail }: BlockedScreenProps) => import("react/jsx-runtime").JSX.Element;
|
|
19
|
+
export interface PaymentFailedScreenProps {
|
|
20
|
+
detail?: string;
|
|
21
|
+
onBack: () => void;
|
|
22
|
+
}
|
|
23
|
+
export declare const PaymentFailedScreen: ({ detail, onBack, }: PaymentFailedScreenProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Button, Icon } from '@openedx/paragon';
|
|
3
|
+
import { Error as ErrorIcon, Block } from '@openedx/paragon/icons';
|
|
4
|
+
import { useIntl } from '@openedx/frontend-base';
|
|
5
|
+
import messages from './Messages';
|
|
6
|
+
export const SuccessScreen = ({ subscriptionBiId, orderNumber, purchaseDate, trialEnd, onFindCourse, courseLabel = null, }) => {
|
|
7
|
+
var _a;
|
|
8
|
+
const { formatMessage } = useIntl();
|
|
9
|
+
const displayOrderNumber = (_a = orderNumber !== null && orderNumber !== void 0 ? orderNumber : subscriptionBiId) !== null && _a !== void 0 ? _a : '—';
|
|
10
|
+
const hasCourse = !!courseLabel;
|
|
11
|
+
return (_jsxs("div", { className: "success-screen", children: [_jsx("h1", { className: "success-screen__headline font-weight-bold mb-2", children: formatMessage(messages.successHeadline) }), _jsx("p", { className: "text-muted mb-4", children: hasCourse
|
|
12
|
+
? formatMessage(messages.successSubheadlineWithCourse, { courseLabel })
|
|
13
|
+
: formatMessage(messages.successSubheadline) }), _jsx("div", { className: "success-screen__ctas d-flex align-items-center mb-5", children: _jsx(Button, { variant: "brand", className: "success-screen__cta-primary mr-3", onClick: onFindCourse, children: formatMessage(hasCourse ? messages.startCourse : messages.findACourse) }) }), _jsxs("div", { className: "row", children: [_jsxs("div", { className: "col-12 col-md-7 mb-4", children: [_jsx("h2", { className: "h5 font-weight-bold mb-3", children: formatMessage(messages.whatsIncluded) }), _jsxs("ul", { className: "success-screen__benefits pl-4", children: [_jsx("li", { className: "mb-2", children: hasCourse
|
|
14
|
+
? formatMessage(messages.benefit1WithCourse, { courseLabel })
|
|
15
|
+
: formatMessage(messages.benefit1) }), _jsx("li", { className: "mb-2", children: formatMessage(messages.benefit2) }), _jsx("li", { className: "mb-2", children: formatMessage(messages.benefit3) }), _jsx("li", { className: "mb-2", children: formatMessage(messages.benefit4) })] })] }), _jsxs("div", { className: "col-12 col-md-5 mb-4", children: [displayOrderNumber && (_jsxs("div", { className: "mb-3", children: [_jsx("p", { className: "font-weight-bold mb-0", children: formatMessage(messages.orderNumber) }), _jsx("p", { className: "text-muted mb-0", children: displayOrderNumber })] })), purchaseDate && (_jsxs("div", { children: [_jsx("p", { className: "font-weight-bold mb-0", children: formatMessage(messages.purchaseDate) }), _jsx("p", { className: "text-muted mb-0", children: purchaseDate })] }))] })] }), _jsx("hr", {}), trialEnd && (_jsx("p", { className: "text-muted small mt-3", children: formatMessage(messages.cancelNotice, { trialEnd }) }))] }));
|
|
16
|
+
};
|
|
17
|
+
export const BlockedScreen = ({ detail }) => {
|
|
18
|
+
const { formatMessage } = useIntl();
|
|
19
|
+
return (_jsxs("div", { className: "blocked-screen text-center py-5", children: [_jsx(Icon, { src: Block, className: "blocked-screen__icon text-danger mb-3" }), _jsx("h3", { className: "font-weight-bold", children: formatMessage(messages.blockedHeading) }), _jsx("p", { className: "text-muted", children: detail || formatMessage(messages.blockedDefault) })] }));
|
|
20
|
+
};
|
|
21
|
+
export const PaymentFailedScreen = ({ detail, onBack, }) => {
|
|
22
|
+
const { formatMessage } = useIntl();
|
|
23
|
+
return (_jsxs("div", { className: "payment-failed-screen text-center py-4", children: [_jsx(Icon, { src: ErrorIcon, className: "payment-failed-screen__icon text-danger mb-3" }), _jsx("h3", { className: "font-weight-bold mb-2", children: formatMessage(messages.paymentFailedHeading) }), _jsx("p", { className: "payment-failed-screen__detail text-muted mb-4", children: detail || formatMessage(messages.paymentFailedDefault) }), _jsx(Button, { variant: "brand", className: "w-100", onClick: onBack, children: formatMessage(messages.tryAgain) })] }));
|
|
24
|
+
};
|
|
25
|
+
//# sourceMappingURL=StatusScreens.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StatusScreens.js","sourceRoot":"","sources":["../../../src/components/StatusScreens/StatusScreens.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,KAAK,IAAI,SAAS,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAC;AACnE,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,QAAQ,MAAM,YAAY,CAAC;AAoBlC,MAAM,CAAC,M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IAAI,aAAa,CAAC,QAAQ,CAAC,cAAc,CAAC,GAC/C,IACA,CACP,CAAC;AACJ,CAAC,CAAC;AAWF,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,EAClC,MAAM,EACN,MAAM,GACmB,EAAE,EAAE;IAC7B,MAAM,EAAE,aAAa,EAAE,GAAG,OAAO,EAAE,CAAC;IACpC,OAAO,CACL,eAAK,SAAS,EAAC,wCAAwC,aACrD,KAAC,IAAI,IACH,GAAG,EAAE,SAAS,EACd,SAAS,EAAC,8CAA8C,GACxD,EACF,aAAI,SAAS,EAAC,uBAAuB,YAClC,aAAa,CAAC,QAAQ,CAAC,oBAAoB,CAAC,GAC1C,EACL,YAAG,SAAS,EAAC,+CAA+C,YACzD,MAAM,IAAI,aAAa,CAAC,QAAQ,CAAC,oBAAoB,CAAC,GACrD,EACJ,KAAC,MAAM,IAAC,OAAO,EAAC,OAAO,EAAC,SAAS,EAAC,OAAO,EAAC,OAAO,EAAE,MAAM,YACtD,aAAa,CAAC,QAAQ,CAAC,QAAQ,CAAC,GAC1B,IACL,CACP,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import React from 'react';\nimport { Button, Icon } from '@openedx/paragon';\nimport { Error as ErrorIcon, Block } from '@openedx/paragon/icons';\nimport { useIntl } from '@openedx/frontend-base';\nimport messages from './Messages';\n\n// ---------------------------------------------------------------------------\n// SuccessScreen\n// ---------------------------------------------------------------------------\n\nexport interface SuccessScreenProps {\n subscriptionBiId?: string,\n orderNumber?: string,\n purchaseDate?: string,\n trialStart?: string,\n trialEnd?: string,\n onFindCourse?: () => void,\n cardLast4?: string,\n priceToShow?: string,\n cycleToShow?: string,\n /** e.g. \"StanfordOnline: Algorithms: Design and Analysis\" — enables course-aware copy. */\n courseLabel?: string | null,\n}\n\nexport const SuccessScreen = ({\n subscriptionBiId,\n orderNumber,\n purchaseDate,\n trialEnd,\n onFindCourse,\n courseLabel = null,\n}: SuccessScreenProps) => {\n const { formatMessage } = useIntl();\n\n const displayOrderNumber = orderNumber ?? subscriptionBiId ?? '—';\n const hasCourse = !!courseLabel;\n\n return (\n <div className=\"success-screen\">\n <h1 className=\"success-screen__headline font-weight-bold mb-2\">\n {formatMessage(messages.successHeadline)}\n </h1>\n\n <p className=\"text-muted mb-4\">\n {hasCourse\n ? formatMessage(messages.successSubheadlineWithCourse, { courseLabel })\n : formatMessage(messages.successSubheadline)}\n </p>\n\n {/* ── CTAs ── */}\n <div className=\"success-screen__ctas d-flex align-items-center mb-5\">\n <Button\n variant=\"brand\"\n className=\"success-screen__cta-primary mr-3\"\n onClick={onFindCourse}\n >\n {formatMessage(hasCourse ? messages.startCourse : messages.findACourse)}\n </Button>\n {/* View receipt button hidden temporarily */}\n </div>\n\n {/* ── Two column: benefits + order details ── */}\n <div className=\"row\">\n <div className=\"col-12 col-md-7 mb-4\">\n <h2 className=\"h5 font-weight-bold mb-3\">\n {formatMessage(messages.whatsIncluded)}\n </h2>\n <ul className=\"success-screen__benefits pl-4\">\n <li className=\"mb-2\">\n {hasCourse\n ? formatMessage(messages.benefit1WithCourse, { courseLabel })\n : formatMessage(messages.benefit1)}\n </li>\n <li className=\"mb-2\">{formatMessage(messages.benefit2)}</li>\n <li className=\"mb-2\">{formatMessage(messages.benefit3)}</li>\n <li className=\"mb-2\">{formatMessage(messages.benefit4)}</li>\n </ul>\n </div>\n\n <div className=\"col-12 col-md-5 mb-4\">\n {displayOrderNumber && (\n <div className=\"mb-3\">\n <p className=\"font-weight-bold mb-0\">\n {formatMessage(messages.orderNumber)}\n </p>\n <p className=\"text-muted mb-0\">{displayOrderNumber}</p>\n </div>\n )}\n {purchaseDate && (\n <div>\n <p className=\"font-weight-bold mb-0\">\n {formatMessage(messages.purchaseDate)}\n </p>\n <p className=\"text-muted mb-0\">{purchaseDate}</p>\n </div>\n )}\n </div>\n </div>\n\n <hr />\n\n {/* ── Trial cancellation notice ── */}\n {trialEnd && (\n <p className=\"text-muted small mt-3\">\n {formatMessage(messages.cancelNotice, { trialEnd })}\n </p>\n )}\n </div>\n );\n};\n\n// ---------------------------------------------------------------------------\n// BlockedScreen\n// ---------------------------------------------------------------------------\n\nexport interface BlockedScreenProps {\n detail?: string,\n}\n\nexport const BlockedScreen = ({ detail }: BlockedScreenProps) => {\n const { formatMessage } = useIntl();\n return (\n <div className=\"blocked-screen text-center py-5\">\n <Icon src={Block} className=\"blocked-screen__icon text-danger mb-3\" />\n <h3 className=\"font-weight-bold\">\n {formatMessage(messages.blockedHeading)}\n </h3>\n <p className=\"text-muted\">\n {detail || formatMessage(messages.blockedDefault)}\n </p>\n </div>\n );\n};\n\n// ---------------------------------------------------------------------------\n// PaymentFailedScreen\n// ---------------------------------------------------------------------------\n\nexport interface PaymentFailedScreenProps {\n detail?: string,\n onBack: () => void,\n}\n\nexport const PaymentFailedScreen = ({\n detail,\n onBack,\n}: PaymentFailedScreenProps) => {\n const { formatMessage } = useIntl();\n return (\n <div className=\"payment-failed-screen text-center py-4\">\n <Icon\n src={ErrorIcon}\n className=\"payment-failed-screen__icon text-danger mb-3\"\n />\n <h3 className=\"font-weight-bold mb-2\">\n {formatMessage(messages.paymentFailedHeading)}\n </h3>\n <p className=\"payment-failed-screen__detail text-muted mb-4\">\n {detail || formatMessage(messages.paymentFailedDefault)}\n </p>\n <Button variant=\"brand\" className=\"w-100\" onClick={onBack}>\n {formatMessage(messages.tryAgain)}\n </Button>\n </div>\n );\n};\n"]}
|
package/dist/constants.d.ts
CHANGED
|
@@ -1,2 +1,61 @@
|
|
|
1
|
+
import type { CSSProperties } from 'react';
|
|
1
2
|
export declare const appId = "org.openedx.frontend.app.subscription.manage";
|
|
2
3
|
export declare const subscriptionManageRole = "org.openedx.frontend.role.subscription.manage";
|
|
4
|
+
export declare const STATUS: {
|
|
5
|
+
readonly IN_CART: "IN_CART";
|
|
6
|
+
readonly CONFIRM: "CONFIRM";
|
|
7
|
+
readonly SANCTION_STARTED: "SANCTION_STARTED";
|
|
8
|
+
readonly SANCTION_PASSED: "SANCTION_PASSED";
|
|
9
|
+
readonly SANCTION_BLOCK: "SANCTION_BLOCK";
|
|
10
|
+
readonly STRIPE_STARTED: "STRIPE_STARTED";
|
|
11
|
+
readonly STRIPE_SUBSCRIBED: "STRIPE_SUBSCRIBED";
|
|
12
|
+
readonly STRIPE_CONFIRMATION_REQUIRED: "STRIPE_CONFIRMATION_REQUIRED";
|
|
13
|
+
readonly STRIPE_FAIL: "STRIPE_FAIL";
|
|
14
|
+
readonly SUBSCRIPTION_CREATED: "SUBSCRIPTION_CREATED";
|
|
15
|
+
};
|
|
16
|
+
export type Status = typeof STATUS[keyof typeof STATUS];
|
|
17
|
+
export type Phase = 'init' | 'ready' | 'processing' | 'threeds' | 'success' | 'blocked' | 'failed';
|
|
18
|
+
export declare const TERMINAL_STATES: Status[];
|
|
19
|
+
export declare const STATUS_LABELS: Record<string, string>;
|
|
20
|
+
export declare const isTerminalStatus: (status: Status | null | undefined) => boolean;
|
|
21
|
+
/** UI phase derived from the raw bpStatus code + cart readiness. */
|
|
22
|
+
export declare function phaseFor(status: Status | null, ready: boolean): Phase;
|
|
23
|
+
export declare const DEFAULTS: {
|
|
24
|
+
apiUrl: string;
|
|
25
|
+
confirmIntentUrl: string;
|
|
26
|
+
customerUid: string;
|
|
27
|
+
salableUid: string;
|
|
28
|
+
billingPlanUid: string;
|
|
29
|
+
};
|
|
30
|
+
export declare const LS_KEYS: {
|
|
31
|
+
biId: string;
|
|
32
|
+
uid: string;
|
|
33
|
+
};
|
|
34
|
+
/** When false, the subscriber check is skipped — already-subscribed users are not redirected. */
|
|
35
|
+
export declare const GATE_CHECK_SUBSCRIBER = false;
|
|
36
|
+
/** When false, the country check is skipped — all countries can access checkout. */
|
|
37
|
+
export declare const GATE_CHECK_COUNTRY = true;
|
|
38
|
+
/**
|
|
39
|
+
* ISO 3166-1 alpha-2 country codes that are permitted to complete checkout.
|
|
40
|
+
* Add or remove codes here to open or restrict access by country.
|
|
41
|
+
* e.g. ['US', 'CA', 'GB'] to allow US, Canada, and UK.
|
|
42
|
+
*/
|
|
43
|
+
export declare const ALLOWED_CHECKOUT_COUNTRIES: readonly string[];
|
|
44
|
+
/**
|
|
45
|
+
* ISO 3166-1 alpha-2 country codes that require the extra billing-consent checkbox.
|
|
46
|
+
* Add or remove codes here to control which residents see the second checkbox.
|
|
47
|
+
*/
|
|
48
|
+
export declare const COUNTRIES_REQUIRING_EXTRA_CONFIRM: readonly string[];
|
|
49
|
+
export declare const COUNTRIES: readonly (readonly [string, string])[];
|
|
50
|
+
export declare const STRIPE_FIELD_STYLE: CSSProperties;
|
|
51
|
+
export declare const STRIPE_ELEMENT_OPTS: {
|
|
52
|
+
style: {
|
|
53
|
+
base: {
|
|
54
|
+
fontSize: string;
|
|
55
|
+
color: string;
|
|
56
|
+
'::placeholder': {
|
|
57
|
+
color: string;
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
};
|
|
61
|
+
};
|
package/dist/constants.js
CHANGED
|
@@ -1,3 +1,278 @@
|
|
|
1
1
|
export const appId = 'org.openedx.frontend.app.subscription.manage';
|
|
2
2
|
export const subscriptionManageRole = 'org.openedx.frontend.role.subscription.manage';
|
|
3
|
+
// --- Cart BI state machine ---------------------------------------------------
|
|
4
|
+
export const STATUS = {
|
|
5
|
+
IN_CART: 'IN_CART',
|
|
6
|
+
CONFIRM: 'CONFIRM',
|
|
7
|
+
SANCTION_STARTED: 'SANCTION_STARTED',
|
|
8
|
+
SANCTION_PASSED: 'SANCTION_PASSED',
|
|
9
|
+
SANCTION_BLOCK: 'SANCTION_BLOCK',
|
|
10
|
+
STRIPE_STARTED: 'STRIPE_STARTED',
|
|
11
|
+
STRIPE_SUBSCRIBED: 'STRIPE_SUBSCRIBED',
|
|
12
|
+
STRIPE_CONFIRMATION_REQUIRED: 'STRIPE_CONFIRMATION_REQUIRED',
|
|
13
|
+
STRIPE_FAIL: 'STRIPE_FAIL',
|
|
14
|
+
SUBSCRIPTION_CREATED: 'SUBSCRIPTION_CREATED',
|
|
15
|
+
};
|
|
16
|
+
export const TERMINAL_STATES = [
|
|
17
|
+
STATUS.SUBSCRIPTION_CREATED,
|
|
18
|
+
STATUS.SANCTION_BLOCK,
|
|
19
|
+
STATUS.STRIPE_FAIL,
|
|
20
|
+
];
|
|
21
|
+
export const STATUS_LABELS = {
|
|
22
|
+
IN_CART: 'Cart created',
|
|
23
|
+
CONFIRM: 'Order confirmed',
|
|
24
|
+
SANCTION_STARTED: 'Checking sanctions…',
|
|
25
|
+
SANCTION_PASSED: 'Sanctions passed — setting up your account…',
|
|
26
|
+
SANCTION_BLOCK: 'Order blocked',
|
|
27
|
+
STRIPE_STARTED: 'Setting up your subscription…',
|
|
28
|
+
STRIPE_CONFIRMATION_REQUIRED: 'Card verification required',
|
|
29
|
+
STRIPE_SUBSCRIBED: 'Card verified — finalizing…',
|
|
30
|
+
STRIPE_FAIL: 'Payment failed',
|
|
31
|
+
SUBSCRIPTION_CREATED: 'Subscription created',
|
|
32
|
+
};
|
|
33
|
+
export const isTerminalStatus = (status) => TERMINAL_STATES.includes(status);
|
|
34
|
+
/** UI phase derived from the raw bpStatus code + cart readiness. */
|
|
35
|
+
export function phaseFor(status, ready) {
|
|
36
|
+
if (status === STATUS.SUBSCRIPTION_CREATED)
|
|
37
|
+
return 'success';
|
|
38
|
+
if (status === STATUS.SANCTION_BLOCK)
|
|
39
|
+
return 'blocked';
|
|
40
|
+
if (status === STATUS.STRIPE_FAIL)
|
|
41
|
+
return 'failed';
|
|
42
|
+
if (status && status !== STATUS.IN_CART)
|
|
43
|
+
return 'processing';
|
|
44
|
+
return ready ? 'ready' : 'init';
|
|
45
|
+
}
|
|
46
|
+
// --- Dev defaults (match the local test harness) -----------------------------
|
|
47
|
+
export const DEFAULTS = {
|
|
48
|
+
apiUrl: '/api/graphql',
|
|
49
|
+
confirmIntentUrl: '/api/stripe/confirm-pi',
|
|
50
|
+
customerUid: '019d2bde-f769-743d-88f9-8bf0d1a7a002',
|
|
51
|
+
salableUid: '019d2ce7-05bc-7dd6-b141-e32df9ac86c1',
|
|
52
|
+
billingPlanUid: '019d2ce7-05c0-7188-81b0-8eb747b41b0f',
|
|
53
|
+
};
|
|
54
|
+
export const LS_KEYS = { biId: 'twou.cartBiId', uid: 'twou.cartUid' };
|
|
55
|
+
// ─── Checkout gate feature flags (dev controls) ───────────────────────────────
|
|
56
|
+
// Set to false during development to bypass the corresponding gate check.
|
|
57
|
+
// Both should be true in production.
|
|
58
|
+
/** When false, the subscriber check is skipped — already-subscribed users are not redirected. */
|
|
59
|
+
export const GATE_CHECK_SUBSCRIBER = false;
|
|
60
|
+
/** When false, the country check is skipped — all countries can access checkout. */
|
|
61
|
+
export const GATE_CHECK_COUNTRY = true;
|
|
62
|
+
/**
|
|
63
|
+
* ISO 3166-1 alpha-2 country codes that are permitted to complete checkout.
|
|
64
|
+
* Add or remove codes here to open or restrict access by country.
|
|
65
|
+
* e.g. ['US', 'CA', 'GB'] to allow US, Canada, and UK.
|
|
66
|
+
*/
|
|
67
|
+
export const ALLOWED_CHECKOUT_COUNTRIES = ['US', 'CA'];
|
|
68
|
+
/**
|
|
69
|
+
* ISO 3166-1 alpha-2 country codes that require the extra billing-consent checkbox.
|
|
70
|
+
* Add or remove codes here to control which residents see the second checkbox.
|
|
71
|
+
*/
|
|
72
|
+
export const COUNTRIES_REQUIRING_EXTRA_CONFIRM = ['GB', 'CA'];
|
|
73
|
+
export const COUNTRIES = [
|
|
74
|
+
['AF', 'Afghanistan'],
|
|
75
|
+
['AL', 'Albania'],
|
|
76
|
+
['DZ', 'Algeria'],
|
|
77
|
+
['AD', 'Andorra'],
|
|
78
|
+
['AO', 'Angola'],
|
|
79
|
+
['AG', 'Antigua and Barbuda'],
|
|
80
|
+
['AR', 'Argentina'],
|
|
81
|
+
['AM', 'Armenia'],
|
|
82
|
+
['AU', 'Australia'],
|
|
83
|
+
['AT', 'Austria'],
|
|
84
|
+
['AZ', 'Azerbaijan'],
|
|
85
|
+
['BS', 'Bahamas'],
|
|
86
|
+
['BH', 'Bahrain'],
|
|
87
|
+
['BD', 'Bangladesh'],
|
|
88
|
+
['BB', 'Barbados'],
|
|
89
|
+
['BY', 'Belarus'],
|
|
90
|
+
['BE', 'Belgium'],
|
|
91
|
+
['BZ', 'Belize'],
|
|
92
|
+
['BJ', 'Benin'],
|
|
93
|
+
['BT', 'Bhutan'],
|
|
94
|
+
['BO', 'Bolivia'],
|
|
95
|
+
['BA', 'Bosnia and Herzegovina'],
|
|
96
|
+
['BW', 'Botswana'],
|
|
97
|
+
['BR', 'Brazil'],
|
|
98
|
+
['BN', 'Brunei'],
|
|
99
|
+
['BG', 'Bulgaria'],
|
|
100
|
+
['BF', 'Burkina Faso'],
|
|
101
|
+
['BI', 'Burundi'],
|
|
102
|
+
['CV', 'Cabo Verde'],
|
|
103
|
+
['KH', 'Cambodia'],
|
|
104
|
+
['CM', 'Cameroon'],
|
|
105
|
+
['CA', 'Canada'],
|
|
106
|
+
['CF', 'Central African Republic'],
|
|
107
|
+
['TD', 'Chad'],
|
|
108
|
+
['CL', 'Chile'],
|
|
109
|
+
['CN', 'China'],
|
|
110
|
+
['CO', 'Colombia'],
|
|
111
|
+
['KM', 'Comoros'],
|
|
112
|
+
['CG', 'Congo (Congo-Brazzaville)'],
|
|
113
|
+
['CR', 'Costa Rica'],
|
|
114
|
+
['HR', 'Croatia'],
|
|
115
|
+
['CU', 'Cuba'],
|
|
116
|
+
['CY', 'Cyprus'],
|
|
117
|
+
['CZ', 'Czechia (Czech Republic)'],
|
|
118
|
+
['CD', 'Democratic Republic of the Congo'],
|
|
119
|
+
['DK', 'Denmark'],
|
|
120
|
+
['DJ', 'Djibouti'],
|
|
121
|
+
['DM', 'Dominica'],
|
|
122
|
+
['DO', 'Dominican Republic'],
|
|
123
|
+
['EC', 'Ecuador'],
|
|
124
|
+
['EG', 'Egypt'],
|
|
125
|
+
['SV', 'El Salvador'],
|
|
126
|
+
['GQ', 'Equatorial Guinea'],
|
|
127
|
+
['ER', 'Eritrea'],
|
|
128
|
+
['EE', 'Estonia'],
|
|
129
|
+
['SZ', 'Eswatini'],
|
|
130
|
+
['ET', 'Ethiopia'],
|
|
131
|
+
['FJ', 'Fiji'],
|
|
132
|
+
['FI', 'Finland'],
|
|
133
|
+
['FR', 'France'],
|
|
134
|
+
['GA', 'Gabon'],
|
|
135
|
+
['GM', 'Gambia'],
|
|
136
|
+
['GE', 'Georgia'],
|
|
137
|
+
['DE', 'Germany'],
|
|
138
|
+
['GH', 'Ghana'],
|
|
139
|
+
['GR', 'Greece'],
|
|
140
|
+
['GD', 'Grenada'],
|
|
141
|
+
['GT', 'Guatemala'],
|
|
142
|
+
['GN', 'Guinea'],
|
|
143
|
+
['GW', 'Guinea-Bissau'],
|
|
144
|
+
['GY', 'Guyana'],
|
|
145
|
+
['HT', 'Haiti'],
|
|
146
|
+
['VA', 'Holy See (Vatican City)'],
|
|
147
|
+
['HN', 'Honduras'],
|
|
148
|
+
['HU', 'Hungary'],
|
|
149
|
+
['IS', 'Iceland'],
|
|
150
|
+
['IN', 'India'],
|
|
151
|
+
['ID', 'Indonesia'],
|
|
152
|
+
['IR', 'Iran'],
|
|
153
|
+
['IQ', 'Iraq'],
|
|
154
|
+
['IE', 'Ireland'],
|
|
155
|
+
['IL', 'Israel'],
|
|
156
|
+
['IT', 'Italy'],
|
|
157
|
+
['CI', "Ivory Coast (Côte d'Ivoire)"],
|
|
158
|
+
['JM', 'Jamaica'],
|
|
159
|
+
['JP', 'Japan'],
|
|
160
|
+
['JO', 'Jordan'],
|
|
161
|
+
['KZ', 'Kazakhstan'],
|
|
162
|
+
['KE', 'Kenya'],
|
|
163
|
+
['KI', 'Kiribati'],
|
|
164
|
+
['KW', 'Kuwait'],
|
|
165
|
+
['KG', 'Kyrgyzstan'],
|
|
166
|
+
['LA', 'Laos'],
|
|
167
|
+
['LV', 'Latvia'],
|
|
168
|
+
['LB', 'Lebanon'],
|
|
169
|
+
['LS', 'Lesotho'],
|
|
170
|
+
['LR', 'Liberia'],
|
|
171
|
+
['LY', 'Libya'],
|
|
172
|
+
['LI', 'Liechtenstein'],
|
|
173
|
+
['LT', 'Lithuania'],
|
|
174
|
+
['LU', 'Luxembourg'],
|
|
175
|
+
['MG', 'Madagascar'],
|
|
176
|
+
['MW', 'Malawi'],
|
|
177
|
+
['MY', 'Malaysia'],
|
|
178
|
+
['MV', 'Maldives'],
|
|
179
|
+
['ML', 'Mali'],
|
|
180
|
+
['MT', 'Malta'],
|
|
181
|
+
['MH', 'Marshall Islands'],
|
|
182
|
+
['MR', 'Mauritania'],
|
|
183
|
+
['MU', 'Mauritius'],
|
|
184
|
+
['MX', 'Mexico'],
|
|
185
|
+
['FM', 'Micronesia'],
|
|
186
|
+
['MD', 'Moldova'],
|
|
187
|
+
['MC', 'Monaco'],
|
|
188
|
+
['MN', 'Mongolia'],
|
|
189
|
+
['ME', 'Montenegro'],
|
|
190
|
+
['MA', 'Morocco'],
|
|
191
|
+
['MZ', 'Mozambique'],
|
|
192
|
+
['MM', 'Myanmar (Burma)'],
|
|
193
|
+
['NA', 'Namibia'],
|
|
194
|
+
['NR', 'Nauru'],
|
|
195
|
+
['NP', 'Nepal'],
|
|
196
|
+
['NL', 'Netherlands'],
|
|
197
|
+
['NZ', 'New Zealand'],
|
|
198
|
+
['NI', 'Nicaragua'],
|
|
199
|
+
['NE', 'Niger'],
|
|
200
|
+
['NG', 'Nigeria'],
|
|
201
|
+
['KP', 'North Korea'],
|
|
202
|
+
['MK', 'North Macedonia'],
|
|
203
|
+
['NO', 'Norway'],
|
|
204
|
+
['OM', 'Oman'],
|
|
205
|
+
['PK', 'Pakistan'],
|
|
206
|
+
['PW', 'Palau'],
|
|
207
|
+
['PS', 'Palestine State'],
|
|
208
|
+
['PA', 'Panama'],
|
|
209
|
+
['PG', 'Papua New Guinea'],
|
|
210
|
+
['PY', 'Paraguay'],
|
|
211
|
+
['PE', 'Peru'],
|
|
212
|
+
['PH', 'Philippines'],
|
|
213
|
+
['PL', 'Poland'],
|
|
214
|
+
['PT', 'Portugal'],
|
|
215
|
+
['QA', 'Qatar'],
|
|
216
|
+
['RO', 'Romania'],
|
|
217
|
+
['RU', 'Russia'],
|
|
218
|
+
['RW', 'Rwanda'],
|
|
219
|
+
['KN', 'Saint Kitts and Nevis'],
|
|
220
|
+
['LC', 'Saint Lucia'],
|
|
221
|
+
['VC', 'Saint Vincent and the Grenadines'],
|
|
222
|
+
['WS', 'Samoa'],
|
|
223
|
+
['SM', 'San Marino'],
|
|
224
|
+
['ST', 'Sao Tome and Principe'],
|
|
225
|
+
['SA', 'Saudi Arabia'],
|
|
226
|
+
['SN', 'Senegal'],
|
|
227
|
+
['RS', 'Serbia'],
|
|
228
|
+
['SC', 'Seychelles'],
|
|
229
|
+
['SL', 'Sierra Leone'],
|
|
230
|
+
['SG', 'Singapore'],
|
|
231
|
+
['SK', 'Slovakia'],
|
|
232
|
+
['SI', 'Slovenia'],
|
|
233
|
+
['SB', 'Solomon Islands'],
|
|
234
|
+
['SO', 'Somalia'],
|
|
235
|
+
['ZA', 'South Africa'],
|
|
236
|
+
['KR', 'South Korea'],
|
|
237
|
+
['SS', 'South Sudan'],
|
|
238
|
+
['ES', 'Spain'],
|
|
239
|
+
['LK', 'Sri Lanka'],
|
|
240
|
+
['SD', 'Sudan'],
|
|
241
|
+
['SR', 'Suriname'],
|
|
242
|
+
['SE', 'Sweden'],
|
|
243
|
+
['CH', 'Switzerland'],
|
|
244
|
+
['SY', 'Syria'],
|
|
245
|
+
['TJ', 'Tajikistan'],
|
|
246
|
+
['TZ', 'Tanzania'],
|
|
247
|
+
['TH', 'Thailand'],
|
|
248
|
+
['TL', 'Timor-Leste'],
|
|
249
|
+
['TG', 'Togo'],
|
|
250
|
+
['TO', 'Tonga'],
|
|
251
|
+
['TT', 'Trinidad and Tobago'],
|
|
252
|
+
['TN', 'Tunisia'],
|
|
253
|
+
['TR', 'Turkey'],
|
|
254
|
+
['TM', 'Turkmenistan'],
|
|
255
|
+
['TV', 'Tuvalu'],
|
|
256
|
+
['UG', 'Uganda'],
|
|
257
|
+
['UA', 'Ukraine'],
|
|
258
|
+
['AE', 'United Arab Emirates'],
|
|
259
|
+
['GB', 'United Kingdom'],
|
|
260
|
+
['US', 'United States'],
|
|
261
|
+
['UY', 'Uruguay'],
|
|
262
|
+
['UZ', 'Uzbekistan'],
|
|
263
|
+
['VU', 'Vanuatu'],
|
|
264
|
+
['VE', 'Venezuela'],
|
|
265
|
+
['VN', 'Vietnam'],
|
|
266
|
+
['YE', 'Yemen'],
|
|
267
|
+
['ZM', 'Zambia'],
|
|
268
|
+
['ZW', 'Zimbabwe'],
|
|
269
|
+
];
|
|
270
|
+
// --- Stripe Element presentation ---------------------------------------------
|
|
271
|
+
// A div that hosts a Stripe Element but reads like a Paragon input.
|
|
272
|
+
export const STRIPE_FIELD_STYLE = {
|
|
273
|
+
height: 'auto', minHeight: '2.875rem', display: 'flex', alignItems: 'center',
|
|
274
|
+
};
|
|
275
|
+
export const STRIPE_ELEMENT_OPTS = {
|
|
276
|
+
style: { base: { fontSize: '16px', color: '#1a1a1a', '::placeholder': { color: '#8f8f8f' } } },
|
|
277
|
+
};
|
|
3
278
|
//# sourceMappingURL=constants.js.map
|