@wix/himalaya-cli 0.1584.0 → 0.1586.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.
@@ -186,6 +186,11 @@ export interface DerivedAppMeta {
186
186
  /** `provisioning.json` `installedVerticals` — the site's verticals, which decide which Wix
187
187
  * notification destinations a derived route table covers. Read from disk at load time. */
188
188
  installedVerticals?: string[];
189
+ /** `provisioning.json` `siteId` when it is a real metaSiteId (`himi site create
190
+ * --write-provisioning` / `himi site analyze --apply` write one; the dev placeholder
191
+ * `development-site` is not). Resolves a frog `mobileAppId` template such as Branded Lite's
192
+ * `brandedLite_{msid}`: the binary is bound by its Headless clientId and holds no msid. */
193
+ provisionedMsid?: string;
189
194
  /** Forwarded from AppConfig.control for the OTA app-config channel. */
190
195
  control?: import("@wix/himalaya/core").AppControl;
191
196
  /** Forwarded from AppConfig.appLinkHosts for the OTA app-config channel. */
@@ -287,8 +292,6 @@ export interface DerivedAppMeta {
287
292
  /** Android App-Links identity for /.well-known/assetlinks.json. */
288
293
  androidAssetLinks?: import("@wix/himalaya/core").AndroidAssetLinks;
289
294
  }
290
- /** `platforms` is the app's parsed `platforms.json` (RFC 0051 surface envelope), and
291
- * `provisioning` the facts read from its `provisioning.json`. Both are passed IN rather than
292
- * read here because this module is types-only by design — the readers live in loader.ts and
293
- * provisioning-facts.ts, which already touch the filesystem. */
295
+ /** A Wix metaSiteId is a UUID; anything else in `provisioning.json` is a placeholder. */
296
+ export declare function isMetaSiteId(v: unknown): v is string;
294
297
  export declare function deriveAppMeta(name: string, m: AppDevModule, platforms?: Record<string, boolean>, provisioning?: import("./provisioning-facts.js").ProvisioningFacts): DerivedAppMeta;
@@ -44,11 +44,32 @@ export interface SnackbarOptions {
44
44
  tone?: SnackbarTone;
45
45
  /** Auto-dismiss delay in ms, on every host. Default 3000; 0 or less also means 3000. */
46
46
  durationMs?: number;
47
+ /** One action button ("Undo", "View"). Tapping it runs `actionId` with `args`, then dismisses the
48
+ * snackbar. The id must be a worker action:
49
+ * - one of this bundle's own `tier5.<svc>.<action>` ids — run on THIS worker, never another
50
+ * screen's or the app-level worker's;
51
+ * - an app service's `app.<svc>.<action>` — needs `app_services` and an exported action (an app
52
+ * service's own id needs neither). The web host refuses it until it hosts app services.
53
+ * Any other id (`capability.*`, `himi.*`, a registered handler) is refused when the snackbar is
54
+ * requested: the call rejects and nothing is shown. A host that cannot tell which worker asked
55
+ * (React Native, an embedded web region) refuses every `action` the same way. */
56
+ action?: SnackbarAction;
57
+ }
58
+ export interface SnackbarAction {
59
+ /** The button's text — also its VoiceOver / TalkBack / screen-reader label. */
60
+ label: string;
61
+ /** What the tap runs: one of this bundle's own `tier5.<svc>.<action>` ids, or `app.<svc>.<action>`. */
62
+ actionId: string;
63
+ /** The action's arguments, which the reducer receives as typed JSON. */
64
+ args?: Record<string, unknown>;
47
65
  }
48
66
  /** Show a transient snackbar toast: it floats above the tab bar, slides and fades in and out
49
67
  * (fades only under reduced motion), queues behind one that is already showing, and is read
50
68
  * by VoiceOver / TalkBack. Resolves once it is PRESENTED (not after it auto-dismisses).
51
- * Rejects with `no_ui_host` if no presenter is attached. */
69
+ * Rejects with `no_ui_host` if no presenter is attached; with an `action`, also with
70
+ * `invalid_action` (empty label or id), `action_not_allowed` (not one of this bundle's
71
+ * actions), or, for an `app.*` id, `undeclared` (no `app_services`), `not_exported`, `no_service`,
72
+ * `no_action`, `not_booted` or `unavailable`. */
52
73
  export declare function snackbar(options: SnackbarOptions): Promise<void>;
53
74
  /** Capability version, for bundles that gate on min binary version. */
54
75
  export declare const version = 1;
@@ -1,5 +1,5 @@
1
1
  /** Every sigil the platform understands, without the leading `$`. */
2
- export declare const BINDING_SIGILS: readonly ["service", "flag", "item", "t"];
2
+ export declare const BINDING_SIGILS: readonly ["service", "flag", "item", "t", "app"];
3
3
  export type BindingSigil = (typeof BINDING_SIGILS)[number];
4
4
  /**
5
5
  * Matches any binding expression by its leading sigil.
@@ -12,11 +12,12 @@ export type BindingSigil = (typeof BINDING_SIGILS)[number];
12
12
  * are long enough for that collision to be implausible; one letter is not, and the
13
13
  * token grammar is always `$t:<key>` anyway.
14
14
  *
15
- * RFC 0074's `$app:` is deliberately NOT in this list yet. Every renderer gates on it (web
16
- * `isBinding`, RN), and none resolves `$app:` until the runtime arms land (S3/S5/S7): adding it here
17
- * alone made web/RN blank a field's literal sibling while iOS/Android printed it. It joins with the
18
- * resolvers, all surfaces at once. Until then `isAppBinding` / `parseAppBinding` below are the
19
- * validator's grammar, and the per-app gate keeps `$app:` out of served content.
15
+ * RFC 0074's `$app:` joined with S7 (#4640), the last runtime resolver arm: iOS/Android
16
+ * learned it in S3/S5 and the web renderer resolves it now, so every surface treats it as a
17
+ * binding at once. It needs its COLON for the same reason `t` does — the grammar is always
18
+ * `$app:<svc>.<path>`, and `\b` after `app` would capture a literal `"$app store"` and blank
19
+ * it. React Native deliberately has no `$app:` resolver (RFC 0074 §12): there the binding
20
+ * fails open to the field's literal sibling, exactly like an unbooted worker.
20
21
  */
21
22
  export declare const BINDING_SIGIL_RE: RegExp;
22
23
  /** Is this value a binding rather than a literal? */
@@ -5,6 +5,7 @@ import type { NavigationConfig, SplashConfig } from "./schema.js";
5
5
  import { type AppServicesConfig } from "./app-services-gate.js";
6
6
  import { type LocaleConfig } from "./locale.js";
7
7
  import { type DistributionConfig } from "./distribution.js";
8
+ import { type StoreConfig } from "./store-adopt.js";
8
9
  import type { CmsConfig } from "./cms.js";
9
10
  import { type DataResourcesConfig } from "@wix/himalaya/data-resources";
10
11
  import { type Base44EntitySpec, type Base44FunctionSpec } from "./base44-entities.js";
@@ -517,6 +518,13 @@ export interface AppConfig {
517
518
  * `GET /.well-known/assetlinks.json`. Pure app identity.
518
519
  */
519
520
  androidAssetLinks?: AndroidAssetLinks;
521
+ /**
522
+ * Store identity (#4647). `store.adopt` declares that this app IS an existing store app: the
523
+ * store build ships under its bundle id, team, App Groups, URL schemes and associated domains
524
+ * instead of a derived identity. Dev, device and QA builds keep `bundleId` / `applicationId`.
525
+ * Read only through `adoptedIdentity()` (./store-adopt.ts).
526
+ */
527
+ store?: StoreConfig;
520
528
  }
521
529
  /** Which registrar the native push facade hands its device token to. */
522
530
  export type PushRegistrar = "generic" | "wix-ping";
@@ -791,7 +799,7 @@ export interface OrientationEnvelope {
791
799
  export declare const DEFAULT_ORIENTATION_ENVELOPE: Required<OrientationEnvelope>;
792
800
  /** Fill in the absent families. Total, so callers never branch on `undefined`. */
793
801
  export declare function resolveOrientationEnvelope(env?: OrientationEnvelope): Required<OrientationEnvelope>;
794
- export type Capability = "camera" | "barcode_scanner" | "biometrics" | "secure_storage" | "share" | "push" | "file_picker" | "files" | "open_url" | "pdf" | "clipboard" | "theme" | "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" | "network" | "wix_cashier" | "wix_chat" | "live_activity" | "local_database" | "speech" | "speaker_diarization" | "system_intents" | "on_device_ai" | "app_info" | "release_control" | "godot" | "base44" | "animation";
802
+ 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" | "network" | "wix_cashier" | "wix_chat" | "live_activity" | "local_database" | "speech" | "speaker_diarization" | "system_intents" | "on_device_ai" | "app_info" | "release_control" | "godot" | "base44" | "animation";
795
803
  /** `defineApp({ wixIap })` — the purchases-service app a build binds this app to. */
796
804
  export interface WixIapConfig {
797
805
  /** The purchases service's app UUID, registered on the app's own auth site. Not a secret. */
@@ -20,6 +20,7 @@ export * from "./worker-subtree-safe-types.generated.js";
20
20
  export * from "./icon-catalog.generated.js";
21
21
  export * from "./app-link.js";
22
22
  export * from "./app-identity.js";
23
+ export * from "./store-adopt.js";
23
24
  export * from "./app-registry-client.js";
24
25
  export * from "./site-shell.js";
25
26
  export * from "./site-menu.js";
@@ -80,3 +80,42 @@ export declare function resolveAppLocale(opts: {
80
80
  app?: LocaleConfig | null;
81
81
  device?: string | null;
82
82
  }): SupportedLocale;
83
+ /** `locale.set { tag: "system" }` — clear the user choice and follow the device language
84
+ * (under the `shipsLocale` rule, so an English-only app stays English on a Hebrew phone). */
85
+ export declare const LOCALE_SYSTEM = "system";
86
+ /** Endonyms for the picker rows. Mirrored by `LocaleStore.nativeNames` (Swift / Kotlin);
87
+ * a supported tag missing here falls back to the tag itself. */
88
+ export declare const LOCALE_NATIVE_NAMES: Readonly<Record<string, string>>;
89
+ /** Wire value of `locale.get`'s `source`. The store's internal `"app"` origin (the served
90
+ * `default`, pinned or not) reads `"default"` on the wire. */
91
+ export type LocaleChoiceSource = "user" | "device" | "default";
92
+ export interface AvailableLocale {
93
+ tag: SupportedLocale;
94
+ nativeName: string;
95
+ dir: "ltr" | "rtl";
96
+ }
97
+ /** `locale.get`'s payload. */
98
+ export interface LocaleGetResult {
99
+ tag: SupportedLocale;
100
+ source: LocaleChoiceSource;
101
+ available: AvailableLocale[];
102
+ }
103
+ export declare function localeChoiceSource(source: LocaleSource | string | null | undefined): LocaleChoiceSource;
104
+ /**
105
+ * The locales the app ships, source locale first, then `translations` in declared order,
106
+ * de-duplicated and coerced (an unsupported or malformed entry is dropped, exactly as
107
+ * `shipsLocale` ignores it).
108
+ */
109
+ export declare function availableLocales(app: LocaleConfig | null | undefined): AvailableLocale[];
110
+ /**
111
+ * Validate a `locale.set` tag. A shipped locale (matched by primary subtag, so `he-IL`
112
+ * selects `he`) or `"system"`; anything else is `unsupported_locale` and the caller must
113
+ * change nothing.
114
+ */
115
+ export declare function parseLocaleSetTag(app: LocaleConfig | null | undefined, tag: string | null | undefined): {
116
+ ok: true;
117
+ tag: SupportedLocale | typeof LOCALE_SYSTEM;
118
+ } | {
119
+ ok: false;
120
+ error: "unsupported_locale";
121
+ };
@@ -0,0 +1,73 @@
1
+ /** How the store build of the Android app is signed. Names a dist-plane keystore policy. */
2
+ export type AdoptedAndroidSigning = "wix-keystore" | "upload-keystore";
3
+ export declare const ADOPTED_ANDROID_SIGNING: readonly AdoptedAndroidSigning[];
4
+ export interface StoreAdoptConfig {
5
+ /** The existing App Store app's bundle id. Must differ from the app's dev `bundleId`. */
6
+ iosBundleId: string;
7
+ /** The Apple Developer team that owns the existing app record (10 characters). */
8
+ appleTeamId: string;
9
+ /** App Store Connect numeric app id of the existing listing. */
10
+ appStoreId?: string;
11
+ /** The existing Play listing's applicationId (the release variant ships under it). */
12
+ androidApplicationId: string;
13
+ /** App Groups the existing binary uses — each `group.…`. Installed users' shared data lives there. */
14
+ iosAppGroups?: string[];
15
+ /** URL schemes the existing binary registers, BEYOND `navigation.scheme`. */
16
+ urlSchemes?: string[];
17
+ /** Universal-link / App-Link hosts (`app.example.com`, or `host/path` to claim a path). No scheme prefix. */
18
+ associatedDomains?: string[];
19
+ /** Embedded extension bundle ids, keyed by the extension's suffix in project.yml (`<host>.<suffix>`). */
20
+ iosExtensionBundleIds?: Record<string, string>;
21
+ /** Which keystore signs the Android store build; it must be the one the existing listing was signed with. */
22
+ androidSigning?: AdoptedAndroidSigning;
23
+ /** Extensions the old binary shipped and the new one deliberately does not. Generates nothing. */
24
+ dropExtensions?: string[];
25
+ }
26
+ export interface StoreConfig {
27
+ /** Adopt an existing store listing's identity for store builds. */
28
+ adopt?: StoreAdoptConfig;
29
+ }
30
+ /** One associated domain, split. `path` is absent for a whole-host claim. */
31
+ export interface AdoptedDomain {
32
+ host: string;
33
+ path?: string;
34
+ }
35
+ /** The normalized adopted identity. Arrays are always present (possibly empty). */
36
+ export interface AdoptedIdentity {
37
+ iosBundleId: string;
38
+ appleTeamId: string;
39
+ appStoreId?: string;
40
+ androidApplicationId: string;
41
+ androidSigning?: AdoptedAndroidSigning;
42
+ iosAppGroups: string[];
43
+ /** Extra schemes only (navigation.scheme is not repeated here), lowercased, in declared order. */
44
+ urlSchemes: string[];
45
+ associatedDomains: AdoptedDomain[];
46
+ /** Distinct hosts of `associatedDomains`, in declared order — one `applinks:` entitlement each. */
47
+ associatedDomainHosts: string[];
48
+ iosExtensionBundleIds: Record<string, string>;
49
+ dropExtensions: string[];
50
+ }
51
+ /** The config fields `adoptedIdentity` reads. Structural, so any app-config shape can be passed. */
52
+ export interface StoreAdoptSource {
53
+ bundleId?: string;
54
+ applicationId?: string;
55
+ navigation?: {
56
+ scheme?: string;
57
+ };
58
+ store?: StoreConfig;
59
+ }
60
+ /** Parse one associated-domain entry (`host` or `host/path`), naming the field on failure. */
61
+ export declare function parseAdoptedDomain(entry: string, field?: string): AdoptedDomain;
62
+ /**
63
+ * The normalized adopted store identity of an app, or `undefined` when it adopts none.
64
+ *
65
+ * The single reader of `store.adopt`. Throws — naming the field — on any malformed value, so a
66
+ * config that would ship a wrong identity never builds. `defineApp` calls it, which is what makes
67
+ * every rejection surface at config load.
68
+ */
69
+ export declare function adoptedIdentity(config: StoreAdoptSource): AdoptedIdentity | undefined;
70
+ /** The `com.apple.developer.associated-domains` values for an adopted identity: one `applinks:<host>` per host. */
71
+ export declare function adoptedApplinks(identity: AdoptedIdentity): string[];
72
+ /** The iOS entitlement keys an adopted identity requires — what the signing step must request capabilities for. */
73
+ export declare function adoptedEntitlementKeys(identity: AdoptedIdentity): string[];
@@ -7030,6 +7030,35 @@ function resolveAppLocale(opts) {
7030
7030
  if (appDefault) return appDefault;
7031
7031
  return "en";
7032
7032
  }
7033
+ var LOCALE_SYSTEM = "system";
7034
+ var LOCALE_NATIVE_NAMES = {
7035
+ en: "English",
7036
+ he: "\u05E2\u05D1\u05E8\u05D9\u05EA",
7037
+ es: "Espa\xF1ol"
7038
+ };
7039
+ function localeChoiceSource(source) {
7040
+ if (source === "user") return "user";
7041
+ if (source === "app") return "default";
7042
+ return "device";
7043
+ }
7044
+ function availableLocales(app) {
7045
+ const tags = [coerceSupportedLocale(app?.default) ?? "en"];
7046
+ const list = app?.translations;
7047
+ if (Array.isArray(list) && list.every((x) => typeof x === "string")) {
7048
+ for (const raw of list) {
7049
+ const t = coerceSupportedLocale(raw);
7050
+ if (t && !tags.includes(t)) tags.push(t);
7051
+ }
7052
+ }
7053
+ return tags.map((tag) => ({ tag, nativeName: LOCALE_NATIVE_NAMES[tag] ?? tag, dir: layoutDirection(tag) }));
7054
+ }
7055
+ function parseLocaleSetTag(app, tag) {
7056
+ const raw = (tag ?? "").trim();
7057
+ if (raw.toLowerCase() === LOCALE_SYSTEM) return { ok: true, tag: LOCALE_SYSTEM };
7058
+ const t = coerceSupportedLocale(raw);
7059
+ if (t && shipsLocale(app, t)) return { ok: true, tag: t };
7060
+ return { ok: false, error: "unsupported_locale" };
7061
+ }
7033
7062
 
7034
7063
  // ../../core/ts/src/media.ts
7035
7064
  var SAFE_MEDIA_SCHEMES = /* @__PURE__ */ new Set(["http:", "https:", "file:"]);
@@ -7247,6 +7276,166 @@ function validateDistribution(d, where = "distribution") {
7247
7276
  }
7248
7277
  }
7249
7278
 
7279
+ // ../../core/ts/src/store-adopt.ts
7280
+ var ADOPTED_ANDROID_SIGNING = ["wix-keystore", "upload-keystore"];
7281
+ var ADOPT_KEYS = /* @__PURE__ */ new Set([
7282
+ "iosBundleId",
7283
+ "appleTeamId",
7284
+ "appStoreId",
7285
+ "androidApplicationId",
7286
+ "iosAppGroups",
7287
+ "urlSchemes",
7288
+ "associatedDomains",
7289
+ "iosExtensionBundleIds",
7290
+ "androidSigning",
7291
+ "dropExtensions"
7292
+ ]);
7293
+ var IOS_BUNDLE_ID = /^[A-Za-z0-9-]+(?:\.[A-Za-z0-9-]+)+$/;
7294
+ var ANDROID_APPLICATION_ID = /^[A-Za-z][A-Za-z0-9_]*(?:\.[A-Za-z][A-Za-z0-9_]*)+$/;
7295
+ var APPLE_TEAM_ID = /^[A-Z0-9]{10}$/;
7296
+ var APP_STORE_ID = /^[0-9]+$/;
7297
+ var URL_SCHEME = /^[A-Za-z][A-Za-z0-9+.-]*$/;
7298
+ var HOST = /^(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/;
7299
+ var PATH = /^(?:\/[A-Za-z0-9._~!$&'()*+,;=:@%-]+)+\/?$/;
7300
+ function fail(field, message) {
7301
+ throw new Error(`defineApp: store.adopt.${field} ${message}`);
7302
+ }
7303
+ function stringList(adopt, field) {
7304
+ const v = adopt[field];
7305
+ if (v === void 0) return [];
7306
+ if (!Array.isArray(v) || v.some((x) => typeof x !== "string")) fail(field, "must be an array of strings.");
7307
+ return v;
7308
+ }
7309
+ function requiredString(adopt, field) {
7310
+ const v = adopt[field];
7311
+ if (typeof v !== "string" || !v) fail(field, "is required.");
7312
+ return v;
7313
+ }
7314
+ function parseAdoptedDomain(entry, field = "associatedDomains") {
7315
+ if (/^[A-Za-z][A-Za-z0-9+.-]*:/.test(entry)) {
7316
+ fail(field, `entry "${entry}" must not carry a scheme prefix (no "applinks:" / "https://"): give the host, e.g. "app.example.com".`);
7317
+ }
7318
+ const slash = entry.indexOf("/");
7319
+ const host = (slash < 0 ? entry : entry.slice(0, slash)).toLowerCase();
7320
+ const path = slash < 0 ? void 0 : entry.slice(slash).replace(/\/$/, "");
7321
+ if (!HOST.test(host)) fail(field, `entry "${entry}" is not a valid host.`);
7322
+ if (path !== void 0 && (path === "" || !PATH.test(path))) fail(field, `entry "${entry}" has an invalid path.`);
7323
+ return path ? { host, path } : { host };
7324
+ }
7325
+ function adoptedIdentity(config) {
7326
+ const store = config.store;
7327
+ if (store === void 0) return void 0;
7328
+ if (store === null || typeof store !== "object" || Array.isArray(store)) {
7329
+ throw new Error("defineApp: store must be an object.");
7330
+ }
7331
+ for (const key of Object.keys(store)) {
7332
+ if (key !== "adopt") throw new Error(`defineApp: store.${key} is not a known field (expected "adopt").`);
7333
+ }
7334
+ const raw = store.adopt;
7335
+ if (raw === void 0) return void 0;
7336
+ if (raw === null || typeof raw !== "object" || Array.isArray(raw)) throw new Error("defineApp: store.adopt must be an object.");
7337
+ const adopt = raw;
7338
+ for (const key of Object.keys(adopt)) {
7339
+ if (!ADOPT_KEYS.has(key)) fail(key, "is not a known field.");
7340
+ }
7341
+ const iosBundleId = requiredString(adopt, "iosBundleId");
7342
+ if (!IOS_BUNDLE_ID.test(iosBundleId)) fail("iosBundleId", `"${iosBundleId}" is not a valid iOS bundle id.`);
7343
+ if (config.bundleId !== void 0 && iosBundleId === config.bundleId) {
7344
+ fail(
7345
+ "iosBundleId",
7346
+ `"${iosBundleId}" equals the app's dev bundleId. The dev build must keep its own id, or a dev install replaces the store app on a device.`
7347
+ );
7348
+ }
7349
+ const appleTeamId = requiredString(adopt, "appleTeamId");
7350
+ if (!APPLE_TEAM_ID.test(appleTeamId)) fail("appleTeamId", `"${appleTeamId}" must be a 10-character Apple team id (A-Z, 0-9).`);
7351
+ let appStoreId;
7352
+ if (adopt.appStoreId !== void 0) {
7353
+ if (typeof adopt.appStoreId !== "string" || !APP_STORE_ID.test(adopt.appStoreId)) {
7354
+ fail("appStoreId", `"${String(adopt.appStoreId)}" must be the numeric App Store Connect app id, as a string.`);
7355
+ }
7356
+ appStoreId = adopt.appStoreId;
7357
+ }
7358
+ const androidApplicationId = requiredString(adopt, "androidApplicationId");
7359
+ if (!ANDROID_APPLICATION_ID.test(androidApplicationId)) {
7360
+ fail("androidApplicationId", `"${androidApplicationId}" is not a valid Android applicationId.`);
7361
+ }
7362
+ let androidSigning;
7363
+ if (adopt.androidSigning !== void 0) {
7364
+ if (!ADOPTED_ANDROID_SIGNING.includes(adopt.androidSigning)) {
7365
+ fail("androidSigning", `"${String(adopt.androidSigning)}" must be one of ${ADOPTED_ANDROID_SIGNING.map((s) => `"${s}"`).join(", ")}.`);
7366
+ }
7367
+ androidSigning = adopt.androidSigning;
7368
+ }
7369
+ const iosAppGroups = stringList(adopt, "iosAppGroups");
7370
+ const seenGroups = /* @__PURE__ */ new Set();
7371
+ for (const g of iosAppGroups) {
7372
+ if (!g.startsWith("group.") || !IOS_BUNDLE_ID.test(g)) fail("iosAppGroups", `entry "${g}" must be an App Group id starting with "group.".`);
7373
+ if (seenGroups.has(g)) fail("iosAppGroups", `entry "${g}" is declared twice.`);
7374
+ seenGroups.add(g);
7375
+ }
7376
+ const urlSchemes = [];
7377
+ const devScheme = config.navigation?.scheme?.toLowerCase();
7378
+ for (const s of stringList(adopt, "urlSchemes")) {
7379
+ if (!URL_SCHEME.test(s)) fail("urlSchemes", `entry "${s}" is not an RFC 3986 scheme (a letter, then letters, digits, "+", "-" or ".").`);
7380
+ const lower = s.toLowerCase();
7381
+ if (urlSchemes.includes(lower)) fail("urlSchemes", `entry "${s}" is declared twice.`);
7382
+ if (lower === devScheme) fail("urlSchemes", `entry "${s}" duplicates navigation.scheme; list only the extra schemes.`);
7383
+ urlSchemes.push(lower);
7384
+ }
7385
+ const associatedDomains = [];
7386
+ const seenDomains = /* @__PURE__ */ new Set();
7387
+ for (const entry of stringList(adopt, "associatedDomains")) {
7388
+ const d = parseAdoptedDomain(entry);
7389
+ const key = d.host + (d.path ?? "");
7390
+ if (seenDomains.has(key)) fail("associatedDomains", `entry "${entry}" is declared twice.`);
7391
+ seenDomains.add(key);
7392
+ associatedDomains.push(d);
7393
+ }
7394
+ const associatedDomainHosts = [...new Set(associatedDomains.map((d) => d.host))];
7395
+ const iosExtensionBundleIds = {};
7396
+ const ext = adopt.iosExtensionBundleIds;
7397
+ if (ext !== void 0) {
7398
+ if (ext === null || typeof ext !== "object" || Array.isArray(ext)) fail("iosExtensionBundleIds", "must be an object of suffix \u2192 bundle id.");
7399
+ for (const [suffix, id] of Object.entries(ext)) {
7400
+ if (!suffix || !/^[A-Za-z0-9-]+(?:\.[A-Za-z0-9-]+)*$/.test(suffix)) fail("iosExtensionBundleIds", `key "${suffix}" is not a bundle id suffix.`);
7401
+ if (typeof id !== "string" || !IOS_BUNDLE_ID.test(id)) fail("iosExtensionBundleIds", `"${suffix}" \u2192 "${String(id)}" is not a valid iOS bundle id.`);
7402
+ if (!id.startsWith(iosBundleId + ".")) {
7403
+ fail("iosExtensionBundleIds", `"${suffix}" \u2192 "${id}" must start with "${iosBundleId}." \u2014 Apple requires an embedded bundle's id to extend its app's.`);
7404
+ }
7405
+ iosExtensionBundleIds[suffix] = id;
7406
+ }
7407
+ }
7408
+ const dropExtensions = stringList(adopt, "dropExtensions");
7409
+ for (const id of dropExtensions) {
7410
+ if (!IOS_BUNDLE_ID.test(id)) fail("dropExtensions", `entry "${id}" is not a valid bundle id.`);
7411
+ if (Object.values(iosExtensionBundleIds).includes(id)) {
7412
+ fail("dropExtensions", `entry "${id}" is also mapped in iosExtensionBundleIds \u2014 an extension is either shipped or dropped.`);
7413
+ }
7414
+ }
7415
+ return {
7416
+ iosBundleId,
7417
+ appleTeamId,
7418
+ ...appStoreId !== void 0 ? { appStoreId } : {},
7419
+ androidApplicationId,
7420
+ ...androidSigning !== void 0 ? { androidSigning } : {},
7421
+ iosAppGroups,
7422
+ urlSchemes,
7423
+ associatedDomains,
7424
+ associatedDomainHosts,
7425
+ iosExtensionBundleIds,
7426
+ dropExtensions
7427
+ };
7428
+ }
7429
+ function adoptedApplinks(identity) {
7430
+ return identity.associatedDomainHosts.map((h) => `applinks:${h}`);
7431
+ }
7432
+ function adoptedEntitlementKeys(identity) {
7433
+ const keys = [];
7434
+ if (identity.iosAppGroups.length) keys.push("com.apple.security.application-groups");
7435
+ if (identity.associatedDomainHosts.length) keys.push("com.apple.developer.associated-domains");
7436
+ return keys;
7437
+ }
7438
+
7250
7439
  // ../../core/ts/src/auth-gate-screen.ts
7251
7440
  function gateScreenIdShapeProblem(id) {
7252
7441
  if (id === void 0) return null;
@@ -7471,48 +7660,48 @@ var FUNCTION_LIMITS_MAX = {
7471
7660
  maxRequestBytes: 10 * 1048576,
7472
7661
  maxResponseBytes: 10 * 1048576
7473
7662
  };
7474
- function fail(message) {
7663
+ function fail2(message) {
7475
7664
  throw new Error(`defineFunction: ${message}`);
7476
7665
  }
7477
7666
  function validateName(name) {
7478
- if (typeof name !== "string") fail("name must be a string");
7479
- if (!/^[a-z][a-z0-9]*(?:[-_.][a-z0-9]+)*$/.test(name)) fail(`name must be lowercase kebab-case: "${name}"`);
7667
+ if (typeof name !== "string") fail2("name must be a string");
7668
+ if (!/^[a-z][a-z0-9]*(?:[-_.][a-z0-9]+)*$/.test(name)) fail2(`name must be lowercase kebab-case: "${name}"`);
7480
7669
  }
7481
7670
  function validateFunctionRoute(method, path) {
7482
- if (!HTTP_METHODS.includes(method)) fail(`method must be one of ${HTTP_METHODS.join(", ")}`);
7671
+ if (!HTTP_METHODS.includes(method)) fail2(`method must be one of ${HTTP_METHODS.join(", ")}`);
7483
7672
  if (path !== "/" && (!/^\/[A-Za-z0-9._~!$&'()*+,;=:@%/-]+$/.test(path) || path.includes("//") || path.endsWith("/"))) {
7484
- fail(`path must be an absolute, normalized route without query syntax: "${path}"`);
7673
+ fail2(`path must be an absolute, normalized route without query syntax: "${path}"`);
7485
7674
  }
7486
7675
  const params = [...path.matchAll(/:([A-Za-z][A-Za-z0-9_]*)/g)].map((match) => match[1]);
7487
- if (new Set(params).size !== params.length) fail(`path contains duplicate parameter names: "${path}"`);
7676
+ if (new Set(params).size !== params.length) fail2(`path contains duplicate parameter names: "${path}"`);
7488
7677
  }
7489
7678
  function validateFunctionDefinition(definition) {
7490
7679
  validateName(definition.name);
7491
7680
  validateFunctionRoute(definition.method, definition.path);
7492
7681
  if (!FUNCTION_AUTHS.includes(definition.auth)) {
7493
- fail(`auth must be one of ${FUNCTION_AUTHS.join(", ")}`);
7682
+ fail2(`auth must be one of ${FUNCTION_AUTHS.join(", ")}`);
7494
7683
  }
7495
7684
  if (definition.wixIdentity !== null && !WIX_IDENTITIES.includes(definition.wixIdentity)) {
7496
- fail(`wixIdentity must be one of ${WIX_IDENTITIES.join(", ")}`);
7685
+ fail2(`wixIdentity must be one of ${WIX_IDENTITIES.join(", ")}`);
7497
7686
  }
7498
7687
  validateStringList("Wix permissions", definition.wixPermissions);
7499
7688
  validateStringList("capabilities", definition.capabilities);
7500
7689
  if (definition.auth === "public" && definition.wixIdentity !== null) {
7501
- fail("public functions cannot request a Wix identity");
7690
+ fail2("public functions cannot request a Wix identity");
7502
7691
  }
7503
7692
  if (definition.wixIdentity === "installation" && definition.wixPermissions.length === 0) {
7504
- fail("installation identity requires wixPermissions");
7693
+ fail2("installation identity requires wixPermissions");
7505
7694
  }
7506
7695
  if (definition.capabilities.includes("resource_admin") && (!(definition.auth === "user" || definition.internal) || definition.wixIdentity !== "installation" || !definition.wixPermissions.includes("wix.data.manage"))) {
7507
- fail("resource_admin requires auth:user or internal, installation identity, and wix.data.manage permission");
7696
+ fail2("resource_admin requires auth:user or internal, installation identity, and wix.data.manage permission");
7508
7697
  }
7509
- if (typeof definition.handler !== "function") fail("handler is required");
7510
- if (typeof definition.internal !== "boolean") fail("internal must be a boolean");
7698
+ if (typeof definition.handler !== "function") fail2("handler is required");
7699
+ if (typeof definition.internal !== "boolean") fail2("internal must be a boolean");
7511
7700
  if (!Array.isArray(definition.secrets) || !Array.isArray(definition.outboundHosts)) {
7512
- fail("secret and host declarations must be arrays");
7701
+ fail2("secret and host declarations must be arrays");
7513
7702
  }
7514
7703
  if (!definition.limits || typeof definition.limits !== "object" || !Object.keys(FUNCTION_LIMITS_MAX).every((key) => Object.prototype.hasOwnProperty.call(definition.limits, key))) {
7515
- fail("limits must include every limit field");
7704
+ fail2("limits must include every limit field");
7516
7705
  }
7517
7706
  validateLimits(definition.limits);
7518
7707
  validateNames("secret", definition.secrets);
@@ -7520,30 +7709,30 @@ function validateFunctionDefinition(definition) {
7520
7709
  }
7521
7710
  function validateLimits(input) {
7522
7711
  if (input !== void 0 && (typeof input !== "object" || input === null || Array.isArray(input))) {
7523
- fail("limits must be an object");
7712
+ fail2("limits must be an object");
7524
7713
  }
7525
7714
  const limits = { ...DEFAULT_FUNCTION_LIMITS, ...input };
7526
7715
  for (const key of Object.keys(FUNCTION_LIMITS_MAX)) {
7527
7716
  const value = limits[key];
7528
7717
  const minimum = key === "memoryMb" ? 8 : 1;
7529
7718
  if (!Number.isInteger(value) || value < minimum || value > FUNCTION_LIMITS_MAX[key]) {
7530
- fail(`limits.${key} must be an integer in [${minimum}, ${FUNCTION_LIMITS_MAX[key]}]`);
7719
+ fail2(`limits.${key} must be an integer in [${minimum}, ${FUNCTION_LIMITS_MAX[key]}]`);
7531
7720
  }
7532
7721
  }
7533
7722
  return limits;
7534
7723
  }
7535
7724
  function validateStringList(kind, values) {
7536
7725
  if (!Array.isArray(values) || values.some((value) => typeof value !== "string")) {
7537
- fail(`${kind} must be an array of strings`);
7726
+ fail2(`${kind} must be an array of strings`);
7538
7727
  }
7539
7728
  return [...values].sort();
7540
7729
  }
7541
7730
  function validateNames(kind, names) {
7542
7731
  const result = validateStringList(`${kind} names`, names);
7543
- if (new Set(result).size !== result.length) fail(`${kind} names must not contain duplicates`);
7732
+ if (new Set(result).size !== result.length) fail2(`${kind} names must not contain duplicates`);
7544
7733
  for (const name of result) {
7545
- if (kind === "secret" && !/^[A-Z][A-Z0-9_]{0,63}$/.test(name)) fail(`secret name must be uppercase: "${name}"`);
7546
- if (kind === "host" && !/^(?:\*\.)?[a-z0-9](?:[a-z0-9.-]*[a-z0-9])?(?::[0-9]{1,5})?$/.test(name)) fail(`outbound host is not a hostname: "${name}"`);
7734
+ if (kind === "secret" && !/^[A-Z][A-Z0-9_]{0,63}$/.test(name)) fail2(`secret name must be uppercase: "${name}"`);
7735
+ if (kind === "host" && !/^(?:\*\.)?[a-z0-9](?:[a-z0-9.-]*[a-z0-9])?(?::[0-9]{1,5})?$/.test(name)) fail2(`outbound host is not a hostname: "${name}"`);
7547
7736
  }
7548
7737
  return result.sort();
7549
7738
  }
@@ -7818,6 +8007,7 @@ function validateConfigShape(config) {
7818
8007
  if (config.distribution) {
7819
8008
  validateDistribution(config.distribution, "defineApp: distribution");
7820
8009
  }
8010
+ adoptedIdentity(config);
7821
8011
  validateLadderConfig(config);
7822
8012
  validateAuthGateScreen(config.auth);
7823
8013
  const appBundleConflict = appLogicBundleConflict(config);
@@ -8378,8 +8568,8 @@ function isComponentAllowedForFamily(key, family) {
8378
8568
  }
8379
8569
 
8380
8570
  // ../../core/ts/src/bindings.ts
8381
- var BINDING_SIGILS = ["service", "flag", "item", "t"];
8382
- var COLON_SIGILS = /* @__PURE__ */ new Set(["t"]);
8571
+ var BINDING_SIGILS = ["service", "flag", "item", "t", "app"];
8572
+ var COLON_SIGILS = /* @__PURE__ */ new Set(["t", "app"]);
8383
8573
  var BINDING_SIGIL_RE = new RegExp(
8384
8574
  `^\\$(?:${BINDING_SIGILS.filter((s) => !COLON_SIGILS.has(s)).join("|")})\\b|^\\$(?:${[...COLON_SIGILS].join("|")}):`
8385
8575
  );
@@ -14740,6 +14930,7 @@ function webViewEmbeddedAppFindings(screens) {
14740
14930
  return out;
14741
14931
  }
14742
14932
  export {
14933
+ ADOPTED_ANDROID_SIGNING,
14743
14934
  ALL_ORIENTATIONS,
14744
14935
  APP_ID_PATTERN,
14745
14936
  APP_SERVICES_BRIDGE_MARKERS,
@@ -14774,6 +14965,8 @@ export {
14774
14965
  LAUNCH_MANIFEST_SCHEMA,
14775
14966
  LAUNCH_NAMESPACE,
14776
14967
  LINK_MOUNT_PATHS,
14968
+ LOCALE_NATIVE_NAMES,
14969
+ LOCALE_SYSTEM,
14777
14970
  MAX_SIMULTANEOUS_BRIDGED_WEBVIEWS,
14778
14971
  OAUTH_IDP_ORIGINS,
14779
14972
  ORIGIN_PARAM_KEYS,
@@ -14823,10 +15016,14 @@ export {
14823
15016
  WORKER_SUBTREE_COMMON_ACTION_PATHS,
14824
15017
  WORKER_SUBTREE_SAFE_TYPE_RULES,
14825
15018
  activeMediaItem,
15019
+ adoptedApplinks,
15020
+ adoptedEntitlementKeys,
15021
+ adoptedIdentity,
14826
15022
  appLogicBundleConflict,
14827
15023
  appLogicBundleRef,
14828
15024
  appServicesAllowed,
14829
15025
  assertSiteShellConfig,
15026
+ availableLocales,
14830
15027
  baselineMediaCapabilities,
14831
15028
  bucket,
14832
15029
  buildHimiPreviewUrl,
@@ -14879,12 +15076,15 @@ export {
14879
15076
  isWidgetFamilySurface,
14880
15077
  isWixAbsoluteCachePrefix,
14881
15078
  layoutDirection,
15079
+ localeChoiceSource,
14882
15080
  mergeIdiomOverlay,
14883
15081
  mergeSiteMenu,
14884
15082
  normalizeServeApp,
14885
15083
  normalizeSiteMenu,
14886
15084
  normalizeSiteOrigin,
15085
+ parseAdoptedDomain,
14887
15086
  parseAppActionId,
15087
+ parseLocaleSetTag,
14888
15088
  parseNumeric,
14889
15089
  physicalEntityName,
14890
15090
  primarySubtag,
@@ -6950,8 +6950,8 @@ var WIDGET_VOCABULARY = {
6950
6950
  var WIDGET_COMPONENTS = new Set(Object.keys(WIDGET_VOCABULARY));
6951
6951
 
6952
6952
  // ../../core/ts/src/bindings.ts
6953
- var BINDING_SIGILS = ["service", "flag", "item", "t"];
6954
- var COLON_SIGILS = /* @__PURE__ */ new Set(["t"]);
6953
+ var BINDING_SIGILS = ["service", "flag", "item", "t", "app"];
6954
+ var COLON_SIGILS = /* @__PURE__ */ new Set(["t", "app"]);
6955
6955
  var BINDING_SIGIL_RE = new RegExp(
6956
6956
  `^\\$(?:${BINDING_SIGILS.filter((s) => !COLON_SIGILS.has(s)).join("|")})\\b|^\\$(?:${[...COLON_SIGILS].join("|")}):`
6957
6957
  );
@@ -9353,6 +9353,10 @@ function isFunctionsOnlyConfig(config) {
9353
9353
  function uiConfig(config) {
9354
9354
  return config ?? {};
9355
9355
  }
9356
+ var META_SITE_ID = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
9357
+ function isMetaSiteId(v) {
9358
+ return typeof v === "string" && META_SITE_ID.test(v);
9359
+ }
9356
9360
  function deriveAppMeta(name, m, platforms = {}, provisioning = {}) {
9357
9361
  const config = m.config;
9358
9362
  return {
@@ -9367,6 +9371,7 @@ function deriveAppMeta(name, m, platforms = {}, provisioning = {}) {
9367
9371
  push: servedPush(config.push),
9368
9372
  ...config.push?.screens ? { pushScreens: config.push.screens } : {},
9369
9373
  ...provisioning.installedVerticals ? { installedVerticals: provisioning.installedVerticals } : {},
9374
+ ...isMetaSiteId(provisioning.siteId) ? { provisionedMsid: provisioning.siteId } : {},
9370
9375
  control: config.control,
9371
9376
  appLinkHosts: config.appLinkHosts,
9372
9377
  permissionCopy: config.permissionCopy,
@@ -9486,6 +9491,7 @@ export {
9486
9491
  iconButton,
9487
9492
  image,
9488
9493
  isFunctionsOnlyConfig,
9494
+ isMetaSiteId,
9489
9495
  label,
9490
9496
  labeledContent,
9491
9497
  lazyList,