tf-checkout-react 1.4.21-beta.1 → 1.4.21-beta.3

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 (32) hide show
  1. package/dist/api/auth.d.ts +1 -1
  2. package/dist/api/checkout.d.ts +1 -1
  3. package/dist/api/index.d.ts +0 -2
  4. package/dist/api/publicRequest.d.ts +0 -1
  5. package/dist/components/billing-info-container/index.d.ts +2 -0
  6. package/dist/components/billing-info-container/utils.d.ts +3 -2
  7. package/dist/components/seatMapContainer/addToCart.d.ts +0 -7
  8. package/dist/components/signupModal/index.d.ts +1 -4
  9. package/dist/components/ticketsContainer/index.d.ts +0 -7
  10. package/dist/tf-checkout-react.cjs.development.js +143 -220
  11. package/dist/tf-checkout-react.cjs.development.js.map +1 -1
  12. package/dist/tf-checkout-react.cjs.production.min.js +1 -1
  13. package/dist/tf-checkout-react.cjs.production.min.js.map +1 -1
  14. package/dist/tf-checkout-react.esm.js +143 -220
  15. package/dist/tf-checkout-react.esm.js.map +1 -1
  16. package/package.json +1 -1
  17. package/src/api/auth.ts +2 -8
  18. package/src/api/checkout.ts +1 -8
  19. package/src/api/index.ts +0 -12
  20. package/src/api/interceptors.ts +0 -11
  21. package/src/api/publicRequest.ts +0 -4
  22. package/src/api/resale.ts +2 -2
  23. package/src/components/addonsContainer/index.tsx +0 -20
  24. package/src/components/billing-info-container/index.tsx +34 -20
  25. package/src/components/billing-info-container/utils.ts +14 -11
  26. package/src/components/myTicketsContainer/index.tsx +0 -1
  27. package/src/components/preRegistration/index.tsx +2 -0
  28. package/src/components/seatMapContainer/addToCart.ts +1 -14
  29. package/src/components/signupModal/index.tsx +3 -12
  30. package/src/components/ticketResale/index.tsx +1 -9
  31. package/src/components/ticketsContainer/index.tsx +1 -40
  32. package/src/utils/downloadPDF.tsx +2 -12
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.4.21-beta.1",
2
+ "version": "1.4.21-beta.3",
3
3
  "license": "MIT",
4
4
  "main": "dist/index.js",
5
5
  "typings": "dist/index.d.ts",
package/src/api/auth.ts CHANGED
@@ -26,14 +26,8 @@ export const register = async (data: FormData): Promise<IProfileResponse> => {
26
26
  return response.data
27
27
  }
28
28
 
29
- export const getProfileData = async (accessToken?: string): Promise<IProfileResponse> => {
30
- const response: AxiosResponse<IProfileResponse, AxiosRequestConfig> =
31
- await publicRequest.get('/customer/profile/', {
32
- headers: {
33
- ...publicRequest.defaults.headers.common,
34
- Authorization: `Bearer ${accessToken}`,
35
- },
36
- })
29
+ export const getProfileData = async (): Promise<IProfileResponse> => {
30
+ const response: AxiosResponse<IProfileResponse, AxiosRequestConfig> = await publicRequest.get('/customer/profile/')
37
31
  return response.data
38
32
  }
39
33
 
@@ -4,7 +4,6 @@ import { publicRequest } from './publicRequest'
4
4
 
5
5
  export const postOnCheckout = async (
6
6
  data: any,
7
- accessToken?: string,
8
7
  freeTicket = false
9
8
  ): Promise<ICheckoutResponse> => {
10
9
  if (freeTicket) {
@@ -17,13 +16,7 @@ export const postOnCheckout = async (
17
16
  const response: AxiosResponse<ICheckoutResponse, AxiosRequestConfig> =
18
17
  await publicRequest.post(
19
18
  `v1/on-checkout`,
20
- { data },
21
- {
22
- headers: {
23
- ...publicRequest.defaults.headers.common,
24
- Authorization: `Bearer ${accessToken}`,
25
- },
26
- }
19
+ { data }
27
20
  )
28
21
 
29
22
  return response.data
package/src/api/index.ts CHANGED
@@ -59,18 +59,6 @@ export const setCustomHeader = (response: any) => {
59
59
  }
60
60
  }
61
61
 
62
- export const handleSetAccessToken = (token: string) => {
63
- if (token) {
64
- if (isBrowser) {
65
- window.localStorage.setItem('access_token', token)
66
- publicRequest.setAccessToken(token)
67
- }
68
- }
69
- }
70
-
71
- export const getAccessToken = (data: FormData) =>
72
- publicRequest.post('v1/oauth/access_token', data)
73
-
74
62
  export const handlePaymentData = (orderHash: string, data: any) => {
75
63
  const res = publicRequest
76
64
  .post(`v1/order/${orderHash}/pay`, {
@@ -6,16 +6,6 @@ import { getCookieByName, setCustomCookie } from '../utils/cookies'
6
6
  import { publicRequest } from './publicRequest'
7
7
 
8
8
  publicRequest.interceptors.request.use((config: AxiosRequestConfig) => {
9
- const userData = isBrowser ? window.localStorage.getItem('user_data') : null
10
- const accessToken = isBrowser ? window.localStorage.getItem('access_token') : null
11
- if (userData && accessToken) {
12
- const updatedHeaders = {
13
- ...config.headers,
14
- Authorization: `Bearer ${accessToken}`,
15
- }
16
- config.headers = updatedHeaders
17
- }
18
-
19
9
  const guestToken = isBrowser ? window.localStorage.getItem('auth_guest_token') : null
20
10
  if (guestToken) {
21
11
  const updatedHeaders = {
@@ -85,7 +75,6 @@ publicRequest.interceptors.response.use(
85
75
  if (error?.response?.status === 401) {
86
76
  if (isBrowser) {
87
77
  window.localStorage.removeItem('user_data')
88
- window.localStorage.removeItem('access_token')
89
78
  const errorType = error?.response?.data?.error
90
79
  if (errorType === 'invalid_token') {
91
80
  window.location.href = '/'
@@ -18,7 +18,6 @@ export const setAxiosHeader = (key: string, value: string | number) => {
18
18
  interface IPublicRequest extends AxiosInstance {
19
19
  setBaseUrl: (baseUrl: string) => void;
20
20
  setGuestToken: (guestToken: string) => void;
21
- setAccessToken: (token: string) => void;
22
21
  }
23
22
 
24
23
  export const publicRequest: IPublicRequest = axios.create({
@@ -32,9 +31,6 @@ publicRequest.setBaseUrl = (baseUrl: string) =>
32
31
  publicRequest.setGuestToken = (guestToken: string) =>
33
32
  (publicRequest.defaults.headers.common['Authorization-Guest'] = guestToken)
34
33
 
35
- publicRequest.setAccessToken = token =>
36
- (publicRequest.defaults.headers.common.Authorization = token)
37
-
38
34
  export const setBaseUrl = (baseUrl: string) => {
39
35
  publicRequest.setBaseUrl(baseUrl)
40
36
  }
package/src/api/resale.ts CHANGED
@@ -22,7 +22,7 @@ export const removeFromResale = async (
22
22
  }
23
23
 
24
24
  export const processTicket = (hash: string) =>
25
- publicRequest.post(`v1/ticket/${hash}/process-invitation`)
25
+ publicRequest.post(`v1/ticket/${hash}/process`)
26
26
 
27
27
  export const declineInvitation = (hash: string) =>
28
- publicRequest.post(`v1/ticket/${hash}/decline-invitation`)
28
+ publicRequest.post(`v1/ticket/${hash}/decline`)
@@ -190,15 +190,6 @@ export const AddonsContainter = ({
190
190
  _get(pageConfigsDataResponse, 'data.attributes') || {}
191
191
 
192
192
  const skipBillingPage = pageConfigsData.skip_billing_page ?? false
193
- const nameIsRequired = pageConfigsData.names_required ?? false
194
- const ageIsRequired = pageConfigsData.age_required ?? false
195
- const phoneIsRequired = pageConfigsData.phone_required ?? false
196
- const hasAddOn = pageConfigsData.has_add_on ?? false
197
- const freeTicket = pageConfigsData.free_ticket ?? false
198
- const collectOptionalWalletAddress =
199
- pageConfigsData.collect_optional_wallet_address ?? false
200
- const collectMandatoryWalletAddress =
201
- pageConfigsData.collect_mandatory_wallet_address ?? false
202
193
 
203
194
  if (skipBillingPage && enableBillingInfoAutoCreate) {
204
195
  const ticketsQuantity = window.localStorage.getItem('quantity')
@@ -226,16 +217,9 @@ export const AddonsContainter = ({
226
217
  onPostCheckoutSuccess(checkoutResponse?.data.attributes)
227
218
  onConfirmSelectionSuccess({
228
219
  skip_billing_page: skipBillingPage,
229
- names_required: nameIsRequired,
230
- phone_required: phoneIsRequired,
231
- age_required: ageIsRequired,
232
220
  event_id: String(eventId),
233
221
  hash,
234
222
  total,
235
- hasAddOn,
236
- free_ticket: freeTicket,
237
- collect_optional_wallet_address: collectOptionalWalletAddress,
238
- collect_mandatory_wallet_address: collectMandatoryWalletAddress,
239
223
  })
240
224
  } catch (error) {
241
225
  if (error.response?.data?.data?.hasUnverifiedOrder) {
@@ -253,11 +237,7 @@ export const AddonsContainter = ({
253
237
 
254
238
  onConfirmSelectionSuccess({
255
239
  skip_billing_page: skipBillingPage && enableBillingInfoAutoCreate,
256
- names_required: nameIsRequired,
257
- phone_required: phoneIsRequired,
258
- age_required: ageIsRequired,
259
240
  event_id: String(eventId),
260
- hasAddOn,
261
241
  })
262
242
  } else {
263
243
  onConfirmSelectionError({
@@ -77,6 +77,8 @@ export interface IBillingInfoPage {
77
77
  onGetStatesError?: (e: AxiosError) => void;
78
78
  onGetProfileDataSuccess?: (res: any) => void;
79
79
  onGetProfileDataError?: (e: AxiosError) => void;
80
+ onGetCheckoutConfigsSuccess?: (res: any) => void;
81
+ onGetCheckoutConfigsError?: (e: AxiosError) => void;
80
82
  onLogin?: () => void;
81
83
  onLoginSuccess?: () => void;
82
84
  onErrorClose?: () => void;
@@ -245,6 +247,8 @@ const BillingInfoContainer = React.memo(
245
247
  customFieldsTicketHolderKeys,
246
248
  isCountryCodeEditable = true,
247
249
  onPendingVerification = _identity,
250
+ onGetCheckoutConfigsSuccess = _identity,
251
+ onGetCheckoutConfigsError = _identity,
248
252
  }: IBillingInfoPage) => {
249
253
  const [extraData, setExtraData] = useState(null)
250
254
  const [isConfigLoading, setIsConfigLoading] = useState(true)
@@ -265,20 +269,19 @@ const BillingInfoContainer = React.memo(
265
269
  setConfigs(data.data.attributes)
266
270
  setIsConfigLoading(false)
267
271
  }
272
+ onGetCheckoutConfigsSuccess(data)
268
273
  })
269
- .catch(() => {
274
+ .catch(e => {
270
275
  setIsConfigLoading(false)
276
+ onGetCheckoutConfigsError(e)
271
277
  })
272
278
  }, [isBrowser])
279
+
273
280
  const defaultCountry = isBrowser ? window.localStorage.getItem('eventCountry') : ''
274
281
  const userData =
275
282
  isBrowser && window.localStorage.getItem('user_data')
276
283
  ? JSON.parse(window.localStorage.getItem('user_data') || '')
277
284
  : {}
278
- const access_token =
279
- isBrowser && window.localStorage.getItem('access_token')
280
- ? window.localStorage.getItem('access_token') || ''
281
- : ''
282
285
  const [dataWithUniqueIds, setDataWithUniqueIds] = useState<IBillingInfoData[]>(
283
286
  assingUniqueIds(data)
284
287
  )
@@ -430,10 +433,10 @@ const BillingInfoContainer = React.memo(
430
433
  }
431
434
 
432
435
  // fetch user data
433
- const fetchUserData = async (token: string) => {
436
+ const fetchUserData = async () => {
434
437
  try {
435
- if ((isBrowser && token) || isLoggedIn) {
436
- const userDataResponse = await getProfileData(token)
438
+ if (isLoggedIn) {
439
+ const userDataResponse = await getProfileData()
437
440
  const profileSpecifiedData = _get(userDataResponse, 'data')
438
441
  const profileDataObj = setLoggedUserData(profileSpecifiedData)
439
442
  setUserValues({
@@ -452,9 +455,9 @@ const BillingInfoContainer = React.memo(
452
455
  }
453
456
 
454
457
  useEffect(() => {
455
- fetchUserData(access_token)
458
+ fetchUserData()
456
459
  fetchCart()
457
- }, [access_token, isLoggedIn])
460
+ }, [isLoggedIn])
458
461
 
459
462
  useEffect(() => {
460
463
  const collectPaymentData = async () => {
@@ -478,7 +481,6 @@ const BillingInfoContainer = React.memo(
478
481
 
479
482
  const checkoutResponse = await postOnCheckout(
480
483
  checkoutBody,
481
- access_token,
482
484
  flagFreeTicket
483
485
  )
484
486
  removeReferralKey()
@@ -527,7 +529,7 @@ const BillingInfoContainer = React.memo(
527
529
  }
528
530
 
529
531
  // Collect data_capture for Order Custom Fields
530
- const data_capture: Record<string, any> = {}
532
+ let data_capture: Record<string, any> = {}
531
533
  _forEach(customFieldsOrderKeys, (key: string) => {
532
534
  data_capture[key] = values[key]
533
535
 
@@ -535,6 +537,23 @@ const BillingInfoContainer = React.memo(
535
537
  delete checkoutBody.attributes[key]
536
538
  })
537
539
 
540
+ // Temp solution for hardcoded data capture values, to be deleted in future
541
+ data_capture = {
542
+ ...data_capture,
543
+ instagram: _get(values, 'data_capture.instagram', ''),
544
+ company: _get(values, 'data_capture.company', ''),
545
+ businessCategory: _get(values, 'data_capture.businessCategory', ''),
546
+ jobTitle: _get(values, 'data_capture.jobTitle', ''),
547
+ wallet_address: _get(values, 'data_capture.wallet_address', ''),
548
+ }
549
+
550
+ // Temp solution for hardcoded data capture values, to be deleted in future
551
+ delete checkoutBody.attributes?.['data_capture[businessCategory]']
552
+ delete checkoutBody.attributes?.['data_capture[company]']
553
+ delete checkoutBody.attributes?.['data_capture[instagram]']
554
+ delete checkoutBody.attributes?.['data_capture[jobTitle]']
555
+ delete checkoutBody.attributes?.['data_capture[wallet_address]']
556
+
538
557
  // Collect data_capture for Ticket Holders Fields
539
558
  _forEach(checkoutBody.attributes.ticket_holders, (holder, holderIndex) => {
540
559
  const holderDataCapture: Record<string, any> = {}
@@ -643,13 +662,12 @@ const BillingInfoContainer = React.memo(
643
662
 
644
663
  const checkoutResponse = await postOnCheckout(
645
664
  checkoutBody,
646
- access_token,
647
665
  flagFreeTicket
648
666
  )
649
667
  removeReferralKey()
650
668
  // After checkout is successful recover updated profile and store it on local storage if needed
651
669
  if (isBrowser) {
652
- const updatedUserData = await getProfileData(access_token)
670
+ const updatedUserData = await getProfileData()
653
671
  const profileSpecifiedData = _get(updatedUserData, 'data')
654
672
  const profileDataObj = setLoggedUserData(profileSpecifiedData)
655
673
  window.localStorage.setItem(
@@ -681,14 +699,12 @@ const BillingInfoContainer = React.memo(
681
699
  setLoading(true)
682
700
  const resRegister = await register(bodyFormData)
683
701
  const xtfCookie = _get(resRegister, 'headers.x-tf-ecommerce')
684
- const accessToken = _get(resRegister, 'data.attributes.access_token')
685
702
  const refreshToken = _get(resRegister, 'data.attributes.refresh_token')
686
703
  const userProfile = _get(resRegister, 'data.attributes.user_profile')
687
704
 
688
705
  setIsNewUser(true)
689
706
  onRegisterSuccess({
690
707
  xtfCookie,
691
- accessToken,
692
708
  refreshToken,
693
709
  userProfile,
694
710
  })
@@ -738,7 +754,6 @@ const BillingInfoContainer = React.memo(
738
754
 
739
755
  const checkoutResponse = await postOnCheckout(
740
756
  checkoutBody,
741
- undefined,
742
757
  flagFreeTicket
743
758
  )
744
759
  removeReferralKey()
@@ -759,7 +774,6 @@ const BillingInfoContainer = React.memo(
759
774
  ) {
760
775
  if (isBrowser) {
761
776
  window.localStorage.removeItem('user_data')
762
- window.localStorage.removeItem('access_token')
763
777
  setUserExpired(true)
764
778
  setShowModalLogin(true)
765
779
  setIsLoggedIn(false)
@@ -966,7 +980,7 @@ const BillingInfoContainer = React.memo(
966
980
  ? setPhoneValidationIsLoading
967
981
  : undefined
968
982
  }
969
- label={getFieldLabel(element)}
983
+ label={getFieldLabel(element, configs)}
970
984
  validate={getValidateFunctions(
971
985
  element,
972
986
  states,
@@ -1036,7 +1050,7 @@ const BillingInfoContainer = React.memo(
1036
1050
  : element.type
1037
1051
  }
1038
1052
  name={`${element.name}-${index}`}
1039
- label={getFieldLabel(element)}
1053
+ label={getFieldLabel(element, configs)}
1040
1054
  component={getFieldComponent(element)}
1041
1055
  validate={getValidateFunctions(
1042
1056
  element,
@@ -8,9 +8,9 @@ import _map from 'lodash/map'
8
8
  import { nanoid } from 'nanoid'
9
9
  import React from 'react'
10
10
 
11
+ import { AttributesConfig } from '../../api'
11
12
  import { IGroupItem } from '../../types'
12
13
  import { CONFIGS } from '../../utils'
13
- import { getQueryVariable } from '../../utils/getQueryVariable'
14
14
  import { combineValidators, requiredValidator } from '../../validators'
15
15
  import {
16
16
  CheckboxField,
@@ -101,10 +101,7 @@ export const createRegisterFormData = (
101
101
 
102
102
  _forEach(checkoutBody.attributes, (item: any, key: string) => {
103
103
  if (
104
- !(
105
- flagFreeTicket &&
106
- ['country', 'state', 'city', 'street_address'].includes(key)
107
- )
104
+ !(flagFreeTicket && ['country', 'state', 'city', 'street_address'].includes(key))
108
105
  ) {
109
106
  bodyFormData.append(key, item)
110
107
  }
@@ -244,11 +241,17 @@ export const assingUniqueIds = (data: any): any => {
244
241
  })
245
242
  }
246
243
 
247
- export const isRequiredField = (element: IGroupItem) => {
248
- const flagRequirePhone = getQueryVariable('phone_required') === 'true'
249
- const collectMandatoryWalletAddress =
250
- getQueryVariable('collect_mandatory_wallet_address') === 'true'
244
+ export const isRequiredField = (
245
+ element: IGroupItem,
246
+ configs: null | AttributesConfig
247
+ ) => {
251
248
  const { name, required } = element
249
+ const flagRequirePhone = _get(configs, 'phone_required', false)
250
+ const collectMandatoryWalletAddress = _get(
251
+ configs,
252
+ 'collect_mandatory_wallet_address',
253
+ false
254
+ )
252
255
 
253
256
  if (
254
257
  required ||
@@ -261,8 +264,8 @@ export const isRequiredField = (element: IGroupItem) => {
261
264
  return false
262
265
  }
263
266
 
264
- export const getFieldLabel = (element: IGroupItem) => {
265
- if (isRequiredField(element) || React.isValidElement(element.label)) {
267
+ export const getFieldLabel = (element: IGroupItem, configs: null | AttributesConfig) => {
268
+ if (isRequiredField(element, configs) || React.isValidElement(element.label)) {
266
269
  return element.label
267
270
  }
268
271
 
@@ -82,7 +82,6 @@ export const MyTicketsContainer = ({
82
82
  if (error.response?.data.error === 'invalid_token') {
83
83
  if (isWindowDefined) {
84
84
  window.localStorage.removeItem('user_data')
85
- window.localStorage.removeItem('access_token')
86
85
  setUserExpired(true)
87
86
  setShowModalLogin(true)
88
87
  }
@@ -54,6 +54,7 @@ export const PreRegistration: FC<IPreRegistrationProps> = ({
54
54
  const [countries, setCountries] = useState<{ [key: string]: string | number }[]>([])
55
55
  const [isLoggedIn, setIsLoggedIn] = useState(Boolean(getCookieByName(X_TF_ECOMMERCE)))
56
56
  const [confirmModalState, setConfirmModalState] = useState({ show: false, message: '' })
57
+ const [, setUserData] = useState({} as IProfileData)
57
58
  useCookieListener(X_TF_ECOMMERCE, value => setIsLoggedIn(Boolean(value)))
58
59
 
59
60
  const formFields = updateFormFieldsAttributes(
@@ -217,6 +218,7 @@ export const PreRegistration: FC<IPreRegistrationProps> = ({
217
218
  'user_data',
218
219
  JSON.stringify(_get(profileRes, 'data'))
219
220
  )
221
+ setUserData(_get(profileRes, 'data'))
220
222
  }
221
223
  }
222
224
  } catch (e) {
@@ -24,14 +24,8 @@ export const addToCartFunc = async ({
24
24
 
25
25
  const {
26
26
  skip_billing_page: skipBillingPage = false,
27
- names_required: nameIsRequired = false,
28
- age_required: ageIsRequired = false,
29
- phone_required: phoneIsRequired = false,
30
- hide_phone_field: hidePhoneField = false,
31
27
  has_add_on: hasAddOn = false,
32
28
  free_ticket: freeTicket = false,
33
- collect_optional_wallet_address: collectOptionalWalletAddress = false,
34
- collect_mandatory_wallet_address: collectMandatoryWalletAddress = false,
35
29
  } = pageConfigsData
36
30
 
37
31
  let hash: string | number | undefined = ''
@@ -52,7 +46,7 @@ export const addToCartFunc = async ({
52
46
  )
53
47
 
54
48
  const checkoutResponse = enableBillingInfoAutoCreate
55
- ? await postOnCheckout(checkoutBody, undefined, freeTicket)
49
+ ? await postOnCheckout(checkoutBody, freeTicket)
56
50
  : null
57
51
 
58
52
  hash = checkoutResponse?.data?.attributes?.hash || ''
@@ -61,13 +55,6 @@ export const addToCartFunc = async ({
61
55
 
62
56
  return {
63
57
  skip_billing_page: skipBillingPage,
64
- names_required: nameIsRequired,
65
- phone_required: phoneIsRequired,
66
- age_required: ageIsRequired,
67
- hide_phone_field: hidePhoneField,
68
- free_ticket: freeTicket,
69
- collect_optional_wallet_address: collectOptionalWalletAddress,
70
- collect_mandatory_wallet_address: collectMandatoryWalletAddress,
71
58
  event_id: String(eventId),
72
59
  hash,
73
60
  total,
@@ -3,11 +3,10 @@ import './style.css'
3
3
  import { Box, CircularProgress, Modal } from '@mui/material'
4
4
  import axios, { AxiosError } from 'axios'
5
5
  import { Field, Form, Formik } from 'formik'
6
- import _get from 'lodash/get'
7
6
  import React, { FC, useState } from 'react'
8
7
  import * as Yup from 'yup'
9
8
 
10
- import { handleSetAccessToken, register } from '../../api'
9
+ import { register } from '../../api'
11
10
  import { CONFIGS } from '../../utils'
12
11
  import { CustomField } from '../common/CustomField'
13
12
  import { PoweredBy } from '../common/PoweredBy'
@@ -15,7 +14,7 @@ import { PoweredBy } from '../common/PoweredBy'
15
14
  interface ISignupProps {
16
15
  onClose: () => void;
17
16
  onLogin: () => void;
18
- onRegisterSuccess: (value: { accessToken: string, refreshToken: string }) => void;
17
+ onRegisterSuccess: (res: any) => void;
19
18
  onRegisterError: (e: AxiosError, email: string) => void;
20
19
  showPoweredByImage?: boolean;
21
20
  }
@@ -79,15 +78,7 @@ export const SignupModal: FC<ISignupProps> = ({
79
78
 
80
79
  const res = await register(formData)
81
80
 
82
- const access_token_register = _get(res, 'data.attributes.access_token')
83
- const refreshToken = _get(res, 'data.attributes.refresh_token')
84
- handleSetAccessToken(access_token_register)
85
-
86
- const tokens = {
87
- accessToken: access_token_register,
88
- refreshToken,
89
- }
90
- onRegisterSuccess(tokens)
81
+ onRegisterSuccess(res)
91
82
  onClose()
92
83
  } catch (e) {
93
84
  if (axios.isAxiosError(e)) {
@@ -1,5 +1,4 @@
1
1
  import { AxiosError } from 'axios'
2
- import _get from 'lodash/get'
3
2
  import React, { useEffect, useState } from 'react'
4
3
 
5
4
  import { declineInvitation, processTicket } from '../../api'
@@ -50,15 +49,8 @@ export const TicketResaleContainer = ({
50
49
 
51
50
  try {
52
51
  const response = await processTicket(hash)
53
- const data = _get(response, 'data.attributes')
54
- const age_required = _get(data, 'age_required', false)
55
- const names_required = _get(data, 'names_required', false)
56
- const event_id = _get(data, 'event_id')
57
-
58
52
  onProcessTicketSuccess(response.data)
59
- window.location.href = `${
60
- billingPath ?? '/billing/billing-info/'
61
- }?age_required=${age_required}&names_required=${names_required}&event_id=${event_id}`
53
+ window.location.href = `${billingPath ?? '/billing/billing-info/'}`
62
54
  } catch (error) {
63
55
  setError(error?.response?.data?.message)
64
56
  onProcessTicketError(error.response)
@@ -5,7 +5,6 @@ import Alert from '@mui/material/Alert'
5
5
  import { ThemeProvider } from '@mui/private-theming'
6
6
  import { CSSProperties } from '@mui/styles'
7
7
  import axios, { AxiosError } from 'axios'
8
- import jwt_decode from 'jwt-decode'
9
8
  import _filter from 'lodash/filter'
10
9
  import _find from 'lodash/find'
11
10
  import _forEach from 'lodash/forEach'
@@ -54,17 +53,10 @@ import { TicketsSection } from './TicketsSection'
54
53
 
55
54
  interface CartSuccess {
56
55
  skip_billing_page: boolean;
57
- names_required: boolean;
58
- age_required: boolean;
59
- phone_required: boolean;
60
- hide_phone_field: boolean;
61
56
  event_id: string;
62
57
  hash?: string | number;
63
58
  total?: string | number;
64
59
  hasAddOn?: boolean;
65
- free_ticket: boolean;
66
- collect_optional_wallet_address?: boolean;
67
- collect_mandatory_wallet_address?: boolean;
68
60
  }
69
61
 
70
62
  export interface IGetTickets {
@@ -203,17 +195,7 @@ export const TicketsContainer = ({
203
195
  usePixel(eventId, { pageUrl })
204
196
 
205
197
  useEffect(() => {
206
- if (isWindowDefined) {
207
- const access_token = window.localStorage.getItem('access_token')
208
- if (access_token) {
209
- const decoded = jwt_decode<{ exp: number }>(access_token)
210
- if (decoded && decoded.exp < Date.now() / 1000) {
211
- window.localStorage.removeItem('access_token')
212
- window.localStorage.removeItem('user_data')
213
- }
214
- }
215
198
  window.localStorage.removeItem('extraData')
216
- }
217
199
  }, [])
218
200
 
219
201
  useEffect(() => {
@@ -247,7 +229,6 @@ export const TicketsContainer = ({
247
229
  await logout()
248
230
  onLogoutSuccess()
249
231
  if (isBrowser) {
250
- window.localStorage.removeItem('access_token')
251
232
  window.localStorage.removeItem('user_data')
252
233
  setIsLogged(false)
253
234
  const event = new window.CustomEvent('tf-logout')
@@ -399,16 +380,8 @@ export const TicketsContainer = ({
399
380
  const pageConfigsData = _get(pageConfigsDataResponse, 'data.attributes') || {}
400
381
 
401
382
  const skipBillingPage = pageConfigsData.skip_billing_page ?? false
402
- const nameIsRequired = pageConfigsData.names_required ?? false
403
- const ageIsRequired = pageConfigsData.age_required ?? false
404
- const phoneIsRequired = pageConfigsData.phone_required ?? false
405
- const hidePhoneField = pageConfigsData.hide_phone_field ?? false
406
383
  const hasAddOn = pageConfigsData.has_add_on ?? false
407
384
  const freeTicket = pageConfigsData.free_ticket ?? false
408
- const collectOptionalWalletAddress =
409
- pageConfigsData.collect_optional_wallet_address ?? false
410
- const collectMandatoryWalletAddress =
411
- pageConfigsData.collect_mandatory_wallet_address ?? false
412
385
 
413
386
  let hash: string | number | undefined = ''
414
387
  let total: string | number | undefined = ''
@@ -422,18 +395,13 @@ export const TicketsContainer = ({
422
395
  ? JSON.parse(window.localStorage.getItem('user_data') || '')
423
396
  : {}
424
397
 
425
- const access_token =
426
- isBrowser && window.localStorage.getItem('access_token')
427
- ? window.localStorage.getItem('access_token') || ''
428
- : ''
429
-
430
398
  const checkoutBody = createCheckoutDataBodyWithDefaultHolder(
431
399
  ticketQuantity,
432
400
  userData
433
401
  )
434
402
 
435
403
  const checkoutResponse = enableBillingInfoAutoCreate
436
- ? await postOnCheckout(checkoutBody, access_token, freeTicket)
404
+ ? await postOnCheckout(checkoutBody, freeTicket)
437
405
  : null
438
406
 
439
407
  hash = checkoutResponse?.data?.attributes?.hash || ''
@@ -442,13 +410,6 @@ export const TicketsContainer = ({
442
410
 
443
411
  onAddToCartSuccess({
444
412
  skip_billing_page: skipBillingPage,
445
- names_required: nameIsRequired,
446
- phone_required: phoneIsRequired,
447
- age_required: ageIsRequired,
448
- hide_phone_field: hidePhoneField,
449
- free_ticket: freeTicket,
450
- collect_optional_wallet_address: collectOptionalWalletAddress,
451
- collect_mandatory_wallet_address: collectMandatoryWalletAddress,
452
413
  event_id: String(eventId),
453
414
  hash,
454
415
  total,
@@ -4,18 +4,11 @@ export const downloadPDF = (pdfUrl: string) => {
4
4
  if (typeof window === 'undefined') return
5
5
 
6
6
  const xtfCookie = getCookieByName('X-TF-ECOMMERCE')
7
- const accessToken: string | null = localStorage.getItem('access_token')
8
7
 
9
- if (!accessToken && !xtfCookie) return
8
+ if (!xtfCookie) return
10
9
 
11
10
  let headers = {}
12
11
 
13
- if (accessToken) {
14
- headers = {
15
- Authorization: `Bearer ${accessToken}`,
16
- }
17
- }
18
-
19
12
  if (xtfCookie) {
20
13
  headers = {
21
14
  'X-TF-ECOMMERCE': xtfCookie,
@@ -35,7 +28,6 @@ export const downloadPDF = (pdfUrl: string) => {
35
28
  .then(({ blobValue, fileName }) => {
36
29
  if (!fileName) {
37
30
  throw Error('Something went wrong.')
38
- return
39
31
  }
40
32
  const file = new Blob([blobValue], { type: 'application/pdf' })
41
33
  const fileURL = URL.createObjectURL(file)
@@ -46,7 +38,5 @@ export const downloadPDF = (pdfUrl: string) => {
46
38
  link.click()
47
39
  document.body.removeChild(link)
48
40
  })
49
- .catch(error => {
50
- return error
51
- })
41
+ .catch(error => error)
52
42
  }