ordering-ui-react-native 0.17.72 → 0.17.73-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 (201) hide show
  1. package/package.json +8 -7
  2. package/src/DeliveryApp.tsx +43 -1
  3. package/src/components/BusinessInformation/index.tsx +10 -9
  4. package/src/components/BusinessesListing/index.tsx +1 -1
  5. package/src/components/OrderCreating/index.tsx +1 -21
  6. package/src/components/PaymentOptionsWebView/index.tsx +29 -8
  7. package/src/components/PhoneInputNumber/index.tsx +6 -2
  8. package/src/components/StripeMethodForm/index.tsx +136 -102
  9. package/src/components/VerifyPhone/styles.tsx +1 -2
  10. package/src/components/shared/OToast.tsx +3 -2
  11. package/src/types/index.tsx +5 -0
  12. package/src/utils/index.tsx +5 -0
  13. package/themes/business/index.tsx +2 -0
  14. package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +28 -24
  15. package/themes/business/src/components/BusinessController/index.tsx +0 -1
  16. package/themes/business/src/components/Chat/index.tsx +149 -118
  17. package/themes/business/src/components/DriverMap/index.tsx +17 -6
  18. package/themes/business/src/components/DriverSchedule/index.tsx +45 -8
  19. package/themes/business/src/components/GoogleMap/index.tsx +58 -57
  20. package/themes/business/src/components/LoginForm/Otp/index.tsx +31 -3
  21. package/themes/business/src/components/LoginForm/index.tsx +15 -22
  22. package/themes/business/src/components/MapView/index.tsx +10 -10
  23. package/themes/business/src/components/MessagesOption/index.tsx +20 -93
  24. package/themes/business/src/components/NewOrderNotification/index.tsx +37 -21
  25. package/themes/business/src/components/NotFoundSource/index.tsx +2 -2
  26. package/themes/business/src/components/OrderDetails/Business.tsx +1 -1
  27. package/themes/business/src/components/OrderDetails/Delivery.tsx +191 -6
  28. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +103 -39
  29. package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +61 -60
  30. package/themes/business/src/components/OrderDetailsLogistic/index.tsx +195 -0
  31. package/themes/business/src/components/OrderDetailsLogistic/styles.tsx +5 -0
  32. package/themes/business/src/components/OrderMessage/index.tsx +19 -18
  33. package/themes/business/src/components/OrderSummary/index.tsx +114 -123
  34. package/themes/business/src/components/OrdersOption/index.tsx +17 -15
  35. package/themes/business/src/components/PreviousMessages/FooterMessageComponent.tsx +103 -0
  36. package/themes/business/src/components/PreviousMessages/index.tsx +97 -55
  37. package/themes/business/src/components/PreviousOrders/OrderItem.tsx +17 -12
  38. package/themes/business/src/components/PreviousOrders/OrderList.tsx +88 -0
  39. package/themes/business/src/components/PreviousOrders/OrdersGroupedItem.tsx +1 -1
  40. package/themes/business/src/components/PreviousOrders/index.tsx +186 -114
  41. package/themes/business/src/components/PreviousOrders/styles.tsx +1 -1
  42. package/themes/business/src/components/ProductItemAccordion/index.tsx +27 -3
  43. package/themes/business/src/components/ReviewCustomer/index.tsx +18 -13
  44. package/themes/business/src/components/StoresList/index.tsx +3 -4
  45. package/themes/business/src/components/UserProfileForm/index.tsx +14 -15
  46. package/themes/business/src/components/shared/OLink.tsx +11 -3
  47. package/themes/business/src/components/shared/OModal.tsx +16 -9
  48. package/themes/business/src/components/shared/OText.tsx +6 -1
  49. package/themes/business/src/types/index.tsx +25 -10
  50. package/themes/business/src/utils/index.tsx +29 -2
  51. package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
  52. package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
  53. package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
  54. package/themes/kiosk/src/components/Checkout/index.tsx +6 -0
  55. package/themes/kiosk/src/components/Intro/index.tsx +16 -1
  56. package/themes/kiosk/src/components/LoginForm/index.tsx +7 -9
  57. package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
  58. package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
  59. package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +8 -10
  60. package/themes/kiosk/src/components/PhoneInputNumber/index.tsx +2 -2
  61. package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
  62. package/themes/original/index.tsx +1 -1
  63. package/themes/original/src/components/AddressDetails/index.tsx +19 -3
  64. package/themes/original/src/components/AddressForm/index.tsx +61 -39
  65. package/themes/original/src/components/AddressList/index.tsx +25 -24
  66. package/themes/original/src/components/AddressList/styles.tsx +4 -2
  67. package/themes/original/src/components/AnalyticsSegment/index.tsx +193 -10
  68. package/themes/original/src/components/AppleLogin/index.tsx +4 -4
  69. package/themes/original/src/components/AppleLogin/styles.tsx +3 -1
  70. package/themes/original/src/components/BusinessBasicInformation/index.tsx +153 -96
  71. package/themes/original/src/components/BusinessBasicInformation/styles.tsx +10 -12
  72. package/themes/original/src/components/BusinessController/index.tsx +80 -66
  73. package/themes/original/src/components/BusinessController/styles.tsx +12 -5
  74. package/themes/original/src/components/BusinessFeaturedController/index.tsx +21 -54
  75. package/themes/original/src/components/BusinessFeaturedController/styles.tsx +8 -0
  76. package/themes/original/src/components/BusinessInformation/index.tsx +139 -85
  77. package/themes/original/src/components/BusinessItemAccordion/index.tsx +15 -20
  78. package/themes/original/src/components/BusinessListingSearch/index.tsx +349 -339
  79. package/themes/original/src/components/BusinessListingSearch/styles.tsx +0 -18
  80. package/themes/original/src/components/BusinessPreorder/index.tsx +103 -19
  81. package/themes/original/src/components/BusinessProductsCategories/index.tsx +1 -2
  82. package/themes/original/src/components/BusinessProductsList/index.tsx +15 -7
  83. package/themes/original/src/components/BusinessProductsList/styles.tsx +8 -3
  84. package/themes/original/src/components/BusinessProductsListing/UpsellingRedirect.tsx +1 -1
  85. package/themes/original/src/components/BusinessProductsListing/index.tsx +684 -557
  86. package/themes/original/src/components/BusinessProductsListing/styles.tsx +2 -2
  87. package/themes/original/src/components/BusinessReviews/index.tsx +3 -1
  88. package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +69 -38
  89. package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +0 -1
  90. package/themes/original/src/components/BusinessesListing/index.tsx +0 -1
  91. package/themes/original/src/components/Cart/index.tsx +77 -79
  92. package/themes/original/src/components/CartContent/index.tsx +117 -20
  93. package/themes/original/src/components/CartContent/styles.tsx +17 -7
  94. package/themes/original/src/components/Checkout/index.tsx +355 -123
  95. package/themes/original/src/components/CitiesControl/index.tsx +1 -1
  96. package/themes/original/src/components/CouponControl/index.tsx +10 -3
  97. package/themes/original/src/components/DriverTips/index.tsx +52 -34
  98. package/themes/original/src/components/FacebookLogin/styles.tsx +3 -1
  99. package/themes/original/src/components/Favorite/index.tsx +2 -6
  100. package/themes/original/src/components/FavoriteList/index.tsx +1 -35
  101. package/themes/original/src/components/FloatingButton/index.tsx +10 -13
  102. package/themes/original/src/components/GPSButton/index.tsx +6 -4
  103. package/themes/original/src/components/GiftCard/GiftCardUI/index.tsx +96 -0
  104. package/themes/original/src/components/GiftCard/GiftCardUI/styles.tsx +5 -0
  105. package/themes/original/src/components/GiftCard/PurchaseGiftCard/index.tsx +100 -0
  106. package/themes/original/src/components/GiftCard/PurchaseGiftCard/styles.tsx +8 -0
  107. package/themes/original/src/components/GiftCard/RedeemGiftCard/index.tsx +191 -0
  108. package/themes/original/src/components/GiftCard/RedeemGiftCard/styles.tsx +8 -0
  109. package/themes/original/src/components/GiftCard/SendGiftCard/index.tsx +165 -0
  110. package/themes/original/src/components/GiftCard/SendGiftCard/styles.tsx +9 -0
  111. package/themes/original/src/components/GoogleLogin/styles.tsx +1 -1
  112. package/themes/original/src/components/GoogleMap/index.tsx +60 -5
  113. package/themes/original/src/components/Help/index.tsx +2 -2
  114. package/themes/original/src/components/HelpAccountAndPayment/index.tsx +10 -31
  115. package/themes/original/src/components/HelpAccountAndPayment/styles.tsx +5 -3
  116. package/themes/original/src/components/HelpGuide/index.tsx +6 -6
  117. package/themes/original/src/components/HelpGuide/styles.tsx +6 -0
  118. package/themes/original/src/components/HelpOrder/index.tsx +6 -15
  119. package/themes/original/src/components/HelpOrder/styles.tsx +8 -1
  120. package/themes/original/src/components/Home/index.tsx +13 -4
  121. package/themes/original/src/components/LastOrder/index.tsx +1 -34
  122. package/themes/original/src/components/LoginForm/Otp/index.tsx +91 -25
  123. package/themes/original/src/components/LoginForm/index.tsx +64 -34
  124. package/themes/original/src/components/LottieAnimation/index.tsx +88 -63
  125. package/themes/original/src/components/MessageListing/index.tsx +16 -42
  126. package/themes/original/src/components/Messages/index.tsx +14 -7
  127. package/themes/original/src/components/MomentOption/index.tsx +193 -90
  128. package/themes/original/src/components/MomentSelector/index.tsx +1 -1
  129. package/themes/original/src/components/MultiCart/index.tsx +41 -54
  130. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +162 -50
  131. package/themes/original/src/components/MultiCheckout/index.tsx +329 -100
  132. package/themes/original/src/components/MultiCheckout/styles.tsx +3 -1
  133. package/themes/original/src/components/MultiOrdersDetails/SingleOrderCard.tsx +37 -224
  134. package/themes/original/src/components/MultiOrdersDetails/index.tsx +54 -21
  135. package/themes/original/src/components/MultiOrdersDetails/styles.tsx +1 -1
  136. package/themes/original/src/components/MyOrders/index.tsx +40 -29
  137. package/themes/original/src/components/NavBar/index.tsx +20 -17
  138. package/themes/original/src/components/NotFoundSource/index.tsx +14 -10
  139. package/themes/original/src/components/Notifications/index.tsx +42 -52
  140. package/themes/original/src/components/Notifications/styles.tsx +6 -3
  141. package/themes/original/src/components/OrderDetails/OrderEta.tsx +76 -0
  142. package/themes/original/src/components/OrderDetails/OrderHistory.tsx +21 -5
  143. package/themes/original/src/components/OrderDetails/index.tsx +191 -363
  144. package/themes/original/src/components/OrderDetails/styles.tsx +0 -1
  145. package/themes/original/src/components/OrderItAgain/index.tsx +3 -1
  146. package/themes/original/src/components/OrderProgress/index.tsx +30 -56
  147. package/themes/original/src/components/OrderSummary/index.tsx +88 -59
  148. package/themes/original/src/components/OrderTypeSelector/index.tsx +2 -1
  149. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/index.tsx +14 -14
  150. package/themes/original/src/components/OrdersOption/index.tsx +67 -85
  151. package/themes/original/src/components/OrdersOption/styles.tsx +1 -1
  152. package/themes/original/src/components/PageBanner/index.tsx +98 -38
  153. package/themes/original/src/components/PageBanner/styles.tsx +0 -10
  154. package/themes/original/src/components/PaymentOptionCard/index.tsx +180 -0
  155. package/themes/original/src/components/PaymentOptionStripe/styles.tsx +1 -1
  156. package/themes/original/src/components/PaymentOptionWallet/index.tsx +56 -56
  157. package/themes/original/src/components/PaymentOptions/index.tsx +78 -35
  158. package/themes/original/src/components/PhoneInputNumber/index.tsx +18 -4
  159. package/themes/original/src/components/ProductForm/index.tsx +104 -29
  160. package/themes/original/src/components/ProductForm/styles.tsx +5 -5
  161. package/themes/original/src/components/ProductItemAccordion/index.tsx +12 -9
  162. package/themes/original/src/components/ProductOptionSubOption/index.tsx +20 -18
  163. package/themes/original/src/components/ProductOptionSubOption/styles.tsx +5 -9
  164. package/themes/original/src/components/ProfessionalFilter/SingleProfessionalCard/index.tsx +108 -0
  165. package/themes/original/src/components/ProfessionalFilter/index.tsx +20 -50
  166. package/themes/original/src/components/ProfessionalProfile/index.tsx +36 -7
  167. package/themes/original/src/components/Promotions/index.tsx +2 -2
  168. package/themes/original/src/components/Promotions/styles.tsx +3 -1
  169. package/themes/original/src/components/ReviewProducts/index.tsx +16 -7
  170. package/themes/original/src/components/ScheduleAccordion/index.tsx +3 -3
  171. package/themes/original/src/components/ServiceForm/index.tsx +63 -20
  172. package/themes/original/src/components/Sessions/index.tsx +11 -8
  173. package/themes/original/src/components/Sessions/styles.tsx +5 -0
  174. package/themes/original/src/components/SignupForm/index.tsx +43 -27
  175. package/themes/original/src/components/SingleOrderCard/index.tsx +102 -63
  176. package/themes/original/src/components/SingleOrderCard/styles.tsx +1 -1
  177. package/themes/original/src/components/SingleProductCard/index.tsx +72 -31
  178. package/themes/original/src/components/SingleProductCard/styles.tsx +20 -4
  179. package/themes/original/src/components/SingleProductReview/styles.tsx +1 -1
  180. package/themes/original/src/components/StripeCardsList/index.tsx +49 -5
  181. package/themes/original/src/components/StripeElementsForm/index.tsx +48 -34
  182. package/themes/original/src/components/StripeElementsForm/naked.tsx +12 -1
  183. package/themes/original/src/components/UpsellingProducts/index.tsx +238 -224
  184. package/themes/original/src/components/UpsellingProducts/styles.tsx +12 -1
  185. package/themes/original/src/components/UserDetails/index.tsx +3 -1
  186. package/themes/original/src/components/UserFormDetails/index.tsx +76 -7
  187. package/themes/original/src/components/UserFormDetails/styles.tsx +1 -1
  188. package/themes/original/src/components/UserProfile/index.tsx +88 -79
  189. package/themes/original/src/components/UserProfileForm/index.tsx +17 -21
  190. package/themes/original/src/components/UserProfileForm/styles.tsx +7 -0
  191. package/themes/original/src/components/UserVerification/index.tsx +55 -50
  192. package/themes/original/src/components/WalletTransactionItem/index.tsx +2 -2
  193. package/themes/original/src/components/WalletTransactions/index.tsx +3 -3
  194. package/themes/original/src/components/Wallets/index.tsx +66 -30
  195. package/themes/original/src/components/Wallets/styles.tsx +3 -4
  196. package/themes/original/src/components/shared/OButton.tsx +6 -2
  197. package/themes/original/src/components/shared/OInput.tsx +6 -1
  198. package/themes/original/src/components/shared/OModal.tsx +3 -3
  199. package/themes/original/src/types/index.tsx +40 -11
  200. package/themes/original/src/utils/index.tsx +273 -1
  201. package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
@@ -80,9 +80,9 @@ export const GoogleMap = (props: GoogleMapsParams) => {
80
80
  locations.map((location: { lat: number; lng: number; level: number }) => {
81
81
  return location.level === 4 && driverLocation?.lat
82
82
  ? {
83
- latitude: driverLocation?.lat,
84
- longitude: driverLocation?.lng,
85
- }
83
+ latitude: driverLocation?.lat,
84
+ longitude: driverLocation?.lng,
85
+ }
86
86
  : { latitude: location.lat, longitude: location.lng };
87
87
  });
88
88
 
@@ -107,7 +107,7 @@ export const GoogleMap = (props: GoogleMapsParams) => {
107
107
  }
108
108
  let data = null;
109
109
  const details = {
110
- geometry: { location: { lat: pos.latitude, lng: pos.longitude } },
110
+ geometry: { location: { lat: pos?.latitude, lng: pos?.longitude } },
111
111
  };
112
112
  if (isSetInputs) {
113
113
  data = {
@@ -165,8 +165,8 @@ export const GoogleMap = (props: GoogleMapsParams) => {
165
165
  const lat1 = pointA.lat;
166
166
  const lon1 = pointA.lng;
167
167
 
168
- const lat2 = pointB.latitude;
169
- const lon2 = pointB.longitude;
168
+ const lat2 = pointB?.latitude;
169
+ const lon2 = pointB?.longitude;
170
170
 
171
171
  const R = 6371e3;
172
172
  const φ1 = lat1 * (Math.PI / 180);
@@ -201,11 +201,11 @@ export const GoogleMap = (props: GoogleMapsParams) => {
201
201
  content: !(errKey === 'ERROR_MAX_LIMIT_LOCATION_TO')
202
202
  ? [t(errKey, mapErrors[errKey])]
203
203
  : [
204
- `${t(errKey, mapErrors[errKey])} ${maxLimitLocation} ${t(
205
- 'METTERS',
206
- 'meters',
207
- )}`,
208
- ],
204
+ `${t(errKey, mapErrors[errKey])} ${maxLimitLocation} ${t(
205
+ 'METTERS',
206
+ 'meters',
207
+ )}`,
208
+ ],
209
209
  key: errKey,
210
210
  });
211
211
  };
@@ -237,9 +237,9 @@ export const GoogleMap = (props: GoogleMapsParams) => {
237
237
  MARKERS = locations.map((location: { lat: number; lng: number; level: number }) => {
238
238
  return location.level === 4 && driverLocation?.lat
239
239
  ? {
240
- latitude: driverLocation?.lat,
241
- longitude: driverLocation?.lng,
242
- }
240
+ latitude: driverLocation?.lat,
241
+ longitude: driverLocation?.lng,
242
+ }
243
243
  : { latitude: location.lat, longitude: location.lng };
244
244
  })
245
245
  fitAllMarkers();
@@ -284,7 +284,7 @@ export const GoogleMap = (props: GoogleMapsParams) => {
284
284
  onRegionChangeComplete={
285
285
  !readOnly
286
286
  ? coordinates => handleChangeRegion(coordinates)
287
- : () => {}
287
+ : () => { }
288
288
  }
289
289
  zoomTapEnabled
290
290
  zoomEnabled
@@ -302,12 +302,13 @@ export const GoogleMap = (props: GoogleMapsParams) => {
302
302
  i: number,
303
303
  ) => (
304
304
  <React.Fragment key={i}>
305
- <Marker
306
- coordinate={location}
307
- onPress={() => {
305
+ <Marker
306
+ coordinate={location}
307
+ onPress={() => {
308
308
  mapRef.current?.animateCamera({
309
- center: { latitude: location.latitude, longitude:location.longitude },
310
- })}}
309
+ center: { latitude: location?.latitude, longitude: location?.longitude },
310
+ })
311
+ }}
311
312
  >
312
313
  <Icon
313
314
  name="map-marker"
@@ -328,46 +329,46 @@ export const GoogleMap = (props: GoogleMapsParams) => {
328
329
  <Callout
329
330
  onPress={() => {
330
331
  showLocation({
331
- latitude: location.latitude,
332
- longitude: location.longitude,
333
- sourceLatitude: userLocation.latitude,
334
- sourceLongitude: userLocation.longitude,
335
- naverCallerName: 'com.businessapp',
336
- dialogTitle: t('SHOW_IN_OTHER_MAPS', 'Show in other maps'),
337
- dialogMessage: t('WHAT_APP_WOULD_YOU_USE', 'What app would you like to use?'),
338
- cancelText: t('CANCEL', 'Cancel'),
332
+ latitude: location?.latitude,
333
+ longitude: location?.longitude,
334
+ sourceLatitude: userLocation?.latitude,
335
+ sourceLongitude: userLocation.longitude,
336
+ naverCallerName: 'com.businessapp',
337
+ dialogTitle: t('SHOW_IN_OTHER_MAPS', 'Show in other maps'),
338
+ dialogMessage: t('WHAT_APP_WOULD_YOU_USE', 'What app would you like to use?'),
339
+ cancelText: t('CANCEL', 'Cancel'),
339
340
  })
340
341
  }}
341
342
  >
342
- <View style={{flex: 1,width: 250, paddingRight: 10, paddingLeft: 10, justifyContent:'space-between' }}>
343
- <View style={{flex: 1, marginBottom: 20}}>
344
- <OText size={16} weight={'bold'} style={{paddingTop: 10, marginBottom: 10}}>{locations[i]?.title}</OText>
345
- { locations[i]?.address && (
346
- <>
347
- <OText size={16} >{locations[i]?.address.addressName}</OText>
348
- <OText size={16} >{locations[i]?.address.zipcode}</OText>
349
- </>
350
- )}
351
- </View>
352
- <OButton
353
- text={t('GO_TO_THIS_LOCATION', 'Go to this location')}
354
- imgRightSrc={null}
355
- textStyle={{
356
- color: theme.colors.white,
357
- fontFamily: 'Poppins',
358
- fontStyle: 'normal',
359
- fontWeight: 'normal',
360
- fontSize: 16
361
- }}
362
- style={{
363
- alignContent:'center',
364
- borderRadius: 10,
365
- height: 35,
366
- bottom:10
367
- }}
368
- bgColor={theme.colors.primary}
369
- borderColor={theme.colors.primary}
370
- />
343
+ <View style={{ flex: 1, width: 250, paddingRight: 10, paddingLeft: 10, justifyContent: 'space-between' }}>
344
+ <View style={{ flex: 1, marginBottom: 20 }}>
345
+ <OText size={16} weight={'bold'} style={{ paddingTop: 10, marginBottom: 10 }}>{locations[i]?.title}</OText>
346
+ {locations[i]?.address && (
347
+ <>
348
+ <OText size={16} >{locations[i]?.address.addressName}</OText>
349
+ <OText size={16} >{locations[i]?.address.zipcode}</OText>
350
+ </>
351
+ )}
352
+ </View>
353
+ <OButton
354
+ text={t('GO_TO_THIS_LOCATION', 'Go to this location')}
355
+ imgRightSrc={null}
356
+ textStyle={{
357
+ color: theme.colors.white,
358
+ fontFamily: 'Poppins',
359
+ fontStyle: 'normal',
360
+ fontWeight: 'normal',
361
+ fontSize: 16
362
+ }}
363
+ style={{
364
+ alignContent: 'center',
365
+ borderRadius: 10,
366
+ height: 35,
367
+ bottom: 10
368
+ }}
369
+ bgColor={theme.colors.primary}
370
+ borderColor={theme.colors.primary}
371
+ />
371
372
  </View>
372
373
  </Callout>
373
374
  </Marker>
@@ -1,6 +1,6 @@
1
- import React, { useEffect } from 'react'
1
+ import React, { useEffect, useState } from 'react'
2
2
  import { formatSeconds } from '../../../utils'
3
- import { StyleSheet, TouchableOpacity } from 'react-native';
3
+ import { StyleSheet, TouchableOpacity, Alert } from 'react-native';
4
4
  import { useCountdownTimer } from '../../../../../../src/hooks/useCountdownTimer';
5
5
  import { useLanguage } from 'ordering-components/native';
6
6
  import { OTPContainer } from './styles';
@@ -16,11 +16,13 @@ export const Otp = (props: otpParams) => {
16
16
  onSubmit,
17
17
  handleLoginOtp,
18
18
  setAlertState,
19
- pinCount
19
+ pinCount,
20
+ formState
20
21
  } = props
21
22
 
22
23
  const theme = useTheme();
23
24
  const [, t] = useLanguage();
25
+ const [code, setCode] = useState('')
24
26
  const [otpLeftTime, _, resetOtpLeftTime]: any = useCountdownTimer(
25
27
  600, willVerifyOtpState)
26
28
 
@@ -44,6 +46,30 @@ export const Otp = (props: otpParams) => {
44
46
  }
45
47
  }, [otpLeftTime])
46
48
 
49
+ useEffect(() => {
50
+ if (!formState?.loading && formState?.result?.error) {
51
+ Alert.alert(
52
+ t('ERROR', 'Error'),
53
+ typeof formState.result?.result === 'string'
54
+ ? formState.result?.result
55
+ : formState.result?.result[0],
56
+ [
57
+ {
58
+ text: t('ACCEPT', 'Accept'),
59
+ onPress: () => {},
60
+ style: 'cancel'
61
+ },
62
+ ],
63
+ { cancelable: false }
64
+ )
65
+
66
+ if (code.length === (pinCount || 6)) {
67
+ setCode('')
68
+ }
69
+
70
+ }
71
+ }, [formState])
72
+
47
73
  const loginStyle = StyleSheet.create({
48
74
  underlineStyleBase: {
49
75
  width: 45,
@@ -72,6 +98,8 @@ export const Otp = (props: otpParams) => {
72
98
  onCodeFilled={(code: string) => handleLoginOtp(code)}
73
99
  selectionColor={theme.colors.primary}
74
100
  editable
101
+ code={code}
102
+ onCodeChanged={(code: string) => setCode(code)}
75
103
  />
76
104
  <TouchableOpacity onPress={() => handleOnSubmit()} disabled={otpLeftTime > 520}>
77
105
  <OText size={16} mBottom={30} color={otpLeftTime > 520 ? theme.colors.disabled : theme.colors.primary}>
@@ -209,11 +209,11 @@ const LoginFormUI = (props: LoginParams) => {
209
209
  props.handleChangeTab(val);
210
210
 
211
211
  if (loginTab === 'email') {
212
- scrollRefTab.current?.scrollToEnd({ animated: true });
212
+ scrollRefTab?.current?.scrollToEnd && scrollRefTab.current?.scrollToEnd({ animated: true });
213
213
  }
214
214
 
215
215
  if (loginTab === 'cellphone') {
216
- scrollRefTab.current?.scrollTo({ animated: true });
216
+ scrollRefTab?.current?.scrollTo && scrollRefTab.current?.scrollTo({ animated: true });
217
217
  }
218
218
  };
219
219
 
@@ -280,7 +280,6 @@ const LoginFormUI = (props: LoginParams) => {
280
280
 
281
281
  const handleLoginOtp = (code: string) => {
282
282
  handleButtonLoginClick({ code })
283
- setWillVerifyOtpState(false)
284
283
  }
285
284
 
286
285
  const closeAlert = () => {
@@ -329,27 +328,17 @@ const LoginFormUI = (props: LoginParams) => {
329
328
  showToast(ToastType.Info, t('TRY_AGAIN', 'Please try again'))
330
329
  return
331
330
  }
332
- formState?.result?.result &&
333
- showToast(
334
- ToastType.Error,
335
- loginTab === 'email' && typeof formState.result?.result === 'string'
336
- ? getTraduction(formState.result?.result)
337
- : loginTab === 'email' &&
338
- typeof formState.result?.result !== 'string'
339
- ? getTraduction(formState.result?.result[0])
340
- : loginTab === 'cellphone' &&
341
- typeof formState.result?.result === 'string'
342
- ? getTraduction(formState.result?.result).replace(
343
- t('USER', 'user').toLowerCase(),
344
- t('PHONE_NUMER', 'Phone number'),
345
- )
346
- : getTraduction(formState.result?.result[0]).replace(
347
- t('USER', 'user').toLowerCase(),
348
- t('PHONE_NUMER', 'Phone number'),
349
- ),
350
- );
331
+ formState.result?.result && showToast(
332
+ ToastType.Error,
333
+ typeof formState.result?.result === 'string'
334
+ ? formState.result?.result
335
+ : formState.result?.result[0]
336
+ )
351
337
  setSubmitted(false)
352
338
  }
339
+ if (!formState?.loading && !formState?.result?.error) {
340
+ setWillVerifyOtpState(false)
341
+ }
353
342
  }, [formState]);
354
343
 
355
344
  useEffect(() => {
@@ -487,6 +476,8 @@ const LoginFormUI = (props: LoginParams) => {
487
476
  borderRadius: 7.6,
488
477
  borderColor: theme.colors.inputSignup,
489
478
  backgroundColor: theme.colors.transparent,
479
+ minHeight: 50,
480
+ maxHeight : 50
490
481
  },
491
482
  btn: {
492
483
  borderRadius: 7.6,
@@ -929,6 +920,7 @@ const LoginFormUI = (props: LoginParams) => {
929
920
  handleLoginOtp={handleLoginOtp}
930
921
  onSubmit={handleLogin}
931
922
  setAlertState={setAlertState}
923
+ formState={formState}
932
924
  />
933
925
  </OModal>
934
926
  <Alert
@@ -951,3 +943,4 @@ export const LoginForm = (props: any) => {
951
943
 
952
944
  return <LoginFormController {...loginProps} />;
953
945
  };
946
+
@@ -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]}
@@ -2,20 +2,17 @@ import React, { useState, useEffect } from 'react';
2
2
  import {
3
3
  View,
4
4
  Pressable,
5
- StyleSheet,
6
- Dimensions,
7
- ScrollView,
8
- RefreshControl,
5
+ StyleSheet
9
6
  } from 'react-native';
10
7
  import { Contacts, useLanguage } from 'ordering-components/native';
11
8
  import { useTheme } from 'styled-components/native';
12
- import { Placeholder, PlaceholderLine, Fade } from 'rn-placeholder';
13
- import { OText, OButton } from '../shared';
9
+ import { OText } from '../shared';
14
10
  import { NotFoundSource } from '../NotFoundSource';
15
11
  import { PreviousMessages } from '../PreviousMessages';
16
12
  import { FiltersTab, TabsContainer, TagsContainer, Tag } from './styles';
17
13
  import { MessagesOptionParams } from '../../types';
18
14
  import { useDeviceOrientation } from '../../../../../src/hooks/DeviceOrientation';
15
+
19
16
  const MessagesOptionUI = (props: MessagesOptionParams) => {
20
17
  const {
21
18
  orders,
@@ -65,12 +62,6 @@ const MessagesOptionUI = (props: MessagesOptionParams) => {
65
62
  ),
66
63
  );
67
64
 
68
- const [orientation, setOrientation] = useState(
69
- Dimensions.get('window').width < Dimensions.get('window').height
70
- ? 'Portrait'
71
- : 'Landscape',
72
- );
73
-
74
65
  const getTagFilter = (key: number) => {
75
66
  return tags.find(value => value.key === key)?.text;
76
67
  };
@@ -114,14 +105,6 @@ const MessagesOptionUI = (props: MessagesOptionParams) => {
114
105
  );
115
106
  }, [orders]);
116
107
 
117
- Dimensions.addEventListener('change', ({ window: { width, height } }) => {
118
- if (width < height) {
119
- setOrientation('Portrait');
120
- } else {
121
- setOrientation('Landscape');
122
- }
123
- });
124
-
125
108
  const styles = StyleSheet.create({
126
109
  header: {
127
110
  marginBottom: 25,
@@ -242,35 +225,28 @@ const MessagesOptionUI = (props: MessagesOptionParams) => {
242
225
  !error
243
226
  ? t('NO_RESULTS_FOUND', 'Sorry, no results found')
244
227
  : error[0]?.message ||
245
- error[0] ||
246
- t('NETWORK_ERROR', 'Network Error')
228
+ error[0] ||
229
+ t('NETWORK_ERROR', 'Network Error')
247
230
  }
248
231
  image={theme.images.general.notFound}
249
232
  conditioned={false}
250
233
  />
251
234
  )}
252
-
253
- <ScrollView
254
- showsVerticalScrollIndicator={false}
255
- style={{ flex: 1 }}
256
- refreshControl={<RefreshControl
257
- refreshing={refreshing}
258
- onRefresh={() => getOrders?.()}
259
- />}
260
- >
261
- {!reload &&
262
- !error &&
263
- values.length > 0 &&
264
- JSON.stringify(tabsFilter) === JSON.stringify(tabs[0].tags) && (
265
- <PreviousMessages
266
- orders={values}
267
- setOrders={setOrders}
268
- messages={messages}
269
- onNavigationRedirect={onNavigationRedirect}
270
- />
271
- )}
272
-
273
- {/* {!reload &&
235
+ <PreviousMessages
236
+ orders={values}
237
+ messages={messages}
238
+ onNavigationRedirect={onNavigationRedirect}
239
+ getOrders={getOrders}
240
+ pagination={pagination}
241
+ loading={loading}
242
+ reload={reload}
243
+ tabs={tabs}
244
+ tabsFilter={tabsFilter}
245
+ setOrders={setOrders}
246
+ loadMore={loadMore}
247
+ error={error}
248
+ />
249
+ {/* {!reload &&
274
250
  !error &&
275
251
  orders.length > 0 &&
276
252
  JSON.stringify(tabsFilter) === JSON.stringify(tabs[1].tags) && (
@@ -283,55 +259,6 @@ const MessagesOptionUI = (props: MessagesOptionParams) => {
283
259
  onNavigationRedirect={onNavigationRedirect}
284
260
  />
285
261
  )} */}
286
-
287
- {(loading || reload) && (
288
- <>
289
- <View>
290
- {[...Array(5)].map((item, i) => (
291
- <Placeholder key={i} Animation={Fade}>
292
- <View
293
- style={{
294
- width: '100%',
295
- flexDirection: 'row',
296
- marginBottom: 10,
297
- }}>
298
- <PlaceholderLine
299
- width={orientation === 'Portrait' ? 22 : 11}
300
- height={74}
301
- style={{
302
- marginRight: 20,
303
- marginBottom: 20,
304
- borderRadius: 7.6,
305
- }}
306
- />
307
- <Placeholder>
308
- <PlaceholderLine width={30} style={{ marginTop: 5 }} />
309
- <PlaceholderLine width={50} />
310
- <PlaceholderLine width={20} />
311
- </Placeholder>
312
- </View>
313
- </Placeholder>
314
- ))}
315
- </View>
316
- </>
317
- )}
318
-
319
- {pagination?.totalPages &&
320
- !loading &&
321
- !reload &&
322
- JSON.stringify(tabsFilter) === JSON.stringify(tabs[0].tags) &&
323
- pagination?.currentPage < pagination?.totalPages && (
324
- <OButton
325
- onClick={() => loadMore && loadMore()}
326
- text={t('LOAD_MORE_ORDERS', 'Load more orders')}
327
- imgRightSrc={null}
328
- textStyle={styles.loadButtonText}
329
- style={styles.loadButton}
330
- bgColor={theme.colors.primary}
331
- borderColor={theme.colors.primary}
332
- />
333
- )}
334
- </ScrollView>
335
262
  </>
336
263
  );
337
264
  };
@@ -1,16 +1,17 @@
1
- import React, { useState, useEffect } from 'react'
2
1
  import moment from 'moment'
3
- import { View, Modal, StyleSheet, TouchableOpacity, Dimensions } from 'react-native'
2
+ import { NewOrderNotification as NewOrderNotificationController, useApi, useEvent, useLanguage, useSession } from 'ordering-components/native'
3
+ import React, { useEffect, useState } from 'react'
4
+ import { Dimensions, Modal, StyleSheet, TouchableOpacity, View } from 'react-native'
4
5
  import Sound from 'react-native-sound'
5
6
  import Icon from 'react-native-vector-icons/Feather'
6
7
  import { useTheme } from 'styled-components/native'
7
- import { useEvent, useLanguage, useSession, useApi, NewOrderNotification as NewOrderNotificationController } from 'ordering-components/native'
8
8
 
9
- import { OText, OIcon } from '../shared'
10
- import { NotificationContainer } from './styles'
11
9
  import { useLocation } from '../../hooks/useLocation'
10
+ import { OIcon, OText } from '../shared'
11
+ import { NotificationContainer } from './styles'
12
12
 
13
- Sound.setCategory('Playback')
13
+ Sound.setCategory('Playback', true)
14
+ Sound.setMode('Default')
14
15
 
15
16
  const windowWidth = Dimensions.get('screen').width
16
17
 
@@ -44,9 +45,12 @@ const NewOrderNotificationUI = (props: any) => {
44
45
  },
45
46
  }
46
47
 
47
- const notificationSound = new Sound(theme.sounds.notification);
48
+ const soundSrc = 'https://d33aymufw4jvwf.cloudfront.net/notification.mp3' ?? theme.sounds.notification
49
+
50
+ const notificationSound = new Sound(soundSrc, '', () => { });
48
51
 
49
52
  let _timeout: any = null
53
+ let times = 0
50
54
 
51
55
  const handleCloseEvents = () => {
52
56
  notificationSound.stop()
@@ -56,15 +60,22 @@ const NewOrderNotificationUI = (props: any) => {
56
60
 
57
61
  const handlePlayNotificationSound = (eventObj: any = null) => {
58
62
  setCurrentEvent(eventObj)
59
- let times = 1
60
- if (times < SOUND_LOOP) {
61
- _timeout = setInterval(() => {
62
- notificationSound.setVolume(1).play(success => success && (times = times + 1))
63
- if (times === SOUND_LOOP) {
64
- clearInterval(_timeout)
65
- }
66
- }, 2500)
63
+ if (times > 0) {
64
+ if (times === 3) {
65
+ times = 0
66
+ return
67
+ }
68
+ return
67
69
  }
70
+ _timeout = setInterval(() => {
71
+ if (times < SOUND_LOOP) {
72
+ notificationSound.play()
73
+ times++
74
+ } else {
75
+ clearInterval(_timeout)
76
+ return
77
+ }
78
+ }, 2500)
68
79
  }
69
80
 
70
81
  const handleEventNotification = async (evtType: number, value: any) => {
@@ -74,32 +85,37 @@ const NewOrderNotificationUI = (props: any) => {
74
85
  await fetch(`${ordering.root}/users/${user.id}/locations`, {
75
86
  method: 'POST',
76
87
  body: JSON.stringify({
77
- location: JSON.stringify({location: `{lat: ${location.latitude}, lng: ${location.longitude}}`})
88
+ location: JSON.stringify({ location: `{lat: ${location.latitude}, lng: ${location.longitude}}` })
78
89
  }),
79
90
  headers: { 'Content-Type': 'application/json', Authorization: `Bearer ${token}` }
80
91
  })
81
- } catch {}
92
+ } catch { }
82
93
  const duration = moment.duration(moment().diff(moment.utc(value?.last_driver_assigned_at)))
83
94
  const assignedSecondsDiff = duration.asSeconds()
84
- if (assignedSecondsDiff < 5 && !isBusinessApp) {
95
+ if (assignedSecondsDiff < 5 && !isBusinessApp && !value?.logistic_status) {
85
96
  handlePlayNotificationSound({ evt: 2, orderId: value?.id })
86
97
  }
87
98
  }
88
99
  if (evtType === 3 || value.author_id === user.id) return
89
- handlePlayNotificationSound({
100
+ setTimeout(() => handlePlayNotificationSound({
90
101
  evt: evtType,
91
- orderId: evtList[evtType].event === 'messages' ? value?.order_id : value?.id
92
- })
102
+ orderId: value?.driver ? value?.order_id : evtList[evtType].event === 'messages' ? value?.order?.id : value?.order_id
103
+ }), 1000)
93
104
  }
94
105
 
95
106
  useEffect(() => {
96
107
  events.on('message_added_notification', (o: any) => handleEventNotification(1, o))
97
108
  events.on('order_added_notification', (o: any) => handleEventNotification(2, o))
98
109
  events.on('order_updated_notification', (o: any) => handleEventNotification(3, o))
110
+ events.on('request_register_notification', (o: any) => handleEventNotification(2, o))
111
+ events.on('request_update_notification', (o: any) => handleEventNotification(3, o))
112
+
99
113
  return () => {
100
114
  events.off('message_added_notification', (o: any) => handleEventNotification(1, o))
101
115
  events.off('order_added_notification', (o: any) => handleEventNotification(2, o))
102
116
  events.off('order_updated_notification', (o: any) => handleEventNotification(3, o))
117
+ events.off('request_register_notification', (o: any) => handleEventNotification(2, o))
118
+ events.off('request_update_notification', (o: any) => handleEventNotification(3, o))
103
119
  }
104
120
  }, [])
105
121
 
@@ -18,7 +18,7 @@ export const NotFoundSource = (props: NotFoundSourceParams) => {
18
18
  <OIcon src={errorImage} width={260} height={220} />
19
19
  </NotFoundImage>
20
20
  )}
21
- {content && conditioned && !errorImage && (
21
+ {!!content && conditioned && !errorImage && (
22
22
  <OText
23
23
  color={theme.colors.textSecondary}
24
24
  size={textSize ?? 18}
@@ -26,7 +26,7 @@ export const NotFoundSource = (props: NotFoundSourceParams) => {
26
26
  {content}
27
27
  </OText>
28
28
  )}
29
- {content && !conditioned && (
29
+ {!!content && !conditioned && (
30
30
  <OText
31
31
  color={theme.colors.textSecondary}
32
32
  size={textSize ?? 18}