@wix/himalaya-cli 0.2023.0 → 0.2025.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.
Files changed (22) hide show
  1. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/dev-server/src/app-config.d.ts +9 -0
  2. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/ts/src/schema.d.ts +20 -0
  3. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/ts/src/validator.d.ts +38 -0
  4. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/core.mjs +24 -3
  5. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/sdui.mjs +17 -1
  6. package/dist/browser-plane/assets.json +5 -5
  7. package/dist/browser-plane/preview-deferred/{dda1fb76c0d4cd06bff81e83b374bfbf1937f894c6f2228ec6cd7140743d0775.bin → 0053531a0cb26d4293937d4021578c4c8b6e7fb5f2199a593995336ead10cc38.bin} +1 -1
  8. package/dist/browser-plane/sw.js +1 -1
  9. package/dist/cli.mjs +87 -53
  10. package/dist/preview-assets.generated.bin +0 -0
  11. package/package.json +2 -2
  12. package/templates/beauty-salon-owner/tier5-src/himi-owner-lite-today/index.ts +146 -13
  13. package/templates/community-club-owner/tier5-src/himi-owner-lite-today/index.ts +146 -13
  14. package/templates/events-meetups-owner/tier5-src/himi-owner-lite-today/index.ts +146 -13
  15. package/templates/gym-fitness-owner/tier5-src/himi-owner-lite-today/index.ts +146 -13
  16. package/templates/nonprofit-cause-owner/tier5-src/himi-owner-lite-today/index.ts +146 -13
  17. package/templates/owner-lite/tier5-src/himi-owner-lite-today/index.ts +146 -13
  18. package/templates/podcast-creator-owner/tier5-src/himi-owner-lite-today/index.ts +146 -13
  19. package/templates/portfolio-creative-owner/tier5-src/himi-owner-lite-today/index.ts +146 -13
  20. package/templates/restaurant-owner/tier5-src/himi-owner-lite-today/index.ts +146 -13
  21. package/templates/retail-store-owner/tier5-src/himi-owner-lite-today/index.ts +146 -13
  22. package/templates/yoga-studio-owner/tier5-src/himi-owner-lite-today/index.ts +146 -13
package/dist/cli.mjs CHANGED
@@ -3964,6 +3964,7 @@ var init_himi_package = __esm({
3964
3964
  var ICON_VIEW_BOX, ICON_STROKE_WIDTH, ICON_FALLBACK, ICON_CATALOG, ICON_NORMALIZED_INDEX, ICON_NAMES;
3965
3965
  var init_icon_catalog_generated = __esm({
3966
3966
  "../../core/ts/src/icon-catalog.generated.ts"() {
3967
+ "use strict";
3967
3968
  init_define_HHP_CATALOG();
3968
3969
  ICON_VIEW_BOX = 24;
3969
3970
  ICON_STROKE_WIDTH = 2;
@@ -20411,8 +20412,13 @@ function validateWidget(snapshot4) {
20411
20412
  }
20412
20413
  if (Array.isArray(snap.frames)) {
20413
20414
  snap.frames.forEach((frame, i2) => {
20414
- const p2 = frame?.payload;
20415
- scanWidgetPayload(p2, family, `$.frames[${i2}].payload`, bindingViolations, disallowedComponents, timeRefViolations, intentViolations, actionSites2);
20415
+ const f2 = frame;
20416
+ scanWidgetPayload(f2?.payload, family, `$.frames[${i2}].payload`, bindingViolations, disallowedComponents, timeRefViolations, intentViolations, actionSites2);
20417
+ if (f2?.regions && typeof f2.regions === "object" && !Array.isArray(f2.regions)) {
20418
+ for (const [key4, region] of Object.entries(f2.regions)) {
20419
+ scanWidgetPayload(region, family, `$.frames[${i2}].regions.${key4}`, bindingViolations, disallowedComponents, timeRefViolations, intentViolations, actionSites2);
20420
+ }
20421
+ }
20416
20422
  });
20417
20423
  }
20418
20424
  if (snap.regions && typeof snap.regions === "object" && !Array.isArray(snap.regions)) {
@@ -20451,7 +20457,7 @@ function validateWidget(snapshot4) {
20451
20457
  intentViolations
20452
20458
  };
20453
20459
  }
20454
- var screenDescriptorSchema, screenValidateFn, FixtureValidator, CORE_COMPONENTS, widgetSnapshotSchema, WIDGET_BINDING, VALID_TIMEREF_STYLES, utf8ByteLength, WIDGET_ACTION_IDENTIFIER, MAX_WIDGET_ACTION_TTL_SECONDS, WIDGET_INTENT_RULES, widgetValidateFn;
20460
+ var screenDescriptorSchema, screenValidateFn, FixtureValidator, CORE_COMPONENTS, WIDGET_RELEVANCE_SCHEMA, widgetSnapshotSchema, WIDGET_BINDING, VALID_TIMEREF_STYLES, utf8ByteLength, WIDGET_ACTION_IDENTIFIER, MAX_WIDGET_ACTION_TTL_SECONDS, WIDGET_INTENT_RULES, widgetValidateFn;
20455
20461
  var init_validator = __esm({
20456
20462
  "../../core/ts/src/validator.ts"() {
20457
20463
  init_define_HHP_CATALOG();
@@ -21685,6 +21691,15 @@ var init_validator = __esm({
21685
21691
  "himalaya.Lottie",
21686
21692
  "himalaya.Rive"
21687
21693
  ]);
21694
+ WIDGET_RELEVANCE_SCHEMA = {
21695
+ type: "object",
21696
+ additionalProperties: false,
21697
+ required: ["score", "durationSeconds"],
21698
+ properties: {
21699
+ score: { type: "integer", minimum: 0, maximum: 100 },
21700
+ durationSeconds: { type: "integer", minimum: 0 }
21701
+ }
21702
+ };
21688
21703
  widgetSnapshotSchema = {
21689
21704
  $id: "https://himalaya.dev/schema/widget-snapshot.json",
21690
21705
  type: "object",
@@ -21741,10 +21756,17 @@ var init_validator = __esm({
21741
21756
  required: ["startsAt", "payload"],
21742
21757
  properties: {
21743
21758
  startsAt: { type: "integer", minimum: 0 },
21744
- payload: { $ref: "#/$defs/component" }
21759
+ payload: { $ref: "#/$defs/component" },
21760
+ // The frame's own size trees, scanned below like the snapshot's.
21761
+ regions: {
21762
+ type: "object",
21763
+ additionalProperties: { $ref: "#/$defs/component" }
21764
+ },
21765
+ relevance: WIDGET_RELEVANCE_SCHEMA
21745
21766
  }
21746
21767
  }
21747
21768
  },
21769
+ relevance: WIDGET_RELEVANCE_SCHEMA,
21748
21770
  // RFC 0047 — named presentation regions: each value is a frozen component tree
21749
21771
  // (compact/minimal/expanded, list/grid/nowPlaying, …). Scanned for the frozen
21750
21772
  // guarantee + family allowlist below, exactly like `payload` and `frames`.
@@ -45183,7 +45205,13 @@ function servedActionMapEntry(e2) {
45183
45205
  };
45184
45206
  }
45185
45207
  function servedWixApiRules() {
45186
- return wix_api_rules_default.rules.map((r3) => ({
45208
+ return splitServedWixApiRules(wix_api_rules_default.rules).apiRules;
45209
+ }
45210
+ function servedWixApiRulesV2() {
45211
+ return splitServedWixApiRules(wix_api_rules_default.rules).apiRulesV2;
45212
+ }
45213
+ function splitServedWixApiRules(rules) {
45214
+ const served = rules.map((r3) => ({
45187
45215
  id: r3.id,
45188
45216
  method: r3.method,
45189
45217
  path: r3.path,
@@ -45192,8 +45220,11 @@ function servedWixApiRules() {
45192
45220
  evid: r3.evid,
45193
45221
  ...r3.endpoint ? { endpoint: r3.endpoint } : {},
45194
45222
  ...r3.module ? { module: r3.module } : {},
45195
- fields: r3.fields
45223
+ fields: r3.fields,
45224
+ ...r3.when ? { when: r3.when } : {}
45196
45225
  }));
45226
+ const apiRules = served.filter((r3) => !r3.when);
45227
+ return apiRules.length === served.length ? { apiRules } : { apiRules, apiRulesV2: served };
45197
45228
  }
45198
45229
  function servedScreenMap(app2) {
45199
45230
  const entries = screen_map_default.apps[app2];
@@ -45228,6 +45259,8 @@ function deriveTelemetryConfig(app2) {
45228
45259
  const screenMap = servedScreenMap(app2.name);
45229
45260
  if (screenMap) cfg.frog.screenMap = screenMap;
45230
45261
  cfg.frog.apiRules = servedWixApiRules();
45262
+ const apiRulesV2 = servedWixApiRulesV2();
45263
+ if (apiRulesV2) cfg.frog.apiRulesV2 = apiRulesV2;
45231
45264
  assignServedActionMaps(cfg.frog, sourceActionMap(app2.name));
45232
45265
  const pushMap = servedPushMap(app2.name);
45233
45266
  if (pushMap) cfg.frog.pushMap = pushMap;
@@ -47688,6 +47721,7 @@ function shouldRevealError(args) {
47688
47721
  var EMAIL_RE, URL_HOST_RE, INTEGER_RE, NUMBER_RE, AUTHORED_PATTERN_LIMIT, authoredPatterns;
47689
47722
  var init_validation = __esm({
47690
47723
  "../../core/ts/src/validation.ts"() {
47724
+ "use strict";
47691
47725
  init_define_HHP_CATALOG();
47692
47726
  EMAIL_RE = /^[A-Za-z0-9._%+-]+@[A-Za-z0-9-]+(\.[A-Za-z0-9-]+)*\.[A-Za-z]{2,}$/;
47693
47727
  URL_HOST_RE = /^[A-Za-z0-9-]+(\.[A-Za-z0-9-]+)*(:[0-9]+)?$/;
@@ -279984,57 +280018,57 @@ var init_preview_assets_generated = __esm({
279984
280018
  init_define_HHP_CATALOG();
279985
280019
  init_preview_assets_format();
279986
280020
  PREVIEW_ASSET_MANIFEST = [
279987
- { key: "assets/DashboardHost-BGVApysa.js", contentType: "application/javascript; charset=utf-8", offset: 8, length: 2985, sha256: "d03f0bc4db0441dd6e65406655243c048755435411024975ae70cadfe68b649e" },
279988
- { key: "assets/DevDrawer-DcwCkYOi.js", contentType: "application/javascript; charset=utf-8", offset: 2993, length: 16783, sha256: "ffa86a00b1d705e327414de0903c31f50b753be6200a794356a85a3ef6e9ce1e" },
279989
- { key: "assets/IdiomCompare-BbaowJyL.js", contentType: "application/javascript; charset=utf-8", offset: 19776, length: 1926, sha256: "ca01c91b47419ae2c3a2b3645b6818743bfd3ad1c5f3d279c44f8b10dd5b8a78" },
279990
- { key: "assets/LightboxViewer-BXTNjmaV.js", contentType: "application/javascript; charset=utf-8", offset: 21702, length: 15970, sha256: "f66e9bcf5eca097360d5758917e472faccdb5d62de2aaa00a1904daf220ebc99" },
279991
- { key: "assets/OfflineReadingBar-BTJFY2zv.js", contentType: "application/javascript; charset=utf-8", offset: 37672, length: 1761, sha256: "31d9e87868a1c399eecac50081bf2da6f0b19a64f3393ee78999f837c366a0ce" },
279992
- { key: "assets/PhonePreviewControl-CIpO32Jx.js", contentType: "application/javascript; charset=utf-8", offset: 39433, length: 37851, sha256: "35293fd5fc5f2d775167cd303bce1c506f2837ed70bee5422c4022b0028fe8ea" },
279993
- { key: "assets/SchemeCompare-C531FP2l.js", contentType: "application/javascript; charset=utf-8", offset: 77284, length: 1858, sha256: "9da10681ff957263b587f6708b0888839478f0929f00134c6d5bdc254f7fcf7c" },
279994
- { key: "assets/TopBandLayer-9jFWfo4B.js", contentType: "application/javascript; charset=utf-8", offset: 79142, length: 1275, sha256: "caa03e4cad430b8d99ad5b881d34b247ce4ee1110c33bdb986b6f5fd919876cf" },
279995
- { key: "assets/TopBarSearchStates-Berb5atz.js", contentType: "application/javascript; charset=utf-8", offset: 80417, length: 4069, sha256: "ea95dd8c4c9b67a256f9106e23ac1b9734272ced6206524e9afe164ebf0a8e39" },
279996
- { key: "assets/WixFrogTelemetrySink-BvgIV26C.js", contentType: "application/javascript; charset=utf-8", offset: 84486, length: 3586, sha256: "3130b96782333a10d0697c4f9bb72a47a061346ef8d0f1bb78930e1b4e8146d9" },
280021
+ { key: "assets/DashboardHost-ChCBMKgg.js", contentType: "application/javascript; charset=utf-8", offset: 8, length: 2985, sha256: "914cd9502ca88d327b196093e02b4edfec9b737c0b9213b2b370986900ff3c5c" },
280022
+ { key: "assets/DevDrawer-CiEmDhUE.js", contentType: "application/javascript; charset=utf-8", offset: 2993, length: 16783, sha256: "469e1e1126a0075ecb3f0d37a61c8e0851d2ff8ccd7d352ee150675148d17ccf" },
280023
+ { key: "assets/IdiomCompare-SMeq1snY.js", contentType: "application/javascript; charset=utf-8", offset: 19776, length: 1926, sha256: "0c1573120f17e266d37fc424689c046dac21197687577bd9ba8de28a3327d946" },
280024
+ { key: "assets/LightboxViewer-B_gqmp4O.js", contentType: "application/javascript; charset=utf-8", offset: 21702, length: 15970, sha256: "6de268ffa4a4185c5fad7925cb3acc7d6c821aba0fe5d1d4f44b6555abb6bf79" },
280025
+ { key: "assets/OfflineReadingBar-6meWKmUj.js", contentType: "application/javascript; charset=utf-8", offset: 37672, length: 1761, sha256: "d60b71e3e4760dd00e4e135bec2ce48c246fb00b7b8009c2193a7793e9f50ba8" },
280026
+ { key: "assets/PhonePreviewControl-CEHl89HX.js", contentType: "application/javascript; charset=utf-8", offset: 39433, length: 37851, sha256: "2c0d329d9d16a1a3521ac0f3740c69f185c07bce1e8b2c7fb91e94632ac10ed3" },
280027
+ { key: "assets/SchemeCompare-DyF-xOUA.js", contentType: "application/javascript; charset=utf-8", offset: 77284, length: 1858, sha256: "671d75c62dadb3437b9c96271f6d5505891e1cd04c4d2fe8ad6a17828eb03921" },
280028
+ { key: "assets/TopBandLayer-CnpY897i.js", contentType: "application/javascript; charset=utf-8", offset: 79142, length: 1275, sha256: "3a74ba8de8521a0ae767bbb5bb0c5e282d518f230b48077b0786014590220978" },
280029
+ { key: "assets/TopBarSearchStates-BYbza2aZ.js", contentType: "application/javascript; charset=utf-8", offset: 80417, length: 4069, sha256: "3f30a16fd1528ef78808c1a40872ebf4b198e54a3ec58766bd7da900342b986f" },
280030
+ { key: "assets/WixFrogTelemetrySink-Vg6cHR9X.js", contentType: "application/javascript; charset=utf-8", offset: 84486, length: 3586, sha256: "8127916bcb6c1c6d11343080b5510c5a1406290d1a72c6ea152d23c64e0ec219" },
279997
280031
  { key: "assets/calendar-ics-BvfIYWjG.js", contentType: "application/javascript; charset=utf-8", offset: 88072, length: 2192, sha256: "1636167041e9829ceccd3544297b86b8475c38bd2f759c4dbc17c813dc6e9254" },
279998
280032
  { key: "assets/catalog-B4UJpy5D.js", contentType: "application/javascript; charset=utf-8", offset: 90264, length: 35626, sha256: "90111ffcf2d13eff399836acafd1f2b387859440a29dcd4a0afd8370915992cb" },
279999
- { key: "assets/catalogFontFaces-CoyXnVeI.js", contentType: "application/javascript; charset=utf-8", offset: 125890, length: 1111, sha256: "bee3f586f9acc6e0ef1f9a4342521946207124af95b74124fe1df14563f5b1e6" },
280033
+ { key: "assets/catalogFontFaces-1r_W5W56.js", contentType: "application/javascript; charset=utf-8", offset: 125890, length: 1111, sha256: "ccd22af2ad79afe839aeeec8da69d58cfff7638ba23a7c3351d3ad083f8c683a" },
280000
280034
  { key: "assets/contacts-vcard-BcohPQ0m.js", contentType: "application/javascript; charset=utf-8", offset: 127001, length: 2567, sha256: "c4ff75e96cd909bbb9182c5dc78794fcebc65139fbddef2537711d774fb33ad0" },
280001
- { key: "assets/files-transfer-Di40QCJS.js", contentType: "application/javascript; charset=utf-8", offset: 129568, length: 9311, sha256: "69d3a0878871c5d4a0848495bba4674afd01abedf3d0176c8f898c144db45fc3" },
280035
+ { key: "assets/files-transfer-BbD7iQ-1.js", contentType: "application/javascript; charset=utf-8", offset: 129568, length: 9311, sha256: "a71c4ca2a4e91139c1612838b5f512d6045a25d5a8b05dc5fe7ef08e0a893d5f" },
280002
280036
  { key: "assets/frogActionMap-tm2NQk9s.js", contentType: "application/javascript; charset=utf-8", offset: 138879, length: 1336, sha256: "72bb60d400d913ff4865c17604fef897e270e094c52bceca76c22cd9f88847df" },
280003
- { key: "assets/frogApiRules-DxyCKTqS.js", contentType: "application/javascript; charset=utf-8", offset: 140215, length: 2207, sha256: "f09b892b11e5a9361af4adb4caf58c51abc42b367c2cd8c84722896eba4899ca" },
280004
- { key: "assets/frogScreenMap-LM0nfzDQ.js", contentType: "application/javascript; charset=utf-8", offset: 142422, length: 1096, sha256: "991b931a02a029c9c4514f0ccbdc8a07f4cf2168ea3e23ffe5e244327fa05141" },
280005
- { key: "assets/frogScreenNavArgs-mIYDwUYX.js", contentType: "application/javascript; charset=utf-8", offset: 143518, length: 780, sha256: "6c9e52135322e0a752b57ef6f360d71400cb77414b4f29d480230ae174201230" },
280006
- { key: "assets/glassPreviewBrowser-OVmIRgHt.js", contentType: "application/javascript; charset=utf-8", offset: 144298, length: 6800, sha256: "3671697a4f66a1f5f68610fab57d590630be70be934f59675ef1bda9a96e6fe3" },
280007
- { key: "assets/godot-pack-cache-Cuhrw41M.js", contentType: "application/javascript; charset=utf-8", offset: 151098, length: 1626, sha256: "70b16367b8938ebd6eb8494a2b472171dd2acdcb452c52f35f140eb8ede9c0b7" },
280008
- { key: "assets/image-preparation-Cj4gldm6.js", contentType: "application/javascript; charset=utf-8", offset: 152724, length: 2704, sha256: "32944ea587c2f3b84389b66b50a850437560238f1c8d33b6275973ee04eee865" },
280009
- { key: "assets/index-CpL_Y6rT.js", contentType: "application/javascript; charset=utf-8", offset: 155428, length: 1753004, sha256: "197795bf2745453dd8d46455ed9fc8407dbb0161ac4936be32c1e94fb9b65c86" },
280010
- { key: "assets/jsx-runtime-CdvZGgm7.js", contentType: "application/javascript; charset=utf-8", offset: 1908432, length: 7751, sha256: "42a78b508d0f309f6a4a6efbb8669015211b3c26574c5b0929884c4d9d20b806" },
280011
- { key: "assets/network-watches-CMlQPkIj.js", contentType: "application/javascript; charset=utf-8", offset: 1916183, length: 1299, sha256: "84de1da493c628ab86cb34d2cbd5f3076f9534f0706772236602c7cf16a8ef82" },
280012
- { key: "assets/on-device-ml-D5QGvW8P.js", contentType: "application/javascript; charset=utf-8", offset: 1917482, length: 10531, sha256: "914ea54d973624e7bc82d1847444f26084ac16d69be3051b4b5938b1e35beced" },
280013
- { key: "assets/pdf-BrWgpuB0.js", contentType: "application/javascript; charset=utf-8", offset: 1928013, length: 488215, sha256: "dda1fb76c0d4cd06bff81e83b374bfbf1937f894c6f2228ec6cd7140743d0775" },
280014
- { key: "assets/pdf.worker.min-BGnVRhRG.js", contentType: "application/javascript; charset=utf-8", offset: 2416228, length: 90, sha256: "521a0e528916d678d7588b2cddf3dadd3bb959a6d62426382f61c77a82017e35" },
280015
- { key: "assets/pdf.worker.min-BmVo14Nb.mjs", contentType: "application/javascript; charset=utf-8", offset: 2416318, length: 1317034, sha256: "a33cfe728c584fdba4fcc1fd54bcdc2f9f2f13889ddbb5b2bd1d0f8cbe49b84e" },
280016
- { key: "assets/pdfDocument-DPAcWGgi.js", contentType: "application/javascript; charset=utf-8", offset: 3733352, length: 3836, sha256: "8d7c7a1cea19a1f5bdb9e7fa667256d9f2b8e6d6c894ae6b457e8a3d23d38b8f" },
280017
- { key: "assets/pdfFetch-Cc8i1I1h.js", contentType: "application/javascript; charset=utf-8", offset: 3737188, length: 2266, sha256: "1d21ad008921942217c9eac0c35b1713773b9d89c71e3ab4412781f7bb88f463" },
280018
- { key: "assets/scrollLinkedRuntime-D9gLh3CI.js", contentType: "application/javascript; charset=utf-8", offset: 3739454, length: 2278, sha256: "bc211bc3edefba44548ef376c9b7c5799b2a2722a168289f98d56209f4a6e45c" },
280019
- { key: "assets/webviewBridgeHost-Bvq7ob25.js", contentType: "application/javascript; charset=utf-8", offset: 3741732, length: 9946, sha256: "4a015e2020af12bb3f0312d85f393ffb20163c473cf9905869929b67073cc26c" },
280020
- { key: "fonts/Roboto-LICENSE.txt", contentType: "application/octet-stream", offset: 3751678, length: 4610, sha256: "994062dd7af4186a739de55dd9e151c63b6301f8e2cbafc608d35c2e87da0cd2" },
280021
- { key: "fonts/Roboto-Variable.ttf", contentType: "font/ttf", offset: 3756288, length: 488584, sha256: "d7598e12c5dbef095ff8272cfc55da0250bd07fbdecbac8a530b9b277872a134" },
280022
- { key: "fonts/WixMadeforDisplay-Bold.ttf", contentType: "font/ttf", offset: 4244872, length: 90924, sha256: "ec4c7d63772d980d6e147b2df6215fd2737e4b04cebe0cf7e11dc695fb63cdcf" },
280023
- { key: "fonts/WixMadeforDisplay-ExtraBold.ttf", contentType: "font/ttf", offset: 4335796, length: 90984, sha256: "bf4c16a2774edd38a921edf3099469866cd74c094fd596f3fa4e81f54a04dfaa" },
280024
- { key: "fonts/WixMadeforDisplay-Medium.ttf", contentType: "font/ttf", offset: 4426780, length: 90980, sha256: "368faca44fb9f7207e4af784e94750b1ee59c1098b8689e0f4a918926f244fb5" },
280025
- { key: "fonts/WixMadeforDisplay-Regular.ttf", contentType: "font/ttf", offset: 4517760, length: 90872, sha256: "97ed8f1a6772abe26e3d8af5cecfc4b02faa94497d585b0398b5053b739a70c1" },
280026
- { key: "fonts/WixMadeforDisplay-SemiBold.ttf", contentType: "font/ttf", offset: 4608632, length: 90980, sha256: "642feab8a48ddf6c7a89d7c2a7c0edfa0e6e773f671287e460e222703563191e" },
280027
- { key: "fonts/WixMadeforText-Bold.ttf", contentType: "font/ttf", offset: 4699612, length: 108636, sha256: "37c179b4fefb63ea9637322b84583a2df53aa226c150294eea1675c14b1b8e29" },
280028
- { key: "fonts/WixMadeforText-ExtraBold.ttf", contentType: "font/ttf", offset: 4808248, length: 109084, sha256: "62e2fe4718129f36ecdb0ae4de385bd6b81ecc876146447167c6c140fad699a9" },
280029
- { key: "fonts/WixMadeforText-Medium.ttf", contentType: "font/ttf", offset: 4917332, length: 109048, sha256: "4ecf270136af928612c76fe4ebade91d8156975e5ea4c0cf9225501dd1788e02" },
280030
- { key: "fonts/WixMadeforText-Regular.ttf", contentType: "font/ttf", offset: 5026380, length: 107700, sha256: "dee56f09fd3efc127c1ea95557edc74110c1460a46287da36e0af25efd341ef5" },
280031
- { key: "fonts/WixMadeforText-SemiBold.ttf", contentType: "font/ttf", offset: 5134080, length: 88108, sha256: "dced97a77624bc5f8b1ae65850360908297f4588e09feb6f22792d29dc7e765b" },
280032
- { key: "himi-sw.js", contentType: "application/javascript; charset=utf-8", offset: 5222188, length: 6818, sha256: "835250c3d8004f27c2b67f9b471984351ba6df07b916d97e33b43c691200a18c" },
280033
- { key: "index.html", contentType: "text/html; charset=utf-8", offset: 5229006, length: 4924, sha256: "16d5eef982c83abf98e56191abefcff991faff2291b37f39e81c212a3cee7406" },
280034
- { key: "ios-glass-preview.css", contentType: "text/css; charset=utf-8", offset: 5233930, length: 15585, sha256: "98ec60ef8f9568532f0746d1092b5c76f1c52d718365c586c8bade8f62c7c5eb" },
280035
- { key: "kit-tab-bar.css", contentType: "text/css; charset=utf-8", offset: 5249515, length: 1171, sha256: "9e2c3a0faaf05d5471badf167a4d3bdf1c4e6dd65c432eea6d254158bfd99585" },
280036
- { key: "t5-frame.html", contentType: "text/html; charset=utf-8", offset: 5250686, length: 24303, sha256: "7ee3dbacf4e6da69c1c7085a2423e33e2adaec933cd897fb2ee2391e3277c3ae" },
280037
- { key: "t5-worker-frame.html", contentType: "text/html; charset=utf-8", offset: 5274989, length: 24320, sha256: "d24f399a1fcfa7f696a0d96aadbc983d2624b45712dae9a15545f6914dbb9506" }
280037
+ { key: "assets/frogApiRules-BRyH0hFV.js", contentType: "application/javascript; charset=utf-8", offset: 140215, length: 2803, sha256: "5349f16ccf428ffff217d0c22eb865b381528421f87bd6cbcad2ddfc6adc26c6" },
280038
+ { key: "assets/frogScreenMap-LM0nfzDQ.js", contentType: "application/javascript; charset=utf-8", offset: 143018, length: 1096, sha256: "991b931a02a029c9c4514f0ccbdc8a07f4cf2168ea3e23ffe5e244327fa05141" },
280039
+ { key: "assets/frogScreenNavArgs-mIYDwUYX.js", contentType: "application/javascript; charset=utf-8", offset: 144114, length: 780, sha256: "6c9e52135322e0a752b57ef6f360d71400cb77414b4f29d480230ae174201230" },
280040
+ { key: "assets/glassPreviewBrowser-OVmIRgHt.js", contentType: "application/javascript; charset=utf-8", offset: 144894, length: 6800, sha256: "3671697a4f66a1f5f68610fab57d590630be70be934f59675ef1bda9a96e6fe3" },
280041
+ { key: "assets/godot-pack-cache-Cuhrw41M.js", contentType: "application/javascript; charset=utf-8", offset: 151694, length: 1626, sha256: "70b16367b8938ebd6eb8494a2b472171dd2acdcb452c52f35f140eb8ede9c0b7" },
280042
+ { key: "assets/image-preparation-Cj4gldm6.js", contentType: "application/javascript; charset=utf-8", offset: 153320, length: 2704, sha256: "32944ea587c2f3b84389b66b50a850437560238f1c8d33b6275973ee04eee865" },
280043
+ { key: "assets/index-DMUEqAPR.js", contentType: "application/javascript; charset=utf-8", offset: 156024, length: 1753028, sha256: "7c985b35037503b3ec418ad6aebf7c15a2001ab0539699f4fefe8c602968b229" },
280044
+ { key: "assets/jsx-runtime-CdvZGgm7.js", contentType: "application/javascript; charset=utf-8", offset: 1909052, length: 7751, sha256: "42a78b508d0f309f6a4a6efbb8669015211b3c26574c5b0929884c4d9d20b806" },
280045
+ { key: "assets/network-watches-BGYqJERg.js", contentType: "application/javascript; charset=utf-8", offset: 1916803, length: 1299, sha256: "984371073bbc5b7978e2df097b666ec622823317ab5a4d8460c65221a754fc5c" },
280046
+ { key: "assets/on-device-ml-D5QGvW8P.js", contentType: "application/javascript; charset=utf-8", offset: 1918102, length: 10531, sha256: "914ea54d973624e7bc82d1847444f26084ac16d69be3051b4b5938b1e35beced" },
280047
+ { key: "assets/pdf-UNbRm9v0.js", contentType: "application/javascript; charset=utf-8", offset: 1928633, length: 488215, sha256: "0053531a0cb26d4293937d4021578c4c8b6e7fb5f2199a593995336ead10cc38" },
280048
+ { key: "assets/pdf.worker.min-BGnVRhRG.js", contentType: "application/javascript; charset=utf-8", offset: 2416848, length: 90, sha256: "521a0e528916d678d7588b2cddf3dadd3bb959a6d62426382f61c77a82017e35" },
280049
+ { key: "assets/pdf.worker.min-BmVo14Nb.mjs", contentType: "application/javascript; charset=utf-8", offset: 2416938, length: 1317034, sha256: "a33cfe728c584fdba4fcc1fd54bcdc2f9f2f13889ddbb5b2bd1d0f8cbe49b84e" },
280050
+ { key: "assets/pdfDocument-Cv7sh_XZ.js", contentType: "application/javascript; charset=utf-8", offset: 3733972, length: 3836, sha256: "4e9fd535e73e357f2964e9a522f1ed661823e742af4e8427197f3adbd2adc762" },
280051
+ { key: "assets/pdfFetch-Cc8i1I1h.js", contentType: "application/javascript; charset=utf-8", offset: 3737808, length: 2266, sha256: "1d21ad008921942217c9eac0c35b1713773b9d89c71e3ab4412781f7bb88f463" },
280052
+ { key: "assets/scrollLinkedRuntime-Cmq6GqXE.js", contentType: "application/javascript; charset=utf-8", offset: 3740074, length: 2278, sha256: "ba647e36f91fa82db675fd0838a1ca523bc2ad44a7b1cb375b6755eb8e8b2b87" },
280053
+ { key: "assets/webviewBridgeHost-DP1wwmH1.js", contentType: "application/javascript; charset=utf-8", offset: 3742352, length: 9946, sha256: "5f96cb8bdc6c31af2ba467eaaf0ebb58252fddd82c76709e46157cedbf1781d7" },
280054
+ { key: "fonts/Roboto-LICENSE.txt", contentType: "application/octet-stream", offset: 3752298, length: 4610, sha256: "994062dd7af4186a739de55dd9e151c63b6301f8e2cbafc608d35c2e87da0cd2" },
280055
+ { key: "fonts/Roboto-Variable.ttf", contentType: "font/ttf", offset: 3756908, length: 488584, sha256: "d7598e12c5dbef095ff8272cfc55da0250bd07fbdecbac8a530b9b277872a134" },
280056
+ { key: "fonts/WixMadeforDisplay-Bold.ttf", contentType: "font/ttf", offset: 4245492, length: 90924, sha256: "ec4c7d63772d980d6e147b2df6215fd2737e4b04cebe0cf7e11dc695fb63cdcf" },
280057
+ { key: "fonts/WixMadeforDisplay-ExtraBold.ttf", contentType: "font/ttf", offset: 4336416, length: 90984, sha256: "bf4c16a2774edd38a921edf3099469866cd74c094fd596f3fa4e81f54a04dfaa" },
280058
+ { key: "fonts/WixMadeforDisplay-Medium.ttf", contentType: "font/ttf", offset: 4427400, length: 90980, sha256: "368faca44fb9f7207e4af784e94750b1ee59c1098b8689e0f4a918926f244fb5" },
280059
+ { key: "fonts/WixMadeforDisplay-Regular.ttf", contentType: "font/ttf", offset: 4518380, length: 90872, sha256: "97ed8f1a6772abe26e3d8af5cecfc4b02faa94497d585b0398b5053b739a70c1" },
280060
+ { key: "fonts/WixMadeforDisplay-SemiBold.ttf", contentType: "font/ttf", offset: 4609252, length: 90980, sha256: "642feab8a48ddf6c7a89d7c2a7c0edfa0e6e773f671287e460e222703563191e" },
280061
+ { key: "fonts/WixMadeforText-Bold.ttf", contentType: "font/ttf", offset: 4700232, length: 108636, sha256: "37c179b4fefb63ea9637322b84583a2df53aa226c150294eea1675c14b1b8e29" },
280062
+ { key: "fonts/WixMadeforText-ExtraBold.ttf", contentType: "font/ttf", offset: 4808868, length: 109084, sha256: "62e2fe4718129f36ecdb0ae4de385bd6b81ecc876146447167c6c140fad699a9" },
280063
+ { key: "fonts/WixMadeforText-Medium.ttf", contentType: "font/ttf", offset: 4917952, length: 109048, sha256: "4ecf270136af928612c76fe4ebade91d8156975e5ea4c0cf9225501dd1788e02" },
280064
+ { key: "fonts/WixMadeforText-Regular.ttf", contentType: "font/ttf", offset: 5027e3, length: 107700, sha256: "dee56f09fd3efc127c1ea95557edc74110c1460a46287da36e0af25efd341ef5" },
280065
+ { key: "fonts/WixMadeforText-SemiBold.ttf", contentType: "font/ttf", offset: 5134700, length: 88108, sha256: "dced97a77624bc5f8b1ae65850360908297f4588e09feb6f22792d29dc7e765b" },
280066
+ { key: "himi-sw.js", contentType: "application/javascript; charset=utf-8", offset: 5222808, length: 6818, sha256: "835250c3d8004f27c2b67f9b471984351ba6df07b916d97e33b43c691200a18c" },
280067
+ { key: "index.html", contentType: "text/html; charset=utf-8", offset: 5229626, length: 4924, sha256: "44891ef4e292affad0cb557714c81ffac978079924e40bfbb02af17fb0996293" },
280068
+ { key: "ios-glass-preview.css", contentType: "text/css; charset=utf-8", offset: 5234550, length: 15585, sha256: "98ec60ef8f9568532f0746d1092b5c76f1c52d718365c586c8bade8f62c7c5eb" },
280069
+ { key: "kit-tab-bar.css", contentType: "text/css; charset=utf-8", offset: 5250135, length: 1171, sha256: "9e2c3a0faaf05d5471badf167a4d3bdf1c4e6dd65c432eea6d254158bfd99585" },
280070
+ { key: "t5-frame.html", contentType: "text/html; charset=utf-8", offset: 5251306, length: 24303, sha256: "7ee3dbacf4e6da69c1c7085a2423e33e2adaec933cd897fb2ee2391e3277c3ae" },
280071
+ { key: "t5-worker-frame.html", contentType: "text/html; charset=utf-8", offset: 5275609, length: 24320, sha256: "d24f399a1fcfa7f696a0d96aadbc983d2624b45712dae9a15545f6914dbb9506" }
280038
280072
  ];
280039
280073
  }
280040
280074
  });
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wix/himalaya-cli",
3
- "version": "0.2023.0",
3
+ "version": "0.2025.0",
4
4
  "type": "module",
5
5
  "description": "himi — the Himalaya authoring CLI. Build a Tier-5 content package on your own machine, push it to the production serve as a draft, preview it on web + Himi Player, and read worker logs back — the remote dev loop. Wraps @himalaya/serve-cli for transport.",
6
6
  "keywords": [
@@ -82,5 +82,5 @@
82
82
  "artifactId": "himalaya-cli"
83
83
  }
84
84
  },
85
- "falconPackageHash": "5714db7fad96f4bb10bbe265b8e1adff67139f218dd94ad0d7097746"
85
+ "falconPackageHash": "5bf9ebc8fbd17e5cc40e1887ba294cc59880e730067921ef5ff06410"
86
86
  }
@@ -23,7 +23,7 @@ import { queryEvents } from "@himalaya/wix-events";
23
23
  import { queryDraftPosts } from "@himalaya/wix-blog";
24
24
  import {
25
25
  str, hhmm, sameLocalDay, dayLabel, rankItems, glanceFields, bookingItems, orderItems, eventItems, blogItems, shownUntil,
26
- GLANCE_COPY, focusFields, focusList, type GlanceFields, type GlanceFocus, type GlanceFocusOption,
26
+ GLANCE_COPY, focusFields, focusList, type GlanceFields, type GlanceFocus, type GlanceFocusOption, type GlanceItem,
27
27
  } from "./glance.js";
28
28
 
29
29
  export { isSectionUnavailable, isSignedOut, dayLabel };
@@ -45,9 +45,24 @@ export interface TodayBooking {
45
45
 
46
46
  /** The glance ("what matters now", glance.ts) rides on the same state: the existing fields stay
47
47
  * for the embedding hosts that bind them (the embedding guide), the glance fields are added. */
48
+ /** One future frame of a focus's timeline: the glance as it will read from `startsAt` (epoch
49
+ * SECONDS), re-ranked at that moment, with the score of what it headlines. */
50
+ export type GlanceFrame = GlanceFields & { startsAt: number; score: number; durationSeconds: number };
51
+
52
+ /** One focus's glance now, and the frames that follow it. */
53
+ export type FocusGlance = GlanceFields & {
54
+ validUntil: number;
55
+ /** The headline's score (0 when nothing is waiting): the widget's Smart Stack relevance. */
56
+ score: number;
57
+ /** Future frames, ascending, at most `MAX_FRAMES - 1` within 24 h; each differs from the one before. */
58
+ frames: GlanceFrame[];
59
+ /** Epoch SECONDS the last frame stops being true; equals `validUntil` without frames. */
60
+ timelineUntil: number;
61
+ };
62
+
48
63
  export interface TodayState extends GlanceFields {
49
64
  /** The glance for each focus a widget may be set to ("now" + the provisioned areas). */
50
- focuses: Record<GlanceFocus, GlanceFields & { validUntil: number }>;
65
+ focuses: Record<GlanceFocus, FocusGlance>;
51
66
  /** Those focuses with owner-facing titles, in order — the widget picker's list. */
52
67
  focusList: GlanceFocusOption[];
53
68
  eventsReady: boolean;
@@ -150,8 +165,46 @@ function upcoming(rows: Rec[] | null, statuses: string[], now: Date): Rec[] {
150
165
  .sort((a, b) => Date.parse(startOf(a)) - Date.parse(startOf(b)) || str(a, "id").localeCompare(str(b, "id")));
151
166
  }
152
167
 
168
+ /** A widget timeline is small: WidgetKit budgets its reloads, and a frame is a whole tree. */
169
+ export const MAX_FRAMES = 8;
170
+ export const TIMELINE_HOURS = 24;
171
+ /** A count read now is not vouched for past this: a later frame drops it. */
172
+ export const COUNTS_FRESH_MS = 3 * 60 * 60 * 1000;
173
+ const HOUR_MS = 60 * 60 * 1000;
174
+
175
+ interface ShapeOptions {
176
+ /** Compute the future frames (off for the frames themselves). */
177
+ timeline?: boolean;
178
+ /** This frame is far enough from the read that its counts are dropped. */
179
+ countsStale?: boolean;
180
+ }
181
+
182
+ /** The moments a glance changes on its own, with no new read: a booking enters its last hour
183
+ * and starts, an event enters its last 3 h and starts, a post goes live, the day turns, and the
184
+ * counts stop being fresh. Ascending, after `now`, within 24 h. Only the `MAX_FRAMES` soonest
185
+ * starts of each source: no focus keeps more frames than that, and every moment costs a full
186
+ * `shape`, so a day of 50 bookings must not mean 100 of them on every publish. */
187
+ function frameTimes(sources: Sources, now: Date): number[] {
188
+ const t0 = now.getTime();
189
+ const at = (s: string) => Date.parse(s);
190
+ // A second past a start: an item is still upcoming AT its start (`start >= now`).
191
+ const started = (s: number) => s + 1000;
192
+ const soonest = (starts: number[]) =>
193
+ starts.filter((s) => Number.isFinite(s) && started(s) > t0).sort((a, b) => a - b).slice(0, MAX_FRAMES);
194
+ const times = [
195
+ ...soonest((sources.bookings ?? []).map((b) => at(startOf(b)))).flatMap((s) => [s - HOUR_MS, started(s)]),
196
+ ...soonest((sources.events ?? []).map((e) => at(str(e, "dateAndTimeSettings.startDate")))).flatMap((s) => [s - 3 * HOUR_MS, started(s)]),
197
+ ...soonest((sources.drafts ?? []).map((d) => at(str(d, "scheduledPublishDate")))).map(started),
198
+ new Date(now.getFullYear(), now.getMonth(), now.getDate() + 1).getTime(),
199
+ t0 + COUNTS_FRESH_MS,
200
+ ];
201
+ return [...new Set(times.filter((t) => Number.isFinite(t) && t > t0 && t <= t0 + TIMELINE_HOURS * HOUR_MS))]
202
+ .sort((a, b) => a - b);
203
+ }
204
+
153
205
  /** Pure: shape what was read into the widget state. `now` is injectable for tests. */
154
- export function shape(sources: Sources, now: Date, siteName: string, provisioned: Verticals = buildVerticals()): TodayState {
206
+ export function shape(sources: Sources, now: Date, siteName: string, provisioned: Verticals = buildVerticals(),
207
+ options: ShapeOptions = { timeline: true }): TodayState {
155
208
  const bookingsReady = sources.bookings !== null && sources.requests !== null;
156
209
  const ordersReady = sources.orders !== null;
157
210
  // Re-filtered even though the queries filter: a server (or a fixture) that returns a
@@ -176,7 +229,7 @@ export function shape(sources: Sources, now: Date, siteName: string, provisioned
176
229
  const midnight = new Date(now.getFullYear(), now.getMonth(), now.getDate() + 1).getTime();
177
230
  const nextStart = next ? Date.parse(startOf(next)) : Infinity;
178
231
  const nextShown = next ? booking(next, now) : undefined;
179
- const ranked = rankItems([
232
+ const allRanked = rankItems([
180
233
  ...(bookingsReady ? bookingItems(
181
234
  nextShown && { start: new Date(startOf(next!)), service: nextShown.service, firstName: str(next, "contactDetails.firstName") },
182
235
  requestCount, requestsCapped, now, LIMIT) : []),
@@ -184,14 +237,18 @@ export function shape(sources: Sources, now: Date, siteName: string, provisioned
184
237
  ...(eventsReady ? eventItems(sources.events ?? [], now) : []),
185
238
  ...(blogReady ? blogItems(sources.drafts ?? [], now, LIMIT) : []),
186
239
  ]);
240
+ // A frame far from the read keeps what is true by the clock (a booking, an event, a post) and
241
+ // drops the counts, which may have changed since: it never shows a morning's "3 orders" at night.
242
+ const ranked = options.countsStale ? allRanked.filter((i) => i.count === undefined) : allRanked;
243
+ const dropped = options.countsStale ? allRanked.filter((i) => i.count !== undefined) : [];
187
244
  // A shown item stops being true when it starts (a booking or event is no longer "next"), as
188
245
  // the next booking already did: the frame's lifetime ends at the first of them.
189
246
  const headAt = shownUntil(ranked);
190
247
  // Nothing could be read at all: the glance shows the degrade line, never "All clear".
191
- const glance = nothing ? degradeGlance(COPY.nothing) : glanceFields(ranked, GLANCE_COPY);
248
+ const glance = nothing ? degradeGlance(COPY.nothing) : withDropped(glanceFields(ranked, GLANCE_COPY), ranked, dropped);
192
249
  // One glance per focus a widget may be set to (PR 2): "now" is the glance above, an area keeps
193
250
  // only its own items. The phone publishes one frame per focus from the same descriptors.
194
- const options = focusList(provisioned);
251
+ const focusOptions = focusList(provisioned);
195
252
  // Each focus's frame ends when an item IT shows starts — an Events widget headlines an event
196
253
  // that may be 4th in "now" — so it carries its own `validUntil`, laid over the state's.
197
254
  const ownEnd = (f: GlanceFocus) => f === "now"
@@ -202,16 +259,21 @@ export function shape(sources: Sources, now: Date, siteName: string, provisioned
202
259
  const areaReady: Record<GlanceFocus, boolean> = {
203
260
  now: !nothing, bookings: bookingsReady, store: ordersReady, events: eventsReady, blog: blogReady,
204
261
  };
205
- const focuses = Object.fromEntries(options.map((f) => [f.id, {
262
+ const own = (items: GlanceItem[], f: GlanceFocus) => f === "now" ? items : items.filter((i) => i.area === f);
263
+ const nowFocuses = Object.fromEntries(focusOptions.map((f) => [f.id, {
206
264
  ...(!areaReady[f.id]
207
265
  ? { ...degradeGlance(COPY.nothing), glanceLabel: focusFields([], f.id, GLANCE_COPY).glanceLabel }
208
- : focusFields(ranked, f.id, GLANCE_COPY)),
266
+ : withDropped(focusFields(ranked, f.id, GLANCE_COPY), own(ranked, f.id), own(dropped, f.id))),
209
267
  validUntil: ownEnd(f.id),
210
- }])) as Record<GlanceFocus, GlanceFields & { validUntil: number }>;
268
+ score: areaReady[f.id] ? own(ranked, f.id)[0]?.score ?? 0 : 0,
269
+ frames: [] as GlanceFrame[],
270
+ timelineUntil: ownEnd(f.id),
271
+ }])) as Record<GlanceFocus, FocusGlance>;
272
+ const focuses = options.timeline ? withTimeline(nowFocuses, sources, now, siteName, provisioned) : nowFocuses;
211
273
  return {
212
274
  ...glance,
213
275
  focuses,
214
- focusList: options,
276
+ focusList: focusOptions,
215
277
  eventsReady,
216
278
  blogReady,
217
279
  validUntil: Math.floor(Math.min(midnight, nextStart, headAt) / 1000),
@@ -243,7 +305,9 @@ export function degraded(status: "error" | "signedOut" | "loading", siteName: st
243
305
  // A FIXED instant, not the clock: a degrade frame has no rows, so nothing in it depends on
244
306
  // the time — and the initial state must be deterministic (template contract: no worker's
245
307
  // initial state may read the clock).
246
- const base = shape({ bookings: null, requests: null, orders: null }, new Date(0), siteName);
308
+ // No timeline: a degrade frame stays what it is until the next read, and frame times would
309
+ // read the build machine's local midnight.
310
+ const base = shape({ bookings: null, requests: null, orders: null }, new Date(0), siteName, buildVerticals(), { timeline: false });
247
311
  const message = status === "signedOut" ? COPY.signedOut : status === "error" ? COPY.error : "";
248
312
  // validUntil pinned too: shape() derives it from LOCAL midnight, so even at a fixed instant it
249
313
  // would vary with the build machine's timezone and change the baked services hash.
@@ -254,11 +318,80 @@ export function degraded(status: "error" | "signedOut" | "loading", siteName: st
254
318
  ...base, status, message, hideMessage: !message, validUntil: 0,
255
319
  ...line,
256
320
  // Each focus keeps its own header ("Orders"), only the line is the degrade one.
257
- focuses: Object.fromEntries(base.focusList.map((f) => [f.id,
258
- { ...line, glanceLabel: focusFields([], f.id, GLANCE_COPY).glanceLabel, validUntil: 0 }])) as Record<GlanceFocus, GlanceFields & { validUntil: number }>,
321
+ focuses: Object.fromEntries(base.focusList.map((f): [GlanceFocus, FocusGlance] => [f.id,
322
+ { ...line, glanceLabel: focusFields([], f.id, GLANCE_COPY).glanceLabel, validUntil: 0, score: 0, frames: [], timelineUntil: 0 }])) as Record<GlanceFocus, FocusGlance>,
259
323
  };
260
324
  }
261
325
 
326
+ /** The glance of a frame whose counts were dropped (`ShapeOptions.countsStale`): where a count
327
+ * would be, "Open Owner to refresh". With nothing left by the clock it says only that, never
328
+ * "All clear" — the counts it dropped may still be waiting. */
329
+ function withDropped(fields: GlanceFields, kept: GlanceItem[], dropped: GlanceItem[]): GlanceFields {
330
+ if (!dropped.length) return fields;
331
+ if (!kept.length) return { ...degradeGlance(COPY.error), glanceLabel: fields.glanceLabel };
332
+ const secondary = [...kept.slice(1, 2).map((i) => i.short), COPY.error].filter(Boolean).join(" · ");
333
+ return {
334
+ ...fields,
335
+ glanceSecondary: secondary, hideGlanceSecondary: false,
336
+ lockRectSecondary: COPY.error, lockHideSecondary: false,
337
+ // Every surface that carried a count says so, the one-line Lock Screen slot included.
338
+ lockInline: `${kept[0].lockTitle} · ${COPY.error}`,
339
+ };
340
+ }
341
+
342
+ const GLANCE_KEYS: (keyof GlanceFields)[] = [
343
+ "glanceHeadline", "glanceDetail", "glanceTime", "hideGlanceTime", "glanceSymbol", "glanceSecondary",
344
+ "hideGlanceSecondary", "glanceAllClear", "glanceLabel", "lockInline", "lockCircValue", "lockCircLabel",
345
+ "lockRectTitle", "lockRectDetail", "lockRectSecondary", "lockHideSecondary",
346
+ ];
347
+
348
+ function glanceOnly(f: GlanceFields): GlanceFields {
349
+ return Object.fromEntries(GLANCE_KEYS.map((k) => [k, f[k]])) as unknown as GlanceFields;
350
+ }
351
+
352
+ function sameGlance(a: GlanceFields, b: GlanceFields): boolean {
353
+ return GLANCE_KEYS.every((k) => a[k] === b[k]);
354
+ }
355
+
356
+ /** Lay each focus's future frames over its glance now: the state re-shaped at each moment the
357
+ * glance changes by itself (`frameTimes`), keeping only a frame that reads differently from the
358
+ * one before it, at most `MAX_FRAMES` in all (the now frame counts). A focus whose area could not
359
+ * be read reads the same degrade line at every moment, so it gets none. */
360
+ function withTimeline(
361
+ focuses: Record<GlanceFocus, FocusGlance>, sources: Sources, now: Date, siteName: string, provisioned: Verticals,
362
+ ): Record<GlanceFocus, FocusGlance> {
363
+ const t0 = now.getTime();
364
+ const later = frameTimes(sources, now).map((t) => ({
365
+ t, state: shape(sources, new Date(t), siteName, provisioned, { countsStale: t - t0 >= COUNTS_FRESH_MS }),
366
+ }));
367
+ return Object.fromEntries(Object.entries(focuses).map(([id, focus]) => {
368
+ const frames: GlanceFrame[] = [];
369
+ let previous: GlanceFields & { score: number } = focus;
370
+ let until = focus.validUntil;
371
+ for (const { t, state } of later) {
372
+ if (frames.length >= MAX_FRAMES - 1) break;
373
+ const at = state.focuses[id as GlanceFocus];
374
+ // A frame that reads the same but matters more (a booking entering its last hour) is kept:
375
+ // its relevance is what lifts the widget to the top of a Smart Stack.
376
+ if (!at) continue;
377
+ if (sameGlance(previous, at) && previous.score === at.score) {
378
+ // Still reads the same at this moment, so what is showing holds for as long as it does here.
379
+ until = Math.max(until, at.validUntil);
380
+ continue;
381
+ }
382
+ frames.push({ ...glanceOnly(at), startsAt: Math.floor(t / 1000), score: at.score, durationSeconds: 0 });
383
+ previous = at;
384
+ until = at.validUntil;
385
+ }
386
+ // Each frame holds until the next one starts; the last until it stops being true, or the
387
+ // timeline's 24 h end if that comes first.
388
+ const end = Math.min(Math.floor((t0 + TIMELINE_HOURS * HOUR_MS) / 1000), until);
389
+ const starts = [...frames.map((f) => f.startsAt), end];
390
+ frames.forEach((f, i) => { f.durationSeconds = Math.max(0, starts[i + 1] - f.startsAt); });
391
+ return [id, { ...focus, frames, timelineUntil: frames.length ? end : focus.validUntil }];
392
+ })) as Record<GlanceFocus, FocusGlance>;
393
+ }
394
+
262
395
  /** The glance of a frame that could not read the business: its one line in every slot, never
263
396
  * "All clear", and never an empty Lock Screen circle. */
264
397
  function degradeGlance(message: string): GlanceFields {