@nu-art/user-account-frontend 0.400.5
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/_ats/account-editor/ATS_AccountEditor.d.ts +15 -0
- package/_ats/account-editor/ATS_AccountEditor.js +45 -0
- package/_ats/account-editor/ATS_AccountEditor.scss +127 -0
- package/_ats_session-data/ATS_SessionData.d.ts +18 -0
- package/_ats_session-data/ATS_SessionData.js +40 -0
- package/_entity/account/ModuleFE_Account.d.ts +47 -0
- package/_entity/account/ModuleFE_Account.js +153 -0
- package/_entity/account/consts.d.ts +8 -0
- package/_entity/account/consts.js +7 -0
- package/_entity/account/index.d.ts +3 -0
- package/_entity/account/index.js +3 -0
- package/_entity/account/module-pack.d.ts +2 -0
- package/_entity/account/module-pack.js +3 -0
- package/_entity/session/ModuleFE_Session.d.ts +33 -0
- package/_entity/session/ModuleFE_Session.js +95 -0
- package/_entity.d.ts +3 -0
- package/_entity.js +3 -0
- package/account-editor/Component_AccountEditor.d.ts +38 -0
- package/account-editor/Component_AccountEditor.js +134 -0
- package/account-editor/Component_AccountEditor.scss +139 -0
- package/consts.d.ts +1 -0
- package/consts.js +1 -0
- package/index.d.ts +9 -0
- package/index.js +26 -0
- package/module-pack.d.ts +2 -0
- package/module-pack.js +21 -0
- package/package.json +81 -0
- package/ui/Component_AccountThumbnail/Component_AccountThumbnail.d.ts +14 -0
- package/ui/Component_AccountThumbnail/Component_AccountThumbnail.js +59 -0
- package/ui/Component_AccountThumbnail/Component_AccountThumbnail.scss +66 -0
- package/ui/Component_ChangePassword/Component_ChangePassword.d.ts +17 -0
- package/ui/Component_ChangePassword/Component_ChangePassword.js +52 -0
- package/ui/Component_GoogleSAMLLogin/Component_GoogleSAMLLogin.d.ts +6 -0
- package/ui/Component_GoogleSAMLLogin/Component_GoogleSAMLLogin.js +16 -0
- package/ui/Component_GoogleSAMLLogin/Component_GoogleSAMLLogin.scss +20 -0
- package/ui/Component_Login/Component_Login.d.ts +23 -0
- package/ui/Component_Login/Component_Login.js +124 -0
- package/ui/Component_Login/Component_Login.scss +66 -0
- package/ui/Component_Login/index.d.ts +1 -0
- package/ui/Component_Login/index.js +18 -0
- package/ui/Component_LoginBlocked/Component_LoginBlocked.d.ts +19 -0
- package/ui/Component_LoginBlocked/Component_LoginBlocked.js +35 -0
- package/ui/Component_LoginBlocked/Component_LoginBlocked.scss +3 -0
- package/ui/Component_Register.d.ts +26 -0
- package/ui/Component_Register.js +152 -0
- package/ui/PopUp_AccountMenu/PopUp_AccountMenu.d.ts +62 -0
- package/ui/PopUp_AccountMenu/PopUp_AccountMenu.js +130 -0
- package/ui/PopUp_AccountMenu/PopUp_AccountMenu.scss +167 -0
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { _className, ComponentSync, getElementCenterPos, Grid, LL_H_C, LL_V_C, LL_V_L, ModuleFE_MouseInteractivity, ModuleFE_Thunderstorm, mouseInteractivity_PopUp, TS_ComponentTransition, TS_ErrorBoundary, Button } from '@nu-art/thunderstorm-frontend/index';
|
|
3
|
+
import { resolveContent, RuntimeVersion } from '@nu-art/ts-common';
|
|
4
|
+
import { Component_AccountThumbnail } from '../Component_AccountThumbnail/Component_AccountThumbnail.js';
|
|
5
|
+
import './PopUp_AccountMenu.scss';
|
|
6
|
+
import { Component_ChangePassword } from '../Component_ChangePassword/Component_ChangePassword.js';
|
|
7
|
+
import { ModuleFE_Utils } from '@nu-art/thunderstorm-frontend/modules/ModuleFE_Utils/ModuleFE_Utils';
|
|
8
|
+
import { RendererKey_AccountMenu_SubHeader } from '../../consts.js';
|
|
9
|
+
import { ModuleFE_Account } from '../../_entity/account/index.js';
|
|
10
|
+
export class PopUp_AccountMenu extends ComponentSync {
|
|
11
|
+
// ######################### Static #########################
|
|
12
|
+
static show(e, props, modalProps) {
|
|
13
|
+
ModuleFE_MouseInteractivity.showContent({
|
|
14
|
+
id: 'pop-up__account-menu',
|
|
15
|
+
originPos: getElementCenterPos(e.currentTarget),
|
|
16
|
+
modalPos: modalProps?.modalPos ?? { x: -1, y: 1 },
|
|
17
|
+
content: () => _jsx(PopUp_AccountMenu, { ...props }),
|
|
18
|
+
offset: modalProps?.offset,
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
static Action_AppToolsButton = (url) => ({
|
|
22
|
+
label: 'App Tools',
|
|
23
|
+
type: 'action',
|
|
24
|
+
closePopUp: true,
|
|
25
|
+
action: () => {
|
|
26
|
+
ModuleFE_Thunderstorm.openUrl(url, '_blank');
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
static Action_EditPassword = {
|
|
30
|
+
label: 'Edit Password',
|
|
31
|
+
type: 'page',
|
|
32
|
+
pageKey: 'edit-password',
|
|
33
|
+
content: (account, closePageTrigger) => _jsx(Component_ChangePassword, { postSubmitAction: closePageTrigger })
|
|
34
|
+
};
|
|
35
|
+
static defaultProps = {
|
|
36
|
+
menuActions: [PopUp_AccountMenu.Action_AppToolsButton('/app-tools'), PopUp_AccountMenu.Action_EditPassword]
|
|
37
|
+
};
|
|
38
|
+
// ######################### Life Cycle #########################
|
|
39
|
+
deriveStateFromProps(nextProps, state) {
|
|
40
|
+
state.account = ModuleFE_Account.cache.unique(nextProps.accountId);
|
|
41
|
+
if (!state.account)
|
|
42
|
+
this.logError('Could not get account', `account id: ${nextProps.accountId}`);
|
|
43
|
+
//Gather menu actions
|
|
44
|
+
state.menuActions = nextProps.menuActions?.map(menuAction => resolveContent(menuAction));
|
|
45
|
+
//Prepare page map from actions
|
|
46
|
+
state.pageMap = state.menuActions?.reduce((map, action) => {
|
|
47
|
+
if (action.type === 'page')
|
|
48
|
+
map[action.pageKey] = action.content;
|
|
49
|
+
return map;
|
|
50
|
+
}, {}) ?? {};
|
|
51
|
+
return state;
|
|
52
|
+
}
|
|
53
|
+
// ######################### Logic #########################
|
|
54
|
+
closePopUp = () => {
|
|
55
|
+
ModuleFE_MouseInteractivity.hide(mouseInteractivity_PopUp);
|
|
56
|
+
};
|
|
57
|
+
logOut = async () => {
|
|
58
|
+
this.closePopUp();
|
|
59
|
+
ModuleFE_Account.logout();
|
|
60
|
+
};
|
|
61
|
+
onActionClick = (action) => {
|
|
62
|
+
switch (action.type) {
|
|
63
|
+
case 'action': {
|
|
64
|
+
if (action.closePopUp)
|
|
65
|
+
this.closePopUp();
|
|
66
|
+
action.action();
|
|
67
|
+
break;
|
|
68
|
+
}
|
|
69
|
+
case 'page': {
|
|
70
|
+
this.setState({ pageKey: action.pageKey, prevPageKey: action.pageKey });
|
|
71
|
+
break;
|
|
72
|
+
}
|
|
73
|
+
default:
|
|
74
|
+
// @ts-ignore
|
|
75
|
+
this.logError(`Unknown action type ${action.type}`);
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
closeCustomPage = () => {
|
|
79
|
+
this.setState({ pageKey: undefined });
|
|
80
|
+
};
|
|
81
|
+
// ######################### Render #########################
|
|
82
|
+
render() {
|
|
83
|
+
return _jsxs(TS_ErrorBoundary, { children: [this.renderNoAccount(), this.renderAccount()] });
|
|
84
|
+
}
|
|
85
|
+
renderNoAccount = () => {
|
|
86
|
+
if (this.state.account)
|
|
87
|
+
return;
|
|
88
|
+
return _jsx("div", { className: 'account-menu__not-found', children: "Account Not Found" });
|
|
89
|
+
};
|
|
90
|
+
renderAccount = () => {
|
|
91
|
+
if (!this.state.account)
|
|
92
|
+
return;
|
|
93
|
+
return _jsxs(_Fragment, { children: [_jsxs(LL_V_L, { className: 'account-menu', children: [this.renderHeader(), this.renderBody(), this.renderFooter()] }), this.renderCustomPage()] });
|
|
94
|
+
};
|
|
95
|
+
renderSeparatorBar = (style) => {
|
|
96
|
+
return _jsx("span", { className: 'account-menu__separator', style: style });
|
|
97
|
+
};
|
|
98
|
+
// ######################### Render - Account Parts #########################
|
|
99
|
+
renderHeader = () => {
|
|
100
|
+
const account = this.state.account;
|
|
101
|
+
if (!account)
|
|
102
|
+
return;
|
|
103
|
+
const accountDisplay = this.props.accountDisplayModifier?.(account) ?? account.displayName ?? account.email;
|
|
104
|
+
const AdditionalHeaderRenderer = ModuleFE_Utils.getRenderer(RendererKey_AccountMenu_SubHeader, { account: account });
|
|
105
|
+
return _jsxs(_Fragment, { children: [_jsxs(LL_H_C, { className: 'account-menu__header', children: [_jsx(Component_AccountThumbnail, { accountId: () => account._id, acronymComposer: this.props.acronymComposer }), _jsx("div", { className: 'account-menu__header__display-name', children: accountDisplay })] }), AdditionalHeaderRenderer && _jsx(AdditionalHeaderRenderer, {}), this.renderSeparatorBar()] });
|
|
106
|
+
};
|
|
107
|
+
renderBody = () => {
|
|
108
|
+
const account = this.state.account;
|
|
109
|
+
if (!account)
|
|
110
|
+
return;
|
|
111
|
+
return _jsx(Grid, { className: 'account-menu__body', children: this.state.menuActions?.map((menuAction, i) => {
|
|
112
|
+
return _jsx(Button, { variant: 'secondary', id: menuAction.id, className: _className(menuAction.className), onClick: () => this.onActionClick(menuAction), children: menuAction.label }, i);
|
|
113
|
+
}) });
|
|
114
|
+
};
|
|
115
|
+
renderFooter = () => {
|
|
116
|
+
const account = this.state.account;
|
|
117
|
+
if (!account)
|
|
118
|
+
return;
|
|
119
|
+
return _jsxs(_Fragment, { children: [this.renderSeparatorBar({ marginTop: 'auto' }), _jsxs(LL_V_C, { className: 'account-menu__footer', children: [_jsx(Button, { variant: 'primary', onClick: this.logOut, children: "Log Out" }), _jsx("div", { className: "version", children: RuntimeVersion() })] })] });
|
|
120
|
+
};
|
|
121
|
+
// ######################### Render - Custom Page #########################
|
|
122
|
+
renderCustomPage = () => {
|
|
123
|
+
const pageKey = this.state.pageKey;
|
|
124
|
+
const account = this.state.account;
|
|
125
|
+
if (!account)
|
|
126
|
+
return;
|
|
127
|
+
const className = _className('account-menu__custom-page', !!pageKey && 'show');
|
|
128
|
+
return _jsxs(LL_V_L, { className: className, children: [_jsx("div", { className: 'account-menu__custom-page__back-button', onClick: this.closeCustomPage, children: "Back" }), _jsx(TS_ComponentTransition, { trigger: !!pageKey, unmountTimeout: 200, onExitDone: () => this.setState({ prevPageKey: undefined }), children: this.state.pageMap[pageKey ?? this.state.prevPageKey]?.(account, this.closeCustomPage) })] });
|
|
129
|
+
};
|
|
130
|
+
}
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
@use '@nu-art/ts-styles' as S;
|
|
2
|
+
|
|
3
|
+
%main-button-design {
|
|
4
|
+
width: 95%;
|
|
5
|
+
height: 30px;
|
|
6
|
+
margin: 0 auto;
|
|
7
|
+
@include S.mouse-interactive-background(S.dark-blue(2), S.dark-blue(1));
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
#pop-up__account-menu {
|
|
11
|
+
width: 280px;
|
|
12
|
+
height: 400px;
|
|
13
|
+
overflow: hidden;
|
|
14
|
+
background: white;
|
|
15
|
+
border-radius: 10px;
|
|
16
|
+
border: 2px solid S.dark-blue(1);
|
|
17
|
+
position: relative;
|
|
18
|
+
|
|
19
|
+
.account-menu__not-found {
|
|
20
|
+
width: 100%;
|
|
21
|
+
height: 100%;
|
|
22
|
+
font-size: 18px;
|
|
23
|
+
color: S.dark-blue(1);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.account-menu {
|
|
27
|
+
width: 100%;
|
|
28
|
+
height: 100%;
|
|
29
|
+
|
|
30
|
+
.account-menu__separator {
|
|
31
|
+
background: S.dark-blue(1);
|
|
32
|
+
width: 95%;
|
|
33
|
+
flex-shrink: 0;
|
|
34
|
+
margin: 0 auto;
|
|
35
|
+
height: 2px;
|
|
36
|
+
border-radius: 1px;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.account-menu__header {
|
|
40
|
+
width: 100%;
|
|
41
|
+
height: 65px;
|
|
42
|
+
flex-shrink: 0;
|
|
43
|
+
align-items: center;
|
|
44
|
+
gap: 10px;
|
|
45
|
+
padding: 0 10px;
|
|
46
|
+
|
|
47
|
+
.user-thumbnail {
|
|
48
|
+
width: 50px;
|
|
49
|
+
height: 50px;
|
|
50
|
+
|
|
51
|
+
.user-thumbnail__acronym {
|
|
52
|
+
font-size: 26px;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.account-menu__header__display-name {
|
|
57
|
+
font: {
|
|
58
|
+
size: 18px;
|
|
59
|
+
weight: 600;
|
|
60
|
+
}
|
|
61
|
+
color: S.dark-blue(1);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.container_role-names {
|
|
66
|
+
max-height: 200px;
|
|
67
|
+
padding: 4px;
|
|
68
|
+
width: 100%;
|
|
69
|
+
|
|
70
|
+
@include S.customScrollbar('vertical');
|
|
71
|
+
|
|
72
|
+
.role-name {
|
|
73
|
+
font: {
|
|
74
|
+
size: 12px;
|
|
75
|
+
weight: 550;
|
|
76
|
+
}
|
|
77
|
+
color: S.dark-blue(1);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.account-menu__body {
|
|
82
|
+
width: 100%;
|
|
83
|
+
padding: 10px;
|
|
84
|
+
gap: 10px;
|
|
85
|
+
grid-template-columns: 1fr 1fr;
|
|
86
|
+
|
|
87
|
+
.ts-button, .ts-busy-button {
|
|
88
|
+
margin: 0;
|
|
89
|
+
height: 30px;
|
|
90
|
+
background: transparent;
|
|
91
|
+
border: 2px solid S.dark-blue(2);
|
|
92
|
+
|
|
93
|
+
@include S.mouse-interactive-text(S.dark-blue(2), white);
|
|
94
|
+
@include S.mouse-interactive-background(white, S.dark-blue(2));
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
.account-menu__footer {
|
|
99
|
+
width: 100%;
|
|
100
|
+
margin-block: 4px;
|
|
101
|
+
gap: 4px;
|
|
102
|
+
align-items: center;
|
|
103
|
+
flex-shrink: 0;
|
|
104
|
+
|
|
105
|
+
.ts-button {
|
|
106
|
+
@extend %main-button-design;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
.version {
|
|
110
|
+
color: #006fab;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
.account-menu__custom-page {
|
|
116
|
+
position: absolute;
|
|
117
|
+
width: 100%;
|
|
118
|
+
height: 100%;
|
|
119
|
+
top: 0;
|
|
120
|
+
left: 0;
|
|
121
|
+
transition: translate 200ms linear;
|
|
122
|
+
background: white;
|
|
123
|
+
padding: 10px 0;
|
|
124
|
+
|
|
125
|
+
.account-menu__custom-page__back-button {
|
|
126
|
+
transition: background 100ms, color 100ms;
|
|
127
|
+
cursor: pointer;
|
|
128
|
+
padding: 4px 10px;
|
|
129
|
+
border-radius: 6px;
|
|
130
|
+
margin-left: 10px;
|
|
131
|
+
font: {
|
|
132
|
+
size: 14px;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
@include S.mouse-interactive-background(white, S.dark-blue(2));
|
|
136
|
+
@include S.mouse-interactive-text(S.dark-blue(2), white);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
&:not(.show) {
|
|
140
|
+
translate: 100% 0;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
//Custom look for the change password page
|
|
144
|
+
.ts-account__change-password {
|
|
145
|
+
width: 100%;
|
|
146
|
+
padding: 10px 20px;
|
|
147
|
+
gap: 20px;
|
|
148
|
+
flex-grow: 1;
|
|
149
|
+
height: 0;
|
|
150
|
+
|
|
151
|
+
.ts-prop-renderer {
|
|
152
|
+
.ts-input {
|
|
153
|
+
border: 1px solid S.dark-blue(2);
|
|
154
|
+
border-radius: 6px;
|
|
155
|
+
min-height: 35px;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
.ts-busy-button {
|
|
160
|
+
margin-top: auto;
|
|
161
|
+
width: 100%;
|
|
162
|
+
|
|
163
|
+
@extend %main-button-design;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
}
|