@sparkvault/sdk 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/README.md +720 -0
  2. package/dist/auto-init.d.ts +51 -0
  3. package/dist/config.d.ts +25 -0
  4. package/dist/errors.d.ts +30 -0
  5. package/dist/http.d.ts +48 -0
  6. package/dist/identity/api.d.ts +101 -0
  7. package/dist/identity/container.d.ts +49 -0
  8. package/dist/identity/handlers/index.d.ts +9 -0
  9. package/dist/identity/handlers/passkey-handler.d.ts +52 -0
  10. package/dist/identity/handlers/sparklink-handler.d.ts +43 -0
  11. package/dist/identity/handlers/totp-handler.d.ts +52 -0
  12. package/dist/identity/index.d.ts +69 -0
  13. package/dist/identity/inline-container.d.ts +60 -0
  14. package/dist/identity/methods.d.ts +23 -0
  15. package/dist/identity/modal.d.ts +74 -0
  16. package/dist/identity/renderer.d.ts +97 -0
  17. package/dist/identity/state.d.ts +95 -0
  18. package/dist/identity/styles.d.ts +22 -0
  19. package/dist/identity/types.d.ts +183 -0
  20. package/dist/identity/utils/cooldown-timer.d.ts +73 -0
  21. package/dist/identity/utils/index.d.ts +5 -0
  22. package/dist/identity/utils.d.ts +27 -0
  23. package/dist/identity/views/base.d.ts +62 -0
  24. package/dist/identity/views/error.d.ts +25 -0
  25. package/dist/identity/views/icons.d.ts +34 -0
  26. package/dist/identity/views/identity-input.d.ts +48 -0
  27. package/dist/identity/views/index.d.ts +14 -0
  28. package/dist/identity/views/loading.d.ts +15 -0
  29. package/dist/identity/views/method-select.d.ts +29 -0
  30. package/dist/identity/views/passkey-prompt.d.ts +22 -0
  31. package/dist/identity/views/passkey.d.ts +38 -0
  32. package/dist/identity/views/sparklink-waiting.d.ts +33 -0
  33. package/dist/identity/views/totp-verify.d.ts +58 -0
  34. package/dist/index.d.ts +658 -0
  35. package/dist/logger.d.ts +45 -0
  36. package/dist/rng/index.d.ts +54 -0
  37. package/dist/rng/types.d.ts +26 -0
  38. package/dist/sparks/index.d.ts +37 -0
  39. package/dist/sparks/types.d.ts +56 -0
  40. package/dist/sparkvault.cjs.js +6152 -0
  41. package/dist/sparkvault.cjs.js.map +1 -0
  42. package/dist/sparkvault.esm.js +6137 -0
  43. package/dist/sparkvault.esm.js.map +1 -0
  44. package/dist/sparkvault.js +2 -0
  45. package/dist/sparkvault.js.map +1 -0
  46. package/dist/utils/base64url.d.ts +49 -0
  47. package/dist/utils/retry.d.ts +32 -0
  48. package/dist/vaults/index.d.ts +83 -0
  49. package/dist/vaults/types.d.ts +120 -0
  50. package/package.json +64 -0
@@ -0,0 +1,51 @@
1
+ /**
2
+ * SparkVault Auto-Initialization
3
+ *
4
+ * Enables zero-config initialization via script tag data attributes.
5
+ *
6
+ * @example
7
+ * ```html
8
+ * <script
9
+ * async
10
+ * src="https://cdn.sparkvault.com/sdk/v1/sparkvault.js"
11
+ * data-account-id="acc_your_account_id"
12
+ * data-attach-selector=".js-sparkvault-auth"
13
+ * data-success-url="https://example.com/auth/verify-token"
14
+ * data-error-function="handleSparkVaultError"
15
+ * data-debug="true"
16
+ * ></script>
17
+ * ```
18
+ *
19
+ * Supported attributes:
20
+ * - data-account-id: Account ID (required for auto-init)
21
+ * - data-attach-selector: CSS selector for elements to attach click handlers
22
+ * - data-success-url: URL to POST { token, identity } on successful verification
23
+ * - data-success-function: Global function name to call on success (receives { token, identity, identityType })
24
+ * - data-error-url: URL to redirect to on error (appends ?error=message)
25
+ * - data-error-function: Global function name to call on error (receives Error object)
26
+ * - data-debug: Set to "true" to enable verbose console logging
27
+ */
28
+ import type { SparkVault } from './index';
29
+ /** Auto-init configuration parsed from script tag attributes */
30
+ export interface AutoInitConfig {
31
+ accountId: string | null;
32
+ attachSelector: string | null;
33
+ successUrl: string | null;
34
+ successFunction: string | null;
35
+ errorUrl: string | null;
36
+ errorFunction: string | null;
37
+ debug: boolean;
38
+ preloadConfig: boolean;
39
+ timeout: number;
40
+ }
41
+ /**
42
+ * Initialize the SDK from script tag attributes
43
+ *
44
+ * Called automatically when the script loads.
45
+ * Requires SparkVault class to be passed in to avoid circular dependency.
46
+ */
47
+ export declare function autoInit(SparkVaultClass: typeof SparkVault): void;
48
+ /**
49
+ * Clean up auto-init resources
50
+ */
51
+ export declare function cleanup(): void;
@@ -0,0 +1,25 @@
1
+ /**
2
+ * SparkVault SDK Configuration
3
+ */
4
+ export interface SparkVaultConfig {
5
+ /** Account ID for Identity operations */
6
+ accountId: string;
7
+ /** Request timeout in milliseconds (default: 30000) */
8
+ timeout?: number;
9
+ /**
10
+ * Preload Identity configuration on SDK init (default: true).
11
+ * When enabled, the /config call is made immediately when the SDK initializes,
12
+ * so verify() opens instantly without waiting for the config fetch.
13
+ * Set to false to defer config loading until verify() is called.
14
+ */
15
+ preloadConfig?: boolean;
16
+ }
17
+ export interface ResolvedConfig {
18
+ accountId: string;
19
+ timeout: number;
20
+ apiBaseUrl: string;
21
+ identityBaseUrl: string;
22
+ preloadConfig: boolean;
23
+ }
24
+ export declare function resolveConfig(config: SparkVaultConfig): ResolvedConfig;
25
+ export declare function validateConfig(config: SparkVaultConfig): void;
@@ -0,0 +1,30 @@
1
+ /**
2
+ * SparkVault SDK Error Types
3
+ */
4
+ export declare class SparkVaultError extends Error {
5
+ readonly code: string;
6
+ readonly statusCode?: number;
7
+ readonly details?: Record<string, unknown>;
8
+ constructor(message: string, code: string, statusCode?: number, details?: Record<string, unknown>);
9
+ }
10
+ export declare class AuthenticationError extends SparkVaultError {
11
+ constructor(message: string, details?: Record<string, unknown>);
12
+ }
13
+ export declare class AuthorizationError extends SparkVaultError {
14
+ constructor(message: string, details?: Record<string, unknown>);
15
+ }
16
+ export declare class ValidationError extends SparkVaultError {
17
+ constructor(message: string, details?: Record<string, unknown>);
18
+ }
19
+ export declare class NetworkError extends SparkVaultError {
20
+ constructor(message: string, details?: Record<string, unknown>);
21
+ }
22
+ export declare class TimeoutError extends SparkVaultError {
23
+ constructor(message?: string);
24
+ }
25
+ export declare class UserCancelledError extends SparkVaultError {
26
+ constructor(message?: string);
27
+ }
28
+ export declare class PopupBlockedError extends SparkVaultError {
29
+ constructor();
30
+ }
package/dist/http.d.ts ADDED
@@ -0,0 +1,48 @@
1
+ /**
2
+ * SparkVault SDK HTTP Client
3
+ */
4
+ import type { ResolvedConfig } from './config';
5
+ import { type RetryOptions } from './utils/retry';
6
+ export interface RequestOptions {
7
+ method?: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
8
+ headers?: Record<string, string>;
9
+ body?: unknown;
10
+ timeout?: number;
11
+ /** Enable automatic retry with exponential backoff (per CLAUDE.md §7) */
12
+ retry?: boolean | RetryOptions;
13
+ }
14
+ export interface ApiResponse<T = unknown> {
15
+ data: T;
16
+ status: number;
17
+ headers: Headers;
18
+ }
19
+ export declare class HttpClient {
20
+ private readonly config;
21
+ constructor(config: ResolvedConfig);
22
+ request<T = unknown>(path: string, options?: RequestOptions): Promise<ApiResponse<T>>;
23
+ /**
24
+ * Execute the actual HTTP request (internal implementation)
25
+ */
26
+ private executeRequest;
27
+ /**
28
+ * Check if an error is safe to retry
29
+ * Per CLAUDE.md §7: Only retry on transient/network errors, not client errors
30
+ */
31
+ private isRetryableError;
32
+ private parseResponse;
33
+ private createErrorFromResponse;
34
+ get<T = unknown>(path: string, options?: Omit<RequestOptions, 'method' | 'body'>): Promise<ApiResponse<T>>;
35
+ post<T = unknown>(path: string, body?: unknown, options?: Omit<RequestOptions, 'method'>): Promise<ApiResponse<T>>;
36
+ put<T = unknown>(path: string, body?: unknown, options?: Omit<RequestOptions, 'method'>): Promise<ApiResponse<T>>;
37
+ patch<T = unknown>(path: string, body?: unknown, options?: Omit<RequestOptions, 'method'>): Promise<ApiResponse<T>>;
38
+ delete<T = unknown>(path: string, options?: Omit<RequestOptions, 'method' | 'body'>): Promise<ApiResponse<T>>;
39
+ /**
40
+ * Request raw binary data (e.g., file downloads).
41
+ * Returns a Blob instead of parsed JSON.
42
+ */
43
+ requestRaw(path: string, options?: RequestOptions): Promise<Blob>;
44
+ /**
45
+ * Execute the actual raw HTTP request (internal implementation)
46
+ */
47
+ private executeRequestRaw;
48
+ }
@@ -0,0 +1,101 @@
1
+ /**
2
+ * Identity API Client
3
+ *
4
+ * Handles all HTTP communication with the Identity App endpoints.
5
+ * Single responsibility: API calls only.
6
+ */
7
+ import type { ResolvedConfig } from '../config';
8
+ import type { SdkConfig, TotpSendResponse, TotpVerifyResponse, PasskeyChallengeResponse, PasskeyVerifyResponse, SparkLinkSendResponse, SparkLinkStatusResponse } from './types';
9
+ export declare class IdentityApi {
10
+ private readonly config;
11
+ private readonly timeoutMs;
12
+ /** Cached config promise - allows preloading and deduplication */
13
+ private configCache;
14
+ constructor(config: ResolvedConfig, timeoutMs?: number);
15
+ private get baseUrl();
16
+ private request;
17
+ /**
18
+ * Fetch SDK configuration (branding, enabled methods).
19
+ * Uses caching to avoid redundant requests - safe to call multiple times.
20
+ */
21
+ getConfig(): Promise<SdkConfig>;
22
+ /**
23
+ * Preload the SDK configuration in the background.
24
+ * Called on SDK init when preloadConfig is enabled.
25
+ * The result is cached and used when verify() is called.
26
+ */
27
+ preloadConfig(): void;
28
+ /**
29
+ * Check if config has been preloaded and is ready.
30
+ */
31
+ isConfigPreloaded(): boolean;
32
+ /**
33
+ * Check if an email has registered passkeys and validate email domain
34
+ *
35
+ * Returns:
36
+ * - email_valid: whether the email domain has valid MX records
37
+ * - hasPasskey: whether any passkeys are registered (only meaningful if email_valid)
38
+ */
39
+ checkPasskey(email: string): Promise<{
40
+ email_valid: boolean;
41
+ hasPasskey: boolean;
42
+ }>;
43
+ /**
44
+ * Send TOTP code to email or phone
45
+ */
46
+ sendTotp(params: {
47
+ recipient: string;
48
+ method: 'email' | 'sms' | 'voice';
49
+ }): Promise<TotpSendResponse>;
50
+ /**
51
+ * Verify TOTP code
52
+ */
53
+ verifyTotp(params: {
54
+ kindling: string;
55
+ pin: string;
56
+ recipient: string;
57
+ }): Promise<TotpVerifyResponse>;
58
+ /**
59
+ * Start passkey registration
60
+ */
61
+ startPasskeyRegister(email: string): Promise<PasskeyChallengeResponse>;
62
+ /**
63
+ * Complete passkey registration
64
+ */
65
+ completePasskeyRegister(params: {
66
+ email: string;
67
+ credential: PublicKeyCredential;
68
+ }): Promise<PasskeyVerifyResponse>;
69
+ /**
70
+ * Start passkey verification
71
+ */
72
+ startPasskeyVerify(email: string): Promise<PasskeyChallengeResponse>;
73
+ /**
74
+ * Complete passkey verification
75
+ */
76
+ completePasskeyVerify(params: {
77
+ email: string;
78
+ credential: PublicKeyCredential;
79
+ }): Promise<PasskeyVerifyResponse>;
80
+ /**
81
+ * Get OAuth redirect URL for social provider
82
+ */
83
+ getSocialAuthUrl(provider: string, redirectUri: string, state: string): string;
84
+ /**
85
+ * Get SAML redirect URL for enterprise provider
86
+ */
87
+ getEnterpriseAuthUrl(provider: string, redirectUri: string, state: string): string;
88
+ /**
89
+ * Send SparkLink email for identity verification
90
+ */
91
+ sendSparkLink(email: string): Promise<SparkLinkSendResponse>;
92
+ /**
93
+ * Check SparkLink verification status (polling endpoint)
94
+ */
95
+ checkSparkLinkStatus(sparkId: string): Promise<SparkLinkStatusResponse>;
96
+ }
97
+ export declare class IdentityApiError extends Error {
98
+ readonly code: string;
99
+ readonly statusCode: number;
100
+ constructor(message: string, code: string, statusCode: number);
101
+ }
@@ -0,0 +1,49 @@
1
+ /**
2
+ * Container Interface
3
+ *
4
+ * Abstract interface for identity UI containers.
5
+ * Allows switching between modal (popup) and inline rendering modes
6
+ * while reusing all view logic, state management, and handlers.
7
+ */
8
+ import type { SdkConfigBranding } from './types';
9
+ /**
10
+ * Container options for initialization.
11
+ */
12
+ export interface ContainerOptions {
13
+ branding?: SdkConfigBranding;
14
+ /** Enable backdrop blur (modal only) */
15
+ backdropBlur?: boolean;
16
+ }
17
+ /**
18
+ * Container interface that both ModalContainer and InlineContainer implement.
19
+ * The renderer interacts with containers through this interface.
20
+ */
21
+ export interface Container {
22
+ /**
23
+ * Create the container with loading state.
24
+ * Called immediately when verification starts.
25
+ */
26
+ createLoading(options: {
27
+ backdropBlur?: boolean;
28
+ }, onClose: () => void): void;
29
+ /**
30
+ * Update branding after SDK config loads.
31
+ */
32
+ updateBranding(branding: SdkConfigBranding): void;
33
+ /**
34
+ * Update backdrop blur setting (may be no-op for inline container).
35
+ */
36
+ updateBackdropBlur(enabled: boolean): void;
37
+ /**
38
+ * Get the body element where views are rendered.
39
+ */
40
+ getBody(): HTMLDivElement | null;
41
+ /**
42
+ * Check if the container is currently active.
43
+ */
44
+ isOpen(): boolean;
45
+ /**
46
+ * Destroy the container and clean up event listeners.
47
+ */
48
+ destroy(): void;
49
+ }
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Identity Handlers
3
+ *
4
+ * Extracted handlers for specific authentication flows.
5
+ * Each handler has a single responsibility.
6
+ */
7
+ export { PasskeyHandler, type PasskeyResult, type PasskeyCheckResult } from './passkey-handler';
8
+ export { TotpHandler, type TotpSendResult, type TotpVerifyResult } from './totp-handler';
9
+ export { SparkLinkHandler, type SparkLinkSendResult, type SparkLinkStatusResult } from './sparklink-handler';
@@ -0,0 +1,52 @@
1
+ /**
2
+ * Passkey Handler
3
+ *
4
+ * Single responsibility: WebAuthn passkey registration and verification.
5
+ * Extracts passkey logic from IdentityRenderer for better separation of concerns.
6
+ */
7
+ import type { IdentityApi } from '../api';
8
+ import type { VerifyResult } from '../types';
9
+ import type { VerificationState } from '../state';
10
+ /**
11
+ * Result of passkey operation
12
+ */
13
+ export interface PasskeyResult {
14
+ success: boolean;
15
+ result?: VerifyResult;
16
+ error?: string;
17
+ errorType?: 'cancelled' | 'not_found' | 'not_allowed' | 'unknown';
18
+ }
19
+ /**
20
+ * Result of passkey check operation
21
+ */
22
+ export interface PasskeyCheckResult {
23
+ /** Whether the email domain is valid (has MX records) */
24
+ emailValid: boolean;
25
+ /** Whether the user has registered passkeys (only meaningful if emailValid is true) */
26
+ hasPasskey: boolean;
27
+ }
28
+ /**
29
+ * Handles WebAuthn passkey registration and verification
30
+ */
31
+ export declare class PasskeyHandler {
32
+ private readonly api;
33
+ private readonly state;
34
+ constructor(api: IdentityApi, state: VerificationState);
35
+ /**
36
+ * Check if user has registered passkeys and validate email domain
37
+ * @returns Check result with emailValid and hasPasskey, or null on error
38
+ */
39
+ checkPasskey(): Promise<PasskeyCheckResult | null>;
40
+ /**
41
+ * Register a new passkey for the user
42
+ */
43
+ register(): Promise<PasskeyResult>;
44
+ /**
45
+ * Verify user with existing passkey
46
+ */
47
+ verify(): Promise<PasskeyResult>;
48
+ /**
49
+ * Handle WebAuthn errors and categorize them
50
+ */
51
+ private handleError;
52
+ }
@@ -0,0 +1,43 @@
1
+ /**
2
+ * SparkLink Handler
3
+ *
4
+ * Single responsibility: SparkLink (magic link) sending and status polling.
5
+ * Extracts SparkLink logic from IdentityRenderer for better separation of concerns.
6
+ */
7
+ import type { IdentityApi } from '../api';
8
+ import type { VerificationState } from '../state';
9
+ /**
10
+ * Result of SparkLink send operation
11
+ */
12
+ export interface SparkLinkSendResult {
13
+ success: boolean;
14
+ sparkId?: string;
15
+ expiresAt?: number;
16
+ error?: string;
17
+ }
18
+ /**
19
+ * Result of SparkLink status check
20
+ */
21
+ export interface SparkLinkStatusResult {
22
+ verified: boolean;
23
+ token?: string;
24
+ identity?: string;
25
+ identityType?: string;
26
+ }
27
+ /**
28
+ * Handles SparkLink (magic link) sending and verification polling
29
+ */
30
+ export declare class SparkLinkHandler {
31
+ private readonly api;
32
+ private readonly state;
33
+ constructor(api: IdentityApi, state: VerificationState);
34
+ /**
35
+ * Send SparkLink to the user's email
36
+ */
37
+ send(): Promise<SparkLinkSendResult>;
38
+ /**
39
+ * Check SparkLink verification status
40
+ * Called periodically by the renderer to poll for completion
41
+ */
42
+ checkStatus(sparkId: string): Promise<SparkLinkStatusResult>;
43
+ }
@@ -0,0 +1,52 @@
1
+ /**
2
+ * TOTP Handler
3
+ *
4
+ * Single responsibility: TOTP code sending and verification.
5
+ * Extracts TOTP logic from IdentityRenderer for better separation of concerns.
6
+ */
7
+ import type { IdentityApi } from '../api';
8
+ import type { VerifyResult } from '../types';
9
+ import type { VerificationState } from '../state';
10
+ /**
11
+ * Result of TOTP send operation
12
+ */
13
+ export interface TotpSendResult {
14
+ success: boolean;
15
+ kindling?: string;
16
+ expiresAt?: number;
17
+ error?: string;
18
+ }
19
+ /**
20
+ * Result of TOTP verify operation
21
+ */
22
+ export interface TotpVerifyResult {
23
+ success: boolean;
24
+ result?: VerifyResult;
25
+ /** New kindling if verification failed (for retry) */
26
+ newKindling?: string;
27
+ /** Seconds until retry allowed (rate limiting) */
28
+ retryAfter?: number;
29
+ /** When backoff expires (Unix timestamp) */
30
+ backoffExpires?: number;
31
+ error?: string;
32
+ }
33
+ /**
34
+ * Handles TOTP code sending and verification
35
+ */
36
+ export declare class TotpHandler {
37
+ private readonly api;
38
+ private readonly state;
39
+ constructor(api: IdentityApi, state: VerificationState);
40
+ /**
41
+ * Send TOTP code via email or SMS
42
+ */
43
+ send(method: 'email' | 'sms'): Promise<TotpSendResult>;
44
+ /**
45
+ * Resend TOTP code
46
+ */
47
+ resend(): Promise<TotpSendResult>;
48
+ /**
49
+ * Verify TOTP code
50
+ */
51
+ verify(code: string): Promise<TotpVerifyResult>;
52
+ }
@@ -0,0 +1,69 @@
1
+ /**
2
+ * Identity Module
3
+ *
4
+ * Provides identity verification through a DOM-based modal interface.
5
+ * Supports passkey, TOTP, magic link, and social authentication.
6
+ */
7
+ import type { ResolvedConfig } from '../config';
8
+ import type { VerifyOptions, VerifyResult, TokenClaims, RenderOptions } from './types';
9
+ export declare class IdentityModule {
10
+ private readonly config;
11
+ private readonly api;
12
+ private renderer;
13
+ constructor(config: ResolvedConfig);
14
+ /**
15
+ * Open the identity verification modal (popup).
16
+ * Returns when user successfully verifies their identity.
17
+ *
18
+ * @example
19
+ * const result = await sv.identity.pop({
20
+ * email: 'user@example.com'
21
+ * });
22
+ * console.log(result.token, result.identity, result.identityType);
23
+ */
24
+ pop(options?: VerifyOptions): Promise<VerifyResult>;
25
+ /**
26
+ * Render identity verification inline within a target element.
27
+ * Unlike verify() which opens a modal popup, this embeds the UI
28
+ * directly into the specified element.
29
+ *
30
+ * @example
31
+ * // Render in a div
32
+ * const result = await sv.identity.render({
33
+ * target: document.getElementById('auth-container'),
34
+ * email: 'user@example.com'
35
+ * });
36
+ *
37
+ * @example
38
+ * // Render in a custom dialog without header/footer
39
+ * const result = await sv.identity.render({
40
+ * target: dialogContentElement,
41
+ * showHeader: false,
42
+ * showFooter: false
43
+ * });
44
+ */
45
+ render(options: RenderOptions): Promise<VerifyResult>;
46
+ /**
47
+ * Verify and decode an identity token.
48
+ * Validates the token structure, expiry, and issuer.
49
+ *
50
+ * Note: For production use, verify the Ed25519 signature server-side
51
+ * using the JWKS endpoint.
52
+ *
53
+ * @example
54
+ * const claims = await sv.identity.verifyToken(token);
55
+ * console.log(claims.identity, claims.identity_type, claims.method);
56
+ */
57
+ verifyToken(token: string): Promise<TokenClaims>;
58
+ /**
59
+ * Close the identity modal if open.
60
+ */
61
+ close(): void;
62
+ /**
63
+ * @deprecated Use `pop()` instead. Will be removed in v2.0.
64
+ */
65
+ verify(options?: VerifyOptions): Promise<VerifyResult>;
66
+ }
67
+ export type { VerifyOptions, RenderOptions, VerifyResult, TokenClaims, AuthMethod, Theme, SdkConfig, SdkConfigBranding, MethodId, MethodMetadata, } from './types';
68
+ export { METHOD_REGISTRY, getMethodMetadata, enrichMethods } from './methods';
69
+ export { IdentityApi, IdentityApiError } from './api';
@@ -0,0 +1,60 @@
1
+ /**
2
+ * Inline Container
3
+ *
4
+ * Renders identity verification UI inline within a target element.
5
+ * Unlike ModalContainer which creates an overlay popup, this embeds
6
+ * directly into the customer's page/dialog where render() was called.
7
+ *
8
+ * Implements the Container interface for use with IdentityRenderer.
9
+ */
10
+ import type { Container } from './container';
11
+ import type { SdkConfigBranding } from './types';
12
+ export interface InlineContainerOptions {
13
+ /** Show header with branding and optional close button */
14
+ showHeader?: boolean;
15
+ /** Show close button in header (requires showHeader) */
16
+ showCloseButton?: boolean;
17
+ /** Show footer with SparkVault branding */
18
+ showFooter?: boolean;
19
+ }
20
+ export declare class InlineContainer implements Container {
21
+ private readonly targetElement;
22
+ private readonly containerOptions;
23
+ private container;
24
+ private header;
25
+ private body;
26
+ private footer;
27
+ private closeBtn;
28
+ private onCloseCallback;
29
+ private closeBtnClickHandler;
30
+ private effectiveTheme;
31
+ constructor(targetElement: HTMLElement, options?: InlineContainerOptions);
32
+ /**
33
+ * Create the inline container with loading state.
34
+ */
35
+ createLoading(_options: {
36
+ backdropBlur?: boolean;
37
+ }, onClose: () => void): void;
38
+ /**
39
+ * Update branding after SDK config loads.
40
+ */
41
+ updateBranding(branding: SdkConfigBranding): void;
42
+ /**
43
+ * Update backdrop blur setting (no-op for inline container).
44
+ */
45
+ updateBackdropBlur(_enabled: boolean): void;
46
+ /**
47
+ * Get the body element for content rendering.
48
+ */
49
+ getBody(): HTMLDivElement | null;
50
+ /**
51
+ * Check if the container is currently active.
52
+ */
53
+ isOpen(): boolean;
54
+ /**
55
+ * Destroy the container and clean up.
56
+ */
57
+ destroy(): void;
58
+ private createHeader;
59
+ private handleClose;
60
+ }
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Method Registry
3
+ *
4
+ * Static metadata for all authentication methods.
5
+ * API returns method IDs; SDK enriches with this metadata for rendering.
6
+ */
7
+ import type { MethodId, MethodMetadata } from './types';
8
+ /**
9
+ * Static method metadata registry
10
+ */
11
+ export declare const METHOD_REGISTRY: Record<MethodId, MethodMetadata>;
12
+ /**
13
+ * Get method metadata by ID
14
+ * @param id - Method ID from config
15
+ * @returns Method metadata or undefined if not found
16
+ */
17
+ export declare function getMethodMetadata(id: MethodId): MethodMetadata | undefined;
18
+ /**
19
+ * Enrich method IDs with full metadata
20
+ * @param ids - Array of method IDs from config
21
+ * @returns Array of method metadata objects
22
+ */
23
+ export declare function enrichMethods(ids: MethodId[]): MethodMetadata[];