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
|
@@ -10,11 +10,11 @@ import {
|
|
|
10
10
|
ToastType,
|
|
11
11
|
MultiCheckout as MultiCheckoutController
|
|
12
12
|
} from 'ordering-components/native'
|
|
13
|
-
import { View, StyleSheet, Platform } from 'react-native'
|
|
13
|
+
import { View, StyleSheet, Platform, ScrollView } from 'react-native'
|
|
14
14
|
import { useTheme } from 'styled-components/native';
|
|
15
15
|
import { Container } from '../../layouts/Container';
|
|
16
16
|
import NavBar from '../NavBar';
|
|
17
|
-
import { OText, OIcon, OModal } from '../shared';
|
|
17
|
+
import { OText, OIcon, OModal, OButton } from '../shared';
|
|
18
18
|
import { getTypesText } from '../../utils';
|
|
19
19
|
import { UserDetails } from '../UserDetails'
|
|
20
20
|
import { AddressDetails } from '../AddressDetails'
|
|
@@ -23,7 +23,11 @@ import { MultiCartsPaymethodsAndWallets } from '../MultiCartsPaymethodsAndWallet
|
|
|
23
23
|
import { Cart } from '../Cart'
|
|
24
24
|
import { FloatingButton } from '../FloatingButton'
|
|
25
25
|
import { DriverTips } from '../DriverTips'
|
|
26
|
+
import { CouponControl } from '../CouponControl';
|
|
26
27
|
import { DriverTipsContainer } from '../Cart/styles'
|
|
28
|
+
import { OSTable, OSCoupon } from '../OrderSummary/styles';
|
|
29
|
+
import { SignupForm } from '../SignupForm'
|
|
30
|
+
import { LoginForm } from '../LoginForm'
|
|
27
31
|
|
|
28
32
|
import {
|
|
29
33
|
ChContainer,
|
|
@@ -51,24 +55,32 @@ const MultiCheckoutUI = (props: any) => {
|
|
|
51
55
|
navigation,
|
|
52
56
|
placing,
|
|
53
57
|
openCarts,
|
|
54
|
-
totalCartsPrice,
|
|
55
58
|
handleGroupPlaceOrder,
|
|
56
59
|
paymethodSelected,
|
|
57
60
|
handleSelectPaymethod,
|
|
58
61
|
handleSelectWallet,
|
|
59
62
|
handlePaymethodDataChange,
|
|
60
63
|
cartUuid,
|
|
64
|
+
loyaltyPlansState,
|
|
61
65
|
totalCartsFee,
|
|
62
|
-
cartGroup
|
|
66
|
+
cartGroup,
|
|
67
|
+
walletState,
|
|
68
|
+
onNavigationRedirectReplace,
|
|
69
|
+
merchantId,
|
|
70
|
+
cartsInvalid
|
|
63
71
|
} = props
|
|
64
72
|
|
|
65
73
|
const theme = useTheme();
|
|
66
74
|
const styles = StyleSheet.create({
|
|
67
75
|
pagePadding: {
|
|
68
|
-
paddingLeft:
|
|
69
|
-
paddingRight:
|
|
76
|
+
paddingLeft: 20,
|
|
77
|
+
paddingRight: 20
|
|
70
78
|
},
|
|
71
|
-
wrapperNavbar: { paddingHorizontal:
|
|
79
|
+
wrapperNavbar: { paddingHorizontal: 20 },
|
|
80
|
+
detailWrapper: {
|
|
81
|
+
paddingHorizontal: 20,
|
|
82
|
+
width: '100%'
|
|
83
|
+
},
|
|
72
84
|
})
|
|
73
85
|
|
|
74
86
|
const [, { showToast }] = useToast();
|
|
@@ -77,20 +89,69 @@ const MultiCheckoutUI = (props: any) => {
|
|
|
77
89
|
const [{ parsePrice, parseDate }] = useUtils();
|
|
78
90
|
const [{ options, carts, loading }, { confirmCart }] = useOrder();
|
|
79
91
|
const [validationFields] = useValidationFields();
|
|
80
|
-
const [{ user }] = useSession()
|
|
92
|
+
const [{ user }, { login }] = useSession()
|
|
81
93
|
|
|
82
94
|
const configTypes = configs?.order_types_allowed?.value.split('|').map((value: any) => Number(value)) || []
|
|
83
95
|
const isPreOrder = configs?.preorder_status_enabled?.value === '1'
|
|
84
96
|
const isMultiDriverTips = configs?.checkout_multi_business_enabled?.value === '1'
|
|
85
|
-
const isDisablePlaceOrderButton = !(paymethodSelected?.paymethod_id || paymethodSelected?.wallet_id) || (paymethodSelected?.paymethod?.gateway === 'stripe' && !paymethodSelected?.paymethod_data)
|
|
86
97
|
const walletCarts = (Object.values(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) || []
|
|
98
|
+
const isChewLayout = theme?.header?.components?.layout?.type?.toLowerCase() === 'chew'
|
|
99
|
+
const cartsToShow = openCarts?.length > 0 ? openCarts : cartsInvalid
|
|
100
|
+
const walletName: any = {
|
|
101
|
+
cash: {
|
|
102
|
+
name: t('PAY_WITH_CASH_WALLET', 'Pay with Cash Wallet'),
|
|
103
|
+
},
|
|
104
|
+
credit_point: {
|
|
105
|
+
name: t('PAY_WITH_CREDITS_POINTS_WALLET', 'Pay with Credit Points Wallet'),
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
const totalCartsPrice = cartGroup?.result?.balance
|
|
110
|
+
|
|
87
111
|
const driverTipsOptions = typeof configs?.driver_tip_options?.value === 'string'
|
|
88
112
|
? JSON.parse(configs?.driver_tip_options?.value) || []
|
|
89
113
|
: configs?.driver_tip_options?.value || []
|
|
90
114
|
|
|
115
|
+
const creditPointGeneralPlan = loyaltyPlansState?.result?.find((loyal: any) => loyal.type === 'credit_point')
|
|
116
|
+
const loyalBusinessAvailable = creditPointGeneralPlan?.businesses?.filter((b: any) => b.accumulates) ?? []
|
|
117
|
+
|
|
118
|
+
const accumulationRateBusiness = (businessId: number) => {
|
|
119
|
+
const value = loyalBusinessAvailable?.find((loyal: any) => loyal.business_id === businessId)?.accumulation_rate ?? 0
|
|
120
|
+
return value || (creditPointGeneralPlan?.accumulation_rate ?? 0)
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
const getIncludedTaxes = (cart: any) => {
|
|
124
|
+
if (cart?.taxes === null || !cart?.taxes) {
|
|
125
|
+
return cart.business.tax_type === 1 ? cart?.tax : 0
|
|
126
|
+
} else {
|
|
127
|
+
return cart?.taxes.reduce((taxIncluded: number, tax: any) => {
|
|
128
|
+
return taxIncluded + (tax.type === 1 ? tax.summary?.tax : 0)
|
|
129
|
+
}, 0)
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
const clearAmount = (value: any) => parseFloat((Math.trunc(value * 100) / 100).toFixed(configs.format_number_decimal_length?.value ?? 2))
|
|
134
|
+
|
|
135
|
+
const loyaltyRewardValue = openCarts
|
|
136
|
+
?.reduce((sum: any, cart: any) => sum + clearAmount((cart?.subtotal + getIncludedTaxes(cart)) * accumulationRateBusiness(cart?.business_id)), 0)
|
|
137
|
+
?.toFixed(configs.format_number_decimal_length?.value ?? 2)
|
|
138
|
+
|
|
91
139
|
const [isUserDetailsEdit, setIsUserDetailsEdit] = useState(false);
|
|
92
140
|
const [phoneUpdate, setPhoneUpdate] = useState(false);
|
|
93
141
|
const [userErrors, setUserErrors] = useState<any>([]);
|
|
142
|
+
const [placeByMethodPay, setPlaceByMethodPay] = useState(false)
|
|
143
|
+
const [allowedGuest, setAllowedGuest] = useState(false)
|
|
144
|
+
const [isOpen, setIsOpen] = useState(false)
|
|
145
|
+
const [requiredFields, setRequiredFields] = useState<any>([])
|
|
146
|
+
const stripePaymethods: any = ['stripe', 'stripe_direct', 'stripe_connect', 'stripe_redirect']
|
|
147
|
+
const [openModal, setOpenModal] = useState({ login: false, signup: false, isGuest: false })
|
|
148
|
+
const [methodPaySupported, setMethodPaySupported] = useState({ enabled: false, message: null, loading: true })
|
|
149
|
+
const methodsPay = ['global_google_pay', 'global_apple_pay']
|
|
150
|
+
const isDisablePlaceOrderButton = cartGroup?.loading || placing || (!(paymethodSelected?.paymethod_id || paymethodSelected?.wallet_id) && cartGroup?.result?.balance > 0) ||
|
|
151
|
+
(paymethodSelected?.paymethod?.gateway === 'stripe' && !paymethodSelected?.paymethod_data) ||
|
|
152
|
+
walletCarts.length > 0
|
|
153
|
+
|| (methodsPay.includes(paymethodSelected?.gateway) && (!methodPaySupported.enabled || methodPaySupported.loading)) || openCarts?.length === 0
|
|
154
|
+
|
|
94
155
|
const handleMomentClick = () => {
|
|
95
156
|
if (isPreOrder) {
|
|
96
157
|
navigation.navigate('MomentOption')
|
|
@@ -101,11 +162,12 @@ const MultiCheckoutUI = (props: any) => {
|
|
|
101
162
|
setUserErrors([])
|
|
102
163
|
const errors = []
|
|
103
164
|
const notFields = ['coupon', 'driver_tip', 'mobile_phone', 'address', 'zipcode', 'address_notes']
|
|
165
|
+
const _requiredFields: any = []
|
|
104
166
|
|
|
105
167
|
Object.values(validationFields?.fields?.checkout).map((field: any) => {
|
|
106
168
|
if (field?.required && !notFields.includes(field.code)) {
|
|
107
169
|
if (!user[field?.code]) {
|
|
108
|
-
|
|
170
|
+
_requiredFields.push(field?.code)
|
|
109
171
|
}
|
|
110
172
|
}
|
|
111
173
|
})
|
|
@@ -116,8 +178,9 @@ const MultiCheckoutUI = (props: any) => {
|
|
|
116
178
|
validationFields?.fields?.checkout?.cellphone?.required) ||
|
|
117
179
|
configs?.verification_phone_required?.value === '1')
|
|
118
180
|
) {
|
|
119
|
-
|
|
181
|
+
_requiredFields.push('cellphone')
|
|
120
182
|
}
|
|
183
|
+
setRequiredFields(_requiredFields)
|
|
121
184
|
|
|
122
185
|
if (phoneUpdate) {
|
|
123
186
|
errors.push(t('NECESSARY_UPDATE_COUNTRY_PHONE_CODE', 'It is necessary to update your phone number'))
|
|
@@ -130,11 +193,20 @@ const MultiCheckoutUI = (props: any) => {
|
|
|
130
193
|
setPhoneUpdate(val)
|
|
131
194
|
}
|
|
132
195
|
|
|
133
|
-
const handlePlaceOrder = () => {
|
|
134
|
-
if (
|
|
135
|
-
|
|
196
|
+
const handlePlaceOrder = (confirmPayment?: any) => {
|
|
197
|
+
if (stripePaymethods.includes(paymethodSelected?.gateway) && user?.guest_id) {
|
|
198
|
+
setOpenModal({ ...openModal, signup: true, isGuest: true })
|
|
199
|
+
return
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
if (!userErrors.length && (!requiredFields?.length || allowedGuest)) {
|
|
203
|
+
handleGroupPlaceOrder && handleGroupPlaceOrder(confirmPayment)
|
|
136
204
|
return
|
|
137
205
|
}
|
|
206
|
+
if (requiredFields?.length) {
|
|
207
|
+
setIsOpen(true)
|
|
208
|
+
return
|
|
209
|
+
}
|
|
138
210
|
let stringError = ''
|
|
139
211
|
Object.values(userErrors).map((item: any, i: number) => {
|
|
140
212
|
stringError += (i + 1) === userErrors.length ? `- ${item?.message || item}` : `- ${item?.message || item}\n`
|
|
@@ -143,12 +215,62 @@ const MultiCheckoutUI = (props: any) => {
|
|
|
143
215
|
setIsUserDetailsEdit(true)
|
|
144
216
|
}
|
|
145
217
|
|
|
218
|
+
const handlePlaceOrderAsGuest = () => {
|
|
219
|
+
setIsOpen(false)
|
|
220
|
+
handleGroupPlaceOrder && handleGroupPlaceOrder()
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
const handleSuccessSignup = (user: any) => {
|
|
224
|
+
login({
|
|
225
|
+
user,
|
|
226
|
+
token: user?.session?.access_token
|
|
227
|
+
})
|
|
228
|
+
openModal?.isGuest && handlePlaceOrderAsGuest()
|
|
229
|
+
setOpenModal({ ...openModal, signup: false, isGuest: false })
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
const handleSuccessLogin = (user: any) => {
|
|
233
|
+
if (user) setOpenModal({ ...openModal, login: false })
|
|
234
|
+
}
|
|
235
|
+
|
|
146
236
|
useEffect(() => {
|
|
147
237
|
if (validationFields && validationFields?.fields?.checkout) {
|
|
148
238
|
checkValidationFields()
|
|
149
239
|
}
|
|
150
240
|
}, [validationFields, user])
|
|
151
241
|
|
|
242
|
+
useEffect(() => {
|
|
243
|
+
if (cartsToShow?.length === 1) {
|
|
244
|
+
onNavigationRedirectReplace('CheckoutPage', {
|
|
245
|
+
cartUuid: cartsToShow[0]?.uuid,
|
|
246
|
+
fromMulti: true
|
|
247
|
+
})
|
|
248
|
+
return
|
|
249
|
+
}
|
|
250
|
+
}, [cartsToShow])
|
|
251
|
+
|
|
252
|
+
useEffect(() => {
|
|
253
|
+
if (walletState.error) {
|
|
254
|
+
showToast(ToastType.Error, t(walletState.error, walletState.error?.[0]?.replace(/_/g, ' ')))
|
|
255
|
+
}
|
|
256
|
+
}, [walletState.error])
|
|
257
|
+
|
|
258
|
+
useEffect(() => {
|
|
259
|
+
if (!cartUuid) {
|
|
260
|
+
onNavigationRedirectReplace('BottomTab', { screen: 'Cart' })
|
|
261
|
+
}
|
|
262
|
+
}, [cartUuid])
|
|
263
|
+
|
|
264
|
+
useEffect(() => {
|
|
265
|
+
if (paymethodSelected?.gateway === 'global_google_pay') {
|
|
266
|
+
setMethodPaySupported({
|
|
267
|
+
enabled: true,
|
|
268
|
+
loading: false,
|
|
269
|
+
message: null
|
|
270
|
+
})
|
|
271
|
+
}
|
|
272
|
+
}, [paymethodSelected])
|
|
273
|
+
|
|
152
274
|
return (
|
|
153
275
|
<>
|
|
154
276
|
<Container noPadding>
|
|
@@ -165,8 +287,15 @@ const MultiCheckoutUI = (props: any) => {
|
|
|
165
287
|
<ChContainer style={styles.pagePadding}>
|
|
166
288
|
<ChSection style={{ paddingTop: 0 }}>
|
|
167
289
|
<ChHeader>
|
|
168
|
-
<CHMomentWrapper onPress={() => navigation.navigate('OrderTypes', { configTypes: configTypes })}>
|
|
169
|
-
<OText
|
|
290
|
+
<CHMomentWrapper isCustomColor={isChewLayout} onPress={() => navigation.navigate('OrderTypes', { configTypes: configTypes })}>
|
|
291
|
+
<OText
|
|
292
|
+
size={12}
|
|
293
|
+
numberOfLines={1}
|
|
294
|
+
ellipsizeMode={'tail'}
|
|
295
|
+
color={theme.colors?.[isChewLayout ? 'white' : 'textSecondary']}
|
|
296
|
+
>
|
|
297
|
+
{t(getTypesText(options?.type || 1), 'Delivery')}
|
|
298
|
+
</OText>
|
|
170
299
|
<OIcon
|
|
171
300
|
src={theme.images.general.arrow_down}
|
|
172
301
|
width={10}
|
|
@@ -196,15 +325,45 @@ const MultiCheckoutUI = (props: any) => {
|
|
|
196
325
|
|
|
197
326
|
<ChSection>
|
|
198
327
|
<ChUserDetails>
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
328
|
+
{(user?.guest_id && !allowedGuest) ? (
|
|
329
|
+
<View>
|
|
330
|
+
<OText size={14} numberOfLines={1} ellipsizeMode='tail' color={theme.colors.textNormal}>
|
|
331
|
+
{t('CUSTOMER_DETAILS', 'Customer details')}
|
|
332
|
+
</OText>
|
|
333
|
+
<OButton
|
|
334
|
+
text={t('SIGN_UP', 'Sign up')}
|
|
335
|
+
textStyle={{ color: theme.colors.white }}
|
|
336
|
+
style={{ borderRadius: 7.6, marginTop: 20 }}
|
|
337
|
+
onClick={() => setOpenModal({ ...openModal, signup: true })}
|
|
338
|
+
/>
|
|
339
|
+
<OButton
|
|
340
|
+
text={t('LOGIN', 'Login')}
|
|
341
|
+
textStyle={{ color: theme.colors.primary }}
|
|
342
|
+
bgColor={theme.colors.white}
|
|
343
|
+
borderColor={theme.colors.primary}
|
|
344
|
+
style={{ borderRadius: 7.6, marginTop: 20 }}
|
|
345
|
+
onClick={() => setOpenModal({ ...openModal, login: true })}
|
|
346
|
+
/>
|
|
347
|
+
<OButton
|
|
348
|
+
text={t('CONTINUE_AS_GUEST', 'Continue as guest')}
|
|
349
|
+
textStyle={{ color: theme.colors.black }}
|
|
350
|
+
bgColor={theme.colors.white}
|
|
351
|
+
borderColor={theme.colors.black}
|
|
352
|
+
style={{ borderRadius: 7.6, marginTop: 20 }}
|
|
353
|
+
onClick={() => setAllowedGuest(true)}
|
|
354
|
+
/>
|
|
355
|
+
</View>
|
|
356
|
+
) : (
|
|
357
|
+
<UserDetails
|
|
358
|
+
isUserDetailsEdit={isUserDetailsEdit}
|
|
359
|
+
useValidationFields
|
|
360
|
+
useDefualtSessionManager
|
|
361
|
+
useSessionUser
|
|
362
|
+
isCheckout
|
|
363
|
+
phoneUpdate={phoneUpdate}
|
|
364
|
+
togglePhoneUpdate={togglePhoneUpdate}
|
|
365
|
+
/>
|
|
366
|
+
)}
|
|
208
367
|
</ChUserDetails>
|
|
209
368
|
<View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginHorizontal: -40 }} />
|
|
210
369
|
</ChSection>
|
|
@@ -221,47 +380,80 @@ const MultiCheckoutUI = (props: any) => {
|
|
|
221
380
|
</ChAddress>
|
|
222
381
|
<View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginTop: 13, marginHorizontal: -40 }} />
|
|
223
382
|
</ChSection>
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
383
|
+
{openCarts?.length > 0 && (
|
|
384
|
+
<ChSection>
|
|
385
|
+
<MultiCartsPaymethodsAndWallets
|
|
386
|
+
openCarts={openCarts}
|
|
387
|
+
paymethodSelected={paymethodSelected}
|
|
388
|
+
walletsPaymethod={cartGroup?.result?.wallets}
|
|
389
|
+
handleSelectPaymethod={handleSelectPaymethod}
|
|
390
|
+
handleSelectWallet={handleSelectWallet}
|
|
391
|
+
handlePaymethodDataChange={handlePaymethodDataChange}
|
|
392
|
+
cartUuid={cartUuid}
|
|
393
|
+
merchantId={merchantId}
|
|
394
|
+
setMethodPaySupported={setMethodPaySupported}
|
|
395
|
+
methodPaySupported={methodPaySupported}
|
|
396
|
+
placeByMethodPay={placeByMethodPay}
|
|
397
|
+
setPlaceByMethodPay={setPlaceByMethodPay}
|
|
398
|
+
cartTotal={totalCartsPrice}
|
|
399
|
+
handlePlaceOrder={handlePlaceOrder}
|
|
400
|
+
/>
|
|
401
|
+
<View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginTop: 13, marginHorizontal: -40 }} />
|
|
402
|
+
</ChSection>
|
|
403
|
+
)}
|
|
237
404
|
{
|
|
238
405
|
isMultiDriverTips &&
|
|
239
406
|
options?.type === 1 &&
|
|
240
407
|
validationFields?.fields?.checkout?.driver_tip?.enabled &&
|
|
241
408
|
openCarts.every((cart: any) => cart.business_id && cart.status !== 2) &&
|
|
242
409
|
driverTipsOptions && driverTipsOptions?.length > 0 &&
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
410
|
+
(
|
|
411
|
+
<ChSection>
|
|
412
|
+
<DriverTipsContainer>
|
|
413
|
+
<OText size={14} lineHeight={20} color={theme.colors.textNormal}>
|
|
414
|
+
{t('DRIVER_TIPS', 'Driver Tips')}
|
|
415
|
+
</OText>
|
|
416
|
+
<DriverTips
|
|
417
|
+
isMulti
|
|
418
|
+
isLoading={loading}
|
|
419
|
+
carts={openCarts}
|
|
420
|
+
businessIds={openCarts.map((cart: any) => cart.business_id)}
|
|
421
|
+
driverTipsOptions={driverTipsOptions}
|
|
422
|
+
isFixedPrice={parseInt(configs?.driver_tip_type?.value, 10) === 1}
|
|
423
|
+
isDriverTipUseCustom={!!parseInt(configs?.driver_tip_use_custom?.value, 10)}
|
|
424
|
+
driverTip={parseInt(configs?.driver_tip_type?.value, 10) === 1
|
|
425
|
+
? openCarts?.reduce((sum: any, cart: any) => sum + cart?.driver_tip, 0)
|
|
426
|
+
: openCarts[0]?.driver_tip_rate}
|
|
427
|
+
useOrderContext
|
|
428
|
+
/>
|
|
429
|
+
</DriverTipsContainer>
|
|
430
|
+
<View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginTop: 13, marginHorizontal: -40 }} />
|
|
431
|
+
</ChSection>
|
|
432
|
+
)}
|
|
433
|
+
|
|
434
|
+
{
|
|
435
|
+
validationFields?.fields?.checkout?.coupon?.enabled &&
|
|
436
|
+
openCarts.every((cart: any) => cart.business_id && cart.status !== 2) &&
|
|
437
|
+
configs?.multi_business_checkout_coupon_input_style?.value === 'group' &&
|
|
438
|
+
openCarts?.length > 0 &&
|
|
439
|
+
(
|
|
440
|
+
<ChSection>
|
|
246
441
|
<OText size={14} lineHeight={20} color={theme.colors.textNormal}>
|
|
247
|
-
{t('
|
|
442
|
+
{t('DISCOUNT_COUPON', 'Discount coupon')}
|
|
248
443
|
</OText>
|
|
249
|
-
<
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
<View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginTop: 13, marginHorizontal: -40 }} />
|
|
263
|
-
</ChSection>
|
|
264
|
-
)}
|
|
444
|
+
<OSTable>
|
|
445
|
+
<OSCoupon>
|
|
446
|
+
<CouponControl
|
|
447
|
+
isMulti
|
|
448
|
+
carts={openCarts}
|
|
449
|
+
businessIds={openCarts.map((cart: any) => cart.business_id)}
|
|
450
|
+
price={openCarts.reduce((total: any, cart: any) => total + cart.total, 0)}
|
|
451
|
+
/>
|
|
452
|
+
</OSCoupon>
|
|
453
|
+
</OSTable>
|
|
454
|
+
<View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginTop: 13, marginHorizontal: -40 }} />
|
|
455
|
+
</ChSection>
|
|
456
|
+
)}
|
|
265
457
|
|
|
266
458
|
<ChSection>
|
|
267
459
|
<ChCarts>
|
|
@@ -270,20 +462,24 @@ const MultiCheckoutUI = (props: any) => {
|
|
|
270
462
|
{t('MOBILE_FRONT_YOUR_ORDER', 'Your order')}
|
|
271
463
|
</OText>
|
|
272
464
|
</CartsHeader>
|
|
273
|
-
{
|
|
465
|
+
{cartsToShow.map((cart: any) => (
|
|
274
466
|
<React.Fragment key={cart.uuid}>
|
|
275
467
|
<Cart
|
|
276
468
|
cart={cart}
|
|
277
469
|
cartuuid={cart.uuid}
|
|
278
470
|
isMultiCheckout
|
|
471
|
+
hideCouponInput={configs?.multi_business_checkout_coupon_input_style?.value === 'group'}
|
|
279
472
|
hideDeliveryFee={configs?.multi_business_checkout_show_combined_delivery_fee?.value === '1'}
|
|
280
473
|
hideDriverTip={configs?.multi_business_checkout_show_combined_driver_tip?.value === '1'}
|
|
281
474
|
onNavigationRedirect={(route: string, params: any) => props.navigation.navigate(route, params)}
|
|
475
|
+
businessConfigs={cart?.business?.configs}
|
|
282
476
|
/>
|
|
283
|
-
|
|
477
|
+
{openCarts.length > 1 && (
|
|
478
|
+
<View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginTop: 13, marginHorizontal: -40 }} />
|
|
479
|
+
)}
|
|
284
480
|
</React.Fragment>
|
|
285
481
|
))}
|
|
286
|
-
{!cartGroup?.loading && openCarts.length === 0 && (
|
|
482
|
+
{!cartGroup?.loading && openCarts.length === 0 && cartsInvalid?.length === 0 && (
|
|
287
483
|
<CCNotCarts>
|
|
288
484
|
<OText size={24} style={{ textAlign: 'center' }}>
|
|
289
485
|
{t('CARTS_NOT_FOUND', 'You don\'t have carts available')}
|
|
@@ -295,33 +491,53 @@ const MultiCheckoutUI = (props: any) => {
|
|
|
295
491
|
{t('WARNING_PARTIAL_WALLET_CARTS', 'Important: One or more carts can`t be completed due a partial payment with cash/points wallet and requires to be paid individually')}
|
|
296
492
|
</OText>
|
|
297
493
|
)}
|
|
298
|
-
{openCarts.length >
|
|
494
|
+
{openCarts.length > 1 && (
|
|
299
495
|
<ChCartsTotal>
|
|
300
|
-
{totalCartsFee && configs?.multi_business_checkout_show_combined_delivery_fee?.value === '1' && (
|
|
496
|
+
{!!totalCartsFee && configs?.multi_business_checkout_show_combined_delivery_fee?.value === '1' && (
|
|
301
497
|
<View style={{ flexDirection: 'row', justifyContent: 'space-between' }}>
|
|
302
498
|
<OText size={14} lineHeight={24} color={theme.colors.textNormal} weight={'400'}>
|
|
303
499
|
{t('TOTAL_DELIVERY_FEE', 'Total delivery fee')}
|
|
304
500
|
</OText>
|
|
305
|
-
<OText size={14} lineHeight={24} color={theme.colors.textNormal} weight={'400'}>
|
|
501
|
+
<OText size={14} lineHeight={24} color={theme.colors.textNormal} weight={'400'}>
|
|
502
|
+
{parsePrice(totalCartsFee)}
|
|
503
|
+
</OText>
|
|
306
504
|
</View>
|
|
307
505
|
)}
|
|
308
506
|
{openCarts.reduce((sum: any, cart: any) => sum + cart?.driver_tip, 0) > 0 &&
|
|
309
507
|
configs?.multi_business_checkout_show_combined_driver_tip?.value === '1' && (
|
|
310
|
-
|
|
508
|
+
<View style={{ flexDirection: 'row', justifyContent: 'space-between' }}>
|
|
509
|
+
<OText size={14} lineHeight={24} color={theme.colors.textNormal} weight={'400'}>
|
|
510
|
+
{t('DRIVER_TIP', 'Driver tip')}
|
|
511
|
+
</OText>
|
|
512
|
+
<OText size={14} lineHeight={24} color={theme.colors.textNormal} weight={'400'}>
|
|
513
|
+
{parsePrice(openCarts.reduce((sum: any, cart: any) => sum + cart?.driver_tip, 0))}
|
|
514
|
+
</OText>
|
|
515
|
+
</View>
|
|
516
|
+
)}
|
|
517
|
+
{!cartGroup?.loading && cartGroup?.result?.payment_events?.length > 0 && cartGroup?.result?.payment_events?.map((event: any) => (
|
|
518
|
+
<View key={event.id} style={{ flexDirection: 'row', justifyContent: 'space-between' }}>
|
|
311
519
|
<OText size={14} lineHeight={24} color={theme.colors.textNormal} weight={'400'}>
|
|
312
|
-
{
|
|
520
|
+
{walletName[cartGroup?.result?.wallets?.find((wallet: any) => wallet.wallet_id === event.wallet_id)?.type]?.name}
|
|
313
521
|
</OText>
|
|
314
522
|
<OText size={14} lineHeight={24} color={theme.colors.textNormal} weight={'400'}>
|
|
315
|
-
{parsePrice(
|
|
523
|
+
-{parsePrice(event.amount, { isTruncable: true })}
|
|
316
524
|
</OText>
|
|
317
525
|
</View>
|
|
318
|
-
)}
|
|
526
|
+
))}
|
|
319
527
|
<View style={{ flexDirection: 'row', justifyContent: 'space-between' }}>
|
|
320
528
|
<OText size={16} lineHeight={24} color={theme.colors.textNormal} weight={'500'}>
|
|
321
529
|
{t('TOTAL_FOR_ALL_CARTS', 'Total for all Carts')}
|
|
322
530
|
</OText>
|
|
323
531
|
<OText size={16} lineHeight={24} color={theme.colors.textNormal} weight={'500'}>{parsePrice(totalCartsPrice)}</OText>
|
|
324
532
|
</View>
|
|
533
|
+
{!!loyaltyRewardValue && (
|
|
534
|
+
<View style={{ flexDirection: 'row', marginTop: 10, justifyContent: 'flex-end' }}>
|
|
535
|
+
<OText size={12} color={theme.colors.textNormal}>
|
|
536
|
+
{t('REWARD_LOYALTY_POINT', 'Reward :amount: on loyalty points').replace(':amount:', loyaltyRewardValue)}
|
|
537
|
+
</OText>
|
|
538
|
+
</View>
|
|
539
|
+
)}
|
|
540
|
+
|
|
325
541
|
<OText size={12} color={theme.colors.mediumGray} mRight={70} style={{ marginTop: 10 }}>
|
|
326
542
|
{t('MULTI_CHECKOUT_DESCRIPTION', 'You will receive a receipt for each business. The payment is not combined between multiple stores. Each payment is processed by the store')}
|
|
327
543
|
</OText>
|
|
@@ -329,11 +545,73 @@ const MultiCheckoutUI = (props: any) => {
|
|
|
329
545
|
)}
|
|
330
546
|
</ChCarts>
|
|
331
547
|
</ChSection>
|
|
548
|
+
{cartsToShow?.some((cart: any) => !cart?.valid_products && cart?.status !== 2) && (
|
|
549
|
+
<OText
|
|
550
|
+
color={theme.colors.error}
|
|
551
|
+
size={12}
|
|
552
|
+
>
|
|
553
|
+
{t('WARNING_INVALID_PRODUCTS_CHECKOUT', 'To continue with your checkout, please remove from your cart the products that are not available.')}
|
|
554
|
+
</OText>
|
|
555
|
+
)}
|
|
332
556
|
</ChContainer>
|
|
557
|
+
<OModal
|
|
558
|
+
open={openModal.signup}
|
|
559
|
+
onClose={() => setOpenModal({ ...openModal, signup: false, isGuest: false })}
|
|
560
|
+
>
|
|
561
|
+
<ScrollView style={{ paddingHorizontal: 20, width: '100%' }}>
|
|
562
|
+
<SignupForm
|
|
563
|
+
handleSuccessSignup={handleSuccessSignup}
|
|
564
|
+
isGuest
|
|
565
|
+
signupButtonText={t('SIGNUP', 'Signup')}
|
|
566
|
+
useSignupByEmail
|
|
567
|
+
useChekoutFileds
|
|
568
|
+
/>
|
|
569
|
+
</ScrollView>
|
|
570
|
+
</OModal>
|
|
571
|
+
<OModal
|
|
572
|
+
open={openModal.login}
|
|
573
|
+
onClose={() => setOpenModal({ ...openModal, login: false })}
|
|
574
|
+
>
|
|
575
|
+
<ScrollView style={{ paddingHorizontal: 20, width: '100%' }}>
|
|
576
|
+
<LoginForm
|
|
577
|
+
handleSuccessLogin={handleSuccessLogin}
|
|
578
|
+
isGuest
|
|
579
|
+
loginButtonText={t('LOGIN', 'Login')}
|
|
580
|
+
loginButtonBackground={theme.colors.primary}
|
|
581
|
+
/>
|
|
582
|
+
</ScrollView>
|
|
583
|
+
</OModal>
|
|
584
|
+
<OModal
|
|
585
|
+
open={isOpen}
|
|
586
|
+
onClose={() => setIsOpen(false)}
|
|
587
|
+
>
|
|
588
|
+
<View style={styles.detailWrapper}>
|
|
589
|
+
<UserDetails
|
|
590
|
+
isUserDetailsEdit
|
|
591
|
+
useValidationFields
|
|
592
|
+
useDefualtSessionManager
|
|
593
|
+
useSessionUser
|
|
594
|
+
isCheckout
|
|
595
|
+
isEdit
|
|
596
|
+
phoneUpdate={phoneUpdate}
|
|
597
|
+
togglePhoneUpdate={togglePhoneUpdate}
|
|
598
|
+
requiredFields={requiredFields}
|
|
599
|
+
hideUpdateButton
|
|
600
|
+
handlePlaceOrderAsGuest={handlePlaceOrderAsGuest}
|
|
601
|
+
onClose={() => {
|
|
602
|
+
setIsOpen(false)
|
|
603
|
+
handlePlaceOrder()
|
|
604
|
+
}}
|
|
605
|
+
setIsOpen={setIsOpen}
|
|
606
|
+
/>
|
|
607
|
+
</View>
|
|
608
|
+
</OModal>
|
|
333
609
|
</Container>
|
|
334
610
|
|
|
335
611
|
<FloatingButton
|
|
336
|
-
handleClick={()
|
|
612
|
+
handleClick={methodsPay.includes(paymethodSelected?.gateway)
|
|
613
|
+
? () => setPlaceByMethodPay(true)
|
|
614
|
+
: () => handlePlaceOrder()}
|
|
337
615
|
isSecondaryBtn={isDisablePlaceOrderButton}
|
|
338
616
|
disabled={isDisablePlaceOrderButton}
|
|
339
617
|
btnText={placing ? t('PLACING', 'Placing') : t('PLACE_ORDER', 'Place Order')}
|
|
@@ -364,7 +642,7 @@ export const MultiCheckout = (props: any) => {
|
|
|
364
642
|
handleOnRedirectCheckout: (cartUuid: string) => {
|
|
365
643
|
props.navigation.navigate('CheckoutNavigator', {
|
|
366
644
|
screen: 'CheckoutPage',
|
|
367
|
-
cartUuid
|
|
645
|
+
cartUuid
|
|
368
646
|
})
|
|
369
647
|
}
|
|
370
648
|
}
|
|
@@ -13,7 +13,9 @@ export const ChHeader = styled.View`
|
|
|
13
13
|
margin: 0px;
|
|
14
14
|
`
|
|
15
15
|
export const CHMomentWrapper = styled.TouchableOpacity`
|
|
16
|
-
background-color: ${(props: any) => props.
|
|
16
|
+
background-color: ${(props: any) => props.isCustomColor
|
|
17
|
+
? props.theme.colors.primary
|
|
18
|
+
: props.theme.colors.backgroundGray100};
|
|
17
19
|
border-radius: 7.6px;
|
|
18
20
|
font-size: 12px;
|
|
19
21
|
max-width: 240px;
|
|
@@ -93,7 +93,7 @@ export const MultiOrdersDetailsUI = (props: any) => {
|
|
|
93
93
|
}, [])
|
|
94
94
|
|
|
95
95
|
return (
|
|
96
|
-
<OrdersDetailsContainer keyboardShouldPersistTaps="handled" contentContainerStyle={{ paddingHorizontal:
|
|
96
|
+
<OrdersDetailsContainer keyboardShouldPersistTaps="handled" contentContainerStyle={{ paddingHorizontal: 20 }}>
|
|
97
97
|
<View style={{ flexDirection: 'row' }}>
|
|
98
98
|
<OButton
|
|
99
99
|
imgRightSrc={null}
|
|
@@ -166,7 +166,7 @@ export const MultiOrdersDetailsUI = (props: any) => {
|
|
|
166
166
|
<OText key={event.id} size={12} lineHeight={18} color={theme.colors.textNormal}>
|
|
167
167
|
{event?.wallet_event
|
|
168
168
|
? walletName[event?.wallet_event?.wallet?.type]?.name
|
|
169
|
-
: event?.paymethod?.name}
|
|
169
|
+
: t(event?.paymethod?.name.toUpperCase()?.replace(/ /g, '_'), event?.paymethod?.name)}
|
|
170
170
|
</OText>
|
|
171
171
|
))}
|
|
172
172
|
</Section>
|