ordering-ui-react-native 0.17.78 → 0.17.80
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/business/src/components/NewOrderNotification/index.tsx +5 -0
- 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
|
@@ -96,10 +96,15 @@ const NewOrderNotificationUI = (props: any) => {
|
|
|
96
96
|
events.on('message_added_notification', (o: any) => handleEventNotification(1, o))
|
|
97
97
|
events.on('order_added_notification', (o: any) => handleEventNotification(2, o))
|
|
98
98
|
events.on('order_updated_notification', (o: any) => handleEventNotification(3, o))
|
|
99
|
+
events.on('request_register_notification', (o: any) => handleEventNotification(2, o))
|
|
100
|
+
events.on('request_update_notification', (o: any) => handleEventNotification(3, o))
|
|
101
|
+
|
|
99
102
|
return () => {
|
|
100
103
|
events.off('message_added_notification', (o: any) => handleEventNotification(1, o))
|
|
101
104
|
events.off('order_added_notification', (o: any) => handleEventNotification(2, o))
|
|
102
105
|
events.off('order_updated_notification', (o: any) => handleEventNotification(3, o))
|
|
106
|
+
events.off('request_register_notification', (o: any) => handleEventNotification(2, o))
|
|
107
|
+
events.off('request_update_notification', (o: any) => handleEventNotification(3, o))
|
|
103
108
|
}
|
|
104
109
|
}, [])
|
|
105
110
|
|
|
@@ -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'
|
|
@@ -531,7 +560,6 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
531
560
|
btnLeftValue={currentCart?.products.reduce((prev: number, product: any) => prev + product.quantity, 0)}
|
|
532
561
|
btnRightValue={parsePrice(currentCart?.total)}
|
|
533
562
|
disabled={subtotalWithTaxes < currentCart?.minimum || openUpselling}
|
|
534
|
-
hideButton={isCheckoutMultiBusinessEnabled}
|
|
535
563
|
handleClick={() => setOpenUpselling(true)}
|
|
536
564
|
/>
|
|
537
565
|
</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;
|
|
@@ -533,7 +534,6 @@ export interface FloatingButtonParams {
|
|
|
533
534
|
handleClick?: any;
|
|
534
535
|
handleEmpty?: any;
|
|
535
536
|
iosBottom?: number
|
|
536
|
-
hideButton?: boolean
|
|
537
537
|
}
|
|
538
538
|
export interface MomentOptionParams {
|
|
539
539
|
navigation: any;
|