@globalpayments-private/gpds-pattern-web 0.0.0-stage → 0.1.0-pr.7.gdcb74cd
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/README.md +567 -2
- package/dist/cjs/control-strategy-DhhYTbse.js +113 -0
- package/dist/cjs/gpds-pattern-web.cjs.js +24 -0
- package/dist/cjs/index-Dzm6P89U.js +1565 -0
- package/dist/cjs/index.cjs.js +180 -0
- package/dist/cjs/loader.cjs.js +12 -0
- package/dist/cjs/uds-pattern-login-card_2.cjs.entry.js +1662 -0
- package/dist/collection/collection-manifest.json +14 -0
- package/dist/collection/components/uds-pattern-login-card/slimmers/identity-memory.slimmer.js +63 -0
- package/dist/collection/components/uds-pattern-login-card/slimmers/login-workflow.slimmer.js +357 -0
- package/dist/collection/components/uds-pattern-login-card/slimmers/renderers/login-card-renderer.js +100 -0
- package/dist/collection/components/uds-pattern-login-card/slimmers/renderers/login-field-renderer.js +129 -0
- package/dist/collection/components/uds-pattern-login-card/slimmers/renderers/login-step-renderer.js +192 -0
- package/dist/collection/components/uds-pattern-login-card/slimmers/resend-throttle.slimmer.js +65 -0
- package/dist/collection/components/uds-pattern-login-card/uds-pattern-login-card.css +154 -0
- package/dist/collection/components/uds-pattern-login-card/uds-pattern-login-card.js +508 -0
- package/dist/collection/components/uds-pattern-login-card/validation/login-validation-rules.js +86 -0
- package/dist/collection/components/uds-pattern-login-card/view-model/login-card-handlers.js +1 -0
- package/dist/collection/components/uds-pattern-login-card/view-model/login-step.view-model.js +138 -0
- package/dist/collection/components/uds-pattern-login-page/uds-pattern-login-page.css +37 -0
- package/dist/collection/components/uds-pattern-login-page/uds-pattern-login-page.js +97 -0
- package/dist/collection/index.js +5 -0
- package/dist/collection/providers/auth-provider.js +28 -0
- package/dist/collection/providers/control-strategy.js +21 -0
- package/dist/collection/providers/login-config.js +4 -0
- package/dist/collection/providers/memory-auth-provider.js +133 -0
- package/dist/collection/providers/parse-auth-result.js +135 -0
- package/dist/collection/slimmer/common/log.js +14 -0
- package/dist/collection/slimmer/common/symbols.js +10 -0
- package/dist/collection/slimmer/common/types.js +2 -0
- package/dist/collection/slimmer/decorators/inject-slimmer.js +73 -0
- package/dist/collection/slimmer/decorators/map-to-component-field.js +41 -0
- package/dist/collection/slimmer/decorators/map-to-component-method.js +33 -0
- package/dist/collection/slimmer/decorators/slimmer.js +10 -0
- package/dist/collection/slimmer/index.js +5 -0
- package/dist/collection/utils/labels.js +81 -0
- package/dist/collection/utils/types.js +1 -0
- package/dist/components/index.d.ts +35 -0
- package/dist/components/index.js +1 -0
- package/dist/components/p-DOrg55po.js +1 -0
- package/dist/components/p-_G8A9gg0.js +1 -0
- package/dist/components/uds-pattern-login-card.d.ts +11 -0
- package/dist/components/uds-pattern-login-card.js +1 -0
- package/dist/components/uds-pattern-login-page.d.ts +11 -0
- package/dist/components/uds-pattern-login-page.js +1 -0
- package/dist/docs.d.ts +480 -0
- package/dist/docs.json +549 -0
- package/dist/esm/control-strategy-DOrg55po.js +105 -0
- package/dist/esm/gpds-pattern-web.js +20 -0
- package/dist/esm/index-DsXlLyGj.js +1537 -0
- package/dist/esm/index.js +170 -0
- package/dist/esm/loader.js +10 -0
- package/dist/esm/uds-pattern-login-card_2.entry.js +1659 -0
- package/dist/gpds-pattern-web/gpds-pattern-web.css +1 -0
- package/dist/gpds-pattern-web/gpds-pattern-web.esm.js +1 -0
- package/dist/gpds-pattern-web/index.esm.js +1 -0
- package/dist/gpds-pattern-web/p-2c97d2da.entry.js +1 -0
- package/dist/gpds-pattern-web/p-DOrg55po.js +1 -0
- package/dist/gpds-pattern-web/p-DsXlLyGj.js +3 -0
- package/dist/index.cjs.js +1 -0
- package/dist/index.js +1 -0
- package/dist/types/components/uds-pattern-login-card/slimmers/identity-memory.slimmer.d.ts +21 -0
- package/dist/types/components/uds-pattern-login-card/slimmers/login-workflow.slimmer.d.ts +100 -0
- package/dist/types/components/uds-pattern-login-card/slimmers/renderers/login-card-renderer.d.ts +44 -0
- package/dist/types/components/uds-pattern-login-card/slimmers/renderers/login-field-renderer.d.ts +91 -0
- package/dist/types/components/uds-pattern-login-card/slimmers/renderers/login-step-renderer.d.ts +40 -0
- package/dist/types/components/uds-pattern-login-card/slimmers/resend-throttle.slimmer.d.ts +21 -0
- package/dist/types/components/uds-pattern-login-card/uds-pattern-login-card.d.ts +134 -0
- package/dist/types/components/uds-pattern-login-card/validation/login-validation-rules.d.ts +72 -0
- package/dist/types/components/uds-pattern-login-card/view-model/login-card-handlers.d.ts +21 -0
- package/dist/types/components/uds-pattern-login-card/view-model/login-step.view-model.d.ts +96 -0
- package/dist/types/components/uds-pattern-login-page/uds-pattern-login-page.d.ts +21 -0
- package/dist/types/components.d.ts +327 -0
- package/dist/types/index.d.ts +10 -0
- package/dist/types/providers/auth-provider.d.ts +168 -0
- package/dist/types/providers/control-strategy.d.ts +144 -0
- package/dist/types/providers/login-config.d.ts +52 -0
- package/dist/types/providers/memory-auth-provider.d.ts +37 -0
- package/dist/types/providers/parse-auth-result.d.ts +8 -0
- package/dist/types/slimmer/common/log.d.ts +8 -0
- package/dist/types/slimmer/common/symbols.d.ts +10 -0
- package/dist/types/slimmer/common/types.d.ts +30 -0
- package/dist/types/slimmer/decorators/inject-slimmer.d.ts +24 -0
- package/dist/types/slimmer/decorators/map-to-component-field.d.ts +16 -0
- package/dist/types/slimmer/decorators/map-to-component-method.d.ts +11 -0
- package/dist/types/slimmer/decorators/slimmer.d.ts +10 -0
- package/dist/types/slimmer/index.d.ts +6 -0
- package/dist/types/stencil-public-runtime.d.ts +1879 -0
- package/dist/types/utils/labels.d.ts +13 -0
- package/dist/types/utils/types.d.ts +106 -0
- package/dist/types/vega.d.ts +11 -0
- package/loader/cdn.js +1 -0
- package/loader/index.cjs.js +1 -0
- package/loader/index.d.ts +24 -0
- package/loader/index.es2017.js +1 -0
- package/loader/index.js +2 -0
- package/package.json +82 -4
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { FormFieldValidationRule, FormFieldStatusMeta } from '@globalpayments/vega/dist/types/helpers/validator/rules/form-field-validation-rule';
|
|
2
|
+
import { EvaluateResult } from '@globalpayments/vega/dist/types/helpers/validator/rules/validation-rule';
|
|
3
|
+
/**
|
|
4
|
+
* The pattern's own `vega-form` validation rules.
|
|
5
|
+
*
|
|
6
|
+
* ## Why rules rather than a pre-submit check
|
|
7
|
+
*
|
|
8
|
+
* `vega-form` already gates submission: its submit handler awaits `valid()` and
|
|
9
|
+
* only emits `vegaFormSubmit` when every field passes. Anything the pattern
|
|
10
|
+
* checks *outside* that gate is a second, competing validation pass — it fires
|
|
11
|
+
* at a different moment, reports through a different surface (a card-level
|
|
12
|
+
* banner rather than the field at fault), and has to be kept in step by hand.
|
|
13
|
+
*
|
|
14
|
+
* Expressing the same checks as rules puts them inside the one flow. The field
|
|
15
|
+
* that is wrong is the field that says so, the error clears as the user fixes
|
|
16
|
+
* it, and the submit gate needs no pattern-specific code at all.
|
|
17
|
+
*
|
|
18
|
+
* ## Why these two, and nothing else
|
|
19
|
+
*
|
|
20
|
+
* Everything Vega already derives from a prop — `required`, `type="email"`,
|
|
21
|
+
* `minLength` — is left to Vega, including its wording. Restating "this field
|
|
22
|
+
* is required" here would fork copy that the design system maintains for every
|
|
23
|
+
* Global Payments product. Only checks Vega cannot express from a prop alone
|
|
24
|
+
* live here: one that needs a sibling field's value, and one that needs the
|
|
25
|
+
* configured code length.
|
|
26
|
+
*
|
|
27
|
+
* ## Why they read through callbacks
|
|
28
|
+
*
|
|
29
|
+
* A rule is handed to `vega-input` as a prop and re-read when its identity
|
|
30
|
+
* changes, so rebuilding the array on each render would churn Vega's watchers
|
|
31
|
+
* every time any unrelated state moved. These are built once and resolve their
|
|
32
|
+
* inputs — the value to compare against, the message to show — when they are
|
|
33
|
+
* evaluated, so a single stable instance always sees current state.
|
|
34
|
+
*/
|
|
35
|
+
/** Evaluated only once the field has a value; emptiness is `required`'s job. */
|
|
36
|
+
declare abstract class NonEmptyStringRule implements FormFieldValidationRule<string> {
|
|
37
|
+
canEvaluate(input: unknown, status?: FormFieldStatusMeta): boolean;
|
|
38
|
+
/**
|
|
39
|
+
* Mirrors Vega's built-in rules: say nothing until the user has engaged with
|
|
40
|
+
* the field, so a freshly rendered step is not pre-littered with errors.
|
|
41
|
+
*/
|
|
42
|
+
shouldShowError(status?: FormFieldStatusMeta): boolean;
|
|
43
|
+
abstract evaluate(input: string): EvaluateResult;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Requires a field to equal another field's current value.
|
|
47
|
+
*
|
|
48
|
+
* Used for the "confirm new password" pairing, which no single-field rule can
|
|
49
|
+
* express: the answer depends on a sibling that may change after this field was
|
|
50
|
+
* last touched.
|
|
51
|
+
*/
|
|
52
|
+
export declare class MatchesFieldRule extends NonEmptyStringRule {
|
|
53
|
+
private readonly expected;
|
|
54
|
+
private readonly message;
|
|
55
|
+
constructor(expected: () => string, message: () => string);
|
|
56
|
+
evaluate(input: string): EvaluateResult;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Requires every character of a passcode to be present.
|
|
60
|
+
*
|
|
61
|
+
* `required` alone is not enough here. It only asks whether the value is
|
|
62
|
+
* non-empty, so a half-typed code — three boxes of six — satisfies it and
|
|
63
|
+
* reaches the provider, which then has to answer a question the pattern could
|
|
64
|
+
* have answered without a round trip.
|
|
65
|
+
*/
|
|
66
|
+
export declare class CompleteCodeRule extends NonEmptyStringRule {
|
|
67
|
+
private readonly length;
|
|
68
|
+
private readonly message;
|
|
69
|
+
constructor(length: () => number, message: (length: number) => string);
|
|
70
|
+
evaluate(input: string): EvaluateResult;
|
|
71
|
+
}
|
|
72
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { UdsLoginAction, UdsLoginStep } from '../../../utils/types';
|
|
2
|
+
/**
|
|
3
|
+
* The behaviour a renderer may invoke, kept deliberately apart from
|
|
4
|
+
* `LoginStepViewModel`.
|
|
5
|
+
*
|
|
6
|
+
* Renderers receive data (the view model) and intents (this object). Neither
|
|
7
|
+
* knows how the intent is serviced — that is the workflow slimmer's business —
|
|
8
|
+
* which is what keeps the rendering layer free of workflow decisions.
|
|
9
|
+
*/
|
|
10
|
+
export interface LoginCardHandlers {
|
|
11
|
+
/** The form was submitted on the current step. */
|
|
12
|
+
onSubmit(event: Event): void;
|
|
13
|
+
/** An in-workflow link was followed. */
|
|
14
|
+
onNavigate(step: UdsLoginStep): (event: Event) => void;
|
|
15
|
+
/** An intent the pattern cannot resolve itself (the help links). */
|
|
16
|
+
onAction(action: UdsLoginAction): (event: Event) => void;
|
|
17
|
+
/** The resend-code affordance was used. */
|
|
18
|
+
onResend(event: Event): void;
|
|
19
|
+
/** A collected field changed. */
|
|
20
|
+
onValueChange(name: string, value: string | boolean): void;
|
|
21
|
+
}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { UdsMfaMethod } from '../../../providers/auth-provider';
|
|
2
|
+
import { UdsLoginLabels, UdsLoginStep } from '../../../utils/types';
|
|
3
|
+
/**
|
|
4
|
+
* The data a renderer needs to draw one step of the login workflow.
|
|
5
|
+
*
|
|
6
|
+
* ## Why this is a class with a factory, and not an inline object
|
|
7
|
+
*
|
|
8
|
+
* Deriving "what the user should see" from "what the workflow currently holds"
|
|
9
|
+
* is real logic: which affordances are available, what the heading says, which
|
|
10
|
+
* description variant applies, whether a countdown is running. Assembled inline
|
|
11
|
+
* inside `render()` that derivation is untestable and re-read on every change;
|
|
12
|
+
* named here it has one home, one test surface and one place to review.
|
|
13
|
+
*
|
|
14
|
+
* ## Why it carries no callbacks
|
|
15
|
+
*
|
|
16
|
+
* A view model is *data*. Handlers are supplied alongside it
|
|
17
|
+
* (`LoginCardHandlers`) rather than folded in, because a model that carries
|
|
18
|
+
* behaviour cannot be compared, snapshotted or reasoned about independently of
|
|
19
|
+
* the component that produced it. Keeping the two apart is what lets the
|
|
20
|
+
* renderers be checked as pure functions of their inputs.
|
|
21
|
+
*
|
|
22
|
+
* ## Pattern-library standard
|
|
23
|
+
*
|
|
24
|
+
* Every pattern component should follow this shape:
|
|
25
|
+
*
|
|
26
|
+
* - `view-model/<pattern>.view-model.ts` exporting a plain data class;
|
|
27
|
+
* - construction through a single `static from(state)` factory;
|
|
28
|
+
* - no inheritance, and no logic beyond derivation from the state passed in;
|
|
29
|
+
* - consumed by renderer slimmers, never mutated by them.
|
|
30
|
+
*
|
|
31
|
+
* Note this is a *view model*, not a DTO: it never crosses a process or
|
|
32
|
+
* serialisation boundary, only the boundary between the stateful layer
|
|
33
|
+
* (slimmers) and the rendering layer. DTO semantics — validation, wire format —
|
|
34
|
+
* belong at the provider seam, where data genuinely enters from outside.
|
|
35
|
+
*/
|
|
36
|
+
export declare class LoginStepViewModel {
|
|
37
|
+
/** The step being rendered. */
|
|
38
|
+
readonly step: UdsLoginStep;
|
|
39
|
+
/** Resolved copy, after merging any consumer overrides. */
|
|
40
|
+
readonly copy: UdsLoginLabels;
|
|
41
|
+
/** Heading for this step. */
|
|
42
|
+
readonly heading: string;
|
|
43
|
+
/** Supporting description, when this step has one. */
|
|
44
|
+
readonly description: string | undefined;
|
|
45
|
+
/** Error copy to surface, already mapped to approved wording. */
|
|
46
|
+
readonly errorText: string | undefined;
|
|
47
|
+
/** Whether a provider call is in flight. */
|
|
48
|
+
readonly busy: boolean;
|
|
49
|
+
/** Which affordances the provider can service. */
|
|
50
|
+
readonly can: StepCapabilities;
|
|
51
|
+
/** MFA methods offered by the provider. */
|
|
52
|
+
readonly methods: UdsMfaMethod[];
|
|
53
|
+
/** Values collected on the current step. */
|
|
54
|
+
readonly values: Readonly<Record<string, string | boolean>>;
|
|
55
|
+
/** How many characters the passcode entry expects. */
|
|
56
|
+
readonly otpLength: number;
|
|
57
|
+
/** Seconds left on the resend throttle; zero when resending is allowed. */
|
|
58
|
+
readonly resendSeconds: number;
|
|
59
|
+
private constructor();
|
|
60
|
+
static from(state: LoginViewState): LoginStepViewModel;
|
|
61
|
+
/** Steps that render no form: terminal outcomes and confirmations. */
|
|
62
|
+
get isTerminal(): boolean;
|
|
63
|
+
/** Whether a resend is currently throttled. */
|
|
64
|
+
get isResendThrottled(): boolean;
|
|
65
|
+
/** Copy for the throttle countdown, with the remaining seconds applied. */
|
|
66
|
+
get resendCountdownText(): string;
|
|
67
|
+
/** The current value of a collected field, as a string. */
|
|
68
|
+
valueOf(name: string): string;
|
|
69
|
+
/** Whether a boolean field is set. */
|
|
70
|
+
isChecked(name: string): boolean;
|
|
71
|
+
}
|
|
72
|
+
/** Which affordances are available, derived from the provider's capabilities. */
|
|
73
|
+
export interface StepCapabilities {
|
|
74
|
+
signUp: boolean;
|
|
75
|
+
reset: boolean;
|
|
76
|
+
username: boolean;
|
|
77
|
+
resend: boolean;
|
|
78
|
+
}
|
|
79
|
+
/** The component state a view model is derived from. */
|
|
80
|
+
export interface LoginViewState {
|
|
81
|
+
step: UdsLoginStep;
|
|
82
|
+
copy: UdsLoginLabels;
|
|
83
|
+
errorText?: string;
|
|
84
|
+
busy: boolean;
|
|
85
|
+
can: StepCapabilities;
|
|
86
|
+
methods: UdsMfaMethod[];
|
|
87
|
+
values: Record<string, string | boolean>;
|
|
88
|
+
otpLength: number;
|
|
89
|
+
resendSeconds: number;
|
|
90
|
+
/** Label of the MFA method a code was sent to, when one was chosen. */
|
|
91
|
+
otpMethodLabel?: string;
|
|
92
|
+
/** Masked destination a reset link or reminder was sent to. */
|
|
93
|
+
destination?: string;
|
|
94
|
+
/** Minutes until a locked account unlocks, when the provider said. */
|
|
95
|
+
unlockMinutes?: number;
|
|
96
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Full-page layout shell for authentication screens: branded masthead, a
|
|
3
|
+
* centred content column sized for `uds-pattern-login-card`, and an optional legal
|
|
4
|
+
* footer.
|
|
5
|
+
*
|
|
6
|
+
* It exists so consuming portals do not re-implement the same centred,
|
|
7
|
+
* responsive, brandable login layout for every product.
|
|
8
|
+
*
|
|
9
|
+
* @slot brand - Replaces the default masthead logo (e.g. a partner lockup).
|
|
10
|
+
* @slot - The authentication card, typically a `uds-pattern-login-card`.
|
|
11
|
+
* @slot footer - Legal / utility links rendered beneath the content column.
|
|
12
|
+
*/
|
|
13
|
+
export declare class UdsPatternLoginPage {
|
|
14
|
+
/** URL of the masthead logo. Ignored when the `brand` slot is used. */
|
|
15
|
+
logoSrc?: string;
|
|
16
|
+
/** Accessible name for the masthead logo. */
|
|
17
|
+
logoAlt: string;
|
|
18
|
+
/** Destination for the masthead logo link. When unset the logo is not a link. */
|
|
19
|
+
logoHref?: string;
|
|
20
|
+
render(): any;
|
|
21
|
+
}
|
|
@@ -0,0 +1,327 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
/* tslint:disable */
|
|
3
|
+
/**
|
|
4
|
+
* This is an autogenerated file created by the Stencil compiler.
|
|
5
|
+
* It contains typing information for all components that exist in this project.
|
|
6
|
+
*/
|
|
7
|
+
import { HTMLStencilElement, JSXBase } from "./stencil-public-runtime";
|
|
8
|
+
import { UdsLoginConfig } from "./providers/login-config";
|
|
9
|
+
import { UdsLoginActionDetail, UdsLoginErrorDetail, UdsLoginStep, UdsLoginStepChangeDetail } from "./utils/types";
|
|
10
|
+
import { UdsSession } from "./providers/auth-provider";
|
|
11
|
+
export { UdsLoginConfig } from "./providers/login-config";
|
|
12
|
+
export { UdsLoginActionDetail, UdsLoginErrorDetail, UdsLoginStep, UdsLoginStepChangeDetail } from "./utils/types";
|
|
13
|
+
export { UdsSession } from "./providers/auth-provider";
|
|
14
|
+
export namespace Components {
|
|
15
|
+
/**
|
|
16
|
+
* The GP login workflow, as a single pattern.
|
|
17
|
+
* Unlike a design-system component, this pattern **owns the workflow**: step
|
|
18
|
+
* sequencing, in-flight state, failure copy, resend throttling, lockout
|
|
19
|
+
* messaging, back-navigation, focus movement and identifier persistence all
|
|
20
|
+
* live inside the card. A consuming product does not implement any of it.
|
|
21
|
+
* Two aggregate seams are all a consumer wires:
|
|
22
|
+
* - **`auth`** — a `UdsAuthProvider` adapter saying *what the identity platform
|
|
23
|
+
* needs next*. The pattern decides what that looks like.
|
|
24
|
+
* - **`controlStrategy`** — an optional `UdsLoginControlStrategy` that intercepts
|
|
25
|
+
* every checkpoint in the workflow, for the cases where the course of the flow
|
|
26
|
+
* itself needs to change.
|
|
27
|
+
* ```ts
|
|
28
|
+
* card.auth = createAuthProvider({
|
|
29
|
+
* signIn: ({ identifier, password }) => oktaSdk.authn(identifier, password),
|
|
30
|
+
* verifyOtp: ({ code }) => oktaSdk.verifyFactor(code),
|
|
31
|
+
* });
|
|
32
|
+
* ```
|
|
33
|
+
* Which optional methods the adapter implements is also the configuration:
|
|
34
|
+
* implement `signUp` and the sign-up route appears; omit `requestPasswordReset`
|
|
35
|
+
* and no recovery link is rendered.
|
|
36
|
+
* This class deliberately holds only props, events, state and the render shell.
|
|
37
|
+
* Behaviour lives in slimmers (`./slimmers`), markup in renderer slimmers
|
|
38
|
+
* (`./slimmers/renderers`) and derivation in `./view-model` — see
|
|
39
|
+
* `src/slimmer/README.md`.
|
|
40
|
+
*/
|
|
41
|
+
interface UdsPatternLoginCard {
|
|
42
|
+
/**
|
|
43
|
+
* Everything that cannot be expressed as an attribute: the `auth` adapter, the `control` strategy and any `labels` overrides. The split is mechanical rather than a matter of taste — see `UdsLoginConfig`. Scalars below are attributes because they can be; objects and functions are gathered here because they cannot be. Also accepts a JSON string, so the `labels` member alone can be set from plain HTML markup.
|
|
44
|
+
* @default {}
|
|
45
|
+
*/
|
|
46
|
+
"config": UdsLoginConfig | string;
|
|
47
|
+
/**
|
|
48
|
+
* Pre-populates the identifier field, overriding any remembered value.
|
|
49
|
+
* @default ''
|
|
50
|
+
*/
|
|
51
|
+
"identifier": string;
|
|
52
|
+
/**
|
|
53
|
+
* The step the workflow starts on.
|
|
54
|
+
* @default 'identifier'
|
|
55
|
+
*/
|
|
56
|
+
"initialStep": UdsLoginStep;
|
|
57
|
+
/**
|
|
58
|
+
* Default number of digit inputs, when the provider does not specify one.
|
|
59
|
+
* @default 6
|
|
60
|
+
*/
|
|
61
|
+
"otpLength": number;
|
|
62
|
+
/**
|
|
63
|
+
* Where the "Remember my email" value is persisted. Set to an empty string to disable persistence entirely.
|
|
64
|
+
* @default 'uds-pattern-login.identifier'
|
|
65
|
+
*/
|
|
66
|
+
"rememberStorageKey": string;
|
|
67
|
+
/**
|
|
68
|
+
* Returns the workflow to its first step and clears all collected input. Useful after a sign-out, or to recover from a terminal step.
|
|
69
|
+
*/
|
|
70
|
+
"reset": () => Promise<void>;
|
|
71
|
+
/**
|
|
72
|
+
* Renders the "Need help signing in?" footer.
|
|
73
|
+
* @default true
|
|
74
|
+
*/
|
|
75
|
+
"showHelpFooter": boolean;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Full-page layout shell for authentication screens: branded masthead, a
|
|
79
|
+
* centred content column sized for `uds-pattern-login-card`, and an optional legal
|
|
80
|
+
* footer.
|
|
81
|
+
* It exists so consuming portals do not re-implement the same centred,
|
|
82
|
+
* responsive, brandable login layout for every product.
|
|
83
|
+
*/
|
|
84
|
+
interface UdsPatternLoginPage {
|
|
85
|
+
/**
|
|
86
|
+
* Accessible name for the masthead logo.
|
|
87
|
+
* @default ''
|
|
88
|
+
*/
|
|
89
|
+
"logoAlt": string;
|
|
90
|
+
/**
|
|
91
|
+
* Destination for the masthead logo link. When unset the logo is not a link.
|
|
92
|
+
*/
|
|
93
|
+
"logoHref"?: string;
|
|
94
|
+
/**
|
|
95
|
+
* URL of the masthead logo. Ignored when the `brand` slot is used.
|
|
96
|
+
*/
|
|
97
|
+
"logoSrc"?: string;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
export interface UdsPatternLoginCardCustomEvent<T> extends CustomEvent<T> {
|
|
101
|
+
detail: T;
|
|
102
|
+
target: HTMLUdsPatternLoginCardElement;
|
|
103
|
+
}
|
|
104
|
+
declare global {
|
|
105
|
+
interface HTMLUdsPatternLoginCardElementEventMap {
|
|
106
|
+
"udsLoginSuccess": { session?: UdsSession };
|
|
107
|
+
"udsLoginStepChange": UdsLoginStepChangeDetail;
|
|
108
|
+
"udsLoginError": UdsLoginErrorDetail;
|
|
109
|
+
"udsLoginAction": UdsLoginActionDetail;
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* The GP login workflow, as a single pattern.
|
|
113
|
+
* Unlike a design-system component, this pattern **owns the workflow**: step
|
|
114
|
+
* sequencing, in-flight state, failure copy, resend throttling, lockout
|
|
115
|
+
* messaging, back-navigation, focus movement and identifier persistence all
|
|
116
|
+
* live inside the card. A consuming product does not implement any of it.
|
|
117
|
+
* Two aggregate seams are all a consumer wires:
|
|
118
|
+
* - **`auth`** — a `UdsAuthProvider` adapter saying *what the identity platform
|
|
119
|
+
* needs next*. The pattern decides what that looks like.
|
|
120
|
+
* - **`controlStrategy`** — an optional `UdsLoginControlStrategy` that intercepts
|
|
121
|
+
* every checkpoint in the workflow, for the cases where the course of the flow
|
|
122
|
+
* itself needs to change.
|
|
123
|
+
* ```ts
|
|
124
|
+
* card.auth = createAuthProvider({
|
|
125
|
+
* signIn: ({ identifier, password }) => oktaSdk.authn(identifier, password),
|
|
126
|
+
* verifyOtp: ({ code }) => oktaSdk.verifyFactor(code),
|
|
127
|
+
* });
|
|
128
|
+
* ```
|
|
129
|
+
* Which optional methods the adapter implements is also the configuration:
|
|
130
|
+
* implement `signUp` and the sign-up route appears; omit `requestPasswordReset`
|
|
131
|
+
* and no recovery link is rendered.
|
|
132
|
+
* This class deliberately holds only props, events, state and the render shell.
|
|
133
|
+
* Behaviour lives in slimmers (`./slimmers`), markup in renderer slimmers
|
|
134
|
+
* (`./slimmers/renderers`) and derivation in `./view-model` — see
|
|
135
|
+
* `src/slimmer/README.md`.
|
|
136
|
+
*/
|
|
137
|
+
interface HTMLUdsPatternLoginCardElement extends Components.UdsPatternLoginCard, HTMLStencilElement {
|
|
138
|
+
addEventListener<K extends keyof HTMLUdsPatternLoginCardElementEventMap>(type: K, listener: (this: HTMLUdsPatternLoginCardElement, ev: UdsPatternLoginCardCustomEvent<HTMLUdsPatternLoginCardElementEventMap[K]>) => any, options?: boolean | AddEventListenerOptions): void;
|
|
139
|
+
addEventListener<K extends keyof DocumentEventMap>(type: K, listener: (this: Document, ev: DocumentEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
|
|
140
|
+
addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
|
|
141
|
+
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
|
|
142
|
+
removeEventListener<K extends keyof HTMLUdsPatternLoginCardElementEventMap>(type: K, listener: (this: HTMLUdsPatternLoginCardElement, ev: UdsPatternLoginCardCustomEvent<HTMLUdsPatternLoginCardElementEventMap[K]>) => any, options?: boolean | EventListenerOptions): void;
|
|
143
|
+
removeEventListener<K extends keyof DocumentEventMap>(type: K, listener: (this: Document, ev: DocumentEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
|
|
144
|
+
removeEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
|
|
145
|
+
removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
|
|
146
|
+
}
|
|
147
|
+
var HTMLUdsPatternLoginCardElement: {
|
|
148
|
+
prototype: HTMLUdsPatternLoginCardElement;
|
|
149
|
+
new (): HTMLUdsPatternLoginCardElement;
|
|
150
|
+
};
|
|
151
|
+
/**
|
|
152
|
+
* Full-page layout shell for authentication screens: branded masthead, a
|
|
153
|
+
* centred content column sized for `uds-pattern-login-card`, and an optional legal
|
|
154
|
+
* footer.
|
|
155
|
+
* It exists so consuming portals do not re-implement the same centred,
|
|
156
|
+
* responsive, brandable login layout for every product.
|
|
157
|
+
*/
|
|
158
|
+
interface HTMLUdsPatternLoginPageElement extends Components.UdsPatternLoginPage, HTMLStencilElement {
|
|
159
|
+
}
|
|
160
|
+
var HTMLUdsPatternLoginPageElement: {
|
|
161
|
+
prototype: HTMLUdsPatternLoginPageElement;
|
|
162
|
+
new (): HTMLUdsPatternLoginPageElement;
|
|
163
|
+
};
|
|
164
|
+
interface HTMLElementTagNameMap {
|
|
165
|
+
"uds-pattern-login-card": HTMLUdsPatternLoginCardElement;
|
|
166
|
+
"uds-pattern-login-page": HTMLUdsPatternLoginPageElement;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
declare namespace LocalJSX {
|
|
170
|
+
/**
|
|
171
|
+
* The GP login workflow, as a single pattern.
|
|
172
|
+
* Unlike a design-system component, this pattern **owns the workflow**: step
|
|
173
|
+
* sequencing, in-flight state, failure copy, resend throttling, lockout
|
|
174
|
+
* messaging, back-navigation, focus movement and identifier persistence all
|
|
175
|
+
* live inside the card. A consuming product does not implement any of it.
|
|
176
|
+
* Two aggregate seams are all a consumer wires:
|
|
177
|
+
* - **`auth`** — a `UdsAuthProvider` adapter saying *what the identity platform
|
|
178
|
+
* needs next*. The pattern decides what that looks like.
|
|
179
|
+
* - **`controlStrategy`** — an optional `UdsLoginControlStrategy` that intercepts
|
|
180
|
+
* every checkpoint in the workflow, for the cases where the course of the flow
|
|
181
|
+
* itself needs to change.
|
|
182
|
+
* ```ts
|
|
183
|
+
* card.auth = createAuthProvider({
|
|
184
|
+
* signIn: ({ identifier, password }) => oktaSdk.authn(identifier, password),
|
|
185
|
+
* verifyOtp: ({ code }) => oktaSdk.verifyFactor(code),
|
|
186
|
+
* });
|
|
187
|
+
* ```
|
|
188
|
+
* Which optional methods the adapter implements is also the configuration:
|
|
189
|
+
* implement `signUp` and the sign-up route appears; omit `requestPasswordReset`
|
|
190
|
+
* and no recovery link is rendered.
|
|
191
|
+
* This class deliberately holds only props, events, state and the render shell.
|
|
192
|
+
* Behaviour lives in slimmers (`./slimmers`), markup in renderer slimmers
|
|
193
|
+
* (`./slimmers/renderers`) and derivation in `./view-model` — see
|
|
194
|
+
* `src/slimmer/README.md`.
|
|
195
|
+
*/
|
|
196
|
+
interface UdsPatternLoginCard {
|
|
197
|
+
/**
|
|
198
|
+
* Everything that cannot be expressed as an attribute: the `auth` adapter, the `control` strategy and any `labels` overrides. The split is mechanical rather than a matter of taste — see `UdsLoginConfig`. Scalars below are attributes because they can be; objects and functions are gathered here because they cannot be. Also accepts a JSON string, so the `labels` member alone can be set from plain HTML markup.
|
|
199
|
+
* @default {}
|
|
200
|
+
*/
|
|
201
|
+
"config"?: UdsLoginConfig | string;
|
|
202
|
+
/**
|
|
203
|
+
* Pre-populates the identifier field, overriding any remembered value.
|
|
204
|
+
* @default ''
|
|
205
|
+
*/
|
|
206
|
+
"identifier"?: string;
|
|
207
|
+
/**
|
|
208
|
+
* The step the workflow starts on.
|
|
209
|
+
* @default 'identifier'
|
|
210
|
+
*/
|
|
211
|
+
"initialStep"?: UdsLoginStep;
|
|
212
|
+
/**
|
|
213
|
+
* Emitted for the two intents the pattern cannot resolve — the help links. In-workflow navigation is handled internally and is not reported here.
|
|
214
|
+
*/
|
|
215
|
+
"onUdsLoginAction"?: (event: UdsPatternLoginCardCustomEvent<UdsLoginActionDetail>) => void;
|
|
216
|
+
/**
|
|
217
|
+
* Emitted when the provider reports a failure, after the card has displayed it.
|
|
218
|
+
*/
|
|
219
|
+
"onUdsLoginError"?: (event: UdsPatternLoginCardCustomEvent<UdsLoginErrorDetail>) => void;
|
|
220
|
+
/**
|
|
221
|
+
* Emitted whenever the workflow moves to a different step.
|
|
222
|
+
*/
|
|
223
|
+
"onUdsLoginStepChange"?: (event: UdsPatternLoginCardCustomEvent<UdsLoginStepChangeDetail>) => void;
|
|
224
|
+
/**
|
|
225
|
+
* Emitted once the provider reports successful authentication.
|
|
226
|
+
*/
|
|
227
|
+
"onUdsLoginSuccess"?: (event: UdsPatternLoginCardCustomEvent<{ session?: UdsSession }>) => void;
|
|
228
|
+
/**
|
|
229
|
+
* Default number of digit inputs, when the provider does not specify one.
|
|
230
|
+
* @default 6
|
|
231
|
+
*/
|
|
232
|
+
"otpLength"?: number;
|
|
233
|
+
/**
|
|
234
|
+
* Where the "Remember my email" value is persisted. Set to an empty string to disable persistence entirely.
|
|
235
|
+
* @default 'uds-pattern-login.identifier'
|
|
236
|
+
*/
|
|
237
|
+
"rememberStorageKey"?: string;
|
|
238
|
+
/**
|
|
239
|
+
* Renders the "Need help signing in?" footer.
|
|
240
|
+
* @default true
|
|
241
|
+
*/
|
|
242
|
+
"showHelpFooter"?: boolean;
|
|
243
|
+
}
|
|
244
|
+
/**
|
|
245
|
+
* Full-page layout shell for authentication screens: branded masthead, a
|
|
246
|
+
* centred content column sized for `uds-pattern-login-card`, and an optional legal
|
|
247
|
+
* footer.
|
|
248
|
+
* It exists so consuming portals do not re-implement the same centred,
|
|
249
|
+
* responsive, brandable login layout for every product.
|
|
250
|
+
*/
|
|
251
|
+
interface UdsPatternLoginPage {
|
|
252
|
+
/**
|
|
253
|
+
* Accessible name for the masthead logo.
|
|
254
|
+
* @default ''
|
|
255
|
+
*/
|
|
256
|
+
"logoAlt"?: string;
|
|
257
|
+
/**
|
|
258
|
+
* Destination for the masthead logo link. When unset the logo is not a link.
|
|
259
|
+
*/
|
|
260
|
+
"logoHref"?: string;
|
|
261
|
+
/**
|
|
262
|
+
* URL of the masthead logo. Ignored when the `brand` slot is used.
|
|
263
|
+
*/
|
|
264
|
+
"logoSrc"?: string;
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
interface UdsPatternLoginCardAttributes {
|
|
268
|
+
"config": UdsLoginConfig | string;
|
|
269
|
+
"initialStep": UdsLoginStep;
|
|
270
|
+
"identifier": string;
|
|
271
|
+
"otpLength": number;
|
|
272
|
+
"rememberStorageKey": string;
|
|
273
|
+
"showHelpFooter": boolean;
|
|
274
|
+
}
|
|
275
|
+
interface UdsPatternLoginPageAttributes {
|
|
276
|
+
"logoSrc": string;
|
|
277
|
+
"logoAlt": string;
|
|
278
|
+
"logoHref": string;
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
interface IntrinsicElements {
|
|
282
|
+
"uds-pattern-login-card": Omit<UdsPatternLoginCard, keyof UdsPatternLoginCardAttributes> & { [K in keyof UdsPatternLoginCard & keyof UdsPatternLoginCardAttributes]?: UdsPatternLoginCard[K] } & { [K in keyof UdsPatternLoginCard & keyof UdsPatternLoginCardAttributes as `attr:${K}`]?: UdsPatternLoginCardAttributes[K] } & { [K in keyof UdsPatternLoginCard & keyof UdsPatternLoginCardAttributes as `prop:${K}`]?: UdsPatternLoginCard[K] };
|
|
283
|
+
"uds-pattern-login-page": Omit<UdsPatternLoginPage, keyof UdsPatternLoginPageAttributes> & { [K in keyof UdsPatternLoginPage & keyof UdsPatternLoginPageAttributes]?: UdsPatternLoginPage[K] } & { [K in keyof UdsPatternLoginPage & keyof UdsPatternLoginPageAttributes as `attr:${K}`]?: UdsPatternLoginPageAttributes[K] } & { [K in keyof UdsPatternLoginPage & keyof UdsPatternLoginPageAttributes as `prop:${K}`]?: UdsPatternLoginPage[K] };
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
export { LocalJSX as JSX };
|
|
287
|
+
declare module "@stencil/core" {
|
|
288
|
+
export namespace JSX {
|
|
289
|
+
interface IntrinsicElements {
|
|
290
|
+
/**
|
|
291
|
+
* The GP login workflow, as a single pattern.
|
|
292
|
+
* Unlike a design-system component, this pattern **owns the workflow**: step
|
|
293
|
+
* sequencing, in-flight state, failure copy, resend throttling, lockout
|
|
294
|
+
* messaging, back-navigation, focus movement and identifier persistence all
|
|
295
|
+
* live inside the card. A consuming product does not implement any of it.
|
|
296
|
+
* Two aggregate seams are all a consumer wires:
|
|
297
|
+
* - **`auth`** — a `UdsAuthProvider` adapter saying *what the identity platform
|
|
298
|
+
* needs next*. The pattern decides what that looks like.
|
|
299
|
+
* - **`controlStrategy`** — an optional `UdsLoginControlStrategy` that intercepts
|
|
300
|
+
* every checkpoint in the workflow, for the cases where the course of the flow
|
|
301
|
+
* itself needs to change.
|
|
302
|
+
* ```ts
|
|
303
|
+
* card.auth = createAuthProvider({
|
|
304
|
+
* signIn: ({ identifier, password }) => oktaSdk.authn(identifier, password),
|
|
305
|
+
* verifyOtp: ({ code }) => oktaSdk.verifyFactor(code),
|
|
306
|
+
* });
|
|
307
|
+
* ```
|
|
308
|
+
* Which optional methods the adapter implements is also the configuration:
|
|
309
|
+
* implement `signUp` and the sign-up route appears; omit `requestPasswordReset`
|
|
310
|
+
* and no recovery link is rendered.
|
|
311
|
+
* This class deliberately holds only props, events, state and the render shell.
|
|
312
|
+
* Behaviour lives in slimmers (`./slimmers`), markup in renderer slimmers
|
|
313
|
+
* (`./slimmers/renderers`) and derivation in `./view-model` — see
|
|
314
|
+
* `src/slimmer/README.md`.
|
|
315
|
+
*/
|
|
316
|
+
"uds-pattern-login-card": LocalJSX.IntrinsicElements["uds-pattern-login-card"] & JSXBase.HTMLAttributes<HTMLUdsPatternLoginCardElement>;
|
|
317
|
+
/**
|
|
318
|
+
* Full-page layout shell for authentication screens: branded masthead, a
|
|
319
|
+
* centred content column sized for `uds-pattern-login-card`, and an optional legal
|
|
320
|
+
* footer.
|
|
321
|
+
* It exists so consuming portals do not re-implement the same centred,
|
|
322
|
+
* responsive, brandable login layout for every product.
|
|
323
|
+
*/
|
|
324
|
+
"uds-pattern-login-page": LocalJSX.IntrinsicElements["uds-pattern-login-page"] & JSXBase.HTMLAttributes<HTMLUdsPatternLoginPageElement>;
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export { DEFAULT_LOGIN_LABELS, formatLabel } from './utils/labels';
|
|
2
|
+
export { createAuthProvider } from './providers/auth-provider';
|
|
3
|
+
export { createMemoryAuthProvider } from './providers/memory-auth-provider';
|
|
4
|
+
export { createControlStrategy, fail, goTo, stay } from './providers/control-strategy';
|
|
5
|
+
export { createLoginConfig } from './providers/login-config';
|
|
6
|
+
export type { UdsLoginConfig } from './providers/login-config';
|
|
7
|
+
export type { MemoryAuthOptions, MemoryAuthUser } from './providers/memory-auth-provider';
|
|
8
|
+
export type { UdsAuthErrorCode, UdsAuthProvider, UdsAuthResult, UdsMfaMethod, UdsSession, } from './providers/auth-provider';
|
|
9
|
+
export type { UdsInterceptor, UdsLoginCompleteContext, UdsLoginControlStrategy, UdsLoginFailureContext, UdsLoginFailureOutcome, UdsLoginNavigateContext, UdsLoginNavigationCause, UdsLoginSubmitContext, UdsLoginTransition, UdsLoginTransitionContext, UdsLoginValues, } from './providers/control-strategy';
|
|
10
|
+
export type { UdsLoginAction, UdsLoginActionDetail, UdsLoginErrorDetail, UdsLoginErrorLabels, UdsLoginLabels, UdsLoginStep, UdsLoginStepChangeDetail, } from './utils/types';
|