ordering-ui-react-native 0.18.2 → 0.18.3-release
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +9 -7
- package/src/DeliveryApp.tsx +43 -1
- package/src/components/BusinessInformation/index.tsx +10 -9
- package/src/components/BusinessesListing/index.tsx +1 -1
- package/src/components/OrderCreating/index.tsx +0 -20
- package/src/components/PaymentOptionsWebView/index.tsx +29 -8
- package/src/components/PhoneInputNumber/index.tsx +6 -2
- package/src/components/StripeMethodForm/index.tsx +136 -102
- package/src/components/VerifyPhone/styles.tsx +1 -2
- package/src/components/shared/OToast.tsx +3 -2
- package/src/types/index.tsx +5 -0
- package/src/utils/index.tsx +7 -2
- package/themes/business/index.tsx +2 -0
- package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +36 -26
- package/themes/business/src/components/BusinessController/index.tsx +19 -17
- package/themes/business/src/components/BusinessProductList/AccordionDropdown.tsx +63 -0
- package/themes/business/src/components/BusinessProductList/IterateCategories.tsx +108 -0
- package/themes/business/src/components/BusinessProductList/ProductList.tsx +196 -0
- package/themes/business/src/components/BusinessProductList/index.tsx +196 -0
- package/themes/business/src/components/BusinessProductList/styles.tsx +10 -0
- package/themes/business/src/components/Chat/index.tsx +163 -123
- package/themes/business/src/components/DriverMap/index.tsx +17 -6
- package/themes/business/src/components/DriverSchedule/index.tsx +45 -8
- package/themes/business/src/components/FloatingButton/index.tsx +34 -31
- package/themes/business/src/components/GoogleMap/index.tsx +58 -57
- package/themes/business/src/components/LoginForm/index.tsx +5 -2
- package/themes/business/src/components/MapView/index.tsx +14 -10
- package/themes/business/src/components/MessagesOption/index.tsx +22 -94
- package/themes/business/src/components/NewOrderNotification/index.tsx +123 -96
- package/themes/business/src/components/NotFoundSource/index.tsx +2 -2
- package/themes/business/src/components/OrderDetails/Business.tsx +1 -1
- package/themes/business/src/components/OrderDetails/Delivery.tsx +205 -12
- package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +67 -39
- package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +47 -23
- package/themes/business/src/components/OrderDetailsLogistic/index.tsx +9 -4
- package/themes/business/src/components/OrderMessage/index.tsx +1 -1
- package/themes/business/src/components/OrderSummary/index.tsx +114 -123
- package/themes/business/src/components/OrdersListManager/index.tsx +7 -2
- package/themes/business/src/components/OrdersListManager/utils.tsx +1 -1
- package/themes/business/src/components/OrdersOption/index.tsx +43 -32
- package/themes/business/src/components/PreviousMessages/FooterMessageComponent.tsx +103 -0
- package/themes/business/src/components/PreviousMessages/index.tsx +97 -55
- package/themes/business/src/components/PreviousOrders/OrderItem.tsx +21 -29
- package/themes/business/src/components/PreviousOrders/OrderList.tsx +93 -0
- package/themes/business/src/components/PreviousOrders/OrdersGroupedItem.tsx +1 -1
- package/themes/business/src/components/PreviousOrders/index.tsx +193 -221
- package/themes/business/src/components/PreviousOrders/styles.tsx +10 -0
- package/themes/business/src/components/ReviewCustomer/index.tsx +3 -1
- package/themes/business/src/components/SearchBar/index.tsx +2 -1
- package/themes/business/src/components/StoresList/index.tsx +6 -5
- package/themes/business/src/components/UserProfileForm/index.tsx +14 -15
- package/themes/business/src/components/WebsocketStatus/index.tsx +171 -0
- package/themes/business/src/components/WebsocketStatus/styles.tsx +28 -0
- package/themes/business/src/components/shared/OModal.tsx +16 -9
- package/themes/business/src/types/index.tsx +8 -0
- package/themes/business/src/utils/index.tsx +4 -4
- package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
- package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
- package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
- package/themes/kiosk/src/components/Checkout/index.tsx +6 -0
- package/themes/kiosk/src/components/Intro/index.tsx +16 -1
- package/themes/kiosk/src/components/LoginForm/index.tsx +7 -5
- package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
- package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
- package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +8 -10
- package/themes/kiosk/src/components/PhoneInputNumber/index.tsx +2 -2
- package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
- package/themes/original/index.tsx +7 -3
- package/themes/original/src/components/AddressDetails/index.tsx +19 -3
- package/themes/original/src/components/AddressForm/index.tsx +33 -15
- package/themes/original/src/components/AddressForm/styles.tsx +1 -1
- package/themes/original/src/components/AddressList/index.tsx +5 -8
- package/themes/original/src/components/AddressList/styles.tsx +4 -4
- package/themes/original/src/components/AnalyticsSegment/index.tsx +193 -10
- package/themes/original/src/components/AppleLogin/index.tsx +4 -4
- package/themes/original/src/components/AppleLogin/styles.tsx +3 -1
- package/themes/original/src/components/BusinessBasicInformation/index.tsx +74 -38
- package/themes/original/src/components/BusinessBasicInformation/styles.tsx +11 -13
- package/themes/original/src/components/BusinessController/index.tsx +35 -44
- package/themes/original/src/components/BusinessController/styles.tsx +12 -5
- package/themes/original/src/components/BusinessFeaturedController/index.tsx +21 -54
- package/themes/original/src/components/BusinessFeaturedController/styles.tsx +8 -0
- package/themes/original/src/components/BusinessInformation/index.tsx +140 -85
- package/themes/original/src/components/BusinessInformation/styles.tsx +2 -2
- package/themes/original/src/components/BusinessItemAccordion/index.tsx +25 -26
- package/themes/original/src/components/BusinessListingSearch/BusinessSearchFooter.tsx +317 -0
- package/themes/original/src/components/BusinessListingSearch/BusinessSearchHeader.tsx +96 -0
- package/themes/original/src/components/BusinessListingSearch/MaxSectionItem/index.tsx +1 -1
- package/themes/original/src/components/BusinessListingSearch/index.tsx +133 -438
- package/themes/original/src/components/BusinessListingSearch/styles.tsx +1 -19
- package/themes/original/src/components/BusinessPreorder/index.tsx +105 -22
- package/themes/original/src/components/BusinessPreorder/styles.tsx +14 -0
- package/themes/original/src/components/BusinessProductsCategories/index.tsx +2 -3
- package/themes/original/src/components/BusinessProductsList/index.tsx +15 -7
- package/themes/original/src/components/BusinessProductsList/styles.tsx +8 -3
- package/themes/original/src/components/BusinessProductsListing/UpsellingRedirect.tsx +1 -1
- package/themes/original/src/components/BusinessProductsListing/index.tsx +162 -39
- package/themes/original/src/components/BusinessProductsListing/styles.tsx +4 -5
- package/themes/original/src/components/BusinessReviews/index.tsx +4 -2
- package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +1 -1
- package/themes/original/src/components/BusinessesListing/Layout/Appointment/styles.tsx +5 -5
- package/themes/original/src/components/BusinessesListing/Layout/Original/FlatListBusinessListFooter.tsx +69 -0
- package/themes/original/src/components/BusinessesListing/Layout/Original/FlatListBusinessListHeader.tsx +406 -0
- package/themes/original/src/components/BusinessesListing/Layout/Original/FlatListBusinessListing.tsx +76 -0
- package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +37 -404
- package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +1 -1
- package/themes/original/src/components/BusinessesListing/index.tsx +0 -1
- package/themes/original/src/components/Cart/index.tsx +49 -47
- package/themes/original/src/components/CartContent/index.tsx +99 -38
- package/themes/original/src/components/CartContent/styles.tsx +6 -6
- package/themes/original/src/components/CartStoresListing/styles.tsx +2 -2
- package/themes/original/src/components/Checkout/index.tsx +324 -43
- package/themes/original/src/components/Checkout/styles.tsx +17 -0
- package/themes/original/src/components/CitiesControl/index.tsx +1 -1
- package/themes/original/src/components/CitiesControl/styles.tsx +1 -1
- package/themes/original/src/components/CouponControl/index.tsx +10 -3
- package/themes/original/src/components/DatePicker/index.tsx +17 -0
- package/themes/original/src/components/DatePicker/styles.tsx +20 -0
- package/themes/original/src/components/DriverTips/index.tsx +6 -3
- package/themes/original/src/components/FacebookLogin/styles.tsx +3 -1
- package/themes/original/src/components/Favorite/index.tsx +4 -9
- package/themes/original/src/components/Favorite/styles.tsx +0 -2
- package/themes/original/src/components/FloatingButton/styles.tsx +1 -1
- package/themes/original/src/components/GPSButton/index.tsx +7 -5
- package/themes/original/src/components/GiftCard/GiftCardUI/index.tsx +8 -3
- package/themes/original/src/components/GiftCard/PurchaseGiftCard/index.tsx +42 -5
- package/themes/original/src/components/GiftCard/PurchaseGiftCard/styles.tsx +3 -1
- package/themes/original/src/components/GiftCard/RedeemGiftCard/index.tsx +84 -8
- package/themes/original/src/components/GiftCard/RedeemGiftCard/styles.tsx +1 -1
- package/themes/original/src/components/GiftCard/SendGiftCard/styles.tsx +1 -1
- package/themes/original/src/components/GoogleLogin/styles.tsx +1 -1
- package/themes/original/src/components/GoogleMap/index.tsx +63 -7
- package/themes/original/src/components/HighestRatedBusinesses/index.tsx +1 -1
- package/themes/original/src/components/HighestRatedBusinesses/styles.tsx +1 -1
- package/themes/original/src/components/Home/index.tsx +14 -5
- package/themes/original/src/components/LastOrder/index.tsx +2 -1
- package/themes/original/src/components/LastOrders/index.tsx +2 -1
- package/themes/original/src/components/LoginForm/Otp/index.tsx +91 -25
- package/themes/original/src/components/LoginForm/index.tsx +64 -34
- package/themes/original/src/components/LottieAnimation/index.tsx +88 -63
- package/themes/original/src/components/MessageListing/index.tsx +9 -2
- package/themes/original/src/components/Messages/index.tsx +15 -4
- package/themes/original/src/components/Messages/styles.tsx +1 -1
- package/themes/original/src/components/MomentOption/index.tsx +9 -10
- package/themes/original/src/components/MomentSelector/index.tsx +1 -1
- package/themes/original/src/components/MultiCart/index.tsx +1 -1
- package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +161 -49
- package/themes/original/src/components/MultiCheckout/index.tsx +348 -70
- package/themes/original/src/components/MultiCheckout/styles.tsx +3 -1
- package/themes/original/src/components/MultiOrdersDetails/index.tsx +2 -2
- package/themes/original/src/components/MyOrders/index.tsx +16 -5
- package/themes/original/src/components/NavBar/index.tsx +20 -13
- package/themes/original/src/components/NetworkError/index.tsx +2 -3
- package/themes/original/src/components/NetworkError/styles.tsx +2 -2
- package/themes/original/src/components/NotFoundSource/index.tsx +14 -10
- package/themes/original/src/components/Notifications/index.tsx +4 -8
- package/themes/original/src/components/Notifications/styles.tsx +0 -1
- package/themes/original/src/components/OrderDetails/OrderEta.tsx +76 -0
- package/themes/original/src/components/OrderDetails/OrderHistory.tsx +22 -6
- package/themes/original/src/components/OrderDetails/index.tsx +721 -670
- package/themes/original/src/components/OrderDetails/styles.tsx +24 -8
- package/themes/original/src/components/OrderItAgain/index.tsx +3 -1
- package/themes/original/src/components/OrderProgress/index.tsx +34 -25
- package/themes/original/src/components/OrderProgress/styles.tsx +1 -1
- package/themes/original/src/components/OrderSummary/index.tsx +62 -57
- package/themes/original/src/components/OrderTypeSelector/index.tsx +5 -6
- package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/styles.tsx +1 -1
- package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/index.tsx +13 -13
- package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/styles.tsx +1 -1
- package/themes/original/src/components/OrdersOption/index.tsx +44 -21
- package/themes/original/src/components/OrdersOption/styles.tsx +2 -2
- package/themes/original/src/components/PageBanner/index.tsx +65 -29
- package/themes/original/src/components/PageBanner/styles.tsx +0 -3
- package/themes/original/src/components/PaymentOptionCard/index.tsx +180 -0
- package/themes/original/src/components/PaymentOptionStripe/styles.tsx +3 -0
- package/themes/original/src/components/PaymentOptionWallet/index.tsx +56 -56
- package/themes/original/src/components/PaymentOptions/index.tsx +100 -34
- package/themes/original/src/components/PhoneInputNumber/index.tsx +18 -4
- package/themes/original/src/components/ProductForm/ActionButton.tsx +120 -0
- package/themes/original/src/components/ProductForm/ExtraOptions.tsx +56 -0
- package/themes/original/src/components/ProductForm/index.tsx +106 -170
- package/themes/original/src/components/ProductForm/styles.tsx +3 -3
- package/themes/original/src/components/ProductItemAccordion/index.tsx +13 -6
- package/themes/original/src/components/ProductOptionSubOption/index.tsx +49 -20
- package/themes/original/src/components/ProductOptionSubOption/styles.tsx +10 -9
- package/themes/original/src/components/ProfessionalProfile/styles.tsx +3 -3
- package/themes/original/src/components/Promotions/index.tsx +6 -6
- package/themes/original/src/components/Promotions/styles.tsx +3 -3
- package/themes/original/src/components/ReviewDriver/styles.tsx +1 -1
- package/themes/original/src/components/ReviewOrder/styles.tsx +1 -1
- package/themes/original/src/components/ReviewProducts/index.tsx +16 -7
- package/themes/original/src/components/ReviewProducts/styles.tsx +1 -1
- package/themes/original/src/components/ScheduleAccordion/index.tsx +3 -3
- package/themes/original/src/components/ServiceForm/index.tsx +2 -2
- package/themes/original/src/components/ServiceForm/styles.tsx +4 -4
- package/themes/original/src/components/SignupForm/index.tsx +27 -16
- package/themes/original/src/components/SingleOrderCard/index.tsx +44 -20
- package/themes/original/src/components/SingleOrderCard/styles.tsx +1 -1
- package/themes/original/src/components/SingleProductCard/index.tsx +13 -10
- package/themes/original/src/components/SingleProductCard/styles.tsx +8 -3
- package/themes/original/src/components/SingleProductReview/styles.tsx +1 -1
- package/themes/original/src/components/StripeCardsList/index.tsx +61 -5
- package/themes/original/src/components/StripeElementsForm/index.tsx +48 -34
- package/themes/original/src/components/StripeElementsForm/naked.tsx +12 -1
- package/themes/original/src/components/UpsellingProducts/UpsellingContent.tsx +170 -0
- package/themes/original/src/components/UpsellingProducts/UpsellingLayout.tsx +86 -0
- package/themes/original/src/components/UpsellingProducts/index.tsx +16 -205
- package/themes/original/src/components/UpsellingProducts/styles.tsx +19 -0
- package/themes/original/src/components/UserDetails/index.tsx +3 -1
- package/themes/original/src/components/UserFormDetails/index.tsx +100 -22
- package/themes/original/src/components/UserFormDetails/styles.tsx +1 -1
- package/themes/original/src/components/UserProfile/index.tsx +8 -26
- package/themes/original/src/components/UserProfileForm/index.tsx +30 -31
- package/themes/original/src/components/UserVerification/index.tsx +55 -50
- package/themes/original/src/components/WalletTransactionItem/index.tsx +2 -2
- package/themes/original/src/components/WalletTransactions/index.tsx +3 -3
- package/themes/original/src/components/WalletTransactions/styles.tsx +1 -0
- package/themes/original/src/components/Wallets/index.tsx +48 -60
- package/themes/original/src/components/Wallets/styles.tsx +3 -4
- package/themes/original/src/components/shared/HeaderTitle.tsx +1 -1
- package/themes/original/src/components/shared/OButton.tsx +3 -3
- package/themes/original/src/components/shared/OInput.tsx +4 -5
- package/themes/original/src/components/shared/OModal.tsx +15 -17
- package/themes/original/src/layouts/Container.tsx +5 -3
- package/themes/original/src/types/index.tsx +28 -6
- package/themes/original/src/utils/index.tsx +180 -13
- package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
- package/src/navigators/BottomNavigator.tsx +0 -117
- package/src/navigators/CheckoutNavigator.tsx +0 -66
- package/src/navigators/HomeNavigator.tsx +0 -202
- package/src/navigators/NavigationRef.tsx +0 -7
- package/src/navigators/RootNavigator.tsx +0 -269
- package/src/pages/Account.tsx +0 -34
- package/src/pages/AddressForm.tsx +0 -62
- package/src/pages/AddressList.tsx +0 -24
- package/src/pages/BusinessProductsList.tsx +0 -81
- package/src/pages/BusinessesListing.tsx +0 -43
- package/src/pages/CartList.tsx +0 -49
- package/src/pages/Checkout.tsx +0 -101
- package/src/pages/ForgotPassword.tsx +0 -24
- package/src/pages/Help.tsx +0 -23
- package/src/pages/HelpAccountAndPayment.tsx +0 -23
- package/src/pages/HelpGuide.tsx +0 -23
- package/src/pages/HelpOrder.tsx +0 -23
- package/src/pages/Home.tsx +0 -36
- package/src/pages/IntroductoryTutorial.tsx +0 -170
- package/src/pages/Login.tsx +0 -47
- package/src/pages/MomentOption.tsx +0 -30
- package/src/pages/MultiCheckout.tsx +0 -31
- package/src/pages/MultiOrdersDetails.tsx +0 -27
- package/src/pages/MyOrders.tsx +0 -40
- package/src/pages/NetworkError.tsx +0 -24
- package/src/pages/NotFound.tsx +0 -22
- package/src/pages/OrderDetails.tsx +0 -25
- package/src/pages/ProductDetails.tsx +0 -55
- package/src/pages/Profile.tsx +0 -36
- package/src/pages/ReviewDriver.tsx +0 -30
- package/src/pages/ReviewOrder.tsx +0 -32
- package/src/pages/ReviewProducts.tsx +0 -30
- package/src/pages/Sessions.tsx +0 -22
- package/src/pages/Signup.tsx +0 -53
- package/src/pages/SpinnerLoader.tsx +0 -10
- package/src/pages/Splash.tsx +0 -21
|
@@ -1,16 +1,18 @@
|
|
|
1
|
-
import React, { useState } from 'react';
|
|
1
|
+
import React, { useState, useEffect } from 'react';
|
|
2
2
|
import {
|
|
3
3
|
SingleOrderCard as SingleOrderCardController,
|
|
4
4
|
useUtils,
|
|
5
5
|
useOrder,
|
|
6
6
|
useLanguage
|
|
7
7
|
} from 'ordering-components/native';
|
|
8
|
+
import FastImage from 'react-native-fast-image'
|
|
8
9
|
import { StyleSheet, TouchableOpacity, View } from 'react-native';
|
|
9
10
|
import { useTheme } from 'styled-components/native';
|
|
10
11
|
import { OIcon, OText, OButton } from '../shared';
|
|
11
12
|
import { SingleOrderCardParams } from '../../types';
|
|
12
13
|
import { OAlert } from '../../../../../src/components/shared'
|
|
13
|
-
|
|
14
|
+
import { OrderEta } from '../OrderDetails/OrderEta'
|
|
15
|
+
import { useIsFocused } from '@react-navigation/native';
|
|
14
16
|
import {
|
|
15
17
|
InnerContainer,
|
|
16
18
|
Logo,
|
|
@@ -44,12 +46,14 @@ const SingleOrderCardUI = (props: SingleOrderCardParams) => {
|
|
|
44
46
|
const [, t] = useLanguage();
|
|
45
47
|
const [{ carts }] = useOrder()
|
|
46
48
|
const theme = useTheme();
|
|
49
|
+
const isFocused = useIsFocused();
|
|
47
50
|
|
|
48
|
-
|
|
51
|
+
let [reorderSelected, setReorderSelected] = useState<number | null>(null);
|
|
49
52
|
const [confirm, setConfirm] = useState<any>({ open: false, content: null, handleOnAccept: null, id: null, title: null })
|
|
50
53
|
const [isPressed, setIsPressed] = useState(false)
|
|
51
54
|
|
|
52
|
-
const allowedOrderStatus = [1, 2, 5, 6, 10, 11, 12];
|
|
55
|
+
const allowedOrderStatus = [1, 2, 5, 6, 10, 11, 12, 15];
|
|
56
|
+
const isGiftCardOrder = !order?.business_id
|
|
53
57
|
|
|
54
58
|
const styles = StyleSheet.create({
|
|
55
59
|
container: {
|
|
@@ -128,19 +132,29 @@ const SingleOrderCardUI = (props: SingleOrderCardParams) => {
|
|
|
128
132
|
});
|
|
129
133
|
|
|
130
134
|
const handleReorderClick = (order: any) => {
|
|
131
|
-
|
|
135
|
+
setReorderSelected(null)
|
|
136
|
+
reorderSelected = null
|
|
137
|
+
const isMultiOrders = Array.isArray(order?.id)
|
|
138
|
+
|
|
139
|
+
const isRemoveCart = isMultiOrders
|
|
140
|
+
? order?.business_id?.some((businessId: any) => !!carts[`businessId:${businessId}`]?.uuid)
|
|
141
|
+
: carts[`businessId:${order?.business_id}`] && !!carts[`businessId:${order?.business_id}`]?.uuid
|
|
142
|
+
|
|
143
|
+
if (isRemoveCart) {
|
|
132
144
|
setConfirm({
|
|
133
145
|
open: true,
|
|
134
146
|
content: [t('QUESTION_DELETE_PRODUCTS_FROM_CART', 'Are you sure that you want to delete all products from cart?')],
|
|
135
147
|
title: t('ORDER', 'Order'),
|
|
136
148
|
handleOnAccept: async () => {
|
|
137
|
-
handleRemoveCart()
|
|
149
|
+
handleRemoveCart(order)
|
|
138
150
|
setConfirm({ ...confirm, open: false })
|
|
139
151
|
}
|
|
140
152
|
})
|
|
141
153
|
} else {
|
|
142
|
-
|
|
143
|
-
|
|
154
|
+
const orderId = Array.isArray(order?.id) ? order?.id[0] : order?.id
|
|
155
|
+
setReorderSelected(orderId)
|
|
156
|
+
reorderSelected = orderId
|
|
157
|
+
handleReorder && handleReorder(order?.id)
|
|
144
158
|
}
|
|
145
159
|
};
|
|
146
160
|
|
|
@@ -198,6 +212,10 @@ const SingleOrderCardUI = (props: SingleOrderCardParams) => {
|
|
|
198
212
|
const hideFavorite = theme?.orders?.components?.favorite?.hidden
|
|
199
213
|
const hideOrderStatus = theme?.orders?.components?.order_status?.hidden
|
|
200
214
|
|
|
215
|
+
useEffect(() => {
|
|
216
|
+
if (isFocused) setReorderSelected(null)
|
|
217
|
+
}, [isFocused])
|
|
218
|
+
|
|
201
219
|
return (
|
|
202
220
|
<>
|
|
203
221
|
<CardAnimation
|
|
@@ -215,10 +233,13 @@ const SingleOrderCardUI = (props: SingleOrderCardParams) => {
|
|
|
215
233
|
key={business?.id}
|
|
216
234
|
style={styles.logoWrapper}
|
|
217
235
|
>
|
|
218
|
-
<
|
|
219
|
-
url={optimizeImage(business?.logo, 'h_300,c_limit')}
|
|
220
|
-
src={optimizeImage(!business?.logo && theme?.images?.dummies?.businessLogo, 'h_300,c_limit')}
|
|
236
|
+
<FastImage
|
|
221
237
|
style={styles.minilogo}
|
|
238
|
+
source={business?.logo ? {
|
|
239
|
+
uri: optimizeImage(business?.logo, 'h_300,c_limit'),
|
|
240
|
+
priority: FastImage.priority.normal,
|
|
241
|
+
} : theme?.images?.dummies?.businessLogo}
|
|
242
|
+
resizeMode={FastImage.resizeMode.contain}
|
|
222
243
|
/>
|
|
223
244
|
</Logo>
|
|
224
245
|
))}
|
|
@@ -228,10 +249,13 @@ const SingleOrderCardUI = (props: SingleOrderCardParams) => {
|
|
|
228
249
|
</MultiLogosContainer>
|
|
229
250
|
) : (
|
|
230
251
|
<Logo style={styles.logoWrapper}>
|
|
231
|
-
<
|
|
232
|
-
url={optimizeImage(order.business?.logo, 'h_300,c_limit')}
|
|
233
|
-
src={optimizeImage(!order.business?.logo && theme?.images?.dummies?.businessLogo, 'h_300,c_limit')}
|
|
252
|
+
<FastImage
|
|
234
253
|
style={styles.logo}
|
|
254
|
+
source={order.business?.logo ? {
|
|
255
|
+
uri: optimizeImage(order.business?.logo, 'h_300,c_limit'),
|
|
256
|
+
priority: FastImage.priority.normal,
|
|
257
|
+
} : theme?.images?.dummies?.businessLogo}
|
|
258
|
+
resizeMode={FastImage.resizeMode.contain}
|
|
235
259
|
/>
|
|
236
260
|
</Logo>
|
|
237
261
|
)}
|
|
@@ -267,11 +291,11 @@ const SingleOrderCardUI = (props: SingleOrderCardParams) => {
|
|
|
267
291
|
)}
|
|
268
292
|
</>
|
|
269
293
|
)}
|
|
270
|
-
{!!pastOrders && (
|
|
294
|
+
{!!pastOrders && !isGiftCardOrder && (
|
|
271
295
|
<ButtonWrapper>
|
|
272
296
|
{!hideReviewOrderButton &&
|
|
273
297
|
allowedOrderStatus.includes(parseInt(order?.status)) &&
|
|
274
|
-
!order.review && (
|
|
298
|
+
!order.review && order?.cart && (
|
|
275
299
|
<TouchableOpacity
|
|
276
300
|
onPress={() => handleClickOrderReview(order)}
|
|
277
301
|
style={styles.reviewButton}>
|
|
@@ -280,7 +304,7 @@ const SingleOrderCardUI = (props: SingleOrderCardParams) => {
|
|
|
280
304
|
</OText>
|
|
281
305
|
</TouchableOpacity>
|
|
282
306
|
)}
|
|
283
|
-
{order
|
|
307
|
+
{!hideReorderButton && typeof order?.id === 'number' && order?.cart && (
|
|
284
308
|
<OButton
|
|
285
309
|
text={t('REORDER', 'Reorder')}
|
|
286
310
|
imgRightSrc={''}
|
|
@@ -333,7 +357,7 @@ const SingleOrderCardUI = (props: SingleOrderCardParams) => {
|
|
|
333
357
|
{
|
|
334
358
|
pastOrders
|
|
335
359
|
? order?.delivery_datetime_utc ? parseDate(order?.delivery_datetime_utc) : parseDate(order?.delivery_datetime, { utc: false })
|
|
336
|
-
: order
|
|
360
|
+
: <OrderEta order={order} />
|
|
337
361
|
}
|
|
338
362
|
</OText>
|
|
339
363
|
)}
|
|
@@ -352,8 +376,8 @@ const SingleOrderCardUI = (props: SingleOrderCardParams) => {
|
|
|
352
376
|
<LottieAnimation
|
|
353
377
|
type='favorite'
|
|
354
378
|
onClick={handleChangeFavorite}
|
|
355
|
-
initialValue={order?.favorite ? 0.
|
|
356
|
-
toValue={order?.favorite ? 0 : 0.
|
|
379
|
+
initialValue={order?.favorite ? 0.5 : 0}
|
|
380
|
+
toValue={order?.favorite ? 0 : 0.5}
|
|
357
381
|
style={{ marginBottom: 5 }}
|
|
358
382
|
iconProps={{ color: theme.colors.danger5, size: 16, style: { top: 7 } }}
|
|
359
383
|
isActive={order?.favorite}
|
|
@@ -17,7 +17,7 @@ import { InView } from 'react-native-intersection-observer'
|
|
|
17
17
|
import { Fade, Placeholder, PlaceholderLine } from 'rn-placeholder';
|
|
18
18
|
import { OButton, OIcon, OText } from '../shared';
|
|
19
19
|
import FastImage from 'react-native-fast-image'
|
|
20
|
-
import { shape } from '../../utils';
|
|
20
|
+
import { lightenDarkenColor, shape } from '../../utils';
|
|
21
21
|
import { LottieAnimation } from '../LottieAnimation';
|
|
22
22
|
import { CardAnimation } from '../shared/CardAnimation'
|
|
23
23
|
|
|
@@ -40,7 +40,8 @@ const SingleProductCardUI = React.memo((props: SingleProductCardParams) => {
|
|
|
40
40
|
navigation,
|
|
41
41
|
businessId,
|
|
42
42
|
isPreviously,
|
|
43
|
-
viewString
|
|
43
|
+
viewString,
|
|
44
|
+
businessSingleId
|
|
44
45
|
} = props;
|
|
45
46
|
|
|
46
47
|
const theme = useTheme();
|
|
@@ -108,7 +109,7 @@ const SingleProductCardUI = React.memo((props: SingleProductCardParams) => {
|
|
|
108
109
|
},
|
|
109
110
|
productTagsStyle: {
|
|
110
111
|
width: 30,
|
|
111
|
-
|
|
112
|
+
height: 30,
|
|
112
113
|
marginRight: 5
|
|
113
114
|
}
|
|
114
115
|
});
|
|
@@ -168,7 +169,7 @@ const SingleProductCardUI = React.memo((props: SingleProductCardParams) => {
|
|
|
168
169
|
}
|
|
169
170
|
|
|
170
171
|
return (
|
|
171
|
-
<InView style={{ minHeight: hideAddButton ? 125 : 190 }} triggerOnce={true} onChange={(inView: boolean) => handleChangeIntersection()}>
|
|
172
|
+
<InView style={{ minHeight: hideAddButton ? 125 : 190, marginLeft: logoPosition === 'left' ? 12.5 : 0 }} triggerOnce={true} onChange={(inView: boolean) => handleChangeIntersection()}>
|
|
172
173
|
{isIntersectionObserver ? (
|
|
173
174
|
<CardAnimation
|
|
174
175
|
onClick={() => handleClickproduct()}
|
|
@@ -180,8 +181,8 @@ const SingleProductCardUI = React.memo((props: SingleProductCardParams) => {
|
|
|
180
181
|
>
|
|
181
182
|
<View style={{ flexDirection: logoPosition === 'left' ? 'row-reverse' : 'row' }}>
|
|
182
183
|
{productAddedToCartLength > 0 && (
|
|
183
|
-
<QuantityContainer style={[styles.quantityContainer, {
|
|
184
|
-
transform: [{ translateX: 25 }, { translateY: -25 }],
|
|
184
|
+
<QuantityContainer businessSingleId={businessSingleId} style={[styles.quantityContainer, {
|
|
185
|
+
transform: [{ translateX: logoPosition === 'right' ? 25 : -25 }, { translateY: -25 }],
|
|
185
186
|
}]}>
|
|
186
187
|
<OText size={12} color={theme.colors.white}>{productAddedToCartLength.toString()}</OText>
|
|
187
188
|
</QuantityContainer>
|
|
@@ -200,8 +201,8 @@ const SingleProductCardUI = React.memo((props: SingleProductCardParams) => {
|
|
|
200
201
|
<LottieAnimation
|
|
201
202
|
type='favorite'
|
|
202
203
|
onClick={handleChangeFavorite}
|
|
203
|
-
initialValue={product?.favorite ? 0.
|
|
204
|
-
toValue={product?.favorite ? 0 : 0.
|
|
204
|
+
initialValue={product?.favorite ? 0.5 : 0}
|
|
205
|
+
toValue={product?.favorite ? 0 : 0.5}
|
|
205
206
|
disableAnimation={!auth}
|
|
206
207
|
iconProps={{ color: theme.colors.danger5, size: 18 }}
|
|
207
208
|
isActive={product?.favorite}
|
|
@@ -221,7 +222,7 @@ const SingleProductCardUI = React.memo((props: SingleProductCardParams) => {
|
|
|
221
222
|
showsHorizontalScrollIndicator={false}
|
|
222
223
|
horizontal
|
|
223
224
|
style={{ marginLeft: 10 }}
|
|
224
|
-
contentContainerStyle={{flexGrow: 1}}
|
|
225
|
+
contentContainerStyle={{ flexGrow: 1 }}
|
|
225
226
|
>
|
|
226
227
|
{product?.tags.map((tag: any, i: any) => (
|
|
227
228
|
<TouchableWithoutFeedback key={i}>
|
|
@@ -265,13 +266,15 @@ const SingleProductCardUI = React.memo((props: SingleProductCardParams) => {
|
|
|
265
266
|
{!!product?.ribbon?.enabled && (
|
|
266
267
|
<RibbonBox
|
|
267
268
|
bgColor={product?.ribbon?.color}
|
|
269
|
+
colorText={lightenDarkenColor(product?.ribbon?.color)}
|
|
270
|
+
borderRibbon={lightenDarkenColor(product?.ribbon?.color)}
|
|
268
271
|
isRoundRect={product?.ribbon?.shape === shape?.rectangleRound}
|
|
269
272
|
isCapsule={product?.ribbon?.shape === shape?.capsuleShape}
|
|
270
273
|
>
|
|
271
274
|
<OText
|
|
272
275
|
size={textSize}
|
|
273
276
|
weight={'400'}
|
|
274
|
-
color={theme.colors.white}
|
|
277
|
+
color={lightenDarkenColor(product?.ribbon?.color) ? theme.colors.black : theme.colors.white}
|
|
275
278
|
numberOfLines={2}
|
|
276
279
|
ellipsizeMode='tail'
|
|
277
280
|
lineHeight={13}
|
|
@@ -49,16 +49,21 @@ export const RibbonBox = styled.View`
|
|
|
49
49
|
background-color: ${(props: any) => props.theme.colors.primary};
|
|
50
50
|
padding: 1px 8px;
|
|
51
51
|
max-width: 60px;
|
|
52
|
-
|
|
53
52
|
${(props: any) => props.bgColor && css`
|
|
54
53
|
background-color: ${props.bgColor};
|
|
55
54
|
`}
|
|
56
|
-
|
|
57
55
|
${(props: any) => props.isRoundRect && css`
|
|
58
56
|
border-radius: 7.6px;
|
|
59
57
|
`}
|
|
60
|
-
|
|
61
58
|
${(props: any) => props.isCapsule && css`
|
|
62
59
|
border-radius: 50px;
|
|
63
60
|
`}
|
|
61
|
+
|
|
62
|
+
${(props: any) => props.colorText && css`
|
|
63
|
+
color: ${props.colorText ? 'black' : 'white'};
|
|
64
|
+
`}
|
|
65
|
+
|
|
66
|
+
${(props: any) => props.borderRibbon && css`
|
|
67
|
+
border: 1px solid ${props.borderRibbon ? 'black' : 'white'};
|
|
68
|
+
`}
|
|
64
69
|
`
|
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { View, StyleSheet, ScrollView } from 'react-native';
|
|
1
|
+
import React, { useEffect } from 'react';
|
|
2
|
+
import { View, StyleSheet, ScrollView, Platform } from 'react-native';
|
|
3
3
|
import {
|
|
4
4
|
PaymentOptionStripe,
|
|
5
5
|
useSession,
|
|
6
6
|
useLanguage,
|
|
7
|
+
useValidationFields
|
|
7
8
|
} from 'ordering-components/native';
|
|
8
9
|
import { PlaceholderLine } from 'rn-placeholder';
|
|
9
10
|
import { useTheme } from 'styled-components/native';
|
|
10
11
|
import { getIconCard } from '../../utils';
|
|
11
|
-
import { OAlert, OIcon, OText } from '../shared';
|
|
12
|
+
import { OAlert, OIcon, OText, OModal } from '../shared';
|
|
12
13
|
|
|
13
14
|
import { NotFoundSource } from '../NotFoundSource';
|
|
14
15
|
|
|
@@ -17,26 +18,46 @@ import {
|
|
|
17
18
|
OSItemContent,
|
|
18
19
|
OSItemActions,
|
|
19
20
|
} from '../PaymentOptionStripe/styles';
|
|
21
|
+
import { StripeElementsForm } from '../StripeElementsForm';
|
|
20
22
|
|
|
21
|
-
|
|
23
|
+
import { KeyboardAvoidingView } from 'react-native';
|
|
24
|
+
|
|
25
|
+
export const StripeCardsListUI = (props: any) => {
|
|
22
26
|
const {
|
|
23
27
|
onSelectCard,
|
|
24
28
|
deleteCard,
|
|
25
29
|
cardSelected,
|
|
26
30
|
cardsList,
|
|
27
31
|
handleCardClick,
|
|
32
|
+
setAddCardOpen,
|
|
33
|
+
gateway,
|
|
34
|
+
setCardsList,
|
|
35
|
+
addCardOpen,
|
|
36
|
+
isOpenMethod,
|
|
37
|
+
handlePaymethodDataChange
|
|
28
38
|
} = props;
|
|
29
39
|
|
|
30
40
|
const theme = useTheme();
|
|
31
41
|
|
|
32
42
|
const [{ token }] = useSession();
|
|
33
43
|
const [, t] = useLanguage();
|
|
44
|
+
const [validationFields] = useValidationFields()
|
|
45
|
+
const validateZipcodeCard =
|
|
46
|
+
validationFields?.fields?.card?.zipcode?.enabled && validationFields?.fields?.card?.zipcode?.required
|
|
47
|
+
const paymethodsWithoutSaveCards = ['credomatic']
|
|
34
48
|
|
|
35
49
|
const handleCardSelected = (card: any) => {
|
|
50
|
+
if (!card?.zipcode && validateZipcodeCard) return
|
|
36
51
|
handleCardClick(card);
|
|
37
52
|
onSelectCard(card);
|
|
38
53
|
}
|
|
39
54
|
|
|
55
|
+
useEffect(() => {
|
|
56
|
+
if (!cardsList?.loading && cardsList?.cards?.length === 0 && !paymethodsWithoutSaveCards.includes(gateway)) {
|
|
57
|
+
setAddCardOpen({ ...addCardOpen, stripe: true })
|
|
58
|
+
}
|
|
59
|
+
}, [cardsList?.loading])
|
|
60
|
+
|
|
40
61
|
return (
|
|
41
62
|
<>
|
|
42
63
|
{token && !cardsList.loading && cardsList.cards && cardsList.cards.length === 0 && (
|
|
@@ -75,7 +96,8 @@ const StripeCardsListUI = (props: any) => {
|
|
|
75
96
|
style={styles.cardsList}
|
|
76
97
|
>
|
|
77
98
|
{cardsList.cards.map((card: any) => (
|
|
78
|
-
<OSItem key={card.id} isUnique={cardsList.cards.length}>
|
|
99
|
+
<OSItem key={card.id} isUnique={cardsList.cards.length} isInvalid={!card?.zipcode && validateZipcodeCard}>
|
|
100
|
+
{console.log(card?.zipcode && validateZipcodeCard)}
|
|
79
101
|
<OSItemContent onPress={() => handleCardSelected(card)}>
|
|
80
102
|
<View style={styles.viewStyle}>
|
|
81
103
|
{card.id === cardSelected?.id ? (
|
|
@@ -100,6 +122,13 @@ const StripeCardsListUI = (props: any) => {
|
|
|
100
122
|
XXXX-XXXX-XXXX-{card.last4}
|
|
101
123
|
</OText>
|
|
102
124
|
</View>
|
|
125
|
+
{!card?.zipcode && validateZipcodeCard && (
|
|
126
|
+
<View style={styles.viewStyle}>
|
|
127
|
+
<OText size={10} color={theme?.colors?.danger5}>
|
|
128
|
+
({t('MISSING_ZIPCODE', 'Missing zipcode')})
|
|
129
|
+
</OText>
|
|
130
|
+
</View>
|
|
131
|
+
)}
|
|
103
132
|
</OSItemContent>
|
|
104
133
|
<OSItemActions>
|
|
105
134
|
<OAlert
|
|
@@ -118,6 +147,33 @@ const StripeCardsListUI = (props: any) => {
|
|
|
118
147
|
))}
|
|
119
148
|
</ScrollView>
|
|
120
149
|
)}
|
|
150
|
+
<OModal
|
|
151
|
+
entireModal
|
|
152
|
+
title={t('ADD_CREDIT_OR_DEBIT_CARD', 'Add credit or debit card')}
|
|
153
|
+
open={addCardOpen.stripe}
|
|
154
|
+
onClose={() => setAddCardOpen({ ...addCardOpen, stripe: false })}
|
|
155
|
+
style={{ backgroundColor: 'red' }}
|
|
156
|
+
>
|
|
157
|
+
<KeyboardAvoidingView
|
|
158
|
+
behavior={Platform.OS == 'ios' ? 'padding' : 'height'}
|
|
159
|
+
keyboardVerticalOffset={Platform.OS == 'ios' ? 0 : 0}
|
|
160
|
+
enabled={Platform.OS === 'ios' ? true : false}
|
|
161
|
+
>
|
|
162
|
+
<StripeElementsForm
|
|
163
|
+
openCarts={props.openCarts}
|
|
164
|
+
toSave
|
|
165
|
+
businessId={props.businessId}
|
|
166
|
+
businessIds={props.businessIds}
|
|
167
|
+
publicKey={props.publicKey || isOpenMethod?.paymethod?.credentials?.publishable}
|
|
168
|
+
setCardsList={setCardsList}
|
|
169
|
+
cardsList={cardsList}
|
|
170
|
+
requirements={props.clientSecret}
|
|
171
|
+
handleCardClick={handleCardClick}
|
|
172
|
+
onSelectCard={handlePaymethodDataChange}
|
|
173
|
+
onCancel={() => setAddCardOpen({ ...addCardOpen, stripe: false })}
|
|
174
|
+
/>
|
|
175
|
+
</KeyboardAvoidingView>
|
|
176
|
+
</OModal>
|
|
121
177
|
</>
|
|
122
178
|
)
|
|
123
179
|
}
|
|
@@ -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
|