ordering-ui-react-native 0.22.57 → 0.22.58-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 (142) hide show
  1. package/package.json +5 -7
  2. package/src/DeliveryApp.tsx +1 -1
  3. package/src/components/BusinessesListing/index.tsx +1 -1
  4. package/src/components/Checkout/index.tsx +40 -39
  5. package/src/components/VerifyPhone/styles.tsx +1 -2
  6. package/src/context/OfflineActions/index.tsx +236 -0
  7. package/src/providers/AlertProvider.tsx +3 -1
  8. package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +5 -3
  9. package/themes/business/src/components/AcceptOrRejectOrder/styles.tsx +1 -0
  10. package/themes/business/src/components/BusinessController/index.tsx +8 -3
  11. package/themes/business/src/components/BusinessProductList/index.tsx +3 -2
  12. package/themes/business/src/components/Chat/index.tsx +15 -3
  13. package/themes/business/src/components/DriverMap/index.tsx +44 -33
  14. package/themes/business/src/components/FloatingButton/index.tsx +3 -2
  15. package/themes/business/src/components/LanguageSelector/index.tsx +1 -1
  16. package/themes/business/src/components/LoginForm/index.tsx +123 -98
  17. package/themes/business/src/components/LogoutButton/index.tsx +13 -4
  18. package/themes/business/src/components/MapView/RenderMarker.tsx +146 -0
  19. package/themes/business/src/components/MapView/index.tsx +68 -142
  20. package/themes/business/src/components/NewOrderNotification/index.tsx +25 -14
  21. package/themes/business/src/components/OrderDetails/Business.tsx +56 -20
  22. package/themes/business/src/components/OrderDetails/Delivery.tsx +123 -54
  23. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +146 -36
  24. package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +51 -28
  25. package/themes/business/src/components/OrderDetails/styles.tsx +39 -3
  26. package/themes/business/src/components/OrderDetails/usePrinterCommands.tsx +17 -16
  27. package/themes/business/src/components/OrderDetailsLogistic/index.tsx +3 -2
  28. package/themes/business/src/components/OrderSummary/index.tsx +271 -176
  29. package/themes/business/src/components/OrdersListManager/index.tsx +13 -1
  30. package/themes/business/src/components/OrdersOption/index.tsx +345 -231
  31. package/themes/business/src/components/OrdersOption/styles.tsx +14 -0
  32. package/themes/business/src/components/PreviousMessages/index.tsx +26 -3
  33. package/themes/business/src/components/PreviousOrders/OrderItem.tsx +30 -18
  34. package/themes/business/src/components/PreviousOrders/index.tsx +74 -66
  35. package/themes/business/src/components/PreviousOrders/styles.tsx +2 -1
  36. package/themes/business/src/components/PrinterEdition/MessageAlert.tsx +33 -0
  37. package/themes/business/src/components/PrinterEdition/index.tsx +143 -75
  38. package/themes/business/src/components/PrinterEdition/printerList.tsx +23 -0
  39. package/themes/business/src/components/PrinterSettings/index.tsx +1 -1
  40. package/themes/business/src/components/ProductItemAccordion/index.tsx +3 -2
  41. package/themes/business/src/components/ReviewCustomer/index.tsx +2 -0
  42. package/themes/business/src/components/StoresList/index.tsx +2 -2
  43. package/themes/business/src/components/UserProfileForm/index.tsx +48 -10
  44. package/themes/business/src/components/UserProfileForm/styles.tsx +7 -0
  45. package/themes/business/src/components/WebsocketStatus/index.tsx +2 -2
  46. package/themes/business/src/config/currency.tsx +1010 -0
  47. package/themes/business/src/hooks/useLocation.tsx +16 -12
  48. package/themes/business/src/layouts/SafeAreaContainer.tsx +35 -19
  49. package/themes/business/src/types/index.tsx +33 -7
  50. package/themes/business/src/utils/index.tsx +28 -3
  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 +9 -5
  55. package/themes/kiosk/src/components/CustomerName/index.tsx +1 -1
  56. package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
  57. package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
  58. package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +8 -10
  59. package/themes/kiosk/src/components/PaymentOptions/index.tsx +121 -57
  60. package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
  61. package/themes/original/index.tsx +223 -219
  62. package/themes/original/src/components/AddressForm/index.tsx +14 -8
  63. package/themes/original/src/components/AppleLogin/index.tsx +4 -4
  64. package/themes/original/src/components/BusinessBasicInformation/index.tsx +1 -1
  65. package/themes/original/src/components/BusinessController/index.tsx +4 -2
  66. package/themes/original/src/components/BusinessItemAccordion/index.tsx +10 -4
  67. package/themes/original/src/components/BusinessListingSearch/BusinessSearchFooter.tsx +103 -92
  68. package/themes/original/src/components/BusinessListingSearch/BusinessSearchHeader.tsx +7 -3
  69. package/themes/original/src/components/BusinessListingSearch/index.tsx +8 -13
  70. package/themes/original/src/components/BusinessPreorder/index.tsx +34 -15
  71. package/themes/original/src/components/BusinessProductsList/SubcategoriesComponent/index.tsx +73 -70
  72. package/themes/original/src/components/BusinessProductsList/index.tsx +6 -7
  73. package/themes/original/src/components/BusinessProductsList/styles.tsx +0 -3
  74. package/themes/original/src/components/BusinessProductsListing/index.tsx +10 -6
  75. package/themes/original/src/components/BusinessTypeFilter/index.tsx +9 -8
  76. package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +2 -1
  77. package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +1 -1
  78. package/themes/original/src/components/BusinessesListing/index.tsx +0 -1
  79. package/themes/original/src/components/Cart/index.tsx +50 -14
  80. package/themes/original/src/components/CartContent/index.tsx +2 -3
  81. package/themes/original/src/components/Checkout/index.tsx +133 -90
  82. package/themes/original/src/components/Favorite/index.tsx +1 -5
  83. package/themes/original/src/components/ForgotPasswordForm/index.tsx +1 -2
  84. package/themes/original/src/components/GoogleMap/index.tsx +6 -5
  85. package/themes/original/src/components/Help/functions.tsx +76 -0
  86. package/themes/original/src/components/Help/index.tsx +74 -29
  87. package/themes/original/src/components/Help/styles.tsx +4 -1
  88. package/themes/original/src/components/HelpOptions/index.tsx +44 -0
  89. package/themes/original/src/components/HighestRatedBusinesses/index.tsx +1 -1
  90. package/themes/original/src/components/Home/index.tsx +35 -16
  91. package/themes/original/src/components/LoginForm/index.tsx +12 -5
  92. package/themes/original/src/components/MessageListing/index.tsx +1 -1
  93. package/themes/original/src/components/Messages/index.tsx +20 -13
  94. package/themes/original/src/components/MomentOption/TimeListItem.tsx +56 -0
  95. package/themes/original/src/components/MomentOption/index.tsx +72 -51
  96. package/themes/original/src/components/MomentSelector/index.tsx +5 -2
  97. package/themes/original/src/components/MultiCheckout/index.tsx +78 -36
  98. package/themes/original/src/components/MyOrders/index.tsx +2 -2
  99. package/themes/original/src/components/NavBar/index.tsx +6 -2
  100. package/themes/original/src/components/NotFoundSource/index.tsx +40 -39
  101. package/themes/original/src/components/NotFoundSource/styles.tsx +18 -9
  102. package/themes/original/src/components/OrderDetails/OrderEta.tsx +4 -3
  103. package/themes/original/src/components/OrderDetails/OrderHistory.tsx +11 -4
  104. package/themes/original/src/components/OrderDetails/index.tsx +44 -19
  105. package/themes/original/src/components/OrderDetails/styles.tsx +0 -1
  106. package/themes/original/src/components/OrderProgress/index.tsx +4 -3
  107. package/themes/original/src/components/OrderSummary/index.tsx +32 -11
  108. package/themes/original/src/components/OrderTypeSelector/index.tsx +4 -3
  109. package/themes/original/src/components/OrdersOption/index.tsx +3 -6
  110. package/themes/original/src/components/PaymentOptionWallet/index.tsx +56 -56
  111. package/themes/original/src/components/PaymentOptions/index.tsx +471 -459
  112. package/themes/original/src/components/PhoneInputNumber/index.tsx +92 -7
  113. package/themes/original/src/components/ProductForm/ActionButton.tsx +6 -10
  114. package/themes/original/src/components/ProductItemAccordion/index.tsx +28 -37
  115. package/themes/original/src/components/ProductOptionSubOption/index.tsx +15 -14
  116. package/themes/original/src/components/ServiceForm/index.tsx +1 -1
  117. package/themes/original/src/components/SignupForm/index.tsx +41 -24
  118. package/themes/original/src/components/SingleOrderCard/index.tsx +7 -4
  119. package/themes/original/src/components/SingleProductCard/index.tsx +3 -4
  120. package/themes/original/src/components/SingleProductCard/styles.tsx +0 -3
  121. package/themes/original/src/components/StripeCardsList/index.tsx +9 -4
  122. package/themes/original/src/components/StripeElementsForm/index.tsx +2 -2
  123. package/themes/original/src/components/StripeElementsForm/naked.tsx +1 -1
  124. package/themes/original/src/components/TaxInformation/index.tsx +3 -2
  125. package/themes/original/src/components/UpsellingProducts/UpsellingContent.tsx +7 -2
  126. package/themes/original/src/components/UserDetails/index.tsx +17 -16
  127. package/themes/original/src/components/UserFormDetails/index.tsx +109 -67
  128. package/themes/original/src/components/UserProfile/index.tsx +9 -1
  129. package/themes/original/src/components/UserVerification/index.tsx +18 -5
  130. package/themes/original/src/components/shared/OAlert.tsx +2 -1
  131. package/themes/original/src/components/shared/OButton.tsx +2 -2
  132. package/themes/original/src/components/shared/OInput.tsx +4 -8
  133. package/themes/original/src/components/shared/OModal.tsx +7 -2
  134. package/themes/original/src/types/index.tsx +699 -691
  135. package/themes/original/src/utils/index.tsx +29 -0
  136. package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
  137. package/themes/original/src/components/HelpAccountAndPayment/index.tsx +0 -62
  138. package/themes/original/src/components/HelpAccountAndPayment/styles.tsx +0 -12
  139. package/themes/original/src/components/HelpGuide/index.tsx +0 -68
  140. package/themes/original/src/components/HelpGuide/styles.tsx +0 -12
  141. package/themes/original/src/components/HelpOrder/index.tsx +0 -71
  142. package/themes/original/src/components/HelpOrder/styles.tsx +0 -13
@@ -0,0 +1,146 @@
1
+ import React, { useEffect, useRef, useState } from 'react'
2
+ import { StyleSheet, View } from 'react-native';
3
+ import { Callout, Marker } from 'react-native-maps'
4
+ import Icon from 'react-native-vector-icons/FontAwesome5';
5
+ import FastImage from 'react-native-fast-image';
6
+ import { useTheme } from 'styled-components/native';
7
+
8
+ import { useLanguage } from 'ordering-components/native';
9
+ import { OText } from '../shared';
10
+ import { RenderMarkerParams } from '../../types'
11
+
12
+ const styles = StyleSheet.create({
13
+ image: {
14
+ borderRadius: 50,
15
+ width: 25,
16
+ height: 25
17
+ },
18
+ view: {
19
+ width: 25,
20
+ position: 'absolute',
21
+ top: 6,
22
+ left: 6,
23
+ bottom: 0,
24
+ right: 0,
25
+ },
26
+ });
27
+
28
+ export const RenderMarker = (props: RenderMarkerParams) => {
29
+ const {
30
+ marker,
31
+ customer,
32
+ orderIds,
33
+ onNavigationRedirect,
34
+ initialPosition,
35
+ locationSelected,
36
+ setLocationSelected
37
+ } = props
38
+ const markerRef = useRef<any>()
39
+ const theme = useTheme()
40
+ const [, t] = useLanguage()
41
+
42
+ const [imageLoaded, setImageLoaded] = useState(false)
43
+
44
+ let coordinateLat = (customer
45
+ ? typeof marker?.customer?.location?.lat === 'number' && !Number.isNaN(marker?.customer?.location?.lat)
46
+ ? marker?.customer?.location?.lat
47
+ : 0
48
+ : typeof marker?.business?.location?.lat === 'number' && !Number.isNaN(marker?.business?.location?.lat)
49
+ ? marker?.business?.location?.lat
50
+ : 0) ?? (initialPosition?.latitude || 0)
51
+ let coordinateLng = (customer
52
+ ? typeof marker?.customer?.location?.lng === 'number' && !Number.isNaN(marker?.customer?.location?.lng)
53
+ ? marker?.customer?.location?.lng
54
+ : 0
55
+ : typeof marker?.business?.location?.lng === 'number' && !Number.isNaN(marker?.business?.location?.lng)
56
+ ? marker?.business?.location?.lng
57
+ : 0) ?? (initialPosition?.longitude || 0)
58
+
59
+ useEffect(() => {
60
+ if (
61
+ markerRef?.current?.props?.coordinate?.latitude === locationSelected?.latitude &&
62
+ markerRef?.current?.props?.coordinate?.longitude === locationSelected?.longitude
63
+ ) {
64
+ markerRef?.current?.showCallout()
65
+ }
66
+ }, [locationSelected])
67
+
68
+ const markerImage = customer ? marker?.customer?.photo ?? theme?.images?.dummies?.customerPhoto : marker?.business?.logo ?? theme?.images?.dummies?.businessLogo
69
+
70
+ return (
71
+ <Marker
72
+ key={customer ? marker?.customer?.id : marker?.business?.id}
73
+ coordinate={{
74
+ latitude: coordinateLat,
75
+ longitude: coordinateLng
76
+ }}
77
+ onPress={() =>
78
+ setLocationSelected({
79
+ latitude: coordinateLat,
80
+ longitude: coordinateLng
81
+ })
82
+ }
83
+ ref={(ref) => markerRef.current = ref}
84
+ tracksViewChanges={!imageLoaded}
85
+ >
86
+ <Icon
87
+ name="map-marker"
88
+ size={50}
89
+ color={theme.colors.primary}
90
+ />
91
+ {!!markerImage && (
92
+ <View style={styles.view}>
93
+ <FastImage
94
+ style={styles.image}
95
+ source={markerImage?.includes('https') ? {
96
+ uri: markerImage,
97
+ priority: FastImage.priority.high,
98
+ cache: FastImage.cacheControl.immutable
99
+ } : markerImage}
100
+ resizeMode={FastImage.resizeMode.cover}
101
+ onLoadEnd={() => setImageLoaded(true)}
102
+ />
103
+ </View>
104
+ )}
105
+ <Callout
106
+ onPress={() => !!orderIds && orderIds.toString().includes(',') ? onNavigationRedirect('Orders') : onNavigationRedirect('OrderDetails', { order: marker })}
107
+ >
108
+ <View style={{ flex: 1, width: 200, padding: 5 }}>
109
+ <OText weight='bold'>{customer ? `${marker?.customer?.name} ${marker?.customer?.lastname}` : marker?.business?.name}</OText>
110
+ <OText>
111
+ {!!orderIds && orderIds.toString().includes(',') ? (
112
+ <>
113
+ {t('ORDER_NUMBERS', 'Order Numbers')} {orderIds}
114
+ </>
115
+ ) : (
116
+ <>
117
+ {t('ORDER_NUMBER', 'Order No.')} {marker?.id}
118
+ </>
119
+ )}
120
+ </OText>
121
+ <OText>{customer ? marker?.customer?.address : marker?.business?.address}</OText>
122
+ {((customer && marker?.customer?.city?.address_notes) || !customer) && (
123
+ <OText>{customer ? marker?.customer?.city?.address_notes : marker?.business?.city?.name}</OText>
124
+ )}
125
+ {((customer && !!marker?.business?.zipcode) || (!customer && !!marker?.business?.zipcode)) && (
126
+ <OText>{customer ? marker?.customer?.zipcode ?? '' : marker?.business?.zipcode ?? ''}</OText>
127
+ )}
128
+ {customer && !!marker?.customer?.internal_number && (
129
+ <OText>{marker?.customer?.internal_number}</OText>
130
+ )}
131
+ <OText textDecorationLine='underline' color={theme.colors.primary}>
132
+ {!!orderIds && orderIds.toString().includes(',') ? (
133
+ <>
134
+ {t('SHOW_ORDERS', 'Show orders')}
135
+ </>
136
+ ) : (
137
+ <>
138
+ {t('MORE_INFO', 'More info')}
139
+ </>
140
+ )}
141
+ </OText>
142
+ </View>
143
+ </Callout>
144
+ </Marker>
145
+ )
146
+ }
@@ -1,20 +1,37 @@
1
- import React, { useState, useEffect, useRef, useCallback } from 'react';
2
- import { Dimensions, SafeAreaView, StyleSheet, View } from 'react-native';
1
+ import React, { useState, useEffect, useRef, useCallback, useMemo } from 'react';
2
+ import { Dimensions, Platform, SafeAreaView, StyleSheet, View } from 'react-native';
3
3
  import { useFocusEffect } from '@react-navigation/native'
4
4
  import MapView, {
5
5
  PROVIDER_GOOGLE,
6
- Marker,
7
- Callout
6
+ Marker
8
7
  } from 'react-native-maps';
8
+ import FastImage from 'react-native-fast-image'
9
9
  import { useLanguage, useSession, MapView as MapViewController } from 'ordering-components/native';
10
10
  import { MapViewParams } from '../../types';
11
11
  import Alert from '../../providers/AlertProvider';
12
12
  import { useTheme } from 'styled-components/native';
13
13
  import { useLocation } from '../../hooks/useLocation';
14
14
  import Icon from 'react-native-vector-icons/FontAwesome5';
15
- import { OIcon, OText, OFab } from '../shared'
16
- const MapViewComponent = (props: MapViewParams) => {
15
+ import { OFab } from '../shared'
16
+ import { RenderMarker } from './RenderMarker'
17
+
18
+ const styles = StyleSheet.create({
19
+ image: {
20
+ borderRadius: 50,
21
+ width: 25,
22
+ height: 25
23
+ },
24
+ view: {
25
+ width: 25,
26
+ position: 'absolute',
27
+ top: 6,
28
+ left: 6,
29
+ bottom: 0,
30
+ right: 0,
31
+ },
32
+ });
17
33
 
34
+ const MapViewComponent = (props: MapViewParams) => {
18
35
  const {
19
36
  isLoadingBusinessMarkers,
20
37
  markerGroups,
@@ -24,6 +41,7 @@ const MapViewComponent = (props: MapViewParams) => {
24
41
  setDriverLocation,
25
42
  onNavigationRedirect,
26
43
  getBusinessLocations,
44
+ isDeliveryApp
27
45
  } = props;
28
46
 
29
47
  const theme = useTheme();
@@ -35,6 +53,7 @@ const MapViewComponent = (props: MapViewParams) => {
35
53
  const following = useRef<boolean>(true);
36
54
  const [isFocused, setIsFocused] = useState(false)
37
55
  const [locationSelected, setLocationSelected] = useState<any>(null)
56
+ const [imageLoaded, setImageLoaded] = useState(false)
38
57
  const {
39
58
  initialPosition,
40
59
  userLocation,
@@ -42,7 +61,10 @@ const MapViewComponent = (props: MapViewParams) => {
42
61
  followUserLocation
43
62
  } = useLocation();
44
63
 
45
- const location = { lat: userLocation?.latitude, lng: userLocation?.longitude }
64
+ const location = useMemo(() => {
65
+ return { lat: userLocation?.latitude, lng: userLocation?.longitude }
66
+ }, [userLocation?.latitude, userLocation?.longitude])
67
+
46
68
  const haveOrders = Object.values(markerGroups)?.length > 0 && Object.values(customerMarkerGroups)?.length > 0
47
69
  const closeAlert = () => {
48
70
  setAlertState({
@@ -53,19 +75,23 @@ const MapViewComponent = (props: MapViewParams) => {
53
75
 
54
76
  const fitCoordinates = (location?: any) => {
55
77
  if (mapRef.current) {
56
- mapRef.current.fitToCoordinates(
57
- [
58
- {
59
- latitude: typeof location?.latitude !== 'object' ? location?.latitude : 0,
60
- longitude: typeof location?.longitude !== 'object' ? location?.latitude : 0
61
- },
62
- {
63
- latitude: typeof userLocation?.latitude !== 'object' ? userLocation?.latitude : 0,
64
- longitude: typeof userLocation?.longitude !== 'object' ? userLocation?.latitude : 0
65
- },
66
- ],
78
+ const isSendCoordinates =
79
+ location &&
80
+ userLocation &&
81
+ location.latitude !== userLocation.latitude &&
82
+ location.longitude !== userLocation.longitude &&
83
+ location.latitude !== 0 &&
84
+ location.longitude !== 0 &&
85
+ userLocation.latitude !== 0 &&
86
+ userLocation.longitude !== 0
87
+
88
+ isSendCoordinates && mapRef.current.fitToCoordinates(
89
+ [location, userLocation].map(_location => ({
90
+ latitude: _location.latitude,
91
+ longitude: _location.longitude
92
+ })),
67
93
  {
68
- edgePadding: { top: 120, right: 120, bottom: 120, left: 120 },
94
+ edgePadding: { top: 120, right: 120, bottom: 120, left: 120 }
69
95
  },
70
96
  );
71
97
  }
@@ -119,120 +145,6 @@ const MapViewComponent = (props: MapViewParams) => {
119
145
  }, [])
120
146
  )
121
147
 
122
- const styles = StyleSheet.create({
123
- image: {
124
- borderRadius: 50,
125
- },
126
- view: {
127
- width: 25,
128
- position: 'absolute',
129
- top: 6,
130
- left: 6,
131
- bottom: 0,
132
- right: 0,
133
- },
134
- });
135
-
136
- const RenderMarker = ({ marker, customer, orderIds }: { marker: any, customer?: boolean, orderIds?: Array<number> }) => {
137
- const markerRef = useRef<any>()
138
-
139
- let coordinateLat = (customer
140
- ? typeof marker?.customer?.location?.lat === 'number' && !Number.isNaN(marker?.customer?.location?.lat)
141
- ? marker?.customer?.location?.lat
142
- : 0
143
- : typeof marker?.business?.location?.lat === 'number' && !Number.isNaN(marker?.business?.location?.lat)
144
- ? marker?.business?.location?.lat
145
- : 0) ?? (initialPosition?.latitude || 0)
146
- let coordinateLng = (customer
147
- ? typeof marker?.customer?.location?.lng === 'number' && !Number.isNaN(marker?.customer?.location?.lng)
148
- ? marker?.customer?.location?.lng
149
- : 0
150
- : typeof marker?.business?.location?.lng === 'number' && !Number.isNaN(marker?.business?.location?.lng)
151
- ? marker?.business?.location?.lng
152
- : 0) ?? (initialPosition?.longitude || 0)
153
-
154
- useEffect(() => {
155
- if (
156
- markerRef?.current?.props?.coordinate?.latitude === locationSelected?.latitude &&
157
- markerRef?.current?.props?.coordinate?.longitude === locationSelected?.longitude
158
- ) {
159
- markerRef?.current?.showCallout()
160
- }
161
- }, [locationSelected])
162
-
163
- return (
164
- <Marker
165
- key={customer ? marker?.customer?.id : marker?.business?.id}
166
- coordinate={{
167
- latitude: coordinateLat,
168
- longitude: coordinateLng
169
- }}
170
- onPress={() =>
171
- setLocationSelected({
172
- latitude: coordinateLat,
173
- longitude: coordinateLng
174
- })
175
- }
176
- ref={(ref) => markerRef.current = ref}
177
- >
178
- <Icon
179
- name="map-marker"
180
- size={50}
181
- color={theme.colors.primary}
182
- />
183
- {(!!marker?.customer?.photo || !!marker?.business?.logo) && (
184
- <View style={styles.view}>
185
- <OIcon
186
- style={styles.image}
187
- src={{ uri: customer ? marker?.customer?.photo : marker?.business?.logo }}
188
- width={25}
189
- height={25}
190
- />
191
- </View>
192
- )}
193
- <Callout
194
- onPress={() => !!orderIds && orderIds.toString().includes(',') ? onNavigationRedirect('Orders') : onNavigationRedirect('OrderDetails', { order: marker })}
195
- >
196
- <View style={{ flex: 1, width: 200, padding: 5 }}>
197
- <OText weight='bold'>{customer ? `${marker?.customer?.name} ${marker?.customer?.lastname}` : marker?.business?.name}</OText>
198
- <OText>
199
- {!!orderIds && orderIds.toString().includes(',') ? (
200
- <>
201
- {t('ORDER_NUMBERS', 'Order Numbers')} {orderIds}
202
- </>
203
- ) : (
204
- <>
205
- {t('ORDER_NUMBER', 'Order No.')} {marker?.id}
206
- </>
207
- )}
208
- </OText>
209
- <OText>{customer ? marker?.customer?.address : marker?.business?.address}</OText>
210
- {((customer && marker?.customer?.city?.address_notes) || !customer) && (
211
- <OText>{customer ? marker?.customer?.city?.address_notes : marker?.business?.city?.name}</OText>
212
- )}
213
- {((customer && !!marker?.business?.zipcode) || (!customer && !!marker?.business?.zipcode)) && (
214
- <OText>{customer ? marker?.customer?.zipcode ?? '' : marker?.business?.zipcode ?? ''}</OText>
215
- )}
216
- {customer && !!marker?.customer?.internal_number && (
217
- <OText>{marker?.customer?.internal_number}</OText>
218
- )}
219
- <OText textDecorationLine='underline' color={theme.colors.primary}>
220
- {!!orderIds && orderIds.toString().includes(',') ? (
221
- <>
222
- {t('SHOW_ORDERS', 'Show orders')}
223
- </>
224
- ) : (
225
- <>
226
- {t('MORE_INFO', 'More info')}
227
- </>
228
- )}
229
- </OText>
230
- </View>
231
- </Callout>
232
- </Marker>
233
- )
234
- }
235
-
236
148
  useEffect(() => {
237
149
  if (userLocation?.latitude !== 0 && userLocation?.longitude !== 0) {
238
150
  const location = {
@@ -243,31 +155,39 @@ const MapViewComponent = (props: MapViewParams) => {
243
155
  }
244
156
  }, [userLocation])
245
157
 
158
+ const renderMarkerDefaultProps = {
159
+ onNavigationRedirect: onNavigationRedirect,
160
+ initialPosition: initialPosition,
161
+ locationSelected: locationSelected,
162
+ setLocationSelected: setLocationSelected
163
+ }
164
+
246
165
  return (
247
166
  <SafeAreaView style={{ flex: 1 }}>
248
167
  <View style={{ flex: 1 }}>
249
- {!isLoadingBusinessMarkers && isFocused && (
168
+ {(isDeliveryApp || (!isLoadingBusinessMarkers && isFocused)) && !!initialPosition?.latitude && !!initialPosition?.longitude && (
250
169
  <View style={{ flex: 1 }}>
251
170
  <MapView
252
171
  ref={mapRef}
253
172
  provider={PROVIDER_GOOGLE}
254
173
  initialRegion={{
255
- latitude: initialPosition?.latitude || 0,
256
- longitude: initialPosition?.longitude || 0,
174
+ latitude: initialPosition?.latitude,
175
+ longitude: initialPosition?.longitude,
257
176
  latitudeDelta: haveOrders ? 0.01 : 0.1,
258
177
  longitudeDelta: haveOrders ? 0.01 * ASPECT_RATIO : 0.1 * ASPECT_RATIO,
259
178
  }}
260
179
  style={{ flex: 1 }}
261
180
  zoomTapEnabled
262
181
  zoomEnabled
263
- zoomControlEnabled
264
- cacheEnabled
182
+ zoomControlEnabled={!(isDeliveryApp && Platform.OS === 'android')}
183
+ cacheEnabled={(isDeliveryApp && Platform.OS === 'android' && isFocused) || Platform.OS === 'ios' || !isDeliveryApp}
265
184
  moveOnMarkerPress
266
185
  onTouchStart={() => (following.current = false)}
267
186
  >
268
187
  <>
269
188
  {Object.values(markerGroups).map((marker: any) => (
270
189
  <RenderMarker
190
+ {...renderMarkerDefaultProps}
271
191
  key={marker[0]?.business_id}
272
192
  marker={marker[0]}
273
193
  orderIds={marker.map((order: any) => order.id).join(', ')}
@@ -275,6 +195,7 @@ const MapViewComponent = (props: MapViewParams) => {
275
195
  ))}
276
196
  {Object.values(customerMarkerGroups).map((marker: any) => (
277
197
  <RenderMarker
198
+ {...renderMarkerDefaultProps}
278
199
  key={marker[0]?.customer_id}
279
200
  marker={marker[0]}
280
201
  orderIds={marker.map((order: any) => order.id).join(', ')}
@@ -282,6 +203,7 @@ const MapViewComponent = (props: MapViewParams) => {
282
203
  />
283
204
  ))}
284
205
  <Marker
206
+ tracksViewChanges={!imageLoaded}
285
207
  coordinate={{
286
208
  latitude: typeof location.lat === 'number' && !Number.isNaN(location.lat) ? location.lat : 0,
287
209
  longitude: typeof location.lng === 'number' && !Number.isNaN(location.lng) ? location.lng : 0,
@@ -294,11 +216,15 @@ const MapViewComponent = (props: MapViewParams) => {
294
216
  color={theme.colors.primary}
295
217
  />
296
218
  <View style={styles.view}>
297
- <OIcon
219
+ <FastImage
298
220
  style={styles.image}
299
- src={{ uri: user.photo }}
300
- width={25}
301
- height={25}
221
+ source={user.photo?.includes('https') ? {
222
+ uri: user.photo,
223
+ priority: FastImage.priority.high,
224
+ cache: FastImage.cacheControl.immutable
225
+ } : user.photo ?? theme?.images?.dummies?.driverPhoto}
226
+ resizeMode={FastImage.resizeMode.cover}
227
+ onLoadEnd={() => setImageLoaded(true)}
302
228
  />
303
229
  </View>
304
230
  </Marker>
@@ -140,7 +140,8 @@ const NewOrderNotificationUI = (props: any) => {
140
140
  location: JSON.stringify({
141
141
  location: `{
142
142
  lat: ${location.latitude},
143
- lng: ${location.longitude}
143
+ lng: ${location.longitude},
144
+ mock: ${location.mocked}
144
145
  }`
145
146
  })
146
147
  }),
@@ -152,11 +153,11 @@ const NewOrderNotificationUI = (props: any) => {
152
153
  } catch { }
153
154
  const duration = moment.duration(moment().diff(moment.utc(value?.last_driver_assigned_at)))
154
155
  const assignedSecondsDiff = duration.asSeconds()
155
- if (assignedSecondsDiff < 5 && !isBusinessApp && !value?.logistic_status && orderStatus.includes(value.status)) {
156
+ if (assignedSecondsDiff < 5 && !isBusinessApp && !value?.logistic_status) {
156
157
  setCurrentEvent({ evt: 2, orderId: value?.id ?? value?.order_id })
157
158
  }
158
159
  }
159
- if ((!orderStatus.includes(value.status) && evtType !== 1) || value?.author_id === user.id) return
160
+ if ((!orderStatus.includes(value.status) && evtType !== 1 && isBusinessApp && orderStatus?.length > 0) || value?.author_id === user.id) return
160
161
  setCurrentEvent({
161
162
  evt: evtType,
162
163
  orderId: value?.driver
@@ -168,20 +169,30 @@ const NewOrderNotificationUI = (props: any) => {
168
169
  }
169
170
 
170
171
  useEffect(() => {
171
- events.on('message_added_notification', (o: any) => handleEventNotification(1, o, orderStatus))
172
- events.on('order_added_notification', (o: any) => handleEventNotification(2, o, orderStatus))
173
- events.on('order_updated_notification', (o: any) => handleEventNotification(3, o, orderStatus))
174
- events.on('request_register_notification', (o: any) => handleEventNotification(2, o, orderStatus))
175
- events.on('request_update_notification', (o: any) => handleEventNotification(3, o, orderStatus))
172
+ const handleEventTypeOne = (o: any) => {
173
+ handleEventNotification(1, o, orderStatus)
174
+ }
175
+ const handleEventTypeTwo = (o: any) => {
176
+ handleEventNotification(2, o, orderStatus)
177
+ }
178
+ const handleEventTypeThree = (o: any) => {
179
+ handleEventNotification(3, o, orderStatus)
180
+ }
181
+
182
+ events.on('message_added_notification', handleEventTypeOne)
183
+ events.on('order_added_notification', handleEventTypeTwo)
184
+ events.on('order_updated_notification', handleEventTypeThree)
185
+ events.on('request_register_notification', handleEventTypeTwo)
186
+ events.on('request_update_notification', handleEventTypeThree)
176
187
 
177
188
  return () => {
178
- events.off('message_added_notification', (o: any) => handleEventNotification(1, o))
179
- events.off('order_added_notification', (o: any) => handleEventNotification(2, o))
180
- events.off('order_updated_notification', (o: any) => handleEventNotification(3, o))
181
- events.off('request_register_notification', (o: any) => handleEventNotification(2, o))
182
- events.off('request_update_notification', (o: any) => handleEventNotification(3, o))
189
+ events.off('message_added_notification', handleEventTypeOne)
190
+ events.off('order_added_notification', handleEventTypeTwo)
191
+ events.off('order_updated_notification', handleEventTypeThree)
192
+ events.off('request_register_notification', handleEventTypeTwo)
193
+ events.off('request_update_notification', handleEventTypeThree)
183
194
  }
184
- }, [orderStatus])
195
+ }, [orderStatus, events])
185
196
 
186
197
  useEffect(() => {
187
198
  return () => setCurrentEvent(null)