ordering-ui-react-native 0.16.54-release → 0.16.55-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 +1 -1
- package/themes/original/src/components/BusinessProductsListing/index.tsx +29 -1
- package/themes/original/src/components/FloatingButton/index.tsx +10 -13
- package/themes/original/src/components/MyOrders/index.tsx +2 -2
- package/themes/original/src/components/OrdersOption/index.tsx +2 -2
- package/themes/original/src/types/index.tsx +1 -1
package/package.json
CHANGED
|
@@ -184,6 +184,35 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
184
184
|
}
|
|
185
185
|
|
|
186
186
|
const handleUpsellingPage = () => {
|
|
187
|
+
setOpenUpselling(false)
|
|
188
|
+
setCanOpenUpselling(false)
|
|
189
|
+
const cartSelectedHasGroup = currentCart?.group?.uuid
|
|
190
|
+
const cartFilterValidation = (cart: any) => cart?.valid && cart?.status !== 2
|
|
191
|
+
const cartsGroupLength = cartSelectedHasGroup ? Object.values(orderState.carts).filter((_cart: any) => _cart?.group?.uuid === cartSelectedHasGroup && cartFilterValidation(_cart))?.length : 0
|
|
192
|
+
if (cartsGroupLength > 1 && isCheckoutMultiBusinessEnabled) {
|
|
193
|
+
props.onNavigationRedirect('CheckoutNavigator', {
|
|
194
|
+
screen: 'MultiCheckout',
|
|
195
|
+
cartUuid: currentCart?.group?.uuid
|
|
196
|
+
})
|
|
197
|
+
return
|
|
198
|
+
}
|
|
199
|
+
const cartGroupsCount: any = {}
|
|
200
|
+
Object.values(orderState.carts).filter(_cart => cartFilterValidation(_cart))?.forEach((_cart: any) => {
|
|
201
|
+
if (cartGroupsCount[_cart?.group?.uuid]) {
|
|
202
|
+
cartGroupsCount[_cart?.group?.uuid] += 1
|
|
203
|
+
} else {
|
|
204
|
+
cartGroupsCount[_cart?.group?.uuid] = 1
|
|
205
|
+
}
|
|
206
|
+
})
|
|
207
|
+
let groupForTheCart
|
|
208
|
+
const groupForAddCartArray = Object.keys(cartGroupsCount).filter(cartGroupUuid => cartGroupsCount[cartGroupUuid] > 0 && cartGroupsCount[cartGroupUuid] < 5)
|
|
209
|
+
const max = Math.max(...groupForAddCartArray.map(uuid => cartGroupsCount[uuid]))
|
|
210
|
+
const indexes = groupForAddCartArray.filter(uuid => cartGroupsCount[uuid] === max)
|
|
211
|
+
if (indexes?.length > 1) {
|
|
212
|
+
groupForTheCart = indexes.find(uuid => uuid !== 'undefined')
|
|
213
|
+
} else {
|
|
214
|
+
groupForTheCart = indexes[0]
|
|
215
|
+
}
|
|
187
216
|
if (isCheckoutMultiBusinessEnabled && openCarts.length > 1) {
|
|
188
217
|
onRedirect('CheckoutNavigator', {
|
|
189
218
|
screen: 'MultiCheckout'
|
|
@@ -530,7 +559,6 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
530
559
|
btnLeftValue={currentCart?.products.reduce((prev: number, product: any) => prev + product.quantity, 0)}
|
|
531
560
|
btnRightValue={parsePrice(currentCart?.total)}
|
|
532
561
|
disabled={subtotalWithTaxes < currentCart?.minimum || openUpselling}
|
|
533
|
-
hideButton={isCheckoutMultiBusinessEnabled}
|
|
534
562
|
handleClick={() => setOpenUpselling(true)}
|
|
535
563
|
/>
|
|
536
564
|
</View>
|
|
@@ -22,8 +22,7 @@ const FloatingButtonUI = (props: FloatingButtonParams) => {
|
|
|
22
22
|
disabled,
|
|
23
23
|
isSecondaryBtn,
|
|
24
24
|
handleEmpty,
|
|
25
|
-
iosBottom
|
|
26
|
-
hideButton
|
|
25
|
+
iosBottom
|
|
27
26
|
} = props;
|
|
28
27
|
|
|
29
28
|
const [, t] = useLanguage();
|
|
@@ -78,17 +77,15 @@ const FloatingButtonUI = (props: FloatingButtonParams) => {
|
|
|
78
77
|
</View>
|
|
79
78
|
)}
|
|
80
79
|
</View>
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
>
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
</Button>
|
|
91
|
-
)}
|
|
80
|
+
<Button
|
|
81
|
+
style={[isSecondaryBtn ? styles.secondaryBtn : styles.primaryBtn]}
|
|
82
|
+
onPress={handleButtonClick}
|
|
83
|
+
disabled={disabled}
|
|
84
|
+
>
|
|
85
|
+
<OText color={isSecondaryBtn ? theme.colors.textSecondary : theme.colors.white} lineHeight={24} size={14} weight={'400'}>
|
|
86
|
+
{btnText}
|
|
87
|
+
</OText>
|
|
88
|
+
</Button>
|
|
92
89
|
</Container>
|
|
93
90
|
);
|
|
94
91
|
};
|
|
@@ -23,7 +23,7 @@ export const MyOrders = (props: any) => {
|
|
|
23
23
|
const [isEmptyBusinesses, setIsEmptyBusinesses] = useState(false)
|
|
24
24
|
const [businessOrderIds, setBusinessOrderIds] = useState([])
|
|
25
25
|
const [ordersLength, setOrdersLength] = useState({
|
|
26
|
-
activeOrdersLength:
|
|
26
|
+
activeOrdersLength: null,
|
|
27
27
|
previousOrdersLength: 0,
|
|
28
28
|
});
|
|
29
29
|
const [selectedOption, setSelectedOption] = useState(!hideOrders ? 'orders' : 'business')
|
|
@@ -143,7 +143,7 @@ export const MyOrders = (props: any) => {
|
|
|
143
143
|
)}
|
|
144
144
|
{selectedOption === 'orders' && (
|
|
145
145
|
<>
|
|
146
|
-
{ordersLength?.activeOrdersLength
|
|
146
|
+
{ordersLength?.activeOrdersLength !== 0 && (
|
|
147
147
|
<View style={{ paddingHorizontal: isChewLayout ? 20 : 40 }}>
|
|
148
148
|
<OrdersOption
|
|
149
149
|
{...props}
|
|
@@ -192,14 +192,14 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
|
|
|
192
192
|
useEffect(() => {
|
|
193
193
|
if (loading) return
|
|
194
194
|
|
|
195
|
-
const updateOrders =
|
|
195
|
+
const updateOrders = _orders.filter((order: any) => orderStatus.includes(order.status))
|
|
196
196
|
|
|
197
197
|
if (activeOrders) {
|
|
198
198
|
setOrdersLength && setOrdersLength({ ...ordersLength, activeOrdersLength: updateOrders?.length })
|
|
199
199
|
} else if (!preOrders) {
|
|
200
200
|
setOrdersLength && setOrdersLength({ ...ordersLength, previousOrdersLength: updateOrders?.length })
|
|
201
201
|
}
|
|
202
|
-
}, [
|
|
202
|
+
}, [_orders, activeOrders, preOrders])
|
|
203
203
|
|
|
204
204
|
useEffect(() => {
|
|
205
205
|
if (refreshOrders) {
|
|
@@ -251,6 +251,7 @@ export interface BusinessProductsListingParams {
|
|
|
251
251
|
handleChangeProfessionalSelected?: any;
|
|
252
252
|
handleUpdateProfessionals?: any;
|
|
253
253
|
onBusinessClick?: any;
|
|
254
|
+
onNavigationRedirect?: any;
|
|
254
255
|
}
|
|
255
256
|
export interface BusinessBasicInformationParams {
|
|
256
257
|
navigation?: any;
|
|
@@ -532,7 +533,6 @@ export interface FloatingButtonParams {
|
|
|
532
533
|
handleClick?: any;
|
|
533
534
|
handleEmpty?: any;
|
|
534
535
|
iosBottom?: number
|
|
535
|
-
hideButton?: boolean
|
|
536
536
|
}
|
|
537
537
|
export interface MomentOptionParams {
|
|
538
538
|
navigation: any;
|