@wix/himalaya-cli 0.1585.0 → 0.1587.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/sdk/app-info/src/index.d.ts +21 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/sdk/ui/src/index.d.ts +22 -1
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/ts/src/define-app.d.ts +47 -1
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/ts/src/index.d.ts +1 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/ts/src/locale.d.ts +39 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/ts/src/store-adopt.d.ts +73 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/app-info.mjs +17 -1
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/core.mjs +250 -21
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/iap-checkout.mjs +17 -1
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/screens.mjs +17 -1
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/ui.mjs +4 -0
- package/dist/cli.mjs +2164 -1369
- package/dist/preview-assets.generated.bin +0 -0
- package/guides/app-config.md +1 -1
- package/guides/importable-sdks.md +1 -1
- package/guides/sdk-reference.json +9 -3
- package/guides/web-page-sdk-reference.md +1 -1
- package/package.json +2 -2
|
@@ -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
|
|
7663
|
+
function fail2(message) {
|
|
7475
7664
|
throw new Error(`defineFunction: ${message}`);
|
|
7476
7665
|
}
|
|
7477
7666
|
function validateName(name) {
|
|
7478
|
-
if (typeof name !== "string")
|
|
7479
|
-
if (!/^[a-z][a-z0-9]*(?:[-_.][a-z0-9]+)*$/.test(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))
|
|
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
|
-
|
|
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)
|
|
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
|
-
|
|
7682
|
+
fail2(`auth must be one of ${FUNCTION_AUTHS.join(", ")}`);
|
|
7494
7683
|
}
|
|
7495
7684
|
if (definition.wixIdentity !== null && !WIX_IDENTITIES.includes(definition.wixIdentity)) {
|
|
7496
|
-
|
|
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
|
-
|
|
7690
|
+
fail2("public functions cannot request a Wix identity");
|
|
7502
7691
|
}
|
|
7503
7692
|
if (definition.wixIdentity === "installation" && definition.wixPermissions.length === 0) {
|
|
7504
|
-
|
|
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
|
-
|
|
7696
|
+
fail2("resource_admin requires auth:user or internal, installation identity, and wix.data.manage permission");
|
|
7508
7697
|
}
|
|
7509
|
-
if (typeof definition.handler !== "function")
|
|
7510
|
-
if (typeof definition.internal !== "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
|
-
|
|
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
|
-
|
|
7704
|
+
fail2("limits must include every limit field");
|
|
7516
7705
|
}
|
|
7517
7706
|
validateLimits(definition.limits);
|
|
7518
7707
|
validateNames("secret", definition.secrets);
|
|
@@ -7520,35 +7709,61 @@ 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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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)
|
|
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))
|
|
7546
|
-
if (kind === "host" && !/^(?:\*\.)?[a-z0-9](?:[a-z0-9.-]*[a-z0-9])?(?::[0-9]{1,5})?$/.test(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
|
}
|
|
7550
7739
|
|
|
7551
7740
|
// ../../core/ts/src/define-app.ts
|
|
7741
|
+
function normalizeInternalEmailDomain(domain) {
|
|
7742
|
+
return domain.trim().toLowerCase().replace(/^@/, "");
|
|
7743
|
+
}
|
|
7744
|
+
function isInternalEmail(email, rule) {
|
|
7745
|
+
const domains = (rule?.emailDomains ?? []).map(normalizeInternalEmailDomain).filter(Boolean);
|
|
7746
|
+
if (!email || domains.length === 0) return false;
|
|
7747
|
+
const e = email.trim().toLowerCase();
|
|
7748
|
+
const at = e.lastIndexOf("@");
|
|
7749
|
+
if (at <= 0 || at === e.length - 1) return false;
|
|
7750
|
+
return domains.includes(e.slice(at + 1));
|
|
7751
|
+
}
|
|
7752
|
+
var INTERNAL_DOMAIN_RE = /^[a-z0-9](?:[a-z0-9-]*[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]*[a-z0-9])?)+$/;
|
|
7753
|
+
function validateAppInfoConfig(appInfo) {
|
|
7754
|
+
const domains = appInfo?.internal?.emailDomains;
|
|
7755
|
+
if (domains === void 0) return;
|
|
7756
|
+
if (!Array.isArray(domains)) {
|
|
7757
|
+
throw new Error('defineApp: appInfo.internal.emailDomains must be an array of domains, e.g. ["example.com"].');
|
|
7758
|
+
}
|
|
7759
|
+
for (const d of domains) {
|
|
7760
|
+
if (typeof d !== "string" || !INTERNAL_DOMAIN_RE.test(normalizeInternalEmailDomain(d))) {
|
|
7761
|
+
throw new Error(
|
|
7762
|
+
`defineApp: appInfo.internal.emailDomains entry ${JSON.stringify(d)} is not a domain \u2014 list bare domains like "example.com" (no "*", no address, no scheme).`
|
|
7763
|
+
);
|
|
7764
|
+
}
|
|
7765
|
+
}
|
|
7766
|
+
}
|
|
7552
7767
|
function isWixAbsoluteCachePrefix(prefix) {
|
|
7553
7768
|
const m = /^https:\/\/([a-z0-9.-]+)(\/.*)$/i.exec(prefix);
|
|
7554
7769
|
if (!m) return false;
|
|
@@ -7818,8 +8033,10 @@ function validateConfigShape(config) {
|
|
|
7818
8033
|
if (config.distribution) {
|
|
7819
8034
|
validateDistribution(config.distribution, "defineApp: distribution");
|
|
7820
8035
|
}
|
|
8036
|
+
adoptedIdentity(config);
|
|
7821
8037
|
validateLadderConfig(config);
|
|
7822
8038
|
validateAuthGateScreen(config.auth);
|
|
8039
|
+
validateAppInfoConfig(config.appInfo);
|
|
7823
8040
|
const appBundleConflict = appLogicBundleConflict(config);
|
|
7824
8041
|
if (appBundleConflict) throw new Error(`defineApp: ${appBundleConflict}`);
|
|
7825
8042
|
if (config.tier5Cap) {
|
|
@@ -14740,6 +14957,7 @@ function webViewEmbeddedAppFindings(screens) {
|
|
|
14740
14957
|
return out;
|
|
14741
14958
|
}
|
|
14742
14959
|
export {
|
|
14960
|
+
ADOPTED_ANDROID_SIGNING,
|
|
14743
14961
|
ALL_ORIENTATIONS,
|
|
14744
14962
|
APP_ID_PATTERN,
|
|
14745
14963
|
APP_SERVICES_BRIDGE_MARKERS,
|
|
@@ -14774,6 +14992,8 @@ export {
|
|
|
14774
14992
|
LAUNCH_MANIFEST_SCHEMA,
|
|
14775
14993
|
LAUNCH_NAMESPACE,
|
|
14776
14994
|
LINK_MOUNT_PATHS,
|
|
14995
|
+
LOCALE_NATIVE_NAMES,
|
|
14996
|
+
LOCALE_SYSTEM,
|
|
14777
14997
|
MAX_SIMULTANEOUS_BRIDGED_WEBVIEWS,
|
|
14778
14998
|
OAUTH_IDP_ORIGINS,
|
|
14779
14999
|
ORIGIN_PARAM_KEYS,
|
|
@@ -14823,10 +15043,14 @@ export {
|
|
|
14823
15043
|
WORKER_SUBTREE_COMMON_ACTION_PATHS,
|
|
14824
15044
|
WORKER_SUBTREE_SAFE_TYPE_RULES,
|
|
14825
15045
|
activeMediaItem,
|
|
15046
|
+
adoptedApplinks,
|
|
15047
|
+
adoptedEntitlementKeys,
|
|
15048
|
+
adoptedIdentity,
|
|
14826
15049
|
appLogicBundleConflict,
|
|
14827
15050
|
appLogicBundleRef,
|
|
14828
15051
|
appServicesAllowed,
|
|
14829
15052
|
assertSiteShellConfig,
|
|
15053
|
+
availableLocales,
|
|
14830
15054
|
baselineMediaCapabilities,
|
|
14831
15055
|
bucket,
|
|
14832
15056
|
buildHimiPreviewUrl,
|
|
@@ -14867,6 +15091,7 @@ export {
|
|
|
14867
15091
|
impliedKeyboard,
|
|
14868
15092
|
isComponentAllowed,
|
|
14869
15093
|
isComponentAllowedForFamily,
|
|
15094
|
+
isInternalEmail,
|
|
14870
15095
|
isPlayerRequirements,
|
|
14871
15096
|
isRTL,
|
|
14872
15097
|
isReservedAppActionId,
|
|
@@ -14879,12 +15104,16 @@ export {
|
|
|
14879
15104
|
isWidgetFamilySurface,
|
|
14880
15105
|
isWixAbsoluteCachePrefix,
|
|
14881
15106
|
layoutDirection,
|
|
15107
|
+
localeChoiceSource,
|
|
14882
15108
|
mergeIdiomOverlay,
|
|
14883
15109
|
mergeSiteMenu,
|
|
15110
|
+
normalizeInternalEmailDomain,
|
|
14884
15111
|
normalizeServeApp,
|
|
14885
15112
|
normalizeSiteMenu,
|
|
14886
15113
|
normalizeSiteOrigin,
|
|
15114
|
+
parseAdoptedDomain,
|
|
14887
15115
|
parseAppActionId,
|
|
15116
|
+
parseLocaleSetTag,
|
|
14888
15117
|
parseNumeric,
|
|
14889
15118
|
physicalEntityName,
|
|
14890
15119
|
primarySubtag,
|
|
@@ -18,6 +18,14 @@ var PLATFORMS = ["ios", "android", "macos", "web", "react-native"];
|
|
|
18
18
|
function str(v) {
|
|
19
19
|
return typeof v === "string" ? v.trim() : "";
|
|
20
20
|
}
|
|
21
|
+
function num(v) {
|
|
22
|
+
const n = typeof v === "number" ? v : typeof v === "string" && v.trim() !== "" ? Number(v) : NaN;
|
|
23
|
+
return Number.isFinite(n) && n > 0 ? n : 0;
|
|
24
|
+
}
|
|
25
|
+
function screenOf(v) {
|
|
26
|
+
const s = v && typeof v === "object" ? v : {};
|
|
27
|
+
return { width: num(s.width), height: num(s.height), scale: num(s.scale) };
|
|
28
|
+
}
|
|
21
29
|
async function get() {
|
|
22
30
|
const r = await dispatch("capability.app_info.get");
|
|
23
31
|
const platform = str(r?.platform);
|
|
@@ -36,7 +44,15 @@ async function get() {
|
|
|
36
44
|
serveBaseUrl: serveBaseUrl || null,
|
|
37
45
|
platform: PLATFORMS.includes(platform) ? platform : "unknown",
|
|
38
46
|
memberSiteBound: r?.memberSiteBound === true,
|
|
39
|
-
oneAppInviteAvailable: r?.oneAppInviteAvailable === true
|
|
47
|
+
oneAppInviteAvailable: r?.oneAppInviteAvailable === true,
|
|
48
|
+
deviceModel: str(r?.deviceModel),
|
|
49
|
+
deviceName: str(r?.deviceName),
|
|
50
|
+
osVersion: str(r?.osVersion),
|
|
51
|
+
locale: str(r?.locale),
|
|
52
|
+
screen: screenOf(r?.screen),
|
|
53
|
+
// Exactly `true` only: a string or a number is not the host's answer, and the safe default
|
|
54
|
+
// for a flag that unlocks debug tools is off.
|
|
55
|
+
isInternal: r?.isInternal === true
|
|
40
56
|
};
|
|
41
57
|
}
|
|
42
58
|
|
|
@@ -800,6 +800,14 @@ var PLATFORMS = ["ios", "android", "macos", "web", "react-native"];
|
|
|
800
800
|
function str(v) {
|
|
801
801
|
return typeof v === "string" ? v.trim() : "";
|
|
802
802
|
}
|
|
803
|
+
function num(v) {
|
|
804
|
+
const n = typeof v === "number" ? v : typeof v === "string" && v.trim() !== "" ? Number(v) : NaN;
|
|
805
|
+
return Number.isFinite(n) && n > 0 ? n : 0;
|
|
806
|
+
}
|
|
807
|
+
function screenOf(v) {
|
|
808
|
+
const s2 = v && typeof v === "object" ? v : {};
|
|
809
|
+
return { width: num(s2.width), height: num(s2.height), scale: num(s2.scale) };
|
|
810
|
+
}
|
|
803
811
|
async function get() {
|
|
804
812
|
const r = await dispatch("capability.app_info.get");
|
|
805
813
|
const platform = str(r?.platform);
|
|
@@ -818,7 +826,15 @@ async function get() {
|
|
|
818
826
|
serveBaseUrl: serveBaseUrl || null,
|
|
819
827
|
platform: PLATFORMS.includes(platform) ? platform : "unknown",
|
|
820
828
|
memberSiteBound: r?.memberSiteBound === true,
|
|
821
|
-
oneAppInviteAvailable: r?.oneAppInviteAvailable === true
|
|
829
|
+
oneAppInviteAvailable: r?.oneAppInviteAvailable === true,
|
|
830
|
+
deviceModel: str(r?.deviceModel),
|
|
831
|
+
deviceName: str(r?.deviceName),
|
|
832
|
+
osVersion: str(r?.osVersion),
|
|
833
|
+
locale: str(r?.locale),
|
|
834
|
+
screen: screenOf(r?.screen),
|
|
835
|
+
// Exactly `true` only: a string or a number is not the host's answer, and the safe default
|
|
836
|
+
// for a flag that unlocks debug tools is off.
|
|
837
|
+
isInternal: r?.isInternal === true
|
|
822
838
|
};
|
|
823
839
|
}
|
|
824
840
|
|
|
@@ -34,6 +34,10 @@ async function snackbar(options) {
|
|
|
34
34
|
if (typeof options.durationMs === "number" && Number.isFinite(options.durationMs)) {
|
|
35
35
|
params.durationMs = Math.min(2147483647, Math.max(0, Math.trunc(options.durationMs)));
|
|
36
36
|
}
|
|
37
|
+
if (options.action) {
|
|
38
|
+
const { label, actionId, args } = options.action;
|
|
39
|
+
params.action = JSON.stringify(args === void 0 ? { label, actionId } : { label, actionId, args });
|
|
40
|
+
}
|
|
37
41
|
await dispatch("capability.ui.snackbar", params);
|
|
38
42
|
}
|
|
39
43
|
var version = 1;
|