@akinon/pz-otp 2.0.0-beta.7 → 2.0.0-beta.8
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/CHANGELOG.md +2 -0
- package/package.json +1 -1
- package/readme.md +4 -4
- package/src/views/Otp.tsx +11 -10
package/CHANGELOG.md
CHANGED
package/package.json
CHANGED
package/readme.md
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
# @akinon/pz-otp
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
## Installation method
|
|
4
|
+
|
|
5
|
+
You can use the following command to install the extension with the latest plugins:
|
|
4
6
|
|
|
5
7
|
```bash
|
|
6
|
-
# For latest version
|
|
7
|
-
yarn add @akinon/pz-otp
|
|
8
8
|
|
|
9
|
-
# Preferred installation method
|
|
10
9
|
npx @akinon/projectzero@latest --plugins
|
|
10
|
+
|
|
11
11
|
```
|
package/src/views/Otp.tsx
CHANGED
|
@@ -30,7 +30,6 @@ type ComponentClasses = ComponentClassKey | ComponentWrapperClassKey;
|
|
|
30
30
|
type OtpProps = {
|
|
31
31
|
codeLength?: number;
|
|
32
32
|
timer?: number;
|
|
33
|
-
phone?: string;
|
|
34
33
|
submitAction: SubmitHandler<{
|
|
35
34
|
[key: string]: any;
|
|
36
35
|
}>;
|
|
@@ -53,15 +52,15 @@ export const Otp = ({
|
|
|
53
52
|
timer = 60,
|
|
54
53
|
texts,
|
|
55
54
|
classes,
|
|
56
|
-
error
|
|
57
|
-
phone
|
|
55
|
+
error
|
|
58
56
|
}: OtpProps) => {
|
|
57
|
+
const { phone } = data;
|
|
59
58
|
const [otp, setOtp] = useState('');
|
|
60
59
|
const [canResend, setCanResend] = useState(false);
|
|
61
60
|
const [time, setTime] = useState(timer);
|
|
62
61
|
const [hasError, setHasError] = useState(false);
|
|
63
62
|
const dispatch = useAppDispatch();
|
|
64
|
-
const
|
|
63
|
+
const { isPopupVisible } = useAppSelector((state) => state.otp);
|
|
65
64
|
|
|
66
65
|
const resetTimer = () => {
|
|
67
66
|
setTime(timer);
|
|
@@ -118,15 +117,17 @@ export const Otp = ({
|
|
|
118
117
|
}, [time, onTimerEnd]);
|
|
119
118
|
|
|
120
119
|
useEffect(() => {
|
|
121
|
-
|
|
122
|
-
|
|
120
|
+
if (isPopupVisible) {
|
|
121
|
+
document.body.style.overflow = 'hidden';
|
|
122
|
+
window.scrollTo({ top: 0, behavior: 'smooth' });
|
|
123
123
|
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
124
|
+
return () => {
|
|
125
|
+
document.body.style.overflow = 'auto';
|
|
126
|
+
};
|
|
127
|
+
}
|
|
127
128
|
}, []);
|
|
128
129
|
|
|
129
|
-
if (!
|
|
130
|
+
if (!isPopupVisible) return null;
|
|
130
131
|
|
|
131
132
|
return (
|
|
132
133
|
<div className="fixed left-0 top-0 z-50 flex h-screen w-screen items-end md:items-center md:justify-center md:bg-black/10">
|