ordering-ui-react-native 0.18.55-test1 → 0.18.56-crash-driver-1

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 (266) hide show
  1. package/package.json +6 -5
  2. package/src/components/BusinessInformation/index.tsx +10 -9
  3. package/src/components/PaymentOptionsWebView/index.tsx +30 -8
  4. package/src/components/PhoneInputNumber/index.tsx +6 -2
  5. package/src/components/StripeMethodForm/index.tsx +60 -55
  6. package/src/components/shared/OToast.tsx +3 -2
  7. package/src/types/index.tsx +3 -1
  8. package/src/utils/index.tsx +2 -2
  9. package/themes/business/index.tsx +6 -0
  10. package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +15 -8
  11. package/themes/business/src/components/BusinessController/index.tsx +19 -17
  12. package/themes/business/src/components/BusinessProductList/AccordionDropdown.tsx +63 -0
  13. package/themes/business/src/components/BusinessProductList/IterateCategories.tsx +108 -0
  14. package/themes/business/src/components/BusinessProductList/ProductList.tsx +196 -0
  15. package/themes/business/src/components/BusinessProductList/index.tsx +196 -0
  16. package/themes/business/src/components/BusinessProductList/styles.tsx +10 -0
  17. package/themes/business/src/components/Chat/index.tsx +48 -19
  18. package/themes/business/src/components/DriverMap/index.tsx +36 -23
  19. package/themes/business/src/components/DriverSchedule/index.tsx +45 -8
  20. package/themes/business/src/components/FloatingButton/index.tsx +34 -31
  21. package/themes/business/src/components/GoogleMap/index.tsx +15 -8
  22. package/themes/business/src/components/Home/index.tsx +5 -1
  23. package/themes/business/src/components/LanguageSelector/index.tsx +1 -2
  24. package/themes/business/src/components/LanguageSelector/lang_country.json +515 -70
  25. package/themes/business/src/components/LoginForm/index.tsx +2 -2
  26. package/themes/business/src/components/LogoutButton/index.tsx +1 -1
  27. package/themes/business/src/components/MapView/index.tsx +28 -17
  28. package/themes/business/src/components/MessagesOption/index.tsx +22 -94
  29. package/themes/business/src/components/NewOrderNotification/index.tsx +162 -106
  30. package/themes/business/src/components/NotFoundSource/index.tsx +2 -2
  31. package/themes/business/src/components/OrderDetails/Business.tsx +53 -3
  32. package/themes/business/src/components/OrderDetails/Delivery.tsx +209 -13
  33. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +107 -75
  34. package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +79 -41
  35. package/themes/business/src/components/OrderDetails/usePrinterCommands.tsx +220 -0
  36. package/themes/business/src/components/OrderDetailsLogistic/index.tsx +7 -2
  37. package/themes/business/src/components/OrderMessage/index.tsx +1 -1
  38. package/themes/business/src/components/OrderSummary/index.tsx +245 -82
  39. package/themes/business/src/components/OrdersListManager/index.tsx +7 -2
  40. package/themes/business/src/components/OrdersListManager/utils.tsx +1 -1
  41. package/themes/business/src/components/OrdersOption/index.tsx +125 -48
  42. package/themes/business/src/components/PhoneInputNumber/index.tsx +8 -5
  43. package/themes/business/src/components/PreviousMessages/FooterMessageComponent.tsx +103 -0
  44. package/themes/business/src/components/PreviousMessages/index.tsx +97 -55
  45. package/themes/business/src/components/PreviousOrders/OrderItem.tsx +43 -41
  46. package/themes/business/src/components/PreviousOrders/OrderList.tsx +93 -0
  47. package/themes/business/src/components/PreviousOrders/OrdersGroupedItem.tsx +1 -1
  48. package/themes/business/src/components/PreviousOrders/index.tsx +195 -221
  49. package/themes/business/src/components/PreviousOrders/styles.tsx +10 -0
  50. package/themes/business/src/components/PrinterEdition/index.tsx +363 -0
  51. package/themes/business/src/components/PrinterEdition/styles.tsx +61 -0
  52. package/themes/business/src/components/PrinterSettings/index.tsx +267 -0
  53. package/themes/business/src/components/PrinterSettings/styles.tsx +30 -0
  54. package/themes/business/src/components/ProductItemAccordion/index.tsx +2 -2
  55. package/themes/business/src/components/ReviewCustomer/index.tsx +1 -1
  56. package/themes/business/src/components/SearchBar/index.tsx +2 -1
  57. package/themes/business/src/components/Sessions/index.tsx +187 -0
  58. package/themes/business/src/components/Sessions/styles.tsx +20 -0
  59. package/themes/business/src/components/StoresList/index.tsx +4 -3
  60. package/themes/business/src/components/UserFormDetails/index.tsx +111 -107
  61. package/themes/business/src/components/UserProfileForm/index.tsx +103 -53
  62. package/themes/business/src/components/WebsocketStatus/index.tsx +171 -0
  63. package/themes/business/src/components/WebsocketStatus/styles.tsx +28 -0
  64. package/themes/business/src/components/shared/OInput.tsx +2 -0
  65. package/themes/business/src/hooks/useLocation.tsx +5 -4
  66. package/themes/business/src/types/index.tsx +21 -1
  67. package/themes/business/src/utils/index.tsx +5 -0
  68. package/themes/kiosk/src/components/Checkout/index.tsx +5 -3
  69. package/themes/kiosk/src/components/CustomerName/index.tsx +1 -1
  70. package/themes/kiosk/src/components/Intro/index.tsx +16 -1
  71. package/themes/kiosk/src/components/LoginForm/index.tsx +131 -101
  72. package/themes/kiosk/src/components/PaymentOptions/index.tsx +57 -121
  73. package/themes/original/index.tsx +11 -3
  74. package/themes/original/src/components/AddressDetails/index.tsx +20 -10
  75. package/themes/original/src/components/AddressForm/index.tsx +41 -20
  76. package/themes/original/src/components/AddressForm/styles.tsx +1 -1
  77. package/themes/original/src/components/AddressList/index.tsx +22 -11
  78. package/themes/original/src/components/AddressList/styles.tsx +4 -4
  79. package/themes/original/src/components/AnalyticsSegment/index.tsx +10 -7
  80. package/themes/original/src/components/AppleLogin/styles.tsx +3 -1
  81. package/themes/original/src/components/BusinessBasicInformation/index.tsx +8 -11
  82. package/themes/original/src/components/BusinessBasicInformation/styles.tsx +1 -1
  83. package/themes/original/src/components/BusinessController/index.tsx +40 -43
  84. package/themes/original/src/components/BusinessController/styles.tsx +12 -12
  85. package/themes/original/src/components/BusinessInformation/index.tsx +45 -17
  86. package/themes/original/src/components/BusinessInformation/styles.tsx +2 -2
  87. package/themes/original/src/components/BusinessItemAccordion/index.tsx +11 -7
  88. package/themes/original/src/components/BusinessListingSearch/BusinessSearchFooter.tsx +317 -0
  89. package/themes/original/src/components/BusinessListingSearch/BusinessSearchHeader.tsx +96 -0
  90. package/themes/original/src/components/BusinessListingSearch/MaxSectionItem/index.tsx +1 -1
  91. package/themes/original/src/components/BusinessListingSearch/index.tsx +57 -361
  92. package/themes/original/src/components/BusinessListingSearch/styles.tsx +1 -1
  93. package/themes/original/src/components/BusinessPreorder/index.tsx +9 -7
  94. package/themes/original/src/components/BusinessProductsCategories/index.tsx +2 -3
  95. package/themes/original/src/components/BusinessProductsList/index.tsx +5 -4
  96. package/themes/original/src/components/BusinessProductsListing/index.tsx +67 -28
  97. package/themes/original/src/components/BusinessProductsListing/styles.tsx +3 -4
  98. package/themes/original/src/components/BusinessReviews/index.tsx +1 -1
  99. package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +1 -1
  100. package/themes/original/src/components/BusinessesListing/Layout/Appointment/styles.tsx +5 -5
  101. package/themes/original/src/components/BusinessesListing/Layout/Original/FlatListBusinessListFooter.tsx +69 -0
  102. package/themes/original/src/components/BusinessesListing/Layout/Original/FlatListBusinessListHeader.tsx +406 -0
  103. package/themes/original/src/components/BusinessesListing/Layout/Original/FlatListBusinessListing.tsx +76 -0
  104. package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +30 -404
  105. package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +2 -2
  106. package/themes/original/src/components/Cart/index.tsx +51 -40
  107. package/themes/original/src/components/CartContent/index.tsx +98 -54
  108. package/themes/original/src/components/CartStoresListing/styles.tsx +2 -2
  109. package/themes/original/src/components/Checkout/index.tsx +308 -75
  110. package/themes/original/src/components/Checkout/styles.tsx +17 -0
  111. package/themes/original/src/components/CitiesControl/styles.tsx +1 -1
  112. package/themes/original/src/components/DatePicker/index.tsx +33 -0
  113. package/themes/original/src/components/DatePicker/styles.tsx +20 -0
  114. package/themes/original/src/components/DriverTips/index.tsx +6 -3
  115. package/themes/original/src/components/FacebookLogin/styles.tsx +3 -1
  116. package/themes/original/src/components/Favorite/index.tsx +8 -4
  117. package/themes/original/src/components/Favorite/styles.tsx +0 -2
  118. package/themes/original/src/components/FloatingButton/styles.tsx +1 -1
  119. package/themes/original/src/components/ForgotPasswordForm/index.tsx +5 -0
  120. package/themes/original/src/components/GPSButton/index.tsx +7 -5
  121. package/themes/original/src/components/GiftCard/GiftCardOrdersList/index.tsx +64 -0
  122. package/themes/original/src/components/GiftCard/GiftCardOrdersList/styles.tsx +8 -0
  123. package/themes/original/src/components/GiftCard/GiftCardUI/index.tsx +8 -3
  124. package/themes/original/src/components/GiftCard/PurchaseGiftCard/index.tsx +36 -3
  125. package/themes/original/src/components/GiftCard/PurchaseGiftCard/styles.tsx +1 -1
  126. package/themes/original/src/components/GiftCard/RedeemGiftCard/index.tsx +84 -8
  127. package/themes/original/src/components/GiftCard/RedeemGiftCard/styles.tsx +1 -1
  128. package/themes/original/src/components/GiftCard/SendGiftCard/index.tsx +2 -2
  129. package/themes/original/src/components/GiftCard/SendGiftCard/styles.tsx +1 -1
  130. package/themes/original/src/components/GiftCard/SingleGiftCard/index.tsx +101 -0
  131. package/themes/original/src/components/GiftCard/SingleGiftCard/styles.tsx +4 -0
  132. package/themes/original/src/components/GiftCard/VerticalGiftCardOrdersLayout/index.tsx +83 -0
  133. package/themes/original/src/components/GiftCard/VerticalGiftCardOrdersLayout/styles.tsx +9 -0
  134. package/themes/original/src/components/GoogleLogin/styles.tsx +1 -1
  135. package/themes/original/src/components/GoogleMap/index.tsx +52 -5
  136. package/themes/original/src/components/Help/index.tsx +7 -0
  137. package/themes/original/src/components/HelpAccountAndPayment/index.tsx +5 -0
  138. package/themes/original/src/components/HelpGuide/index.tsx +5 -0
  139. package/themes/original/src/components/HelpOrder/index.tsx +5 -0
  140. package/themes/original/src/components/HighestRatedBusinesses/index.tsx +1 -1
  141. package/themes/original/src/components/HighestRatedBusinesses/styles.tsx +1 -1
  142. package/themes/original/src/components/Home/index.tsx +3 -2
  143. package/themes/original/src/components/LastOrder/index.tsx +2 -1
  144. package/themes/original/src/components/LastOrders/index.tsx +2 -1
  145. package/themes/original/src/components/LoginForm/Otp/index.tsx +79 -25
  146. package/themes/original/src/components/LoginForm/index.tsx +38 -14
  147. package/themes/original/src/components/MessageListing/index.tsx +6 -0
  148. package/themes/original/src/components/Messages/index.tsx +9 -3
  149. package/themes/original/src/components/Messages/styles.tsx +1 -1
  150. package/themes/original/src/components/MomentOption/index.tsx +20 -5
  151. package/themes/original/src/components/MomentSelector/index.tsx +1 -1
  152. package/themes/original/src/components/MultiCart/index.tsx +1 -1
  153. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +48 -15
  154. package/themes/original/src/components/MultiCheckout/index.tsx +295 -56
  155. package/themes/original/src/components/MultiCheckout/styles.tsx +20 -1
  156. package/themes/original/src/components/MultiOrdersDetails/index.tsx +21 -16
  157. package/themes/original/src/components/MyOrders/index.tsx +37 -39
  158. package/themes/original/src/components/NavBar/index.tsx +15 -14
  159. package/themes/original/src/components/NetworkError/index.tsx +2 -3
  160. package/themes/original/src/components/NetworkError/styles.tsx +2 -2
  161. package/themes/original/src/components/Notifications/index.tsx +9 -8
  162. package/themes/original/src/components/Notifications/styles.tsx +0 -1
  163. package/themes/original/src/components/OrderDetails/OrderEta.tsx +21 -6
  164. package/themes/original/src/components/OrderDetails/OrderHistory.tsx +14 -5
  165. package/themes/original/src/components/OrderDetails/index.tsx +718 -667
  166. package/themes/original/src/components/OrderDetails/styles.tsx +24 -7
  167. package/themes/original/src/components/OrderProgress/index.tsx +50 -14
  168. package/themes/original/src/components/OrderProgress/styles.tsx +1 -1
  169. package/themes/original/src/components/OrderSummary/index.tsx +26 -34
  170. package/themes/original/src/components/OrderTypeSelector/index.tsx +5 -0
  171. package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/styles.tsx +1 -1
  172. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/styles.tsx +1 -1
  173. package/themes/original/src/components/OrdersOption/index.tsx +14 -6
  174. package/themes/original/src/components/OrdersOption/styles.tsx +1 -1
  175. package/themes/original/src/components/PageBanner/index.tsx +3 -0
  176. package/themes/original/src/components/PaymentOptionCard/index.tsx +182 -0
  177. package/themes/original/src/components/PaymentOptionStripe/styles.tsx +3 -0
  178. package/themes/original/src/components/PaymentOptions/index.tsx +118 -37
  179. package/themes/original/src/components/PhoneInputNumber/index.tsx +15 -1
  180. package/themes/original/src/components/PreviousOrders/index.tsx +2 -0
  181. package/themes/original/src/components/ProductForm/ActionButton.tsx +122 -0
  182. package/themes/original/src/components/ProductForm/ExtraOptions.tsx +56 -0
  183. package/themes/original/src/components/ProductForm/index.tsx +193 -267
  184. package/themes/original/src/components/ProductForm/styles.tsx +1 -1
  185. package/themes/original/src/components/ProductItemAccordion/index.tsx +55 -42
  186. package/themes/original/src/components/ProductItemAccordion/styles.tsx +3 -4
  187. package/themes/original/src/components/ProductOptionSubOption/index.tsx +120 -79
  188. package/themes/original/src/components/ProductOptionSubOption/styles.tsx +10 -9
  189. package/themes/original/src/components/ProfessionalProfile/styles.tsx +3 -3
  190. package/themes/original/src/components/Promotions/index.tsx +13 -11
  191. package/themes/original/src/components/Promotions/styles.tsx +0 -2
  192. package/themes/original/src/components/ReviewDriver/index.tsx +5 -0
  193. package/themes/original/src/components/ReviewDriver/styles.tsx +1 -1
  194. package/themes/original/src/components/ReviewOrder/index.tsx +5 -0
  195. package/themes/original/src/components/ReviewOrder/styles.tsx +1 -1
  196. package/themes/original/src/components/ReviewProducts/index.tsx +5 -0
  197. package/themes/original/src/components/ReviewProducts/styles.tsx +1 -1
  198. package/themes/original/src/components/ScheduleAccordion/index.tsx +3 -3
  199. package/themes/original/src/components/ServiceForm/index.tsx +2 -2
  200. package/themes/original/src/components/ServiceForm/styles.tsx +4 -4
  201. package/themes/original/src/components/Sessions/index.tsx +5 -0
  202. package/themes/original/src/components/SignupForm/index.tsx +76 -60
  203. package/themes/original/src/components/SingleOrderCard/index.tsx +6 -5
  204. package/themes/original/src/components/SingleProductCard/index.tsx +5 -4
  205. package/themes/original/src/components/SingleProductCard/styles.tsx +0 -5
  206. package/themes/original/src/components/StripeCardsList/index.tsx +26 -8
  207. package/themes/original/src/components/StripeElementsForm/index.tsx +80 -62
  208. package/themes/original/src/components/StripeElementsForm/naked.tsx +59 -1
  209. package/themes/original/src/components/UpsellingProducts/UpsellingContent.tsx +170 -0
  210. package/themes/original/src/components/UpsellingProducts/UpsellingLayout.tsx +91 -0
  211. package/themes/original/src/components/UpsellingProducts/index.tsx +15 -199
  212. package/themes/original/src/components/UpsellingProducts/styles.tsx +19 -0
  213. package/themes/original/src/components/UserFormDetails/index.tsx +128 -79
  214. package/themes/original/src/components/UserFormDetails/styles.tsx +8 -1
  215. package/themes/original/src/components/UserProfile/index.tsx +5 -4
  216. package/themes/original/src/components/UserProfileForm/index.tsx +35 -36
  217. package/themes/original/src/components/UserVerification/index.tsx +55 -50
  218. package/themes/original/src/components/WalletTransactionItem/index.tsx +2 -2
  219. package/themes/original/src/components/WalletTransactions/styles.tsx +1 -0
  220. package/themes/original/src/components/Wallets/index.tsx +35 -49
  221. package/themes/original/src/components/Wallets/styles.tsx +3 -4
  222. package/themes/original/src/components/WebsocketStatus/index.tsx +172 -0
  223. package/themes/original/src/components/WebsocketStatus/styles.tsx +28 -0
  224. package/themes/original/src/components/shared/HeaderTitle.tsx +1 -1
  225. package/themes/original/src/components/shared/OButton.tsx +5 -5
  226. package/themes/original/src/components/shared/OInput.tsx +7 -4
  227. package/themes/original/src/components/shared/OModal.tsx +12 -14
  228. package/themes/original/src/layouts/Container.tsx +5 -3
  229. package/themes/original/src/types/index.tsx +13 -2
  230. package/themes/original/src/utils/index.tsx +124 -22
  231. package/src/navigators/BottomNavigator.tsx +0 -117
  232. package/src/navigators/CheckoutNavigator.tsx +0 -66
  233. package/src/navigators/HomeNavigator.tsx +0 -202
  234. package/src/navigators/NavigationRef.tsx +0 -7
  235. package/src/navigators/RootNavigator.tsx +0 -269
  236. package/src/pages/Account.tsx +0 -34
  237. package/src/pages/AddressForm.tsx +0 -62
  238. package/src/pages/AddressList.tsx +0 -24
  239. package/src/pages/BusinessProductsList.tsx +0 -81
  240. package/src/pages/BusinessesListing.tsx +0 -43
  241. package/src/pages/CartList.tsx +0 -49
  242. package/src/pages/Checkout.tsx +0 -101
  243. package/src/pages/ForgotPassword.tsx +0 -24
  244. package/src/pages/Help.tsx +0 -23
  245. package/src/pages/HelpAccountAndPayment.tsx +0 -23
  246. package/src/pages/HelpGuide.tsx +0 -23
  247. package/src/pages/HelpOrder.tsx +0 -23
  248. package/src/pages/Home.tsx +0 -36
  249. package/src/pages/IntroductoryTutorial.tsx +0 -170
  250. package/src/pages/Login.tsx +0 -47
  251. package/src/pages/MomentOption.tsx +0 -30
  252. package/src/pages/MultiCheckout.tsx +0 -31
  253. package/src/pages/MultiOrdersDetails.tsx +0 -27
  254. package/src/pages/MyOrders.tsx +0 -40
  255. package/src/pages/NetworkError.tsx +0 -24
  256. package/src/pages/NotFound.tsx +0 -22
  257. package/src/pages/OrderDetails.tsx +0 -25
  258. package/src/pages/ProductDetails.tsx +0 -55
  259. package/src/pages/Profile.tsx +0 -36
  260. package/src/pages/ReviewDriver.tsx +0 -30
  261. package/src/pages/ReviewOrder.tsx +0 -32
  262. package/src/pages/ReviewProducts.tsx +0 -30
  263. package/src/pages/Sessions.tsx +0 -22
  264. package/src/pages/Signup.tsx +0 -53
  265. package/src/pages/SpinnerLoader.tsx +0 -10
  266. package/src/pages/Splash.tsx +0 -21
@@ -55,7 +55,7 @@ const MapViewComponent = (props: MapViewParams) => {
55
55
  if (mapRef.current) {
56
56
  mapRef.current.fitToCoordinates(
57
57
  [
58
- { latitude: location.latitude, longitude: location.longitude },
58
+ { latitude: location.latitude ?? 0, longitude: location.longitude ?? 0},
59
59
  {
60
60
  latitude: userLocation?.latitude,
61
61
  longitude: userLocation?.longitude,
@@ -72,8 +72,8 @@ const MapViewComponent = (props: MapViewParams) => {
72
72
  const lastRegion = mapRef?.current?.__lastRegion
73
73
  mapRef?.current && mapRef.current.animateToRegion({
74
74
  ...mapRef?.current?.__lastRegion,
75
- longitudeDelta: lastRegion.longitudeDelta / 8,
76
- latitudeDelta: lastRegion.longitudeDelta / 8
75
+ longitudeDelta: lastRegion?.longitudeDelta / 8,
76
+ latitudeDelta: lastRegion?.longitudeDelta / 8
77
77
  })
78
78
  }
79
79
 
@@ -81,8 +81,8 @@ const MapViewComponent = (props: MapViewParams) => {
81
81
  const lastRegion = mapRef?.current?.__lastRegion
82
82
  mapRef?.current && mapRef.current.animateToRegion({
83
83
  ...lastRegion,
84
- longitudeDelta: lastRegion.longitudeDelta * 8,
85
- latitudeDelta: lastRegion.longitudeDelta * 8
84
+ longitudeDelta: lastRegion?.longitudeDelta * 8,
85
+ latitudeDelta: lastRegion?.longitudeDelta * 8
86
86
  })
87
87
  }
88
88
 
@@ -132,6 +132,10 @@ const MapViewComponent = (props: MapViewParams) => {
132
132
 
133
133
  const RenderMarker = ({ marker, customer, orderIds }: { marker: any, customer?: boolean, orderIds?: Array<number> }) => {
134
134
  const markerRef = useRef<any>()
135
+
136
+ let coordinateLat = (customer ? marker?.customer?.location?.lat : marker?.business?.location?.lat) ?? initialPosition?.latitude
137
+ let coordinateLng = (customer ? marker?.customer?.location?.lng : marker?.business?.location?.lng) ?? initialPosition?.longitude
138
+
135
139
  useEffect(() => {
136
140
  if (
137
141
  markerRef?.current?.props?.coordinate?.latitude === locationSelected?.latitude &&
@@ -145,8 +149,8 @@ const MapViewComponent = (props: MapViewParams) => {
145
149
  <Marker
146
150
  key={customer ? marker?.customer?.id : marker?.business?.id}
147
151
  coordinate={{
148
- latitude: customer ? marker?.customer?.location?.lat : marker?.business?.location?.lat,
149
- longitude: customer ? marker?.customer?.location?.lng : marker?.business?.location?.lng
152
+ latitude: coordinateLat,
153
+ longitude: coordinateLng
150
154
  }}
151
155
  onPress={() =>
152
156
  setLocationSelected({
@@ -161,14 +165,16 @@ const MapViewComponent = (props: MapViewParams) => {
161
165
  size={50}
162
166
  color={theme.colors.primary}
163
167
  />
164
- <View style={styles.view}>
165
- <OIcon
166
- style={styles.image}
167
- src={{ uri: customer ? marker?.customer?.photo : marker?.business?.logo }}
168
- width={25}
169
- height={25}
170
- />
171
- </View>
168
+ {(!!marker?.customer?.photo || !!marker?.business?.logo) && (
169
+ <View style={styles.view}>
170
+ <OIcon
171
+ style={styles.image}
172
+ src={{ uri: customer ? marker?.customer?.photo : marker?.business?.logo }}
173
+ width={25}
174
+ height={25}
175
+ />
176
+ </View>
177
+ )}
172
178
  <Callout
173
179
  onPress={() => !!orderIds && orderIds.toString().includes(',') ? onNavigationRedirect('Orders') : onNavigationRedirect('OrderDetails', { order: marker })}
174
180
  >
@@ -189,8 +195,8 @@ const MapViewComponent = (props: MapViewParams) => {
189
195
  {((customer && marker?.customer?.city?.address_notes) || !customer) && (
190
196
  <OText>{customer ? marker?.customer?.city?.address_notes : marker?.business?.city?.name}</OText>
191
197
  )}
192
- {((customer && marker?.business?.zipcode) || (!customer && marker?.business?.zipcode)) && (
193
- <OText>{customer ? marker?.customer?.zipcode : marker?.business?.zipcode}</OText>
198
+ {((customer && !!marker?.business?.zipcode) || (!customer && !!marker?.business?.zipcode)) && (
199
+ <OText>{customer ? marker?.customer?.zipcode ?? '' : marker?.business?.zipcode ?? ''}</OText>
194
200
  )}
195
201
  {customer && !!marker?.customer?.internal_number && (
196
202
  <OText>{marker?.customer?.internal_number}</OText>
@@ -225,6 +231,11 @@ const MapViewComponent = (props: MapViewParams) => {
225
231
  return (
226
232
  <SafeAreaView style={{ flex: 1 }}>
227
233
  <View style={{ flex: 1 }}>
234
+ <View>
235
+ <OText>
236
+ {`Locations: lat: ${userLocation?.latitude}, lng: ${userLocation?.longitude}`}
237
+ </OText>
238
+ </View>
228
239
  {!isLoadingBusinessMarkers && isFocused && (
229
240
  <View style={{ flex: 1 }}>
230
241
  <MapView
@@ -2,20 +2,18 @@ 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
+ import { WebsocketStatus } from '../WebsocketStatus'
16
+
19
17
  const MessagesOptionUI = (props: MessagesOptionParams) => {
20
18
  const {
21
19
  orders,
@@ -65,12 +63,6 @@ const MessagesOptionUI = (props: MessagesOptionParams) => {
65
63
  ),
66
64
  );
67
65
 
68
- const [orientation, setOrientation] = useState(
69
- Dimensions.get('window').width < Dimensions.get('window').height
70
- ? 'Portrait'
71
- : 'Landscape',
72
- );
73
-
74
66
  const getTagFilter = (key: number) => {
75
67
  return tags.find(value => value.key === key)?.text;
76
68
  };
@@ -114,14 +106,6 @@ const MessagesOptionUI = (props: MessagesOptionParams) => {
114
106
  );
115
107
  }, [orders]);
116
108
 
117
- Dimensions.addEventListener('change', ({ window: { width, height } }) => {
118
- if (width < height) {
119
- setOrientation('Portrait');
120
- } else {
121
- setOrientation('Landscape');
122
- }
123
- });
124
-
125
109
  const styles = StyleSheet.create({
126
110
  header: {
127
111
  marginBottom: 25,
@@ -180,7 +164,7 @@ const MessagesOptionUI = (props: MessagesOptionParams) => {
180
164
  <View style={styles.header}>
181
165
  <OText style={styles.title}>{t('MESSAGES', 'Messages')}</OText>
182
166
  </View>
183
-
167
+ <WebsocketStatus />
184
168
  <FiltersTab>
185
169
  <TabsContainer width={dimensions.width - 42}>
186
170
  {tabs.map((tab: any) => (
@@ -242,35 +226,28 @@ const MessagesOptionUI = (props: MessagesOptionParams) => {
242
226
  !error
243
227
  ? t('NO_RESULTS_FOUND', 'Sorry, no results found')
244
228
  : error[0]?.message ||
245
- error[0] ||
246
- t('NETWORK_ERROR', 'Network Error')
229
+ error[0] ||
230
+ t('NETWORK_ERROR', 'Network Error')
247
231
  }
248
232
  image={theme.images.general.notFound}
249
233
  conditioned={false}
250
234
  />
251
235
  )}
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 &&
236
+ <PreviousMessages
237
+ orders={values}
238
+ messages={messages}
239
+ onNavigationRedirect={onNavigationRedirect}
240
+ getOrders={getOrders}
241
+ pagination={pagination}
242
+ loading={loading}
243
+ reload={reload}
244
+ tabs={tabs}
245
+ tabsFilter={tabsFilter}
246
+ setOrders={setOrders}
247
+ loadMore={loadMore}
248
+ error={error}
249
+ />
250
+ {/* {!reload &&
274
251
  !error &&
275
252
  orders.length > 0 &&
276
253
  JSON.stringify(tabsFilter) === JSON.stringify(tabs[1].tags) && (
@@ -283,55 +260,6 @@ const MessagesOptionUI = (props: MessagesOptionParams) => {
283
260
  onNavigationRedirect={onNavigationRedirect}
284
261
  />
285
262
  )} */}
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
263
  </>
336
264
  );
337
265
  };
@@ -1,106 +1,170 @@
1
+ import React, { useEffect, useState } from 'react';
2
+ import {
3
+ Modal,
4
+ View,
5
+ StyleSheet,
6
+ Dimensions,
7
+ TouchableOpacity,
8
+ NativeModules,
9
+ PermissionsAndroid,
10
+ Platform
11
+ } from 'react-native';
12
+ import { useTheme } from 'styled-components/native'
1
13
  import moment from 'moment'
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'
5
- import Sound from 'react-native-sound'
6
14
  import Icon from 'react-native-vector-icons/Feather'
7
- import { useTheme } from 'styled-components/native'
15
+ import SoundPlayer from 'react-native-sound-player'
16
+
17
+ import {
18
+ NewOrderNotification as NewOrderNotificationController,
19
+ useApi,
20
+ useEvent,
21
+ useLanguage,
22
+ useSession,
23
+ useConfig,
24
+ useToast,
25
+ ToastType
26
+ } from 'ordering-components/native'
8
27
 
9
- import { useLocation } from '../../hooks/useLocation'
10
28
  import { OIcon, OText } from '../shared'
11
29
  import { NotificationContainer } from './styles'
30
+ import { useLocation } from '../../hooks/useLocation'
12
31
 
13
- Sound.setCategory('Playback', true)
14
- Sound.setMode('Default')
15
-
32
+ const DELAY_SOUND = 2500 // 2 sec
16
33
  const windowWidth = Dimensions.get('screen').width
17
34
 
18
- const SOUND_LOOP = 3
35
+ const SoundPlayerComponent = (props: any) => {
36
+ const { evtList, currentEvent, handleCloseEvents } = props
19
37
 
20
- const NewOrderNotificationUI = (props: any) => {
21
- const { isBusinessApp } = props
22
- const [events] = useEvent()
23
38
  const theme = useTheme()
24
- const [, t] = useLanguage()
25
- const [{ user, token }] = useSession()
26
- const [ordering] = useApi()
27
- const { getCurrentLocation } = useLocation();
28
- const [currentEvent, setCurrentEvent] = useState<any>(null)
29
-
30
- const evtList: any = {
31
- 1: {
32
- event: 'messages',
33
- message: t('NEW_MESSAGES_RECEIVED', 'New messages have been received!'),
34
- message2: t('ORDER_N_UNREAD_MESSAGES', 'Order #_order_id_ has unread messages.').replace('_order_id_', currentEvent?.orderId),
35
- },
36
- 2: {
37
- event: 'order_added',
38
- message: t('NEW_ORDERS_RECEIVED', 'New orders have been received!'),
39
- message2: t('ORDER_N_ORDERED', 'Order #_order_id_ has been ordered.').replace('_order_id_', currentEvent?.orderId),
40
- },
41
- 3: {
42
- event: 'order_updated',
43
- message: t('NEW_ORDERS_UPDATED', 'New orders have been updated!'),
44
- message2: t('ORDER_N_UPDATED', 'Order #_order_id_ has been updated.').replace('_order_id_', currentEvent?.orderId),
45
- },
46
- }
39
+ const [count, setCount] = useState(0);
40
+ const [isEnabledReadStorage, setIsEnabledReadStorage] = useState(true)
41
+ const URL_SOUND = 'https://d33aymufw4jvwf.cloudfront.net/notification.mp3' ?? theme.sounds.notification
47
42
 
48
- const notificationSound = new Sound(theme.sounds.notification, '', () => { });
43
+ useEffect(() => {
44
+ const id = setInterval(() => setCount(count + 1), 2500)
49
45
 
50
- let _timeout: any = null
46
+ const playSound = async () => {
47
+ SoundPlayer.playUrl(URL_SOUND)
48
+ await new Promise(resolve => setTimeout(resolve, DELAY_SOUND))
49
+ SoundPlayer.stop()
50
+ }
51
+ if (NativeModules?.RNSoundPlayer?.playUrl && typeof URL_SOUND === 'string' && isEnabledReadStorage) {
52
+ playSound()
53
+ }
51
54
 
52
- const handleCloseEvents = () => {
53
- notificationSound.stop()
54
- setCurrentEvent(null)
55
- clearInterval(_timeout)
56
- }
55
+ return () => {
56
+ SoundPlayer.stop()
57
+ clearInterval(id);
58
+ }
59
+ }, [count, isEnabledReadStorage])
57
60
 
58
- const handlePlayNotificationSound = (eventObj: any = null) => {
59
- setCurrentEvent(eventObj)
60
- let times = 1
61
- _timeout = setInterval(() => {
62
- if (times <= SOUND_LOOP) {
63
- notificationSound.play()
64
- times++
61
+ useEffect(() => {
62
+ const checkSoundMedia = async () => {
63
+ if (Platform.OS === 'android') {
64
+ const enabled = await PermissionsAndroid.check(PermissionsAndroid.PERMISSIONS.READ_EXTERNAL_STORAGE)
65
+ setIsEnabledReadStorage(enabled)
65
66
  } else {
66
- clearInterval(_timeout)
67
- times = 1
68
- return
67
+ setIsEnabledReadStorage(true)
69
68
  }
70
- }, 2500)
71
- }
69
+ }
70
+ checkSoundMedia()
71
+
72
+ }, [])
73
+ return (
74
+ <Modal
75
+ animationType='slide'
76
+ transparent={true}
77
+ visible={!!currentEvent?.orderId}
78
+ >
79
+ <NotificationContainer>
80
+ <View style={styles.modalView}>
81
+ <TouchableOpacity
82
+ style={styles.wrapperIcon}
83
+ onPress={() => handleCloseEvents()}
84
+ >
85
+ <Icon name="x" size={30} />
86
+ </TouchableOpacity>
87
+ <OText
88
+ size={18}
89
+ color={theme.colors.textGray}
90
+ weight={600}
91
+ >
92
+ {evtList(currentEvent)[currentEvent?.evt]?.message}
93
+ </OText>
94
+ <OIcon
95
+ src={theme.images.general.newOrder}
96
+ width={250}
97
+ height={200}
98
+ />
99
+ <OText
100
+ color={theme.colors.textGray}
101
+ mBottom={15}
102
+ >
103
+ {evtList(currentEvent)[currentEvent?.evt]?.message2}
104
+ </OText>
105
+ </View>
106
+ </NotificationContainer>
107
+ </Modal>
108
+ )
109
+ }
110
+
111
+ const NewOrderNotificationUI = (props: any) => {
112
+ const { isBusinessApp, evtList, orderStatus } = props
113
+ const [, t] = useLanguage()
114
+ const [events] = useEvent()
115
+ const [{ user, token }] = useSession()
116
+ const [ordering] = useApi()
117
+ const [, { showToast }] = useToast()
118
+ const { getCurrentLocation } = useLocation()
119
+ const [currentEvent, setCurrentEvent] = useState<any>(null)
72
120
 
73
- const handleEventNotification = async (evtType: number, value: any) => {
121
+ const handleEventNotification = async (evtType: number, value: any, orderStatus?: any) => {
74
122
  if (value?.driver) {
75
123
  try {
76
124
  const location = await getCurrentLocation()
125
+ if (!location?.latitude || !location?.longitude) {
126
+ showToast(t('ERROR_UPDATING_COORDS', 'Error updating coords'), ToastType.Error)
127
+ return
128
+ }
77
129
  await fetch(`${ordering.root}/users/${user.id}/locations`, {
78
130
  method: 'POST',
79
131
  body: JSON.stringify({
80
- location: JSON.stringify({ location: `{lat: ${location.latitude}, lng: ${location.longitude}}` })
132
+ location: JSON.stringify({
133
+ location: `{
134
+ lat: ${location.latitude},
135
+ lng: ${location.longitude}
136
+ }`
137
+ })
81
138
  }),
82
- headers: { 'Content-Type': 'application/json', Authorization: `Bearer ${token}` }
139
+ headers: {
140
+ 'Content-Type': 'application/json',
141
+ Authorization: `Bearer ${token}`
142
+ }
83
143
  })
84
144
  } catch { }
85
145
  const duration = moment.duration(moment().diff(moment.utc(value?.last_driver_assigned_at)))
86
146
  const assignedSecondsDiff = duration.asSeconds()
87
- if (assignedSecondsDiff < 5 && !isBusinessApp && !value?.logistic_status) {
88
- handlePlayNotificationSound({ evt: 2, orderId: value?.id })
147
+ if (assignedSecondsDiff < 5 && !isBusinessApp && !value?.logistic_status && orderStatus.includes(value.status)) {
148
+ setCurrentEvent({ evt: 2, orderId: value?.id ?? value?.order_id })
89
149
  }
90
150
  }
91
- if (evtType === 3 || value.author_id === user.id) return
92
- handlePlayNotificationSound({
151
+ if (!orderStatus.includes(value.status) || value?.author_id === user.id) return
152
+ setCurrentEvent({
93
153
  evt: evtType,
94
- orderId: value?.driver ? value?.order_id : evtList[evtType].event === 'messages' ? value?.order?.id : value?.id
154
+ orderId: value?.driver
155
+ ? value?.order_id ?? value?.id
156
+ : evtList(currentEvent)[evtType].event === 'messages'
157
+ ? value?.order?.id
158
+ : value?.order_id ?? value?.id
95
159
  })
96
160
  }
97
161
 
98
162
  useEffect(() => {
99
- events.on('message_added_notification', (o: any) => handleEventNotification(1, o))
100
- events.on('order_added_notification', (o: any) => handleEventNotification(2, o))
101
- events.on('order_updated_notification', (o: any) => handleEventNotification(3, o))
102
- events.on('request_register_notification', (o: any) => handleEventNotification(2, o))
103
- events.on('request_update_notification', (o: any) => handleEventNotification(3, o))
163
+ events.on('message_added_notification', (o: any) => handleEventNotification(1, o, orderStatus))
164
+ events.on('order_added_notification', (o: any) => handleEventNotification(2, o, orderStatus))
165
+ events.on('order_updated_notification', (o: any) => handleEventNotification(3, o, orderStatus))
166
+ events.on('request_register_notification', (o: any) => handleEventNotification(2, o, orderStatus))
167
+ events.on('request_update_notification', (o: any) => handleEventNotification(3, o, orderStatus))
104
168
 
105
169
  return () => {
106
170
  events.off('message_added_notification', (o: any) => handleEventNotification(1, o))
@@ -109,51 +173,24 @@ const NewOrderNotificationUI = (props: any) => {
109
173
  events.off('request_register_notification', (o: any) => handleEventNotification(2, o))
110
174
  events.off('request_update_notification', (o: any) => handleEventNotification(3, o))
111
175
  }
112
- }, [])
176
+ }, [orderStatus])
113
177
 
114
178
  useEffect(() => {
115
- return () => handleCloseEvents()
179
+ return () => setCurrentEvent(null)
116
180
  }, [])
117
181
 
118
182
  return (
119
183
  <>
120
- <Modal
121
- animationType='slide'
122
- transparent={true}
123
- visible={!!currentEvent?.orderId}
124
- >
125
- <NotificationContainer>
126
- <View style={styles.modalView}>
127
- <TouchableOpacity
128
- style={styles.wrapperIcon}
129
- onPress={() => handleCloseEvents()}
130
- >
131
- <Icon name="x" size={30} />
132
- </TouchableOpacity>
133
- <OText
134
- size={18}
135
- color={theme.colors.textGray}
136
- weight={600}
137
- >
138
- {evtList[currentEvent?.evt]?.message}
139
- </OText>
140
- <OIcon
141
- src={theme.images.general.newOrder}
142
- width={250}
143
- height={200}
144
- />
145
- <OText
146
- color={theme.colors.textGray}
147
- mBottom={15}
148
- >
149
- {evtList[currentEvent?.evt]?.message2}
150
- </OText>
151
- </View>
152
- </NotificationContainer>
153
- </Modal>
184
+ {!!currentEvent && (
185
+ <SoundPlayerComponent
186
+ evtList={evtList}
187
+ currentEvent={currentEvent}
188
+ handleCloseEvents={() => setCurrentEvent(null)}
189
+ />
190
+ )}
154
191
  </>
155
192
  )
156
- }
193
+ };
157
194
 
158
195
  const styles = StyleSheet.create({
159
196
  modalView: {
@@ -173,9 +210,28 @@ const styles = StyleSheet.create({
173
210
  })
174
211
 
175
212
  export const NewOrderNotification = (props: any) => {
213
+ const [, t] = useLanguage()
214
+
176
215
  const newOrderNotificationProps = {
177
216
  ...props,
178
- UIComponent: NewOrderNotificationUI
217
+ UIComponent: NewOrderNotificationUI,
218
+ evtList: (currentEvent: any) => ({
219
+ 1: {
220
+ event: 'messages',
221
+ message: t('NEW_MESSAGES_RECEIVED', 'New messages have been received!'),
222
+ message2: t('ORDER_N_UNREAD_MESSAGES', 'Order #_order_id_ has unread messages.').replace('_order_id_', currentEvent?.orderId),
223
+ },
224
+ 2: {
225
+ event: 'order_added',
226
+ message: t('NEW_ORDERS_RECEIVED', 'New orders have been received!'),
227
+ message2: t('ORDER_N_ORDERED', 'Order #_order_id_ has been ordered.').replace('_order_id_', currentEvent?.orderId),
228
+ },
229
+ 3: {
230
+ event: 'order_updated',
231
+ message: t('NEW_ORDERS_UPDATED', 'New orders have been updated!'),
232
+ message2: t('ORDER_N_UPDATED', 'Order #_order_id_ has been updated.').replace('_order_id_', currentEvent?.orderId),
233
+ },
234
+ })
179
235
  };
180
236
 
181
237
  return <NewOrderNotificationController {...newOrderNotificationProps} />;
@@ -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}