ordering-ui-react-native 0.15.99 → 0.16.0-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 (234) hide show
  1. package/package.json +8 -3
  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/BusinessTypeFilter/index.tsx +1 -2
  10. package/src/components/BusinessesListing/index.tsx +1 -1
  11. package/src/components/Checkout/index.tsx +2 -1
  12. package/src/components/DriverTips/index.tsx +11 -6
  13. package/src/components/LanguageSelector/index.tsx +21 -16
  14. package/src/components/LoginForm/index.tsx +120 -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 +145 -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/UpsellingProducts/index.tsx +1 -1
  30. package/src/components/UserProfileForm/index.tsx +63 -6
  31. package/src/components/UserProfileForm/styles.tsx +8 -0
  32. package/src/components/VerifyPhone/styles.tsx +1 -2
  33. package/src/components/shared/OBottomPopup.tsx +6 -2
  34. package/src/components/shared/OModal.tsx +1 -1
  35. package/src/index.tsx +2 -0
  36. package/src/navigators/CheckoutNavigator.tsx +6 -0
  37. package/src/navigators/HomeNavigator.tsx +6 -0
  38. package/src/pages/BusinessesListing.tsx +7 -6
  39. package/src/pages/MultiCheckout.tsx +31 -0
  40. package/src/pages/MultiOrdersDetails.tsx +27 -0
  41. package/src/pages/OrderDetails.tsx +1 -1
  42. package/src/pages/ReviewDriver.tsx +2 -2
  43. package/src/pages/ReviewOrder.tsx +2 -2
  44. package/src/theme.json +0 -1
  45. package/src/types/@fatnlazycat/react-native-recaptcha-v3/index.d.ts +1 -0
  46. package/src/types/index.tsx +15 -9
  47. package/src/utils/index.tsx +0 -1
  48. package/themes/business/index.tsx +4 -0
  49. package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +1 -1
  50. package/themes/business/src/components/BusinessController/index.tsx +2 -2
  51. package/themes/business/src/components/Chat/index.tsx +42 -34
  52. package/themes/business/src/components/DriverMap/index.tsx +12 -8
  53. package/themes/business/src/components/DriverSchedule/index.tsx +71 -0
  54. package/themes/business/src/components/DriverSchedule/styles.tsx +6 -0
  55. package/themes/business/src/components/LoginForm/index.tsx +111 -74
  56. package/themes/business/src/components/MapView/index.tsx +1 -1
  57. package/themes/business/src/components/MessagesOption/index.tsx +11 -1
  58. package/themes/business/src/components/OrderDetails/Business.tsx +1 -1
  59. package/themes/business/src/components/OrderDetails/Delivery.tsx +3 -3
  60. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +25 -18
  61. package/themes/business/src/components/OrdersListManager/index.tsx +10 -3
  62. package/themes/business/src/components/OrdersOption/index.tsx +65 -21
  63. package/themes/business/src/components/OrdersOption/styles.tsx +5 -1
  64. package/themes/business/src/components/OrdersOptionBusiness/index.tsx +15 -1
  65. package/themes/business/src/components/OrdersOptionCity/index.tsx +15 -1
  66. package/themes/business/src/components/OrdersOptionDate/index.tsx +19 -6
  67. package/themes/business/src/components/OrdersOptionDelivery/index.tsx +15 -1
  68. package/themes/business/src/components/OrdersOptionDriver/index.tsx +15 -1
  69. package/themes/business/src/components/OrdersOptionPaymethod/index.tsx +15 -1
  70. package/themes/business/src/components/OrdersOptionStatus/index.tsx +10 -1
  71. package/themes/business/src/components/PreviousMessages/index.tsx +17 -18
  72. package/themes/business/src/components/PreviousOrders/index.tsx +21 -23
  73. package/themes/business/src/components/ProductItemAccordion/index.tsx +5 -4
  74. package/themes/business/src/components/ReviewCustomer/index.tsx +1 -1
  75. package/themes/business/src/components/ScheduleBlocked/index.tsx +53 -0
  76. package/themes/business/src/components/UserFormDetails/index.tsx +5 -2
  77. package/themes/business/src/components/UserProfileForm/index.tsx +28 -4
  78. package/themes/business/src/components/shared/ODropDown.tsx +42 -8
  79. package/themes/business/src/components/shared/ODropDownCalendar.tsx +36 -7
  80. package/themes/business/src/components/shared/OModal.tsx +41 -38
  81. package/themes/business/src/types/index.tsx +14 -9
  82. package/themes/business/src/utils/index.tsx +10 -0
  83. package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
  84. package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
  85. package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
  86. package/themes/kiosk/src/components/BusinessMenu/index.tsx +2 -1
  87. package/themes/kiosk/src/components/CartBottomSheet/index.tsx +9 -2
  88. package/themes/kiosk/src/components/CartContent/index.tsx +0 -11
  89. package/themes/kiosk/src/components/CartItem/index.tsx +4 -3
  90. package/themes/kiosk/src/components/CategoriesMenu/index.tsx +70 -31
  91. package/themes/kiosk/src/components/Checkout/index.tsx +18 -3
  92. package/themes/kiosk/src/components/CustomerName/index.tsx +0 -6
  93. package/themes/kiosk/src/components/DrawerView/index.tsx +1 -0
  94. package/themes/kiosk/src/components/DrawerView/styles.tsx +2 -2
  95. package/themes/kiosk/src/components/LoginForm/index.tsx +121 -10
  96. package/themes/kiosk/src/components/LoginForm/styles.tsx +5 -0
  97. package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
  98. package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
  99. package/themes/kiosk/src/components/OrderDetails/index.tsx +2 -2
  100. package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +8 -10
  101. package/themes/kiosk/src/components/PaymentOptions/index.tsx +1 -1
  102. package/themes/kiosk/src/components/ProductForm/index.tsx +6 -7
  103. package/themes/kiosk/src/components/UpsellingProducts/index.tsx +16 -5
  104. package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
  105. package/themes/kiosk/src/types/index.d.ts +3 -0
  106. package/themes/original/index.tsx +22 -0
  107. package/themes/original/src/components/ActiveOrders/index.tsx +15 -132
  108. package/themes/original/src/components/ActiveOrders/styles.tsx +0 -54
  109. package/themes/original/src/components/AddressForm/index.tsx +137 -134
  110. package/themes/original/src/components/AddressList/index.tsx +2 -2
  111. package/themes/original/src/components/AppleLogin/index.tsx +4 -4
  112. package/themes/original/src/components/BusinessBasicInformation/index.tsx +302 -160
  113. package/themes/original/src/components/BusinessBasicInformation/styles.tsx +6 -2
  114. package/themes/original/src/components/BusinessController/index.tsx +179 -96
  115. package/themes/original/src/components/BusinessController/styles.tsx +5 -0
  116. package/themes/original/src/components/BusinessItemAccordion/index.tsx +12 -9
  117. package/themes/original/src/components/BusinessItemAccordion/styles.tsx +3 -1
  118. package/themes/original/src/components/BusinessListingSearch/BusinessControllerSkeletons/index.tsx +57 -0
  119. package/themes/original/src/components/BusinessListingSearch/MaxSectionItem/index.tsx +59 -0
  120. package/themes/original/src/components/BusinessListingSearch/MaxSectionItem/styles.tsx +13 -0
  121. package/themes/original/src/components/BusinessListingSearch/index.tsx +106 -126
  122. package/themes/original/src/components/BusinessListingSearch/styles.tsx +18 -13
  123. package/themes/original/src/components/BusinessPreorder/index.tsx +1 -1
  124. package/themes/original/src/components/BusinessProductsCategories/index.tsx +2 -2
  125. package/themes/original/src/components/BusinessProductsList/CategoryDescription/index.tsx +44 -0
  126. package/themes/original/src/components/BusinessProductsList/SubcategoriesComponent/index.tsx +87 -0
  127. package/themes/original/src/components/BusinessProductsList/SubcategoriesComponent/styles.tsx +12 -0
  128. package/themes/original/src/components/BusinessProductsList/index.tsx +66 -73
  129. package/themes/original/src/components/BusinessProductsList/styles.tsx +0 -3
  130. package/themes/original/src/components/BusinessProductsListing/index.tsx +289 -178
  131. package/themes/original/src/components/BusinessProductsListing/styles.tsx +18 -0
  132. package/themes/original/src/components/BusinessReviews/index.tsx +6 -1
  133. package/themes/original/src/components/BusinessTypeFilter/index.tsx +106 -38
  134. package/themes/original/src/components/BusinessTypeFilter/styles.tsx +2 -0
  135. package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +561 -0
  136. package/themes/original/src/components/BusinessesListing/{styles.tsx → Layout/Appointment/styles.tsx} +24 -2
  137. package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +673 -0
  138. package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +137 -0
  139. package/themes/original/src/components/BusinessesListing/index.tsx +102 -464
  140. package/themes/original/src/components/Cart/index.tsx +82 -37
  141. package/themes/original/src/components/Cart/styles.tsx +4 -0
  142. package/themes/original/src/components/CartContent/index.tsx +22 -16
  143. package/themes/original/src/components/Checkout/index.tsx +107 -67
  144. package/themes/original/src/components/Checkout/styles.tsx +0 -1
  145. package/themes/original/src/components/DriverTips/index.tsx +11 -6
  146. package/themes/original/src/components/Favorite/index.tsx +92 -0
  147. package/themes/original/src/components/Favorite/styles.tsx +22 -0
  148. package/themes/original/src/components/FavoriteList/index.tsx +317 -0
  149. package/themes/original/src/components/FavoriteList/styles.tsx +5 -0
  150. package/themes/original/src/components/GPSButton/index.tsx +25 -17
  151. package/themes/original/src/components/GoogleMap/index.tsx +21 -12
  152. package/themes/original/src/components/HelpAccountAndPayment/index.tsx +8 -3
  153. package/themes/original/src/components/HelpGuide/index.tsx +8 -3
  154. package/themes/original/src/components/HelpOrder/index.tsx +8 -3
  155. package/themes/original/src/components/HighestRatedBusinesses/index.tsx +18 -1
  156. package/themes/original/src/components/LoginForm/Otp/index.tsx +3 -2
  157. package/themes/original/src/components/LoginForm/index.tsx +86 -43
  158. package/themes/original/src/components/Messages/index.tsx +17 -17
  159. package/themes/original/src/components/MomentSelector/index.tsx +197 -0
  160. package/themes/original/src/components/MomentSelector/styles.tsx +6 -0
  161. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +243 -0
  162. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/styles.tsx +46 -0
  163. package/themes/original/src/components/MultiCheckout/index.tsx +304 -0
  164. package/themes/original/src/components/MultiCheckout/styles.tsx +59 -0
  165. package/themes/original/src/components/MultiOrdersDetails/SingleOrderCard.tsx +372 -0
  166. package/themes/original/src/components/MultiOrdersDetails/index.tsx +262 -0
  167. package/themes/original/src/components/MultiOrdersDetails/styles.tsx +50 -0
  168. package/themes/original/src/components/MyOrders/index.tsx +132 -27
  169. package/themes/original/src/components/MyOrders/styles.tsx +8 -1
  170. package/themes/original/src/components/NavBar/index.tsx +11 -5
  171. package/themes/original/src/components/NotFoundSource/index.tsx +2 -1
  172. package/themes/original/src/components/OrderDetails/OrderHistory.tsx +167 -0
  173. package/themes/original/src/components/OrderDetails/index.tsx +136 -57
  174. package/themes/original/src/components/OrderDetails/styles.tsx +5 -2
  175. package/themes/original/src/components/OrderItAgain/index.tsx +73 -0
  176. package/themes/original/src/components/OrderItAgain/styles.tsx +10 -0
  177. package/themes/original/src/components/OrderProgress/index.tsx +8 -2
  178. package/themes/original/src/components/OrderSummary/index.tsx +2 -35
  179. package/themes/original/src/components/OrderTypeSelector/index.tsx +84 -36
  180. package/themes/original/src/components/OrderTypeSelector/styles.tsx +19 -1
  181. package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/index.tsx +140 -0
  182. package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/styles.tsx +6 -0
  183. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/index.tsx +56 -0
  184. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/styles.tsx +6 -0
  185. package/themes/original/src/components/OrdersOption/index.tsx +143 -47
  186. package/themes/original/src/components/OrdersOption/styles.tsx +4 -1
  187. package/themes/original/src/components/PaymentOptionWallet/index.tsx +15 -23
  188. package/themes/original/src/components/PaymentOptions/index.tsx +57 -37
  189. package/themes/original/src/components/PhoneInputNumber/index.tsx +4 -10
  190. package/themes/original/src/components/PlaceSpot/index.tsx +243 -47
  191. package/themes/original/src/components/PlaceSpot/styles.tsx +0 -2
  192. package/themes/original/src/components/PreviousOrders/index.tsx +18 -147
  193. package/themes/original/src/components/ProductForm/index.tsx +697 -649
  194. package/themes/original/src/components/ProductForm/styles.tsx +9 -7
  195. package/themes/original/src/components/ProductItemAccordion/index.tsx +38 -25
  196. package/themes/original/src/components/ProductOption/index.tsx +1 -1
  197. package/themes/original/src/components/ProfessionalFilter/index.tsx +128 -0
  198. package/themes/original/src/components/ProfessionalFilter/styles.tsx +0 -0
  199. package/themes/original/src/components/ProfessionalProfile/index.tsx +298 -0
  200. package/themes/original/src/components/ProfessionalProfile/styles.tsx +46 -0
  201. package/themes/original/src/components/ReviewDriver/index.tsx +6 -6
  202. package/themes/original/src/components/ReviewOrder/index.tsx +18 -3
  203. package/themes/original/src/components/ReviewProducts/index.tsx +1 -1
  204. package/themes/original/src/components/ReviewTrigger/index.tsx +118 -0
  205. package/themes/original/src/components/ReviewTrigger/styles.tsx +34 -0
  206. package/themes/original/src/components/SearchBar/index.tsx +13 -5
  207. package/themes/original/src/components/ServiceForm/index.tsx +579 -0
  208. package/themes/original/src/components/ServiceForm/styles.tsx +50 -0
  209. package/themes/original/src/components/SignupForm/index.tsx +307 -159
  210. package/themes/original/src/components/SingleOrderCard/index.tsx +316 -0
  211. package/themes/original/src/components/SingleOrderCard/styles.tsx +54 -0
  212. package/themes/original/src/components/SingleProductCard/index.tsx +215 -95
  213. package/themes/original/src/components/SingleProductCard/styles.tsx +2 -2
  214. package/themes/original/src/components/SingleProductReview/index.tsx +30 -3
  215. package/themes/original/src/components/SingleProductReview/styles.tsx +12 -0
  216. package/themes/original/src/components/StripeElementsForm/index.tsx +25 -9
  217. package/themes/original/src/components/StripeElementsForm/naked.tsx +2 -2
  218. package/themes/original/src/components/UpsellingProducts/index.tsx +7 -3
  219. package/themes/original/src/components/UserDetails/index.tsx +32 -18
  220. package/themes/original/src/components/UserFormDetails/index.tsx +107 -73
  221. package/themes/original/src/components/UserProfile/index.tsx +4 -0
  222. package/themes/original/src/components/UserProfileForm/index.tsx +15 -10
  223. package/themes/original/src/components/WalletTransactions/index.tsx +76 -0
  224. package/themes/original/src/components/WalletTransactions/styles.tsx +13 -0
  225. package/themes/original/src/components/Wallets/index.tsx +176 -162
  226. package/themes/original/src/components/Wallets/styles.tsx +10 -8
  227. package/themes/original/src/components/shared/OBottomPopup.tsx +47 -14
  228. package/themes/original/src/components/shared/OButton.tsx +10 -3
  229. package/themes/original/src/components/shared/OInput.tsx +3 -2
  230. package/themes/original/src/components/shared/OModal.tsx +4 -2
  231. package/themes/original/src/layouts/FloatingBottomContainer.tsx +5 -1
  232. package/themes/original/src/types/index.tsx +200 -47
  233. package/themes/original/src/utils/index.tsx +77 -0
  234. 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,9 +98,13 @@ 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
 
106
+ const googleLoginEnabled = configs?.google_login_enabled?.value === '1' || !configs?.google_login_enabled?.enabled
107
+
95
108
  const anySocialButtonActivated = ((configs?.facebook_login?.value === 'true' || configs?.facebook_login?.value === '1') && configs?.facebook_id?.value) ||
96
109
  (configs?.google_login_client_id?.value !== '' && configs?.google_login_client_id?.value !== null) ||
97
110
  (configs?.apple_login_client_id?.value !== '' && configs?.apple_login_client_id?.value !== null)
@@ -150,6 +163,40 @@ const LoginFormUI = (props: LoginParams) => {
150
163
  onChange(value.toLowerCase().replace(/[&,()%";:ç?<>{}\\[\]\s]/g, ''))
151
164
  }
152
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
+
153
200
  useEffect(() => {
154
201
  if (!formState.loading && formState.result?.error) {
155
202
  formState.result?.result && showToast(
@@ -315,6 +362,48 @@ const LoginFormUI = (props: LoginParams) => {
315
362
  rules={{ required: t('VALIDATION_ERROR_PASSWORD_REQUIRED', 'The field Password is required').replace('_attribute_', t('PASSWORD', 'Password')) }}
316
363
  defaultValue=""
317
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
+
318
407
  <OButton
319
408
  onClick={handleSubmit(onSubmit)}
320
409
  text={loginButtonText}
@@ -367,13 +456,13 @@ const LoginFormUI = (props: LoginParams) => {
367
456
  }
368
457
 
369
458
  {configs && Object.keys(configs).length > 0 && anySocialButtonActivated && (
370
- <ButtonsWrapper>
371
- <OText size={18} mBottom={10} color={theme.colors.disabled}>
372
- {t('SELECT_AN_OPTION_TO_LOGIN', 'Select an option to login')}
373
- </OText>
374
- <SocialButtons>
375
- {(configs?.facebook_login?.value === 'true' || configs?.facebook_login?.value === '1') &&
376
- 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 && (
377
466
  <FacebookLogin
378
467
  notificationState={notificationState}
379
468
  handleErrors={(err: any) => showToast(ToastType.Error, err)}
@@ -381,26 +470,26 @@ const LoginFormUI = (props: LoginParams) => {
381
470
  handleSuccessFacebookLogin={handleSuccessFacebook}
382
471
  />
383
472
  )}
384
- {(configs?.google_login_client_id?.value !== '' && configs?.google_login_client_id?.value !== null) && (
385
- <GoogleLogin
386
- notificationState={notificationState}
387
- webClientId={configs?.google_login_client_id?.value}
388
- handleErrors={(err: any) => showToast(ToastType.Error, err)}
389
- handleLoading={(val: boolean) => setIsLoadingSocialButton(val)}
390
- handleSuccessGoogleLogin={handleSuccessFacebook}
391
- />
392
- )}
393
- {(configs?.apple_login_client_id?.value !== '' && configs?.apple_login_client_id?.value !== null) && (
394
- <AppleLogin
395
- notificationState={notificationState}
396
- handleErrors={(err: any) => showToast(ToastType.Error, err)}
397
- handleLoading={(val: boolean) => setIsLoadingSocialButton(val)}
398
- handleSuccessApple={handleSuccessApple}
399
- />
400
- )}
401
- </SocialButtons>
402
- </ButtonsWrapper>
403
- )}
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
+ )}
404
493
 
405
494
  {onNavigationRedirect && registerButtonText && (
406
495
  <ButtonsWrapper>
@@ -438,6 +527,7 @@ const LoginFormUI = (props: LoginParams) => {
438
527
  export const LoginForm = (props: any) => {
439
528
  const loginProps = {
440
529
  ...props,
530
+ isRecaptchaEnable: true,
441
531
  UIComponent: LoginFormUI,
442
532
  handleSuccessLogin: () => _removeStoreData('isGuestUser')
443
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