ordering-ui-react-native 0.17.41 → 0.17.42-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 (212) hide show
  1. package/package.json +8 -7
  2. package/src/DeliveryApp.tsx +43 -1
  3. package/src/components/BusinessesListing/index.tsx +1 -1
  4. package/src/components/OrderCreating/index.tsx +1 -21
  5. package/src/components/PaymentOptionsWebView/index.tsx +29 -8
  6. package/src/components/StripeMethodForm/index.tsx +136 -102
  7. package/src/components/VerifyPhone/styles.tsx +1 -2
  8. package/src/components/shared/OToast.tsx +4 -4
  9. package/src/types/index.tsx +5 -0
  10. package/src/utils/index.tsx +7 -1
  11. package/themes/business/index.tsx +2 -0
  12. package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +265 -240
  13. package/themes/business/src/components/AcceptOrRejectOrder/styles.tsx +6 -4
  14. package/themes/business/src/components/BusinessController/index.tsx +0 -1
  15. package/themes/business/src/components/Chat/index.tsx +125 -113
  16. package/themes/business/src/components/DriverMap/index.tsx +17 -6
  17. package/themes/business/src/components/GoogleMap/index.tsx +58 -57
  18. package/themes/business/src/components/LoginForm/Otp/index.tsx +120 -0
  19. package/themes/business/src/components/LoginForm/Otp/styles.tsx +7 -0
  20. package/themes/business/src/components/LoginForm/index.tsx +238 -80
  21. package/themes/business/src/components/LoginForm/styles.tsx +10 -0
  22. package/themes/business/src/components/MapView/index.tsx +10 -10
  23. package/themes/business/src/components/NewOrderNotification/index.tsx +49 -50
  24. package/themes/business/src/components/OrderDetails/Delivery.tsx +4 -3
  25. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +92 -49
  26. package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +59 -62
  27. package/themes/business/src/components/OrderDetailsLogistic/index.tsx +195 -0
  28. package/themes/business/src/components/OrderDetailsLogistic/styles.tsx +5 -0
  29. package/themes/business/src/components/OrderMessage/index.tsx +18 -17
  30. package/themes/business/src/components/OrderSummary/index.tsx +113 -121
  31. package/themes/business/src/components/OrdersOption/index.tsx +32 -75
  32. package/themes/business/src/components/PreviousOrders/OrderItem.tsx +250 -0
  33. package/themes/business/src/components/PreviousOrders/OrdersGroupedItem.tsx +115 -0
  34. package/themes/business/src/components/PreviousOrders/index.tsx +445 -243
  35. package/themes/business/src/components/PreviousOrders/styles.tsx +31 -3
  36. package/themes/business/src/components/ProductItemAccordion/index.tsx +27 -3
  37. package/themes/business/src/components/ReviewCustomer/index.tsx +35 -18
  38. package/themes/business/src/components/StoresList/index.tsx +2 -2
  39. package/themes/business/src/components/shared/OLink.tsx +33 -13
  40. package/themes/business/src/components/shared/OModal.tsx +16 -9
  41. package/themes/business/src/components/shared/OText.tsx +8 -2
  42. package/themes/business/src/types/index.tsx +32 -2
  43. package/themes/business/src/utils/index.tsx +44 -1
  44. package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
  45. package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
  46. package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
  47. package/themes/kiosk/src/components/BusinessesListing/index.tsx +2 -1
  48. package/themes/kiosk/src/components/Checkout/index.tsx +6 -0
  49. package/themes/kiosk/src/components/LoginForm/Otp/index.tsx +92 -0
  50. package/themes/kiosk/src/components/LoginForm/Otp/styles.tsx +7 -0
  51. package/themes/kiosk/src/components/LoginForm/index.tsx +473 -151
  52. package/themes/kiosk/src/components/LoginForm/styles.tsx +14 -1
  53. package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
  54. package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
  55. package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +8 -10
  56. package/themes/kiosk/src/components/PhoneInputNumber/index.tsx +3 -2
  57. package/themes/kiosk/src/components/PhoneInputNumber/styles.tsx +1 -3
  58. package/themes/kiosk/src/components/ProductForm/index.tsx +1 -14
  59. package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
  60. package/themes/kiosk/src/components/shared/OModal.tsx +14 -11
  61. package/themes/kiosk/src/layouts/Container.tsx +7 -1
  62. package/themes/kiosk/src/types/index.d.ts +13 -0
  63. package/themes/kiosk/src/utils/index.tsx +15 -0
  64. package/themes/original/index.tsx +6 -0
  65. package/themes/original/src/components/AddressDetails/index.tsx +29 -11
  66. package/themes/original/src/components/AddressForm/index.tsx +79 -44
  67. package/themes/original/src/components/AddressList/index.tsx +26 -21
  68. package/themes/original/src/components/AddressList/styles.tsx +4 -2
  69. package/themes/original/src/components/AnalyticsSegment/index.tsx +193 -10
  70. package/themes/original/src/components/AppleLogin/index.tsx +4 -4
  71. package/themes/original/src/components/BusinessBasicInformation/index.tsx +159 -90
  72. package/themes/original/src/components/BusinessBasicInformation/styles.tsx +9 -7
  73. package/themes/original/src/components/BusinessController/index.tsx +141 -67
  74. package/themes/original/src/components/BusinessController/styles.tsx +22 -2
  75. package/themes/original/src/components/BusinessFeaturedController/index.tsx +21 -54
  76. package/themes/original/src/components/BusinessFeaturedController/styles.tsx +8 -0
  77. package/themes/original/src/components/BusinessInformation/index.tsx +10 -31
  78. package/themes/original/src/components/BusinessItemAccordion/index.tsx +23 -22
  79. package/themes/original/src/components/BusinessListingSearch/index.tsx +351 -326
  80. package/themes/original/src/components/BusinessPreorder/index.tsx +97 -16
  81. package/themes/original/src/components/BusinessProductsList/index.tsx +20 -11
  82. package/themes/original/src/components/BusinessProductsList/styles.tsx +8 -3
  83. package/themes/original/src/components/BusinessProductsListing/UpsellingRedirect.tsx +1 -1
  84. package/themes/original/src/components/BusinessProductsListing/index.tsx +684 -524
  85. package/themes/original/src/components/BusinessProductsListing/styles.tsx +2 -4
  86. package/themes/original/src/components/BusinessReviews/index.tsx +3 -1
  87. package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +1 -1
  88. package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +106 -79
  89. package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +1 -9
  90. package/themes/original/src/components/BusinessesListing/index.tsx +0 -1
  91. package/themes/original/src/components/Cart/index.tsx +102 -69
  92. package/themes/original/src/components/CartContent/index.tsx +115 -19
  93. package/themes/original/src/components/CartContent/styles.tsx +17 -7
  94. package/themes/original/src/components/Checkout/index.tsx +375 -179
  95. package/themes/original/src/components/Checkout/styles.tsx +4 -2
  96. package/themes/original/src/components/CitiesControl/index.tsx +89 -0
  97. package/themes/original/src/components/CitiesControl/styles.tsx +17 -0
  98. package/themes/original/src/components/CouponControl/index.tsx +10 -3
  99. package/themes/original/src/components/DriverTips/index.tsx +52 -34
  100. package/themes/original/src/components/Favorite/index.tsx +8 -9
  101. package/themes/original/src/components/Favorite/styles.tsx +1 -1
  102. package/themes/original/src/components/FavoriteList/index.tsx +51 -80
  103. package/themes/original/src/components/FloatingButton/index.tsx +1 -2
  104. package/themes/original/src/components/FloatingButton/styles.tsx +1 -1
  105. package/themes/original/src/components/GPSButton/index.tsx +6 -4
  106. package/themes/original/src/components/GPSButton/styles.ts +3 -3
  107. package/themes/original/src/components/GiftCard/GiftCardUI/index.tsx +96 -0
  108. package/themes/original/src/components/GiftCard/GiftCardUI/styles.tsx +5 -0
  109. package/themes/original/src/components/GiftCard/PurchaseGiftCard/index.tsx +100 -0
  110. package/themes/original/src/components/GiftCard/PurchaseGiftCard/styles.tsx +8 -0
  111. package/themes/original/src/components/GiftCard/RedeemGiftCard/index.tsx +191 -0
  112. package/themes/original/src/components/GiftCard/RedeemGiftCard/styles.tsx +8 -0
  113. package/themes/original/src/components/GiftCard/SendGiftCard/index.tsx +165 -0
  114. package/themes/original/src/components/GiftCard/SendGiftCard/styles.tsx +9 -0
  115. package/themes/original/src/components/GoogleMap/index.tsx +15 -4
  116. package/themes/original/src/components/Help/index.tsx +8 -8
  117. package/themes/original/src/components/HelpAccountAndPayment/index.tsx +11 -22
  118. package/themes/original/src/components/HelpAccountAndPayment/styles.tsx +6 -0
  119. package/themes/original/src/components/HelpGuide/index.tsx +12 -16
  120. package/themes/original/src/components/HelpGuide/styles.tsx +6 -0
  121. package/themes/original/src/components/HelpOrder/index.tsx +12 -25
  122. package/themes/original/src/components/HelpOrder/styles.tsx +8 -1
  123. package/themes/original/src/components/Home/index.tsx +13 -4
  124. package/themes/original/src/components/LastOrder/index.tsx +1 -34
  125. package/themes/original/src/components/LoginForm/Otp/index.tsx +139 -75
  126. package/themes/original/src/components/LoginForm/Otp/styles.tsx +0 -1
  127. package/themes/original/src/components/LoginForm/index.tsx +71 -28
  128. package/themes/original/src/components/LottieAnimation/index.tsx +89 -55
  129. package/themes/original/src/components/MessageListing/index.tsx +16 -42
  130. package/themes/original/src/components/Messages/index.tsx +32 -10
  131. package/themes/original/src/components/MomentOption/index.tsx +195 -88
  132. package/themes/original/src/components/MultiCart/index.tsx +50 -0
  133. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +151 -49
  134. package/themes/original/src/components/MultiCheckout/index.tsx +308 -88
  135. package/themes/original/src/components/MultiCheckout/styles.tsx +3 -1
  136. package/themes/original/src/components/MultiOrdersDetails/SingleOrderCard.tsx +37 -224
  137. package/themes/original/src/components/MultiOrdersDetails/index.tsx +68 -21
  138. package/themes/original/src/components/MultiOrdersDetails/styles.tsx +1 -1
  139. package/themes/original/src/components/MyOrders/index.tsx +53 -51
  140. package/themes/original/src/components/NavBar/index.tsx +18 -18
  141. package/themes/original/src/components/NotFoundSource/index.tsx +14 -10
  142. package/themes/original/src/components/Notifications/index.tsx +46 -50
  143. package/themes/original/src/components/Notifications/styles.tsx +6 -3
  144. package/themes/original/src/components/OrderDetails/OrderEta.tsx +76 -0
  145. package/themes/original/src/components/OrderDetails/OrderHistory.tsx +15 -3
  146. package/themes/original/src/components/OrderDetails/index.tsx +199 -359
  147. package/themes/original/src/components/OrderDetails/styles.tsx +0 -1
  148. package/themes/original/src/components/OrderItAgain/index.tsx +3 -1
  149. package/themes/original/src/components/OrderProgress/index.tsx +93 -114
  150. package/themes/original/src/components/OrderProgress/styles.tsx +5 -0
  151. package/themes/original/src/components/OrderSummary/index.tsx +87 -59
  152. package/themes/original/src/components/OrderTypeSelector/index.tsx +1 -1
  153. package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/index.tsx +24 -19
  154. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/index.tsx +14 -14
  155. package/themes/original/src/components/OrdersOption/index.tsx +70 -65
  156. package/themes/original/src/components/OrdersOption/styles.tsx +1 -1
  157. package/themes/original/src/components/PageBanner/index.tsx +171 -0
  158. package/themes/original/src/components/PageBanner/styles.tsx +11 -0
  159. package/themes/original/src/components/PaymentOptionCard/index.tsx +180 -0
  160. package/themes/original/src/components/PaymentOptionStripe/styles.tsx +1 -1
  161. package/themes/original/src/components/PaymentOptionWallet/index.tsx +56 -56
  162. package/themes/original/src/components/PaymentOptions/index.tsx +64 -7
  163. package/themes/original/src/components/PhoneInputNumber/index.tsx +4 -4
  164. package/themes/original/src/components/PlaceSpot/index.tsx +12 -6
  165. package/themes/original/src/components/ProductForm/index.tsx +116 -37
  166. package/themes/original/src/components/ProductForm/styles.tsx +5 -7
  167. package/themes/original/src/components/ProductItemAccordion/index.tsx +14 -13
  168. package/themes/original/src/components/ProductOptionSubOption/index.tsx +19 -11
  169. package/themes/original/src/components/ProductOptionSubOption/styles.tsx +1 -2
  170. package/themes/original/src/components/ProfessionalFilter/SingleProfessionalCard/index.tsx +108 -0
  171. package/themes/original/src/components/ProfessionalFilter/index.tsx +20 -50
  172. package/themes/original/src/components/ProfessionalProfile/index.tsx +36 -7
  173. package/themes/original/src/components/Promotions/index.tsx +234 -220
  174. package/themes/original/src/components/Promotions/styles.tsx +10 -3
  175. package/themes/original/src/components/ReviewDriver/index.tsx +3 -3
  176. package/themes/original/src/components/ReviewOrder/index.tsx +26 -9
  177. package/themes/original/src/components/ReviewOrder/styles.tsx +7 -0
  178. package/themes/original/src/components/ReviewProducts/index.tsx +23 -11
  179. package/themes/original/src/components/ReviewTrigger/index.tsx +27 -9
  180. package/themes/original/src/components/ReviewTrigger/styles.tsx +8 -1
  181. package/themes/original/src/components/ScheduleAccordion/index.tsx +68 -0
  182. package/themes/original/src/components/ScheduleAccordion/styles.tsx +14 -0
  183. package/themes/original/src/components/ServiceForm/index.tsx +74 -19
  184. package/themes/original/src/components/Sessions/index.tsx +11 -8
  185. package/themes/original/src/components/Sessions/styles.tsx +5 -0
  186. package/themes/original/src/components/SignupForm/index.tsx +42 -19
  187. package/themes/original/src/components/SingleOrderCard/index.tsx +130 -52
  188. package/themes/original/src/components/SingleOrderCard/styles.tsx +11 -2
  189. package/themes/original/src/components/SingleProductCard/index.tsx +72 -34
  190. package/themes/original/src/components/SingleProductCard/styles.tsx +22 -4
  191. package/themes/original/src/components/SingleProductReview/styles.tsx +1 -1
  192. package/themes/original/src/components/StripeCardsList/index.tsx +13 -3
  193. package/themes/original/src/components/StripeElementsForm/index.tsx +28 -15
  194. package/themes/original/src/components/UpsellingProducts/index.tsx +238 -224
  195. package/themes/original/src/components/UpsellingProducts/styles.tsx +12 -1
  196. package/themes/original/src/components/UserDetails/index.tsx +8 -4
  197. package/themes/original/src/components/UserFormDetails/index.tsx +47 -7
  198. package/themes/original/src/components/UserProfile/index.tsx +5 -7
  199. package/themes/original/src/components/UserProfileForm/index.tsx +25 -28
  200. package/themes/original/src/components/UserProfileForm/styles.tsx +7 -0
  201. package/themes/original/src/components/WalletTransactionItem/index.tsx +2 -2
  202. package/themes/original/src/components/WalletTransactions/index.tsx +3 -3
  203. package/themes/original/src/components/Wallets/index.tsx +67 -24
  204. package/themes/original/src/components/Wallets/styles.tsx +5 -4
  205. package/themes/original/src/components/shared/HeaderTitle.tsx +8 -3
  206. package/themes/original/src/components/shared/OButton.tsx +6 -2
  207. package/themes/original/src/components/shared/OInput.tsx +16 -2
  208. package/themes/original/src/components/shared/OModal.tsx +3 -3
  209. package/themes/original/src/layouts/Container.tsx +1 -1
  210. package/themes/original/src/types/index.tsx +38 -9
  211. package/themes/original/src/utils/index.tsx +364 -58
  212. 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) {
@@ -209,6 +227,31 @@ const LoginFormUI = (props: LoginParams) => {
209
227
  handleSubmit(onSubmit)();
210
228
  };
211
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
+
212
255
  const onSubmit = (values: any) => {
213
256
  Keyboard.dismiss();
214
257
 
@@ -227,13 +270,26 @@ const LoginFormUI = (props: LoginParams) => {
227
270
  setSubmitted(true)
228
271
  return
229
272
  }
230
-
231
- handleButtonLoginClick({
232
- ...values,
233
- ...phoneInputData.phone
234
- });
273
+ mainLogin(values)
235
274
  };
236
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
+
237
293
  const handleVerifyCodeClick = () => {
238
294
  if (phoneInputData.error) {
239
295
  showToast(ToastType.Error, phoneInputData.error);
@@ -272,27 +328,17 @@ const LoginFormUI = (props: LoginParams) => {
272
328
  showToast(ToastType.Info, t('TRY_AGAIN', 'Please try again'))
273
329
  return
274
330
  }
275
- formState?.result?.result &&
276
- showToast(
277
- ToastType.Error,
278
- loginTab === 'email' && typeof formState.result?.result === 'string'
279
- ? getTraduction(formState.result?.result)
280
- : loginTab === 'email' &&
281
- typeof formState.result?.result !== 'string'
282
- ? getTraduction(formState.result?.result[0])
283
- : loginTab === 'cellphone' &&
284
- typeof formState.result?.result === 'string'
285
- ? getTraduction(formState.result?.result).replace(
286
- t('USER', 'user').toLowerCase(),
287
- t('PHONE_NUMER', 'Phone number'),
288
- )
289
- : getTraduction(formState.result?.result[0]).replace(
290
- t('USER', 'user').toLowerCase(),
291
- t('PHONE_NUMER', 'Phone number'),
292
- ),
293
- );
331
+ formState.result?.result && showToast(
332
+ ToastType.Error,
333
+ typeof formState.result?.result === 'string'
334
+ ? formState.result?.result
335
+ : formState.result?.result[0]
336
+ )
294
337
  setSubmitted(false)
295
338
  }
339
+ if (!formState?.loading && !formState?.result?.error) {
340
+ setWillVerifyOtpState(false)
341
+ }
296
342
  }, [formState]);
297
343
 
298
344
  useEffect(() => {
@@ -360,9 +406,20 @@ const LoginFormUI = (props: LoginParams) => {
360
406
  if (values?.project_name) {
361
407
  delete values.project_name
362
408
  }
363
- handleButtonLoginClick({ ...values })
409
+ mainLogin(values)
410
+ setSubmitted(false)
364
411
  }, [ordering, submitted])
365
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
+
366
423
  Dimensions.addEventListener('change', ({ window: { width, height } }) => {
367
424
  setWindowWidth(
368
425
  parseInt(parseFloat(String(Dimensions.get('window').width)).toFixed(0)),
@@ -419,6 +476,8 @@ const LoginFormUI = (props: LoginParams) => {
419
476
  borderRadius: 7.6,
420
477
  borderColor: theme.colors.inputSignup,
421
478
  backgroundColor: theme.colors.transparent,
479
+ minHeight: 50,
480
+ maxHeight : 50
422
481
  },
423
482
  btn: {
424
483
  borderRadius: 7.6,
@@ -445,6 +504,25 @@ const LoginFormUI = (props: LoginParams) => {
445
504
  fontWeight: 'normal',
446
505
  fontSize: 16,
447
506
  },
507
+
508
+ borderStyleBase: {
509
+ width: 30,
510
+ height: 45
511
+ },
512
+ borderStyleHighLighted: {
513
+ borderColor: "#03DAC6",
514
+ },
515
+ underlineStyleBase: {
516
+ width: 45,
517
+ height: 60,
518
+ borderWidth: 1,
519
+ fontSize: 16
520
+ },
521
+ underlineStyleHighLighted: {
522
+ borderColor: theme.colors.primary,
523
+ color: theme.colors.primary,
524
+ fontSize: 16
525
+ },
448
526
  });
449
527
 
450
528
  return (
@@ -461,7 +539,7 @@ const LoginFormUI = (props: LoginParams) => {
461
539
  <OText style={styles.title}>{t('LOGIN', 'Login')}</OText>
462
540
  </View>
463
541
 
464
- {(useLoginByEmail || useLoginByCellphone) && (
542
+ {(Number(useLoginByEmail) + Number(useLoginByCellphone) + Number(useLoginOtpEmail) + Number(useLoginOtpCellphone) > 1) && (
465
543
  <LoginWith>
466
544
  <ScrollView
467
545
  ref={scrollRefTab}
@@ -522,12 +600,63 @@ const LoginFormUI = (props: LoginParams) => {
522
600
  }}></View>
523
601
  </Pressable>
524
602
  )}
603
+
604
+ {useLoginOtpEmail && (
605
+ <Pressable
606
+ style={styles.btnTab}
607
+ onPress={() => handleChangeOtpType('email')}>
608
+ <OText
609
+ style={styles.btnTabText}
610
+ color={
611
+ isOtpEmail
612
+ ? theme.colors.textNormal
613
+ : theme.colors.disabled
614
+ }
615
+ weight={isOtpEmail ? 'bold' : 'normal'}>
616
+ {t('BY_OTP_EMAIL', 'By Otp Email')}
617
+ </OText>
618
+ <View
619
+ style={{
620
+ width: '100%',
621
+ borderBottomColor:
622
+ isOtpEmail
623
+ ? theme.colors.textGray
624
+ : theme.colors.tabBar,
625
+ borderBottomWidth: 2,
626
+ }} />
627
+ </Pressable>
628
+ )}
629
+ {useLoginOtpCellphone && (
630
+ <Pressable
631
+ style={styles.btnTab}
632
+ onPress={() => handleChangeOtpType('cellphone')}>
633
+ <OText
634
+ style={styles.btnTabText}
635
+ color={
636
+ isOtpCellphone
637
+ ? theme.colors.textNormal
638
+ : theme.colors.disabled
639
+ }
640
+ weight={isOtpCellphone ? 'bold' : 'normal'}>
641
+ {t('BY_OTP_PHONE', 'By Otp Phone')}
642
+ </OText>
643
+ <View
644
+ style={{
645
+ width: '100%',
646
+ borderBottomColor:
647
+ isOtpCellphone
648
+ ? theme.colors.textGray
649
+ : theme.colors.tabBar,
650
+ borderBottomWidth: 2,
651
+ }} />
652
+ </Pressable>
653
+ )}
525
654
  </TabsContainer>
526
655
  </ScrollView>
527
656
  </LoginWith>
528
657
  )}
529
658
 
530
- {(useLoginByCellphone || useLoginByEmail) && (
659
+ {(useLoginByCellphone || useLoginByEmail || useLoginOtp) && (
531
660
  <FormInput>
532
661
  {useRootPoint && (
533
662
  <Controller
@@ -561,7 +690,7 @@ const LoginFormUI = (props: LoginParams) => {
561
690
  />
562
691
  )}
563
692
 
564
- {useLoginByEmail && loginTab === 'email' && (
693
+ {((useLoginByEmail && loginTab === 'email') || (loginTab === 'otp' && otpType === 'email')) && (
565
694
  <Controller
566
695
  control={control}
567
696
  render={({ onChange, value }: any) => (
@@ -606,7 +735,7 @@ const LoginFormUI = (props: LoginParams) => {
606
735
  />
607
736
  )}
608
737
 
609
- {useLoginByCellphone && loginTab === 'cellphone' && (
738
+ {((useLoginByCellphone && loginTab === 'cellphone') || (loginTab === 'otp' && otpType === 'cellphone')) && (
610
739
  <View style={{ marginBottom: 20 }}>
611
740
  <PhoneInputNumber
612
741
  data={phoneInputData}
@@ -621,54 +750,56 @@ const LoginFormUI = (props: LoginParams) => {
621
750
  </View>
622
751
  )}
623
752
 
624
- <Controller
625
- control={control}
626
- render={({ onChange, value }: any) => (
627
- <OInput
628
- isSecured={!passwordSee ? true : false}
629
- placeholder={t('PASSWORD', 'Password')}
630
- placeholderTextColor={theme.colors.arrowColor}
631
- style={styles.input}
632
- icon={theme.images.logos.passwordInputIcon}
633
- iconColor={theme.colors.arrowColor}
634
- iconCustomRight={
635
- !passwordSee ? (
636
- <MaterialCommunityIcons
637
- name="eye-outline"
638
- size={24}
639
- color={theme.colors.arrowColor}
640
- onPress={() => setPasswordSee(!passwordSee)}
641
- />
642
- ) : (
643
- <MaterialCommunityIcons
644
- name="eye-off-outline"
645
- size={24}
646
- color={theme.colors.arrowColor}
647
- onPress={() => setPasswordSee(!passwordSee)}
648
- />
649
- )
650
- }
651
- selectionColor={theme.colors.primary}
652
- color={theme.colors.textGray}
653
- value={value}
654
- forwardRef={inputRef}
655
- onChange={(val: any) => onChange(val)}
656
- returnKeyType="done"
657
- onSubmitEditing={() => handleLogin()}
658
- blurOnSubmit
659
- />
660
- )}
661
- name="password"
662
- rules={{
663
- required: t(
664
- 'VALIDATION_ERROR_PASSWORD_REQUIRED',
665
- 'The field Password is required',
666
- ).replace('_attribute_', t('PASSWORD', 'Password')),
667
- }}
668
- defaultValue=""
669
- />
753
+ {loginTab !== 'otp' && (
754
+ <Controller
755
+ control={control}
756
+ render={({ onChange, value }: any) => (
757
+ <OInput
758
+ isSecured={!passwordSee ? true : false}
759
+ placeholder={t('PASSWORD', 'Password')}
760
+ placeholderTextColor={theme.colors.arrowColor}
761
+ style={styles.input}
762
+ icon={theme.images.logos.passwordInputIcon}
763
+ iconColor={theme.colors.arrowColor}
764
+ iconCustomRight={
765
+ !passwordSee ? (
766
+ <MaterialCommunityIcons
767
+ name="eye-outline"
768
+ size={24}
769
+ color={theme.colors.arrowColor}
770
+ onPress={() => setPasswordSee(!passwordSee)}
771
+ />
772
+ ) : (
773
+ <MaterialCommunityIcons
774
+ name="eye-off-outline"
775
+ size={24}
776
+ color={theme.colors.arrowColor}
777
+ onPress={() => setPasswordSee(!passwordSee)}
778
+ />
779
+ )
780
+ }
781
+ selectionColor={theme.colors.primary}
782
+ color={theme.colors.textGray}
783
+ value={value}
784
+ forwardRef={inputRef}
785
+ onChange={(val: any) => onChange(val)}
786
+ returnKeyType="done"
787
+ onSubmitEditing={() => handleLogin()}
788
+ blurOnSubmit
789
+ />
790
+ )}
791
+ name="password"
792
+ rules={{
793
+ required: t(
794
+ 'VALIDATION_ERROR_PASSWORD_REQUIRED',
795
+ 'The field Password is required',
796
+ ).replace('_attribute_', t('PASSWORD', 'Password')),
797
+ }}
798
+ defaultValue=""
799
+ />
800
+ )}
670
801
 
671
- {onNavigationRedirect && (
802
+ {onNavigationRedirect && loginTab !== 'otp' && (
672
803
  <Pressable
673
804
  style={{ marginRight: 'auto', marginBottom: 20 }}
674
805
  onPress={() => onNavigationRedirect('Forgot')}>
@@ -723,7 +854,7 @@ const LoginFormUI = (props: LoginParams) => {
723
854
  )}
724
855
  <OButton
725
856
  onClick={handleLogin}
726
- text={t('LOGIN', 'Login')}
857
+ text={loginTab !== 'otp' ? t('LOGIN', 'Login') : t('GET_VERIFY_CODE', 'Get verify code')}
727
858
  bgColor={theme.colors.primary}
728
859
  borderColor={theme.colors.primary}
729
860
  textStyle={styles.btnText}
@@ -763,7 +894,10 @@ const LoginFormUI = (props: LoginParams) => {
763
894
  </>
764
895
  )}
765
896
 
766
- <OModal open={isModalVisible} onClose={() => setIsModalVisible(false)}>
897
+ <OModal
898
+ open={isModalVisible}
899
+ onClose={() => setIsModalVisible(false)}
900
+ >
767
901
  <VerifyPhone
768
902
  phone={phoneInputData.phone}
769
903
  verifyPhoneState={verifyPhoneState}
@@ -773,6 +907,29 @@ const LoginFormUI = (props: LoginParams) => {
773
907
  handleVerifyCodeClick={handleVerifyCodeClick}
774
908
  />
775
909
  </OModal>
910
+ <OModal
911
+ open={willVerifyOtpState}
912
+ onClose={() => setWillVerifyOtpState(false)}
913
+ entireModal
914
+ hideIcons
915
+ title={t('ENTER_VERIFICATION_CODE', 'Enter verification code')}
916
+ >
917
+ <Otp
918
+ willVerifyOtpState={willVerifyOtpState}
919
+ setWillVerifyOtpState={setWillVerifyOtpState}
920
+ handleLoginOtp={handleLoginOtp}
921
+ onSubmit={handleLogin}
922
+ setAlertState={setAlertState}
923
+ formState={formState}
924
+ />
925
+ </OModal>
926
+ <Alert
927
+ open={alertState.open}
928
+ content={alertState.content}
929
+ title={alertState.title || ''}
930
+ onAccept={closeAlert}
931
+ onClose={closeAlert}
932
+ />
776
933
  </View>
777
934
  );
778
935
  };
@@ -786,3 +943,4 @@ export const LoginForm = (props: any) => {
786
943
 
787
944
  return <LoginFormController {...loginProps} />;
788
945
  };
946
+
@@ -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
+ `;
@@ -42,7 +42,7 @@ const MapViewComponent = (props: MapViewParams) => {
42
42
  followUserLocation
43
43
  } = useLocation();
44
44
 
45
- const location = { lat: userLocation.latitude, lng: userLocation.longitude }
45
+ const location = { lat: userLocation?.latitude, lng: userLocation?.longitude }
46
46
  const haveOrders = Object.values(markerGroups)?.length > 0 && Object.values(customerMarkerGroups)?.length > 0
47
47
  const closeAlert = () => {
48
48
  setAlertState({
@@ -57,8 +57,8 @@ const MapViewComponent = (props: MapViewParams) => {
57
57
  [
58
58
  { latitude: location.latitude, longitude: location.longitude },
59
59
  {
60
- latitude: userLocation.latitude,
61
- longitude: userLocation.longitude,
60
+ latitude: userLocation?.latitude,
61
+ longitude: userLocation?.longitude,
62
62
  },
63
63
  ],
64
64
  {
@@ -103,7 +103,7 @@ const MapViewComponent = (props: MapViewParams) => {
103
103
  return () => {
104
104
  stopFollowUserLocation();
105
105
  };
106
- }, []);
106
+ }, [isFocused]);
107
107
 
108
108
  useFocusEffect(
109
109
  useCallback(() => {
@@ -213,10 +213,10 @@ const MapViewComponent = (props: MapViewParams) => {
213
213
  }
214
214
 
215
215
  useEffect(() => {
216
- if (userLocation.latitude !== 0 && userLocation.longitude !== 0) {
216
+ if (userLocation?.latitude !== 0 && userLocation?.longitude !== 0) {
217
217
  const location = {
218
- lat: userLocation.latitude,
219
- lng: userLocation.longitude
218
+ lat: userLocation?.latitude,
219
+ lng: userLocation?.longitude
220
220
  }
221
221
  setDriverLocation({ location })
222
222
  }
@@ -231,8 +231,8 @@ const MapViewComponent = (props: MapViewParams) => {
231
231
  ref={mapRef}
232
232
  provider={PROVIDER_GOOGLE}
233
233
  initialRegion={{
234
- latitude: initialPosition.latitude,
235
- longitude: initialPosition.longitude,
234
+ latitude: initialPosition?.latitude,
235
+ longitude: initialPosition?.longitude,
236
236
  latitudeDelta: haveOrders ? 0.01 : 0.1,
237
237
  longitudeDelta: haveOrders ? 0.01 * ASPECT_RATIO : 0.1 * ASPECT_RATIO,
238
238
  }}
@@ -252,7 +252,7 @@ const MapViewComponent = (props: MapViewParams) => {
252
252
  orderIds={marker.map((order: any) => order.id).join(', ')}
253
253
  />
254
254
  ))}
255
- {Object.values(customerMarkerGroups).map((marker: any) => (
255
+ {Object.values(customerMarkerGroups).map((marker: any) => (
256
256
  <RenderMarker
257
257
  key={marker[0]?.customer_id}
258
258
  marker={marker[0]}