@vizualkei/neuma-client-sdk 0.121.0 → 0.125.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 CHANGED
@@ -1,3 +1,24 @@
1
1
  # @vizualkei/neuma-client-sdk
2
2
 
3
3
  See [README.md](../../README.md) for the Neuma SDK API documentation.
4
+
5
+ ## iOS Universal Link handoff
6
+
7
+ On iOS phone browsers the SDK hands off to the Neuma app using an HTTPS
8
+ **Universal Link** instead of the `neuma://` custom scheme. This lets the OS
9
+ open the installed app directly and avoids the "open in app?" custom-scheme
10
+ prompt.
11
+
12
+ - The Universal Link base defaults to `https://www.neuma.me/link`. The SDK
13
+ appends the same query parameters used for the deep link (`operation`, `id`,
14
+ `bioServer`, `webServer`, optional `userName`/`email`/`phone`, `nst`, and the
15
+ iOS-Safari-gated `returnUrl`), so the return-to-tab flow is identical to the
16
+ custom-scheme path.
17
+ - Override the base with the `universalLinkBase` option (passed via
18
+ `sdkOptions`) if you host your own Universal Link page.
19
+ - **App not installed:** the Universal Link navigates the current tab to
20
+ `https://www.neuma.me/link`, a hosted fallback page with install links. The
21
+ tab unloads in that case, so the usual 2s visibility-based launch-failure
22
+ detection may not fire for iOS.
23
+ - **Android is unchanged:** Android (and `unknown` platforms) continue to hand
24
+ off via the `neuma://operation` custom scheme, byte-for-byte as before.
@@ -25,6 +25,7 @@ class NeumaMobile {
25
25
  constructor() {
26
26
  this.options = {
27
27
  customSchemeBase: 'neuma://operation',
28
+ universalLinkBase: 'https://www.neuma.me/link',
28
29
  timeoutMs: 90000,
29
30
  overlay: { appName: 'Neuma Mobile' },
30
31
  apiServerPort: 443,
@@ -38,7 +39,7 @@ class NeumaMobile {
38
39
  this.versionInfo = this.parsePackageVersion(SDK_VERSION);
39
40
  }
40
41
  initialize(opts) {
41
- const { overlay, timeoutMs, onQrCode, onAppLaunchFailed, neumaSessionToken, biometricService, installUrlResolver, qrAppLinkBase, } = opts;
42
+ const { overlay, timeoutMs, onQrCode, onAppLaunchFailed, neumaSessionToken, biometricService, installUrlResolver, qrAppLinkBase, universalLinkBase, } = opts;
42
43
  this.options = {
43
44
  ...this.options,
44
45
  timeoutMs: timeoutMs ?? this.options.timeoutMs,
@@ -49,6 +50,7 @@ class NeumaMobile {
49
50
  biometricService: (0, biometricService_1.normalizeBiometricService)(biometricService ?? this.options.biometricService),
50
51
  installUrlResolver: installUrlResolver ?? this.options.installUrlResolver,
51
52
  qrAppLinkBase: qrAppLinkBase ?? this.options.qrAppLinkBase,
53
+ universalLinkBase: universalLinkBase ?? this.options.universalLinkBase,
52
54
  };
53
55
  common_utils_1.logger.info('SDK initialized', {
54
56
  timeoutMs: this.options.timeoutMs,
@@ -458,6 +460,7 @@ class NeumaMobile {
458
460
  clearPendingResult() {
459
461
  this.clearPendingOperation();
460
462
  this.clearCompletedResult();
463
+ this.clearReturnUrlMarkers();
461
464
  }
462
465
  generateRandomId() {
463
466
  return (Math.random().toString(36).substring(2, 15) +
@@ -892,10 +895,25 @@ class NeumaMobile {
892
895
  if (returnUrl) {
893
896
  params.append('returnUrl', returnUrl);
894
897
  }
895
- const customScheme = `${this.options.customSchemeBase}?${params.toString()}`;
896
- common_utils_1.logger.info('Custom scheme prepared', {
898
+ const platform = this.detectLaunchPlatform();
899
+ // iOS: launch via Universal Link instead of the custom scheme. The
900
+ // same URLSearchParams (operation, id, bioServer, webServer, optional
901
+ // userName/email/phone, nst, and the iOS-Safari-gated returnUrl) are
902
+ // reused verbatim so the return-to-tab flow is identical.
903
+ //
904
+ // If the Neuma app is NOT installed, the Universal Link navigates this
905
+ // tab to https://www.neuma.me/link (a hosted fallback page with install
906
+ // links). In that case the page unloads, so the 2s visibility-based
907
+ // launch-failure timer below may never fire — that is accepted.
908
+ const launchUrl = platform === 'ios'
909
+ ? `${this.options.universalLinkBase}?${params.toString()}`
910
+ : `${this.options.customSchemeBase}?${params.toString()}`;
911
+ common_utils_1.logger.info('Launch URL prepared', {
897
912
  callbackId,
898
- customSchemeBase: this.options.customSchemeBase,
913
+ platform,
914
+ launchBase: platform === 'ios'
915
+ ? this.options.universalLinkBase
916
+ : this.options.customSchemeBase,
899
917
  hasReturnUrl: !!returnUrl,
900
918
  });
901
919
  let launchFailureTimer = null;
@@ -911,9 +929,11 @@ class NeumaMobile {
911
929
  cancelLaunchFailureTimer();
912
930
  };
913
931
  document.addEventListener('visibilitychange', onVisibility);
914
- // Open app immediately using custom scheme
932
+ // Open app immediately. iOS uses the Universal Link; all other
933
+ // platforms use the custom scheme. Launch synchronously in the same
934
+ // call stack (no setTimeout/promise deferral).
915
935
  try {
916
- window.location.href = customScheme;
936
+ window.location.href = launchUrl;
917
937
  }
918
938
  catch { }
919
939
  // Infer failed launches only for phone-browser deep-link flow.
@@ -79,6 +79,15 @@ export type NeumaMobileOptions = {
79
79
  * `/neuma-wellness/f` or `https://apps.example.com/neuma-wellness/f`.
80
80
  */
81
81
  qrAppLinkBase?: string;
82
+ /**
83
+ * HTTPS Universal Link base used for the iOS phone-browser handoff.
84
+ *
85
+ * Defaults to `https://www.neuma.me/link`. On iOS the SDK launches this
86
+ * URL instead of the `neuma://` custom scheme so the OS can open the
87
+ * installed app directly; if the app is not installed, the link falls
88
+ * back to a hosted install page. Android handoff is unaffected.
89
+ */
90
+ universalLinkBase?: string;
82
91
  /** Biometric session token (NST) from the server */
83
92
  neumaSessionToken?: string;
84
93
  /**
@@ -216,17 +225,12 @@ export interface NeumaMobileInterface {
216
225
  resumePendingResult(): Promise<unknown | null>;
217
226
  /**
218
227
  * Clears SDK recovery storage for the current deep-link operation,
219
- * including pending metadata and cached completed results.
220
- *
221
- * This intentionally leaves `neuma_cb` / `neuma_op` / `neuma_ts`
222
- * return-URL markers in the browser URL until they expire or a later
223
- * operation replaces them. iOS Safari uses an exact URL match to refocus
224
- * the originating tab when the native app launches `returnUrl`; removing
225
- * those markers before the user taps Close in the native app can make
226
- * Safari open a new tab instead.
228
+ * including pending metadata, cached completed results, and iOS Safari
229
+ * return-URL markers.
227
230
  *
228
- * Call this after app-level result handling has been made durable. It is
229
- * always safe to call, including when no operation is pending.
231
+ * Call this only after app-level result handling has been made durable
232
+ * (for example after persisting or showing the result popup). It is always
233
+ * safe to call, including when no operation is pending.
230
234
  */
231
235
  clearPendingResult(): void;
232
236
  }
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const NEUMA_CLIENT_SDK_VERSION = "0.121.0";
1
+ export declare const NEUMA_CLIENT_SDK_VERSION = "0.125.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.121.0';
5
+ exports.NEUMA_CLIENT_SDK_VERSION = '0.125.0';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vizualkei/neuma-client-sdk",
3
- "version": "0.121.0",
3
+ "version": "0.125.0",
4
4
  "description": "Neuma Web Client SDK - Biometric verification SDK for webapp integration",
5
5
  "license": "Apache-2.0",
6
6
  "main": "dist/index.js",