tf-checkout-react 1.0.103 → 1.0.106

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.
Files changed (96) hide show
  1. package/dist/api/index.d.ts +3 -1
  2. package/dist/components/common/CustomField.d.ts +1 -1
  3. package/dist/components/common/DatePickerField.d.ts +14 -0
  4. package/dist/components/common/RedirectModal.d.ts +7 -0
  5. package/dist/components/countdown/index.d.ts +3 -1
  6. package/dist/components/orderDetailsContainer/ticketsTable.d.ts +2 -0
  7. package/dist/components/rsvpContainer/index.d.ts +7 -0
  8. package/dist/components/ticketResale/index.d.ts +5 -3
  9. package/dist/components/ticketsContainer/AccessCodeSection.d.ts +7 -0
  10. package/dist/components/ticketsContainer/PromoCodeSection.d.ts +5 -9
  11. package/dist/components/ticketsContainer/TicketsSection.d.ts +6 -3
  12. package/dist/components/ticketsContainer/index.d.ts +9 -2
  13. package/dist/components/timerWidget/index.d.ts +3 -3
  14. package/dist/images/cross.svg +44 -0
  15. package/dist/images/done.svg +3 -3
  16. package/dist/index.d.ts +2 -0
  17. package/dist/tf-checkout-react.cjs.development.js +639 -223
  18. package/dist/tf-checkout-react.cjs.development.js.map +1 -1
  19. package/dist/tf-checkout-react.cjs.production.min.js +1 -1
  20. package/dist/tf-checkout-react.cjs.production.min.js.map +1 -1
  21. package/dist/tf-checkout-react.esm.js +645 -231
  22. package/dist/tf-checkout-react.esm.js.map +1 -1
  23. package/dist/tf-checkout-styles.css +1 -1
  24. package/package.json +89 -89
  25. package/src/.DS_Store +0 -0
  26. package/src/.d.ts +2 -2
  27. package/src/api/index.ts +300 -278
  28. package/src/assets/images/cross.svg +44 -0
  29. package/src/assets/images/done.svg +3 -3
  30. package/src/components/.DS_Store +0 -0
  31. package/src/components/billing-info-container/index.tsx +811 -799
  32. package/src/components/billing-info-container/style.css +105 -105
  33. package/src/components/billing-info-container/utils.ts +225 -224
  34. package/src/components/common/CheckboxField.tsx +41 -41
  35. package/src/components/common/CustomField.tsx +87 -84
  36. package/src/components/common/DatePickerField.tsx +98 -0
  37. package/src/components/common/FormikPhoneNumberField.tsx +51 -51
  38. package/src/components/common/Loader.tsx +9 -9
  39. package/src/components/common/RadioField.tsx +35 -35
  40. package/src/components/common/RedirectModal.tsx +43 -0
  41. package/src/components/common/SelectField.tsx +80 -80
  42. package/src/components/common/SnackbarAlert.tsx +53 -53
  43. package/src/components/common/index.tsx +4 -4
  44. package/src/components/confirmModal/index.tsx +51 -51
  45. package/src/components/confirmModal/style.css +21 -21
  46. package/src/components/confirmationContainer/config.ts +72 -72
  47. package/src/components/confirmationContainer/index.tsx +197 -197
  48. package/src/components/confirmationContainer/social-buttons.tsx +94 -94
  49. package/src/components/confirmationContainer/style.css +202 -202
  50. package/src/components/countdown/index.tsx +98 -89
  51. package/src/components/countdown/style.css +9 -9
  52. package/src/components/index.ts +7 -7
  53. package/src/components/loginModal/index.tsx +209 -209
  54. package/src/components/loginModal/style.css +71 -71
  55. package/src/components/myTicketsContainer/index.tsx +196 -196
  56. package/src/components/myTicketsContainer/row.tsx +41 -41
  57. package/src/components/myTicketsContainer/style.css +39 -39
  58. package/src/components/myTicketsContainer/tableConfig.tsx +34 -34
  59. package/src/components/orderDetailsContainer/index.tsx +252 -249
  60. package/src/components/orderDetailsContainer/style.css +72 -72
  61. package/src/components/orderDetailsContainer/ticketsTable.tsx +130 -124
  62. package/src/components/paymentContainer/index.tsx +285 -284
  63. package/src/components/registerModal/index.tsx +190 -190
  64. package/src/components/rsvpContainer/index.tsx +126 -0
  65. package/src/components/stripePayment/index.tsx +254 -253
  66. package/src/components/stripePayment/style.css +59 -59
  67. package/src/components/ticketResale/index.tsx +74 -56
  68. package/src/components/ticketResaleModal/index.tsx +215 -210
  69. package/src/components/ticketResaleModal/style.css +28 -28
  70. package/src/components/ticketsContainer/AccessCodeSection.tsx +50 -0
  71. package/src/components/ticketsContainer/PromoCodeSection.tsx +88 -99
  72. package/src/components/ticketsContainer/ReferralLogic.tsx +31 -33
  73. package/src/components/ticketsContainer/TicketRow.tsx +83 -83
  74. package/src/components/ticketsContainer/TicketsSection.tsx +90 -81
  75. package/src/components/ticketsContainer/index.tsx +464 -430
  76. package/src/components/ticketsContainer/style.css +181 -181
  77. package/src/components/ticketsContainer/utils.ts +11 -11
  78. package/src/components/timerWidget/index.tsx +87 -70
  79. package/src/components/timerWidget/style.css +34 -26
  80. package/src/components/waitingList/index.tsx +178 -178
  81. package/src/components/waitingList/style.css +26 -26
  82. package/src/env.ts +20 -20
  83. package/src/index.ts +15 -13
  84. package/src/normalizers/index.ts +45 -45
  85. package/src/types/billing-info-data.ts +37 -37
  86. package/src/types/payment-field.ts +7 -7
  87. package/src/types/referral-promotion.ts +7 -7
  88. package/src/utils/createCheckoutDataBodyWithDefaultHolder.ts +59 -59
  89. package/src/utils/downloadPDF.tsx +30 -30
  90. package/src/utils/formikErrorFocus.ts +24 -24
  91. package/src/utils/getImage.ts +14 -14
  92. package/src/utils/getQueryVariable.ts +13 -13
  93. package/src/utils/index.ts +5 -5
  94. package/src/utils/setConfigs.ts +26 -26
  95. package/src/utils/showZero.tsx +10 -10
  96. package/src/validators/index.ts +20 -20
@@ -1,284 +1,285 @@
1
- import React, { useEffect, useState } from 'react'
2
- import { AxiosError } from 'axios'
3
- import Container from '@mui/material/Container'
4
- import CircularProgress from '@mui/material/CircularProgress'
5
- import Alert from '@mui/material/Alert'
6
- import { Elements } from '@stripe/react-stripe-js'
7
- import {
8
- loadStripe,
9
- StripeConstructorOptions,
10
- StripeElementsOptions,
11
- } from '@stripe/stripe-js'
12
- import _map from 'lodash/map'
13
- import _get from 'lodash/get'
14
- import _identity from 'lodash/identity'
15
- import { CONFIGS } from '../../utils'
16
- import { nanoid } from 'nanoid'
17
- import { getQueryVariable } from '../../utils/getQueryVariable'
18
-
19
- import './style.css'
20
- import StripePayment from '../stripePayment'
21
- import { IOrderData, IPaymentField } from '../../types'
22
-
23
- import { getPaymentData, handlePaymentSuccess, getConditions, handleFreeSuccess } from '../../api'
24
- import { StripeCardNumberElementOptions } from '@stripe/stripe-js'
25
- import { ThemeProvider, createTheme } from '@mui/material/styles'
26
- import { ThemeOptions } from '@mui/material'
27
- import { CSSProperties } from '@mui/styles'
28
- import TimerWidget from '../timerWidget'
29
- import { Loader } from '../common/index'
30
-
31
- const publishableKey = CONFIGS.STRIPE_PUBLISHABLE_KEY || ''
32
-
33
- const getStripePromise = (reviewData: any) => {
34
- const stripePublishableKey =
35
- _get(reviewData, 'payment_method.stripe_publishable_key') || publishableKey
36
- const stripeAccount = _get(
37
- reviewData,
38
- 'payment_method.stripe_connected_account'
39
- )
40
-
41
- const options: StripeConstructorOptions = {}
42
- if (stripeAccount) {
43
- options.stripeAccount = stripeAccount
44
- }
45
-
46
- return loadStripe(stripePublishableKey, options)
47
- }
48
-
49
- export interface IPaymentPage {
50
- paymentFields: IPaymentField[];
51
- handlePayment: any;
52
- checkoutData: any;
53
- formTitle?: string;
54
- errorText?: string;
55
- onErrorClose?: () => void;
56
- onGetPaymentDataSuccess: (value: any) => void;
57
- onGetPaymentDataError: (value: AxiosError) => void;
58
- onPaymentError: (value: AxiosError) => void;
59
- stripeCardOptions?: StripeCardNumberElementOptions;
60
- disableZipSection: boolean;
61
- themeOptions?: ThemeOptions & {
62
- input?: CSSProperties;
63
- checkbox?: CSSProperties;
64
- };
65
- elementsOptions?: StripeElementsOptions;
66
- onCountdownFinish?: () => void;
67
- enableTimer?: boolean;
68
- }
69
-
70
- const initialOrderValues: IOrderData = {
71
- product_name: '',
72
- ticketType: '',
73
- quantity: '',
74
- price: '',
75
- total: '',
76
- currency: '',
77
- }
78
- const initialReviewValues = {
79
- order_details: {
80
- order_hash: '',
81
- },
82
- payment_method: {
83
- stripe_client_secret: '',
84
- },
85
- billing_info: {},
86
- }
87
-
88
- export const PaymentContainer = ({
89
- paymentFields = [],
90
- handlePayment,
91
- formTitle = 'Get Your Tickets',
92
- errorText,
93
- checkoutData,
94
- onErrorClose = _identity,
95
- onGetPaymentDataSuccess = () => {},
96
- onGetPaymentDataError = () => {},
97
- onPaymentError = () => {},
98
- stripeCardOptions = {},
99
- disableZipSection = false,
100
- themeOptions,
101
- elementsOptions,
102
- onCountdownFinish = () => {},
103
- enableTimer = false,
104
- }: IPaymentPage) => {
105
- const [reviewData, setReviewData] = useState(initialReviewValues)
106
- const [orderData, setOrderData] = useState(initialOrderValues)
107
- const [error, setError] = useState(null)
108
- const [paymentIsLoading, setPaymentIsLoading] = useState(false)
109
- const [paymentDataIsLoading, setPaymentDataIsLoading] = useState(true)
110
- const [conditions, setConditions] = useState<{ id: string; text: string }[]>(
111
- []
112
- )
113
-
114
- const showFormTitle: boolean = Boolean(formTitle)
115
- const showErrorText: boolean = Boolean(errorText)
116
-
117
- const eventId = getQueryVariable('event_id')
118
- const { hash, total } = checkoutData;
119
-
120
- useEffect(() => {
121
- (async () => {
122
- try {
123
- const response = await getPaymentData(hash)
124
- if (response.data.success) {
125
- const attributes = _get(response, 'data.data.attributes')
126
- setReviewData(attributes)
127
- const { cart, order_details } = attributes
128
- const {
129
- tickets: [ticket],
130
- } = order_details
131
- const orderData = {
132
- product_name: cart[0]?.product_name,
133
- ticketType: ticket?.name,
134
- quantity: ticket?.quantity,
135
- price: ticket?.price,
136
- total: order_details?.total,
137
- currency: order_details?.currency,
138
- }
139
- setOrderData(orderData)
140
- onGetPaymentDataSuccess(response.data)
141
- }
142
- } catch (e) {
143
- setError(_get(e, 'response.data.message'))
144
- onGetPaymentDataError(e.response)
145
- } finally {
146
- setPaymentDataIsLoading(false)
147
- }
148
- })()
149
- }, [checkoutData])
150
-
151
- //just once
152
- useEffect(() => {
153
- // fetch conditions data
154
- const fetchConditions = async () => {
155
- if (eventId) {
156
- const res = await getConditions(eventId)
157
- const conditionsInfo = _get(res, 'data.data.attributes')
158
- setConditions(
159
- conditionsInfo
160
- ? conditionsInfo.map((item: string) => ({
161
- id: nanoid(),
162
- text: item,
163
- checked: false,
164
- }))
165
- : []
166
- )
167
- }
168
- }
169
- fetchConditions()
170
- }, [])
171
-
172
- // 1. get payment data ---> v1/order/${hash}/review/ done
173
- // 2. handle payment ---> v1/order/${orderHash}/pay/
174
- // 3. redirect to confirmation page
175
- const handlePaymentMiddleWare = async (error: any) => {
176
- try {
177
- if (error) {
178
- setPaymentIsLoading(false)
179
- throw error
180
- }
181
- const {
182
- order_details: { order_hash },
183
- } = reviewData
184
- const paymentSuccessResponse = total === "0.00" ? (await handleFreeSuccess(order_hash)) : (await handlePaymentSuccess(order_hash))
185
- if (paymentSuccessResponse.status === 200) {
186
- handlePayment(paymentSuccessResponse)
187
- setPaymentIsLoading(false)
188
- }
189
- } catch (e) {
190
- setError(_get(e, 'response.data.message'))
191
- onPaymentError(e.response)
192
- }
193
- }
194
-
195
- const themeMui = createTheme(themeOptions)
196
-
197
- return (
198
- <ThemeProvider theme={themeMui}>
199
- <div className="payment_page">
200
- {!paymentIsLoading && !error && enableTimer && (
201
- <TimerWidget
202
- expires_at={_get(reviewData, 'expires_at', 0)}
203
- buyLoading={paymentIsLoading}
204
- onCountdownFinish={onCountdownFinish}
205
- />
206
- )}
207
- {error && (
208
- <Alert severity="error" onClose={onErrorClose} variant="filled">
209
- {error}
210
- </Alert>
211
- )}
212
- {paymentDataIsLoading && <Loader />}
213
- {!paymentDataIsLoading && (
214
- <Container maxWidth="md">
215
- {showFormTitle && <h1>{formTitle}</h1>}
216
- <div className="order_info_text">Order Review</div>
217
- <div className="order_info_section">
218
- {_map(paymentFields, field => {
219
- const {
220
- id,
221
- label,
222
- className = '',
223
- normalizer = _identity,
224
- } = field
225
- return (
226
- <div key={id} className="order_info_block">
227
- <div className="order_info_title">{label}</div>
228
- <div className={`${className} order_info_text`}>
229
- {normalizer(orderData[id], orderData.currency)}
230
- </div>
231
- </div>
232
- )
233
- })}
234
- </div>
235
- {total !== "0.00" ? <div className="payment_info">
236
- <div className="payment_info_label">
237
- Please provide your payment information
238
- </div>
239
- {showErrorText && (
240
- <p className="payment_info__error">{errorText}</p>
241
- )}
242
- <div>
243
- <Elements
244
- stripe={getStripePromise(reviewData)}
245
- options={elementsOptions}
246
- >
247
- <StripePayment
248
- stripe_client_secret={_get(
249
- reviewData,
250
- 'payment_method.stripe_client_secret'
251
- )}
252
- total={orderData.total}
253
- onSubmit={handlePaymentMiddleWare}
254
- error={error}
255
- currency={orderData.currency}
256
- billing_info={reviewData.billing_info}
257
- isLoading={paymentIsLoading}
258
- handleSetLoading={value => setPaymentIsLoading(value)}
259
- conditions={conditions}
260
- stripeCardOptions={stripeCardOptions}
261
- disableZipSection={disableZipSection}
262
- />
263
- </Elements>
264
- </div>
265
- </div> :
266
- <div
267
- className={`payment_button ${paymentIsLoading ? 'disabled-payment-button' : ''}`}
268
- >
269
- <button disabled={paymentIsLoading} type="button" onClick={() => {
270
- handlePaymentMiddleWare(null)
271
- }}>
272
- {paymentIsLoading ? (
273
- <CircularProgress size={26} />
274
- ) : (
275
- "Complete Registration"
276
- )}
277
- </button>
278
- </div>}
279
- </Container>
280
- )}
281
- </div>
282
- </ThemeProvider>
283
- )
284
- }
1
+ import React, { useEffect, useState } from 'react'
2
+ import { AxiosError } from 'axios'
3
+ import Container from '@mui/material/Container'
4
+ import CircularProgress from '@mui/material/CircularProgress'
5
+ import Alert from '@mui/material/Alert'
6
+ import { Elements } from '@stripe/react-stripe-js'
7
+ import {
8
+ loadStripe,
9
+ StripeConstructorOptions,
10
+ StripeElementsOptions,
11
+ } from '@stripe/stripe-js'
12
+ import _map from 'lodash/map'
13
+ import _get from 'lodash/get'
14
+ import _identity from 'lodash/identity'
15
+ import { CONFIGS } from '../../utils'
16
+ import { nanoid } from 'nanoid'
17
+ import { getQueryVariable } from '../../utils/getQueryVariable'
18
+
19
+ import './style.css'
20
+ import StripePayment from '../stripePayment'
21
+ import { IOrderData, IPaymentField } from '../../types'
22
+
23
+ import { getPaymentData, handlePaymentSuccess, getConditions, handleFreeSuccess } from '../../api'
24
+ import { StripeCardNumberElementOptions } from '@stripe/stripe-js'
25
+ import { ThemeProvider, createTheme } from '@mui/material/styles'
26
+ import { ThemeOptions } from '@mui/material'
27
+ import { CSSProperties } from '@mui/styles'
28
+ import TimerWidget from '../timerWidget'
29
+ import { Loader } from '../common/index'
30
+
31
+ const publishableKey = CONFIGS.STRIPE_PUBLISHABLE_KEY || ''
32
+
33
+ const getStripePromise = (reviewData: any) => {
34
+ const stripePublishableKey =
35
+ _get(reviewData, 'payment_method.stripe_publishable_key') || publishableKey
36
+ const stripeAccount = _get(
37
+ reviewData,
38
+ 'payment_method.stripe_connected_account'
39
+ )
40
+
41
+ const options: StripeConstructorOptions = {}
42
+ if (stripeAccount) {
43
+ options.stripeAccount = stripeAccount
44
+ }
45
+
46
+ return loadStripe(stripePublishableKey, options)
47
+ }
48
+
49
+ export interface IPaymentPage {
50
+ paymentFields: IPaymentField[];
51
+ handlePayment: any;
52
+ checkoutData: any;
53
+ formTitle?: string;
54
+ errorText?: string;
55
+ onErrorClose?: () => void;
56
+ onGetPaymentDataSuccess: (value: any) => void;
57
+ onGetPaymentDataError: (value: AxiosError) => void;
58
+ onPaymentError: (value: AxiosError) => void;
59
+ stripeCardOptions?: StripeCardNumberElementOptions;
60
+ disableZipSection: boolean;
61
+ themeOptions?: ThemeOptions & {
62
+ input?: CSSProperties;
63
+ checkbox?: CSSProperties;
64
+ };
65
+ elementsOptions?: StripeElementsOptions;
66
+ onCountdownFinish?: () => void;
67
+ enableTimer?: boolean;
68
+ }
69
+
70
+ const initialOrderValues: IOrderData = {
71
+ product_name: '',
72
+ ticketType: '',
73
+ quantity: '',
74
+ price: '',
75
+ total: '',
76
+ currency: '',
77
+ }
78
+ const initialReviewValues = {
79
+ order_details: {
80
+ order_hash: '',
81
+ },
82
+ payment_method: {
83
+ stripe_client_secret: '',
84
+ },
85
+ billing_info: {},
86
+ }
87
+
88
+ export const PaymentContainer = ({
89
+ paymentFields = [],
90
+ handlePayment,
91
+ formTitle = 'Get Your Tickets',
92
+ errorText,
93
+ checkoutData,
94
+ onErrorClose = _identity,
95
+ onGetPaymentDataSuccess = () => {},
96
+ onGetPaymentDataError = () => {},
97
+ onPaymentError = () => {},
98
+ stripeCardOptions = {},
99
+ disableZipSection = false,
100
+ themeOptions,
101
+ elementsOptions,
102
+ onCountdownFinish = () => {},
103
+ enableTimer = false,
104
+ }: IPaymentPage) => {
105
+ const [reviewData, setReviewData] = useState(initialReviewValues)
106
+ const [orderData, setOrderData] = useState(initialOrderValues)
107
+ const [error, setError] = useState(null)
108
+ const [paymentIsLoading, setPaymentIsLoading] = useState(false)
109
+ const [paymentDataIsLoading, setPaymentDataIsLoading] = useState(true)
110
+ const [conditions, setConditions] = useState<{ id: string; text: string }[]>(
111
+ []
112
+ )
113
+
114
+ const showFormTitle: boolean = Boolean(formTitle)
115
+ const showErrorText: boolean = Boolean(errorText)
116
+
117
+ const eventId = getQueryVariable('event_id')
118
+ const { hash, total } = checkoutData;
119
+
120
+ useEffect(() => {
121
+ (async () => {
122
+ try {
123
+ const response = await getPaymentData(hash)
124
+ if (response.data.success) {
125
+ const attributes = _get(response, 'data.data.attributes')
126
+ setReviewData(attributes)
127
+ const { cart, order_details } = attributes
128
+ const {
129
+ tickets: [ticket],
130
+ } = order_details
131
+ const orderData = {
132
+ product_name: cart[0]?.product_name,
133
+ ticketType: ticket?.name,
134
+ quantity: ticket?.quantity,
135
+ price: ticket?.price,
136
+ total: order_details?.total,
137
+ currency: order_details?.currency,
138
+ }
139
+ setOrderData(orderData)
140
+ onGetPaymentDataSuccess(response.data)
141
+ }
142
+ } catch (e) {
143
+ setError(_get(e, 'response.data.message'))
144
+ onGetPaymentDataError(e.response)
145
+ } finally {
146
+ setPaymentDataIsLoading(false)
147
+ }
148
+ })()
149
+ }, [checkoutData])
150
+
151
+ //just once
152
+ useEffect(() => {
153
+ // fetch conditions data
154
+ const fetchConditions = async () => {
155
+ if (eventId) {
156
+ const res = await getConditions(eventId)
157
+ const conditionsInfo = _get(res, 'data.data.attributes')
158
+ setConditions(
159
+ conditionsInfo
160
+ ? conditionsInfo.map((item: string) => ({
161
+ id: nanoid(),
162
+ text: item,
163
+ checked: false,
164
+ }))
165
+ : []
166
+ )
167
+ }
168
+ }
169
+ fetchConditions()
170
+ }, [])
171
+
172
+ // 1. get payment data ---> v1/order/${hash}/review/ done
173
+ // 2. handle payment ---> v1/order/${orderHash}/pay/
174
+ // 3. redirect to confirmation page
175
+ const handlePaymentMiddleWare = async (error: any) => {
176
+ try {
177
+ if (error) {
178
+ throw error
179
+ }
180
+ const {
181
+ order_details: { order_hash },
182
+ } = reviewData
183
+ const paymentSuccessResponse = total === "0.00" ? (await handleFreeSuccess(order_hash)) : (await handlePaymentSuccess(order_hash))
184
+ if (paymentSuccessResponse.status === 200) {
185
+ handlePayment(paymentSuccessResponse)
186
+ setPaymentIsLoading(false)
187
+ }
188
+ } catch (e) {
189
+ setError(_get(e, 'response.data.message'))
190
+ setPaymentIsLoading(false)
191
+ onPaymentError(e.response)
192
+ }
193
+ }
194
+
195
+ const themeMui = createTheme(themeOptions)
196
+
197
+ return (
198
+ <ThemeProvider theme={themeMui}>
199
+ <div className="payment_page">
200
+ {enableTimer && (
201
+ <TimerWidget
202
+ expires_at={_get(reviewData, 'expires_at', 0)}
203
+ buyLoading={paymentIsLoading}
204
+ onCountdownFinish={onCountdownFinish}
205
+ />
206
+ )}
207
+ {error && (
208
+ <Alert severity="error" onClose={onErrorClose} variant="filled">
209
+ {error}
210
+ </Alert>
211
+ )}
212
+ {paymentDataIsLoading && <Loader />}
213
+ {!paymentDataIsLoading && (
214
+ <Container maxWidth="md">
215
+ {showFormTitle && <h1>{formTitle}</h1>}
216
+ <div className="order_info_text">Order Review</div>
217
+ <div className="order_info_section">
218
+ {_map(paymentFields, field => {
219
+ const {
220
+ id,
221
+ label,
222
+ className = '',
223
+ normalizer = _identity,
224
+ } = field
225
+ return (
226
+ <div key={id} className="order_info_block">
227
+ <div className="order_info_title">{label}</div>
228
+ <div className={`${className} order_info_text`}>
229
+ {normalizer(orderData[id], orderData.currency)}
230
+ </div>
231
+ </div>
232
+ )
233
+ })}
234
+ </div>
235
+ {total !== "0.00" ? <div className="payment_info">
236
+ <div className="payment_info_label">
237
+ Please provide your payment information
238
+ </div>
239
+ {showErrorText && (
240
+ <p className="payment_info__error">{errorText}</p>
241
+ )}
242
+ <div>
243
+ <Elements
244
+ stripe={getStripePromise(reviewData)}
245
+ options={elementsOptions}
246
+ >
247
+ <StripePayment
248
+ stripe_client_secret={_get(
249
+ reviewData,
250
+ 'payment_method.stripe_client_secret'
251
+ )}
252
+ total={orderData.total}
253
+ onSubmit={handlePaymentMiddleWare}
254
+ error={error}
255
+ currency={orderData.currency}
256
+ billing_info={reviewData.billing_info}
257
+ isLoading={paymentIsLoading}
258
+ handleSetLoading={value => setPaymentIsLoading(value)}
259
+ conditions={conditions}
260
+ stripeCardOptions={stripeCardOptions}
261
+ disableZipSection={disableZipSection}
262
+ />
263
+ </Elements>
264
+ </div>
265
+ </div> :
266
+ <div
267
+ className={`payment_button ${paymentIsLoading ? 'disabled-payment-button' : ''}`}
268
+ >
269
+ <button disabled={paymentIsLoading} type="button" onClick={() => {
270
+ setPaymentIsLoading(true)
271
+ handlePaymentMiddleWare(null)
272
+ }}>
273
+ {paymentIsLoading ? (
274
+ <CircularProgress size={26} />
275
+ ) : (
276
+ "Complete Registration"
277
+ )}
278
+ </button>
279
+ </div>}
280
+ </Container>
281
+ )}
282
+ </div>
283
+ </ThemeProvider>
284
+ )
285
+ }