@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,52 +1,21 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Validation utilities for phone authentication
|
|
3
|
-
*/
|
|
4
1
|
import { PhoneAuthErrorCode } from './error-utils';
|
|
5
2
|
import type { PLMN, UseCase } from './api-types';
|
|
6
|
-
/**
|
|
7
|
-
* Validates E.164 phone number format
|
|
8
|
-
* @param phoneNumber - Phone number to validate
|
|
9
|
-
* @returns Validation result with error if invalid
|
|
10
|
-
*/
|
|
11
3
|
export declare function validatePhoneNumber(phoneNumber?: string): {
|
|
12
4
|
valid: boolean;
|
|
13
5
|
error?: string;
|
|
14
6
|
};
|
|
15
|
-
/**
|
|
16
|
-
* Validates PLMN (MCC/MNC) values
|
|
17
|
-
* @param plmn - PLMN object with MCC and MNC
|
|
18
|
-
* @returns Validation result
|
|
19
|
-
*/
|
|
20
7
|
export declare function validatePlmn(plmn?: PLMN): {
|
|
21
8
|
valid: boolean;
|
|
22
9
|
error?: string;
|
|
23
10
|
};
|
|
24
|
-
/**
|
|
25
|
-
* Validates use case and phone number combination
|
|
26
|
-
* @param useCase - The use case
|
|
27
|
-
* @param phoneNumber - The phone number (required for VerifyPhoneNumber)
|
|
28
|
-
* @param hasParentSessionId - Whether parent_session_id is provided (allows skipping normal validation)
|
|
29
|
-
* @returns Validation result
|
|
30
|
-
*/
|
|
31
11
|
export declare function validateUseCaseRequirements(useCase: UseCase, phoneNumber?: string, hasParentSessionId?: boolean): {
|
|
32
12
|
valid: boolean;
|
|
33
13
|
error?: string;
|
|
34
14
|
};
|
|
35
|
-
/**
|
|
36
|
-
* Creates a validation error
|
|
37
|
-
* @param code - Error code
|
|
38
|
-
* @param message - Error message
|
|
39
|
-
* @param field - Field that failed validation
|
|
40
|
-
*/
|
|
41
15
|
export declare function createValidationError(code: PhoneAuthErrorCode, message: string, field?: string): Error & {
|
|
42
16
|
code: PhoneAuthErrorCode;
|
|
43
17
|
field?: string;
|
|
44
18
|
};
|
|
45
|
-
/**
|
|
46
|
-
* Validates nonce format
|
|
47
|
-
* @param nonce - Nonce string to validate
|
|
48
|
-
* @returns Validation result
|
|
49
|
-
*/
|
|
50
19
|
export declare function validateNonce(nonce: string): {
|
|
51
20
|
valid: boolean;
|
|
52
21
|
error?: string;
|
|
@@ -1,17 +1,8 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Validation utilities for phone authentication
|
|
3
|
-
*/
|
|
4
1
|
import { USE_CASE } from './api-types';
|
|
5
|
-
/**
|
|
6
|
-
* Validates E.164 phone number format
|
|
7
|
-
* @param phoneNumber - Phone number to validate
|
|
8
|
-
* @returns Validation result with error if invalid
|
|
9
|
-
*/
|
|
10
2
|
export function validatePhoneNumber(phoneNumber) {
|
|
11
3
|
if (!phoneNumber) {
|
|
12
|
-
return { valid: true };
|
|
4
|
+
return { valid: true };
|
|
13
5
|
}
|
|
14
|
-
// E.164 format validation - strict, no cleaning
|
|
15
6
|
const e164Regex = /^\+[1-9]\d{1,14}$/;
|
|
16
7
|
if (!phoneNumber.startsWith('+')) {
|
|
17
8
|
return {
|
|
@@ -31,7 +22,6 @@ export function validatePhoneNumber(phoneNumber) {
|
|
|
31
22
|
error: 'Phone number too long for E.164 format (maximum 15 digits after +)'
|
|
32
23
|
};
|
|
33
24
|
}
|
|
34
|
-
// Check for any invalid characters (spaces, dashes, parentheses, etc.)
|
|
35
25
|
if (!/^\+\d+$/.test(phoneNumber)) {
|
|
36
26
|
return {
|
|
37
27
|
valid: false,
|
|
@@ -46,42 +36,26 @@ export function validatePhoneNumber(phoneNumber) {
|
|
|
46
36
|
}
|
|
47
37
|
return { valid: true };
|
|
48
38
|
}
|
|
49
|
-
/**
|
|
50
|
-
* Validates PLMN (MCC/MNC) values
|
|
51
|
-
* @param plmn - PLMN object with MCC and MNC
|
|
52
|
-
* @returns Validation result
|
|
53
|
-
*/
|
|
54
39
|
export function validatePlmn(plmn) {
|
|
55
40
|
if (!plmn) {
|
|
56
|
-
return { valid: true };
|
|
41
|
+
return { valid: true };
|
|
57
42
|
}
|
|
58
43
|
const { mcc, mnc } = plmn;
|
|
59
|
-
// MCC validation (3 digits) - no range check for telco labs
|
|
60
44
|
if (!mcc || !/^\d{3}$/.test(mcc)) {
|
|
61
45
|
return {
|
|
62
46
|
valid: false,
|
|
63
47
|
error: 'MCC must be exactly 3 digits'
|
|
64
48
|
};
|
|
65
49
|
}
|
|
66
|
-
// MNC validation (2 or 3 digits)
|
|
67
50
|
if (!mnc || !/^\d{2,3}$/.test(mnc)) {
|
|
68
51
|
return {
|
|
69
52
|
valid: false,
|
|
70
53
|
error: 'MNC must be 2 or 3 digits'
|
|
71
54
|
};
|
|
72
55
|
}
|
|
73
|
-
// No range validation - allowing unofficial MCCs for telco labs
|
|
74
56
|
return { valid: true };
|
|
75
57
|
}
|
|
76
|
-
/**
|
|
77
|
-
* Validates use case and phone number combination
|
|
78
|
-
* @param useCase - The use case
|
|
79
|
-
* @param phoneNumber - The phone number (required for VerifyPhoneNumber)
|
|
80
|
-
* @param hasParentSessionId - Whether parent_session_id is provided (allows skipping normal validation)
|
|
81
|
-
* @returns Validation result
|
|
82
|
-
*/
|
|
83
58
|
export function validateUseCaseRequirements(useCase, phoneNumber, hasParentSessionId) {
|
|
84
|
-
// VerifyPhoneNumber requires a phone number (unless parent_session_id is provided)
|
|
85
59
|
if (useCase === USE_CASE.VERIFY_PHONE_NUMBER && !phoneNumber && !hasParentSessionId) {
|
|
86
60
|
return {
|
|
87
61
|
valid: false,
|
|
@@ -90,12 +64,6 @@ export function validateUseCaseRequirements(useCase, phoneNumber, hasParentSessi
|
|
|
90
64
|
}
|
|
91
65
|
return { valid: true };
|
|
92
66
|
}
|
|
93
|
-
/**
|
|
94
|
-
* Creates a validation error
|
|
95
|
-
* @param code - Error code
|
|
96
|
-
* @param message - Error message
|
|
97
|
-
* @param field - Field that failed validation
|
|
98
|
-
*/
|
|
99
67
|
export function createValidationError(code, message, field) {
|
|
100
68
|
const error = new Error(message);
|
|
101
69
|
error.code = code;
|
|
@@ -104,13 +72,7 @@ export function createValidationError(code, message, field) {
|
|
|
104
72
|
}
|
|
105
73
|
return error;
|
|
106
74
|
}
|
|
107
|
-
/**
|
|
108
|
-
* Validates nonce format
|
|
109
|
-
* @param nonce - Nonce string to validate
|
|
110
|
-
* @returns Validation result
|
|
111
|
-
*/
|
|
112
75
|
export function validateNonce(nonce) {
|
|
113
|
-
// Nonce should be base64url encoded and have reasonable length
|
|
114
76
|
const base64urlRegex = /^[A-Za-z0-9_-]+$/;
|
|
115
77
|
if (!nonce || nonce.length === 0) {
|
|
116
78
|
return {
|
package/dist/esm/core/types.d.ts
CHANGED
|
@@ -1,51 +1,16 @@
|
|
|
1
1
|
import { LogLevel, Logger } from './logger';
|
|
2
2
|
export interface ClientConfig {
|
|
3
|
-
/**
|
|
4
|
-
* Base URL for API requests
|
|
5
|
-
* Required only if using useQuery() or client.get() methods
|
|
6
|
-
* Not required for phone authentication
|
|
7
|
-
*/
|
|
8
3
|
baseURL?: string;
|
|
9
|
-
/**
|
|
10
|
-
* API key for authentication
|
|
11
|
-
* Currently not used in the SDK but kept for backward compatibility
|
|
12
|
-
*/
|
|
13
4
|
apiKey?: string;
|
|
14
|
-
/**
|
|
15
|
-
* Request timeout in milliseconds
|
|
16
|
-
* @default 10000
|
|
17
|
-
*/
|
|
18
5
|
timeout?: number;
|
|
19
|
-
/**
|
|
20
|
-
* Target origin for authentication
|
|
21
|
-
* Used for cross-origin authentication flows
|
|
22
|
-
* If not provided, uses baseURL or current origin
|
|
23
|
-
*/
|
|
24
6
|
authTargetOrigin?: string;
|
|
25
|
-
/**
|
|
26
|
-
* Phone authentication endpoints
|
|
27
|
-
* If not provided, uses default endpoints relative to baseURL
|
|
28
|
-
*/
|
|
29
7
|
phoneAuthEndpoints?: {
|
|
30
8
|
prepareRequest: string;
|
|
31
9
|
processResponse: string;
|
|
32
10
|
};
|
|
33
|
-
/**
|
|
34
|
-
* Enable debug logging
|
|
35
|
-
* @default false
|
|
36
|
-
*/
|
|
37
11
|
debug?: boolean;
|
|
38
|
-
/**
|
|
39
|
-
* Set specific log level
|
|
40
|
-
*/
|
|
41
12
|
logLevel?: LogLevel;
|
|
42
|
-
/**
|
|
43
|
-
* Custom logger implementation
|
|
44
|
-
*/
|
|
45
13
|
logger?: Logger;
|
|
46
|
-
/**
|
|
47
|
-
* Remote logging configuration
|
|
48
|
-
*/
|
|
49
14
|
remoteLogging?: {
|
|
50
15
|
endpoint: string;
|
|
51
16
|
apiKey: string;
|
package/dist/esm/core/version.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export const SDK_VERSION = '5.0.0';
|
|
1
|
+
export const SDK_VERSION = '5.0.1-beta.0';
|
package/dist/esm/index.js
CHANGED
|
@@ -1,16 +1,8 @@
|
|
|
1
|
-
// Phone Authentication
|
|
2
1
|
export { PhoneAuthClient } from './core/phone-auth';
|
|
3
|
-
// Phone Auth Error Utilities
|
|
4
2
|
export { PhoneAuthErrorCode, isPhoneAuthError, isUserError, getUserMessage, isErrorCode, getRetryDelay, isRetryableError, serializeError, createErrorBreadcrumb } from './core/phone-auth';
|
|
5
|
-
|
|
6
|
-
export { isExtendedResponse, isCredential, isAuthCredential, isLinkStrategy, isTS43Strategy, isDesktopStrategy, getStrategy, hasPollingControls, hasTrigger,
|
|
7
|
-
// Deprecated aliases
|
|
8
|
-
isHeadlessResult, requiresPolling, requiresUserAction } from './core/phone-auth';
|
|
9
|
-
// Export constants for use case and strategy
|
|
3
|
+
export { isExtendedResponse, isCredential, isAuthCredential, isLinkStrategy, isTS43Strategy, isDesktopStrategy, getStrategy, hasPollingControls, hasTrigger, isHeadlessResult, requiresPolling, requiresUserAction } from './core/phone-auth';
|
|
10
4
|
export { USE_CASE as UseCase, AUTHENTICATION_STRATEGY as AuthenticationStrategy, BrowserError, BrowserErrorCode, BrowserName } from './core/phone-auth/types';
|
|
11
|
-
// Desktop Strategy Exports
|
|
12
5
|
export { DesktopHandler } from './core/phone-auth/strategies/desktop';
|
|
13
|
-
// Adapters
|
|
14
6
|
export { useClient, usePhoneAuth } from './adapters/react';
|
|
15
7
|
export { useClient as useVueClient, usePhoneAuth as useVuePhoneAuth } from './adapters/vue';
|
|
16
8
|
export { ClientService, PhoneAuthService } from './adapters/angular';
|
package/dist/index.js
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.PhoneAuthManager = exports.ClientManager = exports.PhoneAuthService = exports.ClientService = exports.useVuePhoneAuth = exports.useVueClient = exports.usePhoneAuth = exports.useClient = exports.DesktopHandler = exports.BrowserName = exports.BrowserErrorCode = exports.BrowserError = exports.AuthenticationStrategy = exports.UseCase = exports.requiresUserAction = exports.requiresPolling = exports.isHeadlessResult = exports.hasTrigger = exports.hasPollingControls = exports.getStrategy = exports.isDesktopStrategy = exports.isTS43Strategy = exports.isLinkStrategy = exports.isAuthCredential = exports.isCredential = exports.isExtendedResponse = exports.createErrorBreadcrumb = exports.serializeError = exports.isRetryableError = exports.getRetryDelay = exports.isErrorCode = exports.getUserMessage = exports.isUserError = exports.isPhoneAuthError = exports.PhoneAuthErrorCode = exports.PhoneAuthClient = void 0;
|
|
4
|
-
// Phone Authentication
|
|
5
4
|
var phone_auth_1 = require("./core/phone-auth");
|
|
6
5
|
Object.defineProperty(exports, "PhoneAuthClient", { enumerable: true, get: function () { return phone_auth_1.PhoneAuthClient; } });
|
|
7
|
-
// Phone Auth Error Utilities
|
|
8
6
|
var phone_auth_2 = require("./core/phone-auth");
|
|
9
7
|
Object.defineProperty(exports, "PhoneAuthErrorCode", { enumerable: true, get: function () { return phone_auth_2.PhoneAuthErrorCode; } });
|
|
10
8
|
Object.defineProperty(exports, "isPhoneAuthError", { enumerable: true, get: function () { return phone_auth_2.isPhoneAuthError; } });
|
|
@@ -15,7 +13,6 @@ Object.defineProperty(exports, "getRetryDelay", { enumerable: true, get: functio
|
|
|
15
13
|
Object.defineProperty(exports, "isRetryableError", { enumerable: true, get: function () { return phone_auth_2.isRetryableError; } });
|
|
16
14
|
Object.defineProperty(exports, "serializeError", { enumerable: true, get: function () { return phone_auth_2.serializeError; } });
|
|
17
15
|
Object.defineProperty(exports, "createErrorBreadcrumb", { enumerable: true, get: function () { return phone_auth_2.createErrorBreadcrumb; } });
|
|
18
|
-
// Phone Auth Type Guards and Helpers
|
|
19
16
|
var phone_auth_3 = require("./core/phone-auth");
|
|
20
17
|
Object.defineProperty(exports, "isExtendedResponse", { enumerable: true, get: function () { return phone_auth_3.isExtendedResponse; } });
|
|
21
18
|
Object.defineProperty(exports, "isCredential", { enumerable: true, get: function () { return phone_auth_3.isCredential; } });
|
|
@@ -26,21 +23,17 @@ Object.defineProperty(exports, "isDesktopStrategy", { enumerable: true, get: fun
|
|
|
26
23
|
Object.defineProperty(exports, "getStrategy", { enumerable: true, get: function () { return phone_auth_3.getStrategy; } });
|
|
27
24
|
Object.defineProperty(exports, "hasPollingControls", { enumerable: true, get: function () { return phone_auth_3.hasPollingControls; } });
|
|
28
25
|
Object.defineProperty(exports, "hasTrigger", { enumerable: true, get: function () { return phone_auth_3.hasTrigger; } });
|
|
29
|
-
// Deprecated aliases
|
|
30
26
|
Object.defineProperty(exports, "isHeadlessResult", { enumerable: true, get: function () { return phone_auth_3.isHeadlessResult; } });
|
|
31
27
|
Object.defineProperty(exports, "requiresPolling", { enumerable: true, get: function () { return phone_auth_3.requiresPolling; } });
|
|
32
28
|
Object.defineProperty(exports, "requiresUserAction", { enumerable: true, get: function () { return phone_auth_3.requiresUserAction; } });
|
|
33
|
-
// Export constants for use case and strategy
|
|
34
29
|
var types_1 = require("./core/phone-auth/types");
|
|
35
30
|
Object.defineProperty(exports, "UseCase", { enumerable: true, get: function () { return types_1.USE_CASE; } });
|
|
36
31
|
Object.defineProperty(exports, "AuthenticationStrategy", { enumerable: true, get: function () { return types_1.AUTHENTICATION_STRATEGY; } });
|
|
37
32
|
Object.defineProperty(exports, "BrowserError", { enumerable: true, get: function () { return types_1.BrowserError; } });
|
|
38
33
|
Object.defineProperty(exports, "BrowserErrorCode", { enumerable: true, get: function () { return types_1.BrowserErrorCode; } });
|
|
39
34
|
Object.defineProperty(exports, "BrowserName", { enumerable: true, get: function () { return types_1.BrowserName; } });
|
|
40
|
-
// Desktop Strategy Exports
|
|
41
35
|
var desktop_1 = require("./core/phone-auth/strategies/desktop");
|
|
42
36
|
Object.defineProperty(exports, "DesktopHandler", { enumerable: true, get: function () { return desktop_1.DesktopHandler; } });
|
|
43
|
-
// Adapters
|
|
44
37
|
var react_1 = require("./adapters/react");
|
|
45
38
|
Object.defineProperty(exports, "useClient", { enumerable: true, get: function () { return react_1.useClient; } });
|
|
46
39
|
Object.defineProperty(exports, "usePhoneAuth", { enumerable: true, get: function () { return react_1.usePhoneAuth; } });
|