ordering-ui-react-native 0.17.87 → 0.17.88-release
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +8 -7
- package/src/DeliveryApp.tsx +43 -1
- package/src/components/BusinessInformation/index.tsx +10 -9
- package/src/components/BusinessesListing/index.tsx +1 -1
- package/src/components/OrderCreating/index.tsx +1 -21
- package/src/components/PaymentOptionsWebView/index.tsx +29 -8
- package/src/components/PhoneInputNumber/index.tsx +6 -2
- package/src/components/StripeMethodForm/index.tsx +136 -102
- package/src/components/VerifyPhone/styles.tsx +1 -2
- package/src/components/shared/OToast.tsx +3 -2
- package/src/types/index.tsx +5 -0
- package/src/utils/index.tsx +5 -0
- package/themes/business/index.tsx +2 -0
- package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +33 -26
- package/themes/business/src/components/BusinessController/index.tsx +0 -1
- 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/Otp/index.tsx +31 -3
- package/themes/business/src/components/LoginForm/index.tsx +15 -22
- package/themes/business/src/components/MapView/index.tsx +8 -8
- package/themes/business/src/components/MessagesOption/index.tsx +20 -93
- 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 +202 -12
- package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +84 -37
- package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +81 -66
- package/themes/business/src/components/OrderDetailsLogistic/index.tsx +200 -0
- package/themes/business/src/components/OrderDetailsLogistic/styles.tsx +5 -0
- package/themes/business/src/components/OrderMessage/index.tsx +19 -18
- package/themes/business/src/components/OrderSummary/index.tsx +114 -123
- package/themes/business/src/components/OrdersOption/index.tsx +22 -22
- package/themes/business/src/components/PreviousMessages/FooterMessageComponent.tsx +103 -0
- package/themes/business/src/components/PreviousMessages/index.tsx +97 -55
- package/themes/business/src/components/PreviousOrders/OrderItem.tsx +17 -12
- package/themes/business/src/components/PreviousOrders/OrderList.tsx +93 -0
- package/themes/business/src/components/PreviousOrders/OrdersGroupedItem.tsx +1 -1
- package/themes/business/src/components/PreviousOrders/index.tsx +198 -221
- package/themes/business/src/components/ProductItemAccordion/index.tsx +7 -1
- package/themes/business/src/components/ReviewCustomer/index.tsx +18 -13
- package/themes/business/src/components/StoresList/index.tsx +3 -4
- package/themes/business/src/components/UserProfileForm/index.tsx +14 -15
- package/themes/business/src/components/shared/OModal.tsx +16 -9
- package/themes/business/src/types/index.tsx +25 -10
- package/themes/business/src/utils/index.tsx +29 -2
- package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
- package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
- package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
- package/themes/kiosk/src/components/Checkout/index.tsx +6 -0
- package/themes/kiosk/src/components/Intro/index.tsx +16 -1
- package/themes/kiosk/src/components/LoginForm/index.tsx +7 -9
- package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
- package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
- package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +8 -10
- package/themes/kiosk/src/components/PhoneInputNumber/index.tsx +2 -2
- package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
- package/themes/original/index.tsx +1 -1
- package/themes/original/src/components/AddressDetails/index.tsx +19 -3
- package/themes/original/src/components/AddressForm/index.tsx +35 -17
- package/themes/original/src/components/AddressList/index.tsx +5 -8
- 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 +73 -37
- package/themes/original/src/components/BusinessBasicInformation/styles.tsx +10 -12
- 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/BusinessItemAccordion/index.tsx +15 -20
- package/themes/original/src/components/BusinessListingSearch/index.tsx +347 -336
- package/themes/original/src/components/BusinessListingSearch/styles.tsx +0 -18
- package/themes/original/src/components/BusinessPreorder/index.tsx +103 -19
- package/themes/original/src/components/BusinessProductsCategories/index.tsx +1 -2
- package/themes/original/src/components/BusinessProductsList/index.tsx +15 -7
- package/themes/original/src/components/BusinessProductsList/styles.tsx +8 -3
- package/themes/original/src/components/BusinessProductsListing/UpsellingRedirect.tsx +1 -1
- package/themes/original/src/components/BusinessProductsListing/index.tsx +663 -556
- package/themes/original/src/components/BusinessProductsListing/styles.tsx +2 -3
- package/themes/original/src/components/BusinessReviews/index.tsx +3 -1
- 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 +38 -405
- package/themes/original/src/components/BusinessesListing/index.tsx +0 -1
- package/themes/original/src/components/Cart/index.tsx +60 -51
- package/themes/original/src/components/CartContent/index.tsx +102 -58
- package/themes/original/src/components/CartContent/styles.tsx +6 -6
- package/themes/original/src/components/Checkout/index.tsx +280 -35
- package/themes/original/src/components/CitiesControl/index.tsx +1 -1
- package/themes/original/src/components/CouponControl/index.tsx +10 -3
- package/themes/original/src/components/DriverTips/index.tsx +52 -34
- package/themes/original/src/components/FacebookLogin/styles.tsx +3 -1
- package/themes/original/src/components/Favorite/index.tsx +1 -5
- package/themes/original/src/components/GPSButton/index.tsx +6 -4
- 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 +2 -0
- package/themes/original/src/components/GiftCard/RedeemGiftCard/index.tsx +86 -10
- 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/Home/index.tsx +13 -4
- 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/MomentOption/index.tsx +193 -92
- package/themes/original/src/components/MomentSelector/index.tsx +1 -1
- package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +162 -50
- package/themes/original/src/components/MultiCheckout/index.tsx +385 -52
- package/themes/original/src/components/MultiCheckout/styles.tsx +3 -1
- package/themes/original/src/components/MultiOrdersDetails/index.tsx +23 -19
- package/themes/original/src/components/MyOrders/index.tsx +25 -16
- package/themes/original/src/components/NavBar/index.tsx +20 -13
- package/themes/original/src/components/NotFoundSource/index.tsx +14 -10
- package/themes/original/src/components/OrderDetails/OrderEta.tsx +76 -0
- package/themes/original/src/components/OrderDetails/OrderHistory.tsx +21 -5
- package/themes/original/src/components/OrderDetails/index.tsx +50 -38
- package/themes/original/src/components/OrderDetails/styles.tsx +0 -1
- package/themes/original/src/components/OrderItAgain/index.tsx +3 -1
- package/themes/original/src/components/OrderProgress/index.tsx +34 -25
- package/themes/original/src/components/OrderSummary/index.tsx +83 -57
- package/themes/original/src/components/OrderTypeSelector/index.tsx +5 -6
- package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/index.tsx +14 -14
- package/themes/original/src/components/OrdersOption/index.tsx +59 -46
- package/themes/original/src/components/OrdersOption/styles.tsx +1 -1
- 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/index.tsx +88 -31
- package/themes/original/src/components/ProductForm/styles.tsx +3 -3
- package/themes/original/src/components/ProductItemAccordion/index.tsx +8 -6
- package/themes/original/src/components/ProductOptionSubOption/index.tsx +49 -20
- package/themes/original/src/components/ProductOptionSubOption/styles.tsx +10 -9
- package/themes/original/src/components/ProfessionalFilter/SingleProfessionalCard/index.tsx +108 -0
- package/themes/original/src/components/ProfessionalFilter/index.tsx +20 -50
- package/themes/original/src/components/ProfessionalProfile/index.tsx +36 -7
- package/themes/original/src/components/Promotions/index.tsx +2 -2
- package/themes/original/src/components/Promotions/styles.tsx +3 -1
- package/themes/original/src/components/ReviewProducts/index.tsx +16 -7
- package/themes/original/src/components/ScheduleAccordion/index.tsx +3 -3
- package/themes/original/src/components/ServiceForm/index.tsx +63 -20
- package/themes/original/src/components/Sessions/styles.tsx +1 -0
- package/themes/original/src/components/SignupForm/index.tsx +43 -27
- package/themes/original/src/components/SingleOrderCard/index.tsx +42 -19
- package/themes/original/src/components/SingleOrderCard/styles.tsx +1 -1
- package/themes/original/src/components/SingleProductCard/index.tsx +37 -26
- package/themes/original/src/components/SingleProductCard/styles.tsx +9 -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/index.tsx +5 -10
- package/themes/original/src/components/UserDetails/index.tsx +3 -1
- package/themes/original/src/components/UserFormDetails/index.tsx +78 -9
- package/themes/original/src/components/UserFormDetails/styles.tsx +1 -1
- package/themes/original/src/components/UserProfile/index.tsx +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/Wallets/index.tsx +52 -62
- package/themes/original/src/components/Wallets/styles.tsx +2 -4
- 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 +3 -3
- package/themes/original/src/types/index.tsx +37 -10
- package/themes/original/src/utils/index.tsx +185 -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,8 +1,10 @@
|
|
|
1
|
-
import React, { useState, useEffect } from 'react';
|
|
2
|
-
import { View, StyleSheet, TouchableOpacity, Platform, I18nManager,
|
|
1
|
+
import React, { useState, useEffect, useCallback } from 'react';
|
|
2
|
+
import { View, StyleSheet, TouchableOpacity, Platform, I18nManager, ScrollView } from 'react-native';
|
|
3
3
|
import { initStripe, useConfirmPayment } from '@stripe/stripe-react-native';
|
|
4
|
+
import NativeStripeSdk from '@stripe/stripe-react-native/src/NativeStripeSdk'
|
|
4
5
|
import Picker from 'react-native-country-picker-modal';
|
|
5
6
|
import MaterialIcons from 'react-native-vector-icons/MaterialIcons'
|
|
7
|
+
import ReactNativeHapticFeedback from "react-native-haptic-feedback";
|
|
6
8
|
import {
|
|
7
9
|
Checkout as CheckoutController,
|
|
8
10
|
useOrder,
|
|
@@ -14,9 +16,10 @@ import {
|
|
|
14
16
|
useConfig,
|
|
15
17
|
useToast,
|
|
16
18
|
ToastType,
|
|
19
|
+
useEvent
|
|
17
20
|
} from 'ordering-components/native';
|
|
18
21
|
import { useTheme } from 'styled-components/native';
|
|
19
|
-
import { OText, OIcon, OModal } from '../shared';
|
|
22
|
+
import { OText, OIcon, OModal, OButton } from '../shared';
|
|
20
23
|
|
|
21
24
|
import { AddressDetails } from '../AddressDetails';
|
|
22
25
|
import { PaymentOptions } from '../PaymentOptions';
|
|
@@ -25,6 +28,8 @@ import { NotFoundSource } from '../NotFoundSource';
|
|
|
25
28
|
import { UserDetails } from '../UserDetails';
|
|
26
29
|
import { PaymentOptionWallet } from '../PaymentOptionWallet';
|
|
27
30
|
import { PlaceSpot } from '../PlaceSpot'
|
|
31
|
+
import { SignupForm } from '../SignupForm'
|
|
32
|
+
import { LoginForm } from '../LoginForm'
|
|
28
33
|
|
|
29
34
|
import {
|
|
30
35
|
ChContainer,
|
|
@@ -44,7 +49,6 @@ import {
|
|
|
44
49
|
CartHeader
|
|
45
50
|
} from './styles';
|
|
46
51
|
import { Fade, Placeholder, PlaceholderLine } from 'rn-placeholder';
|
|
47
|
-
|
|
48
52
|
import { FloatingButton } from '../FloatingButton';
|
|
49
53
|
import { Container } from '../../layouts/Container';
|
|
50
54
|
import NavBar from '../NavBar';
|
|
@@ -52,6 +56,8 @@ import { OrderSummary } from '../OrderSummary';
|
|
|
52
56
|
import { getTypesText } from '../../utils';
|
|
53
57
|
import { CartStoresListing } from '../CartStoresListing';
|
|
54
58
|
import { PaymentOptionsWebView } from '../../../../../src/components/PaymentOptionsWebView';
|
|
59
|
+
import { DeviceOrientationMethods } from '../../../../../src/hooks/DeviceOrientation'
|
|
60
|
+
const { useDeviceOrientation } = DeviceOrientationMethods
|
|
55
61
|
|
|
56
62
|
const mapConfigs = {
|
|
57
63
|
mapZoom: 16,
|
|
@@ -78,6 +84,7 @@ const CheckoutUI = (props: any) => {
|
|
|
78
84
|
placing,
|
|
79
85
|
cartState,
|
|
80
86
|
cartUuid,
|
|
87
|
+
loyaltyPlansState,
|
|
81
88
|
businessDetails,
|
|
82
89
|
paymethodSelected,
|
|
83
90
|
handlePaymethodChange,
|
|
@@ -88,7 +95,8 @@ const CheckoutUI = (props: any) => {
|
|
|
88
95
|
handleChangeDeliveryOption,
|
|
89
96
|
currency,
|
|
90
97
|
merchantId,
|
|
91
|
-
setPlaceSpotNumber
|
|
98
|
+
setPlaceSpotNumber,
|
|
99
|
+
maxDate
|
|
92
100
|
} = props
|
|
93
101
|
|
|
94
102
|
const theme = useTheme();
|
|
@@ -128,12 +136,17 @@ const CheckoutUI = (props: any) => {
|
|
|
128
136
|
|
|
129
137
|
const [, { showToast }] = useToast();
|
|
130
138
|
const [, t] = useLanguage();
|
|
131
|
-
const [{ user, token }] = useSession();
|
|
139
|
+
const [{ user, token }, { login }] = useSession();
|
|
132
140
|
const [ordering] = useApi()
|
|
133
141
|
const [{ configs }] = useConfig();
|
|
134
142
|
const [{ parsePrice, parseDate }] = useUtils();
|
|
135
143
|
const [{ options, carts, loading }, { confirmCart }] = useOrder();
|
|
136
144
|
const [validationFields] = useValidationFields();
|
|
145
|
+
const [events] = useEvent()
|
|
146
|
+
const [orientationState] = useDeviceOrientation();
|
|
147
|
+
const [isReadMore, setIsReadMore] = useState(false)
|
|
148
|
+
const [lengthMore, setLengthMore] = useState(false)
|
|
149
|
+
const WIDTH_SCREEN = orientationState?.dimensions?.width
|
|
137
150
|
|
|
138
151
|
const [errorCash, setErrorCash] = useState(false);
|
|
139
152
|
const [userErrors, setUserErrors] = useState<any>([]);
|
|
@@ -145,7 +158,14 @@ const CheckoutUI = (props: any) => {
|
|
|
145
158
|
const [webviewPaymethod, setWebviewPaymethod] = useState<any>(null)
|
|
146
159
|
const [isOpen, setIsOpen] = useState(false)
|
|
147
160
|
const [requiredFields, setRequiredFields] = useState<any>([])
|
|
148
|
-
|
|
161
|
+
const [openModal, setOpenModal] = useState({ login: false, signup: false, isGuest: false })
|
|
162
|
+
const [allowedGuest, setAllowedGuest] = useState(false)
|
|
163
|
+
const [placeByMethodPay, setPlaceByMethodPay] = useState(false)
|
|
164
|
+
const [methodPaySupported, setMethodPaySupported] = useState({ enabled: false, message: null, loading: true })
|
|
165
|
+
const [paymethodClicked, setPaymethodClicked] = useState<any>(null)
|
|
166
|
+
const [cardList, setCardList] = useState<any>({ cards: [], loading: false, error: null })
|
|
167
|
+
const cardsMethods = ['credomatic']
|
|
168
|
+
const stripePaymethods: any = ['stripe', 'stripe_direct', 'stripe_connect', 'stripe_redirect']
|
|
149
169
|
const placeSpotTypes = [3, 4, 5]
|
|
150
170
|
const placeSpotsEnabled = placeSpotTypes.includes(options?.type)
|
|
151
171
|
const isGiftCardCart = !cart?.business_id
|
|
@@ -154,24 +174,40 @@ const CheckoutUI = (props: any) => {
|
|
|
154
174
|
const isWalletCreditPointsEnabled = businessConfigs.find((config: any) => config.key === 'wallet_credit_point_enabled')?.value === '1'
|
|
155
175
|
const isWalletEnabled = configs?.cash_wallet?.value && configs?.wallet_enabled?.value === '1' && (isWalletCashEnabled || isWalletCreditPointsEnabled)
|
|
156
176
|
const isBusinessChangeEnabled = configs?.cart_change_business_validation?.value === '1'
|
|
157
|
-
const isChewLayout = theme?.header?.components?.layout?.type === 'chew'
|
|
177
|
+
const isChewLayout = theme?.header?.components?.layout?.type?.toLowerCase() === 'chew'
|
|
158
178
|
const hideBusinessAddress = theme?.checkout?.components?.business?.components?.address?.hidden
|
|
159
179
|
const hideBusinessDetails = theme?.checkout?.components?.business?.hidden
|
|
160
180
|
const hideBusinessMap = theme?.checkout?.components?.business?.components?.map?.hidden
|
|
161
181
|
const hideCustomerDetails = theme?.checkout?.components?.customer?.hidden
|
|
162
182
|
|
|
183
|
+
const creditPointPlan = loyaltyPlansState?.result?.find((loyal: any) => loyal.type === 'credit_point')
|
|
184
|
+
const creditPointPlanOnBusiness = creditPointPlan?.businesses?.find((b: any) => b.business_id === cart?.business_id && b.accumulates)
|
|
185
|
+
const methodsPay = ['google_pay', 'apple_pay']
|
|
186
|
+
|
|
163
187
|
const isPreOrder = configs?.preorder_status_enabled?.value === '1'
|
|
164
188
|
const subtotalWithTaxes = cart?.taxes?.reduce((acc: any, item: any) => {
|
|
165
189
|
if (item?.type === 1)
|
|
166
190
|
return acc = acc + item?.summary?.tax
|
|
167
191
|
return acc = acc
|
|
168
192
|
}, cart?.subtotal)
|
|
193
|
+
|
|
194
|
+
const validateCommentsCartField = validationFields?.fields?.checkout?.comments?.enabled && validationFields?.fields?.checkout?.comments?.required && (cart?.comment === null || cart?.comment?.trim().length === 0)
|
|
195
|
+
const validateZipcodeCard = validationFields?.fields?.card?.zipcode?.enabled &&
|
|
196
|
+
validationFields?.fields?.card?.zipcode?.required &&
|
|
197
|
+
paymethodSelected?.data?.card &&
|
|
198
|
+
!paymethodSelected?.data?.card?.zipcode &&
|
|
199
|
+
paymethodSelected?.gateway === 'stripe'
|
|
200
|
+
|
|
169
201
|
const isDisabledButtonPlace = loading || !cart?.valid || (!paymethodSelected && cart?.balance > 0) ||
|
|
170
202
|
placing || errorCash || subtotalWithTaxes < cart?.minimum ||
|
|
203
|
+
(cardsMethods.includes(paymethodSelected?.gateway) && cardList?.cards?.length === 0) ||
|
|
171
204
|
(options.type === 1 &&
|
|
172
205
|
validationFields?.fields?.checkout?.driver_tip?.enabled &&
|
|
173
206
|
validationFields?.fields?.checkout?.driver_tip?.required &&
|
|
174
|
-
(Number(cart?.driver_tip) <= 0))
|
|
207
|
+
(Number(cart?.driver_tip) <= 0)) ||
|
|
208
|
+
(validateCommentsCartField) ||
|
|
209
|
+
(validateZipcodeCard)
|
|
210
|
+
|| (methodsPay.includes(paymethodSelected?.gateway) && (!methodPaySupported.enabled || methodPaySupported.loading))
|
|
175
211
|
|
|
176
212
|
const driverTipsOptions = typeof configs?.driver_tip_options?.value === 'string'
|
|
177
213
|
? JSON.parse(configs?.driver_tip_options?.value) || []
|
|
@@ -181,6 +217,9 @@ const CheckoutUI = (props: any) => {
|
|
|
181
217
|
|
|
182
218
|
const cartsWithProducts = carts && Object.values(carts).filter((cart: any) => cart.products.length) || null
|
|
183
219
|
|
|
220
|
+
const isSandboxCredomatic = configs?.credomatic_integration_sandbox?.value === '1'
|
|
221
|
+
const credomaticKeyId = isSandboxCredomatic ? configs?.credomatic_integration_public_sandbox_key?.value : configs?.credomatic_integration_public_production_key?.value
|
|
222
|
+
const credomaticUrl = `https://integrations.ordering.co/credomatic/front/auth_mobile.html?title=${t('CREDOMATIC_PAYMENT', 'Credomatic payment')}&body=${t('CREDOMATIC_PROCESSING', 'Processing transaction')}`
|
|
184
223
|
const deliveryOptions = instructionsOptions?.result && instructionsOptions?.result?.filter((option: any) => option?.enabled)?.map((option: any) => {
|
|
185
224
|
return {
|
|
186
225
|
value: option?.id, key: option?.id, label: t(option?.name.toUpperCase().replace(/\s/g, '_'), option?.name)
|
|
@@ -193,10 +232,36 @@ const CheckoutUI = (props: any) => {
|
|
|
193
232
|
}
|
|
194
233
|
}
|
|
195
234
|
|
|
235
|
+
const vibrateApp = (impact?: string) => {
|
|
236
|
+
const options = {
|
|
237
|
+
enableVibrateFallback: true,
|
|
238
|
+
ignoreAndroidSystemSettings: false
|
|
239
|
+
};
|
|
240
|
+
ReactNativeHapticFeedback.trigger(impact || "impactLight", options);
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
const handleSuccessSignup = (user: any) => {
|
|
244
|
+
login({
|
|
245
|
+
user,
|
|
246
|
+
token: user?.session?.access_token
|
|
247
|
+
})
|
|
248
|
+
openModal?.isGuest && handlePlaceOrderAsGuest()
|
|
249
|
+
setOpenModal({ ...openModal, signup: false, isGuest: false })
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
const handleSuccessLogin = (user: any) => {
|
|
253
|
+
if (user) setOpenModal({ ...openModal, login: false })
|
|
254
|
+
}
|
|
255
|
+
|
|
196
256
|
const handlePlaceOrder = (confirmPayment: any, forcePlace: boolean = false) => {
|
|
197
|
-
if (
|
|
198
|
-
|
|
199
|
-
|
|
257
|
+
if (stripePaymethods.includes(paymethodSelected?.gateway) && user?.guest_id) {
|
|
258
|
+
setOpenModal({ ...openModal, signup: true, isGuest: true })
|
|
259
|
+
return
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
if (!userErrors.length && (!requiredFields?.length || allowedGuest) || forcePlace) {
|
|
263
|
+
vibrateApp()
|
|
264
|
+
handlerClickPlaceOrder && handlerClickPlaceOrder(null, { isNative: true }, confirmPayment, NativeStripeSdk?.dismissPlatformPay)
|
|
200
265
|
return
|
|
201
266
|
}
|
|
202
267
|
if (requiredFields?.length) {
|
|
@@ -211,6 +276,11 @@ const CheckoutUI = (props: any) => {
|
|
|
211
276
|
setIsUserDetailsEdit(true)
|
|
212
277
|
}
|
|
213
278
|
|
|
279
|
+
const handlePlaceOrderAsGuest = () => {
|
|
280
|
+
setIsOpen(false)
|
|
281
|
+
handlerClickPlaceOrder && handlerClickPlaceOrder()
|
|
282
|
+
}
|
|
283
|
+
|
|
214
284
|
const handlePaymentMethodClick = (paymethod: any) => {
|
|
215
285
|
setShowGateway({ closedByUser: false, open: true })
|
|
216
286
|
setWebviewPaymethod(paymethod)
|
|
@@ -229,7 +299,7 @@ const CheckoutUI = (props: any) => {
|
|
|
229
299
|
const checkValidationFields = () => {
|
|
230
300
|
setUserErrors([])
|
|
231
301
|
const errors = []
|
|
232
|
-
const notFields = ['coupon', 'driver_tip', 'mobile_phone', 'address', 'zipcode', 'address_notes']
|
|
302
|
+
const notFields = ['coupon', 'driver_tip', 'mobile_phone', 'address', 'zipcode', 'address_notes', 'comments']
|
|
233
303
|
const _requiredFields: any = []
|
|
234
304
|
|
|
235
305
|
Object.values(validationFields?.fields?.checkout).map((field: any) => {
|
|
@@ -277,7 +347,7 @@ const CheckoutUI = (props: any) => {
|
|
|
277
347
|
useEffect(() => {
|
|
278
348
|
if (cart?.products?.length === 0) {
|
|
279
349
|
if (cart?.business?.slug) {
|
|
280
|
-
onNavigationRedirect('Business', { store: cart?.business?.slug, header: null, logo: null })
|
|
350
|
+
onNavigationRedirect('Business', { store: cart?.business?.slug, header: null, logo: null, fromMulti: props.fromMulti })
|
|
281
351
|
} else {
|
|
282
352
|
onNavigationRedirect('Wallets')
|
|
283
353
|
}
|
|
@@ -303,6 +373,24 @@ const CheckoutUI = (props: any) => {
|
|
|
303
373
|
)
|
|
304
374
|
}
|
|
305
375
|
|
|
376
|
+
useEffect(() => {
|
|
377
|
+
cart && events.emit('checkout_started', cart)
|
|
378
|
+
}, [])
|
|
379
|
+
|
|
380
|
+
useEffect(() => {
|
|
381
|
+
if (cart?.paymethod_data?.gateway === 'credomatic') {
|
|
382
|
+
if (cart?.paymethod_data?.status === 2) {
|
|
383
|
+
setShowGateway({ ...showGateway, open: true })
|
|
384
|
+
} else if (cart?.paymethod_data?.gateway === 'credomatic' && cart?.paymethod_data?.status === 4) {
|
|
385
|
+
setShowGateway({ ...showGateway, open: false })
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
}, [cart?.paymethod_data])
|
|
389
|
+
|
|
390
|
+
const onTextLayout = useCallback((e: any) => {
|
|
391
|
+
setLengthMore((e.nativeEvent.lines.length == 3 && e.nativeEvent.lines[2].width > WIDTH_SCREEN * .76) || e.nativeEvent.lines.length > 3)
|
|
392
|
+
}, [])
|
|
393
|
+
|
|
306
394
|
return (
|
|
307
395
|
<>
|
|
308
396
|
<Container noPadding>
|
|
@@ -310,11 +398,12 @@ const CheckoutUI = (props: any) => {
|
|
|
310
398
|
<NavBar
|
|
311
399
|
title={t('CHECKOUT', 'Checkout')}
|
|
312
400
|
titleAlign={'center'}
|
|
313
|
-
onActionLeft={() =>
|
|
401
|
+
onActionLeft={() => onNavigationRedirect('BottomTab', { screen: 'Cart' }, !props.fromMulti)}
|
|
314
402
|
showCall={false}
|
|
315
403
|
btnStyle={{ paddingLeft: 0, paddingTop: Platform.OS == 'ios' ? 0 : 2 }}
|
|
316
404
|
titleWrapStyle={{ paddingHorizontal: 0 }}
|
|
317
405
|
titleStyle={{ marginRight: 0, marginLeft: 0 }}
|
|
406
|
+
style={{ marginTop: 20 }}
|
|
318
407
|
/>
|
|
319
408
|
</View>
|
|
320
409
|
<ChContainer style={styles.pagePadding}>
|
|
@@ -393,6 +482,25 @@ const CheckoutUI = (props: any) => {
|
|
|
393
482
|
{businessDetails?.business?.address}
|
|
394
483
|
</OText>
|
|
395
484
|
)}
|
|
485
|
+
{businessDetails?.business?.address_notes && (
|
|
486
|
+
<>
|
|
487
|
+
<OText
|
|
488
|
+
size={12}
|
|
489
|
+
lineHeight={18}
|
|
490
|
+
numberOfLines={isReadMore ? 20 : 3}
|
|
491
|
+
onTextLayout={onTextLayout}
|
|
492
|
+
>
|
|
493
|
+
{businessDetails?.business?.address_notes}
|
|
494
|
+
</OText>
|
|
495
|
+
{lengthMore && (
|
|
496
|
+
<TouchableOpacity
|
|
497
|
+
onPress={() => setIsReadMore(!isReadMore)}
|
|
498
|
+
>
|
|
499
|
+
<OText size={12} color={theme.colors.primary}>{isReadMore ? t('SHOW_LESS', 'Show less') : t('READ_MORE', 'Read more')}</OText>
|
|
500
|
+
</TouchableOpacity>
|
|
501
|
+
)}
|
|
502
|
+
</>
|
|
503
|
+
)}
|
|
396
504
|
</View>
|
|
397
505
|
</>
|
|
398
506
|
)}
|
|
@@ -420,18 +528,46 @@ const CheckoutUI = (props: any) => {
|
|
|
420
528
|
<PlaceholderLine height={12} style={{ marginBottom: 20 }} />
|
|
421
529
|
</Placeholder>
|
|
422
530
|
) : (
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
531
|
+
(user?.guest_id && !allowedGuest) ? (
|
|
532
|
+
<View>
|
|
533
|
+
<HeaderTitle text={t('CUSTOMER_DETAILS', 'Customer details')} />
|
|
534
|
+
<OButton
|
|
535
|
+
text={t('SIGN_UP', 'Sign up')}
|
|
536
|
+
textStyle={{ color: theme.colors.white }}
|
|
537
|
+
style={{ borderRadius: 7.6, marginTop: 20 }}
|
|
538
|
+
onClick={() => setOpenModal({ ...openModal, signup: true })}
|
|
539
|
+
/>
|
|
540
|
+
<OButton
|
|
541
|
+
text={t('LOGIN', 'Login')}
|
|
542
|
+
textStyle={{ color: theme.colors.primary }}
|
|
543
|
+
bgColor={theme.colors.white}
|
|
544
|
+
borderColor={theme.colors.primary}
|
|
545
|
+
style={{ borderRadius: 7.6, marginTop: 20 }}
|
|
546
|
+
onClick={() => setOpenModal({ ...openModal, login: true })}
|
|
547
|
+
/>
|
|
548
|
+
<OButton
|
|
549
|
+
text={t('CONTINUE_AS_GUEST', 'Continue as guest')}
|
|
550
|
+
textStyle={{ color: theme.colors.black }}
|
|
551
|
+
bgColor={theme.colors.white}
|
|
552
|
+
borderColor={theme.colors.black}
|
|
553
|
+
style={{ borderRadius: 7.6, marginTop: 20 }}
|
|
554
|
+
onClick={() => setAllowedGuest(true)}
|
|
555
|
+
/>
|
|
556
|
+
</View>
|
|
557
|
+
) : (
|
|
558
|
+
<UserDetails
|
|
559
|
+
isUserDetailsEdit={isUserDetailsEdit}
|
|
560
|
+
HeaderTitle={<HeaderTitle text={t('CUSTOMER_DETAILS', 'Customer Details')} mb={0} />}
|
|
561
|
+
cartStatus={cart?.status}
|
|
562
|
+
businessId={cart?.business_id}
|
|
563
|
+
useValidationFields
|
|
564
|
+
useDefualtSessionManager
|
|
565
|
+
useSessionUser
|
|
566
|
+
isCheckout
|
|
567
|
+
phoneUpdate={phoneUpdate}
|
|
568
|
+
togglePhoneUpdate={togglePhoneUpdate}
|
|
569
|
+
/>
|
|
570
|
+
)
|
|
435
571
|
)}
|
|
436
572
|
</ChUserDetails>
|
|
437
573
|
<View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginHorizontal: -40 }} />
|
|
@@ -479,7 +615,7 @@ const CheckoutUI = (props: any) => {
|
|
|
479
615
|
data: deliveryOptions || [],
|
|
480
616
|
renderItem: ({ item }: any) => (
|
|
481
617
|
<TouchableOpacity
|
|
482
|
-
onPress={() => changeDeliveryOption(item.value)}
|
|
618
|
+
onPress={() => !!cart?.uuid && changeDeliveryOption(item.value)}
|
|
483
619
|
disabled={
|
|
484
620
|
deliveryOptionSelected === item.value
|
|
485
621
|
}
|
|
@@ -528,7 +664,7 @@ const CheckoutUI = (props: any) => {
|
|
|
528
664
|
) : (
|
|
529
665
|
<AddressDetails
|
|
530
666
|
navigation={navigation}
|
|
531
|
-
location={
|
|
667
|
+
location={options?.address?.location}
|
|
532
668
|
businessLogo={businessDetails?.business?.logo}
|
|
533
669
|
isCartPending={cart?.status === 2}
|
|
534
670
|
uuid={cartUuid}
|
|
@@ -558,12 +694,13 @@ const CheckoutUI = (props: any) => {
|
|
|
558
694
|
uuid={cartUuid}
|
|
559
695
|
businessId={cart?.business_id}
|
|
560
696
|
driverTipsOptions={!driverTipsOptions.includes(0) ? [0, ...driverTipsOptions] : driverTipsOptions}
|
|
561
|
-
isFixedPrice={parseInt(configs?.driver_tip_type?.value, 10) === 1
|
|
697
|
+
isFixedPrice={parseInt(configs?.driver_tip_type?.value, 10) === 1}
|
|
562
698
|
isDriverTipUseCustom={!!parseInt(configs?.driver_tip_use_custom?.value, 10)}
|
|
563
|
-
driverTip={parseInt(configs?.driver_tip_type?.value, 10) === 1
|
|
699
|
+
driverTip={parseInt(configs?.driver_tip_type?.value, 10) === 1
|
|
564
700
|
? cart?.driver_tip
|
|
565
701
|
: cart?.driver_tip_rate}
|
|
566
702
|
useOrderContext
|
|
703
|
+
cart={cart}
|
|
567
704
|
/>
|
|
568
705
|
</ChDriverTips>
|
|
569
706
|
</ChSection>
|
|
@@ -596,6 +733,16 @@ const CheckoutUI = (props: any) => {
|
|
|
596
733
|
handlePaymentMethodClickCustom={handlePaymentMethodClick}
|
|
597
734
|
handlePlaceOrder={handlePlaceOrder}
|
|
598
735
|
merchantId={merchantId}
|
|
736
|
+
setMethodPaySupported={setMethodPaySupported}
|
|
737
|
+
methodPaySupported={methodPaySupported}
|
|
738
|
+
placeByMethodPay={placeByMethodPay}
|
|
739
|
+
setPlaceByMethodPay={setPlaceByMethodPay}
|
|
740
|
+
cardList={cardList}
|
|
741
|
+
setCardList={setCardList}
|
|
742
|
+
requiredFields={requiredFields}
|
|
743
|
+
openUserModal={setIsOpen}
|
|
744
|
+
paymethodClicked={paymethodClicked}
|
|
745
|
+
setPaymethodClicked={setPaymethodClicked}
|
|
599
746
|
/>
|
|
600
747
|
</ChPaymethods>
|
|
601
748
|
</ChSection>
|
|
@@ -605,6 +752,7 @@ const CheckoutUI = (props: any) => {
|
|
|
605
752
|
<WalletPaymentOptionContainer>
|
|
606
753
|
<PaymentOptionWallet
|
|
607
754
|
cart={cart}
|
|
755
|
+
loyaltyPlansState={loyaltyPlansState}
|
|
608
756
|
businessId={cart?.business_id}
|
|
609
757
|
businessConfigs={businessDetails?.business?.configs}
|
|
610
758
|
/>
|
|
@@ -674,6 +822,12 @@ const CheckoutUI = (props: any) => {
|
|
|
674
822
|
isCartPending={cart?.status === 2}
|
|
675
823
|
onNavigationRedirect={onNavigationRedirect}
|
|
676
824
|
placeSpotTypes={placeSpotTypes}
|
|
825
|
+
businessConfigs={businessConfigs}
|
|
826
|
+
maxDate={maxDate}
|
|
827
|
+
loyaltyRewardRate={
|
|
828
|
+
creditPointPlanOnBusiness?.accumulation_rate ??
|
|
829
|
+
(!!creditPointPlanOnBusiness && creditPointPlan?.accumulation_rate) ?? 0
|
|
830
|
+
}
|
|
677
831
|
/>
|
|
678
832
|
</>
|
|
679
833
|
)}
|
|
@@ -683,7 +837,7 @@ const CheckoutUI = (props: any) => {
|
|
|
683
837
|
|
|
684
838
|
{!cartState.loading && cart && (
|
|
685
839
|
<View>
|
|
686
|
-
<ChErrors style={{ marginBottom: 10 }}>
|
|
840
|
+
<ChErrors style={{ marginBottom: Platform.OS === 'ios' ? 35 : 10 }}>
|
|
687
841
|
{!cart?.valid_address && cart?.status !== 2 && (
|
|
688
842
|
<OText
|
|
689
843
|
color={theme.colors.error}
|
|
@@ -710,6 +864,14 @@ const CheckoutUI = (props: any) => {
|
|
|
710
864
|
{t('WARNING_INVALID_PRODUCTS_CHECKOUT', 'To continue with your checkout, please remove from your cart the products that are not available.')}
|
|
711
865
|
</OText>
|
|
712
866
|
)}
|
|
867
|
+
{cart?.valid_preorder !== undefined && !cart?.valid_preorder && (
|
|
868
|
+
<OText
|
|
869
|
+
color={theme.colors.error}
|
|
870
|
+
size={12}
|
|
871
|
+
>
|
|
872
|
+
{t('INVALID_CART_MOMENT', 'Selected schedule time is invalid, please select a schedule into the business schedule interval.')}
|
|
873
|
+
</OText>
|
|
874
|
+
)}
|
|
713
875
|
{options.type === 1 &&
|
|
714
876
|
validationFields?.fields?.checkout?.driver_tip?.enabled &&
|
|
715
877
|
validationFields?.fields?.checkout?.driver_tip?.required &&
|
|
@@ -721,6 +883,24 @@ const CheckoutUI = (props: any) => {
|
|
|
721
883
|
{t('WARNING_INVALID_DRIVER_TIP', 'Driver Tip is required.')}
|
|
722
884
|
</OText>
|
|
723
885
|
)}
|
|
886
|
+
|
|
887
|
+
{validateCommentsCartField && (
|
|
888
|
+
<OText
|
|
889
|
+
color={theme.colors.error}
|
|
890
|
+
size={12}
|
|
891
|
+
>
|
|
892
|
+
{t('WARNING_INVALID_CART_COMMENTS', 'Cart comments is required.')}
|
|
893
|
+
</OText>
|
|
894
|
+
)}
|
|
895
|
+
|
|
896
|
+
{validateZipcodeCard && (
|
|
897
|
+
<OText
|
|
898
|
+
color={theme.colors.error}
|
|
899
|
+
size={12}
|
|
900
|
+
>
|
|
901
|
+
{t('WARNING_CARD_ZIPCODE_REQUIRED', 'Your card selected has not zipcode')}
|
|
902
|
+
</OText>
|
|
903
|
+
)}
|
|
724
904
|
</ChErrors>
|
|
725
905
|
</View>
|
|
726
906
|
)}
|
|
@@ -753,18 +933,59 @@ const CheckoutUI = (props: any) => {
|
|
|
753
933
|
togglePhoneUpdate={togglePhoneUpdate}
|
|
754
934
|
requiredFields={requiredFields}
|
|
755
935
|
hideUpdateButton
|
|
936
|
+
handlePlaceOrderAsGuest={handlePlaceOrderAsGuest}
|
|
756
937
|
onClose={() => {
|
|
757
938
|
setIsOpen(false)
|
|
758
|
-
|
|
939
|
+
if (paymethodClicked) {
|
|
940
|
+
setPaymethodClicked({
|
|
941
|
+
...paymethodClicked,
|
|
942
|
+
confirmed: true
|
|
943
|
+
})
|
|
944
|
+
} else {
|
|
945
|
+
handlePlaceOrder(null, true)
|
|
946
|
+
}
|
|
759
947
|
}}
|
|
948
|
+
setIsOpen={setIsOpen}
|
|
760
949
|
/>
|
|
761
950
|
</View>
|
|
762
951
|
</OModal>
|
|
952
|
+
<OModal
|
|
953
|
+
open={openModal.signup}
|
|
954
|
+
onClose={() => setOpenModal({ ...openModal, signup: false, isGuest: false })}
|
|
955
|
+
>
|
|
956
|
+
<ScrollView style={{ paddingHorizontal: 20, width: '100%' }}>
|
|
957
|
+
<SignupForm
|
|
958
|
+
handleSuccessSignup={handleSuccessSignup}
|
|
959
|
+
isGuest
|
|
960
|
+
signupButtonText={t('SIGNUP', 'Signup')}
|
|
961
|
+
useSignupByEmail
|
|
962
|
+
useChekoutFileds
|
|
963
|
+
/>
|
|
964
|
+
</ScrollView>
|
|
965
|
+
</OModal>
|
|
966
|
+
<OModal
|
|
967
|
+
open={openModal.login}
|
|
968
|
+
onClose={() => setOpenModal({ ...openModal, login: false })}
|
|
969
|
+
>
|
|
970
|
+
<ScrollView style={{ paddingHorizontal: 20, width: '100%' }}>
|
|
971
|
+
<LoginForm
|
|
972
|
+
handleSuccessLogin={handleSuccessLogin}
|
|
973
|
+
isGuest
|
|
974
|
+
loginButtonText={t('LOGIN', 'Login')}
|
|
975
|
+
loginButtonBackground={theme.colors.primary}
|
|
976
|
+
/>
|
|
977
|
+
</ScrollView>
|
|
978
|
+
</OModal>
|
|
763
979
|
</ChContainer>
|
|
764
980
|
</Container>
|
|
765
981
|
{!cartState.loading && cart && cart?.status !== 2 && (
|
|
766
982
|
<FloatingButton
|
|
767
|
-
handleClick={
|
|
983
|
+
handleClick={
|
|
984
|
+
isDisabledButtonPlace
|
|
985
|
+
? () => vibrateApp()
|
|
986
|
+
: methodsPay.includes(paymethodSelected?.gateway)
|
|
987
|
+
? () => setPlaceByMethodPay(true)
|
|
988
|
+
: () => handlePlaceOrder(null)}
|
|
768
989
|
isSecondaryBtn={isDisabledButtonPlace}
|
|
769
990
|
disabled={isDisabledButtonPlace}
|
|
770
991
|
btnText={subtotalWithTaxes >= cart?.minimum
|
|
@@ -807,6 +1028,29 @@ const CheckoutUI = (props: any) => {
|
|
|
807
1028
|
locationId={'L1NGAY5M6KJRX'}
|
|
808
1029
|
/>
|
|
809
1030
|
)}
|
|
1031
|
+
{cart?.paymethod_data?.gateway === 'credomatic' && cart?.paymethod_data?.status === 2 && showGateway.open && (
|
|
1032
|
+
<PaymentOptionsWebView
|
|
1033
|
+
title={t('CREDOMATIC_PAYMENT', 'Credomatic payment')}
|
|
1034
|
+
onNavigationRedirect={onNavigationRedirect}
|
|
1035
|
+
uri={credomaticUrl}
|
|
1036
|
+
user={user}
|
|
1037
|
+
cart={cart}
|
|
1038
|
+
additionalParams={{
|
|
1039
|
+
type: 'auth',
|
|
1040
|
+
key_id: credomaticKeyId,
|
|
1041
|
+
hash: cart?.paymethod_data?.result?.hash,
|
|
1042
|
+
time: cart?.paymethod_data?.result?.time,
|
|
1043
|
+
amount: cart?.total,
|
|
1044
|
+
orderid: cart?.uuid,
|
|
1045
|
+
ccnumber: cardList?.cards?.[0]?.number,
|
|
1046
|
+
ccexp: cardList?.cards?.[0]?.expiryString,
|
|
1047
|
+
cvv: cardList?.cards?.[0]?.cvc,
|
|
1048
|
+
redirect: credomaticUrl
|
|
1049
|
+
}}
|
|
1050
|
+
webviewPaymethod={webviewPaymethod}
|
|
1051
|
+
setShowGateway={setShowGateway}
|
|
1052
|
+
/>
|
|
1053
|
+
)}
|
|
810
1054
|
</>
|
|
811
1055
|
)
|
|
812
1056
|
}
|
|
@@ -833,7 +1077,8 @@ export const Checkout = (props: any) => {
|
|
|
833
1077
|
const getOrder = async (cartId: any) => {
|
|
834
1078
|
try {
|
|
835
1079
|
let result: any = {}
|
|
836
|
-
const
|
|
1080
|
+
const cartsWithProducts = orderState?.carts && (Object.values(orderState?.carts)?.filter(cart => cart?.products && cart?.products?.length) || null)
|
|
1081
|
+
const cart = cartsWithProducts?.find((cart: any) => cart.uuid === cartId)
|
|
837
1082
|
if (cart) {
|
|
838
1083
|
result = { ...cart }
|
|
839
1084
|
} else {
|
|
@@ -47,7 +47,7 @@ export const CitiesControl = (props: any) => {
|
|
|
47
47
|
return (
|
|
48
48
|
<Container height={height - top - bottom - 60 - (isKeyboardShow ? 250 : 0)}>
|
|
49
49
|
<View>
|
|
50
|
-
{cities?.map((city: any) => (
|
|
50
|
+
{cities?.map((city: any) => city?.enabled && (
|
|
51
51
|
<CityElement
|
|
52
52
|
key={city?.id}
|
|
53
53
|
activeOpacity={1}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { useEffect } from 'react';
|
|
2
2
|
import { StyleSheet, Alert, Text } from 'react-native';
|
|
3
|
-
import { CouponControl as CouponController, useLanguage } from 'ordering-components/native';
|
|
3
|
+
import { CouponControl as CouponController, useLanguage, useEvent } from 'ordering-components/native';
|
|
4
4
|
import { useTheme } from 'styled-components/native';
|
|
5
5
|
import {
|
|
6
6
|
CContainer,
|
|
@@ -18,11 +18,13 @@ const CouponControlUI = (props: any) => {
|
|
|
18
18
|
handleRemoveCouponClick,
|
|
19
19
|
onChangeInputCoupon,
|
|
20
20
|
confirm,
|
|
21
|
-
setConfirm
|
|
21
|
+
setConfirm,
|
|
22
|
+
cart
|
|
22
23
|
} = props
|
|
23
24
|
|
|
24
25
|
const [, t] = useLanguage()
|
|
25
26
|
const theme = useTheme();
|
|
27
|
+
const [events] = useEvent()
|
|
26
28
|
|
|
27
29
|
const styles = StyleSheet.create({
|
|
28
30
|
inputsStyle: {
|
|
@@ -45,6 +47,11 @@ const CouponControlUI = (props: any) => {
|
|
|
45
47
|
setConfirm({ ...confirm, open: false, error: false })
|
|
46
48
|
}
|
|
47
49
|
|
|
50
|
+
const onButtonApplyClick = () => {
|
|
51
|
+
events.emit('coupon_entered', { ...cart, coupon: couponInput })
|
|
52
|
+
handleButtonApplyClick()
|
|
53
|
+
}
|
|
54
|
+
|
|
48
55
|
useEffect(() => {
|
|
49
56
|
if (confirm.content) {
|
|
50
57
|
Alert.alert(
|
|
@@ -94,7 +101,7 @@ const CouponControlUI = (props: any) => {
|
|
|
94
101
|
inputStyle={{ fontSize: 12 }}
|
|
95
102
|
/>
|
|
96
103
|
<OButton
|
|
97
|
-
onClick={() =>
|
|
104
|
+
onClick={() => onButtonApplyClick()}
|
|
98
105
|
bgColor={theme.colors.primary}
|
|
99
106
|
borderColor={theme.colors.primary}
|
|
100
107
|
textStyle={{ color: 'white', fontSize: 12 }}
|