tf-checkout-react 1.6.6 → 1.7.2

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 (137) hide show
  1. package/README.md +401 -59
  2. package/dist/adapters/customFields.d.ts +1 -0
  3. package/dist/api/checkout.d.ts +2 -0
  4. package/dist/api/common.d.ts +1 -0
  5. package/dist/api/index.d.ts +2 -0
  6. package/dist/api/preRegistrationComplete.d.ts +1 -1
  7. package/dist/components/addonsContainer/AddonComponent.d.ts +6 -1
  8. package/dist/components/addonsContainer/SimpleAddonsContainer.d.ts +17 -0
  9. package/dist/components/addonsContainer/index.d.ts +6 -1
  10. package/dist/components/billing-info-container/hooks/index.d.ts +3 -0
  11. package/dist/components/billing-info-container/hooks/usePaymentContext.d.ts +5 -0
  12. package/dist/components/billing-info-container/hooks/usePaymentRedirect.d.ts +14 -0
  13. package/dist/components/billing-info-container/hooks/useStripePayment.d.ts +18 -0
  14. package/dist/components/billing-info-container/index.d.ts +13 -2
  15. package/dist/components/billing-info-container/utils.d.ts +26 -1
  16. package/dist/components/common/DatePickerField.d.ts +7 -1
  17. package/dist/components/common/PhoneNumberField.d.ts +1 -1
  18. package/dist/components/confirmationContainer/index.d.ts +4 -1
  19. package/dist/components/countdown/index.d.ts +1 -1
  20. package/dist/components/forgotPasswordModal/index.d.ts +2 -1
  21. package/dist/components/myTicketsContainer/index.d.ts +3 -2
  22. package/dist/components/orderDetailsContainer/index.d.ts +8 -1
  23. package/dist/components/paymentContainer/OrderDetails.d.ts +9 -0
  24. package/dist/components/paymentContainer/handlePayment.d.ts +15 -0
  25. package/dist/components/paymentContainer/index.d.ts +12 -6
  26. package/dist/components/preRegistration/FieldsSection.d.ts +7 -1
  27. package/dist/components/preRegistration/PreRegistrationComplete.d.ts +8 -0
  28. package/dist/components/preRegistration/constants.d.ts +2 -2
  29. package/dist/components/preRegistration/index.d.ts +6 -0
  30. package/dist/components/resetPasswordContainer/index.d.ts +2 -2
  31. package/dist/components/ticketsContainer/InfoIcon.d.ts +5 -0
  32. package/dist/components/ticketsContainer/TicketsSection.d.ts +3 -2
  33. package/dist/components/ticketsContainer/TimeSlotsSection.d.ts +25 -0
  34. package/dist/components/ticketsContainer/index.d.ts +29 -5
  35. package/dist/components/timerWidget/index.d.ts +2 -1
  36. package/dist/constants/index.d.ts +5 -0
  37. package/dist/index.d.ts +4 -1
  38. package/dist/tf-checkout-react.cjs.development.js +11284 -9565
  39. package/dist/tf-checkout-react.cjs.development.js.map +1 -1
  40. package/dist/tf-checkout-react.cjs.production.min.js +1 -1
  41. package/dist/tf-checkout-react.cjs.production.min.js.map +1 -1
  42. package/dist/tf-checkout-react.esm.js +11293 -9577
  43. package/dist/tf-checkout-react.esm.js.map +1 -1
  44. package/dist/tf-checkout-styles.css +1 -1
  45. package/dist/types/add_on.d.ts +1 -0
  46. package/dist/types/checkoutPageConfigs.d.ts +1 -1
  47. package/dist/types/order-data.d.ts +3 -1
  48. package/dist/utils/auth.d.ts +8 -0
  49. package/dist/utils/createCheckoutDataBodyWithDefaultHolder.d.ts +1 -0
  50. package/dist/utils/customFields.d.ts +11 -0
  51. package/dist/utils/getDomain.d.ts +1 -1
  52. package/dist/utils/index.d.ts +1 -1
  53. package/dist/utils/setConfigs.d.ts +1 -0
  54. package/package.json +14 -8
  55. package/src/adapters/customFields.ts +7 -1
  56. package/src/api/auth.ts +2 -1
  57. package/src/api/checkout.ts +9 -4
  58. package/src/api/common.ts +49 -2
  59. package/src/api/index.ts +1 -0
  60. package/src/api/interceptors.ts +7 -23
  61. package/src/api/preRegistrationComplete.ts +1 -1
  62. package/src/api/publicRequest.ts +10 -0
  63. package/src/components/addonsContainer/AddonComponent.tsx +96 -11
  64. package/src/components/addonsContainer/SimpleAddonsContainer.tsx +420 -0
  65. package/src/components/addonsContainer/index.tsx +198 -47
  66. package/src/components/billing-info-container/hooks/index.ts +3 -0
  67. package/src/components/billing-info-container/hooks/usePaymentContext.ts +22 -0
  68. package/src/components/billing-info-container/hooks/usePaymentRedirect.ts +147 -0
  69. package/src/components/billing-info-container/hooks/useStripePayment.ts +121 -0
  70. package/src/components/billing-info-container/index.tsx +859 -418
  71. package/src/components/billing-info-container/{utils.ts → utils.tsx} +124 -1
  72. package/src/components/common/CheckboxField/index.tsx +1 -1
  73. package/src/components/common/CustomField.tsx +39 -3
  74. package/src/components/common/DatePickerField.tsx +25 -10
  75. package/src/components/common/PhoneNumberField.tsx +4 -2
  76. package/src/components/common/SnackbarAlert.tsx +32 -34
  77. package/src/components/confirmationContainer/config.ts +3 -3
  78. package/src/components/confirmationContainer/index.tsx +20 -1
  79. package/src/components/confirmationContainer/social-buttons.tsx +5 -3
  80. package/src/components/confirmationContainer/style.css +9 -5
  81. package/src/components/countdown/index.tsx +22 -22
  82. package/src/components/delegationsContainer/IssueComponent.tsx +2 -1
  83. package/src/components/forgotPasswordModal/index.tsx +44 -13
  84. package/src/components/loginForm/index.tsx +1 -1
  85. package/src/components/loginModal/index.tsx +19 -27
  86. package/src/components/loginModal/style.css +3 -1
  87. package/src/components/myTicketsContainer/index.tsx +13 -9
  88. package/src/components/orderDetailsContainer/index.tsx +206 -174
  89. package/src/components/paymentContainer/OrderDetails.tsx +257 -0
  90. package/src/components/paymentContainer/handlePayment.ts +86 -0
  91. package/src/components/paymentContainer/index.tsx +299 -259
  92. package/src/components/paymentContainer/style.css +141 -0
  93. package/src/components/preRegistration/FieldsSection.tsx +8 -0
  94. package/src/components/preRegistration/PreRegistrationComplete.tsx +138 -118
  95. package/src/components/preRegistration/PreRegistrationInformations.tsx +21 -15
  96. package/src/components/preRegistration/constants.tsx +10 -4
  97. package/src/components/preRegistration/index.tsx +233 -179
  98. package/src/components/preRegistration/style.css +3 -0
  99. package/src/components/registerForm/constants.tsx +3 -1
  100. package/src/components/registerForm/index.tsx +3 -3
  101. package/src/components/registerModal/index.tsx +47 -72
  102. package/src/components/resetPasswordContainer/index.tsx +20 -14
  103. package/src/components/seatMapContainer/TicketsSection.tsx +2 -2
  104. package/src/components/signupModal/index.tsx +13 -6
  105. package/src/components/ticketResale/index.tsx +7 -0
  106. package/src/components/ticketsContainer/InfoIcon.tsx +35 -0
  107. package/src/components/ticketsContainer/PromoCodeSection.tsx +34 -28
  108. package/src/components/ticketsContainer/TicketRow.tsx +1 -1
  109. package/src/components/ticketsContainer/TicketsSection.tsx +189 -57
  110. package/src/components/ticketsContainer/TimeSlotsSection.tsx +120 -0
  111. package/src/components/ticketsContainer/index.tsx +268 -106
  112. package/src/components/timerWidget/index.tsx +15 -3
  113. package/src/components/timerWidget/style.css +2 -1
  114. package/src/constants/index.ts +2 -0
  115. package/src/env.ts +14 -6
  116. package/src/hoc/CustomFields/index.tsx +9 -1
  117. package/src/index.ts +7 -2
  118. package/src/types/add_on.ts +1 -0
  119. package/src/types/api/cart.d.ts +8 -0
  120. package/src/types/api/checkout.d.ts +58 -7
  121. package/src/types/api/common.d.ts +30 -0
  122. package/src/types/api/orders.d.ts +19 -3
  123. package/src/types/api/payment.d.ts +6 -2
  124. package/src/types/api/preRegistrationComplete.d.ts +2 -2
  125. package/src/types/checkoutPageConfigs.ts +1 -1
  126. package/src/types/order-data.ts +3 -1
  127. package/src/types/pre-registration-complete.d.ts +6 -1
  128. package/src/utils/auth.ts +32 -0
  129. package/src/utils/cookies.ts +42 -11
  130. package/src/utils/createCheckoutDataBodyWithDefaultHolder.ts +3 -1
  131. package/src/utils/customFields.ts +22 -0
  132. package/src/utils/getDomain.ts +10 -4
  133. package/src/utils/index.ts +1 -1
  134. package/src/utils/setConfigs.ts +3 -1
  135. package/dist/components/stripePayment/index.d.ts +0 -24
  136. package/src/components/stripePayment/index.tsx +0 -281
  137. package/src/components/stripePayment/style.css +0 -60
@@ -1,4 +1,5 @@
1
1
  import axios, { AxiosError } from 'axios'
2
+ import _get from 'lodash/get'
2
3
  import _identity from 'lodash/identity'
3
4
  import _map from 'lodash/map'
4
5
  import React, { useEffect, useState } from 'react'
@@ -123,7 +124,7 @@ const IssueComponent = ({
123
124
  resetForm()
124
125
  } catch (e) {
125
126
  if (axios.isAxiosError(e)) {
126
- const error = e?.response?.data?.message || 'Error'
127
+ const error = _get(e, 'response.data.message') || 'Error'
127
128
  setError(error)
128
129
  } else if (e instanceof Error) {
129
130
  setError(e?.message || 'Error')
@@ -3,6 +3,7 @@ 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 _identity from 'lodash/identity'
6
7
  import React, { FC, useState } from 'react'
7
8
  import * as Yup from 'yup'
8
9
 
@@ -13,9 +14,10 @@ import { PoweredBy } from '../common/PoweredBy'
13
14
  export interface IForgotPasswordProps {
14
15
  onClose: () => void;
15
16
  onLoginButtonClick: () => void;
16
- onForgotPasswordSuccess: (res: any) => void;
17
+ onForgotPasswordSuccess: (res: IAxiosResponseData) => void;
17
18
  onForgotPasswordError: (e: AxiosError) => void;
18
19
  showPoweredByImage?: boolean;
20
+ displaySuccessMessage?: boolean;
19
21
  }
20
22
 
21
23
  interface ValuesTypes {
@@ -39,21 +41,37 @@ const Schema = Yup.object().shape({
39
41
  })
40
42
 
41
43
  export const ForgotPasswordModal: FC<IForgotPasswordProps> = ({
42
- onClose = () => {},
43
- onLoginButtonClick = () => {},
44
- onForgotPasswordSuccess = () => {},
45
- onForgotPasswordError = () => {},
44
+ onClose = _identity,
45
+ onLoginButtonClick = _identity,
46
+ onForgotPasswordSuccess = _identity,
47
+ onForgotPasswordError = _identity,
46
48
  showPoweredByImage = false,
49
+ displaySuccessMessage = false,
47
50
  }) => {
48
51
  const [loading, setLoading] = useState(false)
52
+ const [successMessage, setSuccessMessage] = useState<string | null>(null)
53
+ const showSuccess = displaySuccessMessage && successMessage
49
54
 
50
55
  const onForgotPassword = async ({ email }: ValuesTypes) => {
56
+ if (showSuccess) {
57
+ setSuccessMessage(null)
58
+ onClose()
59
+ return
60
+ }
61
+
51
62
  try {
52
63
  setLoading(true)
53
64
  const { data } = await forgotPassword(email)
54
65
 
55
66
  onForgotPasswordSuccess(data)
56
- onClose()
67
+
68
+ if (displaySuccessMessage && data?.success) {
69
+ setSuccessMessage(data?.message)
70
+ }
71
+
72
+ if (!displaySuccessMessage) {
73
+ onClose()
74
+ }
57
75
  } catch (e) {
58
76
  if (axios.isAxiosError(e)) {
59
77
  onForgotPasswordError(e)
@@ -63,12 +81,10 @@ export const ForgotPasswordModal: FC<IForgotPasswordProps> = ({
63
81
  }
64
82
  }
65
83
 
66
- const _onClose = loading ? () => {} : onClose
67
-
68
84
  return (
69
85
  <Modal
70
86
  open={true}
71
- onClose={_onClose}
87
+ onClose={loading ? _identity : onClose}
72
88
  aria-labelledby="modal-modal-title"
73
89
  aria-describedby="modal-modal-description"
74
90
  className="forgot-password-modal"
@@ -85,16 +101,31 @@ export const ForgotPasswordModal: FC<IForgotPasswordProps> = ({
85
101
  <div className="forgot-password-container">
86
102
  <div className="title">Password Reset</div>
87
103
  <div className="forgot-password-container__singleField">
88
- <Field name="email" label="Email" component={CustomField} />
104
+ {showSuccess ? (
105
+ <p id="forgot-password-success-message">{successMessage}</p>
106
+ ) : (
107
+ <Field name="email" label="Email" component={CustomField} />
108
+ )}
89
109
  </div>
90
110
  </div>
91
111
  <div className="forgot-password-action-button">
92
- <button type="submit" disabled={!(isValid && dirty)}>
93
- {loading ? <CircularProgress size="22px" /> : 'Submit'}
112
+ <button
113
+ type="submit"
114
+ disabled={showSuccess ? false : !(isValid && dirty)}
115
+ >
116
+ {loading ? (
117
+ <CircularProgress size="22px" />
118
+ ) : showSuccess ? (
119
+ 'Close'
120
+ ) : (
121
+ 'Submit'
122
+ )}
94
123
  </button>
95
124
  </div>
96
125
  <div className="login">
97
- <span onClick={onLoginButtonClick}>Back to Log In</span>
126
+ <span aria-hidden onClick={onLoginButtonClick}>
127
+ Back to Log In
128
+ </span>
98
129
  </div>
99
130
  {showPoweredByImage ? <PoweredBy /> : null}
100
131
  </Form>
@@ -106,7 +106,7 @@ export const LoginForm: FC<ILoginFormProps> = ({
106
106
  onLoginSuccess(_get(authRes, 'data'))
107
107
  } catch (e) {
108
108
  if (axios.isAxiosError(e)) {
109
- const error = e?.response?.data?.message || 'Error'
109
+ const error = _get(e, 'response.data.message') || 'Error'
110
110
  setError(error)
111
111
  onLoginError(e)
112
112
  } else if (e instanceof Error) {
@@ -1,6 +1,5 @@
1
1
  import './style.css'
2
2
 
3
- import { TextField } from '@mui/material'
4
3
  import Box from '@mui/material/Box'
5
4
  import Modal from '@mui/material/Modal'
6
5
  import axios, { AxiosError } from 'axios'
@@ -12,6 +11,7 @@ import React, { FC, useState } from 'react'
12
11
  import { authorize, getProfileData } from '../../api'
13
12
  import { isBrowser, setLoggedUserData } from '../../utils'
14
13
  import { requiredValidator } from '../../validators'
14
+ import { CustomField } from '../common/CustomField'
15
15
  import { PoweredBy } from '../common/PoweredBy'
16
16
 
17
17
  export interface Props {
@@ -93,10 +93,10 @@ export const LoginModal: FC<Props> = ({
93
93
  const event = new window.CustomEvent('tf-login')
94
94
  window.document.dispatchEvent(event)
95
95
  }
96
- onLogin(_get(authRes, 'data.data'))
96
+ onLogin(_get(authRes, 'data.data', {}) as IProfileData)
97
97
  } catch (e) {
98
98
  if (axios.isAxiosError(e)) {
99
- const error = e?.response?.data?.message || 'Error'
99
+ const error = _get(e, 'response.data.message', 'Error')
100
100
  setError(error)
101
101
  } else if (e instanceof Error) {
102
102
  setError(e?.message || 'Error')
@@ -131,32 +131,24 @@ export const LoginModal: FC<Props> = ({
131
131
  )}
132
132
  <div className="login-modal-body">
133
133
  <div className="login-modal-body__email">
134
- <Field name={'email'} validate={requiredValidator}>
135
- {({ field, meta }: { [key: string]: any }) => (
136
- <TextField
137
- label={'Email'}
138
- type={'email'}
139
- fullWidth
140
- error={!!meta.error && meta.touched}
141
- helperText={meta.touched && meta.error}
142
- {...field}
143
- />
144
- )}
145
- </Field>
134
+ <Field
135
+ name="email"
136
+ label="Email"
137
+ type="email"
138
+ component={CustomField}
139
+ theme="light"
140
+ validate={requiredValidator}
141
+ />
146
142
  </div>
147
143
  <div className="login-modal-body__password">
148
- <Field name={'password'} validate={requiredValidator}>
149
- {({ field, meta }: { [key: string]: any }) => (
150
- <TextField
151
- label="Password"
152
- type="password"
153
- fullWidth
154
- error={!!meta.error && meta.touched}
155
- helperText={meta.touched && meta.error}
156
- {...field}
157
- />
158
- )}
159
- </Field>
144
+ <Field
145
+ name="password"
146
+ label="Password"
147
+ type="password"
148
+ component={CustomField}
149
+ theme="light"
150
+ validate={requiredValidator}
151
+ />
160
152
  </div>
161
153
  <div className="login-action-button">
162
154
  <button type="submit">Login</button>
@@ -46,7 +46,9 @@
46
46
  background-color: #505050;
47
47
  border-color: #505050;
48
48
  }
49
-
49
+ .login-logo-tff{
50
+ height: 60px;
51
+ }
50
52
  .server_auth__error {
51
53
  color: red;
52
54
  padding-left: 25px;
@@ -31,6 +31,7 @@ interface MyTicketsTypes {
31
31
  selectEventsLabel?: string;
32
32
  openLoginModal?: () => void;
33
33
  hideDetailsButton?: boolean;
34
+ customNoOrderContent?: React.ReactNode;
34
35
  columns?: IColumnData[];
35
36
  }
36
37
 
@@ -49,6 +50,7 @@ export const MyTicketsContainer = ({
49
50
  hideDetailsButton = false,
50
51
  columns = [],
51
52
  openLoginModal,
53
+ customNoOrderContent = null,
52
54
  }: MyTicketsTypes) => {
53
55
  const [data, setData] = useState<any>(null)
54
56
  const [loading, setLoading] = useState(true)
@@ -79,7 +81,7 @@ export const MyTicketsContainer = ({
79
81
  setData(data)
80
82
  } catch (error) {
81
83
  if (axios.isAxiosError(error)) {
82
- if (error.response?.data.error === 'invalid_token') {
84
+ if (_get(error, 'response.data.error') === 'invalid_token') {
83
85
  if (isWindowDefined) {
84
86
  window.localStorage.removeItem('user_data')
85
87
  setUserExpired(true)
@@ -110,6 +112,15 @@ export const MyTicketsContainer = ({
110
112
  setFilter(eventFilter?.url_name || '')
111
113
  }
112
114
 
115
+ const noOrderContent = customNoOrderContent || (<div className="no_orders_section">
116
+ <div className="nodata_title">
117
+ You have no current ticket orders on this account
118
+ </div>
119
+ <div className="nodata_subtitle">
120
+ Discover your next nite out <a href="/events">here</a>.
121
+ </div>
122
+ </div>)
123
+
113
124
  return (
114
125
  <div className={`my-ticket ${theme}`}>
115
126
  <>
@@ -191,14 +202,7 @@ export const MyTicketsContainer = ({
191
202
  !loading && (
192
203
  <>
193
204
  <h2>My Ticket Orders</h2>
194
- <div className="no_orders_section">
195
- <div className="nodata_title">
196
- You have no current ticket orders on this account
197
- </div>
198
- <div className="nodata_subtitle">
199
- Discover your next nite out <a href="/events">here</a>.
200
- </div>
201
- </div>
205
+ {noOrderContent}
202
206
  </>
203
207
  )
204
208
  )}