namirasoft-account-react 1.4.290 → 1.4.291

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.
@@ -1,7 +1,7 @@
1
- import { ReactNode } from "react";
1
+ import React, { ReactNode } from "react";
2
2
  import { IBaseComponentProps, NSRouterMakerProps } from 'namirasoft-site-react';
3
3
  import { NSARouterMakerProps } from '../NSARouterMakerProps';
4
- export interface INSAVerificationPageProps extends IBaseComponentProps, NSRouterMakerProps, NSARouterMakerProps {
4
+ export interface NSAVerificationPageProps extends IBaseComponentProps, NSRouterMakerProps, NSARouterMakerProps {
5
5
  contact_type: string;
6
6
  contact_value_name: string;
7
7
  getContactValue: (checkErrors: boolean) => string;
@@ -13,4 +13,12 @@ export interface INSAVerificationPageProps extends IBaseComponentProps, NSRouter
13
13
  export interface NSAVerificationPageState {
14
14
  isSendCode: boolean;
15
15
  }
16
- export declare function NSAVerificationPage(props: INSAVerificationPageProps): import("react/jsx-runtime").JSX.Element;
16
+ export declare class NSAVerificationPage extends React.Component<NSAVerificationPageProps, NSAVerificationPageState> {
17
+ private NSButtonBlue_Verify;
18
+ private NSBoxString_Code;
19
+ constructor(props: NSAVerificationPageProps);
20
+ private onRequest;
21
+ private onVerify;
22
+ componentDidMount(): void;
23
+ render(): ReactNode;
24
+ }
@@ -8,75 +8,83 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  });
9
9
  };
10
10
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
11
- import { useEffect, useRef, useState } from "react";
11
+ import React, { createRef } from "react";
12
12
  import { NSBoxString } from 'namirasoft-site-react';
13
13
  import { NSSection, NSSpace, NSSpaceSizeType, NSButtonBlue } from 'namirasoft-site-react';
14
14
  import Styles from './NSAVerificationPage.module.css';
15
- export function NSAVerificationPage(props) {
16
- var _a, _b, _c;
17
- let NSButtonBlue_Verify = useRef(null);
18
- let NSBoxString_Code = useRef(null);
19
- let code = (_a = props.url.getQuery("code")) !== null && _a !== void 0 ? _a : "";
20
- useEffect(() => {
21
- var _a;
22
- if (code) {
23
- (_a = NSBoxString_Code.current) === null || _a === void 0 ? void 0 : _a.setValue(code, () => {
24
- var _a;
25
- (_a = NSButtonBlue_Verify.current) === null || _a === void 0 ? void 0 : _a.performClick();
26
- });
27
- }
28
- }, [code, NSButtonBlue_Verify.current]);
29
- const [state, setState] = useState({
30
- isSendCode: code.length > 0
31
- });
32
- function onRequest(onFinshied) {
15
+ export class NSAVerificationPage extends React.Component {
16
+ constructor(props) {
17
+ super(props);
18
+ this.NSButtonBlue_Verify = createRef();
19
+ this.NSBoxString_Code = createRef();
20
+ this.state = { isSendCode: false };
21
+ this.onRequest = this.onRequest.bind(this);
22
+ this.onVerify = this.onVerify.bind(this);
23
+ }
24
+ onRequest(onFinshied) {
33
25
  return __awaiter(this, void 0, void 0, function* () {
34
26
  try {
35
- props.onRequest(props.getContactValue(true)).then(() => {
36
- setState(prevState => (Object.assign(Object.assign({}, prevState), { isSendCode: true })));
37
- props.notifier.onSuccess(`Verification code has been sent successfully.`);
27
+ this.props.onRequest(this.props.getContactValue(true)).then(() => {
28
+ this.setState({ isSendCode: true });
29
+ this.props.notifier.onSuccess(`Verification code has been sent successfully.`);
38
30
  onFinshied();
39
31
  }).catch(onFinshied);
40
32
  }
41
33
  catch (error) {
42
- props.notifier.onError(error);
34
+ this.props.notifier.onError(error);
43
35
  }
44
36
  });
45
37
  }
46
- function onVerify(onFinshied) {
38
+ onVerify(onFinshied) {
47
39
  return __awaiter(this, void 0, void 0, function* () {
48
40
  var _a, _b;
49
41
  try {
50
- let code = (_b = (_a = NSBoxString_Code.current) === null || _a === void 0 ? void 0 : _a.getValue()) !== null && _b !== void 0 ? _b : "";
51
- props.onVerify(code).then(() => {
52
- props.notifier.onSuccess("Verification has been done successfully.");
53
- props.notifier.onSuccess("Redirecting ...", 2000);
42
+ let code = (_b = (_a = this.NSBoxString_Code.current) === null || _a === void 0 ? void 0 : _a.getValue()) !== null && _b !== void 0 ? _b : "";
43
+ this.props.onVerify(code).then(() => {
44
+ this.props.notifier.onSuccess("Verification has been done successfully.");
45
+ this.props.notifier.onSuccess("Redirecting ...", 2000);
54
46
  setTimeout(() => {
55
- props.onFinished();
47
+ this.props.onFinished();
56
48
  onFinshied();
57
49
  }, 2000);
58
50
  }).catch(onFinshied);
59
51
  }
60
52
  catch (error) {
61
- props.notifier.onError(error);
53
+ this.props.notifier.onError(error);
62
54
  }
63
55
  });
64
56
  }
65
- return (_jsx(_Fragment, { children: _jsxs(NSSection, { children: [_jsxs("div", { className: `${Styles.nsa_verification_container} ${(_c = (_b = props.classList) === null || _b === void 0 ? void 0 : _b.join(" ")) !== null && _c !== void 0 ? _c : ""}`, style: props.style, children: [_jsx("img", { src: "https://static.namirasoft.com/image/concept/verification/purple.png", alt: 'verification vector', className: Styles.nsa_verification_vector }), _jsxs("div", { className: 'm-0', children: [_jsxs("p", { className: 'm-2', children: ["Type: ", props.contact_type] }), ((state.isSendCode || !props.children) && props.getContactValue(false)) &&
66
- _jsxs("p", { className: 'm-2', children: [props.contact_value_name, ": ", props.getContactValue(false)] }), props.children &&
67
- _jsx("div", { style: { display: state.isSendCode ? "none" : undefined }, children: props.children })] }), state.isSendCode ?
68
- _jsxs(_Fragment, { children: [_jsx("p", { style: { margin: "0px" }, children: "Please enter the code you received" }), _jsx(NSBoxString, { ref: NSBoxString_Code, title: 'Verification Code', placeholder: 'Enter the code', hideHeader: true, required: true, min_length: 6, max_length: 6, input: { style: { fontSize: '24px', fontWeight: "bold", textAlign: "center" } } })] }) :
69
- _jsx(_Fragment, { children: _jsx(NSButtonBlue, { ref: NSButtonBlue_Verify, title: 'Send Code', onClick: {
57
+ componentDidMount() {
58
+ var _a;
59
+ let code = (_a = this.props.url.getQuery("code")) !== null && _a !== void 0 ? _a : "";
60
+ if (code) {
61
+ this.setState({ isSendCode: true }, () => {
62
+ var _a;
63
+ (_a = this.NSBoxString_Code.current) === null || _a === void 0 ? void 0 : _a.setValue(code, () => {
64
+ var _a;
65
+ (_a = this.NSButtonBlue_Verify.current) === null || _a === void 0 ? void 0 : _a.performClick();
66
+ });
67
+ });
68
+ }
69
+ }
70
+ render() {
71
+ var _a, _b;
72
+ return (_jsx(_Fragment, { children: _jsxs(NSSection, { children: [_jsxs("div", { className: `${Styles.nsa_verification_container} ${(_b = (_a = this.props.classList) === null || _a === void 0 ? void 0 : _a.join(" ")) !== null && _b !== void 0 ? _b : ""}`, style: this.props.style, children: [_jsx("img", { src: "https://static.namirasoft.com/image/concept/verification/purple.png", alt: 'verification vector', className: Styles.nsa_verification_vector }), _jsxs("div", { className: 'm-0', children: [_jsxs("p", { className: 'm-2', children: ["Type: ", this.props.contact_type] }), ((this.state.isSendCode || !this.props.children) && this.props.getContactValue(false)) &&
73
+ _jsxs("p", { className: 'm-2', children: [this.props.contact_value_name, ": ", this.props.getContactValue(false)] }), this.props.children &&
74
+ _jsx("div", { style: { display: this.state.isSendCode ? "none" : undefined }, children: this.props.children })] }), this.state.isSendCode ?
75
+ _jsxs(_Fragment, { children: [_jsx("p", { style: { margin: "0px" }, children: "Please enter the code you received" }), _jsx(NSBoxString, { ref: this.NSBoxString_Code, title: 'Verification Code', placeholder: 'Enter the code', hideHeader: true, required: true, min_length: 6, max_length: 6, input: { style: { fontSize: '24px', fontWeight: "bold", textAlign: "center" } } })] }) :
76
+ _jsx(_Fragment, { children: _jsx(NSButtonBlue, { ref: this.NSButtonBlue_Verify, title: 'Send Code', onClick: {
77
+ action: (onFinished) => {
78
+ this.onRequest(onFinished);
79
+ },
80
+ } }) })] }), _jsx(NSSpace, { size: NSSpaceSizeType.NORMAL }), this.state.isSendCode &&
81
+ _jsxs(_Fragment, { children: [_jsx(NSButtonBlue, { title: "Verify", onClick: {
70
82
  action: (onFinished) => {
71
- onRequest(onFinished);
83
+ this.onVerify(onFinished);
72
84
  },
73
- } }) })] }), _jsx(NSSpace, { size: NSSpaceSizeType.NORMAL }), state.isSendCode &&
74
- _jsxs(_Fragment, { children: [_jsx(NSButtonBlue, { title: "Verify", onClick: {
75
- action: (onFinished) => {
76
- onVerify(onFinished);
77
- },
78
- } }), _jsx(NSSpace, { size: NSSpaceSizeType.SMALL }), _jsx("button", { onClick: () => {
79
- setState(prevState => (Object.assign(Object.assign({}, prevState), { isSendCode: false })));
80
- }, className: Styles.nsa_resend_button, children: "Resend Code" })] })] }) }));
85
+ } }), _jsx(NSSpace, { size: NSSpaceSizeType.SMALL }), _jsx("button", { onClick: () => {
86
+ this.setState(prevState => (Object.assign(Object.assign({}, prevState), { isSendCode: false })));
87
+ }, className: Styles.nsa_resend_button, children: "Resend Code" })] })] }) }));
88
+ }
81
89
  }
82
90
  //# sourceMappingURL=NSAVerificationPage.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"NSAVerificationPage.js","sourceRoot":"","sources":["../../src/pages/NSAVerificationPage.tsx"],"names":[],"mappings":";;;;;;;;;;AAAA,OAAO,EAAa,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC/D,OAAO,EAA2C,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAC7F,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAE1F,OAAO,MAAM,MAAM,kCAAkC,CAAC;AAkBtD,MAAM,UAAU,mBAAmB,CAAC,KAAgC;;IAEnE,IAAI,mBAAmB,GAAG,MAAM,CAAe,IAAI,CAAC,CAAC;IACrD,IAAI,gBAAgB,GAAG,MAAM,CAAc,IAAI,CAAC,CAAC;IAEjD,IAAI,IAAI,GAAG,MAAA,KAAK,CAAC,GAAG,CAAC,QAAQ,CAAC,MAAM,CAAC,mCAAI,EAAE,CAAC;IAC5C,SAAS,CAAC,GAAG,EAAE;;QAEd,IAAI,IAAI,EACR,CAAC;YACA,MAAA,gBAAgB,CAAC,OAAO,0CAAE,QAAQ,CAAC,IAAI,EAAE,GAAG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,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,EAAE,GAC9E,IACA,CAAC,CAAC;gCACL,4BACC,KAAC,YAAY,IACZ,GAAG,EAAE,IAAI,CAAC,mBAAmB,EAC7B,KAAK,EAAC,WAAW,EACjB,OAAO,EAAE;4CACR,MAAM,EAAE,CAAC,UAAU,EAAE,EAAE;gDAEtB,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC;4CAC5B,CAAC;yCACD,GACA,GACA,IAEA,EACN,KAAC,OAAO,IAAC,IAAI,EAAE,eAAe,CAAC,MAAM,GAAY,EAEhD,IAAI,CAAC,KAAK,CAAC,UAAU;wBACrB,8BACC,KAAC,YAAY,IACZ,KAAK,EAAC,QAAQ,EACd,OAAO,EAAE;wCACR,MAAM,EAAE,CAAC,UAAU,EAAE,EAAE;4CAEtB,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC;wCAC3B,CAAC;qCACD,GACA,EACF,KAAC,OAAO,IAAC,IAAI,EAAE,eAAe,CAAC,KAAK,GAAY,EAChD,iBAAQ,OAAO,EAAE,GAAG,EAAE;wCAErB,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE,CAAC,iCAAM,SAAS,KAAE,UAAU,EAAE,KAAK,IAAG,CAAC,CAAA;oCAClE,CAAC,EAAE,SAAS,EAAE,MAAM,CAAC,iBAAiB,4BAAsB,IAC1D,IAEQ,GACX,CACH,CAAC;IACH,CAAC;CACD"}
package/package.json CHANGED
@@ -8,7 +8,7 @@
8
8
  "framework": "npm",
9
9
  "application": "package",
10
10
  "private": false,
11
- "version": "1.4.290",
11
+ "version": "1.4.291",
12
12
  "author": "Amir Abolhasani",
13
13
  "license": "MIT",
14
14
  "main": "./dist/main.js",
@@ -1,10 +1,10 @@
1
- import { ReactNode, useEffect, useRef, useState } from "react";
1
+ import React, { createRef, ReactNode } from "react";
2
2
  import { IBaseComponentProps, NSRouterMakerProps, NSBoxString } from 'namirasoft-site-react';
3
3
  import { NSSection, NSSpace, NSSpaceSizeType, NSButtonBlue } from 'namirasoft-site-react';
4
4
  import { NSARouterMakerProps } from '../NSARouterMakerProps';
5
5
  import Styles from './NSAVerificationPage.module.css';
6
6
 
7
- export interface INSAVerificationPageProps extends IBaseComponentProps, NSRouterMakerProps, NSARouterMakerProps
7
+ export interface NSAVerificationPageProps extends IBaseComponentProps, NSRouterMakerProps, NSARouterMakerProps
8
8
  {
9
9
  contact_type: string;
10
10
  contact_value_name: string;
@@ -20,142 +20,146 @@ export interface NSAVerificationPageState
20
20
  isSendCode: boolean;
21
21
  }
22
22
 
23
- export function NSAVerificationPage(props: INSAVerificationPageProps)
23
+ export class NSAVerificationPage extends React.Component<NSAVerificationPageProps, NSAVerificationPageState>
24
24
  {
25
- let NSButtonBlue_Verify = useRef<NSButtonBlue>(null);
26
- let NSBoxString_Code = useRef<NSBoxString>(null);
27
-
28
- let code = props.url.getQuery("code") ?? "";
29
- useEffect(() =>
25
+ private NSButtonBlue_Verify = createRef<NSButtonBlue>();
26
+ private NSBoxString_Code = createRef<NSBoxString>();
27
+ constructor(props: NSAVerificationPageProps)
30
28
  {
31
- if (code)
32
- {
33
- NSBoxString_Code.current?.setValue(code, () =>
34
- {
35
- NSButtonBlue_Verify.current?.performClick();
36
- });
37
- }
38
- // eslint-disable-next-line
39
- }, [code, NSButtonBlue_Verify.current]);
40
-
41
- const [state, setState] = useState<NSAVerificationPageState>({
42
- isSendCode: code.length > 0
43
- });
44
-
45
- async function onRequest(onFinshied: () => void)
29
+ super(props);
30
+ this.state = { isSendCode: false };
31
+ this.onRequest = this.onRequest.bind(this);
32
+ this.onVerify = this.onVerify.bind(this);
33
+ }
34
+ private async onRequest(onFinshied: () => void)
46
35
  {
47
36
  try
48
37
  {
49
- props.onRequest(props.getContactValue(true)).then(() =>
38
+ this.props.onRequest(this.props.getContactValue(true)).then(() =>
50
39
  {
51
- setState(prevState => ({ ...prevState, isSendCode: true }))
52
- props.notifier.onSuccess(`Verification code has been sent successfully.`);
40
+ this.setState({ isSendCode: true });
41
+ this.props.notifier.onSuccess(`Verification code has been sent successfully.`);
53
42
  onFinshied();
54
43
  }).catch(onFinshied);
55
44
  } catch (error)
56
45
  {
57
- props.notifier.onError(error as Error);
46
+ this.props.notifier.onError(error as Error);
58
47
  }
59
48
  }
60
-
61
- async function onVerify(onFinshied: () => void)
49
+ private async onVerify(onFinshied: () => void)
62
50
  {
63
51
  try
64
52
  {
65
- let code = NSBoxString_Code.current?.getValue() ?? "";
66
- props.onVerify(code).then(() =>
53
+ let code = this.NSBoxString_Code.current?.getValue() ?? "";
54
+ this.props.onVerify(code).then(() =>
67
55
  {
68
- props.notifier.onSuccess("Verification has been done successfully.");
69
- props.notifier.onSuccess("Redirecting ...", 2000);
56
+ this.props.notifier.onSuccess("Verification has been done successfully.");
57
+ this.props.notifier.onSuccess("Redirecting ...", 2000);
70
58
  setTimeout(() =>
71
59
  {
72
- props.onFinished();
60
+ this.props.onFinished();
73
61
  onFinshied();
74
62
  }, 2000);
75
63
  }).catch(onFinshied);
76
64
  } catch (error)
77
65
  {
78
- props.notifier.onError(error as Error);
66
+ this.props.notifier.onError(error as Error);
79
67
  }
80
68
  }
81
-
82
- return (
83
- <>
84
- <NSSection>
85
- <div
86
- className={`${Styles.nsa_verification_container} ${props.classList?.join(" ") ?? ""}`}
87
- style={props.style}
88
- >
89
- <img
90
- src={"https://static.namirasoft.com/image/concept/verification/purple.png"}
91
- alt={'verification vector'}
92
- className={Styles.nsa_verification_vector}
93
- />
94
- <div className='m-0'>
95
- <p className='m-2'>Type: {props.contact_type}</p>
96
- {
97
- ((state.isSendCode || !props.children) && props.getContactValue(false)) &&
98
- <p className='m-2'>{props.contact_value_name}: {props.getContactValue(false)}</p>
99
- }
69
+ override componentDidMount(): void
70
+ {
71
+ let code = this.props.url.getQuery("code") ?? "";
72
+ if (code)
73
+ {
74
+ this.setState({ isSendCode: true }, () =>
75
+ {
76
+ this.NSBoxString_Code.current?.setValue(code, () =>
77
+ {
78
+ this.NSButtonBlue_Verify.current?.performClick();
79
+ });
80
+ });
81
+ }
82
+ }
83
+ override render(): ReactNode
84
+ {
85
+ return (
86
+ <>
87
+ <NSSection>
88
+ <div
89
+ className={`${Styles.nsa_verification_container} ${this.props.classList?.join(" ") ?? ""}`}
90
+ style={this.props.style}
91
+ >
92
+ <img
93
+ src={"https://static.namirasoft.com/image/concept/verification/purple.png"}
94
+ alt={'verification vector'}
95
+ className={Styles.nsa_verification_vector}
96
+ />
97
+ <div className='m-0'>
98
+ <p className='m-2'>Type: {this.props.contact_type}</p>
99
+ {
100
+ ((this.state.isSendCode || !this.props.children) && this.props.getContactValue(false)) &&
101
+ <p className='m-2'>{this.props.contact_value_name}: {this.props.getContactValue(false)}</p>
102
+ }
103
+ {
104
+ this.props.children &&
105
+ <div style={{ display: this.state.isSendCode ? "none" : undefined }}>
106
+ {this.props.children}
107
+ </div>
108
+ }
109
+ </div>
100
110
  {
101
- props.children &&
102
- <div style={{ display: state.isSendCode ? "none" : undefined }}>
103
- {props.children}
104
- </div>
111
+ this.state.isSendCode ?
112
+ <>
113
+ <p
114
+ style={{ margin: "0px" }}
115
+ >Please enter the code you received</p>
116
+ <NSBoxString
117
+ ref={this.NSBoxString_Code}
118
+ title='Verification Code'
119
+ placeholder='Enter the code'
120
+ hideHeader={true}
121
+ required={true}
122
+ min_length={6}
123
+ max_length={6}
124
+ input={{ style: { fontSize: '24px', fontWeight: "bold", textAlign: "center" } }}
125
+ />
126
+ </> :
127
+ <>
128
+ <NSButtonBlue
129
+ ref={this.NSButtonBlue_Verify}
130
+ title='Send Code'
131
+ onClick={{
132
+ action: (onFinished) =>
133
+ {
134
+ this.onRequest(onFinished);
135
+ },
136
+ }}
137
+ />
138
+ </>
105
139
  }
106
140
  </div>
141
+ <NSSpace size={NSSpaceSizeType.NORMAL}></NSSpace>
107
142
  {
108
- state.isSendCode ?
109
- <>
110
- <p
111
- style={{ margin: "0px" }}
112
- >Please enter the code you received</p>
113
- <NSBoxString
114
- ref={NSBoxString_Code}
115
- title='Verification Code'
116
- placeholder='Enter the code'
117
- hideHeader={true}
118
- required={true}
119
- min_length={6}
120
- max_length={6}
121
- input={{ style: { fontSize: '24px', fontWeight: "bold", textAlign: "center" } }}
122
- />
123
- </> :
124
- <>
125
- <NSButtonBlue
126
- ref={NSButtonBlue_Verify}
127
- title='Send Code'
128
- onClick={{
129
- action: (onFinished) =>
130
- {
131
- onRequest(onFinished);
132
- },
133
- }}
134
- />
135
- </>
143
+ this.state.isSendCode &&
144
+ <>
145
+ <NSButtonBlue
146
+ title="Verify"
147
+ onClick={{
148
+ action: (onFinished) =>
149
+ {
150
+ this.onVerify(onFinished);
151
+ },
152
+ }}
153
+ />
154
+ <NSSpace size={NSSpaceSizeType.SMALL}></NSSpace>
155
+ <button onClick={() =>
156
+ {
157
+ this.setState(prevState => ({ ...prevState, isSendCode: false }))
158
+ }} className={Styles.nsa_resend_button}>Resend Code</button>
159
+ </>
136
160
  }
137
- </div>
138
- <NSSpace size={NSSpaceSizeType.NORMAL}></NSSpace>
139
- {
140
- state.isSendCode &&
141
- <>
142
- <NSButtonBlue
143
- title="Verify"
144
- onClick={{
145
- action: (onFinished) =>
146
- {
147
- onVerify(onFinished);
148
- },
149
- }}
150
- />
151
- <NSSpace size={NSSpaceSizeType.SMALL}></NSSpace>
152
- <button onClick={() =>
153
- {
154
- setState(prevState => ({ ...prevState, isSendCode: false }))
155
- }} className={Styles.nsa_resend_button}>Resend Code</button>
156
- </>
157
- }
158
- </NSSection >
159
- </>
160
- );
161
+ </NSSection >
162
+ </>
163
+ );
164
+ }
161
165
  }