ordering-ui-react-native 0.16.38 → 0.16.41
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/src/components/LoginForm/index.tsx +15 -0
- package/src/components/OrderDetails/index.tsx +2 -20
- package/src/components/PaymentOptions/index.tsx +66 -49
- package/src/components/SignupForm/index.tsx +15 -0
- package/themes/original/src/components/BusinessBasicInformation/index.tsx +61 -48
- package/themes/original/src/components/BusinessReviews/index.tsx +6 -1
- package/themes/original/src/components/Cart/index.tsx +1 -1
- package/themes/original/src/components/Favorite/index.tsx +1 -0
- package/themes/original/src/components/FavoriteList/index.tsx +13 -2
- package/themes/original/src/components/OrderSummary/index.tsx +1 -1
- package/themes/original/src/components/PaymentOptions/index.tsx +41 -22
- package/themes/original/src/components/SignupForm/index.tsx +26 -17
- package/themes/original/src/components/StripeElementsForm/index.tsx +6 -6
- package/themes/original/src/types/index.tsx +1 -1
- package/themes/original/src/utils/index.tsx +66 -0
package/package.json
CHANGED
|
@@ -165,6 +165,12 @@ const LoginFormUI = (props: LoginParams) => {
|
|
|
165
165
|
|
|
166
166
|
const handleOpenRecaptcha = () => {
|
|
167
167
|
setRecaptchaVerified(false)
|
|
168
|
+
|
|
169
|
+
if (recaptchaVerified) {
|
|
170
|
+
handleReCaptcha && handleReCaptcha('')
|
|
171
|
+
return
|
|
172
|
+
}
|
|
173
|
+
|
|
168
174
|
if (!recaptchaConfig?.siteKey) {
|
|
169
175
|
showToast(ToastType.Error, t('NO_RECAPTCHA_SITE_KEY', 'The config doesn\'t have recaptcha site key'));
|
|
170
176
|
return
|
|
@@ -385,6 +391,15 @@ const LoginFormUI = (props: LoginParams) => {
|
|
|
385
391
|
baseUrl={recaptchaConfig?.baseUrl}
|
|
386
392
|
onVerify={onRecaptchaVerify}
|
|
387
393
|
onExpire={() => setRecaptchaVerified(false)}
|
|
394
|
+
footerComponent={<OButton
|
|
395
|
+
onClick={() => recaptchaRef.current.close()}
|
|
396
|
+
style={{ borderRadius: 0 }}
|
|
397
|
+
text={t('CLOSE', 'Close')}
|
|
398
|
+
bgColor={theme.colors.primary}
|
|
399
|
+
borderColor={theme.colors.primary}
|
|
400
|
+
textStyle={{ color: 'white' }}
|
|
401
|
+
imgRightSrc={null}
|
|
402
|
+
/>}
|
|
388
403
|
/>
|
|
389
404
|
</>
|
|
390
405
|
)}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import React, { useState, useEffect
|
|
2
|
-
import { View, StyleSheet, BackHandler, TouchableOpacity, I18nManager
|
|
1
|
+
import React, { useState, useEffect } from 'react'
|
|
2
|
+
import { View, StyleSheet, BackHandler, TouchableOpacity, I18nManager } from 'react-native'
|
|
3
3
|
import LinearGradient from 'react-native-linear-gradient'
|
|
4
4
|
import { Fade, Placeholder, PlaceholderLine } from 'rn-placeholder';
|
|
5
5
|
import MaterialCommunityIcon from 'react-native-vector-icons/MaterialCommunityIcons'
|
|
@@ -109,7 +109,6 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
109
109
|
const [isReviewed, setIsReviewed] = useState(false)
|
|
110
110
|
const [openOrderCreating, setOpenOrderCreating] = useState(false)
|
|
111
111
|
const [openTaxModal, setOpenTaxModal] = useState<any>({ open: false, tax: null, type: '' })
|
|
112
|
-
const appState = useRef(AppState.currentState)
|
|
113
112
|
|
|
114
113
|
const { order, loading, businessData, error } = props.order
|
|
115
114
|
|
|
@@ -259,23 +258,6 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
259
258
|
})
|
|
260
259
|
}, [])
|
|
261
260
|
|
|
262
|
-
useEffect(() => {
|
|
263
|
-
const onFocusApp = (nextAppState: any) => {
|
|
264
|
-
if (
|
|
265
|
-
appState.current.match(/inactive|background/) &&
|
|
266
|
-
nextAppState === "active"
|
|
267
|
-
) {
|
|
268
|
-
getOrder && getOrder()
|
|
269
|
-
}
|
|
270
|
-
appState.current = nextAppState;
|
|
271
|
-
}
|
|
272
|
-
|
|
273
|
-
AppState.addEventListener("change", onFocusApp);
|
|
274
|
-
return () => {
|
|
275
|
-
AppState.removeEventListener('change', onFocusApp);
|
|
276
|
-
};
|
|
277
|
-
}, [])
|
|
278
|
-
|
|
279
261
|
return (
|
|
280
262
|
<OrderDetailsContainer keyboardShouldPersistTaps='handled'>
|
|
281
263
|
{order && order?.id && !error && !loading && (
|
|
@@ -89,6 +89,8 @@ const PaymentOptionsUI = (props: any) => {
|
|
|
89
89
|
return theme.images.general.stripes
|
|
90
90
|
case 'stripe_redirect':
|
|
91
91
|
return theme.images.general.stripesb
|
|
92
|
+
case 'apple_pay':
|
|
93
|
+
return theme.images.general.applePayMark
|
|
92
94
|
default:
|
|
93
95
|
return theme.images.general.creditCard
|
|
94
96
|
}
|
|
@@ -97,7 +99,7 @@ const PaymentOptionsUI = (props: any) => {
|
|
|
97
99
|
const handlePaymentMethodClick = (paymethod: any) => {
|
|
98
100
|
const isPopupMethod = ['stripe', 'stripe_direct', 'stripe_connect', 'stripe_redirect', 'paypal', 'square'].includes(paymethod?.gateway)
|
|
99
101
|
handlePaymethodClick(paymethod, isPopupMethod)
|
|
100
|
-
|
|
102
|
+
if (webViewPaymentGateway.includes(paymethod?.gateway)) {
|
|
101
103
|
handlePaymentMethodClickCustom(paymethod)
|
|
102
104
|
}
|
|
103
105
|
setCardData(paymethodData)
|
|
@@ -130,29 +132,44 @@ const PaymentOptionsUI = (props: any) => {
|
|
|
130
132
|
|
|
131
133
|
const renderPaymethods = ({ item }: any) => {
|
|
132
134
|
return (
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
key={item.id}
|
|
138
|
-
isDisabled={isDisabled}
|
|
139
|
-
isActive={paymethodSelected?.id === item.id}
|
|
140
|
-
>
|
|
141
|
-
<OIcon
|
|
142
|
-
src={getPayIcon(item.gateway)}
|
|
143
|
-
width={40}
|
|
144
|
-
height={40}
|
|
145
|
-
color={paymethodSelected?.id === item.id ? theme.colors.white : theme.colors.backgroundDark}
|
|
146
|
-
/>
|
|
147
|
-
<OText
|
|
148
|
-
size={12}
|
|
149
|
-
style={{ margin: 0 }}
|
|
150
|
-
color={paymethodSelected?.id === item.id ? theme.colors.white : '#000'}
|
|
135
|
+
<>
|
|
136
|
+
{item?.gateway === 'apple_pay' ? (
|
|
137
|
+
<TouchableOpacity
|
|
138
|
+
onPress={() => handlePaymentMethodClick(item)}
|
|
151
139
|
>
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
140
|
+
<OIcon
|
|
141
|
+
src={getPayIcon(item.gateway)}
|
|
142
|
+
width={120}
|
|
143
|
+
height={100}
|
|
144
|
+
style={{ marginRight: 10 }}
|
|
145
|
+
/>
|
|
146
|
+
</TouchableOpacity>
|
|
147
|
+
) : (
|
|
148
|
+
<TouchableOpacity
|
|
149
|
+
onPress={() => handlePaymentMethodClick(item)}
|
|
150
|
+
>
|
|
151
|
+
<PMItem
|
|
152
|
+
key={item.id}
|
|
153
|
+
isDisabled={isDisabled}
|
|
154
|
+
isActive={paymethodSelected?.id === item.id}
|
|
155
|
+
>
|
|
156
|
+
<OIcon
|
|
157
|
+
src={getPayIcon(item.gateway)}
|
|
158
|
+
width={40}
|
|
159
|
+
height={40}
|
|
160
|
+
color={paymethodSelected?.id === item.id ? theme.colors.white : theme.colors.backgroundDark}
|
|
161
|
+
/>
|
|
162
|
+
<OText
|
|
163
|
+
size={12}
|
|
164
|
+
style={{ margin: 0 }}
|
|
165
|
+
color={paymethodSelected?.id === item.id ? theme.colors.white : '#000'}
|
|
166
|
+
>
|
|
167
|
+
{t(item.gateway.toUpperCase(), item.name)}
|
|
168
|
+
</OText>
|
|
169
|
+
</PMItem>
|
|
170
|
+
</TouchableOpacity>
|
|
171
|
+
)}
|
|
172
|
+
</>
|
|
156
173
|
)
|
|
157
174
|
}
|
|
158
175
|
|
|
@@ -213,31 +230,31 @@ const PaymentOptionsUI = (props: any) => {
|
|
|
213
230
|
{stripeOptions.includes(paymethodSelected?.gateway) &&
|
|
214
231
|
(paymethodData?.brand || paymethodData?.card?.brand) &&
|
|
215
232
|
(paymethodData?.last4 || paymethodData?.card?.last4) &&
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
233
|
+
(
|
|
234
|
+
<PMCardSelected>
|
|
235
|
+
<PMCardItemContent>
|
|
236
|
+
<View style={styles.viewStyle}>
|
|
237
|
+
<MaterialCommunityIcons
|
|
238
|
+
name='radiobox-marked'
|
|
239
|
+
size={24}
|
|
240
|
+
color={theme.colors.primary}
|
|
241
|
+
/>
|
|
242
|
+
</View>
|
|
243
|
+
<View style={styles.viewStyle}>
|
|
244
|
+
<OText>
|
|
245
|
+
{getIconCard((paymethodData?.brand || paymethodData?.card?.brand), 26)}
|
|
246
|
+
</OText>
|
|
247
|
+
</View>
|
|
248
|
+
<View style={styles.viewStyle}>
|
|
249
|
+
<OText
|
|
250
|
+
size={20}
|
|
251
|
+
>
|
|
252
|
+
XXXX-XXXX-XXXX-{(paymethodData?.last4 || paymethodData?.card?.last4)}
|
|
253
|
+
</OText>
|
|
254
|
+
</View>
|
|
255
|
+
</PMCardItemContent>
|
|
256
|
+
</PMCardSelected>
|
|
257
|
+
)}
|
|
241
258
|
|
|
242
259
|
{/* Stripe */}
|
|
243
260
|
{isOpenMethod?.paymethod?.gateway === 'stripe' && !paymethodData?.id && (
|
|
@@ -317,7 +334,7 @@ const PaymentOptionsUI = (props: any) => {
|
|
|
317
334
|
bgColor={theme.colors.primary}
|
|
318
335
|
borderColor={theme.colors.primary}
|
|
319
336
|
style={styles.btnAddStyle}
|
|
320
|
-
textStyle={{color: 'white'}}
|
|
337
|
+
textStyle={{ color: 'white' }}
|
|
321
338
|
imgRightSrc={null}
|
|
322
339
|
onClick={() => setAddCardOpen({ ...addCardOpen, stripeConnect: true })}
|
|
323
340
|
/>
|
|
@@ -245,6 +245,12 @@ const SignupFormUI = (props: SignupParams) => {
|
|
|
245
245
|
|
|
246
246
|
const handleOpenRecaptcha = () => {
|
|
247
247
|
setRecaptchaVerified(false)
|
|
248
|
+
|
|
249
|
+
if (recaptchaVerified) {
|
|
250
|
+
handleReCaptcha && handleReCaptcha('')
|
|
251
|
+
return
|
|
252
|
+
}
|
|
253
|
+
|
|
248
254
|
if (!recaptchaConfig?.siteKey) {
|
|
249
255
|
showToast(ToastType.Error, t('NO_RECAPTCHA_SITE_KEY', 'The config doesn\'t have recaptcha site key'));
|
|
250
256
|
return
|
|
@@ -555,6 +561,15 @@ const SignupFormUI = (props: SignupParams) => {
|
|
|
555
561
|
baseUrl={recaptchaConfig?.baseUrl}
|
|
556
562
|
onVerify={onRecaptchaVerify}
|
|
557
563
|
onExpire={() => setRecaptchaVerified(false)}
|
|
564
|
+
footerComponent={<OButton
|
|
565
|
+
onClick={() => recaptchaRef.current.close()}
|
|
566
|
+
style={{ borderRadius: 0 }}
|
|
567
|
+
text={t('CLOSE', 'Close')}
|
|
568
|
+
bgColor={theme.colors.primary}
|
|
569
|
+
borderColor={theme.colors.primary}
|
|
570
|
+
textStyle={{ color: 'white' }}
|
|
571
|
+
imgRightSrc={null}
|
|
572
|
+
/>}
|
|
558
573
|
/>
|
|
559
574
|
</>
|
|
560
575
|
)}
|
|
@@ -94,7 +94,8 @@ export const BusinessBasicInformation = (
|
|
|
94
94
|
height: 20,
|
|
95
95
|
justifyContent: 'center',
|
|
96
96
|
alignItems: 'center',
|
|
97
|
-
|
|
97
|
+
marginRight: 5,
|
|
98
|
+
marginBottom: 7
|
|
98
99
|
},
|
|
99
100
|
tiktokIcon: {
|
|
100
101
|
height: 12,
|
|
@@ -238,53 +239,6 @@ export const BusinessBasicInformation = (
|
|
|
238
239
|
</OText>
|
|
239
240
|
</RibbonBox>
|
|
240
241
|
)}
|
|
241
|
-
<SocialListWrapper
|
|
242
|
-
showsVerticalScrollIndicator={false}
|
|
243
|
-
showsHorizontalScrollIndicator={false}
|
|
244
|
-
horizontal
|
|
245
|
-
contentContainerStyle={{ flex: 1, justifyContent: 'flex-end'}}
|
|
246
|
-
>
|
|
247
|
-
{!!business?.facebook_profile && (
|
|
248
|
-
<SocialNetWork
|
|
249
|
-
socialLink={business?.facebook_profile}
|
|
250
|
-
iconTitle='facebook'
|
|
251
|
-
/>
|
|
252
|
-
)}
|
|
253
|
-
{!!business?.instagram_profile && (
|
|
254
|
-
<SocialNetWork
|
|
255
|
-
socialLink={business?.instagram_profile}
|
|
256
|
-
iconTitle='instagram'
|
|
257
|
-
/>
|
|
258
|
-
)}
|
|
259
|
-
{!!business?.tiktok_profile && (
|
|
260
|
-
<TouchableOpacity style={styles.socialIcon} onPress={() => Linking.openURL(business?.tiktok_profile)}>
|
|
261
|
-
<View style={styles.tiktokIcon}>
|
|
262
|
-
<OIcon
|
|
263
|
-
src={theme.images.general.tiktok}
|
|
264
|
-
style={{ width: '100%', height: '100%'}}
|
|
265
|
-
/>
|
|
266
|
-
</View>
|
|
267
|
-
</TouchableOpacity>
|
|
268
|
-
)}
|
|
269
|
-
{!!business?.pinterest_profile && (
|
|
270
|
-
<SocialNetWork
|
|
271
|
-
socialLink={business?.pinterest_profile}
|
|
272
|
-
iconTitle='pinterest'
|
|
273
|
-
/>
|
|
274
|
-
)}
|
|
275
|
-
{!!business?.whatsapp_number && (
|
|
276
|
-
<SocialNetWork
|
|
277
|
-
socialLink={business?.whatsapp_number}
|
|
278
|
-
iconTitle='whatsapp'
|
|
279
|
-
/>
|
|
280
|
-
)}
|
|
281
|
-
{!!business?.snapchat_profile && (
|
|
282
|
-
<SocialNetWork
|
|
283
|
-
socialLink={business?.snapchat_profile}
|
|
284
|
-
iconTitle='snapchat'
|
|
285
|
-
/>
|
|
286
|
-
)}
|
|
287
|
-
</SocialListWrapper>
|
|
288
242
|
</TitleWrapper>
|
|
289
243
|
)}
|
|
290
244
|
</BusinessInfoItem>
|
|
@@ -297,6 +251,65 @@ export const BusinessBasicInformation = (
|
|
|
297
251
|
<OText color={theme.colors.textNormal}>{getBusinessType()}</OText>
|
|
298
252
|
</View>
|
|
299
253
|
)}
|
|
254
|
+
{loading ? (
|
|
255
|
+
<Placeholder Animation={Fade}>
|
|
256
|
+
<View style={{ flexDirection: 'row' }}>
|
|
257
|
+
{[...Array(5).keys()].map(i => (
|
|
258
|
+
<View style={styles.socialIcon} key={i}>
|
|
259
|
+
<PlaceholderLine width={100} height={20} style={{ marginBottom: 0 }} />
|
|
260
|
+
</View>
|
|
261
|
+
))}
|
|
262
|
+
</View>
|
|
263
|
+
</Placeholder>
|
|
264
|
+
) : (
|
|
265
|
+
<SocialListWrapper
|
|
266
|
+
showsVerticalScrollIndicator={false}
|
|
267
|
+
showsHorizontalScrollIndicator={false}
|
|
268
|
+
horizontal
|
|
269
|
+
contentContainerStyle={{ flex: 1}}
|
|
270
|
+
>
|
|
271
|
+
{!!business?.facebook_profile && (
|
|
272
|
+
<SocialNetWork
|
|
273
|
+
socialLink={business?.facebook_profile}
|
|
274
|
+
iconTitle='facebook'
|
|
275
|
+
/>
|
|
276
|
+
)}
|
|
277
|
+
{!!business?.instagram_profile && (
|
|
278
|
+
<SocialNetWork
|
|
279
|
+
socialLink={business?.instagram_profile}
|
|
280
|
+
iconTitle='instagram'
|
|
281
|
+
/>
|
|
282
|
+
)}
|
|
283
|
+
{!!business?.tiktok_profile && (
|
|
284
|
+
<TouchableOpacity style={styles.socialIcon} onPress={() => Linking.openURL(business?.tiktok_profile)}>
|
|
285
|
+
<View style={styles.tiktokIcon}>
|
|
286
|
+
<OIcon
|
|
287
|
+
src={theme.images.general.tiktok}
|
|
288
|
+
style={{ width: '100%', height: '100%'}}
|
|
289
|
+
/>
|
|
290
|
+
</View>
|
|
291
|
+
</TouchableOpacity>
|
|
292
|
+
)}
|
|
293
|
+
{!!business?.pinterest_profile && (
|
|
294
|
+
<SocialNetWork
|
|
295
|
+
socialLink={business?.pinterest_profile}
|
|
296
|
+
iconTitle='pinterest'
|
|
297
|
+
/>
|
|
298
|
+
)}
|
|
299
|
+
{!!business?.whatsapp_number && (
|
|
300
|
+
<SocialNetWork
|
|
301
|
+
socialLink={business?.whatsapp_number}
|
|
302
|
+
iconTitle='whatsapp'
|
|
303
|
+
/>
|
|
304
|
+
)}
|
|
305
|
+
{!!business?.snapchat_profile && (
|
|
306
|
+
<SocialNetWork
|
|
307
|
+
socialLink={business?.snapchat_profile}
|
|
308
|
+
iconTitle='snapchat'
|
|
309
|
+
/>
|
|
310
|
+
)}
|
|
311
|
+
</SocialListWrapper>
|
|
312
|
+
)}
|
|
300
313
|
<View>
|
|
301
314
|
<BusinessInfoItem>
|
|
302
315
|
{loading && (
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useState } from 'react';
|
|
1
|
+
import React, { useEffect, useState } from 'react';
|
|
2
2
|
import {
|
|
3
3
|
BusinessReviews as BusinessReviewController,
|
|
4
4
|
useLanguage,
|
|
@@ -22,6 +22,7 @@ import {
|
|
|
22
22
|
import { BusinessReviewsParams } from '../../types';
|
|
23
23
|
import { ProgressBar, TouchableRipple } from 'react-native-paper';
|
|
24
24
|
import moment from 'moment';
|
|
25
|
+
import { setLocalMoment } from '../../utils';
|
|
25
26
|
|
|
26
27
|
const BusinessReviewsUI = (props: BusinessReviewsParams) => {
|
|
27
28
|
const { businessState, reviewsList } = props;
|
|
@@ -99,6 +100,10 @@ const BusinessReviewsUI = (props: BusinessReviewsParams) => {
|
|
|
99
100
|
</View>
|
|
100
101
|
);
|
|
101
102
|
|
|
103
|
+
useEffect(() => {
|
|
104
|
+
setLocalMoment(moment, t)
|
|
105
|
+
}, [])
|
|
106
|
+
|
|
102
107
|
return (
|
|
103
108
|
<BusinessReviewsContainer>
|
|
104
109
|
<BusinessReviewContent
|
|
@@ -361,7 +361,7 @@ const CartUI = (props: any) => {
|
|
|
361
361
|
{t('TOTAL', 'Total')}
|
|
362
362
|
</OText>
|
|
363
363
|
<OText size={14} lineHeight={21} weight={'600'}>
|
|
364
|
-
{parsePrice(cart?.
|
|
364
|
+
{parsePrice(cart?.balance >= 0 ? cart?.balance : 0)}
|
|
365
365
|
</OText>
|
|
366
366
|
</OSTable>
|
|
367
367
|
</OSTotal>
|
|
@@ -73,6 +73,17 @@ const FavoriteListUI = (props: FavoriteParams) => {
|
|
|
73
73
|
return objectStatus && objectStatus
|
|
74
74
|
}
|
|
75
75
|
|
|
76
|
+
const onProductClick = (product: any) => {
|
|
77
|
+
const categoryId = product?.category?.id
|
|
78
|
+
const businessId = product?.category?.business?.id
|
|
79
|
+
if (!categoryId || !businessId) return
|
|
80
|
+
onNavigationRedirect && onNavigationRedirect('ProductDetails', {
|
|
81
|
+
productId: product?.id,
|
|
82
|
+
categoryId: categoryId,
|
|
83
|
+
businessId: businessId
|
|
84
|
+
})
|
|
85
|
+
}
|
|
86
|
+
|
|
76
87
|
useEffect(() => {
|
|
77
88
|
const _businessId = 'businessId:' + reorderState?.result?.business_id
|
|
78
89
|
if (reorderState?.error) {
|
|
@@ -248,9 +259,9 @@ const FavoriteListUI = (props: FavoriteParams) => {
|
|
|
248
259
|
favoriteList.favorites?.sort((a: any, b: any) => a?.name?.toLowerCase() > b?.name?.toLowerCase()).map((product: any, i: number) => (
|
|
249
260
|
<SingleProductCard
|
|
250
261
|
key={`${product?.id}_${i}`}
|
|
251
|
-
isSoldOut={product
|
|
262
|
+
isSoldOut={product?.inventoried && !product?.quantity}
|
|
252
263
|
product={product}
|
|
253
|
-
onProductClick={
|
|
264
|
+
onProductClick={onProductClick}
|
|
254
265
|
handleUpdateProducts={handleUpdateFavoriteList}
|
|
255
266
|
/>
|
|
256
267
|
))
|
|
@@ -299,7 +299,7 @@ const OrderSummaryUI = (props: any) => {
|
|
|
299
299
|
{t('TOTAL', 'Total')}
|
|
300
300
|
</OText>
|
|
301
301
|
<OText size={14} style={{ fontWeight: 'bold' }} >
|
|
302
|
-
{parsePrice(cart?.
|
|
302
|
+
{parsePrice(cart?.balance >= 0 ? cart?.balance : 0)}
|
|
303
303
|
</OText>
|
|
304
304
|
</OSTable>
|
|
305
305
|
</View>
|
|
@@ -82,6 +82,8 @@ const PaymentOptionsUI = (props: any) => {
|
|
|
82
82
|
return theme.images.general.stripes
|
|
83
83
|
case 'stripe_redirect':
|
|
84
84
|
return theme.images.general.stripesb
|
|
85
|
+
case 'apple_pay':
|
|
86
|
+
return theme.images.general.applePayMark
|
|
85
87
|
default:
|
|
86
88
|
return theme.images.general.creditCard
|
|
87
89
|
}
|
|
@@ -142,29 +144,46 @@ const PaymentOptionsUI = (props: any) => {
|
|
|
142
144
|
|
|
143
145
|
const renderPaymethods = ({ item }: any) => {
|
|
144
146
|
return (
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
key={item.id}
|
|
150
|
-
isDisabled={isDisabled}
|
|
151
|
-
isActive={paymethodSelected?.id === item.id}
|
|
152
|
-
>
|
|
153
|
-
<OIcon
|
|
154
|
-
src={getPayIcon(item.gateway)}
|
|
155
|
-
width={20}
|
|
156
|
-
height={20}
|
|
157
|
-
color={paymethodSelected?.id === item.id ? theme.colors.white : theme.colors.backgroundDark}
|
|
158
|
-
/>
|
|
159
|
-
<OText
|
|
160
|
-
size={10}
|
|
161
|
-
style={{ margin: 0, marginTop: 4 }}
|
|
162
|
-
color={paymethodSelected?.id === item.id ? theme.colors.white : '#000'}
|
|
147
|
+
<>
|
|
148
|
+
{item?.gateway === 'apple_pay' ? (
|
|
149
|
+
<TouchableOpacity
|
|
150
|
+
onPress={() => handlePaymentMethodClick(item)}
|
|
163
151
|
>
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
152
|
+
<OIcon
|
|
153
|
+
src={getPayIcon(item.gateway)}
|
|
154
|
+
width={70}
|
|
155
|
+
height={70}
|
|
156
|
+
style={{ marginRight: 10 }}
|
|
157
|
+
/>
|
|
158
|
+
</TouchableOpacity>
|
|
159
|
+
) : (
|
|
160
|
+
<TouchableOpacity
|
|
161
|
+
onPress={() => handlePaymentMethodClick(item)}
|
|
162
|
+
>
|
|
163
|
+
{console.log(item?.gateway)}
|
|
164
|
+
<PMItem
|
|
165
|
+
key={item.id}
|
|
166
|
+
isDisabled={isDisabled}
|
|
167
|
+
isActive={paymethodSelected?.id === item.id}
|
|
168
|
+
>
|
|
169
|
+
<OIcon
|
|
170
|
+
src={getPayIcon(item.gateway)}
|
|
171
|
+
width={20}
|
|
172
|
+
height={20}
|
|
173
|
+
color={item?.gateway === 'apple_pay' ? '' : paymethodSelected?.id === item.id ? theme.colors.white : theme.colors.backgroundDark}
|
|
174
|
+
/>
|
|
175
|
+
<OText
|
|
176
|
+
size={10}
|
|
177
|
+
style={{ margin: 0, marginTop: 4 }}
|
|
178
|
+
color={paymethodSelected?.id === item.id ? theme.colors.white : '#000'}
|
|
179
|
+
>
|
|
180
|
+
{t(item.gateway.toUpperCase(), item.name)}
|
|
181
|
+
</OText>
|
|
182
|
+
</PMItem>
|
|
183
|
+
</TouchableOpacity>
|
|
184
|
+
)}
|
|
185
|
+
</>
|
|
186
|
+
|
|
168
187
|
)
|
|
169
188
|
}
|
|
170
189
|
|
|
@@ -78,7 +78,6 @@ const SignupFormUI = (props: SignupParams) => {
|
|
|
78
78
|
handleChangeInput,
|
|
79
79
|
willVerifyOtpState,
|
|
80
80
|
setOtpState,
|
|
81
|
-
otpState,
|
|
82
81
|
setSignUpTab,
|
|
83
82
|
signUpTab,
|
|
84
83
|
useSignUpFullDetails,
|
|
@@ -120,10 +119,9 @@ const SignupFormUI = (props: SignupParams) => {
|
|
|
120
119
|
const [, t] = useLanguage();
|
|
121
120
|
const [, { login }] = useSession();
|
|
122
121
|
const [{ configs }] = useConfig();
|
|
123
|
-
const { control, handleSubmit, errors, register, setValue } = useForm();
|
|
122
|
+
const { control, handleSubmit, clearErrors, errors, register, unregister, setValue } = useForm();
|
|
124
123
|
|
|
125
124
|
const [passwordSee, setPasswordSee] = useState(false);
|
|
126
|
-
const [otpErrMsg, setOtpErrMsg] = useState('')
|
|
127
125
|
const [formValues, setFormValues] = useState(null);
|
|
128
126
|
const [isModalVisible, setIsModalVisible] = useState(false);
|
|
129
127
|
const [isLoadingVerifyModal, setIsLoadingVerifyModal] = useState(false);
|
|
@@ -238,6 +236,11 @@ const SignupFormUI = (props: SignupParams) => {
|
|
|
238
236
|
navigation.navigate('Home');
|
|
239
237
|
};
|
|
240
238
|
|
|
239
|
+
const handleSignUpTab = (tab: string) => {
|
|
240
|
+
setSignUpTab && setSignUpTab(tab)
|
|
241
|
+
clearErrors()
|
|
242
|
+
}
|
|
243
|
+
|
|
241
244
|
const onSubmit = (values?: any) => {
|
|
242
245
|
if (phoneInputData.error && signUpTab !== 'otpEmail') {
|
|
243
246
|
showToast(ToastType.Error, phoneInputData.error);
|
|
@@ -344,7 +347,7 @@ const SignupFormUI = (props: SignupParams) => {
|
|
|
344
347
|
|
|
345
348
|
const onRecaptchaVerify = (token: any) => {
|
|
346
349
|
setRecaptchaVerified(true)
|
|
347
|
-
handleReCaptcha(token)
|
|
350
|
+
handleReCaptcha && handleReCaptcha(token)
|
|
348
351
|
}
|
|
349
352
|
|
|
350
353
|
useEffect(() => {
|
|
@@ -368,15 +371,19 @@ const SignupFormUI = (props: SignupParams) => {
|
|
|
368
371
|
if (Object.keys(errors).length > 0) {
|
|
369
372
|
setIsLoadingVerifyModal(false);
|
|
370
373
|
}
|
|
371
|
-
}, [errors])
|
|
374
|
+
}, [errors])
|
|
372
375
|
|
|
373
376
|
useEffect(() => {
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
377
|
+
if (signUpTab === 'default' || signUpTab === 'otpCellphone') {
|
|
378
|
+
register('cellphone', {
|
|
379
|
+
required: isRequiredField('cellphone')
|
|
380
|
+
? t('VALIDATION_ERROR_MOBILE_PHONE_REQUIRED', 'The field Mobile phone is required').replace('_attribute_', t('CELLPHONE', 'Cellphone'))
|
|
381
|
+
: null
|
|
382
|
+
})
|
|
383
|
+
} else {
|
|
384
|
+
unregister('cellphone')
|
|
385
|
+
}
|
|
386
|
+
}, [signUpTab])
|
|
380
387
|
|
|
381
388
|
useEffect(() => {
|
|
382
389
|
if (phoneInputData?.phone?.cellphone) setValue('cellphone', phoneInputData?.phone?.cellphone, '')
|
|
@@ -415,9 +422,11 @@ const SignupFormUI = (props: SignupParams) => {
|
|
|
415
422
|
|
|
416
423
|
useEffect(() => {
|
|
417
424
|
if (checkPhoneCodeState?.result?.error) {
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
425
|
+
setAlertState({
|
|
426
|
+
open: true,
|
|
427
|
+
title: (typeof checkPhoneCodeState?.result?.result === 'string' ? checkPhoneCodeState?.result?.result : checkPhoneCodeState?.result?.result[0].toString()) || t('ERROR', 'Error'),
|
|
428
|
+
content: []
|
|
429
|
+
})
|
|
421
430
|
}
|
|
422
431
|
}, [checkPhoneCodeState])
|
|
423
432
|
|
|
@@ -442,7 +451,7 @@ const SignupFormUI = (props: SignupParams) => {
|
|
|
442
451
|
ref={tabsRef}
|
|
443
452
|
>
|
|
444
453
|
<TabBtn
|
|
445
|
-
onPress={() =>
|
|
454
|
+
onPress={() => handleSignUpTab('default')}
|
|
446
455
|
onLayout={(event: any) => handleOnLayout(event, 'default')}
|
|
447
456
|
>
|
|
448
457
|
<OTab
|
|
@@ -466,7 +475,7 @@ const SignupFormUI = (props: SignupParams) => {
|
|
|
466
475
|
</TabBtn>
|
|
467
476
|
{useSignUpOtpEmail && (
|
|
468
477
|
<TabBtn
|
|
469
|
-
onPress={() =>
|
|
478
|
+
onPress={() => handleSignUpTab('otpEmail')}
|
|
470
479
|
onLayout={(event: any) => handleOnLayout(event, 'otpEmail')}
|
|
471
480
|
>
|
|
472
481
|
<OTab
|
|
@@ -492,7 +501,7 @@ const SignupFormUI = (props: SignupParams) => {
|
|
|
492
501
|
)}
|
|
493
502
|
{useSignUpOtpCellphone && (
|
|
494
503
|
<TabBtn
|
|
495
|
-
onPress={() =>
|
|
504
|
+
onPress={() => handleSignUpTab('otpCellphone')}
|
|
496
505
|
onLayout={(event: any) => handleOnLayout(event, 'otpCellphone')}
|
|
497
506
|
>
|
|
498
507
|
<OTab
|
|
@@ -61,13 +61,13 @@ const StripeElementsFormUI = (props: any) => {
|
|
|
61
61
|
}
|
|
62
62
|
|
|
63
63
|
if (user?.address) {
|
|
64
|
-
billingDetails.
|
|
64
|
+
billingDetails.address.line1 = user?.address
|
|
65
65
|
}
|
|
66
66
|
|
|
67
67
|
const createPayMethod = async () => {
|
|
68
|
-
const params: any = {
|
|
68
|
+
const params: any = { paymentMethodType: 'Card', paymentMethodData: {} }
|
|
69
69
|
if (Object.keys(billingDetails).length > 0) {
|
|
70
|
-
params.billingDetails = billingDetails
|
|
70
|
+
params.paymentMethodData.billingDetails = {...billingDetails, token: card?.last4}
|
|
71
71
|
}
|
|
72
72
|
try {
|
|
73
73
|
setCreatePmLoading(true)
|
|
@@ -94,16 +94,16 @@ const StripeElementsFormUI = (props: any) => {
|
|
|
94
94
|
setErrors(error?.message || error?.toString());
|
|
95
95
|
}
|
|
96
96
|
}
|
|
97
|
-
|
|
97
|
+
|
|
98
98
|
const handleSaveCard = async () => {
|
|
99
99
|
setErrors('');
|
|
100
100
|
if (!requirements) {
|
|
101
101
|
createPayMethod();
|
|
102
102
|
return
|
|
103
103
|
}
|
|
104
|
-
const params: any = {
|
|
104
|
+
const params: any = { paymentMethodType: 'Card', paymentMethodData: {} }
|
|
105
105
|
if (Object.keys(billingDetails).length > 0) {
|
|
106
|
-
params.billingDetails = billingDetails
|
|
106
|
+
params.paymentMethodData.billingDetails = {...billingDetails, token: card?.last4}
|
|
107
107
|
}
|
|
108
108
|
try {
|
|
109
109
|
const { setupIntent, error } = await confirmSetupIntent(requirements, params);
|
|
@@ -120,7 +120,7 @@ export interface SignupParams {
|
|
|
120
120
|
handleChangeInput?: (in1: any, in2: any) => void;
|
|
121
121
|
enableReCaptcha?: boolean;
|
|
122
122
|
generateOtpCode?: (in1?: any) => void;
|
|
123
|
-
handleReCaptcha?: () => void;
|
|
123
|
+
handleReCaptcha?: (token?: any) => void;
|
|
124
124
|
setSignUpTab?: (in1: string) => void;
|
|
125
125
|
setWillVerifyOtpState?: (in1: boolean) => void;
|
|
126
126
|
setOtpState?: (in1: string) => void;
|
|
@@ -40,6 +40,72 @@ export const getTraduction = (key: string) => {
|
|
|
40
40
|
return keyList[key] ? t(key, keyList[key]) : t(key)
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
+
/**
|
|
44
|
+
* Change local moment variables
|
|
45
|
+
*/
|
|
46
|
+
export const setLocalMoment = (moment : any, t : any) => {
|
|
47
|
+
moment.locale('custom', {
|
|
48
|
+
months: [
|
|
49
|
+
t('MONTH1','January'),
|
|
50
|
+
t('MONTH2','February'),
|
|
51
|
+
t('MONTH3','March'),
|
|
52
|
+
t('MONTH4','April'),
|
|
53
|
+
t('MONTH5','May'),
|
|
54
|
+
t('MONTH6','June'),
|
|
55
|
+
t('MONTH7','July'),
|
|
56
|
+
t('MONTH8','August'),
|
|
57
|
+
t('MONTH9','September'),
|
|
58
|
+
t('MONTH10','October'),
|
|
59
|
+
t('MONTH11','November'),
|
|
60
|
+
t('MONTH12','December')
|
|
61
|
+
],
|
|
62
|
+
monthsShort: [
|
|
63
|
+
t('MONTHSHORT1','Jan'),
|
|
64
|
+
t('MONTHSHORT2','Feb'),
|
|
65
|
+
t('MONTHSHORT3','Mar'),
|
|
66
|
+
t('MONTHSHORT4','Apr'),
|
|
67
|
+
t('MONTHSHORT5','May'),
|
|
68
|
+
t('MONTHSHORT6','Jun'),
|
|
69
|
+
t('MONTHSHORT7','Jul'),
|
|
70
|
+
t('MONTHSHORT8','Aug'),
|
|
71
|
+
t('MONTHSHORT9','Sep'),
|
|
72
|
+
t('MONTHSHORT10','Oct'),
|
|
73
|
+
t('MONTHSHORT11','Nov'),
|
|
74
|
+
t('MONTHSHORT12','Dec')
|
|
75
|
+
],
|
|
76
|
+
weekdays: [
|
|
77
|
+
t('DAY7','Sunday'),
|
|
78
|
+
t('DAY1','Monday'),
|
|
79
|
+
t('DAY2','Tuesday'),
|
|
80
|
+
t('DAY3','Wednesday'),
|
|
81
|
+
t('DAY4','Thursday'),
|
|
82
|
+
t('DAY5','Friday'),
|
|
83
|
+
t('DAY6','Saturday')
|
|
84
|
+
],
|
|
85
|
+
weekdaysShort: [
|
|
86
|
+
t('DAYSHORT7','Sun'),
|
|
87
|
+
t('DAYSHORT1','Mon'),
|
|
88
|
+
t('DAYSHORT2','Tue'),
|
|
89
|
+
t('DAYSHORT3','Wed'),
|
|
90
|
+
t('DAYSHORT4','Thu'),
|
|
91
|
+
t('DAYSHORT5','Fri'),
|
|
92
|
+
t('DAYSHORT6','Sat')
|
|
93
|
+
],
|
|
94
|
+
weekdaysMin: [
|
|
95
|
+
t('DAYMIN7','Su'),
|
|
96
|
+
t('DAYMIN1','Mo'),
|
|
97
|
+
t('DAYMIN2','Tu'),
|
|
98
|
+
t('DAYMIN3','We'),
|
|
99
|
+
t('DAYMIN4','Th'),
|
|
100
|
+
t('DAYMIN5','Fr'),
|
|
101
|
+
t('DAYMIN6','Sa')
|
|
102
|
+
],
|
|
103
|
+
meridiem : function (hours : any) {
|
|
104
|
+
return hours < 12 ? t('AM', 'AM') : t('PM','PM');
|
|
105
|
+
}
|
|
106
|
+
})
|
|
107
|
+
}
|
|
108
|
+
|
|
43
109
|
/**
|
|
44
110
|
* Function to convert delivery time in minutes
|
|
45
111
|
* @param {string} time business delivery time
|