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
|
@@ -11,11 +11,14 @@ import {
|
|
|
11
11
|
useLanguage,
|
|
12
12
|
ToastType,
|
|
13
13
|
useToast,
|
|
14
|
+
useSession
|
|
14
15
|
} from 'ordering-components/native';
|
|
15
16
|
import { useTheme } from 'styled-components/native';
|
|
16
17
|
import { PaymentOptionCash } from '../PaymentOptionCash';
|
|
17
18
|
import { StripeElementsForm } from '../StripeElementsForm';
|
|
18
19
|
import { StripeCardsList } from '../StripeCardsList';
|
|
20
|
+
import { PaymentOptionCard } from '../PaymentOptionCard'
|
|
21
|
+
|
|
19
22
|
// import { PaymentOptionStripe } from '../PaymentOptionStripe';
|
|
20
23
|
// import { StripeRedirectForm } from '../StripeRedirectForm';
|
|
21
24
|
// import { PaymentOptionPaypal } from '../PaymentOptionPaypal'
|
|
@@ -44,6 +47,7 @@ const stripeDirectMethods = ['stripe_direct']
|
|
|
44
47
|
|
|
45
48
|
const webViewPaymentGateway: any = ['paypal', 'square']
|
|
46
49
|
const multiCheckoutMethods = ['global_google_pay', 'global_apple_pay']
|
|
50
|
+
const cardsPaymethods = ['credomatic']
|
|
47
51
|
|
|
48
52
|
const PaymentOptionsUI = (props: any) => {
|
|
49
53
|
const {
|
|
@@ -61,14 +65,23 @@ const PaymentOptionsUI = (props: any) => {
|
|
|
61
65
|
handlePaymentMethodClickCustom,
|
|
62
66
|
handlePlaceOrder,
|
|
63
67
|
merchantId,
|
|
68
|
+
urlscheme,
|
|
64
69
|
setMethodPaySupported,
|
|
65
70
|
placeByMethodPay,
|
|
66
71
|
methodPaySupported,
|
|
67
|
-
setPlaceByMethodPay
|
|
72
|
+
setPlaceByMethodPay,
|
|
73
|
+
setCardList,
|
|
74
|
+
onPaymentChange,
|
|
75
|
+
requiredFields,
|
|
76
|
+
openUserModal,
|
|
77
|
+
paymethodClicked,
|
|
78
|
+
setPaymethodClicked,
|
|
79
|
+
androidAppId
|
|
68
80
|
} = props
|
|
69
81
|
|
|
70
82
|
const theme = useTheme();
|
|
71
83
|
const [, { showToast }] = useToast();
|
|
84
|
+
const [{ user }] = useSession()
|
|
72
85
|
const { confirmApplePayPayment } = useApplePay()
|
|
73
86
|
|
|
74
87
|
const getPayIcon = (method: string) => {
|
|
@@ -89,6 +102,8 @@ const PaymentOptionsUI = (props: any) => {
|
|
|
89
102
|
return theme.images.general.stripesb
|
|
90
103
|
case 'apple_pay':
|
|
91
104
|
return theme.images.general.applePayMark
|
|
105
|
+
case 'google_pay':
|
|
106
|
+
return theme.images.general.googlePayMark
|
|
92
107
|
default:
|
|
93
108
|
return theme.images.general.creditCard
|
|
94
109
|
}
|
|
@@ -96,7 +111,7 @@ const PaymentOptionsUI = (props: any) => {
|
|
|
96
111
|
|
|
97
112
|
const [, t] = useLanguage();
|
|
98
113
|
|
|
99
|
-
const [addCardOpen, setAddCardOpen] = useState({ stripe: false, stripeConnect: false });
|
|
114
|
+
const [addCardOpen, setAddCardOpen] = useState({ stripe: false, stripeConnect: false, card: false });
|
|
100
115
|
const paymethodSelected = props.paySelected || props.paymethodSelected || isOpenMethod?.paymethod
|
|
101
116
|
// const [{ token }] = useSession()
|
|
102
117
|
|
|
@@ -106,8 +121,18 @@ const PaymentOptionsUI = (props: any) => {
|
|
|
106
121
|
// { name: t('SELECT_A_PAYMENT_METHOD', 'Select a payment method'), value: '-1' },
|
|
107
122
|
// ]
|
|
108
123
|
|
|
124
|
+
const paymethodsFieldRequired = ['paypal', 'apple_pay', 'global_apple_pay']
|
|
125
|
+
|
|
109
126
|
const handlePaymentMethodClick = (paymethod: any) => {
|
|
110
|
-
if (cart?.balance > 0) {
|
|
127
|
+
if (cart?.balance > 0 || !!user?.guest_id) {
|
|
128
|
+
if (paymethodsFieldRequired.includes(paymethod?.gateway) && requiredFields.length > 0) {
|
|
129
|
+
openUserModal && openUserModal(true)
|
|
130
|
+
setPaymethodClicked({
|
|
131
|
+
confirmed: false,
|
|
132
|
+
paymethod
|
|
133
|
+
})
|
|
134
|
+
return
|
|
135
|
+
}
|
|
111
136
|
const isPopupMethod = ['stripe', 'stripe_direct', 'stripe_connect', 'stripe_redirect', 'paypal'].includes(paymethod?.gateway)
|
|
112
137
|
if (webViewPaymentGateway.includes(paymethod?.gateway)) {
|
|
113
138
|
handlePaymentMethodClickCustom(paymethod)
|
|
@@ -121,6 +146,12 @@ const PaymentOptionsUI = (props: any) => {
|
|
|
121
146
|
;
|
|
122
147
|
}
|
|
123
148
|
|
|
149
|
+
useEffect(() => {
|
|
150
|
+
if (cart?.balance === 0) {
|
|
151
|
+
handlePaymethodClick(null)
|
|
152
|
+
}
|
|
153
|
+
}, [cart?.balance])
|
|
154
|
+
|
|
124
155
|
useEffect(() => {
|
|
125
156
|
if (paymethodsList.paymethods.length === 1) {
|
|
126
157
|
handlePaymethodClick && handlePaymethodClick(paymethodsList.paymethods[0])
|
|
@@ -147,10 +178,17 @@ const PaymentOptionsUI = (props: any) => {
|
|
|
147
178
|
}
|
|
148
179
|
}, [paymethodData, paymethodSelected])
|
|
149
180
|
|
|
181
|
+
useEffect(() => {
|
|
182
|
+
if (paymethodClicked?.confirmed) {
|
|
183
|
+
handlePaymentMethodClickCustom(paymethodClicked?.paymethod)
|
|
184
|
+
}
|
|
185
|
+
}, [paymethodClicked?.confirmed])
|
|
186
|
+
|
|
187
|
+
|
|
150
188
|
const renderPaymethods = ({ item }: any) => {
|
|
151
189
|
return (
|
|
152
190
|
<>
|
|
153
|
-
{item?.gateway
|
|
191
|
+
{methodsPay.includes(item?.gateway) ? (
|
|
154
192
|
<TouchableOpacity
|
|
155
193
|
onPress={() => handlePaymentMethodClick(item)}
|
|
156
194
|
>
|
|
@@ -181,7 +219,7 @@ const PaymentOptionsUI = (props: any) => {
|
|
|
181
219
|
style={{ margin: 0, marginTop: 4 }}
|
|
182
220
|
color={paymethodSelected?.id === item.id ? theme.colors.white : '#000'}
|
|
183
221
|
>
|
|
184
|
-
{t(item
|
|
222
|
+
{t(item?.gateway?.toUpperCase(), item.name)}
|
|
185
223
|
</OText>
|
|
186
224
|
</PMItem>
|
|
187
225
|
</TouchableOpacity>
|
|
@@ -192,7 +230,7 @@ const PaymentOptionsUI = (props: any) => {
|
|
|
192
230
|
}
|
|
193
231
|
|
|
194
232
|
const excludeIds: any = [32]; //exclude paypal & connect & redirect
|
|
195
|
-
const filterMethodsPay = (gateway
|
|
233
|
+
const filterMethodsPay = (gateway: string) => Platform.OS === 'ios' ? gateway !== 'google_pay' : gateway !== 'apple_pay'
|
|
196
234
|
|
|
197
235
|
return (
|
|
198
236
|
<PMContainer>
|
|
@@ -202,9 +240,9 @@ const PaymentOptionsUI = (props: any) => {
|
|
|
202
240
|
showsHorizontalScrollIndicator={false}
|
|
203
241
|
// data={paymethodsList.paymethods.sort((a: any, b: any) => a.id - b.id)}
|
|
204
242
|
data={paymethodsList.paymethods.sort((a: any, b: any) => a.id - b.id)
|
|
205
|
-
.filter((p: any) =>
|
|
206
|
-
!multiCheckoutMethods.includes(p.gateway) &&
|
|
207
|
-
filterMethodsPay(p.gateway) &&
|
|
243
|
+
.filter((p: any) =>
|
|
244
|
+
!multiCheckoutMethods.includes(p.gateway) &&
|
|
245
|
+
filterMethodsPay(p.gateway) &&
|
|
208
246
|
!excludeIds.includes(p.id))}
|
|
209
247
|
renderItem={renderPaymethods}
|
|
210
248
|
keyExtractor={(paymethod: any) => paymethod?.id?.toString?.()}
|
|
@@ -251,7 +289,7 @@ const PaymentOptionsUI = (props: any) => {
|
|
|
251
289
|
/>
|
|
252
290
|
)}
|
|
253
291
|
|
|
254
|
-
{stripeOptions.includes(paymethodSelected?.gateway) &&
|
|
292
|
+
{/* {stripeOptions.includes(paymethodSelected?.gateway) &&
|
|
255
293
|
(paymethodData?.brand || paymethodData?.card?.brand) &&
|
|
256
294
|
(paymethodData?.last4 || paymethodData?.card?.last4) &&
|
|
257
295
|
(
|
|
@@ -280,10 +318,10 @@ const PaymentOptionsUI = (props: any) => {
|
|
|
280
318
|
</View>
|
|
281
319
|
</PMCardItemContent>
|
|
282
320
|
</PMCardSelected>
|
|
283
|
-
)}
|
|
321
|
+
)} */}
|
|
284
322
|
|
|
285
323
|
{/* Stripe */}
|
|
286
|
-
{isOpenMethod?.paymethod?.gateway === 'stripe' &&
|
|
324
|
+
{isOpenMethod?.paymethod?.gateway === 'stripe' && (
|
|
287
325
|
<View>
|
|
288
326
|
<OButton
|
|
289
327
|
text={t('ADD_PAYMENT_CARD', 'Add New Payment Card')}
|
|
@@ -301,8 +339,16 @@ const PaymentOptionsUI = (props: any) => {
|
|
|
301
339
|
payType={paymethodsList?.name}
|
|
302
340
|
onSelectCard={handlePaymethodDataChange}
|
|
303
341
|
onNavigationRedirect={onNavigationRedirect}
|
|
342
|
+
paymethodCardId={paymethodData?.id}
|
|
304
343
|
onCancel={() => handlePaymethodClick(null)}
|
|
305
|
-
setAddCardOpen={
|
|
344
|
+
setAddCardOpen={setAddCardOpen}
|
|
345
|
+
addCardOpen={addCardOpen}
|
|
346
|
+
isOpenMethod={isOpenMethod}
|
|
347
|
+
handleSource={handlePaymethodDataChange}
|
|
348
|
+
clientSecret={props.clientSecret}
|
|
349
|
+
businessId={props.businessId}
|
|
350
|
+
onPaymentChange={onPaymentChange}
|
|
351
|
+
paySelected={props.paySelected}
|
|
306
352
|
/>
|
|
307
353
|
</View>
|
|
308
354
|
)}
|
|
@@ -317,35 +363,33 @@ const PaymentOptionsUI = (props: any) => {
|
|
|
317
363
|
handleSource={handlePaymethodDataChange}
|
|
318
364
|
onCancel={() => handlePaymethodClick(null)}
|
|
319
365
|
merchantId={merchantId}
|
|
366
|
+
urlscheme={urlscheme}
|
|
367
|
+
androidAppId={androidAppId}
|
|
320
368
|
setMethodPaySupported={setMethodPaySupported}
|
|
321
369
|
methodPaySupported={methodPaySupported}
|
|
322
370
|
placeByMethodPay={placeByMethodPay}
|
|
323
371
|
setPlaceByMethodPay={setPlaceByMethodPay}
|
|
372
|
+
publicKeyAddCard={isOpenMethod?.paymethod?.credentials?.stripe?.publishable || isOpenMethod?.paymethod?.credentials?.publishable}
|
|
324
373
|
/>
|
|
325
374
|
)}
|
|
326
375
|
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
onSelectCard={handlePaymethodDataChange}
|
|
345
|
-
onCancel={() => setAddCardOpen({ ...addCardOpen, stripe: false })}
|
|
346
|
-
/>
|
|
347
|
-
</KeyboardAvoidingView>
|
|
348
|
-
</OModal>
|
|
376
|
+
{(cardsPaymethods.includes(isOpenMethod?.paymethod?.gateway) || cardsPaymethods.includes(paymethodSelected?.gateway)) && (
|
|
377
|
+
<PaymentOptionCard
|
|
378
|
+
setCardList={setCardList}
|
|
379
|
+
paymethod={isOpenMethod?.paymethod}
|
|
380
|
+
businessId={props.businessId}
|
|
381
|
+
publicKey={isOpenMethod?.paymethod?.credentials?.publishable}
|
|
382
|
+
gateway={isOpenMethod?.paymethod?.gateway || paymethodSelected?.gateway}
|
|
383
|
+
onPaymentChange={onPaymentChange}
|
|
384
|
+
payType={isOpenMethod?.paymethod?.name}
|
|
385
|
+
onSelectCard={handlePaymethodDataChange}
|
|
386
|
+
addCardOpen={addCardOpen}
|
|
387
|
+
setAddCardOpen={setAddCardOpen}
|
|
388
|
+
onCancel={() => handlePaymethodClick(null)}
|
|
389
|
+
paymethodSelected={paymethodSelected?.data?.id}
|
|
390
|
+
handlePaymentMethodClick={handlePaymentMethodClick}
|
|
391
|
+
/>
|
|
392
|
+
)}
|
|
349
393
|
|
|
350
394
|
{/* Stripe direct */}
|
|
351
395
|
<OModal
|
|
@@ -368,6 +412,10 @@ const PaymentOptionsUI = (props: any) => {
|
|
|
368
412
|
handleSource={handlePaymethodDataChange}
|
|
369
413
|
onCancel={() => handlePaymethodClick(null)}
|
|
370
414
|
merchantId={merchantId}
|
|
415
|
+
urlscheme={urlscheme}
|
|
416
|
+
androidAppId={androidAppId}
|
|
417
|
+
publicKeyAddCard={isOpenMethod?.paymethod?.credentials?.stripe?.publishable || isOpenMethod?.paymethod?.credentials?.publishable}
|
|
418
|
+
paySelected={props.paySelected}
|
|
371
419
|
/>
|
|
372
420
|
</KeyboardAvoidingView>
|
|
373
421
|
</OModal>
|
|
@@ -387,15 +435,17 @@ const PaymentOptionsUI = (props: any) => {
|
|
|
387
435
|
<StripeCardsList
|
|
388
436
|
paymethod={isOpenMethod?.paymethod}
|
|
389
437
|
businessId={props.businessId}
|
|
390
|
-
publicKey={isOpenMethod?.paymethod?.credentials.publishable}
|
|
391
438
|
payType={paymethodsList?.name}
|
|
392
439
|
onSelectCard={handlePaymethodDataChange}
|
|
393
440
|
onNavigationRedirect={onNavigationRedirect}
|
|
394
441
|
onCancel={() => handlePaymethodClick(null)}
|
|
442
|
+
publicKey={isOpenMethod?.paymethod?.credentials.publishable}
|
|
443
|
+
publicKeyAddCard={isOpenMethod?.paymethod?.credentials?.stripe?.publishable || isOpenMethod?.paymethod?.credentials?.publishable}
|
|
444
|
+
paySelected={props.paySelected}
|
|
395
445
|
/>
|
|
396
446
|
</View>
|
|
397
447
|
)}
|
|
398
|
-
|
|
448
|
+
{/** Stripe connect add cards */}
|
|
399
449
|
<OModal
|
|
400
450
|
entireModal
|
|
401
451
|
title={t('ADD_CREDIT_OR_DEBIT_CARD', 'Add credit or debit card')}
|
|
@@ -408,6 +458,7 @@ const PaymentOptionsUI = (props: any) => {
|
|
|
408
458
|
enabled={Platform.OS === 'ios' ? true : false}
|
|
409
459
|
>
|
|
410
460
|
<StripeElementsForm
|
|
461
|
+
openCarts={props.openCarts}
|
|
411
462
|
toSave
|
|
412
463
|
businessId={props.businessId}
|
|
413
464
|
publicKey={isOpenMethod?.paymethod?.credentials?.stripe?.publishable}
|
|
@@ -415,6 +466,36 @@ const PaymentOptionsUI = (props: any) => {
|
|
|
415
466
|
accountId={isOpenMethod?.paymethod?.credentials?.user}
|
|
416
467
|
onSelectCard={handlePaymethodDataChange}
|
|
417
468
|
onCancel={() => setAddCardOpen({ ...addCardOpen, stripeConnect: false })}
|
|
469
|
+
publicKeyAddCard={isOpenMethod?.paymethod?.credentials?.stripe?.publishable || isOpenMethod?.paymethod?.credentials?.publishable}
|
|
470
|
+
/>
|
|
471
|
+
</KeyboardAvoidingView>
|
|
472
|
+
</OModal>
|
|
473
|
+
|
|
474
|
+
{/* Stripe Add card */}
|
|
475
|
+
<OModal
|
|
476
|
+
entireModal
|
|
477
|
+
title={t('ADD_CREDIT_OR_DEBIT_CARD', 'Add credit or debit card')}
|
|
478
|
+
open={addCardOpen?.stripe}
|
|
479
|
+
onClose={() => setAddCardOpen({ ...addCardOpen, stripe: false })}
|
|
480
|
+
style={{ backgroundColor: 'red' }}
|
|
481
|
+
>
|
|
482
|
+
<KeyboardAvoidingView
|
|
483
|
+
behavior={Platform.OS == 'ios' ? 'padding' : 'height'}
|
|
484
|
+
keyboardVerticalOffset={Platform.OS == 'ios' ? 0 : 0}
|
|
485
|
+
enabled={Platform.OS === 'ios' ? true : false}
|
|
486
|
+
>
|
|
487
|
+
<StripeElementsForm
|
|
488
|
+
openCarts={props.openCarts}
|
|
489
|
+
toSave
|
|
490
|
+
businessId={props.businessId}
|
|
491
|
+
businessIds={props.businessIds}
|
|
492
|
+
publicKey={props.publicKey || isOpenMethod?.paymethod?.credentials?.publishable}
|
|
493
|
+
setCardsList={setCardList}
|
|
494
|
+
requirements={props.clientSecret}
|
|
495
|
+
handleSource={handlePaymethodDataChange}
|
|
496
|
+
onSelectCard={handlePaymethodDataChange}
|
|
497
|
+
onCancel={() => setAddCardOpen({ ...addCardOpen, stripe: false })}
|
|
498
|
+
publicKeyAddCard={isOpenMethod?.paymethod?.credentials?.stripe?.publishable || isOpenMethod?.paymethod?.credentials?.publishable}
|
|
418
499
|
/>
|
|
419
500
|
</KeyboardAvoidingView>
|
|
420
501
|
</OModal>
|
|
@@ -24,7 +24,8 @@ export const PhoneInputNumber = (props: PhoneInputParams) => {
|
|
|
24
24
|
noDropIcon,
|
|
25
25
|
isDisabled,
|
|
26
26
|
isStartValidation,
|
|
27
|
-
changeCountry
|
|
27
|
+
changeCountry,
|
|
28
|
+
updateStateWithSubmit
|
|
28
29
|
} = props
|
|
29
30
|
|
|
30
31
|
const theme = useTheme();
|
|
@@ -95,6 +96,19 @@ export const PhoneInputNumber = (props: PhoneInputParams) => {
|
|
|
95
96
|
}
|
|
96
97
|
}, [userphoneNumber])
|
|
97
98
|
|
|
99
|
+
useEffect(() => {
|
|
100
|
+
if (defaultValue && updateStateWithSubmit) {
|
|
101
|
+
phoneInput.current?.setState({
|
|
102
|
+
number: defaultValue,
|
|
103
|
+
countryCode: defaultCode ?
|
|
104
|
+
!isNaN(defaultCode)
|
|
105
|
+
? transformCountryCode(defaultCode)
|
|
106
|
+
: findExitingCode(defaultCode)
|
|
107
|
+
: findExitingCode(configs?.default_country_code?.value?.toUpperCase())
|
|
108
|
+
})
|
|
109
|
+
}
|
|
110
|
+
}, [defaultValue])
|
|
111
|
+
|
|
98
112
|
return (
|
|
99
113
|
<Wrapper onPress={() => forwardRef?.current?.focus?.()}>
|
|
100
114
|
{(isStartValidation && userphoneNumber === '') && (
|
|
@@ -49,6 +49,8 @@ export const PreviousOrders = (props: PreviousOrdersParams) => {
|
|
|
49
49
|
onClick={loadMoreOrders}
|
|
50
50
|
text={t('LOAD_MORE_ORDERS', 'Load more orders')}
|
|
51
51
|
imgRightSrc={null}
|
|
52
|
+
bgColor={theme.colors.primary}
|
|
53
|
+
borderColor={theme.colors.primary}
|
|
52
54
|
textStyle={{ color: theme.colors.white }}
|
|
53
55
|
style={{ borderRadius: 7.6, shadowOpacity: 0, marginTop: 20 }}
|
|
54
56
|
/>
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { useSession, useOrder, useLanguage, useConfig } from 'ordering-components/native'
|
|
3
|
+
import { useTheme } from 'styled-components/native'
|
|
4
|
+
import { TouchableOpacity, View } from 'react-native'
|
|
5
|
+
import { OButton, OText } from '../shared';
|
|
6
|
+
import { Placeholder, PlaceholderLine, Fade } from 'rn-placeholder';
|
|
7
|
+
|
|
8
|
+
export const ActionButton = (props: any) => {
|
|
9
|
+
const {
|
|
10
|
+
navigation,
|
|
11
|
+
isHaveWeight,
|
|
12
|
+
isSoldOut,
|
|
13
|
+
maxProductQuantity,
|
|
14
|
+
productCart,
|
|
15
|
+
handleSaveProduct,
|
|
16
|
+
editMode,
|
|
17
|
+
product,
|
|
18
|
+
errors,
|
|
19
|
+
productAddedToCartLength,
|
|
20
|
+
handleRedirectLogin,
|
|
21
|
+
guestCheckoutEnabled,
|
|
22
|
+
orderTypeEnabled,
|
|
23
|
+
handleUpdateGuest,
|
|
24
|
+
actionStatus
|
|
25
|
+
} = props
|
|
26
|
+
const [, t] = useLanguage()
|
|
27
|
+
const [{ auth }] = useSession()
|
|
28
|
+
const [orderState] = useOrder()
|
|
29
|
+
const theme = useTheme()
|
|
30
|
+
const [{ configs }] = useConfig()
|
|
31
|
+
const unaddressedTypes = configs?.unaddressed_order_types_allowed?.value.split('|').map((value: any) => Number(value)) || []
|
|
32
|
+
const isAllowUnaddressOrderType = unaddressedTypes.includes(orderState?.options?.type)
|
|
33
|
+
const saveErrors =
|
|
34
|
+
orderState.loading ||
|
|
35
|
+
maxProductQuantity === 0 ||
|
|
36
|
+
Object.keys(errors)?.length > 0;
|
|
37
|
+
const buttonColor = saveErrors || isSoldOut || maxProductQuantity <= 0 || (product?.minimum_per_order && ((productCart?.quantity + productAddedToCartLength) < product?.minimum_per_order)) || (product?.maximum_per_order && ((productCart?.quantity + productAddedToCartLength) > product?.maximum_per_order))
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
return (
|
|
42
|
+
<View
|
|
43
|
+
style={{
|
|
44
|
+
width: isHaveWeight ? '100%' : ((isSoldOut || maxProductQuantity <= 0) ? '60%' : '40%'),
|
|
45
|
+
}}>
|
|
46
|
+
{((productCart &&
|
|
47
|
+
auth &&
|
|
48
|
+
(orderState.options?.address_id || isAllowUnaddressOrderType)) || (isSoldOut || maxProductQuantity <= 0)) && (
|
|
49
|
+
<OButton
|
|
50
|
+
onClick={() => handleSaveProduct()}
|
|
51
|
+
imgRightSrc=""
|
|
52
|
+
text={`${orderState.loading
|
|
53
|
+
? t('LOADING', 'Loading')
|
|
54
|
+
: (isSoldOut || maxProductQuantity <= 0)
|
|
55
|
+
? t('SOLD_OUT', 'Sold out')
|
|
56
|
+
: editMode
|
|
57
|
+
? t('UPDATE', 'Update')
|
|
58
|
+
: t('ADD', 'Add')
|
|
59
|
+
}`}
|
|
60
|
+
isDisabled={isSoldOut || maxProductQuantity <= 0 || (product?.minimum_per_order && ((productCart?.quantity + productAddedToCartLength) < product?.minimum_per_order)) || (product?.maximum_per_order && ((productCart?.quantity + productAddedToCartLength) > product?.maximum_per_order))}
|
|
61
|
+
textStyle={{
|
|
62
|
+
color: saveErrors || isSoldOut || maxProductQuantity <= 0 ? theme.colors.primary : theme.colors.white,
|
|
63
|
+
fontSize: orderState.loading || editMode ? 10 : 14
|
|
64
|
+
}}
|
|
65
|
+
bgColor={buttonColor ? theme.colors.lightGray : theme.colors.primary}
|
|
66
|
+
borderColor={!buttonColor ? theme.colors.white : theme.colors.primary}
|
|
67
|
+
style={{
|
|
68
|
+
opacity: saveErrors || isSoldOut || maxProductQuantity <= 0 ? 0.3 : 1,
|
|
69
|
+
borderRadius: 7.6,
|
|
70
|
+
height: 44,
|
|
71
|
+
shadowOpacity: 0,
|
|
72
|
+
borderWidth: 1,
|
|
73
|
+
marginTop: isHaveWeight ? 10 : 0
|
|
74
|
+
}}
|
|
75
|
+
/>
|
|
76
|
+
)}
|
|
77
|
+
{auth &&
|
|
78
|
+
!orderState.options?.address_id && !isAllowUnaddressOrderType &&
|
|
79
|
+
(orderState.loading ? (
|
|
80
|
+
<OButton
|
|
81
|
+
isDisabled
|
|
82
|
+
text={t('LOADING', 'Loading')}
|
|
83
|
+
imgRightSrc=""
|
|
84
|
+
textStyle={{ fontSize: 10 }}
|
|
85
|
+
/>
|
|
86
|
+
) : (
|
|
87
|
+
<OButton onClick={navigation.navigate('AddressList')} />
|
|
88
|
+
))}
|
|
89
|
+
{!auth && (
|
|
90
|
+
<OButton
|
|
91
|
+
isDisabled={isSoldOut || maxProductQuantity <= 0}
|
|
92
|
+
onClick={() => handleRedirectLogin()}
|
|
93
|
+
text={
|
|
94
|
+
isSoldOut || maxProductQuantity <= 0
|
|
95
|
+
? t('SOLD_OUT', 'Sold out')
|
|
96
|
+
: t('LOGIN_SIGNUP', 'Login / Sign Up')
|
|
97
|
+
}
|
|
98
|
+
imgRightSrc=""
|
|
99
|
+
textStyle={{ color: theme.colors.primary, fontSize: 13, textAlign: 'center' }}
|
|
100
|
+
style={{
|
|
101
|
+
height: 42,
|
|
102
|
+
borderColor: theme.colors.primary,
|
|
103
|
+
backgroundColor: theme.colors.white,
|
|
104
|
+
paddingLeft: 0,
|
|
105
|
+
paddingRight: 0
|
|
106
|
+
}}
|
|
107
|
+
/>
|
|
108
|
+
)}
|
|
109
|
+
{!auth && guestCheckoutEnabled && orderTypeEnabled && (
|
|
110
|
+
<TouchableOpacity style={{ marginTop: 10 }} onPress={handleUpdateGuest}>
|
|
111
|
+
{actionStatus?.loading ? (
|
|
112
|
+
<Placeholder Animation={Fade}>
|
|
113
|
+
<PlaceholderLine height={20} />
|
|
114
|
+
</Placeholder>
|
|
115
|
+
) : (
|
|
116
|
+
<OText color={theme.colors.primary} size={13} style={{ textAlign: 'center' }}>{t('AS_GUEST_USER', 'As guest user')}</OText>
|
|
117
|
+
)}
|
|
118
|
+
</TouchableOpacity>
|
|
119
|
+
)}
|
|
120
|
+
</View>
|
|
121
|
+
)
|
|
122
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { TouchableOpacity } from 'react-native';
|
|
3
|
+
import { useTheme } from 'styled-components/native';
|
|
4
|
+
import { OText } from '../shared';
|
|
5
|
+
|
|
6
|
+
export const ExtraOptions = (props : any) => {
|
|
7
|
+
const {
|
|
8
|
+
options,
|
|
9
|
+
setSelectedOpt,
|
|
10
|
+
scrollViewRef,
|
|
11
|
+
optionLayout,
|
|
12
|
+
editionsLayoutY,
|
|
13
|
+
styles,
|
|
14
|
+
selOpt
|
|
15
|
+
} = props
|
|
16
|
+
|
|
17
|
+
const theme = useTheme()
|
|
18
|
+
|
|
19
|
+
return (
|
|
20
|
+
<>
|
|
21
|
+
{options.map(({ id, name, respect_to, suboptions }: any) => (
|
|
22
|
+
<React.Fragment key={`cont_key_${id}`}>
|
|
23
|
+
{respect_to == null && suboptions?.length > 0 && (
|
|
24
|
+
<TouchableOpacity
|
|
25
|
+
key={`eopt_key_${id}`}
|
|
26
|
+
onPress={() => {
|
|
27
|
+
setSelectedOpt(id)
|
|
28
|
+
scrollViewRef?.current?.scrollTo && scrollViewRef.current.scrollTo({
|
|
29
|
+
y: optionLayout[`id:${id}`]?.y + editionsLayoutY - 50,
|
|
30
|
+
animated: true
|
|
31
|
+
})
|
|
32
|
+
}}
|
|
33
|
+
style={[
|
|
34
|
+
styles.extraItem,
|
|
35
|
+
{
|
|
36
|
+
borderBottomColor:
|
|
37
|
+
selOpt == id ? theme.colors.textNormal : theme.colors.backgroundPage,
|
|
38
|
+
},
|
|
39
|
+
]}>
|
|
40
|
+
<OText
|
|
41
|
+
color={
|
|
42
|
+
selOpt == id ? theme.colors.textNormal : theme.colors.textSecondary
|
|
43
|
+
}
|
|
44
|
+
size={12}
|
|
45
|
+
weight={selOpt == id ? '600' : 'normal'}
|
|
46
|
+
style={{ maxWidth: 150 }}
|
|
47
|
+
numberOfLines={1}>
|
|
48
|
+
{name}
|
|
49
|
+
</OText>
|
|
50
|
+
</TouchableOpacity>
|
|
51
|
+
)}
|
|
52
|
+
</React.Fragment>
|
|
53
|
+
))}
|
|
54
|
+
</>
|
|
55
|
+
)
|
|
56
|
+
}
|