ordering-ui-react-native 0.17.71 → 0.17.72-release
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 +8 -7
- package/src/DeliveryApp.tsx +43 -1
- package/src/components/BusinessInformation/index.tsx +10 -9
- package/src/components/BusinessesListing/index.tsx +1 -1
- package/src/components/OrderCreating/index.tsx +1 -21
- package/src/components/PaymentOptionsWebView/index.tsx +29 -8
- package/src/components/PhoneInputNumber/index.tsx +6 -2
- package/src/components/StripeMethodForm/index.tsx +136 -102
- package/src/components/VerifyPhone/styles.tsx +1 -2
- package/src/components/shared/OToast.tsx +3 -2
- package/src/types/index.tsx +5 -0
- package/src/utils/index.tsx +5 -0
- package/themes/business/index.tsx +2 -0
- package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +28 -24
- package/themes/business/src/components/BusinessController/index.tsx +0 -1
- package/themes/business/src/components/Chat/index.tsx +149 -118
- package/themes/business/src/components/DriverMap/index.tsx +17 -6
- package/themes/business/src/components/DriverSchedule/index.tsx +45 -8
- package/themes/business/src/components/GoogleMap/index.tsx +58 -57
- package/themes/business/src/components/LoginForm/Otp/index.tsx +31 -3
- package/themes/business/src/components/LoginForm/index.tsx +15 -22
- package/themes/business/src/components/MapView/index.tsx +10 -10
- package/themes/business/src/components/MessagesOption/index.tsx +20 -93
- package/themes/business/src/components/NewOrderNotification/index.tsx +35 -21
- package/themes/business/src/components/NotFoundSource/index.tsx +2 -2
- package/themes/business/src/components/OrderDetails/Business.tsx +1 -1
- package/themes/business/src/components/OrderDetails/Delivery.tsx +191 -6
- package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +103 -39
- package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +61 -60
- package/themes/business/src/components/OrderDetailsLogistic/index.tsx +195 -0
- package/themes/business/src/components/OrderDetailsLogistic/styles.tsx +5 -0
- package/themes/business/src/components/OrderMessage/index.tsx +19 -18
- package/themes/business/src/components/OrderSummary/index.tsx +114 -123
- package/themes/business/src/components/OrdersOption/index.tsx +17 -15
- package/themes/business/src/components/PreviousMessages/FooterMessageComponent.tsx +103 -0
- package/themes/business/src/components/PreviousMessages/index.tsx +97 -55
- package/themes/business/src/components/PreviousOrders/OrderItem.tsx +17 -12
- package/themes/business/src/components/PreviousOrders/OrderList.tsx +88 -0
- package/themes/business/src/components/PreviousOrders/OrdersGroupedItem.tsx +1 -1
- package/themes/business/src/components/PreviousOrders/index.tsx +186 -114
- package/themes/business/src/components/PreviousOrders/styles.tsx +1 -1
- package/themes/business/src/components/ProductItemAccordion/index.tsx +27 -3
- package/themes/business/src/components/ReviewCustomer/index.tsx +18 -13
- package/themes/business/src/components/StoresList/index.tsx +3 -4
- package/themes/business/src/components/UserProfileForm/index.tsx +14 -15
- package/themes/business/src/components/shared/OLink.tsx +11 -3
- package/themes/business/src/components/shared/OModal.tsx +16 -9
- package/themes/business/src/components/shared/OText.tsx +6 -1
- package/themes/business/src/types/index.tsx +25 -10
- package/themes/business/src/utils/index.tsx +29 -2
- package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
- package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
- package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
- package/themes/kiosk/src/components/Checkout/index.tsx +6 -0
- package/themes/kiosk/src/components/Intro/index.tsx +16 -1
- package/themes/kiosk/src/components/LoginForm/index.tsx +7 -9
- package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
- package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
- package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +8 -10
- package/themes/kiosk/src/components/PhoneInputNumber/index.tsx +2 -2
- package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
- package/themes/original/index.tsx +1 -1
- package/themes/original/src/components/AddressDetails/index.tsx +19 -3
- package/themes/original/src/components/AddressForm/index.tsx +61 -39
- package/themes/original/src/components/AddressList/index.tsx +25 -24
- package/themes/original/src/components/AddressList/styles.tsx +4 -2
- package/themes/original/src/components/AnalyticsSegment/index.tsx +193 -10
- package/themes/original/src/components/AppleLogin/index.tsx +4 -4
- package/themes/original/src/components/AppleLogin/styles.tsx +3 -1
- package/themes/original/src/components/BusinessBasicInformation/index.tsx +153 -96
- package/themes/original/src/components/BusinessBasicInformation/styles.tsx +10 -12
- package/themes/original/src/components/BusinessController/index.tsx +80 -66
- package/themes/original/src/components/BusinessController/styles.tsx +12 -5
- package/themes/original/src/components/BusinessFeaturedController/index.tsx +21 -54
- package/themes/original/src/components/BusinessFeaturedController/styles.tsx +8 -0
- package/themes/original/src/components/BusinessInformation/index.tsx +139 -85
- package/themes/original/src/components/BusinessItemAccordion/index.tsx +15 -20
- package/themes/original/src/components/BusinessListingSearch/index.tsx +349 -339
- package/themes/original/src/components/BusinessListingSearch/styles.tsx +0 -18
- package/themes/original/src/components/BusinessPreorder/index.tsx +103 -19
- package/themes/original/src/components/BusinessProductsCategories/index.tsx +1 -2
- package/themes/original/src/components/BusinessProductsList/index.tsx +15 -7
- package/themes/original/src/components/BusinessProductsList/styles.tsx +8 -3
- package/themes/original/src/components/BusinessProductsListing/UpsellingRedirect.tsx +1 -1
- package/themes/original/src/components/BusinessProductsListing/index.tsx +684 -555
- package/themes/original/src/components/BusinessProductsListing/styles.tsx +2 -2
- package/themes/original/src/components/BusinessReviews/index.tsx +3 -1
- package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +69 -38
- package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +0 -1
- package/themes/original/src/components/BusinessesListing/index.tsx +0 -1
- package/themes/original/src/components/Cart/index.tsx +77 -79
- package/themes/original/src/components/CartContent/index.tsx +117 -20
- package/themes/original/src/components/CartContent/styles.tsx +17 -7
- package/themes/original/src/components/Checkout/index.tsx +356 -124
- package/themes/original/src/components/CitiesControl/index.tsx +1 -1
- package/themes/original/src/components/CouponControl/index.tsx +10 -3
- package/themes/original/src/components/DriverTips/index.tsx +52 -34
- package/themes/original/src/components/FacebookLogin/styles.tsx +3 -1
- package/themes/original/src/components/Favorite/index.tsx +2 -6
- package/themes/original/src/components/FavoriteList/index.tsx +1 -35
- package/themes/original/src/components/FloatingButton/index.tsx +10 -13
- package/themes/original/src/components/GPSButton/index.tsx +6 -4
- package/themes/original/src/components/GiftCard/GiftCardUI/index.tsx +96 -0
- package/themes/original/src/components/GiftCard/GiftCardUI/styles.tsx +5 -0
- package/themes/original/src/components/GiftCard/PurchaseGiftCard/index.tsx +100 -0
- package/themes/original/src/components/GiftCard/PurchaseGiftCard/styles.tsx +8 -0
- package/themes/original/src/components/GiftCard/RedeemGiftCard/index.tsx +191 -0
- package/themes/original/src/components/GiftCard/RedeemGiftCard/styles.tsx +8 -0
- package/themes/original/src/components/GiftCard/SendGiftCard/index.tsx +165 -0
- package/themes/original/src/components/GiftCard/SendGiftCard/styles.tsx +9 -0
- package/themes/original/src/components/GoogleLogin/styles.tsx +1 -1
- package/themes/original/src/components/GoogleMap/index.tsx +60 -5
- package/themes/original/src/components/Help/index.tsx +2 -2
- package/themes/original/src/components/HelpAccountAndPayment/index.tsx +10 -31
- package/themes/original/src/components/HelpAccountAndPayment/styles.tsx +5 -3
- package/themes/original/src/components/HelpGuide/index.tsx +6 -6
- package/themes/original/src/components/HelpGuide/styles.tsx +6 -0
- package/themes/original/src/components/HelpOrder/index.tsx +6 -15
- package/themes/original/src/components/HelpOrder/styles.tsx +8 -1
- package/themes/original/src/components/Home/index.tsx +13 -4
- package/themes/original/src/components/LastOrder/index.tsx +1 -34
- package/themes/original/src/components/LoginForm/Otp/index.tsx +91 -25
- package/themes/original/src/components/LoginForm/index.tsx +64 -34
- package/themes/original/src/components/LottieAnimation/index.tsx +88 -63
- package/themes/original/src/components/MessageListing/index.tsx +16 -42
- package/themes/original/src/components/Messages/index.tsx +14 -7
- package/themes/original/src/components/MomentOption/index.tsx +193 -90
- package/themes/original/src/components/MomentSelector/index.tsx +1 -1
- package/themes/original/src/components/MultiCart/index.tsx +41 -54
- package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +162 -50
- package/themes/original/src/components/MultiCheckout/index.tsx +329 -100
- package/themes/original/src/components/MultiCheckout/styles.tsx +3 -1
- package/themes/original/src/components/MultiOrdersDetails/SingleOrderCard.tsx +37 -224
- package/themes/original/src/components/MultiOrdersDetails/index.tsx +54 -21
- package/themes/original/src/components/MultiOrdersDetails/styles.tsx +1 -1
- package/themes/original/src/components/MyOrders/index.tsx +40 -29
- package/themes/original/src/components/NavBar/index.tsx +20 -17
- package/themes/original/src/components/NotFoundSource/index.tsx +14 -10
- package/themes/original/src/components/Notifications/index.tsx +42 -52
- package/themes/original/src/components/Notifications/styles.tsx +6 -3
- package/themes/original/src/components/OrderDetails/OrderEta.tsx +76 -0
- package/themes/original/src/components/OrderDetails/OrderHistory.tsx +21 -5
- package/themes/original/src/components/OrderDetails/index.tsx +191 -363
- package/themes/original/src/components/OrderDetails/styles.tsx +0 -1
- package/themes/original/src/components/OrderItAgain/index.tsx +3 -1
- package/themes/original/src/components/OrderProgress/index.tsx +30 -56
- package/themes/original/src/components/OrderSummary/index.tsx +88 -59
- package/themes/original/src/components/OrderTypeSelector/index.tsx +2 -1
- package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/index.tsx +14 -14
- package/themes/original/src/components/OrdersOption/index.tsx +68 -87
- package/themes/original/src/components/OrdersOption/styles.tsx +1 -1
- package/themes/original/src/components/PageBanner/index.tsx +98 -38
- package/themes/original/src/components/PageBanner/styles.tsx +0 -10
- package/themes/original/src/components/PaymentOptionCard/index.tsx +180 -0
- package/themes/original/src/components/PaymentOptionStripe/styles.tsx +1 -1
- package/themes/original/src/components/PaymentOptionWallet/index.tsx +56 -56
- package/themes/original/src/components/PaymentOptions/index.tsx +78 -35
- package/themes/original/src/components/PhoneInputNumber/index.tsx +18 -4
- package/themes/original/src/components/ProductForm/index.tsx +104 -29
- package/themes/original/src/components/ProductForm/styles.tsx +5 -5
- package/themes/original/src/components/ProductItemAccordion/index.tsx +12 -9
- package/themes/original/src/components/ProductOptionSubOption/index.tsx +20 -18
- package/themes/original/src/components/ProductOptionSubOption/styles.tsx +5 -9
- package/themes/original/src/components/ProfessionalFilter/SingleProfessionalCard/index.tsx +108 -0
- package/themes/original/src/components/ProfessionalFilter/index.tsx +20 -50
- package/themes/original/src/components/ProfessionalProfile/index.tsx +36 -7
- package/themes/original/src/components/Promotions/index.tsx +2 -2
- package/themes/original/src/components/Promotions/styles.tsx +3 -1
- package/themes/original/src/components/ReviewProducts/index.tsx +16 -7
- package/themes/original/src/components/ScheduleAccordion/index.tsx +3 -3
- package/themes/original/src/components/ServiceForm/index.tsx +66 -17
- package/themes/original/src/components/Sessions/index.tsx +11 -8
- package/themes/original/src/components/Sessions/styles.tsx +5 -0
- package/themes/original/src/components/SignupForm/index.tsx +43 -27
- package/themes/original/src/components/SingleOrderCard/index.tsx +102 -63
- package/themes/original/src/components/SingleOrderCard/styles.tsx +1 -1
- package/themes/original/src/components/SingleProductCard/index.tsx +72 -31
- package/themes/original/src/components/SingleProductCard/styles.tsx +20 -4
- package/themes/original/src/components/SingleProductReview/styles.tsx +1 -1
- package/themes/original/src/components/StripeCardsList/index.tsx +49 -5
- package/themes/original/src/components/StripeElementsForm/index.tsx +48 -34
- package/themes/original/src/components/StripeElementsForm/naked.tsx +12 -1
- package/themes/original/src/components/UpsellingProducts/index.tsx +238 -224
- package/themes/original/src/components/UpsellingProducts/styles.tsx +12 -1
- package/themes/original/src/components/UserDetails/index.tsx +3 -1
- package/themes/original/src/components/UserFormDetails/index.tsx +76 -7
- package/themes/original/src/components/UserFormDetails/styles.tsx +1 -1
- package/themes/original/src/components/UserProfile/index.tsx +88 -79
- package/themes/original/src/components/UserProfileForm/index.tsx +17 -21
- package/themes/original/src/components/UserProfileForm/styles.tsx +7 -0
- package/themes/original/src/components/UserVerification/index.tsx +55 -50
- package/themes/original/src/components/WalletTransactionItem/index.tsx +2 -2
- package/themes/original/src/components/WalletTransactions/index.tsx +3 -3
- package/themes/original/src/components/Wallets/index.tsx +66 -30
- package/themes/original/src/components/Wallets/styles.tsx +3 -4
- package/themes/original/src/components/shared/OButton.tsx +6 -2
- package/themes/original/src/components/shared/OInput.tsx +6 -1
- package/themes/original/src/components/shared/OModal.tsx +3 -3
- package/themes/original/src/types/index.tsx +41 -11
- package/themes/original/src/utils/index.tsx +273 -1
- package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
import { View } from 'react-native'
|
|
3
|
-
import { OButton,
|
|
3
|
+
import { OButton, OText } from '../shared'
|
|
4
4
|
import { NotFoundSourceParams } from '../../types'
|
|
5
5
|
import { useTheme } from 'styled-components/native';
|
|
6
|
+
import Foundation from 'react-native-vector-icons/Foundation'
|
|
6
7
|
import {
|
|
7
8
|
NotFound,
|
|
8
9
|
NotFoundImage
|
|
@@ -10,34 +11,37 @@ import {
|
|
|
10
11
|
|
|
11
12
|
export const NotFoundSource = (props: NotFoundSourceParams) => {
|
|
12
13
|
const {
|
|
13
|
-
|
|
14
|
+
hideImage,
|
|
14
15
|
content,
|
|
15
16
|
btnTitle,
|
|
17
|
+
btnStyle,
|
|
16
18
|
conditioned,
|
|
17
19
|
onClickButton
|
|
18
20
|
} = props
|
|
19
21
|
|
|
20
22
|
const theme = useTheme();
|
|
21
23
|
|
|
22
|
-
const errorImage = image || theme.images.general.notFound
|
|
23
|
-
const isUrl = typeof errorImage === 'string' && errorImage.includes('http')
|
|
24
|
-
|
|
25
24
|
return (
|
|
26
25
|
<NotFound>
|
|
27
|
-
{
|
|
26
|
+
{!hideImage && (
|
|
28
27
|
<NotFoundImage>
|
|
29
|
-
<
|
|
28
|
+
<Foundation
|
|
29
|
+
name='page-search'
|
|
30
|
+
color={theme.colors.primary}
|
|
31
|
+
size={60}
|
|
32
|
+
style={{ marginBottom: 10 }}
|
|
33
|
+
/>
|
|
30
34
|
</NotFoundImage>
|
|
31
35
|
)}
|
|
32
|
-
{content && conditioned &&
|
|
33
|
-
{content && !conditioned && <OText color={theme.colors.disabled} size={
|
|
36
|
+
{content && conditioned && <OText color={theme.colors.disabled} size={16} style={{ textAlign: 'center' }}>{content}</OText>}
|
|
37
|
+
{content && !conditioned && <OText color={theme.colors.disabled} size={16} style={{ textAlign: 'center' }}>{content}</OText>}
|
|
34
38
|
{!onClickButton && props.children && (
|
|
35
39
|
props.children
|
|
36
40
|
)}
|
|
37
41
|
{onClickButton && (
|
|
38
42
|
<View style={{ marginTop: 10, width: '100%' }}>
|
|
39
43
|
<OButton
|
|
40
|
-
style={{ width: '100%', height: 50 }}
|
|
44
|
+
style={{ width: '100%', height: 50, ...btnStyle }}
|
|
41
45
|
bgColor={theme.colors.primary}
|
|
42
46
|
borderColor={theme.colors.primary}
|
|
43
47
|
onClick={() => onClickButton()}
|
|
@@ -7,13 +7,12 @@ import {
|
|
|
7
7
|
useToast,
|
|
8
8
|
ToastType,
|
|
9
9
|
} from 'ordering-components/native'
|
|
10
|
-
import { NotificationsGroupSwitchWrapper, SwitchWrapper } from './styles'
|
|
11
|
-
import {
|
|
10
|
+
import { NotificationsGroupSwitchWrapper, SwitchWrapper, Container } from './styles'
|
|
11
|
+
import { StyleSheet, View } from 'react-native'
|
|
12
12
|
import { useState } from 'react'
|
|
13
13
|
import { useTheme } from 'styled-components/native';
|
|
14
14
|
import Spinner from 'react-native-loading-spinner-overlay';
|
|
15
15
|
import ToggleSwitch from 'toggle-switch-react-native'
|
|
16
|
-
import { Container } from '../../layouts/Container'
|
|
17
16
|
import NavBar from '../NavBar'
|
|
18
17
|
import { OText } from '../shared'
|
|
19
18
|
|
|
@@ -70,10 +69,7 @@ const NotificationsUI = (props: any) => {
|
|
|
70
69
|
}, [notificationsList])
|
|
71
70
|
|
|
72
71
|
return (
|
|
73
|
-
<Container
|
|
74
|
-
noPadding
|
|
75
|
-
pt={10}
|
|
76
|
-
>
|
|
72
|
+
<Container>
|
|
77
73
|
<NavBar
|
|
78
74
|
title={t('NOTIFICATIONS', 'Notifications')}
|
|
79
75
|
titleAlign={'center'}
|
|
@@ -87,47 +83,45 @@ const NotificationsUI = (props: any) => {
|
|
|
87
83
|
{showCustomerPromotions && showNotifications && (
|
|
88
84
|
<>
|
|
89
85
|
<Spinner visible={singleNotifications?.loading} />
|
|
90
|
-
<
|
|
91
|
-
<
|
|
92
|
-
|
|
93
|
-
<
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
<
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
<
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
</NotificationsGroupSwitchWrapper>
|
|
130
|
-
</View>
|
|
86
|
+
<NotificationsGroupSwitchWrapper>
|
|
87
|
+
<OText style={{ ...styles.title }}>{t('MARKETING_NOTIFICATIONS', 'Marketing Notifications')}</OText>
|
|
88
|
+
<SwitchWrapper>
|
|
89
|
+
<OText>{t('EMAILS', 'Emails')}</OText>
|
|
90
|
+
<ToggleSwitch
|
|
91
|
+
isOn={notificationsList?.email}
|
|
92
|
+
onColor={theme.colors.primary}
|
|
93
|
+
size="small"
|
|
94
|
+
disabled={singleNotifications?.loading}
|
|
95
|
+
offColor={theme.colors.disabled}
|
|
96
|
+
animationSpeed={400}
|
|
97
|
+
onToggle={() => handleEditNotifications('email', !notificationsList?.email)}
|
|
98
|
+
/>
|
|
99
|
+
</SwitchWrapper>
|
|
100
|
+
<SwitchWrapper>
|
|
101
|
+
<OText>{t('SMS', 'Sms')}</OText>
|
|
102
|
+
<ToggleSwitch
|
|
103
|
+
isOn={notificationsList?.sms}
|
|
104
|
+
onColor={theme.colors.primary}
|
|
105
|
+
size="small"
|
|
106
|
+
disabled={singleNotifications?.loading}
|
|
107
|
+
offColor={theme.colors.disabled}
|
|
108
|
+
animationSpeed={400}
|
|
109
|
+
onToggle={() => handleEditNotifications('sms', !notificationsList?.sms)}
|
|
110
|
+
/>
|
|
111
|
+
</SwitchWrapper>
|
|
112
|
+
<SwitchWrapper>
|
|
113
|
+
<OText>{t('PUSH_NOTIFICATIONS', 'Push Notifications')}</OText>
|
|
114
|
+
<ToggleSwitch
|
|
115
|
+
isOn={notificationsList?.notification}
|
|
116
|
+
onColor={theme.colors.primary}
|
|
117
|
+
size="small"
|
|
118
|
+
disabled={singleNotifications?.loading}
|
|
119
|
+
offColor={theme.colors.disabled}
|
|
120
|
+
animationSpeed={400}
|
|
121
|
+
onToggle={() => handleEditNotifications('notification', !notificationsList?.notification)}
|
|
122
|
+
/>
|
|
123
|
+
</SwitchWrapper>
|
|
124
|
+
</NotificationsGroupSwitchWrapper>
|
|
131
125
|
</>
|
|
132
126
|
)}
|
|
133
127
|
</Container>
|
|
@@ -138,10 +132,6 @@ const styles = StyleSheet.create({
|
|
|
138
132
|
title: {
|
|
139
133
|
marginBottom: 24,
|
|
140
134
|
fontWeight: 'bold',
|
|
141
|
-
},
|
|
142
|
-
pagePadding: {
|
|
143
|
-
paddingLeft: 40,
|
|
144
|
-
paddingRight: 40
|
|
145
135
|
}
|
|
146
136
|
});
|
|
147
137
|
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import styled from 'styled-components/native'
|
|
2
2
|
|
|
3
|
-
export const
|
|
4
|
-
|
|
3
|
+
export const Container = styled.ScrollView`
|
|
4
|
+
position: relative;
|
|
5
|
+
flex: 1;
|
|
6
|
+
padding: 20px;
|
|
5
7
|
`
|
|
6
8
|
|
|
7
9
|
export const NotificationsGroupSwitchWrapper = styled.View`
|
|
8
10
|
flex-grow: 1;
|
|
9
11
|
justify-content: space-between;
|
|
12
|
+
padding: 0 20px;
|
|
10
13
|
`
|
|
11
14
|
|
|
12
15
|
export const SwitchWrapper = styled.View`
|
|
@@ -14,4 +17,4 @@ export const SwitchWrapper = styled.View`
|
|
|
14
17
|
justify-content: space-between;
|
|
15
18
|
align-items: center;
|
|
16
19
|
margin-bottom: 12px;
|
|
17
|
-
`
|
|
20
|
+
`
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import React, { useEffect, useState } from 'react'
|
|
2
|
+
import { useUtils } from 'ordering-components/native'
|
|
3
|
+
import moment from 'moment'
|
|
4
|
+
|
|
5
|
+
export const OrderEta = (props: any) => {
|
|
6
|
+
const {
|
|
7
|
+
order,
|
|
8
|
+
outputFormat
|
|
9
|
+
} = props
|
|
10
|
+
|
|
11
|
+
const [{ parseDate }] = useUtils()
|
|
12
|
+
const [estimatedDeliveryTime, setEstimatedDeliveryTime] = useState(null)
|
|
13
|
+
|
|
14
|
+
const getEstimatedDeliveryTime = () => {
|
|
15
|
+
let estimatedUtcTime = null
|
|
16
|
+
let totalEta = 0
|
|
17
|
+
if (order?.delivered_in) totalEta += order?.delivered_in
|
|
18
|
+
if (order?.prepared_in) totalEta += order?.prepared_in
|
|
19
|
+
if (order?.delivery_type === 1 && order?.eta_drive_time) {
|
|
20
|
+
totalEta += order?.eta_drive_time
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const _delivery = order?.delivery_datetime_utc
|
|
24
|
+
? order?.delivery_datetime_utc
|
|
25
|
+
: order?.delivery_datetime
|
|
26
|
+
|
|
27
|
+
if (order?.eta_current_status_time) {
|
|
28
|
+
const currentStatueEta = order?.eta_current_status_time
|
|
29
|
+
totalEta += currentStatueEta
|
|
30
|
+
let previousStatusTimes = 0
|
|
31
|
+
if (order?.eta_previous_status_times) {
|
|
32
|
+
Object.keys(order.eta_previous_status_times).map(key => {
|
|
33
|
+
if (!key.includes('status_penalty')) {
|
|
34
|
+
previousStatusTimes += order.eta_previous_status_times[key]
|
|
35
|
+
}
|
|
36
|
+
})
|
|
37
|
+
}
|
|
38
|
+
totalEta += previousStatusTimes
|
|
39
|
+
|
|
40
|
+
let nextStatusTimes = 0
|
|
41
|
+
if (order?.eta_next_status_times) {
|
|
42
|
+
Object.keys(order.eta_next_status_times).map(key => {
|
|
43
|
+
if (!key.includes('status_penalty')) {
|
|
44
|
+
nextStatusTimes += order.eta_next_status_times[key]
|
|
45
|
+
}
|
|
46
|
+
})
|
|
47
|
+
}
|
|
48
|
+
totalEta += nextStatusTimes
|
|
49
|
+
|
|
50
|
+
const diffTimeAsSeconds = moment.utc(order?.reporting_data?.at[`status:${order.status}`]).add(order?.eta_current_status_time, 'minutes').diff(moment().utc(), 'seconds')
|
|
51
|
+
const diffTimeAsMinutes = Math.ceil(diffTimeAsSeconds / 60)
|
|
52
|
+
if (diffTimeAsMinutes <= 0) {
|
|
53
|
+
totalEta += (Math.floor(Math.abs(diffTimeAsMinutes / order?.eta_current_status_time) + 1) * order?.eta_current_status_penalty_time)
|
|
54
|
+
}
|
|
55
|
+
} else {
|
|
56
|
+
totalEta = order?.eta_time + totalEta
|
|
57
|
+
}
|
|
58
|
+
estimatedUtcTime = moment.utc(_delivery).add(totalEta, 'minutes')
|
|
59
|
+
const _estimatedTime = outputFormat ? moment(estimatedUtcTime).local().format(outputFormat) : parseDate(estimatedUtcTime, { utc: false })
|
|
60
|
+
setEstimatedDeliveryTime(_estimatedTime)
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
useEffect(() => {
|
|
64
|
+
getEstimatedDeliveryTime()
|
|
65
|
+
const interval = setInterval(() => {
|
|
66
|
+
getEstimatedDeliveryTime()
|
|
67
|
+
}, 1000)
|
|
68
|
+
return () => clearInterval(interval)
|
|
69
|
+
}, [order, outputFormat])
|
|
70
|
+
|
|
71
|
+
return (
|
|
72
|
+
<>
|
|
73
|
+
{estimatedDeliveryTime}
|
|
74
|
+
</>
|
|
75
|
+
)
|
|
76
|
+
}
|
|
@@ -4,6 +4,7 @@ import { ScrollView, StyleSheet, View } from 'react-native'
|
|
|
4
4
|
import { useLanguage, useUtils } from 'ordering-components/native'
|
|
5
5
|
import MaterialCommunityIcons from 'react-native-vector-icons/MaterialCommunityIcons'
|
|
6
6
|
import { OText, OButton } from '../shared'
|
|
7
|
+
import { formatSeconds } from '../../utils'
|
|
7
8
|
|
|
8
9
|
export const OrderHistory = (props: any) => {
|
|
9
10
|
const {
|
|
@@ -61,7 +62,7 @@ export const OrderHistory = (props: any) => {
|
|
|
61
62
|
20: 'ORDER_CUSTOMER_ALMOST_ARRIVED_BUSINESS',
|
|
62
63
|
21: 'ORDER_CUSTOMER_ARRIVED_BUSINESS',
|
|
63
64
|
22: 'ORDER_LOOKING_FOR_DRIVER',
|
|
64
|
-
|
|
65
|
+
23: 'ORDER_DRIVER_ON_WAY'
|
|
65
66
|
}
|
|
66
67
|
|
|
67
68
|
const getLogisticTagStatus = (status: any) => {
|
|
@@ -106,8 +107,12 @@ export const OrderHistory = (props: any) => {
|
|
|
106
107
|
ellipsizeMode='tail'
|
|
107
108
|
>
|
|
108
109
|
{t('ORDER_PLACED', 'Order placed')} {' '}
|
|
109
|
-
{
|
|
110
|
-
|
|
110
|
+
{!props.hideViaText && (
|
|
111
|
+
<>
|
|
112
|
+
{t('VIA', 'Via')}{' '}
|
|
113
|
+
{order.app_id ? t(order.app_id.toUpperCase(), order.app_id) : t('OTHER', 'Other')}
|
|
114
|
+
</>
|
|
115
|
+
)}
|
|
111
116
|
</OText>
|
|
112
117
|
<OText size={12}>{parseDate(order?.created_at, { outputFormat: 'MMM DD, hh:mm A' })}</OText>
|
|
113
118
|
</View>
|
|
@@ -128,12 +133,23 @@ export const OrderHistory = (props: any) => {
|
|
|
128
133
|
<OText
|
|
129
134
|
size={14}
|
|
130
135
|
weight='bold'
|
|
131
|
-
numberOfLines={1}
|
|
136
|
+
numberOfLines={message.change?.attribute.includes(['delivered_in', 'prepared_in']) ? 2 : 1}
|
|
132
137
|
ellipsizeMode='tail'
|
|
133
138
|
>
|
|
134
139
|
{message.change?.attribute === 'logistic_status'
|
|
135
140
|
? getLogisticTagStatus(parseInt(message.change.new, 10))
|
|
136
|
-
:
|
|
141
|
+
: message.change?.attribute === 'delivered_in' ? (
|
|
142
|
+
<>
|
|
143
|
+
{t('TIME_ADDED_BY_DRIVER', 'Time added by driver')}{'\n'}
|
|
144
|
+
{formatSeconds(parseInt(message.change.new, 10))}
|
|
145
|
+
</>
|
|
146
|
+
)
|
|
147
|
+
: message.change?.attribute === 'prepared_in' ? (
|
|
148
|
+
<>
|
|
149
|
+
{t('TIME_ADDED_BY_BUSINESS', 'Time added by business')}{'\n'}
|
|
150
|
+
{formatSeconds(parseInt(message.change.new, 10))}
|
|
151
|
+
</>
|
|
152
|
+
) : t(ORDER_STATUS[parseInt(message.change.new, 10)])
|
|
137
153
|
}
|
|
138
154
|
</OText>
|
|
139
155
|
) : (
|