@glideidentity/web-client-sdk 4.4.10 → 5.0.1-beta.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 (102) hide show
  1. package/README.md +167 -19
  2. package/dist/adapters/angular/index.js +0 -1
  3. package/dist/adapters/angular/phone-auth.service.d.ts +0 -18
  4. package/dist/adapters/angular/phone-auth.service.js +0 -26
  5. package/dist/adapters/react/index.d.ts +1 -1
  6. package/dist/adapters/react/index.js +0 -3
  7. package/dist/adapters/react/useClient.js +0 -1
  8. package/dist/adapters/react/usePhoneAuth.js +1 -16
  9. package/dist/adapters/vanilla/client.js +0 -1
  10. package/dist/adapters/vanilla/index.js +0 -1
  11. package/dist/adapters/vanilla/phone-auth.js +0 -31
  12. package/dist/adapters/vue/index.d.ts +1 -1
  13. package/dist/adapters/vue/index.js +0 -4
  14. package/dist/adapters/vue/useClient.js +0 -5
  15. package/dist/adapters/vue/usePhoneAuth.js +1 -20
  16. package/dist/browser/web-client-sdk.min.js +1 -1
  17. package/dist/browser/web-client-sdk.min.js.LICENSE.txt +1 -1
  18. package/dist/browser.d.ts +1 -1
  19. package/dist/browser.js +0 -6
  20. package/dist/core/client.js +0 -12
  21. package/dist/core/logger.js +1 -81
  22. package/dist/core/phone-auth/api-types.d.ts +0 -13
  23. package/dist/core/phone-auth/api-types.js +0 -83
  24. package/dist/core/phone-auth/client.js +27 -374
  25. package/dist/core/phone-auth/error-utils.js +1 -83
  26. package/dist/core/phone-auth/index.d.ts +1 -1
  27. package/dist/core/phone-auth/index.js +1 -3
  28. package/dist/core/phone-auth/status-types.d.ts +0 -78
  29. package/dist/core/phone-auth/status-types.js +0 -17
  30. package/dist/core/phone-auth/strategies/desktop.js +8 -126
  31. package/dist/core/phone-auth/strategies/index.d.ts +0 -4
  32. package/dist/core/phone-auth/strategies/index.js +0 -4
  33. package/dist/core/phone-auth/strategies/link.js +10 -88
  34. package/dist/core/phone-auth/strategies/ts43.d.ts +0 -19
  35. package/dist/core/phone-auth/strategies/ts43.js +2 -33
  36. package/dist/core/phone-auth/strategies/types.js +0 -4
  37. package/dist/core/phone-auth/type-guards.js +0 -131
  38. package/dist/core/phone-auth/types.js +0 -32
  39. package/dist/core/phone-auth/ui/mobile-debug-console.js +2 -28
  40. package/dist/core/phone-auth/ui/modal.d.ts +33 -55
  41. package/dist/core/phone-auth/ui/modal.js +889 -422
  42. package/dist/core/phone-auth/validation-utils.d.ts +0 -13
  43. package/dist/core/phone-auth/validation-utils.js +2 -81
  44. package/dist/core/version.js +1 -2
  45. package/dist/esm/adapters/angular/index.js +0 -1
  46. package/dist/esm/adapters/angular/phone-auth.service.d.ts +0 -18
  47. package/dist/esm/adapters/angular/phone-auth.service.js +0 -26
  48. package/dist/esm/adapters/react/index.d.ts +1 -1
  49. package/dist/esm/adapters/react/index.js +0 -3
  50. package/dist/esm/adapters/react/useClient.js +0 -1
  51. package/dist/esm/adapters/react/usePhoneAuth.js +1 -16
  52. package/dist/esm/adapters/vanilla/client.js +0 -1
  53. package/dist/esm/adapters/vanilla/index.js +0 -1
  54. package/dist/esm/adapters/vanilla/phone-auth.d.ts +0 -24
  55. package/dist/esm/adapters/vanilla/phone-auth.js +0 -31
  56. package/dist/esm/adapters/vue/index.d.ts +1 -1
  57. package/dist/esm/adapters/vue/index.js +0 -4
  58. package/dist/esm/adapters/vue/useClient.js +0 -5
  59. package/dist/esm/adapters/vue/usePhoneAuth.js +1 -20
  60. package/dist/esm/browser.d.ts +1 -1
  61. package/dist/esm/browser.js +0 -6
  62. package/dist/esm/core/client.d.ts +0 -10
  63. package/dist/esm/core/client.js +0 -12
  64. package/dist/esm/core/logger.d.ts +0 -53
  65. package/dist/esm/core/logger.js +1 -81
  66. package/dist/esm/core/phone-auth/api-types.d.ts +0 -328
  67. package/dist/esm/core/phone-auth/api-types.js +0 -83
  68. package/dist/esm/core/phone-auth/client.d.ts +0 -144
  69. package/dist/esm/core/phone-auth/client.js +28 -375
  70. package/dist/esm/core/phone-auth/error-utils.d.ts +0 -29
  71. package/dist/esm/core/phone-auth/error-utils.js +1 -83
  72. package/dist/esm/core/phone-auth/index.d.ts +1 -1
  73. package/dist/esm/core/phone-auth/index.js +2 -4
  74. package/dist/esm/core/phone-auth/status-types.d.ts +0 -78
  75. package/dist/esm/core/phone-auth/status-types.js +0 -17
  76. package/dist/esm/core/phone-auth/strategies/desktop.d.ts +0 -63
  77. package/dist/esm/core/phone-auth/strategies/desktop.js +8 -126
  78. package/dist/esm/core/phone-auth/strategies/index.d.ts +0 -4
  79. package/dist/esm/core/phone-auth/strategies/index.js +0 -4
  80. package/dist/esm/core/phone-auth/strategies/link.d.ts +0 -48
  81. package/dist/esm/core/phone-auth/strategies/link.js +10 -88
  82. package/dist/esm/core/phone-auth/strategies/ts43.d.ts +0 -19
  83. package/dist/esm/core/phone-auth/strategies/ts43.js +2 -33
  84. package/dist/esm/core/phone-auth/strategies/types.d.ts +0 -13
  85. package/dist/esm/core/phone-auth/strategies/types.js +0 -4
  86. package/dist/esm/core/phone-auth/type-guards.d.ts +0 -128
  87. package/dist/esm/core/phone-auth/type-guards.js +0 -131
  88. package/dist/esm/core/phone-auth/types.d.ts +0 -108
  89. package/dist/esm/core/phone-auth/types.js +0 -32
  90. package/dist/esm/core/phone-auth/ui/mobile-debug-console.d.ts +0 -4
  91. package/dist/esm/core/phone-auth/ui/mobile-debug-console.js +2 -28
  92. package/dist/esm/core/phone-auth/ui/modal.d.ts +27 -68
  93. package/dist/esm/core/phone-auth/ui/modal.js +889 -422
  94. package/dist/esm/core/phone-auth/validation-utils.d.ts +0 -44
  95. package/dist/esm/core/phone-auth/validation-utils.js +2 -80
  96. package/dist/esm/core/types.d.ts +0 -35
  97. package/dist/esm/core/version.js +1 -2
  98. package/dist/esm/index.d.ts +1 -1
  99. package/dist/esm/index.js +1 -9
  100. package/dist/index.d.ts +1 -1
  101. package/dist/index.js +0 -7
  102. package/package.json +2 -2
@@ -1,11 +1,4 @@
1
1
  "use strict";
2
- /**
3
- * Phone Authentication Types
4
- *
5
- * This file exports the types used by the Phone Auth SDK.
6
- * All API types are imported from api-types.ts to ensure consistency.
7
- * No backward compatibility - using clean API specification only.
8
- */
9
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
10
3
  if (k2 === undefined) k2 = k;
11
4
  var desc = Object.getOwnPropertyDescriptor(m, k);
@@ -22,16 +15,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
22
15
  };
23
16
  Object.defineProperty(exports, "__esModule", { value: true });
24
17
  exports.AuthStatus = exports.BrowserName = exports.BrowserErrorCode = exports.BrowserError = void 0;
25
- // ============================================================================
26
- // RE-EXPORT ALL API TYPES
27
- // ============================================================================
28
18
  __exportStar(require("./api-types"), exports);
29
- // ============================================================================
30
- // BROWSER-SPECIFIC TYPES
31
- // ============================================================================
32
- /**
33
- * Browser error names
34
- */
35
19
  exports.BrowserError = {
36
20
  NOT_ALLOWED: 'NotAllowedError',
37
21
  NETWORK: 'NetworkError',
@@ -48,9 +32,6 @@ exports.BrowserError = {
48
32
  RANGE: 'RangeError',
49
33
  SYNTAX: 'SyntaxError'
50
34
  };
51
- /**
52
- * Browser error codes
53
- */
54
35
  exports.BrowserErrorCode = {
55
36
  USER_CANCELLED_DC_API: 19,
56
37
  PERMISSION_DENIED: 1,
@@ -61,9 +42,6 @@ exports.BrowserErrorCode = {
61
42
  NETWORK: 19,
62
43
  SECURITY: 18
63
44
  };
64
- /**
65
- * Browser names for detection
66
- */
67
45
  exports.BrowserName = {
68
46
  CHROME: 'Chrome',
69
47
  EDGE: 'Edge',
@@ -73,21 +51,11 @@ exports.BrowserName = {
73
51
  BRAVE: 'Brave',
74
52
  OTHER: 'other'
75
53
  };
76
- /**
77
- * Authentication status constants
78
- * Maps to both client-side states and backend responses
79
- */
80
54
  exports.AuthStatus = {
81
- /** Authentication in progress */
82
55
  PENDING: 'pending',
83
- /** Authentication completed successfully */
84
56
  COMPLETED: 'completed',
85
- /** User cancelled authentication */
86
57
  CANCELLED: 'cancelled',
87
- /** Authentication failed or expired */
88
58
  FAILED: 'failed',
89
- /** Session expired (backend returns 410 Gone) */
90
59
  EXPIRED: 'expired',
91
- /** Session not found (backend returns 404) */
92
60
  NOT_FOUND: 'not_found'
93
61
  };
@@ -1,8 +1,4 @@
1
1
  "use strict";
2
- /**
3
- * Mobile Debug Console
4
- * A lightweight console overlay for debugging on mobile devices where dev tools aren't available
5
- */
6
2
  Object.defineProperty(exports, "__esModule", { value: true });
7
3
  exports.MobileDebugConsole = void 0;
8
4
  class MobileDebugConsole {
@@ -39,15 +35,13 @@ class MobileDebugConsole {
39
35
  ['log', 'error', 'warn', 'debug', 'info'].forEach(method => {
40
36
  const originalMethod = this.originalConsole[method];
41
37
  console[method] = (...args) => {
42
- // Call original
43
38
  originalMethod.apply(console, args);
44
- // Add to our display
45
39
  this.addLog(method, args);
46
40
  };
47
41
  });
48
42
  }
49
43
  addLog(type, args) {
50
- const timestamp = new Date().toTimeString().split(' ')[0]; // HH:MM:SS
44
+ const timestamp = new Date().toTimeString().split(' ')[0];
51
45
  const content = args.map(arg => {
52
46
  if (typeof arg === 'object') {
53
47
  try {
@@ -59,7 +53,6 @@ class MobileDebugConsole {
59
53
  }
60
54
  return String(arg);
61
55
  }).join(' ');
62
- // Create colored log entry
63
56
  const colors = {
64
57
  log: '#fff',
65
58
  error: '#ff6b6b',
@@ -75,7 +68,6 @@ class MobileDebugConsole {
75
68
  </div>
76
69
  `;
77
70
  this.logs.push(logHtml);
78
- // Keep only last 500 logs
79
71
  if (this.logs.length > 500) {
80
72
  this.logs.shift();
81
73
  }
@@ -84,17 +76,13 @@ class MobileDebugConsole {
84
76
  updateDisplay() {
85
77
  if (!this.logsContainer || !this.isVisible)
86
78
  return;
87
- // Check if scrolled to bottom before update
88
79
  this.isAtBottom = this.logsContainer.scrollHeight - this.logsContainer.scrollTop <= this.logsContainer.clientHeight + 50;
89
- // Update content
90
80
  this.logsContainer.innerHTML = this.logs.join('');
91
- // Auto-scroll only if was at bottom
92
81
  if (this.isAtBottom) {
93
82
  this.logsContainer.scrollTop = this.logsContainer.scrollHeight;
94
83
  }
95
84
  }
96
85
  createUI() {
97
- // Create styles
98
86
  const style = document.createElement('style');
99
87
  style.textContent = `
100
88
  #mobile-debug-console {
@@ -187,13 +175,11 @@ class MobileDebugConsole {
187
175
  }
188
176
  `;
189
177
  document.head.appendChild(style);
190
- // Create container
191
178
  this.container = document.createElement('div');
192
179
  this.container.id = 'mobile-debug-console';
193
180
  if (!this.isVisible) {
194
181
  this.container.className = 'hidden';
195
182
  }
196
- // Create header
197
183
  const header = document.createElement('div');
198
184
  header.id = 'debug-header';
199
185
  const title = document.createElement('div');
@@ -201,15 +187,12 @@ class MobileDebugConsole {
201
187
  title.textContent = '📱 Mobile Debug Console';
202
188
  const buttons = document.createElement('div');
203
189
  buttons.id = 'debug-buttons';
204
- // Clear button
205
190
  const clearBtn = document.createElement('button');
206
191
  clearBtn.textContent = 'Clear';
207
192
  clearBtn.onclick = () => this.clear();
208
- // Show/Hide button
209
193
  const toggleBtn = document.createElement('button');
210
194
  toggleBtn.textContent = 'Hide';
211
195
  toggleBtn.onclick = () => this.toggle();
212
- // Close button
213
196
  const closeBtn = document.createElement('button');
214
197
  closeBtn.textContent = '✕';
215
198
  closeBtn.style.color = '#ff6b6b';
@@ -219,25 +202,20 @@ class MobileDebugConsole {
219
202
  buttons.appendChild(closeBtn);
220
203
  header.appendChild(title);
221
204
  header.appendChild(buttons);
222
- // Create logs container
223
205
  this.logsContainer = document.createElement('div');
224
206
  this.logsContainer.id = 'debug-logs';
225
- // Track scroll position
226
207
  this.logsContainer.addEventListener('scroll', () => {
227
208
  this.isAtBottom = this.logsContainer.scrollHeight - this.logsContainer.scrollTop <= this.logsContainer.clientHeight + 50;
228
209
  });
229
- // Assemble
230
210
  this.container.appendChild(header);
231
211
  this.container.appendChild(this.logsContainer);
232
212
  document.body.appendChild(this.container);
233
- // Create floating toggle button
234
213
  this.floatingToggle = document.createElement('button');
235
214
  this.floatingToggle.id = 'debug-floating-toggle';
236
- this.floatingToggle.innerHTML = '🖥️'; // Console icon
215
+ this.floatingToggle.innerHTML = '🖥️';
237
216
  this.floatingToggle.title = 'Show Debug Console';
238
217
  this.floatingToggle.onclick = () => this.toggle();
239
218
  document.body.appendChild(this.floatingToggle);
240
- // Store reference for toggle button
241
219
  window.__debugToggleBtn = toggleBtn;
242
220
  }
243
221
  escapeHtml(text) {
@@ -268,19 +246,15 @@ class MobileDebugConsole {
268
246
  }
269
247
  }
270
248
  cleanup() {
271
- // Restore original console
272
249
  Object.keys(this.originalConsole).forEach(method => {
273
250
  console[method] = this.originalConsole[method];
274
251
  });
275
- // Remove UI
276
252
  if (this.container) {
277
253
  this.container.remove();
278
254
  }
279
- // Remove floating toggle
280
255
  if (this.floatingToggle) {
281
256
  this.floatingToggle.remove();
282
257
  }
283
- // Clean up references
284
258
  delete window.__debugToggleBtn;
285
259
  }
286
260
  }
@@ -2,20 +2,19 @@
2
2
  * Modal UI Component for Phone Authentication
3
3
  *
4
4
  * This file creates the UI components (modals, buttons) that are shown
5
- * when the SDK is NOT in headless mode. Think of it like a popup window
6
- * that handles the authentication flow for you.
5
+ * when the SDK is NOT in headless mode.
7
6
  */
8
7
  import type { InvokeOptions } from '../api-types';
9
8
  import type { QRCodeData } from '../strategies/desktop';
9
+ export type ModalViewMode = 'toggle' | 'dual' | 'pre-step';
10
+ export type ModalTheme = 'dark' | 'light' | 'auto';
11
+ export type AuthModalOptions = NonNullable<InvokeOptions['modalOptions']> & {
12
+ viewMode?: ModalViewMode;
13
+ /** Modal theme: 'dark', 'light', or 'auto' (uses system preference) */
14
+ theme?: ModalTheme;
15
+ };
10
16
  /**
11
17
  * Creates and manages a modal dialog for authentication
12
- *
13
- * @example
14
- * const modal = new AuthModal({
15
- * title: "Verify Your Phone",
16
- * description: "Complete authentication to continue"
17
- * });
18
- * modal.show();
19
18
  */
20
19
  export declare class AuthModal {
21
20
  private container;
@@ -24,65 +23,44 @@ export declare class AuthModal {
24
23
  private options;
25
24
  private callbacks;
26
25
  private closeCallback?;
27
- constructor(options?: InvokeOptions['modalOptions'], callbacks?: InvokeOptions['callbacks']);
28
- private handleEscapeKey;
26
+ private theme;
27
+ private currentStep;
28
+ private qrCodeData;
29
+ private statusMessage;
30
+ private originalBodyOverflow;
31
+ private isClosing;
32
+ private readonly iconApple;
33
+ private readonly iconAndroid;
34
+ private readonly iconBack;
35
+ constructor(options?: AuthModalOptions, callbacks?: InvokeOptions['callbacks']);
29
36
  /**
30
- * Escape HTML to prevent XSS attacks
37
+ * Determines if dark mode should be used based on theme setting
31
38
  */
39
+ private shouldUseDarkMode;
40
+ private handleEscapeKey;
32
41
  private escapeHtml;
33
42
  /**
34
- * Shows the modal with a QR code for desktop authentication
35
- * Supports both single QR code (legacy) and dual-platform QR codes (iOS + Android)
43
+ * Shows the modal with a QR code
36
44
  */
37
45
  showQRCode(qrCodeData: string | QRCodeData, statusMessage?: string): void;
38
46
  /**
39
- * Creates a modal with iOS/Android platform toggle
40
- */
41
- private createDualPlatformQRModal;
42
- /**
43
- * Sets a callback to be called when the modal is cancelled/closed
47
+ * Updates the status message shown in the modal
44
48
  */
49
+ updateStatus(status: string, isError?: boolean): void;
45
50
  setCloseCallback(callback: () => void): void;
46
- /**
47
- * Shows the modal with a button for Link authentication (App Clips)
48
- * IMPORTANT: The button click is required for iOS to recognize the app link
49
- */
50
- showLinkButton(url: string, buttonText?: string): Promise<void>;
51
- /**
52
- * Shows the modal with a button for TS43 authentication
53
- * IMPORTANT: The button click is required for Digital Credentials API (transient activation)
54
- */
55
- showTS43Button(onAuthenticate: () => Promise<any>): Promise<any>;
56
- /**
57
- * Updates the status message in the modal
58
- */
59
- updateStatus(message: string, isError?: boolean): void;
60
- /**
61
- * Creates the modal HTML structure
62
- */
51
+ private renderToggleMode;
52
+ private renderDualMode;
53
+ private renderPreStepMode;
54
+ private setupPreStepListeners;
55
+ private updatePreStepUI;
56
+ private setupBackButton;
63
57
  private createModal;
64
- /**
65
- * Injects CSS styles for the modal
66
- */
58
+ private setupHelpInteraction;
67
59
  private injectStyles;
68
- /**
69
- * Shows the modal with animation
70
- */
71
60
  show(): void;
72
- /**
73
- * Setup click handlers for iOS/Android platform toggle
74
- */
75
61
  private setupPlatformToggles;
76
- /**
77
- * Closes the modal with animation
78
- */
62
+ private lockBodyScroll;
63
+ private unlockBodyScroll;
79
64
  close(): void;
80
- /**
81
- * Removes modal elements from DOM
82
- */
83
65
  private cleanup;
84
- /**
85
- * Check if modal is currently open
86
- */
87
- isModalOpen(): boolean;
88
66
  }