@akinon/pz-otp 2.0.0-beta.7 → 2.0.0-beta.9

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 CHANGED
@@ -1,5 +1,13 @@
1
1
  # @akinon/pz-otp
2
2
 
3
+ ## 2.0.0-beta.9
4
+
5
+ ### Minor Changes
6
+
7
+ - 0fe7711: ZERO-3387: Upgrade nextjs, eslint-config-next
8
+
9
+ ## 2.0.0-beta.8
10
+
3
11
  ## 2.0.0-beta.7
4
12
 
5
13
  ## 2.0.0-beta.6
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@akinon/pz-otp",
3
- "version": "2.0.0-beta.7",
3
+ "version": "2.0.0-beta.9",
4
4
  "license": "MIT",
5
5
  "main": "./src/index.ts",
6
6
  "module": "./src/index.ts",
package/readme.md CHANGED
@@ -1,11 +1,11 @@
1
1
  # @akinon/pz-otp
2
2
 
3
- ### Install the npm package
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 otpPopupVisible = useAppSelector((state) => state.otp?.isPopupVisible);
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
- document.body.style.overflow = 'hidden';
122
- window.scrollTo({ top: 0, behavior: 'smooth' });
120
+ if (isPopupVisible) {
121
+ document.body.style.overflow = 'hidden';
122
+ window.scrollTo({ top: 0, behavior: 'smooth' });
123
123
 
124
- return () => {
125
- document.body.style.overflow = 'auto';
126
- };
124
+ return () => {
125
+ document.body.style.overflow = 'auto';
126
+ };
127
+ }
127
128
  }, []);
128
129
 
129
- if (!otpPopupVisible) return null;
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">