ordering-ui-external 1.2.2 → 1.3.0
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/_bundles/{0.ordering-ui.fc62fe574704c7c4d033.js → 0.ordering-ui.aee3f88f00476e436e39.js} +1 -1
- package/_bundles/{1.ordering-ui.fc62fe574704c7c4d033.js → 1.ordering-ui.aee3f88f00476e436e39.js} +1 -1
- package/_bundles/{3.ordering-ui.fc62fe574704c7c4d033.js → 3.ordering-ui.aee3f88f00476e436e39.js} +1 -1
- package/_bundles/{4.ordering-ui.fc62fe574704c7c4d033.js → 4.ordering-ui.aee3f88f00476e436e39.js} +1 -1
- package/_bundles/5.ordering-ui.aee3f88f00476e436e39.js +1 -0
- package/_bundles/{6.ordering-ui.fc62fe574704c7c4d033.js → 6.ordering-ui.aee3f88f00476e436e39.js} +1 -1
- package/_bundles/7.ordering-ui.aee3f88f00476e436e39.js +2 -0
- package/_bundles/{7.ordering-ui.fc62fe574704c7c4d033.js.LICENSE.txt → 7.ordering-ui.aee3f88f00476e436e39.js.LICENSE.txt} +0 -0
- package/_bundles/{8.ordering-ui.fc62fe574704c7c4d033.js → 8.ordering-ui.aee3f88f00476e436e39.js} +1 -1
- package/_bundles/{9.ordering-ui.fc62fe574704c7c4d033.js → 9.ordering-ui.aee3f88f00476e436e39.js} +1 -1
- package/_bundles/ordering-ui.aee3f88f00476e436e39.js +2 -0
- package/_bundles/{ordering-ui.fc62fe574704c7c4d033.js.LICENSE.txt → ordering-ui.aee3f88f00476e436e39.js.LICENSE.txt} +0 -0
- package/_modules/components/AutoScroll/styles.js +3 -3
- package/_modules/hooks/useIsMounted.js +24 -0
- package/_modules/index.js +8 -0
- package/_modules/themes/five/index.js +33 -1
- package/_modules/themes/five/src/components/BusinessBasicInformation/index.js +2 -2
- package/_modules/themes/five/src/components/BusinessController/styles.js +42 -42
- package/_modules/themes/five/src/components/BusinessProductsCategories/index.js +12 -2
- package/_modules/themes/five/src/components/BusinessProductsCategories/styles.js +5 -2
- package/_modules/themes/five/src/components/BusinessProductsListing/index.js +10 -3
- package/_modules/themes/five/src/components/BusinessProductsListing/styles.js +7 -3
- package/_modules/themes/five/src/components/BusinessesListing/layouts/OriginalBusinessesListing/index.js +1 -0
- package/_modules/themes/five/src/components/MultiCheckout/styles.js +1 -1
- package/_modules/themes/five/src/components/MyOrders/index.js +9 -3
- package/_modules/themes/five/src/components/NavigationBar/index.js +159 -0
- package/_modules/themes/five/src/components/NavigationBar/styles.js +33 -0
- package/_modules/themes/five/src/components/OrderDetails/index.js +71 -41
- package/_modules/themes/five/src/components/ProfessionalBusinessFilter/index.js +96 -0
- package/_modules/themes/five/src/components/ProfessionalBusinessFilter/styles.js +48 -0
- package/_modules/themes/five/src/components/ProfessionalFilter/index.js +35 -7
- package/_modules/themes/five/src/components/ProfessionalFilter/styles.js +10 -4
- package/_modules/themes/five/src/components/ProfessionalInfo/index.js +120 -0
- package/_modules/themes/five/src/components/ProfessionalInfo/styles.js +100 -0
- package/_modules/themes/five/src/components/RenderProductsLayout/index.js +36 -13
- package/_modules/themes/five/src/components/RenderProductsLayout/styles.js +21 -18
- package/_modules/themes/five/src/components/ReviewProfessional/index.js +314 -0
- package/_modules/themes/five/src/components/ReviewProfessional/styles.js +137 -0
- package/_modules/themes/five/src/components/SignUpApproval/index.js +106 -0
- package/_modules/themes/five/src/components/SignUpApproval/styles.js +71 -0
- package/_modules/themes/five/src/components/SignUpBusiness/index.js +7 -383
- package/_modules/themes/five/src/components/SignUpBusiness/layouts/NewSignUpBusiness/index.js +405 -0
- package/_modules/themes/five/src/components/SignUpBusiness/layouts/NewSignUpBusiness/styles.js +110 -0
- package/_modules/themes/five/src/components/SignUpBusiness/layouts/OldSignUpBusiness/index.js +400 -0
- package/_modules/themes/five/src/components/SignUpBusiness/{styles.js → layouts/OldSignUpBusiness/styles.js} +0 -0
- package/_modules/themes/five/src/components/SignUpDriver/index.js +7 -383
- package/_modules/themes/five/src/components/SignUpDriver/layouts/NewSignUpDriver/index.js +405 -0
- package/_modules/themes/five/src/components/SignUpDriver/layouts/NewSignUpDriver/styles.js +106 -0
- package/_modules/themes/five/src/components/SignUpDriver/layouts/OldSignUpDriver/index.js +400 -0
- package/_modules/themes/five/src/components/SignUpDriver/{styles.js → layouts/OldSignUpDriver/styles.js} +0 -0
- package/_modules/themes/five/src/components/SingleProductCard/styles.js +1 -1
- package/_modules/utils/index.js +103 -0
- package/package.json +2 -2
- package/src/components/AutoScroll/styles.js +11 -12
- package/src/hooks/useIsMounted.js +18 -0
- package/src/index.js +2 -0
- package/src/themes/five/index.js +9 -1
- package/src/themes/five/src/components/BusinessBasicInformation/index.js +1 -1
- package/src/themes/five/src/components/BusinessController/styles.js +3 -6
- package/src/themes/five/src/components/BusinessProductsCategories/index.js +10 -2
- package/src/themes/five/src/components/BusinessProductsCategories/styles.js +5 -0
- package/src/themes/five/src/components/BusinessProductsListing/index.js +8 -2
- package/src/themes/five/src/components/BusinessProductsListing/styles.js +1 -1
- package/src/themes/five/src/components/BusinessesListing/layouts/OriginalBusinessesListing/index.js +2 -0
- package/src/themes/five/src/components/MultiCheckout/index.js +1 -0
- package/src/themes/five/src/components/MultiCheckout/styles.js +1 -0
- package/src/themes/five/src/components/MyOrders/index.js +6 -3
- package/src/themes/five/src/components/NavigationBar/index.js +104 -0
- package/src/themes/five/src/components/NavigationBar/styles.js +44 -0
- package/src/themes/five/src/components/OrderDetails/index.js +19 -11
- package/src/themes/five/src/components/ProfessionalBusinessFilter/index.js +82 -0
- package/src/themes/five/src/components/ProfessionalBusinessFilter/styles.js +71 -0
- package/src/themes/five/src/components/ProfessionalFilter/index.js +30 -7
- package/src/themes/five/src/components/ProfessionalFilter/styles.js +15 -2
- package/src/themes/five/src/components/ProfessionalInfo/index.js +133 -0
- package/src/themes/five/src/components/ProfessionalInfo/styles.js +140 -0
- package/src/themes/five/src/components/RenderProductsLayout/index.js +37 -16
- package/src/themes/five/src/components/RenderProductsLayout/styles.js +6 -1
- package/src/themes/five/src/components/ReviewProfessional/index.js +239 -0
- package/src/themes/five/src/components/ReviewProfessional/styles.js +233 -0
- package/src/themes/five/src/components/SignUpApproval/index.js +108 -0
- package/src/themes/five/src/components/SignUpApproval/styles.js +98 -0
- package/src/themes/five/src/components/SignUpBusiness/index.js +10 -374
- package/src/themes/five/src/components/SignUpBusiness/layouts/NewSignUpBusiness/index.js +382 -0
- package/src/themes/five/src/components/SignUpBusiness/layouts/NewSignUpBusiness/styles.js +256 -0
- package/src/themes/five/src/components/SignUpBusiness/layouts/OldSignUpBusiness/index.js +378 -0
- package/src/themes/five/src/components/SignUpBusiness/{styles.js → layouts/OldSignUpBusiness/styles.js} +0 -0
- package/src/themes/five/src/components/SignUpDriver/index.js +10 -374
- package/src/themes/five/src/components/SignUpDriver/layouts/NewSignUpDriver/index.js +382 -0
- package/src/themes/five/src/components/SignUpDriver/layouts/NewSignUpDriver/styles.js +262 -0
- package/src/themes/five/src/components/SignUpDriver/layouts/OldSignUpDriver/index.js +378 -0
- package/src/themes/five/src/components/SignUpDriver/{styles.js → layouts/OldSignUpDriver/styles.js} +0 -0
- package/src/themes/five/src/components/SingleProductCard/styles.js +3 -1
- package/src/utils/index.js +54 -0
- package/_bundles/5.ordering-ui.fc62fe574704c7c4d033.js +0 -1
- package/_bundles/7.ordering-ui.fc62fe574704c7c4d033.js +0 -2
- package/_bundles/ordering-ui.fc62fe574704c7c4d033.js +0 -2
|
@@ -0,0 +1,382 @@
|
|
|
1
|
+
import React, { useState, useEffect, useRef } from 'react'
|
|
2
|
+
import { useForm } from 'react-hook-form'
|
|
3
|
+
import Skeleton from 'react-loading-skeleton'
|
|
4
|
+
import { Alert } from '../../../Confirm'
|
|
5
|
+
import { InputPhoneNumber } from '../../../../../../../components/InputPhoneNumber'
|
|
6
|
+
import parsePhoneNumber from 'libphonenumber-js'
|
|
7
|
+
import { useTheme } from 'styled-components'
|
|
8
|
+
import { Input } from '../../../../styles/Inputs'
|
|
9
|
+
import { Button } from '../../../../styles/Buttons'
|
|
10
|
+
import { Checkbox } from '../../../../../../../styles/Checkbox'
|
|
11
|
+
import { sortInputFields } from '../../../../../../../utils'
|
|
12
|
+
|
|
13
|
+
import AiOutlineEye from '@meronex/icons/ai/AiOutlineEye'
|
|
14
|
+
import AiOutlineEyeInvisible from '@meronex/icons/ai/AiOutlineEyeInvisible'
|
|
15
|
+
|
|
16
|
+
import {
|
|
17
|
+
SignupForm as SignUpController,
|
|
18
|
+
useLanguage,
|
|
19
|
+
useConfig,
|
|
20
|
+
ReCaptcha
|
|
21
|
+
} from 'ordering-components-external'
|
|
22
|
+
|
|
23
|
+
import {
|
|
24
|
+
SignUpDriverContainer,
|
|
25
|
+
SignupDescriptionContainer,
|
|
26
|
+
SignupDescriptionTitle,
|
|
27
|
+
SignupDescriptionContent,
|
|
28
|
+
SignUpTitle,
|
|
29
|
+
FormInput,
|
|
30
|
+
WrapperPassword,
|
|
31
|
+
TogglePassword,
|
|
32
|
+
ReCaptchaWrapper,
|
|
33
|
+
TermsConditionWrapper,
|
|
34
|
+
SkeletonWrapper,
|
|
35
|
+
FormSide,
|
|
36
|
+
PhoneNumberWrapper
|
|
37
|
+
} from './styles'
|
|
38
|
+
|
|
39
|
+
const notValidationFields = ['coupon', 'driver_tip', 'mobile_phone', 'address', 'address_notes']
|
|
40
|
+
|
|
41
|
+
const SignUpDriverUI = (props) => {
|
|
42
|
+
const {
|
|
43
|
+
handleChangeInput,
|
|
44
|
+
handleButtonSignupClick,
|
|
45
|
+
handleReCaptcha,
|
|
46
|
+
useChekoutFileds,
|
|
47
|
+
validationFields,
|
|
48
|
+
showField,
|
|
49
|
+
isRequiredField,
|
|
50
|
+
formState,
|
|
51
|
+
handleSuccessSignup,
|
|
52
|
+
isPopup,
|
|
53
|
+
externalPhoneNumber,
|
|
54
|
+
saveCustomerUser,
|
|
55
|
+
fieldsNotValid,
|
|
56
|
+
signupData,
|
|
57
|
+
enableReCaptcha
|
|
58
|
+
} = props
|
|
59
|
+
|
|
60
|
+
const theme = useTheme()
|
|
61
|
+
const [, t] = useLanguage()
|
|
62
|
+
const [{ configs }] = useConfig()
|
|
63
|
+
const formMethods = useForm()
|
|
64
|
+
const [alertState, setAlertState] = useState({ open: false, content: [] })
|
|
65
|
+
const emailInput = useRef(null)
|
|
66
|
+
|
|
67
|
+
const [userPhoneNumber, setUserPhoneNumber] = useState('')
|
|
68
|
+
const [isValidPhoneNumber, setIsValidPhoneNumber] = useState(null)
|
|
69
|
+
const [passwordSee, setPasswordSee] = useState(false)
|
|
70
|
+
|
|
71
|
+
const showInputPhoneNumber = (validationFields?.fields?.checkout?.cellphone?.enabled ?? false) || configs?.verification_phone_required?.value === '1'
|
|
72
|
+
|
|
73
|
+
const togglePasswordView = () => {
|
|
74
|
+
setPasswordSee(!passwordSee)
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
const closeAlert = () => {
|
|
78
|
+
setAlertState({
|
|
79
|
+
open: false,
|
|
80
|
+
content: []
|
|
81
|
+
})
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
const onSubmit = () => {
|
|
85
|
+
const isPhoneNumberValid = userPhoneNumber ? isValidPhoneNumber : true
|
|
86
|
+
if (!userPhoneNumber &&
|
|
87
|
+
((validationFields?.fields?.checkout?.cellphone?.enabled &&
|
|
88
|
+
validationFields?.fields?.checkout?.cellphone?.required) ||
|
|
89
|
+
configs?.verification_phone_required?.value === '1')
|
|
90
|
+
) {
|
|
91
|
+
setAlertState({
|
|
92
|
+
open: true,
|
|
93
|
+
content: [t('VALIDATION_ERROR_MOBILE_PHONE_REQUIRED', 'The field Mobile phone is required.')]
|
|
94
|
+
})
|
|
95
|
+
return
|
|
96
|
+
}
|
|
97
|
+
if (!isPhoneNumberValid) {
|
|
98
|
+
setAlertState({
|
|
99
|
+
open: true,
|
|
100
|
+
content: [t('INVALID_ERROR_PHONE_NUMBER', 'The Phone Number field is invalid')]
|
|
101
|
+
})
|
|
102
|
+
return
|
|
103
|
+
}
|
|
104
|
+
handleButtonSignupClick && handleButtonSignupClick()
|
|
105
|
+
if (!formState.loading && formState.result.result && !formState.result.error) {
|
|
106
|
+
handleSuccessSignup(formState.result.result)
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
const handleChangePhoneNumber = (number, isValid) => {
|
|
111
|
+
setUserPhoneNumber(number)
|
|
112
|
+
|
|
113
|
+
let phoneNumberParser = null
|
|
114
|
+
let phoneNumber = {
|
|
115
|
+
country_phone_code: {
|
|
116
|
+
name: 'country_phone_code',
|
|
117
|
+
value: ''
|
|
118
|
+
},
|
|
119
|
+
cellphone: {
|
|
120
|
+
name: 'cellphone',
|
|
121
|
+
value: ''
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
if (isValid) {
|
|
125
|
+
phoneNumberParser = parsePhoneNumber(number)
|
|
126
|
+
}
|
|
127
|
+
if (phoneNumberParser) {
|
|
128
|
+
phoneNumber = {
|
|
129
|
+
country_phone_code: {
|
|
130
|
+
name: 'country_phone_code',
|
|
131
|
+
value: phoneNumberParser.countryCallingCode
|
|
132
|
+
},
|
|
133
|
+
cellphone: {
|
|
134
|
+
name: 'cellphone',
|
|
135
|
+
value: phoneNumberParser.nationalNumber
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
handleChangeInput(phoneNumber, true)
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
const handleChangeInputEmail = (e) => {
|
|
143
|
+
handleChangeInput({ target: { name: 'email', value: e.target.value.toLowerCase().replace(/[&,()%";:ç?<>{}\\[\]\s]/g, '') } })
|
|
144
|
+
formMethods.setValue('email', e.target.value.toLowerCase().replace(/[&,()%";:ç?<>{}\\[\]\s]/g, ''))
|
|
145
|
+
if (emailInput?.current) {
|
|
146
|
+
emailInput.current.value = e.target.value.toLowerCase().replace(/[&,()%";:ç?<>{}\\[\]\s]/g, '')
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
useEffect(() => {
|
|
151
|
+
if (!formState.loading && formState.result?.error) {
|
|
152
|
+
setAlertState({
|
|
153
|
+
open: true,
|
|
154
|
+
content: formState.result?.result || [t('ERROR', 'Error')]
|
|
155
|
+
})
|
|
156
|
+
} else if (!formState.loading && !formState.result?.error && formState.result?.result) {
|
|
157
|
+
saveCustomerUser && saveCustomerUser(formState.result?.result)
|
|
158
|
+
}
|
|
159
|
+
}, [formState])
|
|
160
|
+
|
|
161
|
+
useEffect(() => {
|
|
162
|
+
if (Object.keys(formMethods.errors).length > 0) {
|
|
163
|
+
setAlertState({
|
|
164
|
+
open: true,
|
|
165
|
+
content: Object.values(formMethods.errors).map(error => error.message)
|
|
166
|
+
})
|
|
167
|
+
}
|
|
168
|
+
}, [formMethods.errors])
|
|
169
|
+
|
|
170
|
+
useEffect(() => {
|
|
171
|
+
if (!validationFields.loading) {
|
|
172
|
+
Object.values(validationFields?.fields?.checkout).map(field => !notValidationFields.includes(field.code) && (
|
|
173
|
+
field.code === 'email' ? (
|
|
174
|
+
formMethods.register('email', {
|
|
175
|
+
required: isRequiredField(field.code)
|
|
176
|
+
? t('VALIDATION_ERROR_EMAIL_REQUIRED', 'The field Email is required').replace('_attribute_', t('EMAIL', 'Email'))
|
|
177
|
+
: null,
|
|
178
|
+
pattern: {
|
|
179
|
+
value: /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}$/i,
|
|
180
|
+
message: t('INVALID_ERROR_EMAIL', 'Invalid email address').replace('_attribute_', t('EMAIL', 'Email'))
|
|
181
|
+
}
|
|
182
|
+
})
|
|
183
|
+
) : (
|
|
184
|
+
formMethods.register(field.code, {
|
|
185
|
+
required: isRequiredField(field.code)
|
|
186
|
+
? t(`VALIDATION_ERROR_${field.code.toUpperCase()}_REQUIRED`, `${field.name} is required`).replace('_attribute_', t(field.name, field.code))
|
|
187
|
+
: null
|
|
188
|
+
})
|
|
189
|
+
)
|
|
190
|
+
))
|
|
191
|
+
}
|
|
192
|
+
}, [formMethods])
|
|
193
|
+
|
|
194
|
+
useEffect(() => {
|
|
195
|
+
Object.keys(signupData).map(fieldName => {
|
|
196
|
+
formMethods.setValue(fieldName, signupData[fieldName])
|
|
197
|
+
})
|
|
198
|
+
}, [signupData])
|
|
199
|
+
|
|
200
|
+
useEffect(() => {
|
|
201
|
+
if (externalPhoneNumber) {
|
|
202
|
+
setUserPhoneNumber(externalPhoneNumber)
|
|
203
|
+
handleChangePhoneNumber(externalPhoneNumber, true)
|
|
204
|
+
}
|
|
205
|
+
}, [externalPhoneNumber])
|
|
206
|
+
|
|
207
|
+
useEffect(() => {
|
|
208
|
+
handleChangeInput({
|
|
209
|
+
target: {
|
|
210
|
+
name: 'level',
|
|
211
|
+
value: 4
|
|
212
|
+
}
|
|
213
|
+
})
|
|
214
|
+
}, [])
|
|
215
|
+
|
|
216
|
+
return (
|
|
217
|
+
<SignUpDriverContainer bgImage={theme.images?.general?.driverSignUpBG}>
|
|
218
|
+
<SignupDescriptionContainer>
|
|
219
|
+
<SignupDescriptionTitle>{t('JOIN_OUR_FLEET_TODAY', 'Join our fleet today')}</SignupDescriptionTitle>
|
|
220
|
+
<SignupDescriptionContent>{t('REGISTER_AS_NEW_DRIVER', 'Register as a new driver and start delivering asap. After registering, you’ll download a driver app for iOS or Android, the orders will get assigned to you, and the driver will guide you through the process.')}</SignupDescriptionContent>
|
|
221
|
+
</SignupDescriptionContainer>
|
|
222
|
+
<FormSide>
|
|
223
|
+
<SignUpTitle>{t('SIGN_UP_NOW', 'Sign up now')}</SignUpTitle>
|
|
224
|
+
<FormInput
|
|
225
|
+
noValidate
|
|
226
|
+
isPopup={isPopup}
|
|
227
|
+
onSubmit={formMethods.handleSubmit(onSubmit)}
|
|
228
|
+
isSkeleton={useChekoutFileds && validationFields?.loading}
|
|
229
|
+
>
|
|
230
|
+
{props.beforeMidElements?.map((BeforeMidElements, i) => (
|
|
231
|
+
<React.Fragment key={i}>
|
|
232
|
+
{BeforeMidElements}
|
|
233
|
+
</React.Fragment>))}
|
|
234
|
+
{props.beforeMidComponents?.map((BeforeMidComponents, i) => (
|
|
235
|
+
<BeforeMidComponents key={i} {...props} />))}
|
|
236
|
+
{
|
|
237
|
+
!(useChekoutFileds && validationFields?.loading) ? (
|
|
238
|
+
<>
|
|
239
|
+
{validationFields?.fields?.checkout &&
|
|
240
|
+
sortInputFields({ values: validationFields?.fields?.checkout }).map(field =>
|
|
241
|
+
showField && showField(field.code) && (
|
|
242
|
+
<React.Fragment key={field.id}>
|
|
243
|
+
{field.code === 'email' ? (
|
|
244
|
+
<Input
|
|
245
|
+
type={field.type}
|
|
246
|
+
name={field.code}
|
|
247
|
+
aria-label={field.code}
|
|
248
|
+
className='form'
|
|
249
|
+
placeholder={t(field.code.toUpperCase(), field.name)}
|
|
250
|
+
onChange={handleChangeInputEmail}
|
|
251
|
+
ref={(e) => {
|
|
252
|
+
emailInput.current = e
|
|
253
|
+
}}
|
|
254
|
+
required={!!field.required}
|
|
255
|
+
autoComplete='off'
|
|
256
|
+
/>
|
|
257
|
+
) : (
|
|
258
|
+
<Input
|
|
259
|
+
type={field.type}
|
|
260
|
+
name={field.code}
|
|
261
|
+
aria-label={field.code}
|
|
262
|
+
className='form'
|
|
263
|
+
placeholder={t(field.code.toUpperCase(), field.name)}
|
|
264
|
+
onChange={handleChangeInput}
|
|
265
|
+
required={field.required}
|
|
266
|
+
autoComplete='off'
|
|
267
|
+
/>
|
|
268
|
+
)}
|
|
269
|
+
</React.Fragment>
|
|
270
|
+
)
|
|
271
|
+
)}
|
|
272
|
+
{!!showInputPhoneNumber && (
|
|
273
|
+
<PhoneNumberWrapper className='formStyle'>
|
|
274
|
+
<InputPhoneNumber
|
|
275
|
+
value={userPhoneNumber}
|
|
276
|
+
setValue={handleChangePhoneNumber}
|
|
277
|
+
handleIsValid={setIsValidPhoneNumber}
|
|
278
|
+
/>
|
|
279
|
+
</PhoneNumberWrapper>
|
|
280
|
+
)}
|
|
281
|
+
|
|
282
|
+
{(!fieldsNotValid || (fieldsNotValid && !fieldsNotValid.includes('password'))) && (
|
|
283
|
+
<WrapperPassword className='formStyle'>
|
|
284
|
+
<Input
|
|
285
|
+
type={!passwordSee ? 'password' : 'text'}
|
|
286
|
+
name='password'
|
|
287
|
+
aria-label='password'
|
|
288
|
+
className='form'
|
|
289
|
+
placeholder={t('PASSWORD', 'Password')}
|
|
290
|
+
onChange={handleChangeInput}
|
|
291
|
+
required
|
|
292
|
+
ref={formMethods.register({
|
|
293
|
+
required: isRequiredField('password') ? t('VALIDATION_ERROR_PASSWORD_REQUIRED', 'The field Password is required').replace('_attribute_', t('PASSWORD', 'password')) : null,
|
|
294
|
+
minLength: {
|
|
295
|
+
value: 8,
|
|
296
|
+
message: t('VALIDATION_ERROR_PASSWORD_MIN_STRING', 'The Password must be at least 8 characters.').replace('_attribute_', t('PASSWORD', 'Password')).replace('_min_', 8)
|
|
297
|
+
}
|
|
298
|
+
})}
|
|
299
|
+
/>
|
|
300
|
+
<TogglePassword onClick={togglePasswordView}>
|
|
301
|
+
{!passwordSee ? <AiOutlineEye /> : <AiOutlineEyeInvisible />}
|
|
302
|
+
</TogglePassword>
|
|
303
|
+
</WrapperPassword>
|
|
304
|
+
)}
|
|
305
|
+
|
|
306
|
+
{props.afterMidElements?.map((MidElement, i) => (
|
|
307
|
+
<React.Fragment key={i}>
|
|
308
|
+
{MidElement}
|
|
309
|
+
</React.Fragment>))}
|
|
310
|
+
{props.afterMidComponents?.map((MidComponent, i) => (
|
|
311
|
+
<MidComponent key={i} {...props} />))}
|
|
312
|
+
</>
|
|
313
|
+
) : (
|
|
314
|
+
<>
|
|
315
|
+
{[...Array(5)].map((_, i) => (
|
|
316
|
+
<SkeletonWrapper key={i}>
|
|
317
|
+
<Skeleton height={43} />
|
|
318
|
+
</SkeletonWrapper>
|
|
319
|
+
))}
|
|
320
|
+
</>
|
|
321
|
+
)
|
|
322
|
+
}
|
|
323
|
+
{props.isRecaptchaEnable && enableReCaptcha && (
|
|
324
|
+
<ReCaptchaWrapper>
|
|
325
|
+
<ReCaptcha handleReCaptcha={handleReCaptcha} />
|
|
326
|
+
</ReCaptchaWrapper>
|
|
327
|
+
)}
|
|
328
|
+
|
|
329
|
+
{configs?.terms_and_conditions?.value === 'true' && (
|
|
330
|
+
<TermsConditionWrapper>
|
|
331
|
+
<Checkbox
|
|
332
|
+
name='acceptTerms'
|
|
333
|
+
ref={formMethods.register({
|
|
334
|
+
required: t('ERROR_ACCEPT_TERMS', 'You must accept the Terms & Conditions.')
|
|
335
|
+
})}
|
|
336
|
+
id='acceptTerms'
|
|
337
|
+
/>
|
|
338
|
+
<label
|
|
339
|
+
htmlFor='acceptTerms'
|
|
340
|
+
>
|
|
341
|
+
<span>{t('TERMS_AND_CONDITIONS_TEXT', 'I’m agree with')}</span>
|
|
342
|
+
<a
|
|
343
|
+
href={configs?.terms_and_conditions_url?.value}
|
|
344
|
+
target='_blank'
|
|
345
|
+
rel='noopener noreferrer'
|
|
346
|
+
>
|
|
347
|
+
{t('TERMS_AND_CONDITIONS', 'Terms & Conditions')}
|
|
348
|
+
</a>
|
|
349
|
+
</label>
|
|
350
|
+
</TermsConditionWrapper>
|
|
351
|
+
)}
|
|
352
|
+
|
|
353
|
+
<Button
|
|
354
|
+
color='primary'
|
|
355
|
+
type='submit'
|
|
356
|
+
className='formButton'
|
|
357
|
+
disabled={formState.loading || validationFields?.loading}
|
|
358
|
+
>
|
|
359
|
+
{formState.loading ? `${t('LOADING', 'Loading')}...` : t('SUBMIT', 'Submit')}
|
|
360
|
+
</Button>
|
|
361
|
+
</FormInput>
|
|
362
|
+
</FormSide>
|
|
363
|
+
<Alert
|
|
364
|
+
title={t('SIGN_UP_FOR_BUSINESS', 'Sign up for business')}
|
|
365
|
+
content={alertState.content}
|
|
366
|
+
acceptText={t('ACCEPT', 'Accept')}
|
|
367
|
+
open={alertState.open}
|
|
368
|
+
onClose={() => closeAlert()}
|
|
369
|
+
onAccept={() => closeAlert()}
|
|
370
|
+
closeOnBackdrop={false}
|
|
371
|
+
/>
|
|
372
|
+
</SignUpDriverContainer>
|
|
373
|
+
)
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
export const SignUpDriver = (props) => {
|
|
377
|
+
const signUpDriverProps = {
|
|
378
|
+
...props,
|
|
379
|
+
UIComponent: SignUpDriverUI
|
|
380
|
+
}
|
|
381
|
+
return <SignUpController {...signUpDriverProps} />
|
|
382
|
+
}
|
|
@@ -0,0 +1,262 @@
|
|
|
1
|
+
import styled, { css } from 'styled-components'
|
|
2
|
+
|
|
3
|
+
export const SignUpDriverContainer = styled.div`
|
|
4
|
+
${({ bgImage }) => bgImage && css`
|
|
5
|
+
background-image: url(${bgImage});
|
|
6
|
+
background-repeat: no-repeat;
|
|
7
|
+
background-size: cover;
|
|
8
|
+
object-fit: cover;
|
|
9
|
+
background-position: center;
|
|
10
|
+
`}
|
|
11
|
+
display: flex;
|
|
12
|
+
justify-content: space-between;
|
|
13
|
+
align-items: center;
|
|
14
|
+
flex-direction: column-reverse;
|
|
15
|
+
padding: 25px 30px 30px;
|
|
16
|
+
|
|
17
|
+
> div {
|
|
18
|
+
width: 100%;
|
|
19
|
+
max-width: 580px;
|
|
20
|
+
box-sizing: border-box;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
@media (min-width: 993px) {
|
|
24
|
+
flex-direction: row;
|
|
25
|
+
align-items: center;
|
|
26
|
+
padding: 120px 130px;
|
|
27
|
+
> div {
|
|
28
|
+
width: calc(50% - 12px);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
`
|
|
32
|
+
export const SignupDescriptionContainer = styled.div`
|
|
33
|
+
margin-right: 0;
|
|
34
|
+
margin-top: 45px;
|
|
35
|
+
|
|
36
|
+
@media (min-width: 993px) {
|
|
37
|
+
margin-right: 24px;
|
|
38
|
+
margin-top: 0;
|
|
39
|
+
}
|
|
40
|
+
`
|
|
41
|
+
|
|
42
|
+
export const SignupDescriptionTitle = styled.div`
|
|
43
|
+
font-style: normal;
|
|
44
|
+
font-weight: 600;
|
|
45
|
+
font-size: 28px;
|
|
46
|
+
line-height: 60px;
|
|
47
|
+
color: ${props => props.theme.colors.colorTextSignForm};
|
|
48
|
+
|
|
49
|
+
@media (min-width: 430px) {
|
|
50
|
+
font-size: 37px;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
@media (min-width: 1275px) {
|
|
54
|
+
font-size: 48px;
|
|
55
|
+
}
|
|
56
|
+
`
|
|
57
|
+
|
|
58
|
+
export const SignupDescriptionContent = styled.div`
|
|
59
|
+
margin-top: 0;
|
|
60
|
+
font-style: normal;
|
|
61
|
+
font-weight: 400;
|
|
62
|
+
font-size: 16px;
|
|
63
|
+
line-height: 36px;
|
|
64
|
+
color: ${props => props.theme.colors.colorTextSignForm};
|
|
65
|
+
|
|
66
|
+
@media (min-width: 430px) {
|
|
67
|
+
font-size: 20px;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
@media (min-width: 993px) {
|
|
71
|
+
margin-top: 15px;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
@media (min-width: 1275px) {
|
|
75
|
+
font-size: 24px;
|
|
76
|
+
}
|
|
77
|
+
`
|
|
78
|
+
|
|
79
|
+
export const FormInput = styled.form`
|
|
80
|
+
width: 100%;
|
|
81
|
+
display: flex;
|
|
82
|
+
flex-direction: column;
|
|
83
|
+
|
|
84
|
+
div.phone_number {
|
|
85
|
+
margin: 10px 0px;
|
|
86
|
+
width: 100%;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
input.form:not(:last-child) {
|
|
90
|
+
margin: 10px 0px;
|
|
91
|
+
padding: 8px 20px;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
button {
|
|
95
|
+
margin-top: 10px;
|
|
96
|
+
padding: 5px;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
> input {
|
|
100
|
+
font-size: 20px;
|
|
101
|
+
box-shadow: 0px 8px 35px rgba(0, 0, 0, 0.16);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
> .formStyle {
|
|
105
|
+
& > .phone_number {
|
|
106
|
+
border-radius: 7.6px;
|
|
107
|
+
font-size: 20px;
|
|
108
|
+
box-shadow: 0px 8px 35px rgba(0, 0, 0, 0.16);
|
|
109
|
+
}
|
|
110
|
+
& > input {
|
|
111
|
+
border-radius: 7.6px;
|
|
112
|
+
font-size: 20px;
|
|
113
|
+
box-shadow: 0px 8px 35px rgba(0, 0, 0, 0.16);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
> .formButton {
|
|
118
|
+
width: 128px;
|
|
119
|
+
padding: 15px 0;
|
|
120
|
+
font-style: normal;
|
|
121
|
+
font-weight: 600;
|
|
122
|
+
font-size: 24px;
|
|
123
|
+
line-height: 30px;
|
|
124
|
+
}
|
|
125
|
+
`
|
|
126
|
+
|
|
127
|
+
export const PhoneNumberWrapper = styled.div`
|
|
128
|
+
.PhoneInput {
|
|
129
|
+
border: 1px solid #DEE2E6;
|
|
130
|
+
box-sizing: border-box;
|
|
131
|
+
border-radius: 7.6px;
|
|
132
|
+
background: white;
|
|
133
|
+
|
|
134
|
+
.PhoneInputCountry {
|
|
135
|
+
padding-left: 20px;
|
|
136
|
+
${props => props.theme.rtl && css`
|
|
137
|
+
padding-left: 0;
|
|
138
|
+
padding-right: 20px;
|
|
139
|
+
`}
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
input {
|
|
143
|
+
border: none;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
`
|
|
147
|
+
|
|
148
|
+
export const ReCaptchaWrapper = styled.div`
|
|
149
|
+
margin: 12px auto;
|
|
150
|
+
`
|
|
151
|
+
|
|
152
|
+
export const WrapperPassword = styled.div`
|
|
153
|
+
position: relative;
|
|
154
|
+
width: 100%;
|
|
155
|
+
input{
|
|
156
|
+
box-sizing: border-box;
|
|
157
|
+
width: 100%;
|
|
158
|
+
padding-right: 40px;
|
|
159
|
+
}
|
|
160
|
+
`
|
|
161
|
+
|
|
162
|
+
export const TogglePassword = styled.span`
|
|
163
|
+
position: absolute;
|
|
164
|
+
font-weight: 300;
|
|
165
|
+
padding: 10px 0;
|
|
166
|
+
color: #333;
|
|
167
|
+
font-size: 26px;
|
|
168
|
+
transform: translate(-150%, 10%);
|
|
169
|
+
max-height: 100%;
|
|
170
|
+
${props => props.theme?.rtl && css`
|
|
171
|
+
transform: translate(150%, 10%);
|
|
172
|
+
`}
|
|
173
|
+
span{
|
|
174
|
+
cursor: pointer;
|
|
175
|
+
}
|
|
176
|
+
`
|
|
177
|
+
|
|
178
|
+
export const TermsConditionWrapper = styled.div`
|
|
179
|
+
display: flex;
|
|
180
|
+
align-items: center;
|
|
181
|
+
margin: 10px 0;
|
|
182
|
+
|
|
183
|
+
> label {
|
|
184
|
+
font-size: 14px;
|
|
185
|
+
${props => props.theme?.rtl ? css`
|
|
186
|
+
margin-right: 20px;
|
|
187
|
+
` : css`
|
|
188
|
+
margin-left: 20px;
|
|
189
|
+
`}
|
|
190
|
+
|
|
191
|
+
> span:first-child {
|
|
192
|
+
font-weight: 500;
|
|
193
|
+
${props => props.theme?.rtl ? css`
|
|
194
|
+
margin-left: 7px;
|
|
195
|
+
` : css`
|
|
196
|
+
margin-right: 7px;
|
|
197
|
+
`}
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
> a {
|
|
201
|
+
color: ${props => props.theme.colors.primary} !important;
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
@media (min-width: 768px) {
|
|
206
|
+
> label {
|
|
207
|
+
font-size: 16px;
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
`
|
|
211
|
+
|
|
212
|
+
export const SkeletonWrapper = styled.div`
|
|
213
|
+
span{
|
|
214
|
+
margin: 10px 0;
|
|
215
|
+
border-radius: 7.6px;
|
|
216
|
+
}
|
|
217
|
+
`
|
|
218
|
+
|
|
219
|
+
export const FormSide = styled.div`
|
|
220
|
+
background-color: ${props => props.theme.colors.colorTextSignForm};
|
|
221
|
+
box-shadow: 0px 4px 4px rgba(0, 0, 0, 0.25);
|
|
222
|
+
border-radius: 31px;
|
|
223
|
+
display: flex;
|
|
224
|
+
width: 100%;
|
|
225
|
+
flex-direction: column;
|
|
226
|
+
align-items: center;
|
|
227
|
+
margin: auto;
|
|
228
|
+
padding: 25px 30px 25px;
|
|
229
|
+
|
|
230
|
+
> h1 {
|
|
231
|
+
width: 100%;
|
|
232
|
+
margin-bottom: 25px;
|
|
233
|
+
margin-top: 15;
|
|
234
|
+
font-weight: 500;
|
|
235
|
+
font-size: 24px;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
@media (min-width: 769px) {
|
|
239
|
+
padding: 42px 58px 65px;
|
|
240
|
+
${({ isPopup }) => isPopup && css`
|
|
241
|
+
margin: 20px 0px;
|
|
242
|
+
`}
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
@media (min-width: 992px) {
|
|
246
|
+
width: 45%;
|
|
247
|
+
font-size: ${({ isPopup }) => isPopup ? '12px' : '1em'};
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
@media (min-width: 1200px){
|
|
251
|
+
font-size: ${({ isPopup }) => isPopup ? '0.9em' : '1em'};
|
|
252
|
+
}
|
|
253
|
+
`
|
|
254
|
+
export const SignUpTitle = styled.h1`
|
|
255
|
+
margin-top: 0;
|
|
256
|
+
margin-bottom: 10px !important;
|
|
257
|
+
font-style: normal;
|
|
258
|
+
font-weight: 600;
|
|
259
|
+
font-size: 36px;
|
|
260
|
+
line-height: 65px;
|
|
261
|
+
color: ${props => props.theme.colors.black};
|
|
262
|
+
`
|