ordering-ui-react-native 0.12.41 → 0.12.45
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/src/components/AppleLogin/index.tsx +145 -0
- package/src/components/AppleLogin/styles.tsx +22 -0
- package/src/components/BusinessesListing/index.tsx +1 -1
- package/src/components/Cart/index.tsx +64 -31
- package/src/components/LoginForm/index.tsx +34 -17
- package/src/components/OrderDetails/index.tsx +90 -35
- package/src/components/OrderSummary/index.tsx +59 -27
- package/src/components/OrderSummary/styles.tsx +6 -0
- package/src/components/SignupForm/index.tsx +52 -35
- package/src/components/SingleProductCard/index.tsx +1 -1
- package/src/components/TaxInformation/index.tsx +51 -0
- package/src/components/TaxInformation/styles.tsx +9 -0
- package/src/components/UserFormDetails/index.tsx +0 -2
- package/src/navigators/BottomNavigator.tsx +1 -1
- package/src/types/index.tsx +7 -1
- package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +2 -2
- package/themes/doordash/src/components/Cart/index.tsx +55 -22
- package/themes/doordash/src/components/OrderDetails/index.tsx +444 -386
- package/themes/doordash/src/components/OrderSummary/index.tsx +252 -221
- package/themes/doordash/src/components/OrderSummary/styles.tsx +6 -0
- package/themes/doordash/src/components/SingleProductCard/index.tsx +1 -1
- package/themes/doordash/src/components/TaxInformation/index.tsx +51 -0
- package/themes/doordash/src/components/TaxInformation/styles.tsx +9 -0
- package/themes/franchises/src/components/Cart/index.tsx +55 -23
- package/themes/franchises/src/components/OrderDetails/index.tsx +77 -23
- package/themes/franchises/src/components/OrderSummary/index.tsx +58 -24
- package/themes/franchises/src/components/OrderSummary/styles.tsx +6 -0
- package/themes/franchises/src/components/SingleProductCard/index.tsx +1 -1
- package/themes/franchises/src/components/TaxInformation/index.tsx +51 -0
- package/themes/franchises/src/components/TaxInformation/styles.tsx +9 -0
- package/themes/instacart/src/components/Cart/index.tsx +57 -17
- package/themes/instacart/src/components/OrderDetails/index.tsx +490 -433
- package/themes/instacart/src/components/OrderSummary/index.tsx +236 -194
- package/themes/instacart/src/components/OrderSummary/styles.tsx +6 -0
- package/themes/instacart/src/components/SingleProductCard/index.tsx +2 -2
- package/themes/instacart/src/components/TaxInformation/index.tsx +51 -0
- package/themes/instacart/src/components/TaxInformation/styles.tsx +9 -0
- package/themes/original/src/components/Cart/index.tsx +55 -13
- package/themes/original/src/components/OrderDetails/index.tsx +76 -23
- package/themes/original/src/components/OrderSummary/index.tsx +208 -173
- package/themes/original/src/components/OrderSummary/styles.tsx +6 -0
- package/themes/original/src/components/SingleProductCard/index.tsx +1 -1
- package/themes/original/src/components/TaxInformation/index.tsx +51 -0
- package/themes/original/src/components/TaxInformation/styles.tsx +9 -0
- package/themes/single-business/src/components/Cart/index.tsx +57 -24
- package/themes/single-business/src/components/OrderDetails/index.tsx +77 -23
- package/themes/single-business/src/components/OrderSummary/index.tsx +58 -24
- package/themes/single-business/src/components/OrderSummary/styles.tsx +6 -0
- package/themes/single-business/src/components/SingleProductCard/index.tsx +1 -1
- package/themes/single-business/src/components/TaxInformation/index.tsx +51 -0
- package/themes/single-business/src/components/TaxInformation/styles.tsx +9 -0
- package/themes/uber-eats/src/components/Cart/index.tsx +56 -14
- package/themes/uber-eats/src/components/OrderDetails/index.tsx +81 -22
- package/themes/uber-eats/src/components/OrderSummary/index.tsx +56 -23
- package/themes/uber-eats/src/components/OrderSummary/styles.tsx +6 -0
- package/themes/uber-eats/src/components/SingleProductCard/index.tsx +1 -1
- package/themes/uber-eats/src/components/TaxInformation/index.tsx +51 -0
- package/themes/uber-eats/src/components/TaxInformation/styles.tsx +9 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { useState } from 'react';
|
|
2
|
-
import { View } from 'react-native'
|
|
2
|
+
import { TouchableOpacity, View } from 'react-native'
|
|
3
3
|
import {
|
|
4
4
|
Cart,
|
|
5
5
|
useOrder,
|
|
@@ -13,7 +13,8 @@ import {
|
|
|
13
13
|
OSContainer,
|
|
14
14
|
OSProductList,
|
|
15
15
|
OSBill,
|
|
16
|
-
OSTable
|
|
16
|
+
OSTable,
|
|
17
|
+
OSRow
|
|
17
18
|
} from './styles';
|
|
18
19
|
|
|
19
20
|
import { ProductItemAccordion } from '../ProductItemAccordion';
|
|
@@ -22,6 +23,8 @@ import { OModal, OText } from '../shared';
|
|
|
22
23
|
import { ProductForm } from '../ProductForm';
|
|
23
24
|
import { verifyDecimals } from '../../utils';
|
|
24
25
|
import { useTheme } from 'styled-components/native';
|
|
26
|
+
import AntIcon from 'react-native-vector-icons/AntDesign'
|
|
27
|
+
import { TaxInformation } from '../TaxInformation';
|
|
25
28
|
|
|
26
29
|
const OrderSummaryUI = (props: any) => {
|
|
27
30
|
const {
|
|
@@ -42,6 +45,7 @@ const OrderSummaryUI = (props: any) => {
|
|
|
42
45
|
const [validationFields] = useValidationFields();
|
|
43
46
|
const [openProduct, setModalIsOpen] = useState(false)
|
|
44
47
|
const [curProduct, setCurProduct] = useState<any>(null)
|
|
48
|
+
const [openTaxModal, setOpenTaxModal] = useState<any>({ open: false, data: null })
|
|
45
49
|
|
|
46
50
|
const isCouponEnabled = validationFields?.fields?.checkout?.coupon?.enabled;
|
|
47
51
|
|
|
@@ -60,6 +64,16 @@ const OrderSummaryUI = (props: any) => {
|
|
|
60
64
|
}
|
|
61
65
|
}
|
|
62
66
|
|
|
67
|
+
const getIncludedTaxes = () => {
|
|
68
|
+
if (cart?.taxes === null) {
|
|
69
|
+
return cart.business.tax_type === 1 ? cart?.tax : 0
|
|
70
|
+
} else {
|
|
71
|
+
return cart?.taxes.reduce((taxIncluded: number, tax: any) => {
|
|
72
|
+
return taxIncluded + (tax.type === 1 ? tax.summary?.tax : 0)
|
|
73
|
+
}, 0)
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
63
77
|
return (
|
|
64
78
|
<OSContainer>
|
|
65
79
|
{cart?.products?.length > 0 && (
|
|
@@ -84,9 +98,7 @@ const OrderSummaryUI = (props: any) => {
|
|
|
84
98
|
<OSBill>
|
|
85
99
|
<OSTable>
|
|
86
100
|
<OText size={16}>{t('SUBTOTAL', 'Subtotal')}</OText>
|
|
87
|
-
<OText size={16}>{cart
|
|
88
|
-
? parsePrice((cart?.subtotal + cart?.tax) || 0)
|
|
89
|
-
: parsePrice(cart?.subtotal || 0)}</OText>
|
|
101
|
+
<OText size={16}>{parsePrice(cart?.subtotal + getIncludedTaxes())}</OText>
|
|
90
102
|
</OSTable>
|
|
91
103
|
{cart?.discount > 0 && cart?.total >= 0 && (
|
|
92
104
|
<OSTable>
|
|
@@ -101,15 +113,38 @@ const OrderSummaryUI = (props: any) => {
|
|
|
101
113
|
<OText size={16}>- {parsePrice(cart?.discount || 0)}</OText>
|
|
102
114
|
</OSTable>
|
|
103
115
|
)}
|
|
104
|
-
{
|
|
105
|
-
|
|
106
|
-
<
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
116
|
+
{
|
|
117
|
+
cart?.taxes?.length > 0 && cart?.taxes?.filter((tax: any) => tax?.type === 2 && tax?.rate !== 0).map((tax: any) => (
|
|
118
|
+
<OSTable key={tax?.id}>
|
|
119
|
+
<OSRow>
|
|
120
|
+
<OText size={16} numberOfLines={1}>
|
|
121
|
+
{tax?.name || t('INHERIT_FROM_BUSINESS', 'Inherit from business')}{' '}
|
|
122
|
+
{`(${verifyDecimals(tax?.rate, parseNumber)}%)`}{' '}
|
|
123
|
+
</OText>
|
|
124
|
+
<TouchableOpacity onPress={() => setOpenTaxModal({ open: true, data: tax })} >
|
|
125
|
+
<AntIcon name='exclamationcircleo' size={20} color={theme.colors.primary} />
|
|
126
|
+
</TouchableOpacity>
|
|
127
|
+
</OSRow>
|
|
128
|
+
<OText size={16}>{parsePrice(tax?.summary?.tax || 0)}</OText>
|
|
129
|
+
</OSTable>
|
|
130
|
+
))
|
|
131
|
+
}
|
|
132
|
+
{
|
|
133
|
+
cart?.fees?.length > 0 && cart?.fees?.filter((fee: any) => !(fee.fixed === 0 && fee.percentage === 0))?.map((fee: any) => (
|
|
134
|
+
<OSTable key={fee.id}>
|
|
135
|
+
<OSRow>
|
|
136
|
+
<OText size={16} numberOfLines={1}>
|
|
137
|
+
{fee.name || t('INHERIT_FROM_BUSINESS', 'Inherit from business')}{' '}
|
|
138
|
+
({parsePrice(fee?.fixed)} + {fee.percentage}%){' '}
|
|
139
|
+
</OText>
|
|
140
|
+
<TouchableOpacity onPress={() => setOpenTaxModal({ open: true, data: fee })} >
|
|
141
|
+
<AntIcon name='exclamationcircleo' size={20} color={theme.colors.primary} />
|
|
142
|
+
</TouchableOpacity>
|
|
143
|
+
</OSRow>
|
|
144
|
+
<OText size={16}>{parsePrice(fee?.summary?.fixed + fee?.summary?.percentage || 0)}</OText>
|
|
145
|
+
</OSTable>
|
|
146
|
+
))
|
|
147
|
+
}
|
|
113
148
|
{orderState?.options?.type === 1 && cart?.delivery_price > 0 && (
|
|
114
149
|
<OSTable>
|
|
115
150
|
<OText size={16}>{t('DELIVERY_FEE', 'Delivery Fee')}</OText>
|
|
@@ -130,15 +165,6 @@ const OrderSummaryUI = (props: any) => {
|
|
|
130
165
|
<OText size={16}>{parsePrice(cart?.driver_tip)}</OText>
|
|
131
166
|
</OSTable>
|
|
132
167
|
)}
|
|
133
|
-
{cart?.service_fee > 0 && (
|
|
134
|
-
<OSTable>
|
|
135
|
-
<OText size={16}>
|
|
136
|
-
{t('SERVICE_FEE', 'Service Fee')}
|
|
137
|
-
{`(${verifyDecimals(cart?.business?.service_fee, parseNumber)}%)`}
|
|
138
|
-
</OText>
|
|
139
|
-
<OText size={16}>{parsePrice(cart?.service_fee)}</OText>
|
|
140
|
-
</OSTable>
|
|
141
|
-
)}
|
|
142
168
|
{isCouponEnabled && !isCartPending && (
|
|
143
169
|
<View>
|
|
144
170
|
<View style={{ paddingVertical: 5 }}>
|
|
@@ -181,6 +207,13 @@ const OrderSummaryUI = (props: any) => {
|
|
|
181
207
|
isFromCheckout={isFromCheckout}
|
|
182
208
|
/>
|
|
183
209
|
</OModal>
|
|
210
|
+
<OModal
|
|
211
|
+
open={openTaxModal.open}
|
|
212
|
+
onClose={() => setOpenTaxModal({ open: false, data: null })}
|
|
213
|
+
entireModal
|
|
214
|
+
>
|
|
215
|
+
<TaxInformation data={openTaxModal.data} products={cart.products} />
|
|
216
|
+
</OModal>
|
|
184
217
|
</>
|
|
185
218
|
)}
|
|
186
219
|
</OSContainer>
|
|
@@ -59,7 +59,7 @@ export const SingleProductCard = (props: SingleProductCardParams) => {
|
|
|
59
59
|
|
|
60
60
|
return (
|
|
61
61
|
<CardContainer style={[(isSoldOut || maxProductQuantity <= 0) && styles.soldOutBackgroundStyle]}
|
|
62
|
-
onPress={() => onProductClick(product)}
|
|
62
|
+
onPress={() => onProductClick?.(product)}
|
|
63
63
|
>
|
|
64
64
|
<CardInfo>
|
|
65
65
|
<OText weight={500} numberOfLines={1} ellipsizeMode='tail' style={styles.textStyle}>{product?.name}</OText>
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { useLanguage, useUtils } from 'ordering-components/native'
|
|
3
|
+
import { SingleProductCard } from '../SingleProductCard'
|
|
4
|
+
import { TaxInformationContainer, ProductContainer } from './styles'
|
|
5
|
+
import { OText } from '../shared'
|
|
6
|
+
|
|
7
|
+
interface taxInformationParams {
|
|
8
|
+
data: { name: string, description?: string, rate: string | number, type: number, fixed?: number, percentage?: number, id: number },
|
|
9
|
+
products: Array<any>
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export const TaxInformation = (props: taxInformationParams) => {
|
|
13
|
+
const {
|
|
14
|
+
data,
|
|
15
|
+
products
|
|
16
|
+
} = props
|
|
17
|
+
|
|
18
|
+
const [, t] = useLanguage()
|
|
19
|
+
const [{ parsePrice }] = useUtils()
|
|
20
|
+
|
|
21
|
+
const isTax = typeof data?.rate === 'number'
|
|
22
|
+
const TaxFeeString = isTax ? 'tax' : 'fee'
|
|
23
|
+
const includedOnPriceString = data?.type === 1 ? `(${t('INCLUDED_ON_PRICE', 'Included on price')})` : `(${t('NOT_INCLUDED_ON_PRICE', 'Not included on price')})`
|
|
24
|
+
|
|
25
|
+
return (
|
|
26
|
+
<TaxInformationContainer>
|
|
27
|
+
<OText size={24} style={{ alignSelf: 'center', textAlign: 'center' }} mBottom={10}>
|
|
28
|
+
{`${data?.name ||
|
|
29
|
+
t('INHERIT_FROM_BUSINESS', 'Inherit from business')} (${typeof data?.rate === 'number' ? `${data?.rate}%` : `${parsePrice(data?.fixed ?? 0)} + ${data?.percentage}%`})`}
|
|
30
|
+
</OText>
|
|
31
|
+
{data?.description && (
|
|
32
|
+
<OText mBottom={10} size={18} style={{ alignSelf: 'center', textAlign: 'center' }}>
|
|
33
|
+
{t('DESCRIPTION', 'Description')}: {data?.description} {data?.type && includedOnPriceString}
|
|
34
|
+
</OText>
|
|
35
|
+
)}
|
|
36
|
+
<OText>{t(`OTHER_PRODUCTS_WITH_THIS_${TaxFeeString.toUpperCase()}`, `Other products with this ${TaxFeeString}`)}:</OText>
|
|
37
|
+
<ProductContainer>
|
|
38
|
+
{
|
|
39
|
+
products.filter((product: any) => isTax ? (product.tax?.id ? product.tax?.id === data?.id : product.tax?.id === null && data?.id === null) : (product.fee?.id ? product.fee?.id === data?.id : (product.fee?.id === null && data?.id === null))).map(product => (
|
|
40
|
+
<SingleProductCard
|
|
41
|
+
key={product.id}
|
|
42
|
+
product={product}
|
|
43
|
+
isSoldOut={false}
|
|
44
|
+
businessId={product?.business_id}
|
|
45
|
+
/>
|
|
46
|
+
))
|
|
47
|
+
}
|
|
48
|
+
</ProductContainer>
|
|
49
|
+
</TaxInformationContainer>
|
|
50
|
+
)
|
|
51
|
+
}
|