@useinsider/guido 3.23.0-beta.534d03d → 3.23.0-beta.57760f0
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/display-conditions/DisplayConditionCreateDrawer.vue.js +1 -1
- package/dist/components/organisms/display-conditions/DisplayConditionCreateDrawer.vue2.js +28 -28
- package/dist/components/organisms/display-conditions/DisplayConditionSelectDrawer.vue.js +1 -1
- package/dist/components/organisms/display-conditions/DisplayConditionSelectDrawer.vue2.js +25 -25
- package/dist/composables/useDisplayConditions.js +42 -41
- package/dist/composables/useTranslations.js +2 -1
- package/dist/extensions/DisplayConditions/control.js +44 -33
- package/dist/extensions/DisplayConditions/library.js +8 -6
- package/dist/guido.css +1 -1
- package/dist/package.json.js +1 -1
- package/dist/src/composables/useDisplayConditions.d.ts +1 -0
- package/dist/src/extensions/DisplayConditions/control.d.ts +1 -0
- package/dist/src/utils/displayCondition.d.ts +2 -2
- package/dist/utils/displayCondition.js +11 -11
- package/dist/utils/templatePreparation.js +61 -52
- package/package.json +1 -1
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
import { defineComponent as w, reactive as
|
|
1
|
+
import { defineComponent as w, reactive as L, ref as c, computed as u, watch as N } from "vue";
|
|
2
2
|
import R from "../../wrappers/WpDrawer.vue.js";
|
|
3
|
-
import { useDisplayConditions as
|
|
4
|
-
import { useTranslations as
|
|
5
|
-
import { DISPLAY_CONDITION_LIMITS as
|
|
6
|
-
import { useDisplayConditionStore as
|
|
7
|
-
import { InRadioButton as
|
|
8
|
-
import
|
|
3
|
+
import { useDisplayConditions as k, DISPLAY_CONDITIONS_TRANS_KEY as i } from "../../../composables/useDisplayConditions.js";
|
|
4
|
+
import { useTranslations as Y } from "../../../composables/useTranslations.js";
|
|
5
|
+
import { DISPLAY_CONDITION_LIMITS as j } from "../../../enums/display-condition.js";
|
|
6
|
+
import { useDisplayConditionStore as E } from "../../../stores/display-condition.js";
|
|
7
|
+
import { InRadioButton as P, InBasicTextInput as F } from "@useinsider/design-system-vue";
|
|
8
|
+
import G from "./CodeEditorField.vue.js";
|
|
9
9
|
const Z = /* @__PURE__ */ w({
|
|
10
10
|
__name: "DisplayConditionCreateDrawer",
|
|
11
|
-
setup(
|
|
12
|
-
const n =
|
|
11
|
+
setup(K) {
|
|
12
|
+
const n = Y(), p = E(), {
|
|
13
13
|
validate: v,
|
|
14
14
|
notifyInvalid: f,
|
|
15
15
|
createInline: y,
|
|
16
|
-
createAndSave:
|
|
17
|
-
cancel:
|
|
18
|
-
describeWithAcademyLink:
|
|
19
|
-
} =
|
|
16
|
+
createAndSave: _,
|
|
17
|
+
cancel: b,
|
|
18
|
+
describeWithAcademyLink: B
|
|
19
|
+
} = k(), m = () => ({ name: "", description: "", codeBefore: "", codeAfter: "" }), e = L(m()), o = c({}), r = c(!1), l = c(!1), s = u(() => r.value || l.value), g = c(), I = c();
|
|
20
20
|
let d = 0;
|
|
21
|
-
|
|
21
|
+
N(() => p.isCreateOpen, (a) => {
|
|
22
22
|
if (d += 1, !a)
|
|
23
23
|
return;
|
|
24
24
|
const { editing: t } = p;
|
|
@@ -27,37 +27,37 @@ const Z = /* @__PURE__ */ w({
|
|
|
27
27
|
description: t.description,
|
|
28
28
|
codeBefore: t.beforeScript,
|
|
29
29
|
codeAfter: t.afterScript
|
|
30
|
-
} : m()), o.value = {},
|
|
30
|
+
} : m()), o.value = {}, r.value = !1;
|
|
31
31
|
}, { immediate: !0 });
|
|
32
|
-
const C = u(() =>
|
|
32
|
+
const C = u(() => B("create-description")), D = u(() => ({
|
|
33
33
|
cancelOrBackButton: {
|
|
34
34
|
styling: "ghost",
|
|
35
35
|
type: "secondary",
|
|
36
|
-
labelText:
|
|
36
|
+
labelText: n(`${i}.cancel`),
|
|
37
37
|
disabledStatus: s.value
|
|
38
38
|
},
|
|
39
39
|
secondaryButton: {
|
|
40
40
|
styling: "solid",
|
|
41
41
|
type: "subtle-primary",
|
|
42
|
-
labelText:
|
|
43
|
-
loadingStatus:
|
|
42
|
+
labelText: n(`${i}.create-and-save`),
|
|
43
|
+
loadingStatus: r.value
|
|
44
44
|
},
|
|
45
45
|
primaryButton: {
|
|
46
46
|
styling: "solid",
|
|
47
47
|
type: "primary",
|
|
48
|
-
labelText:
|
|
48
|
+
labelText: n(`${i}.create`),
|
|
49
49
|
disabledStatus: s.value
|
|
50
50
|
}
|
|
51
51
|
})), O = (a, t) => {
|
|
52
52
|
t !== e[a] && (e[a] = t, o.value[a] && (o.value = { ...o.value, [a]: void 0 }));
|
|
53
|
-
}, T = u(() => `${
|
|
54
|
-
return { __sfc: !0,
|
|
53
|
+
}, T = u(() => `${n(`${i}.condition-description`)} <span class="guido-display-condition-create__optional">(${n(`${i}.optional`)})</span>`);
|
|
54
|
+
return { __sfc: !0, trans: n, store: p, validate: v, notifyInvalid: f, createInline: y, createAndSave: _, cancel: b, describeWithAcademyLink: B, emptyDraft: m, draft: e, errors: o, isSaving: r, isReadingCode: l, isBusy: s, codeBeforeRef: g, codeAfterRef: I, openGeneration: d, descriptionText: C, footerButtonGroupOptions: D, updateField: O, descriptionLabel: T, submit: async (a) => {
|
|
55
55
|
var S, A;
|
|
56
56
|
if (s.value)
|
|
57
57
|
return;
|
|
58
58
|
const t = d;
|
|
59
59
|
l.value = !0;
|
|
60
|
-
const [$, x] = await Promise.all([(S =
|
|
60
|
+
const [$, x] = await Promise.all([(S = g.value) == null ? void 0 : S.read(), (A = I.value) == null ? void 0 : A.read()]);
|
|
61
61
|
if (l.value = !1, t !== d)
|
|
62
62
|
return;
|
|
63
63
|
if (e.codeBefore = $ ?? e.codeBefore, e.codeAfter = x ?? e.codeAfter, o.value = v(e), Object.keys(o.value).length) {
|
|
@@ -68,12 +68,12 @@ const Z = /* @__PURE__ */ w({
|
|
|
68
68
|
y({ ...e });
|
|
69
69
|
return;
|
|
70
70
|
}
|
|
71
|
-
|
|
72
|
-
const h = await
|
|
73
|
-
|
|
71
|
+
r.value = !0;
|
|
72
|
+
const h = await _({ ...e });
|
|
73
|
+
r.value = !1, o.value = h ?? {}, Object.keys(o.value).length && f();
|
|
74
74
|
}, close: () => {
|
|
75
|
-
s.value ||
|
|
76
|
-
}, WpDrawer: R, DISPLAY_CONDITION_LIMITS:
|
|
75
|
+
s.value || b();
|
|
76
|
+
}, WpDrawer: R, KEY: i, DISPLAY_CONDITION_LIMITS: j, InBasicTextInput: F, InRadioButton: P, CodeEditorField: G };
|
|
77
77
|
}
|
|
78
78
|
});
|
|
79
79
|
export {
|
|
@@ -1,63 +1,63 @@
|
|
|
1
|
-
import { defineComponent as
|
|
1
|
+
import { defineComponent as x, ref as a, watch as D, computed as r, onBeforeUnmount as M } from "vue";
|
|
2
2
|
import b from "../../wrappers/WpDrawer.vue.js";
|
|
3
3
|
import h from "../../wrappers/WpModal.vue.js";
|
|
4
|
-
import { useDisplayConditions as
|
|
5
|
-
import { useTranslations as
|
|
4
|
+
import { useDisplayConditions as C, DISPLAY_CONDITIONS_TRANS_KEY as c } from "../../../composables/useDisplayConditions.js";
|
|
5
|
+
import { useTranslations as w } from "../../../composables/useTranslations.js";
|
|
6
6
|
import { useDisplayConditionStore as k } from "../../../stores/display-condition.js";
|
|
7
|
-
import { InSkeleton as
|
|
8
|
-
const
|
|
7
|
+
import { InSkeleton as A, InNoData as N, InIcons as $, InButtonV2 as K, InBasicTextInput as P } from "@useinsider/design-system-vue";
|
|
8
|
+
const Q = /* @__PURE__ */ x({
|
|
9
9
|
__name: "DisplayConditionSelectDrawer",
|
|
10
|
-
setup(
|
|
11
|
-
const
|
|
10
|
+
setup(W) {
|
|
11
|
+
const I = [40, 76, 76, 76], l = w(), t = k(), { loadList: m, select: y, deleteSaved: f, cancel: _, describeWithAcademyLink: v } = C(), u = a(""), i = a(null), n = a(null), o = a(!1);
|
|
12
12
|
D(() => t.isSelectOpen, (e) => {
|
|
13
|
-
e && (
|
|
13
|
+
e && (u.value = "", i.value = null, n.value = null, m());
|
|
14
14
|
}, { immediate: !0 });
|
|
15
|
-
const
|
|
16
|
-
const e =
|
|
17
|
-
return e ? t.list.filter((
|
|
18
|
-
}),
|
|
15
|
+
const O = r(() => {
|
|
16
|
+
const e = u.value.trim().toLocaleLowerCase();
|
|
17
|
+
return e ? t.list.filter((d) => `${d.name} ${d.description}`.toLocaleLowerCase().includes(e)) : t.list;
|
|
18
|
+
}), S = r(() => v("select-description")), B = r(() => ({
|
|
19
19
|
cancelOrBackButton: {
|
|
20
20
|
styling: "ghost",
|
|
21
21
|
type: "secondary",
|
|
22
|
-
labelText:
|
|
22
|
+
labelText: l(`${c}.back`),
|
|
23
23
|
leftIcon: "line-arrow-left"
|
|
24
24
|
}
|
|
25
|
-
})),
|
|
25
|
+
})), L = r(() => ({
|
|
26
26
|
cancelOrBackButton: {
|
|
27
27
|
type: "secondary",
|
|
28
28
|
styling: "ghost",
|
|
29
|
-
labelText:
|
|
29
|
+
labelText: l(`${c}.cancel`),
|
|
30
30
|
disabledStatus: o.value
|
|
31
31
|
},
|
|
32
32
|
primaryButton: {
|
|
33
33
|
type: "danger",
|
|
34
|
-
labelText:
|
|
34
|
+
labelText: l(`${c}.delete`),
|
|
35
35
|
loadingStatus: o.value
|
|
36
36
|
}
|
|
37
37
|
})), E = (e) => {
|
|
38
|
-
|
|
39
|
-
},
|
|
38
|
+
i.value = i.value === e.id ? null : e.id;
|
|
39
|
+
}, T = (e) => {
|
|
40
40
|
n.value = n.value === e.id ? null : e.id;
|
|
41
|
-
},
|
|
41
|
+
}, s = (e) => {
|
|
42
42
|
e.composedPath().some((p) => {
|
|
43
43
|
var g;
|
|
44
44
|
return p instanceof Element && p.matches(".guido-display-condition-card__split") && ((g = p.closest(".guido-display-condition-card")) == null ? void 0 : g.getAttribute("data-condition-id")) === String(n.value);
|
|
45
45
|
}) || (n.value = null);
|
|
46
46
|
};
|
|
47
47
|
return D(n, (e) => {
|
|
48
|
-
e === null ? document.removeEventListener("pointerdown",
|
|
49
|
-
}),
|
|
50
|
-
document.removeEventListener("pointerdown",
|
|
51
|
-
}), { __sfc: !0,
|
|
48
|
+
e === null ? document.removeEventListener("pointerdown", s, !0) : document.addEventListener("pointerdown", s, !0);
|
|
49
|
+
}), M(() => {
|
|
50
|
+
document.removeEventListener("pointerdown", s, !0);
|
|
51
|
+
}), { __sfc: !0, SKELETON_HEIGHTS: I, trans: l, store: t, loadList: m, select: y, deleteSaved: f, cancel: _, describeWithAcademyLink: v, search: u, expandedId: i, menuId: n, isDeleting: o, filteredList: O, descriptionText: S, footerButtonGroupOptions: B, deleteModalButtons: L, toggleExpanded: E, toggleMenu: T, closeMenuOnOutsidePointer: s, requestDelete: (e) => {
|
|
52
52
|
n.value = null, t.pendingDelete = e;
|
|
53
53
|
}, confirmDelete: async () => {
|
|
54
54
|
!t.pendingDelete || o.value || (o.value = !0, await f(t.pendingDelete), o.value = !1);
|
|
55
55
|
}, closeDeleteModal: () => {
|
|
56
56
|
o.value || (t.pendingDelete = null);
|
|
57
57
|
}, codeOf: (e) => [e.codeBefore, e.codeAfter].filter(Boolean).join(`
|
|
58
|
-
`), WpDrawer: b, WpModal: h, InBasicTextInput:
|
|
58
|
+
`), WpDrawer: b, WpModal: h, KEY: c, InBasicTextInput: P, InButtonV2: K, InIcons: $, InNoData: N, InSkeleton: A };
|
|
59
59
|
}
|
|
60
60
|
});
|
|
61
61
|
export {
|
|
62
|
-
|
|
62
|
+
Q as default
|
|
63
63
|
};
|
|
@@ -1,105 +1,105 @@
|
|
|
1
|
-
import { useToaster as
|
|
1
|
+
import { useToaster as M } from "./useToaster.js";
|
|
2
2
|
import { useTranslations as x } from "./useTranslations.js";
|
|
3
3
|
import { ACADEMY_LINKS as L } from "../enums/academy.js";
|
|
4
|
-
import { DisplayConditionSourceType as
|
|
4
|
+
import { DisplayConditionSourceType as y, DISPLAY_CONDITION_LIMITS as s, DisplayConditionEvent as I } from "../enums/display-condition.js";
|
|
5
5
|
import { ToasterTypeOptions as l } from "../enums/toaster.js";
|
|
6
6
|
import { useDisplayConditionApi as O } from "../services/displayConditionApi.js";
|
|
7
7
|
import { useConfigStore as q } from "../stores/config.js";
|
|
8
|
-
import { useDisplayConditionStore as
|
|
9
|
-
import { findInvalidCodeFields as
|
|
8
|
+
import { useDisplayConditionStore as P } from "../stores/display-condition.js";
|
|
9
|
+
import { findInvalidCodeFields as Y, nextConditionId as w } from "../utils/displayCondition.js";
|
|
10
10
|
import { escapeHtml as R } from "../utils/htmlEscape.js";
|
|
11
|
-
import { computed as
|
|
12
|
-
const
|
|
13
|
-
id:
|
|
11
|
+
import { computed as B } from "vue";
|
|
12
|
+
const X = "email-editor.display-conditions", i = X, b = 409, S = (n, m, r) => ({
|
|
13
|
+
id: w(),
|
|
14
14
|
name: n.name.trim(),
|
|
15
15
|
description: n.description.trim(),
|
|
16
16
|
beforeScript: n.codeBefore,
|
|
17
17
|
afterScript: n.codeAfter,
|
|
18
|
-
extraData: JSON.stringify(
|
|
19
|
-
}),
|
|
18
|
+
extraData: JSON.stringify(r === void 0 ? { source: m } : { source: m, savedId: r })
|
|
19
|
+
}), v = (n) => ({
|
|
20
20
|
name: n.name,
|
|
21
21
|
description: n.description,
|
|
22
22
|
codeBefore: n.codeBefore,
|
|
23
23
|
codeAfter: n.codeAfter
|
|
24
|
-
}),
|
|
25
|
-
const n =
|
|
24
|
+
}), ne = () => {
|
|
25
|
+
const n = P(), m = q(), r = O(), o = x(), { showToaster: p } = M(), u = B(() => {
|
|
26
26
|
var e;
|
|
27
27
|
return (e = m.features) != null && e.liquidSyntax ? "liquid" : "pongo";
|
|
28
28
|
}), f = (e) => {
|
|
29
29
|
const t = { condition: e };
|
|
30
|
-
return document.dispatchEvent(new CustomEvent(
|
|
31
|
-
},
|
|
32
|
-
n.view !== "none" && (document.dispatchEvent(new CustomEvent(
|
|
33
|
-
},
|
|
30
|
+
return document.dispatchEvent(new CustomEvent(I.APPLY, { detail: t })), n.close(), t.applied === !0;
|
|
31
|
+
}, D = () => {
|
|
32
|
+
n.view !== "none" && (document.dispatchEvent(new CustomEvent(I.CANCEL)), n.close());
|
|
33
|
+
}, N = (e) => {
|
|
34
34
|
if (e.mode === "select") {
|
|
35
35
|
n.openSelect();
|
|
36
36
|
return;
|
|
37
37
|
}
|
|
38
38
|
n.openCreate(e.mode === "edit" ? e.current : null);
|
|
39
|
-
},
|
|
39
|
+
}, $ = async () => {
|
|
40
40
|
const e = ++n.listRequest;
|
|
41
41
|
n.listStatus = "loading";
|
|
42
42
|
try {
|
|
43
|
-
const t = await
|
|
43
|
+
const t = await r.list(u.value);
|
|
44
44
|
e === n.listRequest && (n.list = t, n.listStatus = "loaded");
|
|
45
45
|
} catch (t) {
|
|
46
46
|
console.warn("Display conditions could not be loaded.", t), e === n.listRequest && (n.listStatus = "error");
|
|
47
47
|
}
|
|
48
|
-
},
|
|
48
|
+
}, h = (e) => {
|
|
49
49
|
const t = {}, d = e.name.trim();
|
|
50
|
-
d ? d.length <
|
|
51
|
-
const { DESCRIPTION_MAX: C } =
|
|
50
|
+
d ? d.length < s.NAME_MIN ? t.name = o(`${i}.error-name-min`, { min: s.NAME_MIN }) : d.length > s.NAME_MAX && (t.name = o(`${i}.error-name-max`, { max: s.NAME_MAX })) : t.name = o(`${i}.error-name-required`);
|
|
51
|
+
const { DESCRIPTION_MAX: C } = s;
|
|
52
52
|
e.description.trim().length > C && (t.description = o(`${i}.error-description-max`, { max: C }));
|
|
53
|
-
const
|
|
53
|
+
const g = Y(e.codeBefore, e.codeAfter, u.value);
|
|
54
54
|
return ["codeBefore", "codeAfter"].forEach((a) => {
|
|
55
|
-
e[a].trim() ?
|
|
55
|
+
e[a].trim() ? g.includes(a) ? t[a] = o(`${i}.error-code-invalid`) : e[a].length > s.CODE_MAX && (t[a] = o(`${i}.error-code-max`, { max: s.CODE_MAX })) : t[a] = o(`${i}.error-code-required`);
|
|
56
56
|
}), t;
|
|
57
|
-
},
|
|
57
|
+
}, A = (e, t) => {
|
|
58
58
|
p(e ? { type: l.Success, message: t } : { type: l.Error, message: o("products.something-went-wrong") });
|
|
59
|
-
},
|
|
59
|
+
}, T = (e) => o(
|
|
60
60
|
`${i}.${e}`,
|
|
61
61
|
{
|
|
62
62
|
academyLink: `<a href="${L.EMAIL_DISPLAY_CONDITIONS}" target="_blank" style="color: #0A2ECC; text-decoration: underline;">${o(`${i}.academy`)}</a>`
|
|
63
63
|
}
|
|
64
|
-
),
|
|
64
|
+
), _ = () => {
|
|
65
65
|
p({ type: l.Error, message: o(`${i}.validation-failed`) });
|
|
66
66
|
}, c = (e) => ({ name: R(e) }), E = (e, t) => {
|
|
67
67
|
e != null && e.authReported || (console.warn(t, e), p({ type: l.Error, message: t }));
|
|
68
68
|
};
|
|
69
69
|
return {
|
|
70
70
|
syntax: u,
|
|
71
|
-
handleOpen:
|
|
72
|
-
cancel:
|
|
73
|
-
loadList:
|
|
74
|
-
validate:
|
|
75
|
-
notifyInvalid:
|
|
76
|
-
describeWithAcademyLink:
|
|
71
|
+
handleOpen: N,
|
|
72
|
+
cancel: D,
|
|
73
|
+
loadList: $,
|
|
74
|
+
validate: h,
|
|
75
|
+
notifyInvalid: _,
|
|
76
|
+
describeWithAcademyLink: T,
|
|
77
77
|
createInline: (e) => {
|
|
78
|
-
|
|
79
|
-
f(S(e,
|
|
78
|
+
A(
|
|
79
|
+
f(S(e, y.INLINE)),
|
|
80
80
|
o(`${i}.created`, c(e.name.trim()))
|
|
81
81
|
);
|
|
82
82
|
},
|
|
83
83
|
createAndSave: async (e) => {
|
|
84
84
|
try {
|
|
85
|
-
const t = await
|
|
86
|
-
return n.list = [t, ...n.list.filter((d) => d.id !== t.id)],
|
|
87
|
-
f(S(
|
|
85
|
+
const t = await r.create(e, u.value);
|
|
86
|
+
return n.list = [t, ...n.list.filter((d) => d.id !== t.id)], A(
|
|
87
|
+
f(S(v(t), y.SAVED, t.id)),
|
|
88
88
|
o(`${i}.created-and-saved`, c(t.name))
|
|
89
89
|
), {};
|
|
90
90
|
} catch (t) {
|
|
91
|
-
return (t == null ? void 0 : t.status) ===
|
|
91
|
+
return (t == null ? void 0 : t.status) === b ? { name: o(`${i}.error-name-exists`) } : (E(t, o(`${i}.save-failed`, c(e.name.trim()))), null);
|
|
92
92
|
}
|
|
93
93
|
},
|
|
94
94
|
select: (e) => {
|
|
95
|
-
|
|
96
|
-
f(S(
|
|
95
|
+
A(
|
|
96
|
+
f(S(v(e), y.SAVED, e.id)),
|
|
97
97
|
o(`${i}.applied`, c(e.name))
|
|
98
98
|
);
|
|
99
99
|
},
|
|
100
100
|
deleteSaved: async (e) => {
|
|
101
101
|
try {
|
|
102
|
-
await
|
|
102
|
+
await r.remove(e.id), n.list = n.list.filter((t) => t.id !== e.id), p({
|
|
103
103
|
type: l.Success,
|
|
104
104
|
message: o(`${i}.deleted`, c(e.name))
|
|
105
105
|
});
|
|
@@ -112,5 +112,6 @@ const i = "email-editor.display-conditions", Y = 409, S = (n, m, s) => ({
|
|
|
112
112
|
};
|
|
113
113
|
};
|
|
114
114
|
export {
|
|
115
|
-
|
|
115
|
+
X as DISPLAY_CONDITIONS_TRANS_KEY,
|
|
116
|
+
ne as useDisplayConditions
|
|
116
117
|
};
|
|
@@ -9,7 +9,8 @@ const useTranslations = () => {
|
|
|
9
9
|
var s;
|
|
10
10
|
const r = (s = translations.value) == null ? void 0 : s[t];
|
|
11
11
|
return r ? n ? Object.entries(n).reduce(
|
|
12
|
-
|
|
12
|
+
// A function replacer keeps `$&`, `$$` and `$1` in the value literal.
|
|
13
|
+
(i, [a, l]) => i.replace(new RegExp(`{${a}}`, "g"), () => String(l)),
|
|
13
14
|
r
|
|
14
15
|
) : r : (console.warn(`Translation key not found: ${t}`), t);
|
|
15
16
|
};
|
|
@@ -1,15 +1,18 @@
|
|
|
1
1
|
var $ = Object.defineProperty;
|
|
2
|
-
var
|
|
3
|
-
var c = (
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
2
|
+
var w = (s, a, i) => a in s ? $(s, a, { enumerable: !0, configurable: !0, writable: !0, value: i }) : s[a] = i;
|
|
3
|
+
var c = (s, a, i) => w(s, typeof a != "symbol" ? a + "" : a, i);
|
|
4
|
+
import { useToaster as S } from "../../composables/useToaster.js";
|
|
5
|
+
import { useTranslations as N } from "../../composables/useTranslations.js";
|
|
6
|
+
import { DisplayConditionSourceType as D } from "../../enums/display-condition.js";
|
|
7
|
+
import { ToasterTypeOptions as I } from "../../enums/toaster.js";
|
|
8
|
+
import { CommonControl as T } from "../Blocks/common-control.js";
|
|
9
|
+
import { toAppliedCondition as E, parseSource as x } from "../../utils/displayCondition.js";
|
|
7
10
|
import { escapeHtml as b } from "../../utils/htmlEscape.js";
|
|
8
|
-
import { ModificationDescription as
|
|
9
|
-
import { requestDisplayCondition as
|
|
10
|
-
import { CONDITIONS_CONTROL_ID as
|
|
11
|
-
const l = ".guido-display-conditions",
|
|
12
|
-
class
|
|
11
|
+
import { ModificationDescription as M, UIElementType as v, UEAttr as R } from "../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
12
|
+
import { requestDisplayCondition as L } from "./bridge.js";
|
|
13
|
+
import { CONDITIONS_CONTROL_ID as H, APPLIED_DESCRIPTION as q, EMPTY_DESCRIPTION as A, MAX_COLLAPSED_LINES as O, CONDITION_ICONS as g } from "./constants.js";
|
|
14
|
+
const l = ".guido-display-conditions", k = { id: 0, name: "", description: "", beforeScript: "", afterScript: "" }, _ = (s) => `<${v.ICON} ${R.ICON.src}="${s}"></${v.ICON}>`, p = (s, a, i, t = !1) => `<button type="button" class="${a}" id="${s}"${t ? " hidden" : ""}>${i}</button>`;
|
|
15
|
+
class K extends T {
|
|
13
16
|
constructor() {
|
|
14
17
|
super(...arguments);
|
|
15
18
|
c(this, "expanded", !1);
|
|
@@ -19,7 +22,7 @@ class V extends w {
|
|
|
19
22
|
c(this, "detachRequest", null);
|
|
20
23
|
}
|
|
21
24
|
getId() {
|
|
22
|
-
return
|
|
25
|
+
return H;
|
|
23
26
|
}
|
|
24
27
|
getTemplate() {
|
|
25
28
|
return `
|
|
@@ -84,7 +87,7 @@ class V extends w {
|
|
|
84
87
|
`;
|
|
85
88
|
}
|
|
86
89
|
onRender() {
|
|
87
|
-
this.forgetLastPanelNode(), this.teardown(), this.wire("#guido__btn-add-display-condition", () => this.toggleMenu()), this.wire("#guido__btn-display-condition-create", () => this.openDrawer("create")), this.wire("#guido__btn-display-condition-select", () => this.openDrawer("select")), this.wire("#guido__btn-edit-display-condition", () => this.openDrawer("edit")), this.wire("#guido__btn-remove-display-condition", () => this.
|
|
90
|
+
this.forgetLastPanelNode(), this.teardown(), this.wire("#guido__btn-add-display-condition", () => this.toggleMenu()), this.wire("#guido__btn-display-condition-create", () => this.openDrawer("create")), this.wire("#guido__btn-display-condition-select", () => this.openDrawer("select")), this.wire("#guido__btn-edit-display-condition", () => this.openDrawer("edit")), this.wire("#guido__btn-remove-display-condition", () => this.removeCondition()), this.wire("#guido__btn-display-condition-toggle", () => {
|
|
88
91
|
this.expanded = !this.expanded, this.paint();
|
|
89
92
|
}), this.observeCodeSize();
|
|
90
93
|
}
|
|
@@ -99,39 +102,47 @@ class V extends w {
|
|
|
99
102
|
getCondition() {
|
|
100
103
|
var t;
|
|
101
104
|
const i = this.currentNode;
|
|
102
|
-
return
|
|
105
|
+
return E((t = i == null ? void 0 : i.getDisplayCondition) == null ? void 0 : t.call(i));
|
|
103
106
|
}
|
|
104
107
|
toggleMenu(i) {
|
|
105
|
-
var n, d,
|
|
108
|
+
var n, d, o;
|
|
106
109
|
const t = (n = this.getContainer()) == null ? void 0 : n.querySelector(`${l} [data-dc-menu]`);
|
|
107
110
|
if (!t)
|
|
108
111
|
return;
|
|
109
112
|
t.hidden = i === void 0 ? !t.hidden : !i, (d = this.detachOutsideClick) == null || d.call(this), t.hidden || this.listenOutsideClick();
|
|
110
|
-
const e = (
|
|
113
|
+
const e = (o = this.getContainer()) == null ? void 0 : o.querySelector(`${l} #guido__btn-add-display-condition`);
|
|
111
114
|
t.style.width = !t.hidden && e ? `${e.getBoundingClientRect().width}px` : "";
|
|
112
115
|
}
|
|
113
116
|
listenOutsideClick() {
|
|
114
|
-
|
|
115
|
-
|
|
117
|
+
var e;
|
|
118
|
+
const i = ((e = this.getContainer()) == null ? void 0 : e.ownerDocument) ?? document, t = (n) => {
|
|
119
|
+
n.composedPath().some((o) => o instanceof HTMLElement && o.matches(`${l} [data-dc-menu], ${l} #guido__btn-add-display-condition`)) || this.toggleMenu(!1);
|
|
116
120
|
};
|
|
117
|
-
i
|
|
118
|
-
i
|
|
121
|
+
i.addEventListener("pointerdown", t, !0), this.detachOutsideClick = () => {
|
|
122
|
+
i.removeEventListener("pointerdown", t, !0), this.detachOutsideClick = null;
|
|
119
123
|
};
|
|
120
124
|
}
|
|
121
125
|
openDrawer(i) {
|
|
122
126
|
const t = this.currentNode;
|
|
123
|
-
this.toggleMenu(!1), this.detachRequest =
|
|
127
|
+
this.toggleMenu(!1), this.detachRequest = L(
|
|
124
128
|
{ mode: i, current: i === "edit" ? this.getCondition() : null },
|
|
125
129
|
{ onApply: (e) => this.applyCondition(e, t) }
|
|
126
130
|
);
|
|
127
131
|
}
|
|
132
|
+
// The drawer flows toast through useDisplayConditions; Remove has no drawer, so it toasts here.
|
|
133
|
+
removeCondition() {
|
|
134
|
+
this.applyCondition(null) || S().showToaster({
|
|
135
|
+
type: I.Error,
|
|
136
|
+
message: N()("products.something-went-wrong")
|
|
137
|
+
});
|
|
138
|
+
}
|
|
128
139
|
// The panel can move to another block while the drawer is open; apply onto the block it was opened for.
|
|
129
140
|
applyCondition(i, t = this.currentNode) {
|
|
130
141
|
if (!t)
|
|
131
142
|
return !1;
|
|
132
143
|
try {
|
|
133
144
|
const e = this.api.getDocumentModifier().modifyHtml(t);
|
|
134
|
-
return e.setDisplayCondition(i ||
|
|
145
|
+
return e.setDisplayCondition(i || k), e.apply(new M(
|
|
135
146
|
i ? `Set display condition ${i.name}` : "Remove display condition"
|
|
136
147
|
)), !0;
|
|
137
148
|
} catch (e) {
|
|
@@ -157,33 +168,33 @@ class V extends w {
|
|
|
157
168
|
}));
|
|
158
169
|
}
|
|
159
170
|
paint() {
|
|
160
|
-
var
|
|
161
|
-
const i = (
|
|
171
|
+
var C;
|
|
172
|
+
const i = (C = this.getContainer()) == null ? void 0 : C.querySelector(l);
|
|
162
173
|
if (!i)
|
|
163
174
|
return;
|
|
164
175
|
const t = this.getCondition(), e = (h) => i.querySelector(h);
|
|
165
|
-
if (e("[data-dc-empty]").hidden = !!t, e("[data-dc-applied]").hidden = !t, e("[data-dc-description]").textContent = this.api.translate(t ?
|
|
176
|
+
if (e("[data-dc-empty]").hidden = !!t, e("[data-dc-applied]").hidden = !t, e("[data-dc-description]").textContent = this.api.translate(t ? q : A), !t)
|
|
166
177
|
return;
|
|
167
178
|
e("[data-dc-name]").textContent = t.name;
|
|
168
|
-
const n =
|
|
179
|
+
const n = x(t) === D.INLINE;
|
|
169
180
|
e("#guido__btn-edit-display-condition").hidden = !n;
|
|
170
|
-
const d = e("[data-dc-sections]"),
|
|
171
|
-
|
|
172
|
-
const u = parseFloat(getComputedStyle(
|
|
173
|
-
|
|
181
|
+
const d = e("[data-dc-sections]"), o = e("[data-dc-before]"), r = e("[data-dc-after]");
|
|
182
|
+
o.innerHTML = b(t.beforeScript), r.innerHTML = b(t.afterScript), r.hidden = !t.afterScript, e("[data-dc-after-label]").hidden = !t.afterScript, d.style.maxHeight = "";
|
|
183
|
+
const u = parseFloat(getComputedStyle(o).lineHeight) || 24, y = (h) => h.hidden ? 0 : Math.round(h.scrollHeight / u), m = y(o) + y(r) > O, f = e("#guido__btn-display-condition-toggle");
|
|
184
|
+
f.hidden = !m, f.classList.toggle("is-expanded", this.expanded), e("[data-dc-toggle-label]").textContent = this.api.translate(this.expanded ? "Show Less" : "Show More"), m && !this.expanded && (d.style.maxHeight = `${this.collapsedHeight(d, [o, r], u)}px`);
|
|
174
185
|
}
|
|
175
186
|
// Labels do not count toward the line limit, so the cut lands after the 10th rendered code line.
|
|
176
187
|
collapsedHeight(i, t, e) {
|
|
177
188
|
const { top: n } = i.getBoundingClientRect();
|
|
178
|
-
let d = O,
|
|
189
|
+
let d = O, o = 0;
|
|
179
190
|
return t.filter((r) => !r.hidden).forEach((r) => {
|
|
180
191
|
if (d <= 0)
|
|
181
192
|
return;
|
|
182
193
|
const u = Math.min(d, Math.round(r.scrollHeight / e));
|
|
183
|
-
|
|
184
|
-
}),
|
|
194
|
+
o = r.getBoundingClientRect().top - n + u * e, d -= u;
|
|
195
|
+
}), o;
|
|
185
196
|
}
|
|
186
197
|
}
|
|
187
198
|
export {
|
|
188
|
-
|
|
199
|
+
K as DisplayConditionsControl
|
|
189
200
|
};
|
|
@@ -1,26 +1,28 @@
|
|
|
1
1
|
import { DisplayConditionSourceType as s } from "../../enums/display-condition.js";
|
|
2
|
-
import { toAppliedCondition as
|
|
2
|
+
import { toAppliedCondition as a, parseSource as p } from "../../utils/displayCondition.js";
|
|
3
3
|
import { ExternalDisplayConditionsLibrary as l } from "../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
4
4
|
import { requestDisplayCondition as d } from "./bridge.js";
|
|
5
5
|
class x extends l {
|
|
6
6
|
getCategoryName() {
|
|
7
7
|
return this.api.translate("Insider Display Conditions");
|
|
8
8
|
}
|
|
9
|
-
openExternalDisplayConditionsDialog(
|
|
10
|
-
const e =
|
|
9
|
+
openExternalDisplayConditionsDialog(n, r, t) {
|
|
10
|
+
const e = a(n), o = p(e) === s.INLINE;
|
|
11
11
|
d(
|
|
12
12
|
{ mode: o ? "edit" : "select", current: o ? e : null },
|
|
13
13
|
{
|
|
14
|
-
onApply: (
|
|
14
|
+
onApply: (i) => (i ? r(i) : t(), !0),
|
|
15
15
|
onCancel: t
|
|
16
16
|
}
|
|
17
17
|
);
|
|
18
18
|
}
|
|
19
|
+
// The Conditions tab is the only entry point; no Display Conditions button on the block toolbar.
|
|
19
20
|
getIsContextActionEnabled() {
|
|
20
|
-
return !
|
|
21
|
+
return !1;
|
|
21
22
|
}
|
|
23
|
+
// Stripo reads the index at registration even when disabled; the base method throws.
|
|
22
24
|
getContextActionIndex() {
|
|
23
|
-
return 1;
|
|
25
|
+
return -1;
|
|
24
26
|
}
|
|
25
27
|
}
|
|
26
28
|
export {
|
package/dist/guido.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
@charset "UTF-8";.auth-error-modal[data-v-b4d7ae51]{position:relative;z-index:145}.gap-16[data-v-5553d071],.gap-16[data-v-0e1b0c54]{gap:16px}[data-v-b8f24f34] .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-baf7a5dd]{gap:4px}.header-wrapper[data-v-d11dd577]{min-width:1000px}.guido-loading__wrapper[data-v-07c4b2d8]{height:100%;top:75px!important;bottom:0!important}.validation-error-list[data-v-e48cebe9]{gap:16px}.validation-error-row[data-v-e48cebe9]{gap:8px;padding:24px;border:1px solid #E1E1E1;border-radius:8px}.validation-error-row__icon[data-v-e48cebe9]{flex-shrink:0;font-size:24px;line-height:0}.validation-error-row__text[data-v-e48cebe9]{font-size:13px;line-height:16px;color:#292929;word-break:break-word}.guido-editor__wrapper[data-v-e96ff469]{--ribbon-offset: 0px;position:relative;width:100%;height:calc(100vh - 128px - var(--ribbon-offset))}.guido-editor__container[data-v-e96ff469]{width:100%;height:calc(100vh - 128px - var(--ribbon-offset))}.guido-editor__no-header[data-v-e96ff469]{height:calc(100vh - 75px - var(--ribbon-offset))}[data-v-293f1c47] .in-breadcrumb-wrapper__links{cursor:pointer}.templates-wrapper[data-v-eaf8e461]{gap:16px;grid-template-columns:repeat(3,1fr)}.templates-wrapper .template-wrapper[data-v-eaf8e461]{cursor:pointer}.templates-wrapper .template-wrapper .template-container[data-v-eaf8e461]{height:274px;padding:2px;transition:none}.templates-wrapper .template-wrapper .template-container.selected[data-v-eaf8e461]{padding:1px}.templates-wrapper .template-wrapper .template-container .thumbnail[data-v-eaf8e461]{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}.guido-code-editor-field__label[data-v-c262cac4]{margin:0 0 8px;color:#2c3546;font-size:13px;line-height:16px}[data-v-
|
|
1
|
+
@charset "UTF-8";.auth-error-modal[data-v-b4d7ae51]{position:relative;z-index:145}.gap-16[data-v-5553d071],.gap-16[data-v-0e1b0c54]{gap:16px}[data-v-b8f24f34] .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-baf7a5dd]{gap:4px}.header-wrapper[data-v-d11dd577]{min-width:1000px}.guido-loading__wrapper[data-v-07c4b2d8]{height:100%;top:75px!important;bottom:0!important}.validation-error-list[data-v-e48cebe9]{gap:16px}.validation-error-row[data-v-e48cebe9]{gap:8px;padding:24px;border:1px solid #E1E1E1;border-radius:8px}.validation-error-row__icon[data-v-e48cebe9]{flex-shrink:0;font-size:24px;line-height:0}.validation-error-row__text[data-v-e48cebe9]{font-size:13px;line-height:16px;color:#292929;word-break:break-word}.guido-editor__wrapper[data-v-e96ff469]{--ribbon-offset: 0px;position:relative;width:100%;height:calc(100vh - 128px - var(--ribbon-offset))}.guido-editor__container[data-v-e96ff469]{width:100%;height:calc(100vh - 128px - var(--ribbon-offset))}.guido-editor__no-header[data-v-e96ff469]{height:calc(100vh - 75px - var(--ribbon-offset))}[data-v-293f1c47] .in-breadcrumb-wrapper__links{cursor:pointer}.templates-wrapper[data-v-eaf8e461]{gap:16px;grid-template-columns:repeat(3,1fr)}.templates-wrapper .template-wrapper[data-v-eaf8e461]{cursor:pointer}.templates-wrapper .template-wrapper .template-container[data-v-eaf8e461]{height:274px;padding:2px;transition:none}.templates-wrapper .template-wrapper .template-container.selected[data-v-eaf8e461]{padding:1px}.templates-wrapper .template-wrapper .template-container .thumbnail[data-v-eaf8e461]{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}.guido-code-editor-field__label[data-v-c262cac4]{margin:0 0 8px;color:#2c3546;font-size:13px;line-height:16px}[data-v-cf448043] .guido-display-condition-create__optional{color:#666}.guido-display-condition-create__separator[data-v-cf448043]{height:1px;margin:0 0 24px;background-image:linear-gradient(to right,#91949F 1px,transparent 1px);background-size:5px 1px}.guido-display-condition-create__method-title[data-v-cf448043]{margin:0 0 24px;color:#292929;font-size:13px;font-weight:600;letter-spacing:1.2px;line-height:20px;text-transform:uppercase}.guido-display-condition-create__methods[data-v-cf448043]{display:flex;gap:16px;margin-bottom:24px}.guido-display-condition-select-root[data-v-21acc8d8] .in-drawer__footer{justify-content:flex-start}.guido-display-condition-select__delete-modal[data-v-21acc8d8]{position:relative;z-index:145}.guido-display-condition-select__delete-modal[data-v-21acc8d8] .in-modal-v2-wrapper__header-title{margin-bottom:0}.guido-display-condition-select__delete-text[data-v-21acc8d8]{margin:0;color:#292929}.guido-display-condition-select-root[data-v-21acc8d8] .in-drawer__content>div{display:flex;flex-direction:column;min-height:100%}.guido-display-condition-select__list[data-v-21acc8d8]{display:flex;flex-direction:column;gap:24px;margin:0;padding:0;list-style:none}.guido-display-condition-card[data-v-21acc8d8]{border:1px solid #E1E1E1;border-radius:4px;background-color:#fff}.guido-display-condition-card__header[data-v-21acc8d8]{display:flex;align-items:center;justify-content:space-between;gap:16px;padding:15px}.guido-display-condition-card__text[data-v-21acc8d8]{min-width:0}.guido-display-condition-card__name[data-v-21acc8d8]{margin:0;overflow:hidden;color:#292929;font-size:16px;font-weight:600;line-height:24px;text-overflow:ellipsis;white-space:nowrap}.guido-display-condition-card__description[data-v-21acc8d8]{margin:4px 0 0;overflow:hidden;color:#666;font-size:13px;line-height:16px;text-overflow:ellipsis;white-space:nowrap}.guido-display-condition-card__actions[data-v-21acc8d8]{display:flex;flex-shrink:0;align-items:center;gap:16px}.guido-display-condition-card__split[data-v-21acc8d8]{position:relative;display:flex;gap:1px}.guido-display-condition-card__menu[data-v-21acc8d8]{position:absolute;z-index:2;top:calc(100% + 2px);right:0;min-width:115px;padding:4px 0;border-radius:4px;background-color:#fff;box-shadow:0 4px 16px #22293829}.guido-display-condition-card__menu-item[data-v-21acc8d8]{width:100%;padding:8px 16px;border:0;background:none;color:#222938;cursor:pointer;font-size:14px;line-height:24px;text-align:left}.guido-display-condition-card__menu-item[data-v-21acc8d8]:hover,.guido-display-condition-card__menu-item[data-v-21acc8d8]:focus-visible{background-color:#eff2f4}.guido-display-condition-card__divider[data-v-21acc8d8]{width:1px;height:24px;background-color:#dcdee6}.guido-display-condition-card__expand[data-v-21acc8d8]{display:flex;padding:0;border:0;background:none;cursor:pointer}.guido-display-condition-card__code[data-v-21acc8d8]{margin:1px 15px 15px;padding:8px;border:1px solid #E1E1E1;border-radius:4px;background-color:#fff;color:#101727;font-family:inherit;font-size:15px;line-height:24px;white-space:pre-wrap;word-break:break-word}.legacy-strategy-updated-modal[data-v-da2225a1]{position:relative;z-index:145}
|
package/dist/package.json.js
CHANGED
|
@@ -2,6 +2,7 @@ import type { DisplayConditionDraft, DisplayConditionOpenDetail, SavedDisplayCon
|
|
|
2
2
|
export type DraftField = keyof DisplayConditionDraft;
|
|
3
3
|
export type DraftErrors = Partial<Record<DraftField, string>>;
|
|
4
4
|
export type CreateIntent = 'inline' | 'save';
|
|
5
|
+
export declare const DISPLAY_CONDITIONS_TRANS_KEY = "email-editor.display-conditions";
|
|
5
6
|
export declare const useDisplayConditions: () => {
|
|
6
7
|
syntax: import("vue").ComputedRef<"liquid" | "pongo">;
|
|
7
8
|
handleOpen: (detail: DisplayConditionOpenDetail) => void;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AppliedDisplayCondition } from '@@/Types/display-condition';
|
|
1
|
+
import type { AppliedDisplayCondition, DisplayConditionSyntax } from '@@/Types/display-condition';
|
|
2
2
|
import { DisplayConditionSourceType } from '@@/Enums/display-condition';
|
|
3
3
|
export declare const parseSource: (condition: AppliedDisplayCondition | null | undefined) => DisplayConditionSourceType | null;
|
|
4
4
|
type ConditionLike = Omit<AppliedDisplayCondition, 'description'> & {
|
|
@@ -7,5 +7,5 @@ type ConditionLike = Omit<AppliedDisplayCondition, 'description'> & {
|
|
|
7
7
|
export declare const toAppliedCondition: (condition: ConditionLike | null | undefined) => AppliedDisplayCondition | null;
|
|
8
8
|
export declare const nextConditionId: () => number;
|
|
9
9
|
export type CodeField = 'codeBefore' | 'codeAfter';
|
|
10
|
-
export declare const findInvalidCodeFields: (codeBefore: string, codeAfter: string) => CodeField[];
|
|
10
|
+
export declare const findInvalidCodeFields: (codeBefore: string, codeAfter: string, syntax?: DisplayConditionSyntax) => CodeField[];
|
|
11
11
|
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { DisplayConditionSourceType as n } from "../enums/display-condition.js";
|
|
2
|
-
const
|
|
2
|
+
const m = (e) => {
|
|
3
3
|
if (!e)
|
|
4
4
|
return null;
|
|
5
5
|
try {
|
|
@@ -7,20 +7,20 @@ const T = (e) => {
|
|
|
7
7
|
} catch {
|
|
8
8
|
return n.SAVED;
|
|
9
9
|
}
|
|
10
|
-
},
|
|
10
|
+
}, I = (e) => !e || !(e.name || e.beforeScript || e.afterScript) ? null : { ...e, description: e.description ?? "" };
|
|
11
11
|
let c = 0;
|
|
12
|
-
const
|
|
12
|
+
const C = () => (c = Math.max(Date.now(), c + 1), c), p = /{%-?\s*(\w+)[\s\S]*?-?%}/g, S = /{%[\s\S]*?%}|{{[\s\S]*?}}/g, u = /{%-?\s*(comment|raw)\s*-?%}[\s\S]*?{%-?\s*end\1\s*-?%}/g, A = /{#[\s\S]*?#}/g, d = /* @__PURE__ */ new Set(["if", "unless", "for", "case", "capture", "tablerow", "comment"]), T = /* @__PURE__ */ new Set(["else", "elsif", "elif", "when"]), h = (e) => /{%|%}|{{|}}/.test(e.replace(S, "")), D = (e, a, f = "liquid") => {
|
|
13
13
|
const t = /* @__PURE__ */ new Set(), r = [];
|
|
14
|
-
return [["codeBefore", e], ["codeAfter", a]].forEach(([o,
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
return [["codeBefore", e], ["codeAfter", a]].forEach(([o, l]) => {
|
|
15
|
+
const i = (f === "pongo" ? l.replace(A, "") : l).replace(u, "");
|
|
16
|
+
h(i) && t.add(o), Array.from(i.matchAll(p), (s) => s[1]).forEach((s) => {
|
|
17
|
+
d.has(s) ? r.push(s) : s.startsWith("end") && d.has(s.slice(3)) ? r.pop() !== s.slice(3) && t.add(o) : T.has(s) && !r.length && t.add(o);
|
|
18
18
|
});
|
|
19
19
|
}), r.length && t.add("codeAfter"), [...t];
|
|
20
20
|
};
|
|
21
21
|
export {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
22
|
+
D as findInvalidCodeFields,
|
|
23
|
+
C as nextConditionId,
|
|
24
|
+
m as parseSource,
|
|
25
|
+
I as toAppliedCondition
|
|
26
26
|
};
|
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
import { useActionsApi as
|
|
2
|
-
import { useConfig as
|
|
3
|
-
import { useHtmlCompiler as
|
|
4
|
-
import { useRecommendationExtensionStore as
|
|
5
|
-
import { toBlockUrlConfig as
|
|
6
|
-
import { DATA_ATTRIBUTES as
|
|
7
|
-
import { parsePageList as
|
|
8
|
-
import { writeTrackingIdsInPlace as
|
|
9
|
-
import { useDynamicContentStore as
|
|
10
|
-
import { useEditorStore as
|
|
11
|
-
import { useUnsubscribeStore as
|
|
12
|
-
import { isPlainObject as
|
|
13
|
-
import { planDocumentTrackingIds as
|
|
14
|
-
function
|
|
15
|
-
const
|
|
16
|
-
return
|
|
17
|
-
const
|
|
18
|
-
|
|
1
|
+
import { useActionsApi as E } from "../composables/useActionsApi.js";
|
|
2
|
+
import { useConfig as R } from "../composables/useConfig.js";
|
|
3
|
+
import { useHtmlCompiler as U } from "../composables/useHtmlCompiler.js";
|
|
4
|
+
import { useRecommendationExtensionStore as k } from "../extensions/Blocks/Recommendation/store/recommendation.js";
|
|
5
|
+
import { toBlockUrlConfig as L } from "../extensions/Blocks/Recommendation/utils/blockUrlConfig.js";
|
|
6
|
+
import { DATA_ATTRIBUTES as b } from "../extensions/Blocks/Unsubscribe/utils/constants.js";
|
|
7
|
+
import { parsePageList as v } from "../extensions/Blocks/Unsubscribe/utils/utils.js";
|
|
8
|
+
import { writeTrackingIdsInPlace as N } from "../extensions/LinkTracking/writer.js";
|
|
9
|
+
import { useDynamicContentStore as z } from "../stores/dynamic-content.js";
|
|
10
|
+
import { useEditorStore as q } from "../stores/editor.js";
|
|
11
|
+
import { useUnsubscribeStore as M } from "../stores/unsubscribe.js";
|
|
12
|
+
import { isPlainObject as O } from "./genericUtil.js";
|
|
13
|
+
import { planDocumentTrackingIds as T, renderTrackingIdPlan as B } from "./linkTrackingIds.js";
|
|
14
|
+
function _(c) {
|
|
15
|
+
const i = new DOMParser().parseFromString(c, "text/html").querySelectorAll(`[${b.PAGE_LIST}]`), e = [];
|
|
16
|
+
return i.forEach((s) => {
|
|
17
|
+
const o = s.getAttribute(b.PAGE_LIST);
|
|
18
|
+
o && e.push(...v(o));
|
|
19
19
|
}), [...new Set(e)];
|
|
20
20
|
}
|
|
21
|
-
async function
|
|
22
|
-
const
|
|
23
|
-
if (
|
|
21
|
+
async function w(c) {
|
|
22
|
+
const a = new DOMParser().parseFromString(c, "text/html").querySelectorAll(".recommendation-block-v2");
|
|
23
|
+
if (a.length === 0)
|
|
24
24
|
return;
|
|
25
|
-
const
|
|
26
|
-
|
|
27
|
-
const s = e.getAttribute("recommendation-id"),
|
|
28
|
-
if (!Number.isFinite(
|
|
25
|
+
const i = k();
|
|
26
|
+
a.forEach((e) => {
|
|
27
|
+
const s = e.getAttribute("recommendation-id"), o = s ? Number(s) : NaN;
|
|
28
|
+
if (!Number.isFinite(o))
|
|
29
29
|
return;
|
|
30
30
|
const l = e.getAttribute("esd-ext-config");
|
|
31
31
|
if (!l)
|
|
@@ -36,10 +36,10 @@ async function h(c) {
|
|
|
36
36
|
} catch {
|
|
37
37
|
return;
|
|
38
38
|
}
|
|
39
|
-
|
|
39
|
+
O(m) && i.seedBlockUrlConfig(o, L(m));
|
|
40
40
|
});
|
|
41
41
|
try {
|
|
42
|
-
await
|
|
42
|
+
await i.fetchRecommendationCreateData();
|
|
43
43
|
} catch (e) {
|
|
44
44
|
console.warn(
|
|
45
45
|
"Recommendation reference data pre-load failed; validator will skip the availability check.",
|
|
@@ -47,54 +47,63 @@ async function h(c) {
|
|
|
47
47
|
);
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
|
-
const
|
|
51
|
-
const c =
|
|
50
|
+
const oe = () => {
|
|
51
|
+
const c = z(), n = q(), a = M(), { getCompiledEmail: i, getTemplateData: e, updateHtmlAndCss: s } = E(), { compileHtml: o, compileAmpHtml: l } = U(), { isFeatureEnabled: m } = R();
|
|
52
52
|
return {
|
|
53
|
-
prepareTemplateDetails: async (
|
|
54
|
-
let { html:
|
|
53
|
+
prepareTemplateDetails: async (y) => {
|
|
54
|
+
let { html: r, css: u, syncModulesIds: g = [] } = y ?? await e();
|
|
55
55
|
if (m("linkTrackingIds"))
|
|
56
56
|
try {
|
|
57
|
-
let
|
|
58
|
-
n.trackIdSessionFloor =
|
|
59
|
-
|
|
60
|
-
|
|
57
|
+
let t = T(r, n.trackIdSessionFloor);
|
|
58
|
+
n.trackIdSessionFloor = t.plan.nextSeq;
|
|
59
|
+
let p = t.plan.changed;
|
|
60
|
+
if (p && N(t)) {
|
|
61
|
+
const h = await e().catch((x) => (console.warn(
|
|
62
|
+
"Tracking-id re-read failed, saving the planned ids without a replacement:",
|
|
63
|
+
x
|
|
64
|
+
), null));
|
|
65
|
+
h ? ({ html: r, css: u, syncModulesIds: g = [] } = h, t = T(r, n.trackIdSessionFloor), n.trackIdSessionFloor = t.plan.nextSeq, p = t.plan.changed) : p = !1;
|
|
66
|
+
}
|
|
67
|
+
t.plan.changed && (r = B(r, t)), p && await s(r, u);
|
|
68
|
+
} catch (t) {
|
|
69
|
+
console.error("Tracking-id step failed, saving anyway:", t);
|
|
61
70
|
}
|
|
62
|
-
const { html:
|
|
71
|
+
const { html: A, ampHtml: f = "", ampErrors: P = [] } = await i({
|
|
63
72
|
minimize: !0,
|
|
64
73
|
resetDataSavedFlag: !1
|
|
65
74
|
});
|
|
66
|
-
|
|
67
|
-
const { compiledHtml:
|
|
75
|
+
a.selectedUnsubscribePages.length && await a.fetchTemplates(), await w(r);
|
|
76
|
+
const { compiledHtml: C, stats: d, appliedRules: I } = o(A), H = f && l(f).compiledHtml, D = c.getSelectedDynamicContentList, F = k(), S = _(r);
|
|
68
77
|
return console.debug("HTML Compilation Stats:", {
|
|
69
78
|
originalSize: d.originalSize,
|
|
70
79
|
compiledSize: d.compiledSize,
|
|
71
80
|
reduction: `${d.reductionPercentage.toFixed(2)}%`,
|
|
72
|
-
appliedRules:
|
|
81
|
+
appliedRules: I,
|
|
73
82
|
executionTime: `${d.executionTime.toFixed(2)}ms`
|
|
74
83
|
}), {
|
|
75
|
-
dynamicContentList:
|
|
76
|
-
compiledHtml:
|
|
77
|
-
rawHtml:
|
|
78
|
-
css:
|
|
79
|
-
ampHtml:
|
|
80
|
-
ampErrors:
|
|
81
|
-
modules:
|
|
84
|
+
dynamicContentList: D,
|
|
85
|
+
compiledHtml: C,
|
|
86
|
+
rawHtml: r,
|
|
87
|
+
css: u,
|
|
88
|
+
ampHtml: H,
|
|
89
|
+
ampErrors: P,
|
|
90
|
+
modules: g.map(Number),
|
|
82
91
|
recommendation: {
|
|
83
|
-
campaignUrls:
|
|
92
|
+
campaignUrls: F.recommendationCampaignUrls,
|
|
84
93
|
configs: {}
|
|
85
94
|
},
|
|
86
95
|
unsubscribe: {
|
|
87
|
-
status:
|
|
88
|
-
config:
|
|
96
|
+
status: S.length > 0,
|
|
97
|
+
config: S
|
|
89
98
|
}
|
|
90
99
|
};
|
|
91
100
|
},
|
|
92
101
|
// Exposed so the back/test validate-only path can seed the reco store the
|
|
93
102
|
// same way a full save does (required-field findings depend on it).
|
|
94
|
-
hydrateRecommendationStore:
|
|
103
|
+
hydrateRecommendationStore: w
|
|
95
104
|
};
|
|
96
105
|
};
|
|
97
106
|
export {
|
|
98
|
-
|
|
99
|
-
|
|
107
|
+
_ as getHtmlReferencedUnsubscribePages,
|
|
108
|
+
oe as useTemplatePreparation
|
|
100
109
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@useinsider/guido",
|
|
3
|
-
"version": "3.23.0-beta.
|
|
3
|
+
"version": "3.23.0-beta.57760f0",
|
|
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",
|