ordering-ui-react-native 0.16.83 → 0.16.84-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 (219) hide show
  1. package/package.json +5 -5
  2. package/src/DeliveryApp.tsx +43 -1
  3. package/src/components/ActiveOrders/styles.tsx +8 -14
  4. package/src/components/BusinessInformation/index.tsx +19 -4
  5. package/src/components/BusinessInformation/styles.tsx +2 -2
  6. package/src/components/BusinessProductsList/index.tsx +10 -10
  7. package/src/components/BusinessesListing/index.tsx +1 -1
  8. package/src/components/LanguageSelector/index.tsx +21 -16
  9. package/src/components/Messages/index.tsx +2 -2
  10. package/src/components/OrderCreating/index.tsx +1 -21
  11. package/src/components/OrdersOption/index.tsx +54 -56
  12. package/src/components/PaymentOptionsWebView/index.tsx +119 -120
  13. package/src/components/SingleProductReview/index.tsx +7 -4
  14. package/src/components/VerifyPhone/styles.tsx +1 -2
  15. package/src/components/shared/OToast.tsx +4 -4
  16. package/src/utils/index.tsx +2 -1
  17. package/themes/business/index.tsx +2 -0
  18. package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +260 -238
  19. package/themes/business/src/components/AcceptOrRejectOrder/styles.tsx +6 -4
  20. package/themes/business/src/components/BusinessController/index.tsx +2 -2
  21. package/themes/business/src/components/Chat/index.tsx +31 -31
  22. package/themes/business/src/components/DriverMap/index.tsx +22 -9
  23. package/themes/business/src/components/GoogleMap/index.tsx +58 -57
  24. package/themes/business/src/components/LoginForm/Otp/index.tsx +120 -0
  25. package/themes/business/src/components/LoginForm/Otp/styles.tsx +7 -0
  26. package/themes/business/src/components/LoginForm/index.tsx +236 -80
  27. package/themes/business/src/components/LoginForm/styles.tsx +10 -0
  28. package/themes/business/src/components/MapView/index.tsx +19 -8
  29. package/themes/business/src/components/MessagesOption/index.tsx +11 -1
  30. package/themes/business/src/components/NewOrderNotification/index.tsx +31 -41
  31. package/themes/business/src/components/OrderDetails/Delivery.tsx +4 -3
  32. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +96 -50
  33. package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +3 -3
  34. package/themes/business/src/components/OrderDetailsLogistic/index.tsx +195 -0
  35. package/themes/business/src/components/OrderDetailsLogistic/styles.tsx +5 -0
  36. package/themes/business/src/components/OrdersOption/index.tsx +63 -73
  37. package/themes/business/src/components/OrdersOption/styles.tsx +5 -1
  38. package/themes/business/src/components/OrdersOptionBusiness/index.tsx +15 -1
  39. package/themes/business/src/components/OrdersOptionCity/index.tsx +15 -1
  40. package/themes/business/src/components/OrdersOptionDate/index.tsx +19 -6
  41. package/themes/business/src/components/OrdersOptionDelivery/index.tsx +15 -1
  42. package/themes/business/src/components/OrdersOptionDriver/index.tsx +15 -1
  43. package/themes/business/src/components/OrdersOptionPaymethod/index.tsx +15 -1
  44. package/themes/business/src/components/OrdersOptionStatus/index.tsx +10 -1
  45. package/themes/business/src/components/PreviousMessages/index.tsx +17 -18
  46. package/themes/business/src/components/PreviousOrders/OrderItem.tsx +250 -0
  47. package/themes/business/src/components/PreviousOrders/OrdersGroupedItem.tsx +115 -0
  48. package/themes/business/src/components/PreviousOrders/index.tsx +447 -247
  49. package/themes/business/src/components/PreviousOrders/styles.tsx +31 -3
  50. package/themes/business/src/components/ProductItemAccordion/index.tsx +27 -3
  51. package/themes/business/src/components/ReviewCustomer/index.tsx +39 -15
  52. package/themes/business/src/components/shared/ODropDown.tsx +42 -8
  53. package/themes/business/src/components/shared/ODropDownCalendar.tsx +36 -7
  54. package/themes/business/src/components/shared/OLink.tsx +33 -13
  55. package/themes/business/src/components/shared/OModal.tsx +16 -9
  56. package/themes/business/src/components/shared/OText.tsx +8 -2
  57. package/themes/business/src/types/index.tsx +35 -3
  58. package/themes/business/src/utils/index.tsx +53 -0
  59. package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
  60. package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
  61. package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
  62. package/themes/kiosk/src/components/BusinessesListing/index.tsx +2 -1
  63. package/themes/kiosk/src/components/Checkout/index.tsx +6 -0
  64. package/themes/kiosk/src/components/LoginForm/Otp/index.tsx +92 -0
  65. package/themes/kiosk/src/components/LoginForm/Otp/styles.tsx +7 -0
  66. package/themes/kiosk/src/components/LoginForm/index.tsx +473 -151
  67. package/themes/kiosk/src/components/LoginForm/styles.tsx +14 -1
  68. package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
  69. package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
  70. package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +8 -10
  71. package/themes/kiosk/src/components/PhoneInputNumber/index.tsx +1 -0
  72. package/themes/kiosk/src/components/PhoneInputNumber/styles.tsx +1 -3
  73. package/themes/kiosk/src/components/ProductForm/index.tsx +1 -14
  74. package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
  75. package/themes/kiosk/src/components/shared/OModal.tsx +14 -11
  76. package/themes/kiosk/src/layouts/Container.tsx +7 -1
  77. package/themes/kiosk/src/types/index.d.ts +13 -0
  78. package/themes/kiosk/src/utils/index.tsx +15 -0
  79. package/themes/original/index.tsx +8 -0
  80. package/themes/original/src/components/AddressDetails/index.tsx +10 -8
  81. package/themes/original/src/components/AddressForm/index.tsx +155 -139
  82. package/themes/original/src/components/AddressList/index.tsx +18 -18
  83. package/themes/original/src/components/AddressList/styles.tsx +4 -2
  84. package/themes/original/src/components/AppleLogin/index.tsx +4 -4
  85. package/themes/original/src/components/BusinessBasicInformation/index.tsx +118 -76
  86. package/themes/original/src/components/BusinessController/index.tsx +101 -70
  87. package/themes/original/src/components/BusinessController/styles.tsx +14 -9
  88. package/themes/original/src/components/BusinessInformation/index.tsx +10 -31
  89. package/themes/original/src/components/BusinessItemAccordion/index.tsx +12 -6
  90. package/themes/original/src/components/BusinessListingSearch/BusinessControllerSkeletons/index.tsx +57 -0
  91. package/themes/original/src/components/BusinessListingSearch/MaxSectionItem/index.tsx +59 -0
  92. package/themes/original/src/components/BusinessListingSearch/MaxSectionItem/styles.tsx +13 -0
  93. package/themes/original/src/components/BusinessListingSearch/index.tsx +102 -155
  94. package/themes/original/src/components/BusinessListingSearch/styles.tsx +10 -12
  95. package/themes/original/src/components/BusinessPreorder/index.tsx +96 -15
  96. package/themes/original/src/components/BusinessProductsList/index.tsx +11 -8
  97. package/themes/original/src/components/BusinessProductsList/styles.tsx +0 -3
  98. package/themes/original/src/components/BusinessProductsListing/index.tsx +564 -495
  99. package/themes/original/src/components/BusinessProductsListing/styles.tsx +13 -12
  100. package/themes/original/src/components/BusinessTypeFilter/index.tsx +3 -2
  101. package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +2 -1
  102. package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +116 -81
  103. package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +1 -9
  104. package/themes/original/src/components/BusinessesListing/index.tsx +6 -6
  105. package/themes/original/src/components/Cart/index.tsx +83 -42
  106. package/themes/original/src/components/CartContent/index.tsx +80 -18
  107. package/themes/original/src/components/CartContent/styles.tsx +11 -1
  108. package/themes/original/src/components/Checkout/index.tsx +74 -86
  109. package/themes/original/src/components/Checkout/styles.tsx +4 -2
  110. package/themes/original/src/components/CitiesControl/index.tsx +89 -0
  111. package/themes/original/src/components/CitiesControl/styles.tsx +17 -0
  112. package/themes/original/src/components/DriverTips/index.tsx +52 -37
  113. package/themes/original/src/components/DriverTips/styles.tsx +2 -1
  114. package/themes/original/src/components/Favorite/index.tsx +7 -4
  115. package/themes/original/src/components/Favorite/styles.tsx +1 -1
  116. package/themes/original/src/components/FavoriteList/index.tsx +70 -80
  117. package/themes/original/src/components/FloatingButton/index.tsx +1 -2
  118. package/themes/original/src/components/FloatingButton/styles.tsx +1 -1
  119. package/themes/original/src/components/GPSButton/index.tsx +20 -19
  120. package/themes/original/src/components/GPSButton/styles.ts +3 -3
  121. package/themes/original/src/components/GoogleMap/index.tsx +10 -1
  122. package/themes/original/src/components/Help/index.tsx +8 -8
  123. package/themes/original/src/components/HelpAccountAndPayment/index.tsx +14 -20
  124. package/themes/original/src/components/HelpAccountAndPayment/styles.tsx +6 -0
  125. package/themes/original/src/components/HelpGuide/index.tsx +13 -12
  126. package/themes/original/src/components/HelpGuide/styles.tsx +6 -0
  127. package/themes/original/src/components/HelpOrder/index.tsx +12 -20
  128. package/themes/original/src/components/HelpOrder/styles.tsx +8 -1
  129. package/themes/original/src/components/LanguageSelector/index.tsx +19 -14
  130. package/themes/original/src/components/LastOrder/index.tsx +1 -34
  131. package/themes/original/src/components/LoginForm/Otp/index.tsx +89 -73
  132. package/themes/original/src/components/LoginForm/Otp/styles.tsx +0 -1
  133. package/themes/original/src/components/LoginForm/index.tsx +28 -8
  134. package/themes/original/src/components/LottieAnimation/index.tsx +78 -0
  135. package/themes/original/src/components/MessageListing/index.tsx +7 -40
  136. package/themes/original/src/components/Messages/index.tsx +42 -26
  137. package/themes/original/src/components/MomentOption/index.tsx +195 -88
  138. package/themes/original/src/components/MultiCart/index.tsx +50 -0
  139. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +92 -93
  140. package/themes/original/src/components/MultiCheckout/index.tsx +179 -77
  141. package/themes/original/src/components/MultiOrdersDetails/SingleOrderCard.tsx +37 -224
  142. package/themes/original/src/components/MultiOrdersDetails/index.tsx +85 -34
  143. package/themes/original/src/components/MultiOrdersDetails/styles.tsx +1 -1
  144. package/themes/original/src/components/MyOrders/index.tsx +66 -17
  145. package/themes/original/src/components/NavBar/index.tsx +7 -6
  146. package/themes/original/src/components/NetworkError/index.tsx +5 -3
  147. package/themes/original/src/components/NotFoundSource/index.tsx +2 -1
  148. package/themes/original/src/components/Notifications/index.tsx +144 -0
  149. package/themes/original/src/components/Notifications/styles.tsx +20 -0
  150. package/themes/original/src/components/OrderDetails/index.tsx +108 -218
  151. package/themes/original/src/components/OrderDetails/styles.tsx +10 -1
  152. package/themes/original/src/components/OrderItAgain/index.tsx +46 -43
  153. package/themes/original/src/components/OrderProgress/index.tsx +82 -106
  154. package/themes/original/src/components/OrderProgress/styles.tsx +5 -0
  155. package/themes/original/src/components/OrderSummary/index.tsx +2 -2
  156. package/themes/original/src/components/OrderTypeSelector/index.tsx +13 -6
  157. package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/index.tsx +93 -97
  158. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/index.tsx +3 -0
  159. package/themes/original/src/components/OrdersOption/index.tsx +83 -91
  160. package/themes/original/src/components/PageBanner/index.tsx +146 -0
  161. package/themes/original/src/components/PageBanner/styles.tsx +11 -0
  162. package/themes/original/src/components/PaymentOptionStripe/styles.tsx +1 -1
  163. package/themes/original/src/components/PaymentOptionWallet/index.tsx +56 -56
  164. package/themes/original/src/components/PaymentOptions/index.tsx +2 -2
  165. package/themes/original/src/components/PhoneInputNumber/index.tsx +1 -1
  166. package/themes/original/src/components/PlaceSpot/index.tsx +12 -6
  167. package/themes/original/src/components/PreviousOrders/index.tsx +3 -2
  168. package/themes/original/src/components/ProductForm/index.tsx +240 -256
  169. package/themes/original/src/components/ProductForm/styles.tsx +5 -8
  170. package/themes/original/src/components/ProductItemAccordion/index.tsx +199 -128
  171. package/themes/original/src/components/ProductOptionSubOption/index.tsx +18 -10
  172. package/themes/original/src/components/ProductOptionSubOption/styles.tsx +1 -2
  173. package/themes/original/src/components/ProfessionalFilter/SingleProfessionalCard/index.tsx +108 -0
  174. package/themes/original/src/components/ProfessionalFilter/index.tsx +20 -49
  175. package/themes/original/src/components/ProfessionalProfile/index.tsx +54 -14
  176. package/themes/original/src/components/Promotions/index.tsx +234 -220
  177. package/themes/original/src/components/Promotions/styles.tsx +7 -2
  178. package/themes/original/src/components/ReviewDriver/index.tsx +3 -3
  179. package/themes/original/src/components/ReviewOrder/index.tsx +43 -11
  180. package/themes/original/src/components/ReviewOrder/styles.tsx +7 -0
  181. package/themes/original/src/components/ReviewProducts/index.tsx +8 -5
  182. package/themes/original/src/components/ReviewTrigger/index.tsx +27 -9
  183. package/themes/original/src/components/ReviewTrigger/styles.tsx +8 -1
  184. package/themes/original/src/components/ScheduleAccordion/index.tsx +68 -0
  185. package/themes/original/src/components/ScheduleAccordion/styles.tsx +14 -0
  186. package/themes/original/src/components/ServiceForm/index.tsx +377 -270
  187. package/themes/original/src/components/Sessions/index.tsx +11 -8
  188. package/themes/original/src/components/Sessions/styles.tsx +5 -0
  189. package/themes/original/src/components/SignupForm/index.tsx +78 -66
  190. package/themes/original/src/components/SingleOrderCard/index.tsx +125 -56
  191. package/themes/original/src/components/SingleOrderCard/styles.tsx +10 -8
  192. package/themes/original/src/components/SingleProductCard/index.tsx +112 -77
  193. package/themes/original/src/components/SingleProductCard/styles.tsx +14 -13
  194. package/themes/original/src/components/SingleProductReview/index.tsx +38 -5
  195. package/themes/original/src/components/SingleProductReview/styles.tsx +12 -0
  196. package/themes/original/src/components/StripeCardsList/index.tsx +1 -1
  197. package/themes/original/src/components/StripeElementsForm/index.tsx +4 -1
  198. package/themes/original/src/components/UpsellingProducts/index.tsx +244 -215
  199. package/themes/original/src/components/UpsellingProducts/styles.tsx +12 -1
  200. package/themes/original/src/components/UserDetails/index.tsx +5 -3
  201. package/themes/original/src/components/UserFormDetails/index.tsx +50 -54
  202. package/themes/original/src/components/UserProfile/index.tsx +58 -35
  203. package/themes/original/src/components/UserProfile/styles.ts +17 -0
  204. package/themes/original/src/components/UserProfileForm/index.tsx +21 -28
  205. package/themes/original/src/components/UserProfileForm/styles.tsx +7 -0
  206. package/themes/original/src/components/WalletTransactions/index.tsx +76 -0
  207. package/themes/original/src/components/WalletTransactions/styles.tsx +13 -0
  208. package/themes/original/src/components/Wallets/index.tsx +177 -164
  209. package/themes/original/src/components/Wallets/styles.tsx +12 -8
  210. package/themes/original/src/components/shared/CardAnimation.tsx +47 -0
  211. package/themes/original/src/components/shared/HeaderTitle.tsx +8 -3
  212. package/themes/original/src/components/shared/OBottomPopup.tsx +1 -1
  213. package/themes/original/src/components/shared/OButton.tsx +9 -4
  214. package/themes/original/src/components/shared/OIcon.tsx +8 -1
  215. package/themes/original/src/components/shared/OInput.tsx +10 -1
  216. package/themes/original/src/layouts/Container.tsx +13 -9
  217. package/themes/original/src/types/index.tsx +42 -7
  218. package/themes/original/src/utils/index.tsx +321 -58
  219. package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
@@ -28,7 +28,9 @@ import {
28
28
  TabsContainer,
29
29
  OrSeparator,
30
30
  LineSeparator,
31
- RecaptchaButton
31
+ RecaptchaButton,
32
+ TabBtn,
33
+ OTab
32
34
  } from './styles';
33
35
  import { _setStoreData } from '../../providers/StoreUtil'
34
36
  import { OText, OButton, OInput, OIconButton, OModal } from '../shared';
@@ -36,6 +38,9 @@ import { PhoneInputNumber } from '../PhoneInputNumber';
36
38
  import { VerifyPhone } from '../VerifyPhone';
37
39
  import { LoginParams } from '../../types';
38
40
 
41
+ import { Otp } from './Otp'
42
+ import Alert from '../../../../../src/providers/AlertProvider'
43
+
39
44
  const LoginFormUI = (props: LoginParams) => {
40
45
  const {
41
46
  navigation,
@@ -54,7 +59,14 @@ const LoginFormUI = (props: LoginParams) => {
54
59
  useRootPoint,
55
60
  notificationState,
56
61
  handleReCaptcha,
57
- enableReCaptcha
62
+ enableReCaptcha,
63
+
64
+ useLoginOtp,
65
+ otpType,
66
+ setOtpType,
67
+ generateOtpCode,
68
+ useLoginOtpEmail,
69
+ useLoginOtpCellphone,
58
70
  } = props;
59
71
 
60
72
  const [ordering, { setOrdering }] = useApi();
@@ -97,6 +109,12 @@ const LoginFormUI = (props: LoginParams) => {
97
109
 
98
110
  const recaptchaRef = useRef<any>({});
99
111
 
112
+ const [willVerifyOtpState, setWillVerifyOtpState] = useState(false)
113
+ const [alertState, setAlertState] = useState({ open: false, title: '', content: [] })
114
+ const isOtpEmail = loginTab === 'otp' && otpType === 'email'
115
+ const isOtpCellphone = loginTab === 'otp' && otpType === 'cellphone'
116
+
117
+
100
118
  const handleOpenRecaptcha = () => {
101
119
  setRecaptchaVerified(false)
102
120
  if (!recaptchaConfig?.siteKey) {
@@ -179,6 +197,7 @@ const LoginFormUI = (props: LoginParams) => {
179
197
  'An error occurred while trying to pay by PayPal',
180
198
  ERROR_ADD_PRODUCT_VERY_FAR_FOR_DELIVERY:
181
199
  'Error adding product, very far for delivery',
200
+ ERROR_AUTH_DRIVER_LOGIN_VALIDATION: 'Error auth driver login validation'
182
201
  };
183
202
 
184
203
  return keyList[key] ? t(key, keyList[key]) : t(key);
@@ -208,6 +227,31 @@ const LoginFormUI = (props: LoginParams) => {
208
227
  handleSubmit(onSubmit)();
209
228
  };
210
229
 
230
+ const mainLogin = (values) => {
231
+ if (loginTab === 'otp') {
232
+ if (phoneInputData.error && (loginTab !== 'otp' || (otpType === 'cellphone' && loginTab === 'otp'))) {
233
+ showToast(ToastType.Error, t('INVALID_PHONE_NUMBER', 'Invalid phone number'));
234
+ return
235
+ }
236
+ if (loginTab === 'otp') {
237
+ generateOtpCode({
238
+ ...values,
239
+ ...phoneInputData.phone
240
+ })
241
+ }
242
+ setWillVerifyOtpState(true)
243
+ } else {
244
+ if (phoneInputData.error) {
245
+ showToast(ToastType.Error, phoneInputData.error);
246
+ return;
247
+ }
248
+ handleButtonLoginClick({
249
+ ...values,
250
+ ...phoneInputData.phone,
251
+ });
252
+ }
253
+ }
254
+
211
255
  const onSubmit = (values: any) => {
212
256
  Keyboard.dismiss();
213
257
 
@@ -226,13 +270,26 @@ const LoginFormUI = (props: LoginParams) => {
226
270
  setSubmitted(true)
227
271
  return
228
272
  }
229
-
230
- handleButtonLoginClick({
231
- ...values,
232
- ...phoneInputData.phone
233
- });
273
+ mainLogin(values)
234
274
  };
235
275
 
276
+ const handleChangeOtpType = (type: string) => {
277
+ handleChangeTab('otp', type)
278
+ setOtpType(type)
279
+ }
280
+
281
+ const handleLoginOtp = (code: string) => {
282
+ handleButtonLoginClick({ code })
283
+ }
284
+
285
+ const closeAlert = () => {
286
+ setAlertState({
287
+ open: false,
288
+ title: '',
289
+ content: []
290
+ })
291
+ }
292
+
236
293
  const handleVerifyCodeClick = () => {
237
294
  if (phoneInputData.error) {
238
295
  showToast(ToastType.Error, phoneInputData.error);
@@ -271,27 +328,17 @@ const LoginFormUI = (props: LoginParams) => {
271
328
  showToast(ToastType.Info, t('TRY_AGAIN', 'Please try again'))
272
329
  return
273
330
  }
274
- formState?.result?.result &&
275
- showToast(
276
- ToastType.Error,
277
- loginTab === 'email' && typeof formState.result?.result === 'string'
278
- ? getTraduction(formState.result?.result)
279
- : loginTab === 'email' &&
280
- typeof formState.result?.result !== 'string'
281
- ? getTraduction(formState.result?.result[0])
282
- : loginTab === 'cellphone' &&
283
- typeof formState.result?.result === 'string'
284
- ? getTraduction(formState.result?.result).replace(
285
- t('USER', 'user').toLowerCase(),
286
- t('PHONE_NUMER', 'Phone number'),
287
- )
288
- : getTraduction(formState.result?.result[0]).replace(
289
- t('USER', 'user').toLowerCase(),
290
- t('PHONE_NUMER', 'Phone number'),
291
- ),
292
- );
331
+ formState.result?.result && showToast(
332
+ ToastType.Error,
333
+ typeof formState.result?.result === 'string'
334
+ ? formState.result?.result
335
+ : formState.result?.result[0]
336
+ )
293
337
  setSubmitted(false)
294
338
  }
339
+ if (!formState?.loading && !formState?.result?.error) {
340
+ setWillVerifyOtpState(false)
341
+ }
295
342
  }, [formState]);
296
343
 
297
344
  useEffect(() => {
@@ -359,9 +406,20 @@ const LoginFormUI = (props: LoginParams) => {
359
406
  if (values?.project_name) {
360
407
  delete values.project_name
361
408
  }
362
- handleButtonLoginClick({ ...values })
409
+ mainLogin(values)
410
+ setSubmitted(false)
363
411
  }, [ordering, submitted])
364
412
 
413
+ useEffect(() => {
414
+ if (checkPhoneCodeState?.result?.error) {
415
+ setAlertState({
416
+ open: true,
417
+ content: t(checkPhoneCodeState?.result?.error, checkPhoneCodeState?.result?.error),
418
+ title: ''
419
+ })
420
+ }
421
+ }, [checkPhoneCodeState])
422
+
365
423
  Dimensions.addEventListener('change', ({ window: { width, height } }) => {
366
424
  setWindowWidth(
367
425
  parseInt(parseFloat(String(Dimensions.get('window').width)).toFixed(0)),
@@ -444,6 +502,25 @@ const LoginFormUI = (props: LoginParams) => {
444
502
  fontWeight: 'normal',
445
503
  fontSize: 16,
446
504
  },
505
+
506
+ borderStyleBase: {
507
+ width: 30,
508
+ height: 45
509
+ },
510
+ borderStyleHighLighted: {
511
+ borderColor: "#03DAC6",
512
+ },
513
+ underlineStyleBase: {
514
+ width: 45,
515
+ height: 60,
516
+ borderWidth: 1,
517
+ fontSize: 16
518
+ },
519
+ underlineStyleHighLighted: {
520
+ borderColor: theme.colors.primary,
521
+ color: theme.colors.primary,
522
+ fontSize: 16
523
+ },
447
524
  });
448
525
 
449
526
  return (
@@ -460,7 +537,7 @@ const LoginFormUI = (props: LoginParams) => {
460
537
  <OText style={styles.title}>{t('LOGIN', 'Login')}</OText>
461
538
  </View>
462
539
 
463
- {(useLoginByEmail || useLoginByCellphone) && (
540
+ {(Number(useLoginByEmail) + Number(useLoginByCellphone) + Number(useLoginOtpEmail) + Number(useLoginOtpCellphone) > 1) && (
464
541
  <LoginWith>
465
542
  <ScrollView
466
543
  ref={scrollRefTab}
@@ -521,12 +598,63 @@ const LoginFormUI = (props: LoginParams) => {
521
598
  }}></View>
522
599
  </Pressable>
523
600
  )}
601
+
602
+ {useLoginOtpEmail && (
603
+ <Pressable
604
+ style={styles.btnTab}
605
+ onPress={() => handleChangeOtpType('email')}>
606
+ <OText
607
+ style={styles.btnTabText}
608
+ color={
609
+ isOtpEmail
610
+ ? theme.colors.textNormal
611
+ : theme.colors.disabled
612
+ }
613
+ weight={isOtpEmail ? 'bold' : 'normal'}>
614
+ {t('BY_OTP_EMAIL', 'By Otp Email')}
615
+ </OText>
616
+ <View
617
+ style={{
618
+ width: '100%',
619
+ borderBottomColor:
620
+ isOtpEmail
621
+ ? theme.colors.textGray
622
+ : theme.colors.tabBar,
623
+ borderBottomWidth: 2,
624
+ }} />
625
+ </Pressable>
626
+ )}
627
+ {useLoginOtpCellphone && (
628
+ <Pressable
629
+ style={styles.btnTab}
630
+ onPress={() => handleChangeOtpType('cellphone')}>
631
+ <OText
632
+ style={styles.btnTabText}
633
+ color={
634
+ isOtpCellphone
635
+ ? theme.colors.textNormal
636
+ : theme.colors.disabled
637
+ }
638
+ weight={isOtpCellphone ? 'bold' : 'normal'}>
639
+ {t('BY_OTP_PHONE', 'By Otp Phone')}
640
+ </OText>
641
+ <View
642
+ style={{
643
+ width: '100%',
644
+ borderBottomColor:
645
+ isOtpCellphone
646
+ ? theme.colors.textGray
647
+ : theme.colors.tabBar,
648
+ borderBottomWidth: 2,
649
+ }} />
650
+ </Pressable>
651
+ )}
524
652
  </TabsContainer>
525
653
  </ScrollView>
526
654
  </LoginWith>
527
655
  )}
528
656
 
529
- {(useLoginByCellphone || useLoginByEmail) && (
657
+ {(useLoginByCellphone || useLoginByEmail || useLoginOtp) && (
530
658
  <FormInput>
531
659
  {useRootPoint && (
532
660
  <Controller
@@ -560,7 +688,7 @@ const LoginFormUI = (props: LoginParams) => {
560
688
  />
561
689
  )}
562
690
 
563
- {useLoginByEmail && loginTab === 'email' && (
691
+ {((useLoginByEmail && loginTab === 'email') || (loginTab === 'otp' && otpType === 'email')) && (
564
692
  <Controller
565
693
  control={control}
566
694
  render={({ onChange, value }: any) => (
@@ -605,7 +733,7 @@ const LoginFormUI = (props: LoginParams) => {
605
733
  />
606
734
  )}
607
735
 
608
- {useLoginByCellphone && loginTab === 'cellphone' && (
736
+ {((useLoginByCellphone && loginTab === 'cellphone') || (loginTab === 'otp' && otpType === 'cellphone')) && (
609
737
  <View style={{ marginBottom: 20 }}>
610
738
  <PhoneInputNumber
611
739
  data={phoneInputData}
@@ -620,54 +748,56 @@ const LoginFormUI = (props: LoginParams) => {
620
748
  </View>
621
749
  )}
622
750
 
623
- <Controller
624
- control={control}
625
- render={({ onChange, value }: any) => (
626
- <OInput
627
- isSecured={!passwordSee ? true : false}
628
- placeholder={t('PASSWORD', 'Password')}
629
- placeholderTextColor={theme.colors.arrowColor}
630
- style={styles.input}
631
- icon={theme.images.logos.passwordInputIcon}
632
- iconColor={theme.colors.arrowColor}
633
- iconCustomRight={
634
- !passwordSee ? (
635
- <MaterialCommunityIcons
636
- name="eye-outline"
637
- size={24}
638
- color={theme.colors.arrowColor}
639
- onPress={() => setPasswordSee(!passwordSee)}
640
- />
641
- ) : (
642
- <MaterialCommunityIcons
643
- name="eye-off-outline"
644
- size={24}
645
- color={theme.colors.arrowColor}
646
- onPress={() => setPasswordSee(!passwordSee)}
647
- />
648
- )
649
- }
650
- selectionColor={theme.colors.primary}
651
- color={theme.colors.textGray}
652
- value={value}
653
- forwardRef={inputRef}
654
- onChange={(val: any) => onChange(val)}
655
- returnKeyType="done"
656
- onSubmitEditing={() => handleLogin()}
657
- blurOnSubmit
658
- />
659
- )}
660
- name="password"
661
- rules={{
662
- required: t(
663
- 'VALIDATION_ERROR_PASSWORD_REQUIRED',
664
- 'The field Password is required',
665
- ).replace('_attribute_', t('PASSWORD', 'Password')),
666
- }}
667
- defaultValue=""
668
- />
751
+ {loginTab !== 'otp' && (
752
+ <Controller
753
+ control={control}
754
+ render={({ onChange, value }: any) => (
755
+ <OInput
756
+ isSecured={!passwordSee ? true : false}
757
+ placeholder={t('PASSWORD', 'Password')}
758
+ placeholderTextColor={theme.colors.arrowColor}
759
+ style={styles.input}
760
+ icon={theme.images.logos.passwordInputIcon}
761
+ iconColor={theme.colors.arrowColor}
762
+ iconCustomRight={
763
+ !passwordSee ? (
764
+ <MaterialCommunityIcons
765
+ name="eye-outline"
766
+ size={24}
767
+ color={theme.colors.arrowColor}
768
+ onPress={() => setPasswordSee(!passwordSee)}
769
+ />
770
+ ) : (
771
+ <MaterialCommunityIcons
772
+ name="eye-off-outline"
773
+ size={24}
774
+ color={theme.colors.arrowColor}
775
+ onPress={() => setPasswordSee(!passwordSee)}
776
+ />
777
+ )
778
+ }
779
+ selectionColor={theme.colors.primary}
780
+ color={theme.colors.textGray}
781
+ value={value}
782
+ forwardRef={inputRef}
783
+ onChange={(val: any) => onChange(val)}
784
+ returnKeyType="done"
785
+ onSubmitEditing={() => handleLogin()}
786
+ blurOnSubmit
787
+ />
788
+ )}
789
+ name="password"
790
+ rules={{
791
+ required: t(
792
+ 'VALIDATION_ERROR_PASSWORD_REQUIRED',
793
+ 'The field Password is required',
794
+ ).replace('_attribute_', t('PASSWORD', 'Password')),
795
+ }}
796
+ defaultValue=""
797
+ />
798
+ )}
669
799
 
670
- {onNavigationRedirect && (
800
+ {onNavigationRedirect && loginTab !== 'otp' && (
671
801
  <Pressable
672
802
  style={{ marginRight: 'auto', marginBottom: 20 }}
673
803
  onPress={() => onNavigationRedirect('Forgot')}>
@@ -722,7 +852,7 @@ const LoginFormUI = (props: LoginParams) => {
722
852
  )}
723
853
  <OButton
724
854
  onClick={handleLogin}
725
- text={t('LOGIN', 'Login')}
855
+ text={loginTab !== 'otp' ? t('LOGIN', 'Login') : t('GET_VERIFY_CODE', 'Get verify code')}
726
856
  bgColor={theme.colors.primary}
727
857
  borderColor={theme.colors.primary}
728
858
  textStyle={styles.btnText}
@@ -762,7 +892,10 @@ const LoginFormUI = (props: LoginParams) => {
762
892
  </>
763
893
  )}
764
894
 
765
- <OModal open={isModalVisible} onClose={() => setIsModalVisible(false)}>
895
+ <OModal
896
+ open={isModalVisible}
897
+ onClose={() => setIsModalVisible(false)}
898
+ >
766
899
  <VerifyPhone
767
900
  phone={phoneInputData.phone}
768
901
  verifyPhoneState={verifyPhoneState}
@@ -772,6 +905,29 @@ const LoginFormUI = (props: LoginParams) => {
772
905
  handleVerifyCodeClick={handleVerifyCodeClick}
773
906
  />
774
907
  </OModal>
908
+ <OModal
909
+ open={willVerifyOtpState}
910
+ onClose={() => setWillVerifyOtpState(false)}
911
+ entireModal
912
+ hideIcons
913
+ title={t('ENTER_VERIFICATION_CODE', 'Enter verification code')}
914
+ >
915
+ <Otp
916
+ willVerifyOtpState={willVerifyOtpState}
917
+ setWillVerifyOtpState={setWillVerifyOtpState}
918
+ handleLoginOtp={handleLoginOtp}
919
+ onSubmit={handleLogin}
920
+ setAlertState={setAlertState}
921
+ formState={formState}
922
+ />
923
+ </OModal>
924
+ <Alert
925
+ open={alertState.open}
926
+ content={alertState.content}
927
+ title={alertState.title || ''}
928
+ onAccept={closeAlert}
929
+ onClose={closeAlert}
930
+ />
775
931
  </View>
776
932
  );
777
933
  };
@@ -52,3 +52,13 @@ export const RecaptchaButton = styled.View`
52
52
  align-items: center;
53
53
  margin-bottom: 10px;
54
54
  `
55
+ export const OTab = styled.View`
56
+ padding-bottom: 10px;
57
+ border-bottom-width: 1px;
58
+ margin-end: 14px;
59
+ `;
60
+
61
+ export const TabBtn = styled.TouchableOpacity`
62
+ min-height: 30px;
63
+ height: 30px;
64
+ `;
@@ -21,6 +21,7 @@ const MapViewComponent = (props: MapViewParams) => {
21
21
  customerMarkerGroups,
22
22
  alertState,
23
23
  setAlertState,
24
+ setDriverLocation,
24
25
  onNavigationRedirect,
25
26
  getBusinessLocations,
26
27
  } = props;
@@ -41,7 +42,7 @@ const MapViewComponent = (props: MapViewParams) => {
41
42
  followUserLocation
42
43
  } = useLocation();
43
44
 
44
- const location = { lat: userLocation.latitude, lng: userLocation.longitude }
45
+ const location = { lat: userLocation?.latitude, lng: userLocation?.longitude }
45
46
  const haveOrders = Object.values(markerGroups)?.length > 0 && Object.values(customerMarkerGroups)?.length > 0
46
47
  const closeAlert = () => {
47
48
  setAlertState({
@@ -56,8 +57,8 @@ const MapViewComponent = (props: MapViewParams) => {
56
57
  [
57
58
  { latitude: location.latitude, longitude: location.longitude },
58
59
  {
59
- latitude: userLocation.latitude,
60
- longitude: userLocation.longitude,
60
+ latitude: userLocation?.latitude,
61
+ longitude: userLocation?.longitude,
61
62
  },
62
63
  ],
63
64
  {
@@ -102,7 +103,7 @@ const MapViewComponent = (props: MapViewParams) => {
102
103
  return () => {
103
104
  stopFollowUserLocation();
104
105
  };
105
- }, []);
106
+ }, [isFocused]);
106
107
 
107
108
  useFocusEffect(
108
109
  useCallback(() => {
@@ -191,7 +192,7 @@ const MapViewComponent = (props: MapViewParams) => {
191
192
  {((customer && marker?.business?.zipcode) || (!customer && marker?.business?.zipcode)) && (
192
193
  <OText>{customer ? marker?.customer?.zipcode : marker?.business?.zipcode}</OText>
193
194
  )}
194
- {customer && marker?.customer?.internal_number && (
195
+ {customer && !!marker?.customer?.internal_number && (
195
196
  <OText>{marker?.customer?.internal_number}</OText>
196
197
  )}
197
198
  <OText textDecorationLine='underline' color={theme.colors.primary}>
@@ -211,6 +212,16 @@ const MapViewComponent = (props: MapViewParams) => {
211
212
  )
212
213
  }
213
214
 
215
+ useEffect(() => {
216
+ if (userLocation?.latitude !== 0 && userLocation?.longitude !== 0) {
217
+ const location = {
218
+ lat: userLocation?.latitude,
219
+ lng: userLocation?.longitude
220
+ }
221
+ setDriverLocation({ location })
222
+ }
223
+ }, [userLocation])
224
+
214
225
  return (
215
226
  <SafeAreaView style={{ flex: 1 }}>
216
227
  <View style={{ flex: 1 }}>
@@ -220,8 +231,8 @@ const MapViewComponent = (props: MapViewParams) => {
220
231
  ref={mapRef}
221
232
  provider={PROVIDER_GOOGLE}
222
233
  initialRegion={{
223
- latitude: initialPosition.latitude,
224
- longitude: initialPosition.longitude,
234
+ latitude: initialPosition?.latitude,
235
+ longitude: initialPosition?.longitude,
225
236
  latitudeDelta: haveOrders ? 0.01 : 0.1,
226
237
  longitudeDelta: haveOrders ? 0.01 * ASPECT_RATIO : 0.1 * ASPECT_RATIO,
227
238
  }}
@@ -241,7 +252,7 @@ const MapViewComponent = (props: MapViewParams) => {
241
252
  orderIds={marker.map((order: any) => order.id).join(', ')}
242
253
  />
243
254
  ))}
244
- {Object.values(customerMarkerGroups).map((marker: any) => (
255
+ {Object.values(customerMarkerGroups).map((marker: any) => (
245
256
  <RenderMarker
246
257
  key={marker[0]?.customer_id}
247
258
  marker={marker[0]}
@@ -5,6 +5,7 @@ import {
5
5
  StyleSheet,
6
6
  Dimensions,
7
7
  ScrollView,
8
+ RefreshControl,
8
9
  } from 'react-native';
9
10
  import { Contacts, useLanguage } from 'ordering-components/native';
10
11
  import { useTheme } from 'styled-components/native';
@@ -24,6 +25,7 @@ const MessagesOptionUI = (props: MessagesOptionParams) => {
24
25
  messages,
25
26
  onNavigationRedirect,
26
27
  setSortBy,
28
+ getOrders
27
29
  } = props;
28
30
 
29
31
  const theme = useTheme();
@@ -55,6 +57,7 @@ const MessagesOptionUI = (props: MessagesOptionParams) => {
55
57
  const [tabsFilter, setTabsFilter] = useState(tabs[0].tags);
56
58
  const [activeTag, setActiveTag] = useState(tags[0].key);
57
59
  const [reload, setReload] = useState(false);
60
+ const [refreshing] = useState(false);
58
61
  const [unreadMessages, setUnreadMessages] = useState(
59
62
  values?.reduce(
60
63
  (total: number, order: any) => total + order.unread_count,
@@ -247,7 +250,14 @@ const MessagesOptionUI = (props: MessagesOptionParams) => {
247
250
  />
248
251
  )}
249
252
 
250
- <ScrollView showsVerticalScrollIndicator={false} style={{ flex: 1 }}>
253
+ <ScrollView
254
+ showsVerticalScrollIndicator={false}
255
+ style={{ flex: 1 }}
256
+ refreshControl={<RefreshControl
257
+ refreshing={refreshing}
258
+ onRefresh={() => getOrders?.()}
259
+ />}
260
+ >
251
261
  {!reload &&
252
262
  !error &&
253
263
  values.length > 0 &&