@pontive/pontkit-core 1.21.1 → 1.22.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/catalog.json +60 -1
- package/custom-elements.json +1 -1
- package/dist/components/renderers/auth/form/_form.d.ts +2 -0
- package/dist/components/renderers/auth/form/form.defs.d.ts +2 -1
- package/dist/components/renderers/auth/form/form.types.d.ts +7 -2
- package/dist/components/renderers/auth/index.d.ts +1 -0
- package/dist/components/renderers/auth/recovery-codes/index.d.ts +1 -7
- package/dist/components/renderers/auth/scope-list/_scope-list.d.ts +44 -0
- package/dist/components/renderers/auth/scope-list/index.d.ts +7 -0
- package/dist/components/renderers/auth/scope-list/scope-list.defs.d.ts +2 -0
- package/dist/components/renderers/auth/scope-list/scope-list.stories.d.ts +8 -0
- package/dist/components/renderers/auth/scope-list/scope-list.types.d.ts +20 -0
- package/dist/components/renderers/auth/scope-list/scope-list.value.d.ts +14 -0
- package/dist/components/renderers/feedback/countdown/_countdown.d.ts +38 -13
- package/dist/components/renderers/feedback/countdown/countdown.defs.d.ts +9 -0
- package/dist/components/renderers/feedback/countdown/index.d.ts +1 -7
- package/dist/components/renderers/navigation/external-link/_external-link.d.ts +26 -0
- package/dist/components/renderers/navigation/external-link/external-link.defs.d.ts +2 -0
- package/dist/components/renderers/navigation/external-link/external-link.href.d.ts +9 -0
- package/dist/components/renderers/navigation/external-link/external-link.stories.d.ts +7 -0
- package/dist/components/renderers/navigation/external-link/external-link.types.d.ts +5 -0
- package/dist/components/renderers/navigation/external-link/index.d.ts +7 -0
- package/dist/components/renderers/navigation/index.d.ts +1 -0
- package/dist/components/renderers/typography/subtitle/_subtitle.d.ts +14 -4
- package/dist/components/renderers/typography/subtitle/index.d.ts +1 -7
- package/dist/components/renderers/typography/subtitle/subtitle.defs.d.ts +4 -0
- package/dist/components/renderers/typography/title/_title.d.ts +19 -9
- package/dist/components/renderers/typography/title/index.d.ts +1 -7
- package/dist/components/renderers/typography/title/title.defs.d.ts +7 -0
- package/dist/components/renderers/typography/title/title.stories.d.ts +1 -0
- package/dist/components/widgets/index.d.ts +1 -0
- package/dist/components/widgets/pont-consent/consent-api.d.ts +56 -0
- package/dist/components/widgets/pont-consent/pont-consent.d.ts +50 -0
- package/dist/components/wrappers/layout/layout.d.ts +12 -0
- package/dist/element-tag-map.d.ts +8 -0
- package/dist/index.js +619 -575
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +6838 -6393
- package/dist/index.mjs.map +1 -1
- package/dist/primitives/components/ui/input-otp/_input-otp-group.d.ts +6 -16
- package/dist/primitives/components/ui/input-otp/_input-otp-separator.d.ts +7 -7
- package/dist/primitives/components/ui/input-otp/_input-otp-slot.d.ts +9 -14
- package/dist/primitives/components/ui/input-otp/_input-otp.d.ts +20 -48
- package/dist/primitives/components/ui/input-otp/input-otp.d.ts +9 -9
- package/dist/primitives/components/ui/input-otp/input-otp.defs.d.ts +3 -3
- package/dist/styles.css +786 -178
- package/package.json +1 -1
- package/dist/components/renderers/feedback/countdown/countdown.types.d.ts +0 -6
- package/dist/components/renderers/typography/subtitle/subtitle.types.d.ts +0 -4
- package/dist/components/renderers/typography/title/title.types.d.ts +0 -4
|
@@ -34,6 +34,8 @@ export declare class PontForm extends LitElement implements Props {
|
|
|
34
34
|
customId?: string;
|
|
35
35
|
/**
|
|
36
36
|
* Custom submission handler that replaces the default auth service call.
|
|
37
|
+
* Awaited under the form's loading state; a rejection is reported as
|
|
38
|
+
* `pont-form:error`. `pont-form:submit` is not fired for it.
|
|
37
39
|
*/
|
|
38
40
|
onSubmit?: FormOnSubmit;
|
|
39
41
|
/**
|
|
@@ -2,5 +2,6 @@ import { PontPasskeyButton, PontProviderButton } from '../button';
|
|
|
2
2
|
import { PontConfirmField, PontEmailField, PontIdentifierField, PontNameField, PontPasswordField, PontPhoneField, PontUsernameField } from '../field';
|
|
3
3
|
import { PontLink } from '../../navigation/link';
|
|
4
4
|
import { PontOtp } from '../otp';
|
|
5
|
-
|
|
5
|
+
import { PontScopeList } from '../scope-list';
|
|
6
|
+
export declare const FIELDS: (typeof PontPasswordField | typeof PontConfirmField | typeof PontEmailField | typeof PontIdentifierField | typeof PontNameField | typeof PontPhoneField | typeof PontUsernameField | typeof PontScopeList | typeof PontOtp)[];
|
|
6
7
|
export declare const INTERACTIVES: (typeof PontPasskeyButton | typeof PontProviderButton | typeof PontLink)[];
|
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
import { PontPasskeyButton, PontProviderButton } from '../button';
|
|
2
2
|
import { PontConfirmField, PontEmailField, PontIdentifierField, PontNameField, PontPasswordField, PontPhoneField, PontUsernameField } from '../field';
|
|
3
3
|
import { PontLink } from '../../navigation/link';
|
|
4
|
+
import { PontScopeList } from '../scope-list';
|
|
4
5
|
export type FormPart = "root";
|
|
5
|
-
|
|
6
|
+
/**
|
|
7
|
+
* Replaces the auth service call. The form shows its loading state until the
|
|
8
|
+
* returned promise settles, and reports a rejection as `pont-form:error`.
|
|
9
|
+
*/
|
|
10
|
+
export type FormOnSubmit = (data: Record<string, string>, event?: string) => void | Promise<unknown>;
|
|
6
11
|
export type FormOnReset = (event: Event) => void;
|
|
7
12
|
export type PontFormProps = {
|
|
8
13
|
seed: string;
|
|
@@ -10,5 +15,5 @@ export type PontFormProps = {
|
|
|
10
15
|
onSubmit?: FormOnSubmit;
|
|
11
16
|
onReset?: FormOnReset;
|
|
12
17
|
};
|
|
13
|
-
export type Field = PontEmailField | PontPhoneField | PontUsernameField | PontIdentifierField | PontNameField | PontPasswordField | PontConfirmField;
|
|
18
|
+
export type Field = PontEmailField | PontPhoneField | PontUsernameField | PontIdentifierField | PontNameField | PontPasswordField | PontConfirmField | PontScopeList;
|
|
14
19
|
export type Interactive = PontPasskeyButton | PontProviderButton | PontLink;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { BaseElement } from '../../..';
|
|
2
|
+
import { ScopeListParts, ScopeListProps } from './scope-list.types';
|
|
3
|
+
/**
|
|
4
|
+
* The permissions an app asks for, one checkbox each, on the consent screen
|
|
5
|
+
* (pontive-spec 32 §4.3).
|
|
6
|
+
*
|
|
7
|
+
* Every row starts ticked, new and previously granted alike: the person
|
|
8
|
+
* unticks what they decline. A `required` row is ticked and cannot be unticked.
|
|
9
|
+
* As a form field it submits the ticked scopes space-separated, which is the
|
|
10
|
+
* OAuth `scope` format the consent endpoint reads. No selection is invalid, so
|
|
11
|
+
* `validate()` always passes: declining everything optional is an answer.
|
|
12
|
+
*
|
|
13
|
+
* @part scope-list - root list
|
|
14
|
+
* @part scope-list-item - one row
|
|
15
|
+
* @part scope-list-label - the row's label, wrapping checkbox and text
|
|
16
|
+
* @part scope-list-checkbox - the row's checkbox
|
|
17
|
+
* @part scope-list-text - the row's text
|
|
18
|
+
*/
|
|
19
|
+
export declare class PontScopeList extends BaseElement implements ScopeListProps {
|
|
20
|
+
static readonly ROOT = "scope-list";
|
|
21
|
+
static readonly ITEM = "item";
|
|
22
|
+
static readonly LABEL = "label";
|
|
23
|
+
static readonly CHECKBOX = "checkbox";
|
|
24
|
+
static readonly TEXT = "text";
|
|
25
|
+
static readonly TAG: string;
|
|
26
|
+
static readonly PARTS: Record<ScopeListParts, string>;
|
|
27
|
+
/** Key the ticked scopes are submitted under. */
|
|
28
|
+
name: string;
|
|
29
|
+
/** `[{scope, label, granted, required}]`, as JSON in markup. */
|
|
30
|
+
scopes: ScopeListProps["scopes"];
|
|
31
|
+
/** Set by the enclosing form while a submission is in flight. */
|
|
32
|
+
disabled: boolean;
|
|
33
|
+
/**
|
|
34
|
+
* The scopes the person unticked. Kept as what they declined rather than
|
|
35
|
+
* what is ticked, so a row is ticked until someone says otherwise, and a
|
|
36
|
+
* re-rendered list keeps their choices for the rows it still shows.
|
|
37
|
+
*/
|
|
38
|
+
private _unticked;
|
|
39
|
+
protected createRenderRoot(): this;
|
|
40
|
+
get value(): string;
|
|
41
|
+
validate(): boolean;
|
|
42
|
+
private _toggle;
|
|
43
|
+
render(): import('lit-html').TemplateResult<1>;
|
|
44
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/web-components-vite';
|
|
2
|
+
declare const meta: Meta;
|
|
3
|
+
export default meta;
|
|
4
|
+
type Story = StoryObj;
|
|
5
|
+
export declare const Basic: Story;
|
|
6
|
+
/** As identity-svc renders it: the list as a JSON attribute. */
|
|
7
|
+
export declare const FromAttribute: Story;
|
|
8
|
+
export declare const Disabled: Story;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* One permission an app asks for on the consent screen, as identity-svc
|
|
3
|
+
* renders it into `{{consent_scopes_json}}` (pontive-spec 32 §4.3).
|
|
4
|
+
*/
|
|
5
|
+
export type ConsentScope = {
|
|
6
|
+
/** The OAuth scope value, e.g. `profile`. What the field submits. */
|
|
7
|
+
scope: string;
|
|
8
|
+
/** What the person reads, already localized server-side. */
|
|
9
|
+
label: string;
|
|
10
|
+
/** The person granted this scope to the app before. */
|
|
11
|
+
granted?: boolean;
|
|
12
|
+
/** The app cannot work without it: shown ticked and cannot be unticked. */
|
|
13
|
+
required?: boolean;
|
|
14
|
+
};
|
|
15
|
+
export type ScopeListProps = {
|
|
16
|
+
name: string;
|
|
17
|
+
scopes: ConsentScope[];
|
|
18
|
+
disabled: boolean;
|
|
19
|
+
};
|
|
20
|
+
export type ScopeListParts = "root" | "item" | "label" | "checkbox" | "text";
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ConsentScope } from './scope-list.types';
|
|
2
|
+
/**
|
|
3
|
+
* The scopes as the field can trust them. The list arrives as a JSON attribute
|
|
4
|
+
* the server composed, so an entry without a scope value is dropped rather than
|
|
5
|
+
* rendered as a row that would submit nothing, and a repeated one is dropped.
|
|
6
|
+
*/
|
|
7
|
+
export declare function normalizeScopes(scopes: unknown): ConsentScope[];
|
|
8
|
+
/** Whether a row is ticked: required rows always, the rest unless unticked. */
|
|
9
|
+
export declare function isScopeChecked(scope: ConsentScope, unticked: ReadonlySet<string>): boolean;
|
|
10
|
+
/**
|
|
11
|
+
* The ticked scopes in OAuth's own format: space-separated, in the order the
|
|
12
|
+
* screen lists them, each once.
|
|
13
|
+
*/
|
|
14
|
+
export declare function scopeListValue(scopes: ConsentScope[], unticked: ReadonlySet<string>): string;
|
|
@@ -1,20 +1,45 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { CountdownProps as Props } from './countdown.
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { LitElement } from 'lit';
|
|
2
|
+
import { CountdownProps as Props, CountdownPart } from './countdown.defs';
|
|
3
|
+
/**
|
|
4
|
+
* Displays remaining seconds and redirects once the timer has finished.
|
|
5
|
+
*
|
|
6
|
+
* @element pont-countdown
|
|
7
|
+
* - data-pont-countdown (`div`): root
|
|
8
|
+
*/
|
|
9
|
+
export declare class PontCountdown extends LitElement implements Props {
|
|
10
|
+
static readonly ROOT = "countdown";
|
|
11
|
+
static readonly TAG: string;
|
|
12
|
+
static readonly PARTS: Record<CountdownPart, string>;
|
|
13
|
+
/**
|
|
14
|
+
* Substring used in generated part IDs.
|
|
15
|
+
*/
|
|
16
|
+
seed: string;
|
|
17
|
+
/**
|
|
18
|
+
* Custom ID used as the root part ID and as the base of subpart IDs.
|
|
19
|
+
*/
|
|
20
|
+
customId?: string;
|
|
21
|
+
/**
|
|
22
|
+
* The countdown duration in seconds before redirecting.
|
|
23
|
+
*/
|
|
6
24
|
duration: number;
|
|
25
|
+
/**
|
|
26
|
+
* The URL used for navigation when the countdown completes.
|
|
27
|
+
*/
|
|
7
28
|
redirectUrl: string;
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
29
|
+
/**
|
|
30
|
+
* The text displayed before the countdown timer value.
|
|
31
|
+
*/
|
|
32
|
+
content: string;
|
|
33
|
+
private _seconds;
|
|
34
|
+
private _timerId;
|
|
11
35
|
protected createRenderRoot(): this;
|
|
36
|
+
get rootId(): string;
|
|
37
|
+
get rootEl(): HTMLElement | null;
|
|
12
38
|
connectedCallback(): void;
|
|
13
39
|
disconnectedCallback(): void;
|
|
14
|
-
private
|
|
15
|
-
private
|
|
16
|
-
private
|
|
17
|
-
private
|
|
18
|
-
private renderContent;
|
|
40
|
+
private _initCountdown;
|
|
41
|
+
private _startTimer;
|
|
42
|
+
private _completeCountdown;
|
|
43
|
+
private _clearTimer;
|
|
19
44
|
render(): import('lit-html').TemplateResult<1>;
|
|
20
45
|
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { LitElement, nothing, PropertyValues } from 'lit';
|
|
2
|
+
import { ExternalLinkPart, ExternalLinkProps as Props } from './external-link.types';
|
|
3
|
+
/**
|
|
4
|
+
* A plain link to a page outside the flow — an app's privacy policy, terms or
|
|
5
|
+
* homepage on the consent screen — opened in a new tab.
|
|
6
|
+
*
|
|
7
|
+
* Unlike `pont-link` it has an `href` and nothing else to do: it never calls
|
|
8
|
+
* the flow API and fires no event, so it is safe on screens that are not an
|
|
9
|
+
* authflow. An empty href, or one that is not an absolute http(s) URL, renders
|
|
10
|
+
* nothing and takes no space, so a screen can carry links an app may not have
|
|
11
|
+
* configured.
|
|
12
|
+
*
|
|
13
|
+
* @part external-link - a: the link
|
|
14
|
+
*/
|
|
15
|
+
export declare class PontExternalLink extends LitElement implements Props {
|
|
16
|
+
static readonly ROOT = "external-link";
|
|
17
|
+
static readonly TAG: string;
|
|
18
|
+
static readonly PARTS: Record<ExternalLinkPart, string>;
|
|
19
|
+
/** Where the link goes. Only absolute http(s) URLs render. */
|
|
20
|
+
href: string;
|
|
21
|
+
/** The link's text. Falls back to the URL when empty. */
|
|
22
|
+
label: string;
|
|
23
|
+
protected createRenderRoot(): this;
|
|
24
|
+
protected willUpdate(changed: PropertyValues<this>): void;
|
|
25
|
+
render(): import('lit-html').TemplateResult<1> | typeof nothing;
|
|
26
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The href an external link may open, or null when it must not render.
|
|
3
|
+
*
|
|
4
|
+
* Only absolute http(s) URLs. The href usually comes from a placeholder the
|
|
5
|
+
* server fills from an app's settings (`{{consent_privacy_policy_url}}`), so
|
|
6
|
+
* it may be empty, still a placeholder, or a scheme that runs code
|
|
7
|
+
* (`javascript:`, `data:`) — none of which may become a link.
|
|
8
|
+
*/
|
|
9
|
+
export declare function safeExternalHref(raw: unknown): string | null;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/web-components-vite';
|
|
2
|
+
declare const meta: Meta;
|
|
3
|
+
export default meta;
|
|
4
|
+
type Story = StoryObj;
|
|
5
|
+
export declare const Basic: Story;
|
|
6
|
+
/** An app without the URL configured: the placeholder is left empty. */
|
|
7
|
+
export declare const EmptyHref: Story;
|
|
@@ -1,7 +1,17 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { LitElement } from 'lit';
|
|
2
|
+
import { SubtitleProps as Props } from './subtitle.defs';
|
|
3
|
+
/**
|
|
4
|
+
* A typography component for page, section, and widget subtitles.
|
|
5
|
+
*
|
|
6
|
+
* @element pont-subtitle
|
|
7
|
+
* - data-pont-subtitle (`p`): root/paragraph
|
|
8
|
+
*/
|
|
9
|
+
export declare class PontSubtitle extends LitElement implements Props {
|
|
10
|
+
static readonly ROOT = "subtitle";
|
|
11
|
+
static readonly TAG: string;
|
|
12
|
+
/**
|
|
13
|
+
* The text content rendered inside the subtitle/paragraph.
|
|
14
|
+
*/
|
|
5
15
|
content: string;
|
|
6
16
|
protected createRenderRoot(): this;
|
|
7
17
|
render(): import('lit-html').TemplateResult<1>;
|
|
@@ -1,13 +1,23 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { LitElement } from 'lit';
|
|
2
|
+
import { TitleProps as Props, TitleLevel } from './title.defs';
|
|
3
|
+
/**
|
|
4
|
+
* A typography component for page, section, and widget headings.
|
|
5
|
+
*
|
|
6
|
+
* @element pont-title
|
|
7
|
+
* - data-pont-title (`h1`/`h2`/`h3`/`h4`): root/heading
|
|
8
|
+
*/
|
|
9
|
+
export declare class PontTitle extends LitElement implements Props {
|
|
10
|
+
static readonly ROOT = "title";
|
|
11
|
+
static readonly TAG: string;
|
|
12
|
+
/**
|
|
13
|
+
* The heading level, determining whether `h1`, `h2`, `h3`, or `h4` is
|
|
14
|
+
* rendered.
|
|
15
|
+
*/
|
|
16
|
+
level: TitleLevel;
|
|
17
|
+
/**
|
|
18
|
+
* The text content rendered inside the title/heading.
|
|
19
|
+
*/
|
|
5
20
|
content: string;
|
|
6
21
|
protected createRenderRoot(): this;
|
|
7
22
|
render(): import('lit-html').TemplateResult<1>;
|
|
8
23
|
}
|
|
9
|
-
declare global {
|
|
10
|
-
interface HTMLElementTagNameMap {
|
|
11
|
-
"pont-title": PontTitle;
|
|
12
|
-
}
|
|
13
|
-
}
|
|
@@ -2,6 +2,7 @@ export * from './pont-account-settings';
|
|
|
2
2
|
export * from './pont-member-management';
|
|
3
3
|
export * from './pont-preview/pont-preview';
|
|
4
4
|
export * from './pont-invitation/pont-invitation';
|
|
5
|
+
export * from './pont-consent/pont-consent';
|
|
5
6
|
export * from './pont-signin/pont-signin';
|
|
6
7
|
export * from './pont-signup/pont-signup';
|
|
7
8
|
export * from './pont-account-menu';
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The consent screen's two calls to auth-api (pontive-spec 32 §4.3).
|
|
3
|
+
*
|
|
4
|
+
* Plain fetch rather than the oidc-client: the screen is not an authflow. The
|
|
5
|
+
* person already has a session, and the session cookie is what proves the
|
|
6
|
+
* consent request is theirs, so every call is same-origin and carries it.
|
|
7
|
+
*/
|
|
8
|
+
/** What `GET /auth/v1/consent/{id}` answers, and a re-rendered screen. */
|
|
9
|
+
export type ConsentView = {
|
|
10
|
+
render_spec: string;
|
|
11
|
+
locale?: string;
|
|
12
|
+
dir?: string;
|
|
13
|
+
};
|
|
14
|
+
/** What `POST /auth/v1/consent/{id}` answers. */
|
|
15
|
+
export type ConsentOutcome = {
|
|
16
|
+
redirect_to: string;
|
|
17
|
+
} | ConsentView;
|
|
18
|
+
/** A refused or failed consent call, shaped as describeFlowError reads one. */
|
|
19
|
+
export declare class ConsentError extends Error {
|
|
20
|
+
readonly code: string;
|
|
21
|
+
readonly status?: number | undefined;
|
|
22
|
+
constructor(message: string, code: string, status?: number | undefined);
|
|
23
|
+
}
|
|
24
|
+
export declare function consentEndpoint(baseUrl: string, id: string): string;
|
|
25
|
+
/** Loads the screen for a consent request. */
|
|
26
|
+
export declare function fetchConsent(baseUrl: string, id: string, options?: {
|
|
27
|
+
locales?: string;
|
|
28
|
+
}): Promise<ConsentView>;
|
|
29
|
+
/**
|
|
30
|
+
* Answers a consent request: `allow` with the ticked scopes, or `deny`. The
|
|
31
|
+
* answer is where to send the browser next, or the screen again (with an
|
|
32
|
+
* error on it) when the server wants the person to try again.
|
|
33
|
+
*/
|
|
34
|
+
export declare function submitConsent(baseUrl: string, id: string, event: string, data: Record<string, string>): Promise<ConsentOutcome>;
|
|
35
|
+
/**
|
|
36
|
+
* What pressing Allow or Deny does: posts the answer, then follows the
|
|
37
|
+
* server — to the app's redirect URI, or onto the screen it sent back.
|
|
38
|
+
*
|
|
39
|
+
* A failure is rethrown for the form to report, worded for the screen: the
|
|
40
|
+
* form hands it to `pont-layout`, which puts it in the error banner.
|
|
41
|
+
*/
|
|
42
|
+
export declare function answerConsent(baseUrl: string, id: string, event: string | undefined, data: Record<string, string>, on: {
|
|
43
|
+
navigate(url: string): void;
|
|
44
|
+
render(view: ConsentView): void;
|
|
45
|
+
}): Promise<void>;
|
|
46
|
+
/**
|
|
47
|
+
* The person-facing sentence for a failed consent call. A 404 is the one
|
|
48
|
+
* answer specific to this screen: the request expired, was already answered,
|
|
49
|
+
* or is not this session's — the server does not say which, and the way on
|
|
50
|
+
* is the same for all three.
|
|
51
|
+
*/
|
|
52
|
+
export declare const CONSENT_EXPIRED = "This request has expired. Go back to the app and try again.";
|
|
53
|
+
export declare function describeConsentError(error: unknown): {
|
|
54
|
+
message: string;
|
|
55
|
+
restartable: boolean;
|
|
56
|
+
};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { LitElement } from 'lit';
|
|
2
|
+
import { BrandingEntitlements } from '../../../context';
|
|
3
|
+
/**
|
|
4
|
+
* The consent screen: an app asks for access, the person allows or denies
|
|
5
|
+
* (pontive-spec 32 §4.3).
|
|
6
|
+
*
|
|
7
|
+
* Not a flow widget. The person already has a session, so there is no flow to
|
|
8
|
+
* start and no Auth to wait for: the screen is one consent request, named by
|
|
9
|
+
* `consent-request`, which auth-api renders like a flow view (the built-in
|
|
10
|
+
* `authorize_app` widget, the instance's brand and copy) and answers with a
|
|
11
|
+
* redirect. It still renders through `pont-layout`, so the markup, the error
|
|
12
|
+
* banner and the branding entitlement work as on every other hosted screen.
|
|
13
|
+
*
|
|
14
|
+
* Allow and Deny are submit buttons naming the `allow` / `deny` event, and the
|
|
15
|
+
* ticked scopes come from `pont-scope-list`. The layout's form keeps its usual
|
|
16
|
+
* validation and loading state; only the call it makes is replaced, through
|
|
17
|
+
* `pont-layout`'s `submitHandler`.
|
|
18
|
+
*/
|
|
19
|
+
export declare class PontConsent extends LitElement {
|
|
20
|
+
/** The consent request's id, from the page's `consent_request` parameter. */
|
|
21
|
+
consentRequest: string;
|
|
22
|
+
/** Where auth-api is. Same-origin by default: the session cookie must ride along. */
|
|
23
|
+
baseUrl: string;
|
|
24
|
+
branding: BrandingEntitlements;
|
|
25
|
+
locales: string;
|
|
26
|
+
private renderSpec;
|
|
27
|
+
/** Why the screen could not be loaded, as the person should read it. */
|
|
28
|
+
private loadError?;
|
|
29
|
+
/** Whether trying again could help. Not for an expired request. */
|
|
30
|
+
private retryable;
|
|
31
|
+
createRenderRoot(): this;
|
|
32
|
+
private __started;
|
|
33
|
+
/** Bumped per load, so only the latest answer lands on the screen. */
|
|
34
|
+
private __loadSeq;
|
|
35
|
+
connectedCallback(): void;
|
|
36
|
+
disconnectedCallback(): void;
|
|
37
|
+
protected updated(changed: Map<string, unknown>): void;
|
|
38
|
+
/** A different request, a different server, or a different language. */
|
|
39
|
+
private static readonly RELOAD_ON;
|
|
40
|
+
private reload;
|
|
41
|
+
private load;
|
|
42
|
+
private show;
|
|
43
|
+
/**
|
|
44
|
+
* Stable for the element's lifetime: `pont-layout` re-renders its content on
|
|
45
|
+
* every update, so a new function per render would wipe the screen.
|
|
46
|
+
*/
|
|
47
|
+
private submit;
|
|
48
|
+
private tryRemoveFallback;
|
|
49
|
+
render(): import('lit-html').TemplateResult<1>;
|
|
50
|
+
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { LitElement } from 'lit';
|
|
2
2
|
import { BrandingEntitlements } from '../../../context';
|
|
3
|
+
import { FormOnSubmit } from '../../renderers/auth/form/form.types';
|
|
3
4
|
export declare class PontKitLayout extends LitElement {
|
|
4
5
|
private spec;
|
|
5
6
|
set renderSpec(v: string);
|
|
@@ -32,6 +33,17 @@ export declare class PontKitLayout extends LitElement {
|
|
|
32
33
|
* to forward it falls back to `DEFAULT_BRANDING`, i.e. the watermark shows.
|
|
33
34
|
*/
|
|
34
35
|
branding: BrandingEntitlements;
|
|
36
|
+
/**
|
|
37
|
+
* Replaces the flow call the screen's form makes on submit, for a screen
|
|
38
|
+
* rendered from a spec that is not an authflow's (`pont-consent`). Handed to
|
|
39
|
+
* `pont-form` as its `onSubmit`, so the form still validates, spins the
|
|
40
|
+
* pressed button and holds its fields until the returned promise settles,
|
|
41
|
+
* and a rejection reaches this layout's error banner like a failed flow call.
|
|
42
|
+
*
|
|
43
|
+
* `attribute: false` for the same reason as `branding`: set by the widget
|
|
44
|
+
* hosting the layout, never authored in markup.
|
|
45
|
+
*/
|
|
46
|
+
submitHandler?: FormOnSubmit;
|
|
35
47
|
createRenderRoot(): this;
|
|
36
48
|
/**
|
|
37
49
|
* Asks the widget hosting this layout to start its flow again. Fired from the
|
|
@@ -6,11 +6,13 @@ import { AuthStateElement } from './components/wrappers/pont-auth-state/pont-aut
|
|
|
6
6
|
import { PontAuthenticated } from './components/wrappers/pont-authenticated/pont-authenticated';
|
|
7
7
|
import { PontBlock } from './components/renderers/layout/block/_block';
|
|
8
8
|
import { PontConfirmField } from './components/renderers/auth/field/_confirm-field';
|
|
9
|
+
import { PontConsent } from './components/widgets/pont-consent/pont-consent';
|
|
9
10
|
import { PontContainer } from './components/renderers/layout/container/_container';
|
|
10
11
|
import { PontCountdown } from './components/renderers/feedback/countdown/_countdown';
|
|
11
12
|
import { PontDivider } from './components/renderers/layout/divider/_divider';
|
|
12
13
|
import { PontEditIdentifier } from './components/renderers/auth/edit-identifier/_edit-identifier';
|
|
13
14
|
import { PontEmailField } from './components/renderers/auth/field/_email-field';
|
|
15
|
+
import { PontExternalLink } from './components/renderers/navigation/external-link/_external-link';
|
|
14
16
|
import { PontForm } from './components/renderers/auth/form/_form';
|
|
15
17
|
import { PontGap } from './components/renderers/layout/gap/_gap';
|
|
16
18
|
import { PontHeader } from './components/renderers/layout/header/_header';
|
|
@@ -35,6 +37,7 @@ import { PontProviderButton } from './components/renderers/auth/button/_provider
|
|
|
35
37
|
import { PontProviderField } from './components/renderers/auth/provider-field/_provider-field';
|
|
36
38
|
import { PontQrCode } from './components/renderers/auth/qr-code/_qr-code';
|
|
37
39
|
import { PontRecoveryCodes } from './components/renderers/auth/recovery-codes/_recovery-codes';
|
|
40
|
+
import { PontScopeList } from './components/renderers/auth/scope-list/_scope-list';
|
|
38
41
|
import { PontSecret } from './components/renderers/auth/secret/_secret';
|
|
39
42
|
import { SignedIn } from './components/wrappers/pont-signed-in/pont-signed-in';
|
|
40
43
|
import { SignedOut } from './components/wrappers/pont-signed-out/pont-signed-out';
|
|
@@ -42,6 +45,7 @@ import { PontSignIn } from './components/widgets/pont-signin/pont-signin';
|
|
|
42
45
|
import { PontSignUp } from './components/widgets/pont-signup/pont-signup';
|
|
43
46
|
import { PontSubmitButton } from './components/renderers/auth/button/_submit-button';
|
|
44
47
|
import { PontSubtitle } from './components/renderers/typography/subtitle/_subtitle';
|
|
48
|
+
import { PontTitle } from './components/renderers/typography/title/_title';
|
|
45
49
|
import { PontUsernameField } from './components/renderers/auth/field/_username-field';
|
|
46
50
|
import { PontWatermark } from './components/renderers/visuals/watermark/_watermark';
|
|
47
51
|
declare global {
|
|
@@ -54,11 +58,13 @@ declare global {
|
|
|
54
58
|
"pont-authenticated": PontAuthenticated;
|
|
55
59
|
"pont-block": PontBlock;
|
|
56
60
|
"pont-confirm-field": PontConfirmField;
|
|
61
|
+
"pont-consent": PontConsent;
|
|
57
62
|
"pont-container": PontContainer;
|
|
58
63
|
"pont-countdown": PontCountdown;
|
|
59
64
|
"pont-divider": PontDivider;
|
|
60
65
|
"pont-edit-identifier": PontEditIdentifier;
|
|
61
66
|
"pont-email-field": PontEmailField;
|
|
67
|
+
"pont-external-link": PontExternalLink;
|
|
62
68
|
"pont-form": PontForm;
|
|
63
69
|
"pont-gap": PontGap;
|
|
64
70
|
"pont-header": PontHeader;
|
|
@@ -83,6 +89,7 @@ declare global {
|
|
|
83
89
|
"pont-provider-field": PontProviderField;
|
|
84
90
|
"pont-qr-code": PontQrCode;
|
|
85
91
|
"pont-recovery-codes": PontRecoveryCodes;
|
|
92
|
+
"pont-scope-list": PontScopeList;
|
|
86
93
|
"pont-secret": PontSecret;
|
|
87
94
|
"pont-signed-in": SignedIn;
|
|
88
95
|
"pont-signed-out": SignedOut;
|
|
@@ -90,6 +97,7 @@ declare global {
|
|
|
90
97
|
"pont-signup": PontSignUp;
|
|
91
98
|
"pont-submit-button": PontSubmitButton;
|
|
92
99
|
"pont-subtitle": PontSubtitle;
|
|
100
|
+
"pont-title": PontTitle;
|
|
93
101
|
"pont-user-snippet": PontUserSnippet;
|
|
94
102
|
"pont-username-field": PontUsernameField;
|
|
95
103
|
"pont-watermark": PontWatermark;
|