ordering-ui-react-native 0.17.75 → 0.17.76-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 -25
- 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 +128 -96
- 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 +102 -40
- 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 +20 -22
- 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 +139 -174
- 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 +9 -2
- 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 +11 -6
- 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 +81 -68
- 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 +140 -85
- package/themes/original/src/components/BusinessItemAccordion/index.tsx +15 -20
- package/themes/original/src/components/BusinessListingSearch/index.tsx +348 -340
- 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 -559
- package/themes/original/src/components/BusinessProductsListing/styles.tsx +1 -1
- 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 +76 -79
- package/themes/original/src/components/CartContent/index.tsx +112 -19
- package/themes/original/src/components/CartContent/styles.tsx +16 -6
- package/themes/original/src/components/Checkout/index.tsx +281 -55
- 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/PurchaseGiftCard/index.tsx +7 -3
- package/themes/original/src/components/GiftCard/PurchaseGiftCard/styles.tsx +2 -0
- package/themes/original/src/components/GiftCard/RedeemGiftCard/index.tsx +19 -6
- 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/HelpGuide/index.tsx +2 -2
- package/themes/original/src/components/HelpGuide/styles.tsx +1 -0
- 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 +37 -24
- package/themes/original/src/components/NavBar/index.tsx +20 -12
- package/themes/original/src/components/NotFoundSource/index.tsx +14 -10
- package/themes/original/src/components/Notifications/styles.tsx +1 -5
- 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 +28 -233
- 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 +83 -57
- 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 +67 -85
- 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 +77 -34
- package/themes/original/src/components/PhoneInputNumber/index.tsx +18 -4
- package/themes/original/src/components/ProductForm/index.tsx +101 -34
- package/themes/original/src/components/ProductForm/styles.tsx +3 -3
- package/themes/original/src/components/ProductItemAccordion/index.tsx +8 -6
- 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 +63 -20
- 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 +78 -9
- package/themes/original/src/components/UserFormDetails/styles.tsx +1 -1
- package/themes/original/src/components/UserProfile/index.tsx +87 -76
- package/themes/original/src/components/UserProfileForm/index.tsx +10 -3
- package/themes/original/src/components/UserProfileForm/styles.tsx +1 -1
- 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 +56 -33
- 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 +39 -10
- package/themes/original/src/utils/index.tsx +273 -1
- package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
- package/src/navigators/BottomNavigator.tsx +0 -117
- package/src/navigators/CheckoutNavigator.tsx +0 -66
- package/src/navigators/HomeNavigator.tsx +0 -202
- package/src/navigators/NavigationRef.tsx +0 -7
- package/src/navigators/RootNavigator.tsx +0 -269
- package/src/pages/Account.tsx +0 -34
- package/src/pages/AddressForm.tsx +0 -62
- package/src/pages/AddressList.tsx +0 -24
- package/src/pages/BusinessProductsList.tsx +0 -81
- package/src/pages/BusinessesListing.tsx +0 -43
- package/src/pages/CartList.tsx +0 -49
- package/src/pages/Checkout.tsx +0 -101
- package/src/pages/ForgotPassword.tsx +0 -24
- package/src/pages/Help.tsx +0 -23
- package/src/pages/HelpAccountAndPayment.tsx +0 -23
- package/src/pages/HelpGuide.tsx +0 -23
- package/src/pages/HelpOrder.tsx +0 -23
- package/src/pages/Home.tsx +0 -36
- package/src/pages/IntroductoryTutorial.tsx +0 -170
- package/src/pages/Login.tsx +0 -47
- package/src/pages/MomentOption.tsx +0 -30
- package/src/pages/MultiCheckout.tsx +0 -31
- package/src/pages/MultiOrdersDetails.tsx +0 -27
- package/src/pages/MyOrders.tsx +0 -40
- package/src/pages/NetworkError.tsx +0 -24
- package/src/pages/NotFound.tsx +0 -22
- package/src/pages/OrderDetails.tsx +0 -25
- package/src/pages/ProductDetails.tsx +0 -55
- package/src/pages/Profile.tsx +0 -36
- package/src/pages/ReviewDriver.tsx +0 -30
- package/src/pages/ReviewOrder.tsx +0 -32
- package/src/pages/ReviewProducts.tsx +0 -30
- package/src/pages/Sessions.tsx +0 -22
- package/src/pages/Signup.tsx +0 -53
- package/src/pages/SpinnerLoader.tsx +0 -10
- package/src/pages/Splash.tsx +0 -21
|
@@ -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()}
|
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
import styled from 'styled-components/native'
|
|
2
2
|
|
|
3
|
-
export const ContainerButtons = styled.View`
|
|
4
|
-
margin-vertical: 50px
|
|
5
|
-
`
|
|
6
|
-
|
|
7
3
|
export const Container = styled.ScrollView`
|
|
8
4
|
position: relative;
|
|
9
5
|
flex: 1;
|
|
@@ -13,7 +9,7 @@ export const Container = styled.ScrollView`
|
|
|
13
9
|
export const NotificationsGroupSwitchWrapper = styled.View`
|
|
14
10
|
flex-grow: 1;
|
|
15
11
|
justify-content: space-between;
|
|
16
|
-
|
|
12
|
+
padding: 0 20px;
|
|
17
13
|
`
|
|
18
14
|
|
|
19
15
|
export const SwitchWrapper = styled.View`
|
|
@@ -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
|
) : (
|
|
@@ -40,7 +40,7 @@ import { ProductItemAccordion } from '../ProductItemAccordion';
|
|
|
40
40
|
import { TouchableOpacity } from 'react-native-gesture-handler';
|
|
41
41
|
import { OrderDetailsParams } from '../../types';
|
|
42
42
|
import { GoogleMap } from '../GoogleMap';
|
|
43
|
-
import { verifyDecimals } from '../../utils';
|
|
43
|
+
import { verifyDecimals, getOrderStatus } from '../../utils';
|
|
44
44
|
import { OSRow } from '../OrderSummary/styles';
|
|
45
45
|
import AntIcon from 'react-native-vector-icons/AntDesign'
|
|
46
46
|
import { TaxInformation } from '../TaxInformation';
|
|
@@ -48,6 +48,7 @@ import { Placeholder, PlaceholderLine } from 'rn-placeholder';
|
|
|
48
48
|
import NavBar from '../NavBar'
|
|
49
49
|
import { OrderHistory } from './OrderHistory';
|
|
50
50
|
import { PlaceSpot } from '../PlaceSpot'
|
|
51
|
+
import { OrderEta } from './OrderEta'
|
|
51
52
|
import { SendGiftCard } from '../GiftCard/SendGiftCard'
|
|
52
53
|
export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
53
54
|
const {
|
|
@@ -120,8 +121,10 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
120
121
|
const mapValidStatuses = [9, 19, 23]
|
|
121
122
|
const placeSpotTypes = [3, 4, 5]
|
|
122
123
|
const directionTypes = [2, 3, 4, 5]
|
|
123
|
-
const activeStatus = [0, 3, 4, 7, 8, 9, 14, 18, 19, 20, 21, 22, 23]
|
|
124
|
+
const activeStatus = [0, 3, 4, 7, 8, 9, 13, 14, 18, 19, 20, 21, 22, 23]
|
|
125
|
+
const reorderStatus = [1, 2, 5, 6, 10, 11, 12]
|
|
124
126
|
const enabledPoweredByOrdering = configs?.powered_by_ordering_module?.value
|
|
127
|
+
const hideDeliveryDate = theme?.confirmation?.components?.order?.components?.date?.hidden
|
|
125
128
|
const isGiftCardOrder = !order?.business_id
|
|
126
129
|
|
|
127
130
|
const walletName: any = {
|
|
@@ -133,205 +136,6 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
133
136
|
}
|
|
134
137
|
}
|
|
135
138
|
|
|
136
|
-
const getOrderStatus = (s: string) => {
|
|
137
|
-
const status = parseInt(s);
|
|
138
|
-
const orderStatus = [
|
|
139
|
-
{
|
|
140
|
-
key: 0,
|
|
141
|
-
value: t('PENDING', 'Pending'),
|
|
142
|
-
slug: 'PENDING',
|
|
143
|
-
percentage: 0.25,
|
|
144
|
-
image: theme.images.order.status0,
|
|
145
|
-
},
|
|
146
|
-
{
|
|
147
|
-
key: 1,
|
|
148
|
-
value: t('COMPLETED', 'Completed'),
|
|
149
|
-
slug: 'COMPLETED',
|
|
150
|
-
percentage: 1,
|
|
151
|
-
image: theme.images.order.status1,
|
|
152
|
-
},
|
|
153
|
-
{
|
|
154
|
-
key: 2,
|
|
155
|
-
value: t('REJECTED', 'Rejected'),
|
|
156
|
-
slug: 'REJECTED',
|
|
157
|
-
percentage: 0,
|
|
158
|
-
image: theme.images.order.status2,
|
|
159
|
-
},
|
|
160
|
-
{
|
|
161
|
-
key: 3,
|
|
162
|
-
value: t('DRIVER_IN_BUSINESS', 'Driver in business'),
|
|
163
|
-
slug: 'DRIVER_IN_BUSINESS',
|
|
164
|
-
percentage: 0.6,
|
|
165
|
-
image: theme.images.order.status3,
|
|
166
|
-
},
|
|
167
|
-
{
|
|
168
|
-
key: 4,
|
|
169
|
-
value: t('PREPARATION_COMPLETED', 'Preparation Completed'),
|
|
170
|
-
slug: 'PREPARATION_COMPLETED',
|
|
171
|
-
percentage: 0.7,
|
|
172
|
-
image: theme.images.order.status4,
|
|
173
|
-
},
|
|
174
|
-
{
|
|
175
|
-
key: 5,
|
|
176
|
-
value: t('REJECTED_BY_BUSINESS', 'Rejected by business'),
|
|
177
|
-
slug: 'REJECTED_BY_BUSINESS',
|
|
178
|
-
percentage: 0,
|
|
179
|
-
image: theme.images.order.status5,
|
|
180
|
-
},
|
|
181
|
-
{
|
|
182
|
-
key: 6,
|
|
183
|
-
value: t('REJECTED_BY_DRIVER', 'Rejected by Driver'),
|
|
184
|
-
slug: 'REJECTED_BY_DRIVER',
|
|
185
|
-
percentage: 0,
|
|
186
|
-
image: theme.images.order.status6,
|
|
187
|
-
},
|
|
188
|
-
{
|
|
189
|
-
key: 7,
|
|
190
|
-
value: t('ACCEPTED_BY_BUSINESS', 'Accepted by business'),
|
|
191
|
-
slug: 'ACCEPTED_BY_BUSINESS',
|
|
192
|
-
percentage: 0.35,
|
|
193
|
-
image: theme.images.order.status7,
|
|
194
|
-
},
|
|
195
|
-
{
|
|
196
|
-
key: 8,
|
|
197
|
-
value: t('ACCEPTED_BY_DRIVER', 'Accepted by driver'),
|
|
198
|
-
slug: 'ACCEPTED_BY_DRIVER',
|
|
199
|
-
percentage: 0.45,
|
|
200
|
-
image: theme.images.order.status8,
|
|
201
|
-
},
|
|
202
|
-
{
|
|
203
|
-
key: 9,
|
|
204
|
-
value: t('PICK_UP_COMPLETED_BY_DRIVER', 'Pick up completed by driver'),
|
|
205
|
-
slug: 'PICK_UP_COMPLETED_BY_DRIVER',
|
|
206
|
-
percentage: 0.8,
|
|
207
|
-
image: theme.images.order.status9,
|
|
208
|
-
},
|
|
209
|
-
{
|
|
210
|
-
key: 10,
|
|
211
|
-
value: t('PICK_UP_FAILED_BY_DRIVER', 'Pick up Failed by driver'),
|
|
212
|
-
slug: 'PICK_UP_FAILED_BY_DRIVER',
|
|
213
|
-
percentage: 0,
|
|
214
|
-
image: theme.images.order.status10,
|
|
215
|
-
},
|
|
216
|
-
{
|
|
217
|
-
key: 11,
|
|
218
|
-
value: t(
|
|
219
|
-
'DELIVERY_COMPLETED_BY_DRIVER',
|
|
220
|
-
'Delivery completed by driver',
|
|
221
|
-
),
|
|
222
|
-
slug: 'DELIVERY_COMPLETED_BY_DRIVER',
|
|
223
|
-
percentage: 1,
|
|
224
|
-
image: theme.images.order.status11,
|
|
225
|
-
},
|
|
226
|
-
{
|
|
227
|
-
key: 12,
|
|
228
|
-
value: t('DELIVERY_FAILED_BY_DRIVER', 'Delivery Failed by driver'),
|
|
229
|
-
slug: 'DELIVERY_FAILED_BY_DRIVER',
|
|
230
|
-
percentage: 0,
|
|
231
|
-
image: theme.images.order.status12,
|
|
232
|
-
},
|
|
233
|
-
{
|
|
234
|
-
key: 13,
|
|
235
|
-
value: t('PREORDER', 'PreOrder'),
|
|
236
|
-
slug: 'PREORDER',
|
|
237
|
-
percentage: 0,
|
|
238
|
-
image: theme.images.order.status13,
|
|
239
|
-
},
|
|
240
|
-
{
|
|
241
|
-
key: 14,
|
|
242
|
-
value: t('ORDER_NOT_READY', 'Order not ready'),
|
|
243
|
-
slug: 'ORDER_NOT_READY',
|
|
244
|
-
percentage: 0,
|
|
245
|
-
image: theme.images.order.status13,
|
|
246
|
-
},
|
|
247
|
-
{
|
|
248
|
-
key: 15,
|
|
249
|
-
value: t(
|
|
250
|
-
'ORDER_PICKEDUP_COMPLETED_BY_CUSTOMER',
|
|
251
|
-
'Order picked up completed by customer',
|
|
252
|
-
),
|
|
253
|
-
slug: 'ORDER_PICKEDUP_COMPLETED_BY_CUSTOMER',
|
|
254
|
-
percentage: 100,
|
|
255
|
-
image: theme.images.order.status1,
|
|
256
|
-
},
|
|
257
|
-
{
|
|
258
|
-
key: 16,
|
|
259
|
-
value: t('CANCELLED_BY_CUSTOMER', 'Cancelled by customer'),
|
|
260
|
-
slug: 'CANCELLED_BY_CUSTOMER',
|
|
261
|
-
percentage: 0,
|
|
262
|
-
image: theme.images.order.status2,
|
|
263
|
-
},
|
|
264
|
-
{
|
|
265
|
-
key: 17,
|
|
266
|
-
value: t(
|
|
267
|
-
'ORDER_NOT_PICKEDUP_BY_CUSTOMER',
|
|
268
|
-
'Order not picked up by customer',
|
|
269
|
-
),
|
|
270
|
-
slug: 'ORDER_NOT_PICKEDUP_BY_CUSTOMER',
|
|
271
|
-
percentage: 0,
|
|
272
|
-
image: theme.images.order.status2,
|
|
273
|
-
},
|
|
274
|
-
{
|
|
275
|
-
key: 18,
|
|
276
|
-
value: t(
|
|
277
|
-
'DRIVER_ALMOST_ARRIVED_TO_BUSINESS',
|
|
278
|
-
'Driver almost arrived to business',
|
|
279
|
-
),
|
|
280
|
-
slug: 'DRIVER_ALMOST_ARRIVED_TO_BUSINESS',
|
|
281
|
-
percentage: 0.15,
|
|
282
|
-
image: theme.images.order.status3,
|
|
283
|
-
},
|
|
284
|
-
{
|
|
285
|
-
key: 19,
|
|
286
|
-
value: t(
|
|
287
|
-
'DRIVER_ALMOST_ARRIVED_TO_CUSTOMER',
|
|
288
|
-
'Driver almost arrived to customer',
|
|
289
|
-
),
|
|
290
|
-
slug: 'DRIVER_ALMOST_ARRIVED_TO_CUSTOMER',
|
|
291
|
-
percentage: 0.9,
|
|
292
|
-
image: theme.images.order.status11,
|
|
293
|
-
},
|
|
294
|
-
{
|
|
295
|
-
key: 20,
|
|
296
|
-
value: t(
|
|
297
|
-
'ORDER_CUSTOMER_ALMOST_ARRIVED_BUSINESS',
|
|
298
|
-
'Customer almost arrived to business',
|
|
299
|
-
),
|
|
300
|
-
slug: 'ORDER_CUSTOMER_ALMOST_ARRIVED_BUSINESS',
|
|
301
|
-
percentage: 90,
|
|
302
|
-
image: theme.images.order.status7,
|
|
303
|
-
},
|
|
304
|
-
{
|
|
305
|
-
key: 21,
|
|
306
|
-
value: t(
|
|
307
|
-
'ORDER_CUSTOMER_ARRIVED_BUSINESS',
|
|
308
|
-
'Customer arrived to business',
|
|
309
|
-
),
|
|
310
|
-
slug: 'ORDER_CUSTOMER_ARRIVED_BUSINESS',
|
|
311
|
-
percentage: 95,
|
|
312
|
-
image: theme.images.order.status7,
|
|
313
|
-
},
|
|
314
|
-
{
|
|
315
|
-
key: 22,
|
|
316
|
-
value: t('ORDER_LOOKING_FOR_DRIVER', 'Looking for driver'),
|
|
317
|
-
slug: 'ORDER_LOOKING_FOR_DRIVER',
|
|
318
|
-
percentage: 35,
|
|
319
|
-
image: theme.images.order.status8
|
|
320
|
-
},
|
|
321
|
-
{
|
|
322
|
-
key: 23,
|
|
323
|
-
value: t('ORDER_DRIVER_ON_WAY', 'Driver on way'),
|
|
324
|
-
slug: 'ORDER_DRIVER_ON_WAY',
|
|
325
|
-
percentage: 45,
|
|
326
|
-
image: theme.images.order.status8
|
|
327
|
-
}
|
|
328
|
-
];
|
|
329
|
-
|
|
330
|
-
const objectStatus = orderStatus.find((o) => o.key === status);
|
|
331
|
-
|
|
332
|
-
return objectStatus && objectStatus;
|
|
333
|
-
};
|
|
334
|
-
|
|
335
139
|
const handleGoToMessages = (type: string) => {
|
|
336
140
|
readMessages && readMessages();
|
|
337
141
|
navigation.navigate(
|
|
@@ -598,14 +402,12 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
598
402
|
style={{ marginTop: Platform.OS === 'ios' ? 0 : 20 }}
|
|
599
403
|
titleWrapStyle={{ paddingHorizontal: 0 }}
|
|
600
404
|
titleStyle={{ marginRight: 0, marginLeft: 0 }}
|
|
601
|
-
subTitle={<OText size={12} lineHeight={18} color={theme.colors.textNormal}>
|
|
602
|
-
{
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
: parseDate(order?.delivery_datetime, { utc: false })
|
|
608
|
-
}
|
|
405
|
+
subTitle={!hideDeliveryDate && <OText size={12} lineHeight={18} color={theme.colors.textNormal}>
|
|
406
|
+
{activeStatus.includes(order?.status) ? (
|
|
407
|
+
<OrderEta order={order} />
|
|
408
|
+
) : (
|
|
409
|
+
parseDate(order?.reporting_data?.at[`status:${order.status}`])
|
|
410
|
+
)}
|
|
609
411
|
</OText>}
|
|
610
412
|
/>
|
|
611
413
|
{enabledPoweredByOrdering && (
|
|
@@ -864,7 +666,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
864
666
|
<>
|
|
865
667
|
{order?.driver?.location && mapValidStatuses.includes(parseInt(order?.status)) && (
|
|
866
668
|
<Map>
|
|
867
|
-
|
|
669
|
+
<GoogleMap
|
|
868
670
|
location={typeof order?.driver?.location?.location === 'string'
|
|
869
671
|
? {
|
|
870
672
|
lat: parseFloat(driverLocationString[0]),
|
|
@@ -956,25 +758,17 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
956
758
|
parentStyle={{ marginTop: 29, marginEnd: 15 }}
|
|
957
759
|
onClick={() => navigation.navigate('BottomTab', { screen: 'MyOrders' })}
|
|
958
760
|
/>
|
|
959
|
-
{(
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
textStyle={{ fontSize: 14, color: theme.colors.primary }}
|
|
971
|
-
imgRightSrc={null}
|
|
972
|
-
borderColor='transparent'
|
|
973
|
-
bgColor={theme.colors.primary + 10}
|
|
974
|
-
style={{ borderRadius: 7.6, borderWidth: 1, height: 44, shadowOpacity: 0, marginTop: 29 }}
|
|
975
|
-
onClick={() => handleReorder && handleReorder(order.id)}
|
|
976
|
-
/>
|
|
977
|
-
)}
|
|
761
|
+
{(reorderStatus?.includes(parseInt(order?.status)) && order?.cart) && (
|
|
762
|
+
<OButton
|
|
763
|
+
text={order.id === reorderState?.loading ? t('LOADING', 'Loading..') : t('REORDER', 'Reorder')}
|
|
764
|
+
textStyle={{ fontSize: 14, color: theme.colors.primary }}
|
|
765
|
+
imgRightSrc={null}
|
|
766
|
+
borderColor='transparent'
|
|
767
|
+
bgColor={theme.colors.primary + 10}
|
|
768
|
+
style={{ borderRadius: 7.6, borderWidth: 1, height: 44, shadowOpacity: 0, marginTop: 29 }}
|
|
769
|
+
onClick={() => handleReorder && handleReorder(order.id)}
|
|
770
|
+
/>
|
|
771
|
+
)}
|
|
978
772
|
</OrderAction>
|
|
979
773
|
</HeaderInfo>
|
|
980
774
|
<OrderProducts>
|
|
@@ -1108,7 +902,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
1108
902
|
</Table>
|
|
1109
903
|
))
|
|
1110
904
|
}
|
|
1111
|
-
{order?.summary?.delivery_price
|
|
905
|
+
{typeof order?.summary?.delivery_price === 'number' && (
|
|
1112
906
|
<Table>
|
|
1113
907
|
<OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>{t('DELIVERY_FEE', 'Delivery Fee')}</OText>
|
|
1114
908
|
<OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>{parsePrice(order?.summary?.delivery_price)}</OText>
|
|
@@ -1183,13 +977,13 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
1183
977
|
<OText>
|
|
1184
978
|
{event?.wallet_event
|
|
1185
979
|
? walletName[event?.wallet_event?.wallet?.type]?.name
|
|
1186
|
-
: event?.paymethod?.name}
|
|
980
|
+
: t(event?.paymethod?.name.toUpperCase()?.replace(/ /g, '_'), event?.paymethod?.name)}
|
|
1187
981
|
</OText>
|
|
1188
|
-
{event?.data?.charge_id && (
|
|
982
|
+
{/* {event?.data?.charge_id && (
|
|
1189
983
|
<OText>
|
|
1190
984
|
{`${t('CODE', 'Code')}: ${event?.data?.charge_id}`}
|
|
1191
985
|
</OText>
|
|
1192
|
-
)}
|
|
986
|
+
)} */}
|
|
1193
987
|
</View>
|
|
1194
988
|
<OText>
|
|
1195
989
|
-{parsePrice(event.amount, { isTruncable: true })}
|
|
@@ -1238,6 +1032,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
1238
1032
|
>
|
|
1239
1033
|
<OrderHistory
|
|
1240
1034
|
order={order}
|
|
1035
|
+
hideViaText={props.hideViaText}
|
|
1241
1036
|
messages={messages}
|
|
1242
1037
|
enableReview={(
|
|
1243
1038
|
parseInt(order?.status) === 1 ||
|
|
@@ -20,7 +20,8 @@ export const OrderItAgain = (props: OrderItAgainParams) => {
|
|
|
20
20
|
currentCart,
|
|
21
21
|
handleUpdateProducts,
|
|
22
22
|
navigation,
|
|
23
|
-
searchValue
|
|
23
|
+
searchValue,
|
|
24
|
+
businessSingleId
|
|
24
25
|
} = props
|
|
25
26
|
|
|
26
27
|
const [, t] = useLanguage()
|
|
@@ -65,6 +66,7 @@ export const OrderItAgain = (props: OrderItAgainParams) => {
|
|
|
65
66
|
handleUpdateProducts={handleUpdateProducts}
|
|
66
67
|
navigation={navigation}
|
|
67
68
|
isPreviously
|
|
69
|
+
businessSingleId={businessSingleId}
|
|
68
70
|
/>
|
|
69
71
|
</ProductWrapper>
|
|
70
72
|
))}
|