@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
@@ -41003,15 +41003,31 @@ const TEMPLATED: { pattern: string; display: string; liveSeed?: LiveSeed; static
41003
41003
 
41004
41004
  // Live seed-id enumeration: a published release serves only EXACT screens, so
41005
41005
  // `himi push` bakes each templated detail route's CURRENT catalog ids as exact
41006
- // screens via `seedIds`. Anonymous visitor rung against this app's own clientId;
41007
- // best-effort (offline build → no baked details, preview still live-resolves).
41006
+ // screens via `seedIds`. Anonymous visitor rung against this app's own clientId — or,
41007
+ // for an app bound through the One App visitor identity (`visitorSource: "one-app"`,
41008
+ // no client), that site's One App visitor instance. Best-effort (offline build → no
41009
+ // baked details, preview still live-resolves).
41010
+ async function liveSeedToken(WIX: string): Promise<string | undefined> {
41011
+ const auth = (config as { auth?: { config?: { clientId?: string; visitorSource?: string; metaSiteId?: string } } }).auth?.config;
41012
+ // A One App binding boots as the site's One App visitor, so the seed reads as that visitor too —
41013
+ // even beside a member-login clientId, and never repointed by a stray local WIX_CLIENT_ID.
41014
+ const oneApp = auth?.visitorSource === "one-app";
41015
+ const clientId = oneApp ? "" : process.env.WIX_CLIENT_ID ?? auth?.clientId ?? "";
41016
+ if (clientId && !clientId.startsWith("YOUR_")) {
41017
+ const mint = await fetch(WIX + "/oauth2/token", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ clientId, grantType: "anonymous" }) });
41018
+ return ((await mint.json()) as { access_token?: string }).access_token;
41019
+ }
41020
+ const msid = oneApp ? auth?.metaSiteId ?? "" : "";
41021
+ if (!/^[0-9a-fA-F-]{10,64}$/.test(msid)) return undefined;
41022
+ 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" });
41023
+ const visitor = (await mint.json()) as { signedInstance?: string; signedInstanceType?: string };
41024
+ return visitor.signedInstanceType === "Visitor" ? visitor.signedInstance : undefined;
41025
+ }
41026
+
41008
41027
  async function liveSeedIds(spec: LiveSeed): Promise<string[]> {
41009
41028
  try {
41010
41029
  const WIX = "https://www.wixapis.com";
41011
- const clientId = process.env.WIX_CLIENT_ID ?? (config as { auth?: { config?: { clientId?: string } } }).auth?.config?.clientId ?? "";
41012
- if (!clientId || clientId.startsWith("YOUR_")) return [];
41013
- const mint = await fetch(WIX + "/oauth2/token", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ clientId, grantType: "anonymous" }) });
41014
- const token = ((await mint.json()) as { access_token?: string }).access_token;
41030
+ const token = await liveSeedToken(WIX);
41015
41031
  if (!token) return [];
41016
41032
  const res = await fetch(WIX + spec.path, { method: "POST", headers: { Authorization: token, "Content-Type": "application/json" }, body: JSON.stringify(spec.body) });
41017
41033
  const json = (await res.json()) as Record<string, unknown>;
@@ -86710,15 +86710,31 @@ const TEMPLATED: { pattern: string; display: string; liveSeed?: LiveSeed; static
86710
86710
 
86711
86711
  // Live seed-id enumeration: a published release serves only EXACT screens, so
86712
86712
  // `himi push` bakes each templated detail route's CURRENT catalog ids as exact
86713
- // screens via `seedIds`. Anonymous visitor rung against this app's own clientId;
86714
- // best-effort (offline build → no baked details, preview still live-resolves).
86713
+ // screens via `seedIds`. Anonymous visitor rung against this app's own clientId — or,
86714
+ // for an app bound through the One App visitor identity (`visitorSource: "one-app"`,
86715
+ // no client), that site's One App visitor instance. Best-effort (offline build → no
86716
+ // baked details, preview still live-resolves).
86717
+ async function liveSeedToken(WIX: string): Promise<string | undefined> {
86718
+ const auth = (config as { auth?: { config?: { clientId?: string; visitorSource?: string; metaSiteId?: string } } }).auth?.config;
86719
+ // A One App binding boots as the site's One App visitor, so the seed reads as that visitor too —
86720
+ // even beside a member-login clientId, and never repointed by a stray local WIX_CLIENT_ID.
86721
+ const oneApp = auth?.visitorSource === "one-app";
86722
+ const clientId = oneApp ? "" : process.env.WIX_CLIENT_ID ?? auth?.clientId ?? "";
86723
+ if (clientId && !clientId.startsWith("YOUR_")) {
86724
+ const mint = await fetch(WIX + "/oauth2/token", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ clientId, grantType: "anonymous" }) });
86725
+ return ((await mint.json()) as { access_token?: string }).access_token;
86726
+ }
86727
+ const msid = oneApp ? auth?.metaSiteId ?? "" : "";
86728
+ if (!/^[0-9a-fA-F-]{10,64}$/.test(msid)) return undefined;
86729
+ 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" });
86730
+ const visitor = (await mint.json()) as { signedInstance?: string; signedInstanceType?: string };
86731
+ return visitor.signedInstanceType === "Visitor" ? visitor.signedInstance : undefined;
86732
+ }
86733
+
86715
86734
  async function liveSeedIds(spec: LiveSeed): Promise<string[]> {
86716
86735
  try {
86717
86736
  const WIX = "https://www.wixapis.com";
86718
- const clientId = process.env.WIX_CLIENT_ID ?? (config as { auth?: { config?: { clientId?: string } } }).auth?.config?.clientId ?? "";
86719
- if (!clientId || clientId.startsWith("YOUR_")) return [];
86720
- const mint = await fetch(WIX + "/oauth2/token", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ clientId, grantType: "anonymous" }) });
86721
- const token = ((await mint.json()) as { access_token?: string }).access_token;
86737
+ const token = await liveSeedToken(WIX);
86722
86738
  if (!token) return [];
86723
86739
  const res = await fetch(WIX + spec.path, { method: "POST", headers: { Authorization: token, "Content-Type": "application/json" }, body: JSON.stringify(spec.body) });
86724
86740
  const json = (await res.json()) as Record<string, unknown>;
@@ -104655,15 +104655,31 @@ const TEMPLATED: { pattern: string; display: string; liveSeed?: LiveSeed; static
104655
104655
 
104656
104656
  // Live seed-id enumeration: a published release serves only EXACT screens, so
104657
104657
  // `himi push` bakes each templated detail route's CURRENT catalog ids as exact
104658
- // screens via `seedIds`. Anonymous visitor rung against this app's own clientId;
104659
- // best-effort (offline build → no baked details, preview still live-resolves).
104658
+ // screens via `seedIds`. Anonymous visitor rung against this app's own clientId — or,
104659
+ // for an app bound through the One App visitor identity (`visitorSource: "one-app"`,
104660
+ // no client), that site's One App visitor instance. Best-effort (offline build → no
104661
+ // baked details, preview still live-resolves).
104662
+ async function liveSeedToken(WIX: string): Promise<string | undefined> {
104663
+ const auth = (config as { auth?: { config?: { clientId?: string; visitorSource?: string; metaSiteId?: string } } }).auth?.config;
104664
+ // A One App binding boots as the site's One App visitor, so the seed reads as that visitor too —
104665
+ // even beside a member-login clientId, and never repointed by a stray local WIX_CLIENT_ID.
104666
+ const oneApp = auth?.visitorSource === "one-app";
104667
+ const clientId = oneApp ? "" : process.env.WIX_CLIENT_ID ?? auth?.clientId ?? "";
104668
+ if (clientId && !clientId.startsWith("YOUR_")) {
104669
+ const mint = await fetch(WIX + "/oauth2/token", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ clientId, grantType: "anonymous" }) });
104670
+ return ((await mint.json()) as { access_token?: string }).access_token;
104671
+ }
104672
+ const msid = oneApp ? auth?.metaSiteId ?? "" : "";
104673
+ if (!/^[0-9a-fA-F-]{10,64}$/.test(msid)) return undefined;
104674
+ 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" });
104675
+ const visitor = (await mint.json()) as { signedInstance?: string; signedInstanceType?: string };
104676
+ return visitor.signedInstanceType === "Visitor" ? visitor.signedInstance : undefined;
104677
+ }
104678
+
104660
104679
  async function liveSeedIds(spec: LiveSeed): Promise<string[]> {
104661
104680
  try {
104662
104681
  const WIX = "https://www.wixapis.com";
104663
- const clientId = process.env.WIX_CLIENT_ID ?? (config as { auth?: { config?: { clientId?: string } } }).auth?.config?.clientId ?? "";
104664
- if (!clientId || clientId.startsWith("YOUR_")) return [];
104665
- const mint = await fetch(WIX + "/oauth2/token", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ clientId, grantType: "anonymous" }) });
104666
- const token = ((await mint.json()) as { access_token?: string }).access_token;
104682
+ const token = await liveSeedToken(WIX);
104667
104683
  if (!token) return [];
104668
104684
  const res = await fetch(WIX + spec.path, { method: "POST", headers: { Authorization: token, "Content-Type": "application/json" }, body: JSON.stringify(spec.body) });
104669
104685
  const json = (await res.json()) as Record<string, unknown>;
@@ -24821,15 +24821,31 @@ const TEMPLATED: { pattern: string; display: string; liveSeed?: LiveSeed; static
24821
24821
 
24822
24822
  // Live seed-id enumeration: a published release serves only EXACT screens, so
24823
24823
  // `himi push` bakes each templated detail route's CURRENT catalog ids as exact
24824
- // screens via `seedIds`. Anonymous visitor rung against this app's own clientId;
24825
- // best-effort (offline build → no baked details, preview still live-resolves).
24824
+ // screens via `seedIds`. Anonymous visitor rung against this app's own clientId — or,
24825
+ // for an app bound through the One App visitor identity (`visitorSource: "one-app"`,
24826
+ // no client), that site's One App visitor instance. Best-effort (offline build → no
24827
+ // baked details, preview still live-resolves).
24828
+ async function liveSeedToken(WIX: string): Promise<string | undefined> {
24829
+ const auth = (config as { auth?: { config?: { clientId?: string; visitorSource?: string; metaSiteId?: string } } }).auth?.config;
24830
+ // A One App binding boots as the site's One App visitor, so the seed reads as that visitor too —
24831
+ // even beside a member-login clientId, and never repointed by a stray local WIX_CLIENT_ID.
24832
+ const oneApp = auth?.visitorSource === "one-app";
24833
+ const clientId = oneApp ? "" : process.env.WIX_CLIENT_ID ?? auth?.clientId ?? "";
24834
+ if (clientId && !clientId.startsWith("YOUR_")) {
24835
+ const mint = await fetch(WIX + "/oauth2/token", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ clientId, grantType: "anonymous" }) });
24836
+ return ((await mint.json()) as { access_token?: string }).access_token;
24837
+ }
24838
+ const msid = oneApp ? auth?.metaSiteId ?? "" : "";
24839
+ if (!/^[0-9a-fA-F-]{10,64}$/.test(msid)) return undefined;
24840
+ 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" });
24841
+ const visitor = (await mint.json()) as { signedInstance?: string; signedInstanceType?: string };
24842
+ return visitor.signedInstanceType === "Visitor" ? visitor.signedInstance : undefined;
24843
+ }
24844
+
24826
24845
  async function liveSeedIds(spec: LiveSeed): Promise<string[]> {
24827
24846
  try {
24828
24847
  const WIX = "https://www.wixapis.com";
24829
- const clientId = process.env.WIX_CLIENT_ID ?? (config as { auth?: { config?: { clientId?: string } } }).auth?.config?.clientId ?? "";
24830
- if (!clientId || clientId.startsWith("YOUR_")) return [];
24831
- const mint = await fetch(WIX + "/oauth2/token", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ clientId, grantType: "anonymous" }) });
24832
- const token = ((await mint.json()) as { access_token?: string }).access_token;
24848
+ const token = await liveSeedToken(WIX);
24833
24849
  if (!token) return [];
24834
24850
  const res = await fetch(WIX + spec.path, { method: "POST", headers: { Authorization: token, "Content-Type": "application/json" }, body: JSON.stringify(spec.body) });
24835
24851
  const json = (await res.json()) as Record<string, unknown>;
@@ -85002,15 +85002,31 @@ const TEMPLATED: { pattern: string; display: string; liveSeed?: LiveSeed; static
85002
85002
 
85003
85003
  // Live seed-id enumeration: a published release serves only EXACT screens, so
85004
85004
  // `himi push` bakes each templated detail route's CURRENT catalog ids as exact
85005
- // screens via `seedIds`. Anonymous visitor rung against this app's own clientId;
85006
- // best-effort (offline build → no baked details, preview still live-resolves).
85005
+ // screens via `seedIds`. Anonymous visitor rung against this app's own clientId — or,
85006
+ // for an app bound through the One App visitor identity (`visitorSource: "one-app"`,
85007
+ // no client), that site's One App visitor instance. Best-effort (offline build → no
85008
+ // baked details, preview still live-resolves).
85009
+ async function liveSeedToken(WIX: string): Promise<string | undefined> {
85010
+ const auth = (config as { auth?: { config?: { clientId?: string; visitorSource?: string; metaSiteId?: string } } }).auth?.config;
85011
+ // A One App binding boots as the site's One App visitor, so the seed reads as that visitor too —
85012
+ // even beside a member-login clientId, and never repointed by a stray local WIX_CLIENT_ID.
85013
+ const oneApp = auth?.visitorSource === "one-app";
85014
+ const clientId = oneApp ? "" : process.env.WIX_CLIENT_ID ?? auth?.clientId ?? "";
85015
+ if (clientId && !clientId.startsWith("YOUR_")) {
85016
+ const mint = await fetch(WIX + "/oauth2/token", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ clientId, grantType: "anonymous" }) });
85017
+ return ((await mint.json()) as { access_token?: string }).access_token;
85018
+ }
85019
+ const msid = oneApp ? auth?.metaSiteId ?? "" : "";
85020
+ if (!/^[0-9a-fA-F-]{10,64}$/.test(msid)) return undefined;
85021
+ 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" });
85022
+ const visitor = (await mint.json()) as { signedInstance?: string; signedInstanceType?: string };
85023
+ return visitor.signedInstanceType === "Visitor" ? visitor.signedInstance : undefined;
85024
+ }
85025
+
85007
85026
  async function liveSeedIds(spec: LiveSeed): Promise<string[]> {
85008
85027
  try {
85009
85028
  const WIX = "https://www.wixapis.com";
85010
- const clientId = process.env.WIX_CLIENT_ID ?? (config as { auth?: { config?: { clientId?: string } } }).auth?.config?.clientId ?? "";
85011
- if (!clientId || clientId.startsWith("YOUR_")) return [];
85012
- const mint = await fetch(WIX + "/oauth2/token", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ clientId, grantType: "anonymous" }) });
85013
- const token = ((await mint.json()) as { access_token?: string }).access_token;
85029
+ const token = await liveSeedToken(WIX);
85014
85030
  if (!token) return [];
85015
85031
  const res = await fetch(WIX + spec.path, { method: "POST", headers: { Authorization: token, "Content-Type": "application/json" }, body: JSON.stringify(spec.body) });
85016
85032
  const json = (await res.json()) as Record<string, unknown>;
@@ -22326,15 +22326,31 @@ const TEMPLATED: { pattern: string; display: string; liveSeed?: LiveSeed; static
22326
22326
 
22327
22327
  // Live seed-id enumeration: a published release serves only EXACT screens, so
22328
22328
  // `himi push` bakes each templated detail route's CURRENT catalog ids as exact
22329
- // screens via `seedIds`. Anonymous visitor rung against this app's own clientId;
22330
- // best-effort (offline build → no baked details, preview still live-resolves).
22329
+ // screens via `seedIds`. Anonymous visitor rung against this app's own clientId — or,
22330
+ // for an app bound through the One App visitor identity (`visitorSource: "one-app"`,
22331
+ // no client), that site's One App visitor instance. Best-effort (offline build → no
22332
+ // baked details, preview still live-resolves).
22333
+ async function liveSeedToken(WIX: string): Promise<string | undefined> {
22334
+ const auth = (config as { auth?: { config?: { clientId?: string; visitorSource?: string; metaSiteId?: string } } }).auth?.config;
22335
+ // A One App binding boots as the site's One App visitor, so the seed reads as that visitor too —
22336
+ // even beside a member-login clientId, and never repointed by a stray local WIX_CLIENT_ID.
22337
+ const oneApp = auth?.visitorSource === "one-app";
22338
+ const clientId = oneApp ? "" : process.env.WIX_CLIENT_ID ?? auth?.clientId ?? "";
22339
+ if (clientId && !clientId.startsWith("YOUR_")) {
22340
+ const mint = await fetch(WIX + "/oauth2/token", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ clientId, grantType: "anonymous" }) });
22341
+ return ((await mint.json()) as { access_token?: string }).access_token;
22342
+ }
22343
+ const msid = oneApp ? auth?.metaSiteId ?? "" : "";
22344
+ if (!/^[0-9a-fA-F-]{10,64}$/.test(msid)) return undefined;
22345
+ 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" });
22346
+ const visitor = (await mint.json()) as { signedInstance?: string; signedInstanceType?: string };
22347
+ return visitor.signedInstanceType === "Visitor" ? visitor.signedInstance : undefined;
22348
+ }
22349
+
22331
22350
  async function liveSeedIds(spec: LiveSeed): Promise<string[]> {
22332
22351
  try {
22333
22352
  const WIX = "https://www.wixapis.com";
22334
- const clientId = process.env.WIX_CLIENT_ID ?? (config as { auth?: { config?: { clientId?: string } } }).auth?.config?.clientId ?? "";
22335
- if (!clientId || clientId.startsWith("YOUR_")) return [];
22336
- const mint = await fetch(WIX + "/oauth2/token", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ clientId, grantType: "anonymous" }) });
22337
- const token = ((await mint.json()) as { access_token?: string }).access_token;
22353
+ const token = await liveSeedToken(WIX);
22338
22354
  if (!token) return [];
22339
22355
  const res = await fetch(WIX + spec.path, { method: "POST", headers: { Authorization: token, "Content-Type": "application/json" }, body: JSON.stringify(spec.body) });
22340
22356
  const json = (await res.json()) as Record<string, unknown>;
@@ -76399,15 +76399,31 @@ const TEMPLATED: { pattern: string; display: string; liveSeed?: LiveSeed; static
76399
76399
 
76400
76400
  // Live seed-id enumeration: a published release serves only EXACT screens, so
76401
76401
  // `himi push` bakes each templated detail route's CURRENT catalog ids as exact
76402
- // screens via `seedIds`. Anonymous visitor rung against this app's own clientId;
76403
- // best-effort (offline build → no baked details, preview still live-resolves).
76402
+ // screens via `seedIds`. Anonymous visitor rung against this app's own clientId — or,
76403
+ // for an app bound through the One App visitor identity (`visitorSource: "one-app"`,
76404
+ // no client), that site's One App visitor instance. Best-effort (offline build → no
76405
+ // baked details, preview still live-resolves).
76406
+ async function liveSeedToken(WIX: string): Promise<string | undefined> {
76407
+ const auth = (config as { auth?: { config?: { clientId?: string; visitorSource?: string; metaSiteId?: string } } }).auth?.config;
76408
+ // A One App binding boots as the site's One App visitor, so the seed reads as that visitor too —
76409
+ // even beside a member-login clientId, and never repointed by a stray local WIX_CLIENT_ID.
76410
+ const oneApp = auth?.visitorSource === "one-app";
76411
+ const clientId = oneApp ? "" : process.env.WIX_CLIENT_ID ?? auth?.clientId ?? "";
76412
+ if (clientId && !clientId.startsWith("YOUR_")) {
76413
+ const mint = await fetch(WIX + "/oauth2/token", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ clientId, grantType: "anonymous" }) });
76414
+ return ((await mint.json()) as { access_token?: string }).access_token;
76415
+ }
76416
+ const msid = oneApp ? auth?.metaSiteId ?? "" : "";
76417
+ if (!/^[0-9a-fA-F-]{10,64}$/.test(msid)) return undefined;
76418
+ 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" });
76419
+ const visitor = (await mint.json()) as { signedInstance?: string; signedInstanceType?: string };
76420
+ return visitor.signedInstanceType === "Visitor" ? visitor.signedInstance : undefined;
76421
+ }
76422
+
76404
76423
  async function liveSeedIds(spec: LiveSeed): Promise<string[]> {
76405
76424
  try {
76406
76425
  const WIX = "https://www.wixapis.com";
76407
- const clientId = process.env.WIX_CLIENT_ID ?? (config as { auth?: { config?: { clientId?: string } } }).auth?.config?.clientId ?? "";
76408
- if (!clientId || clientId.startsWith("YOUR_")) return [];
76409
- const mint = await fetch(WIX + "/oauth2/token", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ clientId, grantType: "anonymous" }) });
76410
- const token = ((await mint.json()) as { access_token?: string }).access_token;
76426
+ const token = await liveSeedToken(WIX);
76411
76427
  if (!token) return [];
76412
76428
  const res = await fetch(WIX + spec.path, { method: "POST", headers: { Authorization: token, "Content-Type": "application/json" }, body: JSON.stringify(spec.body) });
76413
76429
  const json = (await res.json()) as Record<string, unknown>;
@@ -49075,15 +49075,31 @@ const TEMPLATED: { pattern: string; display: string; liveSeed?: LiveSeed; static
49075
49075
 
49076
49076
  // Live seed-id enumeration: a published release serves only EXACT screens, so
49077
49077
  // `himi push` bakes each templated detail route's CURRENT catalog ids as exact
49078
- // screens via `seedIds`. Anonymous visitor rung against this app's own clientId;
49079
- // best-effort (offline build → no baked details, preview still live-resolves).
49078
+ // screens via `seedIds`. Anonymous visitor rung against this app's own clientId — or,
49079
+ // for an app bound through the One App visitor identity (`visitorSource: "one-app"`,
49080
+ // no client), that site's One App visitor instance. Best-effort (offline build → no
49081
+ // baked details, preview still live-resolves).
49082
+ async function liveSeedToken(WIX: string): Promise<string | undefined> {
49083
+ const auth = (config as { auth?: { config?: { clientId?: string; visitorSource?: string; metaSiteId?: string } } }).auth?.config;
49084
+ // A One App binding boots as the site's One App visitor, so the seed reads as that visitor too —
49085
+ // even beside a member-login clientId, and never repointed by a stray local WIX_CLIENT_ID.
49086
+ const oneApp = auth?.visitorSource === "one-app";
49087
+ const clientId = oneApp ? "" : process.env.WIX_CLIENT_ID ?? auth?.clientId ?? "";
49088
+ if (clientId && !clientId.startsWith("YOUR_")) {
49089
+ const mint = await fetch(WIX + "/oauth2/token", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ clientId, grantType: "anonymous" }) });
49090
+ return ((await mint.json()) as { access_token?: string }).access_token;
49091
+ }
49092
+ const msid = oneApp ? auth?.metaSiteId ?? "" : "";
49093
+ if (!/^[0-9a-fA-F-]{10,64}$/.test(msid)) return undefined;
49094
+ 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" });
49095
+ const visitor = (await mint.json()) as { signedInstance?: string; signedInstanceType?: string };
49096
+ return visitor.signedInstanceType === "Visitor" ? visitor.signedInstance : undefined;
49097
+ }
49098
+
49080
49099
  async function liveSeedIds(spec: LiveSeed): Promise<string[]> {
49081
49100
  try {
49082
49101
  const WIX = "https://www.wixapis.com";
49083
- const clientId = process.env.WIX_CLIENT_ID ?? (config as { auth?: { config?: { clientId?: string } } }).auth?.config?.clientId ?? "";
49084
- if (!clientId || clientId.startsWith("YOUR_")) return [];
49085
- const mint = await fetch(WIX + "/oauth2/token", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ clientId, grantType: "anonymous" }) });
49086
- const token = ((await mint.json()) as { access_token?: string }).access_token;
49102
+ const token = await liveSeedToken(WIX);
49087
49103
  if (!token) return [];
49088
49104
  const res = await fetch(WIX + spec.path, { method: "POST", headers: { Authorization: token, "Content-Type": "application/json" }, body: JSON.stringify(spec.body) });
49089
49105
  const json = (await res.json()) as Record<string, unknown>;
@@ -90716,15 +90716,31 @@ const TEMPLATED: { pattern: string; display: string; liveSeed?: LiveSeed; static
90716
90716
 
90717
90717
  // Live seed-id enumeration: a published release serves only EXACT screens, so
90718
90718
  // `himi push` bakes each templated detail route's CURRENT catalog ids as exact
90719
- // screens via `seedIds`. Anonymous visitor rung against this app's own clientId;
90720
- // best-effort (offline build → no baked details, preview still live-resolves).
90719
+ // screens via `seedIds`. Anonymous visitor rung against this app's own clientId — or,
90720
+ // for an app bound through the One App visitor identity (`visitorSource: "one-app"`,
90721
+ // no client), that site's One App visitor instance. Best-effort (offline build → no
90722
+ // baked details, preview still live-resolves).
90723
+ async function liveSeedToken(WIX: string): Promise<string | undefined> {
90724
+ const auth = (config as { auth?: { config?: { clientId?: string; visitorSource?: string; metaSiteId?: string } } }).auth?.config;
90725
+ // A One App binding boots as the site's One App visitor, so the seed reads as that visitor too —
90726
+ // even beside a member-login clientId, and never repointed by a stray local WIX_CLIENT_ID.
90727
+ const oneApp = auth?.visitorSource === "one-app";
90728
+ const clientId = oneApp ? "" : process.env.WIX_CLIENT_ID ?? auth?.clientId ?? "";
90729
+ if (clientId && !clientId.startsWith("YOUR_")) {
90730
+ const mint = await fetch(WIX + "/oauth2/token", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ clientId, grantType: "anonymous" }) });
90731
+ return ((await mint.json()) as { access_token?: string }).access_token;
90732
+ }
90733
+ const msid = oneApp ? auth?.metaSiteId ?? "" : "";
90734
+ if (!/^[0-9a-fA-F-]{10,64}$/.test(msid)) return undefined;
90735
+ 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" });
90736
+ const visitor = (await mint.json()) as { signedInstance?: string; signedInstanceType?: string };
90737
+ return visitor.signedInstanceType === "Visitor" ? visitor.signedInstance : undefined;
90738
+ }
90739
+
90721
90740
  async function liveSeedIds(spec: LiveSeed): Promise<string[]> {
90722
90741
  try {
90723
90742
  const WIX = "https://www.wixapis.com";
90724
- const clientId = process.env.WIX_CLIENT_ID ?? (config as { auth?: { config?: { clientId?: string } } }).auth?.config?.clientId ?? "";
90725
- if (!clientId || clientId.startsWith("YOUR_")) return [];
90726
- const mint = await fetch(WIX + "/oauth2/token", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ clientId, grantType: "anonymous" }) });
90727
- const token = ((await mint.json()) as { access_token?: string }).access_token;
90743
+ const token = await liveSeedToken(WIX);
90728
90744
  if (!token) return [];
90729
90745
  const res = await fetch(WIX + spec.path, { method: "POST", headers: { Authorization: token, "Content-Type": "application/json" }, body: JSON.stringify(spec.body) });
90730
90746
  const json = (await res.json()) as Record<string, unknown>;
@@ -1799,15 +1799,31 @@ const TEMPLATED: { pattern: string; display: string; liveSeed?: LiveSeed; static
1799
1799
 
1800
1800
  // Live seed-id enumeration: a published release serves only EXACT screens, so
1801
1801
  // `himi push` bakes each templated detail route's CURRENT catalog ids as exact
1802
- // screens via `seedIds`. Anonymous visitor rung against this app's own clientId;
1803
- // best-effort (offline build → no baked details, preview still live-resolves).
1802
+ // screens via `seedIds`. Anonymous visitor rung against this app's own clientId — or,
1803
+ // for an app bound through the One App visitor identity (`visitorSource: "one-app"`,
1804
+ // no client), that site's One App visitor instance. Best-effort (offline build → no
1805
+ // baked details, preview still live-resolves).
1806
+ async function liveSeedToken(WIX: string): Promise<string | undefined> {
1807
+ const auth = (config as { auth?: { config?: { clientId?: string; visitorSource?: string; metaSiteId?: string } } }).auth?.config;
1808
+ // A One App binding boots as the site's One App visitor, so the seed reads as that visitor too —
1809
+ // even beside a member-login clientId, and never repointed by a stray local WIX_CLIENT_ID.
1810
+ const oneApp = auth?.visitorSource === "one-app";
1811
+ const clientId = oneApp ? "" : process.env.WIX_CLIENT_ID ?? auth?.clientId ?? "";
1812
+ if (clientId && !clientId.startsWith("YOUR_")) {
1813
+ const mint = await fetch(WIX + "/oauth2/token", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ clientId, grantType: "anonymous" }) });
1814
+ return ((await mint.json()) as { access_token?: string }).access_token;
1815
+ }
1816
+ const msid = oneApp ? auth?.metaSiteId ?? "" : "";
1817
+ if (!/^[0-9a-fA-F-]{10,64}$/.test(msid)) return undefined;
1818
+ 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" });
1819
+ const visitor = (await mint.json()) as { signedInstance?: string; signedInstanceType?: string };
1820
+ return visitor.signedInstanceType === "Visitor" ? visitor.signedInstance : undefined;
1821
+ }
1822
+
1804
1823
  async function liveSeedIds(spec: LiveSeed): Promise<string[]> {
1805
1824
  try {
1806
1825
  const WIX = "https://www.wixapis.com";
1807
- const clientId = process.env.WIX_CLIENT_ID ?? (config as { auth?: { config?: { clientId?: string } } }).auth?.config?.clientId ?? "";
1808
- if (!clientId || clientId.startsWith("YOUR_")) return [];
1809
- const mint = await fetch(WIX + "/oauth2/token", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ clientId, grantType: "anonymous" }) });
1810
- const token = ((await mint.json()) as { access_token?: string }).access_token;
1826
+ const token = await liveSeedToken(WIX);
1811
1827
  if (!token) return [];
1812
1828
  const res = await fetch(WIX + spec.path, { method: "POST", headers: { Authorization: token, "Content-Type": "application/json" }, body: JSON.stringify(spec.body) });
1813
1829
  const json = (await res.json()) as Record<string, unknown>;
@@ -26721,15 +26721,31 @@ const TEMPLATED: { pattern: string; display: string; liveSeed?: LiveSeed; static
26721
26721
 
26722
26722
  // Live seed-id enumeration: a published release serves only EXACT screens, so
26723
26723
  // `himi push` bakes each templated detail route's CURRENT catalog ids as exact
26724
- // screens via `seedIds`. Anonymous visitor rung against this app's own clientId;
26725
- // best-effort (offline build → no baked details, preview still live-resolves).
26724
+ // screens via `seedIds`. Anonymous visitor rung against this app's own clientId — or,
26725
+ // for an app bound through the One App visitor identity (`visitorSource: "one-app"`,
26726
+ // no client), that site's One App visitor instance. Best-effort (offline build → no
26727
+ // baked details, preview still live-resolves).
26728
+ async function liveSeedToken(WIX: string): Promise<string | undefined> {
26729
+ const auth = (config as { auth?: { config?: { clientId?: string; visitorSource?: string; metaSiteId?: string } } }).auth?.config;
26730
+ // A One App binding boots as the site's One App visitor, so the seed reads as that visitor too —
26731
+ // even beside a member-login clientId, and never repointed by a stray local WIX_CLIENT_ID.
26732
+ const oneApp = auth?.visitorSource === "one-app";
26733
+ const clientId = oneApp ? "" : process.env.WIX_CLIENT_ID ?? auth?.clientId ?? "";
26734
+ if (clientId && !clientId.startsWith("YOUR_")) {
26735
+ const mint = await fetch(WIX + "/oauth2/token", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ clientId, grantType: "anonymous" }) });
26736
+ return ((await mint.json()) as { access_token?: string }).access_token;
26737
+ }
26738
+ const msid = oneApp ? auth?.metaSiteId ?? "" : "";
26739
+ if (!/^[0-9a-fA-F-]{10,64}$/.test(msid)) return undefined;
26740
+ 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" });
26741
+ const visitor = (await mint.json()) as { signedInstance?: string; signedInstanceType?: string };
26742
+ return visitor.signedInstanceType === "Visitor" ? visitor.signedInstance : undefined;
26743
+ }
26744
+
26726
26745
  async function liveSeedIds(spec: LiveSeed): Promise<string[]> {
26727
26746
  try {
26728
26747
  const WIX = "https://www.wixapis.com";
26729
- const clientId = process.env.WIX_CLIENT_ID ?? (config as { auth?: { config?: { clientId?: string } } }).auth?.config?.clientId ?? "";
26730
- if (!clientId || clientId.startsWith("YOUR_")) return [];
26731
- const mint = await fetch(WIX + "/oauth2/token", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ clientId, grantType: "anonymous" }) });
26732
- const token = ((await mint.json()) as { access_token?: string }).access_token;
26748
+ const token = await liveSeedToken(WIX);
26733
26749
  if (!token) return [];
26734
26750
  const res = await fetch(WIX + spec.path, { method: "POST", headers: { Authorization: token, "Content-Type": "application/json" }, body: JSON.stringify(spec.body) });
26735
26751
  const json = (await res.json()) as Record<string, unknown>;
@@ -82115,15 +82115,31 @@ const TEMPLATED: { pattern: string; display: string; liveSeed?: LiveSeed; static
82115
82115
 
82116
82116
  // Live seed-id enumeration: a published release serves only EXACT screens, so
82117
82117
  // `himi push` bakes each templated detail route's CURRENT catalog ids as exact
82118
- // screens via `seedIds`. Anonymous visitor rung against this app's own clientId;
82119
- // best-effort (offline build → no baked details, preview still live-resolves).
82118
+ // screens via `seedIds`. Anonymous visitor rung against this app's own clientId — or,
82119
+ // for an app bound through the One App visitor identity (`visitorSource: "one-app"`,
82120
+ // no client), that site's One App visitor instance. Best-effort (offline build → no
82121
+ // baked details, preview still live-resolves).
82122
+ async function liveSeedToken(WIX: string): Promise<string | undefined> {
82123
+ const auth = (config as { auth?: { config?: { clientId?: string; visitorSource?: string; metaSiteId?: string } } }).auth?.config;
82124
+ // A One App binding boots as the site's One App visitor, so the seed reads as that visitor too —
82125
+ // even beside a member-login clientId, and never repointed by a stray local WIX_CLIENT_ID.
82126
+ const oneApp = auth?.visitorSource === "one-app";
82127
+ const clientId = oneApp ? "" : process.env.WIX_CLIENT_ID ?? auth?.clientId ?? "";
82128
+ if (clientId && !clientId.startsWith("YOUR_")) {
82129
+ const mint = await fetch(WIX + "/oauth2/token", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ clientId, grantType: "anonymous" }) });
82130
+ return ((await mint.json()) as { access_token?: string }).access_token;
82131
+ }
82132
+ const msid = oneApp ? auth?.metaSiteId ?? "" : "";
82133
+ if (!/^[0-9a-fA-F-]{10,64}$/.test(msid)) return undefined;
82134
+ 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" });
82135
+ const visitor = (await mint.json()) as { signedInstance?: string; signedInstanceType?: string };
82136
+ return visitor.signedInstanceType === "Visitor" ? visitor.signedInstance : undefined;
82137
+ }
82138
+
82120
82139
  async function liveSeedIds(spec: LiveSeed): Promise<string[]> {
82121
82140
  try {
82122
82141
  const WIX = "https://www.wixapis.com";
82123
- const clientId = process.env.WIX_CLIENT_ID ?? (config as { auth?: { config?: { clientId?: string } } }).auth?.config?.clientId ?? "";
82124
- if (!clientId || clientId.startsWith("YOUR_")) return [];
82125
- const mint = await fetch(WIX + "/oauth2/token", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ clientId, grantType: "anonymous" }) });
82126
- const token = ((await mint.json()) as { access_token?: string }).access_token;
82142
+ const token = await liveSeedToken(WIX);
82127
82143
  if (!token) return [];
82128
82144
  const res = await fetch(WIX + spec.path, { method: "POST", headers: { Authorization: token, "Content-Type": "application/json" }, body: JSON.stringify(spec.body) });
82129
82145
  const json = (await res.json()) as Record<string, unknown>;
@@ -93008,15 +93008,31 @@ const TEMPLATED: { pattern: string; display: string; liveSeed?: LiveSeed; static
93008
93008
 
93009
93009
  // Live seed-id enumeration: a published release serves only EXACT screens, so
93010
93010
  // `himi push` bakes each templated detail route's CURRENT catalog ids as exact
93011
- // screens via `seedIds`. Anonymous visitor rung against this app's own clientId;
93012
- // best-effort (offline build → no baked details, preview still live-resolves).
93011
+ // screens via `seedIds`. Anonymous visitor rung against this app's own clientId — or,
93012
+ // for an app bound through the One App visitor identity (`visitorSource: "one-app"`,
93013
+ // no client), that site's One App visitor instance. Best-effort (offline build → no
93014
+ // baked details, preview still live-resolves).
93015
+ async function liveSeedToken(WIX: string): Promise<string | undefined> {
93016
+ const auth = (config as { auth?: { config?: { clientId?: string; visitorSource?: string; metaSiteId?: string } } }).auth?.config;
93017
+ // A One App binding boots as the site's One App visitor, so the seed reads as that visitor too —
93018
+ // even beside a member-login clientId, and never repointed by a stray local WIX_CLIENT_ID.
93019
+ const oneApp = auth?.visitorSource === "one-app";
93020
+ const clientId = oneApp ? "" : process.env.WIX_CLIENT_ID ?? auth?.clientId ?? "";
93021
+ if (clientId && !clientId.startsWith("YOUR_")) {
93022
+ const mint = await fetch(WIX + "/oauth2/token", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ clientId, grantType: "anonymous" }) });
93023
+ return ((await mint.json()) as { access_token?: string }).access_token;
93024
+ }
93025
+ const msid = oneApp ? auth?.metaSiteId ?? "" : "";
93026
+ if (!/^[0-9a-fA-F-]{10,64}$/.test(msid)) return undefined;
93027
+ 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" });
93028
+ const visitor = (await mint.json()) as { signedInstance?: string; signedInstanceType?: string };
93029
+ return visitor.signedInstanceType === "Visitor" ? visitor.signedInstance : undefined;
93030
+ }
93031
+
93013
93032
  async function liveSeedIds(spec: LiveSeed): Promise<string[]> {
93014
93033
  try {
93015
93034
  const WIX = "https://www.wixapis.com";
93016
- const clientId = process.env.WIX_CLIENT_ID ?? (config as { auth?: { config?: { clientId?: string } } }).auth?.config?.clientId ?? "";
93017
- if (!clientId || clientId.startsWith("YOUR_")) return [];
93018
- const mint = await fetch(WIX + "/oauth2/token", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ clientId, grantType: "anonymous" }) });
93019
- const token = ((await mint.json()) as { access_token?: string }).access_token;
93035
+ const token = await liveSeedToken(WIX);
93020
93036
  if (!token) return [];
93021
93037
  const res = await fetch(WIX + spec.path, { method: "POST", headers: { Authorization: token, "Content-Type": "application/json" }, body: JSON.stringify(spec.body) });
93022
93038
  const json = (await res.json()) as Record<string, unknown>;
@@ -26770,15 +26770,31 @@ const TEMPLATED: { pattern: string; display: string; liveSeed?: LiveSeed; static
26770
26770
 
26771
26771
  // Live seed-id enumeration: a published release serves only EXACT screens, so
26772
26772
  // `himi push` bakes each templated detail route's CURRENT catalog ids as exact
26773
- // screens via `seedIds`. Anonymous visitor rung against this app's own clientId;
26774
- // best-effort (offline build → no baked details, preview still live-resolves).
26773
+ // screens via `seedIds`. Anonymous visitor rung against this app's own clientId — or,
26774
+ // for an app bound through the One App visitor identity (`visitorSource: "one-app"`,
26775
+ // no client), that site's One App visitor instance. Best-effort (offline build → no
26776
+ // baked details, preview still live-resolves).
26777
+ async function liveSeedToken(WIX: string): Promise<string | undefined> {
26778
+ const auth = (config as { auth?: { config?: { clientId?: string; visitorSource?: string; metaSiteId?: string } } }).auth?.config;
26779
+ // A One App binding boots as the site's One App visitor, so the seed reads as that visitor too —
26780
+ // even beside a member-login clientId, and never repointed by a stray local WIX_CLIENT_ID.
26781
+ const oneApp = auth?.visitorSource === "one-app";
26782
+ const clientId = oneApp ? "" : process.env.WIX_CLIENT_ID ?? auth?.clientId ?? "";
26783
+ if (clientId && !clientId.startsWith("YOUR_")) {
26784
+ const mint = await fetch(WIX + "/oauth2/token", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ clientId, grantType: "anonymous" }) });
26785
+ return ((await mint.json()) as { access_token?: string }).access_token;
26786
+ }
26787
+ const msid = oneApp ? auth?.metaSiteId ?? "" : "";
26788
+ if (!/^[0-9a-fA-F-]{10,64}$/.test(msid)) return undefined;
26789
+ 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" });
26790
+ const visitor = (await mint.json()) as { signedInstance?: string; signedInstanceType?: string };
26791
+ return visitor.signedInstanceType === "Visitor" ? visitor.signedInstance : undefined;
26792
+ }
26793
+
26775
26794
  async function liveSeedIds(spec: LiveSeed): Promise<string[]> {
26776
26795
  try {
26777
26796
  const WIX = "https://www.wixapis.com";
26778
- const clientId = process.env.WIX_CLIENT_ID ?? (config as { auth?: { config?: { clientId?: string } } }).auth?.config?.clientId ?? "";
26779
- if (!clientId || clientId.startsWith("YOUR_")) return [];
26780
- const mint = await fetch(WIX + "/oauth2/token", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ clientId, grantType: "anonymous" }) });
26781
- const token = ((await mint.json()) as { access_token?: string }).access_token;
26797
+ const token = await liveSeedToken(WIX);
26782
26798
  if (!token) return [];
26783
26799
  const res = await fetch(WIX + spec.path, { method: "POST", headers: { Authorization: token, "Content-Type": "application/json" }, body: JSON.stringify(spec.body) });
26784
26800
  const json = (await res.json()) as Record<string, unknown>;
@@ -85003,15 +85003,31 @@ const TEMPLATED: { pattern: string; display: string; liveSeed?: LiveSeed; static
85003
85003
 
85004
85004
  // Live seed-id enumeration: a published release serves only EXACT screens, so
85005
85005
  // `himi push` bakes each templated detail route's CURRENT catalog ids as exact
85006
- // screens via `seedIds`. Anonymous visitor rung against this app's own clientId;
85007
- // best-effort (offline build → no baked details, preview still live-resolves).
85006
+ // screens via `seedIds`. Anonymous visitor rung against this app's own clientId — or,
85007
+ // for an app bound through the One App visitor identity (`visitorSource: "one-app"`,
85008
+ // no client), that site's One App visitor instance. Best-effort (offline build → no
85009
+ // baked details, preview still live-resolves).
85010
+ async function liveSeedToken(WIX: string): Promise<string | undefined> {
85011
+ const auth = (config as { auth?: { config?: { clientId?: string; visitorSource?: string; metaSiteId?: string } } }).auth?.config;
85012
+ // A One App binding boots as the site's One App visitor, so the seed reads as that visitor too —
85013
+ // even beside a member-login clientId, and never repointed by a stray local WIX_CLIENT_ID.
85014
+ const oneApp = auth?.visitorSource === "one-app";
85015
+ const clientId = oneApp ? "" : process.env.WIX_CLIENT_ID ?? auth?.clientId ?? "";
85016
+ if (clientId && !clientId.startsWith("YOUR_")) {
85017
+ const mint = await fetch(WIX + "/oauth2/token", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ clientId, grantType: "anonymous" }) });
85018
+ return ((await mint.json()) as { access_token?: string }).access_token;
85019
+ }
85020
+ const msid = oneApp ? auth?.metaSiteId ?? "" : "";
85021
+ if (!/^[0-9a-fA-F-]{10,64}$/.test(msid)) return undefined;
85022
+ 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" });
85023
+ const visitor = (await mint.json()) as { signedInstance?: string; signedInstanceType?: string };
85024
+ return visitor.signedInstanceType === "Visitor" ? visitor.signedInstance : undefined;
85025
+ }
85026
+
85008
85027
  async function liveSeedIds(spec: LiveSeed): Promise<string[]> {
85009
85028
  try {
85010
85029
  const WIX = "https://www.wixapis.com";
85011
- const clientId = process.env.WIX_CLIENT_ID ?? (config as { auth?: { config?: { clientId?: string } } }).auth?.config?.clientId ?? "";
85012
- if (!clientId || clientId.startsWith("YOUR_")) return [];
85013
- const mint = await fetch(WIX + "/oauth2/token", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ clientId, grantType: "anonymous" }) });
85014
- const token = ((await mint.json()) as { access_token?: string }).access_token;
85030
+ const token = await liveSeedToken(WIX);
85015
85031
  if (!token) return [];
85016
85032
  const res = await fetch(WIX + spec.path, { method: "POST", headers: { Authorization: token, "Content-Type": "application/json" }, body: JSON.stringify(spec.body) });
85017
85033
  const json = (await res.json()) as Record<string, unknown>;