namirasoft-account-react 1.4.113 → 1.4.115
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/dist/App.js +11 -2
- package/dist/App.js.map +1 -1
- package/dist/pages/NSAVerificationPage.d.ts +8 -7
- package/dist/pages/NSAVerificationPage.js +34 -9
- package/dist/pages/NSAVerificationPage.js.map +1 -1
- package/package.json +1 -1
- package/src/App.tsx +5 -3
- package/src/pages/NSAVerificationPage.tsx +40 -21
package/dist/App.js
CHANGED
|
@@ -1,9 +1,18 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
1
10
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
11
|
import { NSALayout, NSASectionTabs, NSAVerificationPage } from "./main";
|
|
3
12
|
export function App(props) {
|
|
4
|
-
return (_jsx(_Fragment, { children: _jsxs(NSALayout, Object.assign({}, props, { scope: "Namirasoft Job Arranger Console", logo: "", background: "", header: "", notifications: [], children: [_jsx(NSASectionTabs, {}), _jsx(NSAVerificationPage, { contact_type: "Email",
|
|
13
|
+
return (_jsx(_Fragment, { children: _jsxs(NSALayout, Object.assign({}, props, { scope: "Namirasoft Job Arranger Console", logo: "", background: "", header: "", notifications: [], children: [_jsx(NSASectionTabs, {}), _jsx(NSAVerificationPage, Object.assign({}, props, { contact_type: "Email", contact_value_name: "Email", getContactValue: () => "myname@example.com", onVerify: (code) => __awaiter(this, void 0, void 0, function* () {
|
|
5
14
|
console.log(code);
|
|
6
|
-
}, onSend: () => { } })] })) }));
|
|
15
|
+
}), onSend: () => __awaiter(this, void 0, void 0, function* () { }) }))] })) }));
|
|
7
16
|
}
|
|
8
17
|
;
|
|
9
18
|
//# sourceMappingURL=App.js.map
|
package/dist/App.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"App.js","sourceRoot":"","sources":["../src/App.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"App.js","sourceRoot":"","sources":["../src/App.tsx"],"names":[],"mappings":";;;;;;;;;;AACA,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,QAAQ,CAAC;AAMxE,MAAM,UAAU,GAAG,CAAC,KAAe;IAElC,OAAO,CACN,4BACC,MAAC,SAAS,oBAAK,KAAK,IACnB,KAAK,EAAE,iCAAiC,EACxC,IAAI,EAAE,EAAE,EACR,UAAU,EAAE,EAAE,EACd,MAAM,EAAE,EAAE,EACV,aAAa,EAAE,EAAE,aAEjB,KAAC,cAAc,KAAG,EAClB,KAAC,mBAAmB,oBACf,KAAK,IACT,YAAY,EAAC,OAAO,EACpB,kBAAkB,EAAC,OAAO,EAC1B,eAAe,EAAE,GAAG,EAAE,CAAC,oBAAoB,EAC3C,QAAQ,EAAE,CAAO,IAAI,EAAE,EAAE;wBAExB,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAA;oBAClB,CAAC,CAAA,EACD,MAAM,EAAE,GAAS,EAAE,gDAAG,CAAC,CAAA,IACtB,KACU,GACX,CACH,CAAC;AACH,CAAC;AAAA,CAAC"}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import { IBaseComponentProps } from 'namirasoft-site-react';
|
|
2
|
-
import
|
|
3
|
-
export interface INSAVerificationPageProps extends IBaseComponentProps {
|
|
1
|
+
import { IBaseComponentProps, INSRouterProps } from 'namirasoft-site-react';
|
|
2
|
+
import { ReactNode } from "react";
|
|
3
|
+
export interface INSAVerificationPageProps extends IBaseComponentProps, INSRouterProps {
|
|
4
4
|
contact_type: string;
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
contact_value_name: string;
|
|
6
|
+
getContactValue: () => string;
|
|
7
|
+
onSend: () => Promise<void>;
|
|
8
|
+
onVerify: (code: string) => Promise<void>;
|
|
9
|
+
children?: ReactNode;
|
|
9
10
|
}
|
|
10
11
|
export interface NSAVerificationPageState {
|
|
11
12
|
values: string;
|
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
1
10
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
11
|
import Styles from './NSAVerificationPage.module.css';
|
|
3
12
|
import { NSABoxOTP } from '../components/NSABoxOTP';
|
|
@@ -18,16 +27,32 @@ export function NSAVerificationPage(props) {
|
|
|
18
27
|
setState(prevState => (Object.assign(Object.assign({}, prevState), { values: updatedValues.join("") })));
|
|
19
28
|
}
|
|
20
29
|
}
|
|
21
|
-
function
|
|
22
|
-
|
|
23
|
-
|
|
30
|
+
function onSend() {
|
|
31
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
32
|
+
try {
|
|
33
|
+
yield props.onSend();
|
|
34
|
+
setState(prevState => (Object.assign(Object.assign({}, prevState), { isSendCode: true })));
|
|
35
|
+
}
|
|
36
|
+
catch (error) {
|
|
37
|
+
props.notifier.onError(error);
|
|
38
|
+
}
|
|
39
|
+
});
|
|
24
40
|
}
|
|
25
|
-
function
|
|
26
|
-
|
|
41
|
+
function onVerify() {
|
|
42
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
43
|
+
try {
|
|
44
|
+
yield props.onVerify(state.values);
|
|
45
|
+
}
|
|
46
|
+
catch (error) {
|
|
47
|
+
props.notifier.onError(error);
|
|
48
|
+
}
|
|
49
|
+
});
|
|
27
50
|
}
|
|
28
|
-
return (_jsx(_Fragment, { children: _jsxs(NSSection, { center_items: true, children: [_jsxs("div", { className: `${Styles.nsa_verification_container} ${(_a = props.classList) === null || _a === void 0 ? void 0 : _a.join(" ")}`, 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] }), _jsxs("p", { className: 'm-2', children: ["
|
|
29
|
-
_jsxs(_Fragment, { children: [_jsxs("p", { children: ["Please enter code sent to ", props.
|
|
30
|
-
_jsx(_Fragment, { children: _jsx(NSButtonBlue, { onClick:
|
|
31
|
-
_jsxs(_Fragment, { children: [_jsx(NSButtonBlue, { title: "
|
|
51
|
+
return (_jsx(_Fragment, { children: _jsxs(NSSection, { center_items: true, children: [_jsxs("div", { className: `${Styles.nsa_verification_container} ${(_a = props.classList) === null || _a === void 0 ? void 0 : _a.join(" ")}`, 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] }), props.children && !state.isSendCode ? props.children : _jsxs("p", { className: 'm-2', children: [props.contact_value_name, ": ", props.getContactValue()] })] }), state.isSendCode ?
|
|
52
|
+
_jsxs(_Fragment, { children: [_jsxs("p", { children: ["Please enter code sent to ", props.getContactValue()] }), _jsx(NSABoxOTP, { onChanged: onChanged })] }) :
|
|
53
|
+
_jsx(_Fragment, { children: _jsx(NSButtonBlue, { onClick: onSend, title: 'Send Code' }) })] }), _jsx(NSSpace, { size: NSSpaceSizeType.NORMAL }), state.isSendCode &&
|
|
54
|
+
_jsxs(_Fragment, { children: [_jsx(NSButtonBlue, { title: "Verify", onClick: () => onVerify() }), _jsx(NSSpace, { size: NSSpaceSizeType.SMALL }), _jsx("button", { onClick: () => {
|
|
55
|
+
setState(prevState => (Object.assign(Object.assign({}, prevState), { isSendCode: false })));
|
|
56
|
+
}, className: Styles.nsa_resend_button, children: "Resend Code" })] })] }) }));
|
|
32
57
|
}
|
|
33
58
|
//# sourceMappingURL=NSAVerificationPage.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NSAVerificationPage.js","sourceRoot":"","sources":["../../src/pages/NSAVerificationPage.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"NSAVerificationPage.js","sourceRoot":"","sources":["../../src/pages/NSAVerificationPage.tsx"],"names":[],"mappings":";;;;;;;;;;AAAA,OAAO,MAAM,MAAM,kCAAkC,CAAC;AAEtD,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAc,EAAa,QAAQ,EAAE,MAAM,OAAO,CAAC;AACnD,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAkB1F,MAAM,UAAU,mBAAmB,CAAC,KAAgC;;IAEnE,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAA2B;QAC5D,MAAM,EAAE,EAAE;QACV,UAAU,EAAE,KAAK;KACjB,CAAC,CAAC;IAEH,SAAS,SAAS,CAAC,KAA0C,EAAE,KAAa;QAE3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HANGED
|
@@ -18,13 +18,15 @@ export function App(props: AppProps)
|
|
|
18
18
|
>
|
|
19
19
|
<NSASectionTabs />
|
|
20
20
|
<NSAVerificationPage
|
|
21
|
+
{...props}
|
|
21
22
|
contact_type="Email"
|
|
22
|
-
|
|
23
|
-
|
|
23
|
+
contact_value_name="Email"
|
|
24
|
+
getContactValue={() => "myname@example.com"}
|
|
25
|
+
onVerify={async (code) =>
|
|
24
26
|
{
|
|
25
27
|
console.log(code)
|
|
26
28
|
}}
|
|
27
|
-
onSend={() => { }}
|
|
29
|
+
onSend={async () => { }}
|
|
28
30
|
/>
|
|
29
31
|
</NSALayout >
|
|
30
32
|
</>
|
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
import Styles from './NSAVerificationPage.module.css';
|
|
2
|
-
import { IBaseComponentProps } from 'namirasoft-site-react';
|
|
2
|
+
import { IBaseComponentProps, INSRouterProps } from 'namirasoft-site-react';
|
|
3
3
|
import { NSABoxOTP } from '../components/NSABoxOTP';
|
|
4
|
-
import React, { useState } from "react";
|
|
4
|
+
import React, { ReactNode, useState } from "react";
|
|
5
5
|
import { NSSection, NSSpace, NSSpaceSizeType, NSButtonBlue } from 'namirasoft-site-react';
|
|
6
6
|
|
|
7
|
-
export interface INSAVerificationPageProps extends IBaseComponentProps
|
|
7
|
+
export interface INSAVerificationPageProps extends IBaseComponentProps, INSRouterProps
|
|
8
8
|
{
|
|
9
9
|
contact_type: string;
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
contact_value_name: string;
|
|
11
|
+
getContactValue: () => string;
|
|
12
|
+
onSend: () => Promise<void>;
|
|
13
|
+
onVerify: (code: string) => Promise<void>;
|
|
14
|
+
children?: ReactNode;
|
|
14
15
|
}
|
|
15
16
|
|
|
16
17
|
export interface NSAVerificationPageState
|
|
@@ -28,25 +29,37 @@ export function NSAVerificationPage(props: INSAVerificationPageProps)
|
|
|
28
29
|
|
|
29
30
|
function onChanged(event: React.ChangeEvent<HTMLInputElement>, index: number): void
|
|
30
31
|
{
|
|
31
|
-
|
|
32
|
+
const newValue = event.target.value;
|
|
32
33
|
setState(prevState => ({ ...prevState, values: state.values + newValue }));
|
|
33
34
|
if (/^\d?$/.test(event.target.value))
|
|
34
35
|
{
|
|
35
36
|
const updatedValues = [...state.values];
|
|
36
|
-
|
|
37
|
-
setState(prevState => ({ ...prevState, values: updatedValues.join("")}))
|
|
37
|
+
updatedValues[index] = newValue;
|
|
38
|
+
setState(prevState => ({ ...prevState, values: updatedValues.join("") }))
|
|
38
39
|
}
|
|
39
40
|
}
|
|
40
41
|
|
|
41
|
-
function
|
|
42
|
+
async function onSend()
|
|
42
43
|
{
|
|
43
|
-
|
|
44
|
-
|
|
44
|
+
try
|
|
45
|
+
{
|
|
46
|
+
await props.onSend();
|
|
47
|
+
setState(prevState => ({ ...prevState, isSendCode: true }))
|
|
48
|
+
} catch (error)
|
|
49
|
+
{
|
|
50
|
+
props.notifier.onError(error as Error);
|
|
51
|
+
}
|
|
45
52
|
}
|
|
46
53
|
|
|
47
|
-
function
|
|
54
|
+
async function onVerify()
|
|
48
55
|
{
|
|
49
|
-
|
|
56
|
+
try
|
|
57
|
+
{
|
|
58
|
+
await props.onVerify(state.values);
|
|
59
|
+
} catch (error)
|
|
60
|
+
{
|
|
61
|
+
props.notifier.onError(error as Error);
|
|
62
|
+
}
|
|
50
63
|
}
|
|
51
64
|
|
|
52
65
|
return (
|
|
@@ -63,25 +76,31 @@ export function NSAVerificationPage(props: INSAVerificationPageProps)
|
|
|
63
76
|
/>
|
|
64
77
|
<div className='m-0'>
|
|
65
78
|
<p className='m-2'>Type: {props.contact_type}</p>
|
|
66
|
-
|
|
79
|
+
{
|
|
80
|
+
props.children && !state.isSendCode ? props.children : <p className='m-2'>{props.contact_value_name}: {props.getContactValue()}</p>
|
|
81
|
+
}
|
|
67
82
|
</div>
|
|
68
83
|
{
|
|
69
84
|
state.isSendCode ?
|
|
70
85
|
<>
|
|
71
|
-
<p>Please enter code sent to {props.
|
|
86
|
+
<p>Please enter code sent to {props.getContactValue()}</p>
|
|
72
87
|
<NSABoxOTP onChanged={onChanged} />
|
|
73
88
|
</> :
|
|
74
89
|
<>
|
|
75
|
-
<NSButtonBlue onClick={
|
|
90
|
+
<NSButtonBlue onClick={onSend} title='Send Code' />
|
|
76
91
|
</>
|
|
77
92
|
}
|
|
78
93
|
</div>
|
|
79
94
|
<NSSpace size={NSSpaceSizeType.NORMAL}></NSSpace>
|
|
80
|
-
{
|
|
95
|
+
{
|
|
96
|
+
state.isSendCode &&
|
|
81
97
|
<>
|
|
82
|
-
<NSButtonBlue title="
|
|
98
|
+
<NSButtonBlue title="Verify" onClick={() => onVerify()} />
|
|
83
99
|
<NSSpace size={NSSpaceSizeType.SMALL}></NSSpace>
|
|
84
|
-
<button onClick={
|
|
100
|
+
<button onClick={() =>
|
|
101
|
+
{
|
|
102
|
+
setState(prevState => ({ ...prevState, isSendCode: false }))
|
|
103
|
+
}} className={Styles.nsa_resend_button}>Resend Code</button>
|
|
85
104
|
</>
|
|
86
105
|
}
|
|
87
106
|
</NSSection>
|