@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 +142 -135
- package/dist/stackable-widget.external.js +9 -9
- package/dist/stackable-widget.js +24 -24
- package/package.json +1 -1
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 "
|
|
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
|
-
|
|
20
|
-
|
|
21
|
-
|
|
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
|
|
25
|
+
let c = "";
|
|
24
26
|
try {
|
|
25
|
-
const
|
|
26
|
-
|
|
27
|
-
} catch (
|
|
28
|
-
console.error(`[SandboxManager] Failed to fetch bundle for ${e.id}:`,
|
|
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
|
|
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">${
|
|
41
|
+
<script type="module">${c}<\/script>
|
|
40
42
|
</body>
|
|
41
43
|
</html>`;
|
|
42
|
-
o.srcdoc =
|
|
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
|
|
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
|
-
},
|
|
52
|
-
|
|
53
|
-
|
|
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",
|
|
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.
|
|
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:
|
|
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
|
-
|
|
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 (
|
|
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
|
-
},
|
|
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 || (
|
|
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 =
|
|
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,
|
|
1196
|
-
N((
|
|
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 =
|
|
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((
|
|
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((
|
|
1214
|
-
const B =
|
|
1219
|
+
N((D) => {
|
|
1220
|
+
const B = D.findIndex((J) => J.id === P.id);
|
|
1215
1221
|
return B !== -1 ? [
|
|
1216
|
-
...
|
|
1222
|
+
...D.slice(0, B),
|
|
1217
1223
|
{
|
|
1218
|
-
...
|
|
1224
|
+
...D[B],
|
|
1219
1225
|
...P
|
|
1220
1226
|
},
|
|
1221
|
-
...
|
|
1227
|
+
...D.slice(B + 1)
|
|
1222
1228
|
] : [
|
|
1223
1229
|
P,
|
|
1224
|
-
...
|
|
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
|
-
|
|
1239
|
+
z(m);
|
|
1234
1240
|
return;
|
|
1235
1241
|
}
|
|
1236
|
-
if (m === "system" && (window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches ?
|
|
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:
|
|
1240
|
-
D
|
|
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
|
-
|
|
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 = (
|
|
1264
|
+
const P = (D) => {
|
|
1259
1265
|
var B;
|
|
1260
|
-
if (a.every((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
|
-
|
|
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,
|
|
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 &&
|
|
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()],
|
|
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
|
-
}],
|
|
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:
|
|
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", ...
|
|
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
|
-
...
|
|
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
|
-
...
|
|
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", ...
|
|
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", ...
|
|
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", ...
|
|
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:
|
|
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:
|
|
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:
|
|
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,
|
|
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] +
|
|
6924
|
+
[h]: m[h] + z,
|
|
6919
6925
|
data: {
|
|
6920
6926
|
[h]: K,
|
|
6921
|
-
centerOffset: O - K -
|
|
6927
|
+
centerOffset: O - K - z,
|
|
6922
6928
|
...A && {
|
|
6923
|
-
alignmentOffset:
|
|
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((
|
|
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
|
|
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
|
-
|
|
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]),
|
|
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:
|
|
7900
|
-
}), [u, H, K, A,
|
|
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:
|
|
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
|
-
|
|
8056
|
-
}, [
|
|
8057
|
-
const $ = (j = U.arrow) == null ? void 0 : j.x, P = (Y = U.arrow) == null ? void 0 : Y.y,
|
|
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:
|
|
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:
|
|
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:
|
|
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((
|
|
9225
|
+
O((z) => new Set(z).add(A));
|
|
9220
9226
|
}, []),
|
|
9221
9227
|
onNativeOptionRemove: p.useCallback((A) => {
|
|
9222
|
-
O((
|
|
9223
|
-
const U = new Set(
|
|
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
|
-
),
|
|
9381
|
+
), z = p.useCallback(
|
|
9376
9382
|
() => A([E, x]),
|
|
9377
9383
|
[A, E, x]
|
|
9378
9384
|
);
|
|
9379
9385
|
p.useEffect(() => {
|
|
9380
|
-
H &&
|
|
9381
|
-
}, [H,
|
|
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]),
|
|
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:
|
|
9443
|
-
focusSelectedItem:
|
|
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),
|
|
9534
|
-
if (Y <=
|
|
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 +
|
|
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
|
-
|
|
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 -
|
|
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 : ""),
|
|
11884
|
-
d(
|
|
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),
|
|
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
|
-
...
|
|
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 [
|
|
11920
|
-
P.set(
|
|
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
|
|
11936
|
-
if (Ul(P.bundleUrl) && (
|
|
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
|
|
11949
|
-
!
|
|
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,
|
|
11982
|
-
if (!
|
|
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
|
|
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: !!
|
|
12048
|
+
console.log("[embeddables] Sign result:", { hasToken: !!D }), D && O(D);
|
|
12042
12049
|
})();
|
|
12043
|
-
}, [F, H, O]),
|
|
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"),
|
|
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,
|
|
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((
|
|
12098
|
+
x((D) => {
|
|
12092
12099
|
var B, J;
|
|
12093
|
-
return
|
|
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,
|
|
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
|
|
12115
|
-
!
|
|
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
|
|
12133
|
-
T.current = null, A(
|
|
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
|
|
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"),
|
|
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
|
|
12222
|
+
}), B = await D.json();
|
|
12216
12223
|
return {
|
|
12217
|
-
status: B.status ??
|
|
12218
|
-
ok: B.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 $ = (
|
|
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(([
|
|
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((
|
|
12586
|
+
if (F && fetch(`https://ekr.zdassets.com/compose/${F}`).then((z) => z.text()).then((z) => {
|
|
12580
12587
|
var k;
|
|
12581
|
-
const U = (k =
|
|
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((
|
|
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,
|
|
12628
|
-
const K = (
|
|
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,
|
|
12632
|
-
const K = (
|
|
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,
|
|
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(
|
|
12670
|
+
v(z);
|
|
12664
12671
|
}, F = () => {
|
|
12665
12672
|
u(!1), document.body.style.cursor = "", document.body.style.userSelect = "";
|
|
12666
12673
|
};
|