ordering-ui-react-native 0.14.54 → 0.14.57
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/BusinessesListing/index.tsx +1 -1
- package/src/components/StripeElementsForm/index.tsx +28 -13
- package/src/components/TaxInformation/index.tsx +1 -1
- package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
- package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
- package/themes/original/index.tsx +2 -0
- package/themes/original/src/components/BusinessController/index.tsx +3 -3
- package/themes/original/src/components/BusinessFeaturedController/index.tsx +2 -2
- package/themes/original/src/components/BusinessPreorder/index.tsx +1 -2
- package/themes/original/src/components/BusinessProductsListing/index.tsx +8 -4
- package/themes/original/src/components/BusinessesListing/index.tsx +5 -5
- package/themes/original/src/components/HighestRatedBusinesses/index.tsx +1 -0
- package/themes/original/src/components/LogoutButton/index.tsx +2 -2
- package/themes/original/src/components/MomentOption/index.tsx +209 -196
- package/themes/original/src/components/MomentOption/styles.tsx +18 -42
- package/themes/original/src/components/ProductForm/index.tsx +6 -3
- package/themes/original/src/components/ProductOptionSubOption/index.tsx +51 -49
- package/themes/original/src/components/ProductOptionSubOption/styles.tsx +8 -1
- package/themes/original/src/components/SingleProductCard/index.tsx +2 -2
- package/themes/original/src/components/StripeElementsForm/index.tsx +28 -13
- package/themes/original/src/components/TaxInformation/index.tsx +1 -1
- package/themes/original/src/components/VerifyEmail/index.tsx +303 -0
- package/themes/original/src/components/VerifyEmail/styles.tsx +77 -0
- package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
|
@@ -51,7 +51,6 @@ export const ProductOptionSubOptionUI = (props: any) => {
|
|
|
51
51
|
|
|
52
52
|
const disableIncrement = option?.limit_suboptions_by_max ? balance === option?.max : state.quantity === suboption?.max || (!state.selected && balance === option?.max)
|
|
53
53
|
const price = option?.with_half_option && suboption?.half_price && state.position !== 'whole' ? suboption?.half_price : suboption?.price
|
|
54
|
-
|
|
55
54
|
return (
|
|
56
55
|
<Container>
|
|
57
56
|
<IconControl disabled={disabled} onPress={() => handleSuboptionClick()}>
|
|
@@ -73,54 +72,57 @@ export const ProductOptionSubOptionUI = (props: any) => {
|
|
|
73
72
|
</OText>
|
|
74
73
|
</IconControl>
|
|
75
74
|
{showMessage && <OText size={10} mLeft={4} mRight={4} style={{ flex: 1, textAlign: 'center' }} color={theme.colors.primary}>{`${t('OPTIONS_MAX_LIMIT', 'Maximum options to choose')}: ${option?.max}`}</OText>}
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
<
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
{
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
<
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
75
|
+
<QuantityControl>
|
|
76
|
+
{option?.allow_suboption_quantity && state?.selected && (
|
|
77
|
+
<>
|
|
78
|
+
<Checkbox disabled={disabled || state.quantity === 0} onPress={decrement}>
|
|
79
|
+
<OIcon
|
|
80
|
+
src={theme.images.general.minus}
|
|
81
|
+
width={16}
|
|
82
|
+
color={state.quantity === 0 || disabled ? theme.colors.disabled : theme.colors.primary}
|
|
83
|
+
/>
|
|
84
|
+
</Checkbox>
|
|
85
|
+
<OText size={12} mLeft={5} mRight={5}>
|
|
86
|
+
{state.quantity}
|
|
87
|
+
</OText>
|
|
88
|
+
<Checkbox disabled={disabled || disableIncrement} onPress={increment}>
|
|
89
|
+
<OIcon
|
|
90
|
+
src={theme.images.general.plus}
|
|
91
|
+
width={16}
|
|
92
|
+
color={disableIncrement || disabled ? theme.colors.disabled : theme.colors.primary}
|
|
93
|
+
/>
|
|
94
|
+
</Checkbox>
|
|
95
|
+
</>
|
|
96
|
+
)}
|
|
97
|
+
</QuantityControl>
|
|
98
|
+
<PositionControl>
|
|
99
|
+
{option?.with_half_option && state?.selected && (
|
|
100
|
+
<>
|
|
101
|
+
<Circle disabled={disabled} onPress={() => changePosition('left')}>
|
|
102
|
+
<OIcon
|
|
103
|
+
src={theme.images.general.half_l}
|
|
104
|
+
color={state.selected && state.position === 'left' ? theme.colors.primary : '#cbcbcb'}
|
|
105
|
+
width={16}
|
|
106
|
+
style={styles.inverse}
|
|
107
|
+
/>
|
|
108
|
+
</Circle>
|
|
109
|
+
<Circle disabled={disabled} onPress={() => changePosition('whole')}>
|
|
110
|
+
<OIcon
|
|
111
|
+
src={theme.images.general.half_f}
|
|
112
|
+
color={state.selected && state.position === 'whole' ? theme.colors.primary : '#cbcbcb'}
|
|
113
|
+
width={16}
|
|
114
|
+
/>
|
|
115
|
+
</Circle>
|
|
116
|
+
<Circle disabled={disabled} onPress={() => changePosition('right')}>
|
|
117
|
+
<OIcon
|
|
118
|
+
src={theme.images.general.half_r}
|
|
119
|
+
color={state.selected && state.position === 'right' ? theme.colors.primary : '#cbcbcb'}
|
|
120
|
+
width={16}
|
|
121
|
+
/>
|
|
122
|
+
</Circle>
|
|
123
|
+
</>
|
|
124
|
+
)}
|
|
125
|
+
</PositionControl>
|
|
124
126
|
<OText size={12} lineHeight={18} color={theme.colors.textSecondary}>
|
|
125
127
|
+ {parsePrice(price)}
|
|
126
128
|
</OText>
|
|
@@ -5,28 +5,35 @@ export const Container = styled.View`
|
|
|
5
5
|
align-items: center;
|
|
6
6
|
justify-content: space-between;
|
|
7
7
|
padding: 10px;
|
|
8
|
+
width: 100%;
|
|
8
9
|
`
|
|
9
10
|
|
|
10
11
|
export const IconControl = styled.TouchableOpacity`
|
|
11
12
|
flex-direction: row;
|
|
12
|
-
|
|
13
|
+
width: 45%;
|
|
13
14
|
align-items: center;
|
|
14
15
|
`
|
|
15
16
|
|
|
16
17
|
export const QuantityControl = styled.View`
|
|
17
18
|
flex-direction: row;
|
|
18
19
|
align-items: center;
|
|
20
|
+
justify-content: flex-start;
|
|
19
21
|
margin-horizontal: 5px;
|
|
22
|
+
flex: 1;
|
|
23
|
+
width: 60px;
|
|
24
|
+
|
|
20
25
|
`
|
|
21
26
|
|
|
22
27
|
export const PositionControl = styled.View`
|
|
23
28
|
flex-direction: row;
|
|
24
29
|
align-items: center;
|
|
25
30
|
margin-right: 5px;
|
|
31
|
+
flex: 1;
|
|
26
32
|
`
|
|
27
33
|
|
|
28
34
|
export const Checkbox = styled.TouchableOpacity`
|
|
29
35
|
`
|
|
30
36
|
|
|
31
37
|
export const Circle = styled.TouchableOpacity`
|
|
38
|
+
margin: 0 1px;
|
|
32
39
|
`
|
|
@@ -121,9 +121,9 @@ export const SingleProductCard = (props: SingleProductCardParams) => {
|
|
|
121
121
|
{product?.name}
|
|
122
122
|
</OText>
|
|
123
123
|
<PricesContainer>
|
|
124
|
-
<OText color={theme.colors.primary}>{parsePrice(product?.price)}</OText>
|
|
124
|
+
<OText color={theme.colors.primary}>{product?.price ? parsePrice(product?.price) : ''}</OText>
|
|
125
125
|
{product?.offer_price !== null && product?.in_offer && (
|
|
126
|
-
<OText style={styles.regularPriceStyle}>{parsePrice(product?.offer_price)}</OText>
|
|
126
|
+
<OText style={styles.regularPriceStyle}>{product?.offer_price ? parsePrice(product?.offer_price) : ''}</OText>
|
|
127
127
|
)}
|
|
128
128
|
</PricesContainer>
|
|
129
129
|
<OText
|
|
@@ -37,19 +37,33 @@ const StripeElementsFormUI = (props: any) => {
|
|
|
37
37
|
const { top, bottom } = useSafeAreaInsets();
|
|
38
38
|
const [isKeyboardShow, setIsKeyboardShow] = useState(false);
|
|
39
39
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
40
|
+
let billingDetails: any = {}
|
|
41
|
+
|
|
42
|
+
if (user?.name || user?.lastname) {
|
|
43
|
+
if (user?.name) {
|
|
44
|
+
billingDetails.name = user?.name
|
|
45
|
+
}
|
|
46
|
+
if (user?.lastname) {
|
|
47
|
+
billingDetails.name = `${billingDetails?.name} ${user?.lastname}`
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
if (user?.email) {
|
|
52
|
+
billingDetails.email = user?.email
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
if (user?.address) {
|
|
56
|
+
billingDetails.addressLine1 = user?.address
|
|
57
|
+
}
|
|
45
58
|
|
|
46
59
|
const createPayMethod = async () => {
|
|
60
|
+
const params: any = { type: 'Card' }
|
|
61
|
+
if (Object.keys(billingDetails).length > 0) {
|
|
62
|
+
params.billingDetails = billingDetails
|
|
63
|
+
}
|
|
47
64
|
try {
|
|
48
65
|
setCreatePmLoading(true)
|
|
49
|
-
const { paymentMethod } = await createPaymentMethod(
|
|
50
|
-
type: 'Card',
|
|
51
|
-
billingDetails,
|
|
52
|
-
});
|
|
66
|
+
const { paymentMethod } = await createPaymentMethod(params);
|
|
53
67
|
|
|
54
68
|
setCreatePmLoading(false)
|
|
55
69
|
handleSource && handleSource({
|
|
@@ -79,11 +93,12 @@ const StripeElementsFormUI = (props: any) => {
|
|
|
79
93
|
createPayMethod();
|
|
80
94
|
return
|
|
81
95
|
}
|
|
96
|
+
const params: any = { type: 'Card' }
|
|
97
|
+
if (Object.keys(billingDetails).length > 0) {
|
|
98
|
+
params.billingDetails = billingDetails
|
|
99
|
+
}
|
|
82
100
|
try {
|
|
83
|
-
const { setupIntent, error } = await confirmSetupIntent(requirements,
|
|
84
|
-
type: 'Card',
|
|
85
|
-
billingDetails,
|
|
86
|
-
});
|
|
101
|
+
const { setupIntent, error } = await confirmSetupIntent(requirements, params);
|
|
87
102
|
|
|
88
103
|
if (setupIntent?.status === 'Succeeded') {
|
|
89
104
|
stripeTokenHandler(setupIntent?.paymentMethodId, user, businessId);
|
|
@@ -36,7 +36,7 @@ export const TaxInformation = (props: taxInformationParams) => {
|
|
|
36
36
|
? (product.tax?.id ? product.tax?.id === data?.id : product.tax?.id === null && data?.id === null)
|
|
37
37
|
: type === 'fee'
|
|
38
38
|
? (product.fee?.id ? product.fee?.id === data?.id : (product.fee?.id === null && data?.id === null))
|
|
39
|
-
: Object.keys(data?.discounts ?? {}).map(code => code.includes(product?.code))
|
|
39
|
+
: Object.keys(data?.discounts ?? {}).map(code => code.includes(product?.code)) && product?.offers?.find((offer : any) => offer?.name === data?.name)
|
|
40
40
|
)
|
|
41
41
|
}
|
|
42
42
|
|
|
@@ -0,0 +1,303 @@
|
|
|
1
|
+
import React, { useEffect, useState, useRef } from 'react';
|
|
2
|
+
import { useTheme } from 'styled-components/native';
|
|
3
|
+
import {
|
|
4
|
+
StyleSheet,
|
|
5
|
+
Text,
|
|
6
|
+
View,
|
|
7
|
+
TextInput,
|
|
8
|
+
SafeAreaView,
|
|
9
|
+
TouchableOpacity,
|
|
10
|
+
} from 'react-native';
|
|
11
|
+
import {
|
|
12
|
+
VerifyEmail as VerifyEmailController,
|
|
13
|
+
useToast,
|
|
14
|
+
useSession,
|
|
15
|
+
useLanguage,
|
|
16
|
+
ToastType
|
|
17
|
+
} from 'ordering-components/native';
|
|
18
|
+
|
|
19
|
+
import { OText, OInput, OButton } from '../shared';
|
|
20
|
+
import { LogoutButton } from '../LogoutButton'
|
|
21
|
+
|
|
22
|
+
import {
|
|
23
|
+
Container,
|
|
24
|
+
InputsSection,
|
|
25
|
+
WrapperText,
|
|
26
|
+
InputWrapper,
|
|
27
|
+
WrappCountdown,
|
|
28
|
+
CountDownContainer,
|
|
29
|
+
OtpSection,
|
|
30
|
+
DigitInput,
|
|
31
|
+
ButtonsActions,
|
|
32
|
+
WrapperActions
|
|
33
|
+
} from './styles'
|
|
34
|
+
|
|
35
|
+
const TIME_COUNTDOWN = 60 * 10 // 10 minutes
|
|
36
|
+
const CODE_LENGTH = 6;
|
|
37
|
+
|
|
38
|
+
const VerifyEmailUI = (props: any) => {
|
|
39
|
+
const {
|
|
40
|
+
verifyEmailState,
|
|
41
|
+
cleanErrorsState,
|
|
42
|
+
sendVerifyEmailCode,
|
|
43
|
+
checkVerifyEmailCode,
|
|
44
|
+
} = props
|
|
45
|
+
|
|
46
|
+
const theme = useTheme();
|
|
47
|
+
const [, t] = useLanguage()
|
|
48
|
+
const [{ user }] = useSession()
|
|
49
|
+
const [, { showToast }] = useToast();
|
|
50
|
+
|
|
51
|
+
const ref = useRef<TextInput>(null);
|
|
52
|
+
|
|
53
|
+
const [otpState, setOtpState] = useState('')
|
|
54
|
+
const [emailVerification, setEmailVerification] = useState(false)
|
|
55
|
+
|
|
56
|
+
const [timer, setTimer] = useState(`${TIME_COUNTDOWN / 60}:00`)
|
|
57
|
+
const [isSendCodeAgain, setIsSendCodeAgain] = useState(false)
|
|
58
|
+
const [containerIsFocused, setContainerIsFocused] = useState(false);
|
|
59
|
+
|
|
60
|
+
const codeDigitsArray = new Array(CODE_LENGTH).fill(0);
|
|
61
|
+
|
|
62
|
+
const style = StyleSheet.create({
|
|
63
|
+
inputContainer: {
|
|
64
|
+
borderWidth: 1,
|
|
65
|
+
borderRadius: 7.6,
|
|
66
|
+
padding: 12,
|
|
67
|
+
borderColor: theme.colors.disabled,
|
|
68
|
+
},
|
|
69
|
+
inputContainerFocused: {
|
|
70
|
+
borderColor: theme.colors.primary,
|
|
71
|
+
},
|
|
72
|
+
hiddenCodeInput: {
|
|
73
|
+
position: 'absolute',
|
|
74
|
+
height: 0,
|
|
75
|
+
width: 0,
|
|
76
|
+
opacity: 0,
|
|
77
|
+
},
|
|
78
|
+
inputStyle: {
|
|
79
|
+
marginBottom: 28,
|
|
80
|
+
borderWidth: 1,
|
|
81
|
+
borderColor: theme.colors.border,
|
|
82
|
+
borderRadius: 7.6,
|
|
83
|
+
},
|
|
84
|
+
btnStyle: {
|
|
85
|
+
borderRadius: 7.6,
|
|
86
|
+
marginTop: 5,
|
|
87
|
+
marginBottom: 2
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
const handleOnPress = () => {
|
|
92
|
+
setContainerIsFocused(true);
|
|
93
|
+
ref?.current?.focus();
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
const handleOnBlur = () => {
|
|
97
|
+
setContainerIsFocused(false);
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
const toDigitInput = (_value: number, idx: number) => {
|
|
101
|
+
const emptyInputChar = '0';
|
|
102
|
+
const digit = otpState[idx] || emptyInputChar;
|
|
103
|
+
|
|
104
|
+
const isCurrentDigit = idx === otpState.length;
|
|
105
|
+
const isLastDigit = idx === CODE_LENGTH - 1;
|
|
106
|
+
const isCodeFull = otpState.length === CODE_LENGTH;
|
|
107
|
+
|
|
108
|
+
const isFocused = isCurrentDigit || (isLastDigit && isCodeFull);
|
|
109
|
+
|
|
110
|
+
const containerStyle =
|
|
111
|
+
containerIsFocused && isFocused
|
|
112
|
+
? {...style.inputContainer, ...style.inputContainerFocused}
|
|
113
|
+
: style.inputContainer;
|
|
114
|
+
|
|
115
|
+
return (
|
|
116
|
+
<View key={idx} style={containerStyle}>
|
|
117
|
+
<Text
|
|
118
|
+
style={{
|
|
119
|
+
fontSize: 20,
|
|
120
|
+
color: otpState[idx] ? theme.colors.black : theme.colors.disabled
|
|
121
|
+
}}
|
|
122
|
+
>
|
|
123
|
+
{digit}
|
|
124
|
+
</Text>
|
|
125
|
+
</View>
|
|
126
|
+
);
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
const handleSendOtp = () => {
|
|
130
|
+
setTimer(`${TIME_COUNTDOWN / 60}:00`)
|
|
131
|
+
setIsSendCodeAgain(true)
|
|
132
|
+
sendVerifyEmailCode({ email: user?.email })
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
useEffect(() => {
|
|
136
|
+
let _timer = TIME_COUNTDOWN - 1;
|
|
137
|
+
let minutes = 0;
|
|
138
|
+
let seconds = 0;
|
|
139
|
+
const interval = setInterval(() => {
|
|
140
|
+
minutes = _timer / 60;
|
|
141
|
+
seconds = _timer % 60;
|
|
142
|
+
|
|
143
|
+
minutes = minutes < 10 ? 0 + minutes : minutes;
|
|
144
|
+
seconds = seconds < 10 ? 0 + seconds : seconds;
|
|
145
|
+
|
|
146
|
+
const formatMinutes = parseInt(minutes.toString()) < 10
|
|
147
|
+
? `0${parseInt(minutes.toString())}`
|
|
148
|
+
: parseInt(minutes.toString());
|
|
149
|
+
|
|
150
|
+
const formatseconds = parseInt(seconds.toString()) < 10
|
|
151
|
+
? `0${parseInt(seconds.toString())}`
|
|
152
|
+
: parseInt(seconds.toString());
|
|
153
|
+
|
|
154
|
+
setTimer(`${formatMinutes}:${formatseconds}`);
|
|
155
|
+
|
|
156
|
+
if (--_timer < 0) {
|
|
157
|
+
clearInterval(interval);
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
if (timer === `${TIME_COUNTDOWN / 60}:00` && isSendCodeAgain) {
|
|
161
|
+
setIsSendCodeAgain(false)
|
|
162
|
+
clearInterval(interval);
|
|
163
|
+
}
|
|
164
|
+
}, 1000);
|
|
165
|
+
|
|
166
|
+
return () => clearInterval(interval)
|
|
167
|
+
}, [isSendCodeAgain])
|
|
168
|
+
|
|
169
|
+
useEffect(() => {
|
|
170
|
+
if (otpState?.length === CODE_LENGTH) {
|
|
171
|
+
if (emailVerification) {
|
|
172
|
+
checkVerifyEmailCode({ code: otpState })
|
|
173
|
+
return
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
}, [otpState])
|
|
177
|
+
|
|
178
|
+
useEffect(() => {
|
|
179
|
+
if (verifyEmailState?.errorSendCode || verifyEmailState?.errorCheckCode) {
|
|
180
|
+
showToast(
|
|
181
|
+
ToastType.Error,
|
|
182
|
+
verifyEmailState?.errorSendCode?.[0]
|
|
183
|
+
?? verifyEmailState?.errorCheckCode?.[0]
|
|
184
|
+
?? t('ERROR', 'Error'),
|
|
185
|
+
);
|
|
186
|
+
setTimeout(() => {
|
|
187
|
+
cleanErrorsState();
|
|
188
|
+
setOtpState('');
|
|
189
|
+
}, 2000);
|
|
190
|
+
}
|
|
191
|
+
}, [verifyEmailState])
|
|
192
|
+
|
|
193
|
+
useEffect(() => {
|
|
194
|
+
if (!verifyEmailState?.loadingSendCode) {
|
|
195
|
+
setEmailVerification(!!verifyEmailState?.resultSendCode)
|
|
196
|
+
}
|
|
197
|
+
}, [verifyEmailState])
|
|
198
|
+
|
|
199
|
+
return (
|
|
200
|
+
<SafeAreaView style={{ flex: 1 }}>
|
|
201
|
+
<Container>
|
|
202
|
+
<WrapperActions>
|
|
203
|
+
<WrapperText>
|
|
204
|
+
<OText size={22} weight='bold' style={{ marginBottom: 10 }}>
|
|
205
|
+
{t('VERIFICATION_CODE', 'Verification Code')}
|
|
206
|
+
</OText>
|
|
207
|
+
<OText size={14} color={theme.colors.disabled} style={{ textAlign: 'center', paddingVertical: 20 }}>
|
|
208
|
+
{!emailVerification ? (
|
|
209
|
+
t('VERIFICATION_CODE_MESSAGE', 'In order to continue using our platform please verify your email')
|
|
210
|
+
) : (
|
|
211
|
+
t('VERIFICATION_CODE_SENT_MESSAGE', 'Please type the verification code sent to your email')
|
|
212
|
+
)}
|
|
213
|
+
</OText>
|
|
214
|
+
</WrapperText>
|
|
215
|
+
<View style={{ position: 'absolute', top: 0, right: 0 }}>
|
|
216
|
+
<LogoutButton iconSize={20} />
|
|
217
|
+
</View>
|
|
218
|
+
</WrapperActions>
|
|
219
|
+
|
|
220
|
+
{!emailVerification ? (
|
|
221
|
+
<InputWrapper>
|
|
222
|
+
<OInput
|
|
223
|
+
placeholder={user?.email}
|
|
224
|
+
style={style.inputStyle}
|
|
225
|
+
icon={theme.images.general.email}
|
|
226
|
+
isDisabled
|
|
227
|
+
/>
|
|
228
|
+
</InputWrapper>
|
|
229
|
+
) : (
|
|
230
|
+
<>
|
|
231
|
+
<WrappCountdown>
|
|
232
|
+
<CountDownContainer color={timer === '00:00' ? theme.colors.error: theme.colors.success}>
|
|
233
|
+
<OText
|
|
234
|
+
size={26}
|
|
235
|
+
color={timer === '00:00' ? theme.colors.error: theme.colors.success}
|
|
236
|
+
>
|
|
237
|
+
{timer}
|
|
238
|
+
</OText>
|
|
239
|
+
</CountDownContainer>
|
|
240
|
+
</WrappCountdown>
|
|
241
|
+
|
|
242
|
+
<InputsSection>
|
|
243
|
+
<OtpSection>
|
|
244
|
+
<DigitInput
|
|
245
|
+
disabled={otpState.length === CODE_LENGTH}
|
|
246
|
+
onPress={handleOnPress}
|
|
247
|
+
>
|
|
248
|
+
{codeDigitsArray.map(toDigitInput)}
|
|
249
|
+
</DigitInput>
|
|
250
|
+
<TextInput
|
|
251
|
+
ref={ref}
|
|
252
|
+
value={otpState}
|
|
253
|
+
placeholder='0'
|
|
254
|
+
onChangeText={setOtpState}
|
|
255
|
+
onSubmitEditing={handleOnBlur}
|
|
256
|
+
keyboardType="number-pad"
|
|
257
|
+
returnKeyType="done"
|
|
258
|
+
textContentType="oneTimeCode"
|
|
259
|
+
maxLength={CODE_LENGTH}
|
|
260
|
+
style={style.hiddenCodeInput}
|
|
261
|
+
/>
|
|
262
|
+
</OtpSection>
|
|
263
|
+
</InputsSection>
|
|
264
|
+
|
|
265
|
+
<WrapperText>
|
|
266
|
+
<TouchableOpacity
|
|
267
|
+
onPress={handleSendOtp}
|
|
268
|
+
>
|
|
269
|
+
<OText color={theme.colors.primary}>
|
|
270
|
+
{t('RESEND_AGAIN', 'Resend again?')}
|
|
271
|
+
</OText>
|
|
272
|
+
</TouchableOpacity>
|
|
273
|
+
</WrapperText>
|
|
274
|
+
</>
|
|
275
|
+
)}
|
|
276
|
+
</Container>
|
|
277
|
+
<ButtonsActions>
|
|
278
|
+
<View style={{ width: '100%' }}>
|
|
279
|
+
<OButton
|
|
280
|
+
onClick={emailVerification ? () => setEmailVerification(false) : handleSendOtp}
|
|
281
|
+
text={emailVerification ? t('CANCEL', 'Cancel') : t('SEND_CODE', 'Send code')}
|
|
282
|
+
bgColor={emailVerification ? theme.colors.secundary : theme.colors.primary}
|
|
283
|
+
borderColor={emailVerification ? theme.colors.secundary : theme.colors.primary}
|
|
284
|
+
textStyle={{ color: emailVerification ? 'black' : 'white' }}
|
|
285
|
+
imgRightSrc={null}
|
|
286
|
+
isLoading={verifyEmailState?.loadingSendCode || verifyEmailState?.loadingCheckCode}
|
|
287
|
+
style={emailVerification ? style.btnStyle : { borderRadius: 7.6 }}
|
|
288
|
+
/>
|
|
289
|
+
</View>
|
|
290
|
+
</ButtonsActions>
|
|
291
|
+
</SafeAreaView>
|
|
292
|
+
)
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
export const VerifyEmail = (props: any) => {
|
|
296
|
+
const verifyProps = {
|
|
297
|
+
...props,
|
|
298
|
+
UIComponent: VerifyEmailUI
|
|
299
|
+
}
|
|
300
|
+
return (
|
|
301
|
+
<VerifyEmailController {...verifyProps} />
|
|
302
|
+
)
|
|
303
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import styled from 'styled-components/native';
|
|
2
|
+
|
|
3
|
+
export const Container = styled.View`
|
|
4
|
+
padding: 20px;
|
|
5
|
+
`
|
|
6
|
+
|
|
7
|
+
export const WrapperText = styled.View`
|
|
8
|
+
display: flex;
|
|
9
|
+
flex-direction: column;
|
|
10
|
+
margin: 0 auto 0px;
|
|
11
|
+
align-items: center;
|
|
12
|
+
`
|
|
13
|
+
|
|
14
|
+
export const InputWrapper = styled.View``
|
|
15
|
+
|
|
16
|
+
export const WrapperActions = styled.View`
|
|
17
|
+
position: relative;
|
|
18
|
+
`
|
|
19
|
+
|
|
20
|
+
export const ButtonsActions = styled.View`
|
|
21
|
+
position: absolute;
|
|
22
|
+
bottom: 0px;
|
|
23
|
+
left: 0;
|
|
24
|
+
right: 0;
|
|
25
|
+
padding: 12px 40px;
|
|
26
|
+
flex-direction: row;
|
|
27
|
+
border-top-width: 1px;
|
|
28
|
+
border-color: ${(props: any) => props.theme.colors.border};
|
|
29
|
+
width: 100%;
|
|
30
|
+
justify-content: space-between;
|
|
31
|
+
background-color: #FFF;
|
|
32
|
+
z-index: 1000;
|
|
33
|
+
justify-content: space-between;
|
|
34
|
+
`
|
|
35
|
+
|
|
36
|
+
export const OtpSection = styled.SafeAreaView`
|
|
37
|
+
flex: 1;
|
|
38
|
+
align-items: center;
|
|
39
|
+
justify-content: center;
|
|
40
|
+
`
|
|
41
|
+
|
|
42
|
+
export const DigitInput = styled.Pressable`
|
|
43
|
+
width: 80%;
|
|
44
|
+
flex-direction: row;
|
|
45
|
+
justify-content: space-between;
|
|
46
|
+
`
|
|
47
|
+
|
|
48
|
+
export const CountDownContainer = styled.View`
|
|
49
|
+
background-color: ${(props: any) => `${props.color}4D`};
|
|
50
|
+
border-radius: 7.6px;
|
|
51
|
+
padding: 5px 0px 0px;
|
|
52
|
+
margin: 0 auto;
|
|
53
|
+
display: flex;
|
|
54
|
+
justify-content: center;
|
|
55
|
+
align-items: center;
|
|
56
|
+
width: 80%;
|
|
57
|
+
`
|
|
58
|
+
|
|
59
|
+
export const WrappCountdown = styled.View`
|
|
60
|
+
padding-bottom: 20px;
|
|
61
|
+
padding-top: 20px;
|
|
62
|
+
`
|
|
63
|
+
|
|
64
|
+
export const InputsSection = styled.View`
|
|
65
|
+
display: flex;
|
|
66
|
+
flex-direction: row;
|
|
67
|
+
justify-content: space-between;
|
|
68
|
+
padding-bottom: 20px;
|
|
69
|
+
`
|
|
70
|
+
|
|
71
|
+
export const ErrorSection = styled.View`
|
|
72
|
+
margin-bottom: 20px;
|
|
73
|
+
width: 100%;
|
|
74
|
+
display: flex;
|
|
75
|
+
justify-content: center;
|
|
76
|
+
flex-direction: column;
|
|
77
|
+
`
|
|
@@ -144,7 +144,7 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
|
|
|
144
144
|
{isFarAway && (
|
|
145
145
|
<FarAwayMessage style={styles.farAwayMsg}>
|
|
146
146
|
<Ionicons name='md-warning-outline' style={styles.iconStyle} />
|
|
147
|
-
<OText size={12} numberOfLines={1} ellipsizeMode={'tail'} color={theme.colors.textNormal}>{t('YOU_ARE_FAR_FROM_ADDRESS', '
|
|
147
|
+
<OText size={12} numberOfLines={1} ellipsizeMode={'tail'} color={theme.colors.textNormal}>{t('YOU_ARE_FAR_FROM_ADDRESS', 'You are far from this address')}</OText>
|
|
148
148
|
</FarAwayMessage>
|
|
149
149
|
)}
|
|
150
150
|
<View style={styles.wrapperOrderOptions}>
|