ordering-ui-react-native 0.16.72-release → 0.16.73-release
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/OrderCreating/index.tsx +2 -2
- package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +2 -2
- package/themes/business/src/components/LoginForm/Otp/index.tsx +120 -0
- package/themes/business/src/components/LoginForm/Otp/styles.tsx +7 -0
- package/themes/business/src/components/LoginForm/index.tsx +235 -80
- package/themes/business/src/components/LoginForm/styles.tsx +10 -0
- package/themes/business/src/components/ProductItemAccordion/index.tsx +21 -3
- package/themes/business/src/types/index.tsx +15 -0
- package/themes/business/src/utils/index.tsx +16 -0
- package/themes/kiosk/src/components/LoginForm/Otp/index.tsx +92 -0
- package/themes/kiosk/src/components/LoginForm/Otp/styles.tsx +7 -0
- package/themes/kiosk/src/components/LoginForm/index.tsx +473 -151
- package/themes/kiosk/src/components/LoginForm/styles.tsx +14 -1
- package/themes/kiosk/src/components/PhoneInputNumber/index.tsx +1 -0
- package/themes/kiosk/src/components/PhoneInputNumber/styles.tsx +1 -3
- package/themes/kiosk/src/components/shared/OModal.tsx +14 -11
- package/themes/kiosk/src/layouts/Container.tsx +7 -1
- package/themes/kiosk/src/types/index.d.ts +13 -0
- package/themes/kiosk/src/utils/index.tsx +15 -0
- package/themes/original/src/components/BusinessListingSearch/index.tsx +12 -7
- package/themes/original/src/components/BusinessProductsListing/index.tsx +1 -0
- package/themes/original/src/components/Cart/index.tsx +3 -2
- package/themes/original/src/components/Checkout/index.tsx +4 -3
- package/themes/original/src/components/Favorite/index.tsx +1 -1
- package/themes/original/src/components/Help/index.tsx +2 -2
- package/themes/original/src/components/HelpGuide/index.tsx +2 -2
- package/themes/original/src/components/HelpGuide/styles.tsx +1 -0
- package/themes/original/src/components/Messages/index.tsx +8 -7
- package/themes/original/src/components/OrderDetails/index.tsx +8 -3
- package/themes/original/src/components/OrderProgress/index.tsx +2 -5
- package/themes/original/src/components/OrdersOption/index.tsx +17 -29
- package/themes/original/src/components/ProductForm/index.tsx +29 -2
- package/themes/original/src/components/ProductOptionSubOption/index.tsx +1 -1
- package/themes/original/src/components/ProfessionalFilter/SingleProfessionalCard/index.tsx +108 -0
- package/themes/original/src/components/ProfessionalFilter/index.tsx +20 -50
- package/themes/original/src/components/ProfessionalProfile/index.tsx +1 -1
- package/themes/original/src/components/ServiceForm/index.tsx +11 -3
- package/themes/original/src/components/Sessions/index.tsx +11 -8
- package/themes/original/src/components/Sessions/styles.tsx +5 -0
- package/themes/original/src/components/SingleProductCard/index.tsx +62 -24
- package/themes/original/src/components/SingleProductCard/styles.tsx +12 -4
- package/themes/original/src/components/UpsellingProducts/index.tsx +3 -3
- package/themes/original/src/components/UserProfileForm/index.tsx +3 -1
- package/themes/original/src/components/UserProfileForm/styles.tsx +1 -1
- package/themes/original/src/components/Wallets/index.tsx +4 -3
- package/themes/original/src/types/index.tsx +2 -1
- package/themes/original/src/utils/index.tsx +12 -0
|
@@ -23,6 +23,21 @@ export interface LoginParams {
|
|
|
23
23
|
notificationState?: any;
|
|
24
24
|
handleReCaptcha?: any;
|
|
25
25
|
enableReCaptcha?: any;
|
|
26
|
+
|
|
27
|
+
otpType?: string,
|
|
28
|
+
setOtpType: (type : string) => void,
|
|
29
|
+
generateOtpCode: (values ?: any) => void,
|
|
30
|
+
useLoginOtpEmail?: boolean,
|
|
31
|
+
useLoginOtpCellphone?: boolean,
|
|
32
|
+
useLoginOtp?: boolean
|
|
33
|
+
}
|
|
34
|
+
export interface otpParams {
|
|
35
|
+
willVerifyOtpState: boolean,
|
|
36
|
+
setWillVerifyOtpState: (val : boolean) => void,
|
|
37
|
+
onSubmit: () => void,
|
|
38
|
+
handleLoginOtp: (code : string) => void,
|
|
39
|
+
setAlertState: any,
|
|
40
|
+
formState?: any
|
|
26
41
|
}
|
|
27
42
|
export interface ProfileParams {
|
|
28
43
|
navigation?: any;
|
|
@@ -353,3 +353,19 @@ export const transformDistance = (value : number, distanceUnit?: string) => {
|
|
|
353
353
|
? (value * 3280.84).toFixed(0)
|
|
354
354
|
: (value).toFixed(2)
|
|
355
355
|
}
|
|
356
|
+
|
|
357
|
+
export const formatSeconds = (seconds : number) => {
|
|
358
|
+
// Hours, minutes and seconds
|
|
359
|
+
const hrs = Math.floor(seconds / 3600)
|
|
360
|
+
const mins = Math.floor((seconds % 3600) / 60)
|
|
361
|
+
const secs = Math.floor(seconds % 60)
|
|
362
|
+
|
|
363
|
+
// Output like '1:01' or '4:03:59' or '123:03:59'
|
|
364
|
+
let ret = ''
|
|
365
|
+
if (hrs > 0) {
|
|
366
|
+
ret += '' + hrs + ':' + (mins < 10 ? '0' : '')
|
|
367
|
+
}
|
|
368
|
+
ret += '' + mins + ':' + (secs < 10 ? '0' : '')
|
|
369
|
+
ret += '' + secs
|
|
370
|
+
return ret
|
|
371
|
+
}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import React, { useEffect } from 'react'
|
|
2
|
+
import { formatSeconds } from '../../../utils'
|
|
3
|
+
import { StyleSheet, TouchableOpacity } from 'react-native';
|
|
4
|
+
import { useCountdownTimer } from '../../../../../../src/hooks/useCountdownTimer';
|
|
5
|
+
import { useLanguage } from 'ordering-components/native';
|
|
6
|
+
import { OTPContainer } from './styles';
|
|
7
|
+
import { OText, OButton } from '../../shared';
|
|
8
|
+
import OTPInputView from '@twotalltotems/react-native-otp-input'
|
|
9
|
+
import { useTheme } from 'styled-components/native';
|
|
10
|
+
import { otpParams } from '../../../types'
|
|
11
|
+
|
|
12
|
+
export const Otp = (props: otpParams) => {
|
|
13
|
+
const {
|
|
14
|
+
willVerifyOtpState,
|
|
15
|
+
setWillVerifyOtpState,
|
|
16
|
+
onSubmit,
|
|
17
|
+
handleLoginOtp,
|
|
18
|
+
setAlertState,
|
|
19
|
+
pinCount
|
|
20
|
+
} = props
|
|
21
|
+
|
|
22
|
+
const theme = useTheme();
|
|
23
|
+
const [, t] = useLanguage();
|
|
24
|
+
const [otpLeftTime, _, resetOtpLeftTime]: any = useCountdownTimer(
|
|
25
|
+
600, willVerifyOtpState)
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
const handleOnSubmit = () => {
|
|
29
|
+
setAlertState({
|
|
30
|
+
open: true,
|
|
31
|
+
title: t('CODE_SENT', 'The code has been sent'),
|
|
32
|
+
})
|
|
33
|
+
resetOtpLeftTime()
|
|
34
|
+
onSubmit()
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
useEffect(() => {
|
|
38
|
+
if (otpLeftTime === 0) {
|
|
39
|
+
setAlertState({
|
|
40
|
+
open: true,
|
|
41
|
+
title: t('TIME_IS_UP', 'Time is up'),
|
|
42
|
+
content: t('PLEASE_RESEND_CODE', 'Please resend code again')
|
|
43
|
+
})
|
|
44
|
+
}
|
|
45
|
+
}, [otpLeftTime])
|
|
46
|
+
|
|
47
|
+
const loginStyle = StyleSheet.create({
|
|
48
|
+
underlineStyleBase: {
|
|
49
|
+
width: 45,
|
|
50
|
+
height: 60,
|
|
51
|
+
borderWidth: 1,
|
|
52
|
+
fontSize: 16
|
|
53
|
+
},
|
|
54
|
+
underlineStyleHighLighted: {
|
|
55
|
+
borderColor: theme.colors.primary,
|
|
56
|
+
color: theme.colors.primary,
|
|
57
|
+
fontSize: 16
|
|
58
|
+
},
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
return (
|
|
62
|
+
<>
|
|
63
|
+
<OTPContainer>
|
|
64
|
+
<OText size={24}>
|
|
65
|
+
{formatSeconds(otpLeftTime)}
|
|
66
|
+
</OText>
|
|
67
|
+
<OTPInputView
|
|
68
|
+
style={{ width: '100%', height: 150 }}
|
|
69
|
+
pinCount={pinCount || 6}
|
|
70
|
+
codeInputFieldStyle={loginStyle.underlineStyleBase}
|
|
71
|
+
codeInputHighlightStyle={loginStyle.underlineStyleHighLighted}
|
|
72
|
+
onCodeFilled={(code: string) => handleLoginOtp(code)}
|
|
73
|
+
selectionColor={theme.colors.primary}
|
|
74
|
+
editable
|
|
75
|
+
/>
|
|
76
|
+
<TouchableOpacity onPress={() => handleOnSubmit()} disabled={otpLeftTime > 520}>
|
|
77
|
+
<OText size={16} mBottom={30} color={otpLeftTime > 520 ? theme.colors.disabled : theme.colors.primary}>
|
|
78
|
+
{t('RESEND_CODE', 'Resend code')}
|
|
79
|
+
</OText>
|
|
80
|
+
</TouchableOpacity>
|
|
81
|
+
<OButton
|
|
82
|
+
onClick={() => setWillVerifyOtpState(false)}
|
|
83
|
+
bgColor={theme.colors.white}
|
|
84
|
+
borderColor={theme.colors.primary}
|
|
85
|
+
textStyle={{ color: theme.colors.primary }}
|
|
86
|
+
style={{ borderRadius: 8, width: '100%' }}
|
|
87
|
+
text={t('CANCEL', 'Cancel')}
|
|
88
|
+
/>
|
|
89
|
+
</OTPContainer>
|
|
90
|
+
</>
|
|
91
|
+
)
|
|
92
|
+
}
|