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.
- package/README.md +401 -59
- package/dist/adapters/customFields.d.ts +1 -0
- package/dist/api/checkout.d.ts +2 -0
- package/dist/api/common.d.ts +1 -0
- package/dist/api/index.d.ts +2 -0
- package/dist/api/preRegistrationComplete.d.ts +1 -1
- package/dist/components/addonsContainer/AddonComponent.d.ts +6 -1
- package/dist/components/addonsContainer/SimpleAddonsContainer.d.ts +17 -0
- package/dist/components/addonsContainer/index.d.ts +6 -1
- package/dist/components/billing-info-container/hooks/index.d.ts +3 -0
- package/dist/components/billing-info-container/hooks/usePaymentContext.d.ts +5 -0
- package/dist/components/billing-info-container/hooks/usePaymentRedirect.d.ts +14 -0
- package/dist/components/billing-info-container/hooks/useStripePayment.d.ts +18 -0
- package/dist/components/billing-info-container/index.d.ts +13 -2
- package/dist/components/billing-info-container/utils.d.ts +26 -1
- package/dist/components/common/DatePickerField.d.ts +7 -1
- package/dist/components/common/PhoneNumberField.d.ts +1 -1
- package/dist/components/confirmationContainer/index.d.ts +4 -1
- package/dist/components/countdown/index.d.ts +1 -1
- package/dist/components/forgotPasswordModal/index.d.ts +2 -1
- package/dist/components/myTicketsContainer/index.d.ts +3 -2
- package/dist/components/orderDetailsContainer/index.d.ts +8 -1
- package/dist/components/paymentContainer/OrderDetails.d.ts +9 -0
- package/dist/components/paymentContainer/handlePayment.d.ts +15 -0
- package/dist/components/paymentContainer/index.d.ts +12 -6
- package/dist/components/preRegistration/FieldsSection.d.ts +7 -1
- package/dist/components/preRegistration/PreRegistrationComplete.d.ts +8 -0
- package/dist/components/preRegistration/constants.d.ts +2 -2
- package/dist/components/preRegistration/index.d.ts +6 -0
- package/dist/components/resetPasswordContainer/index.d.ts +2 -2
- package/dist/components/ticketsContainer/InfoIcon.d.ts +5 -0
- package/dist/components/ticketsContainer/TicketsSection.d.ts +3 -2
- package/dist/components/ticketsContainer/TimeSlotsSection.d.ts +25 -0
- package/dist/components/ticketsContainer/index.d.ts +29 -5
- package/dist/components/timerWidget/index.d.ts +2 -1
- package/dist/constants/index.d.ts +5 -0
- package/dist/index.d.ts +4 -1
- package/dist/tf-checkout-react.cjs.development.js +11284 -9565
- 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 +11293 -9577
- package/dist/tf-checkout-react.esm.js.map +1 -1
- package/dist/tf-checkout-styles.css +1 -1
- package/dist/types/add_on.d.ts +1 -0
- package/dist/types/checkoutPageConfigs.d.ts +1 -1
- package/dist/types/order-data.d.ts +3 -1
- package/dist/utils/auth.d.ts +8 -0
- package/dist/utils/createCheckoutDataBodyWithDefaultHolder.d.ts +1 -0
- package/dist/utils/customFields.d.ts +11 -0
- package/dist/utils/getDomain.d.ts +1 -1
- package/dist/utils/index.d.ts +1 -1
- package/dist/utils/setConfigs.d.ts +1 -0
- package/package.json +14 -8
- package/src/adapters/customFields.ts +7 -1
- package/src/api/auth.ts +2 -1
- package/src/api/checkout.ts +9 -4
- package/src/api/common.ts +49 -2
- package/src/api/index.ts +1 -0
- package/src/api/interceptors.ts +7 -23
- package/src/api/preRegistrationComplete.ts +1 -1
- package/src/api/publicRequest.ts +10 -0
- package/src/components/addonsContainer/AddonComponent.tsx +96 -11
- package/src/components/addonsContainer/SimpleAddonsContainer.tsx +420 -0
- package/src/components/addonsContainer/index.tsx +198 -47
- package/src/components/billing-info-container/hooks/index.ts +3 -0
- package/src/components/billing-info-container/hooks/usePaymentContext.ts +22 -0
- package/src/components/billing-info-container/hooks/usePaymentRedirect.ts +147 -0
- package/src/components/billing-info-container/hooks/useStripePayment.ts +121 -0
- package/src/components/billing-info-container/index.tsx +859 -418
- package/src/components/billing-info-container/{utils.ts → utils.tsx} +124 -1
- package/src/components/common/CheckboxField/index.tsx +1 -1
- package/src/components/common/CustomField.tsx +39 -3
- package/src/components/common/DatePickerField.tsx +25 -10
- package/src/components/common/PhoneNumberField.tsx +4 -2
- package/src/components/common/SnackbarAlert.tsx +32 -34
- package/src/components/confirmationContainer/config.ts +3 -3
- package/src/components/confirmationContainer/index.tsx +20 -1
- package/src/components/confirmationContainer/social-buttons.tsx +5 -3
- package/src/components/confirmationContainer/style.css +9 -5
- package/src/components/countdown/index.tsx +22 -22
- package/src/components/delegationsContainer/IssueComponent.tsx +2 -1
- package/src/components/forgotPasswordModal/index.tsx +44 -13
- package/src/components/loginForm/index.tsx +1 -1
- package/src/components/loginModal/index.tsx +19 -27
- package/src/components/loginModal/style.css +3 -1
- package/src/components/myTicketsContainer/index.tsx +13 -9
- package/src/components/orderDetailsContainer/index.tsx +206 -174
- package/src/components/paymentContainer/OrderDetails.tsx +257 -0
- package/src/components/paymentContainer/handlePayment.ts +86 -0
- package/src/components/paymentContainer/index.tsx +299 -259
- package/src/components/paymentContainer/style.css +141 -0
- package/src/components/preRegistration/FieldsSection.tsx +8 -0
- package/src/components/preRegistration/PreRegistrationComplete.tsx +138 -118
- package/src/components/preRegistration/PreRegistrationInformations.tsx +21 -15
- package/src/components/preRegistration/constants.tsx +10 -4
- package/src/components/preRegistration/index.tsx +233 -179
- package/src/components/preRegistration/style.css +3 -0
- package/src/components/registerForm/constants.tsx +3 -1
- package/src/components/registerForm/index.tsx +3 -3
- package/src/components/registerModal/index.tsx +47 -72
- package/src/components/resetPasswordContainer/index.tsx +20 -14
- package/src/components/seatMapContainer/TicketsSection.tsx +2 -2
- package/src/components/signupModal/index.tsx +13 -6
- package/src/components/ticketResale/index.tsx +7 -0
- package/src/components/ticketsContainer/InfoIcon.tsx +35 -0
- package/src/components/ticketsContainer/PromoCodeSection.tsx +34 -28
- package/src/components/ticketsContainer/TicketRow.tsx +1 -1
- package/src/components/ticketsContainer/TicketsSection.tsx +189 -57
- package/src/components/ticketsContainer/TimeSlotsSection.tsx +120 -0
- package/src/components/ticketsContainer/index.tsx +268 -106
- package/src/components/timerWidget/index.tsx +15 -3
- package/src/components/timerWidget/style.css +2 -1
- package/src/constants/index.ts +2 -0
- package/src/env.ts +14 -6
- package/src/hoc/CustomFields/index.tsx +9 -1
- package/src/index.ts +7 -2
- package/src/types/add_on.ts +1 -0
- package/src/types/api/cart.d.ts +8 -0
- package/src/types/api/checkout.d.ts +58 -7
- package/src/types/api/common.d.ts +30 -0
- package/src/types/api/orders.d.ts +19 -3
- package/src/types/api/payment.d.ts +6 -2
- package/src/types/api/preRegistrationComplete.d.ts +2 -2
- package/src/types/checkoutPageConfigs.ts +1 -1
- package/src/types/order-data.ts +3 -1
- package/src/types/pre-registration-complete.d.ts +6 -1
- package/src/utils/auth.ts +32 -0
- package/src/utils/cookies.ts +42 -11
- package/src/utils/createCheckoutDataBodyWithDefaultHolder.ts +3 -1
- package/src/utils/customFields.ts +22 -0
- package/src/utils/getDomain.ts +10 -4
- package/src/utils/index.ts +1 -1
- package/src/utils/setConfigs.ts +3 -1
- package/dist/components/stripePayment/index.d.ts +0 -24
- package/src/components/stripePayment/index.tsx +0 -281
- 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
|
|
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:
|
|
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
|
-
|
|
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={
|
|
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
|
-
|
|
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
|
|
93
|
-
|
|
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}>
|
|
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
|
|
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
|
|
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
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
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
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
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>
|
|
@@ -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.
|
|
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
|
-
|
|
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
|
)}
|