ordering-ui-react-native 0.17.91 → 0.17.92

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ordering-ui-react-native",
3
- "version": "0.17.91",
3
+ "version": "0.17.92",
4
4
  "description": "Reusable components made in react native",
5
5
  "main": "src/index.tsx",
6
6
  "author": "ordering.inc",
@@ -46,7 +46,7 @@ export const BusinessBasicInformation = (
46
46
  const [openBusinessReviews, setOpenBusinessReviews] = useState(false);
47
47
  const [businessInformationObtained, setBusinessInformationObtained] = useState(false)
48
48
  const [businessReviewsObtained, setBusinessReviewsObtainedbtained] = useState(false)
49
- const isChewLayout = theme?.header?.components?.layout?.type === 'chew'
49
+ const isChewLayout = theme?.header?.components?.layout?.type?.toLowerCase() === 'chew'
50
50
  const hideLogo = theme?.business_view?.components?.header?.components?.business?.components?.logo?.hidden
51
51
  const hideDeliveryFee = theme?.business_view?.components?.header?.components?.business?.components?.fee?.hidden
52
52
  const hideTime = theme?.business_view?.components?.header?.components?.business?.components?.time?.hidden
@@ -76,7 +76,7 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
76
76
  { text: t('PICKUP_TIME', 'Pickup time'), value: 'pickup_time' }
77
77
  ]
78
78
 
79
- const isChewLayout = theme?.header?.components?.layout?.type === 'chew'
79
+ const isChewLayout = theme?.header?.components?.layout?.type?.toLowerCase() === 'chew'
80
80
 
81
81
  const priceList = [
82
82
  { level: '1', content: '$' },
@@ -82,7 +82,7 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
82
82
  const isFocused = useIsFocused();
83
83
  const isPreOrder = configs?.preorder_status_enabled?.value === '1'
84
84
 
85
- const isChewLayout = theme?.header?.components?.layout?.type === 'chew'
85
+ const isChewLayout = theme?.header?.components?.layout?.type?.toLowerCase() === 'chew'
86
86
  const showLogo = !theme?.business_view?.components?.header?.components?.business?.components?.logo?.hidden
87
87
  const hideBusinessNearCity = theme?.business_view?.components?.near_business?.hidden ?? true
88
88
  const backgroundColor = theme?.business_view?.components?.style?.backgroundColor
@@ -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
@@ -393,7 +393,7 @@ const CartUI = (props: any) => {
393
393
  </OSTable>
394
394
  )}
395
395
 
396
- {isMultiCheckout &&
396
+ {!isMultiCheckout &&
397
397
  cart &&
398
398
  cart?.valid &&
399
399
  orderState?.options?.type === 1 &&
@@ -20,7 +20,7 @@ export const CartContent = (props: any) => {
20
20
  const [{ configs }] = useConfig()
21
21
  const [isCartsLoading, setIsCartsLoading] = useState(false)
22
22
 
23
- const isChewLayout = theme?.header?.components?.layout?.type === 'chew'
23
+ const isChewLayout = theme?.header?.components?.layout?.type?.toLowerCase() === 'chew'
24
24
  const isMultiCheckout = configs?.checkout_multi_business_enabled?.value === '1'
25
25
  const cartsAvailable: any = Object.values(carts)?.filter((cart: any) => cart?.valid && cart?.status !== 2)
26
26
 
@@ -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
- optionSelected,
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.stripe
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}
@@ -21,6 +21,8 @@ import { AddressDetails } from '../AddressDetails'
21
21
  import { MultiCartsPaymethodsAndWallets } from '../MultiCartsPaymethodsAndWallets'
22
22
  import { Cart } from '../Cart'
23
23
  import { FloatingButton } from '../FloatingButton'
24
+ import { DriverTips } from '../DriverTips'
25
+ import { DriverTipsContainer } from '../Cart/styles'
24
26
 
25
27
  import {
26
28
  ChContainer,
@@ -78,8 +80,12 @@ const MultiCheckoutUI = (props: any) => {
78
80
 
79
81
  const configTypes = configs?.order_types_allowed?.value.split('|').map((value: any) => Number(value)) || []
80
82
  const isPreOrder = configs?.preorder_status_enabled?.value === '1'
83
+ const isMultiDriverTips = theme?.header?.components?.layout?.type?.toLowerCase() === 'chew'
81
84
  const isDisablePlaceOrderButton = !(paymethodSelected?.paymethod_id || paymethodSelected?.wallet_id) || (paymethodSelected?.paymethod?.gateway === 'stripe' && !paymethodSelected?.paymethod_data)
82
85
  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) || []
86
+ const driverTipsOptions = typeof configs?.driver_tip_options?.value === 'string'
87
+ ? JSON.parse(configs?.driver_tip_options?.value) || []
88
+ : configs?.driver_tip_options?.value || []
83
89
 
84
90
  const [isUserDetailsEdit, setIsUserDetailsEdit] = useState(false);
85
91
  const [phoneUpdate, setPhoneUpdate] = useState(false);
@@ -227,6 +233,35 @@ const MultiCheckoutUI = (props: any) => {
227
233
  <View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginTop: 13, marginHorizontal: -40 }} />
228
234
  </ChSection>
229
235
 
236
+ {
237
+ isMultiDriverTips &&
238
+ options?.type === 1 &&
239
+ validationFields?.fields?.checkout?.driver_tip?.enabled &&
240
+ openCarts.every((cart: any) => cart.business_id && cart.status !== 2) &&
241
+ driverTipsOptions && driverTipsOptions?.length > 0 &&
242
+ (
243
+ <ChSection>
244
+ <DriverTipsContainer>
245
+ <OText size={14} lineHeight={20} color={theme.colors.textNormal}>
246
+ {t('DRIVER_TIPS', 'Driver Tips')}
247
+ </OText>
248
+ <DriverTips
249
+ isMulti
250
+ carts={openCarts}
251
+ businessIds={openCarts.map((cart: any) => cart.business_id)}
252
+ driverTipsOptions={driverTipsOptions}
253
+ isFixedPrice={parseInt(configs?.driver_tip_type?.value, 10) === 1}
254
+ isDriverTipUseCustom={!!parseInt(configs?.driver_tip_use_custom?.value, 10)}
255
+ driverTip={parseInt(configs?.driver_tip_type?.value, 10) === 1
256
+ ? openCarts[0]?.driver_tip
257
+ : openCarts[0]?.driver_tip_rate}
258
+ useOrderContext
259
+ />
260
+ </DriverTipsContainer>
261
+ <View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginTop: 13, marginHorizontal: -40 }} />
262
+ </ChSection>
263
+ )}
264
+
230
265
  <ChSection>
231
266
  <ChCarts>
232
267
  <CartsHeader>
@@ -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
- <Row>
229
- <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>
230
- {t('TOTAL_BEFORE_TAX', 'Total before tax')}:
231
- </OText>
232
- <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>
233
- {parsePrice(ordersSummary?.subtotal)}
234
- </OText>
235
- </Row>
236
- <Row>
237
- <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>
238
- {t('ESTIMATED_TAX_TO_BE_COLLECTED', 'Estimated tax to be collected')}:
239
- </OText>
240
- <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>
241
- {parsePrice(ordersSummary?.tax)}
242
- </OText>
243
- </Row>
244
- <BorderLine />
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
- {(!props.hideBackBtn || !hideOrdersTheme) && !isChewLayout && (
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: 50,
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)