@akinon/pz-otp 1.59.0-rc.4 → 1.59.0

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,20 +1,6 @@
1
1
  # @akinon/pz-otp
2
2
 
3
- ## 1.59.0-rc.4
4
-
5
- ## 1.59.0-rc.3
6
-
7
- ## 1.59.0-rc.2
8
-
9
- ## 1.59.0-rc.1
10
-
11
- ## 1.59.0-rc.0
12
-
13
- ### Minor Changes
14
-
15
- - 64699d3f: ZERO-2761: Fix invalid import for plugin module
16
- - 7b05522: ZERO-2905: Fix resend and close button in otp package
17
- - 29ead87: ZERO-2905: Fix resend and close button in otp package
3
+ ## 1.59.0
18
4
 
19
5
  ## 1.58.0
20
6
 
package/package.json CHANGED
@@ -1,9 +1,8 @@
1
1
  {
2
2
  "name": "@akinon/pz-otp",
3
- "version": "1.59.0-rc.4",
3
+ "version": "1.59.0",
4
4
  "license": "MIT",
5
- "main": "./src/index.ts",
6
- "module": "./src/index.ts",
5
+ "main": "src/index.tsx",
7
6
  "peerDependencies": {
8
7
  "react": "^18.0.0",
9
8
  "react-dom": "^18.0.0"
package/src/index.tsx ADDED
@@ -0,0 +1,4 @@
1
+ import otpReducer from './redux/reducer';
2
+
3
+ export * from './views/Otp';
4
+ export { otpReducer };
@@ -3,8 +3,8 @@ import { Button } from '@akinon/next/components/button';
3
3
  import OtpInput from 'react-otp-input';
4
4
  import { SubmitHandler } from 'react-hook-form';
5
5
  import { twMerge } from 'tailwind-merge';
6
- import { useAppDispatch, useAppSelector } from '@akinon/next/redux/hooks';
7
- import { hidePopup } from '@akinon/pz-otp/src/redux/reducer';
6
+ import { useAppDispatch } from '@akinon/next/redux/hooks';
7
+ import { hidePopup } from '../redux/reducer';
8
8
 
9
9
  enum Component {
10
10
  Title = 'title',
@@ -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,13 @@ export const Otp = ({
53
52
  timer = 60,
54
53
  texts,
55
54
  classes,
56
- error,
57
- phone
55
+ error
58
56
  }: OtpProps) => {
59
57
  const [otp, setOtp] = useState('');
60
58
  const [canResend, setCanResend] = useState(false);
61
59
  const [time, setTime] = useState(timer);
62
60
  const [hasError, setHasError] = useState(false);
63
61
  const dispatch = useAppDispatch();
64
- const otpPopupVisible = useAppSelector((state) => state.otp?.isPopupVisible);
65
62
 
66
63
  const resetTimer = () => {
67
64
  setTime(timer);
@@ -73,16 +70,11 @@ export const Otp = ({
73
70
 
74
71
  if (submitAction) {
75
72
  data.code = otp;
76
- data.phone = phone;
77
73
  const res = await submitAction(data);
78
74
 
79
75
  if (res?.status !== 200 || error) {
80
76
  setHasError(true);
81
77
  }
82
-
83
- if (res?.status === 200) {
84
- dispatch(hidePopup());
85
- }
86
78
  }
87
79
  };
88
80
 
@@ -95,7 +87,6 @@ export const Otp = ({
95
87
 
96
88
  if (submitAction) {
97
89
  resetTimer();
98
- data.phone = phone;
99
90
  data.resend = true;
100
91
  await submitAction(data);
101
92
  }
@@ -126,8 +117,6 @@ export const Otp = ({
126
117
  };
127
118
  }, []);
128
119
 
129
- if (!otpPopupVisible) return null;
130
-
131
120
  return (
132
121
  <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">
133
122
  <div className="h-[calc(100vh-48px)] w-screen flex md:h-auto md:max-w-lg flex-col items-center rounded-sm bg-white p-8 shadow-xl">
package/src/index.ts DELETED
@@ -1,4 +0,0 @@
1
- import otpReducer from './redux/reducer';
2
- import { Otp } from './views/otp';
3
-
4
- export { otpReducer, Otp };