@useinsider/guido 3.18.2 → 3.19.0-beta.5355c3f
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/README.md +20 -0
- package/dist/components/Guido.vue.js +3 -3
- package/dist/components/Guido.vue2.js +67 -61
- package/dist/components/organisms/save-as-template/SaveAsTemplateDrawer.vue2.js +34 -34
- package/dist/composables/useActionsApi.js +24 -20
- package/dist/composables/useCortexBlueprintBridge.js +115 -54
- package/dist/composables/useEmailTemplateApplier.js +93 -50
- package/dist/composables/useGuidoStateBridge.js +29 -24
- package/dist/composables/useHttp.js +24 -22
- package/dist/composables/useStripo.js +7 -7
- package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +4 -4
- package/dist/extensions/Blocks/Recommendation/recommendation.css.js +6 -3
- package/dist/guido.css +1 -1
- package/dist/library.js +15 -13
- package/dist/package.json.js +1 -1
- package/dist/public/editorState.js +4 -0
- package/dist/services/templateLibraryApi.js +17 -14
- package/dist/src/composables/useCortexBlueprintBridge.d.ts +4 -3
- package/dist/src/composables/useEmailTemplateApplier.d.ts +22 -2
- package/dist/src/composables/useGuidoStateBridge.d.ts +11 -7
- package/dist/src/library.d.ts +2 -0
- package/dist/src/public/editorState.d.ts +14 -0
- package/dist/src/public/trackingIds.d.ts +6 -2
- package/dist/src/stores/editor.d.ts +25 -0
- package/dist/src/stores/guido-email-editor.d.ts +49 -27
- package/dist/src/utils/genericUtil.d.ts +6 -0
- package/dist/src/utils/liquidDynamicContent.d.ts +20 -0
- package/dist/stores/editor.js +4 -0
- package/dist/stores/guido-email-editor.js +3 -5
- package/dist/utils/genericUtil.js +63 -54
- package/dist/utils/liquidDynamicContent.js +15 -0
- package/dist/utils/templatePreparation.js +37 -36
- package/package.json +10 -6
|
@@ -1,70 +1,131 @@
|
|
|
1
|
-
import { useEmailTemplateApplier as
|
|
2
|
-
import { useToaster as
|
|
3
|
-
import { useTranslations as
|
|
4
|
-
import { ToasterTypeOptions as
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
|
|
1
|
+
import { useEmailTemplateApplier as k, resetEmailTemplateApplier as N } from "./useEmailTemplateApplier.js";
|
|
2
|
+
import { useToaster as X } from "./useToaster.js";
|
|
3
|
+
import { useTranslations as j } from "./useTranslations.js";
|
|
4
|
+
import { ToasterTypeOptions as z } from "../enums/toaster.js";
|
|
5
|
+
import { useGuidoEmailEditorStore as J } from "../stores/guido-email-editor.js";
|
|
6
|
+
import { getActivePinia as Q } from "pinia";
|
|
7
|
+
import { onUnmounted as V, watch as Z } from "vue";
|
|
8
|
+
const W = "email_template", tt = "chat", et = "guido:debug:ai", rt = 2, nt = 500, ot = (A, p) => `${A}:${p ?? 1}`;
|
|
9
|
+
let v = null;
|
|
10
|
+
const it = () => {
|
|
8
11
|
if (typeof window > "u")
|
|
9
12
|
return !1;
|
|
10
13
|
try {
|
|
11
|
-
return window.localStorage.getItem(
|
|
14
|
+
return window.localStorage.getItem(et) === "1";
|
|
12
15
|
} catch {
|
|
13
16
|
return !1;
|
|
14
17
|
}
|
|
15
|
-
},
|
|
16
|
-
const
|
|
17
|
-
if (!
|
|
18
|
+
}, ft = () => {
|
|
19
|
+
const A = Q();
|
|
20
|
+
if (!A)
|
|
18
21
|
return;
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
},
|
|
28
|
-
if (
|
|
22
|
+
const p = J(), y = Symbol("cortexBlueprintBridge");
|
|
23
|
+
v = y, p.$patch((t) => {
|
|
24
|
+
t.bridgeActive = !0;
|
|
25
|
+
});
|
|
26
|
+
const { markPending: x, applyTemplate: F, applyTemplateDebounced: I } = k(), { showToaster: C } = X(), H = j(), h = /* @__PURE__ */ new Map(), S = /* @__PURE__ */ new Map(), u = /* @__PURE__ */ new Map(), d = /* @__PURE__ */ new Map(), E = /* @__PURE__ */ new Map(), _ = /* @__PURE__ */ new Set(), M = it();
|
|
27
|
+
let T = null, b = null, f;
|
|
28
|
+
const O = (t, e) => {
|
|
29
|
+
M && console.debug(`[guido:cortex] msg=${t ?? "?"} type=${(e == null ? void 0 : e.type) ?? "?"}`, e);
|
|
30
|
+
}, G = () => new Set((f == null ? void 0 : f.appliedBlueprintKeys) ?? []), K = (t) => t instanceof Error ? t.message : String(t), D = (t, e, o, r) => {
|
|
31
|
+
if (v !== y)
|
|
32
|
+
return;
|
|
33
|
+
const n = p.applyAcks[t], l = Math.max(Date.now(), ((n == null ? void 0 : n.ackAt) ?? 0) + 1), c = { status: e, requestedAt: o, ackAt: l };
|
|
34
|
+
r !== void 0 && (c.error = K(r)), p.$patch((a) => {
|
|
35
|
+
a.applyAcks = { ...a.applyAcks, [t]: c };
|
|
36
|
+
});
|
|
37
|
+
}, B = (t) => (d.get(t) ?? 0) > 0, w = async (t, e, o, r) => {
|
|
38
|
+
var a, i, q;
|
|
39
|
+
const n = ((a = o.blueprintData) == null ? void 0 : a.html) ?? "", l = ((i = o.blueprintData) == null ? void 0 : i.css) ?? "", c = o.applyRequestedAt ?? 0;
|
|
40
|
+
d.set(t, (d.get(t) ?? 0) + 1);
|
|
41
|
+
try {
|
|
42
|
+
const s = r === "debounced" ? await I(e, { html: n, css: l }) : await F(e, { html: n, css: l });
|
|
43
|
+
if (s.status === "superseded")
|
|
44
|
+
return;
|
|
45
|
+
if (s.status === "applied") {
|
|
46
|
+
h.set(e, n), u.delete(t), D(t, "applied", c);
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
const m = u.get(t);
|
|
50
|
+
u.set(t, { html: n, count: (m == null ? void 0 : m.html) === n ? m.count + 1 : 1 }), D(t, "failed", c, s.error);
|
|
51
|
+
} finally {
|
|
52
|
+
d.set(t, (d.get(t) ?? 1) - 1);
|
|
53
|
+
const s = E.get(t);
|
|
54
|
+
s && !B(t) && (E.delete(t), (((q = s.blueprintData) == null ? void 0 : q.html) ?? "") !== n && w(t, e, s, r));
|
|
55
|
+
}
|
|
56
|
+
}, U = (t) => {
|
|
57
|
+
var a;
|
|
58
|
+
if (t.blueprintType !== W)
|
|
29
59
|
return;
|
|
30
|
-
const
|
|
31
|
-
if (!
|
|
60
|
+
const { blueprintId: e } = t, o = (a = t.blueprintData) == null ? void 0 : a.html;
|
|
61
|
+
if (!e || !o)
|
|
32
62
|
return;
|
|
33
|
-
if (!
|
|
34
|
-
|
|
63
|
+
if (!t.applyRequested) {
|
|
64
|
+
x(e);
|
|
35
65
|
return;
|
|
36
66
|
}
|
|
37
|
-
const
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
67
|
+
const r = ot(e, t.version), n = t.applyRequestedAt ?? 0, l = S.get(r);
|
|
68
|
+
if (l === void 0 || n > l) {
|
|
69
|
+
const i = l === void 0;
|
|
70
|
+
if (S.set(r, n), u.delete(r), i && G().has(r)) {
|
|
71
|
+
h.set(e, o);
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
w(r, e, t, "immediate");
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
const c = h.get(e);
|
|
78
|
+
if (c !== o) {
|
|
79
|
+
if (c === void 0) {
|
|
80
|
+
if (B(r)) {
|
|
81
|
+
E.set(r, t);
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
const i = u.get(r);
|
|
85
|
+
if ((i == null ? void 0 : i.html) === o && i.count >= rt)
|
|
86
|
+
return;
|
|
87
|
+
w(r, e, t, "immediate");
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
w(r, e, t, "debounced");
|
|
91
|
+
}
|
|
92
|
+
}, g = (t) => t === void 0 || _.has(t) ? !1 : (_.add(t), C({
|
|
93
|
+
type: z.Error,
|
|
94
|
+
message: H("newsletter.ai-template-failed")
|
|
95
|
+
}), !0), Y = (t) => {
|
|
96
|
+
Array.isArray(t) && t.forEach((e) => {
|
|
97
|
+
const o = e == null ? void 0 : e.id;
|
|
98
|
+
(e == null ? void 0 : e.isError) === !0 && g(o) && M && console.debug(`[guido:cortex] message-level error id=${o}`, e);
|
|
99
|
+
const r = e == null ? void 0 : e.segments;
|
|
100
|
+
Array.isArray(r) && r.forEach((n) => {
|
|
101
|
+
if (n)
|
|
102
|
+
switch (O(o, n), n.type) {
|
|
103
|
+
case "blueprint":
|
|
104
|
+
U(n);
|
|
105
|
+
break;
|
|
106
|
+
case "error":
|
|
107
|
+
g(o);
|
|
108
|
+
break;
|
|
109
|
+
}
|
|
60
110
|
});
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
111
|
+
});
|
|
112
|
+
}, P = () => {
|
|
113
|
+
T !== null && (clearInterval(T), T = null);
|
|
114
|
+
}, $ = () => {
|
|
115
|
+
var t;
|
|
116
|
+
return (t = A._s) == null ? void 0 : t.get(tt);
|
|
117
|
+
}, L = (t) => {
|
|
118
|
+
f = t, b = Z(() => t.messages, Y, { deep: !0, immediate: !0 });
|
|
119
|
+
}, R = $();
|
|
120
|
+
R ? L(R) : T = setInterval(() => {
|
|
121
|
+
const t = $();
|
|
122
|
+
t && (P(), L(t));
|
|
123
|
+
}, nt), V(() => {
|
|
124
|
+
P(), b == null || b(), f = void 0, h.clear(), S.clear(), u.clear(), d.clear(), E.clear(), _.clear(), v === y && (v = null, p.$patch((t) => {
|
|
125
|
+
t.bridgeActive = !1, t.applyAcks = {};
|
|
126
|
+
}), N());
|
|
66
127
|
});
|
|
67
128
|
};
|
|
68
129
|
export {
|
|
69
|
-
|
|
130
|
+
ft as useCortexBlueprintBridge
|
|
70
131
|
};
|
|
@@ -1,59 +1,102 @@
|
|
|
1
|
-
import { useActionsApi as
|
|
2
|
-
import { useConfig as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
1
|
+
import { useActionsApi as Q } from "./useActionsApi.js";
|
|
2
|
+
import { useConfig as x } from "./useConfig.js";
|
|
3
|
+
import { useEditorLock as z } from "./useEditorLock.js";
|
|
4
|
+
import { useToaster as N } from "./useToaster.js";
|
|
5
|
+
import { useTranslations as q } from "./useTranslations.js";
|
|
6
|
+
import { ToasterTypeOptions as D } from "../enums/toaster.js";
|
|
7
|
+
import { useDynamicContentStore as R } from "../stores/dynamic-content.js";
|
|
8
|
+
import { useEditorStore as F } from "../stores/editor.js";
|
|
9
|
+
import { flattenDynamicContentList as G } from "../utils/genericUtil.js";
|
|
10
|
+
import { extractUsedDynamicContent as $ } from "../utils/registerUsedDynamicContent.js";
|
|
11
|
+
import { ref as j, watch as J } from "vue";
|
|
12
|
+
const K = 250, S = 12e4, c = { status: "superseded" }, h = { status: "failed", error: new Error("Blueprint has no html to apply") }, i = j({}), v = /* @__PURE__ */ new Map(), u = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map(), p = /* @__PURE__ */ new Map(), l = /* @__PURE__ */ new Map(), ie = () => {
|
|
13
|
+
const { updateHtmlAndCss: a } = Q(), { runExclusive: M } = z(), { showToaster: d } = N(), y = q(), { template: U } = x(), A = R(), E = F(), T = (e, t) => {
|
|
14
|
+
u.get(e) !== t && (u.set(e, t), d({
|
|
15
|
+
type: D.Error,
|
|
16
|
+
message: y("newsletter.ai-template-failed-apply")
|
|
17
|
+
}));
|
|
18
|
+
}, O = () => {
|
|
19
|
+
var e, t;
|
|
20
|
+
return E.isStripoInitialized && typeof ((t = (e = window.StripoEditorApi) == null ? void 0 : e.actionsApi) == null ? void 0 : t.updateHtmlAndCss) == "function";
|
|
21
|
+
}, P = (e) => {
|
|
22
|
+
i.value[e] === void 0 && (i.value = { ...i.value, [e]: "pending" });
|
|
23
|
+
}, m = (e, t) => {
|
|
24
|
+
i.value = { ...i.value, [e]: t };
|
|
25
|
+
}, _ = (e) => {
|
|
26
|
+
var t;
|
|
19
27
|
try {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
28
|
+
const o = G((t = U.value) == null ? void 0 : t.dynamicContentList), s = $(e, o);
|
|
29
|
+
s.length > 0 && A.registerDynamicContent(s);
|
|
30
|
+
} catch {
|
|
31
|
+
}
|
|
32
|
+
}, H = (e, t) => {
|
|
33
|
+
u.delete(e), v.get(e) !== t && (v.set(e, t), d({
|
|
34
|
+
type: D.Success,
|
|
35
|
+
message: y("newsletter.ai-template-applied")
|
|
36
|
+
}));
|
|
37
|
+
}, g = async (e, t, o) => {
|
|
38
|
+
const s = (l.get(e) ?? 0) + 1;
|
|
39
|
+
l.set(e, s), m(e, "applying");
|
|
40
|
+
try {
|
|
41
|
+
await M(() => a(t, o));
|
|
32
42
|
} catch (n) {
|
|
33
|
-
|
|
34
|
-
type: f.Error,
|
|
35
|
-
message: n instanceof Error ? n.message : "Failed to apply template"
|
|
36
|
-
});
|
|
43
|
+
return l.get(e) !== s ? c : (console.error("[guido:apply] editor did not acknowledge the template apply", n), m(e, "failed"), T(e, t), { status: "failed", error: n });
|
|
37
44
|
}
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
t
|
|
45
|
+
return l.get(e) !== s ? c : (m(e, "applied"), _(t), H(e, t), { status: "applied" });
|
|
46
|
+
}, k = (e) => {
|
|
47
|
+
const t = r.get(e);
|
|
48
|
+
t && (clearTimeout(t.timer), r.delete(e), t.settle(c));
|
|
49
|
+
}, w = (e) => {
|
|
50
|
+
const t = p.get(e);
|
|
51
|
+
t && (clearTimeout(t.timer), p.delete(e), t.settle(c));
|
|
52
|
+
}, B = (e, t, o) => new Promise((s) => {
|
|
53
|
+
k(e);
|
|
54
|
+
const n = setTimeout(() => {
|
|
55
|
+
r.delete(e), m(e, "failed"), T(e, t), s({
|
|
56
|
+
status: "failed",
|
|
57
|
+
error: new Error(`Editor did not become ready within ${S}ms`)
|
|
58
|
+
});
|
|
59
|
+
}, S);
|
|
60
|
+
r.set(e, { html: t, css: o, timer: n, settle: s }), m(e, "applying");
|
|
61
|
+
}), C = (e, t, o) => O() ? g(e, t, o) : B(e, t, o), L = async () => {
|
|
62
|
+
if (r.size === 0)
|
|
63
|
+
return;
|
|
64
|
+
const e = [...r.entries()];
|
|
65
|
+
r.clear(), e.forEach(([, n]) => clearTimeout(n.timer));
|
|
66
|
+
const t = e.pop();
|
|
67
|
+
if (e.forEach(([n, f]) => {
|
|
68
|
+
m(n, "pending"), f.settle(c);
|
|
69
|
+
}), !t)
|
|
70
|
+
return;
|
|
71
|
+
const [o, s] = t;
|
|
72
|
+
s.settle(await g(o, s.html, s.css));
|
|
41
73
|
};
|
|
42
|
-
return
|
|
43
|
-
|
|
74
|
+
return J(() => E.isStripoInitialized, (e) => {
|
|
75
|
+
e && L();
|
|
76
|
+
}, { immediate: !0 }), { applyStatus: i, markPending: P, applyTemplate: (e, t) => {
|
|
77
|
+
const { html: o } = t;
|
|
78
|
+
return o ? (w(e), C(e, o, t.css ?? "")) : Promise.resolve(h);
|
|
44
79
|
}, applyTemplateDebounced: (e, t) => {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
const
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
80
|
+
const { html: o } = t;
|
|
81
|
+
if (!o)
|
|
82
|
+
return Promise.resolve(h);
|
|
83
|
+
const s = t.css ?? "";
|
|
84
|
+
return new Promise((n) => {
|
|
85
|
+
w(e);
|
|
86
|
+
const f = setTimeout(() => {
|
|
87
|
+
p.delete(e), C(e, o, s).then(n);
|
|
88
|
+
}, K);
|
|
89
|
+
p.set(e, { timer: f, settle: n });
|
|
90
|
+
});
|
|
52
91
|
} };
|
|
53
|
-
},
|
|
54
|
-
|
|
92
|
+
}, ce = () => {
|
|
93
|
+
p.forEach((a) => {
|
|
94
|
+
clearTimeout(a.timer), a.settle(c);
|
|
95
|
+
}), p.clear(), r.forEach((a) => {
|
|
96
|
+
clearTimeout(a.timer), a.settle(c);
|
|
97
|
+
}), r.clear(), l.clear(), u.clear(), i.value = {};
|
|
55
98
|
};
|
|
56
99
|
export {
|
|
57
|
-
|
|
58
|
-
|
|
100
|
+
ce as resetEmailTemplateApplier,
|
|
101
|
+
ie as useEmailTemplateApplier
|
|
59
102
|
};
|
|
@@ -1,54 +1,59 @@
|
|
|
1
|
-
import { useActionsApi as
|
|
2
|
-
import { useEditorLock as
|
|
1
|
+
import { useActionsApi as v } from "./useActionsApi.js";
|
|
2
|
+
import { useEditorLock as C } from "./useEditorLock.js";
|
|
3
3
|
import { useConfigStore as T } from "../stores/config.js";
|
|
4
4
|
import { useEditorStore as w } from "../stores/editor.js";
|
|
5
5
|
import { useGuidoEmailEditorStore as y } from "../stores/guido-email-editor.js";
|
|
6
|
-
import { watch as
|
|
7
|
-
const
|
|
8
|
-
const i = w(), u = y(),
|
|
9
|
-
let o = null,
|
|
10
|
-
const
|
|
6
|
+
import { watch as c, onUnmounted as z } from "vue";
|
|
7
|
+
const B = 500, G = () => {
|
|
8
|
+
const i = w(), u = y(), d = T(), { getTemplateData: l } = v(), { runExclusive: m, isEditorBusy: p } = C();
|
|
9
|
+
let o = null, n = !1;
|
|
10
|
+
const r = () => {
|
|
11
11
|
o && (clearTimeout(o), o = null);
|
|
12
|
-
},
|
|
13
|
-
|
|
12
|
+
}, a = (t) => {
|
|
13
|
+
r(), o = setTimeout(() => {
|
|
14
14
|
o = null, t();
|
|
15
|
-
},
|
|
15
|
+
}, B);
|
|
16
16
|
}, e = async () => {
|
|
17
|
-
var t,
|
|
18
|
-
if (!(
|
|
17
|
+
var t, s;
|
|
18
|
+
if (!(n || !i.isStripoInitialized)) {
|
|
19
19
|
if (p()) {
|
|
20
|
-
|
|
20
|
+
a(() => void e());
|
|
21
21
|
return;
|
|
22
22
|
}
|
|
23
23
|
try {
|
|
24
|
-
const { html: E, css:
|
|
25
|
-
if (
|
|
24
|
+
const { html: E, css: I } = await m(l), b = ((s = (t = d.config) == null ? void 0 : t.identity) == null ? void 0 : s.templateId) ?? "";
|
|
25
|
+
if (n)
|
|
26
26
|
return;
|
|
27
27
|
u.$patch({
|
|
28
28
|
html: E ?? "",
|
|
29
|
-
css:
|
|
30
|
-
templateId:
|
|
29
|
+
css: I ?? "",
|
|
30
|
+
templateId: b,
|
|
31
31
|
lastUpdatedAt: Date.now()
|
|
32
32
|
});
|
|
33
33
|
} catch {
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
|
-
}, f = () =>
|
|
36
|
+
}, f = () => a(() => void e()), h = c(
|
|
37
37
|
() => i.isStripoInitialized,
|
|
38
38
|
(t) => {
|
|
39
39
|
t && e();
|
|
40
40
|
},
|
|
41
41
|
{ immediate: !0 }
|
|
42
|
-
), S =
|
|
42
|
+
), S = c(
|
|
43
|
+
() => i.changeSeq,
|
|
44
|
+
() => {
|
|
45
|
+
i.isStripoInitialized && f();
|
|
46
|
+
}
|
|
47
|
+
), g = c(
|
|
43
48
|
() => i.hasChanges,
|
|
44
|
-
(t,
|
|
45
|
-
|
|
49
|
+
(t, s) => {
|
|
50
|
+
!t && s && i.isStripoInitialized && (r(), e());
|
|
46
51
|
}
|
|
47
52
|
);
|
|
48
|
-
|
|
49
|
-
|
|
53
|
+
z(() => {
|
|
54
|
+
n = !0, r(), h(), S(), g();
|
|
50
55
|
});
|
|
51
56
|
};
|
|
52
57
|
export {
|
|
53
|
-
|
|
58
|
+
G as useGuidoStateBridge
|
|
54
59
|
};
|
|
@@ -1,14 +1,16 @@
|
|
|
1
|
-
import { getCsrfToken as
|
|
2
|
-
import { ref as
|
|
3
|
-
const
|
|
4
|
-
const
|
|
1
|
+
import { getCsrfToken as O } from "../utils/genericUtil.js";
|
|
2
|
+
import { ref as m, computed as T } from "vue";
|
|
3
|
+
const X = (b = {}) => {
|
|
4
|
+
const p = m(!1), a = m(null), u = m(null), g = T(() => p.value), y = T(() => a.value !== null), v = {
|
|
5
5
|
baseURL: "",
|
|
6
6
|
timeout: 1e4,
|
|
7
7
|
retry: 0,
|
|
8
8
|
retryDelay: 1e3,
|
|
9
9
|
headers: {
|
|
10
10
|
"Content-Type": "application/json",
|
|
11
|
-
"X-CSRF-TOKEN":
|
|
11
|
+
"X-CSRF-TOKEN": O(),
|
|
12
|
+
Accept: "application/json",
|
|
13
|
+
"X-Requested-With": "XMLHttpRequest"
|
|
12
14
|
},
|
|
13
15
|
...b
|
|
14
16
|
}, w = (e, s) => {
|
|
@@ -22,22 +24,22 @@ const k = (b = {}) => {
|
|
|
22
24
|
}, e);
|
|
23
25
|
}), x = (e) => new Promise((s) => {
|
|
24
26
|
setTimeout(s, e);
|
|
25
|
-
}), i = async (e, s, t,
|
|
26
|
-
a.value = null,
|
|
27
|
-
const n = { ...v, ...
|
|
27
|
+
}), i = async (e, s, t, L = {}) => {
|
|
28
|
+
a.value = null, p.value = !0, u.value = new AbortController();
|
|
29
|
+
const n = { ...v, ...L }, D = w(s, n.baseURL), c = {
|
|
28
30
|
method: e,
|
|
29
31
|
headers: { ...n.headers },
|
|
30
32
|
signal: u.value.signal,
|
|
31
33
|
...n
|
|
32
34
|
};
|
|
33
35
|
t && ["POST", "PUT", "PATCH"].includes(e) && (t instanceof FormData ? (delete c.headers["Content-Type"], c.body = t) : c.body = JSON.stringify(t));
|
|
34
|
-
const E = async (
|
|
36
|
+
const E = async (h = 0) => {
|
|
35
37
|
try {
|
|
36
|
-
const o = [fetch(
|
|
38
|
+
const o = [fetch(D, c)];
|
|
37
39
|
n.timeout && o.push(P(n.timeout));
|
|
38
40
|
const r = await Promise.race(o);
|
|
39
41
|
if (!r.ok) {
|
|
40
|
-
const
|
|
42
|
+
const H = `HTTP Error: ${r.status} ${r.statusText}`, d = new Error(H);
|
|
41
43
|
throw d.status = r.status, d.statusText = r.statusText, d.response = r, d;
|
|
42
44
|
}
|
|
43
45
|
let f;
|
|
@@ -50,19 +52,19 @@ const k = (b = {}) => {
|
|
|
50
52
|
};
|
|
51
53
|
} catch (o) {
|
|
52
54
|
const r = o instanceof Error && o.name === "AbortError";
|
|
53
|
-
if (
|
|
54
|
-
return await x(n.retryDelay || 1e3), E(
|
|
55
|
+
if (h < (n.retry || 0) && !r)
|
|
56
|
+
return await x(n.retryDelay || 1e3), E(h + 1);
|
|
55
57
|
throw o instanceof Error ? o.name === "AbortError" ? a.value = { message: "Request was cancelled" } : a.value = { message: o.message } : a.value = o, o;
|
|
56
58
|
}
|
|
57
59
|
};
|
|
58
60
|
try {
|
|
59
61
|
return await E();
|
|
60
62
|
} finally {
|
|
61
|
-
|
|
63
|
+
p.value = !1, u.value = null;
|
|
62
64
|
}
|
|
63
|
-
}, C = (e, s) => i("GET", e, void 0, s),
|
|
65
|
+
}, C = (e, s) => i("GET", e, void 0, s), R = (e, s, t) => i("POST", e, s, t), $ = (e, s, t) => i("PUT", e, s, t), q = (e, s, t) => i("PATCH", e, s, t), A = (e, s) => i("DELETE", e, void 0, s), U = (e) => {
|
|
64
66
|
u.value && u.value.abort(e);
|
|
65
|
-
},
|
|
67
|
+
}, W = () => {
|
|
66
68
|
a.value = null;
|
|
67
69
|
};
|
|
68
70
|
return {
|
|
@@ -73,14 +75,14 @@ const k = (b = {}) => {
|
|
|
73
75
|
// Methods
|
|
74
76
|
request: i,
|
|
75
77
|
get: C,
|
|
76
|
-
post:
|
|
77
|
-
put:
|
|
78
|
-
patch:
|
|
78
|
+
post: R,
|
|
79
|
+
put: $,
|
|
80
|
+
patch: q,
|
|
79
81
|
delete: A,
|
|
80
|
-
cancel:
|
|
81
|
-
clearError:
|
|
82
|
+
cancel: U,
|
|
83
|
+
clearError: W
|
|
82
84
|
};
|
|
83
85
|
};
|
|
84
86
|
export {
|
|
85
|
-
|
|
87
|
+
X as useHttp
|
|
86
88
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { useActionsApi as
|
|
2
|
-
import { useBlocksConfig as
|
|
3
|
-
import { useConfig as
|
|
1
|
+
import { useActionsApi as x } from "./useActionsApi.js";
|
|
2
|
+
import { useBlocksConfig as L } from "./useBlocksConfig.js";
|
|
3
|
+
import { useConfig as O } from "./useConfig.js";
|
|
4
4
|
import { useCustomInterfaceAppearance as H } from "./useCustomInterfaceAppearance.js";
|
|
5
5
|
import { useFullStoryBridge as N } from "./useFullStoryBridge.js";
|
|
6
6
|
import { useModuleRepair as j } from "./useModuleRepair.js";
|
|
@@ -17,7 +17,7 @@ import { buildMergeTagEntries as W, flattenDynamicContentList as Y } from "../ut
|
|
|
17
17
|
import Z from "../package.json.js";
|
|
18
18
|
let n = null;
|
|
19
19
|
const Ce = () => {
|
|
20
|
-
const { features: c, template: u, isFeatureEnabled: m } =
|
|
20
|
+
const { features: c, template: u, isFeatureEnabled: m } = O(), { handleError: p, showToaster: k } = G(), { getToken: B, getCustomFonts: M, getSyncModulesStatus: T } = K(), { handleEvent: v } = z(), { handleModuleAdd: F } = j(), { getStripoBlocksConfig: A } = L(), { getStripoNotifications: V } = $(), f = () => n || (n = new Promise((i, s) => {
|
|
21
21
|
var d;
|
|
22
22
|
if (document.getElementById("UiEditorScript")) {
|
|
23
23
|
i();
|
|
@@ -88,8 +88,8 @@ const Ce = () => {
|
|
|
88
88
|
},
|
|
89
89
|
onTemplateLoaded() {
|
|
90
90
|
try {
|
|
91
|
-
const { importCss: t } = H(), { activateCustomViewStyles: l, updateTimerInClonedTemplate: I } =
|
|
92
|
-
t(), l(),
|
|
91
|
+
const { importCss: t } = H(), { activateCustomViewStyles: l, updateTimerInClonedTemplate: I } = x(), { injectFullStory: q } = N();
|
|
92
|
+
t(), l(), q(), I(), o.onReady(), e.isStripoInitialized = !0, e.loadingStatus = !1, setTimeout(() => {
|
|
93
93
|
e.hasChanges = !1;
|
|
94
94
|
}, 1e3);
|
|
95
95
|
} catch (t) {
|
|
@@ -106,7 +106,7 @@ const Ce = () => {
|
|
|
106
106
|
e.isVersionHistoryOpen = t;
|
|
107
107
|
},
|
|
108
108
|
onDataChanged() {
|
|
109
|
-
e.hasChanges = !0;
|
|
109
|
+
e.hasChanges = !0, e.changeSeq += 1;
|
|
110
110
|
},
|
|
111
111
|
onEvent: v,
|
|
112
112
|
onModuleAdd: F,
|
|
@@ -67,7 +67,7 @@ class se extends ut {
|
|
|
67
67
|
(d, c) => `
|
|
68
68
|
<div data-reorder-icon-key="${P}${c}" style="display: none;">
|
|
69
69
|
<${_.BUTTON}
|
|
70
|
-
class="drag-handle-btn flat-inline flat-white"
|
|
70
|
+
class="guido-drag-handle-btn flat-inline flat-white"
|
|
71
71
|
${O.BUTTON.name}="${P}${c}"
|
|
72
72
|
>
|
|
73
73
|
<${_.ICON}
|
|
@@ -328,7 +328,7 @@ class se extends ut {
|
|
|
328
328
|
_createBuiltInItemHtml(t, e) {
|
|
329
329
|
return `
|
|
330
330
|
<div class="orderable-item" draggable="true" data-key="${t.key}">
|
|
331
|
-
<span class="drag-handle" data-reorder-icon-slot="${e}"></span>
|
|
331
|
+
<span class="guido-drag-handle" data-reorder-icon-slot="${e}"></span>
|
|
332
332
|
<span class="item-label">${this.api.translate(t.label)}</span>
|
|
333
333
|
<div class="item-action" data-action-for="${t.key}"></div>
|
|
334
334
|
</div>
|
|
@@ -353,7 +353,7 @@ class se extends ut {
|
|
|
353
353
|
<div class="orderable-item price-group-item" draggable="true"
|
|
354
354
|
data-key="${C}" data-group="prices">
|
|
355
355
|
<div class="price-group-header">
|
|
356
|
-
<span class="drag-handle" data-reorder-icon-slot="${t}"></span>
|
|
356
|
+
<span class="guido-drag-handle" data-reorder-icon-slot="${t}"></span>
|
|
357
357
|
<span class="item-label">${this.api.translate("Product Prices")}</span>
|
|
358
358
|
<div class="item-action" data-action-for="${C}"></div>
|
|
359
359
|
</div>
|
|
@@ -365,7 +365,7 @@ class se extends ut {
|
|
|
365
365
|
return `
|
|
366
366
|
<div class="orderable-item" draggable="true"
|
|
367
367
|
data-key="${t}" data-custom-index="${e}">
|
|
368
|
-
<span class="drag-handle" data-reorder-icon-slot="${r}"></span>
|
|
368
|
+
<span class="guido-drag-handle" data-reorder-icon-slot="${r}"></span>
|
|
369
369
|
<div class="custom-attr-select-wrap"
|
|
370
370
|
data-custom-select-slot="${e}"></div>
|
|
371
371
|
<div class="item-action"
|
|
@@ -134,7 +134,10 @@ ue-orderable.orderable-disabled .droppable-icon {
|
|
|
134
134
|
border-top: 2px solid var(--guido-color-primary-500, #0A2ECC);
|
|
135
135
|
}
|
|
136
136
|
|
|
137
|
-
|
|
137
|
+
/* Namespaced: Stripo ships a global \`.drag-handle { position: absolute }\` for its
|
|
138
|
+
floating popups, which knocked this handle out of flow (SD-151734). */
|
|
139
|
+
.guido-drag-handle {
|
|
140
|
+
cursor: move;
|
|
138
141
|
user-select: none;
|
|
139
142
|
display: flex;
|
|
140
143
|
align-items: center;
|
|
@@ -144,13 +147,13 @@ ue-orderable.orderable-disabled .droppable-icon {
|
|
|
144
147
|
flex-shrink: 0;
|
|
145
148
|
}
|
|
146
149
|
|
|
147
|
-
.drag-handle .drag-handle-btn .button {
|
|
150
|
+
.guido-drag-handle .guido-drag-handle-btn .button {
|
|
148
151
|
padding: 0;
|
|
149
152
|
min-width: auto;
|
|
150
153
|
cursor: move;
|
|
151
154
|
}
|
|
152
155
|
|
|
153
|
-
.drag-handle .drag-handle-btn .button .icon-button {
|
|
156
|
+
.guido-drag-handle .guido-drag-handle-btn .button .icon-button {
|
|
154
157
|
color: var(--guido-color-gray-600);
|
|
155
158
|
}
|
|
156
159
|
|