ordering-ui-react-native 0.18.14 → 0.18.16

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",
3
+ "version": "0.18.16",
4
4
  "description": "Reusable components made in react native",
5
5
  "main": "src/index.tsx",
6
6
  "author": "ordering.inc",
@@ -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
 
@@ -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 = {
@@ -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>
@@ -476,6 +476,8 @@ const LoginFormUI = (props: LoginParams) => {
476
476
  borderRadius: 7.6,
477
477
  borderColor: theme.colors.inputSignup,
478
478
  backgroundColor: theme.colors.transparent,
479
+ minHeight: 50,
480
+ maxHeight : 50
479
481
  },
480
482
  btn: {
481
483
  borderRadius: 7.6,
@@ -941,3 +943,4 @@ export const LoginForm = (props: any) => {
941
943
 
942
944
  return <LoginFormController {...loginProps} />;
943
945
  };
946
+
@@ -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({
@@ -57,8 +57,8 @@ const MapViewComponent = (props: MapViewParams) => {
57
57
  [
58
58
  { latitude: location.latitude, longitude: location.longitude },
59
59
  {
60
- latitude: userLocation.latitude,
61
- longitude: userLocation.longitude,
60
+ latitude: userLocation?.latitude,
61
+ longitude: userLocation?.longitude,
62
62
  },
63
63
  ],
64
64
  {
@@ -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
  }}
@@ -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':
@@ -292,6 +292,7 @@ const PaymentOptionsUI = (props: any) => {
292
292
  onSelectCard={handlePaymethodDataChange}
293
293
  onNavigationRedirect={onNavigationRedirect}
294
294
  onCancel={() => handlePaymethodClick(null)}
295
+ setAddCardOpen={() => setAddCardOpen({ ...addCardOpen, stripe: true })}
295
296
  />
296
297
  </View>
297
298
  )}
@@ -113,7 +113,7 @@ export const PhoneInputNumber = (props: PhoneInputParams) => {
113
113
  !isNaN(defaultCode)
114
114
  ? transformCountryCode(defaultCode)
115
115
  : defaultCode
116
- : configs?.default_country_code?.value}
116
+ : configs?.default_country_code?.value?.toUpperCase()}
117
117
  onChangeFormattedText={(text: string) => handleChangeNumber(text)}
118
118
  withDarkTheme
119
119
  onChangeCountry={(country) => changeCountry?.(country)}
@@ -1,4 +1,4 @@
1
- import React from 'react';
1
+ import React, { useEffect } from 'react';
2
2
  import { View, StyleSheet, ScrollView } from 'react-native';
3
3
  import {
4
4
  PaymentOptionStripe,
@@ -25,6 +25,7 @@ const StripeCardsListUI = (props: any) => {
25
25
  cardSelected,
26
26
  cardsList,
27
27
  handleCardClick,
28
+ setAddCardOpen
28
29
  } = props;
29
30
 
30
31
  const theme = useTheme();
@@ -37,6 +38,12 @@ const StripeCardsListUI = (props: any) => {
37
38
  onSelectCard(card);
38
39
  }
39
40
 
41
+ useEffect(() => {
42
+ if (!cardsList?.loading && cardsList?.cards?.length === 0) {
43
+ setAddCardOpen(true)
44
+ }
45
+ }, [cardsList?.loading])
46
+
40
47
  return (
41
48
  <>
42
49
  {token && !cardsList.loading && cardsList.cards && cardsList.cards.length === 0 && (