@wix/himalaya-cli 0.1573.0 → 0.1574.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/ts/src/message-format.d.ts +59 -0
  2. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/core.mjs +3 -3
  3. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/l10n.mjs +8 -3
  4. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/sdui.mjs +3 -3
  5. package/dist/cli.mjs +2618 -1172
  6. package/dist/preview-assets.generated.bin +0 -0
  7. package/guides/himi-json-output.md +41 -2
  8. package/guides/himi-mcp.md +1 -1
  9. package/guides/himi-test.md +3 -2
  10. package/guides/iap-products.md +1 -1
  11. package/guides/importing-oneapp-translations.md +115 -0
  12. package/guides/index.json +6 -0
  13. package/guides/one-app-section-mappings.md +16 -4
  14. package/guides/one-app-to-himi-app.md +167 -10
  15. package/guides/qa-builds.md +21 -1
  16. package/guides/templates.md +3 -2
  17. package/guides/testing-himi-apps.md +1 -1
  18. package/package.json +3 -3
  19. package/templates/beauty-salon/dev/index.ts +22 -6
  20. package/templates/beauty-salon-owner/dev/index.ts +22 -6
  21. package/templates/branded-lite/dev/index.ts +22 -6
  22. package/templates/community-club/dev/index.ts +22 -6
  23. package/templates/community-club-owner/dev/index.ts +22 -6
  24. package/templates/events-meetups/dev/index.ts +22 -6
  25. package/templates/events-meetups-owner/dev/index.ts +22 -6
  26. package/templates/gym-fitness/dev/index.ts +22 -6
  27. package/templates/gym-fitness-owner/dev/index.ts +22 -6
  28. package/templates/himi-chat/dev/index.ts +22 -6
  29. package/templates/nonprofit-cause/dev/index.ts +22 -6
  30. package/templates/nonprofit-cause-owner/dev/index.ts +22 -6
  31. package/templates/owner-lite/dev/index.ts +22 -6
  32. package/templates/podcast-creator/dev/index.ts +22 -6
  33. package/templates/podcast-creator-owner/dev/index.ts +22 -6
  34. package/templates/portfolio-creative/dev/index.ts +22 -6
  35. package/templates/portfolio-creative-owner/dev/index.ts +22 -6
  36. package/templates/restaurant/dev/index.ts +22 -6
  37. package/templates/restaurant-owner/dev/index.ts +22 -6
  38. package/templates/retail-store/dev/index.ts +22 -6
  39. package/templates/retail-store-owner/dev/index.ts +22 -6
  40. package/templates/surface-showcase/dev/index.ts +22 -6
  41. package/templates/yoga-studio/dev/index.ts +22 -6
  42. package/templates/yoga-studio-owner/dev/index.ts +22 -6
@@ -36114,15 +36114,31 @@ const TEMPLATED: { pattern: string; display: string; liveSeed?: LiveSeed; static
36114
36114
 
36115
36115
  // Live seed-id enumeration: a published release serves only EXACT screens, so
36116
36116
  // `himi push` bakes each templated detail route's CURRENT catalog ids as exact
36117
- // screens via `seedIds`. Anonymous visitor rung against this app's own clientId;
36118
- // best-effort (offline build → no baked details, preview still live-resolves).
36117
+ // screens via `seedIds`. Anonymous visitor rung against this app's own clientId — or,
36118
+ // for an app bound through the One App visitor identity (`visitorSource: "one-app"`,
36119
+ // no client), that site's One App visitor instance. Best-effort (offline build → no
36120
+ // baked details, preview still live-resolves).
36121
+ async function liveSeedToken(WIX: string): Promise<string | undefined> {
36122
+ const auth = (config as { auth?: { config?: { clientId?: string; visitorSource?: string; metaSiteId?: string } } }).auth?.config;
36123
+ // A One App binding boots as the site's One App visitor, so the seed reads as that visitor too —
36124
+ // even beside a member-login clientId, and never repointed by a stray local WIX_CLIENT_ID.
36125
+ const oneApp = auth?.visitorSource === "one-app";
36126
+ const clientId = oneApp ? "" : process.env.WIX_CLIENT_ID ?? auth?.clientId ?? "";
36127
+ if (clientId && !clientId.startsWith("YOUR_")) {
36128
+ const mint = await fetch(WIX + "/oauth2/token", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ clientId, grantType: "anonymous" }) });
36129
+ return ((await mint.json()) as { access_token?: string }).access_token;
36130
+ }
36131
+ const msid = oneApp ? auth?.metaSiteId ?? "" : "";
36132
+ if (!/^[0-9a-fA-F-]{10,64}$/.test(msid)) return undefined;
36133
+ const mint = await fetch(`https://apps.wix.com/_api/one-app-session-web/v3/businesses/${msid}/signed-instance?signed_instance_type=Visitor`, { headers: { Accept: "application/json" }, redirect: "error" });
36134
+ const visitor = (await mint.json()) as { signedInstance?: string; signedInstanceType?: string };
36135
+ return visitor.signedInstanceType === "Visitor" ? visitor.signedInstance : undefined;
36136
+ }
36137
+
36119
36138
  async function liveSeedIds(spec: LiveSeed): Promise<string[]> {
36120
36139
  try {
36121
36140
  const WIX = "https://www.wixapis.com";
36122
- const clientId = process.env.WIX_CLIENT_ID ?? (config as { auth?: { config?: { clientId?: string } } }).auth?.config?.clientId ?? "";
36123
- if (!clientId || clientId.startsWith("YOUR_")) return [];
36124
- const mint = await fetch(WIX + "/oauth2/token", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ clientId, grantType: "anonymous" }) });
36125
- const token = ((await mint.json()) as { access_token?: string }).access_token;
36141
+ const token = await liveSeedToken(WIX);
36126
36142
  if (!token) return [];
36127
36143
  const res = await fetch(WIX + spec.path, { method: "POST", headers: { Authorization: token, "Content-Type": "application/json" }, body: JSON.stringify(spec.body) });
36128
36144
  const json = (await res.json()) as Record<string, unknown>;
@@ -86711,15 +86711,31 @@ const TEMPLATED: { pattern: string; display: string; liveSeed?: LiveSeed; static
86711
86711
 
86712
86712
  // Live seed-id enumeration: a published release serves only EXACT screens, so
86713
86713
  // `himi push` bakes each templated detail route's CURRENT catalog ids as exact
86714
- // screens via `seedIds`. Anonymous visitor rung against this app's own clientId;
86715
- // best-effort (offline build → no baked details, preview still live-resolves).
86714
+ // screens via `seedIds`. Anonymous visitor rung against this app's own clientId — or,
86715
+ // for an app bound through the One App visitor identity (`visitorSource: "one-app"`,
86716
+ // no client), that site's One App visitor instance. Best-effort (offline build → no
86717
+ // baked details, preview still live-resolves).
86718
+ async function liveSeedToken(WIX: string): Promise<string | undefined> {
86719
+ const auth = (config as { auth?: { config?: { clientId?: string; visitorSource?: string; metaSiteId?: string } } }).auth?.config;
86720
+ // A One App binding boots as the site's One App visitor, so the seed reads as that visitor too —
86721
+ // even beside a member-login clientId, and never repointed by a stray local WIX_CLIENT_ID.
86722
+ const oneApp = auth?.visitorSource === "one-app";
86723
+ const clientId = oneApp ? "" : process.env.WIX_CLIENT_ID ?? auth?.clientId ?? "";
86724
+ if (clientId && !clientId.startsWith("YOUR_")) {
86725
+ const mint = await fetch(WIX + "/oauth2/token", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ clientId, grantType: "anonymous" }) });
86726
+ return ((await mint.json()) as { access_token?: string }).access_token;
86727
+ }
86728
+ const msid = oneApp ? auth?.metaSiteId ?? "" : "";
86729
+ if (!/^[0-9a-fA-F-]{10,64}$/.test(msid)) return undefined;
86730
+ const mint = await fetch(`https://apps.wix.com/_api/one-app-session-web/v3/businesses/${msid}/signed-instance?signed_instance_type=Visitor`, { headers: { Accept: "application/json" }, redirect: "error" });
86731
+ const visitor = (await mint.json()) as { signedInstance?: string; signedInstanceType?: string };
86732
+ return visitor.signedInstanceType === "Visitor" ? visitor.signedInstance : undefined;
86733
+ }
86734
+
86716
86735
  async function liveSeedIds(spec: LiveSeed): Promise<string[]> {
86717
86736
  try {
86718
86737
  const WIX = "https://www.wixapis.com";
86719
- const clientId = process.env.WIX_CLIENT_ID ?? (config as { auth?: { config?: { clientId?: string } } }).auth?.config?.clientId ?? "";
86720
- if (!clientId || clientId.startsWith("YOUR_")) return [];
86721
- const mint = await fetch(WIX + "/oauth2/token", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ clientId, grantType: "anonymous" }) });
86722
- const token = ((await mint.json()) as { access_token?: string }).access_token;
86738
+ const token = await liveSeedToken(WIX);
86723
86739
  if (!token) return [];
86724
86740
  const res = await fetch(WIX + spec.path, { method: "POST", headers: { Authorization: token, "Content-Type": "application/json" }, body: JSON.stringify(spec.body) });
86725
86741
  const json = (await res.json()) as Record<string, unknown>;
@@ -26773,15 +26773,31 @@ const TEMPLATED: { pattern: string; display: string; liveSeed?: LiveSeed; static
26773
26773
 
26774
26774
  // Live seed-id enumeration: a published release serves only EXACT screens, so
26775
26775
  // `himi push` bakes each templated detail route's CURRENT catalog ids as exact
26776
- // screens via `seedIds`. Anonymous visitor rung against this app's own clientId;
26777
- // best-effort (offline build → no baked details, preview still live-resolves).
26776
+ // screens via `seedIds`. Anonymous visitor rung against this app's own clientId — or,
26777
+ // for an app bound through the One App visitor identity (`visitorSource: "one-app"`,
26778
+ // no client), that site's One App visitor instance. Best-effort (offline build → no
26779
+ // baked details, preview still live-resolves).
26780
+ async function liveSeedToken(WIX: string): Promise<string | undefined> {
26781
+ const auth = (config as { auth?: { config?: { clientId?: string; visitorSource?: string; metaSiteId?: string } } }).auth?.config;
26782
+ // A One App binding boots as the site's One App visitor, so the seed reads as that visitor too —
26783
+ // even beside a member-login clientId, and never repointed by a stray local WIX_CLIENT_ID.
26784
+ const oneApp = auth?.visitorSource === "one-app";
26785
+ const clientId = oneApp ? "" : process.env.WIX_CLIENT_ID ?? auth?.clientId ?? "";
26786
+ if (clientId && !clientId.startsWith("YOUR_")) {
26787
+ const mint = await fetch(WIX + "/oauth2/token", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ clientId, grantType: "anonymous" }) });
26788
+ return ((await mint.json()) as { access_token?: string }).access_token;
26789
+ }
26790
+ const msid = oneApp ? auth?.metaSiteId ?? "" : "";
26791
+ if (!/^[0-9a-fA-F-]{10,64}$/.test(msid)) return undefined;
26792
+ const mint = await fetch(`https://apps.wix.com/_api/one-app-session-web/v3/businesses/${msid}/signed-instance?signed_instance_type=Visitor`, { headers: { Accept: "application/json" }, redirect: "error" });
26793
+ const visitor = (await mint.json()) as { signedInstance?: string; signedInstanceType?: string };
26794
+ return visitor.signedInstanceType === "Visitor" ? visitor.signedInstance : undefined;
26795
+ }
26796
+
26778
26797
  async function liveSeedIds(spec: LiveSeed): Promise<string[]> {
26779
26798
  try {
26780
26799
  const WIX = "https://www.wixapis.com";
26781
- const clientId = process.env.WIX_CLIENT_ID ?? (config as { auth?: { config?: { clientId?: string } } }).auth?.config?.clientId ?? "";
26782
- if (!clientId || clientId.startsWith("YOUR_")) return [];
26783
- const mint = await fetch(WIX + "/oauth2/token", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ clientId, grantType: "anonymous" }) });
26784
- const token = ((await mint.json()) as { access_token?: string }).access_token;
26800
+ const token = await liveSeedToken(WIX);
26785
26801
  if (!token) return [];
26786
26802
  const res = await fetch(WIX + spec.path, { method: "POST", headers: { Authorization: token, "Content-Type": "application/json" }, body: JSON.stringify(spec.body) });
26787
26803
  const json = (await res.json()) as Record<string, unknown>;
@@ -90719,15 +90719,31 @@ const TEMPLATED: { pattern: string; display: string; liveSeed?: LiveSeed; static
90719
90719
 
90720
90720
  // Live seed-id enumeration: a published release serves only EXACT screens, so
90721
90721
  // `himi push` bakes each templated detail route's CURRENT catalog ids as exact
90722
- // screens via `seedIds`. Anonymous visitor rung against this app's own clientId;
90723
- // best-effort (offline build → no baked details, preview still live-resolves).
90722
+ // screens via `seedIds`. Anonymous visitor rung against this app's own clientId — or,
90723
+ // for an app bound through the One App visitor identity (`visitorSource: "one-app"`,
90724
+ // no client), that site's One App visitor instance. Best-effort (offline build → no
90725
+ // baked details, preview still live-resolves).
90726
+ async function liveSeedToken(WIX: string): Promise<string | undefined> {
90727
+ const auth = (config as { auth?: { config?: { clientId?: string; visitorSource?: string; metaSiteId?: string } } }).auth?.config;
90728
+ // A One App binding boots as the site's One App visitor, so the seed reads as that visitor too —
90729
+ // even beside a member-login clientId, and never repointed by a stray local WIX_CLIENT_ID.
90730
+ const oneApp = auth?.visitorSource === "one-app";
90731
+ const clientId = oneApp ? "" : process.env.WIX_CLIENT_ID ?? auth?.clientId ?? "";
90732
+ if (clientId && !clientId.startsWith("YOUR_")) {
90733
+ const mint = await fetch(WIX + "/oauth2/token", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ clientId, grantType: "anonymous" }) });
90734
+ return ((await mint.json()) as { access_token?: string }).access_token;
90735
+ }
90736
+ const msid = oneApp ? auth?.metaSiteId ?? "" : "";
90737
+ if (!/^[0-9a-fA-F-]{10,64}$/.test(msid)) return undefined;
90738
+ const mint = await fetch(`https://apps.wix.com/_api/one-app-session-web/v3/businesses/${msid}/signed-instance?signed_instance_type=Visitor`, { headers: { Accept: "application/json" }, redirect: "error" });
90739
+ const visitor = (await mint.json()) as { signedInstance?: string; signedInstanceType?: string };
90740
+ return visitor.signedInstanceType === "Visitor" ? visitor.signedInstance : undefined;
90741
+ }
90742
+
90724
90743
  async function liveSeedIds(spec: LiveSeed): Promise<string[]> {
90725
90744
  try {
90726
90745
  const WIX = "https://www.wixapis.com";
90727
- const clientId = process.env.WIX_CLIENT_ID ?? (config as { auth?: { config?: { clientId?: string } } }).auth?.config?.clientId ?? "";
90728
- if (!clientId || clientId.startsWith("YOUR_")) return [];
90729
- const mint = await fetch(WIX + "/oauth2/token", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ clientId, grantType: "anonymous" }) });
90730
- const token = ((await mint.json()) as { access_token?: string }).access_token;
90746
+ const token = await liveSeedToken(WIX);
90731
90747
  if (!token) return [];
90732
90748
  const res = await fetch(WIX + spec.path, { method: "POST", headers: { Authorization: token, "Content-Type": "application/json" }, body: JSON.stringify(spec.body) });
90733
90749
  const json = (await res.json()) as Record<string, unknown>;
@@ -25622,15 +25622,31 @@ const TEMPLATED: { pattern: string; display: string; liveSeed?: LiveSeed; static
25622
25622
 
25623
25623
  // Live seed-id enumeration: a published release serves only EXACT screens, so
25624
25624
  // `himi push` bakes each templated detail route's CURRENT catalog ids as exact
25625
- // screens via `seedIds`. Anonymous visitor rung against this app's own clientId;
25626
- // best-effort (offline build → no baked details, preview still live-resolves).
25625
+ // screens via `seedIds`. Anonymous visitor rung against this app's own clientId — or,
25626
+ // for an app bound through the One App visitor identity (`visitorSource: "one-app"`,
25627
+ // no client), that site's One App visitor instance. Best-effort (offline build → no
25628
+ // baked details, preview still live-resolves).
25629
+ async function liveSeedToken(WIX: string): Promise<string | undefined> {
25630
+ const auth = (config as { auth?: { config?: { clientId?: string; visitorSource?: string; metaSiteId?: string } } }).auth?.config;
25631
+ // A One App binding boots as the site's One App visitor, so the seed reads as that visitor too —
25632
+ // even beside a member-login clientId, and never repointed by a stray local WIX_CLIENT_ID.
25633
+ const oneApp = auth?.visitorSource === "one-app";
25634
+ const clientId = oneApp ? "" : process.env.WIX_CLIENT_ID ?? auth?.clientId ?? "";
25635
+ if (clientId && !clientId.startsWith("YOUR_")) {
25636
+ const mint = await fetch(WIX + "/oauth2/token", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ clientId, grantType: "anonymous" }) });
25637
+ return ((await mint.json()) as { access_token?: string }).access_token;
25638
+ }
25639
+ const msid = oneApp ? auth?.metaSiteId ?? "" : "";
25640
+ if (!/^[0-9a-fA-F-]{10,64}$/.test(msid)) return undefined;
25641
+ const mint = await fetch(`https://apps.wix.com/_api/one-app-session-web/v3/businesses/${msid}/signed-instance?signed_instance_type=Visitor`, { headers: { Accept: "application/json" }, redirect: "error" });
25642
+ const visitor = (await mint.json()) as { signedInstance?: string; signedInstanceType?: string };
25643
+ return visitor.signedInstanceType === "Visitor" ? visitor.signedInstance : undefined;
25644
+ }
25645
+
25627
25646
  async function liveSeedIds(spec: LiveSeed): Promise<string[]> {
25628
25647
  try {
25629
25648
  const WIX = "https://www.wixapis.com";
25630
- const clientId = process.env.WIX_CLIENT_ID ?? (config as { auth?: { config?: { clientId?: string } } }).auth?.config?.clientId ?? "";
25631
- if (!clientId || clientId.startsWith("YOUR_")) return [];
25632
- const mint = await fetch(WIX + "/oauth2/token", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ clientId, grantType: "anonymous" }) });
25633
- const token = ((await mint.json()) as { access_token?: string }).access_token;
25649
+ const token = await liveSeedToken(WIX);
25634
25650
  if (!token) return [];
25635
25651
  const res = await fetch(WIX + spec.path, { method: "POST", headers: { Authorization: token, "Content-Type": "application/json" }, body: JSON.stringify(spec.body) });
25636
25652
  const json = (await res.json()) as Record<string, unknown>;
@@ -80984,15 +80984,31 @@ const TEMPLATED: { pattern: string; display: string; liveSeed?: LiveSeed; static
80984
80984
 
80985
80985
  // Live seed-id enumeration: a published release serves only EXACT screens, so
80986
80986
  // `himi push` bakes each templated detail route's CURRENT catalog ids as exact
80987
- // screens via `seedIds`. Anonymous visitor rung against this app's own clientId;
80988
- // best-effort (offline build → no baked details, preview still live-resolves).
80987
+ // screens via `seedIds`. Anonymous visitor rung against this app's own clientId — or,
80988
+ // for an app bound through the One App visitor identity (`visitorSource: "one-app"`,
80989
+ // no client), that site's One App visitor instance. Best-effort (offline build → no
80990
+ // baked details, preview still live-resolves).
80991
+ async function liveSeedToken(WIX: string): Promise<string | undefined> {
80992
+ const auth = (config as { auth?: { config?: { clientId?: string; visitorSource?: string; metaSiteId?: string } } }).auth?.config;
80993
+ // A One App binding boots as the site's One App visitor, so the seed reads as that visitor too —
80994
+ // even beside a member-login clientId, and never repointed by a stray local WIX_CLIENT_ID.
80995
+ const oneApp = auth?.visitorSource === "one-app";
80996
+ const clientId = oneApp ? "" : process.env.WIX_CLIENT_ID ?? auth?.clientId ?? "";
80997
+ if (clientId && !clientId.startsWith("YOUR_")) {
80998
+ const mint = await fetch(WIX + "/oauth2/token", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ clientId, grantType: "anonymous" }) });
80999
+ return ((await mint.json()) as { access_token?: string }).access_token;
81000
+ }
81001
+ const msid = oneApp ? auth?.metaSiteId ?? "" : "";
81002
+ if (!/^[0-9a-fA-F-]{10,64}$/.test(msid)) return undefined;
81003
+ const mint = await fetch(`https://apps.wix.com/_api/one-app-session-web/v3/businesses/${msid}/signed-instance?signed_instance_type=Visitor`, { headers: { Accept: "application/json" }, redirect: "error" });
81004
+ const visitor = (await mint.json()) as { signedInstance?: string; signedInstanceType?: string };
81005
+ return visitor.signedInstanceType === "Visitor" ? visitor.signedInstance : undefined;
81006
+ }
81007
+
80989
81008
  async function liveSeedIds(spec: LiveSeed): Promise<string[]> {
80990
81009
  try {
80991
81010
  const WIX = "https://www.wixapis.com";
80992
- const clientId = process.env.WIX_CLIENT_ID ?? (config as { auth?: { config?: { clientId?: string } } }).auth?.config?.clientId ?? "";
80993
- if (!clientId || clientId.startsWith("YOUR_")) return [];
80994
- const mint = await fetch(WIX + "/oauth2/token", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ clientId, grantType: "anonymous" }) });
80995
- const token = ((await mint.json()) as { access_token?: string }).access_token;
81011
+ const token = await liveSeedToken(WIX);
80996
81012
  if (!token) return [];
80997
81013
  const res = await fetch(WIX + spec.path, { method: "POST", headers: { Authorization: token, "Content-Type": "application/json" }, body: JSON.stringify(spec.body) });
80998
81014
  const json = (await res.json()) as Record<string, unknown>;
@@ -626,15 +626,31 @@ const TEMPLATED: { pattern: string; display: string; liveSeed?: LiveSeed; static
626
626
 
627
627
  // Live seed-id enumeration: a published release serves only EXACT screens, so
628
628
  // `himi push` bakes each templated detail route's CURRENT catalog ids as exact
629
- // screens via `seedIds`. Anonymous visitor rung against this app's own clientId;
630
- // best-effort (offline build → no baked details, preview still live-resolves).
629
+ // screens via `seedIds`. Anonymous visitor rung against this app's own clientId — or,
630
+ // for an app bound through the One App visitor identity (`visitorSource: "one-app"`,
631
+ // no client), that site's One App visitor instance. Best-effort (offline build → no
632
+ // baked details, preview still live-resolves).
633
+ async function liveSeedToken(WIX: string): Promise<string | undefined> {
634
+ const auth = (config as { auth?: { config?: { clientId?: string; visitorSource?: string; metaSiteId?: string } } }).auth?.config;
635
+ // A One App binding boots as the site's One App visitor, so the seed reads as that visitor too —
636
+ // even beside a member-login clientId, and never repointed by a stray local WIX_CLIENT_ID.
637
+ const oneApp = auth?.visitorSource === "one-app";
638
+ const clientId = oneApp ? "" : process.env.WIX_CLIENT_ID ?? auth?.clientId ?? "";
639
+ if (clientId && !clientId.startsWith("YOUR_")) {
640
+ const mint = await fetch(WIX + "/oauth2/token", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ clientId, grantType: "anonymous" }) });
641
+ return ((await mint.json()) as { access_token?: string }).access_token;
642
+ }
643
+ const msid = oneApp ? auth?.metaSiteId ?? "" : "";
644
+ if (!/^[0-9a-fA-F-]{10,64}$/.test(msid)) return undefined;
645
+ const mint = await fetch(`https://apps.wix.com/_api/one-app-session-web/v3/businesses/${msid}/signed-instance?signed_instance_type=Visitor`, { headers: { Accept: "application/json" }, redirect: "error" });
646
+ const visitor = (await mint.json()) as { signedInstance?: string; signedInstanceType?: string };
647
+ return visitor.signedInstanceType === "Visitor" ? visitor.signedInstance : undefined;
648
+ }
649
+
631
650
  async function liveSeedIds(spec: LiveSeed): Promise<string[]> {
632
651
  try {
633
652
  const WIX = "https://www.wixapis.com";
634
- const clientId = process.env.WIX_CLIENT_ID ?? (config as { auth?: { config?: { clientId?: string } } }).auth?.config?.clientId ?? "";
635
- if (!clientId || clientId.startsWith("YOUR_")) return [];
636
- const mint = await fetch(WIX + "/oauth2/token", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ clientId, grantType: "anonymous" }) });
637
- const token = ((await mint.json()) as { access_token?: string }).access_token;
653
+ const token = await liveSeedToken(WIX);
638
654
  if (!token) return [];
639
655
  const res = await fetch(WIX + spec.path, { method: "POST", headers: { Authorization: token, "Content-Type": "application/json" }, body: JSON.stringify(spec.body) });
640
656
  const json = (await res.json()) as Record<string, unknown>;
@@ -37400,15 +37400,31 @@ const TEMPLATED: { pattern: string; display: string; liveSeed?: LiveSeed; static
37400
37400
 
37401
37401
  // Live seed-id enumeration: a published release serves only EXACT screens, so
37402
37402
  // `himi push` bakes each templated detail route's CURRENT catalog ids as exact
37403
- // screens via `seedIds`. Anonymous visitor rung against this app's own clientId;
37404
- // best-effort (offline build → no baked details, preview still live-resolves).
37403
+ // screens via `seedIds`. Anonymous visitor rung against this app's own clientId — or,
37404
+ // for an app bound through the One App visitor identity (`visitorSource: "one-app"`,
37405
+ // no client), that site's One App visitor instance. Best-effort (offline build → no
37406
+ // baked details, preview still live-resolves).
37407
+ async function liveSeedToken(WIX: string): Promise<string | undefined> {
37408
+ const auth = (config as { auth?: { config?: { clientId?: string; visitorSource?: string; metaSiteId?: string } } }).auth?.config;
37409
+ // A One App binding boots as the site's One App visitor, so the seed reads as that visitor too —
37410
+ // even beside a member-login clientId, and never repointed by a stray local WIX_CLIENT_ID.
37411
+ const oneApp = auth?.visitorSource === "one-app";
37412
+ const clientId = oneApp ? "" : process.env.WIX_CLIENT_ID ?? auth?.clientId ?? "";
37413
+ if (clientId && !clientId.startsWith("YOUR_")) {
37414
+ const mint = await fetch(WIX + "/oauth2/token", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ clientId, grantType: "anonymous" }) });
37415
+ return ((await mint.json()) as { access_token?: string }).access_token;
37416
+ }
37417
+ const msid = oneApp ? auth?.metaSiteId ?? "" : "";
37418
+ if (!/^[0-9a-fA-F-]{10,64}$/.test(msid)) return undefined;
37419
+ const mint = await fetch(`https://apps.wix.com/_api/one-app-session-web/v3/businesses/${msid}/signed-instance?signed_instance_type=Visitor`, { headers: { Accept: "application/json" }, redirect: "error" });
37420
+ const visitor = (await mint.json()) as { signedInstance?: string; signedInstanceType?: string };
37421
+ return visitor.signedInstanceType === "Visitor" ? visitor.signedInstance : undefined;
37422
+ }
37423
+
37405
37424
  async function liveSeedIds(spec: LiveSeed): Promise<string[]> {
37406
37425
  try {
37407
37426
  const WIX = "https://www.wixapis.com";
37408
- const clientId = process.env.WIX_CLIENT_ID ?? (config as { auth?: { config?: { clientId?: string } } }).auth?.config?.clientId ?? "";
37409
- if (!clientId || clientId.startsWith("YOUR_")) return [];
37410
- const mint = await fetch(WIX + "/oauth2/token", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ clientId, grantType: "anonymous" }) });
37411
- const token = ((await mint.json()) as { access_token?: string }).access_token;
37427
+ const token = await liveSeedToken(WIX);
37412
37428
  if (!token) return [];
37413
37429
  const res = await fetch(WIX + spec.path, { method: "POST", headers: { Authorization: token, "Content-Type": "application/json" }, body: JSON.stringify(spec.body) });
37414
37430
  const json = (await res.json()) as Record<string, unknown>;
@@ -82114,15 +82114,31 @@ const TEMPLATED: { pattern: string; display: string; liveSeed?: LiveSeed; static
82114
82114
 
82115
82115
  // Live seed-id enumeration: a published release serves only EXACT screens, so
82116
82116
  // `himi push` bakes each templated detail route's CURRENT catalog ids as exact
82117
- // screens via `seedIds`. Anonymous visitor rung against this app's own clientId;
82118
- // best-effort (offline build → no baked details, preview still live-resolves).
82117
+ // screens via `seedIds`. Anonymous visitor rung against this app's own clientId — or,
82118
+ // for an app bound through the One App visitor identity (`visitorSource: "one-app"`,
82119
+ // no client), that site's One App visitor instance. Best-effort (offline build → no
82120
+ // baked details, preview still live-resolves).
82121
+ async function liveSeedToken(WIX: string): Promise<string | undefined> {
82122
+ const auth = (config as { auth?: { config?: { clientId?: string; visitorSource?: string; metaSiteId?: string } } }).auth?.config;
82123
+ // A One App binding boots as the site's One App visitor, so the seed reads as that visitor too —
82124
+ // even beside a member-login clientId, and never repointed by a stray local WIX_CLIENT_ID.
82125
+ const oneApp = auth?.visitorSource === "one-app";
82126
+ const clientId = oneApp ? "" : process.env.WIX_CLIENT_ID ?? auth?.clientId ?? "";
82127
+ if (clientId && !clientId.startsWith("YOUR_")) {
82128
+ const mint = await fetch(WIX + "/oauth2/token", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ clientId, grantType: "anonymous" }) });
82129
+ return ((await mint.json()) as { access_token?: string }).access_token;
82130
+ }
82131
+ const msid = oneApp ? auth?.metaSiteId ?? "" : "";
82132
+ if (!/^[0-9a-fA-F-]{10,64}$/.test(msid)) return undefined;
82133
+ const mint = await fetch(`https://apps.wix.com/_api/one-app-session-web/v3/businesses/${msid}/signed-instance?signed_instance_type=Visitor`, { headers: { Accept: "application/json" }, redirect: "error" });
82134
+ const visitor = (await mint.json()) as { signedInstance?: string; signedInstanceType?: string };
82135
+ return visitor.signedInstanceType === "Visitor" ? visitor.signedInstance : undefined;
82136
+ }
82137
+
82119
82138
  async function liveSeedIds(spec: LiveSeed): Promise<string[]> {
82120
82139
  try {
82121
82140
  const WIX = "https://www.wixapis.com";
82122
- const clientId = process.env.WIX_CLIENT_ID ?? (config as { auth?: { config?: { clientId?: string } } }).auth?.config?.clientId ?? "";
82123
- if (!clientId || clientId.startsWith("YOUR_")) return [];
82124
- const mint = await fetch(WIX + "/oauth2/token", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ clientId, grantType: "anonymous" }) });
82125
- const token = ((await mint.json()) as { access_token?: string }).access_token;
82141
+ const token = await liveSeedToken(WIX);
82126
82142
  if (!token) return [];
82127
82143
  const res = await fetch(WIX + spec.path, { method: "POST", headers: { Authorization: token, "Content-Type": "application/json" }, body: JSON.stringify(spec.body) });
82128
82144
  const json = (await res.json()) as Record<string, unknown>;