ordering-ui-react-native 0.16.10 → 0.16.11-release

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 (213) hide show
  1. package/package.json +8 -4
  2. package/src/DeliveryApp.tsx +43 -1
  3. package/src/components/ActiveOrders/index.tsx +61 -63
  4. package/src/components/ActiveOrders/styles.tsx +8 -14
  5. package/src/components/AddressForm/index.tsx +18 -2
  6. package/src/components/BusinessBasicInformation/index.tsx +11 -19
  7. package/src/components/BusinessController/index.tsx +10 -8
  8. package/src/components/BusinessInformation/index.tsx +22 -0
  9. package/src/components/BusinessProductsList/index.tsx +7 -7
  10. package/src/components/BusinessTypeFilter/index.tsx +1 -2
  11. package/src/components/BusinessesListing/index.tsx +1 -1
  12. package/src/components/Checkout/index.tsx +2 -1
  13. package/src/components/LanguageSelector/index.tsx +21 -16
  14. package/src/components/LoginForm/index.tsx +118 -30
  15. package/src/components/LoginForm/styles.tsx +6 -0
  16. package/src/components/Messages/index.tsx +2 -2
  17. package/src/components/NotificationSetting/index.tsx +85 -0
  18. package/src/components/OrderDetails/index.tsx +7 -21
  19. package/src/components/OrdersOption/index.tsx +54 -56
  20. package/src/components/PaymentOptions/index.tsx +335 -365
  21. package/src/components/PaymentOptionsWebView/index.tsx +120 -121
  22. package/src/components/ReviewDriver/index.tsx +1 -1
  23. package/src/components/ReviewOrder/index.tsx +2 -1
  24. package/src/components/ReviewProducts/index.tsx +11 -0
  25. package/src/components/SignupForm/index.tsx +143 -61
  26. package/src/components/SingleProductReview/index.tsx +8 -5
  27. package/src/components/StripeElementsForm/index.tsx +25 -16
  28. package/src/components/StripeMethodForm/index.tsx +1 -2
  29. package/src/components/VerifyPhone/styles.tsx +1 -2
  30. package/src/components/shared/OBottomPopup.tsx +6 -2
  31. package/src/index.tsx +2 -0
  32. package/src/navigators/CheckoutNavigator.tsx +6 -0
  33. package/src/navigators/HomeNavigator.tsx +6 -0
  34. package/src/pages/BusinessesListing.tsx +7 -6
  35. package/src/pages/MultiCheckout.tsx +31 -0
  36. package/src/pages/MultiOrdersDetails.tsx +27 -0
  37. package/src/pages/OrderDetails.tsx +1 -1
  38. package/src/pages/ReviewDriver.tsx +2 -2
  39. package/src/pages/ReviewOrder.tsx +2 -2
  40. package/src/theme.json +0 -1
  41. package/src/types/@fatnlazycat/react-native-recaptcha-v3/index.d.ts +1 -0
  42. package/src/types/index.tsx +13 -9
  43. package/src/utils/index.tsx +0 -1
  44. package/themes/business/index.tsx +4 -0
  45. package/themes/business/src/components/BusinessController/index.tsx +2 -2
  46. package/themes/business/src/components/Chat/index.tsx +42 -34
  47. package/themes/business/src/components/DriverMap/index.tsx +13 -10
  48. package/themes/business/src/components/DriverSchedule/index.tsx +71 -0
  49. package/themes/business/src/components/DriverSchedule/styles.tsx +6 -0
  50. package/themes/business/src/components/LoginForm/index.tsx +111 -74
  51. package/themes/business/src/components/MapView/index.tsx +1 -1
  52. package/themes/business/src/components/MessagesOption/index.tsx +11 -1
  53. package/themes/business/src/components/OrderDetails/Business.tsx +1 -1
  54. package/themes/business/src/components/OrderDetails/Delivery.tsx +3 -3
  55. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +19 -18
  56. package/themes/business/src/components/OrdersListManager/index.tsx +10 -3
  57. package/themes/business/src/components/OrdersOption/index.tsx +65 -21
  58. package/themes/business/src/components/OrdersOption/styles.tsx +5 -1
  59. package/themes/business/src/components/OrdersOptionBusiness/index.tsx +15 -1
  60. package/themes/business/src/components/OrdersOptionCity/index.tsx +15 -1
  61. package/themes/business/src/components/OrdersOptionDate/index.tsx +19 -6
  62. package/themes/business/src/components/OrdersOptionDelivery/index.tsx +15 -1
  63. package/themes/business/src/components/OrdersOptionDriver/index.tsx +15 -1
  64. package/themes/business/src/components/OrdersOptionPaymethod/index.tsx +15 -1
  65. package/themes/business/src/components/OrdersOptionStatus/index.tsx +10 -1
  66. package/themes/business/src/components/PreviousMessages/index.tsx +17 -18
  67. package/themes/business/src/components/PreviousOrders/index.tsx +21 -23
  68. package/themes/business/src/components/ProductItemAccordion/index.tsx +5 -4
  69. package/themes/business/src/components/ReviewCustomer/index.tsx +1 -1
  70. package/themes/business/src/components/ScheduleBlocked/index.tsx +53 -0
  71. package/themes/business/src/components/UserFormDetails/index.tsx +5 -2
  72. package/themes/business/src/components/UserProfileForm/index.tsx +28 -4
  73. package/themes/business/src/components/shared/ODropDown.tsx +42 -8
  74. package/themes/business/src/components/shared/ODropDownCalendar.tsx +36 -7
  75. package/themes/business/src/components/shared/OModal.tsx +40 -37
  76. package/themes/business/src/types/index.tsx +14 -9
  77. package/themes/business/src/utils/index.tsx +10 -0
  78. package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
  79. package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
  80. package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
  81. package/themes/kiosk/src/components/BusinessMenu/index.tsx +2 -1
  82. package/themes/kiosk/src/components/CartItem/index.tsx +4 -3
  83. package/themes/kiosk/src/components/CategoriesMenu/index.tsx +1 -0
  84. package/themes/kiosk/src/components/Checkout/index.tsx +6 -0
  85. package/themes/kiosk/src/components/DrawerView/index.tsx +1 -0
  86. package/themes/kiosk/src/components/DrawerView/styles.tsx +2 -2
  87. package/themes/kiosk/src/components/LoginForm/index.tsx +121 -10
  88. package/themes/kiosk/src/components/LoginForm/styles.tsx +5 -0
  89. package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
  90. package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
  91. package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +8 -10
  92. package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
  93. package/themes/kiosk/src/types/index.d.ts +2 -0
  94. package/themes/original/index.tsx +16 -0
  95. package/themes/original/src/components/AddressForm/index.tsx +136 -133
  96. package/themes/original/src/components/AddressList/index.tsx +1 -1
  97. package/themes/original/src/components/AppleLogin/index.tsx +4 -4
  98. package/themes/original/src/components/BusinessBasicInformation/index.tsx +302 -160
  99. package/themes/original/src/components/BusinessBasicInformation/styles.tsx +6 -2
  100. package/themes/original/src/components/BusinessController/index.tsx +173 -108
  101. package/themes/original/src/components/BusinessItemAccordion/index.tsx +12 -9
  102. package/themes/original/src/components/BusinessItemAccordion/styles.tsx +3 -1
  103. package/themes/original/src/components/BusinessListingSearch/BusinessControllerSkeletons/index.tsx +57 -0
  104. package/themes/original/src/components/BusinessListingSearch/MaxSectionItem/index.tsx +59 -0
  105. package/themes/original/src/components/BusinessListingSearch/MaxSectionItem/styles.tsx +13 -0
  106. package/themes/original/src/components/BusinessListingSearch/index.tsx +106 -126
  107. package/themes/original/src/components/BusinessListingSearch/styles.tsx +18 -13
  108. package/themes/original/src/components/BusinessProductsList/CategoryDescription/index.tsx +44 -0
  109. package/themes/original/src/components/BusinessProductsList/SubcategoriesComponent/index.tsx +87 -0
  110. package/themes/original/src/components/BusinessProductsList/SubcategoriesComponent/styles.tsx +12 -0
  111. package/themes/original/src/components/BusinessProductsList/index.tsx +61 -72
  112. package/themes/original/src/components/BusinessProductsList/styles.tsx +0 -3
  113. package/themes/original/src/components/BusinessProductsListing/index.tsx +290 -181
  114. package/themes/original/src/components/BusinessProductsListing/styles.tsx +18 -0
  115. package/themes/original/src/components/BusinessReviews/index.tsx +6 -1
  116. package/themes/original/src/components/BusinessTypeFilter/index.tsx +106 -38
  117. package/themes/original/src/components/BusinessTypeFilter/styles.tsx +2 -0
  118. package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +561 -0
  119. package/themes/original/src/components/BusinessesListing/{styles.tsx → Layout/Appointment/styles.tsx} +24 -2
  120. package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +673 -0
  121. package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +137 -0
  122. package/themes/original/src/components/BusinessesListing/index.tsx +100 -484
  123. package/themes/original/src/components/Cart/index.tsx +81 -36
  124. package/themes/original/src/components/Cart/styles.tsx +4 -0
  125. package/themes/original/src/components/CartContent/index.tsx +22 -16
  126. package/themes/original/src/components/Checkout/index.tsx +106 -66
  127. package/themes/original/src/components/Checkout/styles.tsx +0 -1
  128. package/themes/original/src/components/DriverTips/index.tsx +4 -4
  129. package/themes/original/src/components/DriverTips/styles.tsx +2 -1
  130. package/themes/original/src/components/Favorite/index.tsx +1 -0
  131. package/themes/original/src/components/Favorite/styles.tsx +1 -0
  132. package/themes/original/src/components/FavoriteList/index.tsx +143 -94
  133. package/themes/original/src/components/GPSButton/index.tsx +25 -17
  134. package/themes/original/src/components/GoogleMap/index.tsx +20 -12
  135. package/themes/original/src/components/HelpAccountAndPayment/index.tsx +8 -3
  136. package/themes/original/src/components/HelpGuide/index.tsx +8 -3
  137. package/themes/original/src/components/HelpOrder/index.tsx +8 -3
  138. package/themes/original/src/components/LoginForm/Otp/index.tsx +3 -2
  139. package/themes/original/src/components/LoginForm/index.tsx +79 -42
  140. package/themes/original/src/components/Messages/index.tsx +17 -17
  141. package/themes/original/src/components/MomentSelector/index.tsx +197 -0
  142. package/themes/original/src/components/MomentSelector/styles.tsx +6 -0
  143. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +243 -0
  144. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/styles.tsx +46 -0
  145. package/themes/original/src/components/MultiCheckout/index.tsx +304 -0
  146. package/themes/original/src/components/MultiCheckout/styles.tsx +59 -0
  147. package/themes/original/src/components/MultiOrdersDetails/SingleOrderCard.tsx +372 -0
  148. package/themes/original/src/components/MultiOrdersDetails/index.tsx +262 -0
  149. package/themes/original/src/components/MultiOrdersDetails/styles.tsx +50 -0
  150. package/themes/original/src/components/MyOrders/index.tsx +177 -27
  151. package/themes/original/src/components/MyOrders/styles.tsx +8 -1
  152. package/themes/original/src/components/NavBar/index.tsx +11 -5
  153. package/themes/original/src/components/NotFoundSource/index.tsx +2 -1
  154. package/themes/original/src/components/OrderDetails/OrderHistory.tsx +167 -0
  155. package/themes/original/src/components/OrderDetails/index.tsx +125 -40
  156. package/themes/original/src/components/OrderDetails/styles.tsx +5 -2
  157. package/themes/original/src/components/OrderItAgain/index.tsx +75 -0
  158. package/themes/original/src/components/OrderItAgain/styles.tsx +10 -0
  159. package/themes/original/src/components/OrderProgress/index.tsx +8 -2
  160. package/themes/original/src/components/OrderSummary/index.tsx +1 -34
  161. package/themes/original/src/components/OrderTypeSelector/index.tsx +84 -36
  162. package/themes/original/src/components/OrderTypeSelector/styles.tsx +19 -1
  163. package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/index.tsx +144 -0
  164. package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/styles.tsx +6 -0
  165. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/index.tsx +56 -0
  166. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/styles.tsx +6 -0
  167. package/themes/original/src/components/OrdersOption/index.tsx +126 -37
  168. package/themes/original/src/components/OrdersOption/styles.tsx +4 -1
  169. package/themes/original/src/components/PaymentOptions/index.tsx +57 -37
  170. package/themes/original/src/components/PhoneInputNumber/index.tsx +4 -10
  171. package/themes/original/src/components/PlaceSpot/index.tsx +243 -47
  172. package/themes/original/src/components/PlaceSpot/styles.tsx +0 -2
  173. package/themes/original/src/components/ProductForm/index.tsx +712 -655
  174. package/themes/original/src/components/ProductForm/styles.tsx +9 -7
  175. package/themes/original/src/components/ProductItemAccordion/index.tsx +37 -24
  176. package/themes/original/src/components/ProductOption/index.tsx +1 -1
  177. package/themes/original/src/components/ProfessionalFilter/index.tsx +129 -0
  178. package/themes/original/src/components/ProfessionalFilter/styles.tsx +0 -0
  179. package/themes/original/src/components/ProfessionalProfile/index.tsx +309 -0
  180. package/themes/original/src/components/ProfessionalProfile/styles.tsx +46 -0
  181. package/themes/original/src/components/ReviewDriver/index.tsx +6 -6
  182. package/themes/original/src/components/ReviewOrder/index.tsx +18 -3
  183. package/themes/original/src/components/ReviewProducts/index.tsx +1 -1
  184. package/themes/original/src/components/ReviewTrigger/index.tsx +118 -0
  185. package/themes/original/src/components/ReviewTrigger/styles.tsx +34 -0
  186. package/themes/original/src/components/SearchBar/index.tsx +10 -5
  187. package/themes/original/src/components/ServiceForm/index.tsx +608 -0
  188. package/themes/original/src/components/ServiceForm/styles.tsx +50 -0
  189. package/themes/original/src/components/SignupForm/index.tsx +301 -158
  190. package/themes/original/src/components/SingleOrderCard/index.tsx +213 -177
  191. package/themes/original/src/components/SingleProductCard/index.tsx +198 -110
  192. package/themes/original/src/components/SingleProductCard/styles.tsx +2 -2
  193. package/themes/original/src/components/SingleProductReview/index.tsx +30 -3
  194. package/themes/original/src/components/SingleProductReview/styles.tsx +12 -0
  195. package/themes/original/src/components/StripeElementsForm/index.tsx +25 -9
  196. package/themes/original/src/components/StripeElementsForm/naked.tsx +2 -2
  197. package/themes/original/src/components/UpsellingProducts/index.tsx +14 -4
  198. package/themes/original/src/components/UserDetails/index.tsx +32 -18
  199. package/themes/original/src/components/UserFormDetails/index.tsx +107 -73
  200. package/themes/original/src/components/UserProfile/index.tsx +8 -1
  201. package/themes/original/src/components/UserProfileForm/index.tsx +15 -10
  202. package/themes/original/src/components/WalletTransactions/index.tsx +76 -0
  203. package/themes/original/src/components/WalletTransactions/styles.tsx +13 -0
  204. package/themes/original/src/components/Wallets/index.tsx +176 -162
  205. package/themes/original/src/components/Wallets/styles.tsx +10 -8
  206. package/themes/original/src/components/shared/OBottomPopup.tsx +47 -14
  207. package/themes/original/src/components/shared/OButton.tsx +10 -3
  208. package/themes/original/src/components/shared/OInput.tsx +3 -2
  209. package/themes/original/src/components/shared/OModal.tsx +3 -1
  210. package/themes/original/src/layouts/FloatingBottomContainer.tsx +5 -1
  211. package/themes/original/src/types/index.tsx +160 -47
  212. package/themes/original/src/utils/index.tsx +77 -0
  213. package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
@@ -1,9 +1,11 @@
1
1
  import React, { useEffect, useState, useRef } from 'react';
2
2
  import { Pressable, StyleSheet, View, Keyboard } from 'react-native';
3
3
  import Spinner from 'react-native-loading-spinner-overlay';
4
+ import { TouchableOpacity } from 'react-native-gesture-handler';
4
5
  import { useForm, Controller } from 'react-hook-form';
5
6
  import { PhoneInputNumber } from '../PhoneInputNumber'
6
7
  import MaterialCommunityIcons from 'react-native-vector-icons/MaterialCommunityIcons'
8
+ import Recaptcha from 'react-native-recaptcha-that-works'
7
9
 
8
10
  import {
9
11
  LoginForm as LoginFormController,
@@ -28,7 +30,8 @@ import {
28
30
  OTab,
29
31
  SocialButtons,
30
32
  OrSeparator,
31
- LineSeparator
33
+ LineSeparator,
34
+ RecaptchaButton
32
35
  } from './styles';
33
36
 
34
37
  import { _removeStoreData } from '../../providers/StoreUtil';
@@ -56,7 +59,9 @@ const LoginFormUI = (props: LoginParams) => {
56
59
  handleSendVerifyCode,
57
60
  handleCheckPhoneCode,
58
61
  onNavigationRedirect,
59
- notificationState
62
+ notificationState,
63
+ handleReCaptcha,
64
+ enableReCaptcha
60
65
  } = props
61
66
 
62
67
  const theme = useTheme()
@@ -70,6 +75,10 @@ const LoginFormUI = (props: LoginParams) => {
70
75
  marginBottom: 25,
71
76
  borderWidth: 1,
72
77
  borderColor: theme.colors.disabled
78
+ },
79
+ recaptchaIcon: {
80
+ width: 100,
81
+ height: 100,
73
82
  }
74
83
  });
75
84
 
@@ -89,7 +98,9 @@ const LoginFormUI = (props: LoginParams) => {
89
98
  cellphone: null
90
99
  }
91
100
  });
92
-
101
+ const [recaptchaConfig, setRecaptchaConfig] = useState<any>({})
102
+ const [recaptchaVerified, setRecaptchaVerified] = useState(false)
103
+ const recaptchaRef = useRef<any>({});
93
104
  const inputRef = useRef<any>({})
94
105
 
95
106
  const googleLoginEnabled = configs?.google_login_enabled?.value === '1' || !configs?.google_login_enabled?.enabled
@@ -152,6 +163,40 @@ const LoginFormUI = (props: LoginParams) => {
152
163
  onChange(value.toLowerCase().replace(/[&,()%";:ç?<>{}\\[\]\s]/g, ''))
153
164
  }
154
165
 
166
+ const handleOpenRecaptcha = () => {
167
+ setRecaptchaVerified(false)
168
+
169
+ if (recaptchaVerified) {
170
+ handleReCaptcha && handleReCaptcha('')
171
+ return
172
+ }
173
+
174
+ if (!recaptchaConfig?.siteKey) {
175
+ showToast(ToastType.Error, t('NO_RECAPTCHA_SITE_KEY', 'The config doesn\'t have recaptcha site key'));
176
+ return
177
+ }
178
+ if (!recaptchaConfig?.baseUrl) {
179
+ showToast(ToastType.Error, t('NO_RECAPTCHA_BASE_URL', 'The config doesn\'t have recaptcha base url'));
180
+ return
181
+ }
182
+
183
+ recaptchaRef.current.open()
184
+ }
185
+
186
+ const onRecaptchaVerify = (token: any) => {
187
+ setRecaptchaVerified(true)
188
+ handleReCaptcha && handleReCaptcha(token)
189
+ }
190
+
191
+ useEffect(() => {
192
+ if (configs && Object.keys(configs).length > 0 && enableReCaptcha) {
193
+ setRecaptchaConfig({
194
+ siteKey: configs?.security_recaptcha_site_key?.value || null,
195
+ baseUrl: configs?.security_recaptcha_base_url?.value || null
196
+ })
197
+ }
198
+ }, [configs, enableReCaptcha])
199
+
155
200
  useEffect(() => {
156
201
  if (!formState.loading && formState.result?.error) {
157
202
  formState.result?.result && showToast(
@@ -317,6 +362,48 @@ const LoginFormUI = (props: LoginParams) => {
317
362
  rules={{ required: t('VALIDATION_ERROR_PASSWORD_REQUIRED', 'The field Password is required').replace('_attribute_', t('PASSWORD', 'Password')) }}
318
363
  defaultValue=""
319
364
  />
365
+
366
+ {enableReCaptcha && (
367
+ <>
368
+ <TouchableOpacity
369
+ onPress={handleOpenRecaptcha}
370
+ >
371
+ <RecaptchaButton>
372
+ {recaptchaVerified ? (
373
+ <MaterialCommunityIcons
374
+ name="checkbox-marked"
375
+ size={26}
376
+ color={theme.colors.primary}
377
+ />
378
+ ) : (
379
+ <MaterialCommunityIcons
380
+ name="checkbox-blank-outline"
381
+ size={26}
382
+ color={theme.colors.mediumGray}
383
+ />
384
+ )}
385
+ <OText size={14} mLeft={8}>{t('VERIFY_ReCAPTCHA', 'Verify reCAPTCHA')}</OText>
386
+ </RecaptchaButton>
387
+ </TouchableOpacity>
388
+ <Recaptcha
389
+ ref={recaptchaRef}
390
+ siteKey={recaptchaConfig?.siteKey}
391
+ baseUrl={recaptchaConfig?.baseUrl}
392
+ onVerify={onRecaptchaVerify}
393
+ onExpire={() => setRecaptchaVerified(false)}
394
+ footerComponent={<OButton
395
+ onClick={() => recaptchaRef.current.close()}
396
+ style={{ borderRadius: 0 }}
397
+ text={t('CLOSE', 'Close')}
398
+ bgColor={theme.colors.primary}
399
+ borderColor={theme.colors.primary}
400
+ textStyle={{ color: 'white' }}
401
+ imgRightSrc={null}
402
+ />}
403
+ />
404
+ </>
405
+ )}
406
+
320
407
  <OButton
321
408
  onClick={handleSubmit(onSubmit)}
322
409
  text={loginButtonText}
@@ -369,13 +456,13 @@ const LoginFormUI = (props: LoginParams) => {
369
456
  }
370
457
 
371
458
  {configs && Object.keys(configs).length > 0 && anySocialButtonActivated && (
372
- <ButtonsWrapper>
373
- <OText size={18} mBottom={10} color={theme.colors.disabled}>
374
- {t('SELECT_AN_OPTION_TO_LOGIN', 'Select an option to login')}
375
- </OText>
376
- <SocialButtons>
377
- {(configs?.facebook_login?.value === 'true' || configs?.facebook_login?.value === '1') &&
378
- configs?.facebook_id?.value && (
459
+ <ButtonsWrapper>
460
+ <OText size={18} mBottom={10} color={theme.colors.disabled}>
461
+ {t('SELECT_AN_OPTION_TO_LOGIN', 'Select an option to login')}
462
+ </OText>
463
+ <SocialButtons>
464
+ {(configs?.facebook_login?.value === 'true' || configs?.facebook_login?.value === '1') &&
465
+ configs?.facebook_id?.value && (
379
466
  <FacebookLogin
380
467
  notificationState={notificationState}
381
468
  handleErrors={(err: any) => showToast(ToastType.Error, err)}
@@ -383,26 +470,26 @@ const LoginFormUI = (props: LoginParams) => {
383
470
  handleSuccessFacebookLogin={handleSuccessFacebook}
384
471
  />
385
472
  )}
386
- {(configs?.google_login_client_id?.value !== '' && configs?.google_login_client_id?.value !== null) && googleLoginEnabled && (
387
- <GoogleLogin
388
- notificationState={notificationState}
389
- webClientId={configs?.google_login_client_id?.value}
390
- handleErrors={(err: any) => showToast(ToastType.Error, err)}
391
- handleLoading={(val: boolean) => setIsLoadingSocialButton(val)}
392
- handleSuccessGoogleLogin={handleSuccessFacebook}
393
- />
394
- )}
395
- {(configs?.apple_login_client_id?.value !== '' && configs?.apple_login_client_id?.value !== null) && (
396
- <AppleLogin
397
- notificationState={notificationState}
398
- handleErrors={(err: any) => showToast(ToastType.Error, err)}
399
- handleLoading={(val: boolean) => setIsLoadingSocialButton(val)}
400
- handleSuccessApple={handleSuccessApple}
401
- />
402
- )}
403
- </SocialButtons>
404
- </ButtonsWrapper>
405
- )}
473
+ {(configs?.google_login_client_id?.value !== '' && configs?.google_login_client_id?.value !== null) && googleLoginEnabled && (
474
+ <GoogleLogin
475
+ notificationState={notificationState}
476
+ webClientId={configs?.google_login_client_id?.value}
477
+ handleErrors={(err: any) => showToast(ToastType.Error, err)}
478
+ handleLoading={(val: boolean) => setIsLoadingSocialButton(val)}
479
+ handleSuccessGoogleLogin={handleSuccessFacebook}
480
+ />
481
+ )}
482
+ {(configs?.apple_login_client_id?.value !== '' && configs?.apple_login_client_id?.value !== null) && (
483
+ <AppleLogin
484
+ notificationState={notificationState}
485
+ handleErrors={(err: any) => showToast(ToastType.Error, err)}
486
+ handleLoading={(val: boolean) => setIsLoadingSocialButton(val)}
487
+ handleSuccessApple={handleSuccessApple}
488
+ />
489
+ )}
490
+ </SocialButtons>
491
+ </ButtonsWrapper>
492
+ )}
406
493
 
407
494
  {onNavigationRedirect && registerButtonText && (
408
495
  <ButtonsWrapper>
@@ -440,6 +527,7 @@ const LoginFormUI = (props: LoginParams) => {
440
527
  export const LoginForm = (props: any) => {
441
528
  const loginProps = {
442
529
  ...props,
530
+ isRecaptchaEnable: true,
443
531
  UIComponent: LoginFormUI,
444
532
  handleSuccessLogin: () => _removeStoreData('isGuestUser')
445
533
  };
@@ -67,3 +67,9 @@ export const LineSeparator = styled.View`
67
67
  export const SkeletonWrapper = styled.View`
68
68
  width: 90%;
69
69
  `
70
+ export const RecaptchaButton = styled.View`
71
+ flex-direction: row;
72
+ align-items: center;
73
+ margin-bottom: 10px;
74
+ justify-content: center;
75
+ `
@@ -42,8 +42,8 @@ const ORDER_STATUS: any = {
42
42
 
43
43
  const imgOptions = {
44
44
  mediaType: 'photo',
45
- maxHeight: 300,
46
- maxWidth: 300,
45
+ maxHeight: 2048,
46
+ maxWidth: 2048,
47
47
  includeBase64: true,
48
48
  selectionLimit: 0
49
49
  }
@@ -0,0 +1,85 @@
1
+ import React, { useEffect } from 'react';
2
+ import { useTheme } from 'styled-components/native';
3
+ import { StyleSheet, View } from 'react-native';
4
+ import {
5
+ openSettings,
6
+ checkNotifications
7
+ } from 'react-native-permissions';
8
+ import { useLanguage } from 'ordering-components/native'
9
+ import { OBottomPopup, OButton, OText } from '../shared';
10
+ interface NotificationSettingPropsParams {
11
+ checkNotificationStatus: { open: boolean, checked: boolean };
12
+ setCheckNotificationStatus: (notificationStatus: any) => void;
13
+ }
14
+ export const NotificationSetting = (props: NotificationSettingPropsParams) => {
15
+ const { checkNotificationStatus, setCheckNotificationStatus } = props
16
+ const theme = useTheme();
17
+ const [, t] = useLanguage();
18
+
19
+ const requestLocationPermission = async () => {
20
+ const notificationStatus = await checkNotifications()
21
+ if (notificationStatus?.status === 'blocked') {
22
+ setCheckNotificationStatus({ open: true, checked: false })
23
+ return
24
+ }
25
+ setCheckNotificationStatus({ open: false, checked: true })
26
+ };
27
+
28
+ const callOpenSettings = () => {
29
+ openSettings().catch(() => console.warn('cannot open settings'));
30
+ setCheckNotificationStatus({ open: false, checked: true })
31
+ }
32
+
33
+ useEffect(() => {
34
+ requestLocationPermission()
35
+ }, [])
36
+ return (
37
+ <OBottomPopup
38
+ open={checkNotificationStatus?.open}
39
+ onClose={() => setCheckNotificationStatus({ open: false, checked: true })}
40
+ title={t('ENABLE_NOTIFICATIONS', 'Enable notifications')}
41
+ titleStyle={{ textAlign: 'center' }}
42
+ containerStyle={{ borderRadius: 10, borderTopRightRadius: 10, borderTopLeftRadius: 10 }}
43
+ >
44
+ <View style={styles.container}>
45
+ <View style={styles.textContainer}>
46
+ <OText style={{ textAlign: 'center' }}>
47
+ {t('ACTIVE_NOTIFICATION_TO_RECEIVE_INFORMATION', 'Activate notifications to receive information about your orders')}
48
+ </OText>
49
+ </View>
50
+ <OButton
51
+ text={t('ENABLE_NOTIFICATIONS', 'Enable notifications')}
52
+ bgColor={theme.colors.primary}
53
+ borderColor={theme.colors.primary}
54
+ parentStyle={styles.parentStyle}
55
+ style={styles.button}
56
+ textStyle={{ color: 'white' }}
57
+ onClick={() => callOpenSettings()}
58
+ />
59
+ </View>
60
+ </OBottomPopup>
61
+ );
62
+ };
63
+
64
+ const styles = StyleSheet.create({
65
+ container: {
66
+ width: '100%',
67
+ textAlign: 'center'
68
+ },
69
+ textContainer: {
70
+ width: '100%',
71
+ paddingHorizontal: 25,
72
+ paddingBottom: 20
73
+ },
74
+ parentStyle: {
75
+ display: 'flex',
76
+ width: '70%',
77
+ marginLeft: 'auto',
78
+ marginRight: 'auto',
79
+ marginBottom: 25
80
+
81
+ },
82
+ button: {
83
+ borderRadius: 5
84
+ }
85
+ });
@@ -1,5 +1,5 @@
1
- import React, { useState, useEffect, useRef } from 'react'
2
- import { View, StyleSheet, BackHandler, TouchableOpacity, I18nManager, AppState } from 'react-native'
1
+ import React, { useState, useEffect } from 'react'
2
+ import { View, StyleSheet, BackHandler, TouchableOpacity, I18nManager } from 'react-native'
3
3
  import LinearGradient from 'react-native-linear-gradient'
4
4
  import { Fade, Placeholder, PlaceholderLine } from 'rn-placeholder';
5
5
  import MaterialCommunityIcon from 'react-native-vector-icons/MaterialCommunityIcons'
@@ -109,7 +109,6 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
109
109
  const [isReviewed, setIsReviewed] = useState(false)
110
110
  const [openOrderCreating, setOpenOrderCreating] = useState(false)
111
111
  const [openTaxModal, setOpenTaxModal] = useState<any>({ open: false, tax: null, type: '' })
112
- const appState = useRef(AppState.currentState)
113
112
 
114
113
  const { order, loading, businessData, error } = props.order
115
114
 
@@ -259,24 +258,6 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
259
258
  })
260
259
  }, [])
261
260
 
262
- useEffect(() => {
263
- const onFocusApp = (nextAppState: any) => {
264
- if (
265
- appState.current.match(/inactive|background/) &&
266
- nextAppState === "active"
267
- ) {
268
- getOrder && getOrder()
269
- }
270
- appState.current = nextAppState;
271
- }
272
-
273
- AppState.addEventListener("change", onFocusApp);
274
- return () => {
275
- AppState.removeEventListener('change', onFocusApp);
276
- };
277
- }, [])
278
-
279
-
280
261
  return (
281
262
  <OrderDetailsContainer keyboardShouldPersistTaps='handled'>
282
263
  {order && order?.id && !error && !loading && (
@@ -400,6 +381,11 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
400
381
  <InfoBlock>
401
382
  <OText size={18} style={{ textAlign: 'left' }} >{order?.customer?.name} {order?.customer?.lastname}</OText>
402
383
  <OText style={{ textAlign: 'left' }}>{order?.customer?.address}</OText>
384
+ {(!!order?.customer?.cellphone) && (
385
+ <OText size={18} style={{ textAlign: 'left' }}>
386
+ {(order?.customer?.country_phone_code) && `+${(order?.customer?.country_phone_code)} `}{(order?.customer?.cellphone)}
387
+ </OText>
388
+ )}
403
389
  </InfoBlock>
404
390
  </Customer>
405
391
  {order?.delivery_option !== undefined && order?.delivery_type === 1 && (
@@ -102,46 +102,71 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
102
102
  }
103
103
 
104
104
  useEffect(() => {
105
+ const length = orders.filter((order : any) => orderStatus.includes(order.status)).length
106
+
105
107
  setOrdersLength && setOrdersLength({
106
108
  ...ordersLength,
107
- [activeOrders ? 'activeOrdersLength' : 'previousOrdersLength']: orders.length
109
+ [activeOrders ? 'activeOrdersLength' : 'previousOrdersLength']: length
108
110
  })
109
- }, [orders.length])
111
+ ordersLength[activeOrders ? 'activeOrdersLength' : 'previousOrdersLength'] = length
112
+ }, [orders])
110
113
 
111
114
  useEffect(() => {
112
- setOrdersFiltered(filterForOrders === 'preorders' ? orders.filter((order : any) => order.status === 13) : orders.filter((order : any) => orderStatus.includes(order.status) && order.status !== 13))
115
+ setOrdersFiltered(filterForOrders === 'preorders'
116
+ ? orders.filter((order : any) => order.status === 13)
117
+ : orders.filter((order : any) => orderStatus.includes(order.status) && order.status !== 13)
118
+ )
113
119
  }, [filterForOrders, orders])
114
120
 
115
121
  return (
116
- <>
122
+ <View style={{ marginBottom: 20 }}>
117
123
  <OptionTitle>
118
- {(!activeOrders || (activeOrders && ordersLength.activeOrdersLength > 0) || (ordersLength.previousOrdersLength === 0 && ordersLength.activeOrdersLength === 0)) && !isLoadingFirstRender && (
119
- <>
120
- <TouchableOpacity onPress={() => setFilterForOrders('active-orders')}>
121
- <OText size={16} color={filterForOrders === 'active-orders' ? theme.colors.black : theme.colors.textSecondary} mBottom={10} mRight={10} >
122
- {titleContent || (activeOrders
123
- ? t('ACTIVE_ORDERS', 'Active Orders')
124
- : t('PREVIOUS_ORDERS', 'Previous Orders'))}
125
- </OText>
126
- </TouchableOpacity>
127
- {activeOrders && orders.filter((order : any) => order.status === 13)?.length > 0 && (
128
- <TouchableOpacity onPress={() => setFilterForOrders('preorders')}>
129
- <OText size={16} color={filterForOrders === 'preorders' ? theme.colors.black : theme.colors.textSecondary} mBottom={10} >
130
- {t('PREORDERS', 'Preorders')}
131
- </OText>
132
- </TouchableOpacity>
133
- )}
134
- </>
124
+ <TouchableOpacity onPress={() => setFilterForOrders('active-orders')}>
125
+ <OText size={16} color={filterForOrders === 'active-orders' ? theme.colors.black : theme.colors.textSecondary} mBottom={10} mRight={10} >
126
+ {titleContent || (activeOrders
127
+ ? t('ACTIVE_ORDERS', 'Active Orders')
128
+ : t('PREVIOUS_ORDERS', 'Previous Orders'))}
129
+ </OText>
130
+ </TouchableOpacity>
131
+ {activeOrders && orders.filter((order : any) => order.status === 13)?.length > 0 && (
132
+ <TouchableOpacity onPress={() => setFilterForOrders('preorders')}>
133
+ <OText size={16} color={filterForOrders === 'preorders' ? theme.colors.black : theme.colors.textSecondary} mBottom={10} >
134
+ {t('PREORDERS', 'Preorders')}
135
+ </OText>
136
+ </TouchableOpacity>
135
137
  )}
136
138
  </OptionTitle>
137
- {!loading && orders.length === 0 && !isLoadingFirstRender && activeOrders && ordersLength.previousOrdersLength === 0 && ordersLength.activeOrdersLength !== 0 && (
138
- <NotFoundSource
139
- content={t('NO_RESULTS_FOUND', 'Sorry, no results found')}
140
- image={imageFails}
141
- conditioned
142
- />
139
+ {!loading && !error && orders.length > 0 && !isLoadingFirstRender && (
140
+ activeOrders ? (
141
+ <ActiveOrders
142
+ orders={ordersFiltered}
143
+ pagination={pagination}
144
+ loadMoreOrders={loadMoreOrders}
145
+ reorderLoading={reorderLoading}
146
+ customArray={customArray}
147
+ getOrderStatus={getOrderStatus}
148
+ onNavigationRedirect={onNavigationRedirect}
149
+ setScreen={setScreen}
150
+ screen={screen}
151
+ isPreorders={filterForOrders === 'preorders'}
152
+ preordersLength={orders.filter((order : any) => order.status === 13)?.length}
153
+ />
154
+ ) : (
155
+ <PreviousOrders
156
+ reorderLoading={reorderLoading}
157
+ orders={ordersFiltered}
158
+ pagination={pagination}
159
+ loadMoreOrders={loadMoreOrders}
160
+ getOrderStatus={getOrderStatus}
161
+ onNavigationRedirect={onNavigationRedirect}
162
+ handleReorder={handleReorder}
163
+ />
164
+ )
143
165
  )}
144
- {!loading && orders.length === 0 && !isLoadingFirstRender && ordersLength.previousOrdersLength === 0 && (
166
+ {!loading &&
167
+ !isLoadingFirstRender &&
168
+ ordersLength[activeOrders ? 'activeOrdersLength' : 'previousOrdersLength'] === 0 &&
169
+ (
145
170
  <NotFoundSource
146
171
  content={t('NO_RESULTS_FOUND', 'Sorry, no results found')}
147
172
  image={imageFails}
@@ -179,34 +204,7 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
179
204
  )}
180
205
  </>
181
206
  )}
182
- {!loading && !error && orders.length > 0 && !isLoadingFirstRender && (
183
- activeOrders ? (
184
- <ActiveOrders
185
- orders={ordersFiltered}
186
- pagination={pagination}
187
- loadMoreOrders={loadMoreOrders}
188
- reorderLoading={reorderLoading}
189
- customArray={customArray}
190
- getOrderStatus={getOrderStatus}
191
- onNavigationRedirect={onNavigationRedirect}
192
- setScreen={setScreen}
193
- screen={screen}
194
- isPreorders={filterForOrders === 'preorders'}
195
- preordersLength={orders.filter((order : any) => order.status === 13)?.length}
196
- />
197
- ) : (
198
- <PreviousOrders
199
- reorderLoading={reorderLoading}
200
- orders={ordersFiltered}
201
- pagination={pagination}
202
- loadMoreOrders={loadMoreOrders}
203
- getOrderStatus={getOrderStatus}
204
- onNavigationRedirect={onNavigationRedirect}
205
- handleReorder={handleReorder}
206
- />
207
- )
208
- )}
209
- </>
207
+ </View>
210
208
  )
211
209
  }
212
210