ordering-ui-react-native 0.22.90 → 0.22.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 +1 -1
- package/themes/business/src/components/LanguageSelector/index.tsx +1 -1
- package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +20 -5
- package/themes/business/src/components/OrderDetails/styles.tsx +2 -2
- package/themes/original/src/components/Cart/index.tsx +24 -6
- package/themes/original/src/components/OrderDetails/index.tsx +23 -5
- package/themes/original/src/components/OrderSummary/index.tsx +23 -5
- package/themes/original/src/components/TaxInformation/index.tsx +3 -2
package/package.json
CHANGED
|
@@ -49,7 +49,7 @@ const LanguageSelectorUI = (props: LanguageSelectorParams) => {
|
|
|
49
49
|
},
|
|
50
50
|
});
|
|
51
51
|
|
|
52
|
-
return (
|
|
52
|
+
return !languagesState?.loading && languagesState?.languages?.length > 1 && (
|
|
53
53
|
<Container style={{ backgroundColor: theme.colors.inputChat }}>
|
|
54
54
|
{languagesState?.languages && (
|
|
55
55
|
<CountryPicker
|
|
@@ -99,19 +99,21 @@ export const OrderContentComponent = (props: OrderContent) => {
|
|
|
99
99
|
}
|
|
100
100
|
})
|
|
101
101
|
|
|
102
|
-
const getIncludedTaxes = () => {
|
|
102
|
+
const getIncludedTaxes = (isDeliveryFee?: boolean) => {
|
|
103
103
|
if (!order?.taxes) return 0
|
|
104
104
|
if (order?.taxes?.length === 0) {
|
|
105
105
|
return order.tax_type === 1 ? order?.summary?.tax ?? 0 : 0
|
|
106
106
|
} else {
|
|
107
107
|
return order?.taxes.reduce((taxIncluded: number, tax: any) => {
|
|
108
|
-
return taxIncluded +
|
|
108
|
+
return taxIncluded +
|
|
109
|
+
(((!isDeliveryFee && tax.type === 1 && tax.target === 'product') ||
|
|
110
|
+
(isDeliveryFee && tax.type === 1 && tax.target === 'delivery_fee')) ? tax.summary?.tax : 0)
|
|
109
111
|
}, 0)
|
|
110
112
|
}
|
|
111
113
|
}
|
|
112
114
|
|
|
113
115
|
const getIncludedTaxesDiscounts = () => {
|
|
114
|
-
return order?.taxes?.filter((tax: any) => tax?.type === 1)?.reduce((carry: number, tax: any) => carry + (tax?.summary?.tax_after_discount ?? tax?.summary?.tax), 0)
|
|
116
|
+
return order?.taxes?.filter((tax: any) => tax?.type === 1 && tax?.target === 'product')?.reduce((carry: number, tax: any) => carry + (tax?.summary?.tax_after_discount ?? tax?.summary?.tax), 0)
|
|
115
117
|
}
|
|
116
118
|
|
|
117
119
|
const containsOnlyNumbers = (str: string) => {
|
|
@@ -518,7 +520,7 @@ export const OrderContentComponent = (props: OrderContent) => {
|
|
|
518
520
|
)
|
|
519
521
|
}
|
|
520
522
|
{
|
|
521
|
-
order?.taxes?.length > 0 && order?.taxes?.filter((tax: any) => tax?.type === 2 && tax?.rate !== 0).map((tax: any) => (
|
|
523
|
+
order?.taxes?.length > 0 && order?.taxes?.filter((tax: any) => tax?.type === 2 && tax?.rate !== 0 && tax?.target === 'product').map((tax: any) => (
|
|
522
524
|
<Table key={tax.id}>
|
|
523
525
|
<OSRow>
|
|
524
526
|
<OText mBottom={4}>
|
|
@@ -566,11 +568,24 @@ export const OrderContentComponent = (props: OrderContent) => {
|
|
|
566
568
|
</OText>
|
|
567
569
|
|
|
568
570
|
<OText mBottom={4}>
|
|
569
|
-
{parsePrice(order?.summary?.delivery_price, { currency: order?.currency })}
|
|
571
|
+
{parsePrice(order?.summary?.delivery_price + getIncludedTaxes(true), { currency: order?.currency })}
|
|
570
572
|
</OText>
|
|
571
573
|
</Table>
|
|
572
574
|
)
|
|
573
575
|
}
|
|
576
|
+
{
|
|
577
|
+
order?.taxes?.length > 0 && order?.taxes?.filter((tax: any) => tax?.type === 2 && tax?.rate !== 0 && tax?.target === 'delivery_fee').map((tax: any, i: number) => (
|
|
578
|
+
<Table key={`${tax.description}_${i}`}>
|
|
579
|
+
<OSRow>
|
|
580
|
+
<OText size={12} lineHeight={18} numberOfLines={1}>
|
|
581
|
+
{tax.name || t('INHERIT_FROM_BUSINESS', 'Inherit from business')}
|
|
582
|
+
{`(${verifyDecimals(tax?.rate, parseNumber)}%)`}
|
|
583
|
+
</OText>
|
|
584
|
+
</OSRow>
|
|
585
|
+
<OText size={12} lineHeight={18}>{parsePrice(tax?.summary?.tax_after_discount ?? tax?.summary?.tax ?? 0)}</OText>
|
|
586
|
+
</Table>
|
|
587
|
+
))
|
|
588
|
+
}
|
|
574
589
|
{
|
|
575
590
|
order?.offers?.length > 0 && order?.offers?.filter((offer: any) => offer?.target === 2)?.map((offer: any) => (
|
|
576
591
|
<Table key={offer.id}>
|
|
@@ -156,18 +156,20 @@ const CartUI = (props: any) => {
|
|
|
156
156
|
}
|
|
157
157
|
}
|
|
158
158
|
|
|
159
|
-
const getIncludedTaxes = () => {
|
|
159
|
+
const getIncludedTaxes = (isDeliveryFee?: boolean) => {
|
|
160
160
|
if (cart?.taxes === null || !cart?.taxes) {
|
|
161
|
-
return cart
|
|
161
|
+
return cart?.business.tax_type === 1 ? cart?.tax : 0
|
|
162
162
|
} else {
|
|
163
163
|
return cart?.taxes.reduce((taxIncluded: number, tax: any) => {
|
|
164
|
-
return taxIncluded +
|
|
164
|
+
return taxIncluded +
|
|
165
|
+
(((!isDeliveryFee && tax.type === 1 && tax.target === 'product') ||
|
|
166
|
+
(isDeliveryFee && tax.type === 1 && tax.target === 'delivery_fee')) ? tax.summary?.tax : 0)
|
|
165
167
|
}, 0)
|
|
166
168
|
}
|
|
167
169
|
}
|
|
168
170
|
|
|
169
171
|
const getIncludedTaxesDiscounts = () => {
|
|
170
|
-
return cart?.taxes?.filter((tax: any) => tax?.type === 1)?.reduce((carry: number, tax: any) => carry + (tax?.summary?.tax_after_discount ?? tax?.summary?.tax), 0)
|
|
172
|
+
return cart?.taxes?.filter((tax: any) => (tax?.type === 1 && tax?.target === 'product'))?.reduce((carry: number, tax: any) => carry + (tax?.summary?.tax_after_discount ?? tax?.summary?.tax), 0)
|
|
171
173
|
}
|
|
172
174
|
|
|
173
175
|
const OfferAlert = ({ offerId }: any) => {
|
|
@@ -329,7 +331,7 @@ const CartUI = (props: any) => {
|
|
|
329
331
|
</OSTable>
|
|
330
332
|
)}
|
|
331
333
|
{
|
|
332
|
-
cart.taxes?.length > 0 && cart.taxes.filter((tax: any) => tax.type === 2 && tax?.rate !== 0).map((tax: any, i: number) => (
|
|
334
|
+
cart.taxes?.length > 0 && cart.taxes.filter((tax: any) => tax.type === 2 && tax?.rate !== 0 && tax?.target === 'product').map((tax: any, i: number) => (
|
|
333
335
|
<OSTable key={`${tax.id}_${i}`}>
|
|
334
336
|
<OSRow>
|
|
335
337
|
<OText size={12} lineHeight={18} numberOfLines={1} >
|
|
@@ -384,9 +386,25 @@ const CartUI = (props: any) => {
|
|
|
384
386
|
{orderState?.options?.type === 1 && cart?.delivery_price_with_discount > 0 && !hideDeliveryFee && (
|
|
385
387
|
<OSTable>
|
|
386
388
|
<OText size={12} lineHeight={18}>{t('DELIVERY_FEE', 'Delivery Fee')}</OText>
|
|
387
|
-
<OText size={12} lineHeight={18}>{parsePrice(cart?.delivery_price_with_discount)}</OText>
|
|
389
|
+
<OText size={12} lineHeight={18}>{parsePrice(cart?.delivery_price_with_discount + getIncludedTaxes(true))}</OText>
|
|
388
390
|
</OSTable>
|
|
389
391
|
)}
|
|
392
|
+
{
|
|
393
|
+
cart?.taxes?.length > 0 && cart?.taxes?.filter((tax: any) => tax?.type === 2 && tax?.rate !== 0 && tax?.target === 'delivery_fee').map((tax: any, i: number) => (
|
|
394
|
+
<OSTable key={`${tax.description}_${i}`}>
|
|
395
|
+
<OSRow>
|
|
396
|
+
<OText size={12} lineHeight={18} numberOfLines={1}>
|
|
397
|
+
{tax.name || t('INHERIT_FROM_BUSINESS', 'Inherit from business')}
|
|
398
|
+
{`(${verifyDecimals(tax?.rate, parseNumber)}%)`}
|
|
399
|
+
</OText>
|
|
400
|
+
<TouchableOpacity onPress={() => setOpenTaxModal({ open: true, data: tax, type: 'tax' })}>
|
|
401
|
+
<AntIcon name='infocirlceo' size={16} color={theme.colors.primary} />
|
|
402
|
+
</TouchableOpacity>
|
|
403
|
+
</OSRow>
|
|
404
|
+
<OText size={12} lineHeight={18}>{parsePrice(tax?.summary?.tax_after_discount ?? tax?.summary?.tax ?? 0)}</OText>
|
|
405
|
+
</OSTable>
|
|
406
|
+
))
|
|
407
|
+
}
|
|
390
408
|
{
|
|
391
409
|
cart?.offers?.length > 0 && cart?.offers?.filter((offer: any) => offer?.target === 2)?.map((offer: any, i: number) => (
|
|
392
410
|
<OSTable key={`${offer.id}_${i}`}>
|
|
@@ -185,18 +185,18 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
185
185
|
navigation.navigate('BottomTab');
|
|
186
186
|
};
|
|
187
187
|
|
|
188
|
-
const getIncludedTaxes = () => {
|
|
188
|
+
const getIncludedTaxes = (isDeliveryFee?: boolean) => {
|
|
189
189
|
if (order?.taxes?.length === 0 || !order?.taxes) {
|
|
190
190
|
return order.tax_type === 1 ? order?.summary?.tax ?? 0 : 0
|
|
191
191
|
} else {
|
|
192
192
|
return order?.taxes.reduce((taxIncluded: number, tax: any) => {
|
|
193
|
-
return taxIncluded + (tax.type === 1 ? tax.summary?.tax : 0)
|
|
193
|
+
return taxIncluded + (((!isDeliveryFee && tax.type === 1 && tax.target === 'product') || (isDeliveryFee && tax.type === 1 && tax.target === 'delivery_fee')) ? tax.summary?.tax : 0)
|
|
194
194
|
}, 0)
|
|
195
195
|
}
|
|
196
196
|
}
|
|
197
197
|
|
|
198
198
|
const getIncludedTaxesDiscounts = () => {
|
|
199
|
-
return order?.taxes?.filter((tax: any) => tax?.type === 1)?.reduce((carry: number, tax: any) => carry + (tax?.summary?.tax_after_discount ?? tax?.summary?.tax), 0)
|
|
199
|
+
return order?.taxes?.filter((tax: any) => tax?.type === 1 && tax?.target === 'product')?.reduce((carry: number, tax: any) => carry + (tax?.summary?.tax_after_discount ?? tax?.summary?.tax), 0)
|
|
200
200
|
}
|
|
201
201
|
|
|
202
202
|
const handleClickOrderReview = (order: any) => {
|
|
@@ -933,7 +933,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
933
933
|
)
|
|
934
934
|
}
|
|
935
935
|
{
|
|
936
|
-
order?.taxes?.length > 0 && order?.taxes?.filter((tax: any) => tax?.type === 2 && tax?.rate !== 0).map((tax: any) => (
|
|
936
|
+
order?.taxes?.length > 0 && order?.taxes?.filter((tax: any) => tax?.type === 2 && tax?.rate !== 0 && tax?.target === 'product').map((tax: any) => (
|
|
937
937
|
<Table key={tax.id}>
|
|
938
938
|
<OSRow>
|
|
939
939
|
<OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal} numberOfLines={1}>
|
|
@@ -985,9 +985,27 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
985
985
|
{typeof order?.summary?.delivery_price === 'number' && (
|
|
986
986
|
<Table>
|
|
987
987
|
<OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>{t('DELIVERY_FEE', 'Delivery Fee')}</OText>
|
|
988
|
-
<OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>{parsePrice(order?.summary?.delivery_price)}</OText>
|
|
988
|
+
<OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>{parsePrice(order?.summary?.delivery_price) + getIncludedTaxes(true)}</OText>
|
|
989
989
|
</Table>
|
|
990
990
|
)}
|
|
991
|
+
{
|
|
992
|
+
order?.taxes?.length > 0 && order?.taxes?.filter((tax: any) => tax?.type === 2 && tax?.rate !== 0 && tax?.target === 'delivery_fee').map((tax: any, i: number) => (
|
|
993
|
+
<Table key={`${tax?.description}_${i}`}>
|
|
994
|
+
<OSRow>
|
|
995
|
+
<OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal} numberOfLines={1}>
|
|
996
|
+
{t(tax?.name?.toUpperCase()?.replace(/ /g, '_'), tax?.name) || t('INHERIT_FROM_BUSINESS', 'Inherit from business')}
|
|
997
|
+
{`(${verifyDecimals(tax?.rate, parseNumber)}%)`}
|
|
998
|
+
</OText>
|
|
999
|
+
{setOpenTaxModal && (
|
|
1000
|
+
<TouchableOpacity onClick={() => setOpenTaxModal({ open: true, data: tax, type: 'tax' })}>
|
|
1001
|
+
<AntIcon name='infocirlceo' size={16} color={theme.colors.primary} />
|
|
1002
|
+
</TouchableOpacity>
|
|
1003
|
+
)}
|
|
1004
|
+
</OSRow>
|
|
1005
|
+
<OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>{parsePrice(tax?.summary?.tax_after_discount ?? tax?.summary?.tax ?? 0)}</OText>
|
|
1006
|
+
</Table>
|
|
1007
|
+
))
|
|
1008
|
+
}
|
|
991
1009
|
{
|
|
992
1010
|
order?.offers?.length > 0 && order?.offers?.filter((offer: any) => offer?.target === 2)?.map((offer: any) => (
|
|
993
1011
|
<Table key={offer.id}>
|
|
@@ -72,12 +72,14 @@ const OrderSummaryUI = (props: any) => {
|
|
|
72
72
|
}
|
|
73
73
|
}
|
|
74
74
|
|
|
75
|
-
const getIncludedTaxes = () => {
|
|
75
|
+
const getIncludedTaxes = (isDeliveryFee?: boolean) => {
|
|
76
76
|
if (cart?.taxes === null || !cart?.taxes) {
|
|
77
77
|
return cart?.business?.tax_type === 1 ? cart?.tax : 0
|
|
78
78
|
} else {
|
|
79
79
|
return cart?.taxes.reduce((taxIncluded: number, tax: any) => {
|
|
80
|
-
return taxIncluded +
|
|
80
|
+
return taxIncluded +
|
|
81
|
+
(((!isDeliveryFee && tax.type === 1 && tax.target === 'product') ||
|
|
82
|
+
(isDeliveryFee && tax.type === 1 && tax.target === 'delivery_fee')) ? tax.summary?.tax : 0)
|
|
81
83
|
}, 0)
|
|
82
84
|
}
|
|
83
85
|
}
|
|
@@ -102,7 +104,7 @@ const OrderSummaryUI = (props: any) => {
|
|
|
102
104
|
}
|
|
103
105
|
|
|
104
106
|
const getIncludedTaxesDiscounts = () => {
|
|
105
|
-
return cart?.taxes?.filter((tax: any) => tax?.type === 1)?.reduce((carry: number, tax: any) => carry + (tax?.summary?.tax_after_discount ?? tax?.summary?.tax), 0)
|
|
107
|
+
return cart?.taxes?.filter((tax: any) => (tax?.type === 1 && tax?.target === 'product'))?.reduce((carry: number, tax: any) => carry + (tax?.summary?.tax_after_discount ?? tax?.summary?.tax), 0)
|
|
106
108
|
}
|
|
107
109
|
|
|
108
110
|
const OfferAlert = ({ offerId }: any) => {
|
|
@@ -194,7 +196,7 @@ const OrderSummaryUI = (props: any) => {
|
|
|
194
196
|
</OSTable>
|
|
195
197
|
)}
|
|
196
198
|
{
|
|
197
|
-
cart.taxes?.length > 0 && cart.taxes.filter((tax: any) => tax.type === 2 && tax?.rate !== 0).map((tax: any) => (
|
|
199
|
+
cart.taxes?.length > 0 && cart.taxes.filter((tax: any) => tax.type === 2 && tax?.rate !== 0 && tax?.target === 'product').map((tax: any, i: number) => (
|
|
198
200
|
<OSTable key={tax.id}>
|
|
199
201
|
<OSRow>
|
|
200
202
|
<OText size={12} numberOfLines={1} >
|
|
@@ -249,9 +251,25 @@ const OrderSummaryUI = (props: any) => {
|
|
|
249
251
|
{orderState?.options?.type === 1 && !hideDeliveryFee && (
|
|
250
252
|
<OSTable>
|
|
251
253
|
<OText size={12}>{t('DELIVERY_FEE', 'Delivery Fee')}</OText>
|
|
252
|
-
<OText size={12}>{parsePrice(cart?.delivery_price_with_discount)}</OText>
|
|
254
|
+
<OText size={12}>{parsePrice(cart?.delivery_price_with_discount + getIncludedTaxes(true))}</OText>
|
|
253
255
|
</OSTable>
|
|
254
256
|
)}
|
|
257
|
+
{
|
|
258
|
+
cart?.taxes?.length > 0 && cart?.taxes?.filter((tax: any) => tax?.type === 2 && tax?.rate !== 0 && tax?.target === 'delivery_fee').map((tax: any, i: number) => (
|
|
259
|
+
<OSTable key={`${tax.description}_${i}`}>
|
|
260
|
+
<OSRow>
|
|
261
|
+
<OText size={12} numberOfLines={1}>
|
|
262
|
+
{tax.name || t('INHERIT_FROM_BUSINESS', 'Inherit from business')}
|
|
263
|
+
{`(${verifyDecimals(tax?.rate, parseNumber)}%)`}
|
|
264
|
+
</OText>
|
|
265
|
+
<TouchableOpacity onPress={() => setOpenTaxModal({ open: true, data: tax, type: 'tax' })}>
|
|
266
|
+
<AntIcon name='infocirlceo' size={16} color={theme.colors.primary} />
|
|
267
|
+
</TouchableOpacity>
|
|
268
|
+
</OSRow>
|
|
269
|
+
<OText size={12}>{parsePrice(tax?.summary?.tax_after_discount ?? tax?.summary?.tax ?? 0)}</OText>
|
|
270
|
+
</OSTable>
|
|
271
|
+
))
|
|
272
|
+
}
|
|
255
273
|
{
|
|
256
274
|
cart?.offers?.length > 0 && cart?.offers?.filter((offer: any) => offer?.target === 2)?.map((offer: any) => (
|
|
257
275
|
<OSTable key={offer.id}>
|
|
@@ -14,7 +14,8 @@ interface taxInformationParams {
|
|
|
14
14
|
percentage?: number,
|
|
15
15
|
id: number,
|
|
16
16
|
discounts?: any,
|
|
17
|
-
rate_type?: number
|
|
17
|
+
rate_type?: number,
|
|
18
|
+
target?: string
|
|
18
19
|
},
|
|
19
20
|
products: Array<any>,
|
|
20
21
|
type: string
|
|
@@ -34,7 +35,7 @@ export const TaxInformation = (props: taxInformationParams) => {
|
|
|
34
35
|
const offersHideArray = ['offer_target_2', 'offer_target_3']
|
|
35
36
|
const hideProductsSectionOffers = offersHideArray.includes(type)
|
|
36
37
|
const dataHideArray : Array<string | number> = ['platform', 'business']
|
|
37
|
-
const hideProductsSectionData = dataHideArray.includes(data.type)
|
|
38
|
+
const hideProductsSectionData = dataHideArray.includes(data.type) || data?.target === 'delivery_fee'
|
|
38
39
|
|
|
39
40
|
const getFilterValidation = (product: any) => {
|
|
40
41
|
return (
|