ordering-ui-react-native 0.15.45 → 0.15.48

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.15.45",
3
+ "version": "0.15.48",
4
4
  "description": "Reusable components made in react native",
5
5
  "main": "src/index.tsx",
6
6
  "author": "ordering.inc",
@@ -99,7 +99,6 @@ export const PreviousOrders = (props: any) => {
99
99
  },
100
100
  });
101
101
 
102
-
103
102
  const getDelayMinutes = (order: any) => {
104
103
  // targetMin = delivery_datetime + eta_time - now()
105
104
  const offset = 300
@@ -108,7 +107,7 @@ export const PreviousOrders = (props: any) => {
108
107
  ? parseDate(order?.delivery_datetime_utc)
109
108
  : parseDate(cdtToutc)
110
109
  const _eta = order?.eta_time
111
- return moment(_delivery.replace('AM', '')).add(_eta, 'minutes').diff(moment().utc(), 'minutes')
110
+ return moment(_delivery, 'YYYY-MM-DD hh:mm A').add(_eta, 'minutes').diff(moment().utc(), 'minutes')
112
111
  }
113
112
 
114
113
  const displayDelayedTime = (order: any) => {
@@ -116,10 +115,10 @@ export const PreviousOrders = (props: any) => {
116
115
  // get day, hour and minutes
117
116
  const sign = tagetedMin >= 0 ? '' : '- '
118
117
  tagetedMin = Math.abs(tagetedMin)
119
- let day = Math.floor(tagetedMin / 1440)
118
+ let day: string | number = Math.floor(tagetedMin / 1440)
120
119
  const restMinOfTargetedMin = tagetedMin - 1440 * day
121
- let restHours = Math.floor(restMinOfTargetedMin / 60)
122
- let restMins = restMinOfTargetedMin - 60 * restHours
120
+ let restHours: string | number = Math.floor(restMinOfTargetedMin / 60)
121
+ let restMins: string | number = restMinOfTargetedMin - 60 * restHours
123
122
  // make standard time format
124
123
  day = day === 0 ? '' : day + 'day '
125
124
  restHours = restHours < 10 ? '0' + restHours : restHours
@@ -446,7 +446,7 @@ export const ProductOptionsUI = (props: any) => {
446
446
  </WrapperIngredients>
447
447
  </View>
448
448
  )}
449
- {product?.extras.map((extra: any) => extra.options.map((option: any) => {
449
+ {product?.extras.map((extra: any) => extra.options.sort((a: any, b: any) => a.rank - b.rank).map((option: any) => {
450
450
  const currentState = productCart.options[`id:${option.id}`] || {}
451
451
  return (
452
452
  <React.Fragment key={option.id}>
@@ -460,7 +460,7 @@ export const ProductOptionsUI = (props: any) => {
460
460
  >
461
461
  <WrapperSubOption style={{ backgroundColor: isError(option.id) }}>
462
462
  {
463
- option.suboptions.map((suboption: any) => {
463
+ option.suboptions.sort((a: any, b: any) => a.rank - b.rank).map((suboption: any) => {
464
464
  const currentState = productCart.options[`id:${option.id}`]?.suboptions[`id:${suboption.id}`] || {}
465
465
  const balance = productCart.options[`id:${option.id}`]?.balance || 0
466
466
  return (
@@ -554,11 +554,12 @@ const CheckoutUI = (props: any) => {
554
554
  </ChSection>
555
555
  )}
556
556
 
557
- {!cartState.loading && cart && isWalletEnabled && (
557
+ {!cartState.loading && cart && isWalletEnabled && businessDetails?.business?.configs && (
558
558
  <WalletPaymentOptionContainer>
559
559
  <PaymentOptionWallet
560
560
  cart={cart}
561
561
  businessId={cart?.business_id}
562
+ businessConfigs={businessDetails?.business?.configs}
562
563
  />
563
564
  </WalletPaymentOptionContainer>
564
565
  )}
@@ -188,7 +188,7 @@ const OrderProgressUI = (props: any) => {
188
188
  <ProgressBar style={{ width: getOrderStatus(lastOrder.status)?.percentage ? `${getOrderStatus(lastOrder.status)?.percentage}%` : '0%' }} />
189
189
  </ProgressContentWrapper>
190
190
  <ProgressTextWrapper>
191
- <OText size={12}>{getOrderStatus(lastOrder.status)?.value}</OText>
191
+ <OText size={12} style={{ width: '50%' }}>{getOrderStatus(lastOrder.status)?.value}</OText>
192
192
  <TimeWrapper>
193
193
  <OText size={11}>{t('ESTIMATED_DELIVERY', 'Estimated delivery')}</OText>
194
194
  <OText size={11}>
@@ -20,6 +20,7 @@ export const ProgressTextWrapper = styled.View`
20
20
  flex-direction: row;
21
21
  justify-content: space-between;
22
22
  align-items: center;
23
+ width: 100%;
23
24
  `
24
25
 
25
26
  export const OrderInfoWrapper = styled.View`
@@ -20,6 +20,7 @@ import { OText } from '../shared'
20
20
 
21
21
  const PaymentOptionWalletUI = (props: any) => {
22
22
  const {
23
+ businessConfigs,
23
24
  businessId,
24
25
  walletsState,
25
26
  selectWallet,
@@ -37,6 +38,9 @@ const PaymentOptionWalletUI = (props: any) => {
37
38
  const isWalletCashEnabled = configs?.wallet_cash_enabled?.value === '1'
38
39
  const isWalletPointsEnabled = configs?.wallet_credit_point_enabled?.value === '1'
39
40
 
41
+ const isBusinessWalletCashEnabled = businessConfigs.find((config: any) => config.key === 'wallet_cash_enabled')?.value === '1'
42
+ const isBusinessWalletPointsEnabled = businessConfigs.find((config: any) => config.key === 'wallet_credit_point_enabled')?.value === '1'
43
+
40
44
  const styles = StyleSheet.create({
41
45
  checkBoxStyle: {
42
46
  width: 25,
@@ -53,11 +57,11 @@ const PaymentOptionWalletUI = (props: any) => {
53
57
  const walletName: any = {
54
58
  cash: {
55
59
  name: t('PAY_WITH_CASH_WALLET', 'Pay with Cash Wallet'),
56
- isActive: isWalletCashEnabled
60
+ isActive: isWalletCashEnabled && isBusinessWalletCashEnabled
57
61
  },
58
62
  credit_point: {
59
63
  name: t('PAY_WITH_CREDITS_POINTS_WALLET', 'Pay with Credit Points Wallet'),
60
- isActive: isWalletPointsEnabled
64
+ isActive: isWalletPointsEnabled && isBusinessWalletPointsEnabled
61
65
  }
62
66
  }
63
67
 
@@ -695,7 +695,7 @@ export const ProductOptionsUI = (props: any) => {
695
695
  </View>
696
696
  )}
697
697
  {product?.extras.map((extra: any) =>
698
- extra.options.map((option: any) => {
698
+ extra.options.sort((a: any, b: any) => a.rank - b.rank).map((option: any) => {
699
699
  const currentState =
700
700
  productCart.options[`id:${option.id}`] || {};
701
701
  return (
@@ -711,7 +711,7 @@ export const ProductOptionsUI = (props: any) => {
711
711
  backgroundColor: isError(option.id),
712
712
  borderRadius: 7.6
713
713
  }}>
714
- {option.suboptions.map(
714
+ {option.suboptions.sort((a: any, b: any) => a.rank - b.rank).map(
715
715
  (suboption: any) => {
716
716
  const currentState =
717
717
  productCart.options[
@@ -779,7 +779,7 @@ export const ProductOptionsUI = (props: any) => {
779
779
  ) : (
780
780
  <>
781
781
  {product?.extras.map((extra: any) =>
782
- extra.options.map((option: any) => {
782
+ extra.options.sort((a: any, b: any) => a.rank - b.rank).map((option: any) => {
783
783
  if (
784
784
  option.id == selOpt ||
785
785
  (hasRespected(
@@ -804,7 +804,7 @@ export const ProductOptionsUI = (props: any) => {
804
804
  option.id,
805
805
  ),
806
806
  }}>
807
- {option.suboptions.map(
807
+ {option.suboptions.sort((a: any, b: any) => a.rank - b.rank).map(
808
808
  (suboption: any) => {
809
809
  const currentState =
810
810
  productCart.options[
@@ -1,4 +1,5 @@
1
1
  import React from 'react';
2
+ import { Platform } from 'react-native';
2
3
  import OText from './OText';
3
4
 
4
5
  const HeaderTitle = (props: any) => {
@@ -7,7 +8,7 @@ const HeaderTitle = (props: any) => {
7
8
  <OText
8
9
  size={24}
9
10
  style={style ?? {
10
- marginTop: 30,
11
+ marginTop: Platform.OS === 'android' ? 50 : 30,
11
12
  paddingHorizontal: 40,
12
13
  textTransform: 'capitalize'
13
14
  }}