@vizualkei/neuma-client-sdk 0.120.0 → 0.121.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/dist/NeumaClient.d.ts +1 -1
- package/dist/NeumaMobile.js +18 -18
- package/dist/NeumaMobileInterface.d.ts +2 -2
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
package/dist/NeumaClient.d.ts
CHANGED
|
@@ -36,7 +36,7 @@ export type PendingOperationErrorContext = {
|
|
|
36
36
|
export type HandlePendingOperationOptions = {
|
|
37
37
|
/**
|
|
38
38
|
* Limit handling to one or more SDK operation names, e.g.
|
|
39
|
-
* `
|
|
39
|
+
* `verify-user`, `enroll`, `restore-enrollment`, or `unenroll-user`.
|
|
40
40
|
*/
|
|
41
41
|
operation?: PendingOperationMatcher;
|
|
42
42
|
/**
|
package/dist/NeumaMobile.js
CHANGED
|
@@ -15,11 +15,11 @@ void (0, common_utils_1.initLogging)({ serviceName: 'neuma-client-sdk', level: '
|
|
|
15
15
|
// Operation code mappings for short URLs
|
|
16
16
|
const OP_CODES = {
|
|
17
17
|
enroll: 'e',
|
|
18
|
-
|
|
19
|
-
'clear-
|
|
18
|
+
'verify-user': 'v',
|
|
19
|
+
'clear-enrollment': 'ce',
|
|
20
20
|
'unenroll-user': 'u',
|
|
21
|
-
'
|
|
22
|
-
restore: '
|
|
21
|
+
'verify-user-for-key': 'k',
|
|
22
|
+
'restore-enrollment': 're',
|
|
23
23
|
};
|
|
24
24
|
class NeumaMobile {
|
|
25
25
|
constructor() {
|
|
@@ -437,7 +437,7 @@ class NeumaMobile {
|
|
|
437
437
|
if (!pending)
|
|
438
438
|
return null;
|
|
439
439
|
// Offline operations don't have a server-side result to poll for.
|
|
440
|
-
if (pending.operation === '
|
|
440
|
+
if (pending.operation === 'verify-user-for-key' || pending.operation === 'clear-enrollment') {
|
|
441
441
|
this.clearPendingResult();
|
|
442
442
|
return null;
|
|
443
443
|
}
|
|
@@ -505,7 +505,7 @@ class NeumaMobile {
|
|
|
505
505
|
* URL. The unique `neuma_cb=<callbackId>` query param disambiguates the
|
|
506
506
|
* originating tab so Safari does not open a new tab on return. For polling
|
|
507
507
|
* operations, the same markers also let the SDK resume polling after an
|
|
508
|
-
* iOS Safari remount. Offline operations (`
|
|
508
|
+
* iOS Safari remount. Offline operations (`verify-user-for-key`, `clear-enrollment`)
|
|
509
509
|
* use the markers only for exact tab matching and do not persist pending
|
|
510
510
|
* polling state.
|
|
511
511
|
*
|
|
@@ -803,8 +803,8 @@ class NeumaMobile {
|
|
|
803
803
|
cleanupFn = this.options.onQrCode(qrData);
|
|
804
804
|
common_utils_1.logger.info('QR code callback invoked', { callbackId });
|
|
805
805
|
}
|
|
806
|
-
// For
|
|
807
|
-
if (operation === '
|
|
806
|
+
// For verify-user-for-key and clear-enrollment operations, work in offline mode (no polling)
|
|
807
|
+
if (operation === 'verify-user-for-key' || operation === 'clear-enrollment') {
|
|
808
808
|
common_utils_1.logger.info('Offline operation - no polling', { callbackId, operation });
|
|
809
809
|
return null;
|
|
810
810
|
}
|
|
@@ -851,12 +851,12 @@ class NeumaMobile {
|
|
|
851
851
|
hasNeumaSessionToken: !!this.options.neumaSessionToken,
|
|
852
852
|
hasUser: !!user,
|
|
853
853
|
});
|
|
854
|
-
const isOfflineOperation = operation === '
|
|
854
|
+
const isOfflineOperation = operation === 'verify-user-for-key' || operation === 'clear-enrollment';
|
|
855
855
|
// Always give iOS Safari a returnUrl so Neuma's Close button can
|
|
856
856
|
// foreground the originating browser tab. All iOS Safari returnUrls
|
|
857
857
|
// get a unique marker for exact tab matching; only polling operations
|
|
858
|
-
// persist pending state because offline operations (`
|
|
859
|
-
// `clear-
|
|
858
|
+
// persist pending state because offline operations (`verify-user-for-key`,
|
|
859
|
+
// `clear-enrollment`) do not write a server result for the SDK to resume.
|
|
860
860
|
const returnUrl = this.captureReturnUrl(callbackId, operation);
|
|
861
861
|
// Persist pending-op metadata BEFORE firing the deep link when a
|
|
862
862
|
// browser return path can lose the in-memory polling promise. iOS
|
|
@@ -931,7 +931,7 @@ class NeumaMobile {
|
|
|
931
931
|
this.options.onAppLaunchFailed?.(context);
|
|
932
932
|
}, 2000);
|
|
933
933
|
}
|
|
934
|
-
// For
|
|
934
|
+
// For verify-user-for-key and clear-enrollment operations, work in offline mode (no polling, no server connection).
|
|
935
935
|
// Do not resolve immediately after assigning `window.location.href` to the custom scheme:
|
|
936
936
|
// on iOS Safari that can let the webapp mutate UI/state while the browser is still
|
|
937
937
|
// completing the handoff to Neuma, which makes the later `returnUrl` launch more prone
|
|
@@ -1028,8 +1028,8 @@ class NeumaMobile {
|
|
|
1028
1028
|
}
|
|
1029
1029
|
async restoreEnrollment() {
|
|
1030
1030
|
try {
|
|
1031
|
-
const payload = await this.invokeMobileApp('restore', undefined);
|
|
1032
|
-
const nrt = this.extractNeumaResultToken(payload, 'restore', 'AUTH_FAILED');
|
|
1031
|
+
const payload = await this.invokeMobileApp('restore-enrollment', undefined);
|
|
1032
|
+
const nrt = this.extractNeumaResultToken(payload, 'restore-enrollment', 'AUTH_FAILED');
|
|
1033
1033
|
const decoded = this.decodeJwtPayload(nrt);
|
|
1034
1034
|
if (decoded && decoded.userId && decoded.enrollmentId) {
|
|
1035
1035
|
const enrollment = {
|
|
@@ -1060,8 +1060,8 @@ class NeumaMobile {
|
|
|
1060
1060
|
}
|
|
1061
1061
|
async verifyUser() {
|
|
1062
1062
|
try {
|
|
1063
|
-
const payload = await this.invokeMobileApp('
|
|
1064
|
-
const nrt = this.extractNeumaResultToken(payload, '
|
|
1063
|
+
const payload = await this.invokeMobileApp('verify-user', undefined);
|
|
1064
|
+
const nrt = this.extractNeumaResultToken(payload, 'verify-user', 'AUTH_FAILED');
|
|
1065
1065
|
common_utils_1.logger.info('User verification successful');
|
|
1066
1066
|
return nrt;
|
|
1067
1067
|
}
|
|
@@ -1083,7 +1083,7 @@ class NeumaMobile {
|
|
|
1083
1083
|
common_utils_1.logger.error('verifyUserForKey called from desktop browser');
|
|
1084
1084
|
throw new NeumaMobileInterface_1.NeumaError('This operation is supported only on mobile browsers', 'AUTH_FAILED');
|
|
1085
1085
|
}
|
|
1086
|
-
await this.invokeMobileApp('
|
|
1086
|
+
await this.invokeMobileApp('verify-user-for-key', undefined);
|
|
1087
1087
|
return null;
|
|
1088
1088
|
}
|
|
1089
1089
|
parseVerifyUserForKeyResult(jsonString) {
|
|
@@ -1121,7 +1121,7 @@ class NeumaMobile {
|
|
|
1121
1121
|
common_utils_1.logger.error('clearEnrollment called from desktop browser');
|
|
1122
1122
|
throw new NeumaMobileInterface_1.NeumaError('This operation is supported only on mobile browsers', 'AUTH_FAILED');
|
|
1123
1123
|
}
|
|
1124
|
-
await this.invokeMobileApp('clear-
|
|
1124
|
+
await this.invokeMobileApp('clear-enrollment', undefined);
|
|
1125
1125
|
this.persistEnrollment(null);
|
|
1126
1126
|
common_utils_1.logger.info('Enrollment cleared successfully');
|
|
1127
1127
|
return;
|
|
@@ -112,7 +112,7 @@ export type NeumaMobileOptions = {
|
|
|
112
112
|
export interface PendingOperationInfo {
|
|
113
113
|
/** Random callback ID matching the deep-link `id` and the polling URL path segment. */
|
|
114
114
|
readonly callbackId: string;
|
|
115
|
-
/** Internal operation name (`enroll`, `
|
|
115
|
+
/** Internal operation name (`enroll`, `verify-user`, `restore-enrollment`, `unenroll-user`, `verify-user-for-key`, `clear-enrollment`). */
|
|
116
116
|
readonly operation: string;
|
|
117
117
|
/** Epoch ms timestamp of when the deep-link was issued. */
|
|
118
118
|
readonly ts: number;
|
|
@@ -199,7 +199,7 @@ export interface NeumaMobileInterface {
|
|
|
199
199
|
* success. If polling already completed in a previous page lifetime,
|
|
200
200
|
* this returns the cached payload instead of polling again. Returns
|
|
201
201
|
* `null` when there is no recoverable operation, or when the operation is
|
|
202
|
-
* offline-only (`
|
|
202
|
+
* offline-only (`verify-user-for-key`, `clear-enrollment`) and does not write a
|
|
203
203
|
* server-side result.
|
|
204
204
|
*
|
|
205
205
|
* Marks cached results as being consumed, but keeps them briefly so a
|
package/dist/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const NEUMA_CLIENT_SDK_VERSION = "0.
|
|
1
|
+
export declare const NEUMA_CLIENT_SDK_VERSION = "0.121.0";
|
package/dist/version.js
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.NEUMA_CLIENT_SDK_VERSION = void 0;
|
|
4
4
|
// This file is generated by scripts/generate-package-version.mjs. Do not edit by hand.
|
|
5
|
-
exports.NEUMA_CLIENT_SDK_VERSION = '0.
|
|
5
|
+
exports.NEUMA_CLIENT_SDK_VERSION = '0.121.0';
|