tf-checkout-react 1.0.99 → 1.0.100-beta.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 +278 -1
- package/dist/api/index.d.ts +31 -26
- package/dist/components/account-settings/index.d.ts +3 -0
- package/dist/components/billing-info-container/index.d.ts +5 -5
- package/dist/components/billing-info-container/utils.d.ts +1 -0
- package/dist/components/common/CustomField.d.ts +1 -1
- package/dist/components/common/DatePickerField.d.ts +14 -0
- package/dist/components/common/RedirectModal.d.ts +7 -0
- package/dist/components/common/SnackbarAlert.d.ts +13 -0
- package/dist/components/confirmationContainer/index.d.ts +2 -1
- package/dist/components/countdown/index.d.ts +4 -1
- package/dist/components/myTicketsContainer/tableConfig.d.ts +0 -1
- package/dist/components/orderDetailsContainer/index.d.ts +5 -1
- package/dist/components/orderDetailsContainer/ticketsTable.d.ts +4 -1
- package/dist/components/paymentContainer/index.d.ts +3 -1
- package/dist/components/rsvpContainer/index.d.ts +7 -0
- package/dist/components/stripePayment/index.d.ts +2 -1
- package/dist/components/ticketResale/index.d.ts +5 -3
- package/dist/components/ticketsContainer/AccessCodeSection.d.ts +7 -0
- package/dist/components/ticketsContainer/PromoCodeSection.d.ts +6 -9
- package/dist/components/ticketsContainer/TicketsSection.d.ts +5 -3
- package/dist/components/ticketsContainer/index.d.ts +13 -2
- package/dist/components/timerWidget/index.d.ts +3 -3
- package/dist/env.d.ts +1 -0
- package/dist/images/cross.svg +44 -0
- package/dist/images/done.svg +3 -3
- package/dist/index.d.ts +2 -0
- package/dist/tf-checkout-react.cjs.development.js +1400 -575
- 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 +1409 -586
- package/dist/tf-checkout-react.esm.js.map +1 -1
- package/dist/tf-checkout-styles.css +1 -1
- package/dist/utils/cookies.d.ts +3 -0
- package/dist/utils/createCheckoutDataBodyWithDefaultHolder.d.ts +6 -1
- package/dist/utils/downloadPDF.d.ts +1 -1
- package/dist/utils/getDomain.d.ts +1 -0
- package/dist/utils/index.d.ts +2 -0
- package/package.json +89 -89
- package/src/.DS_Store +0 -0
- package/src/.d.ts +2 -2
- package/src/api/index.ts +313 -278
- package/src/assets/images/cross.svg +44 -0
- package/src/assets/images/done.svg +3 -3
- package/src/components/.DS_Store +0 -0
- package/src/components/account-settings/index.tsx +161 -0
- package/src/components/account-settings/style.css +200 -0
- package/src/components/billing-info-container/index.tsx +821 -777
- package/src/components/billing-info-container/style.css +106 -106
- package/src/components/billing-info-container/utils.ts +233 -223
- package/src/components/common/CheckboxField.tsx +41 -41
- package/src/components/common/CustomField.tsx +87 -84
- package/src/components/common/DatePickerField.tsx +98 -0
- package/src/components/common/FormikPhoneNumberField.tsx +51 -51
- package/src/components/common/Loader.tsx +9 -9
- package/src/components/common/RadioField.tsx +35 -35
- package/src/components/common/RedirectModal.tsx +43 -0
- package/src/components/common/SelectField.tsx +80 -80
- package/src/components/common/SnackbarAlert.tsx +54 -0
- package/src/components/common/dist/PhoneNumberField.js +96 -0
- package/src/components/common/index.tsx +4 -4
- package/src/components/confirmModal/index.tsx +51 -51
- package/src/components/confirmModal/style.css +21 -21
- package/src/components/confirmationContainer/config.ts +72 -72
- package/src/components/confirmationContainer/index.tsx +197 -194
- package/src/components/confirmationContainer/social-buttons.tsx +94 -94
- package/src/components/confirmationContainer/style.css +202 -202
- package/src/components/countdown/index.tsx +100 -89
- package/src/components/countdown/style.css +9 -9
- package/src/components/index.ts +7 -7
- package/src/components/loginModal/index.tsx +171 -209
- package/src/components/loginModal/style.css +71 -71
- package/src/components/myTicketsContainer/index.tsx +201 -137
- package/src/components/myTicketsContainer/row.tsx +41 -41
- package/src/components/myTicketsContainer/style.css +40 -40
- package/src/components/myTicketsContainer/tableConfig.tsx +32 -34
- package/src/components/orderDetailsContainer/index.tsx +289 -249
- package/src/components/orderDetailsContainer/style.css +73 -73
- package/src/components/orderDetailsContainer/ticketsTable.tsx +177 -124
- package/src/components/paymentContainer/index.tsx +352 -284
- package/src/components/registerModal/index.tsx +183 -190
- package/src/components/rsvpContainer/index.tsx +126 -0
- package/src/components/stripePayment/index.tsx +258 -253
- package/src/components/stripePayment/style.css +60 -60
- package/src/components/ticketResale/index.tsx +74 -56
- package/src/components/ticketResaleModal/index.tsx +213 -210
- package/src/components/ticketResaleModal/style.css +28 -28
- package/src/components/ticketsContainer/AccessCodeSection.tsx +50 -0
- package/src/components/ticketsContainer/PromoCodeSection.tsx +89 -99
- package/src/components/ticketsContainer/ReferralLogic.tsx +31 -33
- package/src/components/ticketsContainer/TicketRow.tsx +89 -83
- package/src/components/ticketsContainer/TicketsSection.tsx +87 -81
- package/src/components/ticketsContainer/index.tsx +506 -409
- package/src/components/ticketsContainer/style.css +181 -181
- package/src/components/ticketsContainer/utils.ts +11 -11
- package/src/components/timerWidget/index.tsx +87 -70
- package/src/components/timerWidget/style.css +34 -26
- package/src/components/waitingList/index.tsx +178 -178
- package/src/components/waitingList/style.css +26 -26
- package/src/env.ts +20 -19
- package/src/index.ts +15 -13
- package/src/normalizers/index.ts +45 -45
- package/src/types/billing-info-data.ts +37 -37
- package/src/types/payment-field.ts +7 -7
- package/src/types/referral-promotion.ts +7 -7
- package/src/utils/cookies.ts +42 -0
- package/src/utils/createCheckoutDataBodyWithDefaultHolder.ts +71 -59
- package/src/utils/downloadPDF.tsx +52 -30
- package/src/utils/formikErrorFocus.ts +24 -24
- package/src/utils/getDomain.ts +15 -0
- package/src/utils/getImage.ts +14 -14
- package/src/utils/getQueryVariable.ts +13 -13
- package/src/utils/index.ts +7 -5
- package/src/utils/setConfigs.ts +26 -26
- package/src/utils/showZero.tsx +10 -10
- package/src/validators/index.ts +20 -20
|
@@ -1,190 +1,183 @@
|
|
|
1
|
-
import React, { FC } from 'react'
|
|
2
|
-
import { AxiosError } from 'axios'
|
|
3
|
-
import './style.css'
|
|
4
|
-
import { getProfileData,
|
|
5
|
-
import { Field, Form, Formik } from 'formik'
|
|
6
|
-
import { requiredValidator } from '../../validators'
|
|
7
|
-
import { TextField } from '@mui/material'
|
|
8
|
-
import _get from 'lodash/get'
|
|
9
|
-
import { CONFIGS } from '../../utils'
|
|
10
|
-
|
|
11
|
-
interface Props {
|
|
12
|
-
onClose: () => void;
|
|
13
|
-
onRegister: () => void;
|
|
14
|
-
onGetProfileDataSuccess: (res: any) => void;
|
|
15
|
-
onGetProfileDataError: (e: AxiosError) => void;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export const RegisterModal: FC<Props> = ({
|
|
19
|
-
onClose,
|
|
20
|
-
onGetProfileDataSuccess = () => {},
|
|
21
|
-
onGetProfileDataError = () => {},
|
|
22
|
-
}) => (
|
|
23
|
-
<div
|
|
24
|
-
style={{
|
|
25
|
-
display: 'flex',
|
|
26
|
-
position: 'absolute',
|
|
27
|
-
top: 0,
|
|
28
|
-
bottom: 0,
|
|
29
|
-
right: 0,
|
|
30
|
-
left: 0,
|
|
31
|
-
backgroundColor: 'white',
|
|
32
|
-
alignItems: 'center',
|
|
33
|
-
justifyContent: 'center',
|
|
34
|
-
zIndex: 10,
|
|
35
|
-
}}
|
|
36
|
-
>
|
|
37
|
-
<Formik
|
|
38
|
-
initialValues={{
|
|
39
|
-
firstName: '',
|
|
40
|
-
lastName: '',
|
|
41
|
-
email: '',
|
|
42
|
-
password: '',
|
|
43
|
-
confirmPassword: '',
|
|
44
|
-
}}
|
|
45
|
-
onSubmit={async ({
|
|
46
|
-
firstName,
|
|
47
|
-
lastName,
|
|
48
|
-
email,
|
|
49
|
-
password,
|
|
50
|
-
confirmPassword,
|
|
51
|
-
}) => {
|
|
52
|
-
const bodyFormData = new FormData()
|
|
53
|
-
bodyFormData.append('first_name', firstName)
|
|
54
|
-
bodyFormData.append('last_name', lastName)
|
|
55
|
-
bodyFormData.append('email', email)
|
|
56
|
-
bodyFormData.append('password', password)
|
|
57
|
-
bodyFormData.append('password_confirmation', confirmPassword)
|
|
58
|
-
bodyFormData.append(
|
|
59
|
-
'client_id',
|
|
60
|
-
CONFIGS.CLIENT_ID || 'e9d8f8922797b4621e562255afe90dbf'
|
|
61
|
-
)
|
|
62
|
-
bodyFormData.append(
|
|
63
|
-
'client_secret',
|
|
64
|
-
CONFIGS.CLIENT_SECRET ||
|
|
65
|
-
'b89c191eff22fdcf84ac9bfd88d005355a151ec2c83b26b9'
|
|
66
|
-
)
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
)
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
)
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
</div>
|
|
185
|
-
<button type="submit">Submit</button>
|
|
186
|
-
</Form>
|
|
187
|
-
)}
|
|
188
|
-
</Formik>
|
|
189
|
-
</div>
|
|
190
|
-
)
|
|
1
|
+
import React, { FC } from 'react'
|
|
2
|
+
import { AxiosError } from 'axios'
|
|
3
|
+
import './style.css'
|
|
4
|
+
import { getProfileData, register } from '../../api'
|
|
5
|
+
import { Field, Form, Formik } from 'formik'
|
|
6
|
+
import { requiredValidator } from '../../validators'
|
|
7
|
+
import { TextField } from '@mui/material'
|
|
8
|
+
import _get from 'lodash/get'
|
|
9
|
+
import { CONFIGS } from '../../utils'
|
|
10
|
+
|
|
11
|
+
interface Props {
|
|
12
|
+
onClose: () => void;
|
|
13
|
+
onRegister: () => void;
|
|
14
|
+
onGetProfileDataSuccess: (res: any) => void;
|
|
15
|
+
onGetProfileDataError: (e: AxiosError) => void;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export const RegisterModal: FC<Props> = ({
|
|
19
|
+
onClose,
|
|
20
|
+
onGetProfileDataSuccess = () => {},
|
|
21
|
+
onGetProfileDataError = () => {},
|
|
22
|
+
}) => (
|
|
23
|
+
<div
|
|
24
|
+
style={{
|
|
25
|
+
display: 'flex',
|
|
26
|
+
position: 'absolute',
|
|
27
|
+
top: 0,
|
|
28
|
+
bottom: 0,
|
|
29
|
+
right: 0,
|
|
30
|
+
left: 0,
|
|
31
|
+
backgroundColor: 'white',
|
|
32
|
+
alignItems: 'center',
|
|
33
|
+
justifyContent: 'center',
|
|
34
|
+
zIndex: 10,
|
|
35
|
+
}}
|
|
36
|
+
>
|
|
37
|
+
<Formik
|
|
38
|
+
initialValues={{
|
|
39
|
+
firstName: '',
|
|
40
|
+
lastName: '',
|
|
41
|
+
email: '',
|
|
42
|
+
password: '',
|
|
43
|
+
confirmPassword: '',
|
|
44
|
+
}}
|
|
45
|
+
onSubmit={async ({
|
|
46
|
+
firstName,
|
|
47
|
+
lastName,
|
|
48
|
+
email,
|
|
49
|
+
password,
|
|
50
|
+
confirmPassword,
|
|
51
|
+
}) => {
|
|
52
|
+
const bodyFormData = new FormData()
|
|
53
|
+
bodyFormData.append('first_name', firstName)
|
|
54
|
+
bodyFormData.append('last_name', lastName)
|
|
55
|
+
bodyFormData.append('email', email)
|
|
56
|
+
bodyFormData.append('password', password)
|
|
57
|
+
bodyFormData.append('password_confirmation', confirmPassword)
|
|
58
|
+
bodyFormData.append(
|
|
59
|
+
'client_id',
|
|
60
|
+
CONFIGS.CLIENT_ID || 'e9d8f8922797b4621e562255afe90dbf'
|
|
61
|
+
)
|
|
62
|
+
bodyFormData.append(
|
|
63
|
+
'client_secret',
|
|
64
|
+
CONFIGS.CLIENT_SECRET ||
|
|
65
|
+
'b89c191eff22fdcf84ac9bfd88d005355a151ec2c83b26b9'
|
|
66
|
+
)
|
|
67
|
+
await register(bodyFormData)
|
|
68
|
+
let profileResponse = null
|
|
69
|
+
|
|
70
|
+
try {
|
|
71
|
+
profileResponse = await getProfileData()
|
|
72
|
+
onGetProfileDataSuccess(profileResponse.data)
|
|
73
|
+
} catch (e) {
|
|
74
|
+
onGetProfileDataError(e.response)
|
|
75
|
+
return
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
const profileSpecifiedData = _get(profileResponse, 'data.data')
|
|
79
|
+
const profileDataObj = {
|
|
80
|
+
id: profileSpecifiedData.id,
|
|
81
|
+
first_name: profileSpecifiedData.firstName,
|
|
82
|
+
last_name: profileSpecifiedData.lastName,
|
|
83
|
+
email: profileSpecifiedData.email,
|
|
84
|
+
}
|
|
85
|
+
if (typeof window !== 'undefined') {
|
|
86
|
+
window.localStorage.setItem(
|
|
87
|
+
'user_data',
|
|
88
|
+
JSON.stringify(profileDataObj)
|
|
89
|
+
)
|
|
90
|
+
}
|
|
91
|
+
onClose()
|
|
92
|
+
}}
|
|
93
|
+
>
|
|
94
|
+
{props => (
|
|
95
|
+
<Form onSubmit={props.handleSubmit}>
|
|
96
|
+
<div className="register-container">
|
|
97
|
+
<div>Create account</div>
|
|
98
|
+
<button type="button" onClick={onClose}>
|
|
99
|
+
Close
|
|
100
|
+
</button>
|
|
101
|
+
<div className="register-container__twoFields">
|
|
102
|
+
<div className="is-half">
|
|
103
|
+
<Field name={'firstName'} validate={requiredValidator()}>
|
|
104
|
+
{({ field, meta }: { [key: string]: any }) => (
|
|
105
|
+
<TextField
|
|
106
|
+
label={'First Name'}
|
|
107
|
+
type={'text'}
|
|
108
|
+
fullWidth
|
|
109
|
+
error={!!meta.error && meta.touched}
|
|
110
|
+
helperText={meta.touched && meta.error}
|
|
111
|
+
{...field}
|
|
112
|
+
/>
|
|
113
|
+
)}
|
|
114
|
+
</Field>
|
|
115
|
+
</div>
|
|
116
|
+
<div className="is-half">
|
|
117
|
+
<Field name={'lastName'} validate={requiredValidator()}>
|
|
118
|
+
{({ field, meta }: { [key: string]: any }) => (
|
|
119
|
+
<TextField
|
|
120
|
+
label={'Last Name'}
|
|
121
|
+
type={'text'}
|
|
122
|
+
fullWidth
|
|
123
|
+
error={!!meta.error && meta.touched}
|
|
124
|
+
helperText={meta.touched && meta.error}
|
|
125
|
+
{...field}
|
|
126
|
+
/>
|
|
127
|
+
)}
|
|
128
|
+
</Field>
|
|
129
|
+
</div>
|
|
130
|
+
</div>
|
|
131
|
+
<div className="register-container__singleField">
|
|
132
|
+
<div className="">
|
|
133
|
+
<Field name={'email'} validate={requiredValidator()}>
|
|
134
|
+
{({ field, meta }: { [key: string]: any }) => (
|
|
135
|
+
<TextField
|
|
136
|
+
label={'Email'}
|
|
137
|
+
type={'email'}
|
|
138
|
+
fullWidth
|
|
139
|
+
error={!!meta.error && meta.touched}
|
|
140
|
+
helperText={meta.touched && meta.error}
|
|
141
|
+
{...field}
|
|
142
|
+
/>
|
|
143
|
+
)}
|
|
144
|
+
</Field>
|
|
145
|
+
</div>
|
|
146
|
+
</div>
|
|
147
|
+
<div className="register-container__twoFields">
|
|
148
|
+
<div className="is-half">
|
|
149
|
+
<Field name={'password'} validate={requiredValidator()}>
|
|
150
|
+
{({ field, meta }: { [key: string]: any }) => (
|
|
151
|
+
<TextField
|
|
152
|
+
label={'Password'}
|
|
153
|
+
type={'password'}
|
|
154
|
+
fullWidth
|
|
155
|
+
error={!!meta.error && meta.touched}
|
|
156
|
+
helperText={meta.touched && meta.error}
|
|
157
|
+
{...field}
|
|
158
|
+
/>
|
|
159
|
+
)}
|
|
160
|
+
</Field>
|
|
161
|
+
</div>
|
|
162
|
+
<div className="is-half">
|
|
163
|
+
<Field name={'confirmPassword'} validate={requiredValidator()}>
|
|
164
|
+
{({ field, meta }: { [key: string]: any }) => (
|
|
165
|
+
<TextField
|
|
166
|
+
label={'Confirm Passwod'}
|
|
167
|
+
type={'password'}
|
|
168
|
+
fullWidth
|
|
169
|
+
error={!!meta.error && meta.touched}
|
|
170
|
+
helperText={meta.touched && meta.error}
|
|
171
|
+
{...field}
|
|
172
|
+
/>
|
|
173
|
+
)}
|
|
174
|
+
</Field>
|
|
175
|
+
</div>
|
|
176
|
+
</div>
|
|
177
|
+
</div>
|
|
178
|
+
<button type="submit">Submit</button>
|
|
179
|
+
</Form>
|
|
180
|
+
)}
|
|
181
|
+
</Formik>
|
|
182
|
+
</div>
|
|
183
|
+
)
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import React, { useState } from 'react'
|
|
2
|
+
import { Field, Form, Formik } from 'formik'
|
|
3
|
+
import Button from '@mui/material/Button'
|
|
4
|
+
import Modal from '@mui/material/Modal'
|
|
5
|
+
import Box from '@mui/material/Box'
|
|
6
|
+
import { CustomField, Loader } from '../common/index'
|
|
7
|
+
import { combineValidators, requiredValidator, emailValidator } from '../../validators'
|
|
8
|
+
import { sendRSVPInfo } from '../../api'
|
|
9
|
+
|
|
10
|
+
interface IRsvpContainerPage {
|
|
11
|
+
showSection?: boolean;
|
|
12
|
+
eventId: number;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
interface IRSVPValuesTypes {
|
|
16
|
+
email: string;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const style: React.CSSProperties = {
|
|
20
|
+
position: 'absolute',
|
|
21
|
+
top: '50%',
|
|
22
|
+
left: '50%',
|
|
23
|
+
transform: 'translate(-50%, -50%)',
|
|
24
|
+
minWidth: 480,
|
|
25
|
+
backgroundColor: '#e3e3e3',
|
|
26
|
+
border: '1px solid white',
|
|
27
|
+
outline: 'none',
|
|
28
|
+
padding: '14px',
|
|
29
|
+
maxHeight: '85vh',
|
|
30
|
+
overflow: 'auto'
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export const RsvpContainer = ({ showSection = false, eventId }: IRsvpContainerPage) => {
|
|
34
|
+
const userDataEncoded =
|
|
35
|
+
typeof window !== 'undefined' ? window.localStorage.getItem('user_data') : ''
|
|
36
|
+
const parsedData = JSON.parse(userDataEncoded || '{}')
|
|
37
|
+
|
|
38
|
+
const [loading, setLoading] = useState(false)
|
|
39
|
+
const [modal, setModal] = useState({ isOpen: false, text: '' })
|
|
40
|
+
|
|
41
|
+
const handleModalClose = () => {
|
|
42
|
+
setModal({ isOpen: false, text: '' })
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
const handleSubmit = async (values: IRSVPValuesTypes) => {
|
|
46
|
+
try {
|
|
47
|
+
setLoading(true)
|
|
48
|
+
|
|
49
|
+
const requestData = {
|
|
50
|
+
data: {
|
|
51
|
+
email: values.email
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
const { data } = await sendRSVPInfo(eventId, requestData)
|
|
55
|
+
|
|
56
|
+
setModal({ isOpen: true, text: data.message })
|
|
57
|
+
} catch (error) {
|
|
58
|
+
if (error.response.status === 403) {
|
|
59
|
+
setModal({ isOpen: true, text: error.response.data?.message })
|
|
60
|
+
}
|
|
61
|
+
} finally {
|
|
62
|
+
setLoading(false)
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
if (!showSection) {
|
|
67
|
+
return null
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
return (
|
|
71
|
+
<>
|
|
72
|
+
<Modal
|
|
73
|
+
open={modal.isOpen}
|
|
74
|
+
onClose={handleModalClose}
|
|
75
|
+
aria-labelledby="modal-modal-title"
|
|
76
|
+
aria-describedby="modal-modal-description"
|
|
77
|
+
className="rsvp-modal"
|
|
78
|
+
>
|
|
79
|
+
<Box style={style} className="rsvp-modal-box">
|
|
80
|
+
<div className="rsvp-modal-container">
|
|
81
|
+
<div className="rsvp-modal-header">{modal.text}</div>
|
|
82
|
+
<div className="rsvp-modal-button">
|
|
83
|
+
<button onClick={handleModalClose}>OK</button>
|
|
84
|
+
</div>
|
|
85
|
+
</div>
|
|
86
|
+
</Box>
|
|
87
|
+
</Modal>
|
|
88
|
+
<div className="rsvp-container">
|
|
89
|
+
{loading ? (
|
|
90
|
+
<Loader />
|
|
91
|
+
) : (
|
|
92
|
+
<>
|
|
93
|
+
<div className="rsvp-header">RSVP</div>
|
|
94
|
+
<div className="rsvp-email-container">
|
|
95
|
+
<Formik
|
|
96
|
+
initialValues={{
|
|
97
|
+
email: parsedData?.email || ''
|
|
98
|
+
}}
|
|
99
|
+
onSubmit={handleSubmit}
|
|
100
|
+
enableReinitialize
|
|
101
|
+
>
|
|
102
|
+
<Form>
|
|
103
|
+
<div className="rsvp-email-input-container">
|
|
104
|
+
<Field
|
|
105
|
+
name="email"
|
|
106
|
+
label="EMAIL ADDRESS"
|
|
107
|
+
type="email"
|
|
108
|
+
validate={combineValidators(
|
|
109
|
+
(value: string) => requiredValidator(value, 'Please enter your Email'),
|
|
110
|
+
(value: string) => emailValidator(value)
|
|
111
|
+
)}
|
|
112
|
+
component={CustomField}
|
|
113
|
+
/>
|
|
114
|
+
</div>
|
|
115
|
+
<div className="rsvp-button-container">
|
|
116
|
+
<Button type="submit">RSVP</Button>
|
|
117
|
+
</div>
|
|
118
|
+
</Form>
|
|
119
|
+
</Formik>
|
|
120
|
+
</div>
|
|
121
|
+
</>
|
|
122
|
+
)}
|
|
123
|
+
</div>
|
|
124
|
+
</>
|
|
125
|
+
)
|
|
126
|
+
}
|