@glideidentity/web-client-sdk 5.0.0 → 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.
- package/README.md +108 -8
- package/dist/adapters/angular/index.js +0 -1
- package/dist/adapters/angular/phone-auth.service.d.ts +0 -18
- package/dist/adapters/angular/phone-auth.service.js +0 -26
- package/dist/adapters/react/index.js +0 -3
- package/dist/adapters/react/useClient.js +0 -1
- package/dist/adapters/react/usePhoneAuth.js +1 -16
- package/dist/adapters/vanilla/client.js +0 -1
- package/dist/adapters/vanilla/index.js +0 -1
- package/dist/adapters/vanilla/phone-auth.js +0 -31
- package/dist/adapters/vue/index.js +0 -4
- package/dist/adapters/vue/useClient.js +0 -5
- package/dist/adapters/vue/usePhoneAuth.js +1 -20
- package/dist/browser/web-client-sdk.min.js +1 -1
- package/dist/browser.js +0 -6
- package/dist/core/client.js +0 -12
- package/dist/core/logger.js +1 -81
- package/dist/core/phone-auth/api-types.js +0 -83
- package/dist/core/phone-auth/client.js +27 -366
- package/dist/core/phone-auth/error-utils.js +1 -83
- package/dist/core/phone-auth/index.js +0 -1
- package/dist/core/phone-auth/status-types.d.ts +0 -78
- package/dist/core/phone-auth/status-types.js +0 -17
- package/dist/core/phone-auth/strategies/desktop.js +8 -126
- package/dist/core/phone-auth/strategies/index.d.ts +0 -4
- package/dist/core/phone-auth/strategies/index.js +0 -4
- package/dist/core/phone-auth/strategies/link.js +10 -88
- package/dist/core/phone-auth/strategies/ts43.d.ts +0 -19
- package/dist/core/phone-auth/strategies/ts43.js +2 -33
- package/dist/core/phone-auth/strategies/types.js +0 -4
- package/dist/core/phone-auth/type-guards.js +0 -131
- package/dist/core/phone-auth/types.js +0 -32
- package/dist/core/phone-auth/ui/mobile-debug-console.js +2 -28
- package/dist/core/phone-auth/ui/modal.d.ts +33 -55
- package/dist/core/phone-auth/ui/modal.js +889 -422
- package/dist/core/phone-auth/validation-utils.js +2 -40
- package/dist/core/version.js +1 -2
- package/dist/esm/adapters/angular/index.js +0 -1
- package/dist/esm/adapters/angular/phone-auth.service.d.ts +0 -18
- package/dist/esm/adapters/angular/phone-auth.service.js +0 -26
- package/dist/esm/adapters/react/index.js +0 -3
- package/dist/esm/adapters/react/useClient.js +0 -1
- package/dist/esm/adapters/react/usePhoneAuth.js +1 -16
- package/dist/esm/adapters/vanilla/client.js +0 -1
- package/dist/esm/adapters/vanilla/index.js +0 -1
- package/dist/esm/adapters/vanilla/phone-auth.d.ts +0 -24
- package/dist/esm/adapters/vanilla/phone-auth.js +0 -31
- package/dist/esm/adapters/vue/index.js +0 -4
- package/dist/esm/adapters/vue/useClient.js +0 -5
- package/dist/esm/adapters/vue/usePhoneAuth.js +1 -20
- package/dist/esm/browser.js +0 -6
- package/dist/esm/core/client.d.ts +0 -10
- package/dist/esm/core/client.js +0 -12
- package/dist/esm/core/logger.d.ts +0 -53
- package/dist/esm/core/logger.js +1 -81
- package/dist/esm/core/phone-auth/api-types.d.ts +0 -315
- package/dist/esm/core/phone-auth/api-types.js +0 -83
- package/dist/esm/core/phone-auth/client.d.ts +0 -144
- package/dist/esm/core/phone-auth/client.js +27 -366
- package/dist/esm/core/phone-auth/error-utils.d.ts +0 -29
- package/dist/esm/core/phone-auth/error-utils.js +1 -83
- package/dist/esm/core/phone-auth/index.js +1 -3
- package/dist/esm/core/phone-auth/status-types.d.ts +0 -78
- package/dist/esm/core/phone-auth/status-types.js +0 -17
- package/dist/esm/core/phone-auth/strategies/desktop.d.ts +0 -63
- package/dist/esm/core/phone-auth/strategies/desktop.js +8 -126
- package/dist/esm/core/phone-auth/strategies/index.d.ts +0 -4
- package/dist/esm/core/phone-auth/strategies/index.js +0 -4
- package/dist/esm/core/phone-auth/strategies/link.d.ts +0 -48
- package/dist/esm/core/phone-auth/strategies/link.js +10 -88
- package/dist/esm/core/phone-auth/strategies/ts43.d.ts +0 -19
- package/dist/esm/core/phone-auth/strategies/ts43.js +2 -33
- package/dist/esm/core/phone-auth/strategies/types.d.ts +0 -13
- package/dist/esm/core/phone-auth/strategies/types.js +0 -4
- package/dist/esm/core/phone-auth/type-guards.d.ts +0 -128
- package/dist/esm/core/phone-auth/type-guards.js +0 -131
- package/dist/esm/core/phone-auth/types.d.ts +0 -108
- package/dist/esm/core/phone-auth/types.js +0 -32
- package/dist/esm/core/phone-auth/ui/mobile-debug-console.d.ts +0 -4
- package/dist/esm/core/phone-auth/ui/mobile-debug-console.js +2 -28
- package/dist/esm/core/phone-auth/ui/modal.d.ts +27 -68
- package/dist/esm/core/phone-auth/ui/modal.js +889 -422
- package/dist/esm/core/phone-auth/validation-utils.d.ts +0 -31
- package/dist/esm/core/phone-auth/validation-utils.js +2 -40
- package/dist/esm/core/types.d.ts +0 -35
- package/dist/esm/core/version.js +1 -2
- package/dist/esm/index.js +1 -9
- package/dist/index.js +0 -7
- package/package.json +1 -1
|
@@ -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];
|
|
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 = '🖥️';
|
|
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.
|
|
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
|
-
|
|
28
|
-
private
|
|
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
|
-
*
|
|
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
|
|
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
|
-
*
|
|
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
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
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
|
-
|
|
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
|
}
|