ordering-ui-react-native 0.14.69 → 0.14.72
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/Checkout/index.tsx +1 -0
- package/src/components/PaymentOptions/index.tsx +15 -6
- package/src/components/ProductForm/index.tsx +1 -1
- package/src/components/StripeElementsForm/index.tsx +48 -27
- package/src/components/StripeMethodForm/index.tsx +163 -0
- package/src/config.json +2 -0
- package/src/types/index.tsx +9 -0
- package/themes/kiosk/src/components/BusinessController/index.tsx +67 -0
- package/themes/kiosk/src/components/BusinessController/styles.tsx +23 -0
- package/themes/kiosk/src/components/BusinessesListing/index.tsx +119 -0
- package/themes/kiosk/src/components/BusinessesListing/styles.tsx +24 -0
- package/themes/kiosk/src/components/LoginForm/index.tsx +62 -2
- package/themes/kiosk/src/components/LogoutButton/index.tsx +74 -0
- package/themes/kiosk/src/types/index.d.ts +1 -0
- package/themes/original/src/components/BusinessBasicInformation/index.tsx +32 -1
- package/themes/original/src/components/BusinessInformation/index.tsx +7 -2
- package/themes/original/src/components/BusinessesListing/index.tsx +8 -9
- package/themes/original/src/components/Cart/index.tsx +8 -8
- package/themes/original/src/components/Checkout/index.tsx +82 -70
- package/themes/original/src/components/LoginForm/index.tsx +6 -4
- package/themes/original/src/components/OrderDetails/index.tsx +58 -6
- package/themes/original/src/components/OrderProgress/index.tsx +39 -31
- package/themes/original/src/components/OrderSummary/index.tsx +8 -8
- package/themes/original/src/components/OrdersOption/index.tsx +40 -16
- package/themes/original/src/components/OrdersOption/styles.tsx +5 -0
- package/themes/original/src/components/PhoneInputNumber/index.tsx +1 -1
- package/themes/original/src/components/PhoneInputNumber/styles.tsx +1 -1
- package/themes/original/src/components/ProductForm/index.tsx +42 -11
- package/themes/original/src/components/ProductForm/styles.tsx +1 -1
- package/themes/original/src/components/ProductOptionSubOption/index.tsx +1 -1
- package/themes/original/src/components/ProductOptionSubOption/styles.tsx +1 -1
- package/themes/original/src/components/SingleProductCard/index.tsx +15 -8
- package/themes/original/src/components/UpsellingProducts/index.tsx +1 -4
- package/themes/original/src/components/UserProfile/index.tsx +13 -11
- package/themes/original/src/components/WalletTransactionItem/index.tsx +5 -5
- package/themes/original/src/components/Wallets/styles.tsx +1 -1
- package/themes/original/src/components/shared/OInput.tsx +6 -2
- package/themes/original/src/utils/index.tsx +7 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useEffect } from 'react';
|
|
1
|
+
import React, { useEffect, useState } from 'react';
|
|
2
2
|
import { StyleSheet, View } from 'react-native';
|
|
3
3
|
import { useForm, Controller } from 'react-hook-form';
|
|
4
4
|
import { useTheme } from 'styled-components/native';
|
|
@@ -7,7 +7,8 @@ import {
|
|
|
7
7
|
LoginForm as LoginFormController,
|
|
8
8
|
useLanguage,
|
|
9
9
|
ToastType,
|
|
10
|
-
useToast
|
|
10
|
+
useToast,
|
|
11
|
+
useApi
|
|
11
12
|
} from 'ordering-components/native';
|
|
12
13
|
|
|
13
14
|
import {
|
|
@@ -18,21 +19,40 @@ import {
|
|
|
18
19
|
import { OText, OButton, OInput, OIcon } from '../shared';
|
|
19
20
|
import { LoginParams } from '../../types';
|
|
20
21
|
import { LANDSCAPE, PORTRAIT, useDeviceOrientation } from '../../../../../src/hooks/DeviceOrientation';
|
|
22
|
+
import { _setStoreData } from '../../../../../src/providers/StoreUtil'
|
|
21
23
|
|
|
22
24
|
const LoginFormUI = (props: LoginParams) => {
|
|
23
25
|
const {
|
|
24
26
|
loginButtonText,
|
|
25
27
|
formState,
|
|
26
28
|
handleButtonLoginClick,
|
|
29
|
+
useRootPoint
|
|
27
30
|
} = props;
|
|
28
31
|
|
|
29
32
|
const theme = useTheme()
|
|
33
|
+
const [ordering, { setOrdering }] = useApi();
|
|
30
34
|
const [, { showToast }] = useToast();
|
|
31
35
|
const [, t] = useLanguage();
|
|
32
36
|
const {control, handleSubmit, formState: {errors}} = useForm();
|
|
33
37
|
const [orientationState] = useDeviceOrientation();
|
|
34
38
|
|
|
39
|
+
const [formsStateValues, setFormsStateValues] = useState<any>({ isSubmitted: false })
|
|
40
|
+
|
|
35
41
|
const onSubmit = (values: any) => {
|
|
42
|
+
if (values?.project_name) {
|
|
43
|
+
setOrdering({
|
|
44
|
+
...ordering,
|
|
45
|
+
project: values?.project_name
|
|
46
|
+
})
|
|
47
|
+
_setStoreData('project_name', values?.project_name)
|
|
48
|
+
setFormsStateValues({
|
|
49
|
+
...formsStateValues,
|
|
50
|
+
isSubmitted: true,
|
|
51
|
+
values
|
|
52
|
+
})
|
|
53
|
+
return
|
|
54
|
+
}
|
|
55
|
+
|
|
36
56
|
handleButtonLoginClick(values);
|
|
37
57
|
};
|
|
38
58
|
|
|
@@ -73,9 +93,22 @@ const LoginFormUI = (props: LoginParams) => {
|
|
|
73
93
|
? formState.result?.result
|
|
74
94
|
: formState.result?.result[0]
|
|
75
95
|
)
|
|
96
|
+
setFormsStateValues({
|
|
97
|
+
...formsStateValues,
|
|
98
|
+
isSubmitted: false,
|
|
99
|
+
})
|
|
76
100
|
}
|
|
77
101
|
}, [formState]);
|
|
78
102
|
|
|
103
|
+
useEffect(() => {
|
|
104
|
+
if (ordering.project === null || !formsStateValues.isSubmitted || !useRootPoint) return
|
|
105
|
+
const values: any = formsStateValues.values
|
|
106
|
+
if (values?.project_name) {
|
|
107
|
+
delete values.project_name
|
|
108
|
+
}
|
|
109
|
+
handleButtonLoginClick({ ...values })
|
|
110
|
+
}, [ordering, formsStateValues.isSubmitted])
|
|
111
|
+
|
|
79
112
|
|
|
80
113
|
useEffect(() => {
|
|
81
114
|
if (Object.keys(errors)?.length > 0) {
|
|
@@ -97,6 +130,33 @@ const LoginFormUI = (props: LoginParams) => {
|
|
|
97
130
|
|
|
98
131
|
const InputControllers = (
|
|
99
132
|
<>
|
|
133
|
+
{useRootPoint && (
|
|
134
|
+
<Controller
|
|
135
|
+
control={control}
|
|
136
|
+
name='project_name'
|
|
137
|
+
rules={{ required: t(`VALIDATION_ERROR_PROJECT_NAME_REQUIRED`, 'The field project name is required') }}
|
|
138
|
+
defaultValue=""
|
|
139
|
+
render={({ onChange, value }: any) => (
|
|
140
|
+
<OInput
|
|
141
|
+
name='project_name'
|
|
142
|
+
placeholder={t('PROJECT_NAME', 'Project Name')}
|
|
143
|
+
style={styles.inputStyle}
|
|
144
|
+
value={value}
|
|
145
|
+
autoCapitalize='none'
|
|
146
|
+
autoCorrect={false}
|
|
147
|
+
inputStyle={{textAlign: 'center'}}
|
|
148
|
+
onChange={(e: any) => {
|
|
149
|
+
onChange(e?.target?.value);
|
|
150
|
+
setFormsStateValues({
|
|
151
|
+
...formsStateValues,
|
|
152
|
+
isSubmitted: false,
|
|
153
|
+
})
|
|
154
|
+
}}
|
|
155
|
+
/>
|
|
156
|
+
)}
|
|
157
|
+
/>
|
|
158
|
+
)}
|
|
159
|
+
|
|
100
160
|
<Controller
|
|
101
161
|
control={control}
|
|
102
162
|
render={({ onChange, value }: any) => (
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import React, { useEffect } from 'react';
|
|
2
|
+
import { TouchableOpacity } from 'react-native';
|
|
3
|
+
import { LogoutAction, ToastType, useToast, useLanguage, useCustomer, useBusiness, useOrder } from 'ordering-components/native';
|
|
4
|
+
|
|
5
|
+
import { OIcon } from '../shared';
|
|
6
|
+
import { useTheme } from 'styled-components/native';
|
|
7
|
+
import { _clearStoreData, _retrieveStoreData } from '../../../../../src/providers/StoreUtil'
|
|
8
|
+
|
|
9
|
+
const LogoutButtonUI = (props: any) => {
|
|
10
|
+
const { handleLogoutClick, formState, ButtonUI } = props
|
|
11
|
+
|
|
12
|
+
const [theme] = useTheme();
|
|
13
|
+
const [, { setStateValues }] = useOrder();
|
|
14
|
+
const [, { showToast }] = useToast();
|
|
15
|
+
const [, t] = useLanguage();
|
|
16
|
+
const [, { deleteUserCustomer }] = useCustomer();
|
|
17
|
+
const [, { setBusiness }] = useBusiness();
|
|
18
|
+
|
|
19
|
+
const handleClick = async () => {
|
|
20
|
+
const data = await _retrieveStoreData('notification_state');
|
|
21
|
+
const res = await handleLogoutClick(data);
|
|
22
|
+
if (res) {
|
|
23
|
+
_clearStoreData({ excludedKeys: ['isTutorial'] })
|
|
24
|
+
deleteUserCustomer(true)
|
|
25
|
+
setBusiness({})
|
|
26
|
+
setStateValues({
|
|
27
|
+
options: {
|
|
28
|
+
moment: null
|
|
29
|
+
},
|
|
30
|
+
carts: {},
|
|
31
|
+
})
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
useEffect(() => {
|
|
36
|
+
if (!formState.loading && formState.result?.error) {
|
|
37
|
+
formState.result?.result && showToast(
|
|
38
|
+
ToastType.Error,
|
|
39
|
+
typeof formState.result?.result === 'string'
|
|
40
|
+
? formState.result?.result
|
|
41
|
+
: formState.result?.result[0]
|
|
42
|
+
)
|
|
43
|
+
}
|
|
44
|
+
}, [formState])
|
|
45
|
+
|
|
46
|
+
return (
|
|
47
|
+
ButtonUI ? (
|
|
48
|
+
<ButtonUI onPress={() => handleClick()} />
|
|
49
|
+
) : (
|
|
50
|
+
<TouchableOpacity
|
|
51
|
+
onPress={() => handleClick()}
|
|
52
|
+
style={{ flexDirection: 'row', alignItems: 'center' }}
|
|
53
|
+
>
|
|
54
|
+
<OIcon
|
|
55
|
+
src={theme.images.general.menulogout}
|
|
56
|
+
width={24}
|
|
57
|
+
height={24}
|
|
58
|
+
color={theme.colors.disabledContrast}
|
|
59
|
+
/>
|
|
60
|
+
</TouchableOpacity>
|
|
61
|
+
)
|
|
62
|
+
)
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export const LogoutButton = (props: any) => {
|
|
66
|
+
const logoutProps = {
|
|
67
|
+
...props,
|
|
68
|
+
isNative: true,
|
|
69
|
+
UIComponent: LogoutButtonUI
|
|
70
|
+
}
|
|
71
|
+
return (
|
|
72
|
+
<LogoutAction {...logoutProps} />
|
|
73
|
+
)
|
|
74
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useState } from 'react';
|
|
1
|
+
import React, { useState, useEffect } from 'react';
|
|
2
2
|
import { StyleSheet, View, TouchableOpacity } from 'react-native';
|
|
3
3
|
import { useUtils, useOrder, useLanguage } from 'ordering-components/native';
|
|
4
4
|
import { useTheme } from 'styled-components/native';
|
|
@@ -7,6 +7,12 @@ import { BusinessBasicInformationParams } from '../../types';
|
|
|
7
7
|
import { convertHoursToMinutes } from '../../utils';
|
|
8
8
|
import { BusinessInformation } from '../BusinessInformation';
|
|
9
9
|
import { BusinessReviews } from '../BusinessReviews';
|
|
10
|
+
import dayjs from 'dayjs';
|
|
11
|
+
import timezone from 'dayjs/plugin/timezone';
|
|
12
|
+
import isBetween from 'dayjs/plugin/isBetween';
|
|
13
|
+
|
|
14
|
+
dayjs.extend(timezone);
|
|
15
|
+
dayjs.extend(isBetween);
|
|
10
16
|
|
|
11
17
|
import {
|
|
12
18
|
BusinessContainer,
|
|
@@ -45,6 +51,31 @@ export const BusinessBasicInformation = (
|
|
|
45
51
|
return _types.join(', ');
|
|
46
52
|
};
|
|
47
53
|
|
|
54
|
+
|
|
55
|
+
useEffect(() => {
|
|
56
|
+
if (businessState?.loading) return
|
|
57
|
+
let timeout: any = null
|
|
58
|
+
const currentDate = dayjs().tz(businessState?.business?.timezone)
|
|
59
|
+
let lapse = null
|
|
60
|
+
if (businessState?.business?.today?.enabled) {
|
|
61
|
+
lapse = businessState?.business?.today?.lapses?.find((lapse: any) => {
|
|
62
|
+
const from = currentDate.hour(lapse.open.hour).minute(lapse.open.minute)
|
|
63
|
+
const to = currentDate.hour(lapse.close.hour).minute(lapse.close.minute)
|
|
64
|
+
return currentDate.unix() >= from.unix() && currentDate.unix() <= to.unix()
|
|
65
|
+
})
|
|
66
|
+
}
|
|
67
|
+
if (lapse) {
|
|
68
|
+
const to = currentDate.hour(lapse.close.hour).minute(lapse.close.minute)
|
|
69
|
+
const timeToClose = (to.unix() - currentDate.unix()) * 1000
|
|
70
|
+
timeout = setTimeout(() => {
|
|
71
|
+
navigation.navigate('BusinessPreorder', { business: businessState?.business, handleBusinessClick: () => navigation?.goBack() })
|
|
72
|
+
}, timeToClose)
|
|
73
|
+
}
|
|
74
|
+
return () => {
|
|
75
|
+
timeout && clearTimeout(timeout)
|
|
76
|
+
}
|
|
77
|
+
}, [businessState?.business])
|
|
78
|
+
|
|
48
79
|
return (
|
|
49
80
|
<BusinessContainer>
|
|
50
81
|
<BusinessHeader
|
|
@@ -20,7 +20,7 @@ import { Platform, StyleSheet, View } from 'react-native';
|
|
|
20
20
|
import { BusinessInformationParams } from '../../types';
|
|
21
21
|
import { GoogleMap } from '../GoogleMap';
|
|
22
22
|
import { WebView } from 'react-native-webview';
|
|
23
|
-
|
|
23
|
+
import { formatUrlVideo } from '../../utils'
|
|
24
24
|
const BusinessInformationUI = (props: BusinessInformationParams) => {
|
|
25
25
|
const { businessState, businessSchedule, businessLocation } = props;
|
|
26
26
|
|
|
@@ -152,7 +152,12 @@ const BusinessInformationUI = (props: BusinessInformationParams) => {
|
|
|
152
152
|
style={{ width: 210, height: 127, borderRadius: 7.6 }}
|
|
153
153
|
javaScriptEnabled={true}
|
|
154
154
|
domStorageEnabled={true}
|
|
155
|
-
source={{
|
|
155
|
+
source={{
|
|
156
|
+
html: `
|
|
157
|
+
<iframe width='80%' height='80%' src="${formatUrlVideo(v.video)}" frameBorder='0' allow='autoplay; encrypted-media' allowFullScreen />
|
|
158
|
+
`,
|
|
159
|
+
}}
|
|
160
|
+
mediaPlaybackRequiresUserAction={true}
|
|
156
161
|
/>
|
|
157
162
|
))}
|
|
158
163
|
</MediaWrapper>
|
|
@@ -300,15 +300,14 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
|
|
|
300
300
|
</View>
|
|
301
301
|
</OrderControlContainer>
|
|
302
302
|
</HeaderWrapper>
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
}
|
|
303
|
+
|
|
304
|
+
<OrderProgressWrapper>
|
|
305
|
+
<OrderProgress
|
|
306
|
+
{...props}
|
|
307
|
+
isFocused={isFocused}
|
|
308
|
+
/>
|
|
309
|
+
</OrderProgressWrapper>
|
|
310
|
+
|
|
312
311
|
{
|
|
313
312
|
!businessId && !props.franchiseId && featuredBusiness && featuredBusiness.length > 0 && (
|
|
314
313
|
<FeaturedWrapper>
|
|
@@ -207,10 +207,10 @@ const CartUI = (props: any) => {
|
|
|
207
207
|
<OText size={12} lineHeight={18}>{`(${verifyDecimals(offer?.rate, parsePrice)}%)`}</OText>
|
|
208
208
|
)}
|
|
209
209
|
<TouchableOpacity style={{ marginLeft: 3 }} onPress={() => setOpenTaxModal({ open: true, data: offer, type: 'offer_target_1' })}>
|
|
210
|
-
<AntIcon name='
|
|
210
|
+
<AntIcon name='infocirlceo' size={16} color={theme.colors.primary} />
|
|
211
211
|
</TouchableOpacity>
|
|
212
212
|
<TouchableOpacity style={{ marginLeft: 3 }} onPress={() => onRemoveOffer(offer?.id)}>
|
|
213
|
-
<AntIcon name='closecircle' size={
|
|
213
|
+
<AntIcon name='closecircle' size={16} color={theme.colors.primary} />
|
|
214
214
|
</TouchableOpacity>
|
|
215
215
|
</OSRow>
|
|
216
216
|
<OText size={12} lineHeight={18}>
|
|
@@ -239,7 +239,7 @@ const CartUI = (props: any) => {
|
|
|
239
239
|
{`(${verifyDecimals(tax?.rate, parseNumber)}%)`}{' '}
|
|
240
240
|
</OText>
|
|
241
241
|
<TouchableOpacity onPress={() => setOpenTaxModal({ open: true, data: tax, type: 'tax' })} >
|
|
242
|
-
<AntIcon name='
|
|
242
|
+
<AntIcon name='infocirlceo' size={16} color={theme.colors.primary} />
|
|
243
243
|
</TouchableOpacity>
|
|
244
244
|
</OSRow>
|
|
245
245
|
<OText size={12} lineHeight={18}>{parsePrice(tax?.summary?.tax_after_discount ?? tax?.summary?.tax ?? 0)}</OText>
|
|
@@ -255,7 +255,7 @@ const CartUI = (props: any) => {
|
|
|
255
255
|
({parsePrice(fee?.fixed)} + {fee?.percentage}%){' '}
|
|
256
256
|
</OText>
|
|
257
257
|
<TouchableOpacity onPress={() => setOpenTaxModal({ open: true, data: fee, type: 'fee' })} >
|
|
258
|
-
<AntIcon name='
|
|
258
|
+
<AntIcon name='infocirlceo' size={16} color={theme.colors.primary} />
|
|
259
259
|
</TouchableOpacity>
|
|
260
260
|
</OSRow>
|
|
261
261
|
<OText size={12} lineHeight={18}>{parsePrice(fee?.summary?.fixed + (fee?.summary?.percentage_after_discount ?? fee?.summary?.percentage) ?? 0)}</OText>
|
|
@@ -271,10 +271,10 @@ const CartUI = (props: any) => {
|
|
|
271
271
|
<OText size={12} lineHeight={18}>{`(${verifyDecimals(offer?.rate, parsePrice)}%)`}</OText>
|
|
272
272
|
)}
|
|
273
273
|
<TouchableOpacity style={{ marginLeft: 3 }} onPress={() => setOpenTaxModal({ open: true, data: offer, type: 'offer_target_3' })}>
|
|
274
|
-
<AntIcon name='
|
|
274
|
+
<AntIcon name='infocirlceo' size={16} color={theme.colors.primary} />
|
|
275
275
|
</TouchableOpacity>
|
|
276
276
|
<TouchableOpacity style={{ marginLeft: 3 }} onPress={() => onRemoveOffer(offer?.id)}>
|
|
277
|
-
<AntIcon name='closecircle' size={
|
|
277
|
+
<AntIcon name='closecircle' size={16} color={theme.colors.primary} />
|
|
278
278
|
</TouchableOpacity>
|
|
279
279
|
</OSRow>
|
|
280
280
|
<OText size={12} lineHeight={18}>
|
|
@@ -298,10 +298,10 @@ const CartUI = (props: any) => {
|
|
|
298
298
|
<OText size={12} lineHeight={18}>{`(${verifyDecimals(offer?.rate, parsePrice)}%)`}</OText>
|
|
299
299
|
)}
|
|
300
300
|
<TouchableOpacity style={{ marginLeft: 3 }} onPress={() => setOpenTaxModal({ open: true, data: offer, type: 'offer_target_2' })}>
|
|
301
|
-
<AntIcon name='
|
|
301
|
+
<AntIcon name='infocirlceo' size={16} color={theme.colors.primary} />
|
|
302
302
|
</TouchableOpacity>
|
|
303
303
|
<TouchableOpacity style={{ marginLeft: 3 }} onPress={() => onRemoveOffer(offer?.id)}>
|
|
304
|
-
<AntIcon name='closecircle' size={
|
|
304
|
+
<AntIcon name='closecircle' size={16} color={theme.colors.primary} />
|
|
305
305
|
</TouchableOpacity>
|
|
306
306
|
</OSRow>
|
|
307
307
|
<OText size={12} lineHeight={18}>
|
|
@@ -39,7 +39,7 @@ import {
|
|
|
39
39
|
ChCart,
|
|
40
40
|
DeliveryOptionsContainer,
|
|
41
41
|
DeliveryOptionItem,
|
|
42
|
-
|
|
42
|
+
WalletPaymentOptionContainer
|
|
43
43
|
} from './styles';
|
|
44
44
|
import { Fade, Placeholder, PlaceholderLine } from 'rn-placeholder';
|
|
45
45
|
|
|
@@ -133,7 +133,7 @@ const CheckoutUI = (props: any) => {
|
|
|
133
133
|
const [webviewPaymethod, setWebviewPaymethod] = useState<any>(null)
|
|
134
134
|
|
|
135
135
|
|
|
136
|
-
|
|
136
|
+
const isWalletEnabled = configs?.wallet_enabled?.value === '1' && (configs?.wallet_cash_enabled?.value === '1' || configs?.wallet_credit_point_enabled?.value === '1')
|
|
137
137
|
|
|
138
138
|
const driverTipsOptions = typeof configs?.driver_tip_options?.value === 'string'
|
|
139
139
|
? JSON.parse(configs?.driver_tip_options?.value) || []
|
|
@@ -145,7 +145,7 @@ const CheckoutUI = (props: any) => {
|
|
|
145
145
|
|
|
146
146
|
const deliveryOptions = instructionsOptions?.result && instructionsOptions?.result?.filter((option: any) => option?.enabled)?.map((option: any) => {
|
|
147
147
|
return {
|
|
148
|
-
value: option?.id, key: option?.id, label: t(option?.name.toUpperCase().replace(/\s/g, '_'), option?.name)
|
|
148
|
+
value: option?.id, key: option?.id, label: t(option?.name.toUpperCase().replace(/\s/g, '_'), option?.name)
|
|
149
149
|
}
|
|
150
150
|
})
|
|
151
151
|
|
|
@@ -169,7 +169,7 @@ const CheckoutUI = (props: any) => {
|
|
|
169
169
|
|
|
170
170
|
const onFailPaypal = async () => {
|
|
171
171
|
if (showGateway.closedByUser === true) {
|
|
172
|
-
|
|
172
|
+
await confirmCart(cart.uuid)
|
|
173
173
|
}
|
|
174
174
|
}
|
|
175
175
|
const changeDeliveryOption = (option: any) => {
|
|
@@ -283,14 +283,14 @@ const CheckoutUI = (props: any) => {
|
|
|
283
283
|
<ChSection>
|
|
284
284
|
<ChBusinessDetails>
|
|
285
285
|
{
|
|
286
|
-
(businessDetails?.loading || cartState.loading) &&
|
|
286
|
+
(businessDetails?.loading || cartState.loading || !businessDetails?.business || Object.values(businessDetails?.business).length === 0) &&
|
|
287
287
|
!businessDetails?.error &&
|
|
288
288
|
(
|
|
289
289
|
<Placeholder Animation={Fade}>
|
|
290
290
|
<PlaceholderLine height={20} width={70} />
|
|
291
|
-
<PlaceholderLine height={
|
|
292
|
-
<PlaceholderLine height={
|
|
293
|
-
<PlaceholderLine height={
|
|
291
|
+
<PlaceholderLine height={10} width={60} />
|
|
292
|
+
<PlaceholderLine height={10} width={60} />
|
|
293
|
+
<PlaceholderLine height={10} width={80} style={{ marginBottom: 20 }} />
|
|
294
294
|
</Placeholder>
|
|
295
295
|
)}
|
|
296
296
|
{
|
|
@@ -337,9 +337,9 @@ const CheckoutUI = (props: any) => {
|
|
|
337
337
|
{cartState.loading ? (
|
|
338
338
|
<Placeholder Animation={Fade}>
|
|
339
339
|
<PlaceholderLine height={20} width={70} />
|
|
340
|
-
<PlaceholderLine height={
|
|
341
|
-
<PlaceholderLine height={
|
|
342
|
-
<PlaceholderLine height={
|
|
340
|
+
<PlaceholderLine height={10} width={60} />
|
|
341
|
+
<PlaceholderLine height={10} width={60} />
|
|
342
|
+
<PlaceholderLine height={10} width={80} style={{ marginBottom: 20 }} />
|
|
343
343
|
</Placeholder>
|
|
344
344
|
) : (
|
|
345
345
|
<UserDetails
|
|
@@ -358,54 +358,66 @@ const CheckoutUI = (props: any) => {
|
|
|
358
358
|
<View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginHorizontal: -40 }} />
|
|
359
359
|
</ChSection>
|
|
360
360
|
|
|
361
|
-
{
|
|
361
|
+
{options?.type === 1 && (
|
|
362
362
|
<DeliveryOptionsContainer>
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
363
|
+
{cartState.loading || deliveryOptionSelected === undefined ? (
|
|
364
|
+
<View style={{ height: 110 }}>
|
|
365
|
+
<Placeholder Animation={Fade}>
|
|
366
|
+
<PlaceholderLine height={20} width={70} />
|
|
367
|
+
<PlaceholderLine height={40} width={100} />
|
|
368
|
+
</Placeholder>
|
|
369
|
+
</View>
|
|
370
|
+
) : (
|
|
371
|
+
<>
|
|
372
|
+
<OText size={16}>{t('DELIVERY_OPTIONS', 'Delivery options')}</OText>
|
|
373
|
+
<View
|
|
374
|
+
style={{
|
|
375
|
+
backgroundColor: theme.colors.inputDisabled,
|
|
376
|
+
borderRadius: 7.5,
|
|
377
|
+
marginBottom: 20,
|
|
378
|
+
flex: 1
|
|
379
|
+
}}>
|
|
380
|
+
<Picker
|
|
381
|
+
countryCode={undefined}
|
|
382
|
+
visible={isDeliveryOptionModalVisible}
|
|
383
|
+
onClose={() => setIsDeliveryOptionModalVisible(false)}
|
|
384
|
+
withCountryNameButton
|
|
385
|
+
renderFlagButton={() => (
|
|
386
|
+
<TouchableOpacity onPress={() => setIsDeliveryOptionModalVisible(true)}>
|
|
387
|
+
<DeliveryOptionItem backgroundColor={theme?.colors?.inputDisabled}>
|
|
388
|
+
<OText
|
|
389
|
+
size={14}
|
|
390
|
+
>
|
|
391
|
+
{deliveryOptions.find((option: any) => option.value === deliveryOptionSelected).label}
|
|
392
|
+
</OText>
|
|
393
|
+
<MaterialIcons name='keyboard-arrow-down' style={styles.icon} />
|
|
394
|
+
</DeliveryOptionItem>
|
|
395
|
+
</TouchableOpacity>
|
|
396
|
+
)}
|
|
397
|
+
flatListProps={{
|
|
398
|
+
keyExtractor: (item: any) => item.value,
|
|
399
|
+
data: deliveryOptions || [],
|
|
400
|
+
renderItem: ({ item }: any) => (
|
|
401
|
+
<TouchableOpacity
|
|
402
|
+
onPress={() => changeDeliveryOption(item.value)}
|
|
403
|
+
disabled={
|
|
404
|
+
deliveryOptionSelected === item.value
|
|
405
|
+
}
|
|
406
|
+
>
|
|
407
|
+
<DeliveryOptionItem backgroundColor={deliveryOptionSelected === item.value ? theme.colors.inputDisabled : 'white'}>
|
|
408
|
+
<OText>
|
|
409
|
+
{item.label}
|
|
410
|
+
</OText>
|
|
411
|
+
</DeliveryOptionItem>
|
|
412
|
+
</TouchableOpacity>
|
|
413
|
+
)
|
|
414
|
+
}}
|
|
415
|
+
/>
|
|
416
|
+
</View>
|
|
417
|
+
<View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginHorizontal: -40 }} />
|
|
418
|
+
</>
|
|
419
|
+
)}
|
|
420
|
+
|
|
409
421
|
</DeliveryOptionsContainer>
|
|
410
422
|
)}
|
|
411
423
|
|
|
@@ -436,7 +448,7 @@ const CheckoutUI = (props: any) => {
|
|
|
436
448
|
height={80}
|
|
437
449
|
borderRadius={80}
|
|
438
450
|
/>
|
|
439
|
-
<View style={{ marginLeft:
|
|
451
|
+
<View style={{ marginLeft: 10, width: '85%' }}>
|
|
440
452
|
<OText size={22} numberOfLines={2} ellipsizeMode='tail' style={{ width: '85%' }}>
|
|
441
453
|
{businessName || businessDetails?.business?.name}
|
|
442
454
|
</OText>
|
|
@@ -530,14 +542,14 @@ const CheckoutUI = (props: any) => {
|
|
|
530
542
|
</ChSection>
|
|
531
543
|
)}
|
|
532
544
|
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
545
|
+
{!cartState.loading && cart && isWalletEnabled && (
|
|
546
|
+
<WalletPaymentOptionContainer>
|
|
547
|
+
<PaymentOptionWallet
|
|
548
|
+
cart={cart}
|
|
549
|
+
businessId={cart?.business_id}
|
|
550
|
+
/>
|
|
551
|
+
</WalletPaymentOptionContainer>
|
|
552
|
+
)}
|
|
541
553
|
|
|
542
554
|
|
|
543
555
|
{!cartState.loading && cart && (
|
|
@@ -571,7 +583,7 @@ const CheckoutUI = (props: any) => {
|
|
|
571
583
|
<OrderSummary
|
|
572
584
|
cart={cart}
|
|
573
585
|
isCartPending={cart?.status === 2}
|
|
574
|
-
|
|
586
|
+
onNavigationRedirect={onNavigationRedirect}
|
|
575
587
|
/>
|
|
576
588
|
</>
|
|
577
589
|
)}
|
|
@@ -580,7 +592,7 @@ const CheckoutUI = (props: any) => {
|
|
|
580
592
|
)}
|
|
581
593
|
|
|
582
594
|
{!cartState.loading && cart && (
|
|
583
|
-
|
|
595
|
+
<View>
|
|
584
596
|
<ChErrors style={{ marginBottom: 0 }}>
|
|
585
597
|
{!cart?.valid_address && cart?.status !== 2 && (
|
|
586
598
|
<OText
|
|
@@ -641,7 +653,7 @@ const CheckoutUI = (props: any) => {
|
|
|
641
653
|
}
|
|
642
654
|
btnRightValueShow
|
|
643
655
|
btnRightValue={parsePrice(cart?.total)}
|
|
644
|
-
iosBottom={
|
|
656
|
+
iosBottom={30}
|
|
645
657
|
/>
|
|
646
658
|
)}
|
|
647
659
|
{webviewPaymethod?.gateway === 'paypal' && showGateway.open && (
|
|
@@ -102,7 +102,8 @@ const LoginFormUI = (props: LoginParams) => {
|
|
|
102
102
|
},
|
|
103
103
|
});
|
|
104
104
|
|
|
105
|
-
const
|
|
105
|
+
const emailRef = useRef<any>({});
|
|
106
|
+
const passwordRef = useRef<any>({});
|
|
106
107
|
|
|
107
108
|
const handleChangeTab = (val: string) => {
|
|
108
109
|
props.handleChangeTab(val);
|
|
@@ -299,8 +300,9 @@ const LoginFormUI = (props: LoginParams) => {
|
|
|
299
300
|
type="email-address"
|
|
300
301
|
autoCompleteType="email"
|
|
301
302
|
returnKeyType="next"
|
|
302
|
-
onSubmitEditing={() =>
|
|
303
|
+
onSubmitEditing={() => passwordRef.current?.focus()}
|
|
303
304
|
blurOnSubmit={false}
|
|
305
|
+
forwardRef={emailRef}
|
|
304
306
|
/>
|
|
305
307
|
)}
|
|
306
308
|
name="email"
|
|
@@ -327,7 +329,7 @@ const LoginFormUI = (props: LoginParams) => {
|
|
|
327
329
|
handleData={(val: any) => setPhoneInputData(val)}
|
|
328
330
|
textInputProps={{
|
|
329
331
|
returnKeyType: 'next',
|
|
330
|
-
onSubmitEditing: () =>
|
|
332
|
+
onSubmitEditing: () => passwordRef?.current?.focus?.(),
|
|
331
333
|
}}
|
|
332
334
|
/>
|
|
333
335
|
</View>
|
|
@@ -359,7 +361,7 @@ const LoginFormUI = (props: LoginParams) => {
|
|
|
359
361
|
)
|
|
360
362
|
}
|
|
361
363
|
value={value}
|
|
362
|
-
forwardRef={
|
|
364
|
+
forwardRef={passwordRef}
|
|
363
365
|
onChange={(val: any) => onChange(val)}
|
|
364
366
|
returnKeyType="done"
|
|
365
367
|
onSubmitEditing={handleSubmit(onSubmit)}
|