@stackable-labs/embeddables 1.85.0 → 1.86.1

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/react.js CHANGED
@@ -5,7 +5,7 @@ import * as kn from "react-dom";
5
5
  import hs from "react-dom";
6
6
  const nl = () => {
7
7
  try {
8
- return "2715ab6a-67be-4430-9e11-929871b546ca";
8
+ return "9294d4ba-b080-4f5f-8b61-03af88280354";
9
9
  } catch {
10
10
  return "dev";
11
11
  }
@@ -16,18 +16,20 @@ const nl = () => {
16
16
  if (!e.bundleUrl)
17
17
  return console.warn(`[SandboxManager] Extension ${e.id} is missing bundleUrl — skipping sandbox creation`), null;
18
18
  const o = document.createElement("iframe");
19
- if (o.setAttribute("sandbox", "allow-scripts allow-same-origin"), o.style.display = "none", o.style.width = "0", o.style.height = "0", o.style.border = "none", e.bundleUrl.startsWith("http") && !e.bundleUrl.endsWith(".js")) {
20
- const i = new URL(e.bundleUrl);
21
- i.searchParams.set("__extensionId", e.id), o.src = i.toString(), console.warn(`[SandboxManager] Creating dev sandbox for ${e.id}, injecting __extensionId via query param, url: ${i.toString()}`);
19
+ o.setAttribute("sandbox", "allow-scripts allow-same-origin"), o.style.display = "none", o.style.width = "0", o.style.height = "0", o.style.border = "none";
20
+ const r = e.bundleUrl.startsWith("http") && !e.bundleUrl.endsWith(".js"), s = r ? new URL(e.bundleUrl).origin : "null";
21
+ if (r) {
22
+ const c = new URL(e.bundleUrl);
23
+ c.searchParams.set("__extensionId", e.id), o.src = c.toString(), console.warn(`[SandboxManager] Creating dev sandbox for ${e.id}, injecting __extensionId via query param, url: ${c.toString()}`);
22
24
  } else {
23
- let i = "";
25
+ let c = "";
24
26
  try {
25
- const d = nl();
26
- i = await (await fetch(`${e.bundleUrl}?_b=${d}`)).text();
27
- } catch (d) {
28
- console.error(`[SandboxManager] Failed to fetch bundle for ${e.id}:`, d);
27
+ const u = nl();
28
+ c = await (await fetch(`${e.bundleUrl}?_b=${u}`)).text();
29
+ } catch (u) {
30
+ console.error(`[SandboxManager] Failed to fetch bundle for ${e.id}:`, u);
29
31
  }
30
- const c = `<!DOCTYPE html>
32
+ const d = `<!DOCTYPE html>
31
33
  <html>
32
34
  <head>
33
35
  <meta charset="utf-8">
@@ -36,30 +38,34 @@ const nl = () => {
36
38
  <body>
37
39
  <div id="extension-root"></div>
38
40
  <script>var __STACKABLE_EXTENSION_ID__ = ${JSON.stringify(e.id)}; var process = { env: { NODE_ENV: "production" } };<\/script>
39
- <script type="module">${i}<\/script>
41
+ <script type="module">${c}<\/script>
40
42
  </body>
41
43
  </html>`;
42
- o.srcdoc = c, console.warn(`[SandboxManager] Creating srcdoc sandbox for ${e.id}, srcdoc starts with: ${c.substring(0, 300)}`);
44
+ o.srcdoc = d, console.warn(`[SandboxManager] Creating srcdoc sandbox for ${e.id}, srcdoc starts with: ${d.substring(0, 300)}`);
43
45
  }
44
46
  t.appendChild(o);
45
- const s = {
47
+ const a = {
46
48
  extensionId: e.id,
47
49
  iframe: o,
48
50
  manifest: e.manifest,
49
51
  ready: !1,
52
+ expectedOrigin: s,
50
53
  messageHandlers: /* @__PURE__ */ new Set()
51
- }, a = (i) => {
52
- const c = i.data;
53
- !c || typeof c != "object" || !("type" in c) || ("extensionId" in c ? c.extensionId : void 0) !== e.id || (c.type === "extension-ready" && (s.ready = !0), s.messageHandlers.forEach((u) => u(c)));
54
+ }, i = (c) => {
55
+ if (c.origin !== a.expectedOrigin)
56
+ return;
57
+ const d = c.data;
58
+ !d || typeof d != "object" || !("type" in d) || ("extensionId" in d ? d.extensionId : void 0) !== e.id || (d.type === "extension-ready" && (a.ready = !0), a.messageHandlers.forEach((l) => l(d)));
54
59
  };
55
- return window.addEventListener("message", a), dt.set(e.id, s), s;
60
+ return window.addEventListener("message", i), dt.set(e.id, a), a;
56
61
  }, $e = (e, t) => {
57
62
  const n = dt.get(e);
58
63
  if (!(n != null && n.iframe.contentWindow)) {
59
64
  console.warn(`Sandbox not found for extension: ${e}`);
60
65
  return;
61
66
  }
62
- n.iframe.contentWindow.postMessage(t, "*");
67
+ const o = n.expectedOrigin === "null" ? "*" : n.expectedOrigin;
68
+ n.iframe.contentWindow.postMessage(t, o);
63
69
  }, Nt = (e) => dt.get(e), rl = (e) => {
64
70
  const t = dt.get(e);
65
71
  t && (t.iframe.remove(), t.messageHandlers.clear(), dt.delete(e));
@@ -904,7 +910,7 @@ function Bl(e) {
904
910
  }
905
911
  const Hl = (e) => {
906
912
  var t, n, o, r, s, a, i, c, d;
907
- const { invert: u, toast: l, unstyled: m, interacting: h, setHeights: b, visibleToasts: g, heights: v, index: y, toasts: w, expanded: x, removeToast: C, defaultRichColors: R, closeButton: T, style: N, cancelButtonStyle: E, actionButtonStyle: L, className: W = "", descriptionClassName: M = "", duration: F, position: H, gap: O, expandByDefault: K, classNames: A, icons: D, closeButtonAriaLabel: U = "Close toast" } = e, [k, S] = I.useState(null), [_, $] = I.useState(null), [P, z] = I.useState(!1), [B, J] = I.useState(!1), [j, Y] = I.useState(!1), [ee, te] = I.useState(!1), [se, oe] = I.useState(!1), [ue, fe] = I.useState(0), [at, Ke] = I.useState(0), Te = I.useRef(l.duration || F || wr), Zt = I.useRef(null), ye = I.useRef(null), Wc = y === 0, Uc = y + 1 <= g, Se = l.type, gt = l.dismissible !== !1, jc = l.className || "", Gc = l.descriptionClassName || "", Jt = I.useMemo(() => v.findIndex((ne) => ne.toastId === l.id) || 0, [
913
+ const { invert: u, toast: l, unstyled: m, interacting: h, setHeights: b, visibleToasts: g, heights: v, index: y, toasts: w, expanded: x, removeToast: C, defaultRichColors: R, closeButton: T, style: N, cancelButtonStyle: E, actionButtonStyle: L, className: W = "", descriptionClassName: M = "", duration: F, position: H, gap: O, expandByDefault: K, classNames: A, icons: z, closeButtonAriaLabel: U = "Close toast" } = e, [k, S] = I.useState(null), [_, $] = I.useState(null), [P, D] = I.useState(!1), [B, J] = I.useState(!1), [j, Y] = I.useState(!1), [ee, te] = I.useState(!1), [se, oe] = I.useState(!1), [ue, fe] = I.useState(0), [at, Ke] = I.useState(0), Te = I.useRef(l.duration || F || wr), Zt = I.useRef(null), ye = I.useRef(null), Wc = y === 0, Uc = y + 1 <= g, Se = l.type, gt = l.dismissible !== !1, jc = l.className || "", Gc = l.descriptionClassName || "", Jt = I.useMemo(() => v.findIndex((ne) => ne.toastId === l.id) || 0, [
908
914
  v,
909
915
  l.id
910
916
  ]), Yc = I.useMemo(() => {
@@ -928,7 +934,7 @@ const Hl = (e) => {
928
934
  }, [
929
935
  fr
930
936
  ]), I.useEffect(() => {
931
- z(!0);
937
+ D(!0);
932
938
  }, []), I.useEffect(() => {
933
939
  const ne = ye.current;
934
940
  if (ne) {
@@ -1010,19 +1016,19 @@ const Hl = (e) => {
1010
1016
  ]);
1011
1017
  function Zc() {
1012
1018
  var ne;
1013
- if (D != null && D.loading) {
1019
+ if (z != null && z.loading) {
1014
1020
  var me;
1015
1021
  return /* @__PURE__ */ I.createElement("div", {
1016
1022
  className: ze(A == null ? void 0 : A.loader, l == null || (me = l.classNames) == null ? void 0 : me.loader, "sonner-loader"),
1017
1023
  "data-visible": Se === "loading"
1018
- }, D.loading);
1024
+ }, z.loading);
1019
1025
  }
1020
1026
  return /* @__PURE__ */ I.createElement(wl, {
1021
1027
  className: ze(A == null ? void 0 : A.loader, l == null || (ne = l.classNames) == null ? void 0 : ne.loader),
1022
1028
  visible: Se === "loading"
1023
1029
  });
1024
1030
  }
1025
- const Jc = l.icon || (D == null ? void 0 : D[Se]) || bl(Se);
1031
+ const Jc = l.icon || (z == null ? void 0 : z[Se]) || bl(Se);
1026
1032
  var gr, vr;
1027
1033
  return /* @__PURE__ */ I.createElement("li", {
1028
1034
  tabIndex: 0,
@@ -1118,7 +1124,7 @@ const Hl = (e) => {
1118
1124
  Xe(), l.onDismiss == null || l.onDismiss.call(l, l);
1119
1125
  },
1120
1126
  className: ze(A == null ? void 0 : A.closeButton, l == null || (o = l.classNames) == null ? void 0 : o.closeButton)
1121
- }, (vr = D == null ? void 0 : D.close) != null ? vr : kl) : null, (Se || l.icon || l.promise) && l.icon !== null && ((D == null ? void 0 : D[Se]) !== null || l.icon) ? /* @__PURE__ */ I.createElement("div", {
1127
+ }, (vr = z == null ? void 0 : z.close) != null ? vr : kl) : null, (Se || l.icon || l.promise) && l.icon !== null && ((z == null ? void 0 : z[Se]) !== null || l.icon) ? /* @__PURE__ */ I.createElement("div", {
1122
1128
  "data-icon": "",
1123
1129
  className: ze(A == null ? void 0 : A.icon, l == null || (r = l.classNames) == null ? void 0 : r.icon)
1124
1130
  }, l.promise || l.type === "loading" && !l.icon ? l.icon || Zc() : null, l.type !== "loading" ? Jc : null) : null, /* @__PURE__ */ I.createElement("div", {
@@ -1192,16 +1198,16 @@ const Wl = /* @__PURE__ */ I.forwardRef(function(t, n) {
1192
1198
  ].concat(E.filter((P) => P.position).map((P) => P.position)))), [
1193
1199
  E,
1194
1200
  s
1195
- ]), [W, M] = I.useState([]), [F, H] = I.useState(!1), [O, K] = I.useState(!1), [A, D] = I.useState(m !== "system" ? m : typeof window < "u" && window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light"), U = I.useRef(null), k = a.join("+").replace(/Key/g, "").replace(/Digit/g, ""), S = I.useRef(null), _ = I.useRef(!1), $ = I.useCallback((P) => {
1196
- N((z) => {
1201
+ ]), [W, M] = I.useState([]), [F, H] = I.useState(!1), [O, K] = I.useState(!1), [A, z] = I.useState(m !== "system" ? m : typeof window < "u" && window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light"), U = I.useRef(null), k = a.join("+").replace(/Key/g, "").replace(/Digit/g, ""), S = I.useRef(null), _ = I.useRef(!1), $ = I.useCallback((P) => {
1202
+ N((D) => {
1197
1203
  var B;
1198
- return (B = z.find((J) => J.id === P.id)) != null && B.delete || we.dismiss(P.id), z.filter(({ id: J }) => J !== P.id);
1204
+ return (B = D.find((J) => J.id === P.id)) != null && B.delete || we.dismiss(P.id), D.filter(({ id: J }) => J !== P.id);
1199
1205
  });
1200
1206
  }, []);
1201
1207
  return I.useEffect(() => we.subscribe((P) => {
1202
1208
  if (P.dismiss) {
1203
1209
  requestAnimationFrame(() => {
1204
- N((z) => z.map((B) => B.id === P.id ? {
1210
+ N((D) => D.map((B) => B.id === P.id ? {
1205
1211
  ...B,
1206
1212
  delete: !0
1207
1213
  } : B));
@@ -1210,18 +1216,18 @@ const Wl = /* @__PURE__ */ I.forwardRef(function(t, n) {
1210
1216
  }
1211
1217
  setTimeout(() => {
1212
1218
  hs.flushSync(() => {
1213
- N((z) => {
1214
- const B = z.findIndex((J) => J.id === P.id);
1219
+ N((D) => {
1220
+ const B = D.findIndex((J) => J.id === P.id);
1215
1221
  return B !== -1 ? [
1216
- ...z.slice(0, B),
1222
+ ...D.slice(0, B),
1217
1223
  {
1218
- ...z[B],
1224
+ ...D[B],
1219
1225
  ...P
1220
1226
  },
1221
- ...z.slice(B + 1)
1227
+ ...D.slice(B + 1)
1222
1228
  ] : [
1223
1229
  P,
1224
- ...z
1230
+ ...D
1225
1231
  ];
1226
1232
  });
1227
1233
  });
@@ -1230,19 +1236,19 @@ const Wl = /* @__PURE__ */ I.forwardRef(function(t, n) {
1230
1236
  T
1231
1237
  ]), I.useEffect(() => {
1232
1238
  if (m !== "system") {
1233
- D(m);
1239
+ z(m);
1234
1240
  return;
1235
1241
  }
1236
- if (m === "system" && (window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches ? D("dark") : D("light")), typeof window > "u") return;
1242
+ if (m === "system" && (window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches ? z("dark") : z("light")), typeof window > "u") return;
1237
1243
  const P = window.matchMedia("(prefers-color-scheme: dark)");
1238
1244
  try {
1239
- P.addEventListener("change", ({ matches: z }) => {
1240
- D(z ? "dark" : "light");
1245
+ P.addEventListener("change", ({ matches: D }) => {
1246
+ z(D ? "dark" : "light");
1241
1247
  });
1242
1248
  } catch {
1243
1249
  P.addListener(({ matches: B }) => {
1244
1250
  try {
1245
- D(B ? "dark" : "light");
1251
+ z(B ? "dark" : "light");
1246
1252
  } catch (J) {
1247
1253
  console.error(J);
1248
1254
  }
@@ -1255,13 +1261,13 @@ const Wl = /* @__PURE__ */ I.forwardRef(function(t, n) {
1255
1261
  }, [
1256
1262
  T
1257
1263
  ]), I.useEffect(() => {
1258
- const P = (z) => {
1264
+ const P = (D) => {
1259
1265
  var B;
1260
- if (a.every((Y) => z[Y] || z.code === Y)) {
1266
+ if (a.every((Y) => D[Y] || D.code === Y)) {
1261
1267
  var j;
1262
1268
  H(!0), (j = U.current) == null || j.focus();
1263
1269
  }
1264
- z.code === "Escape" && (document.activeElement === U.current || (B = U.current) != null && B.contains(document.activeElement)) && H(!1);
1270
+ D.code === "Escape" && (document.activeElement === U.current || (B = U.current) != null && B.contains(document.activeElement)) && H(!1);
1265
1271
  };
1266
1272
  return document.addEventListener("keydown", P), () => document.removeEventListener("keydown", P);
1267
1273
  }, [
@@ -1284,7 +1290,7 @@ const Wl = /* @__PURE__ */ I.forwardRef(function(t, n) {
1284
1290
  "aria-relevant": "additions text",
1285
1291
  "aria-atomic": "false",
1286
1292
  suppressHydrationWarning: !0
1287
- }, L.map((P, z) => {
1293
+ }, L.map((P, D) => {
1288
1294
  var B;
1289
1295
  const [J, j] = P.split("-");
1290
1296
  return E.length ? /* @__PURE__ */ I.createElement("ol", {
@@ -1322,7 +1328,7 @@ const Wl = /* @__PURE__ */ I.forwardRef(function(t, n) {
1322
1328
  Y.target instanceof HTMLElement && Y.target.dataset.dismissible === "false" || K(!0);
1323
1329
  },
1324
1330
  onPointerUp: () => K(!1)
1325
- }, E.filter((Y) => !Y.position && z === 0 || Y.position === P).map((Y, ee) => {
1331
+ }, E.filter((Y) => !Y.position && D === 0 || Y.position === P).map((Y, ee) => {
1326
1332
  var te, se;
1327
1333
  return /* @__PURE__ */ I.createElement(Hl, {
1328
1334
  key: Y.id,
@@ -2314,13 +2320,13 @@ const au = (e, t) => {
2314
2320
  "left-bottom"
2315
2321
  ], R = () => [...C(), G, V], T = () => ["auto", "hidden", "clip", "visible", "scroll"], N = () => ["auto", "contain", "none"], E = () => [G, V, c], L = () => [Ze, "full", "auto", ...E()], W = () => [Je, "none", "subgrid", G, V], M = () => ["auto", {
2316
2322
  span: ["full", Je, G, V]
2317
- }, Je, G, V], F = () => [Je, "auto", G, V], H = () => ["auto", "min", "max", "fr", G, V], O = () => ["start", "end", "center", "between", "around", "evenly", "stretch", "baseline", "center-safe", "end-safe"], K = () => ["start", "end", "center", "stretch", "center-safe", "end-safe"], A = () => ["auto", ...E()], D = () => [Ze, "auto", "full", "dvw", "dvh", "lvw", "lvh", "svw", "svh", "min", "max", "fit", ...E()], U = () => [Ze, "screen", "full", "dvw", "lvw", "svw", "min", "max", "fit", ...E()], k = () => [Ze, "screen", "full", "lh", "dvh", "lvh", "svh", "min", "max", "fit", ...E()], S = () => [e, G, V], _ = () => [...C(), Ar, Pr, {
2323
+ }, Je, G, V], F = () => [Je, "auto", G, V], H = () => ["auto", "min", "max", "fr", G, V], O = () => ["start", "end", "center", "between", "around", "evenly", "stretch", "baseline", "center-safe", "end-safe"], K = () => ["start", "end", "center", "stretch", "center-safe", "end-safe"], A = () => ["auto", ...E()], z = () => [Ze, "auto", "full", "dvw", "dvh", "lvw", "lvh", "svw", "svh", "min", "max", "fit", ...E()], U = () => [Ze, "screen", "full", "dvw", "lvw", "svw", "min", "max", "fit", ...E()], k = () => [Ze, "screen", "full", "lh", "dvh", "lvh", "svh", "min", "max", "fit", ...E()], S = () => [e, G, V], _ = () => [...C(), Ar, Pr, {
2318
2324
  position: [G, V]
2319
2325
  }], $ = () => ["no-repeat", {
2320
2326
  repeat: ["", "x", "y", "space", "round"]
2321
2327
  }], P = () => ["auto", "cover", "contain", Wu, $u, {
2322
2328
  size: [G, V]
2323
- }], z = () => [Jn, zt, ct], B = () => [
2329
+ }], D = () => [Jn, zt, ct], B = () => [
2324
2330
  // Deprecated since Tailwind CSS v4.0.0
2325
2331
  "",
2326
2332
  "none",
@@ -3013,7 +3019,7 @@ const au = (e, t) => {
3013
3019
  * @see https://tailwindcss.com/docs/width#setting-both-width-and-height
3014
3020
  */
3015
3021
  size: [{
3016
- size: D()
3022
+ size: z()
3017
3023
  }],
3018
3024
  /**
3019
3025
  * Inline Size
@@ -3062,7 +3068,7 @@ const au = (e, t) => {
3062
3068
  * @see https://tailwindcss.com/docs/width
3063
3069
  */
3064
3070
  w: [{
3065
- w: [i, "screen", ...D()]
3071
+ w: [i, "screen", ...z()]
3066
3072
  }],
3067
3073
  /**
3068
3074
  * Min-Width
@@ -3074,7 +3080,7 @@ const au = (e, t) => {
3074
3080
  "screen",
3075
3081
  /** Deprecated. @see https://github.com/tailwindlabs/tailwindcss.com/issues/2027#issuecomment-2620152757 */
3076
3082
  "none",
3077
- ...D()
3083
+ ...z()
3078
3084
  ]
3079
3085
  }],
3080
3086
  /**
@@ -3092,7 +3098,7 @@ const au = (e, t) => {
3092
3098
  {
3093
3099
  screen: [a]
3094
3100
  },
3095
- ...D()
3101
+ ...z()
3096
3102
  ]
3097
3103
  }],
3098
3104
  /**
@@ -3100,21 +3106,21 @@ const au = (e, t) => {
3100
3106
  * @see https://tailwindcss.com/docs/height
3101
3107
  */
3102
3108
  h: [{
3103
- h: ["screen", "lh", ...D()]
3109
+ h: ["screen", "lh", ...z()]
3104
3110
  }],
3105
3111
  /**
3106
3112
  * Min-Height
3107
3113
  * @see https://tailwindcss.com/docs/min-height
3108
3114
  */
3109
3115
  "min-h": [{
3110
- "min-h": ["screen", "lh", "none", ...D()]
3116
+ "min-h": ["screen", "lh", "none", ...z()]
3111
3117
  }],
3112
3118
  /**
3113
3119
  * Max-Height
3114
3120
  * @see https://tailwindcss.com/docs/max-height
3115
3121
  */
3116
3122
  "max-h": [{
3117
- "max-h": ["screen", "lh", ...D()]
3123
+ "max-h": ["screen", "lh", ...z()]
3118
3124
  }],
3119
3125
  // ------------------
3120
3126
  // --- Typography ---
@@ -3431,21 +3437,21 @@ const au = (e, t) => {
3431
3437
  * @see https://tailwindcss.com/docs/gradient-color-stops
3432
3438
  */
3433
3439
  "gradient-from-pos": [{
3434
- from: z()
3440
+ from: D()
3435
3441
  }],
3436
3442
  /**
3437
3443
  * Gradient Color Stops Via Position
3438
3444
  * @see https://tailwindcss.com/docs/gradient-color-stops
3439
3445
  */
3440
3446
  "gradient-via-pos": [{
3441
- via: z()
3447
+ via: D()
3442
3448
  }],
3443
3449
  /**
3444
3450
  * Gradient Color Stops To Position
3445
3451
  * @see https://tailwindcss.com/docs/gradient-color-stops
3446
3452
  */
3447
3453
  "gradient-to-pos": [{
3448
- to: z()
3454
+ to: D()
3449
3455
  }],
3450
3456
  /**
3451
3457
  * Gradient Color Stops From
@@ -6913,14 +6919,14 @@ const qp = 50, Kp = async (e, t, n) => {
6913
6919
  }, h = Xo(r), b = Ko(h), g = await a.getDimensions(d), v = h === "y", y = v ? "top" : "left", w = v ? "bottom" : "right", x = v ? "clientHeight" : "clientWidth", C = s.reference[b] + s.reference[h] - m[h] - s.floating[b], R = m[h] - s.reference[h], T = await (a.getOffsetParent == null ? void 0 : a.getOffsetParent(d));
6914
6920
  let N = T ? T[x] : 0;
6915
6921
  (!N || !await (a.isElement == null ? void 0 : a.isElement(T))) && (N = i.floating[x] || s.floating[b]);
6916
- const E = C / 2 - R / 2, L = N / 2 - g[b] / 2 - 1, W = tt(l[y], L), M = tt(l[w], L), F = W, H = N - g[b] - M, O = N / 2 - g[b] / 2 + E, K = xo(F, O, H), A = !c.arrow && Mt(r) != null && O !== K && s.reference[b] / 2 - (O < F ? W : M) - g[b] / 2 < 0, D = A ? O < F ? O - F : O - H : 0;
6922
+ const E = C / 2 - R / 2, L = N / 2 - g[b] / 2 - 1, W = tt(l[y], L), M = tt(l[w], L), F = W, H = N - g[b] - M, O = N / 2 - g[b] / 2 + E, K = xo(F, O, H), A = !c.arrow && Mt(r) != null && O !== K && s.reference[b] / 2 - (O < F ? W : M) - g[b] / 2 < 0, z = A ? O < F ? O - F : O - H : 0;
6917
6923
  return {
6918
- [h]: m[h] + D,
6924
+ [h]: m[h] + z,
6919
6925
  data: {
6920
6926
  [h]: K,
6921
- centerOffset: O - K - D,
6927
+ centerOffset: O - K - z,
6922
6928
  ...A && {
6923
- alignmentOffset: D
6929
+ alignmentOffset: z
6924
6930
  }
6925
6931
  },
6926
6932
  reset: A
@@ -6976,12 +6982,12 @@ const qp = 50, Kp = async (e, t, n) => {
6976
6982
  placement: K
6977
6983
  }
6978
6984
  };
6979
- let A = (F = W.filter((D) => D.overflows[0] <= 0).sort((D, U) => D.overflows[1] - U.overflows[1])[0]) == null ? void 0 : F.placement;
6985
+ let A = (F = W.filter((z) => z.overflows[0] <= 0).sort((z, U) => z.overflows[1] - U.overflows[1])[0]) == null ? void 0 : F.placement;
6980
6986
  if (!A)
6981
6987
  switch (h) {
6982
6988
  case "bestFit": {
6983
6989
  var H;
6984
- const D = (H = W.filter((U) => {
6990
+ const z = (H = W.filter((U) => {
6985
6991
  if (T) {
6986
6992
  const k = Be(U.placement);
6987
6993
  return k === w || // Create a bias to the `y` side axis due to horizontal
@@ -6990,7 +6996,7 @@ const qp = 50, Kp = async (e, t, n) => {
6990
6996
  }
6991
6997
  return !0;
6992
6998
  }).map((U) => [U.placement, U.overflows.filter((k) => k > 0).reduce((k, S) => k + S, 0)]).sort((U, k) => U[1] - k[1])[0]) == null ? void 0 : H[0];
6993
- D && (A = D);
6999
+ z && (A = z);
6994
7000
  break;
6995
7001
  }
6996
7002
  case "initialPlacement":
@@ -7870,7 +7876,7 @@ function Mm(e) {
7870
7876
  }), [w, x]), A = p.useMemo(() => ({
7871
7877
  reference: C,
7872
7878
  floating: R
7873
- }), [C, R]), D = p.useMemo(() => {
7879
+ }), [C, R]), z = p.useMemo(() => {
7874
7880
  const U = {
7875
7881
  position: n,
7876
7882
  left: 0,
@@ -7896,8 +7902,8 @@ function Mm(e) {
7896
7902
  update: H,
7897
7903
  refs: K,
7898
7904
  elements: A,
7899
- floatingStyles: D
7900
- }), [u, H, K, A, D]);
7905
+ floatingStyles: z
7906
+ }), [u, H, K, A, z]);
7901
7907
  }
7902
7908
  const Om = (e) => {
7903
7909
  function t(n) {
@@ -8020,7 +8026,7 @@ var tr = "PopperContent", [jm, Gm] = Ha(tr), Ga = p.forwardRef(
8020
8026
  boundary: M.filter(qm),
8021
8027
  // with `strategy: 'fixed'`, this is the only way to get it to respect boundaries
8022
8028
  altBoundary: F
8023
- }, { refs: O, floatingStyles: K, placement: A, isPositioned: D, middlewareData: U } = Mm({
8029
+ }, { refs: O, floatingStyles: K, placement: A, isPositioned: z, middlewareData: U } = Mm({
8024
8030
  // default to `fixed` strategy so users don't have to pick and we also avoid focus scroll issues
8025
8031
  strategy: "fixed",
8026
8032
  placement: L,
@@ -8052,9 +8058,9 @@ var tr = "PopperContent", [jm, Gm] = Ha(tr), Ga = p.forwardRef(
8052
8058
  ]
8053
8059
  }), [k, S] = Ka(A), _ = be(b);
8054
8060
  de(() => {
8055
- D && (_ == null || _());
8056
- }, [D, _]);
8057
- const $ = (j = U.arrow) == null ? void 0 : j.x, P = (Y = U.arrow) == null ? void 0 : Y.y, z = ((ee = U.arrow) == null ? void 0 : ee.centerOffset) !== 0, [B, J] = p.useState();
8061
+ z && (_ == null || _());
8062
+ }, [z, _]);
8063
+ const $ = (j = U.arrow) == null ? void 0 : j.x, P = (Y = U.arrow) == null ? void 0 : Y.y, D = ((ee = U.arrow) == null ? void 0 : ee.centerOffset) !== 0, [B, J] = p.useState();
8058
8064
  return de(() => {
8059
8065
  y && J(window.getComputedStyle(y).zIndex);
8060
8066
  }, [y]), /* @__PURE__ */ f(
@@ -8064,7 +8070,7 @@ var tr = "PopperContent", [jm, Gm] = Ha(tr), Ga = p.forwardRef(
8064
8070
  "data-radix-popper-content-wrapper": "",
8065
8071
  style: {
8066
8072
  ...K,
8067
- transform: D ? K.transform : "translate(0, -200%)",
8073
+ transform: z ? K.transform : "translate(0, -200%)",
8068
8074
  // keep off the page when measuring
8069
8075
  minWidth: "max-content",
8070
8076
  zIndex: B,
@@ -8089,7 +8095,7 @@ var tr = "PopperContent", [jm, Gm] = Ha(tr), Ga = p.forwardRef(
8089
8095
  onArrowChange: R,
8090
8096
  arrowX: $,
8091
8097
  arrowY: P,
8092
- shouldHideArrow: z,
8098
+ shouldHideArrow: D,
8093
8099
  children: /* @__PURE__ */ f(
8094
8100
  Z.div,
8095
8101
  {
@@ -8101,7 +8107,7 @@ var tr = "PopperContent", [jm, Gm] = Ha(tr), Ga = p.forwardRef(
8101
8107
  ...g.style,
8102
8108
  // if the PopperContent hasn't been placed yet (not all measurements done)
8103
8109
  // we prevent animations so that users's animation don't kick in too early referring wrong sides
8104
- animation: D ? void 0 : "none"
8110
+ animation: z ? void 0 : "none"
8105
8111
  }
8106
8112
  }
8107
8113
  )
@@ -9216,11 +9222,11 @@ var Fh = ki, Bh = Ri, Hh = Mi, Vh = [" ", "Enter", "ArrowUp", "ArrowDown"], Wh =
9216
9222
  {
9217
9223
  scope: e.__scopeSelect,
9218
9224
  onNativeOptionAdd: p.useCallback((A) => {
9219
- O((D) => new Set(D).add(A));
9225
+ O((z) => new Set(z).add(A));
9220
9226
  }, []),
9221
9227
  onNativeOptionRemove: p.useCallback((A) => {
9222
- O((D) => {
9223
- const U = new Set(D);
9228
+ O((z) => {
9229
+ const U = new Set(z);
9224
9230
  return U.delete(A), U;
9225
9231
  });
9226
9232
  }, []),
@@ -9372,13 +9378,13 @@ var _e = 10, [ji, st] = Lt(pt), Xh = "SelectContentImpl", Zh = /* @__PURE__ */ W
9372
9378
  if (oe === se || (oe == null || oe.scrollIntoView({ block: "nearest" }), oe === Y && R && (R.scrollTop = 0), oe === te && R && (R.scrollTop = R.scrollHeight), oe == null || oe.focus(), document.activeElement !== se)) return;
9373
9379
  },
9374
9380
  [F, R]
9375
- ), D = p.useCallback(
9381
+ ), z = p.useCallback(
9376
9382
  () => A([E, x]),
9377
9383
  [A, E, x]
9378
9384
  );
9379
9385
  p.useEffect(() => {
9380
- H && D();
9381
- }, [H, D]);
9386
+ H && z();
9387
+ }, [H, z]);
9382
9388
  const { onOpenChange: U, triggerPointerDownPosRef: k } = w;
9383
9389
  p.useEffect(() => {
9384
9390
  if (x) {
@@ -9411,7 +9417,7 @@ var _e = 10, [ji, st] = Lt(pt), Xh = "SelectContentImpl", Zh = /* @__PURE__ */ W
9411
9417
  (w.value !== void 0 && w.value === Y || te) && (L(j), te && (K.current = !0));
9412
9418
  },
9413
9419
  [w.value]
9414
- ), P = p.useCallback(() => x == null ? void 0 : x.focus(), [x]), z = p.useCallback(
9420
+ ), P = p.useCallback(() => x == null ? void 0 : x.focus(), [x]), D = p.useCallback(
9415
9421
  (j, Y, ee) => {
9416
9422
  const te = !K.current && !ee;
9417
9423
  (w.value !== void 0 && w.value === Y || te) && M(j);
@@ -9439,8 +9445,8 @@ var _e = 10, [ji, st] = Lt(pt), Xh = "SelectContentImpl", Zh = /* @__PURE__ */ W
9439
9445
  itemRefCallback: $,
9440
9446
  selectedItem: E,
9441
9447
  onItemLeave: P,
9442
- itemTextRefCallback: z,
9443
- focusSelectedItem: D,
9448
+ itemTextRefCallback: D,
9449
+ focusSelectedItem: z,
9444
9450
  selectedItemText: W,
9445
9451
  position: o,
9446
9452
  isPositioned: H,
@@ -9530,25 +9536,25 @@ var Jh = "SelectItemAlignedPosition", Yi = p.forwardRef((e, t) => {
9530
9536
  ]);
9531
9537
  i.style.minWidth = fe + "px", i.style.right = Te + "px";
9532
9538
  }
9533
- const M = m(), F = window.innerHeight - _e * 2, H = g.scrollHeight, O = window.getComputedStyle(d), K = parseInt(O.borderTopWidth, 10), A = parseInt(O.paddingTop, 10), D = parseInt(O.borderBottomWidth, 10), U = parseInt(O.paddingBottom, 10), k = K + A + H + U + D, S = Math.min(v.offsetHeight * 5, k), _ = window.getComputedStyle(g), $ = parseInt(_.paddingTop, 10), P = parseInt(_.paddingBottom, 10), z = N.top + N.height / 2 - _e, B = F - z, J = v.offsetHeight / 2, j = v.offsetTop + J, Y = K + A + j, ee = k - Y;
9534
- if (Y <= z) {
9539
+ const M = m(), F = window.innerHeight - _e * 2, H = g.scrollHeight, O = window.getComputedStyle(d), K = parseInt(O.borderTopWidth, 10), A = parseInt(O.paddingTop, 10), z = parseInt(O.borderBottomWidth, 10), U = parseInt(O.paddingBottom, 10), k = K + A + H + U + z, S = Math.min(v.offsetHeight * 5, k), _ = window.getComputedStyle(g), $ = parseInt(_.paddingTop, 10), P = parseInt(_.paddingBottom, 10), D = N.top + N.height / 2 - _e, B = F - D, J = v.offsetHeight / 2, j = v.offsetTop + J, Y = K + A + j, ee = k - Y;
9540
+ if (Y <= D) {
9535
9541
  const se = M.length > 0 && v === M[M.length - 1].ref.current;
9536
9542
  i.style.bottom = "0px";
9537
9543
  const oe = d.clientHeight - g.offsetTop - g.offsetHeight, ue = Math.max(
9538
9544
  B,
9539
9545
  J + // viewport might have padding bottom, include it to avoid a scrollable viewport
9540
- (se ? P : 0) + oe + D
9546
+ (se ? P : 0) + oe + z
9541
9547
  ), fe = Y + ue;
9542
9548
  i.style.height = fe + "px";
9543
9549
  } else {
9544
9550
  const se = M.length > 0 && v === M[0].ref.current;
9545
9551
  i.style.top = "0px";
9546
9552
  const ue = Math.max(
9547
- z,
9553
+ D,
9548
9554
  K + g.offsetTop + // viewport might have padding top, include it to avoid a scrollable viewport
9549
9555
  (se ? $ : 0) + J
9550
9556
  ) + ee;
9551
- i.style.height = ue + "px", g.scrollTop = Y - z + g.offsetTop;
9557
+ i.style.height = ue + "px", g.scrollTop = Y - D + g.offsetTop;
9552
9558
  }
9553
9559
  i.style.margin = `${_e}px 0`, i.style.minHeight = S + "px", i.style.maxHeight = F + "px", o == null || o(), requestAnimationFrame(() => h.current = !0);
9554
9560
  }
@@ -11822,15 +11828,15 @@ const Dt = (e) => e == null ? void 0 : e === !0 || e === "true", Lc = {
11822
11828
  headers: { "Content-Type": "application/json" },
11823
11829
  body: JSON.stringify({
11824
11830
  appId: n,
11825
- extensionId: i.id,
11826
11831
  instanceId: o,
11832
+ extensionId: i.id,
11827
11833
  ...u && { mode: u },
11828
11834
  ...d && { devSessionToken: d }
11829
11835
  })
11830
11836
  });
11831
11837
  if (m.ok) {
11832
- const { token: h, encryptionKey: b } = await m.json();
11833
- s.set(i.id, { token: h, encryptionKey: b });
11838
+ const { token: h, encryptionKey: b, settings: g } = await m.json();
11839
+ console.log(`[embeddables] proxyToken response for ${i.id}:`, { hasToken: !!h, hasEncKey: !!b, settings: g }), s.set(i.id, { token: h, encryptionKey: b, settings: g });
11834
11840
  } else {
11835
11841
  let h = `Proxy token failed (${m.status})`;
11836
11842
  u && !d ? h = "Session token missing — re-run CLI" : u && (h = "Session expired or invalid — re-run CLI"), a.set(i.id, h), console.warn(`[embeddables] Failed to obtain proxy token for extension ${i.id} (${m.status}) — ${h}`);
@@ -11880,8 +11886,8 @@ const Dt = (e) => e == null ? void 0 : e === !0 || e === "true", Lc = {
11880
11886
  console.warn(`[ExtensionSetup] Instance not found or failed to load: ${S}`), d([]), y(!0);
11881
11887
  return;
11882
11888
  }
11883
- const $ = await _.json(), P = ws(typeof window < "u" ? window.location.search : ""), z = await Yl($, P), { tokens: B, errors: J } = await Lb(z, n, o, S, P);
11884
- d(z), l(P), h(new Map(B)), g(J);
11889
+ const $ = await _.json(), P = ws(typeof window < "u" ? window.location.search : ""), D = await Yl($, P), { tokens: B, errors: J } = await Lb(D, n, o, S, P);
11890
+ d(D), l(P), h(new Map(B)), g(J);
11885
11891
  } catch (_) {
11886
11892
  console.error("Failed to load extensions:", _);
11887
11893
  } finally {
@@ -11898,31 +11904,32 @@ const Dt = (e) => e == null ? void 0 : e === !0 || e === "true", Lc = {
11898
11904
  var P;
11899
11905
  return $.manifest.permissions.includes("data:fetch") || (((P = $.manifest.settingsSchema) == null ? void 0 : P.length) ?? 0) > 0;
11900
11906
  }).map(async ($) => {
11901
- const P = u.find((Y) => Y.extensionId === $.id), z = P == null ? void 0 : P.token, B = P == null ? void 0 : P.mode, J = Ft(n, "/proxy-token"), j = await fetch(J, {
11907
+ const P = u.find((Y) => Y.extensionId === $.id), D = P == null ? void 0 : P.token, B = P == null ? void 0 : P.mode, J = Ft(n, "/proxy-token"), j = await fetch(J, {
11902
11908
  method: "POST",
11903
11909
  headers: { "Content-Type": "application/json" },
11904
11910
  body: JSON.stringify({
11905
11911
  appId: o,
11906
11912
  extensionId: $.id,
11913
+ instanceId: e,
11907
11914
  ...B && { mode: B },
11908
- ...z && { devSessionToken: z }
11915
+ ...D && { devSessionToken: D }
11909
11916
  })
11910
11917
  });
11911
11918
  if (j.ok) {
11912
- const { token: Y, encryptionKey: ee } = await j.json();
11913
- _.push([$.id, { token: Y, encryptionKey: ee }]);
11919
+ const { token: Y, encryptionKey: ee, settings: te } = await j.json();
11920
+ _.push([$.id, { token: Y, encryptionKey: ee, settings: te }]);
11914
11921
  } else
11915
11922
  console.warn(`[embeddables] Proxy token refresh failed for extension ${$.id} (${j.status}) — using stale token`);
11916
11923
  })
11917
11924
  ), _.length > 0 && h(($) => {
11918
11925
  const P = new Map($);
11919
- for (const [z, B] of _)
11920
- P.set(z, B);
11926
+ for (const [D, B] of _)
11927
+ P.set(D, B);
11921
11928
  return P;
11922
11929
  });
11923
11930
  }, 3300 * 1e3);
11924
11931
  return () => clearInterval(S);
11925
- }, [c, u, n, o]), ce(() => {
11932
+ }, [c, u, n, o, e]), ce(() => {
11926
11933
  if (m.size === 0)
11927
11934
  return;
11928
11935
  const k = (S) => {
@@ -11932,8 +11939,8 @@ const Dt = (e) => e == null ? void 0 : e === !0 || e === "true", Lc = {
11932
11939
  const $ = _.extensionId, P = c.find((J) => J.id === $);
11933
11940
  if (!(P != null && P.bundleUrl))
11934
11941
  return;
11935
- const z = u.find((J) => J.extensionId === $);
11936
- if (Ul(P.bundleUrl) && (z == null ? void 0 : z.mode) !== "staging")
11942
+ const D = u.find((J) => J.extensionId === $);
11943
+ if (Ul(P.bundleUrl) && (D == null ? void 0 : D.mode) !== "staging")
11937
11944
  return;
11938
11945
  const B = m.get($);
11939
11946
  B && $e($, { type: "extension-encryption-key", encryptionKey: B.encryptionKey });
@@ -11945,8 +11952,8 @@ const Dt = (e) => e == null ? void 0 : e === !0 || e === "true", Lc = {
11945
11952
  for (const [$, P] of _) {
11946
11953
  if (!P.manifest.permissions.includes("events:identity"))
11947
11954
  continue;
11948
- const z = P.manifest.events ?? [];
11949
- !z.includes("identity") && !z.includes(`identity:${k}`) || $e($, {
11955
+ const D = P.manifest.events ?? [];
11956
+ !D.includes("identity") && !D.includes(`identity:${k}`) || $e($, {
11950
11957
  type: "extension-event",
11951
11958
  eventType: "identity",
11952
11959
  payload: { eventName: k, data: { state: S, timestamp: Zn((/* @__PURE__ */ new Date()).toISOString()) } }
@@ -11978,8 +11985,8 @@ const Dt = (e) => e == null ? void 0 : e === !0 || e === "true", Lc = {
11978
11985
  }
11979
11986
  }, []), F = ve(async (k) => {
11980
11987
  const S = kt(), _ = [];
11981
- for (const [P, z] of S) {
11982
- if (!z.manifest.permissions.includes("extend:identity"))
11988
+ for (const [P, D] of S) {
11989
+ if (!D.manifest.permissions.includes("extend:identity"))
11983
11990
  continue;
11984
11991
  const B = new Promise((J) => {
11985
11992
  const j = `enrich_${P}_${Date.now()}`, Y = (ee) => {
@@ -12032,15 +12039,15 @@ const Dt = (e) => e == null ? void 0 : e === !0 || e === "true", Lc = {
12032
12039
  (async () => {
12033
12040
  const P = await F({ ...$, email: S, name: _ });
12034
12041
  console.log("[embeddables] Enriched claims:", P);
12035
- const z = await H({
12042
+ const D = await H({
12036
12043
  ...$,
12037
12044
  ...P,
12038
12045
  email: S,
12039
12046
  name: _
12040
12047
  });
12041
- console.log("[embeddables] Sign result:", { hasToken: !!z }), z && O(z);
12048
+ console.log("[embeddables] Sign result:", { hasToken: !!D }), D && O(D);
12042
12049
  })();
12043
- }, [F, H, O]), D = ve((k) => {
12050
+ }, [F, H, O]), z = ve((k) => {
12044
12051
  if (E.length > 0 && N.current.size < E.length) {
12045
12052
  console.log(`[embeddables] Deferring sign lifecycle — waiting for extend:identity extensions: ${N.current.size}/${E.length} ready`), T.current = k;
12046
12053
  return;
@@ -12065,14 +12072,14 @@ const Dt = (e) => e == null ? void 0 : e === !0 || e === "true", Lc = {
12065
12072
  };
12066
12073
  x((S) => {
12067
12074
  var _, $;
12068
- return S.authenticated && ((_ = S.user) == null ? void 0 : _.id) === (($ = k.user) == null ? void 0 : $.id) ? S : (console.log("[embeddables] Identity state changed (props), starting sign lifecycle"), D(k.user), L("login", k), k);
12075
+ return S.authenticated && ((_ = S.user) == null ? void 0 : _.id) === (($ = k.user) == null ? void 0 : $.id) ? S : (console.log("[embeddables] Identity state changed (props), starting sign lifecycle"), z(k.user), L("login", k), k);
12069
12076
  });
12070
12077
  } else {
12071
12078
  if (s === void 0)
12072
12079
  return;
12073
12080
  x((k) => k.authenticated ? (console.log("[embeddables] Customer props cleared, logging out"), K(), L("logout", { authenticated: !1, user: null }), { authenticated: !1, user: null }) : k);
12074
12081
  }
12075
- }, [v, s, a, i, E, D, L, K]), ce(() => {
12082
+ }, [v, s, a, i, E, z, L, K]), ce(() => {
12076
12083
  if (!v || s !== void 0)
12077
12084
  return;
12078
12085
  const k = () => {
@@ -12088,9 +12095,9 @@ const Dt = (e) => e == null ? void 0 : e === !0 || e === "true", Lc = {
12088
12095
  provider: "shopify"
12089
12096
  }
12090
12097
  };
12091
- x((z) => {
12098
+ x((D) => {
12092
12099
  var B, J;
12093
- return z.authenticated && ((B = z.user) == null ? void 0 : B.id) === ((J = P.user) == null ? void 0 : J.id) ? z : (console.log("[embeddables] Identity state changed (DOM), starting sign lifecycle"), D(P.user), L("login", P), P);
12100
+ return D.authenticated && ((B = D.user) == null ? void 0 : B.id) === ((J = P.user) == null ? void 0 : J.id) ? D : (console.log("[embeddables] Identity state changed (DOM), starting sign lifecycle"), z(P.user), L("login", P), P);
12094
12101
  });
12095
12102
  } catch {
12096
12103
  console.warn("[embeddables] Failed to parse #stackable-identity JSON");
@@ -12101,7 +12108,7 @@ const Dt = (e) => e == null ? void 0 : e === !0 || e === "true", Lc = {
12101
12108
  k();
12102
12109
  const S = new MutationObserver(k);
12103
12110
  return S.observe(document.head, { childList: !0, subtree: !0 }), S.observe(document.body, { childList: !0, subtree: !0 }), () => S.disconnect();
12104
- }, [v, s, D, L, K]), ce(() => {
12111
+ }, [v, s, z, L, K]), ce(() => {
12105
12112
  if (!w.authenticated)
12106
12113
  return;
12107
12114
  const k = (S) => {
@@ -12111,8 +12118,8 @@ const Dt = (e) => e == null ? void 0 : e === !0 || e === "true", Lc = {
12111
12118
  const $ = _.extensionId, P = c.find((B) => B.id === $);
12112
12119
  if (!(P != null && P.manifest.permissions.includes("events:identity")))
12113
12120
  return;
12114
- const z = P.manifest.events ?? [];
12115
- !z.includes("identity") && !z.includes("identity:login") || $e($, {
12121
+ const D = P.manifest.events ?? [];
12122
+ !D.includes("identity") && !D.includes("identity:login") || $e($, {
12116
12123
  type: "extension-event",
12117
12124
  eventType: "identity",
12118
12125
  payload: { eventName: "login", data: { state: w, timestamp: Zn((/* @__PURE__ */ new Date()).toISOString()) } }
@@ -12129,8 +12136,8 @@ const Dt = (e) => e == null ? void 0 : e === !0 || e === "true", Lc = {
12129
12136
  const P = $.extensionId;
12130
12137
  if (E.includes(P) && (N.current.add(P), console.log(`[embeddables] extend:identity extension ready: ${P} (${N.current.size}/${E.length})`), N.current.size >= E.length && T.current)) {
12131
12138
  console.log("[embeddables] All extend:identity extensions ready, running deferred sign lifecycle");
12132
- const z = T.current;
12133
- T.current = null, A(z);
12139
+ const D = T.current;
12140
+ T.current = null, A(D);
12134
12141
  }
12135
12142
  };
12136
12143
  window.addEventListener("message", k);
@@ -12180,10 +12187,10 @@ const Dt = (e) => e == null ? void 0 : e === !0 || e === "true", Lc = {
12180
12187
  for (const [$, P] of S) {
12181
12188
  if (!P.manifest.permissions.includes("context:read"))
12182
12189
  continue;
12183
- const z = (_ = m.get($)) == null ? void 0 : _.settings, B = z ? { ...k, settings: z } : k;
12184
- $e($, { type: "context-push", context: B });
12190
+ const D = (_ = m.get($)) == null ? void 0 : _.settings, B = D ? { ...k, settings: D } : k;
12191
+ console.log(`[embeddables] context-push for ${$}:`, { hasSettings: !!D, settings: D }), $e($, { type: "context-push", context: B });
12185
12192
  }
12186
- }, [v, s, a, i, w, C]);
12193
+ }, [v, s, a, i, w, C, m]);
12187
12194
  const U = Vt(
12188
12195
  () => ({
12189
12196
  // TODO(data.query-deprecation): Remove when data.query is deprecated — host-native ecommerce route replaced by extension + data.fetch
@@ -12203,7 +12210,7 @@ const Dt = (e) => e == null ? void 0 : e === !0 || e === "true", Lc = {
12203
12210
  method: S.method ?? "GET",
12204
12211
  headers: S.headers ?? {},
12205
12212
  body: S.body ?? null
12206
- }, P = Ft(n, "/proxy"), z = await fetch(P, {
12213
+ }, P = Ft(n, "/proxy"), D = await fetch(P, {
12207
12214
  method: "POST",
12208
12215
  headers: {
12209
12216
  "Content-Type": "application/json",
@@ -12212,10 +12219,10 @@ const Dt = (e) => e == null ? void 0 : e === !0 || e === "true", Lc = {
12212
12219
  Authorization: `Bearer ${_.token}`
12213
12220
  },
12214
12221
  body: JSON.stringify($)
12215
- }), B = await z.json();
12222
+ }), B = await D.json();
12216
12223
  return {
12217
- status: B.status ?? z.status,
12218
- ok: B.ok ?? z.ok,
12224
+ status: B.status ?? D.status,
12225
+ ok: B.ok ?? D.ok,
12219
12226
  data: B.data
12220
12227
  };
12221
12228
  },
@@ -12228,10 +12235,10 @@ const Dt = (e) => e == null ? void 0 : e === !0 || e === "true", Lc = {
12228
12235
  ...S.closeButton != null && { closeButton: S.closeButton }
12229
12236
  };
12230
12237
  if (S.fetch) {
12231
- const $ = (z) => new Promise((B) => setTimeout(B, z)), P = Promise.all([
12238
+ const $ = (D) => new Promise((B) => setTimeout(B, D)), P = Promise.all([
12232
12239
  U["data.fetch"](k, S.fetch),
12233
12240
  $(Ob)
12234
- ]).then(([z]) => z);
12241
+ ]).then(([D]) => D);
12235
12242
  wt.promise(P, {
12236
12243
  loading: S.loading ?? S.message,
12237
12244
  success: S.success ?? S.message,
@@ -12576,9 +12583,9 @@ const Hb = ({ ...e }) => {
12576
12583
  ce(() => {
12577
12584
  var K, A;
12578
12585
  const M = document.querySelector('script[src*="zdassets.com/ekr/snippet"]'), F = (A = (K = M == null ? void 0 : M.src) == null ? void 0 : K.match(/key=([a-f0-9-]+)/)) == null ? void 0 : A[1];
12579
- if (F && fetch(`https://ekr.zdassets.com/compose/${F}`).then((D) => D.text()).then((D) => {
12586
+ if (F && fetch(`https://ekr.zdassets.com/compose/${F}`).then((z) => z.text()).then((z) => {
12580
12587
  var k;
12581
- const U = (k = D.match(/appId['"]?\s*:\s*['"]([a-f0-9]+)['"]/)) == null ? void 0 : k[1];
12588
+ const U = (k = z.match(/appId['"]?\s*:\s*['"]([a-f0-9]+)['"]/)) == null ? void 0 : k[1];
12582
12589
  U && po({ appId: U });
12583
12590
  }).catch(() => {
12584
12591
  }), C()) {
@@ -12588,7 +12595,7 @@ const Hb = ({ ...e }) => {
12588
12595
  const H = setInterval(() => {
12589
12596
  C() && (w("ready"), clearInterval(H));
12590
12597
  }, 100), O = setTimeout(() => {
12591
- clearInterval(H), w((D) => D === "ready" ? D : (console.warn("Zendesk widget failed to load after 10 seconds"), "error"));
12598
+ clearInterval(H), w((z) => z === "ready" ? z : (console.warn("Zendesk widget failed to load after 10 seconds"), "error"));
12592
12599
  }, 1e4);
12593
12600
  return () => {
12594
12601
  clearInterval(H), clearTimeout(O);
@@ -12624,12 +12631,12 @@ const Hb = ({ ...e }) => {
12624
12631
  if (y !== "ready" || !window.zE)
12625
12632
  return;
12626
12633
  const M = window.zE("messenger:on", "conversationStarted", (O) => {
12627
- var A, D;
12628
- const K = (D = (A = O == null ? void 0 : O.payload) == null ? void 0 : A.conversation) == null ? void 0 : D.id;
12634
+ var A, z;
12635
+ const K = (z = (A = O == null ? void 0 : O.payload) == null ? void 0 : A.conversation) == null ? void 0 : z.id;
12629
12636
  K && po({ conversationId: K });
12630
12637
  }), F = window.zE("messenger:on", "messagesShown", (O) => {
12631
- var A, D;
12632
- const K = (D = (A = O == null ? void 0 : O.payload) == null ? void 0 : A.conversation) == null ? void 0 : D.id;
12638
+ var A, z;
12639
+ const K = (z = (A = O == null ? void 0 : O.payload) == null ? void 0 : A.conversation) == null ? void 0 : z.id;
12633
12640
  K && po({ conversationId: K });
12634
12641
  }), H = window.zE("messenger:on", "postbackButtonClicked", (O) => {
12635
12642
  var A;
@@ -12656,11 +12663,11 @@ const Hb = ({ ...e }) => {
12656
12663
  const O = x.current.getBoundingClientRect();
12657
12664
  if ((l ? O.width : O.height) === 0)
12658
12665
  return;
12659
- const A = l ? (H.clientX - O.left) / O.width * 100 : (H.clientY - O.top) / O.height * 100, D = Math.max(
12666
+ const A = l ? (H.clientX - O.left) / O.width * 100 : (H.clientY - O.top) / O.height * 100, z = Math.max(
12660
12667
  mo,
12661
12668
  Math.min(ho, A)
12662
12669
  );
12663
- v(D);
12670
+ v(z);
12664
12671
  }, F = () => {
12665
12672
  u(!1), document.body.style.cursor = "", document.body.style.userSelect = "";
12666
12673
  };