ordering-ui-react-native 0.16.52 → 0.16.53-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 +6 -5
- package/src/DeliveryApp.tsx +43 -1
- package/src/components/ActiveOrders/index.tsx +61 -63
- package/src/components/ActiveOrders/styles.tsx +8 -14
- package/src/components/BusinessInformation/index.tsx +33 -4
- package/src/components/BusinessInformation/styles.tsx +2 -2
- package/src/components/BusinessProductsList/index.tsx +10 -10
- package/src/components/BusinessesListing/index.tsx +1 -1
- package/src/components/Checkout/index.tsx +2 -1
- package/src/components/LanguageSelector/index.tsx +21 -16
- package/src/components/Messages/index.tsx +2 -2
- package/src/components/NotificationSetting/index.tsx +85 -0
- package/src/components/OrdersOption/index.tsx +54 -56
- package/src/components/PaymentOptions/index.tsx +298 -345
- package/src/components/PaymentOptionsWebView/index.tsx +120 -121
- package/src/components/SingleProductReview/index.tsx +7 -4
- package/src/components/StripeElementsForm/index.tsx +25 -16
- package/src/components/VerifyPhone/styles.tsx +1 -2
- package/src/components/shared/OBottomPopup.tsx +6 -2
- package/src/components/shared/OToast.tsx +4 -4
- package/src/index.tsx +2 -0
- package/src/types/@fatnlazycat/react-native-recaptcha-v3/index.d.ts +1 -0
- package/src/utils/index.tsx +2 -1
- package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +260 -238
- package/themes/business/src/components/AcceptOrRejectOrder/styles.tsx +6 -4
- package/themes/business/src/components/BusinessController/index.tsx +2 -2
- package/themes/business/src/components/Chat/index.tsx +40 -32
- package/themes/business/src/components/DriverMap/index.tsx +7 -5
- package/themes/business/src/components/DriverSchedule/index.tsx +36 -19
- package/themes/business/src/components/LoginForm/index.tsx +111 -74
- package/themes/business/src/components/MapView/index.tsx +12 -1
- package/themes/business/src/components/MessagesOption/index.tsx +11 -1
- package/themes/business/src/components/NewOrderNotification/index.tsx +26 -41
- package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +40 -30
- package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +3 -3
- package/themes/business/src/components/OrdersListManager/index.tsx +10 -3
- package/themes/business/src/components/OrdersOption/index.tsx +76 -77
- package/themes/business/src/components/OrdersOption/styles.tsx +5 -1
- package/themes/business/src/components/OrdersOptionBusiness/index.tsx +15 -1
- package/themes/business/src/components/OrdersOptionCity/index.tsx +15 -1
- package/themes/business/src/components/OrdersOptionDate/index.tsx +19 -6
- package/themes/business/src/components/OrdersOptionDelivery/index.tsx +15 -1
- package/themes/business/src/components/OrdersOptionDriver/index.tsx +15 -1
- package/themes/business/src/components/OrdersOptionPaymethod/index.tsx +15 -1
- package/themes/business/src/components/OrdersOptionStatus/index.tsx +10 -1
- package/themes/business/src/components/PreviousMessages/index.tsx +17 -18
- package/themes/business/src/components/PreviousOrders/OrderItem.tsx +250 -0
- package/themes/business/src/components/PreviousOrders/OrdersGroupedItem.tsx +115 -0
- package/themes/business/src/components/PreviousOrders/index.tsx +440 -245
- package/themes/business/src/components/PreviousOrders/styles.tsx +31 -3
- package/themes/business/src/components/ProductItemAccordion/index.tsx +3 -2
- package/themes/business/src/components/ReviewCustomer/index.tsx +39 -15
- package/themes/business/src/components/ScheduleBlocked/index.tsx +2 -2
- package/themes/business/src/components/UserFormDetails/index.tsx +5 -2
- package/themes/business/src/components/UserProfileForm/index.tsx +2 -0
- package/themes/business/src/components/shared/ODropDown.tsx +42 -8
- package/themes/business/src/components/shared/ODropDownCalendar.tsx +36 -7
- package/themes/business/src/components/shared/OLink.tsx +24 -12
- package/themes/business/src/components/shared/OText.tsx +3 -2
- package/themes/business/src/types/index.tsx +25 -11
- package/themes/business/src/utils/index.tsx +10 -0
- 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/BusinessesListing/index.tsx +2 -1
- package/themes/kiosk/src/components/Checkout/index.tsx +6 -0
- package/themes/kiosk/src/components/LoginForm/index.tsx +121 -10
- package/themes/kiosk/src/components/LoginForm/styles.tsx +5 -0
- 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/ProductForm/index.tsx +1 -14
- package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
- package/themes/kiosk/src/types/index.d.ts +2 -0
- package/themes/original/index.tsx +8 -6
- package/themes/original/src/components/AddressDetails/index.tsx +10 -8
- package/themes/original/src/components/AddressForm/index.tsx +157 -140
- package/themes/original/src/components/AddressList/index.tsx +1 -1
- package/themes/original/src/components/AppleLogin/index.tsx +4 -4
- package/themes/original/src/components/BusinessBasicInformation/index.tsx +218 -147
- package/themes/original/src/components/BusinessBasicInformation/styles.tsx +2 -2
- package/themes/original/src/components/BusinessController/index.tsx +192 -91
- package/themes/original/src/components/BusinessController/styles.tsx +14 -9
- package/themes/original/src/components/BusinessInformation/index.tsx +10 -31
- package/themes/original/src/components/BusinessItemAccordion/index.tsx +12 -6
- package/themes/original/src/components/BusinessListingSearch/BusinessControllerSkeletons/index.tsx +57 -0
- package/themes/original/src/components/BusinessListingSearch/MaxSectionItem/index.tsx +59 -0
- package/themes/original/src/components/BusinessListingSearch/MaxSectionItem/styles.tsx +13 -0
- package/themes/original/src/components/BusinessListingSearch/index.tsx +85 -137
- package/themes/original/src/components/BusinessListingSearch/styles.tsx +10 -12
- package/themes/original/src/components/BusinessProductsList/SubcategoriesComponent/index.tsx +87 -0
- package/themes/original/src/components/BusinessProductsList/SubcategoriesComponent/styles.tsx +12 -0
- package/themes/original/src/components/BusinessProductsList/index.tsx +59 -61
- package/themes/original/src/components/BusinessProductsList/styles.tsx +0 -3
- package/themes/original/src/components/BusinessProductsListing/index.tsx +179 -83
- package/themes/original/src/components/BusinessProductsListing/styles.tsx +19 -12
- package/themes/original/src/components/BusinessTypeFilter/index.tsx +3 -2
- package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +28 -29
- package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +299 -148
- package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +47 -11
- package/themes/original/src/components/BusinessesListing/index.tsx +51 -71
- package/themes/original/src/components/Cart/index.tsx +82 -15
- package/themes/original/src/components/Cart/styles.tsx +4 -0
- package/themes/original/src/components/CartContent/index.tsx +27 -17
- package/themes/original/src/components/CartContent/styles.tsx +1 -1
- package/themes/original/src/components/Checkout/index.tsx +114 -118
- package/themes/original/src/components/Checkout/styles.tsx +4 -3
- package/themes/original/src/components/CitiesControl/index.tsx +89 -0
- package/themes/original/src/components/CitiesControl/styles.tsx +17 -0
- package/themes/original/src/components/DriverTips/index.tsx +4 -4
- package/themes/original/src/components/DriverTips/styles.tsx +2 -1
- package/themes/original/src/components/FavoriteList/index.tsx +69 -45
- package/themes/original/src/components/FloatingButton/index.tsx +13 -11
- package/themes/original/src/components/FloatingButton/styles.tsx +1 -1
- package/themes/original/src/components/GPSButton/index.tsx +20 -19
- package/themes/original/src/components/GPSButton/styles.ts +3 -3
- package/themes/original/src/components/GoogleMap/index.tsx +20 -12
- package/themes/original/src/components/HelpAccountAndPayment/index.tsx +25 -10
- package/themes/original/src/components/HelpAccountAndPayment/styles.tsx +4 -0
- package/themes/original/src/components/HelpGuide/index.tsx +9 -8
- package/themes/original/src/components/HelpOrder/index.tsx +9 -8
- package/themes/original/src/components/LanguageSelector/index.tsx +19 -14
- package/themes/original/src/components/LoginForm/Otp/index.tsx +89 -73
- package/themes/original/src/components/LoginForm/Otp/styles.tsx +0 -1
- package/themes/original/src/components/LoginForm/index.tsx +98 -41
- package/themes/original/src/components/LottieAnimation/index.tsx +69 -0
- package/themes/original/src/components/Messages/index.tsx +35 -20
- package/themes/original/src/components/MomentOption/index.tsx +8 -6
- package/themes/original/src/components/MultiCart/index.tsx +63 -0
- package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +92 -93
- package/themes/original/src/components/MultiCheckout/index.tsx +10 -2
- package/themes/original/src/components/MultiOrdersDetails/index.tsx +34 -16
- package/themes/original/src/components/MyOrders/index.tsx +88 -24
- package/themes/original/src/components/NavBar/index.tsx +11 -5
- package/themes/original/src/components/NetworkError/index.tsx +5 -3
- package/themes/original/src/components/NotFoundSource/index.tsx +2 -1
- package/themes/original/src/components/Notifications/index.tsx +148 -0
- package/themes/original/src/components/Notifications/styles.tsx +20 -0
- package/themes/original/src/components/OrderDetails/index.tsx +162 -50
- package/themes/original/src/components/OrderDetails/styles.tsx +15 -2
- package/themes/original/src/components/OrderItAgain/index.tsx +75 -0
- package/themes/original/src/components/OrderItAgain/styles.tsx +10 -0
- package/themes/original/src/components/OrderProgress/index.tsx +77 -66
- package/themes/original/src/components/OrderProgress/styles.tsx +5 -0
- package/themes/original/src/components/OrderSummary/index.tsx +2 -35
- package/themes/original/src/components/OrderTypeSelector/index.tsx +85 -36
- package/themes/original/src/components/OrderTypeSelector/styles.tsx +19 -1
- package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/index.tsx +94 -98
- package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/index.tsx +3 -0
- package/themes/original/src/components/OrdersOption/index.tsx +91 -53
- package/themes/original/src/components/PaymentOptionWallet/index.tsx +56 -56
- package/themes/original/src/components/PaymentOptions/index.tsx +1 -2
- package/themes/original/src/components/PhoneInputNumber/index.tsx +1 -1
- package/themes/original/src/components/PlaceSpot/index.tsx +249 -47
- package/themes/original/src/components/PlaceSpot/styles.tsx +0 -2
- package/themes/original/src/components/PreviousOrders/index.tsx +3 -2
- package/themes/original/src/components/ProductForm/index.tsx +365 -384
- package/themes/original/src/components/ProductForm/styles.tsx +7 -12
- package/themes/original/src/components/ProductItemAccordion/index.tsx +199 -128
- package/themes/original/src/components/ProductOption/index.tsx +1 -1
- package/themes/original/src/components/ProductOptionSubOption/index.tsx +16 -8
- package/themes/original/src/components/ProductOptionSubOption/styles.tsx +0 -1
- package/themes/original/src/components/ProfessionalFilter/index.tsx +2 -1
- package/themes/original/src/components/ProfessionalProfile/index.tsx +19 -8
- package/themes/original/src/components/Promotions/index.tsx +232 -219
- package/themes/original/src/components/Promotions/styles.tsx +7 -2
- package/themes/original/src/components/ReviewDriver/index.tsx +3 -3
- package/themes/original/src/components/ReviewOrder/index.tsx +120 -108
- package/themes/original/src/components/ReviewOrder/styles.tsx +5 -7
- package/themes/original/src/components/ReviewProducts/index.tsx +8 -5
- package/themes/original/src/components/ReviewTrigger/index.tsx +136 -0
- package/themes/original/src/components/{Reviews/ReviewOrder → ReviewTrigger}/styles.tsx +10 -22
- package/themes/original/src/components/ScheduleAccordion/index.tsx +68 -0
- package/themes/original/src/components/ScheduleAccordion/styles.tsx +14 -0
- package/themes/original/src/components/ServiceForm/index.tsx +330 -266
- package/themes/original/src/components/SignupForm/index.tsx +134 -89
- package/themes/original/src/components/SingleOrderCard/index.tsx +219 -129
- package/themes/original/src/components/SingleOrderCard/styles.tsx +10 -8
- package/themes/original/src/components/SingleProductCard/index.tsx +180 -104
- package/themes/original/src/components/SingleProductCard/styles.tsx +3 -10
- package/themes/original/src/components/SingleProductReview/index.tsx +38 -5
- package/themes/original/src/components/SingleProductReview/styles.tsx +12 -0
- package/themes/original/src/components/StripeElementsForm/index.tsx +13 -2
- package/themes/original/src/components/UpsellingProducts/index.tsx +15 -5
- package/themes/original/src/components/UserDetails/index.tsx +5 -3
- package/themes/original/src/components/UserFormDetails/index.tsx +6 -48
- package/themes/original/src/components/UserProfile/index.tsx +58 -35
- package/themes/original/src/components/UserProfile/styles.ts +17 -0
- package/themes/original/src/components/WalletTransactions/index.tsx +76 -0
- package/themes/original/src/components/WalletTransactions/styles.tsx +13 -0
- package/themes/original/src/components/Wallets/index.tsx +176 -164
- package/themes/original/src/components/Wallets/styles.tsx +12 -8
- package/themes/original/src/components/shared/CardAnimation.tsx +47 -0
- package/themes/original/src/components/shared/HeaderTitle.tsx +8 -3
- package/themes/original/src/components/shared/OBottomPopup.tsx +36 -22
- package/themes/original/src/components/shared/OButton.tsx +10 -3
- package/themes/original/src/components/shared/OIcon.tsx +8 -1
- package/themes/original/src/components/shared/OInput.tsx +10 -1
- package/themes/original/src/layouts/Container.tsx +13 -9
- package/themes/original/src/layouts/FloatingBottomContainer.tsx +5 -1
- package/themes/original/src/types/index.tsx +65 -13
- package/themes/original/src/utils/index.tsx +103 -58
- package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
- package/themes/original/src/components/Reviews/ReviewDriver/index.tsx +0 -301
- package/themes/original/src/components/Reviews/ReviewDriver/styles.tsx +0 -39
- package/themes/original/src/components/Reviews/ReviewOrder/index.tsx +0 -326
- package/themes/original/src/components/Reviews/ReviewProducts/index.tsx +0 -101
- package/themes/original/src/components/Reviews/ReviewProducts/styles.tsx +0 -17
- package/themes/original/src/components/Reviews/index.tsx +0 -9
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import styled from 'styled-components/native'
|
|
1
|
+
import styled, { css } from 'styled-components/native'
|
|
2
2
|
|
|
3
3
|
export const WelcomeTitle = styled.View`
|
|
4
4
|
flex: 1;
|
|
@@ -16,6 +16,9 @@ export const Search = styled.View`
|
|
|
16
16
|
align-items: center;
|
|
17
17
|
margin-vertical: 10px;
|
|
18
18
|
margin-horizontal: 20px;
|
|
19
|
+
${(props: any) => props.isChewLayout && css`
|
|
20
|
+
margin-horizontal: 30px;
|
|
21
|
+
`}
|
|
19
22
|
`
|
|
20
23
|
|
|
21
24
|
export const AddressInput = styled.TouchableOpacity`
|
|
@@ -27,6 +30,9 @@ export const AddressInput = styled.TouchableOpacity`
|
|
|
27
30
|
width: 100%;
|
|
28
31
|
height: 44px;
|
|
29
32
|
max-height: 44px;
|
|
33
|
+
${(props: any) => props.isChewLayout && css`
|
|
34
|
+
border-radius: 8px;
|
|
35
|
+
`}
|
|
30
36
|
`
|
|
31
37
|
|
|
32
38
|
export const OrderControlContainer = styled.View`
|
|
@@ -54,28 +60,20 @@ export const WrapMomentOption = styled.TouchableOpacity`
|
|
|
54
60
|
|
|
55
61
|
export const HeaderWrapper = styled.ImageBackground`
|
|
56
62
|
width: 100%;
|
|
57
|
-
|
|
63
|
+
height: 270px;
|
|
58
64
|
padding: 20px 40px;
|
|
59
65
|
background-color: transparent;
|
|
60
66
|
`;
|
|
61
67
|
|
|
62
68
|
export const ListWrapper = styled.View`
|
|
63
69
|
background-color: ${(props: any) => props.theme.colors.backgroundLight};
|
|
64
|
-
padding-horizontal: 40px;
|
|
65
70
|
`;
|
|
66
71
|
|
|
67
72
|
export const FeaturedWrapper = styled.View`
|
|
68
73
|
background-color: ${(props: any) => props.theme.colors.backgroundLight};
|
|
69
|
-
height: 220px;
|
|
70
74
|
paddingVertical: 30px;
|
|
71
75
|
`;
|
|
72
76
|
|
|
73
|
-
export const OrderProgressWrapper = styled.View`
|
|
74
|
-
margin-top: 37px;
|
|
75
|
-
margin-bottom: 20px;
|
|
76
|
-
padding-horizontal: 40px;
|
|
77
|
-
`
|
|
78
|
-
|
|
79
77
|
export const FarAwayMessage = styled.View`
|
|
80
78
|
flex-direction: row;
|
|
81
79
|
align-items: center;
|
|
@@ -89,5 +87,43 @@ export const AddressInputContainer = styled.View`
|
|
|
89
87
|
flex-direction: row;
|
|
90
88
|
width: 100%;
|
|
91
89
|
align-items: center;
|
|
92
|
-
justify-content: center
|
|
90
|
+
justify-content: center;
|
|
91
|
+
${(props: any) => props.isChewLayout && css`
|
|
92
|
+
flex-direction: row-reverse;
|
|
93
|
+
`}
|
|
94
|
+
`
|
|
95
|
+
|
|
96
|
+
export const PreorderInput = styled(AddressInput)`
|
|
97
|
+
justify-content: center;
|
|
98
|
+
`
|
|
99
|
+
|
|
100
|
+
export const OTabs = styled.View`
|
|
101
|
+
flex-direction: row;
|
|
102
|
+
justify-content: space-between;
|
|
103
|
+
align-items: center;
|
|
104
|
+
margin-bottom: -1px;
|
|
105
|
+
width: 100%;
|
|
106
|
+
`;
|
|
107
|
+
|
|
108
|
+
export const OTab = styled.TouchableOpacity`
|
|
109
|
+
padding-bottom: 10px;
|
|
110
|
+
border-bottom-width: 1px;
|
|
111
|
+
margin-end: 14px;
|
|
112
|
+
padding-horizontal: 5px;
|
|
113
|
+
`;
|
|
114
|
+
|
|
115
|
+
export const OrderTypesContainer = styled.View`
|
|
116
|
+
flex-direction: row;
|
|
117
|
+
font-size: 14px;
|
|
118
|
+
width: 180px;
|
|
119
|
+
justify-content: space-between;
|
|
120
|
+
align-items: center;
|
|
121
|
+
border-bottom-width: 1px;
|
|
122
|
+
border-bottom-color: ${(props: any) => props.theme.colors.border};
|
|
123
|
+
margin-top: 10px;
|
|
124
|
+
align-self: center;
|
|
125
|
+
`
|
|
126
|
+
|
|
127
|
+
export const BusinessLogosContainer = styled.ScrollView`
|
|
128
|
+
padding-bottom: 10px;
|
|
93
129
|
`
|
|
@@ -1,125 +1,105 @@
|
|
|
1
|
-
|
|
2
1
|
import React, { useState, useEffect } from 'react'
|
|
3
|
-
import { useOrder, useSession, useLanguage } from 'ordering-components/native';
|
|
2
|
+
import { useOrder, useSession, useLanguage, useConfig } from 'ordering-components/native';
|
|
4
3
|
|
|
5
4
|
import { useTheme } from 'styled-components/native'
|
|
6
5
|
import { BusinessesListing as OriginalBusinessListing } from './Layout/Original'
|
|
7
6
|
import { BusinessesListing as AppointmentBusinessListing } from './Layout/Appointment'
|
|
8
7
|
import { OBottomPopup } from '../shared';
|
|
9
|
-
import {
|
|
8
|
+
import { ReviewTrigger } from '../ReviewTrigger';
|
|
9
|
+
import { NotificationSetting } from '../../../../../src/components/NotificationSetting';
|
|
10
10
|
|
|
11
11
|
export const BusinessesListing = (props: any) => {
|
|
12
|
+
const { logosLayout } = props
|
|
12
13
|
const theme = useTheme()
|
|
14
|
+
const layout = theme?.business_listing_view?.components?.layout?.type || 'original'
|
|
13
15
|
const [, t] = useLanguage();
|
|
14
|
-
const layout = theme?.layout?.businessListing?.layout?.type || 'original'
|
|
15
16
|
const [{ auth }] = useSession()
|
|
16
17
|
const [, { getLastOrderHasNoReview }] = useOrder();
|
|
18
|
+
const [{ configs }] = useConfig()
|
|
19
|
+
const isShowReviewsPopupEnabled = configs?.show_reviews_popups_enabled?.value === '1'
|
|
17
20
|
|
|
21
|
+
const [, setIsReviewed] = useState()
|
|
22
|
+
const [checkNotificationStatus, setCheckNotificationStatus] = useState({ open: false, checked: false })
|
|
23
|
+
const defaultOrder = {
|
|
24
|
+
id: 0,
|
|
25
|
+
business_id: 0,
|
|
26
|
+
business_name: '',
|
|
27
|
+
logo: '',
|
|
28
|
+
driver: {},
|
|
29
|
+
products: [],
|
|
30
|
+
review: {},
|
|
31
|
+
user_review: {},
|
|
32
|
+
delivery_datetime: ''
|
|
33
|
+
}
|
|
18
34
|
const [lastOrderReview, setLastOrderReview] = useState({
|
|
19
35
|
isReviewOpen: false,
|
|
20
|
-
order:
|
|
21
|
-
|
|
22
|
-
business_id: 0,
|
|
23
|
-
business_name: '',
|
|
24
|
-
delivery_datetime: '',
|
|
25
|
-
logo: '',
|
|
26
|
-
driver: null,
|
|
27
|
-
products: [],
|
|
28
|
-
review: null,
|
|
29
|
-
user_review: null
|
|
30
|
-
},
|
|
31
|
-
reviewStatus: { order: false, product: false, driver: false },
|
|
32
|
-
reviewed: { isOrderReviewed: false, isProductReviewed: false, isDriverReviewed: false }
|
|
36
|
+
order: defaultOrder,
|
|
37
|
+
defaultStar: 5,
|
|
33
38
|
})
|
|
34
39
|
|
|
35
40
|
const _getLastOrderHasNoReview = async () => {
|
|
36
41
|
const lastOrderHasNoReview = await getLastOrderHasNoReview()
|
|
37
|
-
lastOrderHasNoReview &&
|
|
42
|
+
lastOrderHasNoReview && OrderReviewRequired(lastOrderHasNoReview)
|
|
38
43
|
}
|
|
39
44
|
|
|
40
|
-
const
|
|
45
|
+
const OrderReviewRequired = (order: any) => {
|
|
41
46
|
setLastOrderReview({
|
|
42
47
|
isReviewOpen: true,
|
|
43
48
|
order: {
|
|
44
49
|
id: order?.id,
|
|
45
50
|
business_id: order?.business_id,
|
|
46
51
|
business_name: order?.business?.name,
|
|
47
|
-
delivery_datetime: order?.delivery_datetime,
|
|
48
52
|
logo: order.business?.logo,
|
|
49
53
|
driver: order?.driver,
|
|
50
54
|
products: order?.products,
|
|
51
55
|
review: order?.review,
|
|
52
|
-
user_review: order?.user_review
|
|
56
|
+
user_review: order?.user_review,
|
|
57
|
+
delivery_datetime: order?.delivery_datetime_utc
|
|
53
58
|
},
|
|
54
|
-
|
|
55
|
-
reviewed: { isOrderReviewed: false, isProductReviewed: false, isDriverReviewed: false }
|
|
56
|
-
})
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
const handleCloseReivew = () => {
|
|
60
|
-
setLastOrderReview({
|
|
61
|
-
...lastOrderReview,
|
|
62
|
-
isReviewOpen: false,
|
|
63
|
-
reviewStatus: { order: false, product: false, driver: false }
|
|
59
|
+
defaultStar: 5
|
|
64
60
|
})
|
|
65
61
|
}
|
|
66
62
|
|
|
67
|
-
const
|
|
68
|
-
const _reviewStatus = { ...lastOrderReview?.reviewed }
|
|
63
|
+
const handleOpenOrderReview = (star: number) => {
|
|
69
64
|
setLastOrderReview({
|
|
70
|
-
...lastOrderReview,
|
|
71
|
-
reviewed: { ..._reviewStatus, [reviewType]: true }
|
|
65
|
+
...lastOrderReview, isReviewOpen: false, order: defaultOrder
|
|
72
66
|
})
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
const closeReviewProduct = () => {
|
|
82
|
-
if (lastOrderReview?.order?.driver && !lastOrderReview?.order?.user_review && !lastOrderReview?.reviewed?.isDriverReviewed) setLastOrderReview({ ...lastOrderReview, reviewStatus: { order: false, product: false, driver: true } })
|
|
83
|
-
else {
|
|
84
|
-
setIsReviewed('isDriverReviewed')
|
|
85
|
-
handleCloseReivew()
|
|
86
|
-
}
|
|
67
|
+
props?.navigation && props.navigation.navigate(
|
|
68
|
+
'ReviewOrder',
|
|
69
|
+
{
|
|
70
|
+
order: lastOrderReview.order,
|
|
71
|
+
defaultStar: star || 5,
|
|
72
|
+
setIsReviewed
|
|
73
|
+
}
|
|
74
|
+
)
|
|
87
75
|
}
|
|
88
76
|
|
|
89
77
|
useEffect(() => {
|
|
90
|
-
|
|
91
|
-
|
|
78
|
+
if (!isShowReviewsPopupEnabled) return
|
|
79
|
+
(checkNotificationStatus?.checked && auth) && _getLastOrderHasNoReview()
|
|
80
|
+
}, [checkNotificationStatus, auth, isShowReviewsPopupEnabled])
|
|
92
81
|
|
|
93
82
|
return (
|
|
94
83
|
<>
|
|
95
|
-
{(layout === 'original') && <OriginalBusinessListing {...props} />}
|
|
96
|
-
{(layout === '
|
|
84
|
+
{((layout === 'original') || logosLayout) && <OriginalBusinessListing {...props} />}
|
|
85
|
+
{(layout === 'appointments') && !logosLayout && <AppointmentBusinessListing {...props} />}
|
|
97
86
|
|
|
98
87
|
{lastOrderReview?.isReviewOpen && (
|
|
99
88
|
<OBottomPopup
|
|
100
89
|
open={lastOrderReview?.isReviewOpen}
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
: (lastOrderReview?.reviewStatus?.product
|
|
106
|
-
? t('REVIEW_PRODUCT', 'Review Product')
|
|
107
|
-
: t('REVIEW_DRIVER', 'Review Driver')))
|
|
108
|
-
: t('LOADING', 'Loading...')}
|
|
109
|
-
bottomContainerStyle={{ height: 'auto' }}
|
|
90
|
+
transparent={true}
|
|
91
|
+
onClose={() => setLastOrderReview({ ...lastOrderReview, isReviewOpen: false, order: defaultOrder })}
|
|
92
|
+
title={t('HEY', 'Hey! ') + t('HOW_WAS_YOUR_ORDER', 'How was your order?')}
|
|
93
|
+
bottomContainerStyle={{ height: 'auto', borderRadius: 10 }}
|
|
110
94
|
titleStyle={{ textAlign: 'center' }}
|
|
111
95
|
closeIcon={theme.images.general.close}
|
|
96
|
+
presentationStyle='overFullScreen'
|
|
112
97
|
>
|
|
113
|
-
{
|
|
114
|
-
lastOrderReview?.reviewStatus?.order
|
|
115
|
-
? <ReviewOrderModal order={lastOrderReview?.order} closeReviewOrder={closeReviewOrder} skipReview={handleCloseReivew} setIsReviewed={() => setIsReviewed('isOrderReviewed')} />
|
|
116
|
-
: (lastOrderReview?.reviewStatus?.product
|
|
117
|
-
? <ReviewProductsModal order={lastOrderReview?.order} closeReviewProduct={closeReviewProduct} setIsProductReviewed={() => setIsReviewed('isProductReviewed')} />
|
|
118
|
-
: <ReviewDriverModal order={lastOrderReview?.order} closeReviewDriver={handleCloseReivew} setIsDriverReviewed={() => setIsReviewed('isDriverReviewed')} />)
|
|
119
|
-
}
|
|
120
|
-
|
|
98
|
+
{lastOrderReview?.order && <ReviewTrigger order={lastOrderReview?.order} handleOpenOrderReview={handleOpenOrderReview} />}
|
|
121
99
|
</OBottomPopup>
|
|
122
100
|
)}
|
|
101
|
+
<NotificationSetting checkNotificationStatus={checkNotificationStatus}
|
|
102
|
+
setCheckNotificationStatus={setCheckNotificationStatus} />
|
|
123
103
|
</>
|
|
124
104
|
)
|
|
125
|
-
}
|
|
105
|
+
}
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
useValidationFields,
|
|
9
9
|
} from 'ordering-components/native';
|
|
10
10
|
import { useTheme } from 'styled-components/native';
|
|
11
|
-
import { CContainer, CheckoutAction, Divider } from './styles';
|
|
11
|
+
import { CContainer, CheckoutAction, Divider, DriverTipsContainer } from './styles';
|
|
12
12
|
|
|
13
13
|
import { OSBill, OSTable, OSCoupon, OSTotal, OSRow } from '../OrderSummary/styles';
|
|
14
14
|
|
|
@@ -25,6 +25,7 @@ import { TaxInformation } from '../TaxInformation';
|
|
|
25
25
|
import { CartStoresListing } from '../CartStoresListing';
|
|
26
26
|
import { OAlert } from '../../../../../src/components/shared'
|
|
27
27
|
import { PlaceSpot } from '../PlaceSpot'
|
|
28
|
+
import { DriverTips } from '../DriverTips'
|
|
28
29
|
|
|
29
30
|
const CartUI = (props: any) => {
|
|
30
31
|
const {
|
|
@@ -60,11 +61,16 @@ const CartUI = (props: any) => {
|
|
|
60
61
|
|
|
61
62
|
const isCartPending = cart?.status === 2
|
|
62
63
|
const isCouponEnabled = validationFields?.fields?.checkout?.coupon?.enabled
|
|
63
|
-
|
|
64
|
+
const isCheckoutMultiBusinessEnabled: Boolean = configs?.checkout_multi_business_enabled?.value === '1'
|
|
65
|
+
const openCarts = (Object.values(orderState?.carts)?.filter((cart: any) => cart?.products && cart?.products?.length && cart?.status !== 2 && cart?.valid_schedule && cart?.valid_products && cart?.valid_address && cart?.valid_maximum && cart?.valid_minimum && !cart?.wallets) || null) || []
|
|
64
66
|
|
|
65
67
|
const business: any = (orderState?.carts && Object.values(orderState.carts).find((_cart: any) => _cart?.uuid === props.cartuuid)) ?? {}
|
|
66
68
|
const businessId = business?.business_id ?? null
|
|
67
|
-
const placeSpotTypes = [
|
|
69
|
+
const placeSpotTypes = [4]
|
|
70
|
+
|
|
71
|
+
const driverTipsOptions = typeof configs?.driver_tip_options?.value === 'string'
|
|
72
|
+
? JSON.parse(configs?.driver_tip_options?.value) || []
|
|
73
|
+
: configs?.driver_tip_options?.value || []
|
|
68
74
|
|
|
69
75
|
const momentFormatted = !orderState?.option?.moment
|
|
70
76
|
? t('RIGHT_NOW', 'Right Now')
|
|
@@ -98,11 +104,40 @@ const CartUI = (props: any) => {
|
|
|
98
104
|
const handleUpsellingPage = () => {
|
|
99
105
|
setOpenUpselling(false)
|
|
100
106
|
setCanOpenUpselling(false)
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
107
|
+
const cartSelectedHasGroup = cart?.group?.uuid
|
|
108
|
+
const cartFilterValidation = (cart : any) => cart?.valid && cart?.status !== 2
|
|
109
|
+
const cartsGroupLength = cartSelectedHasGroup ? Object.values(orderState.carts).filter((_cart : any) => _cart?.group?.uuid === cartSelectedHasGroup && cartFilterValidation(_cart))?.length : 0
|
|
110
|
+
if (cartsGroupLength > 1 && isCheckoutMultiBusinessEnabled) {
|
|
111
|
+
props.onNavigationRedirect('CheckoutNavigator', {
|
|
112
|
+
screen: 'MultiCheckout',
|
|
113
|
+
cartUuid: cart?.group?.uuid
|
|
114
|
+
})
|
|
115
|
+
return
|
|
116
|
+
}
|
|
117
|
+
const cartGroupsCount : any = {}
|
|
118
|
+
Object.values(orderState.carts).filter(_cart => cartFilterValidation(_cart))?.forEach((_cart : any) => {
|
|
119
|
+
if (cartGroupsCount[_cart?.group?.uuid]) {
|
|
120
|
+
cartGroupsCount[_cart?.group?.uuid] += 1
|
|
121
|
+
} else {
|
|
122
|
+
cartGroupsCount[_cart?.group?.uuid] = 1
|
|
123
|
+
}
|
|
124
|
+
})
|
|
125
|
+
let groupForTheCart
|
|
126
|
+
const groupForAddCartArray = Object.keys(cartGroupsCount).filter(cartGroupUuid => cartGroupsCount[cartGroupUuid] > 0 && cartGroupsCount[cartGroupUuid] < 5)
|
|
127
|
+
const max = Math.max(...groupForAddCartArray.map(uuid => cartGroupsCount[uuid]))
|
|
128
|
+
const indexes = groupForAddCartArray.filter(uuid => cartGroupsCount[uuid] === max)
|
|
129
|
+
if (indexes?.length > 1) {
|
|
130
|
+
groupForTheCart = indexes.find(uuid => uuid !== 'undefined')
|
|
131
|
+
} else {
|
|
132
|
+
groupForTheCart = indexes[0]
|
|
133
|
+
}
|
|
134
|
+
if (isCheckoutMultiBusinessEnabled && openCarts.length > 1 && groupForTheCart) {
|
|
135
|
+
props.onNavigationRedirect('CheckoutNavigator', {
|
|
136
|
+
screen: 'MultiCart',
|
|
137
|
+
cartUuid: cart.uuid,
|
|
138
|
+
cartGroup: groupForTheCart === 'undefined' ? 'create' : groupForTheCart
|
|
139
|
+
})
|
|
140
|
+
} else {
|
|
106
141
|
props.onNavigationRedirect('CheckoutNavigator', {
|
|
107
142
|
screen: 'CheckoutPage',
|
|
108
143
|
cartUuid: cart?.uuid,
|
|
@@ -148,6 +183,12 @@ const CartUI = (props: any) => {
|
|
|
148
183
|
}
|
|
149
184
|
}
|
|
150
185
|
|
|
186
|
+
const subtotalWithTaxes = cart?.taxes?.reduce((acc: any, item: any) => {
|
|
187
|
+
if (item?.type === 1)
|
|
188
|
+
return acc = acc + item?.summary?.tax
|
|
189
|
+
return acc = acc
|
|
190
|
+
}, cart?.subtotal)
|
|
191
|
+
|
|
151
192
|
return (
|
|
152
193
|
<CContainer>
|
|
153
194
|
{openUpselling && (
|
|
@@ -172,7 +213,7 @@ const CartUI = (props: any) => {
|
|
|
172
213
|
onNavigationRedirect={props.onNavigationRedirect}
|
|
173
214
|
handleChangeStore={() => setOpenChangeStore(true)}
|
|
174
215
|
handleClickCheckout={() => setOpenUpselling(true)}
|
|
175
|
-
checkoutButtonDisabled={(openUpselling && !canOpenUpselling) ||
|
|
216
|
+
checkoutButtonDisabled={(openUpselling && !canOpenUpselling) || subtotalWithTaxes < cart?.minimum || !cart?.valid_address}
|
|
176
217
|
isMultiCheckout={isMultiCheckout}
|
|
177
218
|
>
|
|
178
219
|
{cart?.products?.length > 0 && cart?.products.map((product: any, i: number) => (
|
|
@@ -355,12 +396,38 @@ const CartUI = (props: any) => {
|
|
|
355
396
|
</OSTable>
|
|
356
397
|
)}
|
|
357
398
|
|
|
399
|
+
{isMultiCheckout &&
|
|
400
|
+
cart &&
|
|
401
|
+
cart?.valid &&
|
|
402
|
+
orderState?.options?.type === 1 &&
|
|
403
|
+
cart?.status !== 2 &&
|
|
404
|
+
validationFields?.fields?.checkout?.driver_tip?.enabled &&
|
|
405
|
+
driverTipsOptions && driverTipsOptions?.length > 0 &&
|
|
406
|
+
(
|
|
407
|
+
<DriverTipsContainer>
|
|
408
|
+
<OText size={14} lineHeight={20} color={theme.colors.textNormal}>
|
|
409
|
+
{t('DRIVER_TIPS', 'Driver Tips')}
|
|
410
|
+
</OText>
|
|
411
|
+
<DriverTips
|
|
412
|
+
uuid={cart?.uuid}
|
|
413
|
+
businessId={cart?.business_id}
|
|
414
|
+
driverTipsOptions={driverTipsOptions}
|
|
415
|
+
isFixedPrice={parseInt(configs?.driver_tip_type?.value, 10) === 1 || !!parseInt(configs?.driver_tip_use_custom?.value, 10)}
|
|
416
|
+
isDriverTipUseCustom={!!parseInt(configs?.driver_tip_use_custom?.value, 10)}
|
|
417
|
+
driverTip={parseInt(configs?.driver_tip_type?.value, 10) === 1 || !!parseInt(configs?.driver_tip_use_custom?.value, 10)
|
|
418
|
+
? cart?.driver_tip
|
|
419
|
+
: cart?.driver_tip_rate}
|
|
420
|
+
useOrderContext
|
|
421
|
+
/>
|
|
422
|
+
</DriverTipsContainer>
|
|
423
|
+
)}
|
|
424
|
+
|
|
358
425
|
<OSTotal>
|
|
359
426
|
<OSTable style={{ marginTop: 15 }}>
|
|
360
|
-
<OText size={14} lineHeight={21} weight={'
|
|
427
|
+
<OText size={14} lineHeight={21} weight={'bold'} color={theme.colors.textNormal}>
|
|
361
428
|
{t('TOTAL', 'Total')}
|
|
362
429
|
</OText>
|
|
363
|
-
<OText size={14} lineHeight={21} weight={'
|
|
430
|
+
<OText size={14} lineHeight={21} weight={'bold'} color={theme.colors.textNormal}>
|
|
364
431
|
{parsePrice(cart?.balance >= 0 ? cart?.balance : 0)}
|
|
365
432
|
</OText>
|
|
366
433
|
</OSTable>
|
|
@@ -423,15 +490,15 @@ const CartUI = (props: any) => {
|
|
|
423
490
|
{cart?.valid_products ? (
|
|
424
491
|
<CheckoutAction>
|
|
425
492
|
<OButton
|
|
426
|
-
text={(
|
|
493
|
+
text={(subtotalWithTaxes >= cart?.minimum || !cart?.minimum) && cart?.valid_address ? (
|
|
427
494
|
!openUpselling !== canOpenUpselling ? t('CHECKOUT', 'Checkout') : t('LOADING', 'Loading')
|
|
428
495
|
) : !cart?.valid_address ? (
|
|
429
496
|
`${t('OUT_OF_COVERAGE', 'Out of Coverage')}`
|
|
430
497
|
) : (
|
|
431
498
|
`${t('MINIMUN_SUBTOTAL_ORDER', 'Minimum subtotal order:')} ${parsePrice(cart?.minimum)}`
|
|
432
499
|
)}
|
|
433
|
-
bgColor={(
|
|
434
|
-
isDisabled={(openUpselling && !canOpenUpselling) ||
|
|
500
|
+
bgColor={(subtotalWithTaxes < cart?.minimum || !cart?.valid_address) ? theme.colors.secundary : theme.colors.primary}
|
|
501
|
+
isDisabled={(openUpselling && !canOpenUpselling) || subtotalWithTaxes < cart?.minimum || !cart?.valid_address}
|
|
435
502
|
borderColor={theme.colors.primary}
|
|
436
503
|
imgRightSrc={null}
|
|
437
504
|
textStyle={{ color: 'white', textAlign: 'center', flex: 1 }}
|
|
@@ -446,7 +513,7 @@ const CartUI = (props: any) => {
|
|
|
446
513
|
</OText>
|
|
447
514
|
</View>
|
|
448
515
|
)}
|
|
449
|
-
</>
|
|
516
|
+
</>
|
|
450
517
|
)}
|
|
451
518
|
</BusinessItemAccordion>
|
|
452
519
|
|
|
@@ -1,39 +1,41 @@
|
|
|
1
|
-
import React, {
|
|
2
|
-
import {
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import { View } from 'react-native';
|
|
3
|
+
import { useLanguage } from 'ordering-components/native';
|
|
3
4
|
import { useTheme } from 'styled-components/native';
|
|
4
5
|
import { CCContainer, CCNotCarts, CCList } from './styles';
|
|
5
6
|
|
|
6
7
|
import { Cart } from '../Cart';
|
|
7
|
-
import {
|
|
8
|
+
import { OButton, OText } from '../shared';
|
|
8
9
|
import Spinner from 'react-native-loading-spinner-overlay';
|
|
9
|
-
import { View } from 'react-native';
|
|
10
10
|
|
|
11
11
|
export const CartContent = (props: any) => {
|
|
12
12
|
const {
|
|
13
13
|
carts,
|
|
14
|
-
isOrderStateCarts
|
|
14
|
+
isOrderStateCarts,
|
|
15
|
+
onNavigationRedirect
|
|
15
16
|
} = props
|
|
16
17
|
|
|
17
18
|
const theme = useTheme();
|
|
18
19
|
const [, t] = useLanguage()
|
|
19
20
|
const [isCartsLoading, setIsCartsLoading] = useState(false)
|
|
20
21
|
|
|
22
|
+
const isChewLayout = theme?.header?.components?.layout?.type === 'chew'
|
|
23
|
+
|
|
21
24
|
return (
|
|
22
|
-
<CCContainer
|
|
25
|
+
<CCContainer
|
|
26
|
+
style={{ paddingHorizontal: isChewLayout ? 20 : 40 }}
|
|
27
|
+
>
|
|
23
28
|
{isOrderStateCarts && carts?.length > 0 && (
|
|
24
29
|
<>
|
|
25
|
-
{/* <OText size={24} lineHeight={36} weight={'600'} style={{ marginBottom: 20 }}>
|
|
26
|
-
{carts.length > 1 ? t('MY_CARTS', 'My Carts') : t('CART', 'Cart')}
|
|
27
|
-
</OText> */}
|
|
28
30
|
{carts.map((cart: any, i: number) => (
|
|
29
31
|
<CCList key={i} style={{ overflow: 'visible' }}>
|
|
30
32
|
{cart.products.length > 0 && (
|
|
31
33
|
<>
|
|
32
34
|
<Cart
|
|
33
|
-
|
|
34
|
-
|
|
35
|
+
singleBusiness={props.singleBusiness}
|
|
36
|
+
isFranchiseApp={props.isFranchiseApp}
|
|
35
37
|
cart={cart}
|
|
36
|
-
|
|
38
|
+
cartuuid={cart.uuid}
|
|
37
39
|
onNavigationRedirect={props.onNavigationRedirect}
|
|
38
40
|
isCartsLoading={isCartsLoading}
|
|
39
41
|
setIsCartsLoading={setIsCartsLoading}
|
|
@@ -48,14 +50,22 @@ export const CartContent = (props: any) => {
|
|
|
48
50
|
)}
|
|
49
51
|
{(!carts || carts?.length === 0) && (
|
|
50
52
|
<CCNotCarts>
|
|
51
|
-
{/* <OIcon
|
|
52
|
-
url={props.icon}
|
|
53
|
-
width={200}
|
|
54
|
-
height={122}
|
|
55
|
-
/> */}
|
|
56
53
|
<OText size={24} style={{ textAlign: 'center' }}>
|
|
57
54
|
{t('CARTS_NOT_FOUND', 'You don\'t have carts available')}
|
|
58
55
|
</OText>
|
|
56
|
+
<OButton
|
|
57
|
+
text={t('START_SHOPPING', 'Start shopping')}
|
|
58
|
+
bgColor={theme.colors.primary}
|
|
59
|
+
borderColor={theme.colors.primary}
|
|
60
|
+
textStyle={{
|
|
61
|
+
color: theme.colors.white,
|
|
62
|
+
fontSize: 14,
|
|
63
|
+
paddingRight: 0
|
|
64
|
+
}}
|
|
65
|
+
style={{ height: 35, marginVertical: 20, borderRadius: 8 }}
|
|
66
|
+
imgRightSrc={null}
|
|
67
|
+
onClick={() => onNavigationRedirect('BusinessList')}
|
|
68
|
+
/>
|
|
59
69
|
</CCNotCarts>
|
|
60
70
|
)}
|
|
61
71
|
<Spinner visible={isCartsLoading} />
|