tf-checkout-react 1.6.6-beta.3 → 1.6.6-beta.31
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 +61 -40
- package/dist/adapters/customFields.d.ts +1 -0
- package/dist/api/checkout.d.ts +1 -0
- package/dist/api/common.d.ts +1 -0
- package/dist/api/index.d.ts +1 -0
- package/dist/api/preRegistrationComplete.d.ts +1 -1
- package/dist/components/addonsContainer/AddonComponent.d.ts +5 -1
- package/dist/components/addonsContainer/SimpleAddonsContainer.d.ts +17 -0
- package/dist/components/addonsContainer/index.d.ts +5 -1
- package/dist/components/billing-info-container/index.d.ts +8 -1
- package/dist/components/billing-info-container/utils.d.ts +25 -1
- package/dist/components/common/DatePickerField.d.ts +7 -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 +7 -1
- package/dist/components/paymentContainer/OrderDetails.d.ts +8 -0
- package/dist/components/paymentContainer/handlePayment.d.ts +15 -0
- package/dist/components/paymentContainer/index.d.ts +10 -5
- package/dist/components/preRegistration/FieldsSection.d.ts +7 -1
- package/dist/components/preRegistration/PreRegistrationComplete.d.ts +6 -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/stripePayment/index.d.ts +18 -3
- 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 +18 -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 +5196 -3599
- 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 +5199 -3605
- 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 +2 -1
- package/dist/utils/auth.d.ts +8 -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 +3 -2
- package/src/adapters/customFields.ts +7 -1
- package/src/api/auth.ts +2 -1
- package/src/api/checkout.ts +8 -4
- package/src/api/common.ts +49 -2
- 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 +71 -11
- package/src/components/addonsContainer/SimpleAddonsContainer.tsx +388 -0
- package/src/components/addonsContainer/index.tsx +189 -58
- package/src/components/billing-info-container/index.tsx +704 -390
- package/src/components/billing-info-container/{utils.ts → utils.tsx} +119 -0
- package/src/components/common/CheckboxField/index.tsx +1 -1
- package/src/components/common/DatePickerField.tsx +25 -10
- package/src/components/common/SnackbarAlert.tsx +32 -34
- package/src/components/confirmationContainer/index.tsx +1 -1
- 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 +2 -2
- package/src/components/loginModal/style.css +3 -1
- package/src/components/myTicketsContainer/index.tsx +13 -9
- package/src/components/orderDetailsContainer/index.tsx +188 -173
- package/src/components/paymentContainer/OrderDetails.tsx +170 -0
- package/src/components/paymentContainer/handlePayment.ts +86 -0
- package/src/components/paymentContainer/index.tsx +253 -226
- package/src/components/paymentContainer/style.css +113 -0
- package/src/components/preRegistration/FieldsSection.tsx +8 -0
- package/src/components/preRegistration/PreRegistrationComplete.tsx +128 -118
- package/src/components/preRegistration/PreRegistrationInformations.tsx +21 -15
- package/src/components/preRegistration/constants.tsx +10 -4
- package/src/components/preRegistration/index.tsx +194 -174
- package/src/components/registerForm/constants.tsx +3 -1
- package/src/components/registerForm/index.tsx +3 -3
- package/src/components/resetPasswordContainer/index.tsx +12 -13
- package/src/components/seatMapContainer/TicketsSection.tsx +2 -2
- package/src/components/stripePayment/index.tsx +129 -24
- 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 +178 -52
- package/src/components/ticketsContainer/TimeSlotsSection.tsx +120 -0
- package/src/components/ticketsContainer/index.tsx +209 -99
- package/src/components/timerWidget/index.tsx +15 -3
- package/src/constants/index.ts +2 -0
- 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/common.d.ts +27 -0
- package/src/types/api/orders.d.ts +19 -3
- package/src/types/api/payment.d.ts +5 -2
- package/src/types/api/preRegistrationComplete.d.ts +2 -2
- package/src/types/checkoutPageConfigs.ts +1 -1
- package/src/types/order-data.ts +2 -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/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
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
|
+
import { Button, CircularProgress, ThemeOptions } from '@mui/material'
|
|
3
|
+
import { createTheme, ThemeProvider } from '@mui/material/styles'
|
|
4
|
+
import { CSSProperties } from '@mui/styles'
|
|
2
5
|
import axios, { AxiosError } from 'axios'
|
|
3
6
|
import { Form, Formik, FormikValues } from 'formik'
|
|
4
7
|
import _get from 'lodash/get'
|
|
@@ -13,7 +16,7 @@ import SnackbarAlert from '../common/SnackbarAlert'
|
|
|
13
16
|
import ConfirmModal from '../confirmModal'
|
|
14
17
|
import { ForgotPasswordModal, IForgotPasswordProps } from '../forgotPasswordModal'
|
|
15
18
|
import { LoginModal, Props } from '../loginModal'
|
|
16
|
-
import {
|
|
19
|
+
import { getFormFieldsLoggedIn, getFormFieldsNotLoggedIn } from './constants'
|
|
17
20
|
import { FieldsSection } from './FieldsSection'
|
|
18
21
|
import { getFormInitialValues, updateFormFieldsAttributes } from './utils'
|
|
19
22
|
|
|
@@ -30,6 +33,11 @@ interface IPreRegistrationProps extends Props, IForgotPasswordProps {
|
|
|
30
33
|
onConfirmationSuccess?: (res: any) => void;
|
|
31
34
|
onConfirmationError?: (e: AxiosError) => void;
|
|
32
35
|
onLoginSuccess?: (res: any) => void;
|
|
36
|
+
|
|
37
|
+
themeOptions?: ThemeOptions & {
|
|
38
|
+
input?: CSSProperties;
|
|
39
|
+
checkbox?: CSSProperties;
|
|
40
|
+
};
|
|
33
41
|
}
|
|
34
42
|
|
|
35
43
|
export const PreRegistration: FC<IPreRegistrationProps> = ({
|
|
@@ -46,6 +54,7 @@ export const PreRegistration: FC<IPreRegistrationProps> = ({
|
|
|
46
54
|
onGetCountriesError = _identity,
|
|
47
55
|
onConfirmationSuccess = _identity,
|
|
48
56
|
onConfirmationError = _identity,
|
|
57
|
+
themeOptions,
|
|
49
58
|
}) => {
|
|
50
59
|
const [error, setError] = useState('')
|
|
51
60
|
const [showModalLogin, setShowModalLogin] = useState(false)
|
|
@@ -57,6 +66,11 @@ export const PreRegistration: FC<IPreRegistrationProps> = ({
|
|
|
57
66
|
const [, setUserData] = useState({} as IProfileData)
|
|
58
67
|
useCookieListener(X_TF_ECOMMERCE, value => setIsLoggedIn(Boolean(value)))
|
|
59
68
|
|
|
69
|
+
const themeMui = createTheme(themeOptions)
|
|
70
|
+
|
|
71
|
+
const formFieldsLoggedIn = getFormFieldsLoggedIn(CONFIGS.CLIENT_NAME)
|
|
72
|
+
const formFieldsNotLoggedIn = getFormFieldsNotLoggedIn(CONFIGS.CLIENT_NAME)
|
|
73
|
+
|
|
60
74
|
const formFields = updateFormFieldsAttributes(
|
|
61
75
|
pFormFields || isLoggedIn ? formFieldsLoggedIn : formFieldsNotLoggedIn,
|
|
62
76
|
additionalFieldAttribute
|
|
@@ -76,7 +90,7 @@ export const PreRegistration: FC<IPreRegistrationProps> = ({
|
|
|
76
90
|
onGetCountriesSuccess(res.data)
|
|
77
91
|
} catch (e) {
|
|
78
92
|
if (axios.isAxiosError(e)) {
|
|
79
|
-
const error =
|
|
93
|
+
const error = 'Error'
|
|
80
94
|
setError(error)
|
|
81
95
|
onGetCountriesError(e)
|
|
82
96
|
}
|
|
@@ -88,189 +102,195 @@ export const PreRegistration: FC<IPreRegistrationProps> = ({
|
|
|
88
102
|
const hash = getQueryVariable('hash') || ''
|
|
89
103
|
const referrerId = getQueryVariable('referrer_id') || ''
|
|
90
104
|
return (
|
|
91
|
-
<
|
|
92
|
-
<
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
setError('')
|
|
98
|
-
}}
|
|
99
|
-
/>
|
|
100
|
-
{confirmModalState.show && (
|
|
101
|
-
<ConfirmModal
|
|
102
|
-
hideCancelBtn
|
|
103
|
-
onConfirm={() => setConfirmModalState({ show: false, message: '' })}
|
|
104
|
-
message={confirmModalState.message}
|
|
105
|
-
/>
|
|
106
|
-
)}
|
|
107
|
-
{!isLoggedIn && (
|
|
108
|
-
<div className="account-actions-block">
|
|
109
|
-
<div className="action-item">
|
|
110
|
-
<div>
|
|
111
|
-
<span>
|
|
112
|
-
Create (or log in to) your account, then click on Confirm Registration.
|
|
113
|
-
</span>
|
|
114
|
-
<span> If you have a</span>
|
|
115
|
-
<b> Mana Common </b>
|
|
116
|
-
<span>account and password already</span>
|
|
117
|
-
</div>
|
|
118
|
-
</div>
|
|
119
|
-
<div className="action-item login-block">
|
|
120
|
-
<button
|
|
121
|
-
className="login-register-button"
|
|
122
|
-
type="button"
|
|
123
|
-
onClick={() => {
|
|
124
|
-
setShowModalLogin(true)
|
|
125
|
-
}}
|
|
126
|
-
>
|
|
127
|
-
Login
|
|
128
|
-
</button>
|
|
129
|
-
</div>
|
|
130
|
-
</div>
|
|
131
|
-
)}
|
|
132
|
-
{showModalLogin && (
|
|
133
|
-
<LoginModal
|
|
134
|
-
logo={logo}
|
|
105
|
+
<ThemeProvider theme={themeMui}>
|
|
106
|
+
<div className="pre-registration-container">
|
|
107
|
+
<SnackbarAlert
|
|
108
|
+
type="error"
|
|
109
|
+
isOpen={!!error}
|
|
110
|
+
message={error || ''}
|
|
135
111
|
onClose={() => {
|
|
136
|
-
|
|
137
|
-
}}
|
|
138
|
-
onLogin={res => {
|
|
139
|
-
setShowModalLogin(false)
|
|
140
|
-
onLoginSuccess(res)
|
|
141
|
-
}}
|
|
142
|
-
showForgotPasswordButton={showForgotPasswordButton}
|
|
143
|
-
onForgotPassword={() => {
|
|
144
|
-
setShowModalLogin(false)
|
|
145
|
-
setShowModalForgotPassword(true)
|
|
112
|
+
setError('')
|
|
146
113
|
}}
|
|
147
|
-
alreadyHasUser={alreadyHasUser}
|
|
148
114
|
/>
|
|
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
|
-
|
|
115
|
+
{confirmModalState.show && (
|
|
116
|
+
<ConfirmModal
|
|
117
|
+
hideCancelBtn
|
|
118
|
+
onConfirm={() => setConfirmModalState({ show: false, message: '' })}
|
|
119
|
+
message={confirmModalState.message}
|
|
120
|
+
/>
|
|
121
|
+
)}
|
|
122
|
+
{!isLoggedIn && (
|
|
123
|
+
<div className="account-actions-block">
|
|
124
|
+
<div className="action-item">
|
|
125
|
+
<div>
|
|
126
|
+
<span>
|
|
127
|
+
Create (or log in to) your account, then click on Confirm Registration.
|
|
128
|
+
</span>
|
|
129
|
+
<span> If you have a</span>
|
|
130
|
+
<b> {CONFIGS.CLIENT_NAME || 'Mana Common'} </b>
|
|
131
|
+
<span>account and password already</span>
|
|
132
|
+
</div>
|
|
133
|
+
</div>
|
|
134
|
+
<div className="action-item login-block">
|
|
135
|
+
<button
|
|
136
|
+
className="login-register-button"
|
|
137
|
+
type="button"
|
|
138
|
+
onClick={() => {
|
|
139
|
+
setShowModalLogin(true)
|
|
140
|
+
}}
|
|
141
|
+
>
|
|
142
|
+
Login
|
|
143
|
+
</button>
|
|
144
|
+
</div>
|
|
145
|
+
</div>
|
|
146
|
+
)}
|
|
147
|
+
{showModalLogin && (
|
|
148
|
+
<LoginModal
|
|
149
|
+
logo={logo}
|
|
150
|
+
onClose={() => {
|
|
151
|
+
setShowModalLogin(false)
|
|
152
|
+
}}
|
|
153
|
+
onLogin={res => {
|
|
154
|
+
setShowModalLogin(false)
|
|
155
|
+
onLoginSuccess(res)
|
|
156
|
+
}}
|
|
157
|
+
showForgotPasswordButton={showForgotPasswordButton}
|
|
158
|
+
onForgotPassword={() => {
|
|
159
|
+
setShowModalLogin(false)
|
|
160
|
+
setShowModalForgotPassword(true)
|
|
161
|
+
}}
|
|
162
|
+
alreadyHasUser={alreadyHasUser}
|
|
163
|
+
/>
|
|
164
|
+
)}
|
|
165
|
+
{showModalForgotPassword && (
|
|
166
|
+
<ForgotPasswordModal
|
|
167
|
+
onClose={() => {
|
|
168
|
+
setShowModalForgotPassword(false)
|
|
169
|
+
}}
|
|
170
|
+
onLoginButtonClick={() => {
|
|
171
|
+
setShowModalForgotPassword(false)
|
|
172
|
+
setShowModalLogin(true)
|
|
173
|
+
}}
|
|
174
|
+
onForgotPasswordSuccess={onForgotPasswordSuccess}
|
|
175
|
+
onForgotPasswordError={onForgotPasswordError}
|
|
176
|
+
displaySuccessMessage
|
|
177
|
+
/>
|
|
178
|
+
)}
|
|
179
|
+
<h2>Pre-Registration</h2>
|
|
180
|
+
<Formik
|
|
181
|
+
initialValues={getFormInitialValues(formFields)}
|
|
182
|
+
enableReinitialize={true}
|
|
183
|
+
onSubmit={async (values: FormikValues) => {
|
|
184
|
+
try {
|
|
185
|
+
if (isLoggedIn) {
|
|
186
|
+
if (isPreregistrationStarted) {
|
|
187
|
+
const updatedValues = { ...values }
|
|
188
|
+
const holderAgeDate = new Date(values.holderAge)
|
|
189
|
+
updatedValues.dobDay = holderAgeDate.getDate()
|
|
190
|
+
updatedValues.dobMonth = holderAgeDate.getMonth() + 1
|
|
191
|
+
updatedValues.dobYear = holderAgeDate.getFullYear()
|
|
192
|
+
updatedValues.referrerId = referrerId
|
|
193
|
+
updatedValues.shareHash = hash
|
|
194
|
+
// remove date picker string value
|
|
195
|
+
delete updatedValues.holderAge
|
|
196
|
+
|
|
197
|
+
const confirmationData = await confirmPreRegistration(
|
|
198
|
+
eventId,
|
|
199
|
+
updatedValues as IConfirmPreRegistrationRequestData
|
|
200
|
+
)
|
|
201
|
+
if (isWindowDefined) {
|
|
202
|
+
window.localStorage.setItem(
|
|
203
|
+
'pre-registration-hash',
|
|
204
|
+
_get(confirmationData, 'attributes.hash')
|
|
205
|
+
)
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
onConfirmationSuccess(confirmationData)
|
|
209
|
+
} else {
|
|
210
|
+
setConfirmModalState({
|
|
211
|
+
show: true,
|
|
212
|
+
message: 'The preregistration has not started',
|
|
213
|
+
})
|
|
214
|
+
}
|
|
215
|
+
} else {
|
|
216
|
+
const bodyFormData = new FormData()
|
|
217
|
+
bodyFormData.append('first_name', values.firstName)
|
|
218
|
+
bodyFormData.append('last_name', values.lastName)
|
|
219
|
+
bodyFormData.append('email', values.email)
|
|
220
|
+
bodyFormData.append('confirm_email', values.confirmEmail)
|
|
221
|
+
bodyFormData.append('zip', values.zip)
|
|
222
|
+
bodyFormData.append('country', values.country)
|
|
223
|
+
bodyFormData.append('password', values.password)
|
|
224
|
+
bodyFormData.append('password_confirmation', values.confirmPassword)
|
|
225
|
+
bodyFormData.append('client_id', CONFIGS.CLIENT_ID)
|
|
226
|
+
bodyFormData.append('client_secret', CONFIGS.CLIENT_SECRET)
|
|
227
|
+
bodyFormData.append('register_for', 'prereg')
|
|
180
228
|
|
|
181
|
-
const
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
)
|
|
229
|
+
const res = await register(bodyFormData)
|
|
230
|
+
const profileRes = await getProfileData()
|
|
231
|
+
onLoginSuccess(res.data)
|
|
185
232
|
if (isWindowDefined) {
|
|
186
233
|
window.localStorage.setItem(
|
|
187
|
-
'
|
|
188
|
-
_get(
|
|
234
|
+
'user_data',
|
|
235
|
+
JSON.stringify(_get(profileRes, 'data'))
|
|
189
236
|
)
|
|
237
|
+
setUserData(_get(profileRes, 'data'))
|
|
190
238
|
}
|
|
191
|
-
|
|
192
|
-
onConfirmationSuccess(confirmationData)
|
|
193
|
-
} else {
|
|
194
|
-
setConfirmModalState({
|
|
195
|
-
show: true,
|
|
196
|
-
message: 'The preregistration has not started',
|
|
197
|
-
})
|
|
198
239
|
}
|
|
199
|
-
}
|
|
200
|
-
const
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
bodyFormData.append('confirm_email', values.confirmEmail)
|
|
205
|
-
bodyFormData.append('zip', values.zip)
|
|
206
|
-
bodyFormData.append('country', values.country)
|
|
207
|
-
bodyFormData.append('password', values.password)
|
|
208
|
-
bodyFormData.append('password_confirmation', values.confirmPassword)
|
|
209
|
-
bodyFormData.append('client_id', CONFIGS.CLIENT_ID)
|
|
210
|
-
bodyFormData.append('client_secret', CONFIGS.CLIENT_SECRET)
|
|
211
|
-
bodyFormData.append('register_for', 'prereg')
|
|
240
|
+
} catch (e) {
|
|
241
|
+
const error = e as AxiosError
|
|
242
|
+
let errorMessage = error?.message || 'Error'
|
|
243
|
+
const emailErrors = _get(error, 'response.data.message.email') || ''
|
|
244
|
+
const errorDataMessage = _get(error, 'response.data.message')
|
|
212
245
|
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
onLoginSuccess(res.data)
|
|
216
|
-
if (isWindowDefined) {
|
|
217
|
-
window.localStorage.setItem(
|
|
218
|
-
'user_data',
|
|
219
|
-
JSON.stringify(_get(profileRes, 'data'))
|
|
220
|
-
)
|
|
221
|
-
setUserData(_get(profileRes, 'data'))
|
|
246
|
+
if (typeof errorDataMessage === 'string') {
|
|
247
|
+
errorMessage = errorDataMessage
|
|
222
248
|
}
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
}
|
|
231
|
-
if (emailErrors?.length > 0) {
|
|
232
|
-
if (emailErrors[0] === 'The email is already used') {
|
|
233
|
-
setShowModalLogin(true)
|
|
234
|
-
setAlreadyHasUser(true)
|
|
249
|
+
if (emailErrors?.length > 0) {
|
|
250
|
+
if (emailErrors[0] === 'The email is already used') {
|
|
251
|
+
setShowModalLogin(true)
|
|
252
|
+
setAlreadyHasUser(true)
|
|
253
|
+
}
|
|
254
|
+
} else {
|
|
255
|
+
setError(errorMessage)
|
|
235
256
|
}
|
|
236
|
-
} else {
|
|
237
|
-
setError(errorMessage)
|
|
238
|
-
}
|
|
239
257
|
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
<
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
258
|
+
onConfirmationError(error)
|
|
259
|
+
}
|
|
260
|
+
}}
|
|
261
|
+
>
|
|
262
|
+
{props => (
|
|
263
|
+
<Form>
|
|
264
|
+
<div className="login-modal-body">
|
|
265
|
+
<FieldsSection
|
|
266
|
+
formFields={formFields}
|
|
267
|
+
values={props.values}
|
|
268
|
+
setFieldValue={props.setFieldValue}
|
|
269
|
+
containerClass="pre-registration"
|
|
270
|
+
countries={countries}
|
|
271
|
+
themeOptions={themeOptions}
|
|
272
|
+
/>
|
|
273
|
+
</div>
|
|
274
|
+
<div className="button-container">
|
|
275
|
+
<Button
|
|
276
|
+
type="submit"
|
|
277
|
+
variant="contained"
|
|
278
|
+
className="login-register-button"
|
|
279
|
+
disabled={props.isSubmitting}
|
|
280
|
+
>
|
|
281
|
+
{props.isSubmitting ? (
|
|
282
|
+
<CircularProgress size={26} />
|
|
283
|
+
) : isLoggedIn ? (
|
|
284
|
+
'Confirm Pre-Registration'
|
|
285
|
+
) : (
|
|
286
|
+
'Create Account'
|
|
287
|
+
)}
|
|
288
|
+
</Button>
|
|
289
|
+
</div>
|
|
290
|
+
</Form>
|
|
291
|
+
)}
|
|
292
|
+
</Formik>
|
|
293
|
+
</div>
|
|
294
|
+
</ThemeProvider>
|
|
275
295
|
)
|
|
276
296
|
}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
|
|
3
|
+
import { CONFIGS } from '../../utils'
|
|
4
|
+
|
|
3
5
|
export const formDefaultFields: IFormFieldsSection[] = [
|
|
4
6
|
{
|
|
5
7
|
name: 'basic-info',
|
|
@@ -68,7 +70,7 @@ export const formDefaultFields: IFormFieldsSection[] = [
|
|
|
68
70
|
groupLabel: (
|
|
69
71
|
<div className="email-info-block">
|
|
70
72
|
<span>Choose a password for your new</span>
|
|
71
|
-
<b> Mana Common </b>
|
|
73
|
+
<b> {CONFIGS.CLIENT_NAME || 'Mana Common'} </b>
|
|
72
74
|
<span>account</span>
|
|
73
75
|
</div>
|
|
74
76
|
),
|
|
@@ -63,7 +63,7 @@ export const RegistrationForm: FC<IRegistrationProps> = ({
|
|
|
63
63
|
onGetCountriesSuccess(res.data)
|
|
64
64
|
} catch (e) {
|
|
65
65
|
if (axios.isAxiosError(e)) {
|
|
66
|
-
const errorMessage = e
|
|
66
|
+
const errorMessage = _get(e, 'response.data.message') || 'Error'
|
|
67
67
|
setErrorMessage(errorMessage)
|
|
68
68
|
onGetCountriesError(e)
|
|
69
69
|
}
|
|
@@ -81,7 +81,7 @@ export const RegistrationForm: FC<IRegistrationProps> = ({
|
|
|
81
81
|
onGetStatesSuccess(res.data)
|
|
82
82
|
} catch (e) {
|
|
83
83
|
if (axios.isAxiosError(e)) {
|
|
84
|
-
const errorMessage = e
|
|
84
|
+
const errorMessage = _get(e, 'response.data.message', {}) as AxiosError
|
|
85
85
|
onGetStatesError(errorMessage)
|
|
86
86
|
}
|
|
87
87
|
}
|
|
@@ -115,7 +115,7 @@ export const RegistrationForm: FC<IRegistrationProps> = ({
|
|
|
115
115
|
} catch (e) {
|
|
116
116
|
if (axios.isAxiosError(e)) {
|
|
117
117
|
console.log(e)
|
|
118
|
-
const errorMessage = e
|
|
118
|
+
const errorMessage = _get(e, 'response.data.message') || 'Error'
|
|
119
119
|
onRegisterAccountError(e)
|
|
120
120
|
setshowErrorModal(true)
|
|
121
121
|
setErrorMessage(errorMessage)
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import './style.css'
|
|
2
|
+
|
|
3
3
|
import { CircularProgress } from '@mui/material'
|
|
4
|
-
import { CustomField } from '../common/CustomField'
|
|
5
4
|
import axios, { AxiosError } from 'axios'
|
|
5
|
+
import { Field, Form, Formik } from 'formik'
|
|
6
|
+
import React, { FC, useState } from 'react'
|
|
6
7
|
import * as Yup from 'yup'
|
|
8
|
+
|
|
7
9
|
import { resetPassword } from '../../api'
|
|
8
|
-
import '
|
|
10
|
+
import { CustomField } from '../common/CustomField'
|
|
9
11
|
|
|
10
12
|
interface IResetPasswordProps {
|
|
11
|
-
token?: string
|
|
12
|
-
onResetPasswordSuccess?: (res: any) => void
|
|
13
|
-
onResetPasswordError?: (e: AxiosError) => void
|
|
13
|
+
token?: string;
|
|
14
|
+
onResetPasswordSuccess?: (res: any) => void;
|
|
15
|
+
onResetPasswordError?: (e: AxiosError) => void;
|
|
14
16
|
}
|
|
15
17
|
|
|
16
18
|
const Schema = Yup.object().shape({
|
|
17
|
-
password: Yup.string()
|
|
18
|
-
|
|
19
|
-
.required('Required'),
|
|
20
|
-
password_confirmation: Yup.string()
|
|
19
|
+
password: Yup.string().min(6, 'Password must have 5+ characters').required('Required'),
|
|
20
|
+
password_confirmation: Yup.string()
|
|
21
21
|
.required('Required')
|
|
22
22
|
.oneOf([Yup.ref('password'), null], 'Passwords must match'),
|
|
23
23
|
})
|
|
@@ -42,8 +42,7 @@ export const ResetPasswordContainer: FC<IResetPasswordProps> = ({
|
|
|
42
42
|
token = tokenProps
|
|
43
43
|
} else {
|
|
44
44
|
if (typeof window !== 'undefined') {
|
|
45
|
-
const params: URLSearchParams = new URL(`${window.location}`)
|
|
46
|
-
.searchParams
|
|
45
|
+
const params: URLSearchParams = new URL(`${window.location}`).searchParams
|
|
47
46
|
token = params.get('token')
|
|
48
47
|
}
|
|
49
48
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { CSSProperties } from '@emotion/serialize'
|
|
2
|
-
import {
|
|
2
|
+
import { Select, SelectChangeEvent, ThemeOptions } from '@mui/material'
|
|
3
3
|
import CircularProgress from '@mui/material/CircularProgress'
|
|
4
4
|
import FormControl from '@mui/material/FormControl'
|
|
5
5
|
import InputLabel from '@mui/material/InputLabel'
|
|
6
6
|
import MenuItem from '@mui/material/MenuItem'
|
|
7
|
+
import { createTheme, ThemeProvider } from '@mui/material/styles'
|
|
7
8
|
import Tooltip from '@mui/material/Tooltip'
|
|
8
|
-
import { ThemeProvider } from '@mui/private-theming'
|
|
9
9
|
import _find from 'lodash/find'
|
|
10
10
|
import _identity from 'lodash/identity'
|
|
11
11
|
import _isEmpty from 'lodash/isEmpty'
|