ordering-ui-react-native 0.17.73 → 0.17.74-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 +28 -25
- package/themes/business/src/components/BusinessController/index.tsx +0 -1
- package/themes/business/src/components/Chat/index.tsx +149 -118
- 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/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 +10 -10
- package/themes/business/src/components/MessagesOption/index.tsx +20 -93
- package/themes/business/src/components/NewOrderNotification/index.tsx +37 -21
- 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 +191 -6
- package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +103 -39
- package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +61 -60
- package/themes/business/src/components/OrderDetailsLogistic/index.tsx +195 -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 +17 -15
- 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 +88 -0
- package/themes/business/src/components/PreviousOrders/OrdersGroupedItem.tsx +1 -1
- package/themes/business/src/components/PreviousOrders/index.tsx +139 -174
- package/themes/business/src/components/ProductItemAccordion/index.tsx +27 -3
- 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/OLink.tsx +11 -3
- package/themes/business/src/components/shared/OModal.tsx +16 -9
- package/themes/business/src/components/shared/OText.tsx +6 -1
- 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 +61 -39
- package/themes/original/src/components/AddressList/index.tsx +25 -24
- package/themes/original/src/components/AddressList/styles.tsx +4 -2
- 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 +153 -96
- package/themes/original/src/components/BusinessBasicInformation/styles.tsx +10 -12
- package/themes/original/src/components/BusinessController/index.tsx +80 -66
- 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 +139 -85
- package/themes/original/src/components/BusinessItemAccordion/index.tsx +15 -20
- package/themes/original/src/components/BusinessListingSearch/index.tsx +349 -339
- 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 +684 -557
- package/themes/original/src/components/BusinessProductsListing/styles.tsx +2 -2
- package/themes/original/src/components/BusinessReviews/index.tsx +3 -1
- package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +69 -38
- package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +0 -1
- package/themes/original/src/components/BusinessesListing/index.tsx +0 -1
- package/themes/original/src/components/Cart/index.tsx +76 -79
- package/themes/original/src/components/CartContent/index.tsx +117 -20
- package/themes/original/src/components/CartContent/styles.tsx +17 -7
- package/themes/original/src/components/Checkout/index.tsx +274 -54
- 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 +2 -6
- package/themes/original/src/components/FavoriteList/index.tsx +1 -35
- package/themes/original/src/components/FloatingButton/index.tsx +10 -13
- package/themes/original/src/components/GPSButton/index.tsx +6 -4
- package/themes/original/src/components/GiftCard/PurchaseGiftCard/index.tsx +7 -3
- package/themes/original/src/components/GiftCard/PurchaseGiftCard/styles.tsx +2 -0
- package/themes/original/src/components/GiftCard/RedeemGiftCard/index.tsx +19 -6
- package/themes/original/src/components/GoogleLogin/styles.tsx +1 -1
- package/themes/original/src/components/GoogleMap/index.tsx +60 -5
- package/themes/original/src/components/Help/index.tsx +2 -2
- package/themes/original/src/components/HelpAccountAndPayment/index.tsx +10 -31
- package/themes/original/src/components/HelpAccountAndPayment/styles.tsx +5 -3
- package/themes/original/src/components/HelpGuide/index.tsx +6 -6
- package/themes/original/src/components/HelpGuide/styles.tsx +6 -0
- package/themes/original/src/components/HelpOrder/index.tsx +6 -15
- package/themes/original/src/components/HelpOrder/styles.tsx +8 -1
- package/themes/original/src/components/Home/index.tsx +13 -4
- package/themes/original/src/components/LastOrder/index.tsx +1 -34
- 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 +16 -42
- package/themes/original/src/components/Messages/index.tsx +14 -7
- package/themes/original/src/components/MomentOption/index.tsx +193 -90
- package/themes/original/src/components/MomentSelector/index.tsx +1 -1
- package/themes/original/src/components/MultiCart/index.tsx +41 -54
- package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +162 -50
- package/themes/original/src/components/MultiCheckout/index.tsx +329 -100
- package/themes/original/src/components/MultiCheckout/styles.tsx +3 -1
- package/themes/original/src/components/MultiOrdersDetails/SingleOrderCard.tsx +37 -224
- package/themes/original/src/components/MultiOrdersDetails/index.tsx +54 -21
- package/themes/original/src/components/MultiOrdersDetails/styles.tsx +1 -1
- package/themes/original/src/components/MyOrders/index.tsx +40 -29
- package/themes/original/src/components/NavBar/index.tsx +20 -17
- package/themes/original/src/components/NotFoundSource/index.tsx +14 -10
- package/themes/original/src/components/Notifications/index.tsx +42 -52
- package/themes/original/src/components/Notifications/styles.tsx +6 -3
- 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 +28 -233
- 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 +30 -56
- package/themes/original/src/components/OrderSummary/index.tsx +83 -57
- package/themes/original/src/components/OrderTypeSelector/index.tsx +2 -1
- package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/index.tsx +14 -14
- package/themes/original/src/components/OrdersOption/index.tsx +67 -85
- package/themes/original/src/components/OrdersOption/styles.tsx +1 -1
- package/themes/original/src/components/PageBanner/index.tsx +98 -38
- package/themes/original/src/components/PageBanner/styles.tsx +0 -10
- package/themes/original/src/components/PaymentOptionCard/index.tsx +180 -0
- package/themes/original/src/components/PaymentOptionStripe/styles.tsx +1 -1
- package/themes/original/src/components/PaymentOptionWallet/index.tsx +56 -56
- package/themes/original/src/components/PaymentOptions/index.tsx +77 -34
- package/themes/original/src/components/PhoneInputNumber/index.tsx +18 -4
- package/themes/original/src/components/ProductForm/index.tsx +104 -29
- package/themes/original/src/components/ProductForm/styles.tsx +5 -5
- package/themes/original/src/components/ProductItemAccordion/index.tsx +8 -6
- package/themes/original/src/components/ProductOptionSubOption/index.tsx +20 -18
- package/themes/original/src/components/ProductOptionSubOption/styles.tsx +5 -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/index.tsx +11 -8
- package/themes/original/src/components/Sessions/styles.tsx +5 -0
- package/themes/original/src/components/SignupForm/index.tsx +43 -27
- package/themes/original/src/components/SingleOrderCard/index.tsx +102 -63
- package/themes/original/src/components/SingleOrderCard/styles.tsx +1 -1
- package/themes/original/src/components/SingleProductCard/index.tsx +72 -31
- package/themes/original/src/components/SingleProductCard/styles.tsx +20 -4
- package/themes/original/src/components/SingleProductReview/styles.tsx +1 -1
- package/themes/original/src/components/StripeCardsList/index.tsx +49 -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 +238 -224
- package/themes/original/src/components/UpsellingProducts/styles.tsx +12 -1
- package/themes/original/src/components/UserDetails/index.tsx +3 -1
- package/themes/original/src/components/UserFormDetails/index.tsx +76 -7
- package/themes/original/src/components/UserFormDetails/styles.tsx +1 -1
- package/themes/original/src/components/UserProfile/index.tsx +88 -79
- package/themes/original/src/components/UserProfileForm/index.tsx +17 -21
- package/themes/original/src/components/UserProfileForm/styles.tsx +7 -0
- 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 +56 -33
- package/themes/original/src/components/Wallets/styles.tsx +3 -4
- package/themes/original/src/components/shared/OButton.tsx +6 -2
- package/themes/original/src/components/shared/OInput.tsx +6 -1
- package/themes/original/src/components/shared/OModal.tsx +3 -3
- package/themes/original/src/types/index.tsx +38 -10
- package/themes/original/src/utils/index.tsx +273 -1
- 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
|
@@ -3,7 +3,6 @@ import { OrderList, useLanguage, useOrder, ToastType, useToast } from 'ordering-
|
|
|
3
3
|
import { useTheme } from 'styled-components/native';
|
|
4
4
|
import { useFocusEffect } from '@react-navigation/native'
|
|
5
5
|
import { OText, OButton } from '../shared'
|
|
6
|
-
import { NotFoundSource } from '../NotFoundSource'
|
|
7
6
|
import { ActiveOrders } from '../ActiveOrders'
|
|
8
7
|
import { PreviousOrders } from '../PreviousOrders'
|
|
9
8
|
import { PreviousBusinessOrdered } from './PreviousBusinessOrdered'
|
|
@@ -11,6 +10,7 @@ import { PreviousProductsOrdered } from './PreviousProductsOrdered'
|
|
|
11
10
|
import { OptionTitle, NoOrdersWrapper } from './styles'
|
|
12
11
|
import { OrdersOptionParams } from '../../types'
|
|
13
12
|
import { _setStoreData } from '../../providers/StoreUtil';
|
|
13
|
+
import { NotFoundSource } from '../NotFoundSource';
|
|
14
14
|
import {
|
|
15
15
|
Placeholder,
|
|
16
16
|
PlaceholderLine,
|
|
@@ -18,6 +18,7 @@ import {
|
|
|
18
18
|
} from "rn-placeholder";
|
|
19
19
|
|
|
20
20
|
import { View, ScrollView } from 'react-native'
|
|
21
|
+
import { getOrderStatus, flatArray } from '../../utils'
|
|
21
22
|
|
|
22
23
|
const OrdersOptionUI = (props: OrdersOptionParams) => {
|
|
23
24
|
const {
|
|
@@ -50,7 +51,8 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
|
|
|
50
51
|
businesses,
|
|
51
52
|
businessPaginationProps,
|
|
52
53
|
handleUpdateProducts,
|
|
53
|
-
handleUpdateBusinesses
|
|
54
|
+
handleUpdateBusinesses,
|
|
55
|
+
businessId
|
|
54
56
|
} = props
|
|
55
57
|
|
|
56
58
|
const theme = useTheme();
|
|
@@ -69,67 +71,37 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
|
|
|
69
71
|
const _orders = customArray || values || []
|
|
70
72
|
const uniqueOrders: any = []
|
|
71
73
|
|
|
72
|
-
|
|
73
74
|
useEffect(() => {
|
|
74
75
|
if (loading || error) return
|
|
75
|
-
const
|
|
76
|
+
const ordersReduced = _orders.map((order: any) => order?.cart_group_id
|
|
76
77
|
? _orders
|
|
77
|
-
.filter((_order
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
const isDuplicate = uniqueOrders.includes(order?.cart_group_id)
|
|
89
|
-
if (!isDuplicate) {
|
|
90
|
-
uniqueOrders.push(order?.cart_group_id)
|
|
91
|
-
return true
|
|
78
|
+
.filter((_order: any) => _order?.cart_group_id === order?.cart_group_id)
|
|
79
|
+
.map((_o: any, _: any, _ordersList: any) => {
|
|
80
|
+
const obj = {
|
|
81
|
+
..._o,
|
|
82
|
+
id: _ordersList.map(o => o.id),
|
|
83
|
+
review: _o.review,
|
|
84
|
+
user_review: _o.user_review,
|
|
85
|
+
total: _ordersList.reduce((acc: any, o: any) => acc + o.summary.total, 0),
|
|
86
|
+
business: _ordersList.map((o: any) => o.business),
|
|
87
|
+
business_id: _ordersList.map((o: any) => o.business_id),
|
|
88
|
+
products: _ordersList.map((o: any) => o.products)
|
|
92
89
|
}
|
|
93
|
-
return
|
|
94
|
-
})
|
|
90
|
+
return obj
|
|
91
|
+
}).find((o: any) => o)
|
|
95
92
|
: order)
|
|
93
|
+
const orders = ordersReduced?.filter((order: any) => {
|
|
94
|
+
if (!order?.cart_group_id) return true
|
|
95
|
+
const isDuplicate = uniqueOrders.includes(order?.cart_group_id)
|
|
96
|
+
if (!isDuplicate) {
|
|
97
|
+
uniqueOrders.push(order?.cart_group_id)
|
|
98
|
+
return true
|
|
99
|
+
}
|
|
100
|
+
return false
|
|
101
|
+
})
|
|
96
102
|
setOrders(orders)
|
|
97
103
|
}, [JSON.stringify(_orders)])
|
|
98
104
|
|
|
99
|
-
const getOrderStatus = (s: string) => {
|
|
100
|
-
const status = parseInt(s)
|
|
101
|
-
const orderStatus = [
|
|
102
|
-
{ key: 0, value: t('PENDING', 'Pending') },
|
|
103
|
-
{ key: 1, value: t('COMPLETED', 'Completed') },
|
|
104
|
-
{ key: 2, value: t('REJECTED', 'Rejected') },
|
|
105
|
-
{ key: 3, value: t('DRIVER_IN_BUSINESS', 'Driver in business') },
|
|
106
|
-
{ key: 4, value: t('PREPARATION_COMPLETED', 'Preparation Completed') },
|
|
107
|
-
{ key: 5, value: t('REJECTED_BY_BUSINESS', 'Rejected by business') },
|
|
108
|
-
{ key: 6, value: t('REJECTED_BY_DRIVER', 'Rejected by Driver') },
|
|
109
|
-
{ key: 7, value: t('ACCEPTED_BY_BUSINESS', 'Accepted by business') },
|
|
110
|
-
{ key: 8, value: t('ACCEPTED_BY_DRIVER', 'Accepted by driver') },
|
|
111
|
-
{ key: 9, value: t('PICK_UP_COMPLETED_BY_DRIVER', 'Pick up completed by driver') },
|
|
112
|
-
{ key: 10, value: t('PICK_UP_FAILED_BY_DRIVER', 'Pick up Failed by driver') },
|
|
113
|
-
{ key: 11, value: t('DELIVERY_COMPLETED_BY_DRIVER', 'Delivery completed by driver') },
|
|
114
|
-
{ key: 12, value: t('DELIVERY_FAILED_BY_DRIVER', 'Delivery Failed by driver') },
|
|
115
|
-
{ key: 13, value: t('PREORDER', 'PreOrder') },
|
|
116
|
-
{ key: 14, value: t('ORDER_NOT_READY', 'Order not ready') },
|
|
117
|
-
{ key: 15, value: t('ORDER_PICKEDUP_COMPLETED_BY_CUSTOMER', 'Order picked up completed by customer') },
|
|
118
|
-
{ key: 16, value: t('CANCELLED_BY_CUSTOMER', 'Cancelled by customer') },
|
|
119
|
-
{ key: 17, value: t('ORDER_NOT_PICKEDUP_BY_CUSTOMER', 'Order not picked up by customer') },
|
|
120
|
-
{ key: 18, value: t('DRIVER_ALMOST_ARRIVED_TO_BUSINESS', 'Driver almost arrived to business') },
|
|
121
|
-
{ key: 19, value: t('DRIVER_ALMOST_ARRIVED_TO_CUSTOMER', 'Driver almost arrived to customer') },
|
|
122
|
-
{ key: 20, value: t('ORDER_CUSTOMER_ALMOST_ARRIVED_BUSINESS', 'Customer almost arrived to business') },
|
|
123
|
-
{ key: 21, value: t('ORDER_CUSTOMER_ARRIVED_BUSINESS', 'Customer arrived to business') },
|
|
124
|
-
{ key: 22, value: t('ORDER_LOOKING_FOR_DRIVER', 'Looking for driver') },
|
|
125
|
-
{ key: 23, value: t('ORDER_DRIVER_ON_WAY', 'Driver on way') }
|
|
126
|
-
]
|
|
127
|
-
|
|
128
|
-
const objectStatus = orderStatus.find((o) => o.key === status)
|
|
129
|
-
|
|
130
|
-
return objectStatus && objectStatus
|
|
131
|
-
}
|
|
132
|
-
|
|
133
105
|
const onProductClick = (product: any) => {
|
|
134
106
|
if (product?.product_id && product?.category_id && product?.businessId &&
|
|
135
107
|
product?.business.slug && product?.business.header && product?.business.logo) {
|
|
@@ -150,6 +122,7 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
|
|
|
150
122
|
}
|
|
151
123
|
|
|
152
124
|
useEffect(() => {
|
|
125
|
+
if (reorderState?.loading) return
|
|
153
126
|
const _businessId = 'businessId:' + reorderState?.result?.business_id
|
|
154
127
|
if (reorderState?.error) {
|
|
155
128
|
if (reorderState?.result?.business_id) {
|
|
@@ -157,21 +130,39 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
|
|
|
157
130
|
navigation.navigate('Business', { store: reorderState?.result?.business?.slug })
|
|
158
131
|
}
|
|
159
132
|
}
|
|
160
|
-
if (!reorderState?.error && reorderState.loading
|
|
133
|
+
if (!reorderState?.error && !reorderState.loading && reorderState?.result?.business_id) {
|
|
161
134
|
const cartProducts = carts?.[_businessId]?.products
|
|
162
|
-
const available = cartProducts.every((product: any) => product.valid === true)
|
|
163
|
-
const orderProducts = orders.find((order: any) => order?.id === reorderState?.result?.orderId)?.products
|
|
164
135
|
|
|
165
|
-
|
|
166
|
-
|
|
136
|
+
const available = cartProducts.every((product: any) => product.valid)
|
|
137
|
+
const orderProducts = orders.find(
|
|
138
|
+
(order: any) => Array.isArray(order?.id)
|
|
139
|
+
? order?.id?.includes(reorderState?.result?.orderId)
|
|
140
|
+
: order?.id === reorderState?.result?.orderId
|
|
141
|
+
)?.products
|
|
142
|
+
|
|
143
|
+
const productsFlatten = orderProducts?.length && flatArray(orderProducts)?.filter(product => product?.order_id === reorderState?.result?.orderId)
|
|
144
|
+
|
|
145
|
+
if (available && reorderState?.result?.uuid && (cartProducts?.length === productsFlatten?.length)) {
|
|
146
|
+
const multiOrders = flatArray(orderProducts)?.map(product => product.order_id)
|
|
147
|
+
const params = multiOrders?.length > 1
|
|
148
|
+
? { screen: 'MultiCheckout', checkCarts: true }
|
|
149
|
+
: { cartUuid: reorderState?.result.uuid }
|
|
150
|
+
|
|
151
|
+
onNavigationRedirect && onNavigationRedirect('CheckoutNavigator', params)
|
|
167
152
|
} else {
|
|
168
153
|
_setStoreData('adjust-cart-products', JSON.stringify(_businessId))
|
|
169
|
-
cartProducts?.length !==
|
|
154
|
+
cartProducts?.length !== productsFlatten?.length && _setStoreData('already-removed', JSON.stringify('removed'))
|
|
170
155
|
navigation.navigate('Business', { store: reorderState?.result?.business?.slug })
|
|
171
156
|
}
|
|
172
157
|
}
|
|
173
158
|
}, [reorderState])
|
|
174
159
|
|
|
160
|
+
useEffect(() => {
|
|
161
|
+
if (reorderState?.error) {
|
|
162
|
+
showToast(ToastType.Error, reorderState?.result)
|
|
163
|
+
}
|
|
164
|
+
}, [reorderState])
|
|
165
|
+
|
|
175
166
|
useFocusEffect(
|
|
176
167
|
React.useCallback(() => {
|
|
177
168
|
if (!businessesSearchList) {
|
|
@@ -190,14 +181,16 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
|
|
|
190
181
|
useEffect(() => {
|
|
191
182
|
if (loading) return
|
|
192
183
|
|
|
193
|
-
const updateOrders =
|
|
184
|
+
const updateOrders = _orders.filter((order: any) => orderStatus.includes(order.status))
|
|
194
185
|
|
|
195
186
|
if (activeOrders) {
|
|
196
187
|
setOrdersLength && setOrdersLength({ ...ordersLength, activeOrdersLength: updateOrders?.length })
|
|
197
188
|
} else if (!preOrders) {
|
|
198
189
|
setOrdersLength && setOrdersLength({ ...ordersLength, previousOrdersLength: updateOrders?.length })
|
|
190
|
+
} else {
|
|
191
|
+
setOrdersLength && setOrdersLength({ ...ordersLength, preordersLength: updateOrders?.length })
|
|
199
192
|
}
|
|
200
|
-
}, [
|
|
193
|
+
}, [_orders, activeOrders, preOrders])
|
|
201
194
|
|
|
202
195
|
useEffect(() => {
|
|
203
196
|
if (refreshOrders) {
|
|
@@ -208,21 +201,21 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
|
|
|
208
201
|
|
|
209
202
|
return (
|
|
210
203
|
<>
|
|
211
|
-
{!loading && ordersLength.activeOrdersLength === 0 && ordersLength.previousOrdersLength === 0 && !activeOrders && (
|
|
204
|
+
{!loading && ordersLength.activeOrdersLength === 0 && ordersLength.previousOrdersLength === 0 && ordersLength?.preordersLength === 0 && !activeOrders && !preOrders && (
|
|
212
205
|
<NoOrdersWrapper>
|
|
213
|
-
<
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
textStyle={{ color: 'white', fontSize: 14 }}
|
|
220
|
-
style={{ borderRadius: 7.6, marginBottom: 10, marginTop: 10, height: 44, paddingLeft: 10, paddingRight: 10 }}
|
|
206
|
+
<NotFoundSource
|
|
207
|
+
hideImage
|
|
208
|
+
btnStyle={{ borderRadius: 8 }}
|
|
209
|
+
content={t('YOU_DONT_HAVE_ORDERS', 'You don\'t have any orders')}
|
|
210
|
+
btnTitle={t('ORDER_NOW', 'Order now')}
|
|
211
|
+
onClickButton={() => onNavigationRedirect && (businessId ? onNavigationRedirect('Business') : onNavigationRedirect('BusinessList'))}
|
|
221
212
|
/>
|
|
222
|
-
|
|
223
213
|
</NoOrdersWrapper>
|
|
224
214
|
)}
|
|
225
|
-
{(ordersLength?.activeOrdersLength > 0
|
|
215
|
+
{((ordersLength?.activeOrdersLength > 0 && activeOrders) ||
|
|
216
|
+
(ordersLength?.previousOrdersLength > 0 && !activeOrders && !preOrders) ||
|
|
217
|
+
(ordersLength?.preordersLength > 0 && preOrders)
|
|
218
|
+
) && (
|
|
226
219
|
<>
|
|
227
220
|
{((titleContent && ((isBusiness && businessOrderIds?.length > 0) || isProducts)) || !titleContent) && (
|
|
228
221
|
<OptionTitle titleContent={!!titleContent} isBusinessesSearchList={!!businessesSearchList}>
|
|
@@ -235,17 +228,6 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
|
|
|
235
228
|
</OText>
|
|
236
229
|
</OptionTitle>
|
|
237
230
|
)}
|
|
238
|
-
|
|
239
|
-
{!(ordersLength?.activeOrdersLength === 0 && ordersLength?.previousOrdersLength === 0) &&
|
|
240
|
-
!loading &&
|
|
241
|
-
orders.filter((order: any) => orderStatus.includes(order.status)).length === 0 &&
|
|
242
|
-
(
|
|
243
|
-
<NotFoundSource
|
|
244
|
-
content={t('NO_RESULTS_FOUND', 'Sorry, no results found')}
|
|
245
|
-
image={imageFails}
|
|
246
|
-
conditioned
|
|
247
|
-
/>
|
|
248
|
-
)}
|
|
249
231
|
</>
|
|
250
232
|
)}
|
|
251
233
|
{isBusiness && !!businessesSearchList && businesses?.loading && (
|
|
@@ -1,22 +1,25 @@
|
|
|
1
|
-
import React, { useRef } from 'react'
|
|
2
|
-
import { useUtils, PageBanner as PageBannerController } from 'ordering-components/native'
|
|
3
|
-
|
|
1
|
+
import React, { useEffect, useState, useRef } from 'react'
|
|
2
|
+
import { useUtils, useEvent, PageBanner as PageBannerController } from 'ordering-components/native'
|
|
4
3
|
import { View, StyleSheet, Dimensions, TouchableOpacity } from 'react-native'
|
|
5
4
|
import { Fade, Placeholder, PlaceholderLine } from 'rn-placeholder';
|
|
6
5
|
import Carousel from 'react-native-snap-carousel'
|
|
7
6
|
import FastImage from 'react-native-fast-image';
|
|
8
7
|
import IconAntDesign from 'react-native-vector-icons/AntDesign';
|
|
9
8
|
import { useTheme } from 'styled-components/native';
|
|
10
|
-
import { PageBannerWrapper
|
|
9
|
+
import { PageBannerWrapper } from './styles'
|
|
11
10
|
|
|
12
11
|
const PageBannerUI = (props: any) => {
|
|
13
12
|
const {
|
|
14
|
-
pageBannerState
|
|
13
|
+
pageBannerState,
|
|
14
|
+
navigation
|
|
15
15
|
} = props
|
|
16
16
|
|
|
17
17
|
const theme = useTheme();
|
|
18
18
|
const [{ optimizeImage }] = useUtils();
|
|
19
|
-
const
|
|
19
|
+
const [events] = useEvent()
|
|
20
|
+
const carouselRef = useRef<any>(null)
|
|
21
|
+
const [currentIndex, setCurrentIndex] = useState(0)
|
|
22
|
+
const [viewedBanner, setViewedBanner] = useState<any>(null)
|
|
20
23
|
|
|
21
24
|
const windowWidth = Dimensions.get('window').width;
|
|
22
25
|
|
|
@@ -25,7 +28,8 @@ const PageBannerUI = (props: any) => {
|
|
|
25
28
|
height: 300,
|
|
26
29
|
},
|
|
27
30
|
swiperButton: {
|
|
28
|
-
|
|
31
|
+
position: 'absolute',
|
|
32
|
+
zIndex: 100,
|
|
29
33
|
alignItems: 'center',
|
|
30
34
|
justifyContent: 'center',
|
|
31
35
|
width: 32,
|
|
@@ -39,18 +43,71 @@ const PageBannerUI = (props: any) => {
|
|
|
39
43
|
}
|
|
40
44
|
})
|
|
41
45
|
|
|
46
|
+
const onRedirect = (route: string, params?: any) => {
|
|
47
|
+
navigation.push(route, params)
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
const handleGoToPage = (item: any) => {
|
|
51
|
+
const action = item.action
|
|
52
|
+
if (!action?.url) return
|
|
53
|
+
let slug
|
|
54
|
+
if (action.type === 'business') {
|
|
55
|
+
slug = action.url.split('store/')[1]
|
|
56
|
+
onRedirect('Business', {
|
|
57
|
+
store: slug
|
|
58
|
+
})
|
|
59
|
+
}
|
|
60
|
+
if (action.type === 'product') {
|
|
61
|
+
slug = action.url.split('store/')[1]?.split('?')[0]
|
|
62
|
+
onRedirect('ProductDetails', {
|
|
63
|
+
businessSlug: slug,
|
|
64
|
+
businessId: action.business_id,
|
|
65
|
+
categoryId: action.category_id,
|
|
66
|
+
productId: action.product_id,
|
|
67
|
+
isRedirect: 'business',
|
|
68
|
+
business: {
|
|
69
|
+
store: slug
|
|
70
|
+
}
|
|
71
|
+
})
|
|
72
|
+
}
|
|
73
|
+
const clickedBanner = pageBannerState.result.find(banner => banner.id === item?.banner_id)
|
|
74
|
+
events.emit('promotion_clicked', clickedBanner)
|
|
75
|
+
}
|
|
76
|
+
|
|
42
77
|
const renderItem = ({ item, index }) => {
|
|
43
78
|
return (
|
|
44
|
-
<
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
79
|
+
<TouchableOpacity
|
|
80
|
+
onPress={() => handleGoToPage(item)}
|
|
81
|
+
>
|
|
82
|
+
<View style={styles.sliderWrapper}>
|
|
83
|
+
<FastImage
|
|
84
|
+
style={{ height: '100%', width: '100%' }}
|
|
85
|
+
resizeMode='cover'
|
|
86
|
+
source={{ uri: optimizeImage(item.url, 'h_300,c_limit') }}
|
|
87
|
+
/>
|
|
88
|
+
</View>
|
|
89
|
+
</TouchableOpacity>
|
|
51
90
|
)
|
|
52
91
|
}
|
|
53
92
|
|
|
93
|
+
const updateIndex = () => {
|
|
94
|
+
setCurrentIndex(carouselRef?.current?.currentIndex)
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
useEffect(() => {
|
|
98
|
+
if (pageBannerState.loading) return
|
|
99
|
+
if (pageBannerState.banner?.items && pageBannerState.banner?.items.length > 0) {
|
|
100
|
+
const bannerId = pageBannerState.banner.items[currentIndex]?.banner_id
|
|
101
|
+
if (pageBannerState.result && bannerId) {
|
|
102
|
+
const _viewedBanner = pageBannerState.result.find(banner => banner.id === bannerId)
|
|
103
|
+
if (_viewedBanner?.id !== viewedBanner?.id) {
|
|
104
|
+
setViewedBanner(_viewedBanner)
|
|
105
|
+
events.emit('promotion_viewed', _viewedBanner)
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}, [pageBannerState.loading, currentIndex, viewedBanner])
|
|
110
|
+
|
|
54
111
|
return (
|
|
55
112
|
<>
|
|
56
113
|
{pageBannerState.loading ? (
|
|
@@ -68,39 +125,42 @@ const PageBannerUI = (props: any) => {
|
|
|
68
125
|
<>
|
|
69
126
|
{pageBannerState.banner?.items && pageBannerState.banner?.items.length > 0 && (
|
|
70
127
|
<PageBannerWrapper>
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
128
|
+
{pageBannerState.banner?.items.length > 1 && (
|
|
129
|
+
<>
|
|
130
|
+
<TouchableOpacity
|
|
131
|
+
style={[styles.swiperButton, { left: 25 }]}
|
|
132
|
+
onPress={() => carouselRef.current.snapToPrev()}
|
|
133
|
+
>
|
|
134
|
+
<IconAntDesign
|
|
135
|
+
name="caretleft"
|
|
136
|
+
color={theme.colors.white}
|
|
137
|
+
size={13}
|
|
138
|
+
/>
|
|
139
|
+
</TouchableOpacity>
|
|
140
|
+
<TouchableOpacity
|
|
141
|
+
style={[styles.swiperButton, { right: 25 }]}
|
|
142
|
+
onPress={() => carouselRef.current.snapToNext()}
|
|
143
|
+
>
|
|
144
|
+
<IconAntDesign
|
|
145
|
+
name="caretright"
|
|
146
|
+
color={theme.colors.white}
|
|
147
|
+
size={13}
|
|
148
|
+
/>
|
|
149
|
+
</TouchableOpacity>
|
|
150
|
+
</>
|
|
151
|
+
)}
|
|
93
152
|
<Carousel
|
|
94
153
|
ref={carouselRef}
|
|
95
154
|
loop={pageBannerState.banner?.items.length > 1}
|
|
96
155
|
data={pageBannerState.banner?.items}
|
|
97
156
|
renderItem={renderItem}
|
|
98
|
-
sliderWidth={windowWidth
|
|
99
|
-
itemWidth={windowWidth
|
|
157
|
+
sliderWidth={windowWidth}
|
|
158
|
+
itemWidth={windowWidth}
|
|
100
159
|
inactiveSlideScale={1}
|
|
101
160
|
pagingEnabled
|
|
102
161
|
removeClippedSubviews={false}
|
|
103
162
|
inactiveSlideOpacity={1}
|
|
163
|
+
onSnapToItem={updateIndex}
|
|
104
164
|
/>
|
|
105
165
|
</PageBannerWrapper>
|
|
106
166
|
)}
|
|
@@ -1,18 +1,8 @@
|
|
|
1
1
|
import styled from 'styled-components/native'
|
|
2
2
|
|
|
3
3
|
export const PageBannerWrapper = styled.View`
|
|
4
|
-
margin-horizontal: 40px;
|
|
5
|
-
border-radius: 8px;
|
|
6
4
|
overflow: hidden;
|
|
7
|
-
margin-vertical: 30px;
|
|
8
5
|
position: relative;
|
|
9
6
|
flex-direction: row;
|
|
10
7
|
align-items: center;
|
|
11
8
|
`
|
|
12
|
-
export const ArrowButtonsContainer = styled.View`
|
|
13
|
-
position: absolute;
|
|
14
|
-
z-index: 100;
|
|
15
|
-
flex-direction: row;
|
|
16
|
-
justify-content: space-between;
|
|
17
|
-
width: 100%;
|
|
18
|
-
`
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
import React, { useEffect, useRef, useState } from 'react'
|
|
2
|
+
import { View, Modal, TouchableOpacity, StyleSheet, SafeAreaView, KeyboardAvoidingView, Platform, ScrollView } from 'react-native'
|
|
3
|
+
import { OButton, OIcon, OInput, OModal, OText } from '../shared'
|
|
4
|
+
import { PaymentOptionStripe, useLanguage, useSession } from 'ordering-components/native'
|
|
5
|
+
import { StripeCardsListUI } from '../StripeCardsList'
|
|
6
|
+
import { useTheme } from 'styled-components/native';
|
|
7
|
+
import { CreditCardInput } from "react-native-credit-card-input-plus";
|
|
8
|
+
import Alert from '../../providers/AlertProvider'
|
|
9
|
+
|
|
10
|
+
const PaymentOptionCardUI = (props: any) => {
|
|
11
|
+
const {
|
|
12
|
+
cardSelected,
|
|
13
|
+
deleteCard,
|
|
14
|
+
onSelectCard,
|
|
15
|
+
handleCardClick,
|
|
16
|
+
cardsList,
|
|
17
|
+
addCardOpen,
|
|
18
|
+
setAddCardOpen,
|
|
19
|
+
gateway,
|
|
20
|
+
handleNewCard,
|
|
21
|
+
paymethodsWithoutSaveCards
|
|
22
|
+
} = props
|
|
23
|
+
const [, t] = useLanguage()
|
|
24
|
+
const theme = useTheme()
|
|
25
|
+
const [{ token }] = useSession()
|
|
26
|
+
const [alertState, setAlertState] = useState<{ open: boolean, content: Array<string> }>({ open: false, content: [] })
|
|
27
|
+
const [newCard, setNewCard] = useState<any>(null)
|
|
28
|
+
|
|
29
|
+
const onChangeCardForm = (values : any) => {
|
|
30
|
+
if (values?.valid) {
|
|
31
|
+
const expiry = values?.values?.expiry?.split('/')
|
|
32
|
+
const expiryMonth = expiry[0]
|
|
33
|
+
const expiryYear = expiry[1]
|
|
34
|
+
const expiryString = expiryMonth + expiryYear
|
|
35
|
+
let lastFourDigits = values?.values?.number?.substr(-4);
|
|
36
|
+
setNewCard({
|
|
37
|
+
name: values?.values.name,
|
|
38
|
+
number: values?.values.number.replace(/\s/g, ''),
|
|
39
|
+
cvc: values?.values.cvc,
|
|
40
|
+
expiryMonth: expiryMonth,
|
|
41
|
+
expiryYear: expiryYear,
|
|
42
|
+
expiry: expiry,
|
|
43
|
+
brand: values?.values?.type,
|
|
44
|
+
last4: lastFourDigits,
|
|
45
|
+
expiryString: expiryString
|
|
46
|
+
})
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
const handleAddNewCard = () => {
|
|
51
|
+
handleNewCard(newCard)
|
|
52
|
+
setAddCardOpen({ ...addCardOpen, card: false })
|
|
53
|
+
setNewCard(null)
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
useEffect(() => {
|
|
57
|
+
if (cardsList.error && !cardsList.loading) {
|
|
58
|
+
setAlertState({
|
|
59
|
+
open: true,
|
|
60
|
+
content: cardsList.error
|
|
61
|
+
})
|
|
62
|
+
}
|
|
63
|
+
}, [JSON.stringify(cardsList)])
|
|
64
|
+
|
|
65
|
+
const style = StyleSheet.create({
|
|
66
|
+
wrapperIcon: {
|
|
67
|
+
marginLeft: 25,
|
|
68
|
+
marginTop: Platform.OS === 'ios' ? 40 : 12,
|
|
69
|
+
marginBottom: 20,
|
|
70
|
+
alignItems: 'center',
|
|
71
|
+
justifyContent: 'center',
|
|
72
|
+
},
|
|
73
|
+
buttonStyle: {
|
|
74
|
+
marginVertical: 20,
|
|
75
|
+
borderRadius: 7.6,
|
|
76
|
+
shadowOpacity: 0,
|
|
77
|
+
height: 44,
|
|
78
|
+
borderWidth: 1
|
|
79
|
+
}
|
|
80
|
+
})
|
|
81
|
+
|
|
82
|
+
return (
|
|
83
|
+
<View>
|
|
84
|
+
<>
|
|
85
|
+
{token && (!cardSelected || !paymethodsWithoutSaveCards.includes(gateway)) && (
|
|
86
|
+
<OButton
|
|
87
|
+
text={t('ADD_PAYMENT_CARD', 'Add New Payment Card')}
|
|
88
|
+
bgColor={theme.colors.white}
|
|
89
|
+
borderColor={theme.colors.primary}
|
|
90
|
+
style={{
|
|
91
|
+
marginVertical: 20,
|
|
92
|
+
borderRadius: 7.6,
|
|
93
|
+
shadowOpacity: 0,
|
|
94
|
+
height: 44,
|
|
95
|
+
borderWidth: 1
|
|
96
|
+
}}
|
|
97
|
+
textStyle={{ color: theme.colors.primary, fontSize: 12 }}
|
|
98
|
+
imgRightSrc={null}
|
|
99
|
+
onClick={() => setAddCardOpen({ ...addCardOpen, card: true })}
|
|
100
|
+
/>
|
|
101
|
+
)}
|
|
102
|
+
<StripeCardsListUI
|
|
103
|
+
cardSelected={cardSelected}
|
|
104
|
+
deleteCard={deleteCard}
|
|
105
|
+
onSelectCard={onSelectCard}
|
|
106
|
+
handleCardClick={handleCardClick}
|
|
107
|
+
cardsList={cardsList}
|
|
108
|
+
noShowErrors
|
|
109
|
+
gateway={gateway}
|
|
110
|
+
/>
|
|
111
|
+
</>
|
|
112
|
+
<Modal
|
|
113
|
+
animationType="slide"
|
|
114
|
+
visible={addCardOpen?.card}
|
|
115
|
+
onDismiss={() => setAddCardOpen({ ...addCardOpen, card: false })}
|
|
116
|
+
>
|
|
117
|
+
<KeyboardAvoidingView
|
|
118
|
+
behavior={Platform.OS === 'ios' ? 'padding' : 'height'}
|
|
119
|
+
style={{
|
|
120
|
+
flex: 1,
|
|
121
|
+
}}
|
|
122
|
+
>
|
|
123
|
+
<ScrollView>
|
|
124
|
+
<TouchableOpacity onPress={() => setAddCardOpen({ ...addCardOpen, card: false })}>
|
|
125
|
+
<OIcon
|
|
126
|
+
src={theme.images.general.close}
|
|
127
|
+
width={16}
|
|
128
|
+
style={style.wrapperIcon}
|
|
129
|
+
/>
|
|
130
|
+
</TouchableOpacity>
|
|
131
|
+
<>
|
|
132
|
+
<CreditCardInput
|
|
133
|
+
onChange={onChangeCardForm}
|
|
134
|
+
requiresName
|
|
135
|
+
/>
|
|
136
|
+
{alertState?.content?.[0] && !cardsList?.loading && (
|
|
137
|
+
<OText
|
|
138
|
+
color={theme?.colors?.error}
|
|
139
|
+
style={{
|
|
140
|
+
alignSelf: 'center'
|
|
141
|
+
}}
|
|
142
|
+
size={20}
|
|
143
|
+
>
|
|
144
|
+
{alertState.content[0]}
|
|
145
|
+
</OText>
|
|
146
|
+
)}
|
|
147
|
+
<OButton
|
|
148
|
+
text={t('ADD_CARD', 'Add card')}
|
|
149
|
+
isDisabled={!newCard || cardsList?.loading}
|
|
150
|
+
isLoading={cardsList?.loading}
|
|
151
|
+
onClick={() => handleAddNewCard()}
|
|
152
|
+
style={{
|
|
153
|
+
margin: 20,
|
|
154
|
+
...style.buttonStyle
|
|
155
|
+
}}
|
|
156
|
+
/>
|
|
157
|
+
</>
|
|
158
|
+
</ScrollView>
|
|
159
|
+
</KeyboardAvoidingView>
|
|
160
|
+
</Modal>
|
|
161
|
+
<Alert
|
|
162
|
+
open={alertState?.open || false}
|
|
163
|
+
title=''
|
|
164
|
+
content={alertState.content}
|
|
165
|
+
onClose={() => setAlertState({ open: false, content: [] })}
|
|
166
|
+
onAccept={() => setAlertState({ open: false, content: [] })}
|
|
167
|
+
/>
|
|
168
|
+
</View>
|
|
169
|
+
)
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
export const PaymentOptionCard = (props : any) => {
|
|
173
|
+
const paymentOptions = {
|
|
174
|
+
...props,
|
|
175
|
+
UIComponent: PaymentOptionCardUI
|
|
176
|
+
}
|
|
177
|
+
return (
|
|
178
|
+
<PaymentOptionStripe {...paymentOptions} />
|
|
179
|
+
)
|
|
180
|
+
}
|