ordering-ui-react-native 0.18.0 → 0.18.1-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 +4 -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 +91 -43
- package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +87 -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/OrdersListManager/index.tsx +7 -2
- package/themes/business/src/components/OrdersListManager/utils.tsx +1 -1
- package/themes/business/src/components/OrdersOption/index.tsx +60 -47
- 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 +198 -221
- package/themes/business/src/components/PreviousOrders/styles.tsx +10 -0
- 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/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 +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 -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/MaxSectionItem/index.tsx +1 -1
- package/themes/original/src/components/BusinessListingSearch/index.tsx +346 -341
- 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 +12 -4
- 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 +43 -38
- 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/styles.tsx +2 -2
- package/themes/original/src/components/NotFoundSource/index.tsx +14 -10
- package/themes/original/src/components/Notifications/index.tsx +2 -4
- 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/index.tsx +35 -6
- 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 +36 -24
- 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 +1 -1
- package/themes/original/src/types/index.tsx +28 -6
- package/themes/original/src/utils/index.tsx +180 -13
- package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
- package/src/navigators/BottomNavigator.tsx +0 -117
- package/src/navigators/CheckoutNavigator.tsx +0 -66
- package/src/navigators/HomeNavigator.tsx +0 -202
- package/src/navigators/NavigationRef.tsx +0 -7
- package/src/navigators/RootNavigator.tsx +0 -269
- package/src/pages/Account.tsx +0 -34
- package/src/pages/AddressForm.tsx +0 -62
- package/src/pages/AddressList.tsx +0 -24
- package/src/pages/BusinessProductsList.tsx +0 -81
- package/src/pages/BusinessesListing.tsx +0 -43
- package/src/pages/CartList.tsx +0 -49
- package/src/pages/Checkout.tsx +0 -101
- package/src/pages/ForgotPassword.tsx +0 -24
- package/src/pages/Help.tsx +0 -23
- package/src/pages/HelpAccountAndPayment.tsx +0 -23
- package/src/pages/HelpGuide.tsx +0 -23
- package/src/pages/HelpOrder.tsx +0 -23
- package/src/pages/Home.tsx +0 -36
- package/src/pages/IntroductoryTutorial.tsx +0 -170
- package/src/pages/Login.tsx +0 -47
- package/src/pages/MomentOption.tsx +0 -30
- package/src/pages/MultiCheckout.tsx +0 -31
- package/src/pages/MultiOrdersDetails.tsx +0 -27
- package/src/pages/MyOrders.tsx +0 -40
- package/src/pages/NetworkError.tsx +0 -24
- package/src/pages/NotFound.tsx +0 -22
- package/src/pages/OrderDetails.tsx +0 -25
- package/src/pages/ProductDetails.tsx +0 -55
- package/src/pages/Profile.tsx +0 -36
- package/src/pages/ReviewDriver.tsx +0 -30
- package/src/pages/ReviewOrder.tsx +0 -32
- package/src/pages/ReviewProducts.tsx +0 -30
- package/src/pages/Sessions.tsx +0 -22
- package/src/pages/Signup.tsx +0 -53
- package/src/pages/SpinnerLoader.tsx +0 -10
- package/src/pages/Splash.tsx +0 -21
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { useState, useEffect } from 'react';
|
|
2
|
-
import { View, StyleSheet, useWindowDimensions, Keyboard } from 'react-native';
|
|
3
|
-
import { useLanguage, useSession, useConfig } from 'ordering-components/native';
|
|
2
|
+
import { View, StyleSheet, useWindowDimensions, Keyboard, Platform } from 'react-native';
|
|
3
|
+
import { useLanguage, useSession, useConfig, useValidationFields } from 'ordering-components/native';
|
|
4
4
|
import {
|
|
5
5
|
StripeProvider,
|
|
6
6
|
CardField,
|
|
@@ -28,7 +28,12 @@ const StripeElementsFormUI = (props: any) => {
|
|
|
28
28
|
onCancel,
|
|
29
29
|
cart,
|
|
30
30
|
merchantId,
|
|
31
|
-
businessIds
|
|
31
|
+
businessIds,
|
|
32
|
+
setMethodPaySupported,
|
|
33
|
+
placeByMethodPay,
|
|
34
|
+
methodPaySupported,
|
|
35
|
+
setPlaceByMethodPay,
|
|
36
|
+
cartTotal
|
|
32
37
|
} = props;
|
|
33
38
|
|
|
34
39
|
const theme = useTheme();
|
|
@@ -36,6 +41,7 @@ const StripeElementsFormUI = (props: any) => {
|
|
|
36
41
|
const [, t] = useLanguage();
|
|
37
42
|
const [{ user }] = useSession();
|
|
38
43
|
const [{ configs }] = useConfig();
|
|
44
|
+
const [validationFields] = useValidationFields()
|
|
39
45
|
const [card, setCard] = useState<any>(null);
|
|
40
46
|
const [isCompleted, setIsCompleted] = useState(false);
|
|
41
47
|
const [errors, setErrors] = useState('')
|
|
@@ -44,6 +50,23 @@ const StripeElementsFormUI = (props: any) => {
|
|
|
44
50
|
const { height } = useWindowDimensions();
|
|
45
51
|
const { top, bottom } = useSafeAreaInsets();
|
|
46
52
|
const [isKeyboardShow, setIsKeyboardShow] = useState(false);
|
|
53
|
+
const zipCodeEnabled = validationFields?.fields?.card?.zipcode?.enabled
|
|
54
|
+
const zipCodeRequired = validationFields?.fields?.card?.zipcode?.required
|
|
55
|
+
const styles = StyleSheet.create({
|
|
56
|
+
container: {
|
|
57
|
+
width: '100%',
|
|
58
|
+
paddingHorizontal: 20,
|
|
59
|
+
justifyContent: 'space-between',
|
|
60
|
+
paddingBottom: 12
|
|
61
|
+
},
|
|
62
|
+
btnAddStyle: {
|
|
63
|
+
marginTop: 20,
|
|
64
|
+
borderRadius: 7.6,
|
|
65
|
+
shadowOpacity: 0,
|
|
66
|
+
height: 44,
|
|
67
|
+
marginBottom: isKeyboardShow && Platform.OS === 'ios' ? 40 : 0
|
|
68
|
+
},
|
|
69
|
+
})
|
|
47
70
|
|
|
48
71
|
let billingDetails: any = {}
|
|
49
72
|
|
|
@@ -62,24 +85,24 @@ const StripeElementsFormUI = (props: any) => {
|
|
|
62
85
|
|
|
63
86
|
if (user?.address) {
|
|
64
87
|
billingDetails.address = {
|
|
65
|
-
|
|
66
|
-
|
|
88
|
+
line1: user?.address
|
|
89
|
+
}
|
|
67
90
|
}
|
|
68
91
|
|
|
69
92
|
const createPayMethod = async () => {
|
|
70
93
|
const params: any = { paymentMethodType: 'Card', paymentMethodData: {} }
|
|
71
94
|
if (Object.keys(billingDetails).length > 0) {
|
|
72
|
-
params.paymentMethodData.billingDetails = {...billingDetails, token: card?.last4}
|
|
95
|
+
params.paymentMethodData.billingDetails = { ...billingDetails, token: card?.last4 }
|
|
73
96
|
}
|
|
74
97
|
try {
|
|
75
98
|
setCreatePmLoading(true)
|
|
76
99
|
const { paymentMethod, error } = await createPaymentMethod(params);
|
|
77
100
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
101
|
+
if (error) {
|
|
102
|
+
setErrors(error?.message);
|
|
103
|
+
setCreatePmLoading(false)
|
|
104
|
+
return
|
|
105
|
+
}
|
|
83
106
|
|
|
84
107
|
setCreatePmLoading(false)
|
|
85
108
|
handleSource && handleSource({
|
|
@@ -102,7 +125,7 @@ const StripeElementsFormUI = (props: any) => {
|
|
|
102
125
|
setErrors(error?.message || error?.toString());
|
|
103
126
|
}
|
|
104
127
|
}
|
|
105
|
-
|
|
128
|
+
|
|
106
129
|
const handleSaveCard = async () => {
|
|
107
130
|
setErrors('');
|
|
108
131
|
if (!requirements) {
|
|
@@ -111,7 +134,7 @@ const StripeElementsFormUI = (props: any) => {
|
|
|
111
134
|
}
|
|
112
135
|
const params: any = { paymentMethodType: 'Card', paymentMethodData: {} }
|
|
113
136
|
if (Object.keys(billingDetails).length > 0) {
|
|
114
|
-
params.paymentMethodData.billingDetails = {...billingDetails, token: card?.last4}
|
|
137
|
+
params.paymentMethodData.billingDetails = { ...billingDetails, token: card?.last4 }
|
|
115
138
|
}
|
|
116
139
|
try {
|
|
117
140
|
const { setupIntent, error } = await confirmSetupIntent(requirements, params);
|
|
@@ -119,8 +142,8 @@ const StripeElementsFormUI = (props: any) => {
|
|
|
119
142
|
if (setupIntent?.status === 'Succeeded') {
|
|
120
143
|
if (businessIds) {
|
|
121
144
|
businessIds.forEach((_businessId: any, index: any) => {
|
|
122
|
-
|
|
123
|
-
|
|
145
|
+
const _isNewCard = index === 0
|
|
146
|
+
stripeTokenHandler(setupIntent?.paymentMethodId, user, businessId, _isNewCard);
|
|
124
147
|
})
|
|
125
148
|
} else {
|
|
126
149
|
stripeTokenHandler(setupIntent?.paymentMethodId, user, businessId);
|
|
@@ -145,7 +168,8 @@ const StripeElementsFormUI = (props: any) => {
|
|
|
145
168
|
!!card?.last4 &&
|
|
146
169
|
!!card?.expiryMonth &&
|
|
147
170
|
!!card?.expiryYear &&
|
|
148
|
-
!!card?.brand
|
|
171
|
+
!!card?.brand &&
|
|
172
|
+
((!zipCodeEnabled || !zipCodeRequired || !!card?.postalCode))
|
|
149
173
|
)
|
|
150
174
|
}
|
|
151
175
|
}, [card])
|
|
@@ -172,12 +196,12 @@ const StripeElementsFormUI = (props: any) => {
|
|
|
172
196
|
}, []);
|
|
173
197
|
|
|
174
198
|
return (
|
|
175
|
-
<View style={{ ...styles.container, height: height - top - bottom - 60 - (isKeyboardShow ? 250 : 0) }}>
|
|
199
|
+
<View style={{ ...styles.container, height: methodsPay?.includes(paymethod) ? 'auto' : height - top - bottom - 60 - (isKeyboardShow ? 250 : 0) }}>
|
|
176
200
|
{publicKey ? (
|
|
177
201
|
<View style={{ flex: 1 }}>
|
|
178
202
|
<StripeProvider
|
|
179
203
|
publishableKey={publicKey}
|
|
180
|
-
merchantIdentifier={
|
|
204
|
+
merchantIdentifier={merchantId}
|
|
181
205
|
urlScheme={merchantId}
|
|
182
206
|
>
|
|
183
207
|
{methodsPay?.includes(paymethod) ? (
|
|
@@ -185,13 +209,18 @@ const StripeElementsFormUI = (props: any) => {
|
|
|
185
209
|
handleSource={handleSource}
|
|
186
210
|
onCancel={onCancel}
|
|
187
211
|
cart={cart}
|
|
212
|
+
cartTotal={cartTotal}
|
|
188
213
|
setErrors={setErrors}
|
|
189
214
|
paymethod={paymethod}
|
|
190
215
|
devMode={publicKey?.includes('test')}
|
|
216
|
+
setMethodPaySupported={setMethodPaySupported}
|
|
217
|
+
placeByMethodPay={placeByMethodPay}
|
|
218
|
+
methodPaySupported={methodPaySupported}
|
|
219
|
+
setPlaceByMethodPay={setPlaceByMethodPay}
|
|
191
220
|
/>
|
|
192
221
|
) : (
|
|
193
222
|
<CardField
|
|
194
|
-
postalCodeEnabled={
|
|
223
|
+
postalCodeEnabled={zipCodeEnabled}
|
|
195
224
|
cardStyle={{
|
|
196
225
|
backgroundColor: '#FFFFFF',
|
|
197
226
|
textColor: '#000000',
|
|
@@ -249,21 +278,6 @@ const StripeElementsFormUI = (props: any) => {
|
|
|
249
278
|
)
|
|
250
279
|
}
|
|
251
280
|
|
|
252
|
-
const styles = StyleSheet.create({
|
|
253
|
-
container: {
|
|
254
|
-
width: '100%',
|
|
255
|
-
paddingHorizontal: 40,
|
|
256
|
-
justifyContent: 'space-between',
|
|
257
|
-
paddingBottom: 12
|
|
258
|
-
},
|
|
259
|
-
btnAddStyle: {
|
|
260
|
-
marginTop: 20,
|
|
261
|
-
borderRadius: 7.6,
|
|
262
|
-
shadowOpacity: 0,
|
|
263
|
-
height: 44
|
|
264
|
-
},
|
|
265
|
-
})
|
|
266
|
-
|
|
267
281
|
export const StripeElementsForm = (props: any) => {
|
|
268
282
|
const stripeProps = {
|
|
269
283
|
...props,
|
|
@@ -4,7 +4,10 @@ import { useApi, useSession } from 'ordering-components/native';
|
|
|
4
4
|
export const StripeElementsForm = (props: any) => {
|
|
5
5
|
const {
|
|
6
6
|
UIComponent,
|
|
7
|
-
toSave
|
|
7
|
+
toSave,
|
|
8
|
+
setCardsList,
|
|
9
|
+
cardsList,
|
|
10
|
+
handleCardClick
|
|
8
11
|
} = props;
|
|
9
12
|
|
|
10
13
|
const [ordering] = useApi();
|
|
@@ -61,6 +64,14 @@ export const StripeElementsForm = (props: any) => {
|
|
|
61
64
|
})
|
|
62
65
|
const response = await result.json();
|
|
63
66
|
isNewCard && props.onSelectCard && props.onSelectCard(response.result);
|
|
67
|
+
setCardsList && setCardsList({
|
|
68
|
+
...cardsList,
|
|
69
|
+
cards: [
|
|
70
|
+
...cardsList.cards,
|
|
71
|
+
response.result
|
|
72
|
+
]
|
|
73
|
+
})
|
|
74
|
+
handleCardClick(response.result)
|
|
64
75
|
setState({
|
|
65
76
|
...state,
|
|
66
77
|
loadingAdd: false
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
import React, { useState } from 'react'
|
|
2
|
+
import { Platform, StyleSheet, View } from 'react-native'
|
|
3
|
+
import {
|
|
4
|
+
useLanguage,
|
|
5
|
+
useOrder,
|
|
6
|
+
useConfig
|
|
7
|
+
} from 'ordering-components/native'
|
|
8
|
+
import { useTheme } from 'styled-components/native';
|
|
9
|
+
import { OText, OButton } from '../shared'
|
|
10
|
+
import {
|
|
11
|
+
CartList,
|
|
12
|
+
CartDivider,
|
|
13
|
+
TopActionsHeader,
|
|
14
|
+
TopHeader
|
|
15
|
+
} from './styles'
|
|
16
|
+
import { OrderSummary } from '../OrderSummary';
|
|
17
|
+
import { Cart } from '../Cart';
|
|
18
|
+
import { ScrollView } from 'react-native-gesture-handler';
|
|
19
|
+
import IconAntDesign from 'react-native-vector-icons/AntDesign';
|
|
20
|
+
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
21
|
+
import { UpsellingLayout } from './UpsellingLayout';
|
|
22
|
+
|
|
23
|
+
export const UpsellingContent = (props : any) => {
|
|
24
|
+
const {
|
|
25
|
+
onGoBack,
|
|
26
|
+
handleUpsellingPage,
|
|
27
|
+
onNavigationRedirect,
|
|
28
|
+
cart,
|
|
29
|
+
productsList
|
|
30
|
+
} = props
|
|
31
|
+
|
|
32
|
+
const theme = useTheme();
|
|
33
|
+
|
|
34
|
+
const [{ carts }] = useOrder()
|
|
35
|
+
const [{ configs }] = useConfig()
|
|
36
|
+
const [, t] = useLanguage()
|
|
37
|
+
const { bottom } = useSafeAreaInsets()
|
|
38
|
+
const [isCartsLoading, setIsCartsLoading] = useState(false)
|
|
39
|
+
const [showTitle, setShowTitle] = useState(false)
|
|
40
|
+
|
|
41
|
+
const isMultiCheckout = configs?.checkout_multi_business_enabled?.value === '1'
|
|
42
|
+
const isChewLayout = theme?.header?.components?.layout?.type?.toLowerCase() === 'chew'
|
|
43
|
+
const showCartList = isChewLayout
|
|
44
|
+
const commentDelayTime = isChewLayout ? 500 : null
|
|
45
|
+
|
|
46
|
+
const cartList = (carts && Object.values(carts).filter((_cart: any) => _cart?.products?.length > 0 && _cart.uuid !== cart?.uuid)) || []
|
|
47
|
+
|
|
48
|
+
const styles = StyleSheet.create({
|
|
49
|
+
closeUpsellingButton: {
|
|
50
|
+
borderRadius: 7.6,
|
|
51
|
+
borderColor: theme.colors.primary,
|
|
52
|
+
backgroundColor: theme.colors.primary,
|
|
53
|
+
borderWidth: 1,
|
|
54
|
+
alignSelf: 'center',
|
|
55
|
+
height: 44,
|
|
56
|
+
shadowOpacity: 0,
|
|
57
|
+
width: '80%',
|
|
58
|
+
},
|
|
59
|
+
cancelBtn: {
|
|
60
|
+
paddingHorizontal: 18,
|
|
61
|
+
borderWidth: 1,
|
|
62
|
+
borderRadius: 7.6,
|
|
63
|
+
borderColor: theme.colors.textSecondary,
|
|
64
|
+
height: 38
|
|
65
|
+
},
|
|
66
|
+
headerItem: {
|
|
67
|
+
flexDirection: 'row',
|
|
68
|
+
alignItems: 'center',
|
|
69
|
+
marginVertical: 2,
|
|
70
|
+
marginHorizontal: 20,
|
|
71
|
+
},
|
|
72
|
+
btnBackArrow: {
|
|
73
|
+
borderWidth: 0,
|
|
74
|
+
width: 26,
|
|
75
|
+
height: 26,
|
|
76
|
+
backgroundColor: theme.colors.clear,
|
|
77
|
+
borderColor: theme.colors.clear,
|
|
78
|
+
shadowColor: theme.colors.clear,
|
|
79
|
+
paddingLeft: 0,
|
|
80
|
+
paddingRight: 0,
|
|
81
|
+
marginLeft: 20,
|
|
82
|
+
marginBottom: 10
|
|
83
|
+
},
|
|
84
|
+
wrapperNavbar: {
|
|
85
|
+
paddingHorizontal: 20,
|
|
86
|
+
paddingTop: 0,
|
|
87
|
+
}
|
|
88
|
+
})
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
const handleScroll = ({ nativeEvent: { contentOffset } }: any) => {
|
|
92
|
+
setShowTitle(contentOffset.y > 30)
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
return (
|
|
96
|
+
<>
|
|
97
|
+
<View style={styles.wrapperNavbar}>
|
|
98
|
+
<TopHeader>
|
|
99
|
+
<>
|
|
100
|
+
<TopActionsHeader onPress={() => onGoBack()}>
|
|
101
|
+
<IconAntDesign
|
|
102
|
+
name='arrowleft'
|
|
103
|
+
size={26}
|
|
104
|
+
/>
|
|
105
|
+
</TopActionsHeader>
|
|
106
|
+
{showTitle && (
|
|
107
|
+
<OText
|
|
108
|
+
size={16}
|
|
109
|
+
style={{ flex: 1, textAlign: 'center', right: 15 }}
|
|
110
|
+
weight={Platform.OS === 'ios' ? '600' : 'bold'}
|
|
111
|
+
numberOfLines={2}
|
|
112
|
+
ellipsizeMode='tail'
|
|
113
|
+
>
|
|
114
|
+
{t('WANT_SOMETHING_ELSE', 'Do you want something else?')}
|
|
115
|
+
</OText>
|
|
116
|
+
)}
|
|
117
|
+
</>
|
|
118
|
+
</TopHeader>
|
|
119
|
+
</View>
|
|
120
|
+
<ScrollView style={{ marginTop: 10, marginBottom: props.isPage ? 40 : bottom + (Platform.OS == 'ios' ? 96 : 130) }} showsVerticalScrollIndicator={false} onScroll={handleScroll}>
|
|
121
|
+
{productsList.length > 0 &&
|
|
122
|
+
<View style={{ paddingHorizontal: 40, overflow: 'visible' }}>
|
|
123
|
+
<OText size={16} lineHeight={24} weight={'500'}>{t('WANT_SOMETHING_ELSE', 'Do you want something else?')}</OText>
|
|
124
|
+
<UpsellingLayout {...props} />
|
|
125
|
+
</View>
|
|
126
|
+
}
|
|
127
|
+
<View style={{ paddingHorizontal: 40 }}>
|
|
128
|
+
<OText size={20} lineHeight={30} weight={600} style={{ marginTop: 10, marginBottom: 17 }}>{t('YOUR_CART', 'Your cart')}</OText>
|
|
129
|
+
<OrderSummary
|
|
130
|
+
cart={cart}
|
|
131
|
+
commentDelayTime={commentDelayTime}
|
|
132
|
+
isCartPending={cart?.status === 2}
|
|
133
|
+
onNavigationRedirect={onNavigationRedirect}
|
|
134
|
+
/>
|
|
135
|
+
</View>
|
|
136
|
+
{showCartList && cartList.map((cart: any, i: number) => (
|
|
137
|
+
<CartList key={i}>
|
|
138
|
+
<Cart
|
|
139
|
+
isFromUpselling
|
|
140
|
+
cart={cart}
|
|
141
|
+
cartuuid={cart.uuid}
|
|
142
|
+
hideUpselling
|
|
143
|
+
singleBusiness={props.singleBusiness}
|
|
144
|
+
isFranchiseApp={props.isFranchiseApp}
|
|
145
|
+
isCartsLoading={isCartsLoading}
|
|
146
|
+
setIsCartsLoading={setIsCartsLoading}
|
|
147
|
+
isMultiCheckout={isMultiCheckout}
|
|
148
|
+
onNavigationRedirect={props.onNavigationRedirect}
|
|
149
|
+
/>
|
|
150
|
+
<CartDivider />
|
|
151
|
+
</CartList>
|
|
152
|
+
))}
|
|
153
|
+
</ScrollView>
|
|
154
|
+
<View
|
|
155
|
+
style={{
|
|
156
|
+
alignItems: 'center',
|
|
157
|
+
bottom: props.isPage ? Platform.OS === 'ios' ? 0 : 20 : Platform.OS === 'ios' ? bottom + 59 : bottom + 125
|
|
158
|
+
}}
|
|
159
|
+
>
|
|
160
|
+
<OButton
|
|
161
|
+
imgRightSrc=''
|
|
162
|
+
text={t('CHECKOUT', 'Checkout')}
|
|
163
|
+
style={{ ...styles.closeUpsellingButton }}
|
|
164
|
+
textStyle={{ color: theme.colors.white, fontSize: 14 }}
|
|
165
|
+
onClick={() => handleUpsellingPage(cart)}
|
|
166
|
+
/>
|
|
167
|
+
</View>
|
|
168
|
+
</>
|
|
169
|
+
)
|
|
170
|
+
}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { Platform, StyleSheet, View } from 'react-native'
|
|
3
|
+
import {
|
|
4
|
+
useUtils,
|
|
5
|
+
useLanguage
|
|
6
|
+
} from 'ordering-components/native'
|
|
7
|
+
import {
|
|
8
|
+
Container,
|
|
9
|
+
UpsellingContainer,
|
|
10
|
+
Item,
|
|
11
|
+
Details,
|
|
12
|
+
AddButton,
|
|
13
|
+
} from './styles'
|
|
14
|
+
import { OIcon, OText } from '../shared'
|
|
15
|
+
import { useTheme } from 'styled-components/native';
|
|
16
|
+
|
|
17
|
+
export const UpsellingLayout = (props : any) => {
|
|
18
|
+
const {
|
|
19
|
+
upsellingProducts,
|
|
20
|
+
productsList,
|
|
21
|
+
onNavigationRedirect,
|
|
22
|
+
business
|
|
23
|
+
} = props
|
|
24
|
+
const theme = useTheme()
|
|
25
|
+
const [{ parsePrice }] = useUtils()
|
|
26
|
+
const [, t] = useLanguage()
|
|
27
|
+
|
|
28
|
+
const styles = StyleSheet.create({
|
|
29
|
+
imageStyle: {
|
|
30
|
+
width: 73,
|
|
31
|
+
height: 73,
|
|
32
|
+
resizeMode: 'cover',
|
|
33
|
+
borderRadius: 7.6,
|
|
34
|
+
},
|
|
35
|
+
})
|
|
36
|
+
|
|
37
|
+
const handleFormProduct = (product: any) => {
|
|
38
|
+
onNavigationRedirect && onNavigationRedirect('ProductDetails', {
|
|
39
|
+
product: product,
|
|
40
|
+
businessId: product?.api?.businessId,
|
|
41
|
+
businessSlug: business.slug,
|
|
42
|
+
})
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
return (
|
|
47
|
+
<>
|
|
48
|
+
<Container>
|
|
49
|
+
<UpsellingContainer
|
|
50
|
+
horizontal
|
|
51
|
+
showsHorizontalScrollIndicator={false}
|
|
52
|
+
contentContainerStyle={{ paddingHorizontal: Platform.OS === 'ios' ? 40 : 0 }}
|
|
53
|
+
>
|
|
54
|
+
{
|
|
55
|
+
!upsellingProducts.loading && (
|
|
56
|
+
<>
|
|
57
|
+
{
|
|
58
|
+
!upsellingProducts.error ? productsList.map((product: any, i: number) => (
|
|
59
|
+
<Item key={`${product.id}_${i}`}>
|
|
60
|
+
<View style={{ flexBasis: '57%' }}>
|
|
61
|
+
<Details>
|
|
62
|
+
<OText size={12} lineHeight={18} numberOfLines={1} ellipsizeMode='tail'>{product.name}</OText>
|
|
63
|
+
<OText size={12} lineHeight={18} color={theme.colors.textNormal}>{parsePrice(product.price)}</OText>
|
|
64
|
+
</Details>
|
|
65
|
+
<AddButton onPress={() => handleFormProduct(product)}>
|
|
66
|
+
<OText size={10} color={theme.colors.primary}>{t('ADD', 'Add')}</OText>
|
|
67
|
+
</AddButton>
|
|
68
|
+
</View>
|
|
69
|
+
<View>
|
|
70
|
+
<OIcon url={product?.images || theme?.images?.dummies?.product} style={styles.imageStyle} />
|
|
71
|
+
</View>
|
|
72
|
+
</Item>
|
|
73
|
+
)) : (
|
|
74
|
+
<OText>
|
|
75
|
+
{upsellingProducts.message}
|
|
76
|
+
</OText>
|
|
77
|
+
)
|
|
78
|
+
}
|
|
79
|
+
</>
|
|
80
|
+
)
|
|
81
|
+
}
|
|
82
|
+
</UpsellingContainer>
|
|
83
|
+
</Container>
|
|
84
|
+
</>
|
|
85
|
+
)
|
|
86
|
+
}
|