@useinsider/guido 3.30.0-beta.6054a97 → 3.30.0-beta.60f9fc0
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 +14 -0
- package/dist/components/Guido.vue.js +9 -9
- package/dist/components/Guido.vue2.js +153 -130
- package/dist/components/organisms/dynamic-content/InvalidDynamicContentCard.vue.js +22 -0
- package/dist/components/organisms/dynamic-content/InvalidDynamicContentCard.vue2.js +30 -0
- package/dist/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue.js +1 -1
- package/dist/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue2.js +46 -52
- package/dist/composables/useInvalidDynamicContentMarking.js +105 -0
- package/dist/config/migrator/itemsBlockMigrator.js +164 -161
- package/dist/extensions/DynamicContent/dynamic-content.js +39 -57
- package/dist/guido.css +1 -1
- package/dist/package.json.js +1 -1
- package/dist/src/@types/generic.d.ts +11 -0
- package/dist/src/components/Guido.vue.d.ts +5 -1
- package/dist/src/components/organisms/dynamic-content/InvalidDynamicContentCard.vue.d.ts +22 -0
- package/dist/src/composables/useInvalidDynamicContentMarking.d.ts +4 -0
- package/dist/src/extensions/DynamicContent/dynamic-content.d.ts +0 -8
- package/dist/src/library.d.ts +1 -1
- package/dist/src/stores/dynamic-content.d.ts +42 -1
- package/dist/src/utils/editorCanvas.d.ts +3 -0
- package/dist/static/styles/customEditorStyle.css.js +4 -0
- package/dist/stores/dynamic-content.js +19 -7
- package/dist/utils/editorCanvas.js +18 -0
- package/dist/utils/pairProductVariables.js +98 -108
- package/package.json +1 -1
|
@@ -1,57 +1,51 @@
|
|
|
1
|
-
import { defineComponent as
|
|
1
|
+
import { defineComponent as b, defineAsyncComponent as T, ref as w, computed as o, watch as N } from "vue";
|
|
2
2
|
import "@useinsider/design-system-organisms/style";
|
|
3
|
-
import { useToaster as
|
|
4
|
-
import { useTranslations as
|
|
5
|
-
import { DOTTED_DATE_LOCALE as
|
|
6
|
-
import { URLS as
|
|
7
|
-
import { ToasterTypeOptions as
|
|
8
|
-
import { useRecommendationExtensionStore as
|
|
9
|
-
import { commitStrategyChange as
|
|
10
|
-
import
|
|
11
|
-
import { formatShortDate as
|
|
12
|
-
import { asText as
|
|
13
|
-
import { escapeHtml as
|
|
14
|
-
import { InSkeleton as
|
|
15
|
-
const
|
|
3
|
+
import { useToaster as R } from "../../../../composables/useToaster.js";
|
|
4
|
+
import { useTranslations as P } from "../../../../composables/useTranslations.js";
|
|
5
|
+
import { DOTTED_DATE_LOCALE as U } from "../../../../enums/date.js";
|
|
6
|
+
import { URLS as G } from "../../../../enums/extensions/recommendationBlock.js";
|
|
7
|
+
import { ToasterTypeOptions as u } from "../../../../enums/toaster.js";
|
|
8
|
+
import { useRecommendationExtensionStore as M } from "../../../../extensions/Blocks/Recommendation/store/recommendation.js";
|
|
9
|
+
import { commitStrategyChange as E } from "../../../../extensions/Blocks/Recommendation/utils/strategyCommit.js";
|
|
10
|
+
import $ from "./StrategyInfoBoxContent.vue.js";
|
|
11
|
+
import { formatShortDate as z } from "../../../../utils/dateUtil.js";
|
|
12
|
+
import { asText as D } from "../../../../utils/genericUtil.js";
|
|
13
|
+
import { escapeHtml as H } from "../../../../utils/htmlEscape.js";
|
|
14
|
+
import { InSkeleton as O } from "@useinsider/design-system-vue";
|
|
15
|
+
const it = /* @__PURE__ */ b({
|
|
16
16
|
__name: "AssignStrategyDrawer",
|
|
17
|
-
setup(
|
|
18
|
-
const g = () => import("@useinsider/design-system-organisms"),
|
|
19
|
-
render: (s) => s(
|
|
20
|
-
}),
|
|
17
|
+
setup(F) {
|
|
18
|
+
const g = () => import("@useinsider/design-system-organisms"), p = (t, r) => ({
|
|
19
|
+
render: (s) => s(O, { props: { sizing: { width: t, height: r } } })
|
|
20
|
+
}), I = T({
|
|
21
21
|
loader: async () => (await g()).OrgStrategyDetailModal,
|
|
22
|
-
loadingComponent:
|
|
22
|
+
loadingComponent: p(480, 240),
|
|
23
23
|
delay: 0
|
|
24
|
-
}),
|
|
24
|
+
}), h = T({
|
|
25
25
|
loader: async () => (await g()).OrgStrategyDropdown
|
|
26
|
-
}), i = "guido-edit-strategy-",
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
));
|
|
30
|
-
R(() => e.assignStrategyDrawerStatus, async (t) => {
|
|
31
|
-
if (!t) {
|
|
32
|
-
await P(), m.value = e.assignStrategyDrawerStatus;
|
|
26
|
+
}), i = "guido-edit-strategy-", x = { width: 480, height: 42 }, a = P(), e = M(), { showToaster: c } = R(), n = w(null), d = "legacy", l = w(!1), A = o(() => e.strategiesLoading || e.legacyConversionLoading), C = o(() => e.assignStrategyDrawerStatus ? a("email-editor.assign-strategy-description", { url: G.RECOMMENDATION_STRATEGIES_PANEL_PATH }) : "");
|
|
27
|
+
N(() => e.assignStrategyDrawerStatus, (t) => {
|
|
28
|
+
if (!t)
|
|
33
29
|
return;
|
|
34
|
-
}
|
|
35
|
-
m.value = !0;
|
|
36
30
|
const { strategyId: r } = e.recommendationConfigs;
|
|
37
31
|
n.value = r || (e.isLegacyStrategyBlock ? d : null), l.value = !1, e.invalidateStrategies(), e.fetchStrategies().catch(() => {
|
|
38
32
|
c({
|
|
39
|
-
type:
|
|
33
|
+
type: u.Error,
|
|
40
34
|
message: a("discovery-strategy.error-description")
|
|
41
35
|
});
|
|
42
36
|
});
|
|
43
|
-
}
|
|
44
|
-
const
|
|
45
|
-
const r =
|
|
37
|
+
});
|
|
38
|
+
const f = (t) => {
|
|
39
|
+
const r = D(t.updated_at || t.created_at);
|
|
46
40
|
if (!r)
|
|
47
41
|
return "";
|
|
48
|
-
const s =
|
|
42
|
+
const s = z(r, U);
|
|
49
43
|
return a("recommendation-strategy.last-updated-on", { value: s });
|
|
50
|
-
},
|
|
44
|
+
}, S = o(() => ({
|
|
51
45
|
text: a("ds-steps.legacy-strategy"),
|
|
52
46
|
value: d,
|
|
53
47
|
hidden: !0
|
|
54
|
-
})),
|
|
48
|
+
})), m = o(() => e.strategies.map((t) => ({
|
|
55
49
|
text: t.name,
|
|
56
50
|
value: t.strategy_id,
|
|
57
51
|
infoBoxProps: {
|
|
@@ -60,10 +54,10 @@ const lt = /* @__PURE__ */ N({
|
|
|
60
54
|
variant: "information",
|
|
61
55
|
size: "small",
|
|
62
56
|
class: "assign-strategy-info-box",
|
|
63
|
-
titleText:
|
|
57
|
+
titleText: H(D(t.name)),
|
|
64
58
|
descriptionStatus: !0,
|
|
65
|
-
descriptionText:
|
|
66
|
-
slot:
|
|
59
|
+
descriptionText: f(t),
|
|
60
|
+
slot: $,
|
|
67
61
|
slotProps: { strategy: t },
|
|
68
62
|
// The info box drops the option's value/text, so the id is the only channel
|
|
69
63
|
// that can carry the strategy back to the click handler.
|
|
@@ -76,17 +70,17 @@ const lt = /* @__PURE__ */ N({
|
|
|
76
70
|
icon: "line-open-website"
|
|
77
71
|
}]
|
|
78
72
|
}
|
|
79
|
-
}))),
|
|
80
|
-
var
|
|
81
|
-
const r = (
|
|
73
|
+
}))), L = o(() => e.isLegacyStrategyBlock ? [S.value, ...m.value] : m.value), B = (t) => {
|
|
74
|
+
var _;
|
|
75
|
+
const r = (_ = t == null ? void 0 : t.id) != null && _.startsWith(i) ? t.id.slice(i.length) : "";
|
|
82
76
|
if (!r)
|
|
83
77
|
return;
|
|
84
78
|
const s = e.currentRecommendationId, y = e.recommendationConfigs.strategyId === r;
|
|
85
|
-
e.openStrategyEdit(r) && (String(n.value ?? "") === r && (n.value = null), y && (e.removeStrategy(), s !== null &&
|
|
86
|
-
},
|
|
79
|
+
e.openStrategyEdit(r) && (String(n.value ?? "") === r && (n.value = null), y && (e.removeStrategy(), s !== null && E(s, "Removed recommendation strategy")));
|
|
80
|
+
}, v = o(() => {
|
|
87
81
|
const t = e.strategies.find((r) => String(r.strategy_id) === String(n.value ?? ""));
|
|
88
82
|
return t ? { ...t, fallback_config: null } : null;
|
|
89
|
-
}),
|
|
83
|
+
}), k = o(() => ({
|
|
90
84
|
primaryButton: {
|
|
91
85
|
styling: "solid",
|
|
92
86
|
type: "primary",
|
|
@@ -98,10 +92,10 @@ const lt = /* @__PURE__ */ N({
|
|
|
98
92
|
labelText: a("products.cancel")
|
|
99
93
|
}
|
|
100
94
|
}));
|
|
101
|
-
return { __sfc: !0, loadOrganisms: g, skeleton:
|
|
95
|
+
return { __sfc: !0, loadOrganisms: g, skeleton: p, OrgStrategyDetailModal: I, OrgStrategyDropdown: h, EDIT_BUTTON_ID_PREFIX: i, SELECT_SKELETON_SIZING: x, trans: a, store: e, showToaster: c, selectedStrategyId: n, LEGACY_OPTION_VALUE: d, showSelectionError: l, strategiesLoading: A, drawerDescription: C, lastUpdatedText: f, legacyStrategyOption: S, remoteStrategyOptions: m, strategyOptions: L, onInfoBoxButtonClick: B, selectedStrategy: v, footerButtonGroupOptions: k, closeDrawer: () => {
|
|
102
96
|
e.closeAssignStrategyDrawer();
|
|
103
97
|
}, assignStrategy: async () => {
|
|
104
|
-
const t =
|
|
98
|
+
const t = v.value;
|
|
105
99
|
if (!t) {
|
|
106
100
|
l.value = !0;
|
|
107
101
|
return;
|
|
@@ -114,21 +108,21 @@ const lt = /* @__PURE__ */ N({
|
|
|
114
108
|
}
|
|
115
109
|
if (!r) {
|
|
116
110
|
c({
|
|
117
|
-
type:
|
|
111
|
+
type: u.Error,
|
|
118
112
|
message: a("email-editor.strategy-assign-failed", { strategyName: t.name })
|
|
119
113
|
});
|
|
120
114
|
return;
|
|
121
115
|
}
|
|
122
116
|
const s = e.currentRecommendationId;
|
|
123
117
|
e.assignStrategy(t), c({
|
|
124
|
-
type:
|
|
118
|
+
type: u.Success,
|
|
125
119
|
message: a("email-editor.strategy-assigned-success", { strategyName: t.name })
|
|
126
|
-
}), e.closeAssignStrategyDrawer(), s !== null && await
|
|
120
|
+
}), e.closeAssignStrategyDrawer(), s !== null && await E(s, "Assigned recommendation strategy");
|
|
127
121
|
}, onSelect: (t) => {
|
|
128
122
|
n.value = t.value, l.value = !1;
|
|
129
|
-
}, InSkeleton:
|
|
123
|
+
}, InSkeleton: O };
|
|
130
124
|
}
|
|
131
125
|
});
|
|
132
126
|
export {
|
|
133
|
-
|
|
127
|
+
it as default
|
|
134
128
|
};
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { useDynamicContentStore as f } from "../stores/dynamic-content.js";
|
|
2
|
+
import { useEditorStore as T } from "../stores/editor.js";
|
|
3
|
+
import { getEditorCanvasFrame as g, getCanvasElementPosition as S } from "../utils/editorCanvas.js";
|
|
4
|
+
import { watch as A } from "vue";
|
|
5
|
+
const C = "merge-tag-selector", E = "merge-tag-value", u = "guido-invalid-dynamic-content-style", v = ["", " "], h = (t) => v.flatMap((n) => v.map((e) => ({
|
|
6
|
+
exact: `{{${n}${t}${e}}}`,
|
|
7
|
+
prefix: `{{${n}${t}${e}|`
|
|
8
|
+
}))), D = (t, n) => h(n).some(({ exact: e, prefix: o }) => t === e || t.startsWith(o)), p = (t) => t.replace(/["\\|]/g, "\\$&").replace(/[\n\r\f]/g, (n) => `\\${n.charCodeAt(0).toString(16)} `), _ = (t) => {
|
|
9
|
+
const n = t.flatMap((e) => h(e).flatMap(({ exact: o, prefix: r }) => [`="${p(o)}"`, `^="${p(r)}"`]).map((o) => `${C}[${E}${o}]`).flatMap((o) => [`${o} .esd-merge-tag`, `${o} .esd-x`]));
|
|
10
|
+
return n.length === 0 ? "" : `${n.join(`,
|
|
11
|
+
`)} {
|
|
12
|
+
color: var(--guido-dc-invalid-color) !important;
|
|
13
|
+
border-color: var(--guido-dc-invalid-color) !important;
|
|
14
|
+
}`;
|
|
15
|
+
}, y = (t, n) => {
|
|
16
|
+
const e = t.getAttribute(E) ?? "";
|
|
17
|
+
return n.find((o) => D(e, o.value));
|
|
18
|
+
}, w = (t) => typeof (t == null ? void 0 : t.nodeType) == "number", x = (t) => {
|
|
19
|
+
const n = t;
|
|
20
|
+
return typeof (n == null ? void 0 : n.closest) == "function" ? n.closest(C) : null;
|
|
21
|
+
}, $ = () => {
|
|
22
|
+
var t, n;
|
|
23
|
+
return ((n = (t = g()) == null ? void 0 : t.contentWindow) == null ? void 0 : n.document) ?? null;
|
|
24
|
+
}, L = (t, n) => {
|
|
25
|
+
var a;
|
|
26
|
+
const e = _(n), o = t.getElementById(u);
|
|
27
|
+
if (!e) {
|
|
28
|
+
o == null || o.remove();
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
if (o) {
|
|
32
|
+
o.textContent !== e && (o.textContent = e);
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
const r = t.createElement("style");
|
|
36
|
+
r.id = u, r.textContent = e, (a = t.head ?? t.body) == null || a.appendChild(r);
|
|
37
|
+
}, P = () => {
|
|
38
|
+
const t = $();
|
|
39
|
+
if (t)
|
|
40
|
+
try {
|
|
41
|
+
const n = f().invalidDynamicContentList.map((e) => e.value);
|
|
42
|
+
L(t, n);
|
|
43
|
+
} catch (n) {
|
|
44
|
+
console.error("Failed to apply the invalid dynamic content marking", n);
|
|
45
|
+
}
|
|
46
|
+
}, k = () => {
|
|
47
|
+
const t = f(), n = T();
|
|
48
|
+
let e = null, o = null;
|
|
49
|
+
const r = () => {
|
|
50
|
+
o && (o = null, document.dispatchEvent(new CustomEvent("dynamic-content:invalid-leave")));
|
|
51
|
+
}, a = (i) => {
|
|
52
|
+
const s = x(i.target);
|
|
53
|
+
if (!s || s === o)
|
|
54
|
+
return;
|
|
55
|
+
const l = y(s, t.invalidDynamicContentList), m = g();
|
|
56
|
+
if (!l || !m)
|
|
57
|
+
return;
|
|
58
|
+
o = s;
|
|
59
|
+
const M = {
|
|
60
|
+
entry: { ...l },
|
|
61
|
+
position: S(m, s)
|
|
62
|
+
};
|
|
63
|
+
document.dispatchEvent(new CustomEvent("dynamic-content:invalid-hover", { detail: M }));
|
|
64
|
+
}, d = (i) => {
|
|
65
|
+
!o || w(i.relatedTarget) && o.contains(i.relatedTarget) || r();
|
|
66
|
+
}, c = () => {
|
|
67
|
+
e == null || e.removeEventListener("mouseover", a), e == null || e.removeEventListener("mouseout", d), e == null || e.removeEventListener("scroll", r, !0), e = null, r();
|
|
68
|
+
}, I = () => {
|
|
69
|
+
if (!n.isStripoInitialized) {
|
|
70
|
+
c();
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
const i = $(), s = t.invalidDynamicContentList.map((l) => l.value);
|
|
74
|
+
if (!i) {
|
|
75
|
+
c();
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
if (L(i, s), s.length === 0) {
|
|
79
|
+
c();
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
i !== e && (c(), i.addEventListener("mouseover", a), i.addEventListener("mouseout", d), i.addEventListener("scroll", r, !0), e = i), o && (!o.isConnected || !y(o, t.invalidDynamicContentList)) && r();
|
|
83
|
+
};
|
|
84
|
+
return A(
|
|
85
|
+
[
|
|
86
|
+
() => n.isStripoInitialized,
|
|
87
|
+
() => n.changeSeq,
|
|
88
|
+
() => n.isCodeEditorOpen,
|
|
89
|
+
() => n.isVersionHistoryOpen,
|
|
90
|
+
() => n.isPreviewModeOpen,
|
|
91
|
+
() => t.invalidDynamicContentList
|
|
92
|
+
],
|
|
93
|
+
() => {
|
|
94
|
+
try {
|
|
95
|
+
I();
|
|
96
|
+
} catch (i) {
|
|
97
|
+
console.error("Failed to track invalid dynamic content", i);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
), { dispose: c };
|
|
101
|
+
};
|
|
102
|
+
export {
|
|
103
|
+
P as applyInvalidDynamicContentMarking,
|
|
104
|
+
k as useInvalidDynamicContentMarking
|
|
105
|
+
};
|