@genesislcap/foundation-login 14.226.1 → 14.226.2-alpha-bcda968.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/dist/dts/main/main.d.ts +1 -1
- package/dist/dts/routes/base.d.ts +1 -2
- package/dist/dts/routes/base.d.ts.map +1 -1
- package/dist/dts/routes/config.d.ts +4 -10
- package/dist/dts/routes/config.d.ts.map +1 -1
- package/dist/dts/routes/forgot-password/forgot-password.d.ts.map +1 -1
- package/dist/esm/main/main.js +1 -1
- package/dist/esm/routes/base.js +5 -6
- package/dist/esm/routes/config.js +16 -48
- package/dist/esm/routes/forgot-password/forgot-password.js +12 -5
- package/dist/esm/routes/login-form/login-form.js +3 -3
- package/dist/esm/routes/login-form/login-form.template.js +3 -3
- package/dist/esm/routes/protected/protected.js +1 -1
- package/dist/foundation-login.api.json +1 -1
- package/dist/foundation-login.d.ts +5 -12
- package/docs/api/foundation-login.login.md +1 -1
- package/docs/api-report.md +4 -10
- package/package.json +15 -15
package/dist/dts/main/main.d.ts
CHANGED
|
@@ -90,7 +90,7 @@ import { MainRouterConfig } from '../routes';
|
|
|
90
90
|
* // Otherwise route them to login
|
|
91
91
|
* phase.cancel(() => {
|
|
92
92
|
* session.captureReturnUrl();
|
|
93
|
-
*
|
|
93
|
+
* FoundationRouteNav.name.replace(phase.router, 'login');
|
|
94
94
|
* });
|
|
95
95
|
* },
|
|
96
96
|
* });
|
|
@@ -54,9 +54,8 @@ export declare class BaseRoute extends ConfigHostElement {
|
|
|
54
54
|
setError(message: string): void;
|
|
55
55
|
clearError(): void;
|
|
56
56
|
get orgUsername(): string;
|
|
57
|
-
getSubRoutePath(routeName: Routes | string): string;
|
|
58
57
|
onBack: () => void;
|
|
59
|
-
onNavigate: (
|
|
58
|
+
onNavigate: (routeName: Routes, params?: Object, trigger?: boolean) => void;
|
|
60
59
|
queueOnBack(delay?: number): void;
|
|
61
60
|
autofill(): Promise<boolean>;
|
|
62
61
|
storeCredentials(password?: string): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../../src/routes/base.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,IAAI,EACJ,OAAO,EAEP,iBAAiB,EAEjB,OAAO,EACP,cAAc,EACd,OAAO,EACR,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,MAAM,8BAA8B,CAAC;
|
|
1
|
+
{"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../../src/routes/base.ts"],"names":[],"mappings":"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"}
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import { Auth
|
|
2
|
-
import {
|
|
3
|
-
import { Container } from '@microsoft/fast-foundation';
|
|
4
|
-
import { RouterConfiguration } from '@microsoft/fast-router';
|
|
1
|
+
import { Auth } from '@genesislcap/foundation-comms';
|
|
2
|
+
import { FoundationRouterConfiguration } from '@genesislcap/foundation-ui';
|
|
5
3
|
import { LoginConfig } from '../main/config';
|
|
6
4
|
import type { Settings } from './types';
|
|
7
5
|
/**
|
|
@@ -14,14 +12,10 @@ import type { Settings } from './types';
|
|
|
14
12
|
*
|
|
15
13
|
* @internal
|
|
16
14
|
*/
|
|
17
|
-
export declare class MainRouterConfig extends
|
|
15
|
+
export declare class MainRouterConfig extends FoundationRouterConfiguration<Settings> {
|
|
18
16
|
private auth;
|
|
19
|
-
private container;
|
|
20
|
-
private analytics;
|
|
21
|
-
private session;
|
|
22
17
|
private loginConfig;
|
|
23
|
-
constructor(auth: Auth,
|
|
18
|
+
constructor(auth: Auth, loginConfig?: LoginConfig);
|
|
24
19
|
configure(): void;
|
|
25
|
-
construct<T>(Type: Constructable<T>): T;
|
|
26
20
|
}
|
|
27
21
|
//# sourceMappingURL=config.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../src/routes/config.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../src/routes/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,+BAA+B,CAAC;AACrD,OAAO,EAAE,6BAA6B,EAAE,MAAM,4BAA4B,CAAC;AAI3E,OAAO,EAAsB,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAQjE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAGxC;;;;;;;;;GASG;AACH,qBAAa,gBAAiB,SAAQ,6BAA6B,CAAC,QAAQ,CAAC;IAEnE,OAAO,CAAC,IAAI;IACK,OAAO,CAAC,WAAW;gBAD5B,IAAI,EAAE,IAAI,EACO,WAAW,cAAqB;IAK1D,SAAS;CAuHjB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"forgot-password.d.ts","sourceRoot":"","sources":["../../../../src/routes/forgot-password/forgot-password.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAGpC,qBAKa,cAAe,SAAQ,SAAS;IACrC,iBAAiB;IAKjB,QAAQ;
|
|
1
|
+
{"version":3,"file":"forgot-password.d.ts","sourceRoot":"","sources":["../../../../src/routes/forgot-password/forgot-password.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAGpC,qBAKa,cAAe,SAAQ,SAAS;IACrC,iBAAiB;IAKjB,QAAQ;CAyBf"}
|
package/dist/esm/main/main.js
CHANGED
|
@@ -95,7 +95,7 @@ import { definition, standaloneDefinition } from './main.definition';
|
|
|
95
95
|
* // Otherwise route them to login
|
|
96
96
|
* phase.cancel(() => {
|
|
97
97
|
* session.captureReturnUrl();
|
|
98
|
-
*
|
|
98
|
+
* FoundationRouteNav.name.replace(phase.router, 'login');
|
|
99
99
|
* });
|
|
100
100
|
* },
|
|
101
101
|
* });
|
package/dist/esm/routes/base.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { __awaiter, __decorate } from "tslib";
|
|
2
2
|
import { Auth, Connect, CredentialManager, credentialSeparator, MessageBuilder, Session, } from '@genesislcap/foundation-comms';
|
|
3
3
|
import { I18next } from '@genesislcap/foundation-i18n';
|
|
4
|
+
import { FoundationRouteNav } from '@genesislcap/foundation-ui';
|
|
4
5
|
import { sync } from '@genesislcap/foundation-utils';
|
|
5
6
|
import { SecondaryRapidColorHEX } from '@genesislcap/foundation-zero';
|
|
6
7
|
import { attr, css, customElement, FASTElement, html, observable, when, } from '@microsoft/fast-element';
|
|
7
8
|
import { Container } from '@microsoft/fast-foundation';
|
|
8
|
-
import { Route } from '@microsoft/fast-router';
|
|
9
9
|
import { classNames } from '@microsoft/fast-web-utilities';
|
|
10
10
|
import merge from 'lodash/merge';
|
|
11
11
|
import { defaultLoginConfig, hostUrl, LoginConfig } from '../main/config';
|
|
@@ -55,8 +55,10 @@ export class BaseRoute extends ConfigHostElement {
|
|
|
55
55
|
this.message = '';
|
|
56
56
|
this.hasErrors = false;
|
|
57
57
|
this.isSubmitting = false;
|
|
58
|
-
this.onBack = () => this.onNavigate('
|
|
59
|
-
this.onNavigate = (
|
|
58
|
+
this.onBack = () => this.onNavigate('login');
|
|
59
|
+
this.onNavigate = (routeName, params = {}, trigger = true) => {
|
|
60
|
+
FoundationRouteNav.name.push(this, routeName, params, trigger);
|
|
61
|
+
};
|
|
60
62
|
}
|
|
61
63
|
connectedCallback() {
|
|
62
64
|
var _a;
|
|
@@ -107,9 +109,6 @@ export class BaseRoute extends ConfigHostElement {
|
|
|
107
109
|
? `${this.username.trim()}:${this.organisation.trim()}`
|
|
108
110
|
: this.username.trim();
|
|
109
111
|
}
|
|
110
|
-
getSubRoutePath(routeName) {
|
|
111
|
-
return this.config.hostPath !== '' ? `${this.config.hostPath}/${routeName}` : routeName;
|
|
112
|
-
}
|
|
113
112
|
queueOnBack(delay) {
|
|
114
113
|
var _a;
|
|
115
114
|
setTimeout(() => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { __awaiter, __decorate, __param } from "tslib";
|
|
2
|
-
import { Auth
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
2
|
+
import { Auth } from '@genesislcap/foundation-comms';
|
|
3
|
+
import { FoundationRouterConfiguration } from '@genesislcap/foundation-ui';
|
|
4
|
+
import { optional } from '@microsoft/fast-foundation';
|
|
5
5
|
import { defaultLayout } from '../layouts';
|
|
6
6
|
import { defaultLoginConfig, LoginConfig } from '../main/config';
|
|
7
7
|
import { ForgotPassword } from './forgot-password/forgot-password';
|
|
@@ -22,28 +22,19 @@ import { Verify } from './verify/verify';
|
|
|
22
22
|
*
|
|
23
23
|
* @internal
|
|
24
24
|
*/
|
|
25
|
-
let MainRouterConfig = class MainRouterConfig extends
|
|
26
|
-
constructor(auth,
|
|
25
|
+
let MainRouterConfig = class MainRouterConfig extends FoundationRouterConfiguration {
|
|
26
|
+
constructor(auth, loginConfig = defaultLoginConfig) {
|
|
27
27
|
super();
|
|
28
28
|
this.auth = auth;
|
|
29
|
-
this.container = container;
|
|
30
|
-
this.analytics = analytics;
|
|
31
|
-
this.session = session;
|
|
32
29
|
this.loginConfig = loginConfig;
|
|
33
30
|
}
|
|
34
31
|
configure() {
|
|
35
32
|
this.title = 'Login';
|
|
33
|
+
this.loginPath = '';
|
|
36
34
|
this.defaultLayout = defaultLayout;
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
* const { define, templateOptions, template, styles } = await import(
|
|
41
|
-
* /!* webpackChunkName: "login-form" *!/
|
|
42
|
-
* './login-form'
|
|
43
|
-
* );
|
|
44
|
-
* return define(this.compose(templateOptions, template, styles, 'login-form'));
|
|
45
|
-
* },
|
|
46
|
-
*/
|
|
35
|
+
this.configureAnalytics();
|
|
36
|
+
this.configureRoutePermittedChecks();
|
|
37
|
+
this.configureFallbackRouteDefinition();
|
|
47
38
|
const routes = [
|
|
48
39
|
{
|
|
49
40
|
path: '',
|
|
@@ -114,63 +105,40 @@ let MainRouterConfig = class MainRouterConfig extends RouterConfiguration {
|
|
|
114
105
|
});
|
|
115
106
|
}
|
|
116
107
|
this.routes.map(...routes);
|
|
117
|
-
const session = this.session;
|
|
118
|
-
const auth = this.auth;
|
|
119
|
-
const analytics = this.analytics;
|
|
120
|
-
/**
|
|
121
|
-
* Example of a FallbackRouteDefinition
|
|
122
|
-
*/
|
|
123
|
-
this.routes.fallback(() => auth.isLoggedIn ? { redirect: 'not-found' } : { redirect: 'login' });
|
|
124
108
|
/**
|
|
125
109
|
* Example of a NavigationContributor
|
|
126
110
|
*/
|
|
127
111
|
this.contributors.push({
|
|
128
112
|
navigate: (phase) => __awaiter(this, void 0, void 0, function* () {
|
|
129
113
|
const settings = phase.route.settings;
|
|
130
|
-
/**
|
|
131
|
-
* TODO: Centralise
|
|
132
|
-
* Suspect this should be done via createEventSink, but it's not fully clear how-to do that as no docs
|
|
133
|
-
*/
|
|
134
|
-
analytics.trackEvent(FoundationAnalyticsEventType.routeChanged, {
|
|
135
|
-
path: phase.route.endpoint.path,
|
|
136
|
-
});
|
|
137
114
|
/**
|
|
138
115
|
* If public route don't block
|
|
139
116
|
*/
|
|
140
|
-
if (settings
|
|
117
|
+
if (settings === null || settings === void 0 ? void 0 : settings.public) {
|
|
141
118
|
return;
|
|
142
119
|
}
|
|
143
120
|
/**
|
|
144
|
-
* If
|
|
121
|
+
* If authenticated don't block
|
|
145
122
|
*/
|
|
146
|
-
if (
|
|
123
|
+
if (this.user.isAuthenticated) {
|
|
147
124
|
return;
|
|
148
125
|
}
|
|
149
126
|
/**
|
|
150
|
-
* If
|
|
127
|
+
* If autoAuth and session is valid try to connect+auto-login
|
|
151
128
|
*/
|
|
152
|
-
if (this.loginConfig.autoAuth && (yield auth.reAuthFromSession())) {
|
|
129
|
+
if (this.loginConfig.autoAuth && (yield this.auth.reAuthFromSession())) {
|
|
153
130
|
return;
|
|
154
131
|
}
|
|
155
132
|
/**
|
|
156
133
|
* Otherwise route them to login
|
|
157
134
|
*/
|
|
158
|
-
|
|
159
|
-
session.captureReturnUrl();
|
|
160
|
-
Route.name.replace(phase.router, 'login');
|
|
161
|
-
});
|
|
135
|
+
this.navigationPhaseLoginRedirect(phase);
|
|
162
136
|
}),
|
|
163
137
|
});
|
|
164
138
|
}
|
|
165
|
-
construct(Type) {
|
|
166
|
-
return this.container.get(Type);
|
|
167
|
-
}
|
|
168
139
|
};
|
|
169
140
|
MainRouterConfig = __decorate([
|
|
170
141
|
__param(0, Auth),
|
|
171
|
-
__param(1,
|
|
172
|
-
__param(2, FoundationAnalytics),
|
|
173
|
-
__param(3, Session),
|
|
174
|
-
__param(4, optional(LoginConfig))
|
|
142
|
+
__param(1, optional(LoginConfig))
|
|
175
143
|
], MainRouterConfig);
|
|
176
144
|
export { MainRouterConfig };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { __awaiter, __decorate } from "tslib";
|
|
2
|
+
import { FoundationRouteNav } from '@genesislcap/foundation-ui';
|
|
2
3
|
import { customElement } from '@microsoft/fast-element';
|
|
3
|
-
import { hostEnv } from '../../main/config';
|
|
4
4
|
import { commonLoginRouteStyles } from '../../styles';
|
|
5
5
|
import { logger } from '../../utils';
|
|
6
6
|
import { BaseRoute } from '../base';
|
|
@@ -19,16 +19,23 @@ let ForgotPassword = class ForgotPassword extends BaseRoute {
|
|
|
19
19
|
const _super = Object.create(null, {
|
|
20
20
|
onSubmit: { get: () => super.onSubmit }
|
|
21
21
|
});
|
|
22
|
-
var _a;
|
|
23
22
|
return __awaiter(this, void 0, void 0, function* () {
|
|
24
23
|
logger.debug('forgot password submission');
|
|
25
24
|
yield _super.onSubmit.call(this);
|
|
25
|
+
const navigationPathCallback = (fullPath) => __awaiter(this, void 0, void 0, function* () {
|
|
26
|
+
var _a;
|
|
27
|
+
const message = this.messageBuilder.createForgotPasswordMessage(this.orgUsername, fullPath);
|
|
28
|
+
yield this.sendMessage(message, this.toLocalisedText('FORGOTTEN_PASSWORD_SUCCESS_MESSAGE'), undefined, (_a = this.config.messageDelays) === null || _a === void 0 ? void 0 : _a.forgotPassword);
|
|
29
|
+
});
|
|
26
30
|
/**
|
|
27
31
|
* Example url from email: https://public-foundation.genesislab.global/reset-password?password=nc_cbGrlgCkZeJHAF043oqEidnk
|
|
28
32
|
*/
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
33
|
+
// this.$emit('generate-navigation-path', {
|
|
34
|
+
// path: 'reset-password',
|
|
35
|
+
// callback: navigationPathCallback,
|
|
36
|
+
// });
|
|
37
|
+
const fullPath = yield FoundationRouteNav.name.generateRoute(this, 'reset-password');
|
|
38
|
+
yield navigationPathCallback(fullPath);
|
|
32
39
|
});
|
|
33
40
|
}
|
|
34
41
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { __awaiter, __decorate } from "tslib";
|
|
2
2
|
import { AuthError } from '@genesislcap/foundation-comms';
|
|
3
|
+
import { FoundationRouteNav } from '@genesislcap/foundation-ui';
|
|
3
4
|
import { inIFrame, inSymphonyDesktop, openPopup } from '@genesislcap/foundation-utils';
|
|
4
5
|
import { customElement, DOM, observable, volatile } from '@microsoft/fast-element';
|
|
5
|
-
import { Route } from '@microsoft/fast-router';
|
|
6
6
|
import { logger, getSSOLoginURL, fetchIDPs } from '../../utils';
|
|
7
7
|
import { BaseRoute } from '../base';
|
|
8
8
|
import { LoginFormStyles as styles } from './login-form.styles';
|
|
@@ -194,14 +194,14 @@ let LoginForm = class LoginForm extends BaseRoute {
|
|
|
194
194
|
this.config.redirectHandler(url);
|
|
195
195
|
}
|
|
196
196
|
else {
|
|
197
|
-
|
|
197
|
+
FoundationRouteNav.path.push(url);
|
|
198
198
|
}
|
|
199
199
|
}
|
|
200
200
|
catch (err) {
|
|
201
201
|
if (err instanceof AuthError) {
|
|
202
202
|
if (err.hasPasswordExpiredError()) {
|
|
203
203
|
this.storeCredentials();
|
|
204
|
-
this.onNavigate(
|
|
204
|
+
this.onNavigate('reset-password', { expired: true });
|
|
205
205
|
return;
|
|
206
206
|
}
|
|
207
207
|
if (err.hasMFAError()) {
|
|
@@ -13,7 +13,7 @@ const regularLogin = html `
|
|
|
13
13
|
${when((x) => !x.config.omitRoutes.includes('forgot-password'), html `
|
|
14
14
|
<zero-button
|
|
15
15
|
appearance="lightweight"
|
|
16
|
-
@click=${(x) => x.onNavigate(
|
|
16
|
+
@click=${(x) => x.onNavigate(`forgot-password`)}
|
|
17
17
|
data-test-id="forgot-password"
|
|
18
18
|
>
|
|
19
19
|
${(x) => x.toLocalisedText('LOGIN_FORM_FORGOT_PASSWORD_LINK')}
|
|
@@ -22,7 +22,7 @@ const regularLogin = html `
|
|
|
22
22
|
${when((x) => !x.config.omitRoutes.includes('reset-password'), html `
|
|
23
23
|
<zero-button
|
|
24
24
|
appearance="lightweight"
|
|
25
|
-
@click=${(x) => x.onNavigate(
|
|
25
|
+
@click=${(x) => x.onNavigate(`reset-password`)}
|
|
26
26
|
data-test-id="reset-password"
|
|
27
27
|
>
|
|
28
28
|
${(x) => x.toLocalisedText('LOGIN_FORM_CHANGE_PASSWORD_LINK')}
|
|
@@ -33,7 +33,7 @@ const regularLogin = html `
|
|
|
33
33
|
${when((x) => !x.config.omitRoutes.includes('request-account'), html `
|
|
34
34
|
<zero-button
|
|
35
35
|
appearance="lightweight"
|
|
36
|
-
@click=${(x) => x.onNavigate(
|
|
36
|
+
@click=${(x) => x.onNavigate(`request-account`)}
|
|
37
37
|
data-test-id="request-account"
|
|
38
38
|
>
|
|
39
39
|
${(x) => x.toLocalisedText('LOGIN_FORM_REQUEST_ACCOUNT_LINK')}
|
|
@@ -1024,7 +1024,7 @@
|
|
|
1024
1024
|
{
|
|
1025
1025
|
"kind": "Class",
|
|
1026
1026
|
"canonicalReference": "@genesislcap/foundation-login!Login:class",
|
|
1027
|
-
"docComment": "/**\n * Defines the login class which handles account authentication from the front-end\n *\n * @remarks\n *\n * Add the Login class as a router element, and it will handle the account authentication for you. Requires use of `@genesislcap/foundation-comms` for the {@link @genesislcap/foundation-comms#Auth | Auth} and {@link @genesislcap/foundation#Session | Session} classes.\n *\n * There are a lot of configuration options available, and different authentication types (such as login via SSO). Use the modules exported `configure` and `define` functions for more power.\n *\n * @deprecated\n *\n * - Use '\\@genesislcap/pbc-auth' instead. 'https://www.npmjs.com/package/\\@genesislcap/pbc-auth'\n *\n * @example\n *\n * The following is an example of using it in your app, setting it up in the router configuration. This isn't a complete routes confutation, but it contains all required configuration in regard to adding Login functionality.\n * ```ts\n * // Import required dependencies from the foundation-login package\n * import { Login } from '@genesislcap/foundation-login';\n * // Import required dependencies from the foundation-comms package\n * // You could also import analytics events and set them up in the NavigationContributor\n * import { Auth, Session } from '@genesislcap/foundation-comms';\n *\n * type RouterSettings = {\n * public?: boolean;\n * autoAuth?: boolean;\n * }\n *\n * // Define your router config\n * export class MainRouterConfig extends RouterConfiguration<RouterSettings> {\n * // Ensure you inject in required dependencies\n * constructor(\n * @Auth private auth: Auth,\n * @Session private session: Session\n * ) {\n * super();\n * }\n *\n * // Add Login as a route\n * public configure() {\n * ...\n * this.routes.map(\n * { path: '', redirect: 'login' },\n * {\n * path: 'login',\n * element: Login,\n * title: 'Login',\n * name: 'login',\n * layout: loginLayout,\n * settings: { public: true },\n * childRouters: true,\n * },\n * ... // Other routes config here\n * );\n *\n * const session = this.session;\n * const auth = this.auth;\n *\n * // Example of a FallbackRouteDefinition\n * this.routes.fallback(() =>\n * auth.isLoggedIn ? { redirect: 'not-found' } : { redirect: 'login' }\n * );\n *\n * // Example of a NavigationContributor\n * this.contributors.push({\n * navigate: async (phase) => {\n * const settings = phase.route.settings;\n *\n * // Could add in processes such as analytics here\n *\n * // If public route don't block\n * if (settings && settings.public) {\n * return;\n * }\n *\n * // If logged in don't block\n * if (auth.isLoggedIn) {\n * return;\n * }\n *\n * // If autoAuth and session is valid try to connect+auto-login\n * if (settings && settings.autoAuth && (await auth.reAuthFromSession())) {\n * return;\n * }\n *\n * // Otherwise route them to login\n * phase.cancel(() => {\n * session.captureReturnUrl();\n *
|
|
1027
|
+
"docComment": "/**\n * Defines the login class which handles account authentication from the front-end\n *\n * @remarks\n *\n * Add the Login class as a router element, and it will handle the account authentication for you. Requires use of `@genesislcap/foundation-comms` for the {@link @genesislcap/foundation-comms#Auth | Auth} and {@link @genesislcap/foundation#Session | Session} classes.\n *\n * There are a lot of configuration options available, and different authentication types (such as login via SSO). Use the modules exported `configure` and `define` functions for more power.\n *\n * @deprecated\n *\n * - Use '\\@genesislcap/pbc-auth' instead. 'https://www.npmjs.com/package/\\@genesislcap/pbc-auth'\n *\n * @example\n *\n * The following is an example of using it in your app, setting it up in the router configuration. This isn't a complete routes confutation, but it contains all required configuration in regard to adding Login functionality.\n * ```ts\n * // Import required dependencies from the foundation-login package\n * import { Login } from '@genesislcap/foundation-login';\n * // Import required dependencies from the foundation-comms package\n * // You could also import analytics events and set them up in the NavigationContributor\n * import { Auth, Session } from '@genesislcap/foundation-comms';\n *\n * type RouterSettings = {\n * public?: boolean;\n * autoAuth?: boolean;\n * }\n *\n * // Define your router config\n * export class MainRouterConfig extends RouterConfiguration<RouterSettings> {\n * // Ensure you inject in required dependencies\n * constructor(\n * @Auth private auth: Auth,\n * @Session private session: Session\n * ) {\n * super();\n * }\n *\n * // Add Login as a route\n * public configure() {\n * ...\n * this.routes.map(\n * { path: '', redirect: 'login' },\n * {\n * path: 'login',\n * element: Login,\n * title: 'Login',\n * name: 'login',\n * layout: loginLayout,\n * settings: { public: true },\n * childRouters: true,\n * },\n * ... // Other routes config here\n * );\n *\n * const session = this.session;\n * const auth = this.auth;\n *\n * // Example of a FallbackRouteDefinition\n * this.routes.fallback(() =>\n * auth.isLoggedIn ? { redirect: 'not-found' } : { redirect: 'login' }\n * );\n *\n * // Example of a NavigationContributor\n * this.contributors.push({\n * navigate: async (phase) => {\n * const settings = phase.route.settings;\n *\n * // Could add in processes such as analytics here\n *\n * // If public route don't block\n * if (settings && settings.public) {\n * return;\n * }\n *\n * // If logged in don't block\n * if (auth.isLoggedIn) {\n * return;\n * }\n *\n * // If autoAuth and session is valid try to connect+auto-login\n * if (settings && settings.autoAuth && (await auth.reAuthFromSession())) {\n * return;\n * }\n *\n * // Otherwise route them to login\n * phase.cancel(() => {\n * session.captureReturnUrl();\n * FoundationRouteNav.name.replace(phase.router, 'login');\n * });\n * },\n * });\n * }\n *\n * ... // Other configuration/methods\n *\n * }\n * ```\n *\n * @public\n */\n",
|
|
1028
1028
|
"excerptTokens": [
|
|
1029
1029
|
{
|
|
1030
1030
|
"kind": "Content",
|
|
@@ -1,20 +1,18 @@
|
|
|
1
1
|
import { Auth } from '@genesislcap/foundation-comms';
|
|
2
2
|
import { Binding } from '@microsoft/fast-element';
|
|
3
3
|
import { Connect } from '@genesislcap/foundation-comms';
|
|
4
|
-
import { Constructable } from '@microsoft/fast-element';
|
|
5
4
|
import { Container } from '@microsoft/fast-foundation';
|
|
6
5
|
import { CredentialManager } from '@genesislcap/foundation-comms';
|
|
7
6
|
import { DefineFunction } from '@genesislcap/foundation-ui';
|
|
8
7
|
import { ElementStyles } from '@microsoft/fast-element';
|
|
9
8
|
import { FASTElement } from '@microsoft/fast-element';
|
|
10
|
-
import {
|
|
9
|
+
import { FoundationRouterConfiguration } from '@genesislcap/foundation-ui';
|
|
11
10
|
import { I18next } from '@genesislcap/foundation-i18n';
|
|
12
11
|
import { I18nextConfig } from '@genesislcap/foundation-i18n';
|
|
13
12
|
import { InterfaceSymbol } from '@microsoft/fast-foundation';
|
|
14
13
|
import { Message } from '@genesislcap/foundation-comms';
|
|
15
14
|
import { MessageBuilder } from '@genesislcap/foundation-comms';
|
|
16
15
|
import { PartialFASTElementDefinition } from '@microsoft/fast-element';
|
|
17
|
-
import { RouterConfiguration } from '@microsoft/fast-router';
|
|
18
16
|
import { Session } from '@genesislcap/foundation-comms';
|
|
19
17
|
import { SyntheticViewTemplate } from '@microsoft/fast-element';
|
|
20
18
|
import { TemplateElementDependency } from '@genesislcap/foundation-ui';
|
|
@@ -60,9 +58,8 @@ export declare class BaseRoute extends ConfigHostElement {
|
|
|
60
58
|
setError(message: string): void;
|
|
61
59
|
clearError(): void;
|
|
62
60
|
get orgUsername(): string;
|
|
63
|
-
getSubRoutePath(routeName: Routes | string): string;
|
|
64
61
|
onBack: () => void;
|
|
65
|
-
onNavigate: (
|
|
62
|
+
onNavigate: (routeName: Routes, params?: Object, trigger?: boolean) => void;
|
|
66
63
|
queueOnBack(delay?: number): void;
|
|
67
64
|
autofill(): Promise<boolean>;
|
|
68
65
|
storeCredentials(password?: string): void;
|
|
@@ -459,7 +456,7 @@ export declare function isMFRoute(pathname?: string): boolean;
|
|
|
459
456
|
* // Otherwise route them to login
|
|
460
457
|
* phase.cancel(() => {
|
|
461
458
|
* session.captureReturnUrl();
|
|
462
|
-
*
|
|
459
|
+
* FoundationRouteNav.name.replace(phase.router, 'login');
|
|
463
460
|
* });
|
|
464
461
|
* },
|
|
465
462
|
* });
|
|
@@ -796,15 +793,11 @@ export declare class LogoElement extends ConfigHostElement {
|
|
|
796
793
|
*
|
|
797
794
|
* @internal
|
|
798
795
|
*/
|
|
799
|
-
export declare class MainRouterConfig extends
|
|
796
|
+
export declare class MainRouterConfig extends FoundationRouterConfiguration<Settings> {
|
|
800
797
|
private auth;
|
|
801
|
-
private container;
|
|
802
|
-
private analytics;
|
|
803
|
-
private session;
|
|
804
798
|
private loginConfig;
|
|
805
|
-
constructor(auth: Auth,
|
|
799
|
+
constructor(auth: Auth, loginConfig?: LoginConfig);
|
|
806
800
|
configure(): void;
|
|
807
|
-
construct<T>(Type: Constructable<T>): T;
|
|
808
801
|
}
|
|
809
802
|
|
|
810
803
|
/**
|
|
@@ -100,7 +100,7 @@ export class MainRouterConfig extends RouterConfiguration<RouterSettings> {
|
|
|
100
100
|
// Otherwise route them to login
|
|
101
101
|
phase.cancel(() => {
|
|
102
102
|
session.captureReturnUrl();
|
|
103
|
-
|
|
103
|
+
FoundationRouteNav.name.replace(phase.router, 'login');
|
|
104
104
|
});
|
|
105
105
|
},
|
|
106
106
|
});
|
package/docs/api-report.md
CHANGED
|
@@ -7,20 +7,18 @@
|
|
|
7
7
|
import { Auth } from '@genesislcap/foundation-comms';
|
|
8
8
|
import { Binding } from '@microsoft/fast-element';
|
|
9
9
|
import { Connect } from '@genesislcap/foundation-comms';
|
|
10
|
-
import { Constructable } from '@microsoft/fast-element';
|
|
11
10
|
import { Container } from '@microsoft/fast-foundation';
|
|
12
11
|
import { CredentialManager } from '@genesislcap/foundation-comms';
|
|
13
12
|
import { DefineFunction } from '@genesislcap/foundation-ui';
|
|
14
13
|
import { ElementStyles } from '@microsoft/fast-element';
|
|
15
14
|
import { FASTElement } from '@microsoft/fast-element';
|
|
16
|
-
import {
|
|
15
|
+
import { FoundationRouterConfiguration } from '@genesislcap/foundation-ui';
|
|
17
16
|
import { I18next } from '@genesislcap/foundation-i18n';
|
|
18
17
|
import { I18nextConfig } from '@genesislcap/foundation-i18n';
|
|
19
18
|
import { InterfaceSymbol } from '@microsoft/fast-foundation';
|
|
20
19
|
import { Message } from '@genesislcap/foundation-comms';
|
|
21
20
|
import { MessageBuilder } from '@genesislcap/foundation-comms';
|
|
22
21
|
import { PartialFASTElementDefinition } from '@microsoft/fast-element';
|
|
23
|
-
import { RouterConfiguration } from '@microsoft/fast-router';
|
|
24
22
|
import { Session } from '@genesislcap/foundation-comms';
|
|
25
23
|
import { SyntheticViewTemplate } from '@microsoft/fast-element';
|
|
26
24
|
import { TemplateElementDependency } from '@genesislcap/foundation-ui';
|
|
@@ -61,8 +59,6 @@ export class BaseRoute extends ConfigHostElement {
|
|
|
61
59
|
// (undocumented)
|
|
62
60
|
ensureConnection(): Promise<boolean>;
|
|
63
61
|
// (undocumented)
|
|
64
|
-
getSubRoutePath(routeName: Routes | string): string;
|
|
65
|
-
// (undocumented)
|
|
66
62
|
hasErrors: boolean;
|
|
67
63
|
// (undocumented)
|
|
68
64
|
host: string;
|
|
@@ -75,7 +71,7 @@ export class BaseRoute extends ConfigHostElement {
|
|
|
75
71
|
// (undocumented)
|
|
76
72
|
onBack: () => void;
|
|
77
73
|
// (undocumented)
|
|
78
|
-
onNavigate: (
|
|
74
|
+
onNavigate: (routeName: Routes, params?: Object, trigger?: boolean) => void;
|
|
79
75
|
// (undocumented)
|
|
80
76
|
onSubmit(): Promise<void>;
|
|
81
77
|
// (undocumented)
|
|
@@ -316,12 +312,10 @@ export class LogoElement extends ConfigHostElement {
|
|
|
316
312
|
// Warning: (ae-internal-missing-underscore) The name "MainRouterConfig" should be prefixed with an underscore because the declaration is marked as @internal
|
|
317
313
|
//
|
|
318
314
|
// @internal
|
|
319
|
-
export class MainRouterConfig extends
|
|
320
|
-
constructor(auth: Auth,
|
|
315
|
+
export class MainRouterConfig extends FoundationRouterConfiguration<Settings> {
|
|
316
|
+
constructor(auth: Auth, loginConfig?: LoginConfig);
|
|
321
317
|
// (undocumented)
|
|
322
318
|
configure(): void;
|
|
323
|
-
// (undocumented)
|
|
324
|
-
construct<T>(Type: Constructable<T>): T;
|
|
325
319
|
}
|
|
326
320
|
|
|
327
321
|
// @public (undocumented)
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@genesislcap/foundation-login",
|
|
3
3
|
"description": "Genesis Foundation Login",
|
|
4
|
-
"version": "14.226.
|
|
4
|
+
"version": "14.226.2-alpha-bcda968.0",
|
|
5
5
|
"license": "SEE LICENSE IN license.txt",
|
|
6
6
|
"main": "dist/esm/index.js",
|
|
7
7
|
"types": "dist/foundation-login.d.ts",
|
|
@@ -67,22 +67,22 @@
|
|
|
67
67
|
}
|
|
68
68
|
},
|
|
69
69
|
"devDependencies": {
|
|
70
|
-
"@genesislcap/foundation-testing": "14.226.
|
|
71
|
-
"@genesislcap/genx": "14.226.
|
|
72
|
-
"@genesislcap/rollup-builder": "14.226.
|
|
73
|
-
"@genesislcap/ts-builder": "14.226.
|
|
74
|
-
"@genesislcap/uvu-playwright-builder": "14.226.
|
|
75
|
-
"@genesislcap/vite-builder": "14.226.
|
|
76
|
-
"@genesislcap/webpack-builder": "14.226.
|
|
70
|
+
"@genesislcap/foundation-testing": "14.226.2-alpha-bcda968.0",
|
|
71
|
+
"@genesislcap/genx": "14.226.2-alpha-bcda968.0",
|
|
72
|
+
"@genesislcap/rollup-builder": "14.226.2-alpha-bcda968.0",
|
|
73
|
+
"@genesislcap/ts-builder": "14.226.2-alpha-bcda968.0",
|
|
74
|
+
"@genesislcap/uvu-playwright-builder": "14.226.2-alpha-bcda968.0",
|
|
75
|
+
"@genesislcap/vite-builder": "14.226.2-alpha-bcda968.0",
|
|
76
|
+
"@genesislcap/webpack-builder": "14.226.2-alpha-bcda968.0",
|
|
77
77
|
"rimraf": "^5.0.0"
|
|
78
78
|
},
|
|
79
79
|
"dependencies": {
|
|
80
|
-
"@genesislcap/foundation-comms": "14.226.
|
|
81
|
-
"@genesislcap/foundation-i18n": "14.226.
|
|
82
|
-
"@genesislcap/foundation-logger": "14.226.
|
|
83
|
-
"@genesislcap/foundation-ui": "14.226.
|
|
84
|
-
"@genesislcap/foundation-utils": "14.226.
|
|
85
|
-
"@genesislcap/foundation-zero": "14.226.
|
|
80
|
+
"@genesislcap/foundation-comms": "14.226.2-alpha-bcda968.0",
|
|
81
|
+
"@genesislcap/foundation-i18n": "14.226.2-alpha-bcda968.0",
|
|
82
|
+
"@genesislcap/foundation-logger": "14.226.2-alpha-bcda968.0",
|
|
83
|
+
"@genesislcap/foundation-ui": "14.226.2-alpha-bcda968.0",
|
|
84
|
+
"@genesislcap/foundation-utils": "14.226.2-alpha-bcda968.0",
|
|
85
|
+
"@genesislcap/foundation-zero": "14.226.2-alpha-bcda968.0",
|
|
86
86
|
"@microsoft/fast-components": "2.30.6",
|
|
87
87
|
"@microsoft/fast-element": "1.14.0",
|
|
88
88
|
"@microsoft/fast-foundation": "2.49.6",
|
|
@@ -100,5 +100,5 @@
|
|
|
100
100
|
"access": "public"
|
|
101
101
|
},
|
|
102
102
|
"customElements": "dist/custom-elements.json",
|
|
103
|
-
"gitHead": "
|
|
103
|
+
"gitHead": "9af9df8ba21d267f9bb916dcdc29796cd9f3e007"
|
|
104
104
|
}
|