ordering-ui-react-native 0.12.44 → 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/Cart/index.tsx +56 -23
- 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/SingleProductCard/index.tsx +1 -1
- package/src/components/TaxInformation/index.tsx +51 -0
- package/src/components/TaxInformation/styles.tsx +9 -0
- package/src/types/index.tsx +1 -1
- 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
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
|
|
11
11
|
import { CContainer, CheckoutAction } from './styles';
|
|
12
12
|
|
|
13
|
-
import { OSBill, OSTable, OSCoupon, OSTotal } from '../OrderSummary/styles';
|
|
13
|
+
import { OSBill, OSTable, OSCoupon, OSTotal, OSRow } from '../OrderSummary/styles';
|
|
14
14
|
|
|
15
15
|
import { ProductItemAccordion } from '../ProductItemAccordion';
|
|
16
16
|
import { BusinessItemAccordion } from '../BusinessItemAccordion';
|
|
@@ -22,6 +22,9 @@ import { ProductForm } from '../ProductForm';
|
|
|
22
22
|
import { UpsellingProducts } from '../UpsellingProducts';
|
|
23
23
|
import { verifyDecimals } from '../../utils';
|
|
24
24
|
import { Platform } from 'react-native';
|
|
25
|
+
import { TaxInformation } from '../TaxInformation';
|
|
26
|
+
import { TouchableOpacity } from 'react-native';
|
|
27
|
+
import AntIcon from 'react-native-vector-icons/AntDesign'
|
|
25
28
|
|
|
26
29
|
const CartUI = (props: any) => {
|
|
27
30
|
const {
|
|
@@ -47,6 +50,7 @@ const CartUI = (props: any) => {
|
|
|
47
50
|
const [curProduct, setCurProduct] = useState<any>(null)
|
|
48
51
|
const [openUpselling, setOpenUpselling] = useState(false)
|
|
49
52
|
const [canOpenUpselling, setCanOpenUpselling] = useState(false)
|
|
53
|
+
const [openTaxModal, setOpenTaxModal] = useState<any>({ open: false, data: null })
|
|
50
54
|
|
|
51
55
|
const isCartPending = cart?.status === 2
|
|
52
56
|
const isCouponEnabled = validationFields?.fields?.checkout?.coupon?.enabled
|
|
@@ -92,6 +96,16 @@ const CartUI = (props: any) => {
|
|
|
92
96
|
})
|
|
93
97
|
}
|
|
94
98
|
|
|
99
|
+
const getIncludedTaxes = () => {
|
|
100
|
+
if (cart?.taxes === null) {
|
|
101
|
+
return cart.business.tax_type === 1 ? cart?.tax : 0
|
|
102
|
+
} else {
|
|
103
|
+
return cart?.taxes.reduce((taxIncluded: number, tax: any) => {
|
|
104
|
+
return taxIncluded + (tax.type === 1 ? tax.summary?.tax : 0)
|
|
105
|
+
}, 0)
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
95
109
|
return (
|
|
96
110
|
<CContainer>
|
|
97
111
|
<BusinessItemAccordion
|
|
@@ -120,9 +134,7 @@ const CartUI = (props: any) => {
|
|
|
120
134
|
<OSTable>
|
|
121
135
|
<OText>{t('SUBTOTAL', 'Subtotal')}</OText>
|
|
122
136
|
<OText>
|
|
123
|
-
{cart
|
|
124
|
-
? parsePrice((cart?.subtotal + cart?.tax) || 0)
|
|
125
|
-
: parsePrice(cart?.subtotal || 0)}
|
|
137
|
+
{parsePrice(cart?.subtotal + getIncludedTaxes())}
|
|
126
138
|
</OText>
|
|
127
139
|
</OSTable>
|
|
128
140
|
{cart?.discount > 0 && cart?.total >= 0 && (
|
|
@@ -138,15 +150,38 @@ const CartUI = (props: any) => {
|
|
|
138
150
|
<OText>- {parsePrice(cart?.discount || 0)}</OText>
|
|
139
151
|
</OSTable>
|
|
140
152
|
)}
|
|
141
|
-
{
|
|
142
|
-
|
|
143
|
-
<
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
153
|
+
{
|
|
154
|
+
cart.taxes?.length > 0 && cart.taxes.filter((tax: any) => tax.type === 2 && tax?.rate !== 0).map((tax: any) => (
|
|
155
|
+
<OSTable key={tax.id}>
|
|
156
|
+
<OSRow>
|
|
157
|
+
<OText numberOfLines={1} >
|
|
158
|
+
{tax.name || t('INHERIT_FROM_BUSINESS', 'Inherit from business')}{' '}
|
|
159
|
+
{`(${verifyDecimals(tax?.rate, parseNumber)}%)`}{' '}
|
|
160
|
+
</OText>
|
|
161
|
+
<TouchableOpacity onPress={() => setOpenTaxModal({ open: true, data: tax })} >
|
|
162
|
+
<AntIcon name='exclamationcircleo' size={18} color={theme.colors.primary} />
|
|
163
|
+
</TouchableOpacity>
|
|
164
|
+
</OSRow>
|
|
165
|
+
<OText>{parsePrice(tax?.summary?.tax || 0)}</OText>
|
|
166
|
+
</OSTable>
|
|
167
|
+
))
|
|
168
|
+
}
|
|
169
|
+
{
|
|
170
|
+
cart?.fees?.length > 0 && cart?.fees?.filter((fee: any) => !(fee.fixed === 0 && fee.percentage === 0)).map((fee: any) => (
|
|
171
|
+
<OSTable key={fee?.id}>
|
|
172
|
+
<OSRow>
|
|
173
|
+
<OText numberOfLines={1}>
|
|
174
|
+
{fee.name || t('INHERIT_FROM_BUSINESS', 'Inherit from business')}{' '}
|
|
175
|
+
({parsePrice(fee?.fixed)} + {fee?.percentage}%){' '}
|
|
176
|
+
</OText>
|
|
177
|
+
<TouchableOpacity onPress={() => setOpenTaxModal({ open: true, data: fee })} >
|
|
178
|
+
<AntIcon name='exclamationcircleo' size={18} color={theme.colors.primary} />
|
|
179
|
+
</TouchableOpacity>
|
|
180
|
+
</OSRow>
|
|
181
|
+
<OText>{parsePrice(fee?.summary?.fixed + fee?.summary?.percentage || 0)}</OText>
|
|
182
|
+
</OSTable>
|
|
183
|
+
))
|
|
184
|
+
}
|
|
150
185
|
{orderState?.options?.type === 1 && cart?.delivery_price > 0 && (
|
|
151
186
|
<OSTable>
|
|
152
187
|
<OText>{t('DELIVERY_FEE', 'Delivery Fee')}</OText>
|
|
@@ -167,15 +202,6 @@ const CartUI = (props: any) => {
|
|
|
167
202
|
<OText>{parsePrice(cart?.driver_tip)}</OText>
|
|
168
203
|
</OSTable>
|
|
169
204
|
)}
|
|
170
|
-
{cart?.service_fee > 0 && (
|
|
171
|
-
<OSTable>
|
|
172
|
-
<OText>
|
|
173
|
-
{t('SERVICE_FEE', 'Service Fee')}
|
|
174
|
-
{`(${verifyDecimals(cart?.business?.service_fee, parseNumber)}%)`}
|
|
175
|
-
</OText>
|
|
176
|
-
<OText>{parsePrice(cart?.service_fee)}</OText>
|
|
177
|
-
</OSTable>
|
|
178
|
-
)}
|
|
179
205
|
{isCouponEnabled && !isCartPending && (
|
|
180
206
|
<OSTable>
|
|
181
207
|
<OSCoupon>
|
|
@@ -249,6 +275,13 @@ const CartUI = (props: any) => {
|
|
|
249
275
|
setCanOpenUpselling={setCanOpenUpselling}
|
|
250
276
|
/>
|
|
251
277
|
)}
|
|
278
|
+
<OModal
|
|
279
|
+
open={openTaxModal.open}
|
|
280
|
+
onClose={() => setOpenTaxModal({ open: false, data: null })}
|
|
281
|
+
entireModal
|
|
282
|
+
>
|
|
283
|
+
<TaxInformation data={openTaxModal.data} products={cart.products} />
|
|
284
|
+
</OModal>
|
|
252
285
|
</CContainer>
|
|
253
286
|
)
|
|
254
287
|
}
|