ordering-ui-react-native 0.12.57 → 0.12.58
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 +1 -1
- package/themes/single-business/src/components/Cart/index.tsx +91 -15
- package/themes/single-business/src/components/Cart/styles.tsx +39 -0
- package/themes/single-business/src/components/CartContent/index.tsx +56 -52
- package/themes/single-business/src/components/CartContent/styles.tsx +2 -16
- package/themes/franchises/index.tsx +0 -111
- package/themes/franchises/src/components/ActiveOrders/index.tsx +0 -134
- package/themes/franchises/src/components/ActiveOrders/styles.tsx +0 -44
- package/themes/franchises/src/components/AddressDetails/index.tsx +0 -77
- package/themes/franchises/src/components/AddressDetails/styles.tsx +0 -21
- package/themes/franchises/src/components/AddressForm/index.tsx +0 -837
- package/themes/franchises/src/components/AddressForm/styles.tsx +0 -27
- package/themes/franchises/src/components/AddressList/index.tsx +0 -338
- package/themes/franchises/src/components/AddressList/styles.tsx +0 -20
- package/themes/franchises/src/components/AppleLogin/index.tsx +0 -149
- package/themes/franchises/src/components/AppleLogin/styles.tsx +0 -21
- package/themes/franchises/src/components/BottomWrapper/index.tsx +0 -29
- package/themes/franchises/src/components/BusinessBasicInformation/index.tsx +0 -310
- package/themes/franchises/src/components/BusinessBasicInformation/styles.tsx +0 -66
- package/themes/franchises/src/components/BusinessController/index.tsx +0 -184
- package/themes/franchises/src/components/BusinessController/styles.tsx +0 -64
- package/themes/franchises/src/components/BusinessFeaturedController/index.tsx +0 -189
- package/themes/franchises/src/components/BusinessFeaturedController/styles.tsx +0 -50
- package/themes/franchises/src/components/BusinessInformation/index.tsx +0 -202
- package/themes/franchises/src/components/BusinessInformation/styles.tsx +0 -39
- package/themes/franchises/src/components/BusinessItemAccordion/index.tsx +0 -125
- package/themes/franchises/src/components/BusinessItemAccordion/styles.tsx +0 -54
- package/themes/franchises/src/components/BusinessProductsCategories/index.tsx +0 -87
- package/themes/franchises/src/components/BusinessProductsCategories/styles.tsx +0 -8
- package/themes/franchises/src/components/BusinessProductsList/index.tsx +0 -199
- package/themes/franchises/src/components/BusinessProductsList/styles.tsx +0 -14
- package/themes/franchises/src/components/BusinessProductsListing/index.tsx +0 -292
- package/themes/franchises/src/components/BusinessProductsListing/styles.tsx +0 -30
- package/themes/franchises/src/components/BusinessReviews/index.tsx +0 -249
- package/themes/franchises/src/components/BusinessReviews/styles.tsx +0 -59
- package/themes/franchises/src/components/BusinessTypeFilter/index.tsx +0 -127
- package/themes/franchises/src/components/BusinessTypeFilter/styles.tsx +0 -40
- package/themes/franchises/src/components/BusinessesListing/index.tsx +0 -339
- package/themes/franchises/src/components/BusinessesListing/styles.tsx +0 -92
- package/themes/franchises/src/components/Cart/index.tsx +0 -332
- package/themes/franchises/src/components/Cart/styles.tsx +0 -28
- package/themes/franchises/src/components/CartContent/index.tsx +0 -60
- package/themes/franchises/src/components/CartContent/styles.tsx +0 -19
- package/themes/franchises/src/components/Checkout/index.tsx +0 -664
- package/themes/franchises/src/components/Checkout/styles.tsx +0 -89
- package/themes/franchises/src/components/CouponControl/index.tsx +0 -119
- package/themes/franchises/src/components/CouponControl/styles.tsx +0 -22
- package/themes/franchises/src/components/DriverTips/index.tsx +0 -167
- package/themes/franchises/src/components/DriverTips/styles.tsx +0 -63
- package/themes/franchises/src/components/FacebookLogin/index.tsx +0 -107
- package/themes/franchises/src/components/FacebookLogin/styles.tsx +0 -21
- package/themes/franchises/src/components/FloatingButton/index.tsx +0 -100
- package/themes/franchises/src/components/FloatingButton/styles.tsx +0 -26
- package/themes/franchises/src/components/ForgotPasswordForm/index.tsx +0 -156
- package/themes/franchises/src/components/ForgotPasswordForm/styles.tsx +0 -11
- package/themes/franchises/src/components/GPSButton/index.tsx +0 -84
- package/themes/franchises/src/components/GPSButton/styles.ts +0 -6
- package/themes/franchises/src/components/GoogleLogin/index.tsx +0 -122
- package/themes/franchises/src/components/GoogleLogin/styles.tsx +0 -23
- package/themes/franchises/src/components/GoogleMap/index.tsx +0 -229
- package/themes/franchises/src/components/Help/index.tsx +0 -56
- package/themes/franchises/src/components/Help/styles.tsx +0 -11
- package/themes/franchises/src/components/HelpAccountAndPayment/index.tsx +0 -68
- package/themes/franchises/src/components/HelpAccountAndPayment/styles.tsx +0 -6
- package/themes/franchises/src/components/HelpGuide/index.tsx +0 -67
- package/themes/franchises/src/components/HelpGuide/styles.tsx +0 -6
- package/themes/franchises/src/components/HelpOrder/index.tsx +0 -79
- package/themes/franchises/src/components/HelpOrder/styles.tsx +0 -6
- package/themes/franchises/src/components/Home/index.tsx +0 -102
- package/themes/franchises/src/components/Home/styles.tsx +0 -18
- package/themes/franchises/src/components/LanguageSelector/index.tsx +0 -98
- package/themes/franchises/src/components/LanguageSelector/styles.tsx +0 -7
- package/themes/franchises/src/components/LastOrder/index.tsx +0 -168
- package/themes/franchises/src/components/LastOrder/styles.tsx +0 -16
- package/themes/franchises/src/components/LastOrders/index.tsx +0 -104
- package/themes/franchises/src/components/LastOrders/styles.tsx +0 -17
- package/themes/franchises/src/components/LoginForm/index.tsx +0 -512
- package/themes/franchises/src/components/LoginForm/styles.tsx +0 -77
- package/themes/franchises/src/components/LogoutButton/index.tsx +0 -36
- package/themes/franchises/src/components/Messages/index.tsx +0 -359
- package/themes/franchises/src/components/Messages/styles.tsx +0 -20
- package/themes/franchises/src/components/MomentOption/index.tsx +0 -321
- package/themes/franchises/src/components/MomentOption/styles.tsx +0 -66
- package/themes/franchises/src/components/NavBar/index.tsx +0 -129
- package/themes/franchises/src/components/NotFoundSource/index.tsx +0 -50
- package/themes/franchises/src/components/NotFoundSource/styles.tsx +0 -16
- package/themes/franchises/src/components/Notifications/index.tsx +0 -120
- package/themes/franchises/src/components/Notifications/styles.ts +0 -21
- package/themes/franchises/src/components/OrderDetails/index.tsx +0 -828
- package/themes/franchises/src/components/OrderDetails/styles.tsx +0 -120
- package/themes/franchises/src/components/OrderSummary/index.tsx +0 -266
- package/themes/franchises/src/components/OrderSummary/styles.tsx +0 -41
- package/themes/franchises/src/components/OrderTypeSelector/index.tsx +0 -92
- package/themes/franchises/src/components/OrderTypeSelector/styles.tsx +0 -27
- package/themes/franchises/src/components/OrdersOption/index.tsx +0 -243
- package/themes/franchises/src/components/OrdersOption/styles.tsx +0 -5
- package/themes/franchises/src/components/PaymentOptionCash/index.tsx +0 -102
- package/themes/franchises/src/components/PaymentOptionCash/styles.tsx +0 -18
- package/themes/franchises/src/components/PaymentOptionStripe/index.tsx +0 -234
- package/themes/franchises/src/components/PaymentOptionStripe/styles.tsx +0 -71
- package/themes/franchises/src/components/PaymentOptions/index.tsx +0 -430
- package/themes/franchises/src/components/PaymentOptions/styles.tsx +0 -77
- package/themes/franchises/src/components/PhoneInputNumber/index.tsx +0 -127
- package/themes/franchises/src/components/PhoneInputNumber/styles.tsx +0 -3
- package/themes/franchises/src/components/PreviousOrders/index.tsx +0 -188
- package/themes/franchises/src/components/PreviousOrders/styles.tsx +0 -33
- package/themes/franchises/src/components/ProductForm/index.tsx +0 -695
- package/themes/franchises/src/components/ProductForm/styles.tsx +0 -78
- package/themes/franchises/src/components/ProductIngredient/index.tsx +0 -43
- package/themes/franchises/src/components/ProductIngredient/styles.tsx +0 -7
- package/themes/franchises/src/components/ProductItemAccordion/index.tsx +0 -276
- package/themes/franchises/src/components/ProductItemAccordion/styles.tsx +0 -57
- package/themes/franchises/src/components/ProductOption/index.tsx +0 -50
- package/themes/franchises/src/components/ProductOption/styles.tsx +0 -11
- package/themes/franchises/src/components/ProductOptionSubOption/index.tsx +0 -146
- package/themes/franchises/src/components/ProductOptionSubOption/styles.tsx +0 -32
- package/themes/franchises/src/components/ReviewDriver/index.tsx +0 -221
- package/themes/franchises/src/components/ReviewDriver/styles.tsx +0 -46
- package/themes/franchises/src/components/ReviewOrder/index.tsx +0 -325
- package/themes/franchises/src/components/ReviewOrder/styles.tsx +0 -46
- package/themes/franchises/src/components/ReviewProduct/index.tsx +0 -275
- package/themes/franchises/src/components/ReviewProduct/styles.tsx +0 -53
- package/themes/franchises/src/components/SearchBar/index.tsx +0 -139
- package/themes/franchises/src/components/SignupForm/index.tsx +0 -643
- package/themes/franchises/src/components/SignupForm/styles.tsx +0 -27
- package/themes/franchises/src/components/SingleProductCard/index.tsx +0 -124
- package/themes/franchises/src/components/SingleProductCard/styles.tsx +0 -23
- package/themes/franchises/src/components/StripeCardForm/index.tsx +0 -97
- package/themes/franchises/src/components/StripeCardForm/naked.tsx +0 -128
- package/themes/franchises/src/components/StripeCardForm/styles.tsx +0 -32
- package/themes/franchises/src/components/StripeCardsList/index.tsx +0 -182
- package/themes/franchises/src/components/StripeElementsForm/index.tsx +0 -204
- package/themes/franchises/src/components/StripeElementsForm/naked.tsx +0 -90
- package/themes/franchises/src/components/StripeElementsForm/styles.tsx +0 -13
- package/themes/franchises/src/components/StripeRedirectForm/index.tsx +0 -159
- package/themes/franchises/src/components/StripeRedirectForm/styles.tsx +0 -23
- package/themes/franchises/src/components/TagSelector/index.tsx +0 -94
- package/themes/franchises/src/components/TagSelector/styles.ts +0 -0
- package/themes/franchises/src/components/TaxInformation/index.tsx +0 -51
- package/themes/franchises/src/components/TaxInformation/styles.tsx +0 -9
- package/themes/franchises/src/components/UpsellingProducts/index.tsx +0 -222
- package/themes/franchises/src/components/UpsellingProducts/styles.tsx +0 -50
- package/themes/franchises/src/components/UserDetails/index.tsx +0 -134
- package/themes/franchises/src/components/UserDetails/styles.tsx +0 -26
- package/themes/franchises/src/components/UserFormDetails/index.tsx +0 -351
- package/themes/franchises/src/components/UserFormDetails/styles.tsx +0 -35
- package/themes/franchises/src/components/UserProfile/index.tsx +0 -179
- package/themes/franchises/src/components/UserProfile/styles.ts +0 -42
- package/themes/franchises/src/components/UserProfileForm/index.tsx +0 -253
- package/themes/franchises/src/components/UserProfileForm/styles.tsx +0 -29
- package/themes/franchises/src/components/VerifyPhone/index.tsx +0 -188
- package/themes/franchises/src/components/VerifyPhone/styles.tsx +0 -43
- package/themes/franchises/src/components/shared/OAlert.tsx +0 -55
- package/themes/franchises/src/components/shared/OBottomPopup.tsx +0 -73
- package/themes/franchises/src/components/shared/OBottomStickBar.tsx +0 -62
- package/themes/franchises/src/components/shared/OButton.tsx +0 -132
- package/themes/franchises/src/components/shared/ODropDown.tsx +0 -169
- package/themes/franchises/src/components/shared/OIcon.tsx +0 -53
- package/themes/franchises/src/components/shared/OIconButton.tsx +0 -127
- package/themes/franchises/src/components/shared/OIconText.tsx +0 -54
- package/themes/franchises/src/components/shared/OInput.tsx +0 -113
- package/themes/franchises/src/components/shared/OKeyButton.tsx +0 -35
- package/themes/franchises/src/components/shared/OModal.tsx +0 -172
- package/themes/franchises/src/components/shared/OText.tsx +0 -52
- package/themes/franchises/src/components/shared/OTextarea.tsx +0 -36
- package/themes/franchises/src/components/shared/OToast.tsx +0 -93
- package/themes/franchises/src/components/shared/OToggle.tsx +0 -158
- package/themes/franchises/src/components/shared/index.tsx +0 -29
- package/themes/franchises/src/config/constants.tsx +0 -57
- package/themes/franchises/src/layouts/Container.tsx +0 -23
- package/themes/franchises/src/layouts/SafeAreaContainer.tsx +0 -6
- package/themes/franchises/src/providers/AlertProvider.tsx +0 -43
- package/themes/franchises/src/providers/StoreUtil.tsx +0 -50
- package/themes/franchises/src/types/index.tsx +0 -445
- package/themes/franchises/src/utils/index.tsx +0 -222
|
@@ -1,430 +0,0 @@
|
|
|
1
|
-
import React, { useEffect, useState } from 'react';
|
|
2
|
-
import { View, StyleSheet, KeyboardAvoidingView, Platform } from 'react-native';
|
|
3
|
-
import {
|
|
4
|
-
Placeholder,
|
|
5
|
-
PlaceholderLine,
|
|
6
|
-
Fade
|
|
7
|
-
} from "rn-placeholder";
|
|
8
|
-
|
|
9
|
-
import {
|
|
10
|
-
PaymentOptions as PaymentOptionsController,
|
|
11
|
-
useLanguage,
|
|
12
|
-
} from 'ordering-components/native';
|
|
13
|
-
import { useTheme } from 'styled-components/native';
|
|
14
|
-
import { PaymentOptionCash } from '../PaymentOptionCash';
|
|
15
|
-
import { StripeElementsForm } from '../StripeElementsForm';
|
|
16
|
-
import { StripeCardsList } from '../StripeCardsList';
|
|
17
|
-
// import { PaymentOptionStripe } from '../PaymentOptionStripe';
|
|
18
|
-
// import { StripeRedirectForm } from '../StripeRedirectForm';
|
|
19
|
-
// import { PaymentOptionPaypal } from '../PaymentOptionPaypal'
|
|
20
|
-
// import { NotFoundSource } from '../NotFoundSource'
|
|
21
|
-
|
|
22
|
-
import { OText, OIcon, OModal, OButton } from '../shared';
|
|
23
|
-
|
|
24
|
-
import {
|
|
25
|
-
PMContainer,
|
|
26
|
-
PMItem,
|
|
27
|
-
PMDropDownWrapper,
|
|
28
|
-
PMDropDownCont
|
|
29
|
-
} from './styles'
|
|
30
|
-
import { TouchableOpacity } from 'react-native-gesture-handler';
|
|
31
|
-
|
|
32
|
-
const stripeOptions: any = ['stripe_direct', 'stripe', 'stripe_connect']
|
|
33
|
-
// const stripeRedirectOptions = [
|
|
34
|
-
// { name: 'Bancontact', value: 'bancontact' },
|
|
35
|
-
// { name: 'Alipay', value: 'alipay' },
|
|
36
|
-
// { name: 'Giropay', value: 'giropay' },
|
|
37
|
-
// { name: 'iDEAL', value: 'ideal' }
|
|
38
|
-
// ]
|
|
39
|
-
|
|
40
|
-
const PaymentOptionsUI = (props: any) => {
|
|
41
|
-
const {
|
|
42
|
-
cart,
|
|
43
|
-
errorCash,
|
|
44
|
-
isLoading,
|
|
45
|
-
isDisabled,
|
|
46
|
-
paymethodData,
|
|
47
|
-
paymethodsList,
|
|
48
|
-
setPaymethodData,
|
|
49
|
-
onNavigationRedirect,
|
|
50
|
-
handlePaymethodClick,
|
|
51
|
-
handlePaymethodDataChange,
|
|
52
|
-
isOpenMethod
|
|
53
|
-
} = props
|
|
54
|
-
|
|
55
|
-
const theme = useTheme();
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
const getPayIcon = (method: string) => {
|
|
59
|
-
switch (method) {
|
|
60
|
-
case 'cash':
|
|
61
|
-
return theme.images.general.cash
|
|
62
|
-
case 'card_delivery':
|
|
63
|
-
return theme.images.general.carddelivery
|
|
64
|
-
case 'paypal':
|
|
65
|
-
return theme.images.general.paypal
|
|
66
|
-
case 'stripe':
|
|
67
|
-
return theme.images.general.stripe
|
|
68
|
-
case 'stripe_direct':
|
|
69
|
-
return theme.images.general.stripecc
|
|
70
|
-
case 'stripe_connect':
|
|
71
|
-
return theme.images.general.stripes
|
|
72
|
-
case 'stripe_redirect':
|
|
73
|
-
return theme.images.general.stripesb
|
|
74
|
-
default:
|
|
75
|
-
return theme.images.general.creditCard
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
const [, t] = useLanguage();
|
|
80
|
-
|
|
81
|
-
const [addCardOpen, setAddCardOpen] = useState({ stripe: false, stripeConnect: false });
|
|
82
|
-
const [isShowMethods, setShowMethods] = useState(false);
|
|
83
|
-
|
|
84
|
-
const paymethodSelected = props.paySelected || props.paymethodSelected || isOpenMethod?.paymethod
|
|
85
|
-
// const [{ token }] = useSession()
|
|
86
|
-
|
|
87
|
-
// const [card, setCard] = useState(null);
|
|
88
|
-
|
|
89
|
-
// const stripeRedirectValues = [
|
|
90
|
-
// { name: t('SELECT_A_PAYMENT_METHOD', 'Select a payment method'), value: '-1' },
|
|
91
|
-
// ]
|
|
92
|
-
|
|
93
|
-
const handlePaymentMethodClick = (paymethod: any) => {
|
|
94
|
-
const isPopupMethod = ['stripe', 'stripe_direct', 'stripe_connect', 'stripe_redirect', 'paypal'].includes(paymethod?.gateway)
|
|
95
|
-
handlePaymethodClick(paymethod, isPopupMethod)
|
|
96
|
-
setShowMethods(false);
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
useEffect(() => {
|
|
100
|
-
if (paymethodsList.paymethods.length === 1) {
|
|
101
|
-
handlePaymethodClick && handlePaymethodClick(paymethodsList.paymethods[0])
|
|
102
|
-
}
|
|
103
|
-
}, [paymethodsList.paymethods])
|
|
104
|
-
|
|
105
|
-
useEffect(() => {
|
|
106
|
-
if (paymethodSelected?.gateway !== 'cash' && errorCash) {
|
|
107
|
-
props.setErrorCash(false)
|
|
108
|
-
}
|
|
109
|
-
}, [paymethodSelected])
|
|
110
|
-
|
|
111
|
-
useEffect(() => {
|
|
112
|
-
if (props.paySelected && props.paySelected?.data) {
|
|
113
|
-
setPaymethodData && setPaymethodData(props.paySelected?.data)
|
|
114
|
-
}
|
|
115
|
-
}, [props.paySelected])
|
|
116
|
-
|
|
117
|
-
const renderPaymethods = ({ item }: any) => {
|
|
118
|
-
return (
|
|
119
|
-
<TouchableOpacity
|
|
120
|
-
onPress={() => handlePaymentMethodClick(item)}
|
|
121
|
-
>
|
|
122
|
-
<PMItem
|
|
123
|
-
key={item.id}
|
|
124
|
-
isDisabled={isDisabled}
|
|
125
|
-
isActive={paymethodSelected?.id === item.id}
|
|
126
|
-
>
|
|
127
|
-
<OIcon
|
|
128
|
-
src={getPayIcon(item.gateway)}
|
|
129
|
-
width={20}
|
|
130
|
-
height={20}
|
|
131
|
-
color={paymethodSelected?.id === item.id ? theme.colors.white : theme.colors.backgroundDark}
|
|
132
|
-
/>
|
|
133
|
-
<OText
|
|
134
|
-
size={10}
|
|
135
|
-
style={{ marginLeft: 12, marginRight: 12 }}
|
|
136
|
-
color={paymethodSelected?.id === item.id ? theme.colors.white : '#000'}
|
|
137
|
-
>
|
|
138
|
-
{t(item.gateway.toUpperCase(), item.name)}
|
|
139
|
-
</OText>
|
|
140
|
-
</PMItem>
|
|
141
|
-
</TouchableOpacity>
|
|
142
|
-
)
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
const excludeIds: any = [3, 32, 66]; //exclude paypal & connect & redirect
|
|
146
|
-
|
|
147
|
-
const pmData = paymethodsList.paymethods.sort((a: any, b: any) => a.id - b.id).filter((p: any) => !excludeIds.includes(p.id));
|
|
148
|
-
// useEffect(() => { console.log(JSON.stringify(paymethodSelected)) }, []);
|
|
149
|
-
return (
|
|
150
|
-
<PMContainer>
|
|
151
|
-
{paymethodsList.paymethods.length > 0 && (
|
|
152
|
-
<PMDropDownWrapper onPress={() => setShowMethods(!isShowMethods)}>
|
|
153
|
-
<OText color={theme.colors.textSecondary} style={{marginLeft: 14, marginRight: 14}}>{paymethodSelected?.paymethod?.name || t('SELECT_PAYMENT_METHOD', 'Select Paymethod')}</OText>
|
|
154
|
-
<OIcon color={theme.colors.textSecondary} width={16} src={theme.images.general.chevron_right} style={{transform: [{rotate: '90deg'}], marginEnd: 14}} />
|
|
155
|
-
{isShowMethods && <PMDropDownCont>
|
|
156
|
-
{
|
|
157
|
-
pmData.map((item: any, idx: number) =>
|
|
158
|
-
<React.Fragment key={idx}>
|
|
159
|
-
{renderPaymethods({item})}
|
|
160
|
-
</React.Fragment>
|
|
161
|
-
)
|
|
162
|
-
}
|
|
163
|
-
</PMDropDownCont>}
|
|
164
|
-
</PMDropDownWrapper>
|
|
165
|
-
)}
|
|
166
|
-
|
|
167
|
-
{(paymethodsList.loading || isLoading) && (
|
|
168
|
-
<Placeholder style={{ marginTop: 10 }} Animation={Fade}>
|
|
169
|
-
<View style={{ display: 'flex', flexDirection: 'row' }}>
|
|
170
|
-
{[...Array(3)].map((_, i) => (
|
|
171
|
-
<PlaceholderLine
|
|
172
|
-
key={i}
|
|
173
|
-
width={37}
|
|
174
|
-
height={80}
|
|
175
|
-
noMargin
|
|
176
|
-
style={{ borderRadius: 10, marginRight: 10 }}
|
|
177
|
-
/>
|
|
178
|
-
))}
|
|
179
|
-
</View>
|
|
180
|
-
</Placeholder>
|
|
181
|
-
)}
|
|
182
|
-
|
|
183
|
-
{paymethodsList.error && paymethodsList.error.length > 0 && (
|
|
184
|
-
<OText size={12} style={{ margin: 0 }}>
|
|
185
|
-
{paymethodsList?.error[0]?.message || paymethodsList?.error[0]}
|
|
186
|
-
</OText>
|
|
187
|
-
)}
|
|
188
|
-
|
|
189
|
-
{!(paymethodsList.loading || isLoading) &&
|
|
190
|
-
!paymethodsList.error &&
|
|
191
|
-
(!paymethodsList?.paymethods || paymethodsList.paymethods.length === 0) &&
|
|
192
|
-
(
|
|
193
|
-
<OText size={12} style={{ margin: 0 }}>
|
|
194
|
-
{t('NO_PAYMENT_METHODS', 'No payment methods!')}
|
|
195
|
-
</OText>
|
|
196
|
-
)}
|
|
197
|
-
|
|
198
|
-
{paymethodSelected?.gateway === 'cash' && (
|
|
199
|
-
<PaymentOptionCash
|
|
200
|
-
orderTotal={cart.total}
|
|
201
|
-
defaultValue={paymethodSelected?.data?.cash}
|
|
202
|
-
onChangeData={handlePaymethodDataChange}
|
|
203
|
-
setErrorCash={props.setErrorCash}
|
|
204
|
-
/>
|
|
205
|
-
)}
|
|
206
|
-
|
|
207
|
-
{/* {stripeOptions.includes(paymethodSelected?.gateway) &&
|
|
208
|
-
(paymethodData?.brand || paymethodData?.card?.brand) &&
|
|
209
|
-
(paymethodData?.last4 || paymethodData?.card?.last4) &&
|
|
210
|
-
(
|
|
211
|
-
<PMCardSelected>
|
|
212
|
-
<PMCardItemContent>
|
|
213
|
-
<View style={styles.viewStyle}>
|
|
214
|
-
<OIcon
|
|
215
|
-
src={theme.images.general.radio_act}
|
|
216
|
-
width={16}
|
|
217
|
-
color={theme.colors.primary}
|
|
218
|
-
/>
|
|
219
|
-
</View>
|
|
220
|
-
<View style={styles.viewStyle}>
|
|
221
|
-
<OText>
|
|
222
|
-
{getIconCard((paymethodData?.brand || paymethodData?.card?.brand), 20)}
|
|
223
|
-
</OText>
|
|
224
|
-
</View>
|
|
225
|
-
<View style={styles.viewStyle}>
|
|
226
|
-
<OText
|
|
227
|
-
size={12}
|
|
228
|
-
lineHeight={18}
|
|
229
|
-
color={theme.colors.textNormal}
|
|
230
|
-
>
|
|
231
|
-
XXXX-XXXX-XXXX-{(paymethodData?.last4 || paymethodData?.card?.last4)}
|
|
232
|
-
</OText>
|
|
233
|
-
</View>
|
|
234
|
-
</PMCardItemContent>
|
|
235
|
-
</PMCardSelected>
|
|
236
|
-
)} */}
|
|
237
|
-
|
|
238
|
-
{/* Stripe */}
|
|
239
|
-
{isOpenMethod?.paymethod?.gateway === 'stripe' && (
|
|
240
|
-
<View style={{paddingTop: 17}}>
|
|
241
|
-
<StripeCardsList
|
|
242
|
-
paymethod={isOpenMethod?.paymethod}
|
|
243
|
-
businessId={props.businessId}
|
|
244
|
-
publicKey={isOpenMethod?.paymethod?.credentials.publishable}
|
|
245
|
-
payType={paymethodsList?.name}
|
|
246
|
-
onSelectCard={handlePaymethodDataChange}
|
|
247
|
-
onNavigationRedirect={onNavigationRedirect}
|
|
248
|
-
onCancel={() => handlePaymethodClick(null)}
|
|
249
|
-
/>
|
|
250
|
-
<OButton
|
|
251
|
-
text={t('ADD_NEW_CARD', 'Add new card')}
|
|
252
|
-
bgColor={theme.colors.white}
|
|
253
|
-
borderColor={theme.colors.primary}
|
|
254
|
-
style={styles.btnAddStyle}
|
|
255
|
-
textStyle={{ color: theme.colors.primary, fontSize: 12, marginLeft: 0, marginRight: 0 }}
|
|
256
|
-
imgRightSrc={null}
|
|
257
|
-
onClick={() => setAddCardOpen({ ...addCardOpen, stripe: true })}
|
|
258
|
-
/>
|
|
259
|
-
</View>
|
|
260
|
-
)}
|
|
261
|
-
|
|
262
|
-
<OModal
|
|
263
|
-
entireModal
|
|
264
|
-
title={t('ADD_CREDIT_OR_DEBIT_CARD', 'Add credit or debit card')}
|
|
265
|
-
open={addCardOpen.stripe}
|
|
266
|
-
onClose={() => setAddCardOpen({ ...addCardOpen, stripe: false })}
|
|
267
|
-
style={{ backgroundColor: 'red' }}
|
|
268
|
-
>
|
|
269
|
-
<KeyboardAvoidingView
|
|
270
|
-
behavior={Platform.OS == 'ios' ? 'padding' : 'height'}
|
|
271
|
-
keyboardVerticalOffset={Platform.OS == 'ios' ? 0 : 0}
|
|
272
|
-
enabled={Platform.OS === 'ios' ? true : false}
|
|
273
|
-
>
|
|
274
|
-
<StripeElementsForm
|
|
275
|
-
toSave
|
|
276
|
-
businessId={props.businessId}
|
|
277
|
-
publicKey={isOpenMethod?.paymethod?.credentials?.publishable}
|
|
278
|
-
requirements={props.clientSecret}
|
|
279
|
-
onSelectCard={handlePaymethodDataChange}
|
|
280
|
-
onCancel={() => setAddCardOpen({ ...addCardOpen, stripe: false })}
|
|
281
|
-
/>
|
|
282
|
-
</KeyboardAvoidingView>
|
|
283
|
-
</OModal>
|
|
284
|
-
|
|
285
|
-
{/* Stripe direct */}
|
|
286
|
-
<OModal
|
|
287
|
-
entireModal
|
|
288
|
-
title={t('ADD_CREDIT_OR_DEBIT_CARD', 'Add credit or debit card')}
|
|
289
|
-
open={isOpenMethod?.paymethod?.gateway === 'stripe_direct' && !paymethodData?.id}
|
|
290
|
-
onClose={() => handlePaymethodClick(null)}
|
|
291
|
-
>
|
|
292
|
-
<KeyboardAvoidingView
|
|
293
|
-
behavior={Platform.OS == 'ios' ? 'padding' : 'height'}
|
|
294
|
-
keyboardVerticalOffset={Platform.OS == 'ios' ? 0 : 0}
|
|
295
|
-
enabled={Platform.OS === 'ios' ? true : false}
|
|
296
|
-
>
|
|
297
|
-
<StripeElementsForm
|
|
298
|
-
businessId={props.businessId}
|
|
299
|
-
publicKey={isOpenMethod?.paymethod?.credentials?.publishable}
|
|
300
|
-
handleSource={handlePaymethodDataChange}
|
|
301
|
-
onCancel={() => handlePaymethodClick(false)}
|
|
302
|
-
/>
|
|
303
|
-
</KeyboardAvoidingView>
|
|
304
|
-
</OModal>
|
|
305
|
-
|
|
306
|
-
{/* Stripe Connect */}
|
|
307
|
-
{isOpenMethod?.paymethod?.gateway === 'stripe_connect' && !paymethodData?.id && (
|
|
308
|
-
<View>
|
|
309
|
-
<StripeCardsList
|
|
310
|
-
paymethod={isOpenMethod?.paymethod}
|
|
311
|
-
businessId={props.businessId}
|
|
312
|
-
publicKey={isOpenMethod?.paymethod?.credentials.publishable}
|
|
313
|
-
payType={paymethodsList?.name}
|
|
314
|
-
onSelectCard={handlePaymethodDataChange}
|
|
315
|
-
onNavigationRedirect={onNavigationRedirect}
|
|
316
|
-
onCancel={() => handlePaymethodClick(null)}
|
|
317
|
-
/>
|
|
318
|
-
<OButton
|
|
319
|
-
text={t('ADD_PAYMENT_CARD', 'Add New Payment Card')}
|
|
320
|
-
bgColor={theme.colors.white}
|
|
321
|
-
borderColor={theme.colors.primary}
|
|
322
|
-
style={styles.btnAddStyle}
|
|
323
|
-
textStyle={{ color: theme.colors.primary, fontSize: 12, marginStart: 0, marginEnd: 0 }}
|
|
324
|
-
imgRightSrc={null}
|
|
325
|
-
onClick={() => setAddCardOpen({ ...addCardOpen, stripeConnect: true })}
|
|
326
|
-
/>
|
|
327
|
-
</View>
|
|
328
|
-
)}
|
|
329
|
-
|
|
330
|
-
<OModal
|
|
331
|
-
entireModal
|
|
332
|
-
title={t('ADD_CREDIT_OR_DEBIT_CARD', 'Add credit or debit card')}
|
|
333
|
-
open={addCardOpen.stripeConnect}
|
|
334
|
-
onClose={() => setAddCardOpen({ ...addCardOpen, stripeConnect: false })}
|
|
335
|
-
>
|
|
336
|
-
<KeyboardAvoidingView
|
|
337
|
-
behavior={Platform.OS == 'ios' ? 'padding' : 'height'}
|
|
338
|
-
keyboardVerticalOffset={Platform.OS == 'ios' ? 0 : 0}
|
|
339
|
-
enabled={Platform.OS === 'ios' ? true : false}
|
|
340
|
-
>
|
|
341
|
-
<StripeElementsForm
|
|
342
|
-
toSave
|
|
343
|
-
businessId={props.businessId}
|
|
344
|
-
publicKey={isOpenMethod?.paymethod?.credentials?.stripe?.publishable}
|
|
345
|
-
requirements={isOpenMethod?.paymethod?.credentials?.publishable}
|
|
346
|
-
accountId={isOpenMethod?.paymethod?.credentials?.user}
|
|
347
|
-
onSelectCard={handlePaymethodDataChange}
|
|
348
|
-
onCancel={() => setAddCardOpen({ ...addCardOpen, stripeConnect: false })}
|
|
349
|
-
/>
|
|
350
|
-
</KeyboardAvoidingView>
|
|
351
|
-
</OModal>
|
|
352
|
-
|
|
353
|
-
{/* Stripe Redirect */}
|
|
354
|
-
{/* <OModal
|
|
355
|
-
isNotDecoration
|
|
356
|
-
open={['stripe_redirect'].includes(paymethodSelected?.gateway) && !paymethodData.type}
|
|
357
|
-
title={t('STRIPE_REDIRECT', 'Stripe Redirect')}
|
|
358
|
-
onClose={() => handlePaymethodClick(null)}
|
|
359
|
-
>
|
|
360
|
-
<StripeRedirectForm
|
|
361
|
-
businessId={props.businessId}
|
|
362
|
-
currency={props.currency}
|
|
363
|
-
// paymethods={flatArray([stripeRedirectValues, stripeRedirectOptions])}
|
|
364
|
-
publicKey={paymethodSelected?.credentials?.publishable}
|
|
365
|
-
paymethods={stripeRedirectOptions}
|
|
366
|
-
handleStripeRedirect={handlePaymethodDataChange}
|
|
367
|
-
/>
|
|
368
|
-
</OModal> */}
|
|
369
|
-
|
|
370
|
-
{/* Paypal */}
|
|
371
|
-
{/* <Modal
|
|
372
|
-
className='modal-info'
|
|
373
|
-
open={paymethodSelected?.gateway === 'paypal' && !paymethodData?.id}
|
|
374
|
-
onClose={() => handlePaymethodClick(null)}
|
|
375
|
-
title={t('PAY_WITH_PAYPAL', 'Pay with PayPal')}
|
|
376
|
-
>
|
|
377
|
-
{paymethodSelected?.gateway === 'paypal' && (
|
|
378
|
-
<PaymentOptionPaypal
|
|
379
|
-
clientId={paymethodSelected?.credentials?.client_id}
|
|
380
|
-
body={{
|
|
381
|
-
paymethod_id: paymethodSelected.id,
|
|
382
|
-
amount: cart.total,
|
|
383
|
-
delivery_zone_id: cart.delivery_zone_id,
|
|
384
|
-
cartUuid: cart.uuid
|
|
385
|
-
}}
|
|
386
|
-
btnStyle={paypalBtnStyle}
|
|
387
|
-
noAuthMessage={
|
|
388
|
-
!token
|
|
389
|
-
? t('NEED_LOGIN_TO_USE', 'Sorry, you need to login to use this method')
|
|
390
|
-
: null
|
|
391
|
-
}
|
|
392
|
-
handlerChangePaypal={(uuid) => onNavigationRedirect && onNavigationRedirect('OrderDetails', { orderId: uuid })}
|
|
393
|
-
/>
|
|
394
|
-
)}
|
|
395
|
-
</Modal> */}
|
|
396
|
-
</PMContainer>
|
|
397
|
-
)
|
|
398
|
-
}
|
|
399
|
-
|
|
400
|
-
const styles = StyleSheet.create({
|
|
401
|
-
viewStyle: {
|
|
402
|
-
marginRight: 10
|
|
403
|
-
},
|
|
404
|
-
cardsList: {
|
|
405
|
-
borderWidth: 1,
|
|
406
|
-
borderColor: 'red',
|
|
407
|
-
flex: 1,
|
|
408
|
-
height: 120
|
|
409
|
-
},
|
|
410
|
-
btnAddStyle: {
|
|
411
|
-
marginTop: 7,
|
|
412
|
-
shadowOpacity: 0,
|
|
413
|
-
height: 27,
|
|
414
|
-
borderWidth: 0,
|
|
415
|
-
borderRadius: 0,
|
|
416
|
-
paddingStart: 0,
|
|
417
|
-
paddingEnd: 0,
|
|
418
|
-
alignSelf: 'flex-start'
|
|
419
|
-
},
|
|
420
|
-
})
|
|
421
|
-
|
|
422
|
-
export const PaymentOptions = (props: any) => {
|
|
423
|
-
const paymentOptions = {
|
|
424
|
-
...props,
|
|
425
|
-
UIComponent: PaymentOptionsUI
|
|
426
|
-
}
|
|
427
|
-
return (
|
|
428
|
-
<PaymentOptionsController {...paymentOptions} />
|
|
429
|
-
)
|
|
430
|
-
}
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
import styled, { css } from 'styled-components/native';
|
|
2
|
-
|
|
3
|
-
export const PMContainer = styled.View`
|
|
4
|
-
width: 100%;
|
|
5
|
-
display: flex;
|
|
6
|
-
flex-direction: column;
|
|
7
|
-
`
|
|
8
|
-
|
|
9
|
-
export const PMList = styled.View`
|
|
10
|
-
display: flex;
|
|
11
|
-
justify-content: flex-start;
|
|
12
|
-
flex-wrap: wrap;
|
|
13
|
-
`
|
|
14
|
-
|
|
15
|
-
export const PMItem = styled.View`
|
|
16
|
-
height: 44px;
|
|
17
|
-
display: flex;
|
|
18
|
-
flex-direction: row;
|
|
19
|
-
align-items: center;
|
|
20
|
-
justify-content: flex-start;
|
|
21
|
-
border-radius: 7.6px;
|
|
22
|
-
margin-vertical: 4px;
|
|
23
|
-
text-align: center;
|
|
24
|
-
background-color: ${(props: any) => props.theme.colors.inputDisabled};
|
|
25
|
-
|
|
26
|
-
${(props: any) => props.theme?.rtl && css`
|
|
27
|
-
margin-left: 10px;
|
|
28
|
-
margin-right: 0;
|
|
29
|
-
`}
|
|
30
|
-
|
|
31
|
-
/* ${(props: any) => props.isDisabled && css`
|
|
32
|
-
pointer-events: none;
|
|
33
|
-
`} */
|
|
34
|
-
|
|
35
|
-
${(props: any) => props.isActive ? css`
|
|
36
|
-
background-color: ${(props: any) => props.theme.colors.primary};
|
|
37
|
-
` : css`
|
|
38
|
-
border: 1px solid #EAEAEA;
|
|
39
|
-
`}
|
|
40
|
-
padding-horizontal: 14px;
|
|
41
|
-
`
|
|
42
|
-
|
|
43
|
-
export const PMCardSelected = styled.View`
|
|
44
|
-
padding: 30px 0px 0px;
|
|
45
|
-
`
|
|
46
|
-
|
|
47
|
-
export const PMCardItemContent = styled.View`
|
|
48
|
-
display: flex;
|
|
49
|
-
flex-direction: row;
|
|
50
|
-
align-items: center;
|
|
51
|
-
justify-content: flex-start;
|
|
52
|
-
width: 100%;
|
|
53
|
-
font-weight: bold;
|
|
54
|
-
`
|
|
55
|
-
|
|
56
|
-
export const PMDropDownWrapper = styled.TouchableOpacity`
|
|
57
|
-
position: relative;
|
|
58
|
-
min-height: 44px;
|
|
59
|
-
height: 44px;
|
|
60
|
-
border-radius: 7.6px;
|
|
61
|
-
background-color: ${(props: any) => props.theme.colors.inputDisabled};
|
|
62
|
-
flex-direction: row;
|
|
63
|
-
justify-content: space-between;
|
|
64
|
-
align-items: center;
|
|
65
|
-
z-index: 10;
|
|
66
|
-
`;
|
|
67
|
-
|
|
68
|
-
export const PMDropDownCont = styled.View`
|
|
69
|
-
background-color: white;
|
|
70
|
-
border-radius: 7.6px;
|
|
71
|
-
position: absolute;
|
|
72
|
-
top: 44px;
|
|
73
|
-
width: 100%;
|
|
74
|
-
padding: 10px 16px;
|
|
75
|
-
box-shadow: 0 2px 3px #0000004D;
|
|
76
|
-
border: 1px solid #EEE;
|
|
77
|
-
`;
|
|
@@ -1,127 +0,0 @@
|
|
|
1
|
-
import React, { useEffect, useRef, useState } from 'react';
|
|
2
|
-
import PhoneInput from "react-native-phone-number-input";
|
|
3
|
-
import { StyleSheet, View } from 'react-native';
|
|
4
|
-
import { useLanguage, useConfig } from 'ordering-components/native';
|
|
5
|
-
import { useTheme } from 'styled-components/native';
|
|
6
|
-
import { Wrapper } from './styles'
|
|
7
|
-
|
|
8
|
-
import { PhoneInputParams } from '../../types';
|
|
9
|
-
import { OIcon, OText } from '../shared';
|
|
10
|
-
import { transformCountryCode } from '../../utils'
|
|
11
|
-
|
|
12
|
-
export const PhoneInputNumber = (props: PhoneInputParams) => {
|
|
13
|
-
const {
|
|
14
|
-
data,
|
|
15
|
-
handleData,
|
|
16
|
-
defaultValue,
|
|
17
|
-
defaultCode,
|
|
18
|
-
forwardRef,
|
|
19
|
-
textInputProps,
|
|
20
|
-
boxStyle,
|
|
21
|
-
inputStyle,
|
|
22
|
-
textStyle,
|
|
23
|
-
flagStyle,
|
|
24
|
-
noDropIcon
|
|
25
|
-
} = props
|
|
26
|
-
|
|
27
|
-
const theme = useTheme();
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
const style = StyleSheet.create({
|
|
31
|
-
input: {
|
|
32
|
-
backgroundColor: theme.colors.white,
|
|
33
|
-
borderRadius: 7.6,
|
|
34
|
-
borderWidth: 1,
|
|
35
|
-
borderColor: theme.colors.border,
|
|
36
|
-
paddingBottom: 0,
|
|
37
|
-
paddingTop: 0,
|
|
38
|
-
flexGrow: 1,
|
|
39
|
-
flex: 1,
|
|
40
|
-
height: 50,
|
|
41
|
-
},
|
|
42
|
-
countryBtn: {
|
|
43
|
-
borderWidth: 1,
|
|
44
|
-
borderColor: theme.colors.border,
|
|
45
|
-
borderRadius: 7.6,
|
|
46
|
-
marginEnd: 9,
|
|
47
|
-
}
|
|
48
|
-
})
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
const [, t] = useLanguage()
|
|
52
|
-
const [{ configs }] = useConfig()
|
|
53
|
-
const phoneInput = useRef<PhoneInput>(null);
|
|
54
|
-
const [userphoneNumber, setUserphoneNumber] = useState('');
|
|
55
|
-
|
|
56
|
-
const handleChangeNumber = (number: any) => {
|
|
57
|
-
setUserphoneNumber(number)
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
useEffect(() => {
|
|
61
|
-
if ((defaultValue && userphoneNumber) || defaultValue === undefined || defaultValue === '') {
|
|
62
|
-
if (userphoneNumber) {
|
|
63
|
-
const checkValid = phoneInput.current?.isValidNumber(userphoneNumber);
|
|
64
|
-
const callingCode = phoneInput.current?.getCallingCode();
|
|
65
|
-
const formattedNumber = phoneInput.current?.getNumberAfterPossiblyEliminatingZero();
|
|
66
|
-
const regex = /^[0-9]*$/
|
|
67
|
-
const cellphone = userphoneNumber.slice(0, 0) + userphoneNumber.slice(1, userphoneNumber.length)
|
|
68
|
-
const validNumber = regex.test(cellphone)
|
|
69
|
-
if ((!checkValid && formattedNumber?.number) || !validNumber) {
|
|
70
|
-
handleData && handleData({
|
|
71
|
-
...data,
|
|
72
|
-
error: t('INVALID_ERROR_PHONE_NUMBER', 'The Phone Number field is invalid')
|
|
73
|
-
})
|
|
74
|
-
return
|
|
75
|
-
}
|
|
76
|
-
handleData && handleData({
|
|
77
|
-
...data,
|
|
78
|
-
error: '',
|
|
79
|
-
phone: {
|
|
80
|
-
country_phone_code: callingCode,
|
|
81
|
-
cellphone: formattedNumber?.number
|
|
82
|
-
}
|
|
83
|
-
})
|
|
84
|
-
} else {
|
|
85
|
-
handleData && handleData({
|
|
86
|
-
...data,
|
|
87
|
-
error: '',
|
|
88
|
-
phone: {
|
|
89
|
-
country_phone_code: null,
|
|
90
|
-
cellphone: null
|
|
91
|
-
}
|
|
92
|
-
})
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
}, [userphoneNumber])
|
|
96
|
-
|
|
97
|
-
return (
|
|
98
|
-
<Wrapper>
|
|
99
|
-
<PhoneInput
|
|
100
|
-
ref={phoneInput}
|
|
101
|
-
defaultValue={userphoneNumber || defaultValue}
|
|
102
|
-
defaultCode={defaultCode ? transformCountryCode(defaultCode) : configs?.default_country_code?.value}
|
|
103
|
-
onChangeFormattedText={(text: string) => handleChangeNumber(text)}
|
|
104
|
-
withDarkTheme
|
|
105
|
-
countryPickerProps={{ withAlphaFilter: true }}
|
|
106
|
-
textContainerStyle={{ ...style.input, ...inputStyle ? inputStyle : {} }}
|
|
107
|
-
textInputStyle={textStyle}
|
|
108
|
-
codeTextStyle={textStyle}
|
|
109
|
-
flagButtonStyle={flagStyle}
|
|
110
|
-
countryPickerButtonStyle={{ ...style.countryBtn, ...boxStyle ? boxStyle : {} }}
|
|
111
|
-
placeholder={t('PHONE_NUMBER', 'Phone Number')}
|
|
112
|
-
textInputProps={{ autoCompleteType: 'tel', ref: forwardRef, ...textInputProps }}
|
|
113
|
-
containerStyle={{ width: '100%' }}
|
|
114
|
-
renderDropdownImage={noDropIcon ? <View /> : <OIcon src={theme.images.general.arrow_down} width={13} color={'#B1BCCC'}></OIcon>}
|
|
115
|
-
/>
|
|
116
|
-
{!!data?.error && (
|
|
117
|
-
<OText
|
|
118
|
-
size={16}
|
|
119
|
-
color={theme.colors.error}
|
|
120
|
-
style={{ textAlign: 'center', marginTop: 5 }}
|
|
121
|
-
>
|
|
122
|
-
{data.error}
|
|
123
|
-
</OText>
|
|
124
|
-
)}
|
|
125
|
-
</Wrapper>
|
|
126
|
-
)
|
|
127
|
-
}
|