ordering-ui-react-native 0.17.91 → 0.17.93
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/BusinessBasicInformation/index.tsx +1 -1
- package/themes/original/src/components/BusinessListingSearch/index.tsx +1 -1
- package/themes/original/src/components/BusinessProductsListing/index.tsx +530 -527
- package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +1 -1
- package/themes/original/src/components/Cart/index.tsx +5 -2
- package/themes/original/src/components/CartContent/index.tsx +4 -1
- package/themes/original/src/components/Checkout/index.tsx +1 -1
- package/themes/original/src/components/DriverTips/index.tsx +2 -2
- package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +2 -2
- package/themes/original/src/components/MultiCheckout/index.tsx +62 -1
- package/themes/original/src/components/MultiOrdersDetails/index.tsx +22 -18
- package/themes/original/src/components/MyOrders/index.tsx +3 -3
- package/themes/original/src/components/ProductForm/index.tsx +1 -1
- package/themes/original/src/components/ProductOptionSubOption/index.tsx +1 -1
- package/themes/original/src/components/SingleProductCard/index.tsx +1 -1
- package/themes/original/src/components/UserProfile/index.tsx +1 -1
- package/themes/original/src/components/Wallets/index.tsx +1 -1
|
@@ -82,7 +82,7 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
|
|
|
82
82
|
const [{ parseDate }] = useUtils();
|
|
83
83
|
|
|
84
84
|
const appState = useRef(AppState.currentState)
|
|
85
|
-
const isChewLayout = theme?.header?.components?.layout?.type === 'chew'
|
|
85
|
+
const isChewLayout = theme?.header?.components?.layout?.type?.toLowerCase() === 'chew'
|
|
86
86
|
const [refreshing] = useState(false);
|
|
87
87
|
const hideCities = (theme?.business_listing_view?.components?.cities?.hidden || orderState?.options?.type !== 2) ?? true
|
|
88
88
|
const hideHero = theme?.business_listing_view?.components?.business_hero?.hidden
|
|
@@ -125,7 +125,10 @@ const CartUI = (props: any) => {
|
|
|
125
125
|
(Object.keys(groupKeys).length === 1 && Object.keys(groupKeys)[0] === 'null') ||
|
|
126
126
|
Object.keys(groupKeys).length > 1
|
|
127
127
|
) {
|
|
128
|
-
onNavigationRedirect('CheckoutNavigator', {
|
|
128
|
+
onNavigationRedirect('CheckoutNavigator', {
|
|
129
|
+
screen: 'MultiCheckout',
|
|
130
|
+
checkCarts: true
|
|
131
|
+
})
|
|
129
132
|
} else {
|
|
130
133
|
onNavigationRedirect('CheckoutNavigator', {
|
|
131
134
|
screen: 'MultiCheckout',
|
|
@@ -393,7 +396,7 @@ const CartUI = (props: any) => {
|
|
|
393
396
|
</OSTable>
|
|
394
397
|
)}
|
|
395
398
|
|
|
396
|
-
{isMultiCheckout &&
|
|
399
|
+
{!isMultiCheckout &&
|
|
397
400
|
cart &&
|
|
398
401
|
cart?.valid &&
|
|
399
402
|
orderState?.options?.type === 1 &&
|
|
@@ -45,7 +45,10 @@ export const CartContent = (props: any) => {
|
|
|
45
45
|
(Object.keys(groupKeys).length === 1 && Object.keys(groupKeys)[0] === 'null') ||
|
|
46
46
|
Object.keys(groupKeys).length > 1
|
|
47
47
|
) {
|
|
48
|
-
onNavigationRedirect('CheckoutNavigator', {
|
|
48
|
+
onNavigationRedirect('CheckoutNavigator', {
|
|
49
|
+
screen: 'MultiCheckout',
|
|
50
|
+
checkCarts: true
|
|
51
|
+
})
|
|
49
52
|
} else {
|
|
50
53
|
onNavigationRedirect('CheckoutNavigator', {
|
|
51
54
|
screen: 'MultiCheckout',
|
|
@@ -154,7 +154,7 @@ const CheckoutUI = (props: any) => {
|
|
|
154
154
|
const isWalletCreditPointsEnabled = businessConfigs.find((config: any) => config.key === 'wallet_credit_point_enabled')?.value === '1'
|
|
155
155
|
const isWalletEnabled = configs?.cash_wallet?.value && configs?.wallet_enabled?.value === '1' && (isWalletCashEnabled || isWalletCreditPointsEnabled)
|
|
156
156
|
const isBusinessChangeEnabled = configs?.cart_change_business_validation?.value === '1'
|
|
157
|
-
const isChewLayout = theme?.header?.components?.layout?.type === 'chew'
|
|
157
|
+
const isChewLayout = theme?.header?.components?.layout?.type?.toLowerCase() === 'chew'
|
|
158
158
|
const hideBusinessAddress = theme?.checkout?.components?.business?.components?.address?.hidden
|
|
159
159
|
const hideBusinessDetails = theme?.checkout?.components?.business?.hidden
|
|
160
160
|
const hideBusinessMap = theme?.checkout?.components?.business?.components?.map?.hidden
|
|
@@ -22,7 +22,7 @@ const DriverTipsUI = (props: any) => {
|
|
|
22
22
|
const {
|
|
23
23
|
driverTip,
|
|
24
24
|
driverTipsOptions,
|
|
25
|
-
|
|
25
|
+
isMulti,
|
|
26
26
|
cart,
|
|
27
27
|
isDriverTipUseCustom,
|
|
28
28
|
handlerChangeOption,
|
|
@@ -33,7 +33,7 @@ const DriverTipsUI = (props: any) => {
|
|
|
33
33
|
const theme = useTheme();
|
|
34
34
|
const [, t] = useLanguage();
|
|
35
35
|
const [{ configs }] = useConfig();
|
|
36
|
-
const [customTip, setCustomTip] = useState((isDriverTipUseCustom && !driverTipsOptions.includes(driverTip)) ?? false)
|
|
36
|
+
const [customTip, setCustomTip] = useState((!isMulti && isDriverTipUseCustom && !driverTipsOptions.includes(driverTip)) ?? false)
|
|
37
37
|
const currentTip = customTip ? parseFloat(driverTip || 0) > 0 : (!customTip && !driverTipsOptions.includes(driverTip) && parseFloat(driverTip || 0)) > 0
|
|
38
38
|
const [value, setvalue] = useState('');
|
|
39
39
|
|
|
@@ -61,7 +61,7 @@ const MultiCartsPaymethodsAndWalletsUI = (props: any) => {
|
|
|
61
61
|
case 'paypal':
|
|
62
62
|
return theme.images.general.paypal
|
|
63
63
|
case 'stripe':
|
|
64
|
-
return theme.images.general.
|
|
64
|
+
return theme.images.general.creditCard
|
|
65
65
|
case 'stripe_direct':
|
|
66
66
|
return theme.images.general.stripecc
|
|
67
67
|
case 'stripe_connect':
|
|
@@ -83,7 +83,7 @@ const MultiCartsPaymethodsAndWalletsUI = (props: any) => {
|
|
|
83
83
|
isActive={paymethodSelected?.id === item.id}
|
|
84
84
|
>
|
|
85
85
|
<OIcon
|
|
86
|
-
src={getPayIcon(item.paymethod?.gateway)}
|
|
86
|
+
src={getPayIcon(item?.gateway ?? item.paymethod?.gateway)}
|
|
87
87
|
width={20}
|
|
88
88
|
height={20}
|
|
89
89
|
color={paymethodSelected?.id === item.id ? theme.colors.white : theme.colors.backgroundDark}
|
|
@@ -18,9 +18,12 @@ import { OText, OIcon, OModal } from '../shared';
|
|
|
18
18
|
import { getTypesText } from '../../utils';
|
|
19
19
|
import { UserDetails } from '../UserDetails'
|
|
20
20
|
import { AddressDetails } from '../AddressDetails'
|
|
21
|
+
import { MultiCart as MultiCartController } from '../MultiCart'
|
|
21
22
|
import { MultiCartsPaymethodsAndWallets } from '../MultiCartsPaymethodsAndWallets'
|
|
22
23
|
import { Cart } from '../Cart'
|
|
23
24
|
import { FloatingButton } from '../FloatingButton'
|
|
25
|
+
import { DriverTips } from '../DriverTips'
|
|
26
|
+
import { DriverTipsContainer } from '../Cart/styles'
|
|
24
27
|
|
|
25
28
|
import {
|
|
26
29
|
ChContainer,
|
|
@@ -78,8 +81,12 @@ const MultiCheckoutUI = (props: any) => {
|
|
|
78
81
|
|
|
79
82
|
const configTypes = configs?.order_types_allowed?.value.split('|').map((value: any) => Number(value)) || []
|
|
80
83
|
const isPreOrder = configs?.preorder_status_enabled?.value === '1'
|
|
84
|
+
const isMultiDriverTips = theme?.header?.components?.layout?.type?.toLowerCase() === 'chew'
|
|
81
85
|
const isDisablePlaceOrderButton = !(paymethodSelected?.paymethod_id || paymethodSelected?.wallet_id) || (paymethodSelected?.paymethod?.gateway === 'stripe' && !paymethodSelected?.paymethod_data)
|
|
82
86
|
const walletCarts = (Object.values(carts)?.filter((cart: any) => cart?.products && cart?.products?.length && cart?.status !== 2 && cart?.valid_schedule && cart?.valid_products && cart?.valid_address && cart?.valid_maximum && cart?.valid_minimum && cart?.wallets) || null) || []
|
|
87
|
+
const driverTipsOptions = typeof configs?.driver_tip_options?.value === 'string'
|
|
88
|
+
? JSON.parse(configs?.driver_tip_options?.value) || []
|
|
89
|
+
: configs?.driver_tip_options?.value || []
|
|
83
90
|
|
|
84
91
|
const [isUserDetailsEdit, setIsUserDetailsEdit] = useState(false);
|
|
85
92
|
const [phoneUpdate, setPhoneUpdate] = useState(false);
|
|
@@ -227,6 +234,35 @@ const MultiCheckoutUI = (props: any) => {
|
|
|
227
234
|
<View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginTop: 13, marginHorizontal: -40 }} />
|
|
228
235
|
</ChSection>
|
|
229
236
|
|
|
237
|
+
{
|
|
238
|
+
isMultiDriverTips &&
|
|
239
|
+
options?.type === 1 &&
|
|
240
|
+
validationFields?.fields?.checkout?.driver_tip?.enabled &&
|
|
241
|
+
openCarts.every((cart: any) => cart.business_id && cart.status !== 2) &&
|
|
242
|
+
driverTipsOptions && driverTipsOptions?.length > 0 &&
|
|
243
|
+
(
|
|
244
|
+
<ChSection>
|
|
245
|
+
<DriverTipsContainer>
|
|
246
|
+
<OText size={14} lineHeight={20} color={theme.colors.textNormal}>
|
|
247
|
+
{t('DRIVER_TIPS', 'Driver Tips')}
|
|
248
|
+
</OText>
|
|
249
|
+
<DriverTips
|
|
250
|
+
isMulti
|
|
251
|
+
carts={openCarts}
|
|
252
|
+
businessIds={openCarts.map((cart: any) => cart.business_id)}
|
|
253
|
+
driverTipsOptions={driverTipsOptions}
|
|
254
|
+
isFixedPrice={parseInt(configs?.driver_tip_type?.value, 10) === 1}
|
|
255
|
+
isDriverTipUseCustom={!!parseInt(configs?.driver_tip_use_custom?.value, 10)}
|
|
256
|
+
driverTip={parseInt(configs?.driver_tip_type?.value, 10) === 1
|
|
257
|
+
? openCarts[0]?.driver_tip
|
|
258
|
+
: openCarts[0]?.driver_tip_rate}
|
|
259
|
+
useOrderContext
|
|
260
|
+
/>
|
|
261
|
+
</DriverTipsContainer>
|
|
262
|
+
<View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginTop: 13, marginHorizontal: -40 }} />
|
|
263
|
+
</ChSection>
|
|
264
|
+
)}
|
|
265
|
+
|
|
230
266
|
<ChSection>
|
|
231
267
|
<ChCarts>
|
|
232
268
|
<CartsHeader>
|
|
@@ -310,9 +346,34 @@ const MultiCheckoutUI = (props: any) => {
|
|
|
310
346
|
}
|
|
311
347
|
|
|
312
348
|
export const MultiCheckout = (props: any) => {
|
|
349
|
+
const [loadMultiCarts, setLoadMultiCarts] = useState(!!props.route?.params?.checkCarts)
|
|
350
|
+
const [cartUuid, setCartUuid] = useState('')
|
|
351
|
+
|
|
313
352
|
const multiCheckoutProps = {
|
|
314
353
|
...props,
|
|
354
|
+
cartUuid: props.route?.params?.cartUuid ?? cartUuid,
|
|
315
355
|
UIComponent: MultiCheckoutUI
|
|
316
356
|
}
|
|
317
|
-
|
|
357
|
+
|
|
358
|
+
const multiCartProps = {
|
|
359
|
+
...props,
|
|
360
|
+
handleOnRedirectMultiCheckout: (cartUuid: string) => {
|
|
361
|
+
setCartUuid(cartUuid)
|
|
362
|
+
setLoadMultiCarts(false)
|
|
363
|
+
},
|
|
364
|
+
handleOnRedirectCheckout: (cartUuid: string) => {
|
|
365
|
+
props.navigation.navigate('CheckoutNavigator', {
|
|
366
|
+
screen: 'CheckoutPage',
|
|
367
|
+
cartUuid: cartUuid
|
|
368
|
+
})
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
return (
|
|
373
|
+
loadMultiCarts ? (
|
|
374
|
+
<MultiCartController {...multiCartProps} />
|
|
375
|
+
) : (
|
|
376
|
+
<MultiCheckoutController {...multiCheckoutProps} />
|
|
377
|
+
)
|
|
378
|
+
)
|
|
318
379
|
}
|
|
@@ -3,7 +3,6 @@ import { useLanguage, useUtils, useToast, ToastType, useConfig, MultiOrdersDetai
|
|
|
3
3
|
import { View, StyleSheet, BackHandler, TouchableOpacity } from 'react-native'
|
|
4
4
|
import { useTheme } from 'styled-components/native'
|
|
5
5
|
import { OText, OButton } from '../shared'
|
|
6
|
-
import { Container } from '../../layouts/Container'
|
|
7
6
|
import { Placeholder, PlaceholderLine, Fade } from 'rn-placeholder'
|
|
8
7
|
import { SingleOrderCard } from './SingleOrderCard'
|
|
9
8
|
import AntDesignIcon from 'react-native-vector-icons/AntDesign'
|
|
@@ -53,6 +52,7 @@ export const MultiOrdersDetailsUI = (props: any) => {
|
|
|
53
52
|
const [, { showToast }] = useToast();
|
|
54
53
|
const [{ configs }] = useConfig()
|
|
55
54
|
|
|
55
|
+
const isTaxIncludedOnPrice = orders.every((_order: any) => _order.taxes?.length ? _order.taxes?.every((_tax: any) => _tax.type === 1) : true)
|
|
56
56
|
const progressBarStyle = configs.multi_business_checkout_progress_bar_style?.value
|
|
57
57
|
const showBarInOrder = ['group', 'both']
|
|
58
58
|
const showBarInIndividual = ['individual', 'both']
|
|
@@ -225,23 +225,27 @@ export const MultiOrdersDetailsUI = (props: any) => {
|
|
|
225
225
|
</Row>
|
|
226
226
|
))}
|
|
227
227
|
<BorderLine />
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
228
|
+
{!isTaxIncludedOnPrice && (
|
|
229
|
+
<>
|
|
230
|
+
<Row>
|
|
231
|
+
<OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>
|
|
232
|
+
{t('TOTAL_BEFORE_TAX', 'Total before tax')}:
|
|
233
|
+
</OText>
|
|
234
|
+
<OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>
|
|
235
|
+
{parsePrice(ordersSummary?.subtotal)}
|
|
236
|
+
</OText>
|
|
237
|
+
</Row>
|
|
238
|
+
<Row>
|
|
239
|
+
<OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>
|
|
240
|
+
{t('ESTIMATED_TAX_TO_BE_COLLECTED', 'Estimated tax to be collected')}:
|
|
241
|
+
</OText>
|
|
242
|
+
<OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>
|
|
243
|
+
{parsePrice(ordersSummary?.tax)}
|
|
244
|
+
</OText>
|
|
245
|
+
</Row>
|
|
246
|
+
<BorderLine />
|
|
247
|
+
</>
|
|
248
|
+
)}
|
|
245
249
|
<Row style={{ marginTop: 10 }}>
|
|
246
250
|
<OText size={14} lineHeight={18} weight={'500'} color={theme.colors.textNormal}>
|
|
247
251
|
{t('PAYMENT_TOTAL', 'Payment total')}:
|
|
@@ -31,7 +31,7 @@ export const MyOrders = (props: any) => {
|
|
|
31
31
|
const notOrderOptions = ['business', 'products']
|
|
32
32
|
const allEmpty = (ordersLength?.activeOrdersLength === 0 && ordersLength?.previousOrdersLength === 0) || ((isEmptyBusinesses || businessOrderIds?.length === 0) && hideOrders)
|
|
33
33
|
|
|
34
|
-
const isChewLayout = theme?.header?.components?.layout?.type === 'chew'
|
|
34
|
+
const isChewLayout = theme?.header?.components?.layout?.type?.toLowerCase() === 'chew'
|
|
35
35
|
const showNavbar = theme?.bar_menu?.components?.orders?.hidden
|
|
36
36
|
const hideOrdersTheme = theme?.bar_menu?.components?.orders?.hidden
|
|
37
37
|
const hideProductsTab = theme?.orders?.components?.products_tab?.hidden
|
|
@@ -90,7 +90,7 @@ export const MyOrders = (props: any) => {
|
|
|
90
90
|
},
|
|
91
91
|
...props.titleStyle
|
|
92
92
|
}}>
|
|
93
|
-
{
|
|
93
|
+
{!props.hideBackBtn && (!isChewLayout || (isChewLayout && hideOrdersTheme)) && (
|
|
94
94
|
<OButton
|
|
95
95
|
imgLeftStyle={{ width: 18 }}
|
|
96
96
|
imgRightSrc={null}
|
|
@@ -103,7 +103,7 @@ export const MyOrders = (props: any) => {
|
|
|
103
103
|
shadowColor: '#FFF',
|
|
104
104
|
paddingLeft: 0,
|
|
105
105
|
paddingRight: 0,
|
|
106
|
-
marginTop:
|
|
106
|
+
marginTop: 30,
|
|
107
107
|
}}
|
|
108
108
|
onClick={goToBack}
|
|
109
109
|
icon={AntDesignIcon}
|
|
@@ -77,7 +77,7 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
77
77
|
const theme = useTheme();
|
|
78
78
|
const [, { showToast }] = useToast()
|
|
79
79
|
|
|
80
|
-
const isChewLayout = theme?.header?.components?.layout?.type === 'chew'
|
|
80
|
+
const isChewLayout = theme?.header?.components?.layout?.type?.toLowerCase() === 'chew'
|
|
81
81
|
|
|
82
82
|
const styles = StyleSheet.create({
|
|
83
83
|
mainContainer: {
|
|
@@ -41,7 +41,7 @@ export const ProductOptionSubOptionUI = (props: any) => {
|
|
|
41
41
|
const [showMessage, setShowMessage] = useState(false)
|
|
42
42
|
const [isDirty, setIsDirty] = useState(false)
|
|
43
43
|
|
|
44
|
-
const isChewLayout = theme?.header?.components?.layout?.type === 'chew'
|
|
44
|
+
const isChewLayout = theme?.header?.components?.layout?.type?.toLowerCase() === 'chew'
|
|
45
45
|
const iconsSize = isChewLayout ? 20 : 16
|
|
46
46
|
|
|
47
47
|
const handleSuboptionClick = () => {
|
|
@@ -45,7 +45,7 @@ const SingleProductCardUI = React.memo((props: SingleProductCardParams) => {
|
|
|
45
45
|
|
|
46
46
|
const theme = useTheme();
|
|
47
47
|
const hideAddButton = theme?.business_view?.components?.products?.components?.add_to_cart_button?.hidden ?? true
|
|
48
|
-
const isChewLayout = theme?.header?.components?.layout?.type === 'chew'
|
|
48
|
+
const isChewLayout = theme?.header?.components?.layout?.type?.toLowerCase() === 'chew'
|
|
49
49
|
const hideProductDescription = theme?.business_view?.components?.products?.components?.product?.components?.description?.hidden
|
|
50
50
|
const hideProductLogo = viewString
|
|
51
51
|
? theme?.[viewString]?.components?.cart?.components?.products?.image?.hidden
|
|
@@ -49,7 +49,7 @@ const ProfileListUI = (props: ProfileParams) => {
|
|
|
49
49
|
|
|
50
50
|
const theme = useTheme();
|
|
51
51
|
|
|
52
|
-
const isChewLayout = theme?.header?.components?.layout?.type === 'chew'
|
|
52
|
+
const isChewLayout = theme?.header?.components?.layout?.type?.toLowerCase() === 'chew'
|
|
53
53
|
const hideProfileImage = theme?.profile?.components?.picture?.hidden
|
|
54
54
|
const hideOrders = theme?.profile?.components?.orders?.hidden
|
|
55
55
|
const hideProfile = theme?.profile?.components?.profile?.hidden
|
|
@@ -71,7 +71,7 @@ const WalletsUI = (props: any) => {
|
|
|
71
71
|
|
|
72
72
|
const [tabSelected, setTabSelected] = useState(isWalletCashEnabled ? 'cash' : 'credit_point')
|
|
73
73
|
const [openHistory, setOpenHistory] = useState(false)
|
|
74
|
-
const isChewLayout = theme?.header?.components?.layout?.type === 'chew'
|
|
74
|
+
const isChewLayout = theme?.header?.components?.layout?.type?.toLowerCase() === 'chew'
|
|
75
75
|
const hideWalletsTheme = theme?.bar_menu?.components?.wallets?.hidden
|
|
76
76
|
|
|
77
77
|
const isWalletEnabled = configs?.cash_wallet?.value && configs?.wallet_enabled?.value === '1' && (isWalletCashEnabled || isWalletPointsEnabled)
|