ordering-ui-react-native 0.18.55 → 0.18.56-crash-driver-1
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 -4
- package/src/components/BusinessInformation/index.tsx +10 -9
- package/src/components/PaymentOptionsWebView/index.tsx +30 -8
- package/src/components/PhoneInputNumber/index.tsx +6 -2
- package/src/components/StripeMethodForm/index.tsx +60 -55
- package/src/components/shared/OToast.tsx +3 -2
- package/src/types/index.tsx +3 -1
- package/src/utils/index.tsx +2 -2
- package/themes/business/index.tsx +6 -0
- package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +15 -8
- 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 +48 -19
- package/themes/business/src/components/DriverMap/index.tsx +36 -23
- 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 +15 -8
- package/themes/business/src/components/Home/index.tsx +5 -1
- package/themes/business/src/components/LanguageSelector/index.tsx +1 -2
- package/themes/business/src/components/LanguageSelector/lang_country.json +515 -70
- package/themes/business/src/components/LoginForm/index.tsx +2 -2
- package/themes/business/src/components/LogoutButton/index.tsx +1 -1
- package/themes/business/src/components/MapView/index.tsx +28 -17
- package/themes/business/src/components/MessagesOption/index.tsx +22 -94
- package/themes/business/src/components/NewOrderNotification/index.tsx +162 -106
- package/themes/business/src/components/NotFoundSource/index.tsx +2 -2
- package/themes/business/src/components/OrderDetails/Business.tsx +53 -3
- package/themes/business/src/components/OrderDetails/Delivery.tsx +209 -13
- package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +107 -75
- package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +79 -41
- package/themes/business/src/components/OrderDetails/usePrinterCommands.tsx +220 -0
- package/themes/business/src/components/OrderDetailsLogistic/index.tsx +7 -2
- package/themes/business/src/components/OrderMessage/index.tsx +1 -1
- package/themes/business/src/components/OrderSummary/index.tsx +245 -82
- 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 +125 -48
- package/themes/business/src/components/PhoneInputNumber/index.tsx +8 -5
- 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 +43 -41
- 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 +195 -221
- package/themes/business/src/components/PreviousOrders/styles.tsx +10 -0
- package/themes/business/src/components/PrinterEdition/index.tsx +363 -0
- package/themes/business/src/components/PrinterEdition/styles.tsx +61 -0
- package/themes/business/src/components/PrinterSettings/index.tsx +267 -0
- package/themes/business/src/components/PrinterSettings/styles.tsx +30 -0
- package/themes/business/src/components/ProductItemAccordion/index.tsx +2 -2
- package/themes/business/src/components/ReviewCustomer/index.tsx +1 -1
- package/themes/business/src/components/SearchBar/index.tsx +2 -1
- package/themes/business/src/components/Sessions/index.tsx +187 -0
- package/themes/business/src/components/Sessions/styles.tsx +20 -0
- package/themes/business/src/components/StoresList/index.tsx +4 -3
- package/themes/business/src/components/UserFormDetails/index.tsx +111 -107
- package/themes/business/src/components/UserProfileForm/index.tsx +103 -53
- 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/OInput.tsx +2 -0
- package/themes/business/src/hooks/useLocation.tsx +5 -4
- package/themes/business/src/types/index.tsx +21 -1
- package/themes/business/src/utils/index.tsx +5 -0
- package/themes/kiosk/src/components/Checkout/index.tsx +5 -3
- package/themes/kiosk/src/components/CustomerName/index.tsx +1 -1
- package/themes/kiosk/src/components/Intro/index.tsx +16 -1
- package/themes/kiosk/src/components/LoginForm/index.tsx +131 -101
- package/themes/kiosk/src/components/PaymentOptions/index.tsx +57 -121
- package/themes/original/index.tsx +11 -3
- package/themes/original/src/components/AddressDetails/index.tsx +20 -10
- package/themes/original/src/components/AddressForm/index.tsx +41 -20
- package/themes/original/src/components/AddressForm/styles.tsx +1 -1
- package/themes/original/src/components/AddressList/index.tsx +22 -11
- package/themes/original/src/components/AddressList/styles.tsx +4 -4
- package/themes/original/src/components/AnalyticsSegment/index.tsx +10 -7
- package/themes/original/src/components/AppleLogin/styles.tsx +3 -1
- package/themes/original/src/components/BusinessBasicInformation/index.tsx +8 -11
- package/themes/original/src/components/BusinessBasicInformation/styles.tsx +1 -1
- package/themes/original/src/components/BusinessController/index.tsx +40 -43
- package/themes/original/src/components/BusinessController/styles.tsx +12 -12
- package/themes/original/src/components/BusinessInformation/index.tsx +45 -17
- package/themes/original/src/components/BusinessInformation/styles.tsx +2 -2
- package/themes/original/src/components/BusinessItemAccordion/index.tsx +11 -7
- 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 +57 -361
- package/themes/original/src/components/BusinessListingSearch/styles.tsx +1 -1
- package/themes/original/src/components/BusinessPreorder/index.tsx +9 -7
- package/themes/original/src/components/BusinessProductsCategories/index.tsx +2 -3
- package/themes/original/src/components/BusinessProductsList/index.tsx +5 -4
- package/themes/original/src/components/BusinessProductsListing/index.tsx +67 -28
- package/themes/original/src/components/BusinessProductsListing/styles.tsx +3 -4
- package/themes/original/src/components/BusinessReviews/index.tsx +1 -1
- 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 +30 -404
- package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +2 -2
- package/themes/original/src/components/Cart/index.tsx +51 -40
- package/themes/original/src/components/CartContent/index.tsx +98 -54
- package/themes/original/src/components/CartStoresListing/styles.tsx +2 -2
- package/themes/original/src/components/Checkout/index.tsx +308 -75
- package/themes/original/src/components/Checkout/styles.tsx +17 -0
- package/themes/original/src/components/CitiesControl/styles.tsx +1 -1
- package/themes/original/src/components/DatePicker/index.tsx +33 -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 +8 -4
- 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/ForgotPasswordForm/index.tsx +5 -0
- package/themes/original/src/components/GPSButton/index.tsx +7 -5
- package/themes/original/src/components/GiftCard/GiftCardOrdersList/index.tsx +64 -0
- package/themes/original/src/components/GiftCard/GiftCardOrdersList/styles.tsx +8 -0
- package/themes/original/src/components/GiftCard/GiftCardUI/index.tsx +8 -3
- package/themes/original/src/components/GiftCard/PurchaseGiftCard/index.tsx +36 -3
- package/themes/original/src/components/GiftCard/PurchaseGiftCard/styles.tsx +1 -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/index.tsx +2 -2
- package/themes/original/src/components/GiftCard/SendGiftCard/styles.tsx +1 -1
- package/themes/original/src/components/GiftCard/SingleGiftCard/index.tsx +101 -0
- package/themes/original/src/components/GiftCard/SingleGiftCard/styles.tsx +4 -0
- package/themes/original/src/components/GiftCard/VerticalGiftCardOrdersLayout/index.tsx +83 -0
- package/themes/original/src/components/GiftCard/VerticalGiftCardOrdersLayout/styles.tsx +9 -0
- package/themes/original/src/components/GoogleLogin/styles.tsx +1 -1
- package/themes/original/src/components/GoogleMap/index.tsx +52 -5
- package/themes/original/src/components/Help/index.tsx +7 -0
- package/themes/original/src/components/HelpAccountAndPayment/index.tsx +5 -0
- package/themes/original/src/components/HelpGuide/index.tsx +5 -0
- package/themes/original/src/components/HelpOrder/index.tsx +5 -0
- 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 +3 -2
- 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 +79 -25
- package/themes/original/src/components/LoginForm/index.tsx +38 -14
- package/themes/original/src/components/MessageListing/index.tsx +6 -0
- package/themes/original/src/components/Messages/index.tsx +9 -3
- package/themes/original/src/components/Messages/styles.tsx +1 -1
- package/themes/original/src/components/MomentOption/index.tsx +20 -5
- 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 +48 -15
- package/themes/original/src/components/MultiCheckout/index.tsx +295 -56
- package/themes/original/src/components/MultiCheckout/styles.tsx +20 -1
- package/themes/original/src/components/MultiOrdersDetails/index.tsx +21 -16
- package/themes/original/src/components/MyOrders/index.tsx +37 -39
- package/themes/original/src/components/NavBar/index.tsx +15 -14
- 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/Notifications/index.tsx +9 -8
- package/themes/original/src/components/Notifications/styles.tsx +0 -1
- package/themes/original/src/components/OrderDetails/OrderEta.tsx +21 -6
- package/themes/original/src/components/OrderDetails/OrderHistory.tsx +14 -5
- package/themes/original/src/components/OrderDetails/index.tsx +718 -667
- package/themes/original/src/components/OrderDetails/styles.tsx +24 -7
- package/themes/original/src/components/OrderProgress/index.tsx +50 -14
- package/themes/original/src/components/OrderProgress/styles.tsx +1 -1
- package/themes/original/src/components/OrderSummary/index.tsx +26 -34
- package/themes/original/src/components/OrderTypeSelector/index.tsx +5 -0
- package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/styles.tsx +1 -1
- package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/styles.tsx +1 -1
- package/themes/original/src/components/OrdersOption/index.tsx +14 -6
- package/themes/original/src/components/OrdersOption/styles.tsx +1 -1
- package/themes/original/src/components/PageBanner/index.tsx +3 -0
- package/themes/original/src/components/PaymentOptionCard/index.tsx +182 -0
- package/themes/original/src/components/PaymentOptionStripe/styles.tsx +3 -0
- package/themes/original/src/components/PaymentOptions/index.tsx +118 -37
- package/themes/original/src/components/PhoneInputNumber/index.tsx +15 -1
- package/themes/original/src/components/PreviousOrders/index.tsx +2 -0
- package/themes/original/src/components/ProductForm/ActionButton.tsx +122 -0
- package/themes/original/src/components/ProductForm/ExtraOptions.tsx +56 -0
- package/themes/original/src/components/ProductForm/index.tsx +193 -267
- package/themes/original/src/components/ProductForm/styles.tsx +1 -1
- package/themes/original/src/components/ProductItemAccordion/index.tsx +55 -42
- package/themes/original/src/components/ProductItemAccordion/styles.tsx +3 -4
- package/themes/original/src/components/ProductOptionSubOption/index.tsx +120 -79
- 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 +13 -11
- package/themes/original/src/components/Promotions/styles.tsx +0 -2
- package/themes/original/src/components/ReviewDriver/index.tsx +5 -0
- package/themes/original/src/components/ReviewDriver/styles.tsx +1 -1
- package/themes/original/src/components/ReviewOrder/index.tsx +5 -0
- package/themes/original/src/components/ReviewOrder/styles.tsx +1 -1
- package/themes/original/src/components/ReviewProducts/index.tsx +5 -0
- 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/Sessions/index.tsx +5 -0
- package/themes/original/src/components/SignupForm/index.tsx +76 -60
- package/themes/original/src/components/SingleOrderCard/index.tsx +6 -5
- package/themes/original/src/components/SingleProductCard/index.tsx +5 -4
- package/themes/original/src/components/SingleProductCard/styles.tsx +0 -5
- package/themes/original/src/components/StripeCardsList/index.tsx +26 -8
- package/themes/original/src/components/StripeElementsForm/index.tsx +80 -62
- package/themes/original/src/components/StripeElementsForm/naked.tsx +59 -1
- package/themes/original/src/components/UpsellingProducts/UpsellingContent.tsx +170 -0
- package/themes/original/src/components/UpsellingProducts/UpsellingLayout.tsx +91 -0
- package/themes/original/src/components/UpsellingProducts/index.tsx +15 -199
- package/themes/original/src/components/UpsellingProducts/styles.tsx +19 -0
- package/themes/original/src/components/UserFormDetails/index.tsx +128 -79
- package/themes/original/src/components/UserFormDetails/styles.tsx +8 -1
- package/themes/original/src/components/UserProfile/index.tsx +5 -4
- package/themes/original/src/components/UserProfileForm/index.tsx +35 -36
- 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/styles.tsx +1 -0
- package/themes/original/src/components/Wallets/index.tsx +35 -49
- package/themes/original/src/components/Wallets/styles.tsx +3 -4
- package/themes/original/src/components/WebsocketStatus/index.tsx +172 -0
- package/themes/original/src/components/WebsocketStatus/styles.tsx +28 -0
- package/themes/original/src/components/shared/HeaderTitle.tsx +1 -1
- package/themes/original/src/components/shared/OButton.tsx +5 -5
- package/themes/original/src/components/shared/OInput.tsx +7 -4
- package/themes/original/src/components/shared/OModal.tsx +12 -14
- package/themes/original/src/layouts/Container.tsx +5 -3
- package/themes/original/src/types/index.tsx +13 -2
- package/themes/original/src/utils/index.tsx +124 -22
- 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'
|
|
@@ -52,7 +52,11 @@ const CartUI = (props: any) => {
|
|
|
52
52
|
preorderMaximumDays,
|
|
53
53
|
preorderMinimumDays,
|
|
54
54
|
cateringTypes,
|
|
55
|
-
isFromUpselling
|
|
55
|
+
isFromUpselling,
|
|
56
|
+
cartsOpened,
|
|
57
|
+
setCartsOpened,
|
|
58
|
+
changeActiveState,
|
|
59
|
+
isActive
|
|
56
60
|
} = props
|
|
57
61
|
|
|
58
62
|
const theme = useTheme();
|
|
@@ -62,12 +66,11 @@ const CartUI = (props: any) => {
|
|
|
62
66
|
const [{ configs }] = useConfig();
|
|
63
67
|
const [{ parsePrice, parseNumber, parseDate }] = useUtils()
|
|
64
68
|
const [validationFields] = useValidationFields()
|
|
65
|
-
|
|
69
|
+
const commentRef = useRef()
|
|
66
70
|
const [openUpselling, setOpenUpselling] = useState(false)
|
|
67
71
|
const [openChangeStore, setOpenChangeStore] = useState(false)
|
|
68
72
|
const [canOpenUpselling, setCanOpenUpselling] = useState(false)
|
|
69
73
|
const [openTaxModal, setOpenTaxModal] = useState<any>({ open: false, data: null, type: '' })
|
|
70
|
-
const [confirm, setConfirm] = useState<any>({ open: false, content: null, handleOnAccept: null, id: null, title: null })
|
|
71
74
|
const [openPlaceModal, setOpenPlaceModal] = useState(false)
|
|
72
75
|
const [maxDate, setMaxDate] = useState<any>(null)
|
|
73
76
|
const isCartPending = cart?.status === 2
|
|
@@ -75,7 +78,6 @@ const CartUI = (props: any) => {
|
|
|
75
78
|
const business: any = (orderState?.carts && Object.values(orderState.carts).find((_cart: any) => _cart?.uuid === props.cartuuid)) ?? {}
|
|
76
79
|
const businessId = business?.business_id ?? null
|
|
77
80
|
const placeSpotTypes = [4]
|
|
78
|
-
const isChewLayout = theme?.header?.components?.layout?.type?.toLowerCase() === 'chew'
|
|
79
81
|
const hideCartComments = theme?.business_view?.components?.cart?.components?.comments?.hidden
|
|
80
82
|
const hideCartDiscount = theme?.business_view?.components?.cart?.components?.discount?.hidden
|
|
81
83
|
const driverTipsOptions = typeof configs?.driver_tip_options?.value === 'string'
|
|
@@ -111,7 +113,7 @@ const CartUI = (props: any) => {
|
|
|
111
113
|
}
|
|
112
114
|
}
|
|
113
115
|
|
|
114
|
-
const handleUpsellingPage = (individualCart
|
|
116
|
+
const handleUpsellingPage = (individualCart: any) => {
|
|
115
117
|
const isProductCartParam = !!individualCart?.products?.length
|
|
116
118
|
setOpenUpselling(false)
|
|
117
119
|
setCanOpenUpselling(false)
|
|
@@ -119,7 +121,7 @@ const CartUI = (props: any) => {
|
|
|
119
121
|
const cartsAvailable: any = Object.values(orderState?.carts)
|
|
120
122
|
?.filter((_cart: any) => _cart?.valid && _cart?.status !== 2 && _cart?.products?.length)
|
|
121
123
|
?.filter((_c: any) => !isProductCartParam ? _c.uuid !== individualCart?.uuid : _c)
|
|
122
|
-
if (cartsAvailable.length === 1 || !isMultiCheckout) {
|
|
124
|
+
if (cartsAvailable.length === 1 || !isMultiCheckout || !cart?.business_id) {
|
|
123
125
|
const cart = isMultiCheckout ? cartsAvailable[0] : individualCart
|
|
124
126
|
onNavigationRedirect('CheckoutNavigator', {
|
|
125
127
|
screen: 'CheckoutPage',
|
|
@@ -167,16 +169,16 @@ const CartUI = (props: any) => {
|
|
|
167
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)
|
|
168
170
|
}
|
|
169
171
|
|
|
170
|
-
const
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
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
|
+
)
|
|
180
182
|
}
|
|
181
183
|
|
|
182
184
|
const walletName: any = {
|
|
@@ -194,6 +196,18 @@ const CartUI = (props: any) => {
|
|
|
194
196
|
return acc = acc
|
|
195
197
|
}, cart?.subtotal)
|
|
196
198
|
|
|
199
|
+
const handleClickCheckout = () => {
|
|
200
|
+
if (cart?.business_id) {
|
|
201
|
+
setOpenUpselling(true)
|
|
202
|
+
} else {
|
|
203
|
+
onNavigationRedirect('CheckoutNavigator', {
|
|
204
|
+
screen: 'CheckoutPage',
|
|
205
|
+
cartUuid: cart?.uuid,
|
|
206
|
+
cartTotal: cart?.total
|
|
207
|
+
}, true)
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
|
|
197
211
|
useEffect(() => {
|
|
198
212
|
const limitDays = parseInt(preorderMaximumDays ?? configs?.max_days_preorder?.value, 10)
|
|
199
213
|
const currentDate = new Date()
|
|
@@ -209,7 +223,7 @@ const CartUI = (props: any) => {
|
|
|
209
223
|
|
|
210
224
|
return (
|
|
211
225
|
<CContainer>
|
|
212
|
-
{openUpselling && (
|
|
226
|
+
{!!openUpselling && (
|
|
213
227
|
<UpsellingProducts
|
|
214
228
|
handleUpsellingPage={handleUpsellingPage}
|
|
215
229
|
openUpselling={openUpselling}
|
|
@@ -230,10 +244,15 @@ const CartUI = (props: any) => {
|
|
|
230
244
|
handleCartOpen={handleCartOpen}
|
|
231
245
|
onNavigationRedirect={props.onNavigationRedirect}
|
|
232
246
|
handleChangeStore={() => setOpenChangeStore(true)}
|
|
233
|
-
handleClickCheckout={() =>
|
|
247
|
+
handleClickCheckout={() => handleClickCheckout()}
|
|
234
248
|
checkoutButtonDisabled={(openUpselling && !canOpenUpselling) || subtotalWithTaxes < cart?.minimum || !cart?.valid_address}
|
|
235
249
|
isMultiCheckout={isMultiCheckout}
|
|
236
250
|
isFromUpselling={isFromUpselling}
|
|
251
|
+
cartsOpened={cartsOpened}
|
|
252
|
+
setCartsOpened={setCartsOpened}
|
|
253
|
+
changeActiveState={changeActiveState}
|
|
254
|
+
isActive={isActive}
|
|
255
|
+
isGiftCart={!cart?.business_id}
|
|
237
256
|
>
|
|
238
257
|
{cart?.products?.length > 0 && cart?.products.map((product: any, i: number) => (
|
|
239
258
|
<ProductItemAccordion
|
|
@@ -283,9 +302,9 @@ const CartUI = (props: any) => {
|
|
|
283
302
|
<TouchableOpacity style={{ marginLeft: 3 }} onPress={() => setOpenTaxModal({ open: true, data: offer, type: 'offer_target_1' })}>
|
|
284
303
|
<AntIcon name='infocirlceo' size={16} color={theme.colors.primary} />
|
|
285
304
|
</TouchableOpacity>
|
|
286
|
-
|
|
287
|
-
<
|
|
288
|
-
|
|
305
|
+
{!!offer?.id && (
|
|
306
|
+
<OfferAlert offerId={offer?.id} />
|
|
307
|
+
)}
|
|
289
308
|
</OSRow>
|
|
290
309
|
<OText size={12} lineHeight={18}>
|
|
291
310
|
- {parsePrice(offer?.summary?.discount)}
|
|
@@ -347,10 +366,8 @@ const CartUI = (props: any) => {
|
|
|
347
366
|
<TouchableOpacity style={{ marginLeft: 3 }} onPress={() => setOpenTaxModal({ open: true, data: offer, type: 'offer_target_3' })}>
|
|
348
367
|
<AntIcon name='infocirlceo' size={16} color={theme.colors.primary} />
|
|
349
368
|
</TouchableOpacity>
|
|
350
|
-
{
|
|
351
|
-
<
|
|
352
|
-
<AntIcon name='closecircle' size={16} color={theme.colors.primary} />
|
|
353
|
-
</TouchableOpacity>
|
|
369
|
+
{!!offer?.id && (
|
|
370
|
+
<OfferAlert offerId={offer?.id} />
|
|
354
371
|
)}
|
|
355
372
|
</OSRow>
|
|
356
373
|
<OText size={12} lineHeight={18}>
|
|
@@ -376,9 +393,9 @@ const CartUI = (props: any) => {
|
|
|
376
393
|
<TouchableOpacity style={{ marginLeft: 3 }} onPress={() => setOpenTaxModal({ open: true, data: offer, type: 'offer_target_2' })}>
|
|
377
394
|
<AntIcon name='infocirlceo' size={16} color={theme.colors.primary} />
|
|
378
395
|
</TouchableOpacity>
|
|
379
|
-
|
|
380
|
-
<
|
|
381
|
-
|
|
396
|
+
{!!offer?.id && (
|
|
397
|
+
<OfferAlert offerId={offer?.id} />
|
|
398
|
+
)}
|
|
382
399
|
</OSRow>
|
|
383
400
|
<OText size={12} lineHeight={18}>
|
|
384
401
|
- {parsePrice(offer?.summary?.discount)}
|
|
@@ -427,6 +444,7 @@ const CartUI = (props: any) => {
|
|
|
427
444
|
cart?.status !== 2 &&
|
|
428
445
|
validationFields?.fields?.checkout?.driver_tip?.enabled &&
|
|
429
446
|
driverTipsOptions && driverTipsOptions?.length > 0 &&
|
|
447
|
+
cart?.business_id &&
|
|
430
448
|
(
|
|
431
449
|
<DriverTipsContainer>
|
|
432
450
|
<OText size={14} lineHeight={20} color={theme.colors.textNormal}>
|
|
@@ -493,6 +511,7 @@ const CartUI = (props: any) => {
|
|
|
493
511
|
marginTop: 10,
|
|
494
512
|
borderRadius: 7.6
|
|
495
513
|
}}
|
|
514
|
+
forwardRef={commentRef}
|
|
496
515
|
multiline
|
|
497
516
|
/>
|
|
498
517
|
{commentState?.loading && (
|
|
@@ -525,7 +544,7 @@ const CartUI = (props: any) => {
|
|
|
525
544
|
/>
|
|
526
545
|
</View>
|
|
527
546
|
)}
|
|
528
|
-
{!isMultiCheckout && (
|
|
547
|
+
{(!isMultiCheckout || !cart?.business_id) && (
|
|
529
548
|
<>
|
|
530
549
|
{cart?.valid_products ? (
|
|
531
550
|
<CheckoutAction>
|
|
@@ -542,7 +561,7 @@ const CartUI = (props: any) => {
|
|
|
542
561
|
borderColor={theme.colors.primary}
|
|
543
562
|
imgRightSrc={null}
|
|
544
563
|
textStyle={{ color: '#fff', textAlign: 'center', flex: 1 }}
|
|
545
|
-
onClick={() =>
|
|
564
|
+
onClick={() => handleClickCheckout()}
|
|
546
565
|
style={{ width: '100%', flexDirection: 'row', justifyContent: 'center', borderRadius: 7.6, shadowOpacity: 0 }}
|
|
547
566
|
/>
|
|
548
567
|
</CheckoutAction>
|
|
@@ -591,14 +610,6 @@ const CartUI = (props: any) => {
|
|
|
591
610
|
setOpenPlaceModal={setOpenPlaceModal}
|
|
592
611
|
/>
|
|
593
612
|
</OModal>
|
|
594
|
-
<OAlert
|
|
595
|
-
open={confirm.open}
|
|
596
|
-
title={confirm.title}
|
|
597
|
-
content={confirm.content}
|
|
598
|
-
onAccept={confirm.handleOnAccept}
|
|
599
|
-
onCancel={() => setConfirm({ ...confirm, open: false, title: null })}
|
|
600
|
-
onClose={() => setConfirm({ ...confirm, open: false, title: null })}
|
|
601
|
-
/>
|
|
602
613
|
</CContainer>
|
|
603
614
|
)
|
|
604
615
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import React, { useState } from 'react';
|
|
1
|
+
import React, { useCallback, useEffect, useState } from 'react';
|
|
2
2
|
import { View } from 'react-native';
|
|
3
|
-
import { useLanguage, useConfig, useUtils } from 'ordering-components/native';
|
|
3
|
+
import { useLanguage, useConfig, useUtils, useOrder } from 'ordering-components/native';
|
|
4
4
|
import { useTheme } from 'styled-components/native';
|
|
5
5
|
import { CCContainer, CCNotCarts, CCList, CheckoutAction, ChCartsTotal } from './styles';
|
|
6
6
|
|
|
@@ -11,9 +11,10 @@ import { NotFoundSource } from '../NotFoundSource';
|
|
|
11
11
|
|
|
12
12
|
export const CartContent = (props: any) => {
|
|
13
13
|
const {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
onNavigationRedirect,
|
|
15
|
+
singleBusiness,
|
|
16
|
+
businessSlug,
|
|
17
|
+
navigation
|
|
17
18
|
} = props
|
|
18
19
|
|
|
19
20
|
const theme = useTheme();
|
|
@@ -21,16 +22,22 @@ export const CartContent = (props: any) => {
|
|
|
21
22
|
const [{ configs }] = useConfig()
|
|
22
23
|
const [{ parsePrice }] = useUtils();
|
|
23
24
|
const [isCartsLoading, setIsCartsLoading] = useState(false)
|
|
24
|
-
|
|
25
|
-
const
|
|
25
|
+
const [cartsOpened, setCartsOpened] = useState([])
|
|
26
|
+
const [{ carts: cartsContext }, { confirmCart }] = useOrder();
|
|
27
|
+
const cartsList =
|
|
28
|
+
(cartsContext &&
|
|
29
|
+
Object.values(cartsContext).filter((cart: any) => cart.products.length > 0)) ??
|
|
30
|
+
[];
|
|
31
|
+
const carts = businessSlug
|
|
32
|
+
? cartsList.filter((cart: any) => cart?.business?.slug === businessSlug || parseInt(businessSlug) === cart?.business_id)
|
|
33
|
+
: cartsList
|
|
34
|
+
const isOrderStateCarts = !!carts
|
|
26
35
|
const isMultiCheckout = configs?.checkout_multi_business_enabled?.value === '1'
|
|
27
|
-
const cartsAvailable: any = Object.values(carts)?.filter((cart: any) => cart?.valid && cart?.status !== 2)
|
|
28
|
-
|
|
36
|
+
const cartsAvailable: any = Object.values(carts || {})?.filter((cart: any) => cart?.valid && cart?.status !== 2 && cart?.business_id)
|
|
29
37
|
const totalCartsPrice = cartsAvailable?.length && cartsAvailable.reduce((total: any, cart: any) => { return total + cart?.total }, 0)
|
|
30
38
|
const totalCartsFee = cartsAvailable?.length && cartsAvailable
|
|
31
39
|
?.filter((cart: any) => cart?.status !== 1 && cart?.valid && cart?.products?.length)
|
|
32
40
|
?.reduce((total: any, cart: any) => { return total + (cart?.delivery_price_with_discount) }, 0)
|
|
33
|
-
|
|
34
41
|
const handleCheckoutRedirect = () => {
|
|
35
42
|
if (cartsAvailable.length === 1) {
|
|
36
43
|
onNavigationRedirect('CheckoutNavigator', {
|
|
@@ -65,9 +72,35 @@ export const CartContent = (props: any) => {
|
|
|
65
72
|
}
|
|
66
73
|
}
|
|
67
74
|
|
|
75
|
+
const changeActiveState = useCallback((isClosed: boolean, uuid: string) => {
|
|
76
|
+
const isActive = cartsOpened?.includes?.(uuid) || !!singleBusiness
|
|
77
|
+
if (isActive || !isClosed) {
|
|
78
|
+
setCartsOpened(cartsOpened?.filter?.((_uuid) => _uuid !== uuid))
|
|
79
|
+
} else {
|
|
80
|
+
setCartsOpened([
|
|
81
|
+
...cartsOpened,
|
|
82
|
+
uuid
|
|
83
|
+
])
|
|
84
|
+
}
|
|
85
|
+
}, [cartsOpened])
|
|
86
|
+
|
|
87
|
+
useEffect(() => {
|
|
88
|
+
const unsuscribe = navigation.addListener('focus', () => {
|
|
89
|
+
const cartsListBlockedByPaypal = carts?.filter((cart: any) => cart?.status === 2 && cart?.paymethod_data?.gateway === 'paypal')
|
|
90
|
+
if (cartsListBlockedByPaypal?.length > 0) {
|
|
91
|
+
cartsListBlockedByPaypal.map(async (cart: any) => {
|
|
92
|
+
await confirmCart(cart?.uuid)
|
|
93
|
+
})
|
|
94
|
+
}
|
|
95
|
+
})
|
|
96
|
+
return () => {
|
|
97
|
+
return unsuscribe()
|
|
98
|
+
}
|
|
99
|
+
}, [carts, navigation])
|
|
100
|
+
|
|
68
101
|
return (
|
|
69
102
|
<CCContainer
|
|
70
|
-
style={{ paddingHorizontal:
|
|
103
|
+
style={{ paddingHorizontal: 20 }}
|
|
71
104
|
>
|
|
72
105
|
{isOrderStateCarts && carts?.length > 0 && (
|
|
73
106
|
<>
|
|
@@ -87,8 +120,12 @@ export const CartContent = (props: any) => {
|
|
|
87
120
|
hideUpselling
|
|
88
121
|
businessConfigs={cart?.business?.configs}
|
|
89
122
|
hideCouponInput={configs?.multi_business_checkout_coupon_input_style?.value === 'group'}
|
|
90
|
-
|
|
123
|
+
hideDeliveryFee={configs?.multi_business_checkout_show_combined_delivery_fee?.value === '1'}
|
|
91
124
|
hideDriverTip={configs?.multi_business_checkout_show_combined_driver_tip?.value === '1'}
|
|
125
|
+
cartsOpened={cartsOpened}
|
|
126
|
+
setCartsOpened={setCartsOpened}
|
|
127
|
+
changeActiveState={changeActiveState}
|
|
128
|
+
isActive={cartsOpened?.includes?.(cart?.uuid) || !!singleBusiness}
|
|
92
129
|
/>
|
|
93
130
|
<View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginHorizontal: -40, marginTop: 20 }} />
|
|
94
131
|
</>
|
|
@@ -98,48 +135,55 @@ export const CartContent = (props: any) => {
|
|
|
98
135
|
{isMultiCheckout && (
|
|
99
136
|
<>
|
|
100
137
|
{!!cartsAvailable.length && (
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
138
|
+
<>
|
|
139
|
+
<ChCartsTotal>
|
|
140
|
+
{!!totalCartsFee && configs?.multi_business_checkout_show_combined_delivery_fee?.value === '1' && (
|
|
141
|
+
<View style={{ flexDirection: 'row', justifyContent: 'space-between' }}>
|
|
142
|
+
<OText size={14} lineHeight={24} color={theme.colors.textNormal} weight={'400'}>
|
|
143
|
+
{t('TOTAL_DELIVERY_FEE', 'Total delivery fee')}
|
|
144
|
+
</OText>
|
|
145
|
+
<OText size={14} lineHeight={24} color={theme.colors.textNormal} weight={'400'}>
|
|
146
|
+
{parsePrice(totalCartsFee)}
|
|
147
|
+
</OText>
|
|
148
|
+
</View>
|
|
149
|
+
)}
|
|
150
|
+
{cartsAvailable.reduce((sum: any, cart: any) => sum + cart?.driver_tip, 0) > 0 &&
|
|
151
|
+
configs?.multi_business_checkout_show_combined_driver_tip?.value === '1' && (
|
|
152
|
+
<View style={{ flexDirection: 'row', justifyContent: 'space-between' }}>
|
|
153
|
+
<OText size={14} lineHeight={24} color={theme.colors.textNormal} weight={'400'}>
|
|
154
|
+
{t('DRIVER_TIP', 'Driver tip')}
|
|
155
|
+
</OText>
|
|
156
|
+
<OText size={14} lineHeight={24} color={theme.colors.textNormal} weight={'400'}>
|
|
157
|
+
{parsePrice(cartsAvailable.reduce((sum: any, cart: any) => sum + cart?.driver_tip, 0))}
|
|
158
|
+
</OText>
|
|
159
|
+
</View>
|
|
160
|
+
)}
|
|
161
|
+
<View style={{ flexDirection: 'row', justifyContent: 'space-between' }}>
|
|
162
|
+
<OText size={16} lineHeight={24} color={theme.colors.textNormal} weight={'500'}>
|
|
163
|
+
{t('TOTAL_FOR_ALL_CARTS', 'Total for all Carts')}
|
|
164
|
+
</OText>
|
|
165
|
+
<OText size={16} lineHeight={24} color={theme.colors.textNormal} weight={'500'}>{parsePrice(totalCartsPrice)}</OText>
|
|
166
|
+
</View>
|
|
167
|
+
<View style={{ flexDirection: 'row', justifyContent: 'center', marginVertical: 20 }}>
|
|
168
|
+
<OText size={14} color={theme.colors.textNormal} weight={'300'} style={{ textAlign: 'center' }}>
|
|
169
|
+
{t('CART_GROUP_MESSAGE_ALERT', 'Discounts may be applied at the time of payment for this group.')}
|
|
170
|
+
</OText>
|
|
171
|
+
</View>
|
|
172
|
+
</ChCartsTotal>
|
|
173
|
+
<CheckoutAction style={{ marginTop: 0 }}>
|
|
174
|
+
<OButton
|
|
175
|
+
text={t('CHECKOUT', 'Checkout')}
|
|
176
|
+
bgColor={!cartsAvailable.length ? theme.colors.secundary : theme.colors.primary}
|
|
177
|
+
isDisabled={!cartsAvailable.length}
|
|
178
|
+
borderColor={theme.colors.primary}
|
|
179
|
+
imgRightSrc={null}
|
|
180
|
+
textStyle={{ color: 'white', textAlign: 'center', flex: 1 }}
|
|
181
|
+
onClick={() => handleCheckoutRedirect()}
|
|
182
|
+
style={{ width: '100%', flexDirection: 'row', justifyContent: 'center', borderRadius: 7.6, shadowOpacity: 0 }}
|
|
183
|
+
/>
|
|
184
|
+
</CheckoutAction>
|
|
185
|
+
</>
|
|
130
186
|
)}
|
|
131
|
-
<CheckoutAction style={{ marginTop: 0 }}>
|
|
132
|
-
<OButton
|
|
133
|
-
text={t('CHECKOUT', 'Checkout')}
|
|
134
|
-
bgColor={!cartsAvailable.length ? theme.colors.secundary : theme.colors.primary}
|
|
135
|
-
isDisabled={!cartsAvailable.length}
|
|
136
|
-
borderColor={theme.colors.primary}
|
|
137
|
-
imgRightSrc={null}
|
|
138
|
-
textStyle={{ color: 'white', textAlign: 'center', flex: 1 }}
|
|
139
|
-
onClick={() => handleCheckoutRedirect()}
|
|
140
|
-
style={{ width: '100%', flexDirection: 'row', justifyContent: 'center', borderRadius: 7.6, shadowOpacity: 0 }}
|
|
141
|
-
/>
|
|
142
|
-
</CheckoutAction>
|
|
143
187
|
</>
|
|
144
188
|
)}
|
|
145
189
|
</>
|
|
@@ -151,7 +195,7 @@ export const CartContent = (props: any) => {
|
|
|
151
195
|
btnStyle={{ borderRadius: 8 }}
|
|
152
196
|
content={t('CARTS_NOT_FOUND', 'You don\'t have carts available')}
|
|
153
197
|
btnTitle={t('START_SHOPPING', 'Start shopping')}
|
|
154
|
-
onClickButton={() => onNavigationRedirect('BusinessList')}
|
|
198
|
+
onClickButton={() => singleBusiness ? onNavigationRedirect('Business') : onNavigationRedirect('BusinessList')}
|
|
155
199
|
/>
|
|
156
200
|
</CCNotCarts>
|
|
157
201
|
)}
|
|
@@ -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`
|