tf-checkout-react 1.0.104 → 1.0.105

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 (78) hide show
  1. package/dist/components/ticketsContainer/TicketsSection.d.ts +2 -1
  2. package/dist/components/ticketsContainer/index.d.ts +2 -1
  3. package/dist/images/done.svg +3 -3
  4. package/dist/tf-checkout-react.cjs.development.js +8 -6
  5. package/dist/tf-checkout-react.cjs.development.js.map +1 -1
  6. package/dist/tf-checkout-react.cjs.production.min.js +1 -1
  7. package/dist/tf-checkout-react.cjs.production.min.js.map +1 -1
  8. package/dist/tf-checkout-react.esm.js +8 -6
  9. package/dist/tf-checkout-react.esm.js.map +1 -1
  10. package/package.json +89 -89
  11. package/src/.d.ts +2 -2
  12. package/src/api/index.ts +293 -293
  13. package/src/assets/images/done.svg +3 -3
  14. package/src/components/billing-info-container/index.tsx +796 -796
  15. package/src/components/billing-info-container/style.css +105 -105
  16. package/src/components/billing-info-container/utils.ts +224 -224
  17. package/src/components/common/CheckboxField.tsx +41 -41
  18. package/src/components/common/CustomField.tsx +84 -84
  19. package/src/components/common/FormikPhoneNumberField.tsx +51 -51
  20. package/src/components/common/Loader.tsx +9 -9
  21. package/src/components/common/RadioField.tsx +35 -35
  22. package/src/components/common/RedirectModal.tsx +43 -43
  23. package/src/components/common/SelectField.tsx +80 -80
  24. package/src/components/common/SnackbarAlert.tsx +53 -53
  25. package/src/components/common/index.tsx +4 -4
  26. package/src/components/confirmModal/index.tsx +51 -51
  27. package/src/components/confirmModal/style.css +21 -21
  28. package/src/components/confirmationContainer/config.ts +72 -72
  29. package/src/components/confirmationContainer/index.tsx +197 -197
  30. package/src/components/confirmationContainer/social-buttons.tsx +94 -94
  31. package/src/components/confirmationContainer/style.css +202 -202
  32. package/src/components/countdown/index.tsx +89 -89
  33. package/src/components/countdown/style.css +9 -9
  34. package/src/components/index.ts +7 -7
  35. package/src/components/loginModal/index.tsx +209 -209
  36. package/src/components/loginModal/style.css +71 -71
  37. package/src/components/myTicketsContainer/index.tsx +196 -196
  38. package/src/components/myTicketsContainer/row.tsx +41 -41
  39. package/src/components/myTicketsContainer/style.css +39 -39
  40. package/src/components/myTicketsContainer/tableConfig.tsx +34 -34
  41. package/src/components/orderDetailsContainer/index.tsx +249 -249
  42. package/src/components/orderDetailsContainer/style.css +72 -72
  43. package/src/components/orderDetailsContainer/ticketsTable.tsx +124 -124
  44. package/src/components/paymentContainer/index.tsx +284 -284
  45. package/src/components/registerModal/index.tsx +190 -190
  46. package/src/components/stripePayment/index.tsx +253 -253
  47. package/src/components/stripePayment/style.css +59 -59
  48. package/src/components/ticketResale/index.tsx +56 -56
  49. package/src/components/ticketResaleModal/index.tsx +210 -210
  50. package/src/components/ticketResaleModal/style.css +28 -28
  51. package/src/components/ticketsContainer/PromoCodeSection.tsx +99 -99
  52. package/src/components/ticketsContainer/ReferralLogic.tsx +33 -33
  53. package/src/components/ticketsContainer/TicketRow.tsx +83 -83
  54. package/src/components/ticketsContainer/TicketsSection.tsx +85 -81
  55. package/src/components/ticketsContainer/index.tsx +430 -427
  56. package/src/components/ticketsContainer/style.css +181 -181
  57. package/src/components/ticketsContainer/utils.ts +11 -11
  58. package/src/components/timerWidget/index.tsx +70 -70
  59. package/src/components/timerWidget/style.css +26 -26
  60. package/src/components/waitingList/index.tsx +178 -178
  61. package/src/components/waitingList/style.css +26 -26
  62. package/src/env.ts +20 -20
  63. package/src/index.ts +14 -14
  64. package/src/normalizers/index.ts +45 -45
  65. package/src/types/billing-info-data.ts +37 -37
  66. package/src/types/payment-field.ts +7 -7
  67. package/src/types/referral-promotion.ts +7 -7
  68. package/src/utils/createCheckoutDataBodyWithDefaultHolder.ts +59 -59
  69. package/src/utils/downloadPDF.tsx +30 -30
  70. package/src/utils/formikErrorFocus.ts +24 -24
  71. package/src/utils/getImage.ts +14 -14
  72. package/src/utils/getQueryVariable.ts +13 -13
  73. package/src/utils/index.ts +5 -5
  74. package/src/utils/setConfigs.ts +26 -26
  75. package/src/utils/showZero.tsx +10 -10
  76. package/src/validators/index.ts +20 -20
  77. package/src/.DS_Store +0 -0
  78. package/src/components/.DS_Store +0 -0
@@ -1,253 +1,253 @@
1
- import React, { useState, useEffect } from 'react'
2
- import {
3
- useStripe,
4
- useElements,
5
- CardNumberElement,
6
- CardExpiryElement,
7
- CardCvcElement,
8
- } from '@stripe/react-stripe-js'
9
- import { StripeCardNumberElementOptions } from '@stripe/stripe-js'
10
- import _identity from 'lodash/identity'
11
- import _get from 'lodash/get'
12
- import { CheckboxField } from '../common/index'
13
-
14
- import './style.css'
15
- import { getCurrencySymbolByCurrency } from '../../normalizers'
16
- import CircularProgress from '@mui/material/CircularProgress'
17
-
18
- const options: StripeCardNumberElementOptions = {
19
- style: {
20
- base: {
21
- backgroundColor: '#000',
22
- fontSize: '18px',
23
- color: '#ffffff',
24
- letterSpacing: '1px',
25
- ':-webkit-autofill': {
26
- color: '#ffffff',
27
- },
28
- '::placeholder': {
29
- color: 'rgba(201, 201, 201, 0.5)',
30
- },
31
- },
32
- invalid: {
33
- color: '#E53935',
34
- },
35
- },
36
- }
37
-
38
- export interface ICheckoutForm {
39
- total: string;
40
- currency: string;
41
- onSubmit: (error: any) => Promise<any>;
42
- error?: string | null;
43
- stripeCardOptions?: StripeCardNumberElementOptions;
44
- stripe_client_secret: string;
45
- billing_info: { [key: string]: any };
46
- isLoading: any;
47
- handleSetLoading: (loading: any) => void;
48
- conditions: any;
49
- disableZipSection: boolean;
50
- }
51
-
52
- interface AddressTypes {
53
- city: string;
54
- line1: string;
55
- state: string;
56
- postal_code?: string;
57
- }
58
-
59
- const CheckoutForm = ({
60
- total,
61
- onSubmit = _identity,
62
- stripeCardOptions = {},
63
- error = null,
64
- stripe_client_secret,
65
- currency,
66
- billing_info,
67
- isLoading = false,
68
- handleSetLoading = () => {},
69
- conditions = [],
70
- disableZipSection,
71
- }: ICheckoutForm) => {
72
- const stripe = useStripe()
73
- const elements = useElements()
74
- const [postalCode, setPostalCode] = useState<any>('')
75
- const [stripeError, setStripeError] = useState<any>(null)
76
- const [checkboxes, setCheckboxes] = useState<any>([])
77
- const [allowSubmit, setAllowSubmit] = useState(false)
78
-
79
- const handleSubmit = async (event: React.SyntheticEvent) => {
80
- handleSetLoading(true)
81
- try {
82
- event.preventDefault()
83
-
84
- if (!postalCode && !disableZipSection) {
85
- setStripeError('Please enter your zip code.')
86
- handleSetLoading(false)
87
- return
88
- }
89
-
90
- if (!stripe || !elements) {
91
- // Stripe.js has not loaded yet. Make sure to disable
92
- // form submission until Stripe.js has loaded.
93
- handleSetLoading(false)
94
- return
95
- }
96
-
97
- const card = elements.getElement(CardNumberElement)
98
-
99
- const address: AddressTypes = {
100
- city: billing_info.city,
101
- line1: billing_info.street_address,
102
- state: billing_info.state,
103
- }
104
-
105
- if (!disableZipSection) {
106
- address.postal_code = postalCode
107
- }
108
-
109
- const paymentMethodReq = await stripe.createPaymentMethod({
110
- type: 'card',
111
- card: card || { token: '' },
112
- billing_details: {
113
- address,
114
- },
115
- })
116
-
117
- if (paymentMethodReq.error) {
118
- setStripeError(paymentMethodReq.error.message || null)
119
- handleSetLoading(false)
120
- return
121
- }
122
-
123
- const { error } = await stripe.confirmCardPayment(stripe_client_secret, {
124
- payment_method: paymentMethodReq.paymentMethod.id,
125
- })
126
-
127
- if (error) {
128
- setStripeError(error.message)
129
- handleSetLoading(false)
130
- return
131
- }
132
-
133
- onSubmit(null)
134
- } catch (e) {
135
- onSubmit(e)
136
- }
137
- }
138
-
139
- const handleCheckboxes = (e: any) => {
140
- const checkbox = e.target
141
- const updatedCheckedState = checkboxes.map((item: any) => {
142
- const value = item.id === checkbox.name ? !item.checked : item.checked
143
- return {
144
- ...item,
145
- checked: value,
146
- }
147
- })
148
- setCheckboxes(updatedCheckedState)
149
- }
150
-
151
- const onChangePostalCode = (e: any) => {
152
- setPostalCode(e.target.value)
153
- }
154
-
155
- useEffect(() => {
156
- if (typeof window !== 'undefined') {
157
- const userData = JSON.parse(
158
- window.localStorage.getItem('user_data') || ''
159
- )
160
- const zipCode = _get(userData, 'zip', '')
161
- zipCode && setPostalCode(zipCode)
162
- }
163
- }, [])
164
-
165
- useEffect(() => {
166
- if (conditions.length) {
167
- setCheckboxes(conditions)
168
- }
169
- }, [conditions])
170
-
171
- useEffect(() => {
172
- if (checkboxes.length) {
173
- const allChecked = checkboxes.every(
174
- (item: any) => item?.checked === true
175
- )
176
- setAllowSubmit(allChecked)
177
- } else {
178
- setAllowSubmit(true)
179
- }
180
- }, [checkboxes])
181
-
182
- const buttonIsDiabled = !stripe || !!error || isLoading || !allowSubmit
183
-
184
- return (
185
- <div className="stripe_payment_container">
186
- {!!stripeError && (
187
- <div className="checkout_error_block">{stripeError}</div>
188
- )}
189
- <form onSubmit={handleSubmit}>
190
- <div className="card_form_inner">
191
- <label className="card_number_element">
192
- <span className="card_label_text">Card number</span>
193
- <CardNumberElement
194
- options={{ ...options, ...stripeCardOptions, }}
195
- onReady={_identity}
196
- onChange={_identity}
197
- onBlur={_identity}
198
- onFocus={_identity}
199
- />
200
- </label>
201
- <label className="expiration_element">
202
- <span className="card_label_text">Expiration date</span>
203
- <CardExpiryElement options={{ ...options, ...stripeCardOptions }} />
204
- </label>
205
- <label className="cvc_element">
206
- <span className="card_label_text">CVC</span>
207
- <CardCvcElement options={{ ...options, ...stripeCardOptions }} />
208
- </label>
209
- {!disableZipSection && (
210
- <label className="zip_element">
211
- <p className="card_label_text">ZIP</p>
212
- <input
213
- type="text"
214
- value={postalCode}
215
- onChange={onChangePostalCode}
216
- placeholder="ZIP"
217
- />
218
- </label>
219
- )}
220
- </div>
221
- {checkboxes?.map((checkbox: any) => (
222
- <div
223
- className={'billing-info-container__singleField'}
224
- key={checkbox.id}
225
- >
226
- <div className="conditions-block">
227
- <CheckboxField
228
- name={checkbox.id}
229
- label={checkbox.text}
230
- required={true}
231
- onChange={handleCheckboxes}
232
- checked={checkbox.checked}
233
- />
234
- </div>
235
- </div>
236
- ))}
237
- <div
238
- className={`payment_button ${buttonIsDiabled ? 'disabled-payment-button' : ''}`}
239
- >
240
- <button disabled={buttonIsDiabled} type="submit">
241
- {isLoading ? (
242
- <CircularProgress size={26} />
243
- ) : (
244
- `Pay ${getCurrencySymbolByCurrency(currency)}${total}`
245
- )}
246
- </button>
247
- </div>
248
- </form>
249
- </div>
250
- )
251
- }
252
-
253
- export default CheckoutForm
1
+ import React, { useState, useEffect } from 'react'
2
+ import {
3
+ useStripe,
4
+ useElements,
5
+ CardNumberElement,
6
+ CardExpiryElement,
7
+ CardCvcElement,
8
+ } from '@stripe/react-stripe-js'
9
+ import { StripeCardNumberElementOptions } from '@stripe/stripe-js'
10
+ import _identity from 'lodash/identity'
11
+ import _get from 'lodash/get'
12
+ import { CheckboxField } from '../common/index'
13
+
14
+ import './style.css'
15
+ import { getCurrencySymbolByCurrency } from '../../normalizers'
16
+ import CircularProgress from '@mui/material/CircularProgress'
17
+
18
+ const options: StripeCardNumberElementOptions = {
19
+ style: {
20
+ base: {
21
+ backgroundColor: '#000',
22
+ fontSize: '18px',
23
+ color: '#ffffff',
24
+ letterSpacing: '1px',
25
+ ':-webkit-autofill': {
26
+ color: '#ffffff',
27
+ },
28
+ '::placeholder': {
29
+ color: 'rgba(201, 201, 201, 0.5)',
30
+ },
31
+ },
32
+ invalid: {
33
+ color: '#E53935',
34
+ },
35
+ },
36
+ }
37
+
38
+ export interface ICheckoutForm {
39
+ total: string;
40
+ currency: string;
41
+ onSubmit: (error: any) => Promise<any>;
42
+ error?: string | null;
43
+ stripeCardOptions?: StripeCardNumberElementOptions;
44
+ stripe_client_secret: string;
45
+ billing_info: { [key: string]: any };
46
+ isLoading: any;
47
+ handleSetLoading: (loading: any) => void;
48
+ conditions: any;
49
+ disableZipSection: boolean;
50
+ }
51
+
52
+ interface AddressTypes {
53
+ city: string;
54
+ line1: string;
55
+ state: string;
56
+ postal_code?: string;
57
+ }
58
+
59
+ const CheckoutForm = ({
60
+ total,
61
+ onSubmit = _identity,
62
+ stripeCardOptions = {},
63
+ error = null,
64
+ stripe_client_secret,
65
+ currency,
66
+ billing_info,
67
+ isLoading = false,
68
+ handleSetLoading = () => {},
69
+ conditions = [],
70
+ disableZipSection,
71
+ }: ICheckoutForm) => {
72
+ const stripe = useStripe()
73
+ const elements = useElements()
74
+ const [postalCode, setPostalCode] = useState<any>('')
75
+ const [stripeError, setStripeError] = useState<any>(null)
76
+ const [checkboxes, setCheckboxes] = useState<any>([])
77
+ const [allowSubmit, setAllowSubmit] = useState(false)
78
+
79
+ const handleSubmit = async (event: React.SyntheticEvent) => {
80
+ handleSetLoading(true)
81
+ try {
82
+ event.preventDefault()
83
+
84
+ if (!postalCode && !disableZipSection) {
85
+ setStripeError('Please enter your zip code.')
86
+ handleSetLoading(false)
87
+ return
88
+ }
89
+
90
+ if (!stripe || !elements) {
91
+ // Stripe.js has not loaded yet. Make sure to disable
92
+ // form submission until Stripe.js has loaded.
93
+ handleSetLoading(false)
94
+ return
95
+ }
96
+
97
+ const card = elements.getElement(CardNumberElement)
98
+
99
+ const address: AddressTypes = {
100
+ city: billing_info.city,
101
+ line1: billing_info.street_address,
102
+ state: billing_info.state,
103
+ }
104
+
105
+ if (!disableZipSection) {
106
+ address.postal_code = postalCode
107
+ }
108
+
109
+ const paymentMethodReq = await stripe.createPaymentMethod({
110
+ type: 'card',
111
+ card: card || { token: '' },
112
+ billing_details: {
113
+ address,
114
+ },
115
+ })
116
+
117
+ if (paymentMethodReq.error) {
118
+ setStripeError(paymentMethodReq.error.message || null)
119
+ handleSetLoading(false)
120
+ return
121
+ }
122
+
123
+ const { error } = await stripe.confirmCardPayment(stripe_client_secret, {
124
+ payment_method: paymentMethodReq.paymentMethod.id,
125
+ })
126
+
127
+ if (error) {
128
+ setStripeError(error.message)
129
+ handleSetLoading(false)
130
+ return
131
+ }
132
+
133
+ onSubmit(null)
134
+ } catch (e) {
135
+ onSubmit(e)
136
+ }
137
+ }
138
+
139
+ const handleCheckboxes = (e: any) => {
140
+ const checkbox = e.target
141
+ const updatedCheckedState = checkboxes.map((item: any) => {
142
+ const value = item.id === checkbox.name ? !item.checked : item.checked
143
+ return {
144
+ ...item,
145
+ checked: value,
146
+ }
147
+ })
148
+ setCheckboxes(updatedCheckedState)
149
+ }
150
+
151
+ const onChangePostalCode = (e: any) => {
152
+ setPostalCode(e.target.value)
153
+ }
154
+
155
+ useEffect(() => {
156
+ if (typeof window !== 'undefined') {
157
+ const userData = JSON.parse(
158
+ window.localStorage.getItem('user_data') || ''
159
+ )
160
+ const zipCode = _get(userData, 'zip', '')
161
+ zipCode && setPostalCode(zipCode)
162
+ }
163
+ }, [])
164
+
165
+ useEffect(() => {
166
+ if (conditions.length) {
167
+ setCheckboxes(conditions)
168
+ }
169
+ }, [conditions])
170
+
171
+ useEffect(() => {
172
+ if (checkboxes.length) {
173
+ const allChecked = checkboxes.every(
174
+ (item: any) => item?.checked === true
175
+ )
176
+ setAllowSubmit(allChecked)
177
+ } else {
178
+ setAllowSubmit(true)
179
+ }
180
+ }, [checkboxes])
181
+
182
+ const buttonIsDiabled = !stripe || !!error || isLoading || !allowSubmit
183
+
184
+ return (
185
+ <div className="stripe_payment_container">
186
+ {!!stripeError && (
187
+ <div className="checkout_error_block">{stripeError}</div>
188
+ )}
189
+ <form onSubmit={handleSubmit}>
190
+ <div className="card_form_inner">
191
+ <label className="card_number_element">
192
+ <span className="card_label_text">Card number</span>
193
+ <CardNumberElement
194
+ options={{ ...options, ...stripeCardOptions, }}
195
+ onReady={_identity}
196
+ onChange={_identity}
197
+ onBlur={_identity}
198
+ onFocus={_identity}
199
+ />
200
+ </label>
201
+ <label className="expiration_element">
202
+ <span className="card_label_text">Expiration date</span>
203
+ <CardExpiryElement options={{ ...options, ...stripeCardOptions }} />
204
+ </label>
205
+ <label className="cvc_element">
206
+ <span className="card_label_text">CVC</span>
207
+ <CardCvcElement options={{ ...options, ...stripeCardOptions }} />
208
+ </label>
209
+ {!disableZipSection && (
210
+ <label className="zip_element">
211
+ <p className="card_label_text">ZIP</p>
212
+ <input
213
+ type="text"
214
+ value={postalCode}
215
+ onChange={onChangePostalCode}
216
+ placeholder="ZIP"
217
+ />
218
+ </label>
219
+ )}
220
+ </div>
221
+ {checkboxes?.map((checkbox: any) => (
222
+ <div
223
+ className={'billing-info-container__singleField'}
224
+ key={checkbox.id}
225
+ >
226
+ <div className="conditions-block">
227
+ <CheckboxField
228
+ name={checkbox.id}
229
+ label={checkbox.text}
230
+ required={true}
231
+ onChange={handleCheckboxes}
232
+ checked={checkbox.checked}
233
+ />
234
+ </div>
235
+ </div>
236
+ ))}
237
+ <div
238
+ className={`payment_button ${buttonIsDiabled ? 'disabled-payment-button' : ''}`}
239
+ >
240
+ <button disabled={buttonIsDiabled} type="submit">
241
+ {isLoading ? (
242
+ <CircularProgress size={26} />
243
+ ) : (
244
+ `Pay ${getCurrencySymbolByCurrency(currency)}${total}`
245
+ )}
246
+ </button>
247
+ </div>
248
+ </form>
249
+ </div>
250
+ )
251
+ }
252
+
253
+ export default CheckoutForm
@@ -1,60 +1,60 @@
1
- .card_form_inner {
2
- background: #232323;
3
- border-radius: 8px;
4
- padding: 15px;
5
- width: 50%;
6
- margin: 0 auto;
7
- min-width: 325px;
8
- margin-bottom: 20px;
9
- }
10
- .card_form_inner .card_label_text {
11
- color: #fff;
12
- }
13
- .card_form_inner .StripeElement {
14
- margin: 5px 0 10px;
15
- }
16
- .card_label_text {
17
- color: #fff;
18
- }
19
- .payment_button {
20
- text-align: center;
21
- padding-top: 15px;
22
- }
23
- .payment_button button {
24
- background-color: #212529;
25
- font-size: 26px;
26
- cursor: pointer;
27
- padding: 15px 30px;
28
- width: 200px;
29
- border-radius: 8px;
30
- color: #fff;
31
- transition: opacity 0.5s;
32
- }
33
- .payment_button button:hover {
34
- opacity: 0.7;
35
- }
36
-
37
- .disabled-payment-button button{
38
- user-select: none;
39
- pointer-events:none;
40
- opacity: 0.3;
41
- }
42
-
43
- .checkout_error_block {
44
- color: #e53935;
45
- padding: 15px 0;
46
- font-weight: 600;
47
- }
48
-
49
- .zip_element p {
50
- margin-bottom: 0;
51
- }
52
- .zip_element input {
53
- background-color: #000;
54
- outline: none;
55
- border: none;
56
- font-size: 18px;
57
- margin-top: 5px;
58
- color: #ffffff;
59
- width: 100%;
1
+ .card_form_inner {
2
+ background: #232323;
3
+ border-radius: 8px;
4
+ padding: 15px;
5
+ width: 50%;
6
+ margin: 0 auto;
7
+ min-width: 325px;
8
+ margin-bottom: 20px;
9
+ }
10
+ .card_form_inner .card_label_text {
11
+ color: #fff;
12
+ }
13
+ .card_form_inner .StripeElement {
14
+ margin: 5px 0 10px;
15
+ }
16
+ .card_label_text {
17
+ color: #fff;
18
+ }
19
+ .payment_button {
20
+ text-align: center;
21
+ padding-top: 15px;
22
+ }
23
+ .payment_button button {
24
+ background-color: #212529;
25
+ font-size: 26px;
26
+ cursor: pointer;
27
+ padding: 15px 30px;
28
+ width: 200px;
29
+ border-radius: 8px;
30
+ color: #fff;
31
+ transition: opacity 0.5s;
32
+ }
33
+ .payment_button button:hover {
34
+ opacity: 0.7;
35
+ }
36
+
37
+ .disabled-payment-button button{
38
+ user-select: none;
39
+ pointer-events:none;
40
+ opacity: 0.3;
41
+ }
42
+
43
+ .checkout_error_block {
44
+ color: #e53935;
45
+ padding: 15px 0;
46
+ font-weight: 600;
47
+ }
48
+
49
+ .zip_element p {
50
+ margin-bottom: 0;
51
+ }
52
+ .zip_element input {
53
+ background-color: #000;
54
+ outline: none;
55
+ border: none;
56
+ font-size: 18px;
57
+ margin-top: 5px;
58
+ color: #ffffff;
59
+ width: 100%;
60
60
  }