ordering-ui-external 1.4.5 → 1.5.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.
Files changed (151) hide show
  1. package/_bundles/{0.ordering-ui.9c913f613f7ccfd32dd9.js → 0.ordering-ui.b1e32f04828ea3f944e1.js} +1 -1
  2. package/_bundles/{1.ordering-ui.9c913f613f7ccfd32dd9.js → 1.ordering-ui.b1e32f04828ea3f944e1.js} +1 -1
  3. package/_bundles/{2.ordering-ui.9c913f613f7ccfd32dd9.js → 2.ordering-ui.b1e32f04828ea3f944e1.js} +1 -1
  4. package/_bundles/{4.ordering-ui.9c913f613f7ccfd32dd9.js → 4.ordering-ui.b1e32f04828ea3f944e1.js} +1 -1
  5. package/_bundles/{5.ordering-ui.9c913f613f7ccfd32dd9.js → 5.ordering-ui.b1e32f04828ea3f944e1.js} +1 -1
  6. package/_bundles/{6.ordering-ui.9c913f613f7ccfd32dd9.js → 6.ordering-ui.b1e32f04828ea3f944e1.js} +1 -1
  7. package/_bundles/{7.ordering-ui.9c913f613f7ccfd32dd9.js → 7.ordering-ui.b1e32f04828ea3f944e1.js} +2 -2
  8. package/_bundles/{7.ordering-ui.9c913f613f7ccfd32dd9.js.LICENSE.txt → 7.ordering-ui.b1e32f04828ea3f944e1.js.LICENSE.txt} +0 -0
  9. package/_bundles/{8.ordering-ui.9c913f613f7ccfd32dd9.js → 8.ordering-ui.b1e32f04828ea3f944e1.js} +1 -1
  10. package/_bundles/{9.ordering-ui.9c913f613f7ccfd32dd9.js → 9.ordering-ui.b1e32f04828ea3f944e1.js} +1 -1
  11. package/_bundles/{ordering-ui.9c913f613f7ccfd32dd9.js → ordering-ui.b1e32f04828ea3f944e1.js} +2 -2
  12. package/_bundles/{ordering-ui.9c913f613f7ccfd32dd9.js.LICENSE.txt → ordering-ui.b1e32f04828ea3f944e1.js.LICENSE.txt} +0 -0
  13. package/_modules/components/LogoutButton/index.js +9 -4
  14. package/_modules/components/PaymentOptions/index.js +14 -7
  15. package/_modules/components/SpinnerLoader/styles.js +1 -1
  16. package/_modules/components/UserProfileForm/index.js +15 -2
  17. package/_modules/components/UserProfileForm/styles.js +1 -1
  18. package/_modules/hooks/useRecaptcha.js +62 -0
  19. package/_modules/themes/five/src/components/AddressForm/styles.js +3 -3
  20. package/_modules/themes/five/src/components/AddressList/index.js +1 -1
  21. package/_modules/themes/five/src/components/AddressList/styles.js +1 -1
  22. package/_modules/themes/five/src/components/BusinessBasicInformation/index.js +5 -5
  23. package/_modules/themes/five/src/components/BusinessBasicInformation/styles.js +12 -10
  24. package/_modules/themes/five/src/components/BusinessController/index.js +6 -4
  25. package/_modules/themes/five/src/components/BusinessController/styles.js +10 -4
  26. package/_modules/themes/five/src/components/BusinessListingSearch/index.js +21 -6
  27. package/_modules/themes/five/src/components/BusinessProductsCategories/index.js +6 -17
  28. package/_modules/themes/five/src/components/BusinessProductsCategories/styles.js +3 -4
  29. package/_modules/themes/five/src/components/BusinessProductsListing/index.js +11 -3
  30. package/_modules/themes/five/src/components/BusinessProductsListing/styles.js +2 -2
  31. package/_modules/themes/five/src/components/BusinessReviews/index.js +16 -8
  32. package/_modules/themes/five/src/components/BusinessReviews/styles.js +6 -4
  33. package/_modules/themes/five/src/components/BusinessesListing/layouts/OriginalBusinessesListing/index.js +58 -34
  34. package/_modules/themes/five/src/components/BusinessesListing/layouts/OriginalBusinessesListing/styles.js +40 -23
  35. package/_modules/themes/five/src/components/DriverTips/styles.js +1 -1
  36. package/_modules/themes/five/src/components/Footer/index.js +2 -1
  37. package/_modules/themes/five/src/components/Footer/styles.js +1 -1
  38. package/_modules/themes/five/src/components/Header/index.js +18 -11
  39. package/_modules/themes/five/src/components/Header/styles.js +7 -7
  40. package/_modules/themes/five/src/components/HomeHero/index.js +0 -15
  41. package/_modules/themes/five/src/components/HomeHero/layouts/OriginalHomeHero/index.js +116 -31
  42. package/_modules/themes/five/src/components/HomeHero/layouts/OriginalHomeHero/styles.js +36 -37
  43. package/_modules/themes/five/src/components/LoginForm/index.js +62 -21
  44. package/_modules/themes/five/src/components/LoginForm/styles.js +1 -1
  45. package/_modules/themes/five/src/components/Messages/index.js +19 -3
  46. package/_modules/themes/five/src/components/MultiOrdersDetails/styles.js +6 -6
  47. package/_modules/themes/five/src/components/MyOrders/index.js +4 -4
  48. package/_modules/themes/five/src/components/NavigationBar/index.js +145 -34
  49. package/_modules/themes/five/src/components/NavigationBar/styles.js +1 -1
  50. package/_modules/themes/five/src/components/PaymentOptionStripe/index.js +2 -14
  51. package/_modules/themes/five/src/components/PaymentOptions/index.js +23 -16
  52. package/_modules/themes/five/src/components/PaymentOptions/styles.js +1 -1
  53. package/_modules/themes/five/src/components/ProductForm/index.js +9 -7
  54. package/_modules/themes/five/src/components/ProductItemAccordion/index.js +10 -4
  55. package/_modules/themes/five/src/components/ProductItemAccordion/styles.js +11 -3
  56. package/_modules/themes/five/src/components/ProductShare/ProductCopyURL.js +61 -0
  57. package/_modules/themes/five/src/components/ProductShare/index.js +107 -0
  58. package/_modules/themes/five/src/components/ProductShare/styles.js +40 -0
  59. package/_modules/themes/five/src/components/RenderProductsLayout/index.js +3 -2
  60. package/_modules/themes/five/src/components/RenderProductsLayout/styles.js +18 -16
  61. package/_modules/themes/five/src/components/ReviewProduct/index.js +5 -3
  62. package/_modules/themes/five/src/components/ReviewProduct/styles.js +19 -3
  63. package/_modules/themes/five/src/components/SearchProducts/index.js +13 -2
  64. package/_modules/themes/five/src/components/SignUpApproval/index.js +6 -6
  65. package/_modules/themes/five/src/components/SignUpBusiness/layouts/NewSignUpBusiness/index.js +57 -17
  66. package/_modules/themes/five/src/components/SignUpBusiness/layouts/OldSignUpBusiness/index.js +57 -17
  67. package/_modules/themes/five/src/components/SignUpDriver/layouts/NewSignUpDriver/index.js +57 -17
  68. package/_modules/themes/five/src/components/SignUpDriver/layouts/OldSignUpDriver/index.js +57 -17
  69. package/_modules/themes/five/src/components/SignUpForm/index.js +60 -20
  70. package/_modules/themes/five/src/components/SignUpForm/styles.js +2 -2
  71. package/_modules/themes/five/src/components/SingleProductCard/index.js +36 -2
  72. package/_modules/themes/five/src/components/UserProfileForm/index.js +105 -8
  73. package/_modules/themes/five/src/components/UserProfileForm/styles.js +30 -17
  74. package/_modules/utils/index.js +26 -11
  75. package/index-template.js +11 -1
  76. package/package.json +2 -2
  77. package/src/components/LogoutButton/index.js +10 -8
  78. package/src/components/PaymentOptions/index.js +16 -11
  79. package/src/components/SpinnerLoader/styles.js +1 -0
  80. package/src/components/UserProfileForm/index.js +12 -2
  81. package/src/components/UserProfileForm/styles.js +1 -1
  82. package/src/hooks/useRecaptcha.js +40 -0
  83. package/src/themes/five/src/components/AddressForm/styles.js +3 -2
  84. package/src/themes/five/src/components/AddressList/index.js +1 -1
  85. package/src/themes/five/src/components/AddressList/styles.js +2 -2
  86. package/src/themes/five/src/components/BusinessBasicInformation/index.js +74 -71
  87. package/src/themes/five/src/components/BusinessBasicInformation/styles.js +69 -20
  88. package/src/themes/five/src/components/BusinessController/index.js +3 -1
  89. package/src/themes/five/src/components/BusinessController/styles.js +8 -0
  90. package/src/themes/five/src/components/BusinessListingSearch/index.js +16 -1
  91. package/src/themes/five/src/components/BusinessProductsCategories/index.js +6 -18
  92. package/src/themes/five/src/components/BusinessProductsCategories/styles.js +1 -1
  93. package/src/themes/five/src/components/BusinessProductsListing/index.js +2 -0
  94. package/src/themes/five/src/components/BusinessProductsListing/styles.js +2 -3
  95. package/src/themes/five/src/components/BusinessReviews/index.js +17 -10
  96. package/src/themes/five/src/components/BusinessReviews/styles.js +7 -0
  97. package/src/themes/five/src/components/BusinessesListing/layouts/OriginalBusinessesListing/index.js +64 -19
  98. package/src/themes/five/src/components/BusinessesListing/layouts/OriginalBusinessesListing/styles.js +99 -1
  99. package/src/themes/five/src/components/DriverTips/styles.js +1 -1
  100. package/src/themes/five/src/components/Footer/index.js +9 -5
  101. package/src/themes/five/src/components/Footer/styles.js +2 -6
  102. package/src/themes/five/src/components/Header/index.js +16 -8
  103. package/src/themes/five/src/components/Header/styles.js +49 -8
  104. package/src/themes/five/src/components/HomeHero/index.js +0 -6
  105. package/src/themes/five/src/components/HomeHero/layouts/OriginalHomeHero/index.js +163 -60
  106. package/src/themes/five/src/components/HomeHero/layouts/OriginalHomeHero/styles.js +145 -82
  107. package/src/themes/five/src/components/LoginForm/index.js +30 -4
  108. package/src/themes/five/src/components/LoginForm/styles.js +8 -0
  109. package/src/themes/five/src/components/Messages/index.js +8 -2
  110. package/src/themes/five/src/components/MultiOrdersDetails/styles.js +34 -1
  111. package/src/themes/five/src/components/MyOrders/index.js +4 -4
  112. package/src/themes/five/src/components/NavigationBar/index.js +153 -39
  113. package/src/themes/five/src/components/NavigationBar/styles.js +2 -2
  114. package/src/themes/five/src/components/PaymentOptionStripe/index.js +2 -14
  115. package/src/themes/five/src/components/PaymentOptions/index.js +13 -7
  116. package/src/themes/five/src/components/PaymentOptions/styles.js +5 -0
  117. package/src/themes/five/src/components/ProductForm/index.js +9 -7
  118. package/src/themes/five/src/components/ProductItemAccordion/index.js +67 -53
  119. package/src/themes/five/src/components/ProductItemAccordion/styles.js +26 -0
  120. package/src/themes/five/src/components/ProductShare/ProductCopyURL.js +53 -0
  121. package/src/themes/five/src/components/ProductShare/index.js +104 -0
  122. package/src/themes/five/src/components/ProductShare/styles.js +165 -0
  123. package/src/themes/five/src/components/RenderProductsLayout/index.js +2 -8
  124. package/src/themes/five/src/components/RenderProductsLayout/styles.js +5 -0
  125. package/src/themes/five/src/components/ReviewProduct/index.js +10 -3
  126. package/src/themes/five/src/components/ReviewProduct/styles.js +43 -0
  127. package/src/themes/five/src/components/SearchProducts/index.js +16 -3
  128. package/src/themes/five/src/components/SignUpApproval/index.js +8 -7
  129. package/src/themes/five/src/components/SignUpBusiness/layouts/NewSignUpBusiness/index.js +26 -2
  130. package/src/themes/five/src/components/SignUpBusiness/layouts/OldSignUpBusiness/index.js +26 -2
  131. package/src/themes/five/src/components/SignUpDriver/layouts/NewSignUpDriver/index.js +26 -2
  132. package/src/themes/five/src/components/SignUpDriver/layouts/OldSignUpDriver/index.js +26 -2
  133. package/src/themes/five/src/components/SignUpForm/index.js +26 -1
  134. package/src/themes/five/src/components/SignUpForm/styles.js +9 -2
  135. package/src/themes/five/src/components/SingleProductCard/index.js +26 -1
  136. package/src/themes/five/src/components/UserPopover/index.js +1 -1
  137. package/src/themes/five/src/components/UserProfileForm/index.js +83 -5
  138. package/src/themes/five/src/components/UserProfileForm/styles.js +49 -0
  139. package/src/utils/index.js +36 -9
  140. package/template/app.js +12 -11
  141. package/template/assets/images/amex.svg +30 -0
  142. package/template/assets/images/diners.svg +16 -0
  143. package/template/assets/images/discover.svg +17 -0
  144. package/template/assets/images/jcb.svg +33 -0
  145. package/template/assets/images/unionpay.svg +25 -0
  146. package/template/components/HelmetTags/index.js +1 -1
  147. package/template/components/ScrollToTop/index.js +7 -5
  148. package/template/pages/BusinessProductsList/index.js +8 -4
  149. package/template/pages/MyOrders/index.js +4 -1
  150. package/template/pages/OrderDetails/index.js +11 -2
  151. package/template/pages/Profile/index.js +8 -2
@@ -25,10 +25,11 @@ export const SignUpApproval = (props) => {
25
25
  const contactEmail = 'support@ordering.co'
26
26
  const showDomain = false
27
27
 
28
- const logoImgUrl = businessType === '2'
28
+ const logoImgUrl = businessType === 2
29
29
  ? approvalType === 'automatic' ? theme.images?.general?.CongratulationApproval : theme.images?.general?.CongratulationNoApproval
30
30
  : approvalType === 'automatic' ? theme.images?.general?.driverCongratulationApproval : theme.images?.general?.driverCongratulationNoApproval
31
- const userType = businessType === '2' ? 'business' : 'driver'
31
+ const userType = businessType === 2 ? 'business' : 'driver'
32
+
32
33
  return (
33
34
  <Container>
34
35
  <HeaderSection>
@@ -61,22 +62,22 @@ export const SignUpApproval = (props) => {
61
62
  <td className='bigger td-text-right'>{t('DASHBOARD_WEBPAGE', 'Dashboard webpage')}: </td>
62
63
  <td className='td-text-left'><a className='green-text' href={dashboardLoginUrl} target='_blank' rel='noopener noreferrer'>{dashboardUrl}</a></td>
63
64
  </tr>
64
- </tbody>
65
+ </tbody>
65
66
  </ProjectInfoContainer>
66
67
  </BodySection>
67
68
  ) : (
68
69
  <BodySection>
69
- {businessType === 'business' ? (
70
+ {userType === 'business' ? (
70
71
  <DescriptionContainer>
71
72
  <Description><span className='bigger'>{t('YOUR_STORE_UNDER_APPROVAL', 'Your store is under approval')}</span></Description>
72
73
  <Description>{t('BUSINESS_SIGNUP_MESSAGE', 'We will contact you as soon as possible')}</Description>
73
- <Description>{t('FEEL_FREE_CONTACT_US', 'feel free to contact us at ')} <a className='green-text' href={`mailto:${contactEmail}`}>{contactEmail}</a></Description>
74
+ <Description>{t('FEEL_FREE_CONTACT_US', 'feel free to contact us at ')} <a className='green-text' href={`mailto:${t('SIGNUP_DRIVER_EMAIL', contactEmail)}`}>{contactEmail}</a></Description>
74
75
  </DescriptionContainer>
75
76
  ) : (
76
77
  <DescriptionContainer>
77
78
  <Description><span className='bigger'>{t('REQUEST_TO_START_UNDER_APPROVAL', 'Your request to start as a driver is under approval.')}</span></Description>
78
79
  <Description>{t('BUSINESS_SIGNUP_MESSAGE', 'We will contact you as soon as possible')}</Description>
79
- <Description>{t('FEEL_FREE_CONTACT_US', 'feel free to contact us at ')} <a className='green-text' href={`mailto:${contactEmail}`}>{contactEmail}</a></Description>
80
+ <Description>{t('FEEL_FREE_CONTACT_US', 'feel free to contact us at ')} <a className='green-text' href={`mailto:${t('SIGNUP_DRIVER_EMAIL', contactEmail)}`}>{contactEmail}</a></Description>
80
81
  </DescriptionContainer>
81
82
  )}
82
83
  </BodySection>
@@ -100,7 +101,7 @@ export const SignUpApproval = (props) => {
100
101
  </Button>
101
102
  </ActionGroup>
102
103
  {(approvalType === 'automatic' && userType === 'business') && (
103
- <ContactSection>{t('CONTACT_US_QUESTIONS', 'If you have some questions do no hestitate to contact us at ')} <a className='green-text' href={`mailto:${contactEmail}`}>{contactEmail}</a></ContactSection>
104
+ <ContactSection>{t('CONTACT_US_QUESTIONS', 'If you have some questions do no hestitate to contact us at ')} <a className='green-text' href={`mailto:${t('SIGNUP_DRIVER_EMAIL', contactEmail)}`}>{contactEmail}</a></ContactSection>
104
105
  )}
105
106
  </FooterSection>
106
107
  </Container>
@@ -9,7 +9,7 @@ import { Input } from '../../../../styles/Inputs'
9
9
  import { Button } from '../../../../styles/Buttons'
10
10
  import { Checkbox } from '../../../../../../../styles/Checkbox'
11
11
  import { sortInputFields } from '../../../../../../../utils'
12
-
12
+ import { useRecaptcha } from '../../../../../../../hooks/useRecaptcha'
13
13
  import AiOutlineEye from '@meronex/icons/ai/AiOutlineEye'
14
14
  import AiOutlineEyeInvisible from '@meronex/icons/ai/AiOutlineEyeInvisible'
15
15
 
@@ -62,6 +62,8 @@ const SignUpBusinessUI = (props) => {
62
62
  const [{ configs }] = useConfig()
63
63
  const formMethods = useForm()
64
64
  const [alertState, setAlertState] = useState({ open: false, content: [] })
65
+ const [recaptchaConfig] = useRecaptcha(enableReCaptcha)
66
+ const [reCaptchaVersion, setRecaptchaVersion] = useState({ version: '', siteKey: '' })
65
67
  const emailInput = useRef(null)
66
68
 
67
69
  const [userPhoneNumber, setUserPhoneNumber] = useState('')
@@ -149,6 +151,22 @@ const SignUpBusinessUI = (props) => {
149
151
 
150
152
  useEffect(() => {
151
153
  if (!formState.loading && formState.result?.error) {
154
+ if (formState.result?.result?.[0] === 'ERROR_AUTH_VERIFICATION_CODE') {
155
+ if (configs?.security_recaptcha_site_key?.value) {
156
+ setRecaptchaVersion({ version: 'v2', siteKey: configs?.security_recaptcha_site_key?.value })
157
+ setAlertState({
158
+ open: true,
159
+ content: [t('TRY_AGAIN', 'Please try again')]
160
+ })
161
+ return
162
+ }
163
+ setAlertState({
164
+ open: true,
165
+ content: [t('CONFIG_DOESNOT_RECAPTCHA_KEY', 'the config doesn\'t have recaptcha site key')]
166
+ })
167
+ return
168
+ }
169
+
152
170
  setAlertState({
153
171
  open: true,
154
172
  content: formState.result?.result || [t('ERROR', 'Error')]
@@ -204,6 +222,12 @@ const SignUpBusinessUI = (props) => {
204
222
  }
205
223
  }, [externalPhoneNumber])
206
224
 
225
+ useEffect(() => {
226
+ if (recaptchaConfig?.siteKey) {
227
+ setRecaptchaVersion({ version: recaptchaConfig?.version, siteKey: recaptchaConfig?.siteKey })
228
+ }
229
+ }, [recaptchaConfig])
230
+
207
231
  useEffect(() => {
208
232
  handleChangeInput({
209
233
  target: {
@@ -322,7 +346,7 @@ const SignUpBusinessUI = (props) => {
322
346
  }
323
347
  {props.isRecaptchaEnable && enableReCaptcha && (
324
348
  <ReCaptchaWrapper>
325
- <ReCaptcha handleReCaptcha={handleReCaptcha} />
349
+ <ReCaptcha handleReCaptcha={handleReCaptcha} reCaptchaVersion={reCaptchaVersion} />
326
350
  </ReCaptchaWrapper>
327
351
  )}
328
352
 
@@ -9,7 +9,7 @@ import { Input } from '../../../../styles/Inputs'
9
9
  import { Button } from '../../../../styles/Buttons'
10
10
  import { Checkbox } from '../../../../../../../styles/Checkbox'
11
11
  import { sortInputFields } from '../../../../../../../utils'
12
-
12
+ import { useRecaptcha } from '../../../../../../../hooks/useRecaptcha'
13
13
  import AiOutlineEye from '@meronex/icons/ai/AiOutlineEye'
14
14
  import AiOutlineEyeInvisible from '@meronex/icons/ai/AiOutlineEyeInvisible'
15
15
 
@@ -60,6 +60,8 @@ const SignUpBusinessUI = (props) => {
60
60
  const [{ configs }] = useConfig()
61
61
  const formMethods = useForm()
62
62
  const [alertState, setAlertState] = useState({ open: false, content: [] })
63
+ const [recaptchaConfig] = useRecaptcha(enableReCaptcha)
64
+ const [reCaptchaVersion, setRecaptchaVersion] = useState({ version: '', siteKey: '' })
63
65
  const emailInput = useRef(null)
64
66
 
65
67
  const [userPhoneNumber, setUserPhoneNumber] = useState('')
@@ -147,6 +149,22 @@ const SignUpBusinessUI = (props) => {
147
149
 
148
150
  useEffect(() => {
149
151
  if (!formState.loading && formState.result?.error) {
152
+ if (formState.result?.result?.[0] === 'ERROR_AUTH_VERIFICATION_CODE') {
153
+ if (configs?.security_recaptcha_site_key?.value) {
154
+ setRecaptchaVersion({ version: 'v2', siteKey: configs?.security_recaptcha_site_key?.value })
155
+ setAlertState({
156
+ open: true,
157
+ content: [t('TRY_AGAIN', 'Please try again')]
158
+ })
159
+ return
160
+ }
161
+ setAlertState({
162
+ open: true,
163
+ content: [t('CONFIG_DOESNOT_RECAPTCHA_KEY', 'the config doesn\'t have recaptcha site key')]
164
+ })
165
+ return
166
+ }
167
+
150
168
  setAlertState({
151
169
  open: true,
152
170
  content: formState.result?.result || [t('ERROR', 'Error')]
@@ -202,6 +220,12 @@ const SignUpBusinessUI = (props) => {
202
220
  }
203
221
  }, [externalPhoneNumber])
204
222
 
223
+ useEffect(() => {
224
+ if (recaptchaConfig?.siteKey) {
225
+ setRecaptchaVersion({ version: recaptchaConfig?.version, siteKey: recaptchaConfig?.siteKey })
226
+ }
227
+ }, [recaptchaConfig])
228
+
205
229
  useEffect(() => {
206
230
  handleChangeInput({
207
231
  target: {
@@ -319,7 +343,7 @@ const SignUpBusinessUI = (props) => {
319
343
  }
320
344
  {props.isRecaptchaEnable && enableReCaptcha && (
321
345
  <ReCaptchaWrapper>
322
- <ReCaptcha handleReCaptcha={handleReCaptcha} />
346
+ <ReCaptcha handleReCaptcha={handleReCaptcha} reCaptchaVersion={reCaptchaVersion} />
323
347
  </ReCaptchaWrapper>
324
348
  )}
325
349
 
@@ -9,7 +9,7 @@ import { Input } from '../../../../styles/Inputs'
9
9
  import { Button } from '../../../../styles/Buttons'
10
10
  import { Checkbox } from '../../../../../../../styles/Checkbox'
11
11
  import { sortInputFields } from '../../../../../../../utils'
12
-
12
+ import { useRecaptcha } from '../../../../../../../hooks/useRecaptcha'
13
13
  import AiOutlineEye from '@meronex/icons/ai/AiOutlineEye'
14
14
  import AiOutlineEyeInvisible from '@meronex/icons/ai/AiOutlineEyeInvisible'
15
15
 
@@ -62,6 +62,8 @@ const SignUpDriverUI = (props) => {
62
62
  const [{ configs }] = useConfig()
63
63
  const formMethods = useForm()
64
64
  const [alertState, setAlertState] = useState({ open: false, content: [] })
65
+ const [recaptchaConfig] = useRecaptcha(enableReCaptcha)
66
+ const [reCaptchaVersion, setRecaptchaVersion] = useState({ version: '', siteKey: '' })
65
67
  const emailInput = useRef(null)
66
68
 
67
69
  const [userPhoneNumber, setUserPhoneNumber] = useState('')
@@ -149,6 +151,22 @@ const SignUpDriverUI = (props) => {
149
151
 
150
152
  useEffect(() => {
151
153
  if (!formState.loading && formState.result?.error) {
154
+ if (formState.result?.result?.[0] === 'ERROR_AUTH_VERIFICATION_CODE') {
155
+ if (configs?.security_recaptcha_site_key?.value) {
156
+ setRecaptchaVersion({ version: 'v2', siteKey: configs?.security_recaptcha_site_key?.value })
157
+ setAlertState({
158
+ open: true,
159
+ content: [t('TRY_AGAIN', 'Please try again')]
160
+ })
161
+ return
162
+ }
163
+ setAlertState({
164
+ open: true,
165
+ content: [t('CONFIG_DOESNOT_RECAPTCHA_KEY', 'the config doesn\'t have recaptcha site key')]
166
+ })
167
+ return
168
+ }
169
+
152
170
  setAlertState({
153
171
  open: true,
154
172
  content: formState.result?.result || [t('ERROR', 'Error')]
@@ -204,6 +222,12 @@ const SignUpDriverUI = (props) => {
204
222
  }
205
223
  }, [externalPhoneNumber])
206
224
 
225
+ useEffect(() => {
226
+ if (recaptchaConfig?.siteKey) {
227
+ setRecaptchaVersion({ version: recaptchaConfig?.version, siteKey: recaptchaConfig?.siteKey })
228
+ }
229
+ }, [recaptchaConfig])
230
+
207
231
  useEffect(() => {
208
232
  handleChangeInput({
209
233
  target: {
@@ -322,7 +346,7 @@ const SignUpDriverUI = (props) => {
322
346
  }
323
347
  {props.isRecaptchaEnable && enableReCaptcha && (
324
348
  <ReCaptchaWrapper>
325
- <ReCaptcha handleReCaptcha={handleReCaptcha} />
349
+ <ReCaptcha handleReCaptcha={handleReCaptcha} reCaptchaVersion={reCaptchaVersion} />
326
350
  </ReCaptchaWrapper>
327
351
  )}
328
352
 
@@ -9,7 +9,7 @@ import { Input } from '../../../../styles/Inputs'
9
9
  import { Button } from '../../../../styles/Buttons'
10
10
  import { Checkbox } from '../../../../../../../styles/Checkbox'
11
11
  import { sortInputFields } from '../../../../../../../utils'
12
-
12
+ import { useRecaptcha } from '../../../../../../../hooks/useRecaptcha'
13
13
  import AiOutlineEye from '@meronex/icons/ai/AiOutlineEye'
14
14
  import AiOutlineEyeInvisible from '@meronex/icons/ai/AiOutlineEyeInvisible'
15
15
 
@@ -60,6 +60,8 @@ const SignUpDriverUI = (props) => {
60
60
  const [{ configs }] = useConfig()
61
61
  const formMethods = useForm()
62
62
  const [alertState, setAlertState] = useState({ open: false, content: [] })
63
+ const [recaptchaConfig] = useRecaptcha(enableReCaptcha)
64
+ const [reCaptchaVersion, setRecaptchaVersion] = useState({ version: '', siteKey: '' })
63
65
  const emailInput = useRef(null)
64
66
 
65
67
  const [userPhoneNumber, setUserPhoneNumber] = useState('')
@@ -147,6 +149,22 @@ const SignUpDriverUI = (props) => {
147
149
 
148
150
  useEffect(() => {
149
151
  if (!formState.loading && formState.result?.error) {
152
+ if (formState.result?.result?.[0] === 'ERROR_AUTH_VERIFICATION_CODE') {
153
+ if (configs?.security_recaptcha_site_key?.value) {
154
+ setRecaptchaVersion({ version: 'v2', siteKey: configs?.security_recaptcha_site_key?.value })
155
+ setAlertState({
156
+ open: true,
157
+ content: [t('TRY_AGAIN', 'Please try again')]
158
+ })
159
+ return
160
+ }
161
+ setAlertState({
162
+ open: true,
163
+ content: [t('CONFIG_DOESNOT_RECAPTCHA_KEY', 'the config doesn\'t have recaptcha site key')]
164
+ })
165
+ return
166
+ }
167
+
150
168
  setAlertState({
151
169
  open: true,
152
170
  content: formState.result?.result || [t('ERROR', 'Error')]
@@ -202,6 +220,12 @@ const SignUpDriverUI = (props) => {
202
220
  }
203
221
  }, [externalPhoneNumber])
204
222
 
223
+ useEffect(() => {
224
+ if (recaptchaConfig?.siteKey) {
225
+ setRecaptchaVersion({ version: recaptchaConfig?.version, siteKey: recaptchaConfig?.siteKey })
226
+ }
227
+ }, [recaptchaConfig])
228
+
205
229
  useEffect(() => {
206
230
  handleChangeInput({
207
231
  target: {
@@ -319,7 +343,7 @@ const SignUpDriverUI = (props) => {
319
343
  }
320
344
  {props.isRecaptchaEnable && enableReCaptcha && (
321
345
  <ReCaptchaWrapper>
322
- <ReCaptcha handleReCaptcha={handleReCaptcha} />
346
+ <ReCaptcha handleReCaptcha={handleReCaptcha} reCaptchaVersion={reCaptchaVersion} />
323
347
  </ReCaptchaWrapper>
324
348
  )}
325
349
 
@@ -21,6 +21,7 @@ import {
21
21
  useEvent
22
22
  } from 'ordering-components-external'
23
23
  import { useCountdownTimer } from '../../../../../hooks/useCountdownTimer'
24
+ import { useRecaptcha } from '../../../../../hooks/useRecaptcha'
24
25
  import { SpinnerLoader } from '../../../../../components/SpinnerLoader'
25
26
 
26
27
  import { Tabs, Tab } from '../../styles/Tabs'
@@ -101,6 +102,8 @@ const SignUpFormUI = (props) => {
101
102
  const formMethods = useForm()
102
103
  const [events] = useEvent()
103
104
  const [alertState, setAlertState] = useState({ open: false, content: [] })
105
+ const [recaptchaConfig] = useRecaptcha(enableReCaptcha)
106
+ const [reCaptchaVersion, setRecaptchaVersion] = useState({ version: '', siteKey: '' })
104
107
  const [, { login }] = useSession()
105
108
  const isFacebookLogin = configs?.facebook_login?.value === 'true' || configs?.facebook_login?.value === '1'
106
109
  const googleLoginEnabled = configs?.google_login_enabled?.value === '1' || !configs?.google_login_enabled?.enabled
@@ -246,6 +249,22 @@ const SignUpFormUI = (props) => {
246
249
 
247
250
  useEffect(() => {
248
251
  if (!formState.loading && formState.result?.error) {
252
+ if (formState.result?.result?.[0] === 'ERROR_AUTH_VERIFICATION_CODE') {
253
+ if (configs?.security_recaptcha_site_key?.value) {
254
+ setRecaptchaVersion({ version: 'v2', siteKey: configs?.security_recaptcha_site_key?.value })
255
+ setAlertState({
256
+ open: true,
257
+ content: [t('TRY_AGAIN', 'Please try again')]
258
+ })
259
+ return
260
+ }
261
+ setAlertState({
262
+ open: true,
263
+ content: [t('CONFIG_DOESNOT_RECAPTCHA_KEY', 'the config doesn\'t have recaptcha site key')]
264
+ })
265
+ return
266
+ }
267
+
249
268
  setAlertState({
250
269
  open: true,
251
270
  content: formState.result?.result || [t('ERROR', 'Error')]
@@ -304,6 +323,12 @@ const SignUpFormUI = (props) => {
304
323
  }
305
324
  }, [checkPhoneCodeState])
306
325
 
326
+ useEffect(() => {
327
+ if (recaptchaConfig?.siteKey) {
328
+ setRecaptchaVersion({ version: recaptchaConfig?.version, siteKey: recaptchaConfig?.siteKey })
329
+ }
330
+ }, [recaptchaConfig])
331
+
307
332
  return (
308
333
  <>
309
334
  {props.beforeElements?.map((BeforeElement, i) => (
@@ -514,7 +539,7 @@ const SignUpFormUI = (props) => {
514
539
  }
515
540
  {props.isRecaptchaEnable && enableReCaptcha && (
516
541
  <ReCaptchaWrapper>
517
- <ReCaptcha handleReCaptcha={handleReCaptcha} />
542
+ <ReCaptcha handleReCaptcha={handleReCaptcha} reCaptchaVersion={reCaptchaVersion} />
518
543
  </ReCaptchaWrapper>
519
544
  )}
520
545
 
@@ -137,7 +137,7 @@ export const SocialButtons = styled.div`
137
137
 
138
138
  button {
139
139
  width: 100%;
140
- padding: 5px 30px;
140
+ padding: 5px;
141
141
  color: #000000;
142
142
  margin-bottom: 15px;
143
143
 
@@ -319,12 +319,19 @@ export const BussinessAndDriverSignUp = styled.div`
319
319
  justify-content: space-between;
320
320
  flex-direction: column;
321
321
 
322
+ button:first-child {
323
+ margin-bottom: 10px;
324
+ }
325
+
322
326
  @media (min-width: 481px) {
323
327
  width: ${({ isPopup }) => isPopup ? 'calc(100% - 20px)' : 'calc(80% - 20px)'};
324
328
  }
325
-
329
+
326
330
  @media (min-width: 993px) {
327
331
  flex-direction: row;
332
+ button:first-child {
333
+ margin-bottom: 0px;
334
+ }
328
335
  }
329
336
 
330
337
  button {
@@ -9,6 +9,7 @@ import { Modal } from '../Modal'
9
9
  import { LoginForm } from '../LoginForm'
10
10
  import { SignUpForm } from '../SignUpForm'
11
11
  import { ForgotPasswordForm } from '../ForgotPasswordForm'
12
+ import { Alert } from '../Confirm'
12
13
 
13
14
  import {
14
15
  CardContainer,
@@ -56,6 +57,7 @@ const SingleProductCardUI = (props) => {
56
57
 
57
58
  const [isModalOpen, setIsModalOpen] = useState(false)
58
59
  const [modalPageToShow, setModalPageToShow] = useState(null)
60
+ const [alertState, setAlertState] = useState({ open: false, content: [] })
59
61
 
60
62
  const editMode = typeof product?.code !== 'undefined'
61
63
  const isObservedValidation = isObserved || useKioskApp
@@ -79,6 +81,13 @@ const SingleProductCardUI = (props) => {
79
81
 
80
82
  const handleClickProduct = (e) => {
81
83
  if (favoriteRef?.current?.contains(e.target)) return
84
+ if (productAddedToCartLength && product?.maximum_per_order && productAddedToCartLength >= product?.maximum_per_order) {
85
+ setAlertState({
86
+ open: true,
87
+ content: [t('PRODUCT_ON_MAXIMUM_ORDER', 'The product is on maximum order')]
88
+ })
89
+ return
90
+ }
82
91
 
83
92
  if (isFavorite) {
84
93
  onProductClick && onProductClick()
@@ -88,6 +97,13 @@ const SingleProductCardUI = (props) => {
88
97
  (useCustomFunctionality && onCustomClick && onCustomClick())
89
98
  }
90
99
 
100
+ const closeAlert = () => {
101
+ setAlertState({
102
+ open: false,
103
+ content: []
104
+ })
105
+ }
106
+
91
107
  const handleChangeFavorite = () => {
92
108
  if (auth) {
93
109
  handleFavoriteProduct && handleFavoriteProduct(!product?.favorite)
@@ -205,7 +221,7 @@ const SingleProductCardUI = (props) => {
205
221
  </div>
206
222
  )}
207
223
  {!useCustomFunctionality && !hideAddButton && !isSkeleton && (
208
- <Button outline color='primary'>
224
+ <Button outline color='primary' disabled={productAddedToCartLength && product?.maximum_per_order && productAddedToCartLength >= product?.maximum_per_order}>
209
225
  {t('ADD', 'Add')}
210
226
  </Button>
211
227
  )}
@@ -271,6 +287,15 @@ const SingleProductCardUI = (props) => {
271
287
  />
272
288
  )}
273
289
  </Modal>
290
+ <Alert
291
+ title={t('PRODUCT', 'Product')}
292
+ content={alertState.content}
293
+ acceptText={t('ACCEPT', 'Accept')}
294
+ open={alertState.open}
295
+ onClose={() => closeAlert()}
296
+ onAccept={() => closeAlert()}
297
+ closeOnBackdrop={false}
298
+ />
274
299
  </>
275
300
  )
276
301
  }
@@ -20,7 +20,7 @@ import AiOutlineMenu from '@meronex/icons/ai/AiOutlineMenu'
20
20
  const optionsDefault = [
21
21
  { name: 'search', pathname: '/explore', displayName: 'My home', key: 'my_home' },
22
22
  { name: 'business_search', pathname: '/business_search', displayName: 'Browse & Search', key: 'browse_search' },
23
- { name: 'orders', pathname: '/profile/orders', displayName: 'orders', key: 'orders' },
23
+ { name: 'orders', pathname: '/profile/orders', displayName: 'orders', key: 'orders' }
24
24
  ]
25
25
 
26
26
  export const UserPopover = (props) => {
@@ -2,6 +2,10 @@ import React, { useState, useEffect, useRef } from 'react'
2
2
  import Skeleton from 'react-loading-skeleton'
3
3
  import {
4
4
  UserFormDetails as UserProfileController,
5
+ LogoutAction as LogoutActionController,
6
+ useConfig,
7
+ useEvent,
8
+ useCustomer,
5
9
  useLanguage,
6
10
  useSession,
7
11
  DragAndDrop,
@@ -14,14 +18,14 @@ import { UserFormDetailsUI as UserFormDetailsOldUI } from '../../../../../compon
14
18
  import { Modal } from '../Modal'
15
19
  import { VerifyCodeForm } from '../VerifyCodeForm'
16
20
  import { useCountdownTimer } from '../../../../../hooks/useCountdownTimer'
21
+ import { useWindowSize } from '../../../../../hooks/useWindowSize'
17
22
  import { AddressList } from '../AddressList'
18
23
  import { Alert } from '../Confirm'
19
24
 
20
25
  import { ProfileOptions } from './ProfileOptions'
21
- import { bytesConverter } from '../../../../../utils'
26
+ import { bytesConverter, capitalize } from '../../../../../utils'
22
27
  import FiCamera from '@meronex/icons/fi/FiCamera'
23
28
  import BiImage from '@meronex/icons/bi/BiImage'
24
- import { useTheme } from 'styled-components'
25
29
  import {
26
30
  Container,
27
31
  UserProfileContainer,
@@ -32,9 +36,46 @@ import {
32
36
  SavedPlaces,
33
37
  UploadImageIcon,
34
38
  SkeletonWrapper,
35
- WrapperForm
39
+ WrapperForm,
40
+ ProfileOptionsList,
41
+ ListLink,
42
+ ListItem
36
43
  } from './styles'
37
44
 
45
+ const LogoutActionUI = (props) => {
46
+ const [, t] = useLanguage()
47
+ const [, { deleteUserCustomer }] = useCustomer()
48
+
49
+ const handleClick = () => {
50
+ const GoogleAuth = window?.gapi?.auth2?.getAuthInstance()
51
+ if (GoogleAuth) {
52
+ const signedIn = GoogleAuth.isSignedIn.get()
53
+ if (signedIn) {
54
+ GoogleAuth.signOut().then(() => {
55
+ GoogleAuth.disconnect()
56
+ })
57
+ }
58
+ }
59
+
60
+ deleteUserCustomer(true)
61
+ props.handleLogoutClick()
62
+ }
63
+ return (
64
+ <ListItem onClick={handleClick}>
65
+ {t('LOGOUT', 'Logout')}
66
+ </ListItem>
67
+ )
68
+ }
69
+
70
+ const ListItemLogout = () => {
71
+ const logoutActionProps = {
72
+ UIComponent: LogoutActionUI
73
+ }
74
+ return (
75
+ <LogoutActionController {...logoutActionProps} />
76
+ )
77
+ }
78
+
38
79
  const UserProfileFormUI = (props) => {
39
80
  const {
40
81
  userData,
@@ -43,6 +84,7 @@ const UserProfileFormUI = (props) => {
43
84
  formState,
44
85
  cleanFormState,
45
86
  toggleIsEdit,
87
+ isCustomerMode,
46
88
  isHiddenAddress,
47
89
  handleSendVerifyCode,
48
90
  verifyPhoneState,
@@ -50,19 +92,37 @@ const UserProfileFormUI = (props) => {
50
92
  } = props
51
93
 
52
94
  const [, t] = useLanguage()
53
- const theme = useTheme()
95
+ const [events] = useEvent()
54
96
  const [{ user }] = useSession()
97
+ const [{ configs }] = useConfig()
55
98
  const [orderingTheme] = useOrderingTheme()
56
99
  const [willVerifyOtpState, setWillVerifyOtpState] = useState(false)
57
100
  const [otpLeftTime, , resetOtpLeftTime] = useCountdownTimer(
58
101
  600, willVerifyOtpState)
59
102
  const [alertState, setAlertState] = useState({ open: false, content: [] })
60
103
  const inputRef = useRef(null)
104
+ const windowSize = useWindowSize()
61
105
 
62
106
  const showCustomerPicture = !orderingTheme?.theme?.profile?.components?.picture?.hidden
63
107
  const showAddressList = !orderingTheme?.theme?.profile?.components?.address_list?.hidden
64
108
  const userFormLayoutRow = orderingTheme?.theme?.profile?.components?.layout?.position === 'row'
65
109
 
110
+ const isPromotionsEnabled = configs?.advanced_offers_module?.value === '1' || configs?.advanced_offers_module?.value === true
111
+ const isAddressListNewPage = orderingTheme?.theme?.profile?.components?.address_list?.components?.layout?.position === 'new_page'
112
+ const isWalletEnabled = configs?.cash_wallet?.value &&
113
+ configs?.wallet_enabled?.value === '1' &&
114
+ (configs?.wallet_cash_enabled?.value === '1' || configs?.wallet_credit_point_enabled?.value === '1')
115
+
116
+ const profileOptions = [
117
+ { name: 'wallets', pathname: '/wallets', displayName: 'wallets', key: 'wallets', isActive: isWalletEnabled && !isCustomerMode },
118
+ { name: 'promotions', pathname: '/promotions', displayName: 'promotions', key: 'promotions', isActive: isPromotionsEnabled },
119
+ { name: 'messages', pathname: '/messages', displayName: 'messages', key: 'messages', isActive: !isCustomerMode },
120
+ { name: 'help', pathname: '/help', displayName: 'help', key: 'help', isActive: true },
121
+ { name: 'sessions', pathname: '/sessions', displayName: 'sessions', key: 'sessions', isActive: true },
122
+ { name: 'favorite', pathname: '/favorite', displayName: 'favorites', key: 'favorites', isActive: true },
123
+ { name: 'addresses', pathname: '/profile/addresses', displayName: 'places', key: 'places', isActive: isAddressListNewPage }
124
+ ]
125
+
66
126
  const handleFiles = (files) => {
67
127
  if (files.length === 1) {
68
128
  const type = files[0].type.split('/')[0]
@@ -116,6 +176,10 @@ const UserProfileFormUI = (props) => {
116
176
  }
117
177
  }
118
178
 
179
+ const handleGoToPage = (page) => {
180
+ events.emit('go_to_page', { page })
181
+ }
182
+
119
183
  useEffect(() => {
120
184
  if (formState.changes?.photo) {
121
185
  const isImage = true
@@ -168,7 +232,7 @@ const UserProfileFormUI = (props) => {
168
232
  </React.Fragment>))}
169
233
  {props.beforeComponents?.map((BeforeComponent, i) => (
170
234
  <BeforeComponent key={i} {...props} />))}
171
- {!isHiddenAddress && (
235
+ {!isHiddenAddress && !props.hideOptions && (
172
236
  <ProfileOptions value='account' />
173
237
  )}
174
238
  <Container>
@@ -204,6 +268,20 @@ const UserProfileFormUI = (props) => {
204
268
  <Camera><FiCamera /></Camera>
205
269
  </UserImage>
206
270
  )}
271
+ {windowSize.width <= 576 && (
272
+ <ProfileOptionsList>
273
+ {profileOptions.map((option, i) => option.isActive && (
274
+ <ListLink
275
+ key={i}
276
+ active={window.location.pathname === option.pathname}
277
+ onClick={() => handleGoToPage(option.name)}
278
+ >
279
+ {t((option.key || option.name).toUpperCase(), capitalize(option.displayName || option.name))}
280
+ </ListLink>
281
+ ))}
282
+ <ListItemLogout />
283
+ </ProfileOptionsList>
284
+ )}
207
285
  <SideForm className='user-form'>
208
286
  <WrapperForm>
209
287
  {userFormLayoutRow ? (