@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.
Files changed (97) hide show
  1. package/README.md +567 -2
  2. package/dist/cjs/control-strategy-DhhYTbse.js +113 -0
  3. package/dist/cjs/gpds-pattern-web.cjs.js +24 -0
  4. package/dist/cjs/index-Dzm6P89U.js +1565 -0
  5. package/dist/cjs/index.cjs.js +180 -0
  6. package/dist/cjs/loader.cjs.js +12 -0
  7. package/dist/cjs/uds-pattern-login-card_2.cjs.entry.js +1662 -0
  8. package/dist/collection/collection-manifest.json +14 -0
  9. package/dist/collection/components/uds-pattern-login-card/slimmers/identity-memory.slimmer.js +63 -0
  10. package/dist/collection/components/uds-pattern-login-card/slimmers/login-workflow.slimmer.js +357 -0
  11. package/dist/collection/components/uds-pattern-login-card/slimmers/renderers/login-card-renderer.js +100 -0
  12. package/dist/collection/components/uds-pattern-login-card/slimmers/renderers/login-field-renderer.js +129 -0
  13. package/dist/collection/components/uds-pattern-login-card/slimmers/renderers/login-step-renderer.js +192 -0
  14. package/dist/collection/components/uds-pattern-login-card/slimmers/resend-throttle.slimmer.js +65 -0
  15. package/dist/collection/components/uds-pattern-login-card/uds-pattern-login-card.css +154 -0
  16. package/dist/collection/components/uds-pattern-login-card/uds-pattern-login-card.js +508 -0
  17. package/dist/collection/components/uds-pattern-login-card/validation/login-validation-rules.js +86 -0
  18. package/dist/collection/components/uds-pattern-login-card/view-model/login-card-handlers.js +1 -0
  19. package/dist/collection/components/uds-pattern-login-card/view-model/login-step.view-model.js +138 -0
  20. package/dist/collection/components/uds-pattern-login-page/uds-pattern-login-page.css +37 -0
  21. package/dist/collection/components/uds-pattern-login-page/uds-pattern-login-page.js +97 -0
  22. package/dist/collection/index.js +5 -0
  23. package/dist/collection/providers/auth-provider.js +28 -0
  24. package/dist/collection/providers/control-strategy.js +21 -0
  25. package/dist/collection/providers/login-config.js +4 -0
  26. package/dist/collection/providers/memory-auth-provider.js +133 -0
  27. package/dist/collection/providers/parse-auth-result.js +135 -0
  28. package/dist/collection/slimmer/common/log.js +14 -0
  29. package/dist/collection/slimmer/common/symbols.js +10 -0
  30. package/dist/collection/slimmer/common/types.js +2 -0
  31. package/dist/collection/slimmer/decorators/inject-slimmer.js +73 -0
  32. package/dist/collection/slimmer/decorators/map-to-component-field.js +41 -0
  33. package/dist/collection/slimmer/decorators/map-to-component-method.js +33 -0
  34. package/dist/collection/slimmer/decorators/slimmer.js +10 -0
  35. package/dist/collection/slimmer/index.js +5 -0
  36. package/dist/collection/utils/labels.js +81 -0
  37. package/dist/collection/utils/types.js +1 -0
  38. package/dist/components/index.d.ts +35 -0
  39. package/dist/components/index.js +1 -0
  40. package/dist/components/p-DOrg55po.js +1 -0
  41. package/dist/components/p-_G8A9gg0.js +1 -0
  42. package/dist/components/uds-pattern-login-card.d.ts +11 -0
  43. package/dist/components/uds-pattern-login-card.js +1 -0
  44. package/dist/components/uds-pattern-login-page.d.ts +11 -0
  45. package/dist/components/uds-pattern-login-page.js +1 -0
  46. package/dist/docs.d.ts +480 -0
  47. package/dist/docs.json +549 -0
  48. package/dist/esm/control-strategy-DOrg55po.js +105 -0
  49. package/dist/esm/gpds-pattern-web.js +20 -0
  50. package/dist/esm/index-DsXlLyGj.js +1537 -0
  51. package/dist/esm/index.js +170 -0
  52. package/dist/esm/loader.js +10 -0
  53. package/dist/esm/uds-pattern-login-card_2.entry.js +1659 -0
  54. package/dist/gpds-pattern-web/gpds-pattern-web.css +1 -0
  55. package/dist/gpds-pattern-web/gpds-pattern-web.esm.js +1 -0
  56. package/dist/gpds-pattern-web/index.esm.js +1 -0
  57. package/dist/gpds-pattern-web/p-2c97d2da.entry.js +1 -0
  58. package/dist/gpds-pattern-web/p-DOrg55po.js +1 -0
  59. package/dist/gpds-pattern-web/p-DsXlLyGj.js +3 -0
  60. package/dist/index.cjs.js +1 -0
  61. package/dist/index.js +1 -0
  62. package/dist/types/components/uds-pattern-login-card/slimmers/identity-memory.slimmer.d.ts +21 -0
  63. package/dist/types/components/uds-pattern-login-card/slimmers/login-workflow.slimmer.d.ts +100 -0
  64. package/dist/types/components/uds-pattern-login-card/slimmers/renderers/login-card-renderer.d.ts +44 -0
  65. package/dist/types/components/uds-pattern-login-card/slimmers/renderers/login-field-renderer.d.ts +91 -0
  66. package/dist/types/components/uds-pattern-login-card/slimmers/renderers/login-step-renderer.d.ts +40 -0
  67. package/dist/types/components/uds-pattern-login-card/slimmers/resend-throttle.slimmer.d.ts +21 -0
  68. package/dist/types/components/uds-pattern-login-card/uds-pattern-login-card.d.ts +134 -0
  69. package/dist/types/components/uds-pattern-login-card/validation/login-validation-rules.d.ts +72 -0
  70. package/dist/types/components/uds-pattern-login-card/view-model/login-card-handlers.d.ts +21 -0
  71. package/dist/types/components/uds-pattern-login-card/view-model/login-step.view-model.d.ts +96 -0
  72. package/dist/types/components/uds-pattern-login-page/uds-pattern-login-page.d.ts +21 -0
  73. package/dist/types/components.d.ts +327 -0
  74. package/dist/types/index.d.ts +10 -0
  75. package/dist/types/providers/auth-provider.d.ts +168 -0
  76. package/dist/types/providers/control-strategy.d.ts +144 -0
  77. package/dist/types/providers/login-config.d.ts +52 -0
  78. package/dist/types/providers/memory-auth-provider.d.ts +37 -0
  79. package/dist/types/providers/parse-auth-result.d.ts +8 -0
  80. package/dist/types/slimmer/common/log.d.ts +8 -0
  81. package/dist/types/slimmer/common/symbols.d.ts +10 -0
  82. package/dist/types/slimmer/common/types.d.ts +30 -0
  83. package/dist/types/slimmer/decorators/inject-slimmer.d.ts +24 -0
  84. package/dist/types/slimmer/decorators/map-to-component-field.d.ts +16 -0
  85. package/dist/types/slimmer/decorators/map-to-component-method.d.ts +11 -0
  86. package/dist/types/slimmer/decorators/slimmer.d.ts +10 -0
  87. package/dist/types/slimmer/index.d.ts +6 -0
  88. package/dist/types/stencil-public-runtime.d.ts +1879 -0
  89. package/dist/types/utils/labels.d.ts +13 -0
  90. package/dist/types/utils/types.d.ts +106 -0
  91. package/dist/types/vega.d.ts +11 -0
  92. package/loader/cdn.js +1 -0
  93. package/loader/index.cjs.js +1 -0
  94. package/loader/index.d.ts +24 -0
  95. package/loader/index.es2017.js +1 -0
  96. package/loader/index.js +2 -0
  97. package/package.json +82 -4
@@ -0,0 +1,168 @@
1
+ /**
2
+ * Provider contracts for the GP pattern library.
3
+ *
4
+ * A pattern owns the *workflow* — which step comes next, what is in flight,
5
+ * what the user is told when something fails. It owns no SDK code and knows no
6
+ * identity platform. The seam between the two is a Provider contract: the
7
+ * consumer brings their own backend SDK (Okta, Auth0, Cognito, Ping, GCP API
8
+ * Gateway, Azure APIM, …) and writes a thin adapter against the interface
9
+ * below.
10
+ *
11
+ * See `docs/adr/0002-provider-driven-patterns.md` for why the workflow lives
12
+ * inside the pattern rather than in the host application.
13
+ */
14
+ /** Opaque session handle returned by the identity platform on success. */
15
+ export type UdsSession = unknown;
16
+ /**
17
+ * Closed set of failure reasons a pattern knows how to explain to a user.
18
+ *
19
+ * It is deliberately small and generic: the pattern maps each code to approved,
20
+ * domain-neutral copy so that every GP product fails in the same words. An
21
+ * adapter that cannot classify a failure should return `unknown`.
22
+ */
23
+ export type UdsAuthErrorCode = 'invalid_credentials' | 'invalid_identifier' | 'invalid_code' | 'code_expired' | 'account_locked' | 'account_not_found' | 'account_exists' | 'password_policy' | 'passwords_do_not_match' | 'rate_limited' | 'network' | 'unknown';
24
+ /** An MFA delivery option offered by the identity platform. */
25
+ export interface UdsMfaMethod {
26
+ /** Stable identifier passed back to `selectMfaMethod`. */
27
+ id: string;
28
+ /** Primary label, e.g. "Authenticator app". */
29
+ label: string;
30
+ /** Optional supporting copy, e.g. "Ending in ••3312". */
31
+ description?: string;
32
+ /** Renders the option as non-selectable. */
33
+ disabled?: boolean;
34
+ }
35
+ /**
36
+ * What the identity platform needs next.
37
+ *
38
+ * This is the heart of the contract: the provider reports the *state of the
39
+ * authentication attempt*, and the pattern decides what to render. Every major
40
+ * identity platform already returns a challenge/next-step object of this shape,
41
+ * so adapters stay thin.
42
+ */
43
+ export type UdsAuthResult =
44
+ /** Authentication is complete. */
45
+ {
46
+ status: 'success';
47
+ session?: UdsSession;
48
+ }
49
+ /** The identifier was accepted; a password is now required. */
50
+ | {
51
+ status: 'password_required';
52
+ }
53
+ /** The user must choose how to receive a one-time code. */
54
+ | {
55
+ status: 'mfa_required';
56
+ methods: UdsMfaMethod[];
57
+ }
58
+ /** A one-time code must be entered. */
59
+ | {
60
+ status: 'otp_required';
61
+ /** The method the code was sent to, used for the on-screen explanation. */
62
+ method?: UdsMfaMethod;
63
+ /** Number of digits to render. Defaults to the card's `otpLength`. */
64
+ codeLength?: number;
65
+ /** How long until a resend is permitted. Drives the built-in throttle. */
66
+ resendAfterMs?: number;
67
+ }
68
+ /** The credentials were valid but the password must be changed before sign-in. */
69
+ | {
70
+ status: 'password_reset_required';
71
+ }
72
+ /** A recovery link was dispatched. `destination` is shown back to the user if present. */
73
+ | {
74
+ status: 'reset_link_sent';
75
+ destination?: string;
76
+ }
77
+ /** A username reminder was dispatched. */
78
+ | {
79
+ status: 'username_sent';
80
+ destination?: string;
81
+ }
82
+ /** The account is temporarily locked. */
83
+ | {
84
+ status: 'locked';
85
+ unlockAfterMs?: number;
86
+ }
87
+ /** The attempt failed. The pattern maps `code` to approved user-facing copy. */
88
+ | {
89
+ status: 'error';
90
+ code: UdsAuthErrorCode;
91
+ message?: string;
92
+ };
93
+ /**
94
+ * The authentication seam for `uds-pattern-login-card`.
95
+ *
96
+ * Only `signIn` is required. **Every other method is a capability**: the card
97
+ * renders the affordance for a method only when the adapter implements it, so
98
+ * there is no way to surface a link that leads nowhere, and no parallel set of
99
+ * `show-*` / `enable-*` booleans to keep in sync.
100
+ *
101
+ * | Implement… | …and the card renders |
102
+ * | --- | --- |
103
+ * | `requestPasswordReset` | the "Forgot password?" route |
104
+ * | `requestUsernameReminder` | the "Forgot username?" route |
105
+ * | `signUp` | the "Create one" route |
106
+ * | `resendOtp` | the "Resend code" affordance, with throttle |
107
+ */
108
+ export interface UdsAuthProvider {
109
+ /**
110
+ * Begin authentication. Called with just the identifier for an
111
+ * identifier-first flow, or with both fields when the card collected them
112
+ * together.
113
+ */
114
+ signIn(input: {
115
+ identifier: string;
116
+ password?: string;
117
+ rememberIdentifier?: boolean;
118
+ }): Promise<UdsAuthResult>;
119
+ /**
120
+ * Verify the password of an identifier-first flow. When omitted, the card
121
+ * falls back to calling `signIn` with both fields.
122
+ */
123
+ verifyPassword?(input: {
124
+ identifier: string;
125
+ password: string;
126
+ }): Promise<UdsAuthResult>;
127
+ /** Choose an MFA delivery method. Required if `signIn` can return `mfa_required`. */
128
+ selectMfaMethod?(input: {
129
+ methodId: string;
130
+ }): Promise<UdsAuthResult>;
131
+ /** Verify a one-time code. Required if any method can return `otp_required`. */
132
+ verifyOtp?(input: {
133
+ code: string;
134
+ }): Promise<UdsAuthResult>;
135
+ /** Re-dispatch the one-time code. Presence enables the resend affordance. */
136
+ resendOtp?(): Promise<UdsAuthResult>;
137
+ /** Start password recovery. Presence enables the "Forgot password?" route. */
138
+ requestPasswordReset?(input: {
139
+ identifier: string;
140
+ }): Promise<UdsAuthResult>;
141
+ /** Start username recovery. Presence enables the "Forgot username?" route. */
142
+ requestUsernameReminder?(input: {
143
+ email: string;
144
+ }): Promise<UdsAuthResult>;
145
+ /** Set a new password. Required if any method can return `password_reset_required`. */
146
+ resetPassword?(input: {
147
+ password: string;
148
+ }): Promise<UdsAuthResult>;
149
+ /** Register a new account. Presence enables the sign-up route. */
150
+ signUp?(input: {
151
+ firstName: string;
152
+ lastName: string;
153
+ identifier: string;
154
+ }): Promise<UdsAuthResult>;
155
+ }
156
+ /**
157
+ * Identity helper that gives adapter authors type inference and a single place
158
+ * to add shared behaviour later (telemetry, retry, logging) without changing
159
+ * every call site.
160
+ *
161
+ * ```ts
162
+ * const auth = createAuthProvider({
163
+ * signIn: ({ identifier, password }) => oktaSdk.authn(identifier, password),
164
+ * verifyOtp: ({ code }) => oktaSdk.verifyFactor(code),
165
+ * });
166
+ * ```
167
+ */
168
+ export declare function createAuthProvider<T extends UdsAuthProvider>(provider: T): T;
@@ -0,0 +1,144 @@
1
+ import { UdsAuthErrorCode, UdsAuthResult, UdsSession } from './auth-provider';
2
+ import { UdsLoginStep } from '../utils/types';
3
+ /**
4
+ * An interceptor around one workflow checkpoint.
5
+ *
6
+ * `next` is the pattern's own behaviour. Call it to keep the default and adapt
7
+ * the result, or ignore it to replace the checkpoint outright.
8
+ */
9
+ export type UdsInterceptor<TContext, TOutcome> = (context: TContext, next: () => TOutcome) => TOutcome;
10
+ /** What the workflow should do next. Returned by the transition checkpoints. */
11
+ export type UdsLoginTransition = {
12
+ type: 'goto';
13
+ step: UdsLoginStep;
14
+ } | {
15
+ type: 'stay';
16
+ } | {
17
+ type: 'fail';
18
+ code: UdsAuthErrorCode;
19
+ message?: string;
20
+ };
21
+ /** Moves the workflow to `step`. */
22
+ export declare const goTo: (step: UdsLoginStep) => UdsLoginTransition;
23
+ /** Leaves the workflow where it is. */
24
+ export declare const stay: () => UdsLoginTransition;
25
+ /** Surfaces a failure without moving. */
26
+ export declare const fail: (code: UdsAuthErrorCode, message?: string) => UdsLoginTransition;
27
+ /** Values collected on the step being submitted. */
28
+ export type UdsLoginValues = Record<string, string | boolean>;
29
+ export interface UdsLoginSubmitContext {
30
+ /** The step being submitted. */
31
+ step: UdsLoginStep;
32
+ /** The values the user entered on this step. */
33
+ values: Readonly<UdsLoginValues>;
34
+ /** The identifier the workflow is authenticating, carried across steps. */
35
+ identifier: string;
36
+ }
37
+ export interface UdsLoginTransitionContext {
38
+ /** The provider result being translated into a step. */
39
+ result: UdsAuthResult;
40
+ /** The step the workflow is on. */
41
+ from: UdsLoginStep;
42
+ }
43
+ /** Why the workflow is moving. */
44
+ export type UdsLoginNavigationCause =
45
+ /** The user followed an in-card link. */
46
+ 'link'
47
+ /** The workflow advanced itself (for example, a lone MFA method was auto-selected). */
48
+ | 'auto'
49
+ /** `reset()` was called. */
50
+ | 'reset';
51
+ export interface UdsLoginNavigateContext {
52
+ from: UdsLoginStep;
53
+ /** Where the pattern intends to go. */
54
+ to: UdsLoginStep;
55
+ cause: UdsLoginNavigationCause;
56
+ }
57
+ export interface UdsLoginFailureContext {
58
+ code: UdsAuthErrorCode;
59
+ /** The step the failure happened on. */
60
+ step: UdsLoginStep;
61
+ /** Any diagnostic text the provider attached. Never rendered. */
62
+ message?: string;
63
+ }
64
+ /** How a failure should be surfaced. */
65
+ export interface UdsLoginFailureOutcome {
66
+ /** The copy to display. `undefined` suppresses the alert. */
67
+ text?: string;
68
+ /** Optionally move the workflow as well — for example to a dedicated page. */
69
+ transition?: UdsLoginTransition;
70
+ }
71
+ export interface UdsLoginCompleteContext {
72
+ /** The session the provider returned, when it supplied one. */
73
+ session?: UdsSession;
74
+ }
75
+ /**
76
+ * The single seam for changing how the login workflow *behaves*.
77
+ *
78
+ * The pattern owns the workflow; this is how a consumer alters its course
79
+ * without taking the whole machine back. Every decision point the workflow has
80
+ * is a checkpoint here, so a change of path is expressed in one object rather
81
+ * than assembled from a handful of independent props — which is what made the
82
+ * previous `controlled` + `step` + `loading` + `errorMessage` arrangement so
83
+ * easy to get half-right.
84
+ *
85
+ * Checkpoints run in workflow order:
86
+ *
87
+ * | Checkpoint | Fires | Default |
88
+ * | --- | --- | --- |
89
+ * | `submit` | before the provider is consulted | calls the provider method for the step |
90
+ * | `transition` | on every provider result | maps the result to a step |
91
+ * | `navigate` | on every step change | performs the move |
92
+ * | `failure` | on every failure | maps the code to approved copy |
93
+ * | `complete` | on success | emits `udsLoginSuccess` |
94
+ *
95
+ * ```ts
96
+ * card.controlStrategy = {
97
+ * // Step into the flow: require acceptance of terms before a new password.
98
+ * transition: (ctx, next) => {
99
+ * const outcome = next();
100
+ * if (outcome.type === 'goto' && outcome.step === 'reset-password' && !termsAccepted) {
101
+ * return goTo('check-email');
102
+ * }
103
+ * return outcome;
104
+ * },
105
+ *
106
+ * // Hand sign-up off to a separate journey entirely.
107
+ * navigate: (ctx, next) => {
108
+ * if (ctx.to === 'sign-up') {
109
+ * router.push('/register');
110
+ * return stay();
111
+ * }
112
+ * return next();
113
+ * },
114
+ * };
115
+ * ```
116
+ *
117
+ * Every hook is optional, and omitting one means "use the pattern's behaviour".
118
+ * Because `next()` is always available, a strategy that only *observes* — for
119
+ * analytics or telemetry — is a one-liner that cannot accidentally change the
120
+ * flow.
121
+ */
122
+ export interface UdsLoginControlStrategy {
123
+ /**
124
+ * Wraps the provider call for a step. Return a `UdsAuthResult` to drive the
125
+ * workflow as though the provider had produced it — useful for inserting a
126
+ * CAPTCHA, a device check, or a consent gate ahead of the real call.
127
+ */
128
+ submit?: UdsInterceptor<UdsLoginSubmitContext, Promise<UdsAuthResult>>;
129
+ /** Wraps the mapping from a provider result to the next step. */
130
+ transition?: UdsInterceptor<UdsLoginTransitionContext, UdsLoginTransition>;
131
+ /** Wraps every step change, whether user-driven or automatic. */
132
+ navigate?: UdsInterceptor<UdsLoginNavigateContext, UdsLoginTransition>;
133
+ /** Wraps failure presentation — the copy shown, and optionally a redirect. */
134
+ failure?: UdsInterceptor<UdsLoginFailureContext, UdsLoginFailureOutcome>;
135
+ /** Wraps successful completion. */
136
+ complete?: UdsInterceptor<UdsLoginCompleteContext, void>;
137
+ }
138
+ /**
139
+ * Runs a checkpoint through the strategy, falling back to the pattern's own
140
+ * behaviour when the strategy does not intercept it.
141
+ */
142
+ export declare function intercept<TContext, TOutcome>(interceptor: UdsInterceptor<TContext, TOutcome> | undefined, context: TContext, fallback: () => TOutcome): TOutcome;
143
+ /** Identity helper giving a strategy literal its types without a type annotation. */
144
+ export declare function createControlStrategy<T extends UdsLoginControlStrategy>(strategy: T): T;
@@ -0,0 +1,52 @@
1
+ import { UdsAuthProvider } from './auth-provider';
2
+ import { UdsLoginControlStrategy } from './control-strategy';
3
+ import { UdsLoginLabels } from '../utils/types';
4
+ /**
5
+ * Everything a login pattern is configured with that cannot be an attribute.
6
+ *
7
+ * ## Why this object exists
8
+ *
9
+ * Custom element attributes are strings. Stencil will coerce `string`,
10
+ * `number` and `boolean` for you, but an object or a function can only be
11
+ * assigned as a JS property — there is no attribute form. That splits the
12
+ * configuration surface in two whether we like it or not, so the convention
13
+ * makes the split explicit rather than letting it emerge by accident:
14
+ *
15
+ * > **If it can be an attribute, it is one. Everything that cannot — objects
16
+ * > and functions — lives here, in exactly one `config` object.**
17
+ *
18
+ * The rule is mechanical, so "should this be a prop or go in config?" is
19
+ * answerable in review by looking at the type rather than debating taste. It
20
+ * also bounds the growth of the element's prop list: new seams (telemetry,
21
+ * theming, validation) land as members of this object instead of as another
22
+ * top-level property, which is the proliferation problem that the aggregate
23
+ * `UdsLoginControlStrategy` was introduced to solve one level down.
24
+ *
25
+ * Every member is optional. A card with no config at all is inert but valid —
26
+ * it renders the first step and reports that it has no provider.
27
+ *
28
+ * ```ts
29
+ * card.config = {
30
+ * auth: createAuthProvider({ signIn: … }),
31
+ * control: { navigate: (ctx, next) => … },
32
+ * labels: { identifierHeading: 'Iniciar sesión' },
33
+ * };
34
+ * ```
35
+ */
36
+ export interface UdsLoginConfig {
37
+ /**
38
+ * The authentication seam: an adapter that answers *what the identity
39
+ * platform needs next*. Supplying one is how the pattern is used.
40
+ */
41
+ auth?: UdsAuthProvider;
42
+ /**
43
+ * The control seam: interceptors over the workflow's checkpoints, for
44
+ * altering *where this product's journey differs*. See
45
+ * `UdsLoginControlStrategy`.
46
+ */
47
+ control?: UdsLoginControlStrategy;
48
+ /** Partial override of the card's copy, for localisation. */
49
+ labels?: Partial<UdsLoginLabels>;
50
+ }
51
+ /** Identity helper giving a config literal its types without an annotation. */
52
+ export declare function createLoginConfig<T extends UdsLoginConfig>(config: T): T;
@@ -0,0 +1,37 @@
1
+ import { UdsAuthProvider, UdsMfaMethod } from './auth-provider';
2
+ /** Shape of the fake directory backing {@link createMemoryAuthProvider}. */
3
+ export interface MemoryAuthUser {
4
+ identifier: string;
5
+ password: string;
6
+ /** When set, sign-in challenges for one of these before succeeding. */
7
+ mfaMethods?: UdsMfaMethod[];
8
+ /** The code `verifyOtp` accepts. Defaults to `'555555'`. */
9
+ otpCode?: string;
10
+ /** Forces the `password_reset_required` branch on successful password entry. */
11
+ mustResetPassword?: boolean;
12
+ }
13
+ export interface MemoryAuthOptions {
14
+ users?: MemoryAuthUser[];
15
+ /** Consecutive failures before the account locks. Defaults to 3. */
16
+ maxAttempts?: number;
17
+ /** Resend throttle reported on `otp_required`. Defaults to 30 000 ms. */
18
+ resendAfterMs?: number;
19
+ /** Omit capabilities to exercise the card's capability detection. */
20
+ capabilities?: {
21
+ signUp?: boolean;
22
+ requestPasswordReset?: boolean;
23
+ requestUsernameReminder?: boolean;
24
+ resendOtp?: boolean;
25
+ };
26
+ }
27
+ /**
28
+ * An in-memory reference implementation of {@link UdsAuthProvider}.
29
+ *
30
+ * It exists so the demo harness and the test suite can drive the *real*
31
+ * workflow — identifier → password → MFA choice → OTP → success, plus the
32
+ * recovery, lockout and sign-up branches — without a network or an identity
33
+ * platform. It is also the worked example adapter authors copy from.
34
+ *
35
+ * Not intended for production use: it compares passwords in plain text.
36
+ */
37
+ export declare function createMemoryAuthProvider(options?: MemoryAuthOptions): UdsAuthProvider;
@@ -0,0 +1,8 @@
1
+ import { UdsAuthResult } from './auth-provider';
2
+ /**
3
+ * Validates a provider's response, returning it narrowed to `UdsAuthResult`.
4
+ *
5
+ * @param value what the adapter returned
6
+ * @param source the provider method called, for the diagnostic message
7
+ */
8
+ export declare function parseAuthResult(value: unknown, source: string): UdsAuthResult;
@@ -0,0 +1,8 @@
1
+ /** Console wrapper carrying a GP prefix, so framework diagnostics are traceable. */
2
+ export declare class LogUtility {
3
+ private static readonly PREFIX;
4
+ private static readonly PREFIX_STYLE;
5
+ static log(...message: unknown[]): void;
6
+ static warn(...message: unknown[]): void;
7
+ static error(...message: unknown[]): void;
8
+ }
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Internal markers used to attach slimmer wiring to component and slimmer
3
+ * instances without colliding with any real field name.
4
+ */
5
+ /** On a slimmer prototype: the list of component methods it hooks into. */
6
+ export declare const SlimmerMappedMethod: unique symbol;
7
+ /** On a slimmer instance: the component that injected it. */
8
+ export declare const SlimmerConsumedBy: unique symbol;
9
+ /** On a component instance: the slimmers it has injected, keyed by field name. */
10
+ export declare const ConsumerSlimmers: unique symbol;
@@ -0,0 +1,30 @@
1
+ /**
2
+ * A prototype or instance as a decorator sees it: an indexable property bag.
3
+ *
4
+ * The upstream snapshot typed these positions as `new (...args) => T`, which
5
+ * describes a *constructor* rather than the prototype object a property
6
+ * decorator is actually handed. That slips through a loose config but not this
7
+ * repo's `strict` mode, so we model it honestly and keep the casts contained
8
+ * to `asBag` instead of scattering them through every decorator.
9
+ */
10
+ export type PropertyBag = Record<PropertyKey, any>;
11
+ /** Narrows the `Object` a decorator is handed to something indexable. */
12
+ export declare const asBag: (target: object) => PropertyBag;
13
+ export type Nullable<T> = T | undefined | null;
14
+ export type MapToComponentFieldOptions = {
15
+ /** The component field to bind to, when it differs from the slimmer field name. */
16
+ componentFieldName?: string;
17
+ /**
18
+ * Allows the slimmer to write back to the component field.
19
+ *
20
+ * Read-only by default, and a given field should be writable from **one**
21
+ * slimmer only — that keeps "who can change this" answerable by looking at a
22
+ * single file, which is the maintainability problem this framework exists to
23
+ * solve.
24
+ */
25
+ writable?: boolean;
26
+ };
27
+ export type SlimmerMappedMethodEntry = {
28
+ componentMethodName: string;
29
+ slimmerMethodName: string;
30
+ };
@@ -0,0 +1,24 @@
1
+ import { UdsSlimmer } from './slimmer';
2
+ import { PropertyBag } from '../common/types';
3
+ /**
4
+ * Marks a component field as a slimmer injection point.
5
+ *
6
+ * ```ts
7
+ * class UdsPatternLoginCard {
8
+ * @InjectSlimmer() private workflow = new WorkflowSlimmer();
9
+ * }
10
+ * ```
11
+ *
12
+ * The decorator replaces the field with an accessor pair, so assigning the
13
+ * instance in the field initialiser is what performs the injection: the slimmer
14
+ * is handed a back-reference to the component and any `@MapToComponentMethod`
15
+ * hooks it declares are attached.
16
+ *
17
+ * Note this relies on field initialisers compiling to assignment rather than
18
+ * `Object.defineProperty` — i.e. `useDefineForClassFields` must be off, which is
19
+ * the default below an ES2022 target. With define semantics the initialiser
20
+ * would shadow this accessor on the instance and nothing would be wired up.
21
+ */
22
+ export declare function InjectSlimmer<T extends UdsSlimmer>(): PropertyDecorator;
23
+ export declare function createSlimmerFieldSetter<T extends UdsSlimmer>(fieldName: PropertyKey): (this: PropertyBag, slimmer: T) => void;
24
+ export declare function createSlimmerFieldGetter(fieldName: PropertyKey): (this: PropertyBag) => unknown;
@@ -0,0 +1,16 @@
1
+ import { MapToComponentFieldOptions } from '../common/types';
2
+ /**
3
+ * Binds a slimmer field to a field on the component that injected it:
4
+ *
5
+ * - reading the slimmer field returns the component's current value;
6
+ * - writing it updates the component (only when `writable` is set).
7
+ *
8
+ * The slimmer therefore holds no copy of the state. That matters inside a
9
+ * Stencil component, where the component's `@State()` fields are the values the
10
+ * renderer actually observes — a slimmer-local duplicate would drift and would
11
+ * not trigger re-renders.
12
+ *
13
+ * The slimmer field name is used as the component field name unless
14
+ * `componentFieldName` says otherwise.
15
+ */
16
+ export declare function MapToComponentField(options?: MapToComponentFieldOptions): PropertyDecorator;
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Hooks a slimmer method onto a component method of the given name.
3
+ *
4
+ * When the component method runs, the slimmer method runs after it and its
5
+ * return value becomes the result. The hook is one-way: calling the slimmer
6
+ * method directly does not invoke the component's.
7
+ *
8
+ * Typical targets are Stencil lifecycle methods (`componentWillLoad`,
9
+ * `disconnectedCallback`), `@Watch` handlers, and `@Method()` members.
10
+ */
11
+ export declare function MapToComponentMethod(componentMethodName: string): PropertyDecorator;
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Base class for every slimmer.
3
+ *
4
+ * A slimmer owns exactly one responsibility lifted out of a component class —
5
+ * the workflow machine, OTP input behaviour, a throttle timer. It reaches back
6
+ * into its host component only through the two mapping decorators, which keeps
7
+ * the coupling declarative and greppable.
8
+ */
9
+ export declare abstract class UdsSlimmer {
10
+ }
@@ -0,0 +1,6 @@
1
+ export * from './decorators/slimmer';
2
+ export * from './decorators/inject-slimmer';
3
+ export * from './decorators/map-to-component-field';
4
+ export * from './decorators/map-to-component-method';
5
+ export * from './common/symbols';
6
+ export type { MapToComponentFieldOptions, Nullable, PropertyBag, SlimmerMappedMethodEntry } from './common/types';