ordering-ui-react-native 0.18.12 → 0.18.14-test

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ordering-ui-react-native",
3
- "version": "0.18.12",
3
+ "version": "0.18.14-test",
4
4
  "description": "Reusable components made in react native",
5
5
  "main": "src/index.tsx",
6
6
  "author": "ordering.inc",
@@ -131,26 +131,6 @@ export const OrderCreating = (props: any) => {
131
131
  <OText size={14}>{address}</OText>
132
132
  </LocationWrapper>
133
133
  )}
134
- {cart && !orderState?.options?.moment && (
135
- <DeliveryWrapper>
136
- <DeliveryContentWrapper>
137
- <SimpleIcon
138
- name='clock'
139
- size={20}
140
- color={theme.colors.primary}
141
- style={{ marginRight: 10 }}
142
- />
143
- <OText size={14}>
144
- {orderState?.options?.type === 1
145
- ? t('DELIVERY_TIME', 'Delivery Time')
146
- : t('PICK_UP', 'Pick Time')}
147
- </OText>
148
- </DeliveryContentWrapper>
149
- <View>
150
- <OText size={14} weight='700'>{parseDeliveryTime()}</OText>
151
- </View>
152
- </DeliveryWrapper>
153
- )}
154
134
  {cardData?.card?.brand && (
155
135
  <View style={{ flexDirection: 'row', marginBottom: 27 }}>
156
136
  {getIconCard(cardData?.card?.brand, 20)}
@@ -69,6 +69,8 @@ const ChatUI = (props: MessagesParams) => {
69
69
  const [, { showToast }] = useToast();
70
70
  const theme = useTheme();
71
71
  const [messageList, setMessageList] = useState<any>([])
72
+ const previousStatus = [1, 2, 5, 6, 10, 11, 12, 16, 17]
73
+ const chatDisabled = previousStatus.includes(order?.status)
72
74
 
73
75
  const ORDER_STATUS: any = {
74
76
  0: t('ORDER_STATUS_PENDING', 'Order status pending'),
@@ -176,12 +178,8 @@ const ChatUI = (props: MessagesParams) => {
176
178
  fontSize: 12,
177
179
  },
178
180
  toolbarStyle: {
179
- flexDirection: 'column-reverse',
180
- paddingVertical: 15,
181
- paddingHorizontal: 30,
182
- backgroundColor: theme.colors.white,
183
- borderTopWidth: 1,
184
- borderTopColor: theme.colors.tabBar,
181
+ padding: Platform.OS === 'ios' && isKeyboardShow ? 0 : 10,
182
+ flexDirection: 'column-reverse'
185
183
  },
186
184
  accessoryIcon: {
187
185
  height: 32,
@@ -586,16 +584,12 @@ const ChatUI = (props: MessagesParams) => {
586
584
  };
587
585
 
588
586
  const renderAccessory = () => (
587
+ !chatDisabled &&
589
588
  <View>
590
589
  <Header
591
590
  showsVerticalScrollIndicator={false}
592
591
  showsHorizontalScrollIndicator={false}
593
592
  horizontal
594
- // contentContainerStyle={{
595
- // justifyContent:
596
- // orientation === 'Landscape' ? 'center' : 'space-between',
597
- // width: '100%',
598
- // }}
599
593
  nestedScrollEnabled={true}
600
594
  >
601
595
  {user?.level !== 2 && (
@@ -766,113 +760,130 @@ const ChatUI = (props: MessagesParams) => {
766
760
  containerStyle={styles.toolbarStyle}
767
761
  primaryStyle={{ alignItems: 'center', justifyContent: 'space-between' }}
768
762
  accessoryStyle={{ position: 'relative', marginBottom: 45 }}
769
- renderAccessory={order ? () => renderAccessory && renderAccessory() : undefined}
763
+ renderAccessory={() => renderAccessory()}
770
764
  />
771
765
  );
772
766
 
773
767
  const renderComposer = (props: any) => (
774
- <View
775
- style={{
776
- flexDirection: 'row',
777
- height: 44,
778
- width: '85%',
779
- backgroundColor: theme.colors.composerView,
780
- borderRadius: 7.6,
781
- alignItems: 'center',
782
- justifyContent: 'center',
783
- paddingRight: 10,
784
- }}>
785
- <Composer
786
- {...props}
787
- textInputStyle={{
788
- borderRadius: 7.6,
789
- borderColor: theme.colors.transparent,
790
- borderWidth: 0,
791
- color: '#010300',
792
- }}
793
- textInputProps={{
794
- value: message,
795
- onSubmitEditing: onSubmit,
796
- returnKeyType: message ? 'send' : 'done',
797
- blurOnSubmit: true,
798
- multiline: false,
799
- numberOfLines: 1,
800
- autoCorrect: false,
801
- autoCompleteType: 'off',
802
- enablesReturnKeyAutomatically: false,
803
- selectionColor: theme.colors.primary,
768
+ chatDisabled ? (
769
+ <View
770
+ style={{
771
+ width: '100%',
772
+ flexDirection: 'column',
773
+ alignItems: 'center'
804
774
  }}
805
- placeholder={t('WRITE_MESSAGE', 'Write message')}
806
- placeholderTextColor={theme.colors.composerPlaceHolder}
807
- />
808
-
809
- <TouchableOpacity
810
- onPress={() => {
811
- setImage && setImage(null);
812
- setIsShowSignaturePad(!isShowSignaturePad);
813
- }}>
775
+ >
814
776
  <MaterialCommunityIcon
815
- name="pen"
816
- color={
817
- isShowSignaturePad ? theme.colors.primary : theme.colors.arrowColor
818
- }
777
+ name='close-octagon-outline'
819
778
  size={24}
820
779
  />
821
- </TouchableOpacity>
822
-
823
- {!file.type && (
824
- <Actions
780
+ <OText size={14}>{t('NOT_SEND_MESSAGES', 'You can\'t send messages because the order has ended')}</OText>
781
+ </View>
782
+ ) : (
783
+ <View
784
+ style={{
785
+ flexDirection: 'row',
786
+ height: 44,
787
+ width: '85%',
788
+ backgroundColor: theme.colors.composerView,
789
+ borderRadius: 7.6,
790
+ alignItems: 'center',
791
+ justifyContent: 'center',
792
+ paddingRight: 10,
793
+ }}>
794
+ <Composer
825
795
  {...props}
826
- containerStyle={styles.containerActions}
827
- optionTintColor="#222845"
828
- icon={() => (
829
- <>
830
- {!file?.type && (
831
- <>
832
- <OIconButton
833
- borderColor={theme.colors.transparent}
834
- icon={
835
- !isShowSignaturePad && image
836
- ? { uri: image }
837
- : theme.images.general.imageChat
838
- }
839
- iconStyle={{
840
- borderRadius: image ? 10 : 0,
841
- width: image ? 32 : 28,
842
- height: image ? 32 : 28,
843
- }}
844
- onClick={handleImagePicker}
845
- iconCover
846
- />
847
-
848
- {image && !isShowSignaturePad && (
849
- <TouchableOpacity
850
- style={{
851
- position: 'absolute',
852
- top: -5,
853
- right: -5,
854
- borderColor: theme.colors.backgroundDark,
855
- backgroundColor: theme.colors.white,
856
- borderRadius: 25,
857
- }}
858
- onPress={() => removeImage()}>
859
- <MaterialCommunityIcon
860
- name="close-circle-outline"
861
- color={theme.colors.backgroundDark}
862
- size={24}
863
- />
864
- </TouchableOpacity>
865
- )}
866
- </>
867
- )}
868
- </>
869
- )}
796
+ textInputStyle={{
797
+ borderRadius: 7.6,
798
+ borderColor: theme.colors.transparent,
799
+ borderWidth: 0,
800
+ color: '#010300',
801
+ }}
802
+ textInputProps={{
803
+ value: message,
804
+ onSubmitEditing: onSubmit,
805
+ returnKeyType: message ? 'send' : 'done',
806
+ blurOnSubmit: true,
807
+ multiline: false,
808
+ numberOfLines: 1,
809
+ autoCorrect: false,
810
+ autoCompleteType: 'off',
811
+ enablesReturnKeyAutomatically: false,
812
+ selectionColor: theme.colors.primary,
813
+ }}
814
+ placeholder={t('WRITE_MESSAGE', 'Write message')}
815
+ placeholderTextColor={theme.colors.composerPlaceHolder}
870
816
  />
871
- )}
872
- </View>
817
+
818
+ <TouchableOpacity
819
+ onPress={() => {
820
+ setImage && setImage(null);
821
+ setIsShowSignaturePad(!isShowSignaturePad);
822
+ }}>
823
+ <MaterialCommunityIcon
824
+ name="pen"
825
+ color={
826
+ isShowSignaturePad ? theme.colors.primary : theme.colors.arrowColor
827
+ }
828
+ size={24}
829
+ />
830
+ </TouchableOpacity>
831
+
832
+ {!file.type && (
833
+ <Actions
834
+ {...props}
835
+ containerStyle={styles.containerActions}
836
+ optionTintColor="#222845"
837
+ icon={() => (
838
+ <>
839
+ {!file?.type && (
840
+ <>
841
+ <OIconButton
842
+ borderColor={theme.colors.transparent}
843
+ icon={
844
+ !isShowSignaturePad && image
845
+ ? { uri: image }
846
+ : theme.images.general.imageChat
847
+ }
848
+ iconStyle={{
849
+ borderRadius: image ? 10 : 0,
850
+ width: image ? 32 : 28,
851
+ height: image ? 32 : 28,
852
+ }}
853
+ onClick={handleImagePicker}
854
+ iconCover
855
+ />
856
+
857
+ {image && !isShowSignaturePad && (
858
+ <TouchableOpacity
859
+ style={{
860
+ position: 'absolute',
861
+ top: -5,
862
+ right: -5,
863
+ borderColor: theme.colors.backgroundDark,
864
+ backgroundColor: theme.colors.white,
865
+ borderRadius: 25,
866
+ }}
867
+ onPress={() => removeImage()}>
868
+ <MaterialCommunityIcon
869
+ name="close-circle-outline"
870
+ color={theme.colors.backgroundDark}
871
+ size={24}
872
+ />
873
+ </TouchableOpacity>
874
+ )}
875
+ </>
876
+ )}
877
+ </>
878
+ )}
879
+ />
880
+ )}
881
+ </View>
882
+ )
873
883
  );
874
884
 
875
885
  const renderSend = (props: any) => (
886
+ !chatDisabled &&
876
887
  <Send
877
888
  {...props}
878
889
  disabled={
@@ -161,7 +161,7 @@ export const DriverMap = (props: GoogleMapsParams) => {
161
161
  if (driverUpdateLocation.error) return;
162
162
 
163
163
  calculateDistance(
164
- { lat: userLocation.latitude, lng: userLocation.longitude },
164
+ { lat: userLocation?.latitude, lng: userLocation?.longitude },
165
165
  destination,
166
166
  );
167
167
  // geocodePosition(userLocation);
@@ -241,8 +241,8 @@ export const DriverMap = (props: GoogleMapsParams) => {
241
241
  [
242
242
  { latitude: location.lat, longitude: location.lng },
243
243
  {
244
- latitude: initialPosition.latitude,
245
- longitude: initialPosition.longitude,
244
+ latitude: initialPosition?.latitude,
245
+ longitude: initialPosition?.longitude,
246
246
  },
247
247
  ],
248
248
  {
@@ -255,7 +255,7 @@ export const DriverMap = (props: GoogleMapsParams) => {
255
255
 
256
256
  useEffect(() => {
257
257
  const interval = setInterval(() => {
258
- if (initialPosition.latitude !== 0 && autoFit.current) {
258
+ if (initialPosition?.latitude !== 0 && autoFit.current) {
259
259
  if (mapRef.current) {
260
260
  fitCoordinates();
261
261
  autoFit.current = false;
@@ -346,8 +346,8 @@ export const DriverMap = (props: GoogleMapsParams) => {
346
346
  ref={mapRef}
347
347
  provider={PROVIDER_GOOGLE}
348
348
  initialRegion={{
349
- latitude: initialPosition.latitude,
350
- longitude: initialPosition.longitude,
349
+ latitude: initialPosition?.latitude,
350
+ longitude: initialPosition?.longitude,
351
351
  latitudeDelta: 0.001,
352
352
  longitudeDelta: 0.001 * ASPECT_RATIO,
353
353
  }}
@@ -401,8 +401,8 @@ export const DriverMap = (props: GoogleMapsParams) => {
401
401
  ) : (
402
402
  <Marker
403
403
  coordinate={{
404
- latitude: userLocation.latitude,
405
- longitude: userLocation.longitude,
404
+ latitude: userLocation?.latitude,
405
+ longitude: userLocation?.longitude,
406
406
  }}
407
407
  title={markerTitle || t('YOUR_LOCATION', 'Your Location')}
408
408
  />
@@ -514,9 +514,9 @@ export const DriverMap = (props: GoogleMapsParams) => {
514
514
  animationIn: 'slideInUp'
515
515
  }}
516
516
  options={{
517
- latitude: destination.latitude,
517
+ latitude: destination?.latitude,
518
518
  longitude: destination.longitude,
519
- sourceLatitude: userLocation.latitude,
519
+ sourceLatitude: userLocation?.latitude,
520
520
  sourceLongitude: userLocation.longitude,
521
521
  naverCallerName: 'com.deliveryapp',
522
522
  dialogTitle: t('SHOW_IN_OTHER_MAPS', 'Show in other maps'),
@@ -80,9 +80,9 @@ export const GoogleMap = (props: GoogleMapsParams) => {
80
80
  locations.map((location: { lat: number; lng: number; level: number }) => {
81
81
  return location.level === 4 && driverLocation?.lat
82
82
  ? {
83
- latitude: driverLocation?.lat,
84
- longitude: driverLocation?.lng,
85
- }
83
+ latitude: driverLocation?.lat,
84
+ longitude: driverLocation?.lng,
85
+ }
86
86
  : { latitude: location.lat, longitude: location.lng };
87
87
  });
88
88
 
@@ -92,8 +92,8 @@ export const GoogleMap = (props: GoogleMapsParams) => {
92
92
 
93
93
  const geocodePosition = (pos: { latitude: number; longitude: number }) => {
94
94
  Geocoder.from({
95
- latitude: pos.latitude,
96
- longitude: pos.longitude,
95
+ latitude: pos?.latitude,
96
+ longitude: pos?.longitude,
97
97
  })
98
98
  .then(({ results }) => {
99
99
  let zipcode = null;
@@ -107,7 +107,7 @@ export const GoogleMap = (props: GoogleMapsParams) => {
107
107
  }
108
108
  let data = null;
109
109
  const details = {
110
- geometry: { location: { lat: pos.latitude, lng: pos.longitude } },
110
+ geometry: { location: { lat: pos?.latitude, lng: pos?.longitude } },
111
111
  };
112
112
  if (isSetInputs) {
113
113
  data = {
@@ -139,8 +139,8 @@ export const GoogleMap = (props: GoogleMapsParams) => {
139
139
  setMarkerPosition(curPos);
140
140
  setRegion({
141
141
  ...region,
142
- longitude: curPos.longitude,
143
- latitude: curPos.latitude,
142
+ longitude: curPos?.longitude,
143
+ latitude: curPos?.latitude,
144
144
  });
145
145
  return;
146
146
  }
@@ -149,8 +149,8 @@ export const GoogleMap = (props: GoogleMapsParams) => {
149
149
  setMarkerPosition(curPos);
150
150
  setRegion({
151
151
  ...region,
152
- longitude: curPos.longitude,
153
- latitude: curPos.latitude,
152
+ longitude: curPos?.longitude,
153
+ latitude: curPos?.latitude,
154
154
  });
155
155
  } else {
156
156
  setMapErrors && setMapErrors('ERROR_MAX_LIMIT_LOCATION');
@@ -165,8 +165,8 @@ export const GoogleMap = (props: GoogleMapsParams) => {
165
165
  const lat1 = pointA.lat;
166
166
  const lon1 = pointA.lng;
167
167
 
168
- const lat2 = pointB.latitude;
169
- const lon2 = pointB.longitude;
168
+ const lat2 = pointB?.latitude;
169
+ const lon2 = pointB?.longitude;
170
170
 
171
171
  const R = 6371e3;
172
172
  const φ1 = lat1 * (Math.PI / 180);
@@ -201,11 +201,11 @@ export const GoogleMap = (props: GoogleMapsParams) => {
201
201
  content: !(errKey === 'ERROR_MAX_LIMIT_LOCATION_TO')
202
202
  ? [t(errKey, mapErrors[errKey])]
203
203
  : [
204
- `${t(errKey, mapErrors[errKey])} ${maxLimitLocation} ${t(
205
- 'METTERS',
206
- 'meters',
207
- )}`,
208
- ],
204
+ `${t(errKey, mapErrors[errKey])} ${maxLimitLocation} ${t(
205
+ 'METTERS',
206
+ 'meters',
207
+ )}`,
208
+ ],
209
209
  key: errKey,
210
210
  });
211
211
  };
@@ -237,9 +237,9 @@ export const GoogleMap = (props: GoogleMapsParams) => {
237
237
  MARKERS = locations.map((location: { lat: number; lng: number; level: number }) => {
238
238
  return location.level === 4 && driverLocation?.lat
239
239
  ? {
240
- latitude: driverLocation?.lat,
241
- longitude: driverLocation?.lng,
242
- }
240
+ latitude: driverLocation?.lat,
241
+ longitude: driverLocation?.lng,
242
+ }
243
243
  : { latitude: location.lat, longitude: location.lng };
244
244
  })
245
245
  fitAllMarkers();
@@ -284,7 +284,7 @@ export const GoogleMap = (props: GoogleMapsParams) => {
284
284
  onRegionChangeComplete={
285
285
  !readOnly
286
286
  ? coordinates => handleChangeRegion(coordinates)
287
- : () => {}
287
+ : () => { }
288
288
  }
289
289
  zoomTapEnabled
290
290
  zoomEnabled
@@ -302,12 +302,13 @@ export const GoogleMap = (props: GoogleMapsParams) => {
302
302
  i: number,
303
303
  ) => (
304
304
  <React.Fragment key={i}>
305
- <Marker
306
- coordinate={location}
307
- onPress={() => {
305
+ <Marker
306
+ coordinate={location}
307
+ onPress={() => {
308
308
  mapRef.current?.animateCamera({
309
- center: { latitude: location.latitude, longitude:location.longitude },
310
- })}}
309
+ center: { latitude: location?.latitude, longitude: location?.longitude },
310
+ })
311
+ }}
311
312
  >
312
313
  <Icon
313
314
  name="map-marker"
@@ -328,46 +329,46 @@ export const GoogleMap = (props: GoogleMapsParams) => {
328
329
  <Callout
329
330
  onPress={() => {
330
331
  showLocation({
331
- latitude: location.latitude,
332
- longitude: location.longitude,
333
- sourceLatitude: userLocation.latitude,
334
- sourceLongitude: userLocation.longitude,
335
- naverCallerName: 'com.businessapp',
336
- dialogTitle: t('SHOW_IN_OTHER_MAPS', 'Show in other maps'),
337
- dialogMessage: t('WHAT_APP_WOULD_YOU_USE', 'What app would you like to use?'),
338
- cancelText: t('CANCEL', 'Cancel'),
332
+ latitude: location?.latitude,
333
+ longitude: location.longitude,
334
+ sourceLatitude: userLocation?.latitude,
335
+ sourceLongitude: userLocation.longitude,
336
+ naverCallerName: 'com.businessapp',
337
+ dialogTitle: t('SHOW_IN_OTHER_MAPS', 'Show in other maps'),
338
+ dialogMessage: t('WHAT_APP_WOULD_YOU_USE', 'What app would you like to use?'),
339
+ cancelText: t('CANCEL', 'Cancel'),
339
340
  })
340
341
  }}
341
342
  >
342
- <View style={{flex: 1,width: 250, paddingRight: 10, paddingLeft: 10, justifyContent:'space-between' }}>
343
- <View style={{flex: 1, marginBottom: 20}}>
344
- <OText size={16} weight={'bold'} style={{paddingTop: 10, marginBottom: 10}}>{locations[i]?.title}</OText>
345
- { locations[i]?.address && (
346
- <>
347
- <OText size={16} >{locations[i]?.address.addressName}</OText>
348
- <OText size={16} >{locations[i]?.address.zipcode}</OText>
349
- </>
350
- )}
351
- </View>
352
- <OButton
353
- text={t('GO_TO_THIS_LOCATION', 'Go to this location')}
354
- imgRightSrc={null}
355
- textStyle={{
356
- color: theme.colors.white,
357
- fontFamily: 'Poppins',
358
- fontStyle: 'normal',
359
- fontWeight: 'normal',
360
- fontSize: 16
361
- }}
362
- style={{
363
- alignContent:'center',
364
- borderRadius: 10,
365
- height: 35,
366
- bottom:10
367
- }}
368
- bgColor={theme.colors.primary}
369
- borderColor={theme.colors.primary}
370
- />
343
+ <View style={{ flex: 1, width: 250, paddingRight: 10, paddingLeft: 10, justifyContent: 'space-between' }}>
344
+ <View style={{ flex: 1, marginBottom: 20 }}>
345
+ <OText size={16} weight={'bold'} style={{ paddingTop: 10, marginBottom: 10 }}>{locations[i]?.title}</OText>
346
+ {locations[i]?.address && (
347
+ <>
348
+ <OText size={16} >{locations[i]?.address.addressName}</OText>
349
+ <OText size={16} >{locations[i]?.address.zipcode}</OText>
350
+ </>
351
+ )}
352
+ </View>
353
+ <OButton
354
+ text={t('GO_TO_THIS_LOCATION', 'Go to this location')}
355
+ imgRightSrc={null}
356
+ textStyle={{
357
+ color: theme.colors.white,
358
+ fontFamily: 'Poppins',
359
+ fontStyle: 'normal',
360
+ fontWeight: 'normal',
361
+ fontSize: 16
362
+ }}
363
+ style={{
364
+ alignContent: 'center',
365
+ borderRadius: 10,
366
+ height: 35,
367
+ bottom: 10
368
+ }}
369
+ bgColor={theme.colors.primary}
370
+ borderColor={theme.colors.primary}
371
+ />
371
372
  </View>
372
373
  </Callout>
373
374
  </Marker>
@@ -42,7 +42,7 @@ const MapViewComponent = (props: MapViewParams) => {
42
42
  followUserLocation
43
43
  } = useLocation();
44
44
 
45
- const location = { lat: userLocation.latitude, lng: userLocation.longitude }
45
+ const location = { lat: userLocation?.latitude, lng: userLocation?.longitude }
46
46
  const haveOrders = Object.values(markerGroups)?.length > 0 && Object.values(customerMarkerGroups)?.length > 0
47
47
  const closeAlert = () => {
48
48
  setAlertState({
@@ -55,9 +55,9 @@ 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, longitude: location.longitude },
59
59
  {
60
- latitude: userLocation.latitude,
60
+ latitude: userLocation?.latitude,
61
61
  longitude: userLocation.longitude,
62
62
  },
63
63
  ],
@@ -213,10 +213,10 @@ const MapViewComponent = (props: MapViewParams) => {
213
213
  }
214
214
 
215
215
  useEffect(() => {
216
- if (userLocation.latitude !== 0 && userLocation.longitude !== 0) {
216
+ if (userLocation?.latitude !== 0 && userLocation?.longitude !== 0) {
217
217
  const location = {
218
- lat: userLocation.latitude,
219
- lng: userLocation.longitude
218
+ lat: userLocation?.latitude,
219
+ lng: userLocation?.longitude
220
220
  }
221
221
  setDriverLocation({ location })
222
222
  }
@@ -231,8 +231,8 @@ const MapViewComponent = (props: MapViewParams) => {
231
231
  ref={mapRef}
232
232
  provider={PROVIDER_GOOGLE}
233
233
  initialRegion={{
234
- latitude: initialPosition.latitude,
235
- longitude: initialPosition.longitude,
234
+ latitude: initialPosition?.latitude,
235
+ longitude: initialPosition?.longitude,
236
236
  latitudeDelta: haveOrders ? 0.01 : 0.1,
237
237
  longitudeDelta: haveOrders ? 0.01 * ASPECT_RATIO : 0.1 * ASPECT_RATIO,
238
238
  }}
@@ -45,7 +45,7 @@ const NewOrderNotificationUI = (props: any) => {
45
45
  },
46
46
  }
47
47
 
48
- const notificationSound = new Sound(theme.sounds.notification, '', () => {});
48
+ const notificationSound = new Sound(theme.sounds.notification, '', () => { });
49
49
 
50
50
  let _timeout: any = null
51
51
 
@@ -75,11 +75,11 @@ const NewOrderNotificationUI = (props: any) => {
75
75
  await fetch(`${ordering.root}/users/${user.id}/locations`, {
76
76
  method: 'POST',
77
77
  body: JSON.stringify({
78
- location: JSON.stringify({location: `{lat: ${location.latitude}, lng: ${location.longitude}}`})
78
+ location: JSON.stringify({ location: `{lat: ${location?.latitude}, lng: ${location?.longitude}}` })
79
79
  }),
80
80
  headers: { 'Content-Type': 'application/json', Authorization: `Bearer ${token}` }
81
81
  })
82
- } catch {}
82
+ } catch { }
83
83
  const duration = moment.duration(moment().diff(moment.utc(value?.last_driver_assigned_at)))
84
84
  const assignedSecondsDiff = duration.asSeconds()
85
85
  if (assignedSecondsDiff < 5 && !isBusinessApp) {
@@ -44,13 +44,10 @@ export const WrapBusinessInfo = styled.TouchableOpacity`
44
44
 
45
45
  export const TitleWrapper = styled.View`
46
46
  width: 100%;
47
- flex-direction: row;
48
- align-items: center;
49
- justify-content: space-between;
47
+ flex-direction: column;
50
48
  `
51
49
 
52
50
  export const RibbonBox = styled.View`
53
- margin-left: 5px;
54
51
  background-color: ${(props: any) => props.theme.colors.primary};
55
52
  padding: 2px 8px;
56
53
  max-width: 180px;
@@ -188,13 +188,15 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
188
188
  setOpenUpselling(false)
189
189
  setCanOpenUpselling(false)
190
190
  const cartsAvailable: any = Object.values(orderState?.carts)?.filter((cart: any) => cart?.valid && cart?.status !== 2)
191
- if (cartsAvailable.length === 1) {
191
+ if (cartsAvailable.length === 1 || !isCheckoutMultiBusinessEnabled) {
192
+ const cart = isCheckoutMultiBusinessEnabled ? cartsAvailable[0] : currentCart
193
+
192
194
  props.onNavigationRedirect('CheckoutNavigator', {
193
195
  screen: 'CheckoutPage',
194
- cartUuid: cartsAvailable[0]?.uuid,
195
- businessLogo: cartsAvailable[0]?.business?.logo,
196
- businessName: cartsAvailable[0]?.business?.name,
197
- cartTotal: cartsAvailable[0]?.total
196
+ cartUuid: cart?.uuid,
197
+ businessLogo: cart?.business?.logo,
198
+ businessName: cart?.business?.name,
199
+ cartTotal: cart?.total
198
200
  })
199
201
  } else {
200
202
  const groupKeys: any = {}
@@ -123,7 +123,9 @@ const OrderMessageUI = (props: any) => {
123
123
  setMessages,
124
124
  readMessages,
125
125
  messagesReadList,
126
- setOpenMessges
126
+ setOpenMessges,
127
+ setSeletedOrder,
128
+ setSelectedOrderId
127
129
  } = props;
128
130
  const [openModalForBusiness, setOpenModalForBusiness] = useState(false);
129
131
  const [openModalForDriver, setOpenModalForDriver] = useState(false);
@@ -140,6 +142,8 @@ const OrderMessageUI = (props: any) => {
140
142
 
141
143
  const handleClose = () => {
142
144
  setOpenMessges(false)
145
+ setSeletedOrder(null)
146
+ setSelectedOrderId(null)
143
147
  }
144
148
 
145
149
  const handleOpenMessages = (data: any) => {
@@ -269,7 +273,7 @@ export const MessageListing = (props: MessageListingParams) => {
269
273
  setOpenMessges={setOpenMessges}
270
274
  franchiseId={props.franchiseId}
271
275
  />
272
- {openMessages && seletedOrder && (
276
+ {openMessages && !!seletedOrder?.id && (
273
277
  <OModal
274
278
  open={openMessages}
275
279
  entireModal
@@ -278,7 +282,10 @@ export const MessageListing = (props: MessageListingParams) => {
278
282
  >
279
283
  <MessagesView
280
284
  order={seletedOrder}
285
+ orderId={seletedOrder?.id}
281
286
  setOpenMessges={setOpenMessges}
287
+ setSeletedOrder={setSeletedOrder}
288
+ setSelectedOrderId={setSelectedOrderId}
282
289
  />
283
290
  </OModal>
284
291
  )}
@@ -171,7 +171,7 @@ const MessagesUI = (props: MessagesParams) => {
171
171
  image: message.source,
172
172
  system: message.type === 1,
173
173
  user: {
174
- _id: message.author && message.author.id ,
174
+ _id: message.author && message.author.id,
175
175
  name: message.author && message.author.name,
176
176
  avatar: message.author && (message.author.id !== user.id && type === USER_TYPE.DRIVER ? order?.driver?.photo : order?.business?.logo)
177
177
  }
@@ -242,6 +242,7 @@ const MessagesUI = (props: MessagesParams) => {
242
242
 
243
243
  const renderAccessory = () => {
244
244
  return (
245
+ !chatDisabled &&
245
246
  <QuickMessageContainer
246
247
  style={{
247
248
  marginLeft: 10,
@@ -412,6 +413,11 @@ const MessagesUI = (props: MessagesParams) => {
412
413
  );
413
414
  }
414
415
 
416
+ useEffect(() => {
417
+ if (!order?.id || messages?.loading) return
418
+ readMessages && readMessages()
419
+ }, [order?.id, messages?.loading])
420
+
415
421
  return (
416
422
  <View style={{ height: getViewHeight(), width: '100%', paddingTop: 12, backgroundColor: 'white' }}>
417
423
  <Wrapper>
@@ -256,7 +256,7 @@ const MomentOptionUI = (props: MomentOptionParams) => {
256
256
  setDateWhitelist([{ start: _minDate, end: _maxDate }])
257
257
  }
258
258
  }
259
- }, [JSON.stringify(datesList), preorderMinimumDays, preorderMaximumDays])
259
+ }, [JSON.stringify(datesList), preorderMinimumDays, preorderMaximumDays, cateringPreorder])
260
260
 
261
261
  useEffect(() => {
262
262
  if (dateSelected) {
@@ -321,7 +321,7 @@ const MomentOptionUI = (props: MomentOptionParams) => {
321
321
  }
322
322
  }))
323
323
  }
324
- }, [dateSelected, JSON.stringify(hoursList), JSON.stringify(datesWhitelist), cateringPreorder])
324
+ }, [dateSelected, JSON.stringify(hoursList), JSON.stringify(datesWhitelist), cateringPreorder, JSON.stringify(business)])
325
325
 
326
326
  return (
327
327
  <>
@@ -385,12 +385,12 @@ const MomentOptionUI = (props: MomentOptionParams) => {
385
385
  </WrapSelectOption>
386
386
  {optionSelected.isSchedule && (
387
387
  <OrderTimeWrapper>
388
- {datesWhitelist?.length <= 1 && (
388
+ {datesWhitelist[0]?.start === datesWhitelist[0]?.end && (
389
389
  <OText>
390
390
  {moment(selectDate).format('Do MMMM, YYYY')}
391
391
  </OText>
392
392
  )}
393
- {datesWhitelist > 1 && (
393
+ {datesWhitelist[0]?.start !== datesWhitelist[0]?.end && (
394
394
  <View style={{ flex: 1 }}>
395
395
  {selectDate && datesWhitelist[0]?.start !== null && (
396
396
  <CalendarStrip
@@ -466,7 +466,7 @@ const MomentOptionUI = (props: MomentOptionParams) => {
466
466
  </View>
467
467
  <Spinner visible={momentState.isLoading === 1} />
468
468
  </Container>
469
- {!isCart && (
469
+ {!isCart && !cateringPreorder && (
470
470
  <View style={{ position: 'absolute', bottom: bottom, paddingBottom: 20, paddingHorizontal: 40, backgroundColor: 'white', width: '100%' }}>
471
471
  <OButton onClick={() => handleChangeMoment()} isDisabled={!selectedTime} text={t('CONTINUE', 'Continue')} style={{ borderRadius: 7.6, height: 44, shadowOpacity: 0 }} textStyle={{ color: 'white', fontSize: 14 }} showNextIcon />
472
472
  </View>
@@ -279,6 +279,7 @@ const MultiCheckoutUI = (props: any) => {
279
279
  hideDeliveryFee={configs?.multi_business_checkout_show_combined_delivery_fee?.value === '1'}
280
280
  hideDriverTip={configs?.multi_business_checkout_show_combined_driver_tip?.value === '1'}
281
281
  onNavigationRedirect={(route: string, params: any) => props.navigation.navigate(route, params)}
282
+ businessConfigs={cart?.business?.configs}
282
283
  />
283
284
  {openCarts.length > 1 && (
284
285
  <View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginTop: 13, marginHorizontal: -40 }} />
@@ -1009,7 +1009,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
1009
1009
  <OText>
1010
1010
  {event?.wallet_event
1011
1011
  ? walletName[event?.wallet_event?.wallet?.type]?.name
1012
- : event?.paymethod?.name}
1012
+ : t(event?.paymethod?.name.toUpperCase()?.replace(/ /g, '_'), event?.paymethod?.name)}
1013
1013
  </OText>
1014
1014
  {event?.data?.charge_id && (
1015
1015
  <OText>
@@ -19,7 +19,7 @@ export const LogoWrapper = styled.View`
19
19
  shadowRadius: 3;
20
20
  shadowOffset: { width: 1, height: 4 };
21
21
  elevation: 3;
22
- borderRadius: 8;
22
+ border-radius: 8;
23
23
  shadowOpacity: 0.1;
24
24
  overflow: hidden;
25
25
  width: 80;
@@ -27,7 +27,7 @@ const StyledButton = styled.View<Props>`
27
27
  padding-left: 20px;
28
28
  padding-right: 20px;
29
29
  position: relative;
30
- ${(props : any) => props?.theme?.general?.components?.buttons?.borderRadius && css`
30
+ ${(props: any) => props?.theme?.general?.components?.buttons?.borderRadius && css`
31
31
  border-radius: ${props?.theme?.general?.components?.buttons?.borderRadius}px;
32
32
  `}
33
33
  `
@@ -119,7 +119,7 @@ const OButton = (props: Props): React.ReactElement => {
119
119
  style={{ width: props.isCircle ? 52 : props.style?.width, ...props.parentStyle }}
120
120
  disabled={props.isDisabledWithSameStyles}
121
121
  >
122
- <StyledButton style={props.bgColor ? { ...props.style, backgroundColor: props.bgColor, borderColor: props.borderColor, borderRadius: theme?.general?.components?.buttons?.borderRadius || props.style?.borderRadius} : {...props.style, borderRadius: theme?.general?.components?.buttons?.borderRadius || props.style?.borderRadius}}>
122
+ <StyledButton style={props.bgColor ? { ...props.style, backgroundColor: props.bgColor, borderColor: props.borderColor, borderRadius: parseInt(theme?.general?.components?.buttons?.borderRadius) || props.style?.borderRadius } : { ...props.style, borderRadius: parseInt(theme?.general?.components?.buttons?.borderRadius) || props.style?.borderRadius }}>
123
123
  {props.icon ? (
124
124
  <props.icon {...props.iconProps} />
125
125
  ) : null}
@@ -52,7 +52,7 @@ const OModal = (props: Props): React.ReactElement => {
52
52
 
53
53
  const theme = useTheme();
54
54
 
55
- const RenderSafeAreaView = () => (
55
+ const renderSafeAreaView = () => (
56
56
  <SafeAreaView style={styles.container}>
57
57
  {!entireModal ? (
58
58
  <View style={styles.centeredView}>
@@ -101,10 +101,10 @@ const OModal = (props: Props): React.ReactElement => {
101
101
  enabled
102
102
  behavior={Platform.OS === 'ios' ? 'padding' : 'height'}
103
103
  >
104
- <RenderSafeAreaView/>
104
+ {renderSafeAreaView()}
105
105
  </KeyboardView>
106
106
  ) : (
107
- <RenderSafeAreaView/>
107
+ renderSafeAreaView()
108
108
  )}
109
109
  </Modal>
110
110
  );