ordering-ui-react-native 0.21.9 → 0.21.11
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/shared/OToast.tsx +3 -2
- package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +3 -4
- package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +6 -0
- package/themes/original/src/components/LoginForm/Otp/index.tsx +6 -9
- package/themes/original/src/components/LoginForm/index.tsx +1 -1
- package/themes/original/src/components/UserVerification/index.tsx +52 -49
package/package.json
CHANGED
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import { Animated, StyleSheet, Text, View
|
|
2
|
+
import { Animated, StyleSheet, Text, View } from "react-native";
|
|
3
|
+
import { useSafeAreaInsets } from 'react-native-safe-area-context'
|
|
3
4
|
import { ToastType, useToast, useLanguage } from "ordering-components/native";
|
|
4
5
|
import { useTheme } from 'styled-components/native';
|
|
5
6
|
import { getTraduction } from '../../utils'
|
|
6
7
|
|
|
7
8
|
const fadeDuration = 300;
|
|
8
|
-
const topPosition = Platform.OS === 'ios' ? 40 : 20
|
|
9
9
|
|
|
10
10
|
export const Toast = (props: any) => {
|
|
11
11
|
const [toastConfig, { hideToast }] = useToast();
|
|
12
12
|
const [, t] = useLanguage()
|
|
13
13
|
const opacity = React.useRef(new Animated.Value(0)).current;
|
|
14
14
|
const theme = useTheme();
|
|
15
|
+
const { top: topPosition } = useSafeAreaInsets();
|
|
15
16
|
|
|
16
17
|
const fadeIn = React.useCallback(() => {
|
|
17
18
|
Animated.timing(opacity, {
|
|
@@ -576,15 +576,14 @@ export const OrderContentComponent = (props: OrderContent) => {
|
|
|
576
576
|
</Table>
|
|
577
577
|
))
|
|
578
578
|
}
|
|
579
|
-
{order?.summary?.driver_tip > 0 && (
|
|
579
|
+
{(order?.summary?.driver_tip > 0 || order?.driver_tip > 0) && (
|
|
580
580
|
<Table>
|
|
581
581
|
<OText mBottom={4}>
|
|
582
582
|
{t('DRIVER_TIP', 'Driver tip')}
|
|
583
|
-
{order?.
|
|
584
|
-
parseInt(configs?.driver_tip_type?.value, 10) === 2 &&
|
|
583
|
+
{order?.driver_tip > 0 && parseInt(configs?.driver_tip_type?.value, 10) === 2 &&
|
|
585
584
|
!parseInt(configs?.driver_tip_use_custom?.value, 10) &&
|
|
586
585
|
(
|
|
587
|
-
`(${verifyDecimals(order?.
|
|
586
|
+
`(${verifyDecimals(order?.driver_tip, parseNumber)}%)`
|
|
588
587
|
)}
|
|
589
588
|
</OText>
|
|
590
589
|
<OText mBottom={4}>{parsePrice(order?.summary?.driver_tip ?? order?.totalDriverTip, { currency: order?.currency })}</OText>
|
|
@@ -693,10 +693,16 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
|
|
|
693
693
|
};
|
|
694
694
|
|
|
695
695
|
export const BusinessesListing = (props: BusinessesListingParams) => {
|
|
696
|
+
|
|
696
697
|
const BusinessesListingProps = {
|
|
697
698
|
...props,
|
|
698
699
|
isForceSearch: Platform.OS === 'ios',
|
|
699
700
|
UIComponent: BusinessesListingUI,
|
|
701
|
+
paginationSettings: {
|
|
702
|
+
initialPage: 1,
|
|
703
|
+
pageSize: 50,
|
|
704
|
+
controlType: 'infinity'
|
|
705
|
+
}
|
|
700
706
|
};
|
|
701
707
|
|
|
702
708
|
return <BusinessesListingController {...BusinessesListingProps} />;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { useEffect, useRef, useState } from 'react'
|
|
2
2
|
import { formatSeconds } from '../../../utils'
|
|
3
|
-
import { StyleSheet, TouchableOpacity, View,
|
|
3
|
+
import { StyleSheet, TouchableOpacity, View, SafeAreaView } from 'react-native';
|
|
4
4
|
import { useCountdownTimer } from '../../../../../../src/hooks/useCountdownTimer';
|
|
5
5
|
import { useLanguage } from 'ordering-components/native';
|
|
6
6
|
import { OTPContainer } from './styles';
|
|
@@ -87,20 +87,19 @@ export const Otp = (props: otpParams) => {
|
|
|
87
87
|
fontSize: 16
|
|
88
88
|
},
|
|
89
89
|
wrapperIcon: {
|
|
90
|
-
marginTop: Platform.OS === 'ios' ? 40 : 12,
|
|
91
|
-
marginBottom: 20,
|
|
92
90
|
alignItems: 'center',
|
|
93
91
|
justifyContent: 'center',
|
|
94
|
-
paddingRight:
|
|
92
|
+
paddingRight: 20
|
|
95
93
|
},
|
|
96
94
|
closeContainer: {
|
|
97
95
|
width: '100%',
|
|
98
96
|
flexDirection: 'row',
|
|
97
|
+
alignItems: 'center'
|
|
99
98
|
}
|
|
100
99
|
});
|
|
101
100
|
|
|
102
101
|
return (
|
|
103
|
-
|
|
102
|
+
<SafeAreaView style={{ flex: 1, backgroundColor: theme.colors.backgroundPage }}>
|
|
104
103
|
<OTPContainer>
|
|
105
104
|
<View
|
|
106
105
|
style={loginStyle.closeContainer}>
|
|
@@ -110,9 +109,7 @@ export const Otp = (props: otpParams) => {
|
|
|
110
109
|
width={22}
|
|
111
110
|
/>
|
|
112
111
|
</TouchableOpacity>
|
|
113
|
-
<OText size={22}
|
|
114
|
-
marginTop: 5
|
|
115
|
-
}}>
|
|
112
|
+
<OText size={22}>
|
|
116
113
|
{t('ENTER_VERIFICATION_CODE', 'Enter verification code')}
|
|
117
114
|
</OText>
|
|
118
115
|
</View>
|
|
@@ -150,6 +147,6 @@ export const Otp = (props: otpParams) => {
|
|
|
150
147
|
text={t('CANCEL', 'Cancel')}
|
|
151
148
|
/>
|
|
152
149
|
</OTPContainer>
|
|
153
|
-
|
|
150
|
+
</SafeAreaView>
|
|
154
151
|
)
|
|
155
152
|
}
|
|
@@ -179,7 +179,7 @@ const LoginFormUI = (props: LoginParams) => {
|
|
|
179
179
|
vibrateApp()
|
|
180
180
|
return
|
|
181
181
|
}
|
|
182
|
-
if (
|
|
182
|
+
if (otpType === 'cellphone' && phoneInputData?.error && !phoneInputData?.phone?.cellphone) {
|
|
183
183
|
showToast(ToastType.Error, t('PHONE_NUMBER_REQUIRED', 'Phone number is required'));
|
|
184
184
|
return
|
|
185
185
|
}
|
|
@@ -195,38 +195,39 @@ const UserVerificationUI = (props: any) => {
|
|
|
195
195
|
}
|
|
196
196
|
|
|
197
197
|
useEffect(() => {
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
198
|
+
if (verificationState.phone) {
|
|
199
|
+
let _timer = TIME_COUNTDOWN - 1;
|
|
200
|
+
let minutes = 0;
|
|
201
|
+
let seconds = 0;
|
|
202
|
+
const interval = setInterval(() => {
|
|
203
|
+
minutes = _timer / 60;
|
|
204
|
+
seconds = _timer % 60;
|
|
205
|
+
|
|
206
|
+
minutes = minutes < 10 ? 0 + minutes : minutes;
|
|
207
|
+
seconds = seconds < 10 ? 0 + seconds : seconds;
|
|
208
|
+
|
|
209
|
+
const formatMinutes = parseInt(minutes.toString()) < 10
|
|
210
|
+
? `0${parseInt(minutes.toString())}`
|
|
211
|
+
: parseInt(minutes.toString());
|
|
212
|
+
|
|
213
|
+
const formatseconds = parseInt(seconds.toString()) < 10
|
|
214
|
+
? `0${parseInt(seconds.toString())}`
|
|
215
|
+
: parseInt(seconds.toString());
|
|
216
|
+
|
|
217
|
+
setTimer(`${formatMinutes}:${formatseconds}`);
|
|
218
|
+
|
|
219
|
+
if (--_timer < 0) {
|
|
220
|
+
clearInterval(interval);
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
if (timer === `${TIME_COUNTDOWN / 60}:00` && isSendCodeAgain) {
|
|
224
|
+
setIsSendCodeAgain(false)
|
|
225
|
+
clearInterval(interval);
|
|
226
|
+
}
|
|
227
|
+
}, 1000);
|
|
228
|
+
return () => clearInterval(interval)
|
|
229
|
+
}
|
|
230
|
+
}, [isSendCodeAgain, verificationState.phone])
|
|
230
231
|
|
|
231
232
|
useEffect(() => {
|
|
232
233
|
if (otpState?.length === CODE_LENGTH) {
|
|
@@ -460,23 +461,25 @@ const UserVerificationUI = (props: any) => {
|
|
|
460
461
|
)}
|
|
461
462
|
|
|
462
463
|
</Container>
|
|
463
|
-
|
|
464
|
-
<
|
|
465
|
-
<
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
464
|
+
{!!phoneState?.cellphone && (
|
|
465
|
+
<ButtonsActions>
|
|
466
|
+
<View style={{ width: '100%' }}>
|
|
467
|
+
<OButton
|
|
468
|
+
onClick={(verificationState.email || verificationState.phone)
|
|
469
|
+
? () => setVerificationState({ email: false, phone: false })
|
|
470
|
+
: () => handleSendOtp(isPhoneVerifyRequired && !isEmailVerifyRequired ? 'phone' : '')
|
|
471
|
+
}
|
|
472
|
+
text={(verificationState.email || verificationState.phone) ? t('CANCEL', 'Cancel') : t('SEND_CODE', 'Send code')}
|
|
473
|
+
bgColor={(verificationState.email || verificationState.phone) ? theme.colors.secundary : theme.colors.primary}
|
|
474
|
+
borderColor={(verificationState.email || verificationState.phone) ? theme.colors.secundary : theme.colors.primary}
|
|
475
|
+
textStyle={{ color: (verificationState.email || verificationState.phone) ? 'black' : 'white' }}
|
|
476
|
+
imgRightSrc={null}
|
|
477
|
+
isLoading={verifyEmailState?.loadingSendCode || verifyEmailState?.loadingCheckCode || verifyPhoneState?.loadingSendCode || verifyPhoneState?.loadingCheckCode}
|
|
478
|
+
style={(verificationState.email || verificationState.phone) ? style.btnStyle : { borderRadius: 7.6 }}
|
|
479
|
+
/>
|
|
480
|
+
</View>
|
|
481
|
+
</ButtonsActions>
|
|
482
|
+
)}
|
|
480
483
|
<View style={{ paddingHorizontal: 20, paddingBottom: 80 }}>
|
|
481
484
|
<UserDetails
|
|
482
485
|
user={user}
|