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

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.14-test",
3
+ "version": "0.18.15",
4
4
  "description": "Reusable components made in react native",
5
5
  "main": "src/index.tsx",
6
6
  "author": "ordering.inc",
@@ -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'),
@@ -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;
@@ -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');
@@ -330,7 +330,7 @@ export const GoogleMap = (props: GoogleMapsParams) => {
330
330
  onPress={() => {
331
331
  showLocation({
332
332
  latitude: location?.latitude,
333
- longitude: location.longitude,
333
+ longitude: location?.longitude,
334
334
  sourceLatitude: userLocation?.latitude,
335
335
  sourceLongitude: userLocation.longitude,
336
336
  naverCallerName: 'com.businessapp',
@@ -55,10 +55,10 @@ 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
60
  latitude: userLocation?.latitude,
61
- longitude: userLocation.longitude,
61
+ longitude: userLocation?.longitude,
62
62
  },
63
63
  ],
64
64
  {
@@ -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) {
@@ -557,7 +557,7 @@ export const BusinessPreorder = (props: any) => {
557
557
  : null
558
558
 
559
559
  const splitCateringValue = (configName : string) =>
560
- Object.values(a || props?.business?.configs || {})
560
+ Object.values(props?.business?.configs || {})
561
561
  ?.find(config => config?.key === configName)
562
562
  ?.value?.split('|')
563
563
  ?.find(val => val.includes(cateringTypeString || ''))?.split(',')[1]
@@ -45,6 +45,7 @@ const CartUI = (props: any) => {
45
45
  isMultiCheckout,
46
46
  hideDeliveryFee,
47
47
  hideDriverTip,
48
+ hideCouponInput,
48
49
  preorderSlotInterval,
49
50
  preorderLeadTime,
50
51
  preorderTimeRange,
@@ -406,7 +407,7 @@ const CartUI = (props: any) => {
406
407
  <OText size={12}>-{parsePrice(event.amount, { isTruncable: true })}</OText>
407
408
  </OSTable>
408
409
  ))}
409
- {isCouponEnabled && !isCartPending && (
410
+ {isCouponEnabled && !isCartPending && !hideCouponInput && (
410
411
  <OSTable>
411
412
  <OSCoupon>
412
413
  <CouponControl
@@ -23,7 +23,9 @@ import { MultiCartsPaymethodsAndWallets } from '../MultiCartsPaymethodsAndWallet
23
23
  import { Cart } from '../Cart'
24
24
  import { FloatingButton } from '../FloatingButton'
25
25
  import { DriverTips } from '../DriverTips'
26
+ import { CouponControl } from '../CouponControl';
26
27
  import { DriverTipsContainer } from '../Cart/styles'
28
+ import { OSTable, OSCoupon } from '../OrderSummary/styles';
27
29
 
28
30
  import {
29
31
  ChContainer,
@@ -263,6 +265,29 @@ const MultiCheckoutUI = (props: any) => {
263
265
  </ChSection>
264
266
  )}
265
267
 
268
+ {
269
+ validationFields?.fields?.checkout?.coupon?.enabled &&
270
+ openCarts.every((cart: any) => cart.business_id && cart.status !== 2) &&
271
+ configs?.multi_business_checkout_coupon_input_style?.value === 'group' &&
272
+ (
273
+ <ChSection>
274
+ <OText size={14} lineHeight={20} color={theme.colors.textNormal}>
275
+ {t('DISCOUNT_COUPON', 'Discount coupon')}
276
+ </OText>
277
+ <OSTable>
278
+ <OSCoupon>
279
+ <CouponControl
280
+ isMulti
281
+ carts={openCarts}
282
+ businessIds={openCarts.map((cart: any) => cart.business_id)}
283
+ price={openCarts.reduce((total: any, cart: any) => total + cart.total, 0)}
284
+ />
285
+ </OSCoupon>
286
+ </OSTable>
287
+ <View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginTop: 13, marginHorizontal: -40 }} />
288
+ </ChSection>
289
+ )}
290
+
266
291
  <ChSection>
267
292
  <ChCarts>
268
293
  <CartsHeader>
@@ -276,6 +301,7 @@ const MultiCheckoutUI = (props: any) => {
276
301
  cart={cart}
277
302
  cartuuid={cart.uuid}
278
303
  isMultiCheckout
304
+ hideCouponInput={configs?.multi_business_checkout_coupon_input_style?.value === 'group'}
279
305
  hideDeliveryFee={configs?.multi_business_checkout_show_combined_delivery_fee?.value === '1'}
280
306
  hideDriverTip={configs?.multi_business_checkout_show_combined_driver_tip?.value === '1'}
281
307
  onNavigationRedirect={(route: string, params: any) => props.navigation.navigate(route, params)}
@@ -117,11 +117,11 @@ const OrderProgressUI = (props: any) => {
117
117
  <View style={styles.logoWrapper}>
118
118
  <FastImage
119
119
  style={{ width: 50, height: 50 }}
120
- source={{
120
+ source={orderList?.orders.length === 1 ? {
121
121
  uri: optimizeImage(lastOrder?.business?.logo, 'h_50,c_limit'),
122
122
  priority: FastImage.priority.normal,
123
- }}
124
- resizeMode={FastImage.resizeMode.cover}
123
+ } : theme.images.logos.logotype}
124
+ resizeMode={FastImage.resizeMode.contain}
125
125
  />
126
126
  </View>
127
127
  <View style={{
@@ -190,7 +190,7 @@ export const OrderProgress = (props: any) => {
190
190
  useDefualtSessionManager: true,
191
191
  paginationSettings: {
192
192
  initialPage: 1,
193
- pageSize: 1,
193
+ pageSize: 10,
194
194
  controlType: 'infinity'
195
195
  }
196
196
  }
@@ -75,7 +75,7 @@ const PaymentOptionsUI = (props: any) => {
75
75
  case 'paypal':
76
76
  return theme.images.general.paypal
77
77
  case 'stripe':
78
- return theme.images.general.stripe
78
+ return theme.images.general.creditCard
79
79
  case 'stripe_direct':
80
80
  return theme.images.general.stripecc
81
81
  case 'stripe_connect':