tf-checkout-react 1.0.44 → 1.0.45

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/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.0.44",
2
+ "version": "1.0.45",
3
3
  "license": "MIT",
4
4
  "main": "dist/index.js",
5
5
  "typings": "dist/index.d.ts",
package/src/api/index.ts CHANGED
@@ -19,7 +19,7 @@ if (
19
19
  window.location.origin !== 'https://www.houseofx.nyc' &&
20
20
  window.location.origin !== 'https://tickets-staging.houseofx.nyc'
21
21
  ) {
22
- ttfHeaders['X-Source-Origin'] = 'houseofx.com'
22
+ ttfHeaders['X-Source-Origin'] = 'houseofx.nyc'
23
23
  }
24
24
 
25
25
  interface IPublicRequest extends AxiosInstance {
@@ -78,7 +78,7 @@ publicRequest.interceptors.request.use((config: AxiosRequestConfig) => {
78
78
  ) {
79
79
  const updatedHeaders = {
80
80
  ...config.headers,
81
- 'X-Source-Origin': 'houseofx.com',
81
+ 'X-Source-Origin': 'houseofx.nyc',
82
82
  }
83
83
  config.headers = updatedHeaders
84
84
  }
@@ -57,44 +57,44 @@ const getQueryVariable = (variable: string) => {
57
57
  }
58
58
 
59
59
  export interface IBillingInfoPage {
60
- data: IBillingInfoData[];
60
+ data?: IBillingInfoData[];
61
61
  ticketHoldersFields?: IBillingInfoData;
62
- handleSubmit: (
62
+ handleSubmit?: (
63
63
  values: FormikValues,
64
64
  formikHelpers: FormikHelpers<FormikValues>,
65
65
  res?: any
66
66
  ) => void;
67
67
 
68
- onRegisterSuccess: (value: {
68
+ onRegisterSuccess?: (value: {
69
69
  accessToken: string;
70
70
  refreshToken: string;
71
71
  }) => void;
72
72
 
73
- onRegisterError: (e: AxiosError) => void;
73
+ onRegisterError?: (e: AxiosError) => void;
74
74
 
75
- onSubmitError: (e: AxiosError) => void;
75
+ onSubmitError?: (e: AxiosError) => void;
76
76
 
77
- onGetCartSuccess: (res: any) => void;
77
+ onGetCartSuccess?: (res: any) => void;
78
78
 
79
- onGetCartError: (e: AxiosError) => void;
79
+ onGetCartError?: (e: AxiosError) => void;
80
80
 
81
- onGetCountriesSuccess: (res: any) => void;
81
+ onGetCountriesSuccess?: (res: any) => void;
82
82
 
83
- onGetCountriesError: (e: AxiosError) => void;
83
+ onGetCountriesError?: (e: AxiosError) => void;
84
84
 
85
- onGetStatesSuccess: (res: any) => void;
85
+ onGetStatesSuccess?: (res: any) => void;
86
86
 
87
- onGetStatesError: (e: AxiosError) => void;
87
+ onGetStatesError?: (e: AxiosError) => void;
88
88
 
89
- onGetProfileDataSuccess: (res: any) => void;
89
+ onGetProfileDataSuccess?: (res: any) => void;
90
90
 
91
- onGetProfileDataError: (e: AxiosError) => void;
91
+ onGetProfileDataError?: (e: AxiosError) => void;
92
92
 
93
- onAuthorizeSuccess: () => void;
93
+ onAuthorizeSuccess?: () => void;
94
94
 
95
- onAuthorizeError: (e: AxiosError) => void;
95
+ onAuthorizeError?: (e: AxiosError) => void;
96
96
 
97
- onLogin: () => void;
97
+ onLogin?: () => void;
98
98
 
99
99
  initialValues?: FormikValues;
100
100
  buttonName?: string;
@@ -130,7 +130,9 @@ const LogicRunner: FC<{
130
130
  setFieldValue('state', mappedStates[0]?.label ?? '')
131
131
  onGetStatesSuccess(res.data)
132
132
  } catch (e) {
133
- onGetStatesError(e.response)
133
+ if (axios.isAxiosError(e)) {
134
+ onGetStatesError(e)
135
+ }
134
136
  }
135
137
  }
136
138
  fetchStates()
@@ -262,7 +264,9 @@ export const BillingInfoContainer = ({
262
264
  setTicketsQuantity(getQuantity(cart))
263
265
  onGetCartSuccess(res.data)
264
266
  } catch (e) {
265
- onGetCartError(e.response)
267
+ if (axios.isAxiosError(e)) {
268
+ onGetCartError(e)
269
+ }
266
270
  }
267
271
  }
268
272
 
@@ -281,7 +285,9 @@ export const BillingInfoContainer = ({
281
285
  onGetProfileDataSuccess(userDataResponse.data)
282
286
  }
283
287
  } catch (e) {
284
- onGetProfileDataError(e.response)
288
+ if (axios.isAxiosError(e)) {
289
+ onGetProfileDataError(e)
290
+ }
285
291
  }
286
292
  }
287
293
 
@@ -302,7 +308,9 @@ export const BillingInfoContainer = ({
302
308
  )
303
309
  onGetCountriesSuccess(res.data)
304
310
  } catch (e) {
305
- onGetCountriesError(e.response)
311
+ if (axios.isAxiosError(e)) {
312
+ onGetCountriesError(e)
313
+ }
306
314
  }
307
315
  }
308
316
 
@@ -385,8 +393,8 @@ export const BillingInfoContainer = ({
385
393
  setAlreadyHasUser(true)
386
394
  setShowModalLogin(true)
387
395
  }
396
+ onRegisterError(e)
388
397
  }
389
- onRegisterError(e.response)
390
398
  return
391
399
  }
392
400
 
@@ -421,8 +429,8 @@ export const BillingInfoContainer = ({
421
429
  setShowModalLogin(true)
422
430
  }
423
431
  }
432
+ onSubmitError(e)
424
433
  }
425
- onSubmitError(e.response)
426
434
  }
427
435
  }}
428
436
  >
@@ -556,15 +564,15 @@ export const BillingInfoContainer = ({
556
564
  })}
557
565
 
558
566
  {showTicketHolderName && (
559
- <SectionContainer key={ticketHoldersFields.id}>
567
+ <div>
560
568
  <p>{ticketHoldersFields.label}</p>
561
569
  {_map(new Array(ticketsQuantity), (_item, index) => (
562
570
  <div key={index}>
563
571
  <h5>Ticket {index + 1}</h5>
564
- {_map(ticketHoldersFields.fields, (group, i) => {
572
+ {_map(ticketHoldersFields.fields, group => {
565
573
  const { groupClassname, groupItems } = group
566
574
  return (
567
- <div key={i}>
575
+ <div key={group.id}>
568
576
  <div className={groupClassname}>
569
577
  {_map(groupItems, element => (
570
578
  <div
@@ -599,7 +607,7 @@ export const BillingInfoContainer = ({
599
607
  })}
600
608
  </div>
601
609
  ))}
602
- </SectionContainer>
610
+ </div>
603
611
  )}
604
612
  <div className="button-container">
605
613
  <LoadingButton
@@ -626,10 +634,10 @@ export const BillingInfoContainer = ({
626
634
  }}
627
635
  onLogin={() => {
628
636
  setShowModalLogin(false)
637
+ setUserExpired(false)
629
638
  }}
630
639
  alreadyHasUser={alreadyHasUser}
631
640
  userExpired={userExpired}
632
- setUserExpired={setUserExpired}
633
641
  onAuthorizeSuccess={onAuthorizeSuccess}
634
642
  onAuthorizeError={onAuthorizeError}
635
643
  onGetProfileDataSuccess={onGetProfileDataSuccess}
@@ -19,13 +19,12 @@ import axios from 'axios'
19
19
  interface Props {
20
20
  onClose: () => void;
21
21
  onLogin: () => void;
22
- alreadyHasUser: boolean;
23
- userExpired: boolean;
24
- setUserExpired: React.Dispatch<React.SetStateAction<boolean>>;
25
- onAuthorizeSuccess: (res: any) => void;
26
- onAuthorizeError: (e: AxiosError) => void;
27
- onGetProfileDataSuccess: (res: any) => void;
28
- onGetProfileDataError: (e: AxiosError) => void;
22
+ alreadyHasUser?: boolean;
23
+ userExpired?: boolean;
24
+ onAuthorizeSuccess?: (res: any) => void;
25
+ onAuthorizeError?: (e: AxiosError) => void;
26
+ onGetProfileDataSuccess?: (res: any) => void;
27
+ onGetProfileDataError?: (e: AxiosError) => void;
29
28
  }
30
29
 
31
30
  const style: React.CSSProperties = {
@@ -42,9 +41,8 @@ const style: React.CSSProperties = {
42
41
  export const LoginModal: FC<Props> = ({
43
42
  onClose,
44
43
  onLogin,
45
- alreadyHasUser,
46
- userExpired,
47
- setUserExpired,
44
+ alreadyHasUser = false,
45
+ userExpired = false,
48
46
  onAuthorizeSuccess = () => {},
49
47
  onAuthorizeError = () => {},
50
48
  onGetProfileDataSuccess = () => {},
@@ -89,7 +87,9 @@ export const LoginModal: FC<Props> = ({
89
87
  resAccessToken = await getAccessToken(bodyFormDataToken)
90
88
  onAuthorizeSuccess(resAccessToken.data)
91
89
  } catch (e) {
92
- onAuthorizeError(e.response)
90
+ if (axios.isAxiosError(e)) {
91
+ onAuthorizeError(e)
92
+ }
93
93
  return
94
94
  }
95
95
 
@@ -102,7 +102,9 @@ export const LoginModal: FC<Props> = ({
102
102
  profileResponse = await getProfileData(accessToken)
103
103
  onGetProfileDataSuccess(profileResponse.data)
104
104
  } catch (e) {
105
- onGetProfileDataError(e.response)
105
+ if (axios.isAxiosError(e)) {
106
+ onGetProfileDataError(e)
107
+ }
106
108
  return
107
109
  }
108
110
 
@@ -120,7 +122,6 @@ export const LoginModal: FC<Props> = ({
120
122
  )
121
123
  window.localStorage.setItem('access_token', accessToken)
122
124
  }
123
- setUserExpired(false)
124
125
  onLogin()
125
126
  } catch (e) {
126
127
  if (axios.isAxiosError(e)) {
@@ -1,5 +1,5 @@
1
1
  import React, { useState, useEffect } from 'react'
2
- import { AxiosError } from 'axios'
2
+ import axios, { AxiosError } from 'axios'
3
3
  import './style.css'
4
4
 
5
5
  import { getTickets, addToCart, setCustomHeader } from '../../api'
@@ -231,7 +231,9 @@ export const TicketsContainer = ({
231
231
  onGetTicketsSuccess(response.data)
232
232
  }
233
233
  } catch (e) {
234
- onGetTicketsError(e.response)
234
+ if (axios.isAxiosError(e)) {
235
+ onGetTicketsError(e)
236
+ }
235
237
  } finally {
236
238
  setIsLoading(false)
237
239
  }
@@ -291,7 +293,9 @@ export const TicketsContainer = ({
291
293
  })
292
294
  }
293
295
  } catch (e) {
294
- onAddToCartError(e.response)
296
+ if (axios.isAxiosError(e)) {
297
+ onAddToCartError(e)
298
+ }
295
299
  } finally {
296
300
  setHandleBookIsLoading(false)
297
301
  }
package/src/index.ts CHANGED
@@ -2,4 +2,5 @@ export { BillingInfoContainer } from './components/billing-info-container/index'
2
2
  export { PaymentContainer } from './components/paymentContainer/index'
3
3
  export { ConfirmationContainer } from './components/confirmationContainer/index'
4
4
  export { TicketsContainer } from './components/ticketsContainer/index'
5
- export { currencyNormalizerCreator, createFixedFloatNormalizer } from './normalizers'
5
+ export { currencyNormalizerCreator, createFixedFloatNormalizer } from './normalizers'
6
+ export { LoginModal } from './components/loginModal'
package/src/.DS_Store DELETED
Binary file
Binary file