tf-checkout-react 1.0.43 → 1.0.47
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/index.d.ts +2 -0
- package/dist/components/billing-info-container/index.d.ts +22 -3
- package/dist/components/billing-info-container/utils.d.ts +2 -2
- package/dist/components/common/CheckboxField.d.ts +2 -2
- package/dist/components/confirmationContainer/index.d.ts +4 -1
- package/dist/components/loginModal/index.d.ts +8 -4
- package/dist/components/paymentContainer/index.d.ts +5 -1
- package/dist/components/registerModal/index.d.ts +3 -0
- package/dist/components/ticketsContainer/TicketRow.d.ts +10 -0
- package/dist/components/ticketsContainer/TicketsSection.d.ts +10 -0
- package/dist/components/ticketsContainer/index.d.ts +7 -1
- package/dist/components/ticketsContainer/utils.d.ts +4 -0
- package/dist/components/waitingList/index.d.ts +7 -0
- package/dist/index.d.ts +1 -0
- package/dist/tf-checkout-react.cjs.development.css +3 -2
- package/dist/tf-checkout-react.cjs.development.js +827 -269
- 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 +832 -272
- package/dist/tf-checkout-react.esm.js.map +1 -1
- package/dist/types/billing-info-data.d.ts +2 -2
- package/dist/validators/index.d.ts +2 -1
- package/package.json +4 -1
- package/src/api/index.ts +7 -3
- package/src/components/billing-info-container/index.tsx +278 -70
- package/src/components/billing-info-container/style.css +15 -0
- package/src/components/billing-info-container/utils.ts +41 -13
- package/src/components/common/CheckboxField.tsx +3 -2
- package/src/components/common/CustomField.tsx +16 -1
- package/src/components/confirmationContainer/index.tsx +8 -3
- package/src/components/loginModal/index.tsx +46 -13
- package/src/components/paymentContainer/index.tsx +10 -0
- package/src/components/registerModal/index.tsx +20 -3
- package/src/components/ticketsContainer/TicketRow.tsx +86 -0
- package/src/components/ticketsContainer/TicketsSection.tsx +82 -0
- package/src/components/ticketsContainer/index.tsx +98 -210
- package/src/components/ticketsContainer/utils.ts +11 -0
- package/src/components/waitingList/index.tsx +162 -0
- package/src/components/waitingList/style.css +18 -0
- package/src/index.ts +2 -1
- package/src/types/billing-info-data.ts +2 -2
- package/src/validators/index.ts +9 -3
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
2
|
export interface IGroupItem {
|
|
3
3
|
name: string;
|
|
4
|
-
label: string;
|
|
4
|
+
label: string | JSX.Element;
|
|
5
5
|
type?: string;
|
|
6
6
|
className?: string;
|
|
7
7
|
required?: boolean;
|
|
@@ -19,6 +19,6 @@ export interface IFieldData {
|
|
|
19
19
|
export interface IBillingInfoData {
|
|
20
20
|
id: number | string;
|
|
21
21
|
fields: IFieldData[];
|
|
22
|
-
label?: string;
|
|
22
|
+
label?: string | JSX.Element;
|
|
23
23
|
labelClassName?: string;
|
|
24
24
|
}
|
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
export declare const combineValidators: (...validators: any) => (...value: any) => any;
|
|
2
|
-
export declare const requiredValidator: (value?: string | number | undefined) => string;
|
|
2
|
+
export declare const requiredValidator: (value?: string | number | undefined, message?: string | undefined) => string;
|
|
3
|
+
export declare const emailValidator: (email: string) => "" | "Please enter a valid email address";
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "1.0.
|
|
2
|
+
"version": "1.0.47",
|
|
3
3
|
"license": "MIT",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"typings": "dist/index.d.ts",
|
|
@@ -66,7 +66,9 @@
|
|
|
66
66
|
"dependencies": {
|
|
67
67
|
"@emotion/react": "^11.5.0",
|
|
68
68
|
"@emotion/styled": "^11.3.0",
|
|
69
|
+
"@mui/lab": "^5.0.0-alpha.55",
|
|
69
70
|
"@mui/material": "5.1.0",
|
|
71
|
+
"@mui/styles": "^5.1.1",
|
|
70
72
|
"@stripe/react-stripe-js": "^1.6.0",
|
|
71
73
|
"@stripe/stripe-js": "^1.21.1",
|
|
72
74
|
"autoprefixer": "^10.4.0",
|
|
@@ -76,6 +78,7 @@
|
|
|
76
78
|
"jwt-decode": "^3.1.2",
|
|
77
79
|
"lodash": "^4.17.21",
|
|
78
80
|
"lodash-es": "^4.17.21",
|
|
81
|
+
"nanoid": "^3.1.30",
|
|
79
82
|
"react-bootstrap": "^2.0.2",
|
|
80
83
|
"react-inlinesvg": "^2.3.0"
|
|
81
84
|
}
|
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
|
-
|
|
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
|
-
|
|
81
|
+
'X-Source-Origin': 'houseofx.nyc',
|
|
82
82
|
}
|
|
83
83
|
config.headers = updatedHeaders
|
|
84
84
|
}
|
|
@@ -215,4 +215,8 @@ export const getCountries = () => publicRequest.get('/countries/')
|
|
|
215
215
|
|
|
216
216
|
export const getConfirmationData = (orderHash: string) => publicRequest.get(`/v1/order/${orderHash}/payment/complete`)
|
|
217
217
|
|
|
218
|
-
export const getStates = (countryId: string) => publicRequest.get(`/countries/${countryId}/states/`)
|
|
218
|
+
export const getStates = (countryId: string) => publicRequest.get(`/countries/${countryId}/states/`)
|
|
219
|
+
|
|
220
|
+
export const addToWaitingList = (id: number, data: any) => publicRequest.post(`/v1/event/${id}/add_to_waiting_list`, data)
|
|
221
|
+
|
|
222
|
+
export const getConditions = (eventId: string) => publicRequest.get(`v1/event/${eventId}/conditions`)
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React, { FC, useEffect, useState } from 'react'
|
|
2
|
+
import { AxiosError } from 'axios'
|
|
2
3
|
import {
|
|
3
4
|
Field,
|
|
4
5
|
Form,
|
|
@@ -7,7 +8,7 @@ import {
|
|
|
7
8
|
FormikProps,
|
|
8
9
|
FormikValues,
|
|
9
10
|
} from 'formik'
|
|
10
|
-
import
|
|
11
|
+
import LoadingButton from '@mui/lab/LoadingButton'
|
|
11
12
|
import _identity from 'lodash/identity'
|
|
12
13
|
import _map from 'lodash/map'
|
|
13
14
|
import _get from 'lodash/get'
|
|
@@ -25,6 +26,7 @@ import {
|
|
|
25
26
|
register,
|
|
26
27
|
setCustomHeader,
|
|
27
28
|
getStates,
|
|
29
|
+
getConditions,
|
|
28
30
|
} from '../../api'
|
|
29
31
|
import { LoginModal } from '../loginModal'
|
|
30
32
|
import { RegisterModal } from '../registerModal'
|
|
@@ -37,6 +39,8 @@ import {
|
|
|
37
39
|
import { CustomField } from '../common/CustomField'
|
|
38
40
|
import axios from 'axios'
|
|
39
41
|
import { CheckboxField } from '../common/CheckboxField'
|
|
42
|
+
import { CircularProgress } from '@mui/material'
|
|
43
|
+
import { nanoid } from 'nanoid'
|
|
40
44
|
|
|
41
45
|
// const TTFLOGO = require('./logo-ttf.png')
|
|
42
46
|
|
|
@@ -55,13 +59,45 @@ const getQueryVariable = (variable: string) => {
|
|
|
55
59
|
}
|
|
56
60
|
|
|
57
61
|
export interface IBillingInfoPage {
|
|
58
|
-
data
|
|
59
|
-
|
|
62
|
+
data?: IBillingInfoData[];
|
|
63
|
+
ticketHoldersFields?: IBillingInfoData;
|
|
64
|
+
handleSubmit?: (
|
|
60
65
|
values: FormikValues,
|
|
61
66
|
formikHelpers: FormikHelpers<FormikValues>,
|
|
62
67
|
res?: any
|
|
63
68
|
) => void;
|
|
64
69
|
|
|
70
|
+
onRegisterSuccess?: (value: {
|
|
71
|
+
accessToken: string;
|
|
72
|
+
refreshToken: string;
|
|
73
|
+
}) => void;
|
|
74
|
+
|
|
75
|
+
onRegisterError?: (e: AxiosError) => void;
|
|
76
|
+
|
|
77
|
+
onSubmitError?: (e: AxiosError) => void;
|
|
78
|
+
|
|
79
|
+
onGetCartSuccess?: (res: any) => void;
|
|
80
|
+
|
|
81
|
+
onGetCartError?: (e: AxiosError) => void;
|
|
82
|
+
|
|
83
|
+
onGetCountriesSuccess?: (res: any) => void;
|
|
84
|
+
|
|
85
|
+
onGetCountriesError?: (e: AxiosError) => void;
|
|
86
|
+
|
|
87
|
+
onGetStatesSuccess?: (res: any) => void;
|
|
88
|
+
|
|
89
|
+
onGetStatesError?: (e: AxiosError) => void;
|
|
90
|
+
|
|
91
|
+
onGetProfileDataSuccess?: (res: any) => void;
|
|
92
|
+
|
|
93
|
+
onGetProfileDataError?: (e: AxiosError) => void;
|
|
94
|
+
|
|
95
|
+
onAuthorizeSuccess?: () => void;
|
|
96
|
+
|
|
97
|
+
onAuthorizeError?: (e: AxiosError) => void;
|
|
98
|
+
|
|
99
|
+
onLogin?: () => void;
|
|
100
|
+
|
|
65
101
|
initialValues?: FormikValues;
|
|
66
102
|
buttonName?: string;
|
|
67
103
|
theme?: 'light' | 'dark';
|
|
@@ -73,7 +109,17 @@ const LogicRunner: FC<{
|
|
|
73
109
|
setFieldValue: any;
|
|
74
110
|
setValues: any;
|
|
75
111
|
setUserValues: any;
|
|
76
|
-
|
|
112
|
+
onGetStatesSuccess: any;
|
|
113
|
+
onGetStatesError: any;
|
|
114
|
+
}> = ({
|
|
115
|
+
values,
|
|
116
|
+
setStates,
|
|
117
|
+
setFieldValue,
|
|
118
|
+
setValues,
|
|
119
|
+
setUserValues,
|
|
120
|
+
onGetStatesSuccess,
|
|
121
|
+
onGetStatesError,
|
|
122
|
+
}) => {
|
|
77
123
|
useEffect(() => {
|
|
78
124
|
const fetchStates = async () => {
|
|
79
125
|
try {
|
|
@@ -84,7 +130,12 @@ const LogicRunner: FC<{
|
|
|
84
130
|
}))
|
|
85
131
|
setStates(mappedStates)
|
|
86
132
|
setFieldValue('state', mappedStates[0]?.label ?? '')
|
|
87
|
-
|
|
133
|
+
onGetStatesSuccess(res.data)
|
|
134
|
+
} catch (e) {
|
|
135
|
+
if (axios.isAxiosError(e)) {
|
|
136
|
+
onGetStatesError(e)
|
|
137
|
+
}
|
|
138
|
+
}
|
|
88
139
|
}
|
|
89
140
|
fetchStates()
|
|
90
141
|
}, [values.country, setStates, setFieldValue])
|
|
@@ -105,9 +156,6 @@ const LogicRunner: FC<{
|
|
|
105
156
|
email: parsedData?.email || '',
|
|
106
157
|
phone: parsedData?.phone || '',
|
|
107
158
|
confirmEmail: '',
|
|
108
|
-
holderFirstName: '',
|
|
109
|
-
holderLastName: '',
|
|
110
|
-
holderAge: '',
|
|
111
159
|
state: parsedData?.state || '',
|
|
112
160
|
street_address: parsedData?.street_address || '',
|
|
113
161
|
country: parsedData?.country || 1,
|
|
@@ -119,9 +167,7 @@ const LogicRunner: FC<{
|
|
|
119
167
|
}
|
|
120
168
|
setValues(mappedValues)
|
|
121
169
|
setUserValues(mappedValues)
|
|
122
|
-
} catch (e) {
|
|
123
|
-
console.log(e)
|
|
124
|
-
}
|
|
170
|
+
} catch (e) {}
|
|
125
171
|
}
|
|
126
172
|
}
|
|
127
173
|
}
|
|
@@ -135,10 +181,28 @@ const SectionContainer: FC = ({ children }) => <>{children}</>
|
|
|
135
181
|
|
|
136
182
|
export const BillingInfoContainer = ({
|
|
137
183
|
data = [],
|
|
184
|
+
ticketHoldersFields = {
|
|
185
|
+
id: 1,
|
|
186
|
+
fields: [],
|
|
187
|
+
},
|
|
138
188
|
initialValues = {},
|
|
139
189
|
buttonName = 'Submit',
|
|
140
190
|
handleSubmit = _identity,
|
|
141
191
|
theme = 'light',
|
|
192
|
+
onRegisterSuccess = () => {},
|
|
193
|
+
onRegisterError = () => {},
|
|
194
|
+
onSubmitError = () => {},
|
|
195
|
+
onGetCartSuccess = () => {},
|
|
196
|
+
onGetCartError = () => {},
|
|
197
|
+
onGetCountriesSuccess = () => {},
|
|
198
|
+
onGetCountriesError = () => {},
|
|
199
|
+
onGetStatesSuccess = () => {},
|
|
200
|
+
onGetStatesError = () => {},
|
|
201
|
+
onGetProfileDataSuccess = () => {},
|
|
202
|
+
onGetProfileDataError = () => {},
|
|
203
|
+
onAuthorizeSuccess = () => {},
|
|
204
|
+
onAuthorizeError = () => {},
|
|
205
|
+
onLogin = () => {},
|
|
142
206
|
}: IBillingInfoPage) => {
|
|
143
207
|
const userData =
|
|
144
208
|
typeof window !== 'undefined' && window.localStorage.getItem('user_data')
|
|
@@ -156,6 +220,8 @@ export const BillingInfoContainer = ({
|
|
|
156
220
|
const [alreadyHasUser, setAlreadyHasUser] = useState(false)
|
|
157
221
|
const [userExpired, setUserExpired] = useState(false)
|
|
158
222
|
const [showModalRegister, setShowModalRegister] = useState(false)
|
|
223
|
+
const [ticketsQuantity, setTicketsQuantity] = useState<string[]>([])
|
|
224
|
+
const [conditions, setConditions] = useState<{id: string, text: string}[]>([])
|
|
159
225
|
const [userValues, setUserValues] = useState<any>({
|
|
160
226
|
firstName: '',
|
|
161
227
|
lastName: '',
|
|
@@ -181,15 +247,66 @@ export const BillingInfoContainer = ({
|
|
|
181
247
|
|
|
182
248
|
const showDOB = getQueryVariable('age_required') === 'true'
|
|
183
249
|
const showTicketHolderName = getQueryVariable('names_required') === 'true'
|
|
250
|
+
const eventId = getQueryVariable('event_id')
|
|
184
251
|
const optedInFieldValue: boolean = _get(cartInfoData, 'optedIn', false)
|
|
252
|
+
const hideOptIn: boolean = _get(cartInfoData, 'hide_ttf_opt_in', false)
|
|
253
|
+
|
|
254
|
+
const getQuantity = (cart: any = []) => {
|
|
255
|
+
let qty: any = 0
|
|
256
|
+
cart.forEach((item: any) => {
|
|
257
|
+
qty += +item.quantity
|
|
258
|
+
})
|
|
259
|
+
return qty
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
//just once
|
|
263
|
+
useEffect(() => {
|
|
264
|
+
// fetch conditions data
|
|
265
|
+
const fetchConditions = async () => {
|
|
266
|
+
if (eventId) {
|
|
267
|
+
const res = await getConditions(eventId)
|
|
268
|
+
const conditionsInfo = _get(res, 'data.data.attributes')
|
|
269
|
+
setConditions(conditionsInfo ? conditionsInfo.map((item: string) => ({ id: nanoid(), text: item })) : [])
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
fetchConditions()
|
|
273
|
+
// fetch countries data
|
|
274
|
+
const fetchCountries = async () => {
|
|
275
|
+
try {
|
|
276
|
+
const res = await getCountries()
|
|
277
|
+
setCustomHeader(res)
|
|
278
|
+
setCountries(
|
|
279
|
+
_map(_get(res, 'data.data'), (item, key) => ({
|
|
280
|
+
label: item,
|
|
281
|
+
value: Number(key),
|
|
282
|
+
}))
|
|
283
|
+
)
|
|
284
|
+
onGetCountriesSuccess(res.data)
|
|
285
|
+
} catch (e) {
|
|
286
|
+
if (axios.isAxiosError(e)) {
|
|
287
|
+
onGetCountriesError(e)
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
fetchCountries()
|
|
292
|
+
fetchCart()
|
|
293
|
+
}, [])
|
|
185
294
|
|
|
186
295
|
// fetch cart data
|
|
187
296
|
const fetchCart = async () => {
|
|
188
297
|
try {
|
|
189
298
|
const res = await getCart()
|
|
190
299
|
setCustomHeader(res)
|
|
191
|
-
|
|
192
|
-
|
|
300
|
+
const cartInfo = _get(res, 'data.data.attributes')
|
|
301
|
+
setCartInfo(cartInfo)
|
|
302
|
+
const { cart = [] } = cartInfo
|
|
303
|
+
setTicketsQuantity(new Array(getQuantity(cart)).fill(null).map(() => nanoid()))
|
|
304
|
+
onGetCartSuccess(res.data)
|
|
305
|
+
} catch (e) {
|
|
306
|
+
if (axios.isAxiosError(e)) {
|
|
307
|
+
onGetCartError(e)
|
|
308
|
+
}
|
|
309
|
+
}
|
|
193
310
|
}
|
|
194
311
|
|
|
195
312
|
// fetch user data
|
|
@@ -204,42 +321,34 @@ export const BillingInfoContainer = ({
|
|
|
204
321
|
'user_data',
|
|
205
322
|
JSON.stringify(profileDataObj)
|
|
206
323
|
)
|
|
324
|
+
onGetProfileDataSuccess(userDataResponse.data)
|
|
325
|
+
}
|
|
326
|
+
} catch (e) {
|
|
327
|
+
if (axios.isAxiosError(e)) {
|
|
328
|
+
onGetProfileDataError(e)
|
|
207
329
|
}
|
|
208
|
-
}
|
|
330
|
+
}
|
|
209
331
|
}
|
|
210
332
|
|
|
211
333
|
useEffect(() => {
|
|
212
|
-
fetchCart()
|
|
213
334
|
fetchUserData(access_token)
|
|
214
|
-
|
|
215
|
-
// fetch countries data
|
|
216
|
-
const fetchCountries = async () => {
|
|
217
|
-
const res = await getCountries()
|
|
218
|
-
setCustomHeader(res)
|
|
219
|
-
setCountries(
|
|
220
|
-
_map(_get(res, 'data.data'), (item, key) => ({
|
|
221
|
-
label: item,
|
|
222
|
-
value: Number(key),
|
|
223
|
-
}))
|
|
224
|
-
)
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
if (!(countries && countries.length)) {
|
|
228
|
-
fetchCountries()
|
|
229
|
-
}
|
|
230
|
-
}, [access_token, countries])
|
|
335
|
+
}, [access_token])
|
|
231
336
|
|
|
232
337
|
return (
|
|
233
338
|
<>
|
|
234
339
|
<Formik
|
|
235
|
-
initialValues={getInitialValues(
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
340
|
+
initialValues={getInitialValues(
|
|
341
|
+
data,
|
|
342
|
+
{
|
|
343
|
+
...initialValues,
|
|
344
|
+
email: emailLogged,
|
|
345
|
+
firstName: firstNameLogged,
|
|
346
|
+
lastName: lastNameLogged,
|
|
347
|
+
country: 1,
|
|
348
|
+
brand_opt_in: optedInFieldValue,
|
|
349
|
+
},
|
|
350
|
+
userValues
|
|
351
|
+
)}
|
|
243
352
|
enableReinitialize={true}
|
|
244
353
|
onSubmit={async (values, formikHelpers) => {
|
|
245
354
|
try {
|
|
@@ -256,6 +365,7 @@ export const BillingInfoContainer = ({
|
|
|
256
365
|
}
|
|
257
366
|
}
|
|
258
367
|
const checkoutBody = createCheckoutDataBody(
|
|
368
|
+
ticketsQuantity.length,
|
|
259
369
|
values,
|
|
260
370
|
{ emailLogged, firstNameLogged, lastNameLogged },
|
|
261
371
|
showDOB
|
|
@@ -266,12 +376,50 @@ export const BillingInfoContainer = ({
|
|
|
266
376
|
}
|
|
267
377
|
|
|
268
378
|
const bodyFormData = createRegisterFormData(values)
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
379
|
+
|
|
380
|
+
let access_token_register = null
|
|
381
|
+
try {
|
|
382
|
+
const resRegister = await register(bodyFormData)
|
|
383
|
+
access_token_register = _get(
|
|
384
|
+
resRegister,
|
|
385
|
+
'data.data.attributes.access_token'
|
|
386
|
+
)
|
|
387
|
+
const refreshToken = _get(
|
|
388
|
+
resRegister,
|
|
389
|
+
'data.data.attributes.refresh_token'
|
|
390
|
+
)
|
|
391
|
+
handleSetAccessToken(access_token_register)
|
|
392
|
+
|
|
393
|
+
const tokens = {
|
|
394
|
+
accessToken: access_token_register,
|
|
395
|
+
refreshToken,
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
onRegisterSuccess(tokens)
|
|
399
|
+
} catch (e) {
|
|
400
|
+
if (axios.isAxiosError(e)) {
|
|
401
|
+
const error = e?.response?.data?.message
|
|
402
|
+
if (_includes(error, 'You must be aged')) {
|
|
403
|
+
formikHelpers.setFieldError('holderAge', error)
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
if (error?.password) {
|
|
407
|
+
formikHelpers.setFieldError('password', error.password)
|
|
408
|
+
formikHelpers.setFieldError(
|
|
409
|
+
'confirmPassword',
|
|
410
|
+
error.password
|
|
411
|
+
)
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
if (error?.email) {
|
|
415
|
+
setAlreadyHasUser(true)
|
|
416
|
+
setShowModalLogin(true)
|
|
417
|
+
}
|
|
418
|
+
onRegisterError(e)
|
|
419
|
+
}
|
|
420
|
+
return
|
|
421
|
+
}
|
|
422
|
+
|
|
275
423
|
const profileData = await getProfileData(access_token_register)
|
|
276
424
|
const profileSpecifiedData = _get(profileData, 'data.data')
|
|
277
425
|
const profileDataObj = setLoggedUserData(profileSpecifiedData)
|
|
@@ -283,6 +431,7 @@ export const BillingInfoContainer = ({
|
|
|
283
431
|
}
|
|
284
432
|
|
|
285
433
|
const checkoutBody = createCheckoutDataBody(
|
|
434
|
+
ticketsQuantity.length,
|
|
286
435
|
values,
|
|
287
436
|
{ emailLogged, firstNameLogged, lastNameLogged },
|
|
288
437
|
showDOB
|
|
@@ -294,20 +443,6 @@ export const BillingInfoContainer = ({
|
|
|
294
443
|
handleSubmit(values, formikHelpers as FormikHelpers<any>, res)
|
|
295
444
|
} catch (e) {
|
|
296
445
|
if (axios.isAxiosError(e)) {
|
|
297
|
-
const error = e?.response?.data?.message
|
|
298
|
-
if (_includes(error, 'You must be aged')) {
|
|
299
|
-
formikHelpers.setFieldError('holderAge', error)
|
|
300
|
-
}
|
|
301
|
-
|
|
302
|
-
if (error?.password) {
|
|
303
|
-
formikHelpers.setFieldError('password', error.password)
|
|
304
|
-
formikHelpers.setFieldError('confirmPassword', error.password)
|
|
305
|
-
}
|
|
306
|
-
|
|
307
|
-
if (error?.email) {
|
|
308
|
-
setAlreadyHasUser(true)
|
|
309
|
-
setShowModalLogin(true)
|
|
310
|
-
}
|
|
311
446
|
if (e.response?.data.error === 'invalid_token') {
|
|
312
447
|
if (typeof window !== 'undefined') {
|
|
313
448
|
window.localStorage.removeItem('user_data')
|
|
@@ -316,6 +451,7 @@ export const BillingInfoContainer = ({
|
|
|
316
451
|
setShowModalLogin(true)
|
|
317
452
|
}
|
|
318
453
|
}
|
|
454
|
+
onSubmitError(e)
|
|
319
455
|
}
|
|
320
456
|
}
|
|
321
457
|
}}
|
|
@@ -328,6 +464,8 @@ export const BillingInfoContainer = ({
|
|
|
328
464
|
setFieldValue={props.setFieldValue}
|
|
329
465
|
setValues={props.setValues}
|
|
330
466
|
setUserValues={setUserValues}
|
|
467
|
+
onGetStatesSuccess={onGetStatesSuccess}
|
|
468
|
+
onGetStatesError={onGetStatesError}
|
|
331
469
|
/>
|
|
332
470
|
<div className={`billing-info-container ${theme}`}>
|
|
333
471
|
{!isLoggedIn && (
|
|
@@ -341,6 +479,7 @@ export const BillingInfoContainer = ({
|
|
|
341
479
|
className="login-register-button"
|
|
342
480
|
type="button"
|
|
343
481
|
onClick={() => {
|
|
482
|
+
onLogin()
|
|
344
483
|
setShowModalLogin(true)
|
|
345
484
|
}}
|
|
346
485
|
>
|
|
@@ -396,6 +535,9 @@ export const BillingInfoContainer = ({
|
|
|
396
535
|
if (el.name === 'holderAge' && !showDOB) {
|
|
397
536
|
return false
|
|
398
537
|
}
|
|
538
|
+
if (el.name === 'brand_opt_in' && hideOptIn) {
|
|
539
|
+
return false
|
|
540
|
+
}
|
|
399
541
|
return true
|
|
400
542
|
}),
|
|
401
543
|
element =>
|
|
@@ -445,20 +587,80 @@ export const BillingInfoContainer = ({
|
|
|
445
587
|
</SectionContainer>
|
|
446
588
|
)
|
|
447
589
|
})}
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
590
|
+
|
|
591
|
+
{showTicketHolderName && (
|
|
592
|
+
<>
|
|
593
|
+
<p>{ticketHoldersFields.label}</p>
|
|
594
|
+
{_map(ticketsQuantity, (_item, index) => (
|
|
595
|
+
<div key={_item}>
|
|
596
|
+
<h5>Ticket {index + 1}</h5>
|
|
597
|
+
{_map(ticketHoldersFields.fields, group => {
|
|
598
|
+
const { groupClassname, groupItems } = group
|
|
599
|
+
return (
|
|
600
|
+
<div key={group.id}>
|
|
601
|
+
<div className={groupClassname}>
|
|
602
|
+
{_map(groupItems, element => (
|
|
603
|
+
<div
|
|
604
|
+
className={element.className}
|
|
605
|
+
key={`${element.name}-${index}`}
|
|
606
|
+
>
|
|
607
|
+
<Field
|
|
608
|
+
name={`${element.name}-${index}`}
|
|
609
|
+
key={`${element.name}-${index}`}
|
|
610
|
+
label={element.label}
|
|
611
|
+
type={element.type}
|
|
612
|
+
required={true}
|
|
613
|
+
component={
|
|
614
|
+
element.type === 'checkbox'
|
|
615
|
+
? CheckboxField
|
|
616
|
+
: CustomField
|
|
617
|
+
}
|
|
618
|
+
validate={combineValidators(
|
|
619
|
+
element.required
|
|
620
|
+
? requiredValidator
|
|
621
|
+
: () => {},
|
|
622
|
+
element.onValidate
|
|
623
|
+
? element.onValidate
|
|
624
|
+
: () => {}
|
|
625
|
+
)}
|
|
626
|
+
/>
|
|
627
|
+
</div>
|
|
628
|
+
))}
|
|
629
|
+
</div>
|
|
630
|
+
</div>
|
|
631
|
+
)
|
|
632
|
+
})}
|
|
633
|
+
</div>
|
|
634
|
+
))}
|
|
635
|
+
</>
|
|
636
|
+
)}
|
|
637
|
+
{conditions?.map(checkbox => (
|
|
638
|
+
<div className={'billing-info-container__singleField'} key={checkbox.id}>
|
|
639
|
+
<div className="width-fc">
|
|
640
|
+
<Field
|
|
641
|
+
name={checkbox.id}
|
|
642
|
+
label={checkbox.text}
|
|
643
|
+
type={'checkbox'}
|
|
644
|
+
required={true}
|
|
645
|
+
component={CheckboxField}
|
|
646
|
+
validate={combineValidators(requiredValidator)}
|
|
647
|
+
/>
|
|
648
|
+
</div>
|
|
649
|
+
</div>
|
|
650
|
+
))}
|
|
651
|
+
<div className="button-container">
|
|
652
|
+
<LoadingButton
|
|
456
653
|
type="submit"
|
|
457
654
|
variant="contained"
|
|
458
655
|
className="login-register-button"
|
|
656
|
+
loadingIndicator={
|
|
657
|
+
<CircularProgress color="inherit" size={26} />
|
|
658
|
+
}
|
|
659
|
+
loading={props.isSubmitting}
|
|
660
|
+
disabled={props.isSubmitting}
|
|
459
661
|
>
|
|
460
662
|
{buttonName}
|
|
461
|
-
</
|
|
663
|
+
</LoadingButton>
|
|
462
664
|
</div>
|
|
463
665
|
</div>
|
|
464
666
|
</Form>
|
|
@@ -471,10 +673,14 @@ export const BillingInfoContainer = ({
|
|
|
471
673
|
}}
|
|
472
674
|
onLogin={() => {
|
|
473
675
|
setShowModalLogin(false)
|
|
676
|
+
setUserExpired(false)
|
|
474
677
|
}}
|
|
475
678
|
alreadyHasUser={alreadyHasUser}
|
|
476
679
|
userExpired={userExpired}
|
|
477
|
-
|
|
680
|
+
onAuthorizeSuccess={onAuthorizeSuccess}
|
|
681
|
+
onAuthorizeError={onAuthorizeError}
|
|
682
|
+
onGetProfileDataSuccess={onGetProfileDataSuccess}
|
|
683
|
+
onGetProfileDataError={onGetProfileDataError}
|
|
478
684
|
/>
|
|
479
685
|
)}
|
|
480
686
|
{showModalRegister && (
|
|
@@ -485,6 +691,8 @@ export const BillingInfoContainer = ({
|
|
|
485
691
|
onRegister={() => {
|
|
486
692
|
setShowModalRegister(false)
|
|
487
693
|
}}
|
|
694
|
+
onGetProfileDataSuccess={onGetProfileDataSuccess}
|
|
695
|
+
onGetProfileDataError={onGetProfileDataError}
|
|
488
696
|
/>
|
|
489
697
|
)}
|
|
490
698
|
</>
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
.button-container {
|
|
2
|
+
display: flex;
|
|
3
|
+
padding: 20px;
|
|
4
|
+
justify-content: center;
|
|
5
|
+
}
|
|
6
|
+
|
|
1
7
|
.billing-info-container {
|
|
2
8
|
max-width: 800px;
|
|
3
9
|
margin: 0 auto;
|
|
@@ -84,4 +90,13 @@ button {
|
|
|
84
90
|
.login-register-block {
|
|
85
91
|
display: flex;
|
|
86
92
|
justify-content: space-between;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
@media only screen and (max-width: 820px) {
|
|
96
|
+
.billing-info-container {
|
|
97
|
+
width: 90%;
|
|
98
|
+
}
|
|
99
|
+
.billing-info-container .main-header {
|
|
100
|
+
font-size: 1.5rem;
|
|
101
|
+
}
|
|
87
102
|
}
|