ordering-ui-react-native 0.16.88-release → 0.16.89-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 +8 -5
- 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/MessageListing/index.tsx +9 -2
- package/themes/original/src/components/Messages/index.tsx +5 -0
- package/themes/original/src/components/MultiCheckout/index.tsx +12 -1
- package/themes/original/src/components/UpsellingProducts/index.tsx +2 -8
- package/themes/original/src/components/shared/OModal.tsx +3 -3
package/package.json
CHANGED
|
@@ -184,10 +184,13 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
184
184
|
handleChangeSearch('')
|
|
185
185
|
}
|
|
186
186
|
|
|
187
|
-
const handleUpsellingPage = () => {
|
|
187
|
+
const handleUpsellingPage = (cart: any) => {
|
|
188
|
+
const isProductCartParam = !!cart?.products?.length
|
|
188
189
|
setOpenUpselling(false)
|
|
189
190
|
setCanOpenUpselling(false)
|
|
190
|
-
const cartsAvailable: any = Object.values(orderState?.carts)
|
|
191
|
+
const cartsAvailable: any = Object.values(orderState?.carts)
|
|
192
|
+
?.filter((_cart: any) => _cart?.valid && _cart?.status !== 2 && _cart?.products?.length)
|
|
193
|
+
?.filter((_c: any) => !isProductCartParam ? _c.uuid !== cart.uuid : _c)
|
|
191
194
|
if (cartsAvailable.length === 1 || !isCheckoutMultiBusinessEnabled) {
|
|
192
195
|
const cart = isCheckoutMultiBusinessEnabled ? cartsAvailable[0] : currentCart
|
|
193
196
|
|
|
@@ -197,7 +200,7 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
197
200
|
businessLogo: cart?.business?.logo,
|
|
198
201
|
businessName: cart?.business?.name,
|
|
199
202
|
cartTotal: cart?.total
|
|
200
|
-
})
|
|
203
|
+
}, true)
|
|
201
204
|
} else {
|
|
202
205
|
const groupKeys: any = {}
|
|
203
206
|
cartsAvailable.forEach((_cart: any) => {
|
|
@@ -213,12 +216,12 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
213
216
|
props.onNavigationRedirect('CheckoutNavigator', {
|
|
214
217
|
screen: 'MultiCheckout',
|
|
215
218
|
checkCarts: true
|
|
216
|
-
})
|
|
219
|
+
}, true)
|
|
217
220
|
} else {
|
|
218
221
|
props.onNavigationRedirect('CheckoutNavigator', {
|
|
219
222
|
screen: 'MultiCheckout',
|
|
220
223
|
cartUuid: cartsAvailable[0]?.group?.uuid
|
|
221
|
-
})
|
|
224
|
+
}, true)
|
|
222
225
|
}
|
|
223
226
|
}
|
|
224
227
|
}
|
|
@@ -108,9 +108,13 @@ const CartUI = (props: any) => {
|
|
|
108
108
|
}
|
|
109
109
|
|
|
110
110
|
const handleUpsellingPage = (individualCart : any) => {
|
|
111
|
+
const isProductCartParam = !!individualCart?.products?.length
|
|
111
112
|
setOpenUpselling(false)
|
|
112
113
|
setCanOpenUpselling(false)
|
|
113
|
-
|
|
114
|
+
|
|
115
|
+
const cartsAvailable: any = Object.values(orderState?.carts)
|
|
116
|
+
?.filter((_cart: any) => _cart?.valid && _cart?.status !== 2 && _cart?.products?.length)
|
|
117
|
+
?.filter((_c: any) => !isProductCartParam ? _c.uuid !== cart.uuid : _c)
|
|
114
118
|
if (cartsAvailable.length === 1 || !isMultiCheckout) {
|
|
115
119
|
const cart = isMultiCheckout ? cartsAvailable[0] : individualCart
|
|
116
120
|
onNavigationRedirect('CheckoutNavigator', {
|
|
@@ -119,7 +123,7 @@ const CartUI = (props: any) => {
|
|
|
119
123
|
businessLogo: cart?.business?.logo,
|
|
120
124
|
businessName: cart?.business?.name,
|
|
121
125
|
cartTotal: cart?.total
|
|
122
|
-
})
|
|
126
|
+
}, true)
|
|
123
127
|
} else {
|
|
124
128
|
const groupKeys: any = {}
|
|
125
129
|
cartsAvailable.forEach((_cart: any) => {
|
|
@@ -135,12 +139,12 @@ const CartUI = (props: any) => {
|
|
|
135
139
|
onNavigationRedirect('CheckoutNavigator', {
|
|
136
140
|
screen: 'MultiCheckout',
|
|
137
141
|
checkCarts: true
|
|
138
|
-
})
|
|
142
|
+
}, true)
|
|
139
143
|
} else {
|
|
140
144
|
onNavigationRedirect('CheckoutNavigator', {
|
|
141
145
|
screen: 'MultiCheckout',
|
|
142
146
|
cartUuid: cartsAvailable[0]?.group?.uuid
|
|
143
|
-
})
|
|
147
|
+
}, true)
|
|
144
148
|
}
|
|
145
149
|
}
|
|
146
150
|
}
|
|
@@ -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 }}
|
|
@@ -123,7 +123,9 @@ const OrderMessageUI = (props: any) => {
|
|
|
123
123
|
setMessages,
|
|
124
124
|
readMessages,
|
|
125
125
|
messagesReadList,
|
|
126
|
-
setOpenMessges
|
|
126
|
+
setOpenMessges,
|
|
127
|
+
setSeletedOrder,
|
|
128
|
+
setSelectedOrderId
|
|
127
129
|
} = props;
|
|
128
130
|
const [openModalForBusiness, setOpenModalForBusiness] = useState(false);
|
|
129
131
|
const [openModalForDriver, setOpenModalForDriver] = useState(false);
|
|
@@ -140,6 +142,8 @@ const OrderMessageUI = (props: any) => {
|
|
|
140
142
|
|
|
141
143
|
const handleClose = () => {
|
|
142
144
|
setOpenMessges(false)
|
|
145
|
+
setSeletedOrder(null)
|
|
146
|
+
setSelectedOrderId(null)
|
|
143
147
|
}
|
|
144
148
|
|
|
145
149
|
const handleOpenMessages = (data: any) => {
|
|
@@ -269,7 +273,7 @@ export const MessageListing = (props: MessageListingParams) => {
|
|
|
269
273
|
setOpenMessges={setOpenMessges}
|
|
270
274
|
franchiseId={props.franchiseId}
|
|
271
275
|
/>
|
|
272
|
-
{openMessages && seletedOrder && (
|
|
276
|
+
{openMessages && !!seletedOrder?.id && (
|
|
273
277
|
<OModal
|
|
274
278
|
open={openMessages}
|
|
275
279
|
entireModal
|
|
@@ -278,7 +282,10 @@ export const MessageListing = (props: MessageListingParams) => {
|
|
|
278
282
|
>
|
|
279
283
|
<MessagesView
|
|
280
284
|
order={seletedOrder}
|
|
285
|
+
orderId={seletedOrder?.id}
|
|
281
286
|
setOpenMessges={setOpenMessges}
|
|
287
|
+
setSeletedOrder={setSeletedOrder}
|
|
288
|
+
setSelectedOrderId={setSelectedOrderId}
|
|
282
289
|
/>
|
|
283
290
|
</OModal>
|
|
284
291
|
)}
|
|
@@ -412,6 +412,11 @@ const MessagesUI = (props: MessagesParams) => {
|
|
|
412
412
|
);
|
|
413
413
|
}
|
|
414
414
|
|
|
415
|
+
useEffect(() => {
|
|
416
|
+
if (!order?.id || messages?.loading) return
|
|
417
|
+
readMessages && readMessages()
|
|
418
|
+
}, [order?.id, messages?.loading])
|
|
419
|
+
|
|
415
420
|
return (
|
|
416
421
|
<View style={{ height: getViewHeight(), width: '100%', paddingTop: 12, backgroundColor: 'white' }}>
|
|
417
422
|
<Wrapper>
|
|
@@ -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>
|
|
@@ -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}
|
|
@@ -52,7 +52,7 @@ const OModal = (props: Props): React.ReactElement => {
|
|
|
52
52
|
|
|
53
53
|
const theme = useTheme();
|
|
54
54
|
|
|
55
|
-
const
|
|
55
|
+
const renderSafeAreaView = () => (
|
|
56
56
|
<SafeAreaView style={styles.container}>
|
|
57
57
|
{!entireModal ? (
|
|
58
58
|
<View style={styles.centeredView}>
|
|
@@ -101,10 +101,10 @@ const OModal = (props: Props): React.ReactElement => {
|
|
|
101
101
|
enabled
|
|
102
102
|
behavior={Platform.OS === 'ios' ? 'padding' : 'height'}
|
|
103
103
|
>
|
|
104
|
-
|
|
104
|
+
{renderSafeAreaView()}
|
|
105
105
|
</KeyboardView>
|
|
106
106
|
) : (
|
|
107
|
-
|
|
107
|
+
renderSafeAreaView()
|
|
108
108
|
)}
|
|
109
109
|
</Modal>
|
|
110
110
|
);
|