@wix/himalaya-cli 0.2049.0 → 0.2050.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/cli.mjs CHANGED
@@ -46615,7 +46615,6 @@ function resolveIdiom(tokens2, ctx = {}) {
46615
46615
  var IDIOM_CONTEXTS, UNSAFE_KEYS;
46616
46616
  var init_idiom = __esm({
46617
46617
  "../../core/ts/src/idiom.ts"() {
46618
- "use strict";
46619
46618
  init_define_HHP_CATALOG();
46620
46619
  IDIOM_CONTEXTS = {
46621
46620
  ios: { native: ["ios"] },
@@ -48385,6 +48384,7 @@ function shouldRevealError(args) {
48385
48384
  var EMAIL_RE, URL_HOST_RE, INTEGER_RE, NUMBER_RE, AUTHORED_PATTERN_LIMIT, authoredPatterns;
48386
48385
  var init_validation = __esm({
48387
48386
  "../../core/ts/src/validation.ts"() {
48387
+ "use strict";
48388
48388
  init_define_HHP_CATALOG();
48389
48389
  EMAIL_RE = /^[A-Za-z0-9._%+-]+@[A-Za-z0-9-]+(\.[A-Za-z0-9-]+)*\.[A-Za-z]{2,}$/;
48390
48390
  URL_HOST_RE = /^[A-Za-z0-9-]+(\.[A-Za-z0-9-]+)*(:[0-9]+)?$/;
@@ -217497,6 +217497,58 @@ function provisionAppName(dir, displayName3, dryRun = false) {
217497
217497
  if (!dryRun) writeFileSync48(configPath, correction.fixed, "utf8");
217498
217498
  return { status: "set", from: correction.current, to: displayName3.trim() };
217499
217499
  }
217500
+ function aboutBlock(paragraphs) {
217501
+ return {
217502
+ id: ABOUT_ID,
217503
+ body: { package: "himalaya", type: "VStack", props: { spacing: 16, alignment: "leading", children: paragraphs.map((text32) => ({ id: "", body: { package: "himalaya", type: "Text", props: { text: text32, style: "body", color: "textSecondary" } } })) } },
217504
+ modifiers: { fillMaxWidth: true, padding: { top: 20 } }
217505
+ };
217506
+ }
217507
+ function appInfoChildren(descriptor) {
217508
+ const children2 = obj21(obj21(obj21(descriptor?.payload).body).props).children;
217509
+ return Array.isArray(children2) && children2.some((c2) => obj21(c2).id === LINKS_ID) ? children2 : void 0;
217510
+ }
217511
+ function aboutTexts(children2) {
217512
+ const block = children2.find((c2) => obj21(c2).id === ABOUT_ID);
217513
+ if (!block) return void 0;
217514
+ const texts = obj21(obj21(obj21(block).body).props).children;
217515
+ return Array.isArray(texts) ? texts.map((t2) => String(obj21(obj21(obj21(t2).body).props).text ?? "")) : [];
217516
+ }
217517
+ function templateAboutTexts() {
217518
+ try {
217519
+ const children2 = appInfoChildren(readEntry(templateSourceDir("branded-lite"), APP_INFO_SCREEN));
217520
+ return children2 ? aboutTexts(children2) : void 0;
217521
+ } catch {
217522
+ return void 0;
217523
+ }
217524
+ }
217525
+ function provisionAppInfoAbout(dir, about, dryRun = false) {
217526
+ if (about === void 0) return { status: "unverified", reason: "the collection did not read the site description; the About screen is left as it is" };
217527
+ const descriptor = readEntry(dir, APP_INFO_SCREEN);
217528
+ const children2 = appInfoChildren(descriptor);
217529
+ if (!descriptor || !children2) {
217530
+ return { status: "absent", reason: `the scaffold has no ${APP_INFO_SCREEN} in the template's shape; its About text is left as it is` };
217531
+ }
217532
+ const props2 = obj21(obj21(obj21(descriptor.payload).body).props);
217533
+ const paragraphs = about.split(/\n\s*\n/).map((p2) => p2.trim()).filter(Boolean);
217534
+ const current = aboutTexts(children2);
217535
+ const same7 = (a3, b3) => JSON.stringify(a3) === JSON.stringify(b3);
217536
+ if (current && !same7(current, paragraphs) && !same7(current, templateAboutTexts() ?? [])) {
217537
+ return { status: "kept", reason: "the About text is not the template's demo text, so it is someone's own copy and is left as written" };
217538
+ }
217539
+ const next = children2.filter((c2) => obj21(c2).id !== ABOUT_ID);
217540
+ const at2 = next.findIndex((c2) => obj21(c2).id === LINKS_ID);
217541
+ const links = obj21(next[at2]);
217542
+ const modifiers = obj21(links.modifiers);
217543
+ next[at2] = { ...links, modifiers: { ...modifiers, padding: { ...obj21(modifiers.padding), top: paragraphs.length ? 24 : 20 } } };
217544
+ if (paragraphs.length) next.splice(at2, 0, aboutBlock(paragraphs));
217545
+ if (JSON.stringify(next) === JSON.stringify(children2)) return { status: "unchanged" };
217546
+ if (!dryRun) {
217547
+ props2.children = next;
217548
+ replaceScreen(dir, APP_INFO_SCREEN, screenEntry(APP_INFO_SCREEN, descriptor));
217549
+ }
217550
+ return paragraphs.length ? { status: "set" } : { status: "removed", reason: "the site has no description; the template's demo text is taken out, and no text is invented" };
217551
+ }
217500
217552
  function readEntry(dir, screenId) {
217501
217553
  const { dev, config } = readAppEntrySources(dir);
217502
217554
  const span = screenSpans(dev, config).get(screenId);
@@ -217593,6 +217645,7 @@ function provisionScreens(dir, facts, dryRun = false) {
217593
217645
  }
217594
217646
  out2.appName = provisionAppName(dir, facts.displayName, dryRun);
217595
217647
  out2.renamed = provisionScreenNames(dir, facts.displayName, dryRun);
217648
+ out2.about = provisionAppInfoAbout(dir, facts.about, dryRun);
217596
217649
  out2.tabBar = provisionTabBar(dir, dryRun);
217597
217650
  out2.chat = provisionChatTarget(dir, facts.memberChat, dryRun);
217598
217651
  const home2 = readEntry(dir, TEMPLATE_HOME_SCREEN);
@@ -217652,6 +217705,8 @@ async function runOneAppProvision(args, io2) {
217652
217705
  ...typeof context.paymentCurrency === "string" && /^[A-Z]{3}$/.test(context.paymentCurrency) ? { paymentCurrency: context.paymentCurrency } : {},
217653
217706
  ...typeof context.timeZone === "string" && context.timeZone ? { timeZone: context.timeZone } : {},
217654
217707
  ...typeof context.displayName === "string" && context.displayName.trim() ? { displayName: context.displayName } : {},
217708
+ // "" is the collection's "the site has none"; an absent field is "not read".
217709
+ ...typeof context.about === "string" ? { about: context.about } : {},
217655
217710
  // Recorded by the collection from the source's own Inbox setting: only an explicit true counts.
217656
217711
  ...manifest2.memberChat === true ? { memberChat: true } : {},
217657
217712
  // The source site the migration collected from: what the same-site binding is written from.
@@ -217669,12 +217724,13 @@ async function runOneAppProvision(args, io2) {
217669
217724
  return report3(io2, false, { code: "content_invalid", error: error instanceof Error ? error.message : String(error) });
217670
217725
  }
217671
217726
  }
217672
- var obj21, PROVISION_USAGE, PROVISIONED_PARAMS, propName9, propOf, GUID2, BUSINESS_CHAT_SCREEN2, INBOX_DOOR_SCREENS, NAME_SLOTS, spansByText, spanParses;
217727
+ var obj21, PROVISION_USAGE, PROVISIONED_PARAMS, propName9, propOf, GUID2, BUSINESS_CHAT_SCREEN2, INBOX_DOOR_SCREENS, NAME_SLOTS, APP_INFO_SCREEN, ABOUT_ID, LINKS_ID, spansByText, spanParses;
217673
217728
  var init_provision = __esm({
217674
217729
  "src/one-app/provision.ts"() {
217675
217730
  init_define_HHP_CATALOG();
217676
217731
  init_template_adopt();
217677
217732
  init_content_manifest();
217733
+ init_scaffold();
217678
217734
  init_template_trim();
217679
217735
  init_coverage();
217680
217736
  init_validate_topbar();
@@ -217704,6 +217760,9 @@ var init_provision = __esm({
217704
217760
  BUSINESS_CHAT_SCREEN2 = "himi_business_chat";
217705
217761
  INBOX_DOOR_SCREENS = ["himi_account", "himi_chat_thread"];
217706
217762
  NAME_SLOTS = /* @__PURE__ */ new Set([...DISPLAY_KEYS, "title", "text", "displayName"]);
217763
+ APP_INFO_SCREEN = "himi_app_info";
217764
+ ABOUT_ID = "himi_app_info.about";
217765
+ LINKS_ID = "himi_app_info.links";
217707
217766
  spansByText = /* @__PURE__ */ new Map();
217708
217767
  spanParses = 0;
217709
217768
  }
@@ -308916,6 +308975,202 @@ var init_business_address = __esm({
308916
308975
  }
308917
308976
  });
308918
308977
 
308978
+ // src/site-analyze/derive.ts
308979
+ function aboutFromCrawl(about, crawlComplete) {
308980
+ const text32 = bounded(oneLine2(about), ABOUT_MAX_LENGTH);
308981
+ if (!text32 && !crawlComplete) return void 0;
308982
+ return text32;
308983
+ }
308984
+ function deriveAppName(ctx, override) {
308985
+ return clean3(override) || clean3(ctx.identity.businessName) || clean3(ctx.identity.siteDisplayName) || "My Business";
308986
+ }
308987
+ function deriveIconSource(ctx) {
308988
+ return clean3(ctx.brand.logo) || null;
308989
+ }
308990
+ function deriveVerticals(ctx) {
308991
+ const requested = new Set(ctx.content.installedVerticals);
308992
+ return KNOWN_VERTICALS.filter((v2) => requested.has(v2));
308993
+ }
308994
+ function unusableIdentifier(value2, max) {
308995
+ if (typeof value2 !== "string" || value2 === "") return "missing";
308996
+ if (value2 !== value2.trim()) {
308997
+ return "is surrounded by whitespace, which the manifest parser strips \u2014 the app would query a different id";
308998
+ }
308999
+ if (HAS_CONTROL_CHAR.test(value2)) {
309000
+ return "contains control characters, and removing them would name a different collection";
309001
+ }
309002
+ if (value2.length > max) return `is longer than ${max} characters`;
309003
+ return null;
309004
+ }
309005
+ function deriveAdoptedCmsCollections(cms) {
309006
+ const collections2 = [];
309007
+ const dropped = [];
309008
+ const seen = /* @__PURE__ */ new Set();
309009
+ for (const collection of cms) {
309010
+ const label4 = typeof collection.id === "string" ? collection.id.trim().slice(0, 60) : "";
309011
+ if (!label4) continue;
309012
+ if (collection.ownerAppId) {
309013
+ dropped.push({ id: label4, reason: "owned by a Wix app \u2014 its own vertical covers it" });
309014
+ continue;
309015
+ }
309016
+ const readRole = collection.readRole;
309017
+ if (readRole !== "ANYONE") {
309018
+ dropped.push({
309019
+ id: label4,
309020
+ reason: readRole === "SITE_MEMBER" || readRole === "SITE_MEMBER_AUTHOR" ? `read permission "${readRole}" \u2014 member-only rows would be cached unencrypted on the device and served to a later visitor` : `read permission ${readRole ? `"${readRole}"` : "unknown"} \u2014 a shipped app can only read ANYONE`
309021
+ });
309022
+ continue;
309023
+ }
309024
+ const idProblem = unusableIdentifier(collection.id, ID_MAX);
309025
+ if (idProblem) {
309026
+ dropped.push({ id: shown2(collection.id), reason: `id ${idProblem}` });
309027
+ continue;
309028
+ }
309029
+ const id = collection.id;
309030
+ if (seen.has(id)) {
309031
+ dropped.push({ id: label4, reason: "duplicate id" });
309032
+ continue;
309033
+ }
309034
+ const fields2 = collection.fields.flatMap((field) => {
309035
+ if (field.systemField || field.encrypted) return [];
309036
+ if (unusableIdentifier(field.key, ID_MAX)) return [];
309037
+ const key4 = field.key;
309038
+ return [{
309039
+ key: key4,
309040
+ // `key.slice(NAME_MAX)`, not bare `key`: a field key may be up to `ID_MAX`, and the
309041
+ // manifest caps a display NAME at `NAME_MAX`. Falling back to the whole key would
309042
+ // emit a name the shell's parser refuses, which fails open to the shell's own
309043
+ // collections — the silent restoration this whole function exists to prevent.
309044
+ displayName: plain4(field.displayName, NAME_MAX) || key4.slice(0, NAME_MAX),
309045
+ type: (plain4(field.type, TYPE_MAX) || "TEXT").toUpperCase()
309046
+ }];
309047
+ });
309048
+ const requested = collection.displayField;
309049
+ const displayField = fields2.some((field) => field.key === requested) ? requested : fields2[0]?.key;
309050
+ if (!displayField) {
309051
+ dropped.push({ id: label4, reason: "no readable field to show as a row title" });
309052
+ continue;
309053
+ }
309054
+ seen.add(id);
309055
+ collections2.push({
309056
+ id,
309057
+ displayName: plain4(collection.displayName, NAME_MAX) || id.slice(0, NAME_MAX),
309058
+ displayField,
309059
+ readRole,
309060
+ fields: fields2
309061
+ });
309062
+ }
309063
+ return { collections: collections2, dropped };
309064
+ }
309065
+ function deriveTailoring(ctx, overrides = {}, revision = "site-derived") {
309066
+ const appName2 = deriveAppName(ctx, overrides.appName);
309067
+ const supportUrl = clean3(overrides.supportUrl) || clean3(ctx.url.primary);
309068
+ const privacyUrl = clean3(overrides.privacyUrl);
309069
+ const termsUrl = clean3(overrides.termsUrl);
309070
+ const missing4 = [];
309071
+ if (!supportUrl) missing4.push("supportUrl");
309072
+ if (!privacyUrl) missing4.push("privacyUrl");
309073
+ if (!termsUrl) missing4.push("termsUrl");
309074
+ const provisioning = {
309075
+ version: 1,
309076
+ siteId: ctx.siteId,
309077
+ revision,
309078
+ installedVerticals: deriveVerticals(ctx),
309079
+ // PRESENT AND EMPTY, never absent. `WixSiteContext` carries no CMS chapter, so this base
309080
+ // overlay knows of no readable collection — and an ABSENT key is not that statement, it
309081
+ // is "inherit whatever the shell has", which pointed a customer's app at the shell's demo
309082
+ // collection (#2341). `runSiteAnalyze` replaces this with the site's own, also possibly
309083
+ // empty; either way the key exists and the shell's list never survives the merge.
309084
+ cmsCollections: [],
309085
+ identity: {
309086
+ appName: appName2,
309087
+ businessName: clean3(ctx.identity.businessName) || appName2,
309088
+ tagline: clean3(overrides.tagline) || clean3(ctx.identity.description),
309089
+ // Present even when empty: an absent key would inherit the shell's About text. `analyzeSite`
309090
+ // fills it from the crawl's About section (`aboutFromCrawl`), or drops the key when the crawl
309091
+ // could not tell. The description already shows as the tagline.
309092
+ about: "",
309093
+ // "" means UNKNOWN here, with `missing` above as the signal — the published overlay's
309094
+ // documented shape. Keeping an unknown url out of a MERGE is `apply.ts`'s job, at the
309095
+ // seam where an empty string would otherwise beat the shell's committed value.
309096
+ supportUrl,
309097
+ privacyUrl,
309098
+ termsUrl
309099
+ }
309100
+ };
309101
+ return { appName: appName2, iconSource: deriveIconSource(ctx), provisioning, missing: missing4 };
309102
+ }
309103
+ function bounded(s5, max) {
309104
+ if (s5.length <= max) return s5;
309105
+ const cut2 = s5.slice(0, max - 1).replace(/[\uD800-\uDBFF]$/, "");
309106
+ const space = cut2.lastIndexOf(" ");
309107
+ return `${(space > max * 0.6 ? cut2.slice(0, space) : cut2).trimEnd()}\u2026`;
309108
+ }
309109
+ function deriveStaticFaq(faq) {
309110
+ if (!Array.isArray(faq)) return [];
309111
+ const out2 = [];
309112
+ const seen = /* @__PURE__ */ new Set();
309113
+ for (const raw of faq) {
309114
+ if (out2.length >= STATIC_FAQ_LIMITS.pairs) break;
309115
+ const pair = raw && typeof raw === "object" ? raw : {};
309116
+ const q4 = bounded(oneLine2(pair.q), STATIC_FAQ_LIMITS.question);
309117
+ const a3 = bounded(oneLine2(pair.a), STATIC_FAQ_LIMITS.answer);
309118
+ if (!q4 || !a3 || seen.has(q4.toLowerCase())) continue;
309119
+ seen.add(q4.toLowerCase());
309120
+ out2.push({ q: q4, a: a3 });
309121
+ }
309122
+ return out2;
309123
+ }
309124
+ function deriveStaticGalleries(pages2) {
309125
+ if (!Array.isArray(pages2)) return [];
309126
+ const galleries = [];
309127
+ const seenPhotoSets = /* @__PURE__ */ new Set();
309128
+ let totalPhotos = 0;
309129
+ for (const raw of pages2) {
309130
+ if (galleries.length >= STATIC_GALLERY_LIMITS.galleries || totalPhotos >= STATIC_GALLERY_LIMITS.totalPhotos) break;
309131
+ const page = raw && typeof raw === "object" ? raw : {};
309132
+ if (!Array.isArray(page.galleryImageUrls)) continue;
309133
+ const photos = [];
309134
+ for (const image of page.galleryImageUrls) {
309135
+ if (photos.length >= STATIC_GALLERY_LIMITS.photos || totalPhotos + photos.length >= STATIC_GALLERY_LIMITS.totalPhotos) break;
309136
+ if (typeof image !== "string") continue;
309137
+ const match = /^https:\/\/static\.wixstatic\.com\/media\/([A-Za-z0-9_~.-]+)(?:\/.*)?$/.exec(image);
309138
+ if (!match) continue;
309139
+ const url = `https://static.wixstatic.com/media/${match[1]}`;
309140
+ if (!photos.includes(url)) photos.push(url);
309141
+ }
309142
+ if (!photos.length) continue;
309143
+ const photoSet = photos.join("\n");
309144
+ if (seenPhotoSets.has(photoSet)) continue;
309145
+ seenPhotoSets.add(photoSet);
309146
+ totalPhotos += photos.length;
309147
+ const heading = Array.isArray(page.headings) ? page.headings.find((h2) => typeof h2 === "string" && !!h2.trim()) : void 0;
309148
+ const pageTitle = typeof page.title === "string" ? page.title.split(/\s+[|–—]\s+/)[0] : "";
309149
+ const title = bounded(oneLine2(page.role === "gallery" ? pageTitle || heading || "Gallery" : "Gallery"), STATIC_GALLERY_LIMITS.title);
309150
+ galleries.push({ id: `site-gallery-${galleries.length + 1}`, title, photos });
309151
+ }
309152
+ return galleries;
309153
+ }
309154
+ var clean3, ABOUT_MAX_LENGTH, ID_MAX, NAME_MAX, TYPE_MAX, CONTROL_CHARS2, HAS_CONTROL_CHAR, plain4, shown2, STATIC_FAQ_LIMITS, oneLine2, STATIC_GALLERY_LIMITS;
309155
+ var init_derive = __esm({
309156
+ "src/site-analyze/derive.ts"() {
309157
+ init_define_HHP_CATALOG();
309158
+ init_types2();
309159
+ clean3 = (s5) => (s5 ?? "").trim();
309160
+ ABOUT_MAX_LENGTH = 1e3;
309161
+ ID_MAX = 256;
309162
+ NAME_MAX = 120;
309163
+ TYPE_MAX = 80;
309164
+ CONTROL_CHARS2 = /[\u0000-\u001F\u007F]/g;
309165
+ HAS_CONTROL_CHAR = /[\u0000-\u001F\u007F]/;
309166
+ plain4 = (value2, max) => (value2 ?? "").replace(CONTROL_CHARS2, "").trim().slice(0, max);
309167
+ shown2 = (value2) => (typeof value2 === "string" ? JSON.stringify(value2) : String(value2)).slice(0, 64);
309168
+ STATIC_FAQ_LIMITS = { pairs: 20, question: 200, answer: 1500 };
309169
+ oneLine2 = (s5) => typeof s5 === "string" ? s5.replace(/[\u0000-\u001F\u007F\s]+/g, " ").trim() : "";
309170
+ STATIC_GALLERY_LIMITS = { galleries: 10, photos: 50, totalPhotos: 50, title: 120 };
309171
+ }
309172
+ });
309173
+
308919
309174
  // ../../stdlib/wix-sdk/rich-content/src/display.ts
308920
309175
  function trimAscii(s5) {
308921
309176
  return s5.replace(/^[\t\n\v\f\r ]+|[\t\n\v\f\r ]+$/g, "");
@@ -309443,9 +309698,15 @@ __export(collect_exports, {
309443
309698
  collectOneApp: () => collectOneApp,
309444
309699
  inboxFromMobileConfig: () => inboxFromMobileConfig,
309445
309700
  resolveSourceLocale: () => resolveSourceLocale,
309701
+ siteAbout: () => siteAbout,
309446
309702
  sourceMemberChat: () => sourceMemberChat
309447
309703
  });
309448
309704
  import { createHash as createHash104 } from "node:crypto";
309705
+ function siteAbout(value2) {
309706
+ if (typeof value2 !== "string") return "";
309707
+ const text32 = value2.replace(/\r\n?/g, "\n").replace(/[\u0000-\u0009\u000B-\u001F\u007F]/g, " ").split("\n").map((line) => line.replace(/ {2,}/g, " ").trim()).join("\n").replace(/\n{3,}/g, "\n\n").trim();
309708
+ return bounded(text32, ABOUT_MAX_LENGTH);
309709
+ }
309449
309710
  function isObject3(value2) {
309450
309711
  return value2 !== null && typeof value2 === "object" && !Array.isArray(value2);
309451
309712
  }
@@ -309770,6 +310031,8 @@ async function collectOneApp(input, deps = {}) {
309770
310031
  const wantsContact = definitions2.some((id) => CONTACT_SECTIONS.has(id));
309771
310032
  const wantsLoyalty = definitions2.some((id) => LOYALTY_SECTIONS.has(id));
309772
310033
  const wantsTimeZone = definitions2.some((id) => SERVICES_SECTIONS.has(id));
310034
+ const wantsAbout = deps.about !== false;
310035
+ let aboutSettled = !wantsAbout;
309773
310036
  if (wantsContact || wantsLoyalty || wantsTimeZone) {
309774
310037
  const optionalOnly = !wantsContact && !wantsLoyalty;
309775
310038
  const requiredVisitor = internalBusinessRead && !optionalOnly ? await visitorAuthorization("enrichment_session") : void 0;
@@ -309780,6 +310043,10 @@ async function collectOneApp(input, deps = {}) {
309780
310043
  if (properties.metaSiteId.toLowerCase() !== input.metaSiteId.toLowerCase()) {
309781
310044
  throw new OneAppError("source_site_mismatch", "The returned properties do not match the requested site.", { stage: "business_contact" });
309782
310045
  }
310046
+ if (wantsAbout) {
310047
+ aboutSettled = true;
310048
+ businessContext.about = redact(siteAbout(properties.properties.description));
310049
+ }
309783
310050
  if (wantsContact) businessContext.contact = redact(contactProjection(properties, input.metaSiteId));
309784
310051
  if (wantsLoyalty) {
309785
310052
  const currency = properties.properties.paymentCurrency;
@@ -309810,6 +310077,8 @@ async function collectOneApp(input, deps = {}) {
309810
310077
  message: "Payment currency is unavailable. Keep currency-based Loyalty earning details unresolved."
309811
310078
  });
309812
310079
  if (wantsTimeZone) contextWarnings.push({ code: "business_time_zone_unavailable", failureCode: error.code, message: TIME_ZONE_UNAVAILABLE });
310080
+ if (!aboutSettled) contextWarnings.push({ code: "business_about_unavailable", failureCode: error.code, message: ABOUT_UNAVAILABLE });
310081
+ aboutSettled = true;
309813
310082
  }
309814
310083
  }
309815
310084
  if (Object.values(buildSourceGraph(rawStructure).sections).some((section3) => {
@@ -309948,6 +310217,29 @@ async function collectOneApp(input, deps = {}) {
309948
310217
  message: "A free One App has no branded mobile config, so its Inbox setting (inbox.chatType) is not collected. Keep the app business-only (no member chat) unless the owner confirms otherwise."
309949
310218
  });
309950
310219
  }
310220
+ if (!aboutSettled) {
310221
+ let about;
310222
+ try {
310223
+ const properties = await request2(
310224
+ PUBLIC_CONTACT,
310225
+ "business_about",
310226
+ void 0,
310227
+ { authorization: await visitorAuthorization("business_about_session"), siteScoped: false }
310228
+ );
310229
+ if (!isObject3(properties) || typeof properties.metaSiteId !== "string" || !isObject3(properties.properties)) throw invalidResponse("business_about");
310230
+ if (properties.metaSiteId.toLowerCase() !== input.metaSiteId.toLowerCase()) {
310231
+ throw new OneAppError("source_site_mismatch", "The returned properties do not match the requested site.", { stage: "business_about" });
310232
+ }
310233
+ about = siteAbout(properties.properties.description);
310234
+ } catch (error) {
310235
+ if (!(error instanceof OneAppError)) throw error;
310236
+ contextWarnings.push({ code: "business_about_unavailable", failureCode: error.code, message: ABOUT_UNAVAILABLE });
310237
+ }
310238
+ if (about !== void 0) {
310239
+ businessContext.about = redact(about);
310240
+ await progress("business-context", businessContext);
310241
+ }
310242
+ }
309951
310243
  return {
309952
310244
  schemaVersion: 1,
309953
310245
  source: {
@@ -309976,7 +310268,7 @@ async function collectOneApp(input, deps = {}) {
309976
310268
  ]
309977
310269
  };
309978
310270
  }
309979
- var MIDDLEWARE, BUSINESS, TOKEN_INFO, IS_PERMITTED, INTERNAL_PERMISSION, VISITOR_SESSION, PUBLIC_CONTACT, MOBILE_CONFIG, PUBLIC_MEMBERS, MEMBER_WIDGETS, LOYALTY_SECTIONS, CONTACT_SECTIONS, SERVICES_SECTIONS, TIME_ZONE_UNAVAILABLE, MAX_RESPONSE_BYTES, TIMEOUT_MS5, UUID, LIFECYCLE_FIELDS, MEMBER_TO_BUSINESS, DEFAULT_CHAT_TYPE, CHAT_TYPE;
310271
+ var MIDDLEWARE, BUSINESS, TOKEN_INFO, IS_PERMITTED, INTERNAL_PERMISSION, VISITOR_SESSION, PUBLIC_CONTACT, MOBILE_CONFIG, PUBLIC_MEMBERS, MEMBER_WIDGETS, LOYALTY_SECTIONS, CONTACT_SECTIONS, SERVICES_SECTIONS, TIME_ZONE_UNAVAILABLE, ABOUT_UNAVAILABLE, MAX_RESPONSE_BYTES, TIMEOUT_MS5, UUID, LIFECYCLE_FIELDS, MEMBER_TO_BUSINESS, DEFAULT_CHAT_TYPE, CHAT_TYPE;
309980
310272
  var init_collect = __esm({
309981
310273
  "src/one-app/collect.ts"() {
309982
310274
  init_define_HHP_CATALOG();
@@ -309984,6 +310276,7 @@ var init_collect = __esm({
309984
310276
  init_business_address();
309985
310277
  init_app_locale();
309986
310278
  init_errors4();
310279
+ init_derive();
309987
310280
  init_graph();
309988
310281
  init_pages();
309989
310282
  MIDDLEWARE = "https://manage.wix.com/_serverless/mobile-apps-editor-middleware";
@@ -310000,6 +310293,7 @@ var init_collect = __esm({
310000
310293
  CONTACT_SECTIONS = /* @__PURE__ */ new Set(["platform_general_contact_section", "platform_general_contact_section_bp"]);
310001
310294
  SERVICES_SECTIONS = /* @__PURE__ */ new Set(["bookings_services_list_section"]);
310002
310295
  TIME_ZONE_UNAVAILABLE = "Business time zone is unverified. Leave `businessTimeZone` out of provisioning: a course whose session times carry no offset then shows no Ended label, and no zone is guessed.";
310296
+ ABOUT_UNAVAILABLE = "The site description is unavailable. `himi one-app provision` leaves the About screen as the template ships it; never fill it with invented copy.";
310003
310297
  MAX_RESPONSE_BYTES = 8e6;
310004
310298
  TIMEOUT_MS5 = 3e4;
310005
310299
  UUID = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
@@ -313278,202 +313572,6 @@ var init_site_properties = __esm({
313278
313572
  }
313279
313573
  });
313280
313574
 
313281
- // src/site-analyze/derive.ts
313282
- function aboutFromCrawl(about, crawlComplete) {
313283
- const text32 = bounded(oneLine2(about), ABOUT_MAX_LENGTH);
313284
- if (!text32 && !crawlComplete) return void 0;
313285
- return text32;
313286
- }
313287
- function deriveAppName(ctx, override) {
313288
- return clean3(override) || clean3(ctx.identity.businessName) || clean3(ctx.identity.siteDisplayName) || "My Business";
313289
- }
313290
- function deriveIconSource(ctx) {
313291
- return clean3(ctx.brand.logo) || null;
313292
- }
313293
- function deriveVerticals(ctx) {
313294
- const requested = new Set(ctx.content.installedVerticals);
313295
- return KNOWN_VERTICALS.filter((v2) => requested.has(v2));
313296
- }
313297
- function unusableIdentifier(value2, max) {
313298
- if (typeof value2 !== "string" || value2 === "") return "missing";
313299
- if (value2 !== value2.trim()) {
313300
- return "is surrounded by whitespace, which the manifest parser strips \u2014 the app would query a different id";
313301
- }
313302
- if (HAS_CONTROL_CHAR.test(value2)) {
313303
- return "contains control characters, and removing them would name a different collection";
313304
- }
313305
- if (value2.length > max) return `is longer than ${max} characters`;
313306
- return null;
313307
- }
313308
- function deriveAdoptedCmsCollections(cms) {
313309
- const collections2 = [];
313310
- const dropped = [];
313311
- const seen = /* @__PURE__ */ new Set();
313312
- for (const collection of cms) {
313313
- const label4 = typeof collection.id === "string" ? collection.id.trim().slice(0, 60) : "";
313314
- if (!label4) continue;
313315
- if (collection.ownerAppId) {
313316
- dropped.push({ id: label4, reason: "owned by a Wix app \u2014 its own vertical covers it" });
313317
- continue;
313318
- }
313319
- const readRole = collection.readRole;
313320
- if (readRole !== "ANYONE") {
313321
- dropped.push({
313322
- id: label4,
313323
- reason: readRole === "SITE_MEMBER" || readRole === "SITE_MEMBER_AUTHOR" ? `read permission "${readRole}" \u2014 member-only rows would be cached unencrypted on the device and served to a later visitor` : `read permission ${readRole ? `"${readRole}"` : "unknown"} \u2014 a shipped app can only read ANYONE`
313324
- });
313325
- continue;
313326
- }
313327
- const idProblem = unusableIdentifier(collection.id, ID_MAX);
313328
- if (idProblem) {
313329
- dropped.push({ id: shown2(collection.id), reason: `id ${idProblem}` });
313330
- continue;
313331
- }
313332
- const id = collection.id;
313333
- if (seen.has(id)) {
313334
- dropped.push({ id: label4, reason: "duplicate id" });
313335
- continue;
313336
- }
313337
- const fields2 = collection.fields.flatMap((field) => {
313338
- if (field.systemField || field.encrypted) return [];
313339
- if (unusableIdentifier(field.key, ID_MAX)) return [];
313340
- const key4 = field.key;
313341
- return [{
313342
- key: key4,
313343
- // `key.slice(NAME_MAX)`, not bare `key`: a field key may be up to `ID_MAX`, and the
313344
- // manifest caps a display NAME at `NAME_MAX`. Falling back to the whole key would
313345
- // emit a name the shell's parser refuses, which fails open to the shell's own
313346
- // collections — the silent restoration this whole function exists to prevent.
313347
- displayName: plain4(field.displayName, NAME_MAX) || key4.slice(0, NAME_MAX),
313348
- type: (plain4(field.type, TYPE_MAX) || "TEXT").toUpperCase()
313349
- }];
313350
- });
313351
- const requested = collection.displayField;
313352
- const displayField = fields2.some((field) => field.key === requested) ? requested : fields2[0]?.key;
313353
- if (!displayField) {
313354
- dropped.push({ id: label4, reason: "no readable field to show as a row title" });
313355
- continue;
313356
- }
313357
- seen.add(id);
313358
- collections2.push({
313359
- id,
313360
- displayName: plain4(collection.displayName, NAME_MAX) || id.slice(0, NAME_MAX),
313361
- displayField,
313362
- readRole,
313363
- fields: fields2
313364
- });
313365
- }
313366
- return { collections: collections2, dropped };
313367
- }
313368
- function deriveTailoring(ctx, overrides = {}, revision = "site-derived") {
313369
- const appName2 = deriveAppName(ctx, overrides.appName);
313370
- const supportUrl = clean3(overrides.supportUrl) || clean3(ctx.url.primary);
313371
- const privacyUrl = clean3(overrides.privacyUrl);
313372
- const termsUrl = clean3(overrides.termsUrl);
313373
- const missing4 = [];
313374
- if (!supportUrl) missing4.push("supportUrl");
313375
- if (!privacyUrl) missing4.push("privacyUrl");
313376
- if (!termsUrl) missing4.push("termsUrl");
313377
- const provisioning = {
313378
- version: 1,
313379
- siteId: ctx.siteId,
313380
- revision,
313381
- installedVerticals: deriveVerticals(ctx),
313382
- // PRESENT AND EMPTY, never absent. `WixSiteContext` carries no CMS chapter, so this base
313383
- // overlay knows of no readable collection — and an ABSENT key is not that statement, it
313384
- // is "inherit whatever the shell has", which pointed a customer's app at the shell's demo
313385
- // collection (#2341). `runSiteAnalyze` replaces this with the site's own, also possibly
313386
- // empty; either way the key exists and the shell's list never survives the merge.
313387
- cmsCollections: [],
313388
- identity: {
313389
- appName: appName2,
313390
- businessName: clean3(ctx.identity.businessName) || appName2,
313391
- tagline: clean3(overrides.tagline) || clean3(ctx.identity.description),
313392
- // Present even when empty: an absent key would inherit the shell's About text. `analyzeSite`
313393
- // fills it from the crawl's About section (`aboutFromCrawl`), or drops the key when the crawl
313394
- // could not tell. The description already shows as the tagline.
313395
- about: "",
313396
- // "" means UNKNOWN here, with `missing` above as the signal — the published overlay's
313397
- // documented shape. Keeping an unknown url out of a MERGE is `apply.ts`'s job, at the
313398
- // seam where an empty string would otherwise beat the shell's committed value.
313399
- supportUrl,
313400
- privacyUrl,
313401
- termsUrl
313402
- }
313403
- };
313404
- return { appName: appName2, iconSource: deriveIconSource(ctx), provisioning, missing: missing4 };
313405
- }
313406
- function bounded(s5, max) {
313407
- if (s5.length <= max) return s5;
313408
- const cut2 = s5.slice(0, max - 1).replace(/[\uD800-\uDBFF]$/, "");
313409
- const space = cut2.lastIndexOf(" ");
313410
- return `${(space > max * 0.6 ? cut2.slice(0, space) : cut2).trimEnd()}\u2026`;
313411
- }
313412
- function deriveStaticFaq(faq) {
313413
- if (!Array.isArray(faq)) return [];
313414
- const out2 = [];
313415
- const seen = /* @__PURE__ */ new Set();
313416
- for (const raw of faq) {
313417
- if (out2.length >= STATIC_FAQ_LIMITS.pairs) break;
313418
- const pair = raw && typeof raw === "object" ? raw : {};
313419
- const q4 = bounded(oneLine2(pair.q), STATIC_FAQ_LIMITS.question);
313420
- const a3 = bounded(oneLine2(pair.a), STATIC_FAQ_LIMITS.answer);
313421
- if (!q4 || !a3 || seen.has(q4.toLowerCase())) continue;
313422
- seen.add(q4.toLowerCase());
313423
- out2.push({ q: q4, a: a3 });
313424
- }
313425
- return out2;
313426
- }
313427
- function deriveStaticGalleries(pages2) {
313428
- if (!Array.isArray(pages2)) return [];
313429
- const galleries = [];
313430
- const seenPhotoSets = /* @__PURE__ */ new Set();
313431
- let totalPhotos = 0;
313432
- for (const raw of pages2) {
313433
- if (galleries.length >= STATIC_GALLERY_LIMITS.galleries || totalPhotos >= STATIC_GALLERY_LIMITS.totalPhotos) break;
313434
- const page = raw && typeof raw === "object" ? raw : {};
313435
- if (!Array.isArray(page.galleryImageUrls)) continue;
313436
- const photos = [];
313437
- for (const image of page.galleryImageUrls) {
313438
- if (photos.length >= STATIC_GALLERY_LIMITS.photos || totalPhotos + photos.length >= STATIC_GALLERY_LIMITS.totalPhotos) break;
313439
- if (typeof image !== "string") continue;
313440
- const match = /^https:\/\/static\.wixstatic\.com\/media\/([A-Za-z0-9_~.-]+)(?:\/.*)?$/.exec(image);
313441
- if (!match) continue;
313442
- const url = `https://static.wixstatic.com/media/${match[1]}`;
313443
- if (!photos.includes(url)) photos.push(url);
313444
- }
313445
- if (!photos.length) continue;
313446
- const photoSet = photos.join("\n");
313447
- if (seenPhotoSets.has(photoSet)) continue;
313448
- seenPhotoSets.add(photoSet);
313449
- totalPhotos += photos.length;
313450
- const heading = Array.isArray(page.headings) ? page.headings.find((h2) => typeof h2 === "string" && !!h2.trim()) : void 0;
313451
- const pageTitle = typeof page.title === "string" ? page.title.split(/\s+[|–—]\s+/)[0] : "";
313452
- const title = bounded(oneLine2(page.role === "gallery" ? pageTitle || heading || "Gallery" : "Gallery"), STATIC_GALLERY_LIMITS.title);
313453
- galleries.push({ id: `site-gallery-${galleries.length + 1}`, title, photos });
313454
- }
313455
- return galleries;
313456
- }
313457
- var clean3, ABOUT_MAX_LENGTH, ID_MAX, NAME_MAX, TYPE_MAX, CONTROL_CHARS2, HAS_CONTROL_CHAR, plain4, shown2, STATIC_FAQ_LIMITS, oneLine2, STATIC_GALLERY_LIMITS;
313458
- var init_derive = __esm({
313459
- "src/site-analyze/derive.ts"() {
313460
- init_define_HHP_CATALOG();
313461
- init_types2();
313462
- clean3 = (s5) => (s5 ?? "").trim();
313463
- ABOUT_MAX_LENGTH = 1e3;
313464
- ID_MAX = 256;
313465
- NAME_MAX = 120;
313466
- TYPE_MAX = 80;
313467
- CONTROL_CHARS2 = /[\u0000-\u001F\u007F]/g;
313468
- HAS_CONTROL_CHAR = /[\u0000-\u001F\u007F]/;
313469
- plain4 = (value2, max) => (value2 ?? "").replace(CONTROL_CHARS2, "").trim().slice(0, max);
313470
- shown2 = (value2) => (typeof value2 === "string" ? JSON.stringify(value2) : String(value2)).slice(0, 64);
313471
- STATIC_FAQ_LIMITS = { pairs: 20, question: 200, answer: 1500 };
313472
- oneLine2 = (s5) => typeof s5 === "string" ? s5.replace(/[\u0000-\u001F\u007F\s]+/g, " ").trim() : "";
313473
- STATIC_GALLERY_LIMITS = { galleries: 10, photos: 50, totalPhotos: 50, title: 120 };
313474
- }
313475
- });
313476
-
313477
313575
  // src/site-analyze/copy.ts
313478
313576
  function pathOf(url) {
313479
313577
  try {
@@ -314131,7 +314229,7 @@ async function readMobileApp(fetchImpl, auth, deps = {}) {
314131
314229
  try {
314132
314230
  const collected = await collectOneApp(
314133
314231
  { metaSiteId: auth.msid, appInstance: "branded", authorization: auth.current ? await auth.current() : auth.token },
314134
- { fetchImpl, timeoutMs: deps.timeoutMs ?? TIMEOUT_MS8, pages: false, inbox: false }
314232
+ { fetchImpl, timeoutMs: deps.timeoutMs ?? TIMEOUT_MS8, pages: false, inbox: false, about: false }
314135
314233
  );
314136
314234
  const catalog4 = deps.catalog?.size ? deps.catalog : loadSectionCatalog();
314137
314235
  const summary2 = summarizeStructure(collected.rawStructure, catalog4);
@@ -828,7 +828,12 @@ Apply these interpretation rules:
828
828
  `himi_services`, `himi_service` and `himi_time` (a value it could not verify stays as the template ships it;
829
829
  nothing is invented). It writes the business name into `config.ts`'s `name` and over the slug `himi init` baked
830
830
  into displayed names (display slots only, never ids or URLs; a name you chose is kept), so the normal flow needs
831
- no `validate-identity --fix`. It states the bottom bar as native (`navigation.tabBar.presentation: "native"`; an
831
+ no `validate-identity --fix`. It writes the About screen's text (`himi_app_info`) from
832
+ `businessContext.about`: the site's own description, which collection reads from the same public, site-bound Visitor
833
+ properties (blank lines separate paragraphs). The template's demo text never ships: a site with no description (`""`)
834
+ gets none (the output's `about` says `set`, `removed` or `unchanged`). A description that could not be read
835
+ (`business_about_unavailable`, or evidence from an older CLI) is unknown, so nothing is written (`unverified`), and
836
+ About text that is not the template's demo is someone's own copy and is `kept`. Never write invented About copy. It states the bottom bar as native (`navigation.tabBar.presentation: "native"`; an
832
837
  explicit `"kit"` is kept; the output's `tabBar` reports `set`, `unchanged` or `absent`). When the collection
833
838
  recorded `memberChat: true` (never a guess), it opens the member Inbox from every baked door (the top-bar chat
834
839
  action, the drawer's Inbox item, the chat thread's parent and "Back to inbox", the Profile link) if the scaffold
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wix/himalaya-cli",
3
- "version": "0.2049.0",
3
+ "version": "0.2050.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": "7ed2861fbd4486cab6fde7bed7a534dcfa574ddc1744df82608be7d5"
85
+ "falconPackageHash": "927cf3d35bac7545d0ad2ce91e8d7119e3de98bf521cdaae2d7029bb"
86
86
  }