@glideidentity/web-client-sdk 5.1.2 → 6.0.0-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.
- package/README.md +337 -526
- package/dist/browser/web-client-sdk.min.js +1 -1
- package/dist/cjs/adapters/index.js +15 -0
- package/dist/cjs/adapters/react.js +192 -0
- package/dist/cjs/adapters/vanilla.js +38 -0
- package/dist/cjs/adapters/vue.js +187 -0
- package/dist/cjs/browser.js +58 -0
- package/dist/cjs/client/http.js +159 -0
- package/dist/cjs/client/index.js +19 -0
- package/dist/cjs/client/logger.js +135 -0
- package/dist/cjs/client/phone-auth-client.js +439 -0
- package/dist/cjs/client/strategies/polling.js +177 -0
- package/dist/cjs/core/errors.js +204 -0
- package/dist/cjs/core/index.js +83 -0
- package/dist/cjs/core/type-guards.js +196 -0
- package/dist/cjs/core/types.js +25 -0
- package/dist/{core/phone-auth/validation-utils.js → cjs/core/validators.js} +70 -23
- package/dist/cjs/index.js +81 -0
- package/dist/cjs/ui/index.js +11 -0
- package/dist/{core/phone-auth → cjs}/ui/mobile-debug-console.js +149 -78
- package/dist/cjs/ui/modal.js +1122 -0
- package/dist/esm/adapters/index.js +11 -0
- package/dist/esm/adapters/react.js +182 -0
- package/dist/esm/adapters/vanilla.js +29 -0
- package/dist/esm/adapters/vue.js +177 -0
- package/dist/esm/browser.js +30 -11
- package/dist/esm/client/http.js +156 -0
- package/dist/esm/client/index.js +11 -0
- package/dist/esm/client/logger.js +131 -0
- package/dist/esm/client/phone-auth-client.js +435 -0
- package/dist/esm/client/strategies/polling.js +174 -0
- package/dist/esm/core/errors.js +193 -0
- package/dist/esm/core/index.js +60 -0
- package/dist/esm/core/type-guards.js +181 -0
- package/dist/esm/core/types.js +22 -1
- package/dist/esm/core/{phone-auth/validation-utils.js → validators.js} +66 -21
- package/dist/esm/index.js +45 -17
- package/dist/esm/ui/index.js +5 -0
- package/dist/esm/{core/phone-auth/ui → ui}/mobile-debug-console.js +149 -78
- package/dist/esm/ui/modal.js +1117 -0
- package/dist/types/adapters/index.d.ts +10 -0
- package/dist/types/adapters/index.d.ts.map +1 -0
- package/dist/types/adapters/react.d.ts +70 -0
- package/dist/types/adapters/react.d.ts.map +1 -0
- package/dist/types/adapters/vanilla.d.ts +29 -0
- package/dist/types/adapters/vanilla.d.ts.map +1 -0
- package/dist/types/adapters/vue.d.ts +71 -0
- package/dist/types/adapters/vue.d.ts.map +1 -0
- package/dist/types/browser.d.ts +27 -0
- package/dist/types/browser.d.ts.map +1 -0
- package/dist/types/client/http.d.ts +41 -0
- package/dist/types/client/http.d.ts.map +1 -0
- package/dist/types/client/index.d.ts +10 -0
- package/dist/types/client/index.d.ts.map +1 -0
- package/dist/types/client/logger.d.ts +36 -0
- package/dist/types/client/logger.d.ts.map +1 -0
- package/dist/types/client/phone-auth-client.d.ts +91 -0
- package/dist/types/client/phone-auth-client.d.ts.map +1 -0
- package/dist/types/client/strategies/polling.d.ts +36 -0
- package/dist/types/client/strategies/polling.d.ts.map +1 -0
- package/dist/types/core/errors.d.ts +71 -0
- package/dist/types/core/errors.d.ts.map +1 -0
- package/dist/types/core/index.d.ts +38 -0
- package/dist/types/core/index.d.ts.map +1 -0
- package/dist/types/core/type-guards.d.ts +118 -0
- package/dist/types/core/type-guards.d.ts.map +1 -0
- package/dist/types/core/types.d.ts +534 -0
- package/dist/types/core/types.d.ts.map +1 -0
- package/dist/types/core/validators.d.ts +63 -0
- package/dist/types/core/validators.d.ts.map +1 -0
- package/dist/types/index.d.ts +40 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/ui/index.d.ts +6 -0
- package/dist/types/ui/index.d.ts.map +1 -0
- package/dist/{esm/core/phone-auth → types}/ui/mobile-debug-console.d.ts +1 -0
- package/dist/types/ui/mobile-debug-console.d.ts.map +1 -0
- package/dist/types/ui/modal.d.ts +87 -0
- package/dist/types/ui/modal.d.ts.map +1 -0
- package/package.json +48 -34
- package/dist/adapters/angular/client.service.d.ts +0 -7
- package/dist/adapters/angular/client.service.js +0 -30
- package/dist/adapters/angular/index.d.ts +0 -3
- package/dist/adapters/angular/index.js +0 -18
- package/dist/adapters/angular/phone-auth.service.d.ts +0 -38
- package/dist/adapters/angular/phone-auth.service.js +0 -130
- package/dist/adapters/react/index.d.ts +0 -9
- package/dist/adapters/react/index.js +0 -28
- package/dist/adapters/react/useClient.d.ts +0 -26
- package/dist/adapters/react/useClient.js +0 -121
- package/dist/adapters/react/usePhoneAuth.d.ts +0 -23
- package/dist/adapters/react/usePhoneAuth.js +0 -95
- package/dist/adapters/vanilla/client.d.ts +0 -8
- package/dist/adapters/vanilla/client.js +0 -33
- package/dist/adapters/vanilla/index.d.ts +0 -3
- package/dist/adapters/vanilla/index.js +0 -18
- package/dist/adapters/vanilla/phone-auth.d.ts +0 -46
- package/dist/adapters/vanilla/phone-auth.js +0 -138
- package/dist/adapters/vue/index.d.ts +0 -10
- package/dist/adapters/vue/index.js +0 -36
- package/dist/adapters/vue/useClient.d.ts +0 -115
- package/dist/adapters/vue/useClient.js +0 -131
- package/dist/adapters/vue/usePhoneAuth.d.ts +0 -94
- package/dist/adapters/vue/usePhoneAuth.js +0 -103
- package/dist/browser.d.ts +0 -7
- package/dist/browser.js +0 -31
- package/dist/core/client.d.ts +0 -22
- package/dist/core/client.js +0 -77
- package/dist/core/logger.d.ts +0 -130
- package/dist/core/logger.js +0 -370
- package/dist/core/phone-auth/api-types.d.ts +0 -593
- package/dist/core/phone-auth/api-types.js +0 -215
- package/dist/core/phone-auth/client.d.ts +0 -189
- package/dist/core/phone-auth/client.js +0 -1441
- package/dist/core/phone-auth/error-utils.d.ts +0 -110
- package/dist/core/phone-auth/error-utils.js +0 -350
- package/dist/core/phone-auth/index.d.ts +0 -7
- package/dist/core/phone-auth/index.js +0 -50
- package/dist/core/phone-auth/status-types.d.ts +0 -107
- package/dist/core/phone-auth/status-types.js +0 -31
- package/dist/core/phone-auth/strategies/desktop.d.ts +0 -122
- package/dist/core/phone-auth/strategies/desktop.js +0 -596
- package/dist/core/phone-auth/strategies/index.d.ts +0 -11
- package/dist/core/phone-auth/strategies/index.js +0 -15
- package/dist/core/phone-auth/strategies/link.d.ts +0 -89
- package/dist/core/phone-auth/strategies/link.js +0 -384
- package/dist/core/phone-auth/strategies/ts43.d.ts +0 -32
- package/dist/core/phone-auth/strategies/ts43.js +0 -151
- package/dist/core/phone-auth/strategies/types.d.ts +0 -18
- package/dist/core/phone-auth/strategies/types.js +0 -6
- package/dist/core/phone-auth/type-guards.d.ts +0 -143
- package/dist/core/phone-auth/type-guards.js +0 -198
- package/dist/core/phone-auth/types.d.ts +0 -237
- package/dist/core/phone-auth/types.js +0 -93
- package/dist/core/phone-auth/ui/mobile-debug-console.d.ts +0 -25
- package/dist/core/phone-auth/ui/modal.d.ts +0 -88
- package/dist/core/phone-auth/ui/modal.js +0 -598
- package/dist/core/phone-auth/validation-utils.d.ts +0 -44
- package/dist/core/types.d.ts +0 -62
- package/dist/core/types.js +0 -2
- package/dist/core/version.d.ts +0 -1
- package/dist/core/version.js +0 -5
- package/dist/esm/adapters/angular/client.service.d.ts +0 -7
- package/dist/esm/adapters/angular/client.service.js +0 -27
- package/dist/esm/adapters/angular/index.d.ts +0 -3
- package/dist/esm/adapters/angular/index.js +0 -4
- package/dist/esm/adapters/angular/phone-auth.service.d.ts +0 -38
- package/dist/esm/adapters/angular/phone-auth.service.js +0 -127
- package/dist/esm/adapters/react/index.d.ts +0 -9
- package/dist/esm/adapters/react/index.js +0 -8
- package/dist/esm/adapters/react/useClient.d.ts +0 -26
- package/dist/esm/adapters/react/useClient.js +0 -116
- package/dist/esm/adapters/react/usePhoneAuth.d.ts +0 -23
- package/dist/esm/adapters/react/usePhoneAuth.js +0 -92
- package/dist/esm/adapters/vanilla/client.d.ts +0 -8
- package/dist/esm/adapters/vanilla/client.js +0 -29
- package/dist/esm/adapters/vanilla/index.d.ts +0 -3
- package/dist/esm/adapters/vanilla/index.js +0 -4
- package/dist/esm/adapters/vanilla/phone-auth.d.ts +0 -46
- package/dist/esm/adapters/vanilla/phone-auth.js +0 -134
- package/dist/esm/adapters/vue/index.d.ts +0 -10
- package/dist/esm/adapters/vue/index.js +0 -11
- package/dist/esm/adapters/vue/useClient.d.ts +0 -115
- package/dist/esm/adapters/vue/useClient.js +0 -127
- package/dist/esm/adapters/vue/usePhoneAuth.d.ts +0 -94
- package/dist/esm/adapters/vue/usePhoneAuth.js +0 -100
- package/dist/esm/browser.d.ts +0 -7
- package/dist/esm/core/client.d.ts +0 -22
- package/dist/esm/core/client.js +0 -70
- package/dist/esm/core/logger.d.ts +0 -130
- package/dist/esm/core/logger.js +0 -359
- package/dist/esm/core/phone-auth/api-types.d.ts +0 -593
- package/dist/esm/core/phone-auth/api-types.js +0 -203
- package/dist/esm/core/phone-auth/client.d.ts +0 -189
- package/dist/esm/core/phone-auth/client.js +0 -1404
- package/dist/esm/core/phone-auth/error-utils.d.ts +0 -110
- package/dist/esm/core/phone-auth/error-utils.js +0 -338
- package/dist/esm/core/phone-auth/index.d.ts +0 -7
- package/dist/esm/core/phone-auth/index.js +0 -8
- package/dist/esm/core/phone-auth/status-types.d.ts +0 -107
- package/dist/esm/core/phone-auth/status-types.js +0 -26
- package/dist/esm/core/phone-auth/strategies/desktop.d.ts +0 -122
- package/dist/esm/core/phone-auth/strategies/desktop.js +0 -590
- package/dist/esm/core/phone-auth/strategies/index.d.ts +0 -11
- package/dist/esm/core/phone-auth/strategies/index.js +0 -7
- package/dist/esm/core/phone-auth/strategies/link.d.ts +0 -89
- package/dist/esm/core/phone-auth/strategies/link.js +0 -380
- package/dist/esm/core/phone-auth/strategies/ts43.d.ts +0 -32
- package/dist/esm/core/phone-auth/strategies/ts43.js +0 -147
- package/dist/esm/core/phone-auth/strategies/types.d.ts +0 -18
- package/dist/esm/core/phone-auth/strategies/types.js +0 -5
- package/dist/esm/core/phone-auth/type-guards.d.ts +0 -143
- package/dist/esm/core/phone-auth/type-guards.js +0 -185
- package/dist/esm/core/phone-auth/types.d.ts +0 -237
- package/dist/esm/core/phone-auth/types.js +0 -76
- package/dist/esm/core/phone-auth/ui/modal.d.ts +0 -88
- package/dist/esm/core/phone-auth/ui/modal.js +0 -594
- package/dist/esm/core/phone-auth/validation-utils.d.ts +0 -44
- package/dist/esm/core/types.d.ts +0 -62
- package/dist/esm/core/version.d.ts +0 -1
- package/dist/esm/core/version.js +0 -2
- package/dist/esm/index.d.ts +0 -12
- package/dist/index.d.ts +0 -12
- package/dist/index.js +0 -55
|
@@ -1,88 +0,0 @@
|
|
|
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
|
-
* Escape HTML to prevent XSS attacks
|
|
31
|
-
*/
|
|
32
|
-
private escapeHtml;
|
|
33
|
-
/**
|
|
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)
|
|
36
|
-
*/
|
|
37
|
-
showQRCode(qrCodeData: string | QRCodeData, statusMessage?: string): void;
|
|
38
|
-
/**
|
|
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
|
|
44
|
-
*/
|
|
45
|
-
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
|
-
*/
|
|
63
|
-
private createModal;
|
|
64
|
-
/**
|
|
65
|
-
* Injects CSS styles for the modal
|
|
66
|
-
*/
|
|
67
|
-
private injectStyles;
|
|
68
|
-
/**
|
|
69
|
-
* Shows the modal with animation
|
|
70
|
-
*/
|
|
71
|
-
show(): void;
|
|
72
|
-
/**
|
|
73
|
-
* Setup click handlers for iOS/Android platform toggle
|
|
74
|
-
*/
|
|
75
|
-
private setupPlatformToggles;
|
|
76
|
-
/**
|
|
77
|
-
* Closes the modal with animation
|
|
78
|
-
*/
|
|
79
|
-
close(): void;
|
|
80
|
-
/**
|
|
81
|
-
* Removes modal elements from DOM
|
|
82
|
-
*/
|
|
83
|
-
private cleanup;
|
|
84
|
-
/**
|
|
85
|
-
* Check if modal is currently open
|
|
86
|
-
*/
|
|
87
|
-
isModalOpen(): boolean;
|
|
88
|
-
}
|
|
@@ -1,598 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Modal UI Component for Phone Authentication
|
|
4
|
-
*
|
|
5
|
-
* This file creates the UI components (modals, buttons) that are shown
|
|
6
|
-
* when the SDK is NOT in headless mode. Think of it like a popup window
|
|
7
|
-
* that handles the authentication flow for you.
|
|
8
|
-
*/
|
|
9
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
10
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
11
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
12
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
13
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
14
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
15
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
16
|
-
});
|
|
17
|
-
};
|
|
18
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
-
exports.AuthModal = void 0;
|
|
20
|
-
/**
|
|
21
|
-
* Creates and manages a modal dialog for authentication
|
|
22
|
-
*
|
|
23
|
-
* @example
|
|
24
|
-
* const modal = new AuthModal({
|
|
25
|
-
* title: "Verify Your Phone",
|
|
26
|
-
* description: "Complete authentication to continue"
|
|
27
|
-
* });
|
|
28
|
-
* modal.show();
|
|
29
|
-
*/
|
|
30
|
-
class AuthModal {
|
|
31
|
-
constructor(options, callbacks) {
|
|
32
|
-
this.container = null;
|
|
33
|
-
this.backdrop = null;
|
|
34
|
-
this.isOpen = false;
|
|
35
|
-
this.options = options || {};
|
|
36
|
-
this.callbacks = callbacks || {};
|
|
37
|
-
// Bind escape key handler
|
|
38
|
-
this.handleEscapeKey = this.handleEscapeKey.bind(this);
|
|
39
|
-
}
|
|
40
|
-
handleEscapeKey(event) {
|
|
41
|
-
var _a, _b;
|
|
42
|
-
if (event.key === 'Escape' && this.isOpen) {
|
|
43
|
-
// Check if escape closing is enabled (default true)
|
|
44
|
-
if (((_a = this.options) === null || _a === void 0 ? void 0 : _a.closeOnEscape) !== false) {
|
|
45
|
-
(_b = this.closeCallback) === null || _b === void 0 ? void 0 : _b.call(this); // Call the cancellation callback if set
|
|
46
|
-
this.close();
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
/**
|
|
51
|
-
* Escape HTML to prevent XSS attacks
|
|
52
|
-
*/
|
|
53
|
-
escapeHtml(unsafe) {
|
|
54
|
-
return unsafe
|
|
55
|
-
.replace(/&/g, "&")
|
|
56
|
-
.replace(/</g, "<")
|
|
57
|
-
.replace(/>/g, ">")
|
|
58
|
-
.replace(/"/g, """)
|
|
59
|
-
.replace(/'/g, "'");
|
|
60
|
-
}
|
|
61
|
-
/**
|
|
62
|
-
* Shows the modal with a QR code for desktop authentication
|
|
63
|
-
* Supports both single QR code (legacy) and dual-platform QR codes (iOS + Android)
|
|
64
|
-
*/
|
|
65
|
-
showQRCode(qrCodeData, statusMessage = 'Scan QR code with your phone') {
|
|
66
|
-
console.log('[Modal] showQRCode called with:', qrCodeData);
|
|
67
|
-
// If modal is already open, don't recreate it
|
|
68
|
-
if (this.isOpen) {
|
|
69
|
-
console.log('[Modal] Modal already open, skipping recreation');
|
|
70
|
-
return;
|
|
71
|
-
}
|
|
72
|
-
// Check if it's the new dual-platform format with VALID Android QR code
|
|
73
|
-
if (typeof qrCodeData === 'object' && qrCodeData.iosQRCode) {
|
|
74
|
-
const hasValidAndroidQR = qrCodeData.androidQRCode &&
|
|
75
|
-
qrCodeData.androidQRCode.length > 0 &&
|
|
76
|
-
qrCodeData.androidQRCode !== qrCodeData.iosQRCode;
|
|
77
|
-
console.log('[Modal] Has valid Android QR?', hasValidAndroidQR);
|
|
78
|
-
if (hasValidAndroidQR) {
|
|
79
|
-
console.log('[Modal] Using dual-platform modal');
|
|
80
|
-
this.createDualPlatformQRModal(qrCodeData, statusMessage);
|
|
81
|
-
// Note: createDualPlatformQRModal calls show() internally
|
|
82
|
-
return;
|
|
83
|
-
}
|
|
84
|
-
else {
|
|
85
|
-
console.log('[Modal] Android QR missing/empty, using single iOS QR');
|
|
86
|
-
// Only iOS QR code available - show single QR
|
|
87
|
-
this.createModal(`
|
|
88
|
-
<div class="glide-auth-qr-container">
|
|
89
|
-
<img src="${this.escapeHtml(qrCodeData.iosQRCode)}" alt="QR Code" class="glide-auth-qr-code" />
|
|
90
|
-
<p class="glide-auth-status">Scan with your iPhone to authenticate</p>
|
|
91
|
-
</div>
|
|
92
|
-
`);
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
else {
|
|
96
|
-
console.log('[Modal] Using legacy single QR code modal');
|
|
97
|
-
// Legacy single QR code
|
|
98
|
-
this.createModal(`
|
|
99
|
-
<div class="glide-auth-qr-container">
|
|
100
|
-
<img src="${this.escapeHtml(qrCodeData)}" alt="QR Code" class="glide-auth-qr-code" />
|
|
101
|
-
<p class="glide-auth-status">${this.escapeHtml(statusMessage)}</p>
|
|
102
|
-
</div>
|
|
103
|
-
`);
|
|
104
|
-
}
|
|
105
|
-
this.show();
|
|
106
|
-
}
|
|
107
|
-
/**
|
|
108
|
-
* Creates a modal with iOS/Android platform toggle
|
|
109
|
-
*/
|
|
110
|
-
createDualPlatformQRModal(qrCodeData, statusMessage) {
|
|
111
|
-
this.createModal(`
|
|
112
|
-
<div class="glide-auth-qr-container">
|
|
113
|
-
<!-- Platform Switcher -->
|
|
114
|
-
<div class="glide-platform-switcher">
|
|
115
|
-
<button class="glide-platform-btn glide-platform-ios active" data-platform="ios">
|
|
116
|
-
<svg width="18" height="18" viewBox="0 0 24 24" fill="currentColor">
|
|
117
|
-
<path d="M17.05 20.28c-.98.95-2.05.88-3.08.4-1.09-.5-2.08-.48-3.24 0-1.44.62-2.2.44-3.06-.4C2.79 15.25 3.51 7.59 9.05 7.31c1.35.07 2.29.74 3.08.8 1.18-.24 2.31-.93 3.57-.84 1.51.12 2.65.72 3.4 1.8-3.12 1.87-2.38 5.98.48 7.13-.57 1.5-1.31 2.99-2.54 4.09l.01-.01zM12.03 7.25c-.15-2.23 1.66-4.07 3.74-4.25.29 2.58-2.34 4.5-3.74 4.25z"/>
|
|
118
|
-
</svg>
|
|
119
|
-
<span>iOS</span>
|
|
120
|
-
</button>
|
|
121
|
-
<button class="glide-platform-btn glide-platform-android" data-platform="android">
|
|
122
|
-
<svg width="18" height="18" viewBox="0 0 24 24" fill="currentColor">
|
|
123
|
-
<path d="M17.6 9.48l1.84-3.18c.16-.31.04-.69-.26-.85-.29-.15-.65-.06-.83.22l-1.88 3.24c-2.86-1.21-6.08-1.21-8.94 0L5.65 5.67c-.19-.28-.54-.38-.83-.22-.3.16-.42.54-.26.85l1.84 3.18C4.08 11.08 2.4 13.97 2.4 17.2h19.2c0-3.23-1.68-6.12-4.0-7.72zM7.0 14.8c-.66 0-1.2-.54-1.2-1.2s.54-1.2 1.2-1.2 1.2.54 1.2 1.2-.54 1.2-1.2 1.2zm10 0c-.66 0-1.2-.54-1.2-1.2s.54-1.2 1.2-1.2 1.2.54 1.2 1.2-.54 1.2-1.2 1.2z"/>
|
|
124
|
-
</svg>
|
|
125
|
-
<span>Android</span>
|
|
126
|
-
</button>
|
|
127
|
-
</div>
|
|
128
|
-
|
|
129
|
-
<!-- QR Code Image -->
|
|
130
|
-
<img
|
|
131
|
-
id="glide-qr-code-img"
|
|
132
|
-
src="${this.escapeHtml(qrCodeData.iosQRCode)}"
|
|
133
|
-
alt="QR Code"
|
|
134
|
-
class="glide-auth-qr-code"
|
|
135
|
-
data-ios="${this.escapeHtml(qrCodeData.iosQRCode)}"
|
|
136
|
-
data-android="${this.escapeHtml(qrCodeData.androidQRCode || '')}"
|
|
137
|
-
/>
|
|
138
|
-
|
|
139
|
-
<!-- Status Message -->
|
|
140
|
-
<p class="glide-auth-status" id="glide-platform-message">Scan with your iPhone to authenticate</p>
|
|
141
|
-
</div>
|
|
142
|
-
`);
|
|
143
|
-
// IMPORTANT: Call show() to actually display the modal!
|
|
144
|
-
this.show();
|
|
145
|
-
}
|
|
146
|
-
/**
|
|
147
|
-
* Sets a callback to be called when the modal is cancelled/closed
|
|
148
|
-
*/
|
|
149
|
-
setCloseCallback(callback) {
|
|
150
|
-
this.closeCallback = callback;
|
|
151
|
-
}
|
|
152
|
-
/**
|
|
153
|
-
* Shows the modal with a button for Link authentication (App Clips)
|
|
154
|
-
* IMPORTANT: The button click is required for iOS to recognize the app link
|
|
155
|
-
*/
|
|
156
|
-
showLinkButton(url, buttonText) {
|
|
157
|
-
return new Promise((resolve) => {
|
|
158
|
-
var _a, _b, _c;
|
|
159
|
-
const text = buttonText || ((_a = this.options) === null || _a === void 0 ? void 0 : _a.buttonText) || 'Open Verification App';
|
|
160
|
-
this.createModal(`
|
|
161
|
-
<div class="glide-auth-link-container">
|
|
162
|
-
<p class="glide-auth-description">
|
|
163
|
-
${((_b = this.options) === null || _b === void 0 ? void 0 : _b.description) || 'Click below to verify your phone number'}
|
|
164
|
-
</p>
|
|
165
|
-
<button class="glide-auth-button" id="glide-auth-link-button">
|
|
166
|
-
${text}
|
|
167
|
-
</button>
|
|
168
|
-
<p class="glide-auth-helper-text">
|
|
169
|
-
You'll be redirected to complete verification
|
|
170
|
-
</p>
|
|
171
|
-
</div>
|
|
172
|
-
`);
|
|
173
|
-
// Show modal first so elements are in the DOM
|
|
174
|
-
this.show();
|
|
175
|
-
// Add click handler for the button AFTER modal is in DOM
|
|
176
|
-
// CRITICAL: This click event is required for iOS to recognize the app link
|
|
177
|
-
// Do NOT call window.open automatically - it must be triggered by user interaction
|
|
178
|
-
const button = (_c = this.container) === null || _c === void 0 ? void 0 : _c.querySelector('#glide-auth-link-button');
|
|
179
|
-
if (button) {
|
|
180
|
-
button.addEventListener('click', (event) => {
|
|
181
|
-
var _a, _b;
|
|
182
|
-
(_b = (_a = this.callbacks) === null || _a === void 0 ? void 0 : _a.onAuthStart) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
183
|
-
// User-initiated click is required for app links to work properly on iOS
|
|
184
|
-
// This ensures the OS recognizes it should open an app, not just a browser tab
|
|
185
|
-
window.open(url, '_blank');
|
|
186
|
-
resolve();
|
|
187
|
-
});
|
|
188
|
-
}
|
|
189
|
-
else {
|
|
190
|
-
console.error('[Modal] Link button not found in modal');
|
|
191
|
-
}
|
|
192
|
-
});
|
|
193
|
-
}
|
|
194
|
-
/**
|
|
195
|
-
* Shows the modal with a button for TS43 authentication
|
|
196
|
-
* IMPORTANT: The button click is required for Digital Credentials API (transient activation)
|
|
197
|
-
*/
|
|
198
|
-
showTS43Button(onAuthenticate) {
|
|
199
|
-
return new Promise((resolve, reject) => {
|
|
200
|
-
var _a, _b, _c;
|
|
201
|
-
const text = ((_a = this.options) === null || _a === void 0 ? void 0 : _a.buttonText) || 'Verify with Carrier';
|
|
202
|
-
this.createModal(`
|
|
203
|
-
<div class="glide-auth-ts43-container">
|
|
204
|
-
<p class="glide-auth-description">
|
|
205
|
-
${((_b = this.options) === null || _b === void 0 ? void 0 : _b.description) || 'Verify using your carrier credentials'}
|
|
206
|
-
</p>
|
|
207
|
-
<button class="glide-auth-button" id="glide-auth-ts43-button">
|
|
208
|
-
${text}
|
|
209
|
-
</button>
|
|
210
|
-
<p class="glide-auth-helper-text">
|
|
211
|
-
Secure verification through your mobile carrier
|
|
212
|
-
</p>
|
|
213
|
-
</div>
|
|
214
|
-
`);
|
|
215
|
-
// Show modal first so elements are in the DOM
|
|
216
|
-
this.show();
|
|
217
|
-
// Add click handler for the button AFTER modal is in DOM
|
|
218
|
-
// CRITICAL: Digital Credentials API requires "transient activation" (user interaction)
|
|
219
|
-
// Do NOT call onAuthenticate automatically - it must be triggered by user click
|
|
220
|
-
const button = (_c = this.container) === null || _c === void 0 ? void 0 : _c.querySelector('#glide-auth-ts43-button');
|
|
221
|
-
if (button) {
|
|
222
|
-
button.addEventListener('click', (event) => __awaiter(this, void 0, void 0, function* () {
|
|
223
|
-
var _a, _b, _c, _d, _e, _f;
|
|
224
|
-
(_b = (_a = this.callbacks) === null || _a === void 0 ? void 0 : _a.onAuthStart) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
225
|
-
button.setAttribute('disabled', 'true');
|
|
226
|
-
button.textContent = 'Verifying...';
|
|
227
|
-
try {
|
|
228
|
-
const result = yield onAuthenticate();
|
|
229
|
-
(_d = (_c = this.callbacks) === null || _c === void 0 ? void 0 : _c.onAuthComplete) === null || _d === void 0 ? void 0 : _d.call(_c, result);
|
|
230
|
-
resolve(result);
|
|
231
|
-
this.close();
|
|
232
|
-
}
|
|
233
|
-
catch (error) {
|
|
234
|
-
(_f = (_e = this.callbacks) === null || _e === void 0 ? void 0 : _e.onError) === null || _f === void 0 ? void 0 : _f.call(_e, error);
|
|
235
|
-
button.removeAttribute('disabled');
|
|
236
|
-
button.textContent = text;
|
|
237
|
-
reject(error);
|
|
238
|
-
}
|
|
239
|
-
}));
|
|
240
|
-
}
|
|
241
|
-
else {
|
|
242
|
-
console.error('[Modal] TS43 button not found in modal');
|
|
243
|
-
}
|
|
244
|
-
});
|
|
245
|
-
}
|
|
246
|
-
/**
|
|
247
|
-
* Updates the status message in the modal
|
|
248
|
-
*/
|
|
249
|
-
updateStatus(message, isError = false) {
|
|
250
|
-
var _a;
|
|
251
|
-
const statusEl = (_a = this.container) === null || _a === void 0 ? void 0 : _a.querySelector('.glide-auth-status');
|
|
252
|
-
if (statusEl) {
|
|
253
|
-
statusEl.textContent = message;
|
|
254
|
-
statusEl.className = isError ? 'glide-auth-status glide-auth-error' : 'glide-auth-status';
|
|
255
|
-
}
|
|
256
|
-
}
|
|
257
|
-
/**
|
|
258
|
-
* Creates the modal HTML structure
|
|
259
|
-
*/
|
|
260
|
-
createModal(content) {
|
|
261
|
-
var _a, _b, _c;
|
|
262
|
-
// Clean up any existing modal
|
|
263
|
-
this.cleanup();
|
|
264
|
-
// Create backdrop (dark overlay)
|
|
265
|
-
this.backdrop = document.createElement('div');
|
|
266
|
-
this.backdrop.className = 'glide-auth-backdrop';
|
|
267
|
-
this.backdrop.style.cssText = `
|
|
268
|
-
position: fixed;
|
|
269
|
-
top: 0;
|
|
270
|
-
left: 0;
|
|
271
|
-
right: 0;
|
|
272
|
-
bottom: 0;
|
|
273
|
-
background: rgba(0, 0, 0, 0.5);
|
|
274
|
-
z-index: 9998;
|
|
275
|
-
opacity: 0;
|
|
276
|
-
transition: opacity 0.3s ease;
|
|
277
|
-
`;
|
|
278
|
-
// Create modal container
|
|
279
|
-
this.container = document.createElement('div');
|
|
280
|
-
this.container.className = `glide-auth-modal ${((_a = this.options) === null || _a === void 0 ? void 0 : _a.className) || ''}`;
|
|
281
|
-
this.container.style.cssText = `
|
|
282
|
-
position: fixed;
|
|
283
|
-
top: 50%;
|
|
284
|
-
left: 50%;
|
|
285
|
-
transform: translate(-50%, -50%) scale(0.9);
|
|
286
|
-
background: white;
|
|
287
|
-
border-radius: 12px;
|
|
288
|
-
padding: 24px;
|
|
289
|
-
max-width: 400px;
|
|
290
|
-
width: 90%;
|
|
291
|
-
box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
|
|
292
|
-
z-index: 9999;
|
|
293
|
-
opacity: 0;
|
|
294
|
-
transition: opacity 0.3s ease, transform 0.3s ease;
|
|
295
|
-
`;
|
|
296
|
-
// Add modal content
|
|
297
|
-
this.container.innerHTML = `
|
|
298
|
-
<div class="glide-auth-header">
|
|
299
|
-
${((_b = this.options) === null || _b === void 0 ? void 0 : _b.showCloseButton) !== false ? `
|
|
300
|
-
<button class="glide-auth-close" aria-label="Close">
|
|
301
|
-
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
302
|
-
<line x1="18" y1="6" x2="6" y2="18"></line>
|
|
303
|
-
<line x1="6" y1="6" x2="18" y2="18"></line>
|
|
304
|
-
</svg>
|
|
305
|
-
</button>
|
|
306
|
-
` : ''}
|
|
307
|
-
<h2 class="glide-auth-title">${((_c = this.options) === null || _c === void 0 ? void 0 : _c.title) || 'Phone Verification'}</h2>
|
|
308
|
-
</div>
|
|
309
|
-
<div class="glide-auth-content">
|
|
310
|
-
${content}
|
|
311
|
-
</div>
|
|
312
|
-
`;
|
|
313
|
-
// Add styles
|
|
314
|
-
this.injectStyles();
|
|
315
|
-
// Add close button handler
|
|
316
|
-
const closeBtn = this.container.querySelector('.glide-auth-close');
|
|
317
|
-
if (closeBtn) {
|
|
318
|
-
closeBtn.addEventListener('click', () => {
|
|
319
|
-
var _a;
|
|
320
|
-
(_a = this.closeCallback) === null || _a === void 0 ? void 0 : _a.call(this); // Call cancellation callback if set
|
|
321
|
-
this.close();
|
|
322
|
-
});
|
|
323
|
-
}
|
|
324
|
-
// Add backdrop click handler
|
|
325
|
-
this.backdrop.addEventListener('click', (e) => {
|
|
326
|
-
var _a, _b;
|
|
327
|
-
// Only close if backdrop itself was clicked and closeOnBackdrop is enabled (default true)
|
|
328
|
-
if (e.target === this.backdrop && ((_a = this.options) === null || _a === void 0 ? void 0 : _a.closeOnBackdrop) !== false) {
|
|
329
|
-
(_b = this.closeCallback) === null || _b === void 0 ? void 0 : _b.call(this); // Call cancellation callback if set
|
|
330
|
-
this.close();
|
|
331
|
-
}
|
|
332
|
-
});
|
|
333
|
-
}
|
|
334
|
-
/**
|
|
335
|
-
* Injects CSS styles for the modal
|
|
336
|
-
*/
|
|
337
|
-
injectStyles() {
|
|
338
|
-
if (document.getElementById('glide-auth-styles'))
|
|
339
|
-
return;
|
|
340
|
-
const styles = document.createElement('style');
|
|
341
|
-
styles.id = 'glide-auth-styles';
|
|
342
|
-
styles.textContent = `
|
|
343
|
-
.glide-auth-backdrop {
|
|
344
|
-
backdrop-filter: blur(4px);
|
|
345
|
-
}
|
|
346
|
-
|
|
347
|
-
.glide-auth-modal {
|
|
348
|
-
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
|
|
349
|
-
}
|
|
350
|
-
|
|
351
|
-
.glide-auth-header {
|
|
352
|
-
position: relative;
|
|
353
|
-
margin-bottom: 20px;
|
|
354
|
-
}
|
|
355
|
-
|
|
356
|
-
.glide-auth-close {
|
|
357
|
-
position: absolute;
|
|
358
|
-
top: 0;
|
|
359
|
-
right: 0;
|
|
360
|
-
background: none;
|
|
361
|
-
border: none;
|
|
362
|
-
cursor: pointer;
|
|
363
|
-
padding: 0;
|
|
364
|
-
color: #666;
|
|
365
|
-
transition: color 0.2s;
|
|
366
|
-
}
|
|
367
|
-
|
|
368
|
-
.glide-auth-close:hover {
|
|
369
|
-
color: #000;
|
|
370
|
-
}
|
|
371
|
-
|
|
372
|
-
.glide-auth-title {
|
|
373
|
-
margin: 0;
|
|
374
|
-
font-size: 24px;
|
|
375
|
-
font-weight: 600;
|
|
376
|
-
color: #333;
|
|
377
|
-
text-align: center;
|
|
378
|
-
}
|
|
379
|
-
|
|
380
|
-
.glide-auth-content {
|
|
381
|
-
text-align: center;
|
|
382
|
-
}
|
|
383
|
-
|
|
384
|
-
.glide-auth-description {
|
|
385
|
-
color: #666;
|
|
386
|
-
margin: 0 0 20px 0;
|
|
387
|
-
font-size: 16px;
|
|
388
|
-
line-height: 1.5;
|
|
389
|
-
}
|
|
390
|
-
|
|
391
|
-
.glide-auth-button {
|
|
392
|
-
background: #007AFF;
|
|
393
|
-
color: white;
|
|
394
|
-
border: none;
|
|
395
|
-
border-radius: 8px;
|
|
396
|
-
padding: 12px 24px;
|
|
397
|
-
font-size: 16px;
|
|
398
|
-
font-weight: 500;
|
|
399
|
-
cursor: pointer;
|
|
400
|
-
transition: background 0.2s, transform 0.1s;
|
|
401
|
-
min-width: 200px;
|
|
402
|
-
}
|
|
403
|
-
|
|
404
|
-
.glide-auth-button:hover:not(:disabled) {
|
|
405
|
-
background: #0051D5;
|
|
406
|
-
transform: translateY(-1px);
|
|
407
|
-
}
|
|
408
|
-
|
|
409
|
-
.glide-auth-button:active {
|
|
410
|
-
transform: translateY(0);
|
|
411
|
-
}
|
|
412
|
-
|
|
413
|
-
.glide-auth-button:disabled {
|
|
414
|
-
opacity: 0.6;
|
|
415
|
-
cursor: not-allowed;
|
|
416
|
-
}
|
|
417
|
-
|
|
418
|
-
.glide-auth-helper-text {
|
|
419
|
-
color: #999;
|
|
420
|
-
font-size: 14px;
|
|
421
|
-
margin: 16px 0 0 0;
|
|
422
|
-
}
|
|
423
|
-
|
|
424
|
-
.glide-auth-qr-code {
|
|
425
|
-
max-width: 256px;
|
|
426
|
-
width: 100%;
|
|
427
|
-
height: auto;
|
|
428
|
-
margin: 20px auto;
|
|
429
|
-
display: block;
|
|
430
|
-
}
|
|
431
|
-
|
|
432
|
-
.glide-auth-status {
|
|
433
|
-
color: #666;
|
|
434
|
-
font-size: 16px;
|
|
435
|
-
margin: 16px 0;
|
|
436
|
-
}
|
|
437
|
-
|
|
438
|
-
.glide-auth-error {
|
|
439
|
-
color: #FF3B30;
|
|
440
|
-
}
|
|
441
|
-
|
|
442
|
-
.glide-auth-qr-container,
|
|
443
|
-
.glide-auth-link-container,
|
|
444
|
-
.glide-auth-ts43-container {
|
|
445
|
-
padding: 20px 0;
|
|
446
|
-
}
|
|
447
|
-
|
|
448
|
-
/* Platform Switcher Styles */
|
|
449
|
-
.glide-platform-switcher {
|
|
450
|
-
display: flex;
|
|
451
|
-
justify-content: center;
|
|
452
|
-
gap: 10px;
|
|
453
|
-
margin-bottom: 20px;
|
|
454
|
-
}
|
|
455
|
-
|
|
456
|
-
.glide-platform-btn {
|
|
457
|
-
display: flex;
|
|
458
|
-
align-items: center;
|
|
459
|
-
gap: 6px;
|
|
460
|
-
padding: 10px 20px;
|
|
461
|
-
border: 2px solid;
|
|
462
|
-
background: transparent;
|
|
463
|
-
border-radius: 8px;
|
|
464
|
-
cursor: pointer;
|
|
465
|
-
font-size: 14px;
|
|
466
|
-
font-weight: 600;
|
|
467
|
-
transition: all 0.2s ease;
|
|
468
|
-
}
|
|
469
|
-
|
|
470
|
-
.glide-platform-btn svg {
|
|
471
|
-
flex-shrink: 0;
|
|
472
|
-
}
|
|
473
|
-
|
|
474
|
-
.glide-platform-ios {
|
|
475
|
-
border-color: #007AFF;
|
|
476
|
-
color: #007AFF;
|
|
477
|
-
}
|
|
478
|
-
|
|
479
|
-
.glide-platform-ios.active {
|
|
480
|
-
background: #007AFF;
|
|
481
|
-
color: white;
|
|
482
|
-
}
|
|
483
|
-
|
|
484
|
-
.glide-platform-ios:hover:not(.active) {
|
|
485
|
-
background: rgba(0, 122, 255, 0.1);
|
|
486
|
-
}
|
|
487
|
-
|
|
488
|
-
.glide-platform-android {
|
|
489
|
-
border-color: #3DDC84;
|
|
490
|
-
color: #3DDC84;
|
|
491
|
-
}
|
|
492
|
-
|
|
493
|
-
.glide-platform-android.active {
|
|
494
|
-
background: #3DDC84;
|
|
495
|
-
color: white;
|
|
496
|
-
}
|
|
497
|
-
|
|
498
|
-
.glide-platform-android:hover:not(.active) {
|
|
499
|
-
background: rgba(61, 220, 132, 0.1);
|
|
500
|
-
}
|
|
501
|
-
`;
|
|
502
|
-
document.head.appendChild(styles);
|
|
503
|
-
}
|
|
504
|
-
/**
|
|
505
|
-
* Shows the modal with animation
|
|
506
|
-
*/
|
|
507
|
-
show() {
|
|
508
|
-
var _a, _b;
|
|
509
|
-
if (!this.container || !this.backdrop || this.isOpen)
|
|
510
|
-
return;
|
|
511
|
-
document.body.appendChild(this.backdrop);
|
|
512
|
-
document.body.appendChild(this.container);
|
|
513
|
-
// Add escape key listener for closing modal
|
|
514
|
-
document.addEventListener('keydown', this.handleEscapeKey);
|
|
515
|
-
// Setup platform toggle handlers if they exist
|
|
516
|
-
this.setupPlatformToggles();
|
|
517
|
-
// Trigger animation
|
|
518
|
-
requestAnimationFrame(() => {
|
|
519
|
-
if (this.backdrop && this.container) {
|
|
520
|
-
this.backdrop.style.opacity = '1';
|
|
521
|
-
this.container.style.opacity = '1';
|
|
522
|
-
this.container.style.transform = 'translate(-50%, -50%) scale(1)';
|
|
523
|
-
}
|
|
524
|
-
});
|
|
525
|
-
this.isOpen = true;
|
|
526
|
-
(_b = (_a = this.callbacks) === null || _a === void 0 ? void 0 : _a.onOpen) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
527
|
-
}
|
|
528
|
-
/**
|
|
529
|
-
* Setup click handlers for iOS/Android platform toggle
|
|
530
|
-
*/
|
|
531
|
-
setupPlatformToggles() {
|
|
532
|
-
var _a, _b, _c;
|
|
533
|
-
const platformBtns = (_a = this.container) === null || _a === void 0 ? void 0 : _a.querySelectorAll('.glide-platform-btn');
|
|
534
|
-
const qrImg = (_b = this.container) === null || _b === void 0 ? void 0 : _b.querySelector('#glide-qr-code-img');
|
|
535
|
-
const message = (_c = this.container) === null || _c === void 0 ? void 0 : _c.querySelector('#glide-platform-message');
|
|
536
|
-
if (!platformBtns || !qrImg)
|
|
537
|
-
return;
|
|
538
|
-
platformBtns.forEach((btn) => {
|
|
539
|
-
btn.addEventListener('click', (e) => {
|
|
540
|
-
const target = e.currentTarget;
|
|
541
|
-
const platform = target.getAttribute('data-platform');
|
|
542
|
-
// Update active state
|
|
543
|
-
platformBtns.forEach(b => b.classList.remove('active'));
|
|
544
|
-
target.classList.add('active');
|
|
545
|
-
// Switch QR code
|
|
546
|
-
if (platform === 'ios') {
|
|
547
|
-
qrImg.src = qrImg.getAttribute('data-ios') || '';
|
|
548
|
-
if (message)
|
|
549
|
-
message.textContent = 'Scan with your iPhone to authenticate';
|
|
550
|
-
}
|
|
551
|
-
else if (platform === 'android') {
|
|
552
|
-
qrImg.src = qrImg.getAttribute('data-android') || '';
|
|
553
|
-
if (message)
|
|
554
|
-
message.textContent = 'Scan with your Android device to authenticate';
|
|
555
|
-
}
|
|
556
|
-
});
|
|
557
|
-
});
|
|
558
|
-
}
|
|
559
|
-
/**
|
|
560
|
-
* Closes the modal with animation
|
|
561
|
-
*/
|
|
562
|
-
close() {
|
|
563
|
-
if (!this.container || !this.backdrop || !this.isOpen)
|
|
564
|
-
return;
|
|
565
|
-
// Remove escape key listener
|
|
566
|
-
document.removeEventListener('keydown', this.handleEscapeKey);
|
|
567
|
-
// Animate out
|
|
568
|
-
this.backdrop.style.opacity = '0';
|
|
569
|
-
this.container.style.opacity = '0';
|
|
570
|
-
this.container.style.transform = 'translate(-50%, -50%) scale(0.9)';
|
|
571
|
-
// Clear any stored callbacks
|
|
572
|
-
this.closeCallback = undefined;
|
|
573
|
-
// Remove after animation
|
|
574
|
-
setTimeout(() => {
|
|
575
|
-
var _a, _b;
|
|
576
|
-
this.cleanup();
|
|
577
|
-
this.isOpen = false;
|
|
578
|
-
(_b = (_a = this.callbacks) === null || _a === void 0 ? void 0 : _a.onClose) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
579
|
-
}, 300);
|
|
580
|
-
}
|
|
581
|
-
/**
|
|
582
|
-
* Removes modal elements from DOM
|
|
583
|
-
*/
|
|
584
|
-
cleanup() {
|
|
585
|
-
var _a, _b;
|
|
586
|
-
(_a = this.container) === null || _a === void 0 ? void 0 : _a.remove();
|
|
587
|
-
(_b = this.backdrop) === null || _b === void 0 ? void 0 : _b.remove();
|
|
588
|
-
this.container = null;
|
|
589
|
-
this.backdrop = null;
|
|
590
|
-
}
|
|
591
|
-
/**
|
|
592
|
-
* Check if modal is currently open
|
|
593
|
-
*/
|
|
594
|
-
isModalOpen() {
|
|
595
|
-
return this.isOpen;
|
|
596
|
-
}
|
|
597
|
-
}
|
|
598
|
-
exports.AuthModal = AuthModal;
|