ordering-ui-react-native 0.18.55-test1 → 0.18.56-crash-driver-1
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 +6 -5
- package/src/components/BusinessInformation/index.tsx +10 -9
- package/src/components/PaymentOptionsWebView/index.tsx +30 -8
- package/src/components/PhoneInputNumber/index.tsx +6 -2
- package/src/components/StripeMethodForm/index.tsx +60 -55
- package/src/components/shared/OToast.tsx +3 -2
- package/src/types/index.tsx +3 -1
- package/src/utils/index.tsx +2 -2
- package/themes/business/index.tsx +6 -0
- package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +15 -8
- 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 +48 -19
- package/themes/business/src/components/DriverMap/index.tsx +36 -23
- 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 +15 -8
- package/themes/business/src/components/Home/index.tsx +5 -1
- package/themes/business/src/components/LanguageSelector/index.tsx +1 -2
- package/themes/business/src/components/LanguageSelector/lang_country.json +515 -70
- package/themes/business/src/components/LoginForm/index.tsx +2 -2
- package/themes/business/src/components/LogoutButton/index.tsx +1 -1
- package/themes/business/src/components/MapView/index.tsx +28 -17
- package/themes/business/src/components/MessagesOption/index.tsx +22 -94
- package/themes/business/src/components/NewOrderNotification/index.tsx +162 -106
- package/themes/business/src/components/NotFoundSource/index.tsx +2 -2
- package/themes/business/src/components/OrderDetails/Business.tsx +53 -3
- package/themes/business/src/components/OrderDetails/Delivery.tsx +209 -13
- package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +107 -75
- package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +79 -41
- package/themes/business/src/components/OrderDetails/usePrinterCommands.tsx +220 -0
- package/themes/business/src/components/OrderDetailsLogistic/index.tsx +7 -2
- package/themes/business/src/components/OrderMessage/index.tsx +1 -1
- package/themes/business/src/components/OrderSummary/index.tsx +245 -82
- 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 +125 -48
- package/themes/business/src/components/PhoneInputNumber/index.tsx +8 -5
- 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 +43 -41
- 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 +195 -221
- package/themes/business/src/components/PreviousOrders/styles.tsx +10 -0
- package/themes/business/src/components/PrinterEdition/index.tsx +363 -0
- package/themes/business/src/components/PrinterEdition/styles.tsx +61 -0
- package/themes/business/src/components/PrinterSettings/index.tsx +267 -0
- package/themes/business/src/components/PrinterSettings/styles.tsx +30 -0
- package/themes/business/src/components/ProductItemAccordion/index.tsx +2 -2
- package/themes/business/src/components/ReviewCustomer/index.tsx +1 -1
- package/themes/business/src/components/SearchBar/index.tsx +2 -1
- package/themes/business/src/components/Sessions/index.tsx +187 -0
- package/themes/business/src/components/Sessions/styles.tsx +20 -0
- package/themes/business/src/components/StoresList/index.tsx +4 -3
- package/themes/business/src/components/UserFormDetails/index.tsx +111 -107
- package/themes/business/src/components/UserProfileForm/index.tsx +103 -53
- 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/OInput.tsx +2 -0
- package/themes/business/src/hooks/useLocation.tsx +5 -4
- package/themes/business/src/types/index.tsx +21 -1
- package/themes/business/src/utils/index.tsx +5 -0
- package/themes/kiosk/src/components/Checkout/index.tsx +5 -3
- package/themes/kiosk/src/components/CustomerName/index.tsx +1 -1
- package/themes/kiosk/src/components/Intro/index.tsx +16 -1
- package/themes/kiosk/src/components/LoginForm/index.tsx +131 -101
- package/themes/kiosk/src/components/PaymentOptions/index.tsx +57 -121
- package/themes/original/index.tsx +11 -3
- package/themes/original/src/components/AddressDetails/index.tsx +20 -10
- package/themes/original/src/components/AddressForm/index.tsx +41 -20
- package/themes/original/src/components/AddressForm/styles.tsx +1 -1
- package/themes/original/src/components/AddressList/index.tsx +22 -11
- package/themes/original/src/components/AddressList/styles.tsx +4 -4
- package/themes/original/src/components/AnalyticsSegment/index.tsx +10 -7
- package/themes/original/src/components/AppleLogin/styles.tsx +3 -1
- package/themes/original/src/components/BusinessBasicInformation/index.tsx +8 -11
- package/themes/original/src/components/BusinessBasicInformation/styles.tsx +1 -1
- package/themes/original/src/components/BusinessController/index.tsx +40 -43
- package/themes/original/src/components/BusinessController/styles.tsx +12 -12
- package/themes/original/src/components/BusinessInformation/index.tsx +45 -17
- package/themes/original/src/components/BusinessInformation/styles.tsx +2 -2
- package/themes/original/src/components/BusinessItemAccordion/index.tsx +11 -7
- 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 +57 -361
- package/themes/original/src/components/BusinessListingSearch/styles.tsx +1 -1
- package/themes/original/src/components/BusinessPreorder/index.tsx +9 -7
- package/themes/original/src/components/BusinessProductsCategories/index.tsx +2 -3
- package/themes/original/src/components/BusinessProductsList/index.tsx +5 -4
- package/themes/original/src/components/BusinessProductsListing/index.tsx +67 -28
- package/themes/original/src/components/BusinessProductsListing/styles.tsx +3 -4
- package/themes/original/src/components/BusinessReviews/index.tsx +1 -1
- 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 +30 -404
- package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +2 -2
- package/themes/original/src/components/Cart/index.tsx +51 -40
- package/themes/original/src/components/CartContent/index.tsx +98 -54
- package/themes/original/src/components/CartStoresListing/styles.tsx +2 -2
- package/themes/original/src/components/Checkout/index.tsx +308 -75
- package/themes/original/src/components/Checkout/styles.tsx +17 -0
- package/themes/original/src/components/CitiesControl/styles.tsx +1 -1
- package/themes/original/src/components/DatePicker/index.tsx +33 -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 +8 -4
- 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/ForgotPasswordForm/index.tsx +5 -0
- package/themes/original/src/components/GPSButton/index.tsx +7 -5
- package/themes/original/src/components/GiftCard/GiftCardOrdersList/index.tsx +64 -0
- package/themes/original/src/components/GiftCard/GiftCardOrdersList/styles.tsx +8 -0
- package/themes/original/src/components/GiftCard/GiftCardUI/index.tsx +8 -3
- package/themes/original/src/components/GiftCard/PurchaseGiftCard/index.tsx +36 -3
- package/themes/original/src/components/GiftCard/PurchaseGiftCard/styles.tsx +1 -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/index.tsx +2 -2
- package/themes/original/src/components/GiftCard/SendGiftCard/styles.tsx +1 -1
- package/themes/original/src/components/GiftCard/SingleGiftCard/index.tsx +101 -0
- package/themes/original/src/components/GiftCard/SingleGiftCard/styles.tsx +4 -0
- package/themes/original/src/components/GiftCard/VerticalGiftCardOrdersLayout/index.tsx +83 -0
- package/themes/original/src/components/GiftCard/VerticalGiftCardOrdersLayout/styles.tsx +9 -0
- package/themes/original/src/components/GoogleLogin/styles.tsx +1 -1
- package/themes/original/src/components/GoogleMap/index.tsx +52 -5
- package/themes/original/src/components/Help/index.tsx +7 -0
- package/themes/original/src/components/HelpAccountAndPayment/index.tsx +5 -0
- package/themes/original/src/components/HelpGuide/index.tsx +5 -0
- package/themes/original/src/components/HelpOrder/index.tsx +5 -0
- 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 +3 -2
- 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 +79 -25
- package/themes/original/src/components/LoginForm/index.tsx +38 -14
- package/themes/original/src/components/MessageListing/index.tsx +6 -0
- package/themes/original/src/components/Messages/index.tsx +9 -3
- package/themes/original/src/components/Messages/styles.tsx +1 -1
- package/themes/original/src/components/MomentOption/index.tsx +20 -5
- 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 +48 -15
- package/themes/original/src/components/MultiCheckout/index.tsx +295 -56
- package/themes/original/src/components/MultiCheckout/styles.tsx +20 -1
- package/themes/original/src/components/MultiOrdersDetails/index.tsx +21 -16
- package/themes/original/src/components/MyOrders/index.tsx +37 -39
- package/themes/original/src/components/NavBar/index.tsx +15 -14
- 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/Notifications/index.tsx +9 -8
- package/themes/original/src/components/Notifications/styles.tsx +0 -1
- package/themes/original/src/components/OrderDetails/OrderEta.tsx +21 -6
- package/themes/original/src/components/OrderDetails/OrderHistory.tsx +14 -5
- package/themes/original/src/components/OrderDetails/index.tsx +718 -667
- package/themes/original/src/components/OrderDetails/styles.tsx +24 -7
- package/themes/original/src/components/OrderProgress/index.tsx +50 -14
- package/themes/original/src/components/OrderProgress/styles.tsx +1 -1
- package/themes/original/src/components/OrderSummary/index.tsx +26 -34
- package/themes/original/src/components/OrderTypeSelector/index.tsx +5 -0
- package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/styles.tsx +1 -1
- package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/styles.tsx +1 -1
- package/themes/original/src/components/OrdersOption/index.tsx +14 -6
- package/themes/original/src/components/OrdersOption/styles.tsx +1 -1
- package/themes/original/src/components/PageBanner/index.tsx +3 -0
- package/themes/original/src/components/PaymentOptionCard/index.tsx +182 -0
- package/themes/original/src/components/PaymentOptionStripe/styles.tsx +3 -0
- package/themes/original/src/components/PaymentOptions/index.tsx +118 -37
- package/themes/original/src/components/PhoneInputNumber/index.tsx +15 -1
- package/themes/original/src/components/PreviousOrders/index.tsx +2 -0
- package/themes/original/src/components/ProductForm/ActionButton.tsx +122 -0
- package/themes/original/src/components/ProductForm/ExtraOptions.tsx +56 -0
- package/themes/original/src/components/ProductForm/index.tsx +193 -267
- package/themes/original/src/components/ProductForm/styles.tsx +1 -1
- package/themes/original/src/components/ProductItemAccordion/index.tsx +55 -42
- package/themes/original/src/components/ProductItemAccordion/styles.tsx +3 -4
- package/themes/original/src/components/ProductOptionSubOption/index.tsx +120 -79
- 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 +13 -11
- package/themes/original/src/components/Promotions/styles.tsx +0 -2
- package/themes/original/src/components/ReviewDriver/index.tsx +5 -0
- package/themes/original/src/components/ReviewDriver/styles.tsx +1 -1
- package/themes/original/src/components/ReviewOrder/index.tsx +5 -0
- package/themes/original/src/components/ReviewOrder/styles.tsx +1 -1
- package/themes/original/src/components/ReviewProducts/index.tsx +5 -0
- 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/Sessions/index.tsx +5 -0
- package/themes/original/src/components/SignupForm/index.tsx +76 -60
- package/themes/original/src/components/SingleOrderCard/index.tsx +6 -5
- package/themes/original/src/components/SingleProductCard/index.tsx +5 -4
- package/themes/original/src/components/SingleProductCard/styles.tsx +0 -5
- package/themes/original/src/components/StripeCardsList/index.tsx +26 -8
- package/themes/original/src/components/StripeElementsForm/index.tsx +80 -62
- package/themes/original/src/components/StripeElementsForm/naked.tsx +59 -1
- package/themes/original/src/components/UpsellingProducts/UpsellingContent.tsx +170 -0
- package/themes/original/src/components/UpsellingProducts/UpsellingLayout.tsx +91 -0
- package/themes/original/src/components/UpsellingProducts/index.tsx +15 -199
- package/themes/original/src/components/UpsellingProducts/styles.tsx +19 -0
- package/themes/original/src/components/UserFormDetails/index.tsx +128 -79
- package/themes/original/src/components/UserFormDetails/styles.tsx +8 -1
- package/themes/original/src/components/UserProfile/index.tsx +5 -4
- package/themes/original/src/components/UserProfileForm/index.tsx +35 -36
- 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/styles.tsx +1 -0
- package/themes/original/src/components/Wallets/index.tsx +35 -49
- package/themes/original/src/components/Wallets/styles.tsx +3 -4
- package/themes/original/src/components/WebsocketStatus/index.tsx +172 -0
- package/themes/original/src/components/WebsocketStatus/styles.tsx +28 -0
- package/themes/original/src/components/shared/HeaderTitle.tsx +1 -1
- package/themes/original/src/components/shared/OButton.tsx +5 -5
- package/themes/original/src/components/shared/OInput.tsx +7 -4
- package/themes/original/src/components/shared/OModal.tsx +12 -14
- package/themes/original/src/layouts/Container.tsx +5 -3
- package/themes/original/src/types/index.tsx +13 -2
- package/themes/original/src/utils/index.tsx +124 -22
- package/src/navigators/BottomNavigator.tsx +0 -117
- package/src/navigators/CheckoutNavigator.tsx +0 -66
- package/src/navigators/HomeNavigator.tsx +0 -202
- package/src/navigators/NavigationRef.tsx +0 -7
- package/src/navigators/RootNavigator.tsx +0 -269
- package/src/pages/Account.tsx +0 -34
- package/src/pages/AddressForm.tsx +0 -62
- package/src/pages/AddressList.tsx +0 -24
- package/src/pages/BusinessProductsList.tsx +0 -81
- package/src/pages/BusinessesListing.tsx +0 -43
- package/src/pages/CartList.tsx +0 -49
- package/src/pages/Checkout.tsx +0 -101
- package/src/pages/ForgotPassword.tsx +0 -24
- package/src/pages/Help.tsx +0 -23
- package/src/pages/HelpAccountAndPayment.tsx +0 -23
- package/src/pages/HelpGuide.tsx +0 -23
- package/src/pages/HelpOrder.tsx +0 -23
- package/src/pages/Home.tsx +0 -36
- package/src/pages/IntroductoryTutorial.tsx +0 -170
- package/src/pages/Login.tsx +0 -47
- package/src/pages/MomentOption.tsx +0 -30
- package/src/pages/MultiCheckout.tsx +0 -31
- package/src/pages/MultiOrdersDetails.tsx +0 -27
- package/src/pages/MyOrders.tsx +0 -40
- package/src/pages/NetworkError.tsx +0 -24
- package/src/pages/NotFound.tsx +0 -22
- package/src/pages/OrderDetails.tsx +0 -25
- package/src/pages/ProductDetails.tsx +0 -55
- package/src/pages/Profile.tsx +0 -36
- package/src/pages/ReviewDriver.tsx +0 -30
- package/src/pages/ReviewOrder.tsx +0 -32
- package/src/pages/ReviewProducts.tsx +0 -30
- package/src/pages/Sessions.tsx +0 -22
- package/src/pages/Signup.tsx +0 -53
- package/src/pages/SpinnerLoader.tsx +0 -10
- package/src/pages/Splash.tsx +0 -21
|
@@ -10,7 +10,7 @@ export const NavBack = styled.TouchableOpacity`
|
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
export const Header = styled.View`
|
|
13
|
-
padding: 10px
|
|
13
|
+
padding: 10px 20px;
|
|
14
14
|
flex: 1;
|
|
15
15
|
`
|
|
16
16
|
|
|
@@ -24,7 +24,7 @@ export const OrderContent = styled.View`
|
|
|
24
24
|
export const OrderBusiness = styled.View`
|
|
25
25
|
position: relative;
|
|
26
26
|
padding-vertical: 10px;
|
|
27
|
-
padding-horizontal:
|
|
27
|
+
padding-horizontal: 20px;
|
|
28
28
|
background-color: ${(props: any) => props.theme.colors.white};
|
|
29
29
|
align-items: flex-start;
|
|
30
30
|
`
|
|
@@ -64,7 +64,7 @@ export const SectionTitle = styled.View`
|
|
|
64
64
|
`
|
|
65
65
|
|
|
66
66
|
export const OrderCustomer = styled.View`
|
|
67
|
-
padding: 20px
|
|
67
|
+
padding: 20px 20px 10px;
|
|
68
68
|
background-color: ${(props: any) => props.theme.colors.white};
|
|
69
69
|
`
|
|
70
70
|
|
|
@@ -86,7 +86,7 @@ export const InfoBlock = styled.View`
|
|
|
86
86
|
export const HeaderInfo = styled.View`
|
|
87
87
|
flex: 1;
|
|
88
88
|
background-color: ${(props: any) => props.theme.colors.backgroundGray100};
|
|
89
|
-
padding: 20px
|
|
89
|
+
padding: 20px 20px;
|
|
90
90
|
`
|
|
91
91
|
|
|
92
92
|
export const OrderProducts = styled(OrderCustomer)``
|
|
@@ -100,7 +100,7 @@ export const Table = styled.View`
|
|
|
100
100
|
`
|
|
101
101
|
|
|
102
102
|
export const OrderBill = styled.View`
|
|
103
|
-
padding-horizontal:
|
|
103
|
+
padding-horizontal: 20px;
|
|
104
104
|
padding-vertical: 10px;
|
|
105
105
|
flex: 1;
|
|
106
106
|
background-color: ${(props: any) => props.theme.colors.white};
|
|
@@ -130,7 +130,7 @@ export const OrderAction = styled.View`
|
|
|
130
130
|
`
|
|
131
131
|
|
|
132
132
|
export const PlaceSpotWrapper = styled.View`
|
|
133
|
-
padding-horizontal:
|
|
133
|
+
padding-horizontal: 20px;
|
|
134
134
|
`
|
|
135
135
|
|
|
136
136
|
export const ProfessionalPhoto = styled.ImageBackground`
|
|
@@ -141,4 +141,21 @@ export const ProfessionalPhoto = styled.ImageBackground`
|
|
|
141
141
|
width: 80px;
|
|
142
142
|
resize-mode: cover;
|
|
143
143
|
margin-right: 10px;
|
|
144
|
-
`;
|
|
144
|
+
`;
|
|
145
|
+
|
|
146
|
+
export const TopActions = styled.TouchableOpacity`
|
|
147
|
+
height: 60px;
|
|
148
|
+
justify-content: center;
|
|
149
|
+
min-width: 30px;
|
|
150
|
+
padding-right: 15px;
|
|
151
|
+
`;
|
|
152
|
+
|
|
153
|
+
export const TopHeader = styled.View`
|
|
154
|
+
width: 100%;
|
|
155
|
+
flex-direction: row;
|
|
156
|
+
align-items: center;
|
|
157
|
+
justify-content: space-between;
|
|
158
|
+
z-index: 1;
|
|
159
|
+
height: 60px;
|
|
160
|
+
min-height: 60px;
|
|
161
|
+
`
|
|
@@ -2,7 +2,8 @@ import React, { useEffect, useState } from 'react'
|
|
|
2
2
|
import {
|
|
3
3
|
OrderList,
|
|
4
4
|
useLanguage,
|
|
5
|
-
useUtils
|
|
5
|
+
useUtils,
|
|
6
|
+
useConfig
|
|
6
7
|
} from 'ordering-components/native'
|
|
7
8
|
import { useTheme } from 'styled-components/native';
|
|
8
9
|
import IconAntDesign from 'react-native-vector-icons/AntDesign'
|
|
@@ -21,7 +22,8 @@ import {
|
|
|
21
22
|
OrderInfoWrapper,
|
|
22
23
|
OrderProgressWrapper
|
|
23
24
|
} from './styles'
|
|
24
|
-
import { getOrderStatus } from '../../utils'
|
|
25
|
+
import { getOrderStatuPickUp, getOrderStatus } from '../../utils'
|
|
26
|
+
import DeviceInfo from 'react-native-device-info'
|
|
25
27
|
|
|
26
28
|
const OrderProgressUI = (props: any) => {
|
|
27
29
|
const {
|
|
@@ -34,10 +36,12 @@ const OrderProgressUI = (props: any) => {
|
|
|
34
36
|
const theme = useTheme();
|
|
35
37
|
|
|
36
38
|
const [, t] = useLanguage()
|
|
37
|
-
const [{ optimizeImage, parseTime }] = useUtils()
|
|
39
|
+
const [{ optimizeImage, parseTime, parseDate }] = useUtils()
|
|
40
|
+
const [{ configs }] = useConfig()
|
|
38
41
|
const [lastOrder, setLastOrder] = useState<any>(null)
|
|
39
42
|
const imageFails = theme.images.general.emptyActiveOrders
|
|
40
43
|
const [initialLoaded, setInitialLoaded] = useState(false)
|
|
44
|
+
const statusToShow = [0, 3, 4, 7, 8, 9, 13, 14, 18, 19, 20, 21, 22, 23]
|
|
41
45
|
|
|
42
46
|
const styles = StyleSheet.create({
|
|
43
47
|
main: {
|
|
@@ -53,7 +57,9 @@ const OrderProgressUI = (props: any) => {
|
|
|
53
57
|
shadowColor: '#000',
|
|
54
58
|
shadowOpacity: 0.2,
|
|
55
59
|
shadowRadius: 2,
|
|
56
|
-
elevation: 3
|
|
60
|
+
elevation: 3,
|
|
61
|
+
borderWidth: 1,
|
|
62
|
+
borderColor: 'rgba(0,0,0,0.1)'
|
|
57
63
|
},
|
|
58
64
|
logoWrapper: {
|
|
59
65
|
overflow: 'hidden',
|
|
@@ -84,7 +90,15 @@ const OrderProgressUI = (props: any) => {
|
|
|
84
90
|
useEffect(() => {
|
|
85
91
|
if (orderList?.orders.length > 0) {
|
|
86
92
|
const sortedOrders = orderList.orders.sort((a: any, b: any) => a.id > b.id ? -1 : 1)
|
|
87
|
-
|
|
93
|
+
const orderInProgress = sortedOrders.find((order: any) => (statusToShow.includes(order.status)))
|
|
94
|
+
|
|
95
|
+
let _lastOrder = null
|
|
96
|
+
if (orderInProgress) {
|
|
97
|
+
_lastOrder = orderInProgress
|
|
98
|
+
} else {
|
|
99
|
+
_lastOrder = sortedOrders[0]
|
|
100
|
+
}
|
|
101
|
+
setLastOrder(_lastOrder)
|
|
88
102
|
}
|
|
89
103
|
}, [orderList?.orders])
|
|
90
104
|
|
|
@@ -99,6 +113,8 @@ const OrderProgressUI = (props: any) => {
|
|
|
99
113
|
setInitialLoaded(true)
|
|
100
114
|
}, [orderList.loading, initialLoaded])
|
|
101
115
|
|
|
116
|
+
const progressBarObjt = (s: any) => lastOrder?.delivery_type && lastOrder?.delivery_type === 2 ? getOrderStatuPickUp(s) : getOrderStatus(s)
|
|
117
|
+
|
|
102
118
|
return (
|
|
103
119
|
<>
|
|
104
120
|
{(orderList?.loading && !initialLoaded) && (
|
|
@@ -117,7 +133,7 @@ const OrderProgressUI = (props: any) => {
|
|
|
117
133
|
<View style={styles.logoWrapper}>
|
|
118
134
|
<FastImage
|
|
119
135
|
style={{ width: 50, height: 50 }}
|
|
120
|
-
source={orderList?.orders.length === 1 ? {
|
|
136
|
+
source={orderList?.orders.length === 1 && lastOrder?.business?.logo?.includes?.('http') ? {
|
|
121
137
|
uri: optimizeImage(lastOrder?.business?.logo, 'h_50,c_limit'),
|
|
122
138
|
priority: FastImage.priority.normal,
|
|
123
139
|
} : theme.images.logos.logotype}
|
|
@@ -135,8 +151,7 @@ const OrderProgressUI = (props: any) => {
|
|
|
135
151
|
fontWeight: 'bold',
|
|
136
152
|
marginBottom: 3
|
|
137
153
|
}}
|
|
138
|
-
>{t('ORDER_IN_PROGRESS', 'Order in progress')}</OText>
|
|
139
|
-
<OText size={11} numberOfLines={1} ellipsizeMode='tail'>{t('RESTAURANT_PREPARING_YOUR_ORDER', 'The restaurant is preparing your order')}</OText>
|
|
154
|
+
>{statusToShow.includes(lastOrder?.status) ? t('ORDER_IN_PROGRESS', 'Order in progress') : t('ORDER', 'Order')}</OText>
|
|
140
155
|
<TouchableOpacity onPress={() => handleGoToOrder('MyOrders')}>
|
|
141
156
|
<View style={styles.navigationButton}>
|
|
142
157
|
<OText size={11} color={theme.colors.primary}>{t('GO_TO_MY_ORDERS', 'Go to my orders')}</OText>
|
|
@@ -152,18 +167,22 @@ const OrderProgressUI = (props: any) => {
|
|
|
152
167
|
</OrderInfoWrapper>
|
|
153
168
|
<View style={{ flex: 1 }}>
|
|
154
169
|
<ProgressContentWrapper>
|
|
155
|
-
<ProgressBar style={{ width:
|
|
170
|
+
<ProgressBar style={{ width: progressBarObjt(lastOrder.status)?.percentage ? `${(progressBarObjt(lastOrder.status) as any).percentage * 100}%` : '0%' }} />
|
|
156
171
|
</ProgressContentWrapper>
|
|
157
172
|
<ProgressTextWrapper>
|
|
158
|
-
<OText size={12} style={{ width: '50%' }}>{
|
|
173
|
+
<OText size={12} style={{ width: '50%' }}>{progressBarObjt(lastOrder.status)?.value}</OText>
|
|
159
174
|
<TimeWrapper>
|
|
160
|
-
<OText size={11}>{t('ESTIMATED_DELIVERY', 'Estimated delivery')}</OText>
|
|
175
|
+
<OText size={11}>{lastOrder?.delivery_type === 1 ? t('ESTIMATED_DELIVERY', 'Estimated delivery') : t('ESTIMATED_TIME', 'Estimated time')}</OText>
|
|
161
176
|
<OText size={11}>
|
|
162
177
|
{lastOrder?.delivery_datetime_utc
|
|
163
|
-
? parseTime(lastOrder?.delivery_datetime_utc, { outputFormat: '
|
|
178
|
+
? parseTime(lastOrder?.delivery_datetime_utc, { outputFormat: configs?.general_hour_format?.value || 'HH:mm' })
|
|
164
179
|
: parseTime(lastOrder?.delivery_datetime, { utc: false })}
|
|
165
180
|
-
|
|
166
|
-
|
|
181
|
+
{statusToShow.includes(lastOrder?.status) ? (
|
|
182
|
+
<OrderEta order={lastOrder} outputFormat={configs?.general_hour_format?.value || 'HH:mm'} />
|
|
183
|
+
) : (
|
|
184
|
+
parseDate(lastOrder?.reporting_data?.at[`status:${lastOrder.status}`], { outputFormat: configs?.general_hour_format?.value })
|
|
185
|
+
)}
|
|
167
186
|
</OText>
|
|
168
187
|
</TimeWrapper>
|
|
169
188
|
</ProgressTextWrapper>
|
|
@@ -192,7 +211,24 @@ export const OrderProgress = (props: any) => {
|
|
|
192
211
|
initialPage: 1,
|
|
193
212
|
pageSize: 10,
|
|
194
213
|
controlType: 'infinity'
|
|
195
|
-
}
|
|
214
|
+
},
|
|
215
|
+
propsToFetch: [
|
|
216
|
+
'id',
|
|
217
|
+
'name',
|
|
218
|
+
'business',
|
|
219
|
+
'status',
|
|
220
|
+
'delivery_type',
|
|
221
|
+
'delivery_datetime_utc',
|
|
222
|
+
'delivery_datetime',
|
|
223
|
+
'reporting_data',
|
|
224
|
+
'eta_current_status_time',
|
|
225
|
+
'eta_previous_status_times',
|
|
226
|
+
'eta_time',
|
|
227
|
+
'delivered_in',
|
|
228
|
+
'prepared_in',
|
|
229
|
+
'eta_drive_time'
|
|
230
|
+
],
|
|
231
|
+
noGiftCardOrders: true
|
|
196
232
|
}
|
|
197
233
|
|
|
198
234
|
return <OrderList {...orderProgressProps} />
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useState } from 'react';
|
|
1
|
+
import React, { useState, useRef } from 'react';
|
|
2
2
|
import { ActivityIndicator, View } from 'react-native'
|
|
3
3
|
import {
|
|
4
4
|
Cart,
|
|
@@ -20,12 +20,11 @@ import {
|
|
|
20
20
|
|
|
21
21
|
import { ProductItemAccordion } from '../ProductItemAccordion';
|
|
22
22
|
import { CouponControl } from '../CouponControl';
|
|
23
|
-
import { OInput, OModal, OText } from '../shared';
|
|
23
|
+
import { OInput, OModal, OText, OAlert } from '../shared';
|
|
24
24
|
import { verifyDecimals } from '../../utils';
|
|
25
25
|
import AntIcon from 'react-native-vector-icons/AntDesign'
|
|
26
26
|
import { TaxInformation } from '../TaxInformation';
|
|
27
27
|
import { TouchableOpacity } from 'react-native';
|
|
28
|
-
import { OAlert } from '../../../../../src/components/shared'
|
|
29
28
|
import { MomentOption } from '../MomentOption';
|
|
30
29
|
|
|
31
30
|
const OrderSummaryUI = (props: any) => {
|
|
@@ -57,8 +56,8 @@ const OrderSummaryUI = (props: any) => {
|
|
|
57
56
|
const [orderState] = useOrder();
|
|
58
57
|
const [{ parsePrice, parseNumber }] = useUtils();
|
|
59
58
|
const [validationFields] = useValidationFields();
|
|
59
|
+
const commentRef = useRef()
|
|
60
60
|
const [openTaxModal, setOpenTaxModal] = useState<any>({ open: false, data: null, type: '' })
|
|
61
|
-
const [confirm, setConfirm] = useState<any>({ open: false, content: null, handleOnAccept: null, id: null, title: null })
|
|
62
61
|
const isCouponEnabled = validationFields?.fields?.checkout?.coupon?.enabled;
|
|
63
62
|
const hideCartComments = !validationFields?.fields?.checkout?.comments?.enabled
|
|
64
63
|
|
|
@@ -106,16 +105,16 @@ const OrderSummaryUI = (props: any) => {
|
|
|
106
105
|
return cart?.taxes?.filter((tax: any) => tax?.type === 1)?.reduce((carry: number, tax: any) => carry + (tax?.summary?.tax_after_discount ?? tax?.summary?.tax), 0)
|
|
107
106
|
}
|
|
108
107
|
|
|
109
|
-
const
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
108
|
+
const OfferAlert = ({ offerId }: any) => {
|
|
109
|
+
return (
|
|
110
|
+
<OAlert
|
|
111
|
+
title={t('OFFER', 'Offer')}
|
|
112
|
+
message={t('QUESTION_DELETE_OFFER', 'Are you sure that you want to delete the offer?')}
|
|
113
|
+
onAccept={() => handleRemoveOfferClick(offerId)}
|
|
114
|
+
>
|
|
115
|
+
<AntIcon style={{ marginLeft: 3 }} name='closecircle' size={16} color={theme.colors.primary} />
|
|
116
|
+
</OAlert>
|
|
117
|
+
)
|
|
119
118
|
}
|
|
120
119
|
|
|
121
120
|
return (
|
|
@@ -171,9 +170,9 @@ const OrderSummaryUI = (props: any) => {
|
|
|
171
170
|
<TouchableOpacity style={{ marginLeft: 3 }} onPress={() => setOpenTaxModal({ open: true, data: offer, type: 'offer_target_1' })}>
|
|
172
171
|
<AntIcon name='infocirlceo' size={16} color={theme.colors.primary} />
|
|
173
172
|
</TouchableOpacity>
|
|
174
|
-
|
|
175
|
-
<
|
|
176
|
-
|
|
173
|
+
{!!offer?.id && (
|
|
174
|
+
<OfferAlert offerId={offer?.id} />
|
|
175
|
+
)}
|
|
177
176
|
</OSRow>
|
|
178
177
|
<OText size={12}>
|
|
179
178
|
- {parsePrice(offer?.summary?.discount)}
|
|
@@ -211,8 +210,8 @@ const OrderSummaryUI = (props: any) => {
|
|
|
211
210
|
))
|
|
212
211
|
}
|
|
213
212
|
{
|
|
214
|
-
cart?.fees?.length > 0 && cart?.fees?.filter((fee: any) => !(fee.fixed === 0 && fee.percentage === 0)).map((fee: any) => (
|
|
215
|
-
<OSTable key={fee?.id}>
|
|
213
|
+
cart?.fees?.length > 0 && cart?.fees?.filter((fee: any) => !(fee.fixed === 0 && fee.percentage === 0)).map((fee: any, i: number) => (
|
|
214
|
+
<OSTable key={fee?.id + i}>
|
|
216
215
|
<OSRow>
|
|
217
216
|
<OText size={12} numberOfLines={1}>
|
|
218
217
|
{fee.name || t('INHERIT_FROM_BUSINESS', 'Inherit from business')}{' '}
|
|
@@ -237,9 +236,9 @@ const OrderSummaryUI = (props: any) => {
|
|
|
237
236
|
<TouchableOpacity style={{ marginLeft: 3 }} onPress={() => setOpenTaxModal({ open: true, data: offer, type: 'offer_target_3' })}>
|
|
238
237
|
<AntIcon name='infocirlceo' size={16} color={theme.colors.primary} />
|
|
239
238
|
</TouchableOpacity>
|
|
240
|
-
|
|
241
|
-
<
|
|
242
|
-
|
|
239
|
+
{!!offer?.id && (
|
|
240
|
+
<OfferAlert offerId={offer?.id} />
|
|
241
|
+
)}
|
|
243
242
|
</OSRow>
|
|
244
243
|
<OText size={12}>
|
|
245
244
|
- {parsePrice(offer?.summary?.discount)}
|
|
@@ -247,7 +246,7 @@ const OrderSummaryUI = (props: any) => {
|
|
|
247
246
|
</OSTable>
|
|
248
247
|
))
|
|
249
248
|
}
|
|
250
|
-
{orderState?.options?.type === 1 &&
|
|
249
|
+
{orderState?.options?.type === 1 && !hideDeliveryFee && (
|
|
251
250
|
<OSTable>
|
|
252
251
|
<OText size={12}>{t('DELIVERY_FEE', 'Delivery Fee')}</OText>
|
|
253
252
|
<OText size={12}>{parsePrice(cart?.delivery_price_with_discount)}</OText>
|
|
@@ -264,9 +263,9 @@ const OrderSummaryUI = (props: any) => {
|
|
|
264
263
|
<TouchableOpacity style={{ marginLeft: 3 }} onPress={() => setOpenTaxModal({ open: true, data: offer, type: 'offer_target_2' })}>
|
|
265
264
|
<AntIcon name='infocirlceo' size={16} color={theme.colors.primary} />
|
|
266
265
|
</TouchableOpacity>
|
|
267
|
-
|
|
268
|
-
<
|
|
269
|
-
|
|
266
|
+
{!!offer?.id && (
|
|
267
|
+
<OfferAlert offerId={offer?.id} />
|
|
268
|
+
)}
|
|
270
269
|
</OSRow>
|
|
271
270
|
<OText size={12}>
|
|
272
271
|
- {parsePrice(offer?.summary?.discount)}
|
|
@@ -343,6 +342,7 @@ const OrderSummaryUI = (props: any) => {
|
|
|
343
342
|
marginTop: 10,
|
|
344
343
|
borderRadius: 8
|
|
345
344
|
}}
|
|
345
|
+
forwardRef={commentRef}
|
|
346
346
|
multiline
|
|
347
347
|
/>
|
|
348
348
|
{commentState?.loading && (
|
|
@@ -388,14 +388,6 @@ const OrderSummaryUI = (props: any) => {
|
|
|
388
388
|
products={cart?.products}
|
|
389
389
|
/>
|
|
390
390
|
</OModal>
|
|
391
|
-
<OAlert
|
|
392
|
-
open={confirm.open}
|
|
393
|
-
title={confirm.title}
|
|
394
|
-
content={confirm.content}
|
|
395
|
-
onAccept={confirm.handleOnAccept}
|
|
396
|
-
onCancel={() => setConfirm({ ...confirm, open: false, title: null })}
|
|
397
|
-
onClose={() => setConfirm({ ...confirm, open: false, title: null })}
|
|
398
|
-
/>
|
|
399
391
|
</>
|
|
400
392
|
)}
|
|
401
393
|
</OSContainer>
|
|
@@ -103,6 +103,11 @@ const OrderTypeSelectorUI = (props: OrderTypeSelectParams) => {
|
|
|
103
103
|
title={t('HOW_WILL_YOU_DELIVERY_TYPE', 'How will your order type?')}
|
|
104
104
|
titleAlign={'center'}
|
|
105
105
|
noMargin
|
|
106
|
+
buttonProps={{
|
|
107
|
+
bgColor: theme.colors.white,
|
|
108
|
+
borderColor: theme.colors.white,
|
|
109
|
+
textStyle: { color: theme.colors.btnFont }
|
|
110
|
+
}}
|
|
106
111
|
/>
|
|
107
112
|
{
|
|
108
113
|
items.length > 0 && (
|
|
@@ -2,5 +2,5 @@ import styled, { css } from 'styled-components/native'
|
|
|
2
2
|
|
|
3
3
|
export const ListWrapper = styled.View`
|
|
4
4
|
background-color: ${(props: any) => props.theme.colors.backgroundLight};
|
|
5
|
-
padding-horizontal: ${(props : any) => props.isBusinessesSearchList ? '0' : '
|
|
5
|
+
padding-horizontal: ${(props : any) => props.isBusinessesSearchList ? '0' : '20px'};
|
|
6
6
|
`;
|
|
@@ -2,5 +2,5 @@ import styled from 'styled-components/native'
|
|
|
2
2
|
|
|
3
3
|
export const ListWrapper = styled.View`
|
|
4
4
|
background-color: ${(props: any) => props.theme.colors.backgroundLight};
|
|
5
|
-
padding-horizontal: ${(props : any) => props.isBusinessesSearchList ? '0' : '
|
|
5
|
+
padding-horizontal: ${(props : any) => props.isBusinessesSearchList ? '0' : '20px'};
|
|
6
6
|
`;
|
|
@@ -51,7 +51,8 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
|
|
|
51
51
|
businesses,
|
|
52
52
|
businessPaginationProps,
|
|
53
53
|
handleUpdateProducts,
|
|
54
|
-
handleUpdateBusinesses
|
|
54
|
+
handleUpdateBusinesses,
|
|
55
|
+
businessId
|
|
55
56
|
} = props
|
|
56
57
|
|
|
57
58
|
const theme = useTheme();
|
|
@@ -158,7 +159,10 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
|
|
|
158
159
|
|
|
159
160
|
useEffect(() => {
|
|
160
161
|
if (reorderState?.error) {
|
|
161
|
-
|
|
162
|
+
const errorMessage = (Array.isArray(reorderState?.result) || typeof reorderState?.result === 'string')
|
|
163
|
+
? reorderState?.result
|
|
164
|
+
: t('CANT_REORDER_FOR_THIS_BUSINESS', 'Can’t reorder for this store, please create order manually.')
|
|
165
|
+
showToast(ToastType.Error, errorMessage)
|
|
162
166
|
}
|
|
163
167
|
}, [reorderState])
|
|
164
168
|
|
|
@@ -200,18 +204,21 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
|
|
|
200
204
|
|
|
201
205
|
return (
|
|
202
206
|
<>
|
|
203
|
-
{!loading && ordersLength.activeOrdersLength === 0 && ordersLength.previousOrdersLength === 0 && !activeOrders && (
|
|
207
|
+
{!loading && ordersLength.activeOrdersLength === 0 && ordersLength.previousOrdersLength === 0 && ordersLength?.preordersLength === 0 && !activeOrders && !preOrders && (
|
|
204
208
|
<NoOrdersWrapper>
|
|
205
209
|
<NotFoundSource
|
|
206
210
|
hideImage
|
|
207
211
|
btnStyle={{ borderRadius: 8 }}
|
|
208
212
|
content={t('YOU_DONT_HAVE_ORDERS', 'You don\'t have any orders')}
|
|
209
213
|
btnTitle={t('ORDER_NOW', 'Order now')}
|
|
210
|
-
onClickButton={() => onNavigationRedirect && onNavigationRedirect('BusinessList')}
|
|
214
|
+
onClickButton={() => onNavigationRedirect && (businessId ? onNavigationRedirect('Business') : onNavigationRedirect('BusinessList'))}
|
|
211
215
|
/>
|
|
212
216
|
</NoOrdersWrapper>
|
|
213
217
|
)}
|
|
214
|
-
{((ordersLength?.activeOrdersLength > 0 && activeOrders) ||
|
|
218
|
+
{((ordersLength?.activeOrdersLength > 0 && activeOrders) ||
|
|
219
|
+
(ordersLength?.previousOrdersLength > 0 && !activeOrders && !preOrders) ||
|
|
220
|
+
(ordersLength?.preordersLength > 0 && preOrders)
|
|
221
|
+
) && (
|
|
215
222
|
<>
|
|
216
223
|
{((titleContent && ((isBusiness && businessOrderIds?.length > 0) || isProducts)) || !titleContent) && (
|
|
217
224
|
<OptionTitle titleContent={!!titleContent} isBusinessesSearchList={!!businessesSearchList}>
|
|
@@ -305,7 +312,7 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
|
|
|
305
312
|
/>
|
|
306
313
|
)
|
|
307
314
|
)}
|
|
308
|
-
{loading && !hideOrders && (
|
|
315
|
+
{loading && !hideOrders && !preOrders && (
|
|
309
316
|
<>
|
|
310
317
|
{!activeOrders ? (
|
|
311
318
|
<Placeholder style={{ marginTop: 30 }} Animation={Fade}>
|
|
@@ -346,6 +353,7 @@ export const OrdersOption = (props: OrdersOptionParams) => {
|
|
|
346
353
|
const MyOrdersProps = {
|
|
347
354
|
...props,
|
|
348
355
|
UIComponent: OrdersOptionUI,
|
|
356
|
+
noGiftCardOrders: true,
|
|
349
357
|
orderStatus: getAllOrders
|
|
350
358
|
? [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23]
|
|
351
359
|
: props.preOrders ? [13] : props.activeOrders
|
|
@@ -3,7 +3,7 @@ import styled, { css } from 'styled-components/native'
|
|
|
3
3
|
export const OptionTitle = styled.View`
|
|
4
4
|
margin-top: 24px;
|
|
5
5
|
${(props : any) => props.titleContent && css`
|
|
6
|
-
margin-left: ${() => props.isBusinessesSearchList ? '0' : '
|
|
6
|
+
margin-left: ${() => props.isBusinessesSearchList ? '0' : '20px'};
|
|
7
7
|
`}
|
|
8
8
|
`
|
|
9
9
|
|
|
@@ -77,6 +77,7 @@ const PageBannerUI = (props: any) => {
|
|
|
77
77
|
const renderItem = ({ item, index }) => {
|
|
78
78
|
return (
|
|
79
79
|
<TouchableOpacity
|
|
80
|
+
activeOpacity={1}
|
|
80
81
|
onPress={() => handleGoToPage(item)}
|
|
81
82
|
>
|
|
82
83
|
<View style={styles.sliderWrapper}>
|
|
@@ -128,6 +129,7 @@ const PageBannerUI = (props: any) => {
|
|
|
128
129
|
{pageBannerState.banner?.items.length > 1 && (
|
|
129
130
|
<>
|
|
130
131
|
<TouchableOpacity
|
|
132
|
+
activeOpacity={1}
|
|
131
133
|
style={[styles.swiperButton, { left: 25 }]}
|
|
132
134
|
onPress={() => carouselRef.current.snapToPrev()}
|
|
133
135
|
>
|
|
@@ -138,6 +140,7 @@ const PageBannerUI = (props: any) => {
|
|
|
138
140
|
/>
|
|
139
141
|
</TouchableOpacity>
|
|
140
142
|
<TouchableOpacity
|
|
143
|
+
activeOpacity={1}
|
|
141
144
|
style={[styles.swiperButton, { right: 25 }]}
|
|
142
145
|
onPress={() => carouselRef.current.snapToNext()}
|
|
143
146
|
>
|
|
@@ -0,0 +1,182 @@
|
|
|
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
|
+
onOpen={() => setAddCardOpen({ ...addCardOpen, stripe: true })}
|
|
111
|
+
onCancel={() => setAddCardOpen({ ...addCardOpen, stripe: false })}
|
|
112
|
+
/>
|
|
113
|
+
</>
|
|
114
|
+
<Modal
|
|
115
|
+
animationType="slide"
|
|
116
|
+
visible={addCardOpen?.card}
|
|
117
|
+
onDismiss={() => setAddCardOpen({ ...addCardOpen, card: false })}
|
|
118
|
+
>
|
|
119
|
+
<KeyboardAvoidingView
|
|
120
|
+
behavior={Platform.OS === 'ios' ? 'padding' : 'height'}
|
|
121
|
+
style={{
|
|
122
|
+
flex: 1,
|
|
123
|
+
}}
|
|
124
|
+
>
|
|
125
|
+
<ScrollView>
|
|
126
|
+
<TouchableOpacity onPress={() => setAddCardOpen({ ...addCardOpen, card: false })}>
|
|
127
|
+
<OIcon
|
|
128
|
+
src={theme.images.general.close}
|
|
129
|
+
width={16}
|
|
130
|
+
style={style.wrapperIcon}
|
|
131
|
+
/>
|
|
132
|
+
</TouchableOpacity>
|
|
133
|
+
<>
|
|
134
|
+
<CreditCardInput
|
|
135
|
+
onChange={onChangeCardForm}
|
|
136
|
+
requiresName
|
|
137
|
+
/>
|
|
138
|
+
{alertState?.content?.[0] && !cardsList?.loading && (
|
|
139
|
+
<OText
|
|
140
|
+
color={theme?.colors?.error}
|
|
141
|
+
style={{
|
|
142
|
+
alignSelf: 'center'
|
|
143
|
+
}}
|
|
144
|
+
size={20}
|
|
145
|
+
>
|
|
146
|
+
{alertState.content[0]}
|
|
147
|
+
</OText>
|
|
148
|
+
)}
|
|
149
|
+
<OButton
|
|
150
|
+
text={t('ADD_CARD', 'Add card')}
|
|
151
|
+
isDisabled={!newCard || cardsList?.loading}
|
|
152
|
+
isLoading={cardsList?.loading}
|
|
153
|
+
onClick={() => handleAddNewCard()}
|
|
154
|
+
style={{
|
|
155
|
+
margin: 20,
|
|
156
|
+
...style.buttonStyle
|
|
157
|
+
}}
|
|
158
|
+
/>
|
|
159
|
+
</>
|
|
160
|
+
</ScrollView>
|
|
161
|
+
</KeyboardAvoidingView>
|
|
162
|
+
</Modal>
|
|
163
|
+
<Alert
|
|
164
|
+
open={alertState?.open || false}
|
|
165
|
+
title=''
|
|
166
|
+
content={alertState.content}
|
|
167
|
+
onClose={() => setAlertState({ open: false, content: [] })}
|
|
168
|
+
onAccept={() => setAlertState({ open: false, content: [] })}
|
|
169
|
+
/>
|
|
170
|
+
</View>
|
|
171
|
+
)
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
export const PaymentOptionCard = (props: any) => {
|
|
175
|
+
const paymentOptions = {
|
|
176
|
+
...props,
|
|
177
|
+
UIComponent: PaymentOptionCardUI
|
|
178
|
+
}
|
|
179
|
+
return (
|
|
180
|
+
<PaymentOptionStripe {...paymentOptions} />
|
|
181
|
+
)
|
|
182
|
+
}
|