@useinsider/guido 3.19.0-beta.acb00a2 → 3.19.0-beta.c0e1797
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/components/Guido.vue.js +1 -1
- package/dist/components/Guido.vue2.js +53 -59
- package/dist/components/organisms/header/EditorActions.vue.js +4 -4
- package/dist/components/organisms/header/EditorActions.vue2.js +23 -25
- package/dist/composables/useActionsApi.js +44 -43
- package/dist/composables/useCodeEditorApi.js +23 -9
- package/dist/composables/useCortexBlueprintBridge.js +54 -122
- package/dist/composables/useEmailTemplateApplier.js +52 -108
- package/dist/composables/useLegacyStrategyConversion.js +23 -19
- package/dist/composables/useTranslations.js +3 -2
- package/dist/composables/useVersionHistoryApi.js +33 -24
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +1 -0
- package/dist/guido.css +1 -1
- package/dist/src/composables/useCortexBlueprintBridge.d.ts +3 -2
- package/dist/src/composables/useEmailTemplateApplier.d.ts +5 -18
- package/dist/src/stores/guido-email-editor.d.ts +10 -20
- package/dist/src/utils/stripoEditorApi.d.ts +4 -0
- package/dist/stores/guido-email-editor.js +1 -3
- package/dist/stores/unsubscribe.js +3 -3
- package/dist/utils/stripoEditorApi.js +11 -0
- package/package.json +2 -1
|
@@ -1,138 +1,70 @@
|
|
|
1
|
-
import { useEmailTemplateApplier as
|
|
2
|
-
import { useToaster as
|
|
3
|
-
import { useTranslations as
|
|
4
|
-
import { ToasterTypeOptions as
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
const rt = "email_template", nt = "chat", ot = "guido:debug:ai", it = 2, lt = 500, ct = (b, p) => `${b}:${p ?? 1}`;
|
|
9
|
-
let S = null;
|
|
10
|
-
const at = () => {
|
|
1
|
+
import { useEmailTemplateApplier as w, resetEmailTemplateApplier as _ } from "./useEmailTemplateApplier.js";
|
|
2
|
+
import { useToaster as I } from "./useToaster.js";
|
|
3
|
+
import { useTranslations as P } from "./useTranslations.js";
|
|
4
|
+
import { ToasterTypeOptions as S } from "../enums/toaster.js";
|
|
5
|
+
import { getActivePinia as v } from "pinia";
|
|
6
|
+
import { watch as B, onUnmounted as D } from "vue";
|
|
7
|
+
const x = "email_template", L = "chat", M = "guido:debug:ai", R = () => {
|
|
11
8
|
if (typeof window > "u")
|
|
12
9
|
return !1;
|
|
13
10
|
try {
|
|
14
|
-
return window.localStorage.getItem(
|
|
11
|
+
return window.localStorage.getItem(M) === "1";
|
|
15
12
|
} catch {
|
|
16
13
|
return !1;
|
|
17
14
|
}
|
|
18
|
-
},
|
|
19
|
-
const
|
|
20
|
-
if (!
|
|
15
|
+
}, H = () => {
|
|
16
|
+
const c = v();
|
|
17
|
+
if (!c)
|
|
21
18
|
return;
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
})
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
}, U = () => new Set((A == null ? void 0 : A.appliedBlueprintKeys) ?? []), Y = (t) => t instanceof Error ? t.message : String(t), D = (t, r, n, e) => {
|
|
33
|
-
if (S !== M)
|
|
34
|
-
return;
|
|
35
|
-
const o = p.applyAcks[t], c = Math.max(Date.now(), ((o == null ? void 0 : o.ackAt) ?? 0) + 1), a = { status: r, requestedAt: n, ackAt: c };
|
|
36
|
-
e !== void 0 && (a.error = Y(e)), p.$patch((l) => {
|
|
37
|
-
l.applyAcks = { ...l.applyAcks, [t]: a };
|
|
38
|
-
});
|
|
39
|
-
}, I = (t) => (d.get(t) ?? 0) > 0, P = (t) => (s == null ? void 0 : s.key) === t, v = async (t, r, n) => {
|
|
40
|
-
var a, l, h;
|
|
41
|
-
const e = ((a = r.blueprintData) == null ? void 0 : a.html) ?? "", o = ((l = r.blueprintData) == null ? void 0 : l.css) ?? "", c = r.applyRequestedAt ?? 0;
|
|
42
|
-
d.set(t, (d.get(t) ?? 0) + 1);
|
|
43
|
-
try {
|
|
44
|
-
const i = n === "debounced" ? await O(t, { html: e, css: o }) : await H(t, { html: e, css: o });
|
|
45
|
-
if (i.status === "superseded")
|
|
46
|
-
return;
|
|
47
|
-
if (i.status === "applied") {
|
|
48
|
-
E.set(t, e), u.delete(t), D(t, "applied", c);
|
|
49
|
-
return;
|
|
50
|
-
}
|
|
51
|
-
const y = u.get(t), j = (y == null ? void 0 : y.html) === e ? y.count + 1 : 1;
|
|
52
|
-
u.set(t, { html: e, count: j }), D(t, "failed", c, i.error);
|
|
53
|
-
} catch (i) {
|
|
54
|
-
console.error("[guido:apply] apply threw before it could settle", i), D(t, "failed", c, i);
|
|
55
|
-
} finally {
|
|
56
|
-
d.set(t, (d.get(t) ?? 1) - 1);
|
|
57
|
-
const i = T.get(t);
|
|
58
|
-
i && !I(t) && (T.delete(t), P(t) && (((h = i.blueprintData) == null ? void 0 : h.html) ?? "") !== e && v(t, i, n));
|
|
59
|
-
}
|
|
60
|
-
}, N = (t) => {
|
|
61
|
-
var h;
|
|
62
|
-
if (t.blueprintType !== rt)
|
|
63
|
-
return;
|
|
64
|
-
const { blueprintId: r } = t, n = (h = t.blueprintData) == null ? void 0 : h.html;
|
|
65
|
-
if (!r || !n)
|
|
66
|
-
return;
|
|
67
|
-
const e = ct(r, t.version);
|
|
68
|
-
if (!t.applyRequested) {
|
|
69
|
-
F(e);
|
|
19
|
+
const l = c._s, p = l == null ? void 0 : l.get(L);
|
|
20
|
+
if (!p)
|
|
21
|
+
return;
|
|
22
|
+
const { markPending: d, applyTemplate: f, applyTemplateDebounced: T } = w(), { showToaster: E } = I(), h = P(), y = (r, t) => {
|
|
23
|
+
const e = h(r);
|
|
24
|
+
return e === r ? t : e;
|
|
25
|
+
}, i = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Set(), u = R(), A = (r, t) => {
|
|
26
|
+
u && console.debug(`[guido:cortex] msg=${r ?? "?"} type=${(t == null ? void 0 : t.type) ?? "?"}`, t);
|
|
27
|
+
}, b = (r) => {
|
|
28
|
+
if (r.blueprintType !== x)
|
|
70
29
|
return;
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
if (c === void 0 || o > c) {
|
|
74
|
-
const i = c === void 0;
|
|
75
|
-
if (_.set(e, o), u.delete(e), (!s || o >= s.requestedAt) && (s = { key: e, requestedAt: o }), i && U().has(e)) {
|
|
76
|
-
E.set(e, n);
|
|
77
|
-
return;
|
|
78
|
-
}
|
|
79
|
-
v(e, t, "immediate");
|
|
30
|
+
const t = r.blueprintId, e = r.blueprintData;
|
|
31
|
+
if (!t || !(e != null && e.html))
|
|
80
32
|
return;
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
if (a === n || !P(e))
|
|
33
|
+
if (!r.applyRequested) {
|
|
34
|
+
d(t);
|
|
84
35
|
return;
|
|
85
|
-
const l = u.get(e);
|
|
86
|
-
if (!((l == null ? void 0 : l.html) === n && l.count >= it)) {
|
|
87
|
-
if (a === void 0) {
|
|
88
|
-
if (I(e)) {
|
|
89
|
-
T.set(e, t);
|
|
90
|
-
return;
|
|
91
|
-
}
|
|
92
|
-
v(e, t, "immediate");
|
|
93
|
-
return;
|
|
94
|
-
}
|
|
95
|
-
f.get(e) !== n && (f.set(e, n), v(e, t, "debounced").finally(() => {
|
|
96
|
-
f.get(e) === n && f.delete(e);
|
|
97
|
-
}));
|
|
98
36
|
}
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
Array.isArray(
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
37
|
+
const o = i.get(t);
|
|
38
|
+
o === void 0 ? (i.set(t, e.html), f(t, e)) : o !== e.html && (i.set(t, e.html), T(t, e));
|
|
39
|
+
}, s = (r) => r === void 0 || a.has(r) ? !1 : (a.add(r), E({
|
|
40
|
+
type: S.Error,
|
|
41
|
+
message: y("newsletter.ai-template-failed", "AI couldn't generate the template. Please try again.")
|
|
42
|
+
}), !0), m = B(
|
|
43
|
+
() => p.messages,
|
|
44
|
+
(r) => {
|
|
45
|
+
Array.isArray(r) && r.forEach((t) => {
|
|
46
|
+
const e = t == null ? void 0 : t.id;
|
|
47
|
+
(t == null ? void 0 : t.isError) === !0 && s(e) && u && console.debug(`[guido:cortex] message-level error id=${e}`, t);
|
|
48
|
+
const o = t == null ? void 0 : t.segments;
|
|
49
|
+
Array.isArray(o) && o.forEach((n) => {
|
|
50
|
+
if (n)
|
|
51
|
+
switch (A(e, n), n.type) {
|
|
52
|
+
case "blueprint":
|
|
53
|
+
b(n);
|
|
54
|
+
break;
|
|
55
|
+
case "error":
|
|
56
|
+
s(e);
|
|
57
|
+
break;
|
|
58
|
+
}
|
|
59
|
+
});
|
|
117
60
|
});
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
return (t = b._s) == null ? void 0 : t.get(nt);
|
|
124
|
-
}, L = (t) => {
|
|
125
|
-
A = t, m = et(() => t.messages, X, { deep: !0, immediate: !0 });
|
|
126
|
-
}, x = q();
|
|
127
|
-
x ? L(x) : w = setInterval(() => {
|
|
128
|
-
const t = q();
|
|
129
|
-
t && ($(), L(t));
|
|
130
|
-
}, lt), tt(() => {
|
|
131
|
-
$(), m == null || m(), A = void 0, E.clear(), f.clear(), _.clear(), u.clear(), s = null, d.clear(), T.clear(), g.clear(), S === M && (S = null, p.$patch((t) => {
|
|
132
|
-
t.bridgeActive = !1, t.applyAcks = {};
|
|
133
|
-
}), J());
|
|
61
|
+
},
|
|
62
|
+
{ deep: !0, immediate: !0 }
|
|
63
|
+
);
|
|
64
|
+
D(() => {
|
|
65
|
+
m(), i.clear(), a.clear(), _();
|
|
134
66
|
});
|
|
135
67
|
};
|
|
136
68
|
export {
|
|
137
|
-
|
|
69
|
+
H as useCortexBlueprintBridge
|
|
138
70
|
};
|
|
@@ -1,115 +1,59 @@
|
|
|
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
|
-
const
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
},
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
type: U.Error,
|
|
20
|
-
message: w("newsletter.ai-template-failed-apply")
|
|
21
|
-
}));
|
|
22
|
-
}, C = () => {
|
|
23
|
-
var e, t;
|
|
24
|
-
return g.isStripoInitialized && typeof ((t = (e = window.StripoEditorApi) == null ? void 0 : e.actionsApi) == null ? void 0 : t.updateHtmlAndCss) == "function";
|
|
25
|
-
}, L = (e) => {
|
|
26
|
-
a.value[e] === void 0 && (a.value = { ...a.value, [e]: "pending" });
|
|
27
|
-
}, l = (e, t) => {
|
|
28
|
-
a.value = { ...a.value, [e]: t };
|
|
29
|
-
}, Q = (e) => {
|
|
30
|
-
var t;
|
|
1
|
+
import { useActionsApi as C } from "./useActionsApi.js";
|
|
2
|
+
import { useConfig as h } from "./useConfig.js";
|
|
3
|
+
import { useToaster as D } from "./useToaster.js";
|
|
4
|
+
import { useTranslations as E } from "./useTranslations.js";
|
|
5
|
+
import { ToasterTypeOptions as f } from "../enums/toaster.js";
|
|
6
|
+
import { useDynamicContentStore as A } from "../stores/dynamic-content.js";
|
|
7
|
+
import { flattenDynamicContentList as w } from "../utils/genericUtil.js";
|
|
8
|
+
import { extractUsedDynamicContent as S } from "../utils/registerUsedDynamicContent.js";
|
|
9
|
+
import { ref as O } from "vue";
|
|
10
|
+
const U = 250, o = O({}), s = {}, u = /* @__PURE__ */ new Map(), z = () => {
|
|
11
|
+
const { updateHtmlAndCss: r } = C(), { showToaster: m } = D(), y = E(), { template: T } = h(), d = A(), g = (e, t) => {
|
|
12
|
+
const a = y(e);
|
|
13
|
+
return a === e ? t : a;
|
|
14
|
+
}, v = (e) => {
|
|
15
|
+
o.value[e] === void 0 && (o.value = { ...o.value, [e]: "pending" });
|
|
16
|
+
}, l = (e, t, a) => {
|
|
17
|
+
var c;
|
|
18
|
+
o.value = { ...o.value, [e]: "applying" };
|
|
31
19
|
try {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
}
|
|
49
|
-
return u.get(e) !== n ? p : (l(e, "applied"), Q(t), H(e, t), { status: "applied" });
|
|
50
|
-
}, I = (e) => {
|
|
51
|
-
const t = s.get(e);
|
|
52
|
-
t && (clearTimeout(t.timer), s.delete(e), t.settle(p));
|
|
53
|
-
}, S = (e) => {
|
|
54
|
-
const t = c.get(e);
|
|
55
|
-
t && (clearTimeout(t.timer), c.delete(e), t.settle(p));
|
|
56
|
-
}, B = () => {
|
|
57
|
-
[...c.keys()].forEach(S);
|
|
58
|
-
}, h = async () => {
|
|
59
|
-
if (s.size === 0) {
|
|
60
|
-
E();
|
|
61
|
-
return;
|
|
62
|
-
}
|
|
63
|
-
if (!C())
|
|
64
|
-
return;
|
|
65
|
-
E();
|
|
66
|
-
const e = [...s.entries()];
|
|
67
|
-
s.clear(), e.forEach(([, o]) => clearTimeout(o.timer));
|
|
68
|
-
const t = e.pop();
|
|
69
|
-
if (e.forEach(([o, f]) => {
|
|
70
|
-
l(o, "failed"), f.settle({ status: "failed", error: new Error("Displaced by a newer apply") });
|
|
71
|
-
}), !t)
|
|
72
|
-
return;
|
|
73
|
-
const [r, n] = t;
|
|
74
|
-
n.settle(await D(r, n.html, n.css));
|
|
75
|
-
}, q = (e, t, r) => new Promise((n) => {
|
|
76
|
-
I(e);
|
|
77
|
-
const o = setTimeout(() => {
|
|
78
|
-
s.delete(e), l(e, "failed"), y(e, t), n({
|
|
79
|
-
status: "failed",
|
|
80
|
-
error: new Error(`Editor did not become ready within ${M}ms`)
|
|
20
|
+
r(t, a).catch((n) => {
|
|
21
|
+
console.warn("Editor did not acknowledge the template apply.", n);
|
|
22
|
+
}), o.value = { ...o.value, [e]: "applied" };
|
|
23
|
+
try {
|
|
24
|
+
const n = w((c = T.value) == null ? void 0 : c.dynamicContentList), i = S(t, n);
|
|
25
|
+
i.length > 0 && d.registerDynamicContent(i);
|
|
26
|
+
} catch {
|
|
27
|
+
}
|
|
28
|
+
u.get(e) !== t && (u.set(e, t), m({
|
|
29
|
+
type: f.Success,
|
|
30
|
+
message: g("newsletter.ai-template-applied", "Template applied to the editor")
|
|
31
|
+
}));
|
|
32
|
+
} catch (n) {
|
|
33
|
+
o.value = { ...o.value, [e]: "failed" }, m({
|
|
34
|
+
type: f.Error,
|
|
35
|
+
message: n instanceof Error ? n.message : "Failed to apply template"
|
|
81
36
|
});
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
}
|
|
87
|
-
return
|
|
88
|
-
|
|
89
|
-
}, { immediate: !0 }), { applyStatus: a, markPending: L, applyTemplate: (e, t) => {
|
|
90
|
-
const { html: r } = t;
|
|
91
|
-
return r ? (B(), v(e, r, t.css ?? "")) : Promise.resolve(A);
|
|
37
|
+
}
|
|
38
|
+
}, p = (e) => {
|
|
39
|
+
const t = s[e];
|
|
40
|
+
t && (clearTimeout(t), delete s[e]);
|
|
41
|
+
};
|
|
42
|
+
return { applyStatus: o, markPending: v, applyTemplate: (e, t) => {
|
|
43
|
+
t.html && (p(e), l(e, t.html, t.css ?? ""));
|
|
92
44
|
}, applyTemplateDebounced: (e, t) => {
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
const
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
c.delete(e), v(e, r, n).then(o);
|
|
101
|
-
}, W);
|
|
102
|
-
c.set(e, { timer: f, settle: o });
|
|
103
|
-
});
|
|
45
|
+
if (!t.html)
|
|
46
|
+
return;
|
|
47
|
+
p(e);
|
|
48
|
+
const { html: a } = t, c = t.css ?? "";
|
|
49
|
+
s[e] = setTimeout(() => {
|
|
50
|
+
delete s[e], l(e, a, c);
|
|
51
|
+
}, U);
|
|
104
52
|
} };
|
|
105
|
-
},
|
|
106
|
-
|
|
107
|
-
clearTimeout(i.timer), i.settle(p);
|
|
108
|
-
}), c.clear(), s.forEach((i) => {
|
|
109
|
-
clearTimeout(i.timer), i.settle(p);
|
|
110
|
-
}), s.clear(), E(), m.clear(), a.value = {};
|
|
53
|
+
}, G = () => {
|
|
54
|
+
Object.values(s).forEach(clearTimeout), Object.keys(s).forEach((r) => delete s[r]), o.value = {};
|
|
111
55
|
};
|
|
112
56
|
export {
|
|
113
|
-
|
|
114
|
-
|
|
57
|
+
G as resetEmailTemplateApplier,
|
|
58
|
+
z as useEmailTemplateApplier
|
|
115
59
|
};
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import { useRecommendation as
|
|
2
|
-
import { useToaster as
|
|
1
|
+
import { useRecommendation as C } from "./useRecommendation.js";
|
|
2
|
+
import { useToaster as I } from "./useToaster.js";
|
|
3
3
|
import { useTranslations as v } from "./useTranslations.js";
|
|
4
4
|
import { ToasterTypeOptions as g } from "../enums/toaster.js";
|
|
5
5
|
import "../extensions/Blocks/Recommendation/constants/selectors.js";
|
|
6
6
|
import { CURRENT_CONFIG_VERSION as L } from "../extensions/Blocks/Recommendation/constants/defaultConfig.js";
|
|
7
7
|
import { useRecommendationExtensionStore as b } from "../extensions/Blocks/Recommendation/store/recommendation.js";
|
|
8
|
-
import { resolveMigrationTarget as
|
|
9
|
-
import { commitBlockChangeOutsidePanel as
|
|
10
|
-
import { useConfigStore as
|
|
8
|
+
import { resolveMigrationTarget as k, buildLegacyMigrationPayload as R } from "../extensions/Blocks/Recommendation/utils/legacyStrategyMigration.js";
|
|
9
|
+
import { commitBlockChangeOutsidePanel as T } from "../extensions/Blocks/Recommendation/utils/nodeConfigWriter.js";
|
|
10
|
+
import { useConfigStore as h } from "../stores/config.js";
|
|
11
11
|
const F = () => {
|
|
12
|
-
const e = b(), r =
|
|
12
|
+
const e = b(), r = h(), { buildCampaignUrl: m } = C(), { showToaster: c } = I(), a = v();
|
|
13
13
|
return { convertLegacyStrategy: async () => {
|
|
14
14
|
const t = e.currentRecommendationId;
|
|
15
15
|
if (t === null || !e.isLegacyStrategyBlock || e.legacyConversionLoading)
|
|
16
16
|
return "";
|
|
17
|
-
const { strategy: d, productIds: y, size: l, strategyId: p, nodeConfigVersion: u } = e.recommendationConfigs, f = { strategyId: p, size: l, nodeConfigVersion: u }, s =
|
|
17
|
+
const { strategy: d, productIds: y, size: l, strategyId: p, nodeConfigVersion: u } = e.recommendationConfigs, f = { strategyId: p, size: l, nodeConfigVersion: u }, s = k({
|
|
18
18
|
campaignId: r.campaignId,
|
|
19
19
|
templateLibraryId: r.templateLibraryId
|
|
20
|
-
}), S =
|
|
20
|
+
}), S = R({
|
|
21
21
|
blockId: t,
|
|
22
22
|
url: m(String(t)),
|
|
23
23
|
campaignId: r.campaignId,
|
|
@@ -29,30 +29,34 @@ const F = () => {
|
|
|
29
29
|
let o;
|
|
30
30
|
try {
|
|
31
31
|
o = await e.convertLegacyStrategy(S, s);
|
|
32
|
-
} catch (
|
|
33
|
-
return console.error("[useLegacyStrategyConversion] migration failed",
|
|
32
|
+
} catch (i) {
|
|
33
|
+
return console.error("[useLegacyStrategyConversion] migration failed", i), c({
|
|
34
34
|
type: g.Error,
|
|
35
|
-
message:
|
|
35
|
+
message: a("email-editor.legacy-strategy-migration-failed"),
|
|
36
|
+
actionButton: {
|
|
37
|
+
text: a("ds-steps.create-recommendation-strategy"),
|
|
38
|
+
onClick: () => e.openStrategyCreation()
|
|
39
|
+
}
|
|
36
40
|
}), "";
|
|
37
41
|
}
|
|
38
42
|
try {
|
|
39
43
|
await e.fetchStrategyProductsForBlock(t);
|
|
40
|
-
} catch (
|
|
41
|
-
console.error("[useLegacyStrategyConversion] product refetch failed",
|
|
44
|
+
} catch (i) {
|
|
45
|
+
console.error("[useLegacyStrategyConversion] product refetch failed", i);
|
|
42
46
|
}
|
|
43
|
-
const
|
|
44
|
-
return
|
|
47
|
+
const n = e.blockStates[t];
|
|
48
|
+
return n ? T(
|
|
45
49
|
t,
|
|
46
50
|
{
|
|
47
51
|
strategyId: o,
|
|
48
|
-
size:
|
|
52
|
+
size: n.recommendationConfigs.size,
|
|
49
53
|
configVersion: L
|
|
50
54
|
},
|
|
51
|
-
|
|
55
|
+
n.recommendationProducts,
|
|
52
56
|
"Converted legacy recommendation strategy"
|
|
53
|
-
) ? (e.currentRecommendationId === t && e.openLegacyStrategyUpdatedModal(), o) : (console.error("[useLegacyStrategyConversion] node write failed", t), e.revertLegacyConversion(t, f),
|
|
57
|
+
) ? (e.currentRecommendationId === t && e.openLegacyStrategyUpdatedModal(), o) : (console.error("[useLegacyStrategyConversion] node write failed", t), e.revertLegacyConversion(t, f), c({
|
|
54
58
|
type: g.Error,
|
|
55
|
-
message:
|
|
59
|
+
message: a("email-editor.legacy-strategy-update-failed")
|
|
56
60
|
}), "") : o;
|
|
57
61
|
} };
|
|
58
62
|
};
|
|
@@ -6,9 +6,10 @@ import { useConfig } from "./useConfig.js";
|
|
|
6
6
|
const useTranslations = () => {
|
|
7
7
|
var o, e;
|
|
8
8
|
const { config } = useConfig(), translationsPath = ((e = (o = config.value) == null ? void 0 : o.editor) == null ? void 0 : e.translationsPath) || DEFAULT_EDITOR.translationsPath, translations = ref(eval(translationsPath)), trans = (t, n) => {
|
|
9
|
-
|
|
9
|
+
var s;
|
|
10
|
+
const r = (s = translations.value) == null ? void 0 : s[t];
|
|
10
11
|
return r ? n ? Object.entries(n).reduce(
|
|
11
|
-
(
|
|
12
|
+
(i, [a, l]) => i.replace(new RegExp(`{${a}}`, "g"), String(l)),
|
|
12
13
|
r
|
|
13
14
|
) : r : (console.warn(`Translation key not found: ${t}`), t);
|
|
14
15
|
};
|
|
@@ -1,54 +1,63 @@
|
|
|
1
1
|
import { ToasterTypeOptions as t } from "../enums/toaster.js";
|
|
2
|
-
import { useVersionHistoryStore as
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
2
|
+
import { useVersionHistoryStore as m } from "../stores/version-history.js";
|
|
3
|
+
import { findEditorApi as w, EDITOR_NOT_READY_MESSAGE as y } from "../utils/stripoEditorApi.js";
|
|
4
|
+
import { useToaster as V } from "./useToaster.js";
|
|
5
|
+
const d = () => {
|
|
6
|
+
const n = m(), { showToaster: i } = V(), o = (e) => {
|
|
7
|
+
var s;
|
|
8
|
+
const r = (s = w()) == null ? void 0 : s.versionHistoryApi;
|
|
9
|
+
if (!r) {
|
|
10
|
+
i({ type: t.Error, message: y });
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
e(r);
|
|
14
|
+
}, p = (e) => {
|
|
15
|
+
n.$reset(), n.updateState(e);
|
|
16
|
+
}, a = () => {
|
|
17
|
+
n.$reset();
|
|
9
18
|
};
|
|
10
19
|
return {
|
|
11
20
|
openVersionHistory: () => {
|
|
12
|
-
|
|
21
|
+
o((e) => e.openVersionHistory(p, a));
|
|
13
22
|
},
|
|
14
23
|
closeVersionHistory: () => {
|
|
15
|
-
|
|
24
|
+
o((e) => e.closeVersionHistory());
|
|
16
25
|
},
|
|
17
26
|
switchToDesktopPreview: () => {
|
|
18
|
-
|
|
27
|
+
o((e) => e.switchToDesktopPreview());
|
|
19
28
|
},
|
|
20
29
|
switchToMobilePreview: () => {
|
|
21
|
-
|
|
30
|
+
o((e) => e.switchToMobilePreview());
|
|
22
31
|
},
|
|
23
32
|
previewVersion: (e) => {
|
|
24
|
-
|
|
25
|
-
const
|
|
26
|
-
|
|
33
|
+
o((r) => r.previewVersion(e, (s) => {
|
|
34
|
+
const c = s instanceof Error ? s.message : String(s);
|
|
35
|
+
i({
|
|
27
36
|
type: t.Error,
|
|
28
|
-
message: `Error compiling email: ${
|
|
37
|
+
message: `Error compiling email: ${c}`
|
|
29
38
|
});
|
|
30
|
-
});
|
|
39
|
+
}));
|
|
31
40
|
},
|
|
32
41
|
restoreVersion: (e) => {
|
|
33
|
-
|
|
42
|
+
o((r) => r.restoreVersion(
|
|
34
43
|
e,
|
|
35
44
|
() => {
|
|
36
|
-
|
|
45
|
+
i({
|
|
37
46
|
type: t.Success,
|
|
38
47
|
message: "Your version has been restored successfully."
|
|
39
48
|
});
|
|
40
49
|
},
|
|
41
|
-
(
|
|
42
|
-
const
|
|
43
|
-
|
|
50
|
+
(s) => {
|
|
51
|
+
const c = s instanceof Error ? s.message : String(s);
|
|
52
|
+
i({
|
|
44
53
|
type: t.Error,
|
|
45
|
-
message: `Error compiling email: ${
|
|
54
|
+
message: `Error compiling email: ${c}`
|
|
46
55
|
});
|
|
47
56
|
}
|
|
48
|
-
);
|
|
57
|
+
));
|
|
49
58
|
}
|
|
50
59
|
};
|
|
51
60
|
};
|
|
52
61
|
export {
|
|
53
|
-
|
|
62
|
+
d as useVersionHistoryApi
|
|
54
63
|
};
|
package/dist/guido.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
@charset "UTF-8";.gap-16[data-v-5553d071],.gap-16[data-v-0e1b0c54]{gap:16px}[data-v-73199fa4] .in-button-v2__wrapper{line-height:0}[data-v-22226124] .in-segments-wrapper__button_selected,[data-v-22226124] .in-segments-wrapper__button_selected:hover{background-color:#dae1fb;color:#0010ac;border-color:#0010ac}[data-v-2cb418af] .in-progress-wrapper__progress p span:last-child{display:none!important}[data-v-2cb418af] .in-progress-description-status{display:none!important}.view-options-wrapper[data-v-87033101]{position:relative;display:inline-block}.new-tag[data-v-87033101]{position:absolute;top:-8px;right:-16px;z-index:10}[data-v-87033101] .guido__view-option-selection-desktop svg,[data-v-87033101] .guido__view-option-selection-mobile svg{margin:0 0 0 2px}[data-v-87033101] .in-segments-wrapper__button_selected,[data-v-87033101] .in-segments-wrapper__button_selected:hover{background-color:#dae1fb}[data-v-87033101] .in-tooltip-wrapper-v2__icon{cursor:pointer}.editor-toolbar[data-v-173c3a40]{gap:4px}.version-history-item[data-v-ee4b9c3f]{flex-basis:200px}.version-history[data-v-fad98586]{gap:8px}.version-history__toolbar[data-v-fad98586]{gap:4px}.view-options-wrapper[data-v-6ebabfe4]{position:relative;display:inline-block}.new-tag[data-v-6ebabfe4]{position:absolute;top:-8px;right:-16px;z-index:10}[data-v-6ebabfe4] .guido__verion-history-view-option-selection-desktop svg,[data-v-6ebabfe4] .guido__verion-history-view-option-selection-mobile svg{margin:0 0 0 2px}[data-v-6ebabfe4] .in-segments-wrapper__button_selected,[data-v-6ebabfe4] .in-segments-wrapper__button_selected:hover{background-color:#dae1fb}[data-v-6ebabfe4] .in-tooltip-wrapper-v2__icon{cursor:pointer}.auto-save-toggle[data-v-2c964af4]{position:relative}.auto-save-toggle__info-box[data-v-2c964af4]{position:absolute;top:100%;left:0;z-index:10;width:280px}.editor-actions[data-v-
|
|
1
|
+
@charset "UTF-8";.gap-16[data-v-5553d071],.gap-16[data-v-0e1b0c54]{gap:16px}[data-v-73199fa4] .in-button-v2__wrapper{line-height:0}[data-v-22226124] .in-segments-wrapper__button_selected,[data-v-22226124] .in-segments-wrapper__button_selected:hover{background-color:#dae1fb;color:#0010ac;border-color:#0010ac}[data-v-2cb418af] .in-progress-wrapper__progress p span:last-child{display:none!important}[data-v-2cb418af] .in-progress-description-status{display:none!important}.view-options-wrapper[data-v-87033101]{position:relative;display:inline-block}.new-tag[data-v-87033101]{position:absolute;top:-8px;right:-16px;z-index:10}[data-v-87033101] .guido__view-option-selection-desktop svg,[data-v-87033101] .guido__view-option-selection-mobile svg{margin:0 0 0 2px}[data-v-87033101] .in-segments-wrapper__button_selected,[data-v-87033101] .in-segments-wrapper__button_selected:hover{background-color:#dae1fb}[data-v-87033101] .in-tooltip-wrapper-v2__icon{cursor:pointer}.editor-toolbar[data-v-173c3a40]{gap:4px}.version-history-item[data-v-ee4b9c3f]{flex-basis:200px}.version-history[data-v-fad98586]{gap:8px}.version-history__toolbar[data-v-fad98586]{gap:4px}.view-options-wrapper[data-v-6ebabfe4]{position:relative;display:inline-block}.new-tag[data-v-6ebabfe4]{position:absolute;top:-8px;right:-16px;z-index:10}[data-v-6ebabfe4] .guido__verion-history-view-option-selection-desktop svg,[data-v-6ebabfe4] .guido__verion-history-view-option-selection-mobile svg{margin:0 0 0 2px}[data-v-6ebabfe4] .in-segments-wrapper__button_selected,[data-v-6ebabfe4] .in-segments-wrapper__button_selected:hover{background-color:#dae1fb}[data-v-6ebabfe4] .in-tooltip-wrapper-v2__icon{cursor:pointer}.auto-save-toggle[data-v-2c964af4]{position:relative}.auto-save-toggle__info-box[data-v-2c964af4]{position:absolute;top:100%;left:0;z-index:10;width:280px}.editor-actions[data-v-c61cc8ea]{gap:4px}.header-wrapper[data-v-d11dd577]{min-width:1000px}.guido-loading__wrapper[data-v-07c4b2d8]{height:100%;top:75px!important;bottom:0!important}.guido-editor__wrapper[data-v-36867e2e]{--ribbon-offset: 0px;position:relative;width:100%;height:calc(100vh - 128px - var(--ribbon-offset))}.guido-editor__container[data-v-36867e2e]{width:100%;height:calc(100vh - 128px - var(--ribbon-offset))}.guido-editor__no-header[data-v-36867e2e]{height:calc(100vh - 75px - var(--ribbon-offset))}[data-v-293f1c47] .in-breadcrumb-wrapper__links{cursor:pointer}.templates-wrapper[data-v-91a26acd]{gap:16px;grid-template-columns:repeat(3,1fr)}.templates-wrapper .template-wrapper[data-v-91a26acd]{cursor:pointer}.templates-wrapper .template-wrapper .template-container[data-v-91a26acd]{height:274px;padding:2px;transition:none}.templates-wrapper .template-wrapper .template-container.selected[data-v-91a26acd]{padding:1px}.templates-wrapper .template-wrapper .template-container .thumbnail[data-v-91a26acd]{object-fit:cover;transform:scale(1)}[data-v-b9a93c6e] .guido__verion-history-view-option-selection-desktop svg,[data-v-b9a93c6e] .guido__verion-history-view-option-selection-mobile svg{margin:0 0 0 2px}[data-v-b9a93c6e] .in-segments-wrapper__button_selected,[data-v-b9a93c6e] .in-segments-wrapper__button_selected:hover{background-color:#dae1fb}.error-list[data-v-c3fd5d4b]{gap:16px}.desktop-browser-header[data-v-d86c5af5]{height:79px;min-height:79px}.desktop-browser-header__left[data-v-d86c5af5]{-webkit-user-drag:none;height:79px;width:378px}.desktop-browser-header__center[data-v-d86c5af5]{height:79px;background-repeat:repeat-x;background-size:auto 100%;background-position:left top}.desktop-browser-header__right[data-v-d86c5af5]{-webkit-user-drag:none;height:79px;width:112px}.desktop-preview[data-v-cf946232]{min-width:602px;height:70vh;min-height:583px;border-radius:10px}.desktop-preview iframe[data-v-cf946232]{min-height:504px}.iframe-wrapper[data-v-f255b2bb]{width:258px}.iframe-scaled[data-v-f255b2bb]{width:320px;height:124.0310077519%;transform:scale(.80625);transform-origin:top left}.cropped-text[data-v-eb3d05d7]{width:220px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.mobile-preview-wrapper__phone[data-v-3f472f96]{width:282px}.mobile-preview-wrapper__phone img[data-v-3f472f96]{object-fit:cover;border-radius:44px}.mobile-preview-wrapper__content[data-v-3f472f96]{width:258px;height:450px;left:12px}[data-v-6bcaca8a] .vueperslides__parallax-wrapper{padding-bottom:110px!important}[data-v-f16f20f8] .vueperslides__bullets{pointer-events:none!important}[data-v-f16f20f8] .vueperslides__parallax-wrapper{padding-bottom:110px!important}[data-v-bb3cca55] .vueperslides__bullets{pointer-events:none!important}[data-v-bb3cca55] .vueperslides__parallax-wrapper{height:110px!important;padding-bottom:110px!important}[data-v-19d8cb42] .vueperslides__bullets,[data-v-ec2027ff] .vueperslides__bullets,[data-v-b09e80c4] .vueperslides__bullets{pointer-events:none!important}[data-v-b09e80c4] .vueperslides__parallax-wrapper{height:110px!important;padding-bottom:110px!important}[data-v-9bdef600] .vueperslides__parallax-wrapper{padding-bottom:110px!important}.assign-strategy-drawer-content .assign-strategy-select[data-v-6ce48dfd]{width:100%;max-width:none}.assign-strategy-drawer-content .assign-strategy-select[data-v-6ce48dfd] .in-skeleton{width:100%!important}.assign-strategy-drawer-content .assign-strategy-select[data-v-6ce48dfd] .in-dropdown-box__container{width:413px}.assign-strategy-drawer .spaced-dot-sep{background-image:linear-gradient(90deg,#91949f 20%,#fff0 0);background-position:center bottom;background-repeat:repeat-x;background-size:5px 1px}.assign-strategy-drawer .spaced-dot-sep--top{background-position:center top}.assign-strategy-drawer .spaced-dot-sep--fc-n:first-child{background:none}.legacy-strategy-updated-modal[data-v-da2225a1]{position:relative;z-index:145}
|
|
@@ -17,11 +17,12 @@
|
|
|
17
17
|
* - `error` segments (and message-level `isError` / `isCancelled`) trigger
|
|
18
18
|
* a localized toaster.
|
|
19
19
|
*
|
|
20
|
-
* Every apply settles into a terminal `applyAcks` entry, so cortex moves its button on the write, not the click.
|
|
21
|
-
*
|
|
22
20
|
* In dev (`import.meta.env.DEV`) every observed segment + message-level flag
|
|
23
21
|
* change is also `console.debug`-logged with the prefix `[guido:cortex]` so a
|
|
24
22
|
* developer can watch the agent stream in real time. In production this is
|
|
25
23
|
* gated behind `localStorage.guido:debug:ai === '1'`.
|
|
24
|
+
*
|
|
25
|
+
* If cortex-fe isn't loaded the chat store is undefined and the bridge is a
|
|
26
|
+
* no-op (intentional — Guido must still work standalone).
|
|
26
27
|
*/
|
|
27
28
|
export declare const useCortexBlueprintBridge: () => void;
|
|
@@ -1,16 +1,4 @@
|
|
|
1
1
|
type ApplyStatus = 'pending' | 'applying' | 'applied' | 'failed';
|
|
2
|
-
/**
|
|
3
|
-
* Terminal outcome of an apply; every promise here settles with one, since the bridge acks on it.
|
|
4
|
-
* `superseded`: a newer payload for the same key replaced this one and owns the ack.
|
|
5
|
-
*/
|
|
6
|
-
export type ApplyOutcome = {
|
|
7
|
-
status: 'applied';
|
|
8
|
-
} | {
|
|
9
|
-
status: 'failed';
|
|
10
|
-
error: unknown;
|
|
11
|
-
} | {
|
|
12
|
-
status: 'superseded';
|
|
13
|
-
};
|
|
14
2
|
/**
|
|
15
3
|
* Applies email_template blueprints from the chat agent to the Stripo editor.
|
|
16
4
|
*
|
|
@@ -21,19 +9,18 @@ export type ApplyOutcome = {
|
|
|
21
9
|
* - manual Apply click (first apply): immediate.
|
|
22
10
|
* - blueprint_update after the user has applied once: debounced 250 ms trailing
|
|
23
11
|
* so rapid mid-stream updates don't thrash updateHtmlAndCss.
|
|
24
|
-
* - a click before Stripo is ready is queued and flushed when `isStripoInitialized` flips.
|
|
25
12
|
*/
|
|
26
13
|
export declare const useEmailTemplateApplier: () => {
|
|
27
14
|
applyStatus: import("vue").Ref<Record<string, ApplyStatus>>;
|
|
28
|
-
markPending: (
|
|
29
|
-
applyTemplate: (
|
|
15
|
+
markPending: (blueprintId: string) => void;
|
|
16
|
+
applyTemplate: (blueprintId: string, data: {
|
|
30
17
|
html?: string;
|
|
31
18
|
css?: string;
|
|
32
|
-
}) =>
|
|
33
|
-
applyTemplateDebounced: (
|
|
19
|
+
}) => void;
|
|
20
|
+
applyTemplateDebounced: (blueprintId: string, data: {
|
|
34
21
|
html?: string;
|
|
35
22
|
css?: string;
|
|
36
|
-
}) =>
|
|
23
|
+
}) => void;
|
|
37
24
|
};
|
|
38
25
|
export declare const resetEmailTemplateApplier: () => void;
|
|
39
26
|
export {};
|