ordering-ui-react-native 0.15.45 → 0.15.46

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.46",
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
@@ -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
  )}
@@ -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