@transmitsecurity/platform-web-sdk 1.15.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 (74) hide show
  1. package/CHANGELOG.md +479 -0
  2. package/README.md +72 -0
  3. package/VITE_CONFIG.md +107 -0
  4. package/build/drs-entry.d.ts +20 -0
  5. package/build/drs-entry.js +19 -0
  6. package/build/drs-only.d.ts +22 -0
  7. package/build/drs-only.js +25 -0
  8. package/build/drs.d.ts +13 -0
  9. package/build/drs.js +45 -0
  10. package/build/ido-entry.d.ts +17 -0
  11. package/build/ido-entry.js +19 -0
  12. package/build/ido.d.ts +8 -0
  13. package/build/ido.js +27 -0
  14. package/build/idv-entry.d.ts +17 -0
  15. package/build/idv-entry.js +19 -0
  16. package/build/idv.d.ts +8 -0
  17. package/build/idv.js +27 -0
  18. package/build/initialize-only.d.ts +7 -0
  19. package/build/initialize-only.js +40 -0
  20. package/build/initialize.d.ts +1 -0
  21. package/build/initialize.js +2 -0
  22. package/build/mainExport.d.ts +16 -0
  23. package/build/mainExport.js +43 -0
  24. package/build/sdk-factory.d.ts +109 -0
  25. package/build/sdk-factory.js +108 -0
  26. package/build/shared-state.d.ts +4 -0
  27. package/build/shared-state.js +32 -0
  28. package/build/webauthn-entry.d.ts +19 -0
  29. package/build/webauthn-entry.js +19 -0
  30. package/build/webauthn.d.ts +12 -0
  31. package/build/webauthn.js +44 -0
  32. package/bundler-config.json +15 -0
  33. package/dist/docs/.nojekyll +1 -0
  34. package/dist/docs/README.md +72 -0
  35. package/dist/docs/enums/ErrorCode.md +113 -0
  36. package/dist/docs/interfaces/ActionEventOptions.md +44 -0
  37. package/dist/docs/interfaces/ActionResponse.md +9 -0
  38. package/dist/docs/interfaces/AuthenticationAutofillActivateHandlers.md +61 -0
  39. package/dist/docs/interfaces/AutofillHandlers.md +50 -0
  40. package/dist/docs/interfaces/CrossDeviceController.md +27 -0
  41. package/dist/docs/interfaces/SdkError.md +28 -0
  42. package/dist/docs/interfaces/WebauthnApis.md +73 -0
  43. package/dist/docs/interfaces/WebauthnAuthenticationFlows.md +52 -0
  44. package/dist/docs/interfaces/WebauthnCrossDeviceFlows.md +107 -0
  45. package/dist/docs/interfaces/WebauthnCrossDeviceRegistrationOptions.md +23 -0
  46. package/dist/docs/interfaces/WebauthnRegistrationOptions.md +55 -0
  47. package/dist/docs/interfaces/initConfigParams.md +7 -0
  48. package/dist/docs/modules/drs.md +92 -0
  49. package/dist/docs/modules/idv.md +106 -0
  50. package/dist/docs/modules/webauthn.md +197 -0
  51. package/dist/docs/modules.md +146 -0
  52. package/dist/drs.cjs +1 -0
  53. package/dist/drs.d.ts +241 -0
  54. package/dist/drs.js +1 -0
  55. package/dist/ido.cjs +1 -0
  56. package/dist/ido.d.ts +8 -0
  57. package/dist/ido.js +1 -0
  58. package/dist/idv.cjs +1 -0
  59. package/dist/idv.d.ts +68 -0
  60. package/dist/idv.js +1 -0
  61. package/dist/index.cjs +1 -0
  62. package/dist/index.esm.js +1 -0
  63. package/dist/index.umd.js +1 -0
  64. package/dist/ts-platform-websdk.js +1 -0
  65. package/dist/web-sdk-drs+idv+webauthn+ido.js +1 -0
  66. package/dist/web-sdk.d.ts +1737 -0
  67. package/dist/webauthn.cjs +1 -0
  68. package/dist/webauthn.d.ts +461 -0
  69. package/dist/webauthn.js +1 -0
  70. package/package.json +98 -0
  71. package/scripts/make-semver-aliases.sh +11 -0
  72. package/scripts/upload-dist.sh +6 -0
  73. package/src/mainExport.ts +75 -0
  74. package/src/tsconfig.json +14 -0
@@ -0,0 +1,22 @@
1
+ import * as drsModule from './drs';
2
+ export interface SDKConfig {
3
+ clientId: string;
4
+ serverPath?: string;
5
+ drs?: {
6
+ serverPath?: string;
7
+ verbose?: boolean;
8
+ enableSessionToken?: boolean;
9
+ };
10
+ }
11
+ /**
12
+ * šŸš€ **WebSDK** - DRS Only
13
+ * Perfect tree-shaking with only DRS module (~219KB)
14
+ */
15
+ export declare class WebSDK {
16
+ /**
17
+ * šŸŽÆ **DRS (Device Risk & Security)** (~219KB bundle)
18
+ * Perfect for fraud detection and risk assessment
19
+ */
20
+ static drs(config: SDKConfig): Promise<typeof drsModule>;
21
+ }
22
+ export declare const PACKAGE_VERSION = "1.15.0";
@@ -0,0 +1,25 @@
1
+ // šŸŽÆ DRS-Only Entry Point for Perfect Tree-Shaking
2
+ import { initialize } from './initialize-only';
3
+ import * as drsModule from './drs';
4
+ /**
5
+ * šŸš€ **WebSDK** - DRS Only
6
+ * Perfect tree-shaking with only DRS module (~219KB)
7
+ */
8
+ export class WebSDK {
9
+ /**
10
+ * šŸŽÆ **DRS (Device Risk & Security)** (~219KB bundle)
11
+ * Perfect for fraud detection and risk assessment
12
+ */
13
+ static async drs(config) {
14
+ // āœ… Validation
15
+ if (!config.clientId) {
16
+ throw new Error('āŒ clientId is required');
17
+ }
18
+ // šŸ”§ Initialize core
19
+ await initialize(config);
20
+ // šŸ”„ Return DRS module
21
+ return drsModule;
22
+ }
23
+ }
24
+ // Export version for compatibility
25
+ export const PACKAGE_VERSION = '1.15.0';
package/build/drs.d.ts ADDED
@@ -0,0 +1,13 @@
1
+ declare global {
2
+ interface Window {
3
+ __TS_WEB_SDK_INITIALIZED__?: boolean;
4
+ __TS_WEB_SDK_CONFIG__?: any;
5
+ }
6
+ }
7
+ export { initialize } from './initialize-only';
8
+ export * from '@transmit-security/riskid_sdk';
9
+ export declare const triggerActionEvent: (...args: any[]) => any;
10
+ export declare const setUser: (...args: any[]) => any;
11
+ export declare const setAuthenticatedUser: (...args: any[]) => any;
12
+ export declare const clearUser: (...args: any[]) => any;
13
+ export type { ActionEventOptions, ActionResponse } from "@transmit-security/riskid_sdk";
package/build/drs.js ADDED
@@ -0,0 +1,45 @@
1
+ // DRS module - clean entry point with global state awareness
2
+ import { setInitConfig, getInitConfig } from '@transmit-security/web-sdk-common/dist/module-metadata/module-metadata';
3
+ import { emit } from '@transmit-security/web-sdk-common/dist/events';
4
+ import { MODULE_INITIALIZED } from '@transmit-security/web-sdk-common/dist/events';
5
+ // Function to sync global initialization state when needed
6
+ function ensureInitialized() {
7
+ if (typeof window !== 'undefined' && window.__TS_WEB_SDK_INITIALIZED__ && window.__TS_WEB_SDK_CONFIG__) {
8
+ try {
9
+ const currentConfig = getInitConfig();
10
+ if (!currentConfig || !currentConfig.clientId) {
11
+ console.log('šŸ”„ Syncing global initialization state to DRS module');
12
+ setInitConfig(window.__TS_WEB_SDK_CONFIG__);
13
+ emit(MODULE_INITIALIZED, undefined);
14
+ return true;
15
+ }
16
+ return true;
17
+ }
18
+ catch (error) {
19
+ // If getInitConfig fails, it means common module is not initialized
20
+ console.log('šŸ”„ Initializing DRS module with global state');
21
+ setInitConfig(window.__TS_WEB_SDK_CONFIG__);
22
+ emit(MODULE_INITIALIZED, undefined);
23
+ return true;
24
+ }
25
+ }
26
+ return false;
27
+ }
28
+ // Import the original RiskID SDK
29
+ import * as originalDRS from '@transmit-security/riskid_sdk';
30
+ // Create wrapper functions for the main DRS methods
31
+ function wrapDRSMethod(methodName, originalMethod) {
32
+ return function (...args) {
33
+ ensureInitialized();
34
+ return originalMethod.apply(originalDRS, args);
35
+ };
36
+ }
37
+ // Re-export initialize to ensure shared state
38
+ export { initialize } from './initialize-only';
39
+ // Export all DRS functionality (re-export everything)
40
+ export * from '@transmit-security/riskid_sdk';
41
+ // Override the main methods with wrapped versions
42
+ export const triggerActionEvent = wrapDRSMethod('triggerActionEvent', originalDRS.triggerActionEvent);
43
+ export const setUser = wrapDRSMethod('setUser', originalDRS.setUser);
44
+ export const setAuthenticatedUser = wrapDRSMethod('setAuthenticatedUser', originalDRS.setAuthenticatedUser);
45
+ export const clearUser = wrapDRSMethod('clearUser', originalDRS.clearUser);
@@ -0,0 +1,17 @@
1
+ export interface IDOModule {
2
+ executeFlow: (flowId: string, options?: any) => Promise<any>;
3
+ getFlowStatus: (executionId: string) => Promise<any>;
4
+ }
5
+ export interface SDKConfig {
6
+ clientId: string;
7
+ serverPath?: string;
8
+ ido?: {
9
+ serverPath?: string;
10
+ };
11
+ }
12
+ /**
13
+ * šŸ”„ **IDO (Identity Orchestration)** (~2KB bundle)
14
+ * Perfect for orchestration workflows
15
+ */
16
+ export declare function createIDO(config: SDKConfig): Promise<any>;
17
+ export { createIDO as ido };
@@ -0,0 +1,19 @@
1
+ // šŸ”„ IDO-Only Entry Point for Perfect Tree-Shaking
2
+ import { initialize } from './initialize-only';
3
+ import * as idoModule from './ido';
4
+ /**
5
+ * šŸ”„ **IDO (Identity Orchestration)** (~2KB bundle)
6
+ * Perfect for orchestration workflows
7
+ */
8
+ export async function createIDO(config) {
9
+ // āœ… Validation
10
+ if (!config.clientId) {
11
+ throw new Error('āŒ clientId is required');
12
+ }
13
+ // šŸ”§ Initialize core
14
+ await initialize(config);
15
+ // šŸ”„ Return IDO module
16
+ return idoModule;
17
+ }
18
+ // Export for WebSDK class compatibility
19
+ export { createIDO as ido };
package/build/ido.d.ts ADDED
@@ -0,0 +1,8 @@
1
+ declare global {
2
+ interface Window {
3
+ __TS_WEB_SDK_INITIALIZED__?: boolean;
4
+ __TS_WEB_SDK_CONFIG__?: any;
5
+ }
6
+ }
7
+ export { initialize } from './initialize-only';
8
+ export * from '@transmit-security/ido-web-sdk';
package/build/ido.js ADDED
@@ -0,0 +1,27 @@
1
+ // IDO module - clean entry point with global state awareness
2
+ import { setInitConfig, getInitConfig } from '@transmit-security/web-sdk-common/dist/module-metadata/module-metadata';
3
+ import { emit } from '@transmit-security/web-sdk-common/dist/events';
4
+ import { MODULE_INITIALIZED } from '@transmit-security/web-sdk-common/dist/events';
5
+ // Check for global initialization state and sync with common module on import
6
+ (function syncGlobalInitialization() {
7
+ if (typeof window !== 'undefined' && window.__TS_WEB_SDK_INITIALIZED__ && window.__TS_WEB_SDK_CONFIG__) {
8
+ try {
9
+ const currentConfig = getInitConfig();
10
+ if (!currentConfig || !currentConfig.clientId) {
11
+ console.log('šŸ”„ Syncing global initialization state to IDO module');
12
+ setInitConfig(window.__TS_WEB_SDK_CONFIG__);
13
+ emit(MODULE_INITIALIZED, undefined);
14
+ }
15
+ }
16
+ catch (error) {
17
+ // If getInitConfig fails, it means common module is not initialized
18
+ console.log('šŸ”„ Initializing IDO module with global state');
19
+ setInitConfig(window.__TS_WEB_SDK_CONFIG__);
20
+ emit(MODULE_INITIALIZED, undefined);
21
+ }
22
+ }
23
+ })();
24
+ // Re-export initialize to ensure shared state
25
+ export { initialize } from './initialize-only';
26
+ // Export all IDO functionality
27
+ export * from '@transmit-security/ido-web-sdk';
@@ -0,0 +1,17 @@
1
+ export interface IDVModule {
2
+ startVerification: (options: any) => Promise<any>;
3
+ getVerificationStatus: (sessionId: string) => Promise<any>;
4
+ }
5
+ export interface SDKConfig {
6
+ clientId: string;
7
+ serverPath?: string;
8
+ idv?: {
9
+ serverPath?: string;
10
+ };
11
+ }
12
+ /**
13
+ * šŸ†” **IDV (Identity Verification)** (~589KB bundle)
14
+ * Perfect for identity verification flows
15
+ */
16
+ export declare function createIDV(config: SDKConfig): Promise<any>;
17
+ export { createIDV as idv };
@@ -0,0 +1,19 @@
1
+ // šŸ†” IDV-Only Entry Point for Perfect Tree-Shaking
2
+ import { initialize } from './initialize-only';
3
+ import * as idvModule from './idv';
4
+ /**
5
+ * šŸ†” **IDV (Identity Verification)** (~589KB bundle)
6
+ * Perfect for identity verification flows
7
+ */
8
+ export async function createIDV(config) {
9
+ // āœ… Validation
10
+ if (!config.clientId) {
11
+ throw new Error('āŒ clientId is required');
12
+ }
13
+ // šŸ”§ Initialize core
14
+ await initialize(config);
15
+ // šŸ”„ Return IDV module
16
+ return idvModule;
17
+ }
18
+ // Export for WebSDK class compatibility
19
+ export { createIDV as idv };
package/build/idv.d.ts ADDED
@@ -0,0 +1,8 @@
1
+ declare global {
2
+ interface Window {
3
+ __TS_WEB_SDK_INITIALIZED__?: boolean;
4
+ __TS_WEB_SDK_CONFIG__?: any;
5
+ }
6
+ }
7
+ export { initialize } from './initialize-only';
8
+ export * from '@transmit-security/ts-identity-verification';
package/build/idv.js ADDED
@@ -0,0 +1,27 @@
1
+ // IDV module - clean entry point with global state awareness
2
+ import { setInitConfig, getInitConfig } from '@transmit-security/web-sdk-common/dist/module-metadata/module-metadata';
3
+ import { emit } from '@transmit-security/web-sdk-common/dist/events';
4
+ import { MODULE_INITIALIZED } from '@transmit-security/web-sdk-common/dist/events';
5
+ // Check for global initialization state and sync with common module on import
6
+ (function syncGlobalInitialization() {
7
+ if (typeof window !== 'undefined' && window.__TS_WEB_SDK_INITIALIZED__ && window.__TS_WEB_SDK_CONFIG__) {
8
+ try {
9
+ const currentConfig = getInitConfig();
10
+ if (!currentConfig || !currentConfig.clientId) {
11
+ console.log('šŸ”„ Syncing global initialization state to IDV module');
12
+ setInitConfig(window.__TS_WEB_SDK_CONFIG__);
13
+ emit(MODULE_INITIALIZED, undefined);
14
+ }
15
+ }
16
+ catch (error) {
17
+ // If getInitConfig fails, it means common module is not initialized
18
+ console.log('šŸ”„ Initializing IDV module with global state');
19
+ setInitConfig(window.__TS_WEB_SDK_CONFIG__);
20
+ emit(MODULE_INITIALIZED, undefined);
21
+ }
22
+ }
23
+ })();
24
+ // Re-export initialize to ensure shared state
25
+ export { initialize } from './initialize-only';
26
+ // Export all IDV functionality
27
+ export * from '@transmit-security/ts-identity-verification';
@@ -0,0 +1,7 @@
1
+ declare global {
2
+ interface Window {
3
+ __TS_WEB_SDK_INITIALIZED__?: boolean;
4
+ __TS_WEB_SDK_CONFIG__?: any;
5
+ }
6
+ }
7
+ export declare function initialize(config: any): Promise<void>;
@@ -0,0 +1,40 @@
1
+ // Minimal initialize module - only initialization logic
2
+ import { setInitConfig } from '@transmit-security/web-sdk-common/dist/module-metadata/module-metadata';
3
+ import { emit } from '@transmit-security/web-sdk-common/dist/events';
4
+ import { MODULE_INITIALIZED } from '@transmit-security/web-sdk-common/dist/events';
5
+ // Browser Environment Validation (run once globally)
6
+ (function validateBrowserEnvironment() {
7
+ var _a, _b;
8
+ const isBrowser = typeof window !== 'undefined' && typeof document !== 'undefined';
9
+ const isNode = typeof globalThis !== 'undefined' &&
10
+ typeof globalThis.process !== 'undefined' &&
11
+ ((_b = (_a = globalThis.process) === null || _a === void 0 ? void 0 : _a.versions) === null || _b === void 0 ? void 0 : _b.node);
12
+ if (isNode && !isBrowser) {
13
+ throw new Error('\n🚫 @TransmitSecurity/web-sdk is a BROWSER-ONLY package.\n\n' +
14
+ 'āŒ Node.js environments are not supported.\n' +
15
+ 'āœ… Use this package in web browsers only.\n\n' +
16
+ 'For more information, visit: https://github.com/transmitsecurity-dev/ciam-web-sdk#browser-only\n');
17
+ }
18
+ if (!isBrowser) {
19
+ console.warn('āš ļø @TransmitSecurity/web-sdk: Browser environment not detected. ' +
20
+ 'Some features may not work correctly.');
21
+ }
22
+ })();
23
+ export async function initialize(config) {
24
+ try {
25
+ // Store config in both the common module and global window
26
+ setInitConfig(config);
27
+ // Store initialization state globally so DRS can access it
28
+ if (typeof window !== 'undefined') {
29
+ window.__TS_WEB_SDK_INITIALIZED__ = true;
30
+ window.__TS_WEB_SDK_CONFIG__ = config;
31
+ }
32
+ // Emit initialization event
33
+ emit(MODULE_INITIALIZED, undefined);
34
+ console.log('āœ… SDK initialized successfully');
35
+ }
36
+ catch (error) {
37
+ console.error('āŒ SDK initialization failed:', error);
38
+ throw error;
39
+ }
40
+ }
@@ -0,0 +1 @@
1
+ export { initialize } from './initialize-only';
@@ -0,0 +1,2 @@
1
+ // Initialize module - clean entry point
2
+ export { initialize } from './initialize-only';
@@ -0,0 +1,16 @@
1
+ export * from '@transmit-security/web-sdk-common/dist/main-entry';
2
+ export type { ActionEventOptions, ActionResponse } from "@transmit-security/riskid_sdk";
3
+ export type { authenticate, WebauthnApis, WebauthnAuthenticationFlows, AutofillHandlers, AuthenticationAutofillActivateHandlers, WebauthnRegistrationOptions, isAutofillSupported, SdkError, ErrorCode, isPlatformAuthenticatorSupported, register, crossDevice, CrossDeviceController, WebauthnCrossDeviceRegistrationOptions, WebauthnCrossDeviceFlows, getDefaultPaths } from '@transmit-security/authentication-sdk';
4
+ /**
5
+ * Main SDK class for CDN usage (window.tsPlatform)
6
+ * Provides access to all modules and common functionality
7
+ */
8
+ declare class TSWebSDK {
9
+ factories: {
10
+ drs: () => Record<string, any>;
11
+ idv: () => Record<string, any>;
12
+ };
13
+ constructor();
14
+ }
15
+ declare const _default: TSWebSDK;
16
+ export default _default;
@@ -0,0 +1,43 @@
1
+ // Browser Environment Validation
2
+ (function validateBrowserEnvironment() {
3
+ var _a, _b;
4
+ const isBrowser = typeof window !== 'undefined' && typeof document !== 'undefined';
5
+ const isNode = typeof globalThis !== 'undefined' &&
6
+ typeof globalThis.process !== 'undefined' &&
7
+ ((_b = (_a = globalThis.process) === null || _a === void 0 ? void 0 : _a.versions) === null || _b === void 0 ? void 0 : _b.node);
8
+ if (isNode && !isBrowser) {
9
+ throw new Error('\n🚫 @TransmitSecurity/web-sdk is a BROWSER-ONLY package.\n\n' +
10
+ 'āŒ Node.js environments are not supported.\n' +
11
+ 'āœ… Use this package in web browsers only.\n\n' +
12
+ 'For more information, visit: https://github.com/transmitsecurity-dev/ciam-web-sdk#browser-only\n');
13
+ }
14
+ if (!isBrowser) {
15
+ console.warn('āš ļø @TransmitSecurity/web-sdk: Browser environment not detected. ' +
16
+ 'Some features may not work correctly.');
17
+ }
18
+ })();
19
+ // Export common SDK functionality (initialize, etc.)
20
+ export * from '@transmit-security/web-sdk-common/dist/main-entry';
21
+ // Import individual modules
22
+ import * as drsMod from '@transmit-security/riskid_sdk';
23
+ import * as idvMod from '@transmit-security/ts-identity-verification';
24
+ // Module factories for dynamic loading
25
+ const factories = {
26
+ drs: drsMod,
27
+ idv: idvMod,
28
+ };
29
+ /**
30
+ * Main SDK class for CDN usage (window.tsPlatform)
31
+ * Provides access to all modules and common functionality
32
+ */
33
+ class TSWebSDK {
34
+ constructor() {
35
+ this.factories = factories;
36
+ // Attach DRS module functions
37
+ Object.assign(this, drsMod);
38
+ // Attach IDV module functions
39
+ Object.assign(this, idvMod);
40
+ }
41
+ }
42
+ // Export default instance for CDN usage
43
+ export default new TSWebSDK();
@@ -0,0 +1,109 @@
1
+ export interface DRSModule {
2
+ triggerActionEvent: (action: string, options: any) => Promise<any>;
3
+ setUser: (userId: string) => void;
4
+ clearUser: () => void;
5
+ }
6
+ export interface WebAuthnModule {
7
+ register: (options?: any) => Promise<any>;
8
+ authenticate: (options?: any) => Promise<any>;
9
+ isPlatformAuthenticatorSupported: () => Promise<boolean>;
10
+ isAutofillSupported: () => Promise<boolean>;
11
+ }
12
+ export interface IDVModule {
13
+ startVerification: (options: any) => Promise<any>;
14
+ getVerificationStatus: (sessionId: string) => Promise<any>;
15
+ }
16
+ export interface IDOModule {
17
+ executeFlow: (flowId: string, options?: any) => Promise<any>;
18
+ getFlowStatus: (executionId: string) => Promise<any>;
19
+ }
20
+ export interface SDKConfig {
21
+ clientId: string;
22
+ serverPath?: string;
23
+ drs?: {
24
+ serverPath?: string;
25
+ verbose?: boolean;
26
+ enableSessionToken?: boolean;
27
+ };
28
+ webauthn?: {
29
+ serverPath?: string;
30
+ };
31
+ idv?: {
32
+ serverPath?: string;
33
+ };
34
+ ido?: {
35
+ serverPath?: string;
36
+ };
37
+ }
38
+ /**
39
+ * šŸš€ **NEXT-GENERATION SDK FACTORY**
40
+ *
41
+ * ✨ **Features:**
42
+ * - 🌳 **Perfect Tree-Shaking**: Individual entry points for each module
43
+ * - šŸ“¦ **No Module Bundling**: Modules loaded only when needed
44
+ * - šŸŽÆ **TypeScript First**: Strong typing throughout
45
+ * - šŸ”„ **Static Imports**: Better for bundlers and tree-shaking
46
+ * - šŸŽ›ļø **Zero Config**: Sensible defaults
47
+ *
48
+ * @example
49
+ * ```typescript
50
+ * // šŸ“¦ Use specialized imports for perfect tree-shaking
51
+ * import { WebSDK } from '@TransmitSecurity/web-sdk';
52
+ *
53
+ * // Only DRS will be bundled (~219KB vs 567KB)
54
+ * const sdk = await WebSDK.drs({
55
+ * clientId: 'your-client-id',
56
+ * serverPath: 'https://api.transmitsecurity.io'
57
+ * });
58
+ *
59
+ * await sdk.triggerActionEvent('login', {...});
60
+ * ```
61
+ */
62
+ export declare class WebSDK {
63
+ /**
64
+ * šŸŽÆ **DRS (Device Risk & Security)** (~219KB bundle)
65
+ * Perfect for fraud detection and risk assessment
66
+ */
67
+ static drs(config: SDKConfig & {
68
+ drs?: SDKConfig['drs'];
69
+ }): Promise<any>;
70
+ /**
71
+ * šŸ” **WebAuthn (Passwordless Authentication)** (~75KB bundle)
72
+ * Perfect for passwordless authentication
73
+ */
74
+ static webauthn(config: SDKConfig & {
75
+ webauthn?: SDKConfig['webauthn'];
76
+ }): Promise<any>;
77
+ /**
78
+ * šŸ†” **IDV (Identity Verification)** (~589KB bundle)
79
+ * Perfect for identity verification flows
80
+ */
81
+ static idv(config: SDKConfig & {
82
+ idv?: SDKConfig['idv'];
83
+ }): Promise<any>;
84
+ /**
85
+ * šŸ”„ **IDO (Identity Orchestration)** (~2KB bundle)
86
+ * Perfect for orchestration workflows
87
+ */
88
+ static ido(config: SDKConfig & {
89
+ ido?: SDKConfig['ido'];
90
+ }): Promise<any>;
91
+ /**
92
+ * šŸŽ›ļø **Multi-Module SDK** (~5KB core + modules on-demand)
93
+ * Perfect for progressive loading and complex applications
94
+ */
95
+ static create(config: SDKConfig): Promise<{
96
+ isInitialized: boolean;
97
+ config: SDKConfig;
98
+ drs: any;
99
+ loadDRS(): Promise<any>;
100
+ loadWebAuthn(): Promise<any>;
101
+ loadIDV(): Promise<any>;
102
+ loadIDO(): Promise<any>;
103
+ }>;
104
+ }
105
+ export declare const createDRSSDK: typeof WebSDK.drs;
106
+ export declare const createWebAuthnSDK: typeof WebSDK.webauthn;
107
+ export declare const createIDVSDK: typeof WebSDK.idv;
108
+ export declare const createIDOSDK: typeof WebSDK.ido;
109
+ export declare const createSDK: typeof WebSDK.create;
@@ -0,0 +1,108 @@
1
+ // šŸš€ Next-Generation SDK Factory
2
+ // Ultra-lightweight factories with perfect tree-shaking
3
+ import { initialize } from './initialize-only';
4
+ // Import individual entry points for perfect tree-shaking
5
+ import { createDRS } from './drs-entry';
6
+ import { createWebAuthn } from './webauthn-entry';
7
+ import { createIDV } from './idv-entry';
8
+ import { createIDO } from './ido-entry';
9
+ /**
10
+ * šŸš€ **NEXT-GENERATION SDK FACTORY**
11
+ *
12
+ * ✨ **Features:**
13
+ * - 🌳 **Perfect Tree-Shaking**: Individual entry points for each module
14
+ * - šŸ“¦ **No Module Bundling**: Modules loaded only when needed
15
+ * - šŸŽÆ **TypeScript First**: Strong typing throughout
16
+ * - šŸ”„ **Static Imports**: Better for bundlers and tree-shaking
17
+ * - šŸŽ›ļø **Zero Config**: Sensible defaults
18
+ *
19
+ * @example
20
+ * ```typescript
21
+ * // šŸ“¦ Use specialized imports for perfect tree-shaking
22
+ * import { WebSDK } from '@TransmitSecurity/web-sdk';
23
+ *
24
+ * // Only DRS will be bundled (~219KB vs 567KB)
25
+ * const sdk = await WebSDK.drs({
26
+ * clientId: 'your-client-id',
27
+ * serverPath: 'https://api.transmitsecurity.io'
28
+ * });
29
+ *
30
+ * await sdk.triggerActionEvent('login', {...});
31
+ * ```
32
+ */
33
+ // šŸŽÆ **MAIN SDK CLASS** - Clean, intuitive API
34
+ export class WebSDK {
35
+ /**
36
+ * šŸŽÆ **DRS (Device Risk & Security)** (~219KB bundle)
37
+ * Perfect for fraud detection and risk assessment
38
+ */
39
+ static async drs(config) {
40
+ return await createDRS(config);
41
+ }
42
+ /**
43
+ * šŸ” **WebAuthn (Passwordless Authentication)** (~75KB bundle)
44
+ * Perfect for passwordless authentication
45
+ */
46
+ static async webauthn(config) {
47
+ return await createWebAuthn(config);
48
+ }
49
+ /**
50
+ * šŸ†” **IDV (Identity Verification)** (~589KB bundle)
51
+ * Perfect for identity verification flows
52
+ */
53
+ static async idv(config) {
54
+ return await createIDV(config);
55
+ }
56
+ /**
57
+ * šŸ”„ **IDO (Identity Orchestration)** (~2KB bundle)
58
+ * Perfect for orchestration workflows
59
+ */
60
+ static async ido(config) {
61
+ return await createIDO(config);
62
+ }
63
+ /**
64
+ * šŸŽ›ļø **Multi-Module SDK** (~5KB core + modules on-demand)
65
+ * Perfect for progressive loading and complex applications
66
+ */
67
+ static async create(config) {
68
+ // āœ… Validation
69
+ if (!config.clientId) {
70
+ throw new Error('āŒ clientId is required');
71
+ }
72
+ // šŸ”§ Initialize core
73
+ await initialize(config);
74
+ // 🌳 Load DRS by default if configured
75
+ let drsModule = null;
76
+ if (config.drs) {
77
+ drsModule = await createDRS(config);
78
+ }
79
+ return {
80
+ isInitialized: true,
81
+ config: config,
82
+ // šŸ”„ Direct module access (only DRS loaded by default)
83
+ drs: drsModule,
84
+ // šŸ”„ Lazy load methods for other modules
85
+ async loadDRS() {
86
+ if (!drsModule) {
87
+ drsModule = await createDRS(config);
88
+ }
89
+ return drsModule;
90
+ },
91
+ async loadWebAuthn() {
92
+ return await createWebAuthn(config);
93
+ },
94
+ async loadIDV() {
95
+ return await createIDV(config);
96
+ },
97
+ async loadIDO() {
98
+ return await createIDO(config);
99
+ }
100
+ };
101
+ }
102
+ }
103
+ // šŸ”„ **LEGACY COMPATIBILITY** - Keep old exports working
104
+ export const createDRSSDK = WebSDK.drs;
105
+ export const createWebAuthnSDK = WebSDK.webauthn;
106
+ export const createIDVSDK = WebSDK.idv;
107
+ export const createIDOSDK = WebSDK.ido;
108
+ export const createSDK = WebSDK.create;
@@ -0,0 +1,4 @@
1
+ export declare function initialize(params: any): void;
2
+ export { getInitConfig } from '@transmit-security/web-sdk-common/dist/module-metadata/module-metadata';
3
+ export { emit, on, off } from '@transmit-security/web-sdk-common/dist/events';
4
+ export { MODULE_INITIALIZED } from '@transmit-security/web-sdk-common/dist/events';
@@ -0,0 +1,32 @@
1
+ // Shared state manager for the Web SDK
2
+ // This ensures all modules can access the same initialization state
3
+ import { setInitConfig } from '@transmit-security/web-sdk-common/dist/module-metadata/module-metadata';
4
+ import { emit } from '@transmit-security/web-sdk-common/dist/events';
5
+ import { MODULE_INITIALIZED } from '@transmit-security/web-sdk-common/dist/events';
6
+ // Browser Environment Validation (run once globally)
7
+ (function validateBrowserEnvironment() {
8
+ var _a, _b;
9
+ const isBrowser = typeof window !== 'undefined' && typeof document !== 'undefined';
10
+ const isNode = typeof globalThis !== 'undefined' &&
11
+ typeof globalThis.process !== 'undefined' &&
12
+ ((_b = (_a = globalThis.process) === null || _a === void 0 ? void 0 : _a.versions) === null || _b === void 0 ? void 0 : _b.node);
13
+ if (isNode && !isBrowser) {
14
+ throw new Error('\n🚫 @TransmitSecurity/web-sdk is a BROWSER-ONLY package.\n\n' +
15
+ 'āŒ Node.js environments are not supported.\n' +
16
+ 'āœ… Use this package in web browsers only.\n\n' +
17
+ 'For more information, visit: https://github.com/transmitsecurity-dev/ciam-web-sdk#browser-only\n');
18
+ }
19
+ if (!isBrowser) {
20
+ console.warn('āš ļø @TransmitSecurity/web-sdk: Browser environment not detected. ' +
21
+ 'Some features may not work correctly.');
22
+ }
23
+ })();
24
+ // Global initialization function that all modules can use
25
+ export function initialize(params) {
26
+ setInitConfig(params);
27
+ emit(MODULE_INITIALIZED, undefined);
28
+ }
29
+ // Export utilities for modules to check initialization state
30
+ export { getInitConfig } from '@transmit-security/web-sdk-common/dist/module-metadata/module-metadata';
31
+ export { emit, on, off } from '@transmit-security/web-sdk-common/dist/events';
32
+ export { MODULE_INITIALIZED } from '@transmit-security/web-sdk-common/dist/events';
@@ -0,0 +1,19 @@
1
+ export interface WebAuthnModule {
2
+ register: (options?: any) => Promise<any>;
3
+ authenticate: (options?: any) => Promise<any>;
4
+ isPlatformAuthenticatorSupported: () => Promise<boolean>;
5
+ isAutofillSupported: () => Promise<boolean>;
6
+ }
7
+ export interface SDKConfig {
8
+ clientId: string;
9
+ serverPath?: string;
10
+ webauthn?: {
11
+ serverPath?: string;
12
+ };
13
+ }
14
+ /**
15
+ * šŸ” **WebAuthn (Passwordless Authentication)** (~75KB bundle)
16
+ * Perfect for passwordless authentication
17
+ */
18
+ export declare function createWebAuthn(config: SDKConfig): Promise<any>;
19
+ export { createWebAuthn as webauthn };