namirasoft-account-react 1.4.180 → 1.4.181
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/.env.template +1 -0
- package/dist/App.js +45 -44
- package/dist/App.js.map +1 -1
- package/dist/components/NSBoxPassword.d.ts +18 -0
- package/dist/components/NSBoxPassword.js +60 -0
- package/dist/components/NSBoxPassword.js.map +1 -0
- package/dist/components/NSBoxSecret.d.ts +19 -0
- package/dist/components/NSBoxSecret.js +73 -0
- package/dist/components/NSBoxSecret.js.map +1 -0
- package/dist/main.d.ts +1 -0
- package/dist/main.js +1 -0
- package/dist/main.js.map +1 -1
- package/package.json +3 -2
- package/src/App.tsx +6 -1
- package/src/components/NSBoxSecret.tsx +103 -0
- package/src/main.ts +1 -0
package/.env.template
CHANGED
|
@@ -10,4 +10,5 @@ REACT_APP_BASE_URL_HISTORY = "https://history.namirasoft.com/api/v1";
|
|
|
10
10
|
REACT_APP_BASE_URL_HISTORY_CONSOLE = "https://history.namirasoft.com";
|
|
11
11
|
REACT_APP_BASE_URL_MESSAGE = "https://message.namirasoft.com/api/v1";
|
|
12
12
|
REACT_APP_BASE_URL_MESSAGE_CONSOLE = "https://message.namirasoft.com"
|
|
13
|
+
REACT_APP_BASE_URL_SECRET = "https://secret.namirasoft.com/api/v1";
|
|
13
14
|
REACT_APP_BASE_URL_WORKSPACE = "https://workspace.namirasoft.com/api/v1"
|
package/dist/App.js
CHANGED
|
@@ -3,57 +3,58 @@ import { NSALayout, NSALoginPage, NSASectionTabs } from "./main";
|
|
|
3
3
|
import { BaseColumnFormatter, DateTimeFormatter, IDFormatter, StringFormatter, StringFormatterSizeType } from "namirasoft-site-react";
|
|
4
4
|
import { ProductUUID } from "namirasoft-site";
|
|
5
5
|
import { NamirasoftFieldMetaDatabase, NamirasoftFieldServer } from "namirasoft-field";
|
|
6
|
+
import { NSBoxSecret } from "../src/components/NSBoxSecret";
|
|
6
7
|
export function App(props) {
|
|
7
8
|
let server = new NamirasoftFieldServer("https://field.namirasoft.dev/api/v1", props.account.token_manager, props.notifier.onError);
|
|
8
9
|
if (!props.account)
|
|
9
10
|
return _jsx(NSALoginPage, { background: { image: "https://static.namirasoft.com/image/namirasoft/access/background/base.svg" }, logo: "https://static.namirasoft.com/image/namirasoft/access/logo/base.png", title: "Namirasoft Access" });
|
|
10
|
-
return (
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
11
|
+
return (_jsxs(_Fragment, { children: [_jsx(NSBoxSecret, Object.assign({ required: true, title: "Password" }, props)), _jsx(NSALayout, Object.assign({}, props, { scope: "Namirasoft Job Arranger Console", logo: "", background: "", header: "", notifications: [], pages: {
|
|
12
|
+
entity: {
|
|
13
|
+
product_id: ProductUUID.NAMIRASOFT_FIELD,
|
|
14
|
+
name: "category",
|
|
15
|
+
tables: [{ table: NamirasoftFieldMetaDatabase.main.tables.category, required: false }],
|
|
16
|
+
client: {
|
|
17
|
+
getListURL: () => "",
|
|
18
|
+
getNewURL: null,
|
|
19
|
+
getCopyURL: null,
|
|
20
|
+
getEditURL: null,
|
|
21
|
+
getViewURL: null,
|
|
22
|
+
getColumns: () => {
|
|
23
|
+
return [
|
|
24
|
+
BaseColumnFormatter.getColumn(NamirasoftFieldMetaDatabase.main.tables.category.columns.id, new IDFormatter()),
|
|
25
|
+
BaseColumnFormatter.getColumn(NamirasoftFieldMetaDatabase.main.tables.category.columns.user_id, new IDFormatter()),
|
|
26
|
+
BaseColumnFormatter.getColumn(NamirasoftFieldMetaDatabase.main.tables.category.columns.name, new StringFormatter(StringFormatterSizeType.TwoWords)),
|
|
27
|
+
BaseColumnFormatter.getColumn(NamirasoftFieldMetaDatabase.main.tables.category.columns.group, new StringFormatter(StringFormatterSizeType.TwoWords)),
|
|
28
|
+
BaseColumnFormatter.getColumn(NamirasoftFieldMetaDatabase.main.tables.category.columns.entity, new StringFormatter(StringFormatterSizeType.TwoWords)),
|
|
29
|
+
BaseColumnFormatter.getColumn(NamirasoftFieldMetaDatabase.main.tables.category.columns.created_at, new DateTimeFormatter()),
|
|
30
|
+
BaseColumnFormatter.getColumn(NamirasoftFieldMetaDatabase.main.tables.category.columns.updated_at, new DateTimeFormatter()),
|
|
31
|
+
];
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
server: {
|
|
35
|
+
value_list: server.value.List,
|
|
36
|
+
get: server.category.Get,
|
|
37
|
+
list: server.category.List,
|
|
38
|
+
create: null,
|
|
39
|
+
update: null,
|
|
40
|
+
delete: server.category.Delete,
|
|
31
41
|
}
|
|
32
42
|
},
|
|
33
|
-
server: {
|
|
34
|
-
value_list: server.value.List,
|
|
35
|
-
get: server.category.Get,
|
|
36
|
-
list: server.category.List,
|
|
37
|
-
create: null,
|
|
38
|
-
update: null,
|
|
39
|
-
delete: server.category.Delete,
|
|
40
|
-
}
|
|
41
|
-
},
|
|
42
|
-
ui: {
|
|
43
|
-
action: {
|
|
44
|
-
menus: {
|
|
45
|
-
viewHistory: false
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
},
|
|
49
|
-
list: {
|
|
50
|
-
isEdit: true,
|
|
51
43
|
ui: {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
44
|
+
action: {
|
|
45
|
+
menus: {
|
|
46
|
+
viewHistory: false
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
list: {
|
|
51
|
+
isEdit: true,
|
|
52
|
+
ui: {
|
|
53
|
+
getEntity: () => { return {}; },
|
|
54
|
+
setEntity: () => { }
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
}, children: _jsx(NSASectionTabs, {}) }))] }));
|
|
57
58
|
}
|
|
58
59
|
;
|
|
59
60
|
//# 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":";AACA,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAC;AACjE,OAAO,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,WAAW,EAAE,eAAe,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AACtI,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,2BAA2B,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"App.js","sourceRoot":"","sources":["../src/App.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAC;AACjE,OAAO,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,WAAW,EAAE,eAAe,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AACtI,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,2BAA2B,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AACtF,OAAO,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAM5D,MAAM,UAAU,GAAG,CAAC,KAAe;IAElC,IAAI,MAAM,GAAG,IAAI,qBAAqB,CAAC,qCAAqC,EAAE,KAAK,CAAC,OAAO,CAAC,aAAa,EAAE,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;IACnI,IAAI,CAAC,KAAK,CAAC,OAAO;QACjB,OAAO,KAAC,YAAY,IACnB,UAAU,EAAE,EAAE,KAAK,EAAE,2EAA2E,EAAE,EAClG,IAAI,EAAC,qEAAqE,EAC1E,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+
import { IBaseComponentProps, IValidationProps, IValidationStringProps, INSBoxBaseLayoutProps, NSBoxBaseLayout, INSBox } from "namirasoft-site-react";
|
|
3
|
+
export interface NSBoxPasswordProps extends IBaseComponentProps, IValidationProps, IValidationStringProps, INSBoxBaseLayoutProps<string, NSBoxPassword> {
|
|
4
|
+
}
|
|
5
|
+
export interface NSBoxPasswordState {
|
|
6
|
+
value: string | null;
|
|
7
|
+
show: boolean;
|
|
8
|
+
}
|
|
9
|
+
export declare class NSBoxPassword extends React.Component<NSBoxPasswordProps, NSBoxPasswordState> implements INSBox {
|
|
10
|
+
private service;
|
|
11
|
+
NSBoxBaseLayout_Main: React.RefObject<NSBoxBaseLayout>;
|
|
12
|
+
constructor(props: NSBoxPasswordProps);
|
|
13
|
+
isEmpty(value: string): boolean;
|
|
14
|
+
getError(): string | null;
|
|
15
|
+
getValue(checkError?: boolean): string | null;
|
|
16
|
+
setValue(value: string | null, callback?: () => void): void;
|
|
17
|
+
render(): import("react/jsx-runtime").JSX.Element;
|
|
18
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import React, { createRef } from "react";
|
|
4
|
+
import StylesNSBox from "./NSBox.module.css";
|
|
5
|
+
import { Validator, safeMenuMenuItem, NSBoxBaseLayout } from "namirasoft-site-react";
|
|
6
|
+
import { NamingConvention, SetTimeouService } from "namirasoft-core";
|
|
7
|
+
export class NSBoxPassword extends React.Component {
|
|
8
|
+
constructor(props) {
|
|
9
|
+
var _a;
|
|
10
|
+
super(props);
|
|
11
|
+
this.service = new SetTimeouService();
|
|
12
|
+
this.NSBoxBaseLayout_Main = createRef();
|
|
13
|
+
this.state = { value: (_a = props.defaultValue) !== null && _a !== void 0 ? _a : null, show: false };
|
|
14
|
+
this.isEmpty = this.isEmpty.bind(this);
|
|
15
|
+
this.getError = this.getError.bind(this);
|
|
16
|
+
this.getValue = this.getValue.bind(this);
|
|
17
|
+
this.setValue = this.setValue.bind(this);
|
|
18
|
+
}
|
|
19
|
+
isEmpty(value) {
|
|
20
|
+
if ((value !== null && value !== void 0 ? value : "").trim())
|
|
21
|
+
return false;
|
|
22
|
+
return true;
|
|
23
|
+
}
|
|
24
|
+
getError() {
|
|
25
|
+
return (Validator.getError(this.props.title, this.state.value, this.props) ||
|
|
26
|
+
Validator.getErrorString(this.props.title, this.state.value, this.props));
|
|
27
|
+
}
|
|
28
|
+
getValue(checkError = true) {
|
|
29
|
+
return NSBoxBaseLayout.checkGetValue(this, checkError, () => this.state.value);
|
|
30
|
+
}
|
|
31
|
+
setValue(value, callback) {
|
|
32
|
+
this.setState({ value }, () => {
|
|
33
|
+
var _a, _b;
|
|
34
|
+
(_b = (_a = this.props).onChanged) === null || _b === void 0 ? void 0 : _b.call(_a, this);
|
|
35
|
+
callback === null || callback === void 0 ? void 0 : callback();
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
render() {
|
|
39
|
+
var _a, _b;
|
|
40
|
+
let menu = safeMenuMenuItem(this.props, (items) => {
|
|
41
|
+
items.push({
|
|
42
|
+
title: this.state.show ? "Hide Password" : "Show Password",
|
|
43
|
+
icon: this.state.show ? "https://static.namirasoft.com/image/concept/password/hide.png" : "https://static.namirasoft.com/image/concept/password/show.png",
|
|
44
|
+
onClick: () => {
|
|
45
|
+
let show = !this.state.show;
|
|
46
|
+
this.setState({ show });
|
|
47
|
+
if (show)
|
|
48
|
+
this.service.setTimeoutIfNotCalledAgain(() => {
|
|
49
|
+
this.setState({ show: false });
|
|
50
|
+
}, 10000);
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
});
|
|
54
|
+
return (_jsx(NSBoxBaseLayout, Object.assign({ ref: this.NSBoxBaseLayout_Main }, this.props, { menu: menu, children: _jsx("input", { id: this.props.id, name: this.props.name, type: this.state.show ? "text" : "password", className: StylesNSBox.ns_box_input, placeholder: (_a = this.props.placeholder) !== null && _a !== void 0 ? _a : `Please enter ${NamingConvention.auto.convert(this.props.title, NamingConvention.lower_case_space)}`, value: (_b = this.state.value) !== null && _b !== void 0 ? _b : "", onChange: e => this.setValue(e.target.value), onClick: () => { var _a, _b; (_b = (_a = this.props).onClicked) === null || _b === void 0 ? void 0 : _b.call(_a, this); }, style: {
|
|
55
|
+
background: `url("https://static.namirasoft.com/image/concept/type/password.png") white no-repeat scroll center right 4px`,
|
|
56
|
+
backgroundSize: "24px"
|
|
57
|
+
} }) })));
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
//# sourceMappingURL=NSBoxPassword.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NSBoxPassword.js","sourceRoot":"","sources":["../../src/components/NSBoxPassword.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACzC,OAAO,WAAW,MAAM,oBAAoB,CAAC;AAC7C,OAAO,EAAiE,SAAS,EAAE,gBAAgB,EAAyB,eAAe,EAAU,MAAM,uBAAuB,CAAC;AACnL,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAWrE,MAAM,OAAO,aAAc,SAAQ,KAAK,CAAC,SAAiD;IAIzF,YAAY,KAAyB;;QAEpC,KAAK,CAAC,KAAK,CAAC,CAAC;QAJN,YAAO,GAAqB,IAAI,gBAAgB,EAAE,CAAC;QAC3D,yBAAoB,GAAG,SAAS,EAAmB,CAAC;QAInD,IAAI,CAAC,KAAK,GAAG,EAAE,KAAK,EAAE,MAAA,KAAK,CAAC,YAAY,mCAAI,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;QAChE,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACvC,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;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AAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAC5C,OAAO,EAAE,GAAG,EAAE,eAAG,MAAA,MAAA,IAAI,CAAC,KAAK,EAAC,SAAS,mDAAG,IAAI,CAAC,CAAC,CAAC,CAAC,EAChD,KAAK,EAAE;oBACN,UAAU,EAAE,8GAA8G;oBAC1H,cAAc,EAAE,MAAM;iBACtB,GACA,IACe,CAClB,CAAC;IACH,CAAC;CACD"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { IBaseComponentProps, IValidationProps, IValidationStringProps, INSBoxBaseLayoutProps, INSBox } from "namirasoft-site-react";
|
|
3
|
+
import { INSARouterProps } from "../INSARouterProps";
|
|
4
|
+
export interface NSBoxSecretProps extends IBaseComponentProps, IValidationProps, IValidationStringProps, INSBoxBaseLayoutProps<string, NSBoxSecret>, INSARouterProps {
|
|
5
|
+
}
|
|
6
|
+
interface NSBoxSecretState {
|
|
7
|
+
secret_id: string | null;
|
|
8
|
+
value: string | null;
|
|
9
|
+
}
|
|
10
|
+
export declare class NSBoxSecret extends React.Component<NSBoxSecretProps, NSBoxSecretState> implements INSBox {
|
|
11
|
+
private NSBoxPassword_Main;
|
|
12
|
+
constructor(props: NSBoxSecretProps);
|
|
13
|
+
isEmpty(value: string): boolean;
|
|
14
|
+
getError(): string | null;
|
|
15
|
+
getValue(checkError?: boolean): string | null;
|
|
16
|
+
setValue(value: string | null, callback?: () => void): void;
|
|
17
|
+
render(): import("react/jsx-runtime").JSX.Element;
|
|
18
|
+
}
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import React, { createRef } from "react";
|
|
3
|
+
import { NSBoxPassword, safeMenuMenuItem } from "namirasoft-site-react";
|
|
4
|
+
import { NamirasoftSecretMetaDatabase, NamirasoftSecretServer } from "namirasoft-secret";
|
|
5
|
+
import { BaseUUID, EnvService } from "namirasoft-core";
|
|
6
|
+
export class NSBoxSecret extends React.Component {
|
|
7
|
+
constructor(props) {
|
|
8
|
+
super(props);
|
|
9
|
+
this.NSBoxPassword_Main = createRef();
|
|
10
|
+
this.state = { secret_id: null, value: null };
|
|
11
|
+
this.isEmpty = this.isEmpty.bind(this);
|
|
12
|
+
this.getError = this.getError.bind(this);
|
|
13
|
+
this.getValue = this.getValue.bind(this);
|
|
14
|
+
this.setValue = this.setValue.bind(this);
|
|
15
|
+
}
|
|
16
|
+
isEmpty(value) {
|
|
17
|
+
var _a, _b;
|
|
18
|
+
return (_b = (_a = this.NSBoxPassword_Main.current) === null || _a === void 0 ? void 0 : _a.isEmpty(value)) !== null && _b !== void 0 ? _b : true;
|
|
19
|
+
}
|
|
20
|
+
getError() {
|
|
21
|
+
var _a, _b;
|
|
22
|
+
if (this.state.secret_id && !this.state.value)
|
|
23
|
+
return null;
|
|
24
|
+
return (_b = (_a = this.NSBoxPassword_Main.current) === null || _a === void 0 ? void 0 : _a.getError()) !== null && _b !== void 0 ? _b : null;
|
|
25
|
+
}
|
|
26
|
+
getValue(checkError = true) {
|
|
27
|
+
var _a, _b;
|
|
28
|
+
if (this.state.secret_id && !this.state.value)
|
|
29
|
+
return "";
|
|
30
|
+
return (_b = (_a = this.NSBoxPassword_Main.current) === null || _a === void 0 ? void 0 : _a.getValue(checkError)) !== null && _b !== void 0 ? _b : null;
|
|
31
|
+
}
|
|
32
|
+
setValue(value, callback) {
|
|
33
|
+
var _a;
|
|
34
|
+
let short = NamirasoftSecretMetaDatabase.main.tables.secret.uuid.short;
|
|
35
|
+
if (BaseUUID.isValidShort(value !== null && value !== void 0 ? value : "", short))
|
|
36
|
+
this.setState({ secret_id: value, value: null });
|
|
37
|
+
else {
|
|
38
|
+
this.setState({ secret_id: null, value });
|
|
39
|
+
(_a = this.NSBoxPassword_Main.current) === null || _a === void 0 ? void 0 : _a.setValue(value, callback);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
render() {
|
|
43
|
+
let input_style = {};
|
|
44
|
+
let placeholder = undefined;
|
|
45
|
+
if (this.state.secret_id && !this.state.value) {
|
|
46
|
+
input_style.backgroundColor = "#00000030";
|
|
47
|
+
input_style.textAlign = "center";
|
|
48
|
+
placeholder = this.state.secret_id;
|
|
49
|
+
}
|
|
50
|
+
let menu = safeMenuMenuItem(this.props, (items) => {
|
|
51
|
+
if (this.state.secret_id && !this.state.value)
|
|
52
|
+
items.push({
|
|
53
|
+
title: "Load From Secret",
|
|
54
|
+
icon: "https://static.namirasoft.com/image/namirasoft/secret/logo/base.png",
|
|
55
|
+
onClick: () => {
|
|
56
|
+
let REACT_APP_BASE_URL_SECRET = new EnvService("REACT_APP_BASE_URL_SECRET", true).getString();
|
|
57
|
+
let server = new NamirasoftSecretServer(REACT_APP_BASE_URL_SECRET, this.props.account.token_manager, this.props.notifier.onError);
|
|
58
|
+
if (this.state.secret_id)
|
|
59
|
+
server.secret.GetValue(this.state.secret_id).then(value => {
|
|
60
|
+
var _a;
|
|
61
|
+
(_a = this.NSBoxPassword_Main.current) === null || _a === void 0 ? void 0 : _a.setValue(value);
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
});
|
|
66
|
+
return (_jsx(_Fragment, { children: _jsx(NSBoxPassword, Object.assign({ ref: this.NSBoxPassword_Main }, this.props, { onChanged: (box) => {
|
|
67
|
+
var _a, _b;
|
|
68
|
+
this.setState({ value: box.getValue(false) });
|
|
69
|
+
(_b = (_a = this.props).onChanged) === null || _b === void 0 ? void 0 : _b.call(_a, this);
|
|
70
|
+
}, onClicked: () => { var _a, _b; return (_b = (_a = this.props).onClicked) === null || _b === void 0 ? void 0 : _b.call(_a, this); }, placeholder: placeholder, input: { style: input_style }, menu: menu })) }));
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
//# sourceMappingURL=NSBoxSecret.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+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EAAE,eAAC,OAAA,MAAA,MAAA,IAAI,CAAC,KAAK,EAAC,SAAS,mDAAG,IAAI,CAAC,CAAA,EAAA,EAC7C,WAAW,EAAE,WAAW,EACxB,KAAK,EAAE,EAAE,KAAK,EAAE,WAAW,EAAE,EAC7B,IAAI,EAAE,IAAI,IACT,GACA,CACH,CAAC;IACH,CAAC;CACD"}
|
package/dist/main.d.ts
CHANGED
package/dist/main.js
CHANGED
package/dist/main.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.js","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":"AAAA,cAAc,kCAAkC,CAAC;AACjD,cAAc,mCAAmC,CAAC;AAClD,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,0BAA0B,CAAC;AACzC,cAAc,0BAA0B,CAAC;AACzC,cAAc,0BAA0B,CAAC;AACzC,cAAc,0BAA0B,CAAC;AACzC,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC;AACrC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,eAAe,CAAC;AAC9B,cAAc,QAAQ,CAAC;AACvB,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,kBAAkB,CAAC"}
|
|
1
|
+
{"version":3,"file":"main.js","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":"AAAA,cAAc,kCAAkC,CAAC;AACjD,cAAc,mCAAmC,CAAC;AAClD,cAAc,0BAA0B,CAAC;AACzC,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,0BAA0B,CAAC;AACzC,cAAc,0BAA0B,CAAC;AACzC,cAAc,0BAA0B,CAAC;AACzC,cAAc,0BAA0B,CAAC;AACzC,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC;AACrC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,eAAe,CAAC;AAC9B,cAAc,QAAQ,CAAC;AACvB,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,kBAAkB,CAAC"}
|
package/package.json
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"framework": "npm",
|
|
9
9
|
"application": "package",
|
|
10
10
|
"private": false,
|
|
11
|
-
"version": "1.4.
|
|
11
|
+
"version": "1.4.181",
|
|
12
12
|
"author": "Amir Abolhasani",
|
|
13
13
|
"license": "MIT",
|
|
14
14
|
"main": "./dist/main.js",
|
|
@@ -34,9 +34,10 @@
|
|
|
34
34
|
"namirasoft-field": "^1.4.13",
|
|
35
35
|
"namirasoft-history": "^1.4.12",
|
|
36
36
|
"namirasoft-message": "^1.4.12",
|
|
37
|
+
"namirasoft-secret": "^1.4.22",
|
|
37
38
|
"namirasoft-site": "^1.4.8",
|
|
38
39
|
"namirasoft-site-map": "^1.4.9",
|
|
39
|
-
"namirasoft-site-react": "^1.4.
|
|
40
|
+
"namirasoft-site-react": "^1.4.237",
|
|
40
41
|
"namirasoft-workspace": "^1.4.12",
|
|
41
42
|
"os-browserify": "^0.3.0",
|
|
42
43
|
"path-browserify": "^1.0.1",
|
package/src/App.tsx
CHANGED
|
@@ -3,6 +3,7 @@ import { NSALayout, NSALoginPage, NSASectionTabs } from "./main";
|
|
|
3
3
|
import { BaseColumnFormatter, DateTimeFormatter, IDFormatter, StringFormatter, StringFormatterSizeType } from "namirasoft-site-react";
|
|
4
4
|
import { ProductUUID } from "namirasoft-site";
|
|
5
5
|
import { NamirasoftFieldMetaDatabase, NamirasoftFieldServer } from "namirasoft-field";
|
|
6
|
+
import { NSBoxSecret } from "../src/components/NSBoxSecret";
|
|
6
7
|
|
|
7
8
|
export interface AppProps extends INSARouterProps
|
|
8
9
|
{
|
|
@@ -20,6 +21,11 @@ export function App(props: AppProps)
|
|
|
20
21
|
|
|
21
22
|
return (
|
|
22
23
|
<>
|
|
24
|
+
<NSBoxSecret
|
|
25
|
+
required
|
|
26
|
+
title="Password"
|
|
27
|
+
{...props}
|
|
28
|
+
/>
|
|
23
29
|
<NSALayout {...props}
|
|
24
30
|
scope={"Namirasoft Job Arranger Console"}
|
|
25
31
|
logo={""}
|
|
@@ -87,7 +93,6 @@ export function App(props: AppProps)
|
|
|
87
93
|
}
|
|
88
94
|
}
|
|
89
95
|
>
|
|
90
|
-
<>test</>
|
|
91
96
|
<NSASectionTabs />
|
|
92
97
|
</NSALayout >
|
|
93
98
|
</>
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import React, { createRef } from "react";
|
|
2
|
+
import { IBaseComponentProps, IValidationProps, IValidationStringProps, INSBoxBaseLayoutProps, INSBox, NSBoxPassword, safeMenuMenuItem } from "namirasoft-site-react";
|
|
3
|
+
import { NamirasoftSecretMetaDatabase, NamirasoftSecretServer } from "namirasoft-secret";
|
|
4
|
+
import { BaseUUID, EnvService } from "namirasoft-core";
|
|
5
|
+
import { INSARouterProps } from "../INSARouterProps";
|
|
6
|
+
|
|
7
|
+
export interface NSBoxSecretProps extends IBaseComponentProps, IValidationProps, IValidationStringProps, INSBoxBaseLayoutProps<string, NSBoxSecret>, INSARouterProps
|
|
8
|
+
{ }
|
|
9
|
+
|
|
10
|
+
interface NSBoxSecretState
|
|
11
|
+
{
|
|
12
|
+
secret_id: string | null;
|
|
13
|
+
value: string | null;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export class NSBoxSecret extends React.Component<NSBoxSecretProps, NSBoxSecretState> implements INSBox
|
|
17
|
+
{
|
|
18
|
+
private NSBoxPassword_Main = createRef<NSBoxPassword>();
|
|
19
|
+
constructor(props: NSBoxSecretProps)
|
|
20
|
+
{
|
|
21
|
+
super(props);
|
|
22
|
+
this.state = { secret_id: null, value: null };
|
|
23
|
+
this.isEmpty = this.isEmpty.bind(this);
|
|
24
|
+
this.getError = this.getError.bind(this);
|
|
25
|
+
this.getValue = this.getValue.bind(this);
|
|
26
|
+
this.setValue = this.setValue.bind(this);
|
|
27
|
+
}
|
|
28
|
+
isEmpty(value: string)
|
|
29
|
+
{
|
|
30
|
+
return this.NSBoxPassword_Main.current?.isEmpty(value) ?? true;
|
|
31
|
+
}
|
|
32
|
+
getError(): string | null
|
|
33
|
+
{
|
|
34
|
+
if (this.state.secret_id && !this.state.value)
|
|
35
|
+
return null;
|
|
36
|
+
return this.NSBoxPassword_Main.current?.getError() ?? null;
|
|
37
|
+
}
|
|
38
|
+
getValue(checkError: boolean = true): string | null
|
|
39
|
+
{
|
|
40
|
+
if (this.state.secret_id && !this.state.value)
|
|
41
|
+
return "";
|
|
42
|
+
return this.NSBoxPassword_Main.current?.getValue(checkError) ?? null;
|
|
43
|
+
}
|
|
44
|
+
setValue(value: string | null, callback?: () => void): void
|
|
45
|
+
{
|
|
46
|
+
let short = NamirasoftSecretMetaDatabase.main.tables.secret.uuid.short;
|
|
47
|
+
if (BaseUUID.isValidShort(value ?? "", short))
|
|
48
|
+
this.setState({ secret_id: value, value: null });
|
|
49
|
+
else
|
|
50
|
+
{
|
|
51
|
+
this.setState({ secret_id: null, value });
|
|
52
|
+
this.NSBoxPassword_Main.current?.setValue(value, callback);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
override render()
|
|
56
|
+
{
|
|
57
|
+
let input_style: React.CSSProperties = {};
|
|
58
|
+
let placeholder = undefined;
|
|
59
|
+
if (this.state.secret_id && !this.state.value)
|
|
60
|
+
{
|
|
61
|
+
input_style.backgroundColor = "#00000030";
|
|
62
|
+
input_style.textAlign = "center";
|
|
63
|
+
placeholder = this.state.secret_id;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
let menu = safeMenuMenuItem(this.props, (items) =>
|
|
67
|
+
{
|
|
68
|
+
if (this.state.secret_id && !this.state.value)
|
|
69
|
+
items.push({
|
|
70
|
+
title: "Load From Secret",
|
|
71
|
+
icon: "https://static.namirasoft.com/image/namirasoft/secret/logo/base.png",
|
|
72
|
+
onClick: () =>
|
|
73
|
+
{
|
|
74
|
+
let REACT_APP_BASE_URL_SECRET = new EnvService("REACT_APP_BASE_URL_SECRET", true).getString();
|
|
75
|
+
let server = new NamirasoftSecretServer(REACT_APP_BASE_URL_SECRET, this.props.account.token_manager, this.props.notifier.onError);
|
|
76
|
+
if (this.state.secret_id)
|
|
77
|
+
server.secret.GetValue(this.state.secret_id).then(value =>
|
|
78
|
+
{
|
|
79
|
+
this.NSBoxPassword_Main.current?.setValue(value);
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
return (
|
|
86
|
+
<>
|
|
87
|
+
<NSBoxPassword
|
|
88
|
+
ref={this.NSBoxPassword_Main}
|
|
89
|
+
{...this.props}
|
|
90
|
+
onChanged={(box) =>
|
|
91
|
+
{
|
|
92
|
+
this.setState({ value: box.getValue(false) });
|
|
93
|
+
this.props.onChanged?.(this);
|
|
94
|
+
}}
|
|
95
|
+
onClicked={() => this.props.onClicked?.(this)}
|
|
96
|
+
placeholder={placeholder}
|
|
97
|
+
input={{ style: input_style }}
|
|
98
|
+
menu={menu}
|
|
99
|
+
/>
|
|
100
|
+
</>
|
|
101
|
+
);
|
|
102
|
+
}
|
|
103
|
+
}
|
package/src/main.ts
CHANGED