ordering-ui-react-native 0.19.8-release → 0.20.0-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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ordering-ui-react-native",
3
- "version": "0.19.8-release",
3
+ "version": "0.20.0-release",
4
4
  "description": "Reusable components made in react native",
5
5
  "main": "src/index.tsx",
6
6
  "author": "ordering.inc",
@@ -50,6 +50,7 @@ export const OrderHeaderComponent = (props: OrderHeader) => {
50
50
  const theme = useTheme();
51
51
  const [, t] = useLanguage();
52
52
  const [{ parseDate }] = useUtils();
53
+ const paymethodsLength = order?.payment_events?.filter((item: any) => item.event === 'payment')?.length
53
54
 
54
55
  const styles = StyleSheet.create({
55
56
  icons: {
@@ -120,6 +121,15 @@ export const OrderHeaderComponent = (props: OrderHeader) => {
120
121
  ? t('CURBSIDE', 'Curbside')
121
122
  : t('DRIVER_THRU', 'Driver thru')
122
123
 
124
+ const handlePaymethodsListString = () => {
125
+ const paymethodsList = order?.payment_events?.filter((item: any) => item.event === 'payment').map((paymethod: any) => {
126
+ return paymethod?.wallet_event
127
+ ? walletName[paymethod?.wallet_event?.wallet?.type]?.name
128
+ : t(paymethod?.paymethod?.gateway?.toUpperCase(), paymethod?.paymethod?.name)
129
+ })
130
+ return paymethodsList.join(', ')
131
+ }
132
+
123
133
  return (
124
134
  <>
125
135
  {!props.isCustomView && (
@@ -283,20 +293,10 @@ export const OrderHeaderComponent = (props: OrderHeader) => {
283
293
  )}
284
294
  <OText>
285
295
  <OText size={13} weight='bold'>
286
- {`${t('PAYMENT_METHODS', 'Payment methods')}: `}
296
+ {`${t(paymethodsLength > 1 ? 'PAYMENT_METHODS' : 'PAYMENT_METHOD', paymethodsLength > 1 ? 'Payment methods' : 'Payment method')}: `}
287
297
  </OText>
288
298
  {order?.payment_events?.length > 0 ? (
289
- <OText size={13}>
290
- {order?.payment_events?.map((event: any, idx: number) => {
291
- return event?.wallet_event
292
- ? idx < order?.payment_events?.length - 1
293
- ? `${walletName[event?.wallet_event?.wallet?.type]?.name} - `
294
- : walletName[event?.wallet_event?.wallet?.type]?.name
295
- : idx < order?.payment_events?.length - 1
296
- ? `${t(event?.paymethod?.name?.toUpperCase()?.replace(/ /g, '_'), event?.paymethod?.name)} - `
297
- : t(event?.paymethod?.name?.toUpperCase()?.replace(/ /g, '_'), event?.paymethod?.name)
298
- })}
299
- </OText>
299
+ <OText size={13}>{`${handlePaymethodsListString()}`}</OText>
300
300
  ) : (
301
301
  <OText size={13}>{t(order?.paymethod?.gateway?.toUpperCase(), order?.paymethod?.name)}</OText>
302
302
  )}
@@ -118,7 +118,7 @@ export const OrderSummary = ({ order, navigation, orderStatus, askBluetoothPermi
118
118
  : parseDate(order?.delivery_datetime, { utc: false })
119
119
  }
120
120
  </br>
121
- ${paymethodsLength > 1 ? 'PAYMENT_METHODS' : 'PAYMENT_METHOD'}: ${handlePaymethodsListString()}
121
+ ${t(paymethodsLength > 1 ? 'PAYMENT_METHODS' : 'PAYMENT_METHOD', paymethodsLength > 1 ? 'Payment methods' : 'Payment method')}: ${handlePaymethodsListString()}
122
122
  </p>
123
123
 
124
124
  <h1>${t('CUSTOMER_DETAILS', 'Customer details')}</h1>
@@ -72,7 +72,7 @@ export const ProductItemAccordion = (props: ProductItemAccordionParams) => {
72
72
 
73
73
  const getProductPrice = (product: any) => {
74
74
  let subOptionPrice = 0;
75
- if (product?.options?.length > 0 && product?.options?.suboptions?.length > 0) {
75
+ if (product?.options?.length > 0 && product?.options[0]?.suboptions?.length > 0) {
76
76
  for (const option of product?.options) {
77
77
  for (const suboption of option?.suboptions) {
78
78
  subOptionPrice += suboption.quantity * suboption.price;
@@ -118,7 +118,7 @@ export const ProductItemAccordion = (props: ProductItemAccordionParams) => {
118
118
 
119
119
  const onTextLayout = useCallback((e: any) => {
120
120
  setLengthMore((e.nativeEvent.lines.length == 2 && e.nativeEvent.lines[1].width > WIDTH_SCREEN * .76) || e.nativeEvent.lines.length > 2); //to check the text is more than 2 lines or not
121
- },[]);
121
+ }, []);
122
122
 
123
123
  return (
124
124
  <AccordionSection>
@@ -47,7 +47,8 @@ const ProfileUI = (props: ProfileParams) => {
47
47
  cleanFormState,
48
48
  handleToggleAvalaibleStatusDriver,
49
49
  isAlsea,
50
- isHideDriverStatus
50
+ isShowDriverStatus,
51
+ navigation
51
52
  } = props;
52
53
 
53
54
  const [{ user, sessionLoading }] = useSession();
@@ -361,7 +362,7 @@ const ProfileUI = (props: ProfileParams) => {
361
362
  />
362
363
  </CenterView>
363
364
 
364
- {user?.level === 4 && !isHideDriverStatus && (
365
+ {user?.level === 4 && (
365
366
  <EnabledStatusDriver>
366
367
  <View style={{ flex: 1 }}>
367
368
  <OText
@@ -369,29 +370,33 @@ const ProfileUI = (props: ProfileParams) => {
369
370
  adjustsFontSizeToFit
370
371
  style={{ ...styles.label, paddingHorizontal: 0 }}>
371
372
  {t(
372
- 'AVAILABLE_TO_RECEIVE_ORDERS',
373
- 'Available to receive orders',
373
+ `${!isShowDriverStatus ? 'NOT_' : ''}AVAILABLE_TO_RECEIVE_ORDERS`,
374
+ `${!isShowDriverStatus ? 'You are not ' : ''}Available to receive orders`
374
375
  )}
375
376
  </OText>
376
377
  </View>
377
378
 
378
- {userState.loadingDriver ? (
379
- <ActivityIndicator size="small" color={theme.colors.primary} />
380
- ) : (
381
- <ToggleSwitch
382
- isOn={userState?.result?.result?.available}
383
- onColor={theme.colors.primary}
384
- offColor={theme.colors.offColor}
385
- size="small"
386
- onToggle={() =>
387
- handleToggleAvalaibleStatusDriver &&
388
- handleToggleAvalaibleStatusDriver(
389
- !userState?.result?.result?.available,
390
- )
391
- }
392
- disabled={userState?.loading}
393
- animationSpeed={200}
394
- />
379
+ {isShowDriverStatus && (
380
+ <>
381
+ {userState.loadingDriver ? (
382
+ <ActivityIndicator size="small" color={theme.colors.primary} />
383
+ ) : (
384
+ <ToggleSwitch
385
+ isOn={userState?.result?.result?.available}
386
+ onColor={theme.colors.primary}
387
+ offColor={theme.colors.offColor}
388
+ size="small"
389
+ onToggle={() =>
390
+ handleToggleAvalaibleStatusDriver &&
391
+ handleToggleAvalaibleStatusDriver(
392
+ !userState?.result?.result?.available,
393
+ )
394
+ }
395
+ disabled={userState?.loading}
396
+ animationSpeed={200}
397
+ />
398
+ )}
399
+ </>
395
400
  )}
396
401
  </EnabledStatusDriver>
397
402
  )}
@@ -57,7 +57,7 @@ export interface ProfileParams {
57
57
  showField?: any;
58
58
  isRequiredField?: any;
59
59
  isAlsea?: boolean;
60
- isHideDriverStatus?: boolean;
60
+ isShowDriverStatus?: boolean;
61
61
  isFocused?: boolean;
62
62
  }
63
63
 
@@ -24,7 +24,7 @@ const AddressDetailsUI = (props: any) => {
24
24
 
25
25
  const styles = StyleSheet.create({
26
26
  productStyle: {
27
- width: width,
27
+ width,
28
28
  height: 151,
29
29
  marginVertical: 10
30
30
  }
@@ -45,7 +45,7 @@ const AddressDetailsUI = (props: any) => {
45
45
  </ADHeader>
46
46
  {!!apiKey && googleMapsUrl && (
47
47
  <ADMap
48
- style={{ marginStart: -40, marginEnd: -40, width: width, flex: 1 }}>
48
+ style={{ width, flex: 1, marginStart: -20, marginEnd: -20, }}>
49
49
  <FastImage
50
50
  style={styles.productStyle}
51
51
  source={{
@@ -471,7 +471,7 @@ const CheckoutUI = (props: any) => {
471
471
  </TopHeader>
472
472
  </View>
473
473
  </SafeAreaView>
474
- <Container pt={0} forwardRef={containerRef} noPadding onScroll={handleScroll}>
474
+ <Container pt={0} forwardRef={containerRef} showsVerticalScrollIndicator={false} noPadding onScroll={handleScroll}>
475
475
  <View style={styles.wrapperNavbar}>
476
476
  <NavBar
477
477
  hideArrowLeft
@@ -110,7 +110,7 @@ const OrderProgressUI = (props: any) => {
110
110
  setInitialLoaded(true)
111
111
  }, [orderList.loading, initialLoaded])
112
112
 
113
- const progressBarObjt = lastOrder?.delivery_type && lastOrder?.delivery_type === 2 ? getOrderStatuPickUp : getOrderStatus
113
+ const progressBarObjt = (s: any) => lastOrder?.delivery_type && lastOrder?.delivery_type === 2 ? getOrderStatuPickUp(s) : getOrderStatus(s)
114
114
 
115
115
  return (
116
116
  <>
@@ -130,7 +130,7 @@ const OrderProgressUI = (props: any) => {
130
130
  <View style={styles.logoWrapper}>
131
131
  <FastImage
132
132
  style={{ width: 50, height: 50 }}
133
- source={orderList?.orders.length === 1 ? {
133
+ source={orderList?.orders.length === 1 && lastOrder?.business?.logo.includes('http') ? {
134
134
  uri: optimizeImage(lastOrder?.business?.logo, 'h_50,c_limit'),
135
135
  priority: FastImage.priority.normal,
136
136
  } : theme.images.logos.logotype}
@@ -209,6 +209,16 @@ export const OrderProgress = (props: any) => {
209
209
  pageSize: 10,
210
210
  controlType: 'infinity'
211
211
  },
212
+ propsToFetch: [
213
+ 'id',
214
+ 'name',
215
+ 'business',
216
+ 'status',
217
+ 'delivery_type',
218
+ 'delivery_datetime_utc',
219
+ 'delivery_datetime',
220
+ 'reporting_data'
221
+ ],
212
222
  noGiftCardOrders: true
213
223
  }
214
224