tf-checkout-react 1.4.24 → 1.4.25
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/api/auth.d.ts +5 -0
- package/dist/api/cart.d.ts +2 -0
- package/dist/api/checkout.d.ts +1 -0
- package/dist/api/common.d.ts +10 -0
- package/dist/api/index.d.ts +10 -31
- package/dist/api/interceptors.d.ts +1 -0
- package/dist/api/orders.d.ts +2 -0
- package/dist/api/payment.d.ts +5 -0
- package/dist/api/publicRequest.d.ts +10 -0
- package/dist/api/resale.d.ts +5 -0
- package/dist/components/billing-info-container/utils.d.ts +0 -28
- package/dist/components/common/CheckboxField.d.ts +1 -1
- package/dist/components/confirmationContainer/index.d.ts +7 -2
- package/dist/components/loginForm/index.d.ts +6 -22
- package/dist/components/loginModal/index.d.ts +0 -28
- package/dist/components/seatMapContainer/addToCart.d.ts +2 -2
- package/dist/components/seatMapContainer/utils.d.ts +1 -9
- package/dist/components/stripePayment/index.d.ts +1 -1
- package/dist/components/ticketsContainer/index.d.ts +2 -2
- package/dist/components/waitingList/index.d.ts +1 -1
- package/dist/tf-checkout-react.cjs.development.js +1076 -694
- package/dist/tf-checkout-react.cjs.development.js.map +1 -1
- package/dist/tf-checkout-react.cjs.production.min.js +1 -1
- package/dist/tf-checkout-react.cjs.production.min.js.map +1 -1
- package/dist/tf-checkout-react.esm.js +1076 -694
- package/dist/tf-checkout-react.esm.js.map +1 -1
- package/dist/types/order-data.d.ts +5 -5
- package/dist/utils/auth.d.ts +5 -5
- package/dist/utils/setConfigs.d.ts +0 -12
- package/package.json +1 -1
- package/src/api/auth.ts +44 -0
- package/src/api/cart.ts +28 -0
- package/src/api/checkout.ts +30 -0
- package/src/api/common.ts +129 -0
- package/src/api/guestTicketDelegation.ts +1 -1
- package/src/api/index.ts +40 -346
- package/src/api/interceptors.ts +104 -0
- package/src/api/orders.ts +30 -0
- package/src/api/payment.ts +77 -0
- package/src/api/publicRequest.ts +40 -0
- package/src/api/resale.ts +28 -0
- package/src/components/addonsContainer/adapters/index.tsx +2 -4
- package/src/components/addonsContainer/index.tsx +23 -57
- package/src/components/billing-info-container/index.tsx +144 -214
- package/src/components/billing-info-container/utils.ts +9 -59
- package/src/components/common/CheckboxField.tsx +3 -4
- package/src/components/common/CustomField.tsx +1 -5
- package/src/components/common/NativeSelectFeild/index.tsx +1 -5
- package/src/components/common/SelectField/index.tsx +1 -3
- package/src/components/confirmationContainer/index.tsx +20 -13
- package/src/components/idVerificationContainer/index.tsx +7 -19
- package/src/components/loginForm/index.tsx +28 -41
- package/src/components/loginModal/index.tsx +18 -46
- package/src/components/myTicketsContainer/index.tsx +1 -1
- package/src/components/orderDetailsContainer/index.tsx +3 -3
- package/src/components/paymentContainer/index.tsx +23 -16
- package/src/components/registerForm/index.tsx +3 -6
- package/src/components/registerModal/index.tsx +4 -14
- package/src/components/rsvpContainer/index.tsx +18 -18
- package/src/components/seatMapContainer/addToCart.ts +9 -12
- package/src/components/seatMapContainer/utils.ts +3 -8
- package/src/components/signupModal/index.tsx +9 -30
- package/src/components/stripePayment/index.tsx +1 -1
- package/src/components/ticketResale/index.tsx +7 -6
- package/src/components/ticketsContainer/TicketsSection.tsx +11 -33
- package/src/components/ticketsContainer/index.tsx +32 -56
- package/src/components/waitingList/index.tsx +18 -30
- package/src/types/api/auth.d.ts +20 -12
- package/src/types/api/axiosResponse.d.ts +6 -0
- package/src/types/api/cart.d.ts +65 -0
- package/src/types/api/checkout.d.ts +41 -0
- package/src/types/api/common.d.ts +117 -0
- package/src/types/api/orders.d.ts +100 -0
- package/src/types/api/payment.d.ts +168 -0
- package/src/types/api/ticketResale.d.ts +13 -0
- package/src/types/order-data.ts +5 -5
- package/src/utils/auth.ts +3 -3
- package/src/utils/setConfigs.ts +2 -25
- package/src/types/auth.d.ts +0 -15
|
@@ -6,14 +6,7 @@ import Button from '@mui/material/Button'
|
|
|
6
6
|
import { createTheme, ThemeProvider } from '@mui/material/styles'
|
|
7
7
|
import { CSSProperties } from '@mui/styles'
|
|
8
8
|
import axios, { AxiosError } from 'axios'
|
|
9
|
-
import {
|
|
10
|
-
Field,
|
|
11
|
-
Form,
|
|
12
|
-
Formik,
|
|
13
|
-
FormikHelpers,
|
|
14
|
-
FormikProps,
|
|
15
|
-
FormikValues,
|
|
16
|
-
} from 'formik'
|
|
9
|
+
import { Field, Form, Formik, FormikHelpers, FormikProps, FormikValues } from 'formik'
|
|
17
10
|
import _find from 'lodash/find'
|
|
18
11
|
import _get from 'lodash/get'
|
|
19
12
|
import _identity from 'lodash/identity'
|
|
@@ -42,6 +35,7 @@ import {
|
|
|
42
35
|
deleteCookieByName,
|
|
43
36
|
getCookieByName,
|
|
44
37
|
isBrowser,
|
|
38
|
+
setLoggedUserData,
|
|
45
39
|
} from '../../utils'
|
|
46
40
|
import { ErrorFocus } from '../../utils/formikErrorFocus'
|
|
47
41
|
import { combineValidators, requiredValidator } from '../../validators'
|
|
@@ -59,7 +53,6 @@ import {
|
|
|
59
53
|
getFieldLabel,
|
|
60
54
|
getInitialValues,
|
|
61
55
|
getValidateFunctions,
|
|
62
|
-
setLoggedUserData,
|
|
63
56
|
} from './utils'
|
|
64
57
|
|
|
65
58
|
export interface IBillingInfoPage {
|
|
@@ -142,7 +135,7 @@ const LogicRunner: FC<{
|
|
|
142
135
|
const fetchStates = async () => {
|
|
143
136
|
try {
|
|
144
137
|
const res = await getStates(values.country)
|
|
145
|
-
const mappedStates = _map(
|
|
138
|
+
const mappedStates = _map(res.data, (item, key) => ({
|
|
146
139
|
label: item,
|
|
147
140
|
value: key,
|
|
148
141
|
}))
|
|
@@ -163,14 +156,11 @@ const LogicRunner: FC<{
|
|
|
163
156
|
}
|
|
164
157
|
shouldFetchCountries && fetchStates()
|
|
165
158
|
}, [values.country, setStates, setFieldValue])
|
|
166
|
-
const userDataEncoded =
|
|
167
|
-
typeof window !== 'undefined'
|
|
168
|
-
? window.localStorage.getItem('user_data')
|
|
169
|
-
: ''
|
|
159
|
+
const userDataEncoded = isBrowser ? window.localStorage.getItem('user_data') : ''
|
|
170
160
|
useEffect(() => {
|
|
171
161
|
// set user data from local storage
|
|
172
162
|
const getStoredUserData = () => {
|
|
173
|
-
if (
|
|
163
|
+
if (isBrowser) {
|
|
174
164
|
if (userDataEncoded) {
|
|
175
165
|
try {
|
|
176
166
|
const parsedData = JSON.parse(userDataEncoded)
|
|
@@ -184,16 +174,12 @@ const LogicRunner: FC<{
|
|
|
184
174
|
street_address: parsedData?.street_address || '',
|
|
185
175
|
country: parsedData?.country || '1',
|
|
186
176
|
zip: parsedData?.zip || '',
|
|
187
|
-
brand_opt_in: brandOptIn
|
|
188
|
-
? brandOptIn
|
|
189
|
-
: parsedData?.brand_opt_in || false,
|
|
177
|
+
brand_opt_in: brandOptIn ? brandOptIn : parsedData?.brand_opt_in || false,
|
|
190
178
|
city: parsedData?.city || '',
|
|
191
179
|
confirmPassword: '',
|
|
192
180
|
password: '',
|
|
193
|
-
'holderFirstName-0':
|
|
194
|
-
|
|
195
|
-
'holderLastName-0':
|
|
196
|
-
parsedData?.last_name || parsedData?.lastName || '',
|
|
181
|
+
'holderFirstName-0': parsedData?.first_name || parsedData?.firstName || '',
|
|
182
|
+
'holderLastName-0': parsedData?.last_name || parsedData?.lastName || '',
|
|
197
183
|
'holderEmail-0': parsedData?.email || '',
|
|
198
184
|
}
|
|
199
185
|
|
|
@@ -264,37 +250,37 @@ export const BillingInfoContainer = React.memo(
|
|
|
264
250
|
const [configs, setConfigs] = useState<null | AttributesConfig>(null)
|
|
265
251
|
const [isNewUser, setIsNewUser] = useState(false)
|
|
266
252
|
const themeMui = createTheme(themeOptions)
|
|
267
|
-
|
|
253
|
+
|
|
268
254
|
useEffect(() => {
|
|
269
|
-
if (
|
|
255
|
+
if (isBrowser) {
|
|
270
256
|
const extraData = window.localStorage.getItem('extraData')
|
|
271
257
|
if (extraData) {
|
|
272
258
|
setExtraData(JSON.parse(extraData))
|
|
273
259
|
}
|
|
274
260
|
}
|
|
275
|
-
getCheckoutPageConfigs()
|
|
276
|
-
|
|
277
|
-
|
|
261
|
+
getCheckoutPageConfigs()
|
|
262
|
+
.then(data => {
|
|
263
|
+
if (data?.data?.attributes) {
|
|
264
|
+
setConfigs(data.data.attributes)
|
|
265
|
+
setIsConfigLoading(false)
|
|
266
|
+
}
|
|
267
|
+
})
|
|
268
|
+
.catch(() => {
|
|
278
269
|
setIsConfigLoading(false)
|
|
279
|
-
}
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
})
|
|
283
|
-
}, [isWindowDefined])
|
|
284
|
-
const defaultCountry = isWindowDefined
|
|
285
|
-
? window.localStorage.getItem('eventCountry')
|
|
286
|
-
: ''
|
|
270
|
+
})
|
|
271
|
+
}, [isBrowser])
|
|
272
|
+
const defaultCountry = isBrowser ? window.localStorage.getItem('eventCountry') : ''
|
|
287
273
|
const userData =
|
|
288
|
-
|
|
274
|
+
isBrowser && window.localStorage.getItem('user_data')
|
|
289
275
|
? JSON.parse(window.localStorage.getItem('user_data') || '')
|
|
290
276
|
: {}
|
|
291
277
|
const access_token =
|
|
292
|
-
|
|
278
|
+
isBrowser && window.localStorage.getItem('access_token')
|
|
293
279
|
? window.localStorage.getItem('access_token') || ''
|
|
294
280
|
: ''
|
|
295
|
-
const [dataWithUniqueIds, setDataWithUniqueIds] = useState<
|
|
296
|
-
|
|
297
|
-
|
|
281
|
+
const [dataWithUniqueIds, setDataWithUniqueIds] = useState<IBillingInfoData[]>(
|
|
282
|
+
assingUniqueIds(data)
|
|
283
|
+
)
|
|
298
284
|
const xtfCookie = getCookieByName('X-TF-ECOMMERCE')
|
|
299
285
|
const [isLoggedIn, setIsLoggedIn] = useState(!!(pIsLoggedIn || xtfCookie))
|
|
300
286
|
const [cartInfoData, setCartInfo] = useState<any>({})
|
|
@@ -304,9 +290,7 @@ export const BillingInfoContainer = React.memo(
|
|
|
304
290
|
const [alreadyHasUser, setAlreadyHasUser] = useState(false)
|
|
305
291
|
const [userExpired, setUserExpired] = useState(false)
|
|
306
292
|
const [showModalSignup, setShowModalSignup] = useState(false)
|
|
307
|
-
const [showModalForgotPassword, setShowModalForgotPassword] = useState(
|
|
308
|
-
false
|
|
309
|
-
)
|
|
293
|
+
const [showModalForgotPassword, setShowModalForgotPassword] = useState(false)
|
|
310
294
|
const [ticketsQuantity, setTicketsQuantity] = useState<string[]>([])
|
|
311
295
|
const [userValues, setUserValues] = useState<any>({
|
|
312
296
|
firstName: '',
|
|
@@ -327,11 +311,8 @@ export const BillingInfoContainer = React.memo(
|
|
|
327
311
|
const [cardLoading, setCardLoading] = useState(false)
|
|
328
312
|
const [isCountriesLoading, setIsCountriesLoading] = useState(true)
|
|
329
313
|
const [error, setError] = useState(null)
|
|
330
|
-
const [phoneValidationIsLoading, setPhoneValidationIsLoading] = useState(
|
|
331
|
-
|
|
332
|
-
)
|
|
333
|
-
const emailLogged =
|
|
334
|
-
_get(userData, 'email', '') || _get(userValues, 'email', '')
|
|
314
|
+
const [phoneValidationIsLoading, setPhoneValidationIsLoading] = useState(false)
|
|
315
|
+
const emailLogged = _get(userData, 'email', '') || _get(userValues, 'email', '')
|
|
335
316
|
const firstNameLogged =
|
|
336
317
|
_get(userData, 'first_name', '') || _get(userValues, 'first_name', '')
|
|
337
318
|
const lastNameLogged =
|
|
@@ -355,25 +336,19 @@ export const BillingInfoContainer = React.memo(
|
|
|
355
336
|
!collectOptionalWalletAddress && !collectMandatoryWalletAddress
|
|
356
337
|
const collectMandatoryCompany = configs?.collect_mandatory_company
|
|
357
338
|
const collectOptionalCompany = configs?.collect_optional_company
|
|
358
|
-
const hideCompanyField =
|
|
359
|
-
!collectOptionalCompany && !collectMandatoryCompany
|
|
339
|
+
const hideCompanyField = !collectOptionalCompany && !collectMandatoryCompany
|
|
360
340
|
const collectMandatoryJobTitle = configs?.collect_mandatory_job_title
|
|
361
341
|
const collectOptionalJobTitle = configs?.collect_optional_job_title
|
|
362
|
-
const hideJobTitleField =
|
|
363
|
-
!collectMandatoryJobTitle && !collectOptionalJobTitle
|
|
342
|
+
const hideJobTitleField = !collectMandatoryJobTitle && !collectOptionalJobTitle
|
|
364
343
|
const collectMandatoryInstagram = configs?.collect_mandatory_instagram
|
|
365
344
|
const collectOptionalInstagram = configs?.collect_optional_instagram
|
|
366
|
-
const hideInstagramField =
|
|
367
|
-
!collectMandatoryInstagram && !collectOptionalInstagram
|
|
345
|
+
const hideInstagramField = !collectMandatoryInstagram && !collectOptionalInstagram
|
|
368
346
|
const collectMandatoryBusinessCategory = configs?.collect_mandatory_business_category
|
|
369
347
|
const collectOptionalBusinessCategory = configs?.collect_optional_business_category
|
|
370
348
|
const hideBusinessCategoryField =
|
|
371
349
|
!collectMandatoryBusinessCategory && !collectOptionalBusinessCategory
|
|
372
350
|
|
|
373
|
-
const [
|
|
374
|
-
pendingVerificationMessage,
|
|
375
|
-
setPendingVerificationMessage,
|
|
376
|
-
] = useState()
|
|
351
|
+
const [pendingVerificationMessage, setPendingVerificationMessage] = useState()
|
|
377
352
|
|
|
378
353
|
// Get prevProps
|
|
379
354
|
const prevData = useRef(data)
|
|
@@ -414,7 +389,7 @@ export const BillingInfoContainer = React.memo(
|
|
|
414
389
|
try {
|
|
415
390
|
const res = await getCountries()
|
|
416
391
|
setCustomHeader(res)
|
|
417
|
-
setCountries(
|
|
392
|
+
setCountries(res.data)
|
|
418
393
|
setIsCountriesLoading(false)
|
|
419
394
|
onGetCountriesSuccess(res.data)
|
|
420
395
|
} catch (e) {
|
|
@@ -433,12 +408,10 @@ export const BillingInfoContainer = React.memo(
|
|
|
433
408
|
setCardLoading(true)
|
|
434
409
|
const res = await getCart()
|
|
435
410
|
setCustomHeader(res)
|
|
436
|
-
const cartInfo =
|
|
411
|
+
const cartInfo = res.data.attributes
|
|
437
412
|
setCartInfo(cartInfo)
|
|
438
413
|
const { cart = [] } = cartInfo
|
|
439
|
-
setTicketsQuantity(
|
|
440
|
-
new Array(getQuantity(cart)).fill(null).map(() => nanoid())
|
|
441
|
-
)
|
|
414
|
+
setTicketsQuantity(new Array(getQuantity(cart)).fill(null).map(() => nanoid()))
|
|
442
415
|
onGetCartSuccess(res.data)
|
|
443
416
|
} catch (e) {
|
|
444
417
|
if (axios.isAxiosError(e)) {
|
|
@@ -451,19 +424,16 @@ export const BillingInfoContainer = React.memo(
|
|
|
451
424
|
// fetch user data
|
|
452
425
|
const fetchUserData = async (token: string) => {
|
|
453
426
|
try {
|
|
454
|
-
if ((
|
|
427
|
+
if ((isBrowser && token) || isLoggedIn) {
|
|
455
428
|
const userDataResponse = await getProfileData(token)
|
|
456
|
-
const profileSpecifiedData = _get(userDataResponse, 'data
|
|
429
|
+
const profileSpecifiedData = _get(userDataResponse, 'data')
|
|
457
430
|
const profileDataObj = setLoggedUserData(profileSpecifiedData)
|
|
458
431
|
setUserValues({
|
|
459
432
|
...profileDataObj,
|
|
460
433
|
firstName: profileDataObj.first_name,
|
|
461
434
|
lastName: profileDataObj.last_name,
|
|
462
435
|
})
|
|
463
|
-
window.localStorage.setItem(
|
|
464
|
-
'user_data',
|
|
465
|
-
JSON.stringify(profileDataObj)
|
|
466
|
-
)
|
|
436
|
+
window.localStorage.setItem('user_data', JSON.stringify(profileDataObj))
|
|
467
437
|
onGetProfileDataSuccess(userDataResponse.data)
|
|
468
438
|
}
|
|
469
439
|
} catch (e) {
|
|
@@ -493,17 +463,17 @@ export const BillingInfoContainer = React.memo(
|
|
|
493
463
|
)
|
|
494
464
|
|
|
495
465
|
try {
|
|
496
|
-
if (
|
|
466
|
+
if (isBrowser) {
|
|
497
467
|
addAddOnsInAttributes(checkoutBody)
|
|
498
468
|
}
|
|
499
469
|
|
|
500
|
-
const
|
|
470
|
+
const checkoutResponse = await postOnCheckout(
|
|
501
471
|
checkoutBody,
|
|
502
472
|
access_token,
|
|
503
473
|
flagFreeTicket
|
|
504
474
|
)
|
|
505
475
|
removeReferralKey()
|
|
506
|
-
onSkipBillingPage(
|
|
476
|
+
onSkipBillingPage(checkoutResponse.data.attributes)
|
|
507
477
|
setLoading(false)
|
|
508
478
|
} catch (e) {
|
|
509
479
|
onSubmitError(e)
|
|
@@ -539,9 +509,7 @@ export const BillingInfoContainer = React.memo(
|
|
|
539
509
|
{
|
|
540
510
|
emailLogged: emailLogged || profileData.email,
|
|
541
511
|
firstNameLogged:
|
|
542
|
-
firstNameLogged ||
|
|
543
|
-
profileData.first_name ||
|
|
544
|
-
profileData.firstName,
|
|
512
|
+
firstNameLogged || profileData.first_name || profileData.firstName,
|
|
545
513
|
lastNameLogged:
|
|
546
514
|
lastNameLogged || profileData.last_name || profileData.lastName,
|
|
547
515
|
},
|
|
@@ -556,10 +524,7 @@ export const BillingInfoContainer = React.memo(
|
|
|
556
524
|
localStorage.removeItem('referral_key')
|
|
557
525
|
}
|
|
558
526
|
|
|
559
|
-
if (
|
|
560
|
-
loading ||
|
|
561
|
-
(enableTimer && !expirationTime && typeof window !== 'undefined')
|
|
562
|
-
) {
|
|
527
|
+
if (loading || (enableTimer && !expirationTime && isBrowser)) {
|
|
563
528
|
if (expirationTime === 0) {
|
|
564
529
|
// Redirect to homepage (countdown finished and browser reloaded case)
|
|
565
530
|
window.location.href = '/'
|
|
@@ -568,8 +533,7 @@ export const BillingInfoContainer = React.memo(
|
|
|
568
533
|
|
|
569
534
|
const selectedCountry =
|
|
570
535
|
_find(countries, item => item.code.toLowerCase() === defaultCountry) || {}
|
|
571
|
-
const initialCountry =
|
|
572
|
-
selectedCountry.id || _get(userData, 'country', '') || '1'
|
|
536
|
+
const initialCountry = selectedCountry.id || _get(userData, 'countryId', '') || '1'
|
|
573
537
|
|
|
574
538
|
const pageUrl = isBrowser ? window.location.href.split('?')[0] : ''
|
|
575
539
|
usePixel(eventId || '', { page: 'billing', pageUrl })
|
|
@@ -598,14 +562,14 @@ export const BillingInfoContainer = React.memo(
|
|
|
598
562
|
dataWithUniqueIds,
|
|
599
563
|
{
|
|
600
564
|
country: initialCountry,
|
|
601
|
-
state: _get(userData, '
|
|
565
|
+
state: _get(userData, 'stateId', '') || '1',
|
|
602
566
|
brand_opt_in: optedInFieldValue,
|
|
603
567
|
ttf_opt_in: ttfOptIn,
|
|
604
568
|
data_capture: {
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
569
|
+
instagram: _get(extraData, 'data_capture.instagram', ''),
|
|
570
|
+
company: _get(extraData, 'data_capture.company', ''),
|
|
571
|
+
businessCategory: _get(extraData, 'data_capture.businessCategory', ''),
|
|
572
|
+
jobTitle: _get(extraData, 'data_capture.jobTitle', ''),
|
|
609
573
|
},
|
|
610
574
|
...initialValues,
|
|
611
575
|
},
|
|
@@ -614,39 +578,41 @@ export const BillingInfoContainer = React.memo(
|
|
|
614
578
|
enableReinitialize={false}
|
|
615
579
|
onSubmit={async (values, formikHelpers) => {
|
|
616
580
|
try {
|
|
617
|
-
if (
|
|
618
|
-
window.localStorage.setItem(
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
581
|
+
if (isBrowser) {
|
|
582
|
+
window.localStorage.setItem(
|
|
583
|
+
'extraData',
|
|
584
|
+
JSON.stringify({
|
|
585
|
+
data_capture: {
|
|
586
|
+
instagram: _get(values, 'data_capture.instagram', ''),
|
|
587
|
+
company: _get(values, 'data_capture.company', ''),
|
|
588
|
+
businessCategory: _get(
|
|
589
|
+
values,
|
|
590
|
+
'data_capture.businessCategory',
|
|
591
|
+
''
|
|
592
|
+
),
|
|
593
|
+
jobTitle: _get(values, 'data_capture.jobTitle', ''),
|
|
594
|
+
},
|
|
595
|
+
})
|
|
596
|
+
)
|
|
626
597
|
}
|
|
627
598
|
if (isLoggedIn) {
|
|
628
599
|
const checkoutBody = collectCheckoutBody(values, userData)
|
|
629
600
|
|
|
630
|
-
if (
|
|
601
|
+
if (isBrowser) {
|
|
631
602
|
addAddOnsInAttributes(checkoutBody)
|
|
632
603
|
}
|
|
633
604
|
|
|
634
|
-
const
|
|
605
|
+
const checkoutResponse = await postOnCheckout(
|
|
635
606
|
checkoutBody,
|
|
636
607
|
access_token,
|
|
637
608
|
flagFreeTicket
|
|
638
609
|
)
|
|
639
610
|
removeReferralKey()
|
|
640
611
|
// After checkout is successful recover updated profile and store it on local storage if needed
|
|
641
|
-
if (
|
|
612
|
+
if (isBrowser) {
|
|
642
613
|
const updatedUserData = await getProfileData(access_token)
|
|
643
|
-
const profileSpecifiedData = _get(
|
|
644
|
-
|
|
645
|
-
'data.data'
|
|
646
|
-
)
|
|
647
|
-
const profileDataObj = setLoggedUserData(
|
|
648
|
-
profileSpecifiedData
|
|
649
|
-
)
|
|
614
|
+
const profileSpecifiedData = _get(updatedUserData, 'data')
|
|
615
|
+
const profileDataObj = setLoggedUserData(profileSpecifiedData)
|
|
650
616
|
window.localStorage.setItem(
|
|
651
617
|
'user_data',
|
|
652
618
|
JSON.stringify(profileDataObj)
|
|
@@ -657,7 +623,7 @@ export const BillingInfoContainer = React.memo(
|
|
|
657
623
|
values,
|
|
658
624
|
formikHelpers as FormikHelpers<any>,
|
|
659
625
|
eventId,
|
|
660
|
-
|
|
626
|
+
checkoutResponse
|
|
661
627
|
)
|
|
662
628
|
return
|
|
663
629
|
}
|
|
@@ -676,18 +642,9 @@ export const BillingInfoContainer = React.memo(
|
|
|
676
642
|
setLoading(true)
|
|
677
643
|
const resRegister = await register(bodyFormData)
|
|
678
644
|
const xtfCookie = _get(resRegister, 'headers.x-tf-ecommerce')
|
|
679
|
-
const accessToken = _get(
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
)
|
|
683
|
-
const refreshToken = _get(
|
|
684
|
-
resRegister,
|
|
685
|
-
'data.data.attributes.refresh_token'
|
|
686
|
-
)
|
|
687
|
-
const userProfile = _get(
|
|
688
|
-
resRegister,
|
|
689
|
-
'data.data.attributes.user_profile'
|
|
690
|
-
)
|
|
645
|
+
const accessToken = _get(resRegister, 'data.attributes.access_token')
|
|
646
|
+
const refreshToken = _get(resRegister, 'data.attributes.refresh_token')
|
|
647
|
+
const userProfile = _get(resRegister, 'data.attributes.user_profile')
|
|
691
648
|
|
|
692
649
|
setIsNewUser(true)
|
|
693
650
|
onRegisterSuccess({
|
|
@@ -708,10 +665,7 @@ export const BillingInfoContainer = React.memo(
|
|
|
708
665
|
}
|
|
709
666
|
if (error?.password) {
|
|
710
667
|
formikHelpers.setFieldError('password', error.password)
|
|
711
|
-
formikHelpers.setFieldError(
|
|
712
|
-
'confirmPassword',
|
|
713
|
-
error.password
|
|
714
|
-
)
|
|
668
|
+
formikHelpers.setFieldError('confirmPassword', error.password)
|
|
715
669
|
}
|
|
716
670
|
if (error?.email && !onLogin) {
|
|
717
671
|
// False will stand for outside controll
|
|
@@ -731,22 +685,19 @@ export const BillingInfoContainer = React.memo(
|
|
|
731
685
|
return
|
|
732
686
|
}
|
|
733
687
|
const profileData = await getProfileData()
|
|
734
|
-
const profileSpecifiedData = _get(profileData, 'data
|
|
688
|
+
const profileSpecifiedData = _get(profileData, 'data')
|
|
735
689
|
const profileDataObj = setLoggedUserData(profileSpecifiedData)
|
|
736
|
-
if (
|
|
737
|
-
window.localStorage.setItem(
|
|
738
|
-
'user_data',
|
|
739
|
-
JSON.stringify(profileDataObj)
|
|
740
|
-
)
|
|
690
|
+
if (isBrowser) {
|
|
691
|
+
window.localStorage.setItem('user_data', JSON.stringify(profileDataObj))
|
|
741
692
|
}
|
|
742
693
|
|
|
743
694
|
const checkoutBody = collectCheckoutBody(values, profileDataObj)
|
|
744
695
|
|
|
745
|
-
if (
|
|
696
|
+
if (isBrowser) {
|
|
746
697
|
addAddOnsInAttributes(checkoutBody)
|
|
747
698
|
}
|
|
748
699
|
|
|
749
|
-
const
|
|
700
|
+
const checkoutResponse = await postOnCheckout(
|
|
750
701
|
checkoutBody,
|
|
751
702
|
undefined,
|
|
752
703
|
flagFreeTicket
|
|
@@ -756,7 +707,7 @@ export const BillingInfoContainer = React.memo(
|
|
|
756
707
|
values,
|
|
757
708
|
formikHelpers as FormikHelpers<any>,
|
|
758
709
|
eventId,
|
|
759
|
-
|
|
710
|
+
checkoutResponse
|
|
760
711
|
)
|
|
761
712
|
} catch (e) {
|
|
762
713
|
setLoading(false)
|
|
@@ -767,7 +718,7 @@ export const BillingInfoContainer = React.memo(
|
|
|
767
718
|
e.response?.status === 401 ||
|
|
768
719
|
e.response?.data?.error === 'invalid_token'
|
|
769
720
|
) {
|
|
770
|
-
if (
|
|
721
|
+
if (isBrowser) {
|
|
771
722
|
window.localStorage.removeItem('user_data')
|
|
772
723
|
window.localStorage.removeItem('access_token')
|
|
773
724
|
setUserExpired(true)
|
|
@@ -866,10 +817,7 @@ export const BillingInfoContainer = React.memo(
|
|
|
866
817
|
if (el.name === 'holderAge' && !showDOB) {
|
|
867
818
|
return false
|
|
868
819
|
}
|
|
869
|
-
if (
|
|
870
|
-
el.name === 'ttf_opt_in' &&
|
|
871
|
-
hideTtfOptIn
|
|
872
|
-
) {
|
|
820
|
+
if (el.name === 'ttf_opt_in' && hideTtfOptIn) {
|
|
873
821
|
return false
|
|
874
822
|
}
|
|
875
823
|
if (el.name === 'phone') {
|
|
@@ -879,38 +827,27 @@ export const BillingInfoContainer = React.memo(
|
|
|
879
827
|
return false
|
|
880
828
|
}
|
|
881
829
|
}
|
|
882
|
-
if (
|
|
883
|
-
el.name ===
|
|
884
|
-
'data_capture[wallet_address]'
|
|
885
|
-
) {
|
|
830
|
+
if (el.name === 'data_capture[wallet_address]') {
|
|
886
831
|
if (collectMandatoryWalletAddress) {
|
|
887
832
|
el.required = true
|
|
888
833
|
}
|
|
889
834
|
}
|
|
890
|
-
if (
|
|
891
|
-
el.name === 'data_capture[jobTitle]'
|
|
892
|
-
) {
|
|
835
|
+
if (el.name === 'data_capture[jobTitle]') {
|
|
893
836
|
if (collectMandatoryJobTitle) {
|
|
894
837
|
el.required = true
|
|
895
838
|
}
|
|
896
839
|
}
|
|
897
|
-
if (
|
|
898
|
-
el.name === 'data_capture[businessCategory]'
|
|
899
|
-
) {
|
|
840
|
+
if (el.name === 'data_capture[businessCategory]') {
|
|
900
841
|
if (collectMandatoryBusinessCategory) {
|
|
901
842
|
el.required = true
|
|
902
843
|
}
|
|
903
844
|
}
|
|
904
|
-
if (
|
|
905
|
-
el.name === 'data_capture[company]'
|
|
906
|
-
) {
|
|
845
|
+
if (el.name === 'data_capture[company]') {
|
|
907
846
|
if (collectMandatoryCompany) {
|
|
908
847
|
el.required = true
|
|
909
848
|
}
|
|
910
849
|
}
|
|
911
|
-
if (
|
|
912
|
-
el.name === 'data_capture[instagram]'
|
|
913
|
-
) {
|
|
850
|
+
if (el.name === 'data_capture[instagram]') {
|
|
914
851
|
if (collectMandatoryInstagram) {
|
|
915
852
|
el.required = true
|
|
916
853
|
}
|
|
@@ -930,28 +867,33 @@ export const BillingInfoContainer = React.memo(
|
|
|
930
867
|
}
|
|
931
868
|
if (
|
|
932
869
|
hideWalletAddressField &&
|
|
933
|
-
(el.name === 'wallet-address-info' ||
|
|
870
|
+
(el.name === 'wallet-address-info' ||
|
|
871
|
+
el.name === 'data_capture[wallet_address]')
|
|
934
872
|
) {
|
|
935
873
|
return false
|
|
936
874
|
}
|
|
937
875
|
if (
|
|
938
|
-
hideJobTitleField &&
|
|
876
|
+
hideJobTitleField &&
|
|
877
|
+
el.name === 'data_capture[jobTitle]'
|
|
939
878
|
) {
|
|
940
879
|
return false
|
|
941
880
|
}
|
|
942
881
|
if (
|
|
943
|
-
hideBusinessCategoryField &&
|
|
882
|
+
hideBusinessCategoryField &&
|
|
883
|
+
el.name === 'data_capture[businessCategory]'
|
|
944
884
|
) {
|
|
945
885
|
return false
|
|
946
886
|
}
|
|
947
887
|
if (
|
|
948
|
-
hideCompanyField &&
|
|
888
|
+
hideCompanyField &&
|
|
889
|
+
el.name === 'data_capture[company]'
|
|
949
890
|
) {
|
|
950
891
|
return false
|
|
951
892
|
}
|
|
952
893
|
if (
|
|
953
894
|
hideInstagramField &&
|
|
954
|
-
(el.name === 'data_capture[instagram]' ||
|
|
895
|
+
(el.name === 'data_capture[instagram]' ||
|
|
896
|
+
el.name === 'instagram-info')
|
|
955
897
|
) {
|
|
956
898
|
return false
|
|
957
899
|
}
|
|
@@ -962,14 +904,12 @@ export const BillingInfoContainer = React.memo(
|
|
|
962
904
|
'password',
|
|
963
905
|
'confirmPassword',
|
|
964
906
|
'password-info',
|
|
965
|
-
].includes(element.name) &&
|
|
966
|
-
isLoggedIn ? null : (
|
|
907
|
+
].includes(element.name) && isLoggedIn ? null : (
|
|
967
908
|
<React.Fragment key={element.uniqueId}>
|
|
968
909
|
<div
|
|
969
|
-
className={`${
|
|
970
|
-
element.
|
|
971
|
-
}
|
|
972
|
-
''}`}
|
|
910
|
+
className={`${element.className} ${
|
|
911
|
+
props?.errors[element.name] || ''
|
|
912
|
+
}`}
|
|
973
913
|
>
|
|
974
914
|
{element.component ? (
|
|
975
915
|
element.component
|
|
@@ -993,48 +933,47 @@ export const BillingInfoContainer = React.memo(
|
|
|
993
933
|
props.values,
|
|
994
934
|
props.errors
|
|
995
935
|
)}
|
|
996
|
-
setFieldValue={
|
|
997
|
-
props.setFieldValue
|
|
998
|
-
}
|
|
936
|
+
setFieldValue={props.setFieldValue}
|
|
999
937
|
onBlur={props.handleBlur}
|
|
1000
|
-
component={getFieldComponent(
|
|
1001
|
-
element
|
|
1002
|
-
)}
|
|
938
|
+
component={getFieldComponent(element)}
|
|
1003
939
|
selectOptions={
|
|
1004
940
|
element.name === 'country'
|
|
1005
941
|
? _map(countries, item => ({
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
942
|
+
value: item.id,
|
|
943
|
+
label: item.name,
|
|
944
|
+
}))
|
|
945
|
+
: element.name === 'state'
|
|
946
|
+
? [
|
|
947
|
+
{
|
|
948
|
+
label: element.label,
|
|
949
|
+
value: '',
|
|
950
|
+
disabled: true,
|
|
951
|
+
},
|
|
952
|
+
...states,
|
|
953
|
+
]
|
|
954
|
+
: element.selectOptions || []
|
|
955
|
+
}
|
|
956
|
+
theme={theme}
|
|
957
|
+
defaultCountry={
|
|
958
|
+
defaultCountry || element.defaultCountry
|
|
959
|
+
}
|
|
960
|
+
dateFormat={element.format}
|
|
961
|
+
isCountryCodeEditable={
|
|
962
|
+
isCountryCodeEditable
|
|
963
|
+
}
|
|
964
|
+
/>
|
|
965
|
+
)}
|
|
966
|
+
</div>
|
|
967
|
+
</React.Fragment>
|
|
968
|
+
)
|
|
969
|
+
)}
|
|
970
|
+
</div>
|
|
971
|
+
</React.Fragment>
|
|
972
|
+
)
|
|
973
|
+
})}
|
|
974
|
+
</React.Fragment>
|
|
975
|
+
)
|
|
976
|
+
})}
|
|
1038
977
|
{!_isEmpty(ticketHoldersFields.fields) && (
|
|
1039
978
|
<div className="ticket-holders-fields">
|
|
1040
979
|
<h2>{ticketHoldersFields.label}</h2>
|
|
@@ -1080,20 +1019,15 @@ export const BillingInfoContainer = React.memo(
|
|
|
1080
1019
|
element.onValidate
|
|
1081
1020
|
? element.onValidate
|
|
1082
1021
|
: () =>
|
|
1083
|
-
props.errors[
|
|
1084
|
-
`${element.name}-${index}`
|
|
1085
|
-
]
|
|
1022
|
+
props.errors[`${element.name}-${index}`]
|
|
1086
1023
|
)}
|
|
1087
1024
|
setPhoneValidationIsLoading={
|
|
1088
1025
|
setPhoneValidationIsLoading
|
|
1089
1026
|
}
|
|
1090
1027
|
defaultCountry={
|
|
1091
|
-
defaultCountry ||
|
|
1092
|
-
element.defaultCountry
|
|
1093
|
-
}
|
|
1094
|
-
isCountryCodeEditable={
|
|
1095
|
-
isCountryCodeEditable
|
|
1028
|
+
defaultCountry || element.defaultCountry
|
|
1096
1029
|
}
|
|
1030
|
+
isCountryCodeEditable={isCountryCodeEditable}
|
|
1097
1031
|
/>
|
|
1098
1032
|
</div>
|
|
1099
1033
|
)
|
|
@@ -1113,11 +1047,7 @@ export const BillingInfoContainer = React.memo(
|
|
|
1113
1047
|
className="login-register-button"
|
|
1114
1048
|
disabled={props.isSubmitting || phoneValidationIsLoading}
|
|
1115
1049
|
>
|
|
1116
|
-
{props.isSubmitting ?
|
|
1117
|
-
<CircularProgress size={26} />
|
|
1118
|
-
) : (
|
|
1119
|
-
buttonName
|
|
1120
|
-
)}
|
|
1050
|
+
{props.isSubmitting ? <CircularProgress size={26} /> : buttonName}
|
|
1121
1051
|
</Button>
|
|
1122
1052
|
</div>
|
|
1123
1053
|
</div>
|