ordering-ui-react-native 0.16.23 → 0.16.24
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
package/src/theme.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { useState, useRef, useEffect } from 'react';
|
|
2
2
|
import { TouchableOpacity, View } from 'react-native';
|
|
3
|
-
import { useOrder, useLanguage, useUtils } from 'ordering-components/native';
|
|
3
|
+
import { useOrder, useLanguage, useUtils, useConfig } from 'ordering-components/native';
|
|
4
4
|
import { useTheme } from 'styled-components/native';
|
|
5
5
|
import {
|
|
6
6
|
BIContainer,
|
|
@@ -28,11 +28,13 @@ export const BusinessItemAccordion = (props: any) => {
|
|
|
28
28
|
const [orderState] = useOrder();
|
|
29
29
|
const [, t] = useLanguage();
|
|
30
30
|
const [{ parsePrice }] = useUtils();
|
|
31
|
+
const [{ configs }] = useConfig()
|
|
31
32
|
const theme = useTheme();
|
|
32
33
|
|
|
33
34
|
const isCartPending = cart?.status === 2
|
|
34
35
|
const isClosed = !cart?.valid_schedule
|
|
35
36
|
const isProducts = cart?.products?.length
|
|
37
|
+
const isBusinessChangeEnabled = configs?.cart_change_business_validation?.value === '1'
|
|
36
38
|
|
|
37
39
|
const [isActive, setActiveState] = useState(!!singleBusiness)
|
|
38
40
|
|
|
@@ -91,7 +93,7 @@ export const BusinessItemAccordion = (props: any) => {
|
|
|
91
93
|
</OAlert>
|
|
92
94
|
</>
|
|
93
95
|
)}
|
|
94
|
-
{props.handleChangeStore && (
|
|
96
|
+
{isBusinessChangeEnabled && props.handleChangeStore && (
|
|
95
97
|
<>
|
|
96
98
|
<OText color={theme.colors.textSecondary}>{' \u2022 '}</OText>
|
|
97
99
|
<TouchableOpacity
|
|
@@ -142,6 +142,7 @@ const CheckoutUI = (props: any) => {
|
|
|
142
142
|
const isWalletCashEnabled = businessConfigs.find((config: any) => config.key === 'wallet_cash_enabled')?.value === '1'
|
|
143
143
|
const isWalletCreditPointsEnabled = businessConfigs.find((config: any) => config.key === 'wallet_credit_point_enabled')?.value === '1'
|
|
144
144
|
const isWalletEnabled = configs?.cash_wallet?.value && configs?.wallet_enabled?.value === '1' && (isWalletCashEnabled || isWalletCreditPointsEnabled)
|
|
145
|
+
const isBusinessChangeEnabled = configs?.cart_change_business_validation?.value === '1'
|
|
145
146
|
|
|
146
147
|
const isPreOrder = configs?.preorder_status_enabled?.value === '1'
|
|
147
148
|
const isDisabledButtonPlace = loading || !cart?.valid || (!paymethodSelected && cart?.balance > 0) || placing || errorCash ||
|
|
@@ -614,19 +615,21 @@ const CheckoutUI = (props: any) => {
|
|
|
614
615
|
</OText>
|
|
615
616
|
</TouchableOpacity>
|
|
616
617
|
</CartHeader>
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
<OText
|
|
622
|
-
size={12}
|
|
623
|
-
lineHeight={18}
|
|
624
|
-
color={theme.colors.textSecondary}
|
|
625
|
-
style={{ textDecorationLine: 'underline' }}
|
|
618
|
+
{isBusinessChangeEnabled && (
|
|
619
|
+
<TouchableOpacity
|
|
620
|
+
onPress={() => setOpenChangeStore(true)}
|
|
621
|
+
style={{ alignSelf: 'flex-start' }}
|
|
626
622
|
>
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
623
|
+
<OText
|
|
624
|
+
size={12}
|
|
625
|
+
lineHeight={18}
|
|
626
|
+
color={theme.colors.textSecondary}
|
|
627
|
+
style={{ textDecorationLine: 'underline' }}
|
|
628
|
+
>
|
|
629
|
+
{t('CHANGE_STORE', 'Change store')}
|
|
630
|
+
</OText>
|
|
631
|
+
</TouchableOpacity>
|
|
632
|
+
)}
|
|
630
633
|
<OrderSummary
|
|
631
634
|
cart={cart}
|
|
632
635
|
isCartPending={cart?.status === 2}
|