@wix/himalaya-cli 0.1711.0 → 0.1713.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.
@@ -873,7 +873,7 @@ export interface OrientationEnvelope {
873
873
  export declare const DEFAULT_ORIENTATION_ENVELOPE: Required<OrientationEnvelope>;
874
874
  /** Fill in the absent families. Total, so callers never branch on `undefined`. */
875
875
  export declare function resolveOrientationEnvelope(env?: OrientationEnvelope): Required<OrientationEnvelope>;
876
- export type Capability = "camera" | "barcode_scanner" | "biometrics" | "secure_storage" | "share" | "push" | "file_picker" | "files" | "open_url" | "pdf" | "clipboard" | "theme" | "l10n" | "photos" | "presigned_upload" | "ui" | "calendar" | "contacts" | "tasks" | "audio_record" | "audio_record_background" | "calls" | "location" | "location_background" | "motion" | "health" | "media_playback" | "webview" | "browser_auth" | "haptic" | "himi_apps" | "iap" | "keyboard" | "torch" | "network" | "wix_cashier" | "wix_chat" | "live_activity" | "local_database" | "speech" | "speaker_diarization" | "system_intents" | "on_device_ai" | "app_info" | "release_control" | "legacy_import" | "godot" | "base44" | "animation";
876
+ export type Capability = "camera" | "barcode_scanner" | "biometrics" | "secure_storage" | "share" | "push" | "file_picker" | "files" | "open_url" | "pdf" | "clipboard" | "theme" | "l10n" | "photos" | "presigned_upload" | "ui" | "calendar" | "contacts" | "tasks" | "audio_record" | "audio_record_background" | "calls" | "location" | "location_background" | "motion" | "health" | "media_playback" | "webview" | "browser_auth" | "haptic" | "himi_apps" | "iap" | "keyboard" | "torch" | "network" | "wix_cashier" | "wix_chat" | "live_activity" | "local_database" | "speech" | "speaker_diarization" | "system_intents" | "on_device_ai" | "app_info" | "release_control" | "legacy_import" | "godot" | "base44" | "animation" | "video_playback";
877
877
  /** `defineApp({ wixIap })` — the purchases-service app a build binds this app to. */
878
878
  export interface WixIapConfig {
879
879
  /** The purchases service's app UUID, registered on the app's own auth site. Not a secret. */
@@ -2267,10 +2267,11 @@ export interface PdfViewProps {
2267
2267
  allowShare?: boolean;
2268
2268
  }
2269
2269
  /**
2270
- * Inline video player. Needs the `media_playback` capability: the player lives in the native
2271
- * media module, which a binary links only when the app declares `media_playback` (in
2272
- * `capabilities` or `capabilityEnvelope`). Without it the component draws a sized placeholder,
2273
- * and `himi validate` rejects a screen that uses it.
2270
+ * Inline video player. Needs the `media_playback` capability, or the lighter `video_playback` for
2271
+ * in-app playback with no background audio: the player lives in the native media module, which a
2272
+ * binary links only when the app declares one of them (in `capabilities` or `capabilityEnvelope`).
2273
+ * Without it the component draws a sized placeholder, and `himi validate` rejects a screen that
2274
+ * uses it.
2274
2275
  */
2275
2276
  export interface VideoProps {
2276
2277
  url?: string;
@@ -163,6 +163,12 @@ export interface SitePageNodeSpec {
163
163
  title?: string;
164
164
  /** Overrides merged OVER the site preset, like {@link SitePage.webView}. */
165
165
  webView?: Partial<WebViewConfig>;
166
+ /** RFC 0079 §7 — `"worker"`: the page talks to the screen's worker (`@wix/himalaya/webview-page` on the
167
+ * page, `@himalaya/webview` in the worker, whose bundle must declare `"webview"`). On a binary whose
168
+ * baked site contains the page and the preset's allow-list, the page is SITE-TRUSTED: it keeps every
169
+ * site behaviour and gains the channel, which is attached only while the page's main frame is inside
170
+ * the site. Anywhere else it falls back to RFC 0073's strict profile. Unset ⇒ no channel. */
171
+ bridge?: "worker";
166
172
  }
167
173
  /** The component id every site-page node gets unless the author names one. A screen has one
168
174
  * primary node (RFC 0079 §9), so a fixed id is unique and stays a stable test id (invariant 27).
@@ -3,7 +3,7 @@ export declare const MAX_SIMULTANEOUS_BRIDGED_WEBVIEWS = 4;
3
3
  export interface WebViewEmbeddedFinding {
4
4
  severity: "error" | "warning";
5
5
  /** Stable id of the §4.6 rule, for tests and tooling; never match on `message`. */
6
- rule: "bridge_requires_worker" | "template_instance_id" | "duplicate_instance_id" | "instance_id_reused_across_screens" | "storage_seed_requires_per_instance" | "per_instance_with_url" | "fill_with_height" | "too_many_bridged" | "bridged_url_not_allowed" | "unknown_enum_value" | "multiple_primary_webviews" | "primary_in_scroll_container" | "primary_in_template" | "primary_without_weight" | "fill_in_vertical_scroll" | "internal_links_as_screens_on_node" | "bridged_site_without_primary" | "dual_form_without_primary" | "dual_form_mismatch" | "dual_form_logic_bundle";
6
+ rule: "bridge_requires_worker" | "template_instance_id" | "duplicate_instance_id" | "instance_id_reused_across_screens" | "storage_seed_requires_per_instance" | "per_instance_with_url" | "fill_with_height" | "too_many_bridged" | "bridged_url_not_allowed" | "unknown_enum_value" | "multiple_primary_webviews" | "primary_in_scroll_container" | "primary_in_template" | "primary_without_weight" | "fill_in_vertical_scroll" | "internal_links_as_screens_on_node" | "bridged_site_without_primary" | "primary_bridge_not_site_trusted" | "dual_form_without_primary" | "dual_form_mismatch" | "dual_form_logic_bundle";
7
7
  path: string;
8
8
  message: string;
9
9
  }
@@ -51,6 +51,21 @@ export declare function canonicalScreenArgs(args: Readonly<Record<string, unknow
51
51
  */
52
52
  export declare function effectiveWebViewInstanceId(screenId: string, args: Readonly<Record<string, unknown>> | undefined, componentId: string, explicitInstanceId?: string): string;
53
53
  export { DUAL_FORM_NODE_RENDERER, DUAL_FORM_T3_RENDERER, payloadNodeForm, prefersPayloadNodeForm, rootPrimaryWebView, sameCapabilityScope } from "./site-screen-form.js";
54
+ /** Whether a page URL is inside the site's path boundaries (the RFC 0062 §3 rule): https, no
55
+ * credentials, the boundary's host and port, and its path or anything under it. */
56
+ export declare function siteOriginsAdmit(url: string, siteOrigins: readonly string[]): boolean;
57
+ /**
58
+ * RFC 0079 §9 — the app-level half of the site-trusted rule: a `role: "primary"` + `bridge: "worker"`
59
+ * WebView whose literal `url`, or any `allowedOrigins` entry, is outside the app's `site` block
60
+ * (`navigation.site.origins`). The device decides trust from the BAKED site (§7) and fails closed to the
61
+ * strict profile, so this is a warning: the page stays a primary page, under the strict bridge profile.
62
+ * `siteOrigins` null/empty — the app has no site block — means no primary bridged page can be trusted.
63
+ * The empty allow-list case is the single-screen rule in {@link webViewEmbeddedFindings}.
64
+ */
65
+ export declare function webViewSiteTrustAppFindings(screens: Iterable<{
66
+ screenId: string;
67
+ descriptor: unknown;
68
+ }>, siteOrigins: readonly string[] | null | undefined): WebViewEmbeddedAppFinding[];
54
69
  /**
55
70
  * The single-screen §4.6 rules over one screen descriptor. The cross-screen rule (an explicit
56
71
  * `per_instance` literal reused for different content) needs every screen, so it is
@@ -8132,7 +8132,8 @@ function looksLikeCardData(field) {
8132
8132
  }
8133
8133
  var ENVELOPE_IMPLIES = {
8134
8134
  location_background: ["location"],
8135
- audio_record_background: ["audio_record"]
8135
+ audio_record_background: ["audio_record"],
8136
+ media_playback: ["video_playback"]
8136
8137
  };
8137
8138
  function validateLadderConfig(config) {
8138
8139
  const caps = new Set(config.capabilities ?? []);
@@ -14742,6 +14743,68 @@ function primaryRules(s, config, out) {
14742
14743
  message: `WebView "${s.id}" sets bridge: "worker" with a site config (${siteFields.join(", ")}) but no role: "primary" \u2014 a bridged WebView that is not the screen's site page gets the strict bridge profile, which drops the site behaviours those fields ask for (RFC 0079 \xA77, \xA79)`
14743
14744
  });
14744
14745
  }
14746
+ if (isBridged(props) && primary && allowedOriginsOf(config).length === 0) {
14747
+ out.push({
14748
+ severity: "warning",
14749
+ rule: "primary_bridge_not_site_trusted",
14750
+ path: `${path}.body.props.config.allowedOrigins`,
14751
+ message: `WebView "${s.id}" is a primary page with bridge: "worker" but no config.allowedOrigins \u2014 the device trusts a site page's channel only when every allowed origin is inside the app's baked site, so this page stays a primary page under the strict bridge profile (no off-site prompt, /login intercept, session bridges or site links). Give it the site's allow-list (sitePage() does) (RFC 0079 \xA77, \xA79)`
14752
+ });
14753
+ }
14754
+ }
14755
+ var allowedOriginsOf = (config) => Array.isArray(config.allowedOrigins) ? config.allowedOrigins.filter((o) => typeof o === "string") : [];
14756
+ function siteBoundary(raw) {
14757
+ const trimmed = raw.trim();
14758
+ if (!/^https:\/\//i.test(trimmed) || trimmed.includes("*")) return null;
14759
+ const rawPath = trimmed.replace(/^https:\/\/[^/?#]*/i, "").split(/[?#]/)[0];
14760
+ if (rawPath.replace(/%2e/gi, ".").split("/").some((seg) => seg === "." || seg === "..")) return null;
14761
+ let url;
14762
+ try {
14763
+ url = new URL(trimmed);
14764
+ } catch {
14765
+ return null;
14766
+ }
14767
+ if (url.username || url.password || url.search || url.hash || !url.hostname) return null;
14768
+ const path = (url.pathname.endsWith("/") ? url.pathname : `${url.pathname}/`).toLowerCase();
14769
+ return { host: url.hostname.toLowerCase(), port: url.port, path };
14770
+ }
14771
+ var boundaryWithin = (a, b) => a.host === b.host && a.port === b.port && a.path.startsWith(b.path);
14772
+ function siteOriginsAdmit(url, siteOrigins) {
14773
+ const page = siteBoundary(url.split("#")[0].split("?")[0]);
14774
+ if (page === null) return false;
14775
+ return siteOrigins.map(siteBoundary).some((b) => b !== null && boundaryWithin(page, b));
14776
+ }
14777
+ function siteOriginsContain(entry, siteOrigins) {
14778
+ const e = siteBoundary(entry);
14779
+ if (e === null) return false;
14780
+ return siteOrigins.map(siteBoundary).some((b) => b !== null && boundaryWithin(e, b));
14781
+ }
14782
+ function webViewSiteTrustAppFindings(screens, siteOrigins) {
14783
+ const origins = siteOrigins ?? [];
14784
+ const out = [];
14785
+ for (const { screenId, descriptor } of screens) {
14786
+ if (!isRec2(descriptor)) continue;
14787
+ for (const s of collectWebViews(descriptor)) {
14788
+ if (!isBridged(s.props) || !isPrimary(s.props)) continue;
14789
+ const allowed = allowedOriginsOf(configOf(s.props));
14790
+ if (allowed.length === 0) continue;
14791
+ const outsideUrl = isLiteral(s.props.url) && !siteOriginsAdmit(s.props.url, origins);
14792
+ const outsideEntries = allowed.filter((o) => !siteOriginsContain(o, origins));
14793
+ if (!outsideUrl && outsideEntries.length === 0) continue;
14794
+ const what = origins.length === 0 ? "the app has no site block (navigation.site)" : [
14795
+ ...outsideUrl ? [`its url ${JSON.stringify(s.props.url)}`] : [],
14796
+ ...outsideEntries.length > 0 ? [`allowedOrigins ${JSON.stringify(outsideEntries)}`] : []
14797
+ ].join(" and ") + ` ${outsideUrl && outsideEntries.length === 0 ? "is" : "are"} outside the app's site block (${JSON.stringify(origins)})`;
14798
+ out.push({
14799
+ severity: "warning",
14800
+ rule: "primary_bridge_not_site_trusted",
14801
+ screenId,
14802
+ path: `${s.path}.body.props.${outsideUrl ? "url" : "config.allowedOrigins"}`,
14803
+ message: `WebView "${s.id}" is a primary page with bridge: "worker", but ${what} \u2014 the device trusts a site page's channel only inside the binary's baked site, so this page stays a primary page under the strict bridge profile (RFC 0079 \xA77, \xA79)`
14804
+ });
14805
+ }
14806
+ }
14807
+ return out;
14745
14808
  }
14746
14809
  function webViewEmbeddedFindings(descriptor) {
14747
14810
  if (!isRec2(descriptor)) return [];
@@ -15065,7 +15128,7 @@ function defineSitePageScreen(site) {
15065
15128
  var SITE_PAGE_NODE_ID = "site_page_view";
15066
15129
  var SITE_SCREEN_FORMS = ["t3", "node", "both"];
15067
15130
  var SITE_NODE_SCREEN_RENDERER = "sdui_layout";
15068
- function primarySiteWebView(url, config, id, label2, capabilitiesRequired) {
15131
+ function primarySiteWebView(url, config, id, label2, capabilitiesRequired, bridge) {
15069
15132
  return {
15070
15133
  id,
15071
15134
  body: {
@@ -15076,6 +15139,7 @@ function primarySiteWebView(url, config, id, label2, capabilitiesRequired) {
15076
15139
  role: "primary",
15077
15140
  fill: true,
15078
15141
  scrollEnabled: true,
15142
+ ...bridge === "worker" ? { bridge } : {},
15079
15143
  ...capabilitiesRequired ? { capabilitiesRequired: [...capabilitiesRequired] } : {},
15080
15144
  ...config ? { config } : {}
15081
15145
  }
@@ -15098,7 +15162,10 @@ function sitePageNode(site, page, opts) {
15098
15162
  throw new Error("a site page node needs a path");
15099
15163
  }
15100
15164
  const url = sitePageUrl(site.origin, page.path);
15101
- return primarySiteWebView(url, { ...siteWebViewPreset(site), ...page.webView ?? {} }, opts?.id ?? SITE_PAGE_NODE_ID, page.title, []);
15165
+ if (page.bridge !== void 0 && page.bridge !== "worker") {
15166
+ throw new Error(`site page bridge ${JSON.stringify(page.bridge)} must be "worker" or unset`);
15167
+ }
15168
+ return primarySiteWebView(url, { ...siteWebViewPreset(site), ...page.webView ?? {} }, opts?.id ?? SITE_PAGE_NODE_ID, page.title, [], page.bridge);
15102
15169
  }
15103
15170
  function isDesugarableSiteScreen(descriptor) {
15104
15171
  return !!descriptor && descriptor.renderer === "webview_native_bridge" && typeof descriptor.url === "string" && descriptor.url !== "" && descriptor.logicBundle === void 0 && descriptor.webViewConfig?.internalLinksAsScreens !== true;
@@ -15720,6 +15787,7 @@ export {
15720
15787
  siteNav,
15721
15788
  siteNavConfig,
15722
15789
  siteNavKind,
15790
+ siteOriginsAdmit,
15723
15791
  sitePageNode,
15724
15792
  sitePageUrl,
15725
15793
  siteScreenId,
@@ -15749,6 +15817,7 @@ export {
15749
15817
  webViewEmbeddedAppFindings,
15750
15818
  webViewEmbeddedFindings,
15751
15819
  webViewOriginAllowed,
15820
+ webViewSiteTrustAppFindings,
15752
15821
  widgetSnapshotSchema,
15753
15822
  workerSubtreePolicyErrors,
15754
15823
  workerSubtreeSha256
@@ -8454,7 +8454,7 @@ function siteWebViewPreset(site) {
8454
8454
  };
8455
8455
  }
8456
8456
  var SITE_PAGE_NODE_ID = "site_page_view";
8457
- function primarySiteWebView(url, config, id, label2, capabilitiesRequired) {
8457
+ function primarySiteWebView(url, config, id, label2, capabilitiesRequired, bridge) {
8458
8458
  return {
8459
8459
  id,
8460
8460
  body: {
@@ -8465,6 +8465,7 @@ function primarySiteWebView(url, config, id, label2, capabilitiesRequired) {
8465
8465
  role: "primary",
8466
8466
  fill: true,
8467
8467
  scrollEnabled: true,
8468
+ ...bridge === "worker" ? { bridge } : {},
8468
8469
  ...capabilitiesRequired ? { capabilitiesRequired: [...capabilitiesRequired] } : {},
8469
8470
  ...config ? { config } : {}
8470
8471
  }
@@ -8487,7 +8488,10 @@ function sitePageNode(site, page, opts) {
8487
8488
  throw new Error("a site page node needs a path");
8488
8489
  }
8489
8490
  const url = sitePageUrl(site.origin, page.path);
8490
- return primarySiteWebView(url, { ...siteWebViewPreset(site), ...page.webView ?? {} }, opts?.id ?? SITE_PAGE_NODE_ID, page.title, []);
8491
+ if (page.bridge !== void 0 && page.bridge !== "worker") {
8492
+ throw new Error(`site page bridge ${JSON.stringify(page.bridge)} must be "worker" or unset`);
8493
+ }
8494
+ return primarySiteWebView(url, { ...siteWebViewPreset(site), ...page.webView ?? {} }, opts?.id ?? SITE_PAGE_NODE_ID, page.title, [], page.bridge);
8491
8495
  }
8492
8496
 
8493
8497
  // ../../core/ts/src/rich-content-limits.generated.ts
@@ -2,7 +2,7 @@
2
2
  "files": [
3
3
  {
4
4
  "name": "sw.js",
5
- "bytes": 2542570
5
+ "bytes": 2544178
6
6
  },
7
7
  {
8
8
  "name": "host.html",
@@ -21,7 +21,7 @@
21
21
  "bytes": 23064
22
22
  },
23
23
  {
24
- "name": "preview-deferred/82ac5473f6edad4c4d0e5c0cfd460722e7e145b9f097cf708cdc97621f386d6a.bin",
24
+ "name": "preview-deferred/eebfb701744c8f130b659a79b33f563c2a47f5104d624fe7e108a064dce68d1b.bin",
25
25
  "bytes": 488215
26
26
  },
27
27
  {
@@ -79,10 +79,10 @@
79
79
  ],
80
80
  "deferred": [
81
81
  {
82
- "key": "assets/pdf-Cz5R3omz.js",
82
+ "key": "assets/pdf-eJ6o0ucP.js",
83
83
  "contentType": "application/javascript; charset=utf-8",
84
- "sha256": "82ac5473f6edad4c4d0e5c0cfd460722e7e145b9f097cf708cdc97621f386d6a",
85
- "file": "preview-deferred/82ac5473f6edad4c4d0e5c0cfd460722e7e145b9f097cf708cdc97621f386d6a.bin"
84
+ "sha256": "eebfb701744c8f130b659a79b33f563c2a47f5104d624fe7e108a064dce68d1b",
85
+ "file": "preview-deferred/eebfb701744c8f130b659a79b33f563c2a47f5104d624fe7e108a064dce68d1b.bin"
86
86
  },
87
87
  {
88
88
  "key": "assets/pdf.worker.min-BGnVRhRG.js",