ordering-ui-react-native 0.18.44 → 0.18.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/themes/business/src/components/NewOrderNotification/index.tsx +10 -8
- package/themes/original/src/components/MultiCheckout/index.tsx +13 -13
- package/themes/original/src/components/OrderDetails/OrderEta.tsx +3 -2
- package/themes/original/src/components/OrderSummary/index.tsx +3 -4
- package/themes/original/src/components/ProductOptionSubOption/index.tsx +1 -1
- package/themes/original/src/components/StripeCardsList/index.tsx +1 -1
package/package.json
CHANGED
|
@@ -58,14 +58,16 @@ const NewOrderNotificationUI = (props: any) => {
|
|
|
58
58
|
const handlePlayNotificationSound = (eventObj: any = null) => {
|
|
59
59
|
setCurrentEvent(eventObj)
|
|
60
60
|
let times = 1
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
notificationSound.play(
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
61
|
+
_timeout = setInterval(() => {
|
|
62
|
+
if (times <= SOUND_LOOP) {
|
|
63
|
+
notificationSound.play()
|
|
64
|
+
times++
|
|
65
|
+
} else {
|
|
66
|
+
clearInterval(_timeout)
|
|
67
|
+
times = 1
|
|
68
|
+
return
|
|
69
|
+
}
|
|
70
|
+
}, 2500)
|
|
69
71
|
}
|
|
70
72
|
|
|
71
73
|
const handleEventNotification = async (evtType: number, value: any) => {
|
|
@@ -96,14 +96,13 @@ const MultiCheckoutUI = (props: any) => {
|
|
|
96
96
|
? JSON.parse(configs?.driver_tip_options?.value) || []
|
|
97
97
|
: configs?.driver_tip_options?.value || []
|
|
98
98
|
|
|
99
|
-
const
|
|
100
|
-
const
|
|
101
|
-
const loyalBusinessIds = creditPointPlan?.businesses?.filter((b: any) => b.accumulates).map((item: any) => item.business_id) ?? []
|
|
102
|
-
const creditPointPlanOnBusiness = businessIds.every((bid: any) => loyalBusinessIds.includes(bid)) && creditPointPlan
|
|
99
|
+
const creditPointGeneralPlan = loyaltyPlansState?.result?.find((loyal: any) => loyal.type === 'credit_point')
|
|
100
|
+
const loyalBusinessAvailable = creditPointGeneralPlan?.businesses?.filter((b: any) => b.accumulates) ?? []
|
|
103
101
|
|
|
104
|
-
const
|
|
105
|
-
|
|
106
|
-
|
|
102
|
+
const accumulationRateBusiness = (businessId: number) => {
|
|
103
|
+
const value = loyalBusinessAvailable?.find((loyal: any) => loyal.business_id === businessId)?.accumulation_rate ?? 0
|
|
104
|
+
return value || (creditPointGeneralPlan?.accumulation_rate ?? 0)
|
|
105
|
+
}
|
|
107
106
|
|
|
108
107
|
const getIncludedTaxes = (cart: any) => {
|
|
109
108
|
if (cart?.taxes === null || !cart?.taxes) {
|
|
@@ -115,12 +114,13 @@ const MultiCheckoutUI = (props: any) => {
|
|
|
115
114
|
}
|
|
116
115
|
}
|
|
117
116
|
|
|
118
|
-
const
|
|
119
|
-
creditPointPlanOnBusiness?.accumulation_rate
|
|
117
|
+
const clearAmount = (value: any) => parseFloat((Math.trunc(value * 100) / 100).toFixed(configs.format_number_decimal_length?.value ?? 2))
|
|
120
118
|
|
|
121
|
-
const loyaltyRewardValue = (
|
|
122
|
-
|
|
123
|
-
|
|
119
|
+
const loyaltyRewardValue = openCarts.reduce((sum: any, cart: any) => sum + clearAmount((cart?.subtotal + getIncludedTaxes(cart)) * accumulationRateBusiness(cart?.business_id)), 0)
|
|
120
|
+
|
|
121
|
+
const [isUserDetailsEdit, setIsUserDetailsEdit] = useState(false);
|
|
122
|
+
const [phoneUpdate, setPhoneUpdate] = useState(false);
|
|
123
|
+
const [userErrors, setUserErrors] = useState<any>([]);
|
|
124
124
|
|
|
125
125
|
const handleMomentClick = () => {
|
|
126
126
|
if (isPreOrder) {
|
|
@@ -405,7 +405,7 @@ const MultiCheckoutUI = (props: any) => {
|
|
|
405
405
|
</OText>
|
|
406
406
|
<OText size={16} lineHeight={24} color={theme.colors.textNormal} weight={'500'}>{parsePrice(totalCartsPrice)}</OText>
|
|
407
407
|
</View>
|
|
408
|
-
{!!loyaltyRewardValue &&
|
|
408
|
+
{!!loyaltyRewardValue && (
|
|
409
409
|
<View style={{ flexDirection: 'row', marginTop: 10, justifyContent: 'flex-end' }}>
|
|
410
410
|
<OText size={12} color={theme.colors.textNormal}>
|
|
411
411
|
{t('REWARD_LOYALTY_POINT', 'Reward :amount: on loyalty points').replace(':amount:', loyaltyRewardValue)}
|
|
@@ -12,7 +12,7 @@ export const OrderEta = (props: any) => {
|
|
|
12
12
|
const [estimatedDeliveryTime, setEstimatedDeliveryTime] = useState(null)
|
|
13
13
|
|
|
14
14
|
const getEstimatedDeliveryTime = () => {
|
|
15
|
-
let _estimatedTime
|
|
15
|
+
let _estimatedTime = null
|
|
16
16
|
let totalEta = 0
|
|
17
17
|
const _delivery = order?.delivery_datetime_utc
|
|
18
18
|
? order?.delivery_datetime_utc
|
|
@@ -40,7 +40,8 @@ export const OrderEta = (props: any) => {
|
|
|
40
40
|
} else {
|
|
41
41
|
_estimatedTime = moment.utc(_delivery).add(order?.eta_time, 'minutes')
|
|
42
42
|
}
|
|
43
|
-
_estimatedTime =
|
|
43
|
+
if (order?.delivered_in) { _estimatedTime = moment.utc(_delivery).add(order?.delivered_in, 'minutes')}
|
|
44
|
+
_estimatedTime = outputFormat ? moment(_estimatedTime).local().format(outputFormat) : parseDate(_estimatedTime, { utc: false })
|
|
44
45
|
setEstimatedDeliveryTime(_estimatedTime)
|
|
45
46
|
}
|
|
46
47
|
|
|
@@ -83,9 +83,8 @@ const OrderSummaryUI = (props: any) => {
|
|
|
83
83
|
}
|
|
84
84
|
}
|
|
85
85
|
|
|
86
|
-
const
|
|
87
|
-
|
|
88
|
-
).toFixed(configs.format_number_decimal_length?.value ?? 2), 10)
|
|
86
|
+
const clearAmount = (value: any) => parseFloat((Math.trunc(value * 100) / 100).toFixed(configs.format_number_decimal_length?.value ?? 2))
|
|
87
|
+
const loyaltyRewardValue = clearAmount((cart?.subtotal + getIncludedTaxes()) * loyaltyRewardRate)
|
|
89
88
|
|
|
90
89
|
const handleDeleteClick = (product: any) => {
|
|
91
90
|
removeProduct(product, cart)
|
|
@@ -317,7 +316,7 @@ const OrderSummaryUI = (props: any) => {
|
|
|
317
316
|
{parsePrice(cart?.balance >= 0 ? cart?.balance : 0)}
|
|
318
317
|
</OText>
|
|
319
318
|
</OSTable>
|
|
320
|
-
{!!loyaltyRewardValue &&
|
|
319
|
+
{!!loyaltyRewardValue && (
|
|
321
320
|
<OSTable style={{ justifyContent: 'flex-end' }}>
|
|
322
321
|
<OText size={12} color={theme.colors.textNormal}>
|
|
323
322
|
{t('REWARD_LOYALTY_POINT', 'Reward :amount: on loyalty points').replace(':amount:', loyaltyRewardValue)}
|
|
@@ -67,7 +67,7 @@ export const ProductOptionSubOptionUI = (props: any) => {
|
|
|
67
67
|
|
|
68
68
|
return (
|
|
69
69
|
<View>
|
|
70
|
-
<Container onPress={() => handleSuboptionClick()}>
|
|
70
|
+
<Container onPress={!(option?.with_half_option || option?.allow_suboption_quantity) ? () => handleSuboptionClick() : null}>
|
|
71
71
|
<IconControl disabled={disabled} onPress={() => handleSuboptionClick()}>
|
|
72
72
|
{((option?.min === 0 && option?.max === 1) || option?.max > 1) ? (
|
|
73
73
|
state?.selected ? (
|
|
@@ -39,7 +39,7 @@ const StripeCardsListUI = (props: any) => {
|
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
useEffect(() => {
|
|
42
|
-
if (!cardsList?.loading && cardsList?.cards?.length === 0) {
|
|
42
|
+
if (!cardsList && !cardsList?.loading && cardsList?.cards?.length === 0) {
|
|
43
43
|
setAddCardOpen(true)
|
|
44
44
|
}
|
|
45
45
|
}, [cardsList?.loading])
|