@glideidentity/web-client-sdk 4.4.10 → 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 +167 -19
- 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.d.ts +1 -1
- 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.d.ts +1 -1
- 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/web-client-sdk.min.js.LICENSE.txt +1 -1
- package/dist/browser.d.ts +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.d.ts +0 -13
- package/dist/core/phone-auth/api-types.js +0 -83
- package/dist/core/phone-auth/client.js +27 -374
- package/dist/core/phone-auth/error-utils.js +1 -83
- package/dist/core/phone-auth/index.d.ts +1 -1
- package/dist/core/phone-auth/index.js +1 -3
- 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.d.ts +0 -13
- package/dist/core/phone-auth/validation-utils.js +2 -81
- 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.d.ts +1 -1
- 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.d.ts +1 -1
- 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.d.ts +1 -1
- 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 -328
- 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 +28 -375
- 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.d.ts +1 -1
- package/dist/esm/core/phone-auth/index.js +2 -4
- 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 -44
- package/dist/esm/core/phone-auth/validation-utils.js +2 -80
- package/dist/esm/core/types.d.ts +0 -35
- package/dist/esm/core/version.js +1 -2
- package/dist/esm/index.d.ts +1 -1
- package/dist/esm/index.js +1 -9
- package/dist/index.d.ts +1 -1
- package/dist/index.js +0 -7
- package/package.json +2 -2
|
@@ -9,8 +9,6 @@ var client_1 = require("../../core/client");
|
|
|
9
9
|
Object.defineProperty(exports, "SDKClient", { enumerable: true, get: function () { return client_1.SDKClient; } });
|
|
10
10
|
var phone_auth_1 = require("../../core/phone-auth");
|
|
11
11
|
Object.defineProperty(exports, "PhoneAuthClient", { enumerable: true, get: function () { return phone_auth_1.PhoneAuthClient; } });
|
|
12
|
-
// API response types are already exported via core/phone-auth/types
|
|
13
|
-
// Export error utilities
|
|
14
12
|
var phone_auth_2 = require("../../core/phone-auth");
|
|
15
13
|
Object.defineProperty(exports, "PhoneAuthErrorCode", { enumerable: true, get: function () { return phone_auth_2.PhoneAuthErrorCode; } });
|
|
16
14
|
Object.defineProperty(exports, "isPhoneAuthError", { enumerable: true, get: function () { return phone_auth_2.isPhoneAuthError; } });
|
|
@@ -21,14 +19,12 @@ Object.defineProperty(exports, "getRetryDelay", { enumerable: true, get: functio
|
|
|
21
19
|
Object.defineProperty(exports, "isRetryableError", { enumerable: true, get: function () { return phone_auth_2.isRetryableError; } });
|
|
22
20
|
Object.defineProperty(exports, "serializeError", { enumerable: true, get: function () { return phone_auth_2.serializeError; } });
|
|
23
21
|
Object.defineProperty(exports, "createErrorBreadcrumb", { enumerable: true, get: function () { return phone_auth_2.createErrorBreadcrumb; } });
|
|
24
|
-
// Export constants for use case and strategy
|
|
25
22
|
var types_1 = require("../../core/phone-auth/types");
|
|
26
23
|
Object.defineProperty(exports, "UseCase", { enumerable: true, get: function () { return types_1.USE_CASE; } });
|
|
27
24
|
Object.defineProperty(exports, "AuthenticationStrategy", { enumerable: true, get: function () { return types_1.AUTHENTICATION_STRATEGY; } });
|
|
28
25
|
Object.defineProperty(exports, "BrowserError", { enumerable: true, get: function () { return types_1.BrowserError; } });
|
|
29
26
|
Object.defineProperty(exports, "BrowserErrorCode", { enumerable: true, get: function () { return types_1.BrowserErrorCode; } });
|
|
30
27
|
Object.defineProperty(exports, "BrowserName", { enumerable: true, get: function () { return types_1.BrowserName; } });
|
|
31
|
-
// Export API constants from api-types
|
|
32
28
|
var api_types_1 = require("../../core/phone-auth/api-types");
|
|
33
29
|
Object.defineProperty(exports, "USE_CASE", { enumerable: true, get: function () { return api_types_1.USE_CASE; } });
|
|
34
30
|
Object.defineProperty(exports, "ERROR_CODE", { enumerable: true, get: function () { return api_types_1.ERROR_CODE; } });
|
|
@@ -44,17 +44,14 @@ function useClient(config) {
|
|
|
44
44
|
const authenticate = (authUrl) => __awaiter(this, void 0, void 0, function* () {
|
|
45
45
|
loading.value = true;
|
|
46
46
|
error.value = null;
|
|
47
|
-
// Clean up previous authentication if exists
|
|
48
47
|
if (cleanup) {
|
|
49
48
|
cleanup();
|
|
50
49
|
cleanup = null;
|
|
51
50
|
}
|
|
52
|
-
// Legacy authentication removed - use setToken directly
|
|
53
51
|
error.value = new Error('authenticate method is deprecated. Use client.setToken() directly.');
|
|
54
52
|
loading.value = false;
|
|
55
53
|
throw error.value;
|
|
56
54
|
});
|
|
57
|
-
// Cleanup on component unmount
|
|
58
55
|
(0, vue_1.onUnmounted)(() => {
|
|
59
56
|
if (cleanup) {
|
|
60
57
|
cleanup();
|
|
@@ -107,7 +104,6 @@ function useClient(config) {
|
|
|
107
104
|
loading.value = false;
|
|
108
105
|
}
|
|
109
106
|
});
|
|
110
|
-
// Low-level methods for advanced control
|
|
111
107
|
const preparePhoneRequest = (options) => __awaiter(this, void 0, void 0, function* () {
|
|
112
108
|
return client.value.phoneAuth.preparePhoneRequest(options);
|
|
113
109
|
});
|
|
@@ -121,7 +117,6 @@ function useClient(config) {
|
|
|
121
117
|
isSupported,
|
|
122
118
|
getPhoneNumber,
|
|
123
119
|
verifyPhoneNumber,
|
|
124
|
-
// Low-level API for advanced usage
|
|
125
120
|
preparePhoneRequest,
|
|
126
121
|
invokeSecurePrompt
|
|
127
122
|
};
|
|
@@ -13,43 +13,31 @@ exports.usePhoneAuth = usePhoneAuth;
|
|
|
13
13
|
const vue_1 = require("vue");
|
|
14
14
|
const phone_auth_1 = require("../../core/phone-auth");
|
|
15
15
|
function usePhoneAuth(config = {}) {
|
|
16
|
-
// State management
|
|
17
16
|
const isLoading = (0, vue_1.ref)(false);
|
|
18
17
|
const error = (0, vue_1.ref)(null);
|
|
19
18
|
const result = (0, vue_1.ref)(null);
|
|
20
19
|
const currentStep = (0, vue_1.ref)('idle');
|
|
21
|
-
|
|
22
|
-
const client = new phone_auth_1.PhoneAuthClient(Object.assign(Object.assign({}, config), {
|
|
23
|
-
// Callbacks are now properly typed through AuthConfig
|
|
24
|
-
onCrossDeviceDetected: config.onCrossDeviceDetected, onRetryAttempt: config.onRetryAttempt }));
|
|
25
|
-
// Check browser support
|
|
20
|
+
const client = new phone_auth_1.PhoneAuthClient(Object.assign(Object.assign({}, config), { onCrossDeviceDetected: config.onCrossDeviceDetected, onRetryAttempt: config.onRetryAttempt }));
|
|
26
21
|
const isSupported = (0, vue_1.computed)(() => client.isSupported());
|
|
27
|
-
// Verify method - internal wrapper that converts to API format
|
|
28
22
|
const verify = (options) => __awaiter(this, void 0, void 0, function* () {
|
|
29
23
|
isLoading.value = true;
|
|
30
24
|
error.value = null;
|
|
31
25
|
result.value = null;
|
|
32
26
|
currentStep.value = 'requesting';
|
|
33
27
|
try {
|
|
34
|
-
// Step 1: Prepare the request
|
|
35
28
|
const preparedRequest = yield client.preparePhoneRequest(options);
|
|
36
|
-
// Step 2: User authentication
|
|
37
29
|
currentStep.value = 'authenticating';
|
|
38
30
|
const credentialResponse = yield client.invokeSecurePrompt(preparedRequest);
|
|
39
|
-
// Step 3: Process the response through appropriate endpoint
|
|
40
31
|
currentStep.value = 'processing';
|
|
41
|
-
// Cast to credential type - adapters never use headless mode
|
|
42
32
|
const credential = credentialResponse;
|
|
43
33
|
const verificationResult = options.use_case === 'GetPhoneNumber'
|
|
44
34
|
? yield client.getPhoneNumber(credential, preparedRequest.session)
|
|
45
35
|
: yield client.verifyPhoneNumber(credential, preparedRequest.session);
|
|
46
|
-
// Use the result directly - it's already the correct type
|
|
47
36
|
result.value = verificationResult;
|
|
48
37
|
currentStep.value = 'complete';
|
|
49
38
|
return result.value;
|
|
50
39
|
}
|
|
51
40
|
catch (err) {
|
|
52
|
-
// Enhance error with context if it's an AuthError
|
|
53
41
|
const authError = err;
|
|
54
42
|
const enhancedError = Object.assign(Object.assign({}, authError), { context: authError.context || {
|
|
55
43
|
useCase: options.use_case,
|
|
@@ -65,39 +53,32 @@ function usePhoneAuth(config = {}) {
|
|
|
65
53
|
isLoading.value = false;
|
|
66
54
|
}
|
|
67
55
|
});
|
|
68
|
-
// Convenience methods
|
|
69
56
|
const getPhoneNumber = (options) => verify(Object.assign({ use_case: 'GetPhoneNumber' }, options));
|
|
70
57
|
const verifyPhoneNumber = (phoneNumber, options) => verify(Object.assign({ use_case: 'VerifyPhoneNumber', phone_number: phoneNumber }, options));
|
|
71
|
-
// Reset state
|
|
72
58
|
const reset = () => {
|
|
73
59
|
isLoading.value = false;
|
|
74
60
|
error.value = null;
|
|
75
61
|
result.value = null;
|
|
76
62
|
currentStep.value = 'idle';
|
|
77
63
|
};
|
|
78
|
-
// Expose granular methods directly from client for better discoverability
|
|
79
64
|
const preparePhoneRequest = client.preparePhoneRequest.bind(client);
|
|
80
65
|
const invokeSecurePrompt = client.invokeSecurePrompt.bind(client);
|
|
81
66
|
const getPhoneNumberCredential = client.getPhoneNumber.bind(client);
|
|
82
67
|
const verifyPhoneNumberCredential = client.verifyPhoneNumber.bind(client);
|
|
83
68
|
return {
|
|
84
|
-
// State (readonly)
|
|
85
69
|
isLoading: (0, vue_1.readonly)(isLoading),
|
|
86
70
|
error: (0, vue_1.readonly)(error),
|
|
87
71
|
result: (0, vue_1.readonly)(result),
|
|
88
72
|
currentStep: (0, vue_1.readonly)(currentStep),
|
|
89
73
|
isSupported: (0, vue_1.readonly)(isSupported),
|
|
90
|
-
// High-level methods
|
|
91
74
|
verify,
|
|
92
75
|
getPhoneNumber,
|
|
93
76
|
verifyPhoneNumber,
|
|
94
77
|
reset,
|
|
95
|
-
// Granular methods (directly exposed for better discoverability)
|
|
96
78
|
preparePhoneRequest,
|
|
97
79
|
invokeSecurePrompt,
|
|
98
80
|
getPhoneNumberCredential,
|
|
99
81
|
verifyPhoneNumberCredential,
|
|
100
|
-
// Client instance (still available for advanced usage)
|
|
101
82
|
client
|
|
102
83
|
};
|
|
103
84
|
}
|