ordering-ui-react-native 0.16.75 → 0.16.76-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 (216) hide show
  1. package/package.json +6 -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 +2 -2
  11. package/src/components/OrdersOption/index.tsx +54 -56
  12. package/src/components/PaymentOptions/index.tsx +298 -347
  13. package/src/components/PaymentOptionsWebView/index.tsx +119 -120
  14. package/src/components/SingleProductReview/index.tsx +7 -4
  15. package/src/components/VerifyPhone/styles.tsx +1 -2
  16. package/src/components/shared/OToast.tsx +4 -4
  17. package/src/types/@fatnlazycat/react-native-recaptcha-v3/index.d.ts +1 -0
  18. package/src/utils/index.tsx +2 -1
  19. package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +260 -238
  20. package/themes/business/src/components/AcceptOrRejectOrder/styles.tsx +6 -4
  21. package/themes/business/src/components/BusinessController/index.tsx +2 -2
  22. package/themes/business/src/components/Chat/index.tsx +31 -31
  23. package/themes/business/src/components/DriverMap/index.tsx +7 -5
  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 +332 -140
  27. package/themes/business/src/components/LoginForm/styles.tsx +10 -0
  28. package/themes/business/src/components/MapView/index.tsx +14 -3
  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/OrderContentComponent.tsx +70 -43
  32. package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +3 -3
  33. package/themes/business/src/components/OrdersOption/index.tsx +63 -73
  34. package/themes/business/src/components/OrdersOption/styles.tsx +5 -1
  35. package/themes/business/src/components/OrdersOptionBusiness/index.tsx +15 -1
  36. package/themes/business/src/components/OrdersOptionCity/index.tsx +15 -1
  37. package/themes/business/src/components/OrdersOptionDate/index.tsx +19 -6
  38. package/themes/business/src/components/OrdersOptionDelivery/index.tsx +15 -1
  39. package/themes/business/src/components/OrdersOptionDriver/index.tsx +15 -1
  40. package/themes/business/src/components/OrdersOptionPaymethod/index.tsx +15 -1
  41. package/themes/business/src/components/OrdersOptionStatus/index.tsx +10 -1
  42. package/themes/business/src/components/PreviousMessages/index.tsx +17 -18
  43. package/themes/business/src/components/PreviousOrders/OrderItem.tsx +250 -0
  44. package/themes/business/src/components/PreviousOrders/OrdersGroupedItem.tsx +115 -0
  45. package/themes/business/src/components/PreviousOrders/index.tsx +440 -245
  46. package/themes/business/src/components/PreviousOrders/styles.tsx +31 -3
  47. package/themes/business/src/components/ProductItemAccordion/index.tsx +24 -5
  48. package/themes/business/src/components/ReviewCustomer/index.tsx +39 -15
  49. package/themes/business/src/components/shared/ODropDown.tsx +42 -8
  50. package/themes/business/src/components/shared/ODropDownCalendar.tsx +36 -7
  51. package/themes/business/src/components/shared/OLink.tsx +33 -13
  52. package/themes/business/src/components/shared/OText.tsx +8 -2
  53. package/themes/business/src/types/index.tsx +29 -3
  54. package/themes/business/src/utils/index.tsx +26 -0
  55. package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
  56. package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
  57. package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
  58. package/themes/kiosk/src/components/BusinessesListing/index.tsx +2 -1
  59. package/themes/kiosk/src/components/Checkout/index.tsx +6 -0
  60. package/themes/kiosk/src/components/LoginForm/Otp/index.tsx +92 -0
  61. package/themes/kiosk/src/components/LoginForm/Otp/styles.tsx +7 -0
  62. package/themes/kiosk/src/components/LoginForm/index.tsx +545 -112
  63. package/themes/kiosk/src/components/LoginForm/styles.tsx +18 -0
  64. package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
  65. package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
  66. package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +8 -10
  67. package/themes/kiosk/src/components/PhoneInputNumber/index.tsx +1 -0
  68. package/themes/kiosk/src/components/PhoneInputNumber/styles.tsx +1 -3
  69. package/themes/kiosk/src/components/ProductForm/index.tsx +1 -14
  70. package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
  71. package/themes/kiosk/src/components/shared/OModal.tsx +14 -11
  72. package/themes/kiosk/src/layouts/Container.tsx +7 -1
  73. package/themes/kiosk/src/types/index.d.ts +15 -0
  74. package/themes/kiosk/src/utils/index.tsx +15 -0
  75. package/themes/original/index.tsx +8 -0
  76. package/themes/original/src/components/AddressDetails/index.tsx +10 -8
  77. package/themes/original/src/components/AddressForm/index.tsx +155 -139
  78. package/themes/original/src/components/AddressList/index.tsx +18 -18
  79. package/themes/original/src/components/AddressList/styles.tsx +4 -2
  80. package/themes/original/src/components/AppleLogin/index.tsx +4 -4
  81. package/themes/original/src/components/BusinessBasicInformation/index.tsx +47 -22
  82. package/themes/original/src/components/BusinessController/index.tsx +101 -70
  83. package/themes/original/src/components/BusinessController/styles.tsx +14 -9
  84. package/themes/original/src/components/BusinessInformation/index.tsx +10 -31
  85. package/themes/original/src/components/BusinessItemAccordion/index.tsx +12 -6
  86. package/themes/original/src/components/BusinessListingSearch/BusinessControllerSkeletons/index.tsx +57 -0
  87. package/themes/original/src/components/BusinessListingSearch/MaxSectionItem/index.tsx +59 -0
  88. package/themes/original/src/components/BusinessListingSearch/MaxSectionItem/styles.tsx +13 -0
  89. package/themes/original/src/components/BusinessListingSearch/index.tsx +104 -155
  90. package/themes/original/src/components/BusinessListingSearch/styles.tsx +10 -12
  91. package/themes/original/src/components/BusinessProductsList/SubcategoriesComponent/index.tsx +87 -0
  92. package/themes/original/src/components/BusinessProductsList/SubcategoriesComponent/styles.tsx +12 -0
  93. package/themes/original/src/components/BusinessProductsList/index.tsx +26 -52
  94. package/themes/original/src/components/BusinessProductsList/styles.tsx +0 -3
  95. package/themes/original/src/components/BusinessProductsListing/index.tsx +563 -493
  96. package/themes/original/src/components/BusinessProductsListing/styles.tsx +13 -12
  97. package/themes/original/src/components/BusinessTypeFilter/index.tsx +3 -2
  98. package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +2 -1
  99. package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +116 -81
  100. package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +1 -9
  101. package/themes/original/src/components/BusinessesListing/index.tsx +7 -6
  102. package/themes/original/src/components/Cart/index.tsx +75 -40
  103. package/themes/original/src/components/CartContent/index.tsx +80 -18
  104. package/themes/original/src/components/CartContent/styles.tsx +11 -1
  105. package/themes/original/src/components/Checkout/index.tsx +102 -108
  106. package/themes/original/src/components/Checkout/styles.tsx +4 -3
  107. package/themes/original/src/components/CitiesControl/index.tsx +89 -0
  108. package/themes/original/src/components/CitiesControl/styles.tsx +17 -0
  109. package/themes/original/src/components/DriverTips/index.tsx +47 -37
  110. package/themes/original/src/components/DriverTips/styles.tsx +2 -1
  111. package/themes/original/src/components/Favorite/index.tsx +7 -4
  112. package/themes/original/src/components/Favorite/styles.tsx +1 -1
  113. package/themes/original/src/components/FavoriteList/index.tsx +70 -80
  114. package/themes/original/src/components/FloatingButton/index.tsx +1 -2
  115. package/themes/original/src/components/FloatingButton/styles.tsx +1 -1
  116. package/themes/original/src/components/GPSButton/index.tsx +20 -19
  117. package/themes/original/src/components/GPSButton/styles.ts +3 -3
  118. package/themes/original/src/components/GoogleMap/index.tsx +10 -1
  119. package/themes/original/src/components/Help/index.tsx +8 -8
  120. package/themes/original/src/components/HelpAccountAndPayment/index.tsx +14 -20
  121. package/themes/original/src/components/HelpAccountAndPayment/styles.tsx +6 -0
  122. package/themes/original/src/components/HelpGuide/index.tsx +13 -12
  123. package/themes/original/src/components/HelpGuide/styles.tsx +6 -0
  124. package/themes/original/src/components/HelpOrder/index.tsx +12 -20
  125. package/themes/original/src/components/HelpOrder/styles.tsx +8 -1
  126. package/themes/original/src/components/LanguageSelector/index.tsx +19 -14
  127. package/themes/original/src/components/LastOrder/index.tsx +1 -34
  128. package/themes/original/src/components/LoginForm/Otp/index.tsx +89 -73
  129. package/themes/original/src/components/LoginForm/Otp/styles.tsx +0 -1
  130. package/themes/original/src/components/LoginForm/index.tsx +98 -41
  131. package/themes/original/src/components/LottieAnimation/index.tsx +78 -0
  132. package/themes/original/src/components/MessageListing/index.tsx +7 -40
  133. package/themes/original/src/components/Messages/index.tsx +42 -26
  134. package/themes/original/src/components/MomentOption/index.tsx +23 -14
  135. package/themes/original/src/components/MultiCart/index.tsx +50 -0
  136. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +92 -93
  137. package/themes/original/src/components/MultiCheckout/index.tsx +158 -77
  138. package/themes/original/src/components/MultiOrdersDetails/SingleOrderCard.tsx +37 -224
  139. package/themes/original/src/components/MultiOrdersDetails/index.tsx +85 -34
  140. package/themes/original/src/components/MultiOrdersDetails/styles.tsx +1 -1
  141. package/themes/original/src/components/MyOrders/index.tsx +66 -17
  142. package/themes/original/src/components/NavBar/index.tsx +7 -6
  143. package/themes/original/src/components/NetworkError/index.tsx +5 -3
  144. package/themes/original/src/components/NotFoundSource/index.tsx +2 -1
  145. package/themes/original/src/components/Notifications/index.tsx +144 -0
  146. package/themes/original/src/components/Notifications/styles.tsx +20 -0
  147. package/themes/original/src/components/OrderDetails/index.tsx +108 -218
  148. package/themes/original/src/components/OrderDetails/styles.tsx +10 -1
  149. package/themes/original/src/components/OrderItAgain/index.tsx +46 -43
  150. package/themes/original/src/components/OrderProgress/index.tsx +81 -105
  151. package/themes/original/src/components/OrderProgress/styles.tsx +5 -0
  152. package/themes/original/src/components/OrderSummary/index.tsx +2 -2
  153. package/themes/original/src/components/OrderTypeSelector/index.tsx +13 -6
  154. package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/index.tsx +93 -97
  155. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/index.tsx +3 -0
  156. package/themes/original/src/components/OrdersOption/index.tsx +86 -92
  157. package/themes/original/src/components/PageBanner/index.tsx +146 -0
  158. package/themes/original/src/components/PageBanner/styles.tsx +11 -0
  159. package/themes/original/src/components/PaymentOptionStripe/styles.tsx +1 -1
  160. package/themes/original/src/components/PaymentOptionWallet/index.tsx +56 -56
  161. package/themes/original/src/components/PaymentOptions/index.tsx +1 -1
  162. package/themes/original/src/components/PhoneInputNumber/index.tsx +1 -1
  163. package/themes/original/src/components/PlaceSpot/index.tsx +16 -6
  164. package/themes/original/src/components/PreviousOrders/index.tsx +3 -2
  165. package/themes/original/src/components/ProductForm/index.tsx +240 -254
  166. package/themes/original/src/components/ProductForm/styles.tsx +5 -8
  167. package/themes/original/src/components/ProductItemAccordion/index.tsx +199 -128
  168. package/themes/original/src/components/ProductOptionSubOption/index.tsx +18 -10
  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 -49
  172. package/themes/original/src/components/ProfessionalProfile/index.tsx +20 -9
  173. package/themes/original/src/components/Promotions/index.tsx +234 -220
  174. package/themes/original/src/components/Promotions/styles.tsx +7 -2
  175. package/themes/original/src/components/ReviewDriver/index.tsx +3 -3
  176. package/themes/original/src/components/ReviewOrder/index.tsx +43 -11
  177. package/themes/original/src/components/ReviewOrder/styles.tsx +7 -0
  178. package/themes/original/src/components/ReviewProducts/index.tsx +8 -5
  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 +360 -265
  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 +150 -100
  187. package/themes/original/src/components/SingleOrderCard/index.tsx +125 -56
  188. package/themes/original/src/components/SingleOrderCard/styles.tsx +10 -8
  189. package/themes/original/src/components/SingleProductCard/index.tsx +116 -79
  190. package/themes/original/src/components/SingleProductCard/styles.tsx +14 -13
  191. package/themes/original/src/components/SingleProductReview/index.tsx +38 -5
  192. package/themes/original/src/components/SingleProductReview/styles.tsx +12 -0
  193. package/themes/original/src/components/StripeCardsList/index.tsx +1 -1
  194. package/themes/original/src/components/StripeElementsForm/index.tsx +3 -0
  195. package/themes/original/src/components/UpsellingProducts/index.tsx +244 -215
  196. package/themes/original/src/components/UpsellingProducts/styles.tsx +12 -1
  197. package/themes/original/src/components/UserDetails/index.tsx +5 -3
  198. package/themes/original/src/components/UserFormDetails/index.tsx +50 -54
  199. package/themes/original/src/components/UserProfile/index.tsx +58 -35
  200. package/themes/original/src/components/UserProfile/styles.ts +17 -0
  201. package/themes/original/src/components/UserProfileForm/index.tsx +21 -28
  202. package/themes/original/src/components/UserProfileForm/styles.tsx +7 -0
  203. package/themes/original/src/components/WalletTransactions/index.tsx +76 -0
  204. package/themes/original/src/components/WalletTransactions/styles.tsx +13 -0
  205. package/themes/original/src/components/Wallets/index.tsx +177 -164
  206. package/themes/original/src/components/Wallets/styles.tsx +12 -8
  207. package/themes/original/src/components/shared/CardAnimation.tsx +47 -0
  208. package/themes/original/src/components/shared/HeaderTitle.tsx +8 -3
  209. package/themes/original/src/components/shared/OBottomPopup.tsx +6 -4
  210. package/themes/original/src/components/shared/OButton.tsx +9 -4
  211. package/themes/original/src/components/shared/OIcon.tsx +8 -1
  212. package/themes/original/src/components/shared/OInput.tsx +10 -1
  213. package/themes/original/src/layouts/Container.tsx +13 -9
  214. package/themes/original/src/types/index.tsx +42 -7
  215. package/themes/original/src/utils/index.tsx +322 -58
  216. package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
@@ -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;
@@ -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 }}>
@@ -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 &&
@@ -14,6 +14,8 @@ Sound.setCategory('Playback')
14
14
 
15
15
  const windowWidth = Dimensions.get('screen').width
16
16
 
17
+ const SOUND_LOOP = 3
18
+
17
19
  const NewOrderNotificationUI = (props: any) => {
18
20
  const { isBusinessApp } = props
19
21
  const [events] = useEvent()
@@ -22,8 +24,7 @@ const NewOrderNotificationUI = (props: any) => {
22
24
  const [{ user, token }] = useSession()
23
25
  const [ordering] = useApi()
24
26
  const { getCurrentLocation } = useLocation();
25
- const [soundTimeout, setSoundTimeout] = useState<any>(null)
26
- let [currentEvent, setCurrentEvent] = useState<any>(null)
27
+ const [currentEvent, setCurrentEvent] = useState<any>(null)
27
28
 
28
29
  const evtList: any = {
29
30
  1: {
@@ -43,29 +44,27 @@ const NewOrderNotificationUI = (props: any) => {
43
44
  },
44
45
  }
45
46
 
46
- const notificationSound = new Sound(theme.sounds.notification, (e) => { console.log(e) });
47
+ const notificationSound = new Sound(theme.sounds.notification);
47
48
 
48
- const handlePlayNotificationSound = () => {
49
- if (currentEvent) return
50
- let times = 0
51
- const _timeout = setInterval(function () {
52
- notificationSound.play(success => {
53
- if (success) {
54
- times = times + 1
55
- }
56
- })
57
- setSoundTimeout(_timeout)
58
- if (times === 3) {
59
- clearInterval(_timeout)
60
- clearInterval(soundTimeout)
61
- }
62
- }, 2500)
49
+ let _timeout: any = null
50
+
51
+ const handleCloseEvents = () => {
52
+ notificationSound.stop()
53
+ setCurrentEvent(null)
54
+ clearInterval(_timeout)
63
55
  }
64
56
 
65
- const handleCloseModal = () => {
66
- clearInterval(soundTimeout)
67
- currentEvent = null
68
- setCurrentEvent({ evt: null })
57
+ const handlePlayNotificationSound = (eventObj: any = null) => {
58
+ 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)
67
+ }
69
68
  }
70
69
 
71
70
  const handleEventNotification = async (evtType: number, value: any) => {
@@ -79,26 +78,15 @@ const NewOrderNotificationUI = (props: any) => {
79
78
  }),
80
79
  headers: { 'Content-Type': 'application/json', Authorization: `Bearer ${token}` }
81
80
  })
82
- } catch (error) {
83
- console.log(error)
84
- }
81
+ } catch {}
85
82
  const duration = moment.duration(moment().diff(moment.utc(value?.last_driver_assigned_at)))
86
83
  const assignedSecondsDiff = duration.asSeconds()
87
84
  if (assignedSecondsDiff < 5 && !isBusinessApp) {
88
- handlePlayNotificationSound()
89
- clearInterval(soundTimeout)
90
- currentEvent = { evt: 2, orderId: value?.id }
91
- setCurrentEvent({ evt: 2, orderId: value?.id })
85
+ handlePlayNotificationSound({ evt: 2, orderId: value?.id })
92
86
  }
93
87
  }
94
88
  if (evtType === 3 || value.author_id === user.id) return
95
- handlePlayNotificationSound()
96
- clearInterval(soundTimeout)
97
- currentEvent = {
98
- evt: evtType,
99
- orderId: evtList[evtType].event === 'messages' ? value?.order_id : value?.id
100
- }
101
- setCurrentEvent({
89
+ handlePlayNotificationSound({
102
90
  evt: evtType,
103
91
  orderId: evtList[evtType].event === 'messages' ? value?.order_id : value?.id
104
92
  })
@@ -108,18 +96,20 @@ const NewOrderNotificationUI = (props: any) => {
108
96
  events.on('message_added_notification', (o: any) => handleEventNotification(1, o))
109
97
  events.on('order_added_notification', (o: any) => handleEventNotification(2, o))
110
98
  events.on('order_updated_notification', (o: any) => handleEventNotification(3, o))
99
+ events.on('request_register_notification', (o: any) => handleEventNotification(2, o))
100
+ events.on('request_update_notification', (o: any) => handleEventNotification(3, o))
101
+
111
102
  return () => {
112
103
  events.off('message_added_notification', (o: any) => handleEventNotification(1, o))
113
104
  events.off('order_added_notification', (o: any) => handleEventNotification(2, o))
114
105
  events.off('order_updated_notification', (o: any) => handleEventNotification(3, o))
106
+ events.off('request_register_notification', (o: any) => handleEventNotification(2, o))
107
+ events.off('request_update_notification', (o: any) => handleEventNotification(3, o))
115
108
  }
116
109
  }, [])
117
110
 
118
111
  useEffect(() => {
119
- notificationSound.setVolume(1);
120
- return () => {
121
- notificationSound.release();
122
- }
112
+ return () => handleCloseEvents()
123
113
  }, [])
124
114
 
125
115
  return (
@@ -133,7 +123,7 @@ const NewOrderNotificationUI = (props: any) => {
133
123
  <View style={styles.modalView}>
134
124
  <TouchableOpacity
135
125
  style={styles.wrapperIcon}
136
- onPress={() => handleCloseModal()}
126
+ onPress={() => handleCloseEvents()}
137
127
  >
138
128
  <Icon name="x" size={30} />
139
129
  </TouchableOpacity>
@@ -1,6 +1,6 @@
1
- import React, { useState } from 'react'
1
+ import React, { useState, useCallback } from 'react'
2
2
 
3
- import { Platform, StyleSheet, View } from 'react-native';
3
+ import { Platform, StyleSheet, View, TouchableOpacity } from 'react-native';
4
4
 
5
5
  import { OButton, OText, OLink, OModal } from '../shared'
6
6
  import {
@@ -44,6 +44,9 @@ export const OrderContentComponent = (props: OrderContent) => {
44
44
  const [{ configs }] = useConfig();
45
45
  const [openReviewModal, setOpenReviewModal] = useState(false)
46
46
 
47
+ const [isReadMore, setIsReadMore] = useState(false)
48
+ const [lengthMore, setLengthMore] = useState(false)
49
+
47
50
  const pastOrderStatuses = [1, 2, 5, 6, 10, 11, 12, 16, 17]
48
51
 
49
52
  const walletName: any = {
@@ -91,6 +94,14 @@ export const OrderContentComponent = (props: OrderContent) => {
91
94
  return order?.taxes?.filter((tax: any) => tax?.type === 1)?.reduce((carry: number, tax: any) => carry + (tax?.summary?.tax_after_discount ?? tax?.summary?.tax), 0)
92
95
  }
93
96
 
97
+ const containsOnlyNumbers = (str: string) => {
98
+ return /^\d+$/.test(str);
99
+ }
100
+
101
+ const onTextLayout = useCallback((e: any) => {
102
+ setLengthMore(e.nativeEvent.lines.length >= 3); //to check the text is more than 2 lines or not
103
+ },[]);
104
+
94
105
  return (
95
106
  <OrderContent isOrderGroup={isOrderGroup} lastOrder={lastOrder}>
96
107
  {isOrderGroup && (
@@ -148,7 +159,7 @@ export const OrderContentComponent = (props: OrderContent) => {
148
159
  <View style={styles.linkWithIcons}>
149
160
  <OLink
150
161
  PressStyle={styles.linkWithIcons}
151
- url={`tel:${order?.business?.cellphone}`}
162
+ url={`tel:${containsOnlyNumbers(order?.business?.cellphone) ? order?.business?.cellphone : 'invalid'}`}
152
163
  shorcut={`${order?.business?.cellphone}`}
153
164
  TextStyle={styles.textLink}
154
165
  />
@@ -159,7 +170,7 @@ export const OrderContentComponent = (props: OrderContent) => {
159
170
  <View style={styles.linkWithIcons}>
160
171
  <OLink
161
172
  PressStyle={styles.linkWithIcons}
162
- url={`tel:${order?.business?.phone}`}
173
+ url={`tel:${containsOnlyNumbers(order?.business?.cellphone) ? order?.business?.phone : 'invalid'}`}
163
174
  shorcut={order?.business?.phone}
164
175
  TextStyle={styles.textLink}
165
176
  />
@@ -176,6 +187,7 @@ export const OrderContentComponent = (props: OrderContent) => {
176
187
  ios: `maps:0,0?q=${order?.business?.address}`,
177
188
  android: `geo:0,0?q=${order?.business?.address}`,
178
189
  })}
190
+ numberOfLines={2}
179
191
  shorcut={order?.business?.address}
180
192
  TextStyle={styles.textLink}
181
193
  />
@@ -274,7 +286,7 @@ export const OrderContentComponent = (props: OrderContent) => {
274
286
  <View style={styles.linkWithIcons}>
275
287
  <OLink
276
288
  PressStyle={styles.linkWithIcons}
277
- url={`tel:${!!order?.customer?.country_phone_code ? '+' + order?.customer?.country_phone_code : ''} ${order?.customer?.cellphone}`}
289
+ url={`tel:${!!order?.customer?.country_phone_code ? '+' + order?.customer?.country_phone_code : ''} ${containsOnlyNumbers(order?.customer?.cellphone) ? order?.customer?.cellphone : 'invalid'}`}
278
290
  shorcut={`${!!order?.customer?.country_phone_code ? '+' + order?.customer?.country_phone_code : ''} ${order?.customer?.cellphone}`}
279
291
  TextStyle={styles.textLink}
280
292
  />
@@ -285,7 +297,7 @@ export const OrderContentComponent = (props: OrderContent) => {
285
297
  <View style={styles.linkWithIcons}>
286
298
  <OLink
287
299
  PressStyle={styles.linkWithIcons}
288
- url={`tel:${order?.customer?.phone}`}
300
+ url={`tel:${containsOnlyNumbers(order?.customer?.phone) ? order?.customer?.phone : 'invalid'}`}
289
301
  shorcut={order?.customer?.phone}
290
302
  TextStyle={styles.textLink}
291
303
  />
@@ -293,17 +305,26 @@ export const OrderContentComponent = (props: OrderContent) => {
293
305
  )}
294
306
 
295
307
  {!!order?.customer?.address && (
296
- <View style={styles.linkWithIcons}>
297
- <OLink
298
- PressStyle={styles.linkWithIcons}
299
- url={Platform.select({
300
- ios: `maps:0,0?q=${order?.customer?.address}`,
301
- android: `geo:0,0?q=${order?.customer?.address}`,
302
- })}
303
- shorcut={order?.customer?.address}
304
- TextStyle={styles.textLink}
305
- />
306
- </View>
308
+ <>
309
+ <View style={styles.linkWithIcons}>
310
+ <OLink
311
+ PressStyle={{ ...styles.linkWithIcons, marginBottom: 0 }}
312
+ url={Platform.select({
313
+ ios: `maps:0,0?q=${order?.customer?.address}`,
314
+ android: `geo:0,0?q=${order?.customer?.address}`,
315
+ })}
316
+ onTextLayout={onTextLayout}
317
+ numberOfLines={isReadMore ? 20 : 2}
318
+ shorcut={order?.customer?.address}
319
+ TextStyle={styles.textLink}
320
+ />
321
+ </View>
322
+ {lengthMore && (
323
+ <TouchableOpacity onPress={() => setIsReadMore(!isReadMore)}>
324
+ <OText size={12} color={theme.colors.statusOrderBlue}>{isReadMore ? t('SHOW_LESS', 'Show less') : t('READ_MORE', 'Read more')}</OText>
325
+ </TouchableOpacity>
326
+ )}
327
+ </>
307
328
  )}
308
329
 
309
330
  {!!order?.customer?.internal_number && (
@@ -333,13 +354,18 @@ export const OrderContentComponent = (props: OrderContent) => {
333
354
  <View style={{ marginTop: 10 }}>
334
355
  {order?.delivery_option !== undefined && order?.delivery_type === 1 && (
335
356
  <OText>
336
- {order?.delivery_option?.name}
357
+ {t(order?.delivery_option?.name?.toUpperCase()?.replace(/ /g, '_'), order?.delivery_option?.name)}
337
358
  </OText>
338
359
  )}
339
360
  {!!order?.comment && (
340
- <OText style={{ fontStyle: 'italic', opacity: 0.6, marginBottom: 5 }}>
341
- {order?.comment}
342
- </OText>
361
+ <>
362
+ <OText weight='500' style={{ marginBottom: 5 }}>
363
+ {t('ORDER_COMMENT', 'Order Comment')}
364
+ </OText>
365
+ <OText style={{ fontStyle: 'italic', opacity: 0.6, marginBottom: 20 }}>
366
+ {order?.comment}
367
+ </OText>
368
+ </>
343
369
  )}
344
370
  </View>
345
371
  )}
@@ -364,6 +390,7 @@ export const OrderContentComponent = (props: OrderContent) => {
364
390
  <ProductItemAccordion
365
391
  key={product?.id || i}
366
392
  product={product}
393
+ currency={order?.currency}
367
394
  />
368
395
  ))}
369
396
  </OrderProducts>
@@ -372,7 +399,7 @@ export const OrderContentComponent = (props: OrderContent) => {
372
399
  <Table>
373
400
  <OText mBottom={4}>{t('SUBTOTAL', 'Subtotal')}</OText>
374
401
  <OText mBottom={4}>
375
- {parsePrice(((order?.summary?.subtotal ?? order?.subtotal) + getIncludedTaxes()), { currency: order?.currency})}
402
+ {parsePrice(((order?.summary?.subtotal ?? order?.subtotal) + getIncludedTaxes()), { currency: order?.currency })}
376
403
  </OText>
377
404
  </Table>
378
405
  {(order?.summary?.discount > 0 ?? order?.discount > 0) && order?.offers?.length === 0 && (
@@ -385,7 +412,7 @@ export const OrderContentComponent = (props: OrderContent) => {
385
412
  ) : (
386
413
  <OText mBottom={4}>{t('DISCOUNT', theme?.defaultLanguages?.DISCOUNT || 'Discount')}</OText>
387
414
  )}
388
- <OText>- {parsePrice(order?.summary?.discount ?? order?.discount, { currency: order?.currency})}</OText>
415
+ <OText>- {parsePrice(order?.summary?.discount ?? order?.discount, { currency: order?.currency })}</OText>
389
416
  </Table>
390
417
  )}
391
418
  {
@@ -393,13 +420,13 @@ export const OrderContentComponent = (props: OrderContent) => {
393
420
  <Table key={offer.id}>
394
421
  <OSRow>
395
422
  <OText mBottom={4}>
396
- {offer.name}
423
+ {t(offer.name?.toUpperCase()?.replace(/ /g, '_'), offer.name)}
397
424
  {offer.rate_type === 1 && (
398
425
  <OText>{`(${verifyDecimals(offer?.rate, parsePrice)}%)`}</OText>
399
426
  )}
400
427
  </OText>
401
428
  </OSRow>
402
- <OText mBottom={4}>- {parsePrice(offer?.summary?.discount, { currency: order?.currency})}</OText>
429
+ <OText mBottom={4}>- {parsePrice(offer?.summary?.discount, { currency: order?.currency })}</OText>
403
430
  </Table>
404
431
  ))
405
432
  }
@@ -407,9 +434,9 @@ export const OrderContentComponent = (props: OrderContent) => {
407
434
  <Table>
408
435
  <OText mBottom={4}>{t('SUBTOTAL_WITH_DISCOUNT', 'Subtotal with discount')}</OText>
409
436
  {order?.tax_type === 1 ? (
410
- <OText mBottom={4}>{parsePrice((order?.summary?.subtotal_with_discount + getIncludedTaxesDiscounts() ?? 0), { currency: order?.currency})}</OText>
437
+ <OText mBottom={4}>{parsePrice((order?.summary?.subtotal_with_discount + getIncludedTaxesDiscounts() ?? 0), { currency: order?.currency })}</OText>
411
438
  ) : (
412
- <OText mBottom={4}>{parsePrice(order?.summary?.subtotal_with_discount ?? 0, { currency: order?.currency})}</OText>
439
+ <OText mBottom={4}>{parsePrice(order?.summary?.subtotal_with_discount ?? 0, { currency: order?.currency })}</OText>
413
440
  )}
414
441
  </Table>
415
442
  )}
@@ -419,7 +446,7 @@ export const OrderContentComponent = (props: OrderContent) => {
419
446
  {t('TAX', 'Tax')} {`(${verifyDecimals(order?.tax, parseNumber)}%)`}
420
447
  </OText>
421
448
  <OText mBottom={4}>
422
- {parsePrice(order?.summary?.tax ?? 0, { currency: order?.currency})}
449
+ {parsePrice(order?.summary?.tax ?? 0, { currency: order?.currency })}
423
450
  </OText>
424
451
  </Table>
425
452
  )}
@@ -430,7 +457,7 @@ export const OrderContentComponent = (props: OrderContent) => {
430
457
  {t('SERVICE_FEE', 'Service fee')}
431
458
  {`(${verifyDecimals(order?.service_fee, parseNumber)}%)`}
432
459
  </OText>
433
- <OText mBottom={4}>{parsePrice(order?.summary?.service_fee ?? 0, { currency: order?.currency})}</OText>
460
+ <OText mBottom={4}>{parsePrice(order?.summary?.service_fee ?? 0, { currency: order?.currency })}</OText>
434
461
  </Table>
435
462
  )
436
463
  }
@@ -439,11 +466,11 @@ export const OrderContentComponent = (props: OrderContent) => {
439
466
  <Table key={tax.id}>
440
467
  <OSRow>
441
468
  <OText mBottom={4}>
442
- {tax.name || t('INHERIT_FROM_BUSINESS', 'Inherit from business')}
469
+ {t(tax?.name?.toUpperCase()?.replace(/ /g, '_'), tax?.name) || t('INHERIT_FROM_BUSINESS', 'Inherit from business')}
443
470
  {`(${verifyDecimals(tax?.rate, parseNumber)}%)`}{' '}
444
471
  </OText>
445
472
  </OSRow>
446
- <OText mBottom={4}>{parsePrice(tax?.summary?.tax_after_discount ?? tax?.summary?.tax ?? 0, { currency: order?.currency})}</OText>
473
+ <OText mBottom={4}>{parsePrice(tax?.summary?.tax_after_discount ?? tax?.summary?.tax ?? 0, { currency: order?.currency })}</OText>
447
474
  </Table>
448
475
  ))
449
476
  }
@@ -452,11 +479,11 @@ export const OrderContentComponent = (props: OrderContent) => {
452
479
  <Table key={fee.id}>
453
480
  <OSRow>
454
481
  <OText mBottom={4}>
455
- {fee.name || t('INHERIT_FROM_BUSINESS', 'Inherit from business')}
456
- ({fee?.fixed > 0 && `${parsePrice(fee?.fixed, { currency: order?.currency})} + `}{fee.percentage}%){' '}
482
+ {t(fee?.name?.toUpperCase()?.replace(/ /g, '_'), fee?.name) || t('INHERIT_FROM_BUSINESS', 'Inherit from business')}
483
+ ({fee?.fixed > 0 && `${parsePrice(fee?.fixed, { currency: order?.currency })} + `}{fee.percentage}%){' '}
457
484
  </OText>
458
485
  </OSRow>
459
- <OText mBottom={4}>{parsePrice(fee?.summary?.fixed + (fee?.summary?.percentage_after_discount ?? fee?.summary?.percentage) ?? 0, { currency: order?.currency})}</OText>
486
+ <OText mBottom={4}>{parsePrice(fee?.summary?.fixed + (fee?.summary?.percentage_after_discount ?? fee?.summary?.percentage) ?? 0, { currency: order?.currency })}</OText>
460
487
  </Table>
461
488
  ))
462
489
  }
@@ -465,13 +492,13 @@ export const OrderContentComponent = (props: OrderContent) => {
465
492
  <Table key={offer.id}>
466
493
  <OSRow>
467
494
  <OText mBottom={4}>
468
- {offer.name}
495
+ {t(offer.name?.toUpperCase()?.replace(/ /g, '_'), offer.name)}
469
496
  {offer.rate_type === 1 && (
470
497
  <OText>{`(${verifyDecimals(offer?.rate, parsePrice)}%)`}</OText>
471
498
  )}
472
499
  </OText>
473
500
  </OSRow>
474
- <OText mBottom={4}>- {parsePrice(offer?.summary?.discount, { currency: order?.currency})}</OText>
501
+ <OText mBottom={4}>- {parsePrice(offer?.summary?.discount, { currency: order?.currency })}</OText>
475
502
  </Table>
476
503
  ))
477
504
  }
@@ -483,7 +510,7 @@ export const OrderContentComponent = (props: OrderContent) => {
483
510
  </OText>
484
511
 
485
512
  <OText mBottom={4}>
486
- {parsePrice(order?.summary?.delivery_price, { currency: order?.currency})}
513
+ {parsePrice(order?.summary?.delivery_price, { currency: order?.currency })}
487
514
  </OText>
488
515
  </Table>
489
516
  )
@@ -493,13 +520,13 @@ export const OrderContentComponent = (props: OrderContent) => {
493
520
  <Table key={offer.id}>
494
521
  <OSRow>
495
522
  <OText mBottom={4}>
496
- {offer.name}
523
+ {t(offer.name?.toUpperCase()?.replace(/ /g, '_'), offer.name)}
497
524
  {offer.rate_type === 1 && (
498
525
  <OText>{`(${verifyDecimals(offer?.rate, parsePrice)}%)`}</OText>
499
526
  )}
500
527
  </OText>
501
528
  </OSRow>
502
- <OText mBottom={4}>- {parsePrice(offer?.summary?.discount, { currency: order?.currency})}</OText>
529
+ <OText mBottom={4}>- {parsePrice(offer?.summary?.discount, { currency: order?.currency })}</OText>
503
530
  </Table>
504
531
  ))
505
532
  }
@@ -514,7 +541,7 @@ export const OrderContentComponent = (props: OrderContent) => {
514
541
  `(${verifyDecimals(order?.summary?.driver_tip, parseNumber)}%)`
515
542
  )}
516
543
  </OText>
517
- <OText mBottom={4}>{parsePrice(order?.summary?.driver_tip ?? order?.totalDriverTip, { currency: order?.currency})}</OText>
544
+ <OText mBottom={4}>{parsePrice(order?.summary?.driver_tip ?? order?.totalDriverTip, { currency: order?.currency })}</OText>
518
545
  </Table>
519
546
  )}
520
547
 
@@ -528,7 +555,7 @@ export const OrderContentComponent = (props: OrderContent) => {
528
555
  mBottom={4}
529
556
  style={styles.textBold}
530
557
  color={theme.colors.primary}>
531
- {parsePrice(order?.summary?.total ?? order?.total, { currency: order?.currency})}
558
+ {parsePrice(order?.summary?.total ?? order?.total, { currency: order?.currency })}
532
559
  </OText>
533
560
  </Table>
534
561
  </Total>
@@ -562,7 +589,7 @@ export const OrderContentComponent = (props: OrderContent) => {
562
589
  <OText>
563
590
  {event?.wallet_event
564
591
  ? walletName[event?.wallet_event?.wallet?.type]?.name
565
- : event?.paymethod?.name}
592
+ : t(event?.paymethod?.name?.toUpperCase()?.replace(/ /g, '_'), event?.paymethod?.name)}
566
593
  </OText>
567
594
  {event?.data?.charge_id && (
568
595
  <OText>
@@ -571,7 +598,7 @@ export const OrderContentComponent = (props: OrderContent) => {
571
598
  )}
572
599
  </View>
573
600
  <OText>
574
- -{parsePrice(event.amount, { currency: order?.currency})}
601
+ -{parsePrice(event.amount, { currency: order?.currency })}
575
602
  </OText>
576
603
  </View>
577
604
  ))}
@@ -271,7 +271,7 @@ export const OrderHeaderComponent = (props: OrderHeader) => {
271
271
  {order?.delivery_option && (
272
272
  <OText size={13}>
273
273
  <OText size={13} weight='bold'>{`${t('DELIVERY_PREFERENCE', 'Delivery Preference')}: `}</OText>
274
- {order?.delivery_option?.name}
274
+ {t(order?.delivery_option?.name?.toUpperCase()?.replace(/ /g, '_'), order?.delivery_option?.name)}
275
275
  </OText>
276
276
  )}
277
277
  {order?.payment_events?.length > 0 && (
@@ -286,8 +286,8 @@ export const OrderHeaderComponent = (props: OrderHeader) => {
286
286
  ? `${walletName[event?.wallet_event?.wallet?.type]?.name} - `
287
287
  : walletName[event?.wallet_event?.wallet?.type]?.name
288
288
  : idx < order?.payment_events?.length - 1
289
- ? `${event?.paymethod?.name} - `
290
- : event?.paymethod?.name
289
+ ? `${t(event?.paymethod?.name?.toUpperCase()?.replace(/ /g, '_'), event?.paymethod?.name)} - `
290
+ : t(event?.paymethod?.name?.toUpperCase()?.replace(/ /g, '_'), event?.paymethod?.name)
291
291
  })}
292
292
  </OText>
293
293
  </View>