@wix/himalaya-cli 0.1809.0 → 0.1811.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.
@@ -15,6 +15,11 @@ export interface HostIdentitySource {
15
15
  * when the host installed no session source: iOS publishes the bridge (`identityBound`) to
16
16
  * every worker that has `wix_api`, with or without one. */
17
17
  site(): string | null;
18
+ /** Whether the host's session clock has settled: the native runtime has restored (or confirmed) who is signed in,
19
+ * so `current().kind` is final rather than the provisional `signedOut` a clock reports while it is still restoring.
20
+ * True when the host has no authenticated clock: none published, or the web host's stub (`identityBound: false`, never
21
+ * ready). Nothing restores there, so its first answer stands. */
22
+ settled(): boolean;
18
23
  }
19
24
  export interface HostSessionProvider extends SessionProvider, HostIdentitySource {
20
25
  }
@@ -25,6 +30,9 @@ export declare function createHostSession(source: {
25
30
  identityBound: boolean;
26
31
  current(): unknown;
27
32
  subscribe(listener: () => void): () => void;
33
+ /** Whether the host has (or is about to bind) a session clock to wait for; read on every `settled()` call, because a
34
+ * native clock binds after the worker starts. False means `settled()` is always true. Default true. */
35
+ hasClock?: boolean | (() => boolean);
28
36
  }): HostSessionProvider;
29
37
  /** The session on `globalThis.himalaya`. Web publishes `identityBound: false`. */
30
38
  export declare function hostSessionFromGlobal(): HostSessionProvider;
@@ -1038,6 +1038,11 @@ function createHostSession(source) {
1038
1038
  const snap = pull();
1039
1039
  return snap.ready ? snap.siteId : null;
1040
1040
  },
1041
+ settled() {
1042
+ const hasClock = typeof source.hasClock === "function" ? source.hasClock() : source.hasClock !== false;
1043
+ if (!hasClock) return true;
1044
+ return pull().ready;
1045
+ },
1041
1046
  subscribe(listener) {
1042
1047
  return source.subscribe(() => {
1043
1048
  const before = seen;
@@ -1052,12 +1057,13 @@ function hostSessionFromGlobal() {
1052
1057
  const session = api?.session;
1053
1058
  if (!session || typeof session.current !== "function" || typeof session.subscribe !== "function") {
1054
1059
  return createHostSession({ identityBound: false, current: () => SIGNED_OUT, subscribe: () => () => {
1055
- } });
1060
+ }, hasClock: false });
1056
1061
  }
1057
1062
  return createHostSession({
1058
1063
  identityBound: api?.identityBound === true,
1059
1064
  current: () => session.current(),
1060
- subscribe: (listener) => session.subscribe(listener)
1065
+ subscribe: (listener) => session.subscribe(listener),
1066
+ hasClock: () => wixApiGlobal()?.identityBound === true || typeof nativeSessionFunction() === "function"
1061
1067
  });
1062
1068
  }
1063
1069
  function memberIdentityOf(source) {
@@ -1086,6 +1092,9 @@ function parseSession(raw) {
1086
1092
  epoch: typeof value.epoch === "number" ? value.epoch : 0
1087
1093
  };
1088
1094
  }
1095
+ function nativeSessionFunction() {
1096
+ return globalThis.__himalaya_native_session_current;
1097
+ }
1089
1098
  function wixApiGlobal() {
1090
1099
  return globalThis.himalaya?.wixApi;
1091
1100
  }
@@ -1042,6 +1042,11 @@ function createHostSession(source) {
1042
1042
  const snap = pull();
1043
1043
  return snap.ready ? snap.siteId : null;
1044
1044
  },
1045
+ settled() {
1046
+ const hasClock = typeof source.hasClock === "function" ? source.hasClock() : source.hasClock !== false;
1047
+ if (!hasClock) return true;
1048
+ return pull().ready;
1049
+ },
1045
1050
  subscribe(listener) {
1046
1051
  return source.subscribe(() => {
1047
1052
  const before = seen;
@@ -1056,12 +1061,13 @@ function hostSessionFromGlobal() {
1056
1061
  const session = api?.session;
1057
1062
  if (!session || typeof session.current !== "function" || typeof session.subscribe !== "function") {
1058
1063
  return createHostSession({ identityBound: false, current: () => SIGNED_OUT, subscribe: () => () => {
1059
- } });
1064
+ }, hasClock: false });
1060
1065
  }
1061
1066
  return createHostSession({
1062
1067
  identityBound: api?.identityBound === true,
1063
1068
  current: () => session.current(),
1064
- subscribe: (listener) => session.subscribe(listener)
1069
+ subscribe: (listener) => session.subscribe(listener),
1070
+ hasClock: () => wixApiGlobal()?.identityBound === true || typeof nativeSessionFunction() === "function"
1065
1071
  });
1066
1072
  }
1067
1073
  function memberIdentityOf(source) {
@@ -1090,6 +1096,9 @@ function parseSession(raw) {
1090
1096
  epoch: typeof value.epoch === "number" ? value.epoch : 0
1091
1097
  };
1092
1098
  }
1099
+ function nativeSessionFunction() {
1100
+ return globalThis.__himalaya_native_session_current;
1101
+ }
1093
1102
  function wixApiGlobal() {
1094
1103
  return globalThis.himalaya?.wixApi;
1095
1104
  }
@@ -4325,6 +4325,11 @@ function createHostSession(source) {
4325
4325
  const snap = pull();
4326
4326
  return snap.ready ? snap.siteId : null;
4327
4327
  },
4328
+ settled() {
4329
+ const hasClock = typeof source.hasClock === "function" ? source.hasClock() : source.hasClock !== false;
4330
+ if (!hasClock) return true;
4331
+ return pull().ready;
4332
+ },
4328
4333
  subscribe(listener) {
4329
4334
  return source.subscribe(() => {
4330
4335
  const before = seen;
@@ -4339,12 +4344,13 @@ function hostSessionFromGlobal() {
4339
4344
  const session = api?.session;
4340
4345
  if (!session || typeof session.current !== "function" || typeof session.subscribe !== "function") {
4341
4346
  return createHostSession({ identityBound: false, current: () => SIGNED_OUT, subscribe: () => () => {
4342
- } });
4347
+ }, hasClock: false });
4343
4348
  }
4344
4349
  return createHostSession({
4345
4350
  identityBound: api?.identityBound === true,
4346
4351
  current: () => session.current(),
4347
- subscribe: (listener) => session.subscribe(listener)
4352
+ subscribe: (listener) => session.subscribe(listener),
4353
+ hasClock: () => wixApiGlobal()?.identityBound === true || typeof nativeSessionFunction() === "function"
4348
4354
  });
4349
4355
  }
4350
4356
  function memberIdentityOf(source) {
@@ -4373,6 +4379,9 @@ function parseSession(raw) {
4373
4379
  epoch: typeof value.epoch === "number" ? value.epoch : 0
4374
4380
  };
4375
4381
  }
4382
+ function nativeSessionFunction() {
4383
+ return globalThis.__himalaya_native_session_current;
4384
+ }
4376
4385
  function wixApiGlobal() {
4377
4386
  return globalThis.himalaya?.wixApi;
4378
4387
  }
@@ -2,7 +2,7 @@
2
2
  "files": [
3
3
  {
4
4
  "name": "sw.js",
5
- "bytes": 2610196
5
+ "bytes": 2611036
6
6
  },
7
7
  {
8
8
  "name": "host.html",
@@ -21,7 +21,7 @@
21
21
  "bytes": 24320
22
22
  },
23
23
  {
24
- "name": "preview-deferred/09e39aeb032cda05611bd7c888d3ae818f2fa89fc69705221b2dfcdf5ce5d704.bin",
24
+ "name": "preview-deferred/35916cad4faec46ac3f7d6cb11b049d75faef382fcbc2c8697128937d73732cc.bin",
25
25
  "bytes": 488215
26
26
  },
27
27
  {
@@ -79,10 +79,10 @@
79
79
  ],
80
80
  "deferred": [
81
81
  {
82
- "key": "assets/pdf-7xBOEFOJ.js",
82
+ "key": "assets/pdf-ddP2ZRr6.js",
83
83
  "contentType": "application/javascript; charset=utf-8",
84
- "sha256": "09e39aeb032cda05611bd7c888d3ae818f2fa89fc69705221b2dfcdf5ce5d704",
85
- "file": "preview-deferred/09e39aeb032cda05611bd7c888d3ae818f2fa89fc69705221b2dfcdf5ce5d704.bin"
84
+ "sha256": "35916cad4faec46ac3f7d6cb11b049d75faef382fcbc2c8697128937d73732cc",
85
+ "file": "preview-deferred/35916cad4faec46ac3f7d6cb11b049d75faef382fcbc2c8697128937d73732cc.bin"
86
86
  },
87
87
  {
88
88
  "key": "assets/pdf.worker.min-BGnVRhRG.js",