@glideidentity/web-client-sdk 4.4.8-beta.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.
Files changed (136) hide show
  1. package/README.md +938 -0
  2. package/dist/adapters/angular/client.service.d.ts +7 -0
  3. package/dist/adapters/angular/client.service.js +30 -0
  4. package/dist/adapters/angular/index.d.ts +3 -0
  5. package/dist/adapters/angular/index.js +18 -0
  6. package/dist/adapters/angular/phone-auth.service.d.ts +38 -0
  7. package/dist/adapters/angular/phone-auth.service.js +130 -0
  8. package/dist/adapters/react/index.d.ts +9 -0
  9. package/dist/adapters/react/index.js +28 -0
  10. package/dist/adapters/react/useClient.d.ts +26 -0
  11. package/dist/adapters/react/useClient.js +121 -0
  12. package/dist/adapters/react/usePhoneAuth.d.ts +23 -0
  13. package/dist/adapters/react/usePhoneAuth.js +95 -0
  14. package/dist/adapters/vanilla/client.d.ts +8 -0
  15. package/dist/adapters/vanilla/client.js +33 -0
  16. package/dist/adapters/vanilla/index.d.ts +3 -0
  17. package/dist/adapters/vanilla/index.js +18 -0
  18. package/dist/adapters/vanilla/phone-auth.d.ts +46 -0
  19. package/dist/adapters/vanilla/phone-auth.js +138 -0
  20. package/dist/adapters/vue/index.d.ts +10 -0
  21. package/dist/adapters/vue/index.js +36 -0
  22. package/dist/adapters/vue/useClient.d.ts +115 -0
  23. package/dist/adapters/vue/useClient.js +131 -0
  24. package/dist/adapters/vue/usePhoneAuth.d.ts +94 -0
  25. package/dist/adapters/vue/usePhoneAuth.js +103 -0
  26. package/dist/browser/web-client-sdk.min.js +2 -0
  27. package/dist/browser/web-client-sdk.min.js.LICENSE.txt +1 -0
  28. package/dist/browser.d.ts +7 -0
  29. package/dist/browser.js +31 -0
  30. package/dist/core/client.d.ts +22 -0
  31. package/dist/core/client.js +77 -0
  32. package/dist/core/logger.d.ts +130 -0
  33. package/dist/core/logger.js +370 -0
  34. package/dist/core/phone-auth/api-types.d.ts +525 -0
  35. package/dist/core/phone-auth/api-types.js +215 -0
  36. package/dist/core/phone-auth/client.d.ts +187 -0
  37. package/dist/core/phone-auth/client.js +1353 -0
  38. package/dist/core/phone-auth/error-utils.d.ts +110 -0
  39. package/dist/core/phone-auth/error-utils.js +350 -0
  40. package/dist/core/phone-auth/index.d.ts +7 -0
  41. package/dist/core/phone-auth/index.js +47 -0
  42. package/dist/core/phone-auth/status-types.d.ts +107 -0
  43. package/dist/core/phone-auth/status-types.js +31 -0
  44. package/dist/core/phone-auth/strategies/desktop.d.ts +113 -0
  45. package/dist/core/phone-auth/strategies/desktop.js +502 -0
  46. package/dist/core/phone-auth/strategies/index.d.ts +11 -0
  47. package/dist/core/phone-auth/strategies/index.js +15 -0
  48. package/dist/core/phone-auth/strategies/link.d.ts +81 -0
  49. package/dist/core/phone-auth/strategies/link.js +265 -0
  50. package/dist/core/phone-auth/strategies/ts43.d.ts +32 -0
  51. package/dist/core/phone-auth/strategies/ts43.js +146 -0
  52. package/dist/core/phone-auth/strategies/types.d.ts +18 -0
  53. package/dist/core/phone-auth/strategies/types.js +6 -0
  54. package/dist/core/phone-auth/type-guards.d.ts +125 -0
  55. package/dist/core/phone-auth/type-guards.js +160 -0
  56. package/dist/core/phone-auth/types.d.ts +232 -0
  57. package/dist/core/phone-auth/types.js +93 -0
  58. package/dist/core/phone-auth/ui/mobile-debug-console.d.ts +25 -0
  59. package/dist/core/phone-auth/ui/mobile-debug-console.js +288 -0
  60. package/dist/core/phone-auth/ui/modal.d.ts +84 -0
  61. package/dist/core/phone-auth/ui/modal.js +574 -0
  62. package/dist/core/phone-auth/validation-utils.d.ts +66 -0
  63. package/dist/core/phone-auth/validation-utils.js +182 -0
  64. package/dist/core/types.d.ts +62 -0
  65. package/dist/core/types.js +2 -0
  66. package/dist/core/version.d.ts +1 -0
  67. package/dist/core/version.js +5 -0
  68. package/dist/esm/adapters/angular/client.service.d.ts +7 -0
  69. package/dist/esm/adapters/angular/client.service.js +27 -0
  70. package/dist/esm/adapters/angular/index.d.ts +3 -0
  71. package/dist/esm/adapters/angular/index.js +4 -0
  72. package/dist/esm/adapters/angular/phone-auth.service.d.ts +38 -0
  73. package/dist/esm/adapters/angular/phone-auth.service.js +127 -0
  74. package/dist/esm/adapters/react/index.d.ts +9 -0
  75. package/dist/esm/adapters/react/index.js +8 -0
  76. package/dist/esm/adapters/react/useClient.d.ts +26 -0
  77. package/dist/esm/adapters/react/useClient.js +116 -0
  78. package/dist/esm/adapters/react/usePhoneAuth.d.ts +23 -0
  79. package/dist/esm/adapters/react/usePhoneAuth.js +92 -0
  80. package/dist/esm/adapters/vanilla/client.d.ts +8 -0
  81. package/dist/esm/adapters/vanilla/client.js +29 -0
  82. package/dist/esm/adapters/vanilla/index.d.ts +3 -0
  83. package/dist/esm/adapters/vanilla/index.js +4 -0
  84. package/dist/esm/adapters/vanilla/phone-auth.d.ts +46 -0
  85. package/dist/esm/adapters/vanilla/phone-auth.js +134 -0
  86. package/dist/esm/adapters/vue/index.d.ts +10 -0
  87. package/dist/esm/adapters/vue/index.js +11 -0
  88. package/dist/esm/adapters/vue/useClient.d.ts +115 -0
  89. package/dist/esm/adapters/vue/useClient.js +127 -0
  90. package/dist/esm/adapters/vue/usePhoneAuth.d.ts +94 -0
  91. package/dist/esm/adapters/vue/usePhoneAuth.js +100 -0
  92. package/dist/esm/browser.d.ts +7 -0
  93. package/dist/esm/browser.js +11 -0
  94. package/dist/esm/core/client.d.ts +22 -0
  95. package/dist/esm/core/client.js +70 -0
  96. package/dist/esm/core/logger.d.ts +130 -0
  97. package/dist/esm/core/logger.js +359 -0
  98. package/dist/esm/core/phone-auth/api-types.d.ts +525 -0
  99. package/dist/esm/core/phone-auth/api-types.js +203 -0
  100. package/dist/esm/core/phone-auth/client.d.ts +187 -0
  101. package/dist/esm/core/phone-auth/client.js +1316 -0
  102. package/dist/esm/core/phone-auth/error-utils.d.ts +110 -0
  103. package/dist/esm/core/phone-auth/error-utils.js +338 -0
  104. package/dist/esm/core/phone-auth/index.d.ts +7 -0
  105. package/dist/esm/core/phone-auth/index.js +6 -0
  106. package/dist/esm/core/phone-auth/status-types.d.ts +107 -0
  107. package/dist/esm/core/phone-auth/status-types.js +26 -0
  108. package/dist/esm/core/phone-auth/strategies/desktop.d.ts +113 -0
  109. package/dist/esm/core/phone-auth/strategies/desktop.js +496 -0
  110. package/dist/esm/core/phone-auth/strategies/index.d.ts +11 -0
  111. package/dist/esm/core/phone-auth/strategies/index.js +7 -0
  112. package/dist/esm/core/phone-auth/strategies/link.d.ts +81 -0
  113. package/dist/esm/core/phone-auth/strategies/link.js +261 -0
  114. package/dist/esm/core/phone-auth/strategies/ts43.d.ts +32 -0
  115. package/dist/esm/core/phone-auth/strategies/ts43.js +142 -0
  116. package/dist/esm/core/phone-auth/strategies/types.d.ts +18 -0
  117. package/dist/esm/core/phone-auth/strategies/types.js +5 -0
  118. package/dist/esm/core/phone-auth/type-guards.d.ts +125 -0
  119. package/dist/esm/core/phone-auth/type-guards.js +150 -0
  120. package/dist/esm/core/phone-auth/types.d.ts +232 -0
  121. package/dist/esm/core/phone-auth/types.js +76 -0
  122. package/dist/esm/core/phone-auth/ui/mobile-debug-console.d.ts +25 -0
  123. package/dist/esm/core/phone-auth/ui/mobile-debug-console.js +284 -0
  124. package/dist/esm/core/phone-auth/ui/modal.d.ts +84 -0
  125. package/dist/esm/core/phone-auth/ui/modal.js +570 -0
  126. package/dist/esm/core/phone-auth/validation-utils.d.ts +66 -0
  127. package/dist/esm/core/phone-auth/validation-utils.js +174 -0
  128. package/dist/esm/core/types.d.ts +62 -0
  129. package/dist/esm/core/types.js +1 -0
  130. package/dist/esm/core/version.d.ts +1 -0
  131. package/dist/esm/core/version.js +2 -0
  132. package/dist/esm/index.d.ts +12 -0
  133. package/dist/esm/index.js +15 -0
  134. package/dist/index.d.ts +12 -0
  135. package/dist/index.js +52 -0
  136. package/package.json +92 -0
@@ -0,0 +1,284 @@
1
+ /**
2
+ * Mobile Debug Console
3
+ * A lightweight console overlay for debugging on mobile devices where dev tools aren't available
4
+ */
5
+ export class MobileDebugConsole {
6
+ constructor() {
7
+ this.logs = [];
8
+ this.container = null;
9
+ this.logsContainer = null;
10
+ this.floatingToggle = null;
11
+ this.isAtBottom = true;
12
+ this.isVisible = true;
13
+ this.originalConsole = {
14
+ log: console.log,
15
+ error: console.error,
16
+ warn: console.warn,
17
+ debug: console.debug,
18
+ info: console.info,
19
+ };
20
+ this.interceptConsole();
21
+ this.createUI();
22
+ }
23
+ static init() {
24
+ if (!MobileDebugConsole.instance) {
25
+ MobileDebugConsole.instance = new MobileDebugConsole();
26
+ }
27
+ return MobileDebugConsole.instance;
28
+ }
29
+ static destroy() {
30
+ if (MobileDebugConsole.instance) {
31
+ MobileDebugConsole.instance.cleanup();
32
+ MobileDebugConsole.instance = null;
33
+ }
34
+ }
35
+ interceptConsole() {
36
+ ['log', 'error', 'warn', 'debug', 'info'].forEach(method => {
37
+ const originalMethod = this.originalConsole[method];
38
+ console[method] = (...args) => {
39
+ // Call original
40
+ originalMethod.apply(console, args);
41
+ // Add to our display
42
+ this.addLog(method, args);
43
+ };
44
+ });
45
+ }
46
+ addLog(type, args) {
47
+ const timestamp = new Date().toTimeString().split(' ')[0]; // HH:MM:SS
48
+ const content = args.map(arg => {
49
+ if (typeof arg === 'object') {
50
+ try {
51
+ return JSON.stringify(arg, null, 2);
52
+ }
53
+ catch (_a) {
54
+ return '[Object]';
55
+ }
56
+ }
57
+ return String(arg);
58
+ }).join(' ');
59
+ // Create colored log entry
60
+ const colors = {
61
+ log: '#fff',
62
+ error: '#ff6b6b',
63
+ warn: '#ffd93d',
64
+ info: '#6bcf7f',
65
+ debug: '#95a5a6'
66
+ };
67
+ const logHtml = `
68
+ <div style="margin: 4px 0; font-family: monospace; font-size: 11px; color: ${colors[type] || '#fff'};">
69
+ <span style="color: #666;">[${timestamp}]</span>
70
+ <span style="color: ${colors[type]}; font-weight: bold; text-transform: uppercase; font-size: 9px;">[${type}]</span>
71
+ <span style="white-space: pre-wrap; word-break: break-all;">${this.escapeHtml(content)}</span>
72
+ </div>
73
+ `;
74
+ this.logs.push(logHtml);
75
+ // Keep only last 500 logs
76
+ if (this.logs.length > 500) {
77
+ this.logs.shift();
78
+ }
79
+ this.updateDisplay();
80
+ }
81
+ updateDisplay() {
82
+ if (!this.logsContainer || !this.isVisible)
83
+ return;
84
+ // Check if scrolled to bottom before update
85
+ this.isAtBottom = this.logsContainer.scrollHeight - this.logsContainer.scrollTop <= this.logsContainer.clientHeight + 50;
86
+ // Update content
87
+ this.logsContainer.innerHTML = this.logs.join('');
88
+ // Auto-scroll only if was at bottom
89
+ if (this.isAtBottom) {
90
+ this.logsContainer.scrollTop = this.logsContainer.scrollHeight;
91
+ }
92
+ }
93
+ createUI() {
94
+ // Create styles
95
+ const style = document.createElement('style');
96
+ style.textContent = `
97
+ #mobile-debug-console {
98
+ position: fixed;
99
+ bottom: 0;
100
+ left: 0;
101
+ right: 0;
102
+ height: 45vh;
103
+ background: rgba(0, 0, 0, 0.95);
104
+ z-index: 999999;
105
+ display: flex;
106
+ flex-direction: column;
107
+ font-family: monospace;
108
+ transition: transform 0.3s ease;
109
+ }
110
+
111
+ #mobile-debug-console.hidden {
112
+ transform: translateY(100%);
113
+ }
114
+
115
+ #debug-header {
116
+ display: flex;
117
+ justify-content: space-between;
118
+ align-items: center;
119
+ padding: 10px;
120
+ background: #1a1a1a;
121
+ border-top: 2px solid #333;
122
+ }
123
+
124
+ #debug-title {
125
+ color: #0f0;
126
+ font-size: 12px;
127
+ font-weight: bold;
128
+ }
129
+
130
+ #debug-buttons {
131
+ display: flex;
132
+ gap: 10px;
133
+ }
134
+
135
+ #debug-buttons button {
136
+ padding: 5px 10px;
137
+ background: #333;
138
+ color: #fff;
139
+ border: 1px solid #555;
140
+ border-radius: 3px;
141
+ font-size: 11px;
142
+ cursor: pointer;
143
+ }
144
+
145
+ #debug-buttons button:active {
146
+ background: #555;
147
+ }
148
+
149
+ #debug-logs {
150
+ flex: 1;
151
+ overflow-y: auto;
152
+ padding: 10px;
153
+ -webkit-overflow-scrolling: touch;
154
+ }
155
+
156
+ #debug-floating-toggle {
157
+ position: fixed;
158
+ bottom: 20px;
159
+ right: 20px;
160
+ width: 50px;
161
+ height: 50px;
162
+ border-radius: 50%;
163
+ background: rgba(0, 0, 0, 0.8);
164
+ border: 2px solid #0f0;
165
+ color: #0f0;
166
+ cursor: pointer;
167
+ z-index: 999998;
168
+ display: none;
169
+ align-items: center;
170
+ justify-content: center;
171
+ font-size: 24px;
172
+ box-shadow: 0 2px 10px rgba(0, 255, 0, 0.3);
173
+ transition: all 0.3s ease;
174
+ }
175
+
176
+ #debug-floating-toggle:hover {
177
+ background: rgba(0, 0, 0, 0.9);
178
+ transform: scale(1.1);
179
+ box-shadow: 0 4px 15px rgba(0, 255, 0, 0.5);
180
+ }
181
+
182
+ #debug-floating-toggle.visible {
183
+ display: flex;
184
+ }
185
+ `;
186
+ document.head.appendChild(style);
187
+ // Create container
188
+ this.container = document.createElement('div');
189
+ this.container.id = 'mobile-debug-console';
190
+ if (!this.isVisible) {
191
+ this.container.className = 'hidden';
192
+ }
193
+ // Create header
194
+ const header = document.createElement('div');
195
+ header.id = 'debug-header';
196
+ const title = document.createElement('div');
197
+ title.id = 'debug-title';
198
+ title.textContent = '📱 Mobile Debug Console';
199
+ const buttons = document.createElement('div');
200
+ buttons.id = 'debug-buttons';
201
+ // Clear button
202
+ const clearBtn = document.createElement('button');
203
+ clearBtn.textContent = 'Clear';
204
+ clearBtn.onclick = () => this.clear();
205
+ // Show/Hide button
206
+ const toggleBtn = document.createElement('button');
207
+ toggleBtn.textContent = 'Hide';
208
+ toggleBtn.onclick = () => this.toggle();
209
+ // Close button
210
+ const closeBtn = document.createElement('button');
211
+ closeBtn.textContent = '✕';
212
+ closeBtn.style.color = '#ff6b6b';
213
+ closeBtn.onclick = () => this.cleanup();
214
+ buttons.appendChild(clearBtn);
215
+ buttons.appendChild(toggleBtn);
216
+ buttons.appendChild(closeBtn);
217
+ header.appendChild(title);
218
+ header.appendChild(buttons);
219
+ // Create logs container
220
+ this.logsContainer = document.createElement('div');
221
+ this.logsContainer.id = 'debug-logs';
222
+ // Track scroll position
223
+ this.logsContainer.addEventListener('scroll', () => {
224
+ this.isAtBottom = this.logsContainer.scrollHeight - this.logsContainer.scrollTop <= this.logsContainer.clientHeight + 50;
225
+ });
226
+ // Assemble
227
+ this.container.appendChild(header);
228
+ this.container.appendChild(this.logsContainer);
229
+ document.body.appendChild(this.container);
230
+ // Create floating toggle button
231
+ this.floatingToggle = document.createElement('button');
232
+ this.floatingToggle.id = 'debug-floating-toggle';
233
+ this.floatingToggle.innerHTML = '🖥️'; // Console icon
234
+ this.floatingToggle.title = 'Show Debug Console';
235
+ this.floatingToggle.onclick = () => this.toggle();
236
+ document.body.appendChild(this.floatingToggle);
237
+ // Store reference for toggle button
238
+ window.__debugToggleBtn = toggleBtn;
239
+ }
240
+ escapeHtml(text) {
241
+ const div = document.createElement('div');
242
+ div.textContent = text;
243
+ return div.innerHTML;
244
+ }
245
+ toggle() {
246
+ this.isVisible = !this.isVisible;
247
+ if (this.container && this.floatingToggle) {
248
+ if (this.isVisible) {
249
+ this.container.classList.remove('hidden');
250
+ this.floatingToggle.classList.remove('visible');
251
+ window.__debugToggleBtn.textContent = 'Hide';
252
+ this.updateDisplay();
253
+ }
254
+ else {
255
+ this.container.classList.add('hidden');
256
+ this.floatingToggle.classList.add('visible');
257
+ window.__debugToggleBtn.textContent = 'Show';
258
+ }
259
+ }
260
+ }
261
+ clear() {
262
+ this.logs = [];
263
+ if (this.logsContainer) {
264
+ this.logsContainer.innerHTML = '';
265
+ }
266
+ }
267
+ cleanup() {
268
+ // Restore original console
269
+ Object.keys(this.originalConsole).forEach(method => {
270
+ console[method] = this.originalConsole[method];
271
+ });
272
+ // Remove UI
273
+ if (this.container) {
274
+ this.container.remove();
275
+ }
276
+ // Remove floating toggle
277
+ if (this.floatingToggle) {
278
+ this.floatingToggle.remove();
279
+ }
280
+ // Clean up references
281
+ delete window.__debugToggleBtn;
282
+ }
283
+ }
284
+ MobileDebugConsole.instance = null;
@@ -0,0 +1,84 @@
1
+ /**
2
+ * Modal UI Component for Phone Authentication
3
+ *
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.
7
+ */
8
+ import type { InvokeOptions } from '../api-types';
9
+ import type { QRCodeData } from '../strategies/desktop';
10
+ /**
11
+ * 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
+ */
20
+ export declare class AuthModal {
21
+ private container;
22
+ private backdrop;
23
+ private isOpen;
24
+ private options;
25
+ private callbacks;
26
+ private closeCallback?;
27
+ constructor(options?: InvokeOptions['modalOptions'], callbacks?: InvokeOptions['callbacks']);
28
+ private handleEscapeKey;
29
+ /**
30
+ * Shows the modal with a QR code for desktop authentication
31
+ * Supports both single QR code (legacy) and dual-platform QR codes (iOS + Android)
32
+ */
33
+ showQRCode(qrCodeData: string | QRCodeData, statusMessage?: string): void;
34
+ /**
35
+ * Creates a modal with iOS/Android platform toggle
36
+ */
37
+ private createDualPlatformQRModal;
38
+ /**
39
+ * Sets a callback to be called when the modal is cancelled/closed
40
+ */
41
+ setCloseCallback(callback: () => void): void;
42
+ /**
43
+ * Shows the modal with a button for Link authentication (App Clips)
44
+ * IMPORTANT: The button click is required for iOS to recognize the app link
45
+ */
46
+ showLinkButton(url: string, buttonText?: string): Promise<void>;
47
+ /**
48
+ * Shows the modal with a button for TS43 authentication
49
+ * IMPORTANT: The button click is required for Digital Credentials API (transient activation)
50
+ */
51
+ showTS43Button(onAuthenticate: () => Promise<any>): Promise<any>;
52
+ /**
53
+ * Updates the status message in the modal
54
+ */
55
+ updateStatus(message: string, isError?: boolean): void;
56
+ /**
57
+ * Creates the modal HTML structure
58
+ */
59
+ private createModal;
60
+ /**
61
+ * Injects CSS styles for the modal
62
+ */
63
+ private injectStyles;
64
+ /**
65
+ * Shows the modal with animation
66
+ */
67
+ show(): void;
68
+ /**
69
+ * Setup click handlers for iOS/Android platform toggle
70
+ */
71
+ private setupPlatformToggles;
72
+ /**
73
+ * Closes the modal with animation
74
+ */
75
+ close(): void;
76
+ /**
77
+ * Removes modal elements from DOM
78
+ */
79
+ private cleanup;
80
+ /**
81
+ * Check if modal is currently open
82
+ */
83
+ isModalOpen(): boolean;
84
+ }