ordering-ui-external 1.6.8 → 1.7.1
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.7635bd47ae9a481b3f59.js → 0.ordering-ui.8b7044a2b34939a44465.js} +0 -0
- package/_bundles/{1.ordering-ui.7635bd47ae9a481b3f59.js → 1.ordering-ui.8b7044a2b34939a44465.js} +0 -0
- package/_bundles/{2.ordering-ui.7635bd47ae9a481b3f59.js → 2.ordering-ui.8b7044a2b34939a44465.js} +0 -0
- package/_bundles/{4.ordering-ui.7635bd47ae9a481b3f59.js → 4.ordering-ui.8b7044a2b34939a44465.js} +0 -0
- package/_bundles/{5.ordering-ui.7635bd47ae9a481b3f59.js → 5.ordering-ui.8b7044a2b34939a44465.js} +0 -0
- package/_bundles/{6.ordering-ui.7635bd47ae9a481b3f59.js → 6.ordering-ui.8b7044a2b34939a44465.js} +0 -0
- package/_bundles/{7.ordering-ui.7635bd47ae9a481b3f59.js → 7.ordering-ui.8b7044a2b34939a44465.js} +1 -1
- package/_bundles/{7.ordering-ui.7635bd47ae9a481b3f59.js.LICENSE.txt → 7.ordering-ui.8b7044a2b34939a44465.js.LICENSE.txt} +0 -0
- package/_bundles/{8.ordering-ui.7635bd47ae9a481b3f59.js → 8.ordering-ui.8b7044a2b34939a44465.js} +0 -0
- package/_bundles/{9.ordering-ui.7635bd47ae9a481b3f59.js → 9.ordering-ui.8b7044a2b34939a44465.js} +0 -0
- package/_bundles/ordering-ui.8b7044a2b34939a44465.js +2 -0
- package/_bundles/{ordering-ui.7635bd47ae9a481b3f59.js.LICENSE.txt → ordering-ui.8b7044a2b34939a44465.js.LICENSE.txt} +0 -0
- package/_modules/components/BusinessInformation/index.js +8 -10
- package/_modules/components/LoginForm/index.js +58 -17
- package/_modules/components/SignUpForm/index.js +61 -20
- package/_modules/themes/callcenterOriginal/src/components/LoginForm/index.js +71 -25
- package/_modules/themes/callcenterOriginal/src/components/SignUpForm/index.js +60 -19
- package/_modules/themes/eight/src/components/LoginForm/index.js +63 -20
- package/_modules/themes/eight/src/components/SignUpForm/index.js +63 -22
- package/_modules/themes/five/src/components/BusinessController/index.js +2 -2
- package/_modules/themes/five/src/components/BusinessPreorder/index.js +6 -45
- package/_modules/themes/five/src/components/BusinessProductsListing/index.js +1 -1
- package/_modules/themes/five/src/components/Checkout/index.js +19 -3
- package/_modules/themes/five/src/components/Checkout/styles.js +5 -3
- package/_modules/themes/five/src/components/Footer/styles.js +1 -1
- package/_modules/themes/five/src/components/Header/index.js +3 -3
- package/_modules/themes/five/src/components/Header/styles.js +1 -1
- package/_modules/themes/five/src/components/HomeHero/layouts/OriginalHomeHero/index.js +1 -1
- package/_modules/themes/five/src/components/MomentControl/index.js +1 -41
- package/_modules/themes/five/src/components/OrderDetails/OrderBillSection.js +2 -2
- package/_modules/themes/five/src/components/OrderDetails/index.js +14 -16
- package/_modules/themes/five/src/components/OrderDetails/styles.js +7 -3
- package/_modules/themes/five/src/components/PaymentOptions/index.js +3 -6
- package/_modules/themes/five/src/components/PlaceSpot/styles.js +2 -2
- package/_modules/themes/five/src/components/ProductItemAccordion/index.js +7 -4
- package/_modules/themes/five/src/components/ProductOption/index.js +1 -1
- package/_modules/themes/five/src/components/ProductOptionSubOption/index.js +1 -1
- package/_modules/themes/five/src/components/ProfessionalProfile/index.js +1 -1
- package/_modules/themes/five/src/components/ServiceForm/index.js +136 -24
- package/_modules/themes/five/src/components/ServiceForm/styles.js +45 -3
- package/_modules/themes/four/src/components/LoginForm/index.js +64 -20
- package/_modules/themes/four/src/components/LoginForm/styles.js +5 -3
- package/_modules/themes/four/src/components/SignUpForm/index.js +67 -22
- package/_modules/themes/four/src/components/SignUpForm/styles.js +5 -3
- package/_modules/themes/franchise/src/components/LoginForm/index.js +61 -20
- package/_modules/themes/franchise/src/components/SignUpForm/index.js +57 -16
- package/_modules/themes/seven/src/components/LoginForm/index.js +60 -17
- package/_modules/themes/seven/src/components/SignUpForm/index.js +60 -19
- package/_modules/themes/six/src/components/LoginForm/index.js +62 -20
- package/_modules/themes/six/src/components/SignUpForm/index.js +58 -17
- package/_modules/themes/three/src/components/LoginForm/index.js +64 -20
- package/_modules/themes/three/src/components/LoginForm/styles.js +5 -3
- package/_modules/themes/three/src/components/SignUpForm/index.js +63 -18
- package/_modules/themes/three/src/components/SignUpForm/styles.js +5 -3
- package/_modules/themes/two/src/components/LoginForm/index.js +57 -17
- package/_modules/themes/two/src/components/SignUpForm/index.js +57 -17
- package/_modules/utils/index.js +56 -2
- package/package.json +2 -2
- package/src/components/BusinessInformation/index.js +8 -6
- package/src/components/LoginForm/index.js +32 -6
- package/src/components/SignUpForm/index.js +27 -2
- package/src/themes/callcenterOriginal/src/components/LoginForm/index.js +30 -2
- package/src/themes/callcenterOriginal/src/components/SignUpForm/index.js +27 -1
- package/src/themes/eight/src/components/LoginForm/index.js +30 -0
- package/src/themes/eight/src/components/SignUpForm/index.js +27 -1
- package/src/themes/five/src/components/BusinessController/index.js +2 -2
- package/src/themes/five/src/components/BusinessPreorder/index.js +6 -46
- package/src/themes/five/src/components/BusinessProductsListing/index.js +1 -1
- package/src/themes/five/src/components/Checkout/index.js +28 -3
- package/src/themes/five/src/components/Checkout/styles.js +30 -0
- package/src/themes/five/src/components/Footer/styles.js +1 -5
- package/src/themes/five/src/components/Header/index.js +7 -6
- package/src/themes/five/src/components/Header/styles.js +1 -3
- package/src/themes/five/src/components/HomeHero/layouts/OriginalHomeHero/index.js +1 -1
- package/src/themes/five/src/components/MomentControl/index.js +1 -42
- package/src/themes/five/src/components/OrderDetails/OrderBillSection.js +1 -1
- package/src/themes/five/src/components/OrderDetails/index.js +10 -8
- package/src/themes/five/src/components/OrderDetails/styles.js +21 -1
- package/src/themes/five/src/components/PaymentOptions/index.js +25 -26
- package/src/themes/five/src/components/PlaceSpot/styles.js +14 -4
- package/src/themes/five/src/components/ProductItemAccordion/index.js +7 -3
- package/src/themes/five/src/components/ProductOption/index.js +1 -1
- package/src/themes/five/src/components/ProductOptionSubOption/index.js +1 -1
- package/src/themes/five/src/components/ProfessionalProfile/index.js +1 -1
- package/src/themes/five/src/components/ServiceForm/index.js +151 -11
- package/src/themes/five/src/components/ServiceForm/styles.js +148 -0
- package/src/themes/four/src/components/LoginForm/index.js +37 -5
- package/src/themes/four/src/components/LoginForm/styles.js +4 -0
- package/src/themes/four/src/components/SignUpForm/index.js +39 -5
- package/src/themes/four/src/components/SignUpForm/styles.js +4 -0
- package/src/themes/franchise/src/components/LoginForm/index.js +26 -1
- package/src/themes/franchise/src/components/SignUpForm/index.js +27 -1
- package/src/themes/seven/src/components/LoginForm/index.js +31 -0
- package/src/themes/seven/src/components/SignUpForm/index.js +27 -1
- package/src/themes/six/src/components/LoginForm/index.js +28 -1
- package/src/themes/six/src/components/SignUpForm/index.js +27 -1
- package/src/themes/three/src/components/LoginForm/index.js +38 -6
- package/src/themes/three/src/components/LoginForm/styles.js +4 -0
- package/src/themes/three/src/components/SignUpForm/index.js +40 -4
- package/src/themes/three/src/components/SignUpForm/styles.js +4 -0
- package/src/themes/two/src/components/LoginForm/index.js +25 -1
- package/src/themes/two/src/components/SignUpForm/index.js +28 -3
- package/src/utils/index.js +53 -0
- package/template/app.js +15 -3
- package/template/config.json +1 -0
- package/template/pages/BusinessProductsList/index.js +2 -2
- package/_bundles/ordering-ui.7635bd47ae9a481b3f59.js +0 -2
|
@@ -39,6 +39,7 @@ import { sortInputFields } from '../../../../../utils'
|
|
|
39
39
|
import { FacebookLoginButton } from '../FacebookLogin'
|
|
40
40
|
import { GoogleLoginButton } from '../GoogleLogin'
|
|
41
41
|
import { AppleLogin } from '../AppleLogin'
|
|
42
|
+
import { useRecaptcha } from '../../../../../hooks/useRecaptcha'
|
|
42
43
|
|
|
43
44
|
import AiOutlineEye from '@meronex/icons/ai/AiOutlineEye'
|
|
44
45
|
import AiOutlineEyeInvisible from '@meronex/icons/ai/AiOutlineEyeInvisible'
|
|
@@ -73,6 +74,8 @@ const SignUpFormUI = (props) => {
|
|
|
73
74
|
const [alertState, setAlertState] = useState({ open: false, content: [] })
|
|
74
75
|
const [, { login }] = useSession()
|
|
75
76
|
const emailInput = useRef(null)
|
|
77
|
+
const [recaptchaConfig] = useRecaptcha(enableReCaptcha)
|
|
78
|
+
const [reCaptchaVersion, setRecaptchaVersion] = useState({ version: '', siteKey: '' })
|
|
76
79
|
|
|
77
80
|
const [userPhoneNumber, setUserPhoneNumber] = useState('')
|
|
78
81
|
const [isValidPhoneNumber, setIsValidPhoneNumber] = useState(null)
|
|
@@ -185,6 +188,22 @@ const SignUpFormUI = (props) => {
|
|
|
185
188
|
|
|
186
189
|
useEffect(() => {
|
|
187
190
|
if (!formState.loading && formState.result?.error) {
|
|
191
|
+
if (formState.result?.result?.[0] === 'ERROR_AUTH_VERIFICATION_CODE') {
|
|
192
|
+
if (configs?.security_recaptcha_site_key?.value) {
|
|
193
|
+
setRecaptchaVersion({ version: 'v2', siteKey: configs?.security_recaptcha_site_key?.value })
|
|
194
|
+
setAlertState({
|
|
195
|
+
open: true,
|
|
196
|
+
content: [t('TRY_AGAIN', 'Please try again')]
|
|
197
|
+
})
|
|
198
|
+
return
|
|
199
|
+
}
|
|
200
|
+
setAlertState({
|
|
201
|
+
open: true,
|
|
202
|
+
content: [t('CONFIG_DOESNOT_RECAPTCHA_KEY', 'the config doesn\'t have recaptcha site key')]
|
|
203
|
+
})
|
|
204
|
+
return
|
|
205
|
+
}
|
|
206
|
+
|
|
188
207
|
setAlertState({
|
|
189
208
|
open: true,
|
|
190
209
|
content: formState.result?.result || [t('ERROR', 'Error')]
|
|
@@ -240,6 +259,12 @@ const SignUpFormUI = (props) => {
|
|
|
240
259
|
}
|
|
241
260
|
}, [externalPhoneNumber])
|
|
242
261
|
|
|
262
|
+
useEffect(() => {
|
|
263
|
+
if (recaptchaConfig?.siteKey) {
|
|
264
|
+
setRecaptchaVersion({ version: recaptchaConfig?.version, siteKey: recaptchaConfig?.siteKey })
|
|
265
|
+
}
|
|
266
|
+
}, [recaptchaConfig])
|
|
267
|
+
|
|
243
268
|
return (
|
|
244
269
|
<>
|
|
245
270
|
{props.beforeElements?.map((BeforeElement, i) => (
|
|
@@ -363,7 +388,7 @@ const SignUpFormUI = (props) => {
|
|
|
363
388
|
}
|
|
364
389
|
{props.isRecaptchaEnable && enableReCaptcha && (
|
|
365
390
|
<ReCaptchaWrapper>
|
|
366
|
-
<ReCaptcha handleReCaptcha={handleReCaptcha} />
|
|
391
|
+
<ReCaptcha handleReCaptcha={handleReCaptcha} reCaptchaVersion={reCaptchaVersion} />
|
|
367
392
|
</ReCaptchaWrapper>
|
|
368
393
|
)}
|
|
369
394
|
|
|
@@ -465,6 +490,7 @@ const SignUpFormUI = (props) => {
|
|
|
465
490
|
export const SignUpForm = (props) => {
|
|
466
491
|
const loginControllerProps = {
|
|
467
492
|
...props,
|
|
493
|
+
isRecaptchaEnable: true,
|
|
468
494
|
UIComponent: SignUpFormUI
|
|
469
495
|
}
|
|
470
496
|
return <SignUpController {...loginControllerProps} />
|
|
@@ -37,6 +37,7 @@ import { FacebookLoginButton } from '../../../../../components/FacebookLogin'
|
|
|
37
37
|
import { AppleLogin } from '../../../../../components/AppleLogin'
|
|
38
38
|
import { SmsLoginButton } from '../../../../../components/SmsLogin'
|
|
39
39
|
import { useCountdownTimer } from '../../../../../hooks/useCountdownTimer'
|
|
40
|
+
import { useRecaptcha } from '../../../../../hooks/useRecaptcha'
|
|
40
41
|
import parsePhoneNumber from 'libphonenumber-js'
|
|
41
42
|
import AiOutlineEye from '@meronex/icons/ai/AiOutlineEye'
|
|
42
43
|
import AiOutlineEyeInvisible from '@meronex/icons/ai/AiOutlineEyeInvisible'
|
|
@@ -67,7 +68,9 @@ const LoginFormUI = (props) => {
|
|
|
67
68
|
const [, t] = useLanguage()
|
|
68
69
|
const [{ configs }] = useConfig()
|
|
69
70
|
const formMethods = useForm()
|
|
71
|
+
const [recaptchaConfig] = useRecaptcha(enableReCaptcha)
|
|
70
72
|
const [alertState, setAlertState] = useState({ open: false, content: [] })
|
|
73
|
+
const [reCaptchaVersion, setRecaptchaVersion] = useState({ version: '', siteKey: '' })
|
|
71
74
|
const [, { login }] = useSession()
|
|
72
75
|
const [passwordSee, setPasswordSee] = useState(false)
|
|
73
76
|
const emailInput = useRef(null)
|
|
@@ -175,6 +178,21 @@ const LoginFormUI = (props) => {
|
|
|
175
178
|
|
|
176
179
|
useEffect(() => {
|
|
177
180
|
if (!formState.loading && formState.result?.error) {
|
|
181
|
+
if (formState.result?.result?.[0] === 'ERROR_AUTH_VERIFICATION_CODE') {
|
|
182
|
+
if (configs?.security_recaptcha_site_key?.value) {
|
|
183
|
+
setRecaptchaVersion({ version: 'v2', siteKey: configs?.security_recaptcha_site_key?.value })
|
|
184
|
+
setAlertState({
|
|
185
|
+
open: true,
|
|
186
|
+
content: [t('TRY_AGAIN', 'Please try again')]
|
|
187
|
+
})
|
|
188
|
+
return
|
|
189
|
+
}
|
|
190
|
+
setAlertState({
|
|
191
|
+
open: true,
|
|
192
|
+
content: [t('CONFIG_DOESNOT_RECAPTCHA_KEY', 'the config doesn\'t have recaptcha site key')]
|
|
193
|
+
})
|
|
194
|
+
return
|
|
195
|
+
}
|
|
178
196
|
setAlertState({
|
|
179
197
|
open: true,
|
|
180
198
|
content: formState.result?.result || [t('ERROR', 'Error')]
|
|
@@ -242,6 +260,12 @@ const LoginFormUI = (props) => {
|
|
|
242
260
|
} else { resetOtpLeftTime() }
|
|
243
261
|
}, [verifyPhoneState])
|
|
244
262
|
|
|
263
|
+
useEffect(() => {
|
|
264
|
+
if (recaptchaConfig?.siteKey) {
|
|
265
|
+
setRecaptchaVersion({ version: recaptchaConfig?.version, siteKey: recaptchaConfig?.siteKey })
|
|
266
|
+
}
|
|
267
|
+
}, [recaptchaConfig])
|
|
268
|
+
|
|
245
269
|
return (
|
|
246
270
|
<>
|
|
247
271
|
{props.beforeElements?.map((BeforeElement, i) => (
|
|
@@ -344,6 +368,12 @@ const LoginFormUI = (props) => {
|
|
|
344
368
|
</FormInline>
|
|
345
369
|
)}
|
|
346
370
|
|
|
371
|
+
{props.isRecaptchaEnable && enableReCaptcha && (
|
|
372
|
+
<ReCaptchaWrapper>
|
|
373
|
+
<ReCaptcha handleReCaptcha={handleReCaptcha} reCaptchaVersion={reCaptchaVersion} />
|
|
374
|
+
</ReCaptchaWrapper>
|
|
375
|
+
)}
|
|
376
|
+
|
|
347
377
|
<FormInline>
|
|
348
378
|
{(!willVerifyOtpState &&
|
|
349
379
|
<Button
|
|
@@ -486,6 +516,7 @@ const LoginFormUI = (props) => {
|
|
|
486
516
|
export const LoginForm = (props) => {
|
|
487
517
|
const loginControllerProps = {
|
|
488
518
|
...props,
|
|
519
|
+
isRecaptchaEnable: true,
|
|
489
520
|
UIComponent: LoginFormUI
|
|
490
521
|
}
|
|
491
522
|
return <LoginFormController {...loginControllerProps} />
|
|
@@ -41,6 +41,7 @@ import { AppleLogin } from '../../../../../components/AppleLogin'
|
|
|
41
41
|
import AiOutlineEye from '@meronex/icons/ai/AiOutlineEye'
|
|
42
42
|
import AiOutlineEyeInvisible from '@meronex/icons/ai/AiOutlineEyeInvisible'
|
|
43
43
|
import { sortInputFields } from '../../../../../utils'
|
|
44
|
+
import { useRecaptcha } from '../../../../../hooks/useRecaptcha'
|
|
44
45
|
|
|
45
46
|
const notValidationFields = ['coupon', 'driver_tip', 'mobile_phone', 'address', 'address_notes']
|
|
46
47
|
const SignUpFormUI = (props) => {
|
|
@@ -66,6 +67,8 @@ const SignUpFormUI = (props) => {
|
|
|
66
67
|
const [{ configs }] = useConfig()
|
|
67
68
|
const formMethods = useForm()
|
|
68
69
|
const [alertState, setAlertState] = useState({ open: false, content: [] })
|
|
70
|
+
const [recaptchaConfig] = useRecaptcha(enableReCaptcha)
|
|
71
|
+
const [reCaptchaVersion, setRecaptchaVersion] = useState({ version: '', siteKey: '' })
|
|
69
72
|
const [, { login }] = useSession()
|
|
70
73
|
const emailInput = useRef(null)
|
|
71
74
|
const [userPhoneNumber, setUserPhoneNumber] = useState('')
|
|
@@ -183,6 +186,22 @@ const SignUpFormUI = (props) => {
|
|
|
183
186
|
|
|
184
187
|
useEffect(() => {
|
|
185
188
|
if (!formState.loading && formState.result?.error) {
|
|
189
|
+
if (formState.result?.result?.[0] === 'ERROR_AUTH_VERIFICATION_CODE') {
|
|
190
|
+
if (configs?.security_recaptcha_site_key?.value) {
|
|
191
|
+
setRecaptchaVersion({ version: 'v2', siteKey: configs?.security_recaptcha_site_key?.value })
|
|
192
|
+
setAlertState({
|
|
193
|
+
open: true,
|
|
194
|
+
content: [t('TRY_AGAIN', 'Please try again')]
|
|
195
|
+
})
|
|
196
|
+
return
|
|
197
|
+
}
|
|
198
|
+
setAlertState({
|
|
199
|
+
open: true,
|
|
200
|
+
content: [t('CONFIG_DOESNOT_RECAPTCHA_KEY', 'the config doesn\'t have recaptcha site key')]
|
|
201
|
+
})
|
|
202
|
+
return
|
|
203
|
+
}
|
|
204
|
+
|
|
186
205
|
setAlertState({
|
|
187
206
|
open: true,
|
|
188
207
|
content: formState.result?.result || [t('ERROR', 'Error')]
|
|
@@ -238,6 +257,12 @@ const SignUpFormUI = (props) => {
|
|
|
238
257
|
}
|
|
239
258
|
}, [externalPhoneNumber])
|
|
240
259
|
|
|
260
|
+
useEffect(() => {
|
|
261
|
+
if (recaptchaConfig?.siteKey) {
|
|
262
|
+
setRecaptchaVersion({ version: recaptchaConfig?.version, siteKey: recaptchaConfig?.siteKey })
|
|
263
|
+
}
|
|
264
|
+
}, [recaptchaConfig])
|
|
265
|
+
|
|
241
266
|
return (
|
|
242
267
|
<>
|
|
243
268
|
{props.beforeElements?.map((BeforeElement, i) => (
|
|
@@ -389,7 +414,7 @@ const SignUpFormUI = (props) => {
|
|
|
389
414
|
{props.isRecaptchaEnable && enableReCaptcha && (
|
|
390
415
|
<FormInline>
|
|
391
416
|
<ReCaptchaWrapper>
|
|
392
|
-
<ReCaptcha handleReCaptcha={handleReCaptcha} />
|
|
417
|
+
<ReCaptcha handleReCaptcha={handleReCaptcha} reCaptchaVersion={reCaptchaVersion} />
|
|
393
418
|
</ReCaptchaWrapper>
|
|
394
419
|
</FormInline>
|
|
395
420
|
)}
|
|
@@ -494,6 +519,7 @@ const SignUpFormUI = (props) => {
|
|
|
494
519
|
export const SignUpForm = (props) => {
|
|
495
520
|
const loginControllerProps = {
|
|
496
521
|
...props,
|
|
522
|
+
isRecaptchaEnable: true,
|
|
497
523
|
UIComponent: SignUpFormUI
|
|
498
524
|
}
|
|
499
525
|
return <SignUpController {...loginControllerProps} />
|
|
@@ -32,6 +32,7 @@ import { GoogleLoginButton } from '../../../../../components/GoogleLogin'
|
|
|
32
32
|
import { Input } from '../../styles/Inputs'
|
|
33
33
|
import { Button } from '../../../../../styles/Buttons'
|
|
34
34
|
import { useCountdownTimer } from '../../../../../hooks/useCountdownTimer'
|
|
35
|
+
import { useRecaptcha } from '../../../../../hooks/useRecaptcha'
|
|
35
36
|
import { formatSeconds } from '../../../../../utils'
|
|
36
37
|
import { useTheme } from 'styled-components'
|
|
37
38
|
import parsePhoneNumber from 'libphonenumber-js'
|
|
@@ -65,6 +66,8 @@ const LoginFormUI = (props) => {
|
|
|
65
66
|
const [, t] = useLanguage()
|
|
66
67
|
const [{ configs }] = useConfig()
|
|
67
68
|
const formMethods = useForm()
|
|
69
|
+
const [recaptchaConfig] = useRecaptcha(enableReCaptcha)
|
|
70
|
+
const [reCaptchaVersion, setRecaptchaVersion] = useState({ version: '', siteKey: '' })
|
|
68
71
|
const [alertState, setAlertState] = useState({ open: false, content: [] })
|
|
69
72
|
const [, { login }] = useSession()
|
|
70
73
|
const theme = useTheme()
|
|
@@ -156,10 +159,26 @@ const LoginFormUI = (props) => {
|
|
|
156
159
|
}
|
|
157
160
|
useEffect(() => {
|
|
158
161
|
if (!formState.loading && formState.result?.error) {
|
|
162
|
+
if (formState.result?.result?.[0] === 'ERROR_AUTH_VERIFICATION_CODE') {
|
|
163
|
+
if (configs?.security_recaptcha_site_key?.value) {
|
|
164
|
+
setRecaptchaVersion({ version: 'v2', siteKey: configs?.security_recaptcha_site_key?.value })
|
|
165
|
+
setAlertState({
|
|
166
|
+
open: true,
|
|
167
|
+
content: [t('TRY_AGAIN', 'Please try again')]
|
|
168
|
+
})
|
|
169
|
+
return
|
|
170
|
+
}
|
|
171
|
+
setAlertState({
|
|
172
|
+
open: true,
|
|
173
|
+
content: [t('CONFIG_DOESNOT_RECAPTCHA_KEY', 'the config doesn\'t have recaptcha site key')]
|
|
174
|
+
})
|
|
175
|
+
return
|
|
176
|
+
}
|
|
159
177
|
setAlertState({
|
|
160
178
|
open: true,
|
|
161
179
|
content: formState.result?.result || [t('ERROR', 'Error')]
|
|
162
180
|
})
|
|
181
|
+
// setSubmitted(false)
|
|
163
182
|
}
|
|
164
183
|
}, [formState])
|
|
165
184
|
useEffect(() => {
|
|
@@ -219,6 +238,13 @@ const LoginFormUI = (props) => {
|
|
|
219
238
|
resetOtpLeftTime()
|
|
220
239
|
}
|
|
221
240
|
}, [verifyPhoneState])
|
|
241
|
+
|
|
242
|
+
useEffect(() => {
|
|
243
|
+
if (recaptchaConfig?.siteKey) {
|
|
244
|
+
setRecaptchaVersion({ version: recaptchaConfig?.version, siteKey: recaptchaConfig?.siteKey })
|
|
245
|
+
}
|
|
246
|
+
}, [recaptchaConfig])
|
|
247
|
+
|
|
222
248
|
return (
|
|
223
249
|
<>
|
|
224
250
|
{props.beforeElements?.map((BeforeElement, i) => (
|
|
@@ -350,7 +376,7 @@ const LoginFormUI = (props) => {
|
|
|
350
376
|
)}
|
|
351
377
|
{props.isRecaptchaEnable && enableReCaptcha && (
|
|
352
378
|
<ReCaptchaWrapper>
|
|
353
|
-
<ReCaptcha handleReCaptcha={handleReCaptcha} />
|
|
379
|
+
<ReCaptcha handleReCaptcha={handleReCaptcha} reCaptchaVersion={reCaptchaVersion} />
|
|
354
380
|
</ReCaptchaWrapper>
|
|
355
381
|
)}
|
|
356
382
|
{(!willVerifyOtpState &&
|
|
@@ -451,6 +477,7 @@ const LoginFormUI = (props) => {
|
|
|
451
477
|
export const LoginForm = (props) => {
|
|
452
478
|
const loginControllerProps = {
|
|
453
479
|
...props,
|
|
480
|
+
isRecaptchaEnable: true,
|
|
454
481
|
UIComponent: LoginFormUI
|
|
455
482
|
}
|
|
456
483
|
return <LoginFormController {...loginControllerProps} />
|
|
@@ -4,6 +4,7 @@ import Skeleton from 'react-loading-skeleton'
|
|
|
4
4
|
import { Alert } from '../../../../../components/Confirm'
|
|
5
5
|
import { InputPhoneNumber } from '../../../../../components/InputPhoneNumber'
|
|
6
6
|
import parsePhoneNumber from 'libphonenumber-js'
|
|
7
|
+
import { useRecaptcha } from '../../../../../hooks/useRecaptcha'
|
|
7
8
|
|
|
8
9
|
import {
|
|
9
10
|
SignupForm as SignUpController,
|
|
@@ -64,6 +65,8 @@ const SignUpFormUI = (props) => {
|
|
|
64
65
|
const [{ configs }] = useConfig()
|
|
65
66
|
const formMethods = useForm()
|
|
66
67
|
const [alertState, setAlertState] = useState({ open: false, content: [] })
|
|
68
|
+
const [recaptchaConfig] = useRecaptcha(enableReCaptcha)
|
|
69
|
+
const [reCaptchaVersion, setRecaptchaVersion] = useState({ version: '', siteKey: '' })
|
|
67
70
|
const [, { login }] = useSession()
|
|
68
71
|
const theme = useTheme()
|
|
69
72
|
const emailInput = useRef(null)
|
|
@@ -180,6 +183,22 @@ const SignUpFormUI = (props) => {
|
|
|
180
183
|
|
|
181
184
|
useEffect(() => {
|
|
182
185
|
if (!formState.loading && formState.result?.error) {
|
|
186
|
+
if (formState.result?.result?.[0] === 'ERROR_AUTH_VERIFICATION_CODE') {
|
|
187
|
+
if (configs?.security_recaptcha_site_key?.value) {
|
|
188
|
+
setRecaptchaVersion({ version: 'v2', siteKey: configs?.security_recaptcha_site_key?.value })
|
|
189
|
+
setAlertState({
|
|
190
|
+
open: true,
|
|
191
|
+
content: [t('TRY_AGAIN', 'Please try again')]
|
|
192
|
+
})
|
|
193
|
+
return
|
|
194
|
+
}
|
|
195
|
+
setAlertState({
|
|
196
|
+
open: true,
|
|
197
|
+
content: [t('CONFIG_DOESNOT_RECAPTCHA_KEY', 'the config doesn\'t have recaptcha site key')]
|
|
198
|
+
})
|
|
199
|
+
return
|
|
200
|
+
}
|
|
201
|
+
|
|
183
202
|
setAlertState({
|
|
184
203
|
open: true,
|
|
185
204
|
content: formState.result?.result || [t('ERROR', 'Error')]
|
|
@@ -198,6 +217,12 @@ const SignUpFormUI = (props) => {
|
|
|
198
217
|
}
|
|
199
218
|
}, [formMethods.errors])
|
|
200
219
|
|
|
220
|
+
useEffect(() => {
|
|
221
|
+
if (recaptchaConfig?.siteKey) {
|
|
222
|
+
setRecaptchaVersion({ version: recaptchaConfig?.version, siteKey: recaptchaConfig?.siteKey })
|
|
223
|
+
}
|
|
224
|
+
}, [recaptchaConfig])
|
|
225
|
+
|
|
201
226
|
useEffect(() => {
|
|
202
227
|
if (!validationFields.loading) {
|
|
203
228
|
Object.values(validationFields?.fields?.checkout).map(field => !notValidationFields.includes(field.code) && (
|
|
@@ -345,7 +370,7 @@ const SignUpFormUI = (props) => {
|
|
|
345
370
|
}
|
|
346
371
|
{props.isRecaptchaEnable && enableReCaptcha && (
|
|
347
372
|
<ReCaptchaWrapper>
|
|
348
|
-
<ReCaptcha handleReCaptcha={handleReCaptcha} />
|
|
373
|
+
<ReCaptcha handleReCaptcha={handleReCaptcha} reCaptchaVersion={reCaptchaVersion} />
|
|
349
374
|
</ReCaptchaWrapper>
|
|
350
375
|
)}
|
|
351
376
|
{elementLinkToLogin && (
|
|
@@ -442,6 +467,7 @@ const SignUpFormUI = (props) => {
|
|
|
442
467
|
export const SignUpForm = (props) => {
|
|
443
468
|
const loginControllerProps = {
|
|
444
469
|
...props,
|
|
470
|
+
isRecaptchaEnable: true,
|
|
445
471
|
UIComponent: SignUpFormUI
|
|
446
472
|
}
|
|
447
473
|
return <SignUpController {...loginControllerProps} />
|
|
@@ -5,7 +5,8 @@ import {
|
|
|
5
5
|
LoginForm as LoginFormController,
|
|
6
6
|
useLanguage,
|
|
7
7
|
useConfig,
|
|
8
|
-
useSession
|
|
8
|
+
useSession,
|
|
9
|
+
ReCaptcha
|
|
9
10
|
} from 'ordering-components-external'
|
|
10
11
|
import { Alert } from '../Confirm'
|
|
11
12
|
import { SpinnerLoader } from '../../../../../components/SpinnerLoader'
|
|
@@ -22,7 +23,8 @@ import {
|
|
|
22
23
|
WrapperPassword,
|
|
23
24
|
TogglePassword,
|
|
24
25
|
OtpWrapper,
|
|
25
|
-
CountdownTimer
|
|
26
|
+
CountdownTimer,
|
|
27
|
+
ReCaptchaWrapper
|
|
26
28
|
} from './styles'
|
|
27
29
|
|
|
28
30
|
import { Tabs, Tab } from '../../styles/Tabs'
|
|
@@ -33,6 +35,7 @@ import { FacebookLoginButton } from '../../../../../components/FacebookLogin'
|
|
|
33
35
|
import { AppleLogin } from '../../../../../components/AppleLogin'
|
|
34
36
|
import { SmsLoginButton } from '../../../../../components/SmsLogin'
|
|
35
37
|
import { useCountdownTimer } from '../../../../../hooks/useCountdownTimer'
|
|
38
|
+
import { useRecaptcha } from '../../../../../hooks/useRecaptcha'
|
|
36
39
|
import { formatSeconds } from '../../../../../utils'
|
|
37
40
|
import { useTheme } from 'styled-components'
|
|
38
41
|
import parsePhoneNumber from 'libphonenumber-js'
|
|
@@ -45,6 +48,7 @@ const LoginFormUI = (props) => {
|
|
|
45
48
|
useLoginByEmail,
|
|
46
49
|
useLoginByCellphone,
|
|
47
50
|
handleChangeInput,
|
|
51
|
+
handleReCaptcha,
|
|
48
52
|
handleChangeTab,
|
|
49
53
|
handleButtonLoginClick,
|
|
50
54
|
handleSendVerifyCode,
|
|
@@ -56,13 +60,16 @@ const LoginFormUI = (props) => {
|
|
|
56
60
|
checkPhoneCodeState,
|
|
57
61
|
loginTab,
|
|
58
62
|
isPopup,
|
|
59
|
-
credentials
|
|
63
|
+
credentials,
|
|
64
|
+
enableReCaptcha
|
|
60
65
|
} = props
|
|
61
66
|
const numOtpInputs = 4
|
|
62
67
|
const [, t] = useLanguage()
|
|
63
68
|
const [{ configs }] = useConfig()
|
|
64
69
|
const formMethods = useForm()
|
|
70
|
+
const [recaptchaConfig] = useRecaptcha(enableReCaptcha)
|
|
65
71
|
const [alertState, setAlertState] = useState({ open: false, content: [] })
|
|
72
|
+
const [reCaptchaVersion, setRecaptchaVersion] = useState({ version: '', siteKey: '' })
|
|
66
73
|
const [, { login }] = useSession()
|
|
67
74
|
const theme = useTheme()
|
|
68
75
|
const [passwordSee, setPasswordSee] = useState(false)
|
|
@@ -164,12 +171,25 @@ const LoginFormUI = (props) => {
|
|
|
164
171
|
|
|
165
172
|
useEffect(() => {
|
|
166
173
|
if (!formState.loading && formState.result?.error) {
|
|
174
|
+
if (formState.result?.result?.[0] === 'ERROR_AUTH_VERIFICATION_CODE') {
|
|
175
|
+
if (configs?.security_recaptcha_site_key?.value) {
|
|
176
|
+
setRecaptchaVersion({ version: 'v2', siteKey: configs?.security_recaptcha_site_key?.value })
|
|
177
|
+
setAlertState({
|
|
178
|
+
open: true,
|
|
179
|
+
content: [t('TRY_AGAIN', 'Please try again')]
|
|
180
|
+
})
|
|
181
|
+
return
|
|
182
|
+
}
|
|
183
|
+
setAlertState({
|
|
184
|
+
open: true,
|
|
185
|
+
content: [t('CONFIG_DOESNOT_RECAPTCHA_KEY', 'the config doesn\'t have recaptcha site key')]
|
|
186
|
+
})
|
|
187
|
+
return
|
|
188
|
+
}
|
|
167
189
|
setAlertState({
|
|
168
190
|
open: true,
|
|
169
191
|
content: formState.result?.result || [t('ERROR', 'Error')]
|
|
170
192
|
})
|
|
171
|
-
|
|
172
|
-
return
|
|
173
193
|
}
|
|
174
194
|
}, [formState])
|
|
175
195
|
|
|
@@ -240,6 +260,12 @@ const LoginFormUI = (props) => {
|
|
|
240
260
|
|
|
241
261
|
}, [verifyPhoneState])
|
|
242
262
|
|
|
263
|
+
useEffect(() => {
|
|
264
|
+
if (recaptchaConfig?.siteKey) {
|
|
265
|
+
setRecaptchaVersion({ version: recaptchaConfig?.version, siteKey: recaptchaConfig?.siteKey })
|
|
266
|
+
}
|
|
267
|
+
}, [recaptchaConfig])
|
|
268
|
+
|
|
243
269
|
return (
|
|
244
270
|
<>
|
|
245
271
|
{props.beforeElements?.map((BeforeElement, i) => (
|
|
@@ -385,6 +411,11 @@ const LoginFormUI = (props) => {
|
|
|
385
411
|
{elementLinkToForgotPassword}
|
|
386
412
|
</RedirectLink>
|
|
387
413
|
)}
|
|
414
|
+
{props.isRecaptchaEnable && enableReCaptcha && (
|
|
415
|
+
<ReCaptchaWrapper>
|
|
416
|
+
<ReCaptcha handleReCaptcha={handleReCaptcha} reCaptchaVersion={reCaptchaVersion} />
|
|
417
|
+
</ReCaptchaWrapper>
|
|
418
|
+
)}
|
|
388
419
|
{(!willVerifyOtpState &&
|
|
389
420
|
<Button
|
|
390
421
|
color='secundary'
|
|
@@ -485,7 +516,8 @@ const LoginFormUI = (props) => {
|
|
|
485
516
|
export const LoginForm = (props) => {
|
|
486
517
|
const loginControllerProps = {
|
|
487
518
|
...props,
|
|
488
|
-
UIComponent: LoginFormUI
|
|
519
|
+
UIComponent: LoginFormUI,
|
|
520
|
+
isRecaptchaEnable: true
|
|
489
521
|
}
|
|
490
522
|
return <LoginFormController {...loginControllerProps} />
|
|
491
523
|
}
|
|
@@ -9,7 +9,8 @@ import {
|
|
|
9
9
|
SignupForm as SignUpController,
|
|
10
10
|
useLanguage,
|
|
11
11
|
useConfig,
|
|
12
|
-
useSession
|
|
12
|
+
useSession,
|
|
13
|
+
ReCaptcha
|
|
13
14
|
} from 'ordering-components-external'
|
|
14
15
|
import {
|
|
15
16
|
SignUpContainer,
|
|
@@ -21,7 +22,8 @@ import {
|
|
|
21
22
|
SkeletonSocialWrapper,
|
|
22
23
|
WrapperPassword,
|
|
23
24
|
TogglePassword,
|
|
24
|
-
TermsConditionWrapper
|
|
25
|
+
TermsConditionWrapper,
|
|
26
|
+
ReCaptchaWrapper
|
|
25
27
|
} from './styles'
|
|
26
28
|
|
|
27
29
|
import { Input } from '../../styles/Inputs'
|
|
@@ -35,6 +37,7 @@ import { useTheme } from 'styled-components'
|
|
|
35
37
|
import AiOutlineEye from '@meronex/icons/ai/AiOutlineEye'
|
|
36
38
|
import AiOutlineEyeInvisible from '@meronex/icons/ai/AiOutlineEyeInvisible'
|
|
37
39
|
import { sortInputFields } from '../../../../../utils'
|
|
40
|
+
import { useRecaptcha } from '../../../../../hooks/useRecaptcha'
|
|
38
41
|
|
|
39
42
|
const notValidationFields = ['coupon', 'driver_tip', 'mobile_phone', 'address', 'address_notes']
|
|
40
43
|
|
|
@@ -53,12 +56,16 @@ const SignUpFormUI = (props) => {
|
|
|
53
56
|
externalPhoneNumber,
|
|
54
57
|
saveCustomerUser,
|
|
55
58
|
fieldsNotValid,
|
|
56
|
-
signupData
|
|
59
|
+
signupData,
|
|
60
|
+
enableReCaptcha,
|
|
61
|
+
handleReCaptcha
|
|
57
62
|
} = props
|
|
58
63
|
const [, t] = useLanguage()
|
|
59
64
|
const [{ configs }] = useConfig()
|
|
60
65
|
const formMethods = useForm()
|
|
61
66
|
const [alertState, setAlertState] = useState({ open: false, content: [] })
|
|
67
|
+
const [recaptchaConfig] = useRecaptcha(enableReCaptcha)
|
|
68
|
+
const [reCaptchaVersion, setRecaptchaVersion] = useState({ version: '', siteKey: '' })
|
|
62
69
|
const [, { login }] = useSession()
|
|
63
70
|
const theme = useTheme()
|
|
64
71
|
const emailInput = useRef(null)
|
|
@@ -162,6 +169,22 @@ const SignUpFormUI = (props) => {
|
|
|
162
169
|
|
|
163
170
|
useEffect(() => {
|
|
164
171
|
if (!formState.loading && formState.result?.error) {
|
|
172
|
+
if (formState.result?.result?.[0] === 'ERROR_AUTH_VERIFICATION_CODE') {
|
|
173
|
+
if (configs?.security_recaptcha_site_key?.value) {
|
|
174
|
+
setRecaptchaVersion({ version: 'v2', siteKey: configs?.security_recaptcha_site_key?.value })
|
|
175
|
+
setAlertState({
|
|
176
|
+
open: true,
|
|
177
|
+
content: [t('TRY_AGAIN', 'Please try again')]
|
|
178
|
+
})
|
|
179
|
+
return
|
|
180
|
+
}
|
|
181
|
+
setAlertState({
|
|
182
|
+
open: true,
|
|
183
|
+
content: [t('CONFIG_DOESNOT_RECAPTCHA_KEY', 'the config doesn\'t have recaptcha site key')]
|
|
184
|
+
})
|
|
185
|
+
return
|
|
186
|
+
}
|
|
187
|
+
|
|
165
188
|
setAlertState({
|
|
166
189
|
open: true,
|
|
167
190
|
content: formState.result?.result || [t('ERROR', 'Error')]
|
|
@@ -217,6 +240,12 @@ const SignUpFormUI = (props) => {
|
|
|
217
240
|
}
|
|
218
241
|
}, [externalPhoneNumber])
|
|
219
242
|
|
|
243
|
+
useEffect(() => {
|
|
244
|
+
if (recaptchaConfig?.siteKey) {
|
|
245
|
+
setRecaptchaVersion({ version: recaptchaConfig?.version, siteKey: recaptchaConfig?.siteKey })
|
|
246
|
+
}
|
|
247
|
+
}, [recaptchaConfig])
|
|
248
|
+
|
|
220
249
|
return (
|
|
221
250
|
<>
|
|
222
251
|
{props.beforeElements?.map((BeforeElement, i) => (
|
|
@@ -326,6 +355,12 @@ const SignUpFormUI = (props) => {
|
|
|
326
355
|
)
|
|
327
356
|
}
|
|
328
357
|
|
|
358
|
+
{props.isRecaptchaEnable && enableReCaptcha && (
|
|
359
|
+
<ReCaptchaWrapper>
|
|
360
|
+
<ReCaptcha handleReCaptcha={handleReCaptcha} reCaptchaVersion={reCaptchaVersion} />
|
|
361
|
+
</ReCaptchaWrapper>
|
|
362
|
+
)}
|
|
363
|
+
|
|
329
364
|
{configs?.terms_and_conditions?.value === 'true' && (
|
|
330
365
|
<TermsConditionWrapper>
|
|
331
366
|
<Checkbox
|
|
@@ -414,7 +449,8 @@ const SignUpFormUI = (props) => {
|
|
|
414
449
|
export const SignUpForm = (props) => {
|
|
415
450
|
const loginControllerProps = {
|
|
416
451
|
...props,
|
|
417
|
-
UIComponent: SignUpFormUI
|
|
452
|
+
UIComponent: SignUpFormUI,
|
|
453
|
+
isRecaptchaEnable: true
|
|
418
454
|
}
|
|
419
455
|
return <SignUpController {...loginControllerProps} />
|
|
420
456
|
}
|
|
@@ -34,6 +34,7 @@ import { FacebookLoginButton } from '../FacebookLogin'
|
|
|
34
34
|
import { AppleLogin } from '../AppleLogin'
|
|
35
35
|
import { SmsLoginButton } from '../../../../../components/SmsLogin'
|
|
36
36
|
import { useCountdownTimer } from '../../../../../hooks/useCountdownTimer'
|
|
37
|
+
import { useRecaptcha } from '../../../../../hooks/useRecaptcha'
|
|
37
38
|
import { formatSeconds } from '../../../../../utils'
|
|
38
39
|
import parsePhoneNumber from 'libphonenumber-js'
|
|
39
40
|
import OtpInput from 'react-otp-input'
|
|
@@ -66,7 +67,9 @@ const LoginFormUI = (props) => {
|
|
|
66
67
|
const [, t] = useLanguage()
|
|
67
68
|
const [{ configs }] = useConfig()
|
|
68
69
|
const formMethods = useForm()
|
|
70
|
+
const [recaptchaConfig] = useRecaptcha(enableReCaptcha)
|
|
69
71
|
const [alertState, setAlertState] = useState({ open: false, content: [] })
|
|
72
|
+
const [reCaptchaVersion, setRecaptchaVersion] = useState({ version: '', siteKey: '' })
|
|
70
73
|
const [, { login }] = useSession()
|
|
71
74
|
const [passwordSee, setPasswordSee] = useState(false)
|
|
72
75
|
const emailInput = useRef(null)
|
|
@@ -162,6 +165,21 @@ const LoginFormUI = (props) => {
|
|
|
162
165
|
|
|
163
166
|
useEffect(() => {
|
|
164
167
|
if (!formState.loading && formState.result?.error) {
|
|
168
|
+
if (formState.result?.result?.[0] === 'ERROR_AUTH_VERIFICATION_CODE') {
|
|
169
|
+
if (configs?.security_recaptcha_site_key?.value) {
|
|
170
|
+
setRecaptchaVersion({ version: 'v2', siteKey: configs?.security_recaptcha_site_key?.value })
|
|
171
|
+
setAlertState({
|
|
172
|
+
open: true,
|
|
173
|
+
content: [t('TRY_AGAIN', 'Please try again')]
|
|
174
|
+
})
|
|
175
|
+
return
|
|
176
|
+
}
|
|
177
|
+
setAlertState({
|
|
178
|
+
open: true,
|
|
179
|
+
content: [t('CONFIG_DOESNOT_RECAPTCHA_KEY', 'the config doesn\'t have recaptcha site key')]
|
|
180
|
+
})
|
|
181
|
+
return
|
|
182
|
+
}
|
|
165
183
|
setAlertState({
|
|
166
184
|
open: true,
|
|
167
185
|
content: formState.result?.result || [t('ERROR', 'Error')]
|
|
@@ -236,6 +254,12 @@ const LoginFormUI = (props) => {
|
|
|
236
254
|
|
|
237
255
|
}, [verifyPhoneState])
|
|
238
256
|
|
|
257
|
+
useEffect(() => {
|
|
258
|
+
if (recaptchaConfig?.siteKey) {
|
|
259
|
+
setRecaptchaVersion({ version: recaptchaConfig?.version, siteKey: recaptchaConfig?.siteKey })
|
|
260
|
+
}
|
|
261
|
+
}, [recaptchaConfig])
|
|
262
|
+
|
|
239
263
|
return (
|
|
240
264
|
<>
|
|
241
265
|
{props.beforeElements?.map((BeforeElement, i) => (
|
|
@@ -429,7 +453,7 @@ const LoginFormUI = (props) => {
|
|
|
429
453
|
)}
|
|
430
454
|
{props.isRecaptchaEnable && enableReCaptcha && (
|
|
431
455
|
<ReCaptchaWrapper>
|
|
432
|
-
<ReCaptcha handleReCaptcha={handleReCaptcha} />
|
|
456
|
+
<ReCaptcha handleReCaptcha={handleReCaptcha} reCaptchaVersion={reCaptchaVersion} />
|
|
433
457
|
</ReCaptchaWrapper>
|
|
434
458
|
)}
|
|
435
459
|
{(!willVerifyOtpState &&
|