ordering-ui-react-native 0.18.2 → 0.18.3-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 +9 -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 +0 -20
- 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 +7 -2
- package/themes/business/index.tsx +2 -0
- package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +36 -26
- package/themes/business/src/components/BusinessController/index.tsx +19 -17
- package/themes/business/src/components/BusinessProductList/AccordionDropdown.tsx +63 -0
- package/themes/business/src/components/BusinessProductList/IterateCategories.tsx +108 -0
- package/themes/business/src/components/BusinessProductList/ProductList.tsx +196 -0
- package/themes/business/src/components/BusinessProductList/index.tsx +196 -0
- package/themes/business/src/components/BusinessProductList/styles.tsx +10 -0
- package/themes/business/src/components/Chat/index.tsx +163 -123
- 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/FloatingButton/index.tsx +34 -31
- package/themes/business/src/components/GoogleMap/index.tsx +58 -57
- package/themes/business/src/components/LoginForm/index.tsx +5 -2
- package/themes/business/src/components/MapView/index.tsx +14 -10
- package/themes/business/src/components/MessagesOption/index.tsx +22 -94
- package/themes/business/src/components/NewOrderNotification/index.tsx +123 -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 +205 -12
- package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +67 -39
- package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +47 -23
- package/themes/business/src/components/OrderDetailsLogistic/index.tsx +9 -4
- package/themes/business/src/components/OrderMessage/index.tsx +1 -1
- package/themes/business/src/components/OrderSummary/index.tsx +114 -123
- package/themes/business/src/components/OrdersListManager/index.tsx +7 -2
- package/themes/business/src/components/OrdersListManager/utils.tsx +1 -1
- package/themes/business/src/components/OrdersOption/index.tsx +43 -32
- 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 +21 -29
- package/themes/business/src/components/PreviousOrders/OrderList.tsx +93 -0
- package/themes/business/src/components/PreviousOrders/OrdersGroupedItem.tsx +1 -1
- package/themes/business/src/components/PreviousOrders/index.tsx +193 -221
- package/themes/business/src/components/PreviousOrders/styles.tsx +10 -0
- package/themes/business/src/components/ReviewCustomer/index.tsx +3 -1
- package/themes/business/src/components/SearchBar/index.tsx +2 -1
- package/themes/business/src/components/StoresList/index.tsx +6 -5
- package/themes/business/src/components/UserProfileForm/index.tsx +14 -15
- package/themes/business/src/components/WebsocketStatus/index.tsx +171 -0
- package/themes/business/src/components/WebsocketStatus/styles.tsx +28 -0
- package/themes/business/src/components/shared/OModal.tsx +16 -9
- package/themes/business/src/types/index.tsx +8 -0
- package/themes/business/src/utils/index.tsx +4 -4
- 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 -5
- 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 +7 -3
- package/themes/original/src/components/AddressDetails/index.tsx +19 -3
- package/themes/original/src/components/AddressForm/index.tsx +33 -15
- package/themes/original/src/components/AddressForm/styles.tsx +1 -1
- package/themes/original/src/components/AddressList/index.tsx +5 -8
- package/themes/original/src/components/AddressList/styles.tsx +4 -4
- 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 +74 -38
- package/themes/original/src/components/BusinessBasicInformation/styles.tsx +11 -13
- package/themes/original/src/components/BusinessController/index.tsx +35 -44
- 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/BusinessInformation/styles.tsx +2 -2
- package/themes/original/src/components/BusinessItemAccordion/index.tsx +25 -26
- package/themes/original/src/components/BusinessListingSearch/BusinessSearchFooter.tsx +317 -0
- package/themes/original/src/components/BusinessListingSearch/BusinessSearchHeader.tsx +96 -0
- package/themes/original/src/components/BusinessListingSearch/MaxSectionItem/index.tsx +1 -1
- package/themes/original/src/components/BusinessListingSearch/index.tsx +133 -438
- package/themes/original/src/components/BusinessListingSearch/styles.tsx +1 -19
- package/themes/original/src/components/BusinessPreorder/index.tsx +105 -22
- package/themes/original/src/components/BusinessPreorder/styles.tsx +14 -0
- package/themes/original/src/components/BusinessProductsCategories/index.tsx +2 -3
- 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 +162 -39
- package/themes/original/src/components/BusinessProductsListing/styles.tsx +4 -5
- package/themes/original/src/components/BusinessReviews/index.tsx +4 -2
- package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +1 -1
- package/themes/original/src/components/BusinessesListing/Layout/Appointment/styles.tsx +5 -5
- package/themes/original/src/components/BusinessesListing/Layout/Original/FlatListBusinessListFooter.tsx +69 -0
- package/themes/original/src/components/BusinessesListing/Layout/Original/FlatListBusinessListHeader.tsx +406 -0
- package/themes/original/src/components/BusinessesListing/Layout/Original/FlatListBusinessListing.tsx +76 -0
- package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +37 -404
- package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +1 -1
- package/themes/original/src/components/BusinessesListing/index.tsx +0 -1
- package/themes/original/src/components/Cart/index.tsx +49 -47
- package/themes/original/src/components/CartContent/index.tsx +99 -38
- package/themes/original/src/components/CartContent/styles.tsx +6 -6
- package/themes/original/src/components/CartStoresListing/styles.tsx +2 -2
- package/themes/original/src/components/Checkout/index.tsx +324 -43
- package/themes/original/src/components/Checkout/styles.tsx +17 -0
- package/themes/original/src/components/CitiesControl/index.tsx +1 -1
- package/themes/original/src/components/CitiesControl/styles.tsx +1 -1
- package/themes/original/src/components/CouponControl/index.tsx +10 -3
- package/themes/original/src/components/DatePicker/index.tsx +17 -0
- package/themes/original/src/components/DatePicker/styles.tsx +20 -0
- package/themes/original/src/components/DriverTips/index.tsx +6 -3
- package/themes/original/src/components/FacebookLogin/styles.tsx +3 -1
- package/themes/original/src/components/Favorite/index.tsx +4 -9
- package/themes/original/src/components/Favorite/styles.tsx +0 -2
- package/themes/original/src/components/FloatingButton/styles.tsx +1 -1
- package/themes/original/src/components/GPSButton/index.tsx +7 -5
- package/themes/original/src/components/GiftCard/GiftCardUI/index.tsx +8 -3
- package/themes/original/src/components/GiftCard/PurchaseGiftCard/index.tsx +42 -5
- package/themes/original/src/components/GiftCard/PurchaseGiftCard/styles.tsx +3 -1
- package/themes/original/src/components/GiftCard/RedeemGiftCard/index.tsx +84 -8
- package/themes/original/src/components/GiftCard/RedeemGiftCard/styles.tsx +1 -1
- package/themes/original/src/components/GiftCard/SendGiftCard/styles.tsx +1 -1
- package/themes/original/src/components/GoogleLogin/styles.tsx +1 -1
- package/themes/original/src/components/GoogleMap/index.tsx +63 -7
- package/themes/original/src/components/HighestRatedBusinesses/index.tsx +1 -1
- package/themes/original/src/components/HighestRatedBusinesses/styles.tsx +1 -1
- package/themes/original/src/components/Home/index.tsx +14 -5
- package/themes/original/src/components/LastOrder/index.tsx +2 -1
- package/themes/original/src/components/LastOrders/index.tsx +2 -1
- 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 +9 -2
- package/themes/original/src/components/Messages/index.tsx +15 -4
- package/themes/original/src/components/Messages/styles.tsx +1 -1
- package/themes/original/src/components/MomentOption/index.tsx +9 -10
- package/themes/original/src/components/MomentSelector/index.tsx +1 -1
- package/themes/original/src/components/MultiCart/index.tsx +1 -1
- package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +161 -49
- package/themes/original/src/components/MultiCheckout/index.tsx +348 -70
- package/themes/original/src/components/MultiCheckout/styles.tsx +3 -1
- package/themes/original/src/components/MultiOrdersDetails/index.tsx +2 -2
- package/themes/original/src/components/MyOrders/index.tsx +16 -5
- package/themes/original/src/components/NavBar/index.tsx +20 -13
- package/themes/original/src/components/NetworkError/index.tsx +2 -3
- package/themes/original/src/components/NetworkError/styles.tsx +2 -2
- package/themes/original/src/components/NotFoundSource/index.tsx +14 -10
- package/themes/original/src/components/Notifications/index.tsx +4 -8
- package/themes/original/src/components/Notifications/styles.tsx +0 -1
- package/themes/original/src/components/OrderDetails/OrderEta.tsx +76 -0
- package/themes/original/src/components/OrderDetails/OrderHistory.tsx +22 -6
- package/themes/original/src/components/OrderDetails/index.tsx +721 -670
- package/themes/original/src/components/OrderDetails/styles.tsx +24 -8
- package/themes/original/src/components/OrderItAgain/index.tsx +3 -1
- package/themes/original/src/components/OrderProgress/index.tsx +34 -25
- package/themes/original/src/components/OrderProgress/styles.tsx +1 -1
- package/themes/original/src/components/OrderSummary/index.tsx +62 -57
- package/themes/original/src/components/OrderTypeSelector/index.tsx +5 -6
- package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/styles.tsx +1 -1
- package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/index.tsx +13 -13
- package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/styles.tsx +1 -1
- package/themes/original/src/components/OrdersOption/index.tsx +44 -21
- package/themes/original/src/components/OrdersOption/styles.tsx +2 -2
- package/themes/original/src/components/PageBanner/index.tsx +65 -29
- package/themes/original/src/components/PageBanner/styles.tsx +0 -3
- package/themes/original/src/components/PaymentOptionCard/index.tsx +180 -0
- package/themes/original/src/components/PaymentOptionStripe/styles.tsx +3 -0
- package/themes/original/src/components/PaymentOptionWallet/index.tsx +56 -56
- package/themes/original/src/components/PaymentOptions/index.tsx +100 -34
- package/themes/original/src/components/PhoneInputNumber/index.tsx +18 -4
- package/themes/original/src/components/ProductForm/ActionButton.tsx +120 -0
- package/themes/original/src/components/ProductForm/ExtraOptions.tsx +56 -0
- package/themes/original/src/components/ProductForm/index.tsx +106 -170
- package/themes/original/src/components/ProductForm/styles.tsx +3 -3
- package/themes/original/src/components/ProductItemAccordion/index.tsx +13 -6
- package/themes/original/src/components/ProductOptionSubOption/index.tsx +49 -20
- package/themes/original/src/components/ProductOptionSubOption/styles.tsx +10 -9
- package/themes/original/src/components/ProfessionalProfile/styles.tsx +3 -3
- package/themes/original/src/components/Promotions/index.tsx +6 -6
- package/themes/original/src/components/Promotions/styles.tsx +3 -3
- package/themes/original/src/components/ReviewDriver/styles.tsx +1 -1
- package/themes/original/src/components/ReviewOrder/styles.tsx +1 -1
- package/themes/original/src/components/ReviewProducts/index.tsx +16 -7
- package/themes/original/src/components/ReviewProducts/styles.tsx +1 -1
- package/themes/original/src/components/ScheduleAccordion/index.tsx +3 -3
- package/themes/original/src/components/ServiceForm/index.tsx +2 -2
- package/themes/original/src/components/ServiceForm/styles.tsx +4 -4
- package/themes/original/src/components/SignupForm/index.tsx +27 -16
- package/themes/original/src/components/SingleOrderCard/index.tsx +44 -20
- package/themes/original/src/components/SingleOrderCard/styles.tsx +1 -1
- package/themes/original/src/components/SingleProductCard/index.tsx +13 -10
- package/themes/original/src/components/SingleProductCard/styles.tsx +8 -3
- package/themes/original/src/components/SingleProductReview/styles.tsx +1 -1
- package/themes/original/src/components/StripeCardsList/index.tsx +61 -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/UpsellingContent.tsx +170 -0
- package/themes/original/src/components/UpsellingProducts/UpsellingLayout.tsx +86 -0
- package/themes/original/src/components/UpsellingProducts/index.tsx +16 -205
- package/themes/original/src/components/UpsellingProducts/styles.tsx +19 -0
- package/themes/original/src/components/UserDetails/index.tsx +3 -1
- package/themes/original/src/components/UserFormDetails/index.tsx +100 -22
- package/themes/original/src/components/UserFormDetails/styles.tsx +1 -1
- package/themes/original/src/components/UserProfile/index.tsx +8 -26
- package/themes/original/src/components/UserProfileForm/index.tsx +30 -31
- 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/WalletTransactions/styles.tsx +1 -0
- package/themes/original/src/components/Wallets/index.tsx +48 -60
- package/themes/original/src/components/Wallets/styles.tsx +3 -4
- package/themes/original/src/components/shared/HeaderTitle.tsx +1 -1
- package/themes/original/src/components/shared/OButton.tsx +3 -3
- package/themes/original/src/components/shared/OInput.tsx +4 -5
- package/themes/original/src/components/shared/OModal.tsx +15 -17
- package/themes/original/src/layouts/Container.tsx +5 -3
- package/themes/original/src/types/index.tsx +28 -6
- package/themes/original/src/utils/index.tsx +180 -13
- 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,4 +1,4 @@
|
|
|
1
|
-
import React, { useEffect, useState } from 'react';
|
|
1
|
+
import React, { useEffect, useState, useRef } from 'react';
|
|
2
2
|
import {
|
|
3
3
|
Cart as CartController,
|
|
4
4
|
useOrder,
|
|
@@ -23,7 +23,7 @@ import { ActivityIndicator, TouchableOpacity, View } from 'react-native';
|
|
|
23
23
|
import AntIcon from 'react-native-vector-icons/AntDesign'
|
|
24
24
|
import { TaxInformation } from '../TaxInformation';
|
|
25
25
|
import { CartStoresListing } from '../CartStoresListing';
|
|
26
|
-
import { OAlert } from '
|
|
26
|
+
import { OAlert } from '../shared'
|
|
27
27
|
import { PlaceSpot } from '../PlaceSpot'
|
|
28
28
|
import { DriverTips } from '../DriverTips'
|
|
29
29
|
import { MomentOption } from '../MomentOption'
|
|
@@ -45,12 +45,18 @@ const CartUI = (props: any) => {
|
|
|
45
45
|
isMultiCheckout,
|
|
46
46
|
hideDeliveryFee,
|
|
47
47
|
hideDriverTip,
|
|
48
|
+
hideCouponInput,
|
|
48
49
|
preorderSlotInterval,
|
|
49
50
|
preorderLeadTime,
|
|
50
51
|
preorderTimeRange,
|
|
51
52
|
preorderMaximumDays,
|
|
52
53
|
preorderMinimumDays,
|
|
53
|
-
cateringTypes
|
|
54
|
+
cateringTypes,
|
|
55
|
+
isFromUpselling,
|
|
56
|
+
cartsOpened,
|
|
57
|
+
setCartsOpened,
|
|
58
|
+
changeActiveState,
|
|
59
|
+
isActive
|
|
54
60
|
} = props
|
|
55
61
|
|
|
56
62
|
const theme = useTheme();
|
|
@@ -60,12 +66,11 @@ const CartUI = (props: any) => {
|
|
|
60
66
|
const [{ configs }] = useConfig();
|
|
61
67
|
const [{ parsePrice, parseNumber, parseDate }] = useUtils()
|
|
62
68
|
const [validationFields] = useValidationFields()
|
|
63
|
-
|
|
69
|
+
const commentRef = useRef()
|
|
64
70
|
const [openUpselling, setOpenUpselling] = useState(false)
|
|
65
71
|
const [openChangeStore, setOpenChangeStore] = useState(false)
|
|
66
72
|
const [canOpenUpselling, setCanOpenUpselling] = useState(false)
|
|
67
73
|
const [openTaxModal, setOpenTaxModal] = useState<any>({ open: false, data: null, type: '' })
|
|
68
|
-
const [confirm, setConfirm] = useState<any>({ open: false, content: null, handleOnAccept: null, id: null, title: null })
|
|
69
74
|
const [openPlaceModal, setOpenPlaceModal] = useState(false)
|
|
70
75
|
const [maxDate, setMaxDate] = useState<any>(null)
|
|
71
76
|
const isCartPending = cart?.status === 2
|
|
@@ -108,10 +113,14 @@ const CartUI = (props: any) => {
|
|
|
108
113
|
}
|
|
109
114
|
}
|
|
110
115
|
|
|
111
|
-
const handleUpsellingPage = (individualCart
|
|
116
|
+
const handleUpsellingPage = (individualCart: any) => {
|
|
117
|
+
const isProductCartParam = !!individualCart?.products?.length
|
|
112
118
|
setOpenUpselling(false)
|
|
113
119
|
setCanOpenUpselling(false)
|
|
114
|
-
|
|
120
|
+
|
|
121
|
+
const cartsAvailable: any = Object.values(orderState?.carts)
|
|
122
|
+
?.filter((_cart: any) => _cart?.valid && _cart?.status !== 2 && _cart?.products?.length)
|
|
123
|
+
?.filter((_c: any) => !isProductCartParam ? _c.uuid !== individualCart?.uuid : _c)
|
|
115
124
|
if (cartsAvailable.length === 1 || !isMultiCheckout) {
|
|
116
125
|
const cart = isMultiCheckout ? cartsAvailable[0] : individualCart
|
|
117
126
|
onNavigationRedirect('CheckoutNavigator', {
|
|
@@ -120,7 +129,7 @@ const CartUI = (props: any) => {
|
|
|
120
129
|
businessLogo: cart?.business?.logo,
|
|
121
130
|
businessName: cart?.business?.name,
|
|
122
131
|
cartTotal: cart?.total
|
|
123
|
-
})
|
|
132
|
+
}, true)
|
|
124
133
|
} else {
|
|
125
134
|
const groupKeys: any = {}
|
|
126
135
|
cartsAvailable.forEach((_cart: any) => {
|
|
@@ -136,12 +145,12 @@ const CartUI = (props: any) => {
|
|
|
136
145
|
onNavigationRedirect('CheckoutNavigator', {
|
|
137
146
|
screen: 'MultiCheckout',
|
|
138
147
|
checkCarts: true
|
|
139
|
-
})
|
|
148
|
+
}, true)
|
|
140
149
|
} else {
|
|
141
150
|
onNavigationRedirect('CheckoutNavigator', {
|
|
142
151
|
screen: 'MultiCheckout',
|
|
143
152
|
cartUuid: cartsAvailable[0]?.group?.uuid
|
|
144
|
-
})
|
|
153
|
+
}, true)
|
|
145
154
|
}
|
|
146
155
|
}
|
|
147
156
|
}
|
|
@@ -160,16 +169,16 @@ const CartUI = (props: any) => {
|
|
|
160
169
|
return cart?.taxes?.filter((tax: any) => tax?.type === 1)?.reduce((carry: number, tax: any) => carry + (tax?.summary?.tax_after_discount ?? tax?.summary?.tax), 0)
|
|
161
170
|
}
|
|
162
171
|
|
|
163
|
-
const
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
172
|
+
const OfferAlert = ({ offerId }: any) => {
|
|
173
|
+
return (
|
|
174
|
+
<OAlert
|
|
175
|
+
title={t('OFFER', 'Offer')}
|
|
176
|
+
message={t('QUESTION_DELETE_OFFER', 'Are you sure that you want to delete the offer?')}
|
|
177
|
+
onAccept={() => handleRemoveOfferClick(offerId)}
|
|
178
|
+
>
|
|
179
|
+
<AntIcon style={{ marginLeft: 3 }} name='closecircle' size={16} color={theme.colors.primary} />
|
|
180
|
+
</OAlert>
|
|
181
|
+
)
|
|
173
182
|
}
|
|
174
183
|
|
|
175
184
|
const walletName: any = {
|
|
@@ -226,6 +235,12 @@ const CartUI = (props: any) => {
|
|
|
226
235
|
handleClickCheckout={() => setOpenUpselling(true)}
|
|
227
236
|
checkoutButtonDisabled={(openUpselling && !canOpenUpselling) || subtotalWithTaxes < cart?.minimum || !cart?.valid_address}
|
|
228
237
|
isMultiCheckout={isMultiCheckout}
|
|
238
|
+
isFromUpselling={isFromUpselling}
|
|
239
|
+
cartsOpened={cartsOpened}
|
|
240
|
+
setCartsOpened={setCartsOpened}
|
|
241
|
+
changeActiveState={changeActiveState}
|
|
242
|
+
isActive={isActive}
|
|
243
|
+
isGiftCart={!cart?.business_id}
|
|
229
244
|
>
|
|
230
245
|
{cart?.products?.length > 0 && cart?.products.map((product: any, i: number) => (
|
|
231
246
|
<ProductItemAccordion
|
|
@@ -275,9 +290,9 @@ const CartUI = (props: any) => {
|
|
|
275
290
|
<TouchableOpacity style={{ marginLeft: 3 }} onPress={() => setOpenTaxModal({ open: true, data: offer, type: 'offer_target_1' })}>
|
|
276
291
|
<AntIcon name='infocirlceo' size={16} color={theme.colors.primary} />
|
|
277
292
|
</TouchableOpacity>
|
|
278
|
-
|
|
279
|
-
<
|
|
280
|
-
|
|
293
|
+
{!!offer?.id && (
|
|
294
|
+
<OfferAlert offerId={offer?.id} />
|
|
295
|
+
)}
|
|
281
296
|
</OSRow>
|
|
282
297
|
<OText size={12} lineHeight={18}>
|
|
283
298
|
- {parsePrice(offer?.summary?.discount)}
|
|
@@ -339,10 +354,8 @@ const CartUI = (props: any) => {
|
|
|
339
354
|
<TouchableOpacity style={{ marginLeft: 3 }} onPress={() => setOpenTaxModal({ open: true, data: offer, type: 'offer_target_3' })}>
|
|
340
355
|
<AntIcon name='infocirlceo' size={16} color={theme.colors.primary} />
|
|
341
356
|
</TouchableOpacity>
|
|
342
|
-
{
|
|
343
|
-
<
|
|
344
|
-
<AntIcon name='closecircle' size={16} color={theme.colors.primary} />
|
|
345
|
-
</TouchableOpacity>
|
|
357
|
+
{!!offer?.id && (
|
|
358
|
+
<OfferAlert offerId={offer?.id} />
|
|
346
359
|
)}
|
|
347
360
|
</OSRow>
|
|
348
361
|
<OText size={12} lineHeight={18}>
|
|
@@ -351,10 +364,10 @@ const CartUI = (props: any) => {
|
|
|
351
364
|
</OSTable>
|
|
352
365
|
))
|
|
353
366
|
}
|
|
354
|
-
{orderState?.options?.type === 1 && cart?.
|
|
367
|
+
{orderState?.options?.type === 1 && cart?.delivery_price_with_discount > 0 && !hideDeliveryFee && (
|
|
355
368
|
<OSTable>
|
|
356
369
|
<OText size={12} lineHeight={18}>{t('DELIVERY_FEE', 'Delivery Fee')}</OText>
|
|
357
|
-
<OText size={12} lineHeight={18}>{parsePrice(cart?.
|
|
370
|
+
<OText size={12} lineHeight={18}>{parsePrice(cart?.delivery_price_with_discount)}</OText>
|
|
358
371
|
</OSTable>
|
|
359
372
|
)}
|
|
360
373
|
{
|
|
@@ -368,9 +381,9 @@ const CartUI = (props: any) => {
|
|
|
368
381
|
<TouchableOpacity style={{ marginLeft: 3 }} onPress={() => setOpenTaxModal({ open: true, data: offer, type: 'offer_target_2' })}>
|
|
369
382
|
<AntIcon name='infocirlceo' size={16} color={theme.colors.primary} />
|
|
370
383
|
</TouchableOpacity>
|
|
371
|
-
|
|
372
|
-
<
|
|
373
|
-
|
|
384
|
+
{!!offer?.id && (
|
|
385
|
+
<OfferAlert offerId={offer?.id} />
|
|
386
|
+
)}
|
|
374
387
|
</OSRow>
|
|
375
388
|
<OText size={12} lineHeight={18}>
|
|
376
389
|
- {parsePrice(offer?.summary?.discount)}
|
|
@@ -378,12 +391,6 @@ const CartUI = (props: any) => {
|
|
|
378
391
|
</OSTable>
|
|
379
392
|
))
|
|
380
393
|
}
|
|
381
|
-
{orderState?.options?.type === 1 && cart?.delivery_price > 0 && cart?.delivery_price_with_discount >= 0 && !hideDeliveryFee && (
|
|
382
|
-
<OSTable>
|
|
383
|
-
<OText size={12} lineHeight={18}>{t('DELIVERY_FEE_AFTER_DISCOUNT', 'Delivery Fee After Discount')}</OText>
|
|
384
|
-
<OText size={12} lineHeight={18}>{parsePrice(cart?.delivery_price_with_discount)}</OText>
|
|
385
|
-
</OSTable>
|
|
386
|
-
)}
|
|
387
394
|
{cart?.driver_tip > 0 && !hideDriverTip && (
|
|
388
395
|
<OSTable>
|
|
389
396
|
<OText size={12} lineHeight={18}>
|
|
@@ -406,12 +413,13 @@ const CartUI = (props: any) => {
|
|
|
406
413
|
<OText size={12}>-{parsePrice(event.amount, { isTruncable: true })}</OText>
|
|
407
414
|
</OSTable>
|
|
408
415
|
))}
|
|
409
|
-
{isCouponEnabled && !isCartPending && (
|
|
416
|
+
{isCouponEnabled && !isCartPending && !hideCouponInput && (
|
|
410
417
|
<OSTable>
|
|
411
418
|
<OSCoupon>
|
|
412
419
|
<CouponControl
|
|
413
420
|
businessId={businessId}
|
|
414
421
|
price={cart.total}
|
|
422
|
+
cart={cart}
|
|
415
423
|
/>
|
|
416
424
|
</OSCoupon>
|
|
417
425
|
</OSTable>
|
|
@@ -424,6 +432,7 @@ const CartUI = (props: any) => {
|
|
|
424
432
|
cart?.status !== 2 &&
|
|
425
433
|
validationFields?.fields?.checkout?.driver_tip?.enabled &&
|
|
426
434
|
driverTipsOptions && driverTipsOptions?.length > 0 &&
|
|
435
|
+
cart?.business_id &&
|
|
427
436
|
(
|
|
428
437
|
<DriverTipsContainer>
|
|
429
438
|
<OText size={14} lineHeight={20} color={theme.colors.textNormal}>
|
|
@@ -490,6 +499,7 @@ const CartUI = (props: any) => {
|
|
|
490
499
|
marginTop: 10,
|
|
491
500
|
borderRadius: 7.6
|
|
492
501
|
}}
|
|
502
|
+
forwardRef={commentRef}
|
|
493
503
|
multiline
|
|
494
504
|
/>
|
|
495
505
|
{commentState?.loading && (
|
|
@@ -588,14 +598,6 @@ const CartUI = (props: any) => {
|
|
|
588
598
|
setOpenPlaceModal={setOpenPlaceModal}
|
|
589
599
|
/>
|
|
590
600
|
</OModal>
|
|
591
|
-
<OAlert
|
|
592
|
-
open={confirm.open}
|
|
593
|
-
title={confirm.title}
|
|
594
|
-
content={confirm.content}
|
|
595
|
-
onAccept={confirm.handleOnAccept}
|
|
596
|
-
onCancel={() => setConfirm({ ...confirm, open: false, title: null })}
|
|
597
|
-
onClose={() => setConfirm({ ...confirm, open: false, title: null })}
|
|
598
|
-
/>
|
|
599
601
|
</CContainer>
|
|
600
602
|
)
|
|
601
603
|
}
|
|
@@ -1,29 +1,42 @@
|
|
|
1
|
-
import React, { useState } from 'react';
|
|
1
|
+
import React, { useCallback, useState } from 'react';
|
|
2
2
|
import { View } from 'react-native';
|
|
3
|
-
import { useLanguage, useConfig } from 'ordering-components/native';
|
|
3
|
+
import { useLanguage, useConfig, useUtils, useOrder } from 'ordering-components/native';
|
|
4
4
|
import { useTheme } from 'styled-components/native';
|
|
5
|
-
import { CCContainer, CCNotCarts, CCList, CheckoutAction } from './styles';
|
|
5
|
+
import { CCContainer, CCNotCarts, CCList, CheckoutAction, ChCartsTotal } from './styles';
|
|
6
6
|
|
|
7
7
|
import { Cart } from '../Cart';
|
|
8
8
|
import { OButton, OText } from '../shared';
|
|
9
9
|
import Spinner from 'react-native-loading-spinner-overlay';
|
|
10
|
+
import { NotFoundSource } from '../NotFoundSource';
|
|
10
11
|
|
|
11
12
|
export const CartContent = (props: any) => {
|
|
12
13
|
const {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
onNavigationRedirect,
|
|
15
|
+
singleBusiness,
|
|
16
|
+
businessSlug
|
|
16
17
|
} = props
|
|
17
18
|
|
|
18
19
|
const theme = useTheme();
|
|
19
20
|
const [, t] = useLanguage()
|
|
20
21
|
const [{ configs }] = useConfig()
|
|
22
|
+
const [{ parsePrice }] = useUtils();
|
|
21
23
|
const [isCartsLoading, setIsCartsLoading] = useState(false)
|
|
22
|
-
|
|
23
|
-
const
|
|
24
|
+
const [cartsOpened, setCartsOpened] = useState([])
|
|
25
|
+
const [{ carts: cartsContext }] = useOrder();
|
|
26
|
+
const cartsList =
|
|
27
|
+
(cartsContext &&
|
|
28
|
+
Object.values(cartsContext).filter((cart: any) => cart.products.length > 0)) ??
|
|
29
|
+
[];
|
|
30
|
+
const carts = businessSlug
|
|
31
|
+
? cartsList.filter((cart: any) => cart?.business?.slug === businessSlug || parseInt(businessSlug) === cart?.business_id)
|
|
32
|
+
: cartsList
|
|
33
|
+
const isOrderStateCarts = !!carts
|
|
24
34
|
const isMultiCheckout = configs?.checkout_multi_business_enabled?.value === '1'
|
|
25
|
-
const cartsAvailable: any = Object.values(carts)?.filter((cart: any) => cart?.valid && cart?.status !== 2)
|
|
26
|
-
|
|
35
|
+
const cartsAvailable: any = Object.values(carts || {})?.filter((cart: any) => cart?.valid && cart?.status !== 2)
|
|
36
|
+
const totalCartsPrice = cartsAvailable?.length && cartsAvailable.reduce((total: any, cart: any) => { return total + cart?.total }, 0)
|
|
37
|
+
const totalCartsFee = cartsAvailable?.length && cartsAvailable
|
|
38
|
+
?.filter((cart: any) => cart?.status !== 1 && cart?.valid && cart?.products?.length)
|
|
39
|
+
?.reduce((total: any, cart: any) => { return total + (cart?.delivery_price_with_discount) }, 0)
|
|
27
40
|
const handleCheckoutRedirect = () => {
|
|
28
41
|
if (cartsAvailable.length === 1) {
|
|
29
42
|
onNavigationRedirect('CheckoutNavigator', {
|
|
@@ -58,9 +71,21 @@ export const CartContent = (props: any) => {
|
|
|
58
71
|
}
|
|
59
72
|
}
|
|
60
73
|
|
|
74
|
+
const changeActiveState = useCallback((isClosed : boolean, uuid : string) => {
|
|
75
|
+
const isActive = cartsOpened?.includes?.(uuid) || !!singleBusiness
|
|
76
|
+
if (isActive || !isClosed) {
|
|
77
|
+
setCartsOpened(cartsOpened?.filter?.((_uuid) => _uuid !== uuid))
|
|
78
|
+
} else {
|
|
79
|
+
setCartsOpened([
|
|
80
|
+
...cartsOpened,
|
|
81
|
+
uuid
|
|
82
|
+
])
|
|
83
|
+
}
|
|
84
|
+
}, [cartsOpened])
|
|
85
|
+
|
|
61
86
|
return (
|
|
62
87
|
<CCContainer
|
|
63
|
-
style={{ paddingHorizontal:
|
|
88
|
+
style={{ paddingHorizontal: 20 }}
|
|
64
89
|
>
|
|
65
90
|
{isOrderStateCarts && carts?.length > 0 && (
|
|
66
91
|
<>
|
|
@@ -79,6 +104,13 @@ export const CartContent = (props: any) => {
|
|
|
79
104
|
isMultiCheckout={isMultiCheckout}
|
|
80
105
|
hideUpselling
|
|
81
106
|
businessConfigs={cart?.business?.configs}
|
|
107
|
+
hideCouponInput={configs?.multi_business_checkout_coupon_input_style?.value === 'group'}
|
|
108
|
+
hideDeliveryFee={configs?.multi_business_checkout_show_combined_delivery_fee?.value === '1'}
|
|
109
|
+
hideDriverTip={configs?.multi_business_checkout_show_combined_driver_tip?.value === '1'}
|
|
110
|
+
cartsOpened={cartsOpened}
|
|
111
|
+
setCartsOpened={setCartsOpened}
|
|
112
|
+
changeActiveState={changeActiveState}
|
|
113
|
+
isActive={cartsOpened?.includes?.(cart?.uuid) || !!singleBusiness}
|
|
82
114
|
/>
|
|
83
115
|
<View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginHorizontal: -40, marginTop: 20 }} />
|
|
84
116
|
</>
|
|
@@ -86,38 +118,67 @@ export const CartContent = (props: any) => {
|
|
|
86
118
|
</CCList>
|
|
87
119
|
))}
|
|
88
120
|
{isMultiCheckout && (
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
121
|
+
<>
|
|
122
|
+
{!!cartsAvailable.length && (
|
|
123
|
+
<ChCartsTotal>
|
|
124
|
+
{!!totalCartsFee && configs?.multi_business_checkout_show_combined_delivery_fee?.value === '1' && (
|
|
125
|
+
<View style={{ flexDirection: 'row', justifyContent: 'space-between' }}>
|
|
126
|
+
<OText size={14} lineHeight={24} color={theme.colors.textNormal} weight={'400'}>
|
|
127
|
+
{t('TOTAL_DELIVERY_FEE', 'Total delivery fee')}
|
|
128
|
+
</OText>
|
|
129
|
+
<OText size={14} lineHeight={24} color={theme.colors.textNormal} weight={'400'}>
|
|
130
|
+
{parsePrice(totalCartsFee)}
|
|
131
|
+
</OText>
|
|
132
|
+
</View>
|
|
133
|
+
)}
|
|
134
|
+
{cartsAvailable.reduce((sum: any, cart: any) => sum + cart?.driver_tip, 0) > 0 &&
|
|
135
|
+
configs?.multi_business_checkout_show_combined_driver_tip?.value === '1' && (
|
|
136
|
+
<View style={{ flexDirection: 'row', justifyContent: 'space-between' }}>
|
|
137
|
+
<OText size={14} lineHeight={24} color={theme.colors.textNormal} weight={'400'}>
|
|
138
|
+
{t('DRIVER_TIP', 'Driver tip')}
|
|
139
|
+
</OText>
|
|
140
|
+
<OText size={14} lineHeight={24} color={theme.colors.textNormal} weight={'400'}>
|
|
141
|
+
{parsePrice(cartsAvailable.reduce((sum: any, cart: any) => sum + cart?.driver_tip, 0))}
|
|
142
|
+
</OText>
|
|
143
|
+
</View>
|
|
144
|
+
)}
|
|
145
|
+
<View style={{ flexDirection: 'row', justifyContent: 'space-between' }}>
|
|
146
|
+
<OText size={16} lineHeight={24} color={theme.colors.textNormal} weight={'500'}>
|
|
147
|
+
{t('TOTAL_FOR_ALL_CARTS', 'Total for all Carts')}
|
|
148
|
+
</OText>
|
|
149
|
+
<OText size={16} lineHeight={24} color={theme.colors.textNormal} weight={'500'}>{parsePrice(totalCartsPrice)}</OText>
|
|
150
|
+
</View>
|
|
151
|
+
<View style={{ flexDirection: 'row', justifyContent: 'center', marginVertical: 20 }}>
|
|
152
|
+
<OText size={14} color={theme.colors.textNormal} weight={'300'} style={{ textAlign: 'center' }}>
|
|
153
|
+
{t('CART_GROUP_MESSAGE_ALERT', 'Discounts may be applied at the time of payment for this group.')}
|
|
154
|
+
</OText>
|
|
155
|
+
</View>
|
|
156
|
+
</ChCartsTotal>
|
|
157
|
+
)}
|
|
158
|
+
<CheckoutAction style={{ marginTop: 0 }}>
|
|
159
|
+
<OButton
|
|
160
|
+
text={t('CHECKOUT', 'Checkout')}
|
|
161
|
+
bgColor={!cartsAvailable.length ? theme.colors.secundary : theme.colors.primary}
|
|
162
|
+
isDisabled={!cartsAvailable.length}
|
|
163
|
+
borderColor={theme.colors.primary}
|
|
164
|
+
imgRightSrc={null}
|
|
165
|
+
textStyle={{ color: 'white', textAlign: 'center', flex: 1 }}
|
|
166
|
+
onClick={() => handleCheckoutRedirect()}
|
|
167
|
+
style={{ width: '100%', flexDirection: 'row', justifyContent: 'center', borderRadius: 7.6, shadowOpacity: 0 }}
|
|
168
|
+
/>
|
|
169
|
+
</CheckoutAction>
|
|
170
|
+
</>
|
|
101
171
|
)}
|
|
102
172
|
</>
|
|
103
173
|
)}
|
|
104
174
|
{(!carts || carts?.length === 0) && (
|
|
105
175
|
<CCNotCarts>
|
|
106
|
-
<
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
borderColor={theme.colors.primary}
|
|
113
|
-
textStyle={{
|
|
114
|
-
color: theme.colors.white,
|
|
115
|
-
fontSize: 14,
|
|
116
|
-
paddingRight: 0
|
|
117
|
-
}}
|
|
118
|
-
style={{ height: 35, marginVertical: 20, borderRadius: 8 }}
|
|
119
|
-
imgRightSrc={null}
|
|
120
|
-
onClick={() => onNavigationRedirect('BusinessList')}
|
|
176
|
+
<NotFoundSource
|
|
177
|
+
hideImage
|
|
178
|
+
btnStyle={{ borderRadius: 8 }}
|
|
179
|
+
content={t('CARTS_NOT_FOUND', 'You don\'t have carts available')}
|
|
180
|
+
btnTitle={t('START_SHOPPING', 'Start shopping')}
|
|
181
|
+
onClickButton={() => singleBusiness ? onNavigationRedirect('Business') : onNavigationRedirect('BusinessList')}
|
|
121
182
|
/>
|
|
122
183
|
</CCNotCarts>
|
|
123
184
|
)}
|
|
@@ -5,13 +5,9 @@ export const CCContainer = styled.View`
|
|
|
5
5
|
`
|
|
6
6
|
|
|
7
7
|
export const CCNotCarts = styled.View`
|
|
8
|
-
height: 300px;
|
|
9
|
-
display: flex;
|
|
10
8
|
flex-direction: column;
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
width: 80%;
|
|
14
|
-
margin: auto;
|
|
9
|
+
align-items: center;
|
|
10
|
+
margin-top: 40px;
|
|
15
11
|
`
|
|
16
12
|
|
|
17
13
|
export const CCList = styled.ScrollView`
|
|
@@ -27,3 +23,7 @@ export const CheckoutAction = styled.View`
|
|
|
27
23
|
margin-top: 10px;
|
|
28
24
|
margin-bottom: 10px;
|
|
29
25
|
`
|
|
26
|
+
|
|
27
|
+
export const ChCartsTotal = styled.View`
|
|
28
|
+
margin-bottom: 16px;
|
|
29
|
+
`
|
|
@@ -9,7 +9,7 @@ export const Container = styled.View`
|
|
|
9
9
|
`
|
|
10
10
|
|
|
11
11
|
export const ItemListing = styled.ScrollView`
|
|
12
|
-
padding: 0
|
|
12
|
+
padding: 0 20px;
|
|
13
13
|
margin: 0 0 140px;
|
|
14
14
|
`
|
|
15
15
|
|
|
@@ -19,7 +19,7 @@ export const TopHeader = styled.View`
|
|
|
19
19
|
align-items: center;
|
|
20
20
|
justify-content: space-between;
|
|
21
21
|
z-index: 1;
|
|
22
|
-
padding: 0
|
|
22
|
+
padding: 0 20px;
|
|
23
23
|
`
|
|
24
24
|
|
|
25
25
|
export const HeaderItem = styled.TouchableOpacity`
|