@useinsider/guido 3.9.0-beta.fcaa08b → 3.9.0-beta.fd95a10
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/organisms/header/AiStatusPill.vue.js +18 -0
- package/dist/components/organisms/header/AiStatusPill.vue2.js +17 -0
- package/dist/components/organisms/header/EditorToolbar.vue.js +2 -2
- package/dist/components/organisms/header/EditorToolbar.vue2.js +7 -6
- package/dist/composables/useAiStatus.js +12 -0
- package/dist/composables/useCortexBlueprintBridge.js +58 -41
- package/dist/config/compiler/utils/recommendationCompilerUtils.js +69 -89
- package/dist/guido.css +1 -1
- package/dist/src/components/organisms/header/AiStatusPill.vue.d.ts +2 -0
- package/dist/src/composables/useAiStatus.d.ts +25 -0
- package/dist/src/stores/ai-status.d.ts +24 -0
- package/dist/stores/ai-status.js +15 -0
- package/package.json +1 -1
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import i from "./AiStatusPill.vue2.js";
|
|
2
|
+
/* empty css */
|
|
3
|
+
import e from "../../../_virtual/_plugin-vue2_normalizer.js";
|
|
4
|
+
var l = function() {
|
|
5
|
+
var t = this, s = t._self._c, a = t._self._setupProxy;
|
|
6
|
+
return a.aiStatusStore.isGenerating ? s("div", { staticClass: "d-f a-i-c ml-2 ai-status-pill", attrs: { id: "guido__ai-status-pill", "data-testid": "AI Status Pill" } }, [s(a.InLoading, { attrs: { "color-class": "i-c-53", size: "16" } }), s("span", { staticClass: "ml-1 f-s-1 t-c-53 ai-status-pill__label" }, [t._v(" " + t._s(a.label) + " ")])], 1) : t._e();
|
|
7
|
+
}, r = [], _ = /* @__PURE__ */ e(
|
|
8
|
+
i,
|
|
9
|
+
l,
|
|
10
|
+
r,
|
|
11
|
+
!1,
|
|
12
|
+
null,
|
|
13
|
+
"1ed36cb3"
|
|
14
|
+
);
|
|
15
|
+
const u = _.exports;
|
|
16
|
+
export {
|
|
17
|
+
u as default
|
|
18
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { defineComponent as s, computed as a } from "vue";
|
|
2
|
+
import { useTranslations as i } from "../../../composables/useTranslations.js";
|
|
3
|
+
import { useAiStatusStore as m } from "../../../stores/ai-status.js";
|
|
4
|
+
import { InLoading as u } from "@useinsider/design-system-vue";
|
|
5
|
+
const d = /* @__PURE__ */ s({
|
|
6
|
+
__name: "AiStatusPill",
|
|
7
|
+
setup(p) {
|
|
8
|
+
const n = m(), t = i(), r = a(() => {
|
|
9
|
+
const e = "newsletter.ai-generating", o = t(e);
|
|
10
|
+
return o === e ? "AI is generating…" : o;
|
|
11
|
+
});
|
|
12
|
+
return { __sfc: !0, aiStatusStore: n, trans: t, label: r, InLoading: u };
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
export {
|
|
16
|
+
d as default
|
|
17
|
+
};
|
|
@@ -3,14 +3,14 @@ import i from "./EditorToolbar.vue2.js";
|
|
|
3
3
|
import s from "../../../_virtual/_plugin-vue2_normalizer.js";
|
|
4
4
|
var n = function() {
|
|
5
5
|
var e = this, o = e._self._c, t = e._self._setupProxy;
|
|
6
|
-
return o("div", { staticClass: "d-f editor-toolbar" }, [o(t.InButtonV2, { attrs: { id: "guido__undo-button", "left-icon": "line-undo", styling: "ghost", type: "secondary", "disabled-status": t.editorStore.isUndoButtonDisabled, "label-text-status": !1, "tooltip-options": t.getTooltipOptions("guido__undo-button"), "tooltip-text": t.trans("action-builder.undo") } }), o(t.InButtonV2, { attrs: { id: "guido__redo-button", "left-icon": "line-redo", styling: "ghost", type: "secondary", "disabled-status": t.editorStore.isRedoButtonDisabled, "label-text-status": !1, "tooltip-options": t.getTooltipOptions("guido__redo-button"), "tooltip-text": t.trans("action-builder.redo") } }), o(t.InButtonV2, { attrs: { id: "guido__code-button", "data-testid": "Code Editor", "left-icon": "line-code", styling: "ghost", type: "secondary", "disabled-status": t.editorStore.isCodeEditorButtonDisabled, "label-text-status": !1, "selected-status": t.editorStore.isCodeEditorOpen, "tooltip-options": t.getTooltipOptions("guido__code-button"), "tooltip-text": t.codeEditorTooltipText } }), o(t.InButtonV2, { attrs: { id: "guido__preview-button", "left-icon": "line-show-on", styling: "ghost", type: "secondary", "disabled-status": t.editorStore.isPreviewButtonDisabled, "label-text-status": !1, "selected-status": t.editorStore.isPreviewModeOpen, "tooltip-options": t.getTooltipOptions("guido__preview-button"), "tooltip-text": t.previewTooltipText }, on: { click: t.handlePreviewToggle } }), o(t.ViewOptions, { staticClass: "ml-2" })], 1);
|
|
6
|
+
return o("div", { staticClass: "d-f editor-toolbar" }, [o(t.InButtonV2, { attrs: { id: "guido__undo-button", "left-icon": "line-undo", styling: "ghost", type: "secondary", "disabled-status": t.editorStore.isUndoButtonDisabled, "label-text-status": !1, "tooltip-options": t.getTooltipOptions("guido__undo-button"), "tooltip-text": t.trans("action-builder.undo") } }), o(t.InButtonV2, { attrs: { id: "guido__redo-button", "left-icon": "line-redo", styling: "ghost", type: "secondary", "disabled-status": t.editorStore.isRedoButtonDisabled, "label-text-status": !1, "tooltip-options": t.getTooltipOptions("guido__redo-button"), "tooltip-text": t.trans("action-builder.redo") } }), o(t.InButtonV2, { attrs: { id: "guido__code-button", "data-testid": "Code Editor", "left-icon": "line-code", styling: "ghost", type: "secondary", "disabled-status": t.editorStore.isCodeEditorButtonDisabled, "label-text-status": !1, "selected-status": t.editorStore.isCodeEditorOpen, "tooltip-options": t.getTooltipOptions("guido__code-button"), "tooltip-text": t.codeEditorTooltipText } }), o(t.InButtonV2, { attrs: { id: "guido__preview-button", "left-icon": "line-show-on", styling: "ghost", type: "secondary", "disabled-status": t.editorStore.isPreviewButtonDisabled, "label-text-status": !1, "selected-status": t.editorStore.isPreviewModeOpen, "tooltip-options": t.getTooltipOptions("guido__preview-button"), "tooltip-text": t.previewTooltipText }, on: { click: t.handlePreviewToggle } }), o(t.ViewOptions, { staticClass: "ml-2" }), o(t.AiStatusPill)], 1);
|
|
7
7
|
}, d = [], l = /* @__PURE__ */ s(
|
|
8
8
|
i,
|
|
9
9
|
n,
|
|
10
10
|
d,
|
|
11
11
|
!1,
|
|
12
12
|
null,
|
|
13
|
-
"
|
|
13
|
+
"ec30d292"
|
|
14
14
|
);
|
|
15
15
|
const _ = l.exports;
|
|
16
16
|
export {
|
|
@@ -4,14 +4,15 @@ import { useTranslations as l } from "../../../composables/useTranslations.js";
|
|
|
4
4
|
import { useEditorStore as d } from "../../../stores/editor.js";
|
|
5
5
|
import { getTooltipOptions as w } from "../../../utils/tooltipUtils.js";
|
|
6
6
|
import { InButtonV2 as c } from "@useinsider/design-system-vue";
|
|
7
|
-
import a from "./
|
|
8
|
-
|
|
7
|
+
import a from "./AiStatusPill.vue.js";
|
|
8
|
+
import f from "./ViewOptions.vue.js";
|
|
9
|
+
const x = /* @__PURE__ */ p({
|
|
9
10
|
__name: "EditorToolbar",
|
|
10
|
-
setup(
|
|
11
|
-
const o = d(), e = l(), { openPreviewMode: t, closePreviewMode: r } = m(),
|
|
12
|
-
return { __sfc: !0, editorStore: o, trans: e, openPreviewMode: t, closePreviewMode: r, previewTooltipText:
|
|
11
|
+
setup(u) {
|
|
12
|
+
const o = d(), e = l(), { openPreviewMode: t, closePreviewMode: r } = m(), s = i(() => o.isPreviewModeOpen ? e("newsletter.close-email-preview") : e("newsletter.email-preview")), n = i(() => o.isCodeEditorOpen ? e("newsletter.close-html-editor") : e("newsletter.html-editor"));
|
|
13
|
+
return { __sfc: !0, editorStore: o, trans: e, openPreviewMode: t, closePreviewMode: r, previewTooltipText: s, codeEditorTooltipText: n, handlePreviewToggle: () => o.isPreviewModeOpen ? r() : t(), getTooltipOptions: w, InButtonV2: c, AiStatusPill: a, ViewOptions: f };
|
|
13
14
|
}
|
|
14
15
|
});
|
|
15
16
|
export {
|
|
16
|
-
|
|
17
|
+
x as default
|
|
17
18
|
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { useAiStatusStore as r } from "../stores/ai-status.js";
|
|
2
|
+
const a = () => {
|
|
3
|
+
const t = r();
|
|
4
|
+
return { store: t, start: (e = "") => {
|
|
5
|
+
t.isGenerating && t.activeTool === e || t.$patch({ isGenerating: !0, activeTool: e });
|
|
6
|
+
}, stop: () => {
|
|
7
|
+
!t.isGenerating && t.activeTool === "" || t.$patch({ isGenerating: !1, activeTool: "" });
|
|
8
|
+
} };
|
|
9
|
+
};
|
|
10
|
+
export {
|
|
11
|
+
a as useAiStatus
|
|
12
|
+
};
|
|
@@ -1,66 +1,83 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
|
|
1
|
+
import { useAiStatus as v } from "./useAiStatus.js";
|
|
2
|
+
import { useEmailTemplateApplier as I, resetEmailTemplateApplier as B } from "./useEmailTemplateApplier.js";
|
|
3
|
+
import { useToaster as M } from "./useToaster.js";
|
|
4
|
+
import { useTranslations as P } from "./useTranslations.js";
|
|
5
|
+
import { ToasterTypeOptions as D } from "../enums/toaster.js";
|
|
6
|
+
import { getActivePinia as L } from "pinia";
|
|
7
|
+
import { watch as N, onUnmounted as x } from "vue";
|
|
8
|
+
const C = "email_template", G = "chat", R = "guido:debug:ai", U = /* @__PURE__ */ new Set(["done", "error", "cancelled"]), Y = () => {
|
|
8
9
|
if (typeof window > "u")
|
|
9
10
|
return !1;
|
|
10
11
|
try {
|
|
11
|
-
return window.localStorage.getItem(
|
|
12
|
+
return window.localStorage.getItem(R) === "1";
|
|
12
13
|
} catch {
|
|
13
14
|
return !1;
|
|
14
15
|
}
|
|
15
|
-
},
|
|
16
|
-
const
|
|
17
|
-
if (!
|
|
16
|
+
}, q = () => {
|
|
17
|
+
const s = L();
|
|
18
|
+
if (!s)
|
|
18
19
|
return;
|
|
19
|
-
const
|
|
20
|
+
const c = s._s, p = c == null ? void 0 : c.get(G);
|
|
20
21
|
if (!p)
|
|
21
22
|
return;
|
|
22
|
-
const { applyTemplate:
|
|
23
|
-
const
|
|
24
|
-
return
|
|
25
|
-
},
|
|
26
|
-
|
|
27
|
-
},
|
|
28
|
-
if (
|
|
23
|
+
const { applyTemplate: T, applyTemplateDebounced: A } = I(), { showToaster: E } = M(), l = v(), y = P(), h = (r, t) => {
|
|
24
|
+
const e = y(r);
|
|
25
|
+
return e === r ? t : e;
|
|
26
|
+
}, a = /* @__PURE__ */ new Map(), u = /* @__PURE__ */ new Set(), d = Y(), m = (r, t) => {
|
|
27
|
+
d && console.debug(`[guido:cortex] msg=${r ?? "?"} type=${(t == null ? void 0 : t.type) ?? "?"}`, t);
|
|
28
|
+
}, b = (r) => {
|
|
29
|
+
if (r.blueprintType !== C)
|
|
29
30
|
return;
|
|
30
|
-
const t =
|
|
31
|
-
if (!t || !(
|
|
31
|
+
const t = r.blueprintId, e = r.blueprintData;
|
|
32
|
+
if (!t || !(e != null && e.html))
|
|
32
33
|
return;
|
|
33
|
-
const
|
|
34
|
-
|
|
35
|
-
},
|
|
36
|
-
type:
|
|
37
|
-
message:
|
|
38
|
-
}), !0),
|
|
34
|
+
const n = a.get(t);
|
|
35
|
+
n === void 0 ? (a.set(t, e.html), T(t, e)) : n !== e.html && (a.set(t, e.html), A(t, e));
|
|
36
|
+
}, f = (r) => r === void 0 || u.has(r) ? !1 : (u.add(r), E({
|
|
37
|
+
type: D.Alert,
|
|
38
|
+
message: h("newsletter.ai-template-failed", "AI couldn't generate the template. Please try again.")
|
|
39
|
+
}), !0), S = (r) => {
|
|
40
|
+
const t = r.toolName ?? r.name ?? r.tool;
|
|
41
|
+
return typeof t == "string" ? t : "";
|
|
42
|
+
}, _ = (r) => {
|
|
43
|
+
const t = r[r.length - 1];
|
|
44
|
+
if (!t) {
|
|
45
|
+
l.stop();
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
const e = Array.isArray(t.segments) ? t.segments : [];
|
|
49
|
+
if (t.isError === !0 || t.isCancelled === !0 || e.some((i) => !!i && U.has(i.type ?? ""))) {
|
|
50
|
+
l.stop();
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
const o = [...e].reverse().find((i) => (i == null ? void 0 : i.type) === "tool_call");
|
|
54
|
+
o && l.start(S(o));
|
|
55
|
+
}, w = N(
|
|
39
56
|
() => p.messages,
|
|
40
|
-
(
|
|
41
|
-
Array.isArray(
|
|
42
|
-
const
|
|
43
|
-
(t == null ? void 0 : t.isError) === !0 &&
|
|
44
|
-
const
|
|
45
|
-
Array.isArray(
|
|
46
|
-
if (
|
|
47
|
-
switch (
|
|
57
|
+
(r) => {
|
|
58
|
+
Array.isArray(r) && (_(r), r.forEach((t) => {
|
|
59
|
+
const e = t == null ? void 0 : t.id;
|
|
60
|
+
(t == null ? void 0 : t.isError) === !0 && f(e) && d && console.debug(`[guido:cortex] message-level error id=${e}`, t);
|
|
61
|
+
const n = t == null ? void 0 : t.segments;
|
|
62
|
+
Array.isArray(n) && n.forEach((o) => {
|
|
63
|
+
if (o)
|
|
64
|
+
switch (m(e, o), o.type) {
|
|
48
65
|
case "blueprint":
|
|
49
|
-
|
|
66
|
+
b(o);
|
|
50
67
|
break;
|
|
51
68
|
case "error":
|
|
52
|
-
|
|
69
|
+
f(e);
|
|
53
70
|
break;
|
|
54
71
|
}
|
|
55
72
|
});
|
|
56
|
-
});
|
|
73
|
+
}));
|
|
57
74
|
},
|
|
58
75
|
{ deep: !0, immediate: !0 }
|
|
59
76
|
);
|
|
60
|
-
|
|
61
|
-
|
|
77
|
+
x(() => {
|
|
78
|
+
w(), a.clear(), u.clear(), l.stop(), B();
|
|
62
79
|
});
|
|
63
80
|
};
|
|
64
81
|
export {
|
|
65
|
-
|
|
82
|
+
q as useCortexBlueprintBridge
|
|
66
83
|
};
|
|
@@ -1,44 +1,44 @@
|
|
|
1
|
-
import { useConfig as
|
|
1
|
+
import { useConfig as _ } from "../../../composables/useConfig.js";
|
|
2
2
|
import { useRecommendation as g } from "../../../composables/useRecommendation.js";
|
|
3
3
|
import { CSS_CLASS_RECO_BUTTON as q } from "../../../extensions/Blocks/Recommendation/constants/selectors.js";
|
|
4
|
-
import { useRecommendationExtensionStore as
|
|
4
|
+
import { useRecommendationExtensionStore as C } from "../../../extensions/Blocks/Recommendation/store/recommendation.js";
|
|
5
5
|
import { isIgnoredRecommendationBlock as w } from "./recommendationIgnoreUtils.js";
|
|
6
|
-
function b(
|
|
7
|
-
const i = `{{${c}${
|
|
6
|
+
function b(e, n, t, o, c = "") {
|
|
7
|
+
const i = `{{${c}${e}_${n}_${t}}}`, r = `{{${c}${e}_${n}_currency}}`;
|
|
8
8
|
return o === "before" ? `${r} ${i}` : `${i} ${r}`;
|
|
9
9
|
}
|
|
10
|
-
function m(
|
|
11
|
-
let n =
|
|
10
|
+
function m(e) {
|
|
11
|
+
let n = e;
|
|
12
12
|
for (; n.children.length === 1; )
|
|
13
13
|
[n] = n.children;
|
|
14
14
|
return n;
|
|
15
15
|
}
|
|
16
|
-
function
|
|
16
|
+
function h(e, n, t, o, c, i) {
|
|
17
17
|
switch (n) {
|
|
18
18
|
case "productImage": {
|
|
19
|
-
const r =
|
|
20
|
-
r && (r.setAttribute("src", `{{${i}${
|
|
21
|
-
const s =
|
|
22
|
-
s && (s.setAttribute("href", `{{${i}${
|
|
19
|
+
const r = e.querySelector("img");
|
|
20
|
+
r && (r.setAttribute("src", `{{${i}${t}_${o}_image_url}}`), r.setAttribute("alt", `{{${i}${t}_${o}_name}}`));
|
|
21
|
+
const s = e.querySelector("a");
|
|
22
|
+
s && (s.setAttribute("href", `{{${i}${t}_${o}_url}}`), s.classList.add(q));
|
|
23
23
|
break;
|
|
24
24
|
}
|
|
25
25
|
case "productName": {
|
|
26
|
-
const r =
|
|
27
|
-
r && (m(r).textContent = `{{${i}${
|
|
26
|
+
const r = e.querySelector("p");
|
|
27
|
+
r && (m(r).textContent = `{{${i}${t}_${o}_name}}`);
|
|
28
28
|
break;
|
|
29
29
|
}
|
|
30
30
|
case "productPrice": {
|
|
31
|
-
const r =
|
|
31
|
+
const r = e.querySelector(".product-price p") ?? e.querySelector("p");
|
|
32
32
|
r && (m(r).textContent = b(
|
|
33
|
-
|
|
33
|
+
t,
|
|
34
34
|
o,
|
|
35
35
|
"price",
|
|
36
36
|
c,
|
|
37
37
|
i
|
|
38
38
|
));
|
|
39
|
-
const s =
|
|
39
|
+
const s = e.querySelector(".product-old-price p");
|
|
40
40
|
s && (m(s).textContent = b(
|
|
41
|
-
|
|
41
|
+
t,
|
|
42
42
|
o,
|
|
43
43
|
"original_price",
|
|
44
44
|
c,
|
|
@@ -47,9 +47,9 @@ function y(t, n, e, o, c, i) {
|
|
|
47
47
|
break;
|
|
48
48
|
}
|
|
49
49
|
case "productOldPrice": {
|
|
50
|
-
const r =
|
|
50
|
+
const r = e.querySelector("p");
|
|
51
51
|
r && (m(r).textContent = b(
|
|
52
|
-
|
|
52
|
+
t,
|
|
53
53
|
o,
|
|
54
54
|
"original_price",
|
|
55
55
|
c,
|
|
@@ -58,117 +58,97 @@ function y(t, n, e, o, c, i) {
|
|
|
58
58
|
break;
|
|
59
59
|
}
|
|
60
60
|
case "productButton": {
|
|
61
|
-
const r =
|
|
62
|
-
r && r.setAttribute("href", `{{${i}${
|
|
61
|
+
const r = e.querySelector("a");
|
|
62
|
+
r && r.setAttribute("href", `{{${i}${t}_${o}_url}}`);
|
|
63
63
|
break;
|
|
64
64
|
}
|
|
65
65
|
case "productOmnibusPrice": {
|
|
66
|
-
const r =
|
|
66
|
+
const r = e.querySelector(".omnibus-price-value");
|
|
67
67
|
if (r) {
|
|
68
|
-
r.textContent = `{{${i}${
|
|
68
|
+
r.textContent = `{{${i}${t}_${o}_omnibus_price}}`;
|
|
69
69
|
const s = r.closest("p");
|
|
70
70
|
s && (s.setAttribute("product-attr", "omnibus_price"), s.setAttribute("composition", "true"));
|
|
71
71
|
}
|
|
72
72
|
break;
|
|
73
73
|
}
|
|
74
74
|
case "productOmnibusDiscount": {
|
|
75
|
-
const r =
|
|
75
|
+
const r = e.querySelector(".omnibus-discount-value");
|
|
76
76
|
if (r) {
|
|
77
|
-
r.textContent = `{{${i}${
|
|
77
|
+
r.textContent = `{{${i}${t}_${o}_omnibus_discount}}`;
|
|
78
78
|
const s = r.closest("p");
|
|
79
79
|
s && (s.setAttribute("product-attr", "omnibus_discount"), s.setAttribute("composition", "true"));
|
|
80
80
|
}
|
|
81
81
|
break;
|
|
82
82
|
}
|
|
83
83
|
default: {
|
|
84
|
-
const r =
|
|
84
|
+
const r = e.getAttribute("product-attr") ? e : e.querySelector("[product-attr]");
|
|
85
85
|
if (r) {
|
|
86
86
|
const s = r.getAttribute("product-attr"), a = r.querySelector("p");
|
|
87
|
-
a && (m(a).textContent = `{{${i}${
|
|
87
|
+
a && (m(a).textContent = `{{${i}${t}_${o}_${s}}}`);
|
|
88
88
|
}
|
|
89
89
|
break;
|
|
90
90
|
}
|
|
91
91
|
}
|
|
92
92
|
}
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
const c = `${o}${n}_${e}_${R}`;
|
|
96
|
-
return {
|
|
97
|
-
open: t.createComment(`{% if ${c} and ${c} != "" %}`),
|
|
98
|
-
close: t.createComment("{% endif %}")
|
|
99
|
-
};
|
|
100
|
-
}
|
|
101
|
-
function P(t, n, e, o) {
|
|
102
|
-
if (!t.innerHTML.includes("{{"))
|
|
103
|
-
return;
|
|
104
|
-
const { open: c, close: i } = S(t.ownerDocument, n, e, o);
|
|
105
|
-
t.insertBefore(c, t.firstChild), t.appendChild(i);
|
|
106
|
-
}
|
|
107
|
-
function T(t, n, e, o) {
|
|
108
|
-
if (!t.innerHTML.includes("{{"))
|
|
109
|
-
return;
|
|
110
|
-
const { open: c, close: i } = S(t.ownerDocument, n, e, o), r = t.parentNode;
|
|
111
|
-
r.insertBefore(c, t), r.insertBefore(i, t.nextSibling);
|
|
112
|
-
}
|
|
113
|
-
function L(t, n, e, o) {
|
|
114
|
-
t.querySelectorAll(".recommendation-product-row").forEach((i, r) => {
|
|
93
|
+
function E(e, n, t, o) {
|
|
94
|
+
e.querySelectorAll(".recommendation-product-row").forEach((i, r) => {
|
|
115
95
|
i.querySelectorAll("[data-attribute-type]").forEach((a) => {
|
|
116
96
|
const u = a.getAttribute("data-attribute-type") || "", p = a.querySelectorAll(".attribute-cell");
|
|
117
97
|
p.length > 0 ? p.forEach((l) => {
|
|
118
|
-
|
|
119
|
-
}) :
|
|
120
|
-
})
|
|
98
|
+
h(l, u, n, r, t, o);
|
|
99
|
+
}) : h(a, u, n, r, t, o);
|
|
100
|
+
});
|
|
121
101
|
});
|
|
122
102
|
}
|
|
123
|
-
function
|
|
124
|
-
const c =
|
|
103
|
+
function P(e, n, t, o) {
|
|
104
|
+
const c = e.querySelectorAll(".recommendation-product-row");
|
|
125
105
|
if (!c.length)
|
|
126
106
|
return;
|
|
127
107
|
const [i] = c, r = i.querySelector("[data-attribute-type]"), s = r ? r.querySelectorAll(".attribute-cell").length : 1;
|
|
128
108
|
c.forEach((a, u) => {
|
|
129
109
|
a.querySelectorAll("[data-attribute-type]").forEach((l) => {
|
|
130
110
|
const d = l.getAttribute("data-attribute-type") || "";
|
|
131
|
-
l.querySelectorAll(".attribute-cell").forEach((
|
|
132
|
-
const
|
|
133
|
-
|
|
111
|
+
l.querySelectorAll(".attribute-cell").forEach((A, $) => {
|
|
112
|
+
const S = u * s + $;
|
|
113
|
+
h(A, d, n, S, t, o);
|
|
134
114
|
});
|
|
135
115
|
});
|
|
136
116
|
});
|
|
137
117
|
}
|
|
138
|
-
function
|
|
139
|
-
|
|
140
|
-
|
|
118
|
+
function R(e, n, t, o) {
|
|
119
|
+
e.querySelectorAll(".ins-recommendation-product-container").forEach((i) => {
|
|
120
|
+
P(i, n, t, o);
|
|
141
121
|
});
|
|
142
122
|
}
|
|
143
|
-
function
|
|
144
|
-
const o =
|
|
145
|
-
o === "list" ?
|
|
123
|
+
function O(e, n, t) {
|
|
124
|
+
const o = e.getAttribute("data-layout") || "grid", c = e.getAttribute("currency-alignment") || "after";
|
|
125
|
+
o === "list" ? E(e, n, c, t) : R(e, n, c, t);
|
|
146
126
|
}
|
|
147
|
-
function
|
|
148
|
-
const o = new RegExp(`${n}\\s*:\\s*(\\d+)\\s*px`, "i"), c =
|
|
149
|
-
return c ? parseInt(c[1]) :
|
|
127
|
+
function y(e, n, t) {
|
|
128
|
+
const o = new RegExp(`${n}\\s*:\\s*(\\d+)\\s*px`, "i"), c = e.match(o);
|
|
129
|
+
return c ? parseInt(c[1]) : t;
|
|
150
130
|
}
|
|
151
|
-
function
|
|
152
|
-
let
|
|
153
|
-
for (;
|
|
154
|
-
if (
|
|
155
|
-
const o =
|
|
131
|
+
function T(e, n) {
|
|
132
|
+
let t = e.parentElement;
|
|
133
|
+
for (; t && t !== n; ) {
|
|
134
|
+
if (t.tagName === "TD") {
|
|
135
|
+
const o = t.getAttribute("width");
|
|
156
136
|
if (o && o.endsWith("%") && parseFloat(o) < 100)
|
|
157
|
-
return
|
|
137
|
+
return t;
|
|
158
138
|
}
|
|
159
|
-
|
|
139
|
+
t = t.parentElement;
|
|
160
140
|
}
|
|
161
141
|
return null;
|
|
162
142
|
}
|
|
163
|
-
function
|
|
164
|
-
const n =
|
|
165
|
-
c !== 0 &&
|
|
143
|
+
function v(e) {
|
|
144
|
+
const n = e.getAttribute("style") || "", t = y(n, "width", 600), o = y(n, "padding", 0) * 2, c = Math.max(0, t - o);
|
|
145
|
+
c !== 0 && e.querySelectorAll("img.adapt-img").forEach((i) => {
|
|
166
146
|
if (i.hasAttribute("width"))
|
|
167
147
|
return;
|
|
168
|
-
const r =
|
|
148
|
+
const r = T(i, e);
|
|
169
149
|
if (!r)
|
|
170
150
|
return;
|
|
171
|
-
const s = r.getAttribute("width"), a = parseFloat(s), u =
|
|
151
|
+
const s = r.getAttribute("width"), a = parseFloat(s), u = y(r.getAttribute("style") || "", "padding", 0) * 2, p = Math.floor(c * a / 100), l = Math.max(1, p - u);
|
|
172
152
|
i.setAttribute("width", String(l));
|
|
173
153
|
const d = i.getAttribute("style") || "";
|
|
174
154
|
if (!/\bwidth\s*:\s*\d/i.test(d)) {
|
|
@@ -177,25 +157,25 @@ function M(t) {
|
|
|
177
157
|
}
|
|
178
158
|
});
|
|
179
159
|
}
|
|
180
|
-
function
|
|
181
|
-
const
|
|
182
|
-
return (
|
|
160
|
+
function W(e, n) {
|
|
161
|
+
const t = e.match(/<!DOCTYPE[^>]*>/i);
|
|
162
|
+
return (t ? `${t[0]}
|
|
183
163
|
` : "") + n.documentElement.outerHTML;
|
|
184
164
|
}
|
|
185
|
-
function
|
|
186
|
-
const n =
|
|
165
|
+
function F(e) {
|
|
166
|
+
const n = e.replaceAll("{%", "<!--{%").replaceAll("%}", "%}-->"), t = new DOMParser().parseFromString(n, "text/html"), o = t.querySelectorAll(".recommendation-block-v2");
|
|
187
167
|
if (!o.length)
|
|
188
|
-
return
|
|
189
|
-
const { buildCampaignUrl: c } = g(), i =
|
|
168
|
+
return e;
|
|
169
|
+
const { buildCampaignUrl: c } = g(), i = C();
|
|
190
170
|
i.recommendationCampaignUrls = {};
|
|
191
|
-
const { isFeatureEnabled: r } =
|
|
171
|
+
const { isFeatureEnabled: r } = _(), s = r("liquidSyntax") ? "reco_" : "";
|
|
192
172
|
return o.forEach((u) => {
|
|
193
173
|
var l, d;
|
|
194
174
|
const p = u.getAttribute("recommendation-id");
|
|
195
|
-
p && ((l = u.parentNode) == null || l.insertBefore(
|
|
196
|
-
}),
|
|
175
|
+
p && ((l = u.parentNode) == null || l.insertBefore(t.createComment("REC_START"), u), (d = u.parentNode) == null || d.insertBefore(t.createComment("REC_END"), u.nextSibling), u.querySelectorAll('[data-visibility="0"]').forEach((f) => f.remove()), c(p), w(u) || O(u, p, s), v(u));
|
|
176
|
+
}), W(n, t).replaceAll("<!--{%", "{%").replaceAll("%}-->", "%}").replaceAll("<!--{%", "{%").replaceAll("%}-->", "%}");
|
|
197
177
|
}
|
|
198
178
|
export {
|
|
199
179
|
b as formatPriceVariable,
|
|
200
|
-
|
|
180
|
+
F as prepareRecommendationBlocks
|
|
201
181
|
};
|
package/dist/guido.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.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-195ab6d4]{position:relative;display:inline-block}.new-tag[data-v-195ab6d4]{position:absolute;top:-8px;right:-16px;z-index:10}[data-v-195ab6d4] .guido__view-option-selection-desktop svg,[data-v-195ab6d4] .guido__view-option-selection-mobile svg{margin:0 0 0 2px}[data-v-195ab6d4] .in-segments-wrapper__button_selected,[data-v-195ab6d4] .in-segments-wrapper__button_selected:hover{background-color:#dae1fb}[data-v-195ab6d4] .in-tooltip-wrapper__icon{cursor:pointer}.editor-toolbar[data-v-
|
|
1
|
+
.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}.ai-status-pill[data-v-1ed36cb3]{padding:2px 8px;border-radius:12px;background-color:#f3f4f6}.ai-status-pill__label[data-v-1ed36cb3]{white-space:nowrap}.view-options-wrapper[data-v-195ab6d4]{position:relative;display:inline-block}.new-tag[data-v-195ab6d4]{position:absolute;top:-8px;right:-16px;z-index:10}[data-v-195ab6d4] .guido__view-option-selection-desktop svg,[data-v-195ab6d4] .guido__view-option-selection-mobile svg{margin:0 0 0 2px}[data-v-195ab6d4] .in-segments-wrapper__button_selected,[data-v-195ab6d4] .in-segments-wrapper__button_selected:hover{background-color:#dae1fb}[data-v-195ab6d4] .in-tooltip-wrapper__icon{cursor:pointer}.editor-toolbar[data-v-ec30d292]{gap:4px}.version-history-item[data-v-ee4b9c3f]{flex-basis:200px}.version-history[data-v-64c52560]{gap:8px}.version-history__toolbar[data-v-64c52560]{gap:4px}.view-options-wrapper[data-v-d405ca59]{position:relative;display:inline-block}.new-tag[data-v-d405ca59]{position:absolute;top:-8px;right:-16px;z-index:10}[data-v-d405ca59] .guido__verion-history-view-option-selection-desktop svg,[data-v-d405ca59] .guido__verion-history-view-option-selection-mobile svg{margin:0 0 0 2px}[data-v-d405ca59] .in-segments-wrapper__button_selected,[data-v-d405ca59] .in-segments-wrapper__button_selected:hover{background-color:#dae1fb}[data-v-d405ca59] .in-tooltip-wrapper__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-82128f7d]{gap:4px}.header-wrapper[data-v-5c02dcc7]{min-width:1000px}.guido-loading__wrapper[data-v-07c4b2d8]{height:100%;top:75px!important;bottom:0!important}.guido-editor__wrapper[data-v-50dac6de]{--ribbon-offset: 0px;position:relative;width:100%;height:calc(100vh - 128px - var(--ribbon-offset))}.guido-editor__container[data-v-50dac6de]{width:100%;height:calc(100vh - 128px - var(--ribbon-offset))}.guido-editor__no-header[data-v-50dac6de]{height:calc(100vh - 75px - var(--ribbon-offset))}[data-v-293f1c47] .in-breadcrumb-wrapper__links{cursor:pointer}.templates-wrapper[data-v-669fe7cf]{gap:16px;grid-template-columns:repeat(3,1fr)}.templates-wrapper .template-wrapper[data-v-669fe7cf]{cursor:pointer}.templates-wrapper .template-wrapper .template-container[data-v-669fe7cf]{height:274px;padding:2px;transition:none}.templates-wrapper .template-wrapper .template-container.selected[data-v-669fe7cf]{padding:1px}.templates-wrapper .template-wrapper .template-container .thumbnail[data-v-669fe7cf]{object-fit:cover;transform:scale(1)}[data-v-7a305bb2] .guido__verion-history-view-option-selection-desktop svg,[data-v-7a305bb2] .guido__verion-history-view-option-selection-mobile svg{margin:0 0 0 2px}[data-v-7a305bb2] .in-segments-wrapper__button_selected,[data-v-7a305bb2] .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-06afaecb]{min-width:602px;height:70vh;min-height:583px;border-radius:10px}.desktop-preview iframe[data-v-06afaecb]{min-height:504px}.iframe-wrapper[data-v-cbafc185]{width:258px}.iframe-scaled[data-v-cbafc185]{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-7419ae06] .vueperslides__bullets,[data-v-796d193b] .vueperslides__bullets{pointer-events:none!important}[data-v-796d193b] .vueperslides__parallax-wrapper{height:110px!important}[data-v-cadfc82d] .vueperslides__bullets{pointer-events:none!important}[data-v-cadfc82d] .vueperslides__parallax-wrapper{height:110px!important}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
declare const _default: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue/types/v3-component-options.js").ComponentOptionsMixin, import("vue/types/v3-component-options.js").ComponentOptionsMixin, {}, string, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
|
|
2
|
+
export default _default;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Thin mutation API over the `guidoAiStatus` store. The cortex bridge calls
|
|
3
|
+
* `start`/`stop` as it observes `tool_call` and terminal (`done`/`error`/
|
|
4
|
+
* `cancelled`) segments; the toolbar pill reads the store directly.
|
|
5
|
+
*
|
|
6
|
+
* Both mutations are idempotent: the bridge re-evaluates status on every
|
|
7
|
+
* stream tick, so guarding against no-op writes keeps the store (and any
|
|
8
|
+
* reactive consumers) from churning.
|
|
9
|
+
*/
|
|
10
|
+
export declare const useAiStatus: () => {
|
|
11
|
+
store: import("pinia").Store<"guidoAiStatus", {
|
|
12
|
+
isGenerating: boolean;
|
|
13
|
+
activeTool: string;
|
|
14
|
+
}, {
|
|
15
|
+
isBusy: (state: {
|
|
16
|
+
isGenerating: boolean;
|
|
17
|
+
activeTool: string;
|
|
18
|
+
} & import("pinia").PiniaCustomStateProperties<{
|
|
19
|
+
isGenerating: boolean;
|
|
20
|
+
activeTool: string;
|
|
21
|
+
}>) => boolean;
|
|
22
|
+
}, {}>;
|
|
23
|
+
start: (tool?: string) => void;
|
|
24
|
+
stop: () => void;
|
|
25
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tracks whether the AI agent (cortex-fe) is mid-generation so the editor
|
|
3
|
+
* toolbar can surface a status pill. Written by `useAiStatus` via `$patch` —
|
|
4
|
+
* state + getters only, mirroring `guido-email-editor` (architecture invariant).
|
|
5
|
+
*
|
|
6
|
+
* Store id `guidoAiStatus` is intentionally cross-MFE readable for debugging,
|
|
7
|
+
* same convention as `guidoEmailEditor`.
|
|
8
|
+
*/
|
|
9
|
+
export declare const useAiStatusStore: import("pinia").StoreDefinition<"guidoAiStatus", {
|
|
10
|
+
/** True while a qmechanics tool_call is in flight and no terminal segment seen. */
|
|
11
|
+
isGenerating: boolean;
|
|
12
|
+
/** Best-effort name of the tool that flipped the pill on — for debug/telemetry. */
|
|
13
|
+
activeTool: string;
|
|
14
|
+
}, {
|
|
15
|
+
isBusy: (state: {
|
|
16
|
+
isGenerating: boolean;
|
|
17
|
+
activeTool: string;
|
|
18
|
+
} & import("pinia").PiniaCustomStateProperties<{
|
|
19
|
+
/** True while a qmechanics tool_call is in flight and no terminal segment seen. */
|
|
20
|
+
isGenerating: boolean;
|
|
21
|
+
/** Best-effort name of the tool that flipped the pill on — for debug/telemetry. */
|
|
22
|
+
activeTool: string;
|
|
23
|
+
}>) => boolean;
|
|
24
|
+
}, {}>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { defineStore as e } from "pinia";
|
|
2
|
+
const s = e("guidoAiStatus", {
|
|
3
|
+
state: () => ({
|
|
4
|
+
/** True while a qmechanics tool_call is in flight and no terminal segment seen. */
|
|
5
|
+
isGenerating: !1,
|
|
6
|
+
/** Best-effort name of the tool that flipped the pill on — for debug/telemetry. */
|
|
7
|
+
activeTool: ""
|
|
8
|
+
}),
|
|
9
|
+
getters: {
|
|
10
|
+
isBusy: (t) => t.isGenerating
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
export {
|
|
14
|
+
s as useAiStatusStore
|
|
15
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@useinsider/guido",
|
|
3
|
-
"version": "3.9.0-beta.
|
|
3
|
+
"version": "3.9.0-beta.fd95a10",
|
|
4
4
|
"description": "Guido is a Vue + TypeScript wrapper for Email Plugin. Easily embed the email editor in your Vue applications.",
|
|
5
5
|
"main": "./dist/guido.umd.cjs",
|
|
6
6
|
"module": "./dist/library.js",
|