@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,288 @@
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
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.MobileDebugConsole = void 0;
8
+ class MobileDebugConsole {
9
+ constructor() {
10
+ this.logs = [];
11
+ this.container = null;
12
+ this.logsContainer = null;
13
+ this.floatingToggle = null;
14
+ this.isAtBottom = true;
15
+ this.isVisible = true;
16
+ this.originalConsole = {
17
+ log: console.log,
18
+ error: console.error,
19
+ warn: console.warn,
20
+ debug: console.debug,
21
+ info: console.info,
22
+ };
23
+ this.interceptConsole();
24
+ this.createUI();
25
+ }
26
+ static init() {
27
+ if (!MobileDebugConsole.instance) {
28
+ MobileDebugConsole.instance = new MobileDebugConsole();
29
+ }
30
+ return MobileDebugConsole.instance;
31
+ }
32
+ static destroy() {
33
+ if (MobileDebugConsole.instance) {
34
+ MobileDebugConsole.instance.cleanup();
35
+ MobileDebugConsole.instance = null;
36
+ }
37
+ }
38
+ interceptConsole() {
39
+ ['log', 'error', 'warn', 'debug', 'info'].forEach(method => {
40
+ const originalMethod = this.originalConsole[method];
41
+ console[method] = (...args) => {
42
+ // Call original
43
+ originalMethod.apply(console, args);
44
+ // Add to our display
45
+ this.addLog(method, args);
46
+ };
47
+ });
48
+ }
49
+ addLog(type, args) {
50
+ const timestamp = new Date().toTimeString().split(' ')[0]; // HH:MM:SS
51
+ const content = args.map(arg => {
52
+ if (typeof arg === 'object') {
53
+ try {
54
+ return JSON.stringify(arg, null, 2);
55
+ }
56
+ catch (_a) {
57
+ return '[Object]';
58
+ }
59
+ }
60
+ return String(arg);
61
+ }).join(' ');
62
+ // Create colored log entry
63
+ const colors = {
64
+ log: '#fff',
65
+ error: '#ff6b6b',
66
+ warn: '#ffd93d',
67
+ info: '#6bcf7f',
68
+ debug: '#95a5a6'
69
+ };
70
+ const logHtml = `
71
+ <div style="margin: 4px 0; font-family: monospace; font-size: 11px; color: ${colors[type] || '#fff'};">
72
+ <span style="color: #666;">[${timestamp}]</span>
73
+ <span style="color: ${colors[type]}; font-weight: bold; text-transform: uppercase; font-size: 9px;">[${type}]</span>
74
+ <span style="white-space: pre-wrap; word-break: break-all;">${this.escapeHtml(content)}</span>
75
+ </div>
76
+ `;
77
+ this.logs.push(logHtml);
78
+ // Keep only last 500 logs
79
+ if (this.logs.length > 500) {
80
+ this.logs.shift();
81
+ }
82
+ this.updateDisplay();
83
+ }
84
+ updateDisplay() {
85
+ if (!this.logsContainer || !this.isVisible)
86
+ return;
87
+ // Check if scrolled to bottom before update
88
+ this.isAtBottom = this.logsContainer.scrollHeight - this.logsContainer.scrollTop <= this.logsContainer.clientHeight + 50;
89
+ // Update content
90
+ this.logsContainer.innerHTML = this.logs.join('');
91
+ // Auto-scroll only if was at bottom
92
+ if (this.isAtBottom) {
93
+ this.logsContainer.scrollTop = this.logsContainer.scrollHeight;
94
+ }
95
+ }
96
+ createUI() {
97
+ // Create styles
98
+ const style = document.createElement('style');
99
+ style.textContent = `
100
+ #mobile-debug-console {
101
+ position: fixed;
102
+ bottom: 0;
103
+ left: 0;
104
+ right: 0;
105
+ height: 45vh;
106
+ background: rgba(0, 0, 0, 0.95);
107
+ z-index: 999999;
108
+ display: flex;
109
+ flex-direction: column;
110
+ font-family: monospace;
111
+ transition: transform 0.3s ease;
112
+ }
113
+
114
+ #mobile-debug-console.hidden {
115
+ transform: translateY(100%);
116
+ }
117
+
118
+ #debug-header {
119
+ display: flex;
120
+ justify-content: space-between;
121
+ align-items: center;
122
+ padding: 10px;
123
+ background: #1a1a1a;
124
+ border-top: 2px solid #333;
125
+ }
126
+
127
+ #debug-title {
128
+ color: #0f0;
129
+ font-size: 12px;
130
+ font-weight: bold;
131
+ }
132
+
133
+ #debug-buttons {
134
+ display: flex;
135
+ gap: 10px;
136
+ }
137
+
138
+ #debug-buttons button {
139
+ padding: 5px 10px;
140
+ background: #333;
141
+ color: #fff;
142
+ border: 1px solid #555;
143
+ border-radius: 3px;
144
+ font-size: 11px;
145
+ cursor: pointer;
146
+ }
147
+
148
+ #debug-buttons button:active {
149
+ background: #555;
150
+ }
151
+
152
+ #debug-logs {
153
+ flex: 1;
154
+ overflow-y: auto;
155
+ padding: 10px;
156
+ -webkit-overflow-scrolling: touch;
157
+ }
158
+
159
+ #debug-floating-toggle {
160
+ position: fixed;
161
+ bottom: 20px;
162
+ right: 20px;
163
+ width: 50px;
164
+ height: 50px;
165
+ border-radius: 50%;
166
+ background: rgba(0, 0, 0, 0.8);
167
+ border: 2px solid #0f0;
168
+ color: #0f0;
169
+ cursor: pointer;
170
+ z-index: 999998;
171
+ display: none;
172
+ align-items: center;
173
+ justify-content: center;
174
+ font-size: 24px;
175
+ box-shadow: 0 2px 10px rgba(0, 255, 0, 0.3);
176
+ transition: all 0.3s ease;
177
+ }
178
+
179
+ #debug-floating-toggle:hover {
180
+ background: rgba(0, 0, 0, 0.9);
181
+ transform: scale(1.1);
182
+ box-shadow: 0 4px 15px rgba(0, 255, 0, 0.5);
183
+ }
184
+
185
+ #debug-floating-toggle.visible {
186
+ display: flex;
187
+ }
188
+ `;
189
+ document.head.appendChild(style);
190
+ // Create container
191
+ this.container = document.createElement('div');
192
+ this.container.id = 'mobile-debug-console';
193
+ if (!this.isVisible) {
194
+ this.container.className = 'hidden';
195
+ }
196
+ // Create header
197
+ const header = document.createElement('div');
198
+ header.id = 'debug-header';
199
+ const title = document.createElement('div');
200
+ title.id = 'debug-title';
201
+ title.textContent = '📱 Mobile Debug Console';
202
+ const buttons = document.createElement('div');
203
+ buttons.id = 'debug-buttons';
204
+ // Clear button
205
+ const clearBtn = document.createElement('button');
206
+ clearBtn.textContent = 'Clear';
207
+ clearBtn.onclick = () => this.clear();
208
+ // Show/Hide button
209
+ const toggleBtn = document.createElement('button');
210
+ toggleBtn.textContent = 'Hide';
211
+ toggleBtn.onclick = () => this.toggle();
212
+ // Close button
213
+ const closeBtn = document.createElement('button');
214
+ closeBtn.textContent = '✕';
215
+ closeBtn.style.color = '#ff6b6b';
216
+ closeBtn.onclick = () => this.cleanup();
217
+ buttons.appendChild(clearBtn);
218
+ buttons.appendChild(toggleBtn);
219
+ buttons.appendChild(closeBtn);
220
+ header.appendChild(title);
221
+ header.appendChild(buttons);
222
+ // Create logs container
223
+ this.logsContainer = document.createElement('div');
224
+ this.logsContainer.id = 'debug-logs';
225
+ // Track scroll position
226
+ this.logsContainer.addEventListener('scroll', () => {
227
+ this.isAtBottom = this.logsContainer.scrollHeight - this.logsContainer.scrollTop <= this.logsContainer.clientHeight + 50;
228
+ });
229
+ // Assemble
230
+ this.container.appendChild(header);
231
+ this.container.appendChild(this.logsContainer);
232
+ document.body.appendChild(this.container);
233
+ // Create floating toggle button
234
+ this.floatingToggle = document.createElement('button');
235
+ this.floatingToggle.id = 'debug-floating-toggle';
236
+ this.floatingToggle.innerHTML = '🖥️'; // Console icon
237
+ this.floatingToggle.title = 'Show Debug Console';
238
+ this.floatingToggle.onclick = () => this.toggle();
239
+ document.body.appendChild(this.floatingToggle);
240
+ // Store reference for toggle button
241
+ window.__debugToggleBtn = toggleBtn;
242
+ }
243
+ escapeHtml(text) {
244
+ const div = document.createElement('div');
245
+ div.textContent = text;
246
+ return div.innerHTML;
247
+ }
248
+ toggle() {
249
+ this.isVisible = !this.isVisible;
250
+ if (this.container && this.floatingToggle) {
251
+ if (this.isVisible) {
252
+ this.container.classList.remove('hidden');
253
+ this.floatingToggle.classList.remove('visible');
254
+ window.__debugToggleBtn.textContent = 'Hide';
255
+ this.updateDisplay();
256
+ }
257
+ else {
258
+ this.container.classList.add('hidden');
259
+ this.floatingToggle.classList.add('visible');
260
+ window.__debugToggleBtn.textContent = 'Show';
261
+ }
262
+ }
263
+ }
264
+ clear() {
265
+ this.logs = [];
266
+ if (this.logsContainer) {
267
+ this.logsContainer.innerHTML = '';
268
+ }
269
+ }
270
+ cleanup() {
271
+ // Restore original console
272
+ Object.keys(this.originalConsole).forEach(method => {
273
+ console[method] = this.originalConsole[method];
274
+ });
275
+ // Remove UI
276
+ if (this.container) {
277
+ this.container.remove();
278
+ }
279
+ // Remove floating toggle
280
+ if (this.floatingToggle) {
281
+ this.floatingToggle.remove();
282
+ }
283
+ // Clean up references
284
+ delete window.__debugToggleBtn;
285
+ }
286
+ }
287
+ exports.MobileDebugConsole = MobileDebugConsole;
288
+ 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
+ }