@sparkvault/sdk-js 19.0.1 → 19.1.1
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 +26 -4
- package/dist/npm/chunks/index-C97091lF.mjs +12959 -0
- package/dist/npm/chunks/index-C97091lF.mjs.map +1 -0
- package/dist/npm/chunks/index-D_p_8VO7.cjs +13024 -0
- package/dist/npm/chunks/index-D_p_8VO7.cjs.map +1 -0
- package/dist/npm/identity.cjs +23 -0
- package/dist/npm/identity.cjs.map +1 -0
- package/dist/npm/identity.mjs +12 -0
- package/dist/npm/identity.mjs.map +1 -0
- package/dist/{index.cjs → npm/index.cjs} +802 -13759
- package/dist/npm/index.cjs.map +1 -0
- package/dist/{index.mjs → npm/index.mjs} +203 -13159
- package/dist/npm/index.mjs.map +1 -0
- package/dist/sparkvault-identity.js +2 -0
- package/dist/sparkvault-identity.js.map +1 -0
- package/dist/sparkvault.js +1 -1
- package/dist/sparkvault.js.map +1 -1
- package/dist/types/identity.d.ts +8 -0
- package/dist/{index.d.ts → types/index.d.ts} +4 -790
- package/dist/types/shared/errors-C-gjmGBs.d.ts +800 -0
- package/package.json +20 -9
- package/dist/api-base.d.ts +0 -116
- package/dist/auto-init.d.ts +0 -32
- package/dist/config.d.ts +0 -79
- package/dist/entropy/index.d.ts +0 -35
- package/dist/entropy/types.d.ts +0 -32
- package/dist/errors.d.ts +0 -146
- package/dist/folders/index.d.ts +0 -102
- package/dist/folders/types.d.ts +0 -91
- package/dist/health.d.ts +0 -18
- package/dist/http.d.ts +0 -46
- package/dist/index.cjs.map +0 -1
- package/dist/index.mjs.map +0 -1
- package/dist/ingots/fetch-download.d.ts +0 -78
- package/dist/ingots/history.d.ts +0 -4
- package/dist/ingots/index.d.ts +0 -388
- package/dist/ingots/revision.d.ts +0 -4
- package/dist/ingots/types.d.ts +0 -556
- package/dist/logger.d.ts +0 -32
- package/dist/notify/index.d.ts +0 -154
- package/dist/notify/types.d.ts +0 -232
- package/dist/products/help-desk/client.d.ts +0 -198
- package/dist/products/help-desk/desk-id.d.ts +0 -2
- package/dist/products/help-desk/form-draft.d.ts +0 -37
- package/dist/products/help-desk/form-types.d.ts +0 -123
- package/dist/products/help-desk/form.d.ts +0 -83
- package/dist/products/help-desk/index.d.ts +0 -47
- package/dist/products/help-desk/kb-client.d.ts +0 -48
- package/dist/products/help-desk/kb-types.d.ts +0 -59
- package/dist/products/help-desk/modal.d.ts +0 -8
- package/dist/products/help-desk/styles.d.ts +0 -9
- package/dist/products/help-desk/support-analytics-types.d.ts +0 -32
- package/dist/products/help-desk/support-analytics.d.ts +0 -3
- package/dist/products/help-desk/support-brand.d.ts +0 -49
- package/dist/products/help-desk/support-controller.d.ts +0 -4
- package/dist/products/help-desk/support-history.d.ts +0 -38
- package/dist/products/help-desk/support-launcher.d.ts +0 -12
- package/dist/products/help-desk/support-styles.d.ts +0 -14
- package/dist/products/help-desk/support-types.d.ts +0 -66
- package/dist/products/help-desk/support-view.d.ts +0 -173
- package/dist/products/help-desk/types.d.ts +0 -285
- package/dist/products/help-desk/widget-identity.d.ts +0 -32
- package/dist/products/identity/api.d.ts +0 -237
- package/dist/products/identity/container.d.ts +0 -44
- package/dist/products/identity/dialog-launcher.d.ts +0 -133
- package/dist/products/identity/federation-flow.d.ts +0 -31
- package/dist/products/identity/handlers/otp-handler.d.ts +0 -69
- package/dist/products/identity/handlers/passkey-handler.d.ts +0 -105
- package/dist/products/identity/handlers/sparklink-handler.d.ts +0 -34
- package/dist/products/identity/index.d.ts +0 -296
- package/dist/products/identity/inline-container.d.ts +0 -53
- package/dist/products/identity/methods.d.ts +0 -19
- package/dist/products/identity/modal.d.ts +0 -51
- package/dist/products/identity/pending-signin.d.ts +0 -102
- package/dist/products/identity/popup-launcher.d.ts +0 -73
- package/dist/products/identity/renderer.d.ts +0 -525
- package/dist/products/identity/state.d.ts +0 -84
- package/dist/products/identity/styles.d.ts +0 -31
- package/dist/products/identity/types.d.ts +0 -561
- package/dist/products/identity/utils/cooldown-timer.d.ts +0 -73
- package/dist/products/identity/utils.d.ts +0 -85
- package/dist/products/identity/views/backup-verify.d.ts +0 -42
- package/dist/products/identity/views/base.d.ts +0 -51
- package/dist/products/identity/views/error.d.ts +0 -65
- package/dist/products/identity/views/icons.d.ts +0 -41
- package/dist/products/identity/views/identity-input.d.ts +0 -80
- package/dist/products/identity/views/index.d.ts +0 -20
- package/dist/products/identity/views/loading.d.ts +0 -23
- package/dist/products/identity/views/method-button.d.ts +0 -14
- package/dist/products/identity/views/method-select.d.ts +0 -42
- package/dist/products/identity/views/origin-not-allowed.d.ts +0 -25
- package/dist/products/identity/views/otp-verify.d.ts +0 -58
- package/dist/products/identity/views/passkey-auto.d.ts +0 -22
- package/dist/products/identity/views/passkey-prompt.d.ts +0 -25
- package/dist/products/identity/views/passkey.d.ts +0 -38
- package/dist/products/identity/views/product-not-configured.d.ts +0 -21
- package/dist/products/identity/views/service-unavailable.d.ts +0 -21
- package/dist/products/identity/views/sms-consent.d.ts +0 -16
- package/dist/products/identity/views/sparklink-waiting.d.ts +0 -40
- package/dist/products/identity/views/two-factor.d.ts +0 -37
- package/dist/products/index.d.ts +0 -51
- package/dist/products/messaging/index.d.ts +0 -38
- package/dist/products/messaging/types.d.ts +0 -162
- package/dist/products/notify/index.d.ts +0 -436
- package/dist/products/notify/project-types.d.ts +0 -44
- package/dist/products/notify/projects.d.ts +0 -15
- package/dist/products/notify/types.d.ts +0 -1327
- package/dist/products/structured-ingots/index.d.ts +0 -31
- package/dist/products/structured-ingots/types-client.d.ts +0 -19
- package/dist/products/structured-ingots/types.d.ts +0 -293
- package/dist/products/structured-ingots/validation.d.ts +0 -25
- package/dist/request-path.d.ts +0 -44
- package/dist/sparks/index.d.ts +0 -91
- package/dist/sparks/types.d.ts +0 -304
- package/dist/ui/chrome.d.ts +0 -16
- package/dist/ui/ds-tokens.d.ts +0 -59
- package/dist/ui/inline-shell.d.ts +0 -19
- package/dist/ui/live-region.d.ts +0 -15
- package/dist/ui/modal-shell.d.ts +0 -67
- package/dist/ui/target.d.ts +0 -6
- package/dist/utils/dom.d.ts +0 -26
- package/dist/vault-session.d.ts +0 -2
- package/dist/vaults/index.d.ts +0 -254
- package/dist/vaults/types.d.ts +0 -368
- package/dist/vaults/upload/api.d.ts +0 -310
- package/dist/vaults/upload/chrome.d.ts +0 -21
- package/dist/vaults/upload/container.d.ts +0 -37
- package/dist/vaults/upload/index.d.ts +0 -76
- package/dist/vaults/upload/inline-container.d.ts +0 -41
- package/dist/vaults/upload/modal.d.ts +0 -55
- package/dist/vaults/upload/renderer.d.ts +0 -150
- package/dist/vaults/upload/styles.d.ts +0 -14
- package/dist/vaults/upload/types.d.ts +0 -220
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Identity Module Utilities
|
|
3
|
-
*
|
|
4
|
-
* The encoding and validation helpers the identity renderer, API
|
|
5
|
-
* client and module share.
|
|
6
|
-
*/
|
|
7
|
-
export { CooldownTimer, ExpirationTimer } from './utils/cooldown-timer';
|
|
8
|
-
import type { ResolvedConfig } from '../../config';
|
|
9
|
-
import type { SigninIdentityType, VerifyOptions } from './types';
|
|
10
|
-
/** base64url of an ArrayBuffer: the shape WebAuthn and WebCrypto hand back. */
|
|
11
|
-
export declare function arrayBufferToBase64url(buffer: ArrayBuffer): string;
|
|
12
|
-
/**
|
|
13
|
-
* A sign-in's restriction on the identity types it may produce, as its flow
|
|
14
|
-
* holds it: read (`types`, null for none), or a spelling the sign-in page's
|
|
15
|
-
* URL carried that cannot be read, which the flow refuses to run under rather
|
|
16
|
-
* than run unrestricted.
|
|
17
|
-
*/
|
|
18
|
-
export type SigninIdentityTypesRead = {
|
|
19
|
-
ok: true;
|
|
20
|
-
types: SigninIdentityType[] | null;
|
|
21
|
-
} | {
|
|
22
|
-
ok: false;
|
|
23
|
-
};
|
|
24
|
-
/**
|
|
25
|
-
* The restriction a caller's `identityTypes` option names, in the contract's
|
|
26
|
-
* one order, or null when it names none. Synchronous, so a sign-in refuses a
|
|
27
|
-
* bad value before it opens anything.
|
|
28
|
-
*
|
|
29
|
-
* @throws {ValidationError} For a value that is no list of at least one
|
|
30
|
-
* SigninIdentityType
|
|
31
|
-
*/
|
|
32
|
-
export declare function callerIdentityTypes(identityTypes: SigninIdentityType[] | undefined): SigninIdentityType[] | null;
|
|
33
|
-
/**
|
|
34
|
-
* The restriction as the wire carries it, `{ identity_types: <spelling> }`,
|
|
35
|
-
* or nothing for none: a sign-in that names no restriction sends no field,
|
|
36
|
-
* and Identity applies none.
|
|
37
|
-
*/
|
|
38
|
-
export declare function identityTypesParam(types: readonly SigninIdentityType[] | null): Record<string, string>;
|
|
39
|
-
/**
|
|
40
|
-
* This page as a navigation return target: origin, path, and query (the query
|
|
41
|
-
* carries the page's own state, whether app routing or the sign-in page's validated
|
|
42
|
-
* destination), without the fragment, which is the channel a result returns
|
|
43
|
-
* in.
|
|
44
|
-
*/
|
|
45
|
-
export declare function currentPageReturnUrl(): string;
|
|
46
|
-
/** The PKCE + state return leg a handoff navigation carries back to this page. */
|
|
47
|
-
export interface SigninUrlRedirectExtras {
|
|
48
|
-
redirectUri: string;
|
|
49
|
-
state: string;
|
|
50
|
-
codeChallenge: string;
|
|
51
|
-
}
|
|
52
|
-
/**
|
|
53
|
-
* How the sign-in page is delivered, and so how it learns its sign-in's
|
|
54
|
-
* reference (app-sdk SIGNIN_REFERENCE):
|
|
55
|
-
* - `popup`: the page opens in a popup inside the click, before any draw can
|
|
56
|
-
* finish, so its URL says the opener posts the reference.
|
|
57
|
-
* - `redirect`: this tab navigates there. A reference rides in the URL; with
|
|
58
|
-
* none, the URL says no recovery stands in for the page's result
|
|
59
|
-
* (`noRecoveryValue`): the caller holds no pending marker for it. `handoff`
|
|
60
|
-
* arms the return to this page as a one-time code in the fragment; an OIDC
|
|
61
|
-
* auth request or a verify session navigates without it, its page driving
|
|
62
|
-
* the return.
|
|
63
|
-
*/
|
|
64
|
-
export type SigninPageDelivery = {
|
|
65
|
-
kind: 'popup';
|
|
66
|
-
} | {
|
|
67
|
-
kind: 'redirect';
|
|
68
|
-
signinRef: string | null;
|
|
69
|
-
handoff?: SigninUrlRedirectExtras;
|
|
70
|
-
};
|
|
71
|
-
/**
|
|
72
|
-
* Build the sign-in page URL on the Identity origin. Single source for BOTH
|
|
73
|
-
* delivery modes: the popup (opener + postMessage) and the same-tab redirect
|
|
74
|
-
* (redirect_uri + state + code_challenge → one-time code in the fragment).
|
|
75
|
-
*/
|
|
76
|
-
export declare function buildSigninUrl(config: ResolvedConfig, options: VerifyOptions, delivery: SigninPageDelivery): string;
|
|
77
|
-
/**
|
|
78
|
-
* Warm the connection to another origin by injecting `<link rel="preconnect">`
|
|
79
|
-
* hints (one plain for top-level navigations, one `crossorigin` for CORS
|
|
80
|
-
* fetches). The sign-in popup/redirect and every flow API call reuse the open
|
|
81
|
-
* connection, which removes the cold-connection stall mobile browsers hit on
|
|
82
|
-
* the first navigation to the Identity origin. No-op off-DOM, for the page's
|
|
83
|
-
* own origin, and when the hints already exist.
|
|
84
|
-
*/
|
|
85
|
-
export declare function ensurePreconnect(baseUrl: string): void;
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Backup Verification Input View
|
|
3
|
-
*
|
|
4
|
-
* Post-login nudge to add the inverse identifier as a recovery backup:
|
|
5
|
-
* collects a new phone (for an email login), under the SMS and voice consent,
|
|
6
|
-
* or email (for a phone login), then hands it off to send a one-time code.
|
|
7
|
-
* Includes a "Not now" skip that suppresses this method's prompt for 30 days
|
|
8
|
-
* (handled by the renderer).
|
|
9
|
-
*
|
|
10
|
-
* Sibling of PasskeyPromptView: same low-friction, skippable shape.
|
|
11
|
-
*/
|
|
12
|
-
import type { View } from './base';
|
|
13
|
-
export interface BackupVerifyViewProps {
|
|
14
|
-
/** Which identifier to collect: the inverse of what they logged in with. */
|
|
15
|
-
missingType: 'email' | 'phone';
|
|
16
|
-
/** Submit the validated identifier to send a code. */
|
|
17
|
-
onSubmit: (value: string) => void;
|
|
18
|
-
/** Skip ("Not now"): suppresses this method for 30 days. */
|
|
19
|
-
onSkip: () => void;
|
|
20
|
-
/** Error to display (e.g. send failed, or identifier already in use). */
|
|
21
|
-
error?: string;
|
|
22
|
-
}
|
|
23
|
-
export declare class BackupVerifyView implements View {
|
|
24
|
-
private readonly props;
|
|
25
|
-
private inputElement;
|
|
26
|
-
private submitButton;
|
|
27
|
-
private skipLink;
|
|
28
|
-
private errorContainer;
|
|
29
|
-
private focusTimeoutId;
|
|
30
|
-
private readonly boundHandleInput;
|
|
31
|
-
private readonly boundHandleKeyDown;
|
|
32
|
-
private readonly boundHandleSubmit;
|
|
33
|
-
private readonly boundHandleSkip;
|
|
34
|
-
constructor(props: BackupVerifyViewProps);
|
|
35
|
-
private get isPhone();
|
|
36
|
-
render(): HTMLElement;
|
|
37
|
-
private handleInput;
|
|
38
|
-
private clearError;
|
|
39
|
-
private showError;
|
|
40
|
-
private handleSubmit;
|
|
41
|
-
destroy(): void;
|
|
42
|
-
}
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Base View Types and Utilities
|
|
3
|
-
*
|
|
4
|
-
* Shared interfaces and helpers for all view components.
|
|
5
|
-
*/
|
|
6
|
-
/**
|
|
7
|
-
* Base interface for all view components.
|
|
8
|
-
* Each view must implement render() to return its DOM element.
|
|
9
|
-
*/
|
|
10
|
-
export interface View {
|
|
11
|
-
render(): HTMLElement;
|
|
12
|
-
destroy?(): void;
|
|
13
|
-
/**
|
|
14
|
-
* What the page announces as its status while this view shows: the
|
|
15
|
-
* renderer writes it into its one live region, which stays in the page
|
|
16
|
-
* across views so the change is heard. None for a view with nothing to say.
|
|
17
|
-
*/
|
|
18
|
-
readonly announcement?: string;
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* Create an element with optional attributes and children.
|
|
22
|
-
* Type-safe DOM element creation utility.
|
|
23
|
-
*/
|
|
24
|
-
export declare function createElement<K extends keyof HTMLElementTagNameMap>(tag: K, attrs?: Partial<HTMLElementTagNameMap[K]> & {
|
|
25
|
-
className?: string;
|
|
26
|
-
}, children?: (HTMLElement | string | null | undefined)[]): HTMLElementTagNameMap[K];
|
|
27
|
-
/**
|
|
28
|
-
* Create a container div with optional class and children.
|
|
29
|
-
*/
|
|
30
|
-
export declare function div(className?: string, children?: (HTMLElement | string | null | undefined)[]): HTMLDivElement;
|
|
31
|
-
/**
|
|
32
|
-
* Clear all children from an element safely.
|
|
33
|
-
* Preferred over innerHTML = '' for security and performance.
|
|
34
|
-
*/
|
|
35
|
-
export declare function clearChildren(element: HTMLElement): void;
|
|
36
|
-
/**
|
|
37
|
-
* Create an error message element.
|
|
38
|
-
*/
|
|
39
|
-
export declare function errorMessage(message: string): HTMLDivElement;
|
|
40
|
-
/**
|
|
41
|
-
* An email address in its canonical form, or null when the platform cannot
|
|
42
|
-
* deliver to it: the platform's one email grammar
|
|
43
|
-
* (`@sparkvault/app-sdk/email-address`), which the Identity Product reads an
|
|
44
|
-
* address by, so a field refuses exactly what the server would.
|
|
45
|
-
*/
|
|
46
|
-
export declare function validateEmail(email: string): string | null;
|
|
47
|
-
/**
|
|
48
|
-
* Validate OTP code format.
|
|
49
|
-
* Returns sanitized code or null if invalid.
|
|
50
|
-
*/
|
|
51
|
-
export declare function validateOtpCode(code: string): string | null;
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Error View
|
|
3
|
-
*
|
|
4
|
-
* Professional enterprise-quality error display with clear visual hierarchy.
|
|
5
|
-
*/
|
|
6
|
-
import type { View } from './base';
|
|
7
|
-
/**
|
|
8
|
-
* Error codes that mean the site owner's Identity access is blocked: the
|
|
9
|
-
* free trial was exhausted or expired, or a paid plan hit its capacity wall.
|
|
10
|
-
* The end user can do nothing about these, so the ErrorView renders a friendly,
|
|
11
|
-
* non-leaky interstitial (no "Try Again", no debug code badge) exactly like
|
|
12
|
-
* `identity_locked`. The owner is nudged to subscribe through their own
|
|
13
|
-
* dashboard, never through this end-user surface.
|
|
14
|
-
*/
|
|
15
|
-
export declare const IDENTITY_BLOCKED_ERROR_CODES: readonly ["identity_trial_exhausted", "identity_trial_expired", "identity_capacity_blocked"];
|
|
16
|
-
/**
|
|
17
|
-
* The code of a verification whose request its sender held to a passkey, for
|
|
18
|
-
* a person who holds none: no ceremony here enrols one, so the person can do
|
|
19
|
-
* nothing from this page, and only the sender can resend the request at a
|
|
20
|
-
* level they can clear (the message says so).
|
|
21
|
-
*/
|
|
22
|
-
export declare const STRONGER_VERIFICATION_REQUIRED_CODE = "stronger_verification_required";
|
|
23
|
-
/**
|
|
24
|
-
* The code of a sign-in whose only way in is the account's own identity
|
|
25
|
-
* provider, on a page that may not offer it: the site's sign-in predates what
|
|
26
|
-
* that provider needs, so only the site updating it clears this.
|
|
27
|
-
*/
|
|
28
|
-
export declare const FEDERATION_UNAVAILABLE_CODE = "federation_unavailable";
|
|
29
|
-
/**
|
|
30
|
-
* The code of a sign-in whose only way in is the account's own identity
|
|
31
|
-
* provider, on a page that could not get its sign-in's reference just now:
|
|
32
|
-
* a genuine error, which the person's Try Again asks for again.
|
|
33
|
-
*/
|
|
34
|
-
export declare const SIGNIN_REFERENCE_UNAVAILABLE_CODE = "signin_reference_unavailable";
|
|
35
|
-
/**
|
|
36
|
-
* The code of a sign-in whose restriction on the identity types it may
|
|
37
|
-
* produce (SignInOptions.identityTypes) admits none of the account's ways in:
|
|
38
|
-
* only the site that asked for the restriction can change that.
|
|
39
|
-
*/
|
|
40
|
-
export declare const IDENTITY_TYPES_UNAVAILABLE_CODE = "identity_types_unavailable";
|
|
41
|
-
/**
|
|
42
|
-
* The code of a sign-in page whose URL names a restriction it cannot read:
|
|
43
|
-
* the page runs no sign-in under it rather than one wider than the site
|
|
44
|
-
* asked for, and only a sign-in the site opens afresh clears it.
|
|
45
|
-
*/
|
|
46
|
-
export declare const IDENTITY_TYPES_UNREADABLE_CODE = "identity_types_unreadable";
|
|
47
|
-
export interface ErrorViewProps {
|
|
48
|
-
message: string;
|
|
49
|
-
code: string;
|
|
50
|
-
onRetry: () => void;
|
|
51
|
-
onClose: () => void;
|
|
52
|
-
}
|
|
53
|
-
export declare class ErrorView implements View {
|
|
54
|
-
private readonly props;
|
|
55
|
-
private retryButton;
|
|
56
|
-
private closeButton;
|
|
57
|
-
private readonly boundHandleRetry;
|
|
58
|
-
private readonly boundHandleClose;
|
|
59
|
-
constructor(props: ErrorViewProps);
|
|
60
|
-
render(): HTMLElement;
|
|
61
|
-
/**
|
|
62
|
-
* Clean up event listeners to prevent memory leaks.
|
|
63
|
-
*/
|
|
64
|
-
destroy(): void;
|
|
65
|
-
}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* SVG Icon Factory
|
|
3
|
-
*
|
|
4
|
-
* Bare outline glyphs per the SparkVault design system: stroke `currentColor`
|
|
5
|
-
* so the stylesheet drives color, no tinted container backgrounds, round
|
|
6
|
-
* caps/joins. The sign-in providers' marks are their owners' filled logos,
|
|
7
|
-
* drawn from `@sparkvault/app-sdk/brand-marks` in their owners' colors, a
|
|
8
|
-
* one-color logo (Apple, GitHub) in `currentColor`. Uses proper DOM element
|
|
9
|
-
* creation for security.
|
|
10
|
-
*/
|
|
11
|
-
/**
|
|
12
|
-
* Checkmark icon for benefit lists
|
|
13
|
-
*/
|
|
14
|
-
export declare function createCheckmarkIcon(): SVGSVGElement;
|
|
15
|
-
/**
|
|
16
|
-
* Back arrow (chevron left)
|
|
17
|
-
*/
|
|
18
|
-
export declare function createBackArrowIcon(): SVGSVGElement;
|
|
19
|
-
/**
|
|
20
|
-
* Close (X) icon
|
|
21
|
-
*/
|
|
22
|
-
export declare function createCloseIcon(): SVGSVGElement;
|
|
23
|
-
/**
|
|
24
|
-
* Passkey icon - bare outline key design
|
|
25
|
-
*/
|
|
26
|
-
export declare function createPasskeyIcon(): SVGSVGElement;
|
|
27
|
-
/**
|
|
28
|
-
* Error icon - alert triangle for error states
|
|
29
|
-
*/
|
|
30
|
-
export declare function createErrorIcon(): SVGSVGElement;
|
|
31
|
-
/**
|
|
32
|
-
* Expired icon - alert triangle for expired states
|
|
33
|
-
*/
|
|
34
|
-
export declare function createExpiredIcon(): SVGSVGElement;
|
|
35
|
-
/**
|
|
36
|
-
* Method icons. Every `MethodMetadata.icon` value in the registry must have a
|
|
37
|
-
* case here. The returned glyph is tagged with `data-sv-method-icon` so a
|
|
38
|
-
* mismatch is visible in the DOM (and assertable in tests) instead of a wrong
|
|
39
|
-
* glyph silently standing in for the method.
|
|
40
|
-
*/
|
|
41
|
-
export declare function createMethodIcon(iconName: string): SVGSVGElement;
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Identity Input View
|
|
3
|
-
*
|
|
4
|
-
* Collects and validates the user's email or phone number: reads the input as
|
|
5
|
-
* one or the other by the platform's rules (`@sparkvault/app-sdk/phone` and
|
|
6
|
-
* `@sparkvault/app-sdk/email-address`), and formats phone numbers as the
|
|
7
|
-
* number is typed. A field that takes a phone number carries the SMS and voice
|
|
8
|
-
* consent beneath it.
|
|
9
|
-
*/
|
|
10
|
-
import type { MethodMetadata } from '../types';
|
|
11
|
-
import type { View } from './base';
|
|
12
|
-
export type IdentityType = 'email' | 'phone';
|
|
13
|
-
export interface IdentityInputResult {
|
|
14
|
-
value: string;
|
|
15
|
-
type: IdentityType;
|
|
16
|
-
}
|
|
17
|
-
export interface IdentityInputViewProps {
|
|
18
|
-
/** Which identity types are allowed */
|
|
19
|
-
allowedTypes: IdentityType[];
|
|
20
|
-
/** Pre-filled value */
|
|
21
|
-
initialValue?: string;
|
|
22
|
-
/** Error message to display */
|
|
23
|
-
error?: string;
|
|
24
|
-
/** Called with validated identity */
|
|
25
|
-
onSubmit: (result: IdentityInputResult) => void;
|
|
26
|
-
/**
|
|
27
|
-
* When set, offer a "Sign in with a passkey" shortcut below the form:
|
|
28
|
-
* the way back into the discoverable ceremony for a returning browser
|
|
29
|
-
* whose auto-started prompt was dismissed.
|
|
30
|
-
*/
|
|
31
|
-
onPasskey?: () => void;
|
|
32
|
-
/**
|
|
33
|
-
* A method that needs no identifier, offered above the field: the account's
|
|
34
|
-
* own identity provider, whose people sign in without typing anything here.
|
|
35
|
-
* One the flow can offer only later joins the view through
|
|
36
|
-
* `offerLeadingMethod`.
|
|
37
|
-
*/
|
|
38
|
-
leadingMethod?: LeadingMethod;
|
|
39
|
-
/** Called each time the person edits the field. */
|
|
40
|
-
onType?: () => void;
|
|
41
|
-
}
|
|
42
|
-
/** A method offered above the identifier field, and what its click does. */
|
|
43
|
-
export interface LeadingMethod {
|
|
44
|
-
method: MethodMetadata;
|
|
45
|
-
onSelect: () => void;
|
|
46
|
-
}
|
|
47
|
-
export declare class IdentityInputView implements View {
|
|
48
|
-
private readonly props;
|
|
49
|
-
private container;
|
|
50
|
-
private inputElement;
|
|
51
|
-
private labelElement;
|
|
52
|
-
private submitButton;
|
|
53
|
-
private passkeyLink;
|
|
54
|
-
private leadingButton;
|
|
55
|
-
private leadingHandler;
|
|
56
|
-
private errorContainer;
|
|
57
|
-
private focusTimeoutId;
|
|
58
|
-
private identityInput;
|
|
59
|
-
private readonly boundHandleKeyDown;
|
|
60
|
-
private readonly boundHandleSubmit;
|
|
61
|
-
private readonly boundHandlePasskey;
|
|
62
|
-
constructor(props: IdentityInputViewProps);
|
|
63
|
-
private get allowsBoth();
|
|
64
|
-
private get allowsEmail();
|
|
65
|
-
private get allowsPhone();
|
|
66
|
-
render(): HTMLElement;
|
|
67
|
-
/**
|
|
68
|
-
* Offer `leading` above the field, set apart by "or". On a view already on
|
|
69
|
-
* screen it joins in place, so what the person typed and where their focus
|
|
70
|
-
* is stay as they were. A view that already leads with a method keeps it.
|
|
71
|
-
*/
|
|
72
|
-
offerLeadingMethod(leading: LeadingMethod): void;
|
|
73
|
-
private getSubtitleText;
|
|
74
|
-
private getLabelText;
|
|
75
|
-
private getPlaceholderText;
|
|
76
|
-
private clearError;
|
|
77
|
-
private showError;
|
|
78
|
-
private handleSubmit;
|
|
79
|
-
destroy(): void;
|
|
80
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* View Components Index
|
|
3
|
-
*
|
|
4
|
-
* Re-exports all view components for the identity modal.
|
|
5
|
-
*/
|
|
6
|
-
export * from './base';
|
|
7
|
-
export * from './loading';
|
|
8
|
-
export * from './identity-input';
|
|
9
|
-
export * from './method-select';
|
|
10
|
-
export * from './otp-verify';
|
|
11
|
-
export * from './two-factor';
|
|
12
|
-
export * from './passkey';
|
|
13
|
-
export * from './passkey-auto';
|
|
14
|
-
export * from './passkey-prompt';
|
|
15
|
-
export * from './backup-verify';
|
|
16
|
-
export * from './sparklink-waiting';
|
|
17
|
-
export * from './error';
|
|
18
|
-
export * from './service-unavailable';
|
|
19
|
-
export * from './product-not-configured';
|
|
20
|
-
export * from './origin-not-allowed';
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Loading View
|
|
3
|
-
*
|
|
4
|
-
* Displays a loading spinner with optional message.
|
|
5
|
-
*/
|
|
6
|
-
import type { View } from './base';
|
|
7
|
-
export interface LoadingViewProps {
|
|
8
|
-
message?: string;
|
|
9
|
-
/**
|
|
10
|
-
* Announce the message as the page's status, for a wait whose words say
|
|
11
|
-
* what is happening: the renderer's live region carries it, so the spinner
|
|
12
|
-
* and the visible words are hidden from assistive technology. Otherwise
|
|
13
|
-
* the spinner is the status, named "Loading".
|
|
14
|
-
*/
|
|
15
|
-
announce?: boolean;
|
|
16
|
-
}
|
|
17
|
-
export declare class LoadingView implements View {
|
|
18
|
-
private readonly message;
|
|
19
|
-
readonly announcement?: string;
|
|
20
|
-
constructor(props?: LoadingViewProps);
|
|
21
|
-
render(): HTMLElement;
|
|
22
|
-
destroy(): void;
|
|
23
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Method Button
|
|
3
|
-
*
|
|
4
|
-
* A sign-in method's button, drawn one way wherever a method is offered: the
|
|
5
|
-
* method list, and the identifier step that leads with the account's own
|
|
6
|
-
* identity provider. The caller attaches its click handler, and removes it.
|
|
7
|
-
*/
|
|
8
|
-
import type { MethodMetadata } from '../types';
|
|
9
|
-
/**
|
|
10
|
-
* The button: its glyph, hidden from assistive technology so the button is
|
|
11
|
-
* named by its words alone; the method's name; and its description, when it
|
|
12
|
-
* has one.
|
|
13
|
-
*/
|
|
14
|
-
export declare function methodButton(method: MethodMetadata): HTMLButtonElement;
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Method Select View
|
|
3
|
-
*
|
|
4
|
-
* Displays available authentication methods for the user to choose from. A
|
|
5
|
-
* list that offers a text or a call carries the SMS and voice consent beneath
|
|
6
|
-
* it: a phone number the sign-in was handed reaches this list without passing
|
|
7
|
-
* the identifier field that carries it, so the tap on a text or call method is
|
|
8
|
-
* what gives it.
|
|
9
|
-
*/
|
|
10
|
-
import type { View } from './base';
|
|
11
|
-
import type { IdentityType } from './identity-input';
|
|
12
|
-
import type { MethodMetadata } from '../types';
|
|
13
|
-
export interface MethodSelectViewProps {
|
|
14
|
-
email?: string;
|
|
15
|
-
/** Channel of the identifier being verified; drives the back-link label. */
|
|
16
|
-
identityType?: IdentityType;
|
|
17
|
-
methods: MethodMetadata[];
|
|
18
|
-
onSelectMethod: (method: MethodMetadata) => void;
|
|
19
|
-
onBack?: () => void;
|
|
20
|
-
}
|
|
21
|
-
export declare class MethodSelectView implements View {
|
|
22
|
-
private readonly props;
|
|
23
|
-
private backLink;
|
|
24
|
-
private methodsContainer;
|
|
25
|
-
private methodButtons;
|
|
26
|
-
private readonly boundHandleBack;
|
|
27
|
-
private readonly methodClickHandlers;
|
|
28
|
-
constructor(props: MethodSelectViewProps);
|
|
29
|
-
render(): HTMLElement;
|
|
30
|
-
/**
|
|
31
|
-
* Put `method` at the head of a list already on screen, in place, so the
|
|
32
|
-
* person's focus stays where it was. The method sends no text or call (the
|
|
33
|
-
* account's own identity provider), so the list's consent stands as it is.
|
|
34
|
-
*/
|
|
35
|
-
offerLeadingMethod(method: MethodMetadata): void;
|
|
36
|
-
private createBackLink;
|
|
37
|
-
private createMethodButton;
|
|
38
|
-
/**
|
|
39
|
-
* Clean up event listeners to prevent memory leaks.
|
|
40
|
-
*/
|
|
41
|
-
destroy(): void;
|
|
42
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Origin Not Allowed View
|
|
3
|
-
*
|
|
4
|
-
* Full-dialog terminal screen shown when the embedding site's origin is not in
|
|
5
|
-
* the account's verified-domains allowlist. The audience is the website owner /
|
|
6
|
-
* developer: this is a misconfiguration surface, not an end-user error, and it
|
|
7
|
-
* is permanent (retrying never clears an origin block), so the dialog drops
|
|
8
|
-
* customer branding, offers no "Try Again", names the blocked origin, and
|
|
9
|
-
* points to the place that fixes it. Reuses the SparkVault-notice styling from
|
|
10
|
-
* the product-not-configured view.
|
|
11
|
-
*/
|
|
12
|
-
import type { View } from './base';
|
|
13
|
-
export interface OriginNotAllowedViewProps {
|
|
14
|
-
/** The blocked embedding origin, when the server reported it. */
|
|
15
|
-
origin?: string;
|
|
16
|
-
onClose: () => void;
|
|
17
|
-
}
|
|
18
|
-
export declare class OriginNotAllowedView implements View {
|
|
19
|
-
private readonly props;
|
|
20
|
-
private dismissButton;
|
|
21
|
-
private readonly boundHandleClose;
|
|
22
|
-
constructor(props: OriginNotAllowedViewProps);
|
|
23
|
-
render(): HTMLElement;
|
|
24
|
-
destroy(): void;
|
|
25
|
-
}
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* OTP Verification View
|
|
3
|
-
*
|
|
4
|
-
* Collects and validates the 6-digit OTP code sent via email, SMS, or voice.
|
|
5
|
-
*/
|
|
6
|
-
import type { View } from './base';
|
|
7
|
-
export interface OtpVerifyViewProps {
|
|
8
|
-
email: string;
|
|
9
|
-
method: 'email' | 'sms' | 'voice';
|
|
10
|
-
error?: string;
|
|
11
|
-
/** UTC timestamp (Unix seconds) when backoff expires and next attempt is allowed */
|
|
12
|
-
backoffExpires?: number;
|
|
13
|
-
onSubmit: (code: string) => void;
|
|
14
|
-
onResend: () => void;
|
|
15
|
-
onBack: () => void;
|
|
16
|
-
}
|
|
17
|
-
export declare class OtpVerifyView implements View {
|
|
18
|
-
private readonly props;
|
|
19
|
-
private inputElements;
|
|
20
|
-
private submitButton;
|
|
21
|
-
private resendButton;
|
|
22
|
-
private backLink;
|
|
23
|
-
private errorContainer;
|
|
24
|
-
private resendTimer;
|
|
25
|
-
private backoffTimer;
|
|
26
|
-
private backoffSeconds;
|
|
27
|
-
private focusTimeoutId;
|
|
28
|
-
private autoSubmitTimeoutId;
|
|
29
|
-
private isSubmitting;
|
|
30
|
-
private readonly boundHandleBack;
|
|
31
|
-
private readonly boundHandleResend;
|
|
32
|
-
private readonly boundHandleSubmit;
|
|
33
|
-
private readonly inputHandlers;
|
|
34
|
-
constructor(props: OtpVerifyViewProps);
|
|
35
|
-
render(): HTMLElement;
|
|
36
|
-
private createBackLink;
|
|
37
|
-
private createInputGroup;
|
|
38
|
-
private handleInput;
|
|
39
|
-
private handleKeyDown;
|
|
40
|
-
private handlePaste;
|
|
41
|
-
private checkAutoSubmit;
|
|
42
|
-
private getCode;
|
|
43
|
-
private clearError;
|
|
44
|
-
private showError;
|
|
45
|
-
private handleSubmit;
|
|
46
|
-
/**
|
|
47
|
-
* Start backoff countdown using UTC timestamp.
|
|
48
|
-
* Derives remaining seconds client-side for accuracy.
|
|
49
|
-
*/
|
|
50
|
-
private startBackoff;
|
|
51
|
-
private updateSubmitButton;
|
|
52
|
-
private disableInputs;
|
|
53
|
-
private handleResend;
|
|
54
|
-
/**
|
|
55
|
-
* Clean up event listeners, timers, and intervals to prevent memory leaks.
|
|
56
|
-
*/
|
|
57
|
-
destroy(): void;
|
|
58
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Passkey Auto-Verify View
|
|
3
|
-
*
|
|
4
|
-
* Shown behind the browser's passkey sheet while an auto-started discoverable
|
|
5
|
-
* ceremony runs (returning browsers carrying the passkey-hint cookie). The
|
|
6
|
-
* ceremony was fired without a click, so this screen has no action button,
|
|
7
|
-
* only a live status and an escape hatch to the identifier form for anyone
|
|
8
|
-
* who wants a different method (or whose sheet hangs).
|
|
9
|
-
*/
|
|
10
|
-
import type { View } from './base';
|
|
11
|
-
export interface PasskeyAutoViewProps {
|
|
12
|
-
/** Abort the pending ceremony and fall back to the identifier form. */
|
|
13
|
-
onUseAnotherMethod: () => void;
|
|
14
|
-
}
|
|
15
|
-
export declare class PasskeyAutoView implements View {
|
|
16
|
-
private readonly props;
|
|
17
|
-
private fallbackLink;
|
|
18
|
-
private readonly boundHandleFallback;
|
|
19
|
-
constructor(props: PasskeyAutoViewProps);
|
|
20
|
-
render(): HTMLElement;
|
|
21
|
-
destroy(): void;
|
|
22
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Passkey Registration Prompt View
|
|
3
|
-
*
|
|
4
|
-
* Shown after a login whose recommendations name a passkey, to encourage the
|
|
5
|
-
* person to add one. Includes a benefits list and a skip option, which the
|
|
6
|
-
* server suppresses for 30 days (POST /recommendations/dismiss).
|
|
7
|
-
*/
|
|
8
|
-
import type { View } from './base';
|
|
9
|
-
export interface PasskeyPromptViewProps {
|
|
10
|
-
identityLabel: string;
|
|
11
|
-
onAddPasskey: () => void;
|
|
12
|
-
onSkip: () => void;
|
|
13
|
-
/** Error message to display when registration fails */
|
|
14
|
-
error?: string;
|
|
15
|
-
}
|
|
16
|
-
export declare class PasskeyPromptView implements View {
|
|
17
|
-
private readonly props;
|
|
18
|
-
private addButton;
|
|
19
|
-
private skipLink;
|
|
20
|
-
private readonly boundHandleAdd;
|
|
21
|
-
private readonly boundHandleSkip;
|
|
22
|
-
constructor(props: PasskeyPromptViewProps);
|
|
23
|
-
render(): HTMLElement;
|
|
24
|
-
destroy(): void;
|
|
25
|
-
}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Passkey View
|
|
3
|
-
*
|
|
4
|
-
* Handles WebAuthn passkey registration and verification.
|
|
5
|
-
*/
|
|
6
|
-
import type { View } from './base';
|
|
7
|
-
export interface PasskeyViewProps {
|
|
8
|
-
identityLabel: string;
|
|
9
|
-
mode: 'register' | 'verify';
|
|
10
|
-
error?: string;
|
|
11
|
-
onStart: () => void;
|
|
12
|
-
onBack?: () => void;
|
|
13
|
-
/** Optional fallback to an identifier-based code if passkey fails */
|
|
14
|
-
onFallback?: () => void;
|
|
15
|
-
}
|
|
16
|
-
export declare class PasskeyView implements View {
|
|
17
|
-
private readonly props;
|
|
18
|
-
private actionButton;
|
|
19
|
-
private errorContainer;
|
|
20
|
-
private backLink;
|
|
21
|
-
private fallbackLink;
|
|
22
|
-
private readonly boundHandleBack;
|
|
23
|
-
private readonly boundHandleStart;
|
|
24
|
-
private readonly boundHandleFallback;
|
|
25
|
-
constructor(props: PasskeyViewProps);
|
|
26
|
-
render(): HTMLElement;
|
|
27
|
-
private createFallbackLink;
|
|
28
|
-
private createBackLink;
|
|
29
|
-
private handleStart;
|
|
30
|
-
/**
|
|
31
|
-
* Re-enable the button and show error after a failed attempt.
|
|
32
|
-
*/
|
|
33
|
-
showError(message: string): void;
|
|
34
|
-
/**
|
|
35
|
-
* Clean up event listeners to prevent memory leaks.
|
|
36
|
-
*/
|
|
37
|
-
destroy(): void;
|
|
38
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Product Not Configured View
|
|
3
|
-
*
|
|
4
|
-
* Full-dialog terminal screen shown when the SparkVault Identity Product has
|
|
5
|
-
* not been configured for the account that the JS SDK is configured against. The
|
|
6
|
-
* audience is the website owner / developer: this is a misconfiguration
|
|
7
|
-
* surface, not an end-user error, so the dialog drops customer branding and
|
|
8
|
-
* presents itself as an unmistakable SparkVault notice.
|
|
9
|
-
*/
|
|
10
|
-
import type { View } from './base';
|
|
11
|
-
export interface ProductNotConfiguredViewProps {
|
|
12
|
-
onClose: () => void;
|
|
13
|
-
}
|
|
14
|
-
export declare class ProductNotConfiguredView implements View {
|
|
15
|
-
private readonly props;
|
|
16
|
-
private dismissButton;
|
|
17
|
-
private readonly boundHandleClose;
|
|
18
|
-
constructor(props: ProductNotConfiguredViewProps);
|
|
19
|
-
render(): HTMLElement;
|
|
20
|
-
destroy(): void;
|
|
21
|
-
}
|