ordering-ui-react-native 0.18.23 → 0.18.25
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 +9 -7
- package/themes/original/src/components/Cart/index.tsx +8 -4
- package/themes/original/src/components/Checkout/index.tsx +1 -1
- package/themes/original/src/components/MultiCheckout/index.tsx +12 -1
- package/themes/original/src/components/Promotions/index.tsx +1 -1
- package/themes/original/src/components/Promotions/styles.tsx +2 -1
- package/themes/original/src/components/UpsellingProducts/index.tsx +2 -8
package/package.json
CHANGED
|
@@ -185,10 +185,13 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
185
185
|
handleChangeSearch('')
|
|
186
186
|
}
|
|
187
187
|
|
|
188
|
-
const handleUpsellingPage = () => {
|
|
188
|
+
const handleUpsellingPage = (cart: any) => {
|
|
189
|
+
const isProductCartParam = !!cart?.products?.length
|
|
189
190
|
setOpenUpselling(false)
|
|
190
191
|
setCanOpenUpselling(false)
|
|
191
|
-
const cartsAvailable: any = Object.values(orderState?.carts)
|
|
192
|
+
const cartsAvailable: any = Object.values(orderState?.carts)
|
|
193
|
+
?.filter((_cart: any) => _cart?.valid && _cart?.status !== 2 && _cart?.products?.length)
|
|
194
|
+
?.filter((_c: any) => !isProductCartParam ? _c.uuid !== cart.uuid : _c)
|
|
192
195
|
if (cartsAvailable.length === 1 || !isCheckoutMultiBusinessEnabled) {
|
|
193
196
|
const cart = isCheckoutMultiBusinessEnabled ? cartsAvailable[0] : currentCart
|
|
194
197
|
|
|
@@ -198,7 +201,7 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
198
201
|
businessLogo: cart?.business?.logo,
|
|
199
202
|
businessName: cart?.business?.name,
|
|
200
203
|
cartTotal: cart?.total
|
|
201
|
-
})
|
|
204
|
+
}, true)
|
|
202
205
|
} else {
|
|
203
206
|
const groupKeys: any = {}
|
|
204
207
|
cartsAvailable.forEach((_cart: any) => {
|
|
@@ -214,12 +217,12 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
214
217
|
props.onNavigationRedirect('CheckoutNavigator', {
|
|
215
218
|
screen: 'MultiCheckout',
|
|
216
219
|
checkCarts: true
|
|
217
|
-
})
|
|
220
|
+
}, true)
|
|
218
221
|
} else {
|
|
219
222
|
props.onNavigationRedirect('CheckoutNavigator', {
|
|
220
223
|
screen: 'MultiCheckout',
|
|
221
224
|
cartUuid: cartsAvailable[0]?.group?.uuid
|
|
222
|
-
})
|
|
225
|
+
}, true)
|
|
223
226
|
}
|
|
224
227
|
}
|
|
225
228
|
}
|
|
@@ -422,7 +425,7 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
422
425
|
<BackgroundGray isIos={Platform.OS === 'ios'} />
|
|
423
426
|
)}
|
|
424
427
|
<IOScrollView
|
|
425
|
-
stickyHeaderIndices={[business?.professionals?.length > 0 ?
|
|
428
|
+
stickyHeaderIndices={[business?.professionals?.length > 0 ? 4 : 3]}
|
|
426
429
|
style={{
|
|
427
430
|
...styles.mainContainer,
|
|
428
431
|
marginBottom: currentCart?.products?.length > 0 && categoryState.products.length !== 0 ?
|
|
@@ -601,7 +604,6 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
601
604
|
professionalList={business?.professionals}
|
|
602
605
|
professionalSelected={professionalSelected}
|
|
603
606
|
handleChangeProfessional={handleChangeProfessionalSelected}
|
|
604
|
-
handleChangeProfessional={handleChangeProfessionalSelected}
|
|
605
607
|
handleUpdateProfessionals={handleUpdateProfessionals}
|
|
606
608
|
onSave={() => setOpenService(false)}
|
|
607
609
|
onClose={() => setOpenService(false)}
|
|
@@ -110,9 +110,13 @@ const CartUI = (props: any) => {
|
|
|
110
110
|
}
|
|
111
111
|
|
|
112
112
|
const handleUpsellingPage = (individualCart : any) => {
|
|
113
|
+
const isProductCartParam = !!individualCart?.products?.length
|
|
113
114
|
setOpenUpselling(false)
|
|
114
115
|
setCanOpenUpselling(false)
|
|
115
|
-
|
|
116
|
+
|
|
117
|
+
const cartsAvailable: any = Object.values(orderState?.carts)
|
|
118
|
+
?.filter((_cart: any) => _cart?.valid && _cart?.status !== 2 && _cart?.products?.length)
|
|
119
|
+
?.filter((_c: any) => !isProductCartParam ? _c.uuid !== cart.uuid : _c)
|
|
116
120
|
if (cartsAvailable.length === 1 || !isMultiCheckout) {
|
|
117
121
|
const cart = isMultiCheckout ? cartsAvailable[0] : individualCart
|
|
118
122
|
onNavigationRedirect('CheckoutNavigator', {
|
|
@@ -121,7 +125,7 @@ const CartUI = (props: any) => {
|
|
|
121
125
|
businessLogo: cart?.business?.logo,
|
|
122
126
|
businessName: cart?.business?.name,
|
|
123
127
|
cartTotal: cart?.total
|
|
124
|
-
})
|
|
128
|
+
}, true)
|
|
125
129
|
} else {
|
|
126
130
|
const groupKeys: any = {}
|
|
127
131
|
cartsAvailable.forEach((_cart: any) => {
|
|
@@ -137,12 +141,12 @@ const CartUI = (props: any) => {
|
|
|
137
141
|
onNavigationRedirect('CheckoutNavigator', {
|
|
138
142
|
screen: 'MultiCheckout',
|
|
139
143
|
checkCarts: true
|
|
140
|
-
})
|
|
144
|
+
}, true)
|
|
141
145
|
} else {
|
|
142
146
|
onNavigationRedirect('CheckoutNavigator', {
|
|
143
147
|
screen: 'MultiCheckout',
|
|
144
148
|
cartUuid: cartsAvailable[0]?.group?.uuid
|
|
145
|
-
})
|
|
149
|
+
}, true)
|
|
146
150
|
}
|
|
147
151
|
}
|
|
148
152
|
}
|
|
@@ -333,7 +333,7 @@ const CheckoutUI = (props: any) => {
|
|
|
333
333
|
<NavBar
|
|
334
334
|
title={t('CHECKOUT', 'Checkout')}
|
|
335
335
|
titleAlign={'center'}
|
|
336
|
-
onActionLeft={() =>
|
|
336
|
+
onActionLeft={() => onNavigationRedirect('BottomTab', { screen: 'Cart' }, !props.fromMulti)}
|
|
337
337
|
showCall={false}
|
|
338
338
|
btnStyle={{ paddingLeft: 0, paddingTop: Platform.OS == 'ios' ? 0 : 2 }}
|
|
339
339
|
titleWrapStyle={{ paddingHorizontal: 0 }}
|
|
@@ -62,7 +62,8 @@ const MultiCheckoutUI = (props: any) => {
|
|
|
62
62
|
cartUuid,
|
|
63
63
|
rewardRate,
|
|
64
64
|
totalCartsFee,
|
|
65
|
-
cartGroup
|
|
65
|
+
cartGroup,
|
|
66
|
+
onNavigationRedirectReplace
|
|
66
67
|
} = props
|
|
67
68
|
|
|
68
69
|
const theme = useTheme();
|
|
@@ -154,6 +155,16 @@ const MultiCheckoutUI = (props: any) => {
|
|
|
154
155
|
}
|
|
155
156
|
}, [validationFields, user])
|
|
156
157
|
|
|
158
|
+
useEffect(() => {
|
|
159
|
+
if (openCarts.length === 1) {
|
|
160
|
+
onNavigationRedirectReplace('CheckoutPage', {
|
|
161
|
+
cartUuid: openCarts[0]?.uuid,
|
|
162
|
+
fromMulti: true
|
|
163
|
+
})
|
|
164
|
+
return
|
|
165
|
+
}
|
|
166
|
+
}, [openCarts])
|
|
167
|
+
|
|
157
168
|
return (
|
|
158
169
|
<>
|
|
159
170
|
<Container noPadding>
|
|
@@ -143,7 +143,7 @@ const PromotionsUI = (props: PromotionParams) => {
|
|
|
143
143
|
<WrapperSingleOffer key={offer.id}>
|
|
144
144
|
<SingleOfferContainer>
|
|
145
145
|
<FastImage
|
|
146
|
-
style={{ height: 80, width: 80, aspectRatio:
|
|
146
|
+
style={{ height: 80, width: 80, aspectRatio: 1, borderRadius: 8 }}
|
|
147
147
|
source={typeof offer?.image !== 'number' ? {
|
|
148
148
|
uri: optimizeImage(offer?.image, 'h_1024,c_limit'),
|
|
149
149
|
priority: FastImage.priority.normal,
|
|
@@ -30,7 +30,6 @@ const UpsellingProductsUI = (props: UpsellingProductsParams) => {
|
|
|
30
30
|
upsellingProducts,
|
|
31
31
|
business,
|
|
32
32
|
handleUpsellingPage,
|
|
33
|
-
handleCloseUpsellingPage,
|
|
34
33
|
openUpselling,
|
|
35
34
|
canOpenUpselling,
|
|
36
35
|
setCanOpenUpselling,
|
|
@@ -85,13 +84,11 @@ const UpsellingProductsUI = (props: UpsellingProductsParams) => {
|
|
|
85
84
|
},
|
|
86
85
|
})
|
|
87
86
|
|
|
88
|
-
const [modalIsOpen, setModalIsOpen] = useState(false)
|
|
89
87
|
const [{ carts }] = useOrder()
|
|
90
88
|
const [{ parsePrice }] = useUtils()
|
|
91
89
|
const [{ configs }] = useConfig()
|
|
92
90
|
const [, t] = useLanguage()
|
|
93
91
|
const { bottom } = useSafeAreaInsets()
|
|
94
|
-
const [isCheckout, setIsCheckout] = useState(false)
|
|
95
92
|
const [isCartsLoading, setIsCartsLoading] = useState(false)
|
|
96
93
|
|
|
97
94
|
const isMultiCheckout = configs?.checkout_multi_business_enabled?.value === '1'
|
|
@@ -224,10 +221,7 @@ const UpsellingProductsUI = (props: UpsellingProductsParams) => {
|
|
|
224
221
|
text={t('CHECKOUT', 'Checkout')}
|
|
225
222
|
style={{ ...styles.closeUpsellingButton }}
|
|
226
223
|
textStyle={{ color: theme.colors.white, fontSize: 14 }}
|
|
227
|
-
onClick={() =>
|
|
228
|
-
handleUpsellingPage(cart)
|
|
229
|
-
setIsCheckout(true)
|
|
230
|
-
}}
|
|
224
|
+
onClick={() => handleUpsellingPage(cart)}
|
|
231
225
|
/>
|
|
232
226
|
</View>
|
|
233
227
|
</>
|
|
@@ -243,7 +237,7 @@ const UpsellingProductsUI = (props: UpsellingProductsParams) => {
|
|
|
243
237
|
{props.isPage ? (
|
|
244
238
|
<UpsellingContent />
|
|
245
239
|
) : (
|
|
246
|
-
canOpenUpselling &&
|
|
240
|
+
canOpenUpselling && (
|
|
247
241
|
<OBottomPopup
|
|
248
242
|
title={''}
|
|
249
243
|
open={openUpselling}
|