@useinsider/guido 3.23.0-beta.668404b → 3.23.0-beta.95af882

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.
Files changed (72) hide show
  1. package/README.md +1 -0
  2. package/dist/@types/config/schemas.js +41 -39
  3. package/dist/@types/display-condition.js +25 -0
  4. package/dist/components/Guido.vue.js +6 -6
  5. package/dist/components/Guido.vue2.js +89 -83
  6. package/dist/components/organisms/display-conditions/CodeEditorField.vue.js +20 -0
  7. package/dist/components/organisms/display-conditions/CodeEditorField.vue2.js +30 -0
  8. package/dist/components/organisms/display-conditions/DisplayConditionCreateDrawer.vue.js +30 -0
  9. package/dist/components/organisms/display-conditions/DisplayConditionCreateDrawer.vue2.js +75 -0
  10. package/dist/components/organisms/display-conditions/DisplayConditionSelectDrawer.vue.js +34 -0
  11. package/dist/components/organisms/display-conditions/DisplayConditionSelectDrawer.vue2.js +54 -0
  12. package/dist/components/organisms/display-conditions/DisplayConditionsHost.vue.js +17 -0
  13. package/dist/components/organisms/display-conditions/DisplayConditionsHost.vue2.js +22 -0
  14. package/dist/composables/useBlocksConfig.js +31 -20
  15. package/dist/composables/useDisplayConditions.js +116 -0
  16. package/dist/composables/useHtmlCompiler.js +0 -2
  17. package/dist/config/compiler/htmlCompilerRules.js +6 -14
  18. package/dist/config/compiler/utils/itemsCompilerUtils.js +43 -42
  19. package/dist/config/compiler/utils/recommendationCompilerUtils.js +67 -64
  20. package/dist/enums/academy.js +1 -0
  21. package/dist/enums/display-condition.js +12 -0
  22. package/dist/extensions/DisplayConditions/bridge.js +23 -0
  23. package/dist/extensions/DisplayConditions/constants.js +17 -0
  24. package/dist/extensions/DisplayConditions/control.js +189 -0
  25. package/dist/extensions/DisplayConditions/display-conditions.css.js +201 -0
  26. package/dist/extensions/DisplayConditions/extension.js +28 -0
  27. package/dist/extensions/DisplayConditions/iconsRegistry.js +20 -0
  28. package/dist/extensions/DisplayConditions/library.js +28 -0
  29. package/dist/extensions/DisplayConditions/settingsPanel.js +17 -0
  30. package/dist/extensions/LinkTracking/extension.js +17 -0
  31. package/dist/extensions/LinkTracking/writer.js +35 -0
  32. package/dist/guido.css +1 -1
  33. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js +93 -92
  34. package/dist/node_modules/valibot/dist/index.js +297 -261
  35. package/dist/package.json.js +1 -1
  36. package/dist/services/displayConditionApi.js +39 -0
  37. package/dist/src/@types/config/schemas.d.ts +4 -0
  38. package/dist/src/@types/display-condition.d.ts +59 -0
  39. package/dist/src/components/organisms/display-conditions/CodeEditorField.vue.d.ts +43 -0
  40. package/dist/src/components/organisms/display-conditions/DisplayConditionCreateDrawer.vue.d.ts +2 -0
  41. package/dist/src/components/organisms/display-conditions/DisplayConditionSelectDrawer.vue.d.ts +2 -0
  42. package/dist/src/components/organisms/display-conditions/DisplayConditionsHost.vue.d.ts +2 -0
  43. package/dist/src/composables/useConfig.d.ts +2 -0
  44. package/dist/src/composables/useDisplayConditions.d.ts +17 -0
  45. package/dist/src/enums/academy.d.ts +1 -0
  46. package/dist/src/enums/display-condition.d.ts +15 -0
  47. package/dist/src/extensions/DisplayConditions/bridge.d.ts +7 -0
  48. package/dist/src/extensions/DisplayConditions/constants.d.ts +14 -0
  49. package/dist/src/extensions/DisplayConditions/control.d.ts +24 -0
  50. package/dist/src/extensions/DisplayConditions/extension.d.ts +2 -0
  51. package/dist/src/extensions/DisplayConditions/iconsRegistry.d.ts +4 -0
  52. package/dist/src/extensions/DisplayConditions/library.d.ts +8 -0
  53. package/dist/src/extensions/DisplayConditions/settingsPanel.d.ts +5 -0
  54. package/dist/src/extensions/LinkTracking/extension.d.ts +2 -0
  55. package/dist/src/extensions/LinkTracking/writer.d.ts +13 -0
  56. package/dist/src/mock/api/display-conditions.d.ts +2 -0
  57. package/dist/src/services/displayConditionApi.d.ts +8 -0
  58. package/dist/src/stores/config.d.ts +166 -0
  59. package/dist/src/stores/display-condition.d.ts +84 -0
  60. package/dist/src/utils/displayCondition.d.ts +11 -0
  61. package/dist/src/utils/linkTrackingIds.d.ts +20 -5
  62. package/dist/src/utils/protectTableText.d.ts +2 -0
  63. package/dist/stores/config.js +13 -6
  64. package/dist/stores/display-condition.js +29 -0
  65. package/dist/utils/displayCondition.js +26 -0
  66. package/dist/utils/linkTrackingIds.js +80 -47
  67. package/dist/utils/pairProductVariables.js +30 -29
  68. package/dist/utils/protectTableText.js +22 -0
  69. package/dist/utils/templatePreparation.js +55 -51
  70. package/package.json +1 -1
  71. package/dist/src/utils/trimHrefWhitespace.d.ts +0 -5
  72. package/dist/utils/trimHrefWhitespace.js +0 -10
@@ -0,0 +1,30 @@
1
+ import a from "./DisplayConditionCreateDrawer.vue2.js";
2
+ /* empty css */
3
+ import r from "../../../_virtual/_plugin-vue2_normalizer.js";
4
+ var n = function() {
5
+ var i = this, t = i._self._c, e = i._self._setupProxy;
6
+ return t(e.WpDrawer, { attrs: { id: "guido__display-condition-create-drawer", "description-status": "", "class-name": "guido-display-condition-create-drawer", size: "large", "close-on-outside-click": !1, "description-text": e.descriptionText, "footer-button-group-options": e.footerButtonGroupOptions, status: e.store.isCreateOpen, "title-text": e.trans(`${e.KEY}.create-title`) }, on: { cancelOrBackButtonEvent: e.close, onCloseEvent: e.close, primaryButtonEvent: function(o) {
7
+ return e.submit("inline");
8
+ }, secondaryButtonEvent: function(o) {
9
+ return e.submit("save");
10
+ } } }, [t("div", { staticClass: "guido-display-condition-create" }, [t(e.InBasicTextInput, { staticClass: "mb-4 w-1", attrs: { id: "guido__display-condition-name-input", name: "displayConditionName", "character-counter-status": !1, "disabled-status": e.isSaving, "label-text": e.trans(`${e.KEY}.condition-name`), "max-character-length": e.DISPLAY_CONDITION_LIMITS.NAME_MAX, "placeholder-text": e.trans(`${e.KEY}.condition-name-placeholder`), "state-message": e.errors.name || "", states: e.errors.name ? "error" : "default", "tooltip-status": !1, value: e.draft.name }, on: { input: function(o) {
11
+ return e.updateField("name", o);
12
+ } } }), t(e.InBasicTextInput, { staticClass: "mb-4 w-1", attrs: { id: "guido__display-condition-description-input", name: "displayConditionDescription", "character-counter-status": !1, "disabled-status": e.isSaving, "label-text": e.descriptionLabel, "max-character-length": e.DISPLAY_CONDITION_LIMITS.DESCRIPTION_MAX, "placeholder-text": e.trans(`${e.KEY}.condition-description-placeholder`), "state-message": e.errors.description || "", states: e.errors.description ? "error" : "default", "tooltip-status": !1, value: e.draft.description }, on: { input: function(o) {
13
+ return e.updateField("description", o);
14
+ } } }), t("div", { staticClass: "guido-display-condition-create__separator" }), t("p", { staticClass: "guido-display-condition-create__method-title" }, [i._v(" " + i._s(e.trans(`${e.KEY}.select-method`)) + " ")]), t("div", { staticClass: "guido-display-condition-create__methods" }, [t(e.InRadioButton, { attrs: { id: "guido__display-condition-method-logic-builder", disable: "", disabled: "", name: "displayConditionMethod", selected: "codeOnly", value: "logicBuilder", label: e.trans(`${e.KEY}.logic-builder`) } }), t(e.InRadioButton, { attrs: { id: "guido__display-condition-method-code-only", name: "displayConditionMethod", selected: "codeOnly", value: "codeOnly", label: e.trans(`${e.KEY}.code-only`) } })], 1), t(e.CodeEditorField, { ref: "codeBeforeRef", staticClass: "mb-3", attrs: { id: "guido__display-condition-code-before", disabled: e.isSaving, error: e.errors.codeBefore, label: e.trans(`${e.KEY}.code-before`), placeholder: e.trans(`${e.KEY}.code-placeholder`), value: e.draft.codeBefore }, on: { input: function(o) {
15
+ return e.updateField("codeBefore", o);
16
+ } } }), t(e.CodeEditorField, { ref: "codeAfterRef", attrs: { id: "guido__display-condition-code-after", disabled: e.isSaving, error: e.errors.codeAfter, label: e.trans(`${e.KEY}.code-after`), placeholder: e.trans(`${e.KEY}.code-placeholder`), value: e.draft.codeAfter }, on: { input: function(o) {
17
+ return e.updateField("codeAfter", o);
18
+ } } })], 1)]);
19
+ }, s = [], d = /* @__PURE__ */ r(
20
+ a,
21
+ n,
22
+ s,
23
+ !1,
24
+ null,
25
+ "9f69e08d"
26
+ );
27
+ const f = d.exports;
28
+ export {
29
+ f as default
30
+ };
@@ -0,0 +1,75 @@
1
+ import { defineComponent as D, reactive as O, ref as s, watch as T, computed as u } from "vue";
2
+ import $ from "../../wrappers/WpDrawer.vue.js";
3
+ import { useDisplayConditions as x } from "../../../composables/useDisplayConditions.js";
4
+ import { useTranslations as h } from "../../../composables/useTranslations.js";
5
+ import { DISPLAY_CONDITION_LIMITS as k } from "../../../enums/display-condition.js";
6
+ import { useDisplayConditionStore as w } from "../../../stores/display-condition.js";
7
+ import { InRadioButton as L, InBasicTextInput as j } from "@useinsider/design-system-vue";
8
+ import R from "./CodeEditorField.vue.js";
9
+ const H = /* @__PURE__ */ D({
10
+ __name: "DisplayConditionCreateDrawer",
11
+ setup(E) {
12
+ const i = "email-editor.display-conditions", n = h(), c = w(), {
13
+ validate: p,
14
+ notifyInvalid: l,
15
+ createInline: f,
16
+ createAndSave: m,
17
+ cancel: v,
18
+ describeWithAcademyLink: y
19
+ } = x(), d = () => ({ name: "", description: "", codeBefore: "", codeAfter: "" }), e = O(d()), o = s({}), r = s(!1), b = s(), B = s();
20
+ T(() => c.isCreateOpen, (a) => {
21
+ if (!a)
22
+ return;
23
+ const { editing: t } = c;
24
+ Object.assign(e, t ? {
25
+ name: t.name,
26
+ description: t.description,
27
+ codeBefore: t.beforeScript,
28
+ codeAfter: t.afterScript
29
+ } : d()), o.value = {}, r.value = !1;
30
+ }, { immediate: !0 });
31
+ const I = u(() => y("create-description")), S = u(() => ({
32
+ cancelOrBackButton: {
33
+ styling: "ghost",
34
+ type: "secondary",
35
+ labelText: n(`${i}.cancel`),
36
+ disabledStatus: r.value
37
+ },
38
+ secondaryButton: {
39
+ styling: "solid",
40
+ type: "subtle-primary",
41
+ labelText: n(`${i}.create-and-save`),
42
+ loadingStatus: r.value
43
+ },
44
+ primaryButton: {
45
+ styling: "solid",
46
+ type: "primary",
47
+ labelText: n(`${i}.create`),
48
+ disabledStatus: r.value
49
+ }
50
+ })), A = (a, t) => {
51
+ t !== e[a] && (e[a] = t, o.value[a] && (o.value = { ...o.value, [a]: void 0 }));
52
+ }, C = u(() => `${n(`${i}.condition-description`)} <span class="guido-display-condition-create__optional">(${n(`${i}.optional`)})</span>`);
53
+ return { __sfc: !0, KEY: i, trans: n, store: c, validate: p, notifyInvalid: l, createInline: f, createAndSave: m, cancel: v, describeWithAcademyLink: y, emptyDraft: d, draft: e, errors: o, isSaving: r, codeBeforeRef: b, codeAfterRef: B, descriptionText: I, footerButtonGroupOptions: S, updateField: A, descriptionLabel: C, submit: async (a) => {
54
+ var _, g;
55
+ if (r.value)
56
+ return;
57
+ if (e.codeBefore = ((_ = b.value) == null ? void 0 : _.read()) ?? e.codeBefore, e.codeAfter = ((g = B.value) == null ? void 0 : g.read()) ?? e.codeAfter, o.value = p(e), Object.keys(o.value).length) {
58
+ l();
59
+ return;
60
+ }
61
+ if (a === "inline") {
62
+ f({ ...e });
63
+ return;
64
+ }
65
+ r.value = !0;
66
+ const t = await m({ ...e });
67
+ r.value = !1, o.value = t ?? {}, Object.keys(o.value).length && l();
68
+ }, close: () => {
69
+ r.value || v();
70
+ }, WpDrawer: $, DISPLAY_CONDITION_LIMITS: k, InBasicTextInput: j, InRadioButton: L, CodeEditorField: R };
71
+ }
72
+ });
73
+ export {
74
+ H as default
75
+ };
@@ -0,0 +1,34 @@
1
+ import a from "./DisplayConditionSelectDrawer.vue2.js";
2
+ /* empty css */
3
+ import d from "../../../_virtual/_plugin-vue2_normalizer.js";
4
+ var o = function() {
5
+ var s = this, i = s._self._c, t = s._self._setupProxy;
6
+ return i("div", { staticClass: "guido-display-condition-select-root" }, [i(t.WpDrawer, { attrs: { id: "guido__display-condition-select-drawer", "description-status": "", "class-name": "guido-display-condition-select-drawer", size: "large", "description-text": t.descriptionText, "footer-button-group-options": t.footerButtonGroupOptions, status: t.store.isSelectOpen, "title-text": t.trans(`${t.KEY}.select-title`) }, on: { cancelOrBackButtonEvent: t.cancel, onCloseEvent: t.cancel } }, [i("div", { staticClass: "guido-display-condition-select d-f f-d-c f-g-1" }, [t.store.listStatus === "loaded" && t.store.list.length ? i(t.InBasicTextInput, { staticClass: "mb-4 w-1", attrs: { id: "guido__display-condition-search-input", name: "displayConditionSearch", "character-counter-status": !1, "label-status": !1, "placeholder-text": t.trans(`${t.KEY}.search`), "tooltip-status": !1, value: t.search }, on: { input: function(e) {
7
+ t.search = e;
8
+ } } }) : s._e(), t.store.listStatus === "loading" || t.store.listStatus === "idle" ? i("div", { staticClass: "guido-display-condition-select__list", attrs: { "data-testid": "display-condition-loading" } }, s._l(t.SKELETON_HEIGHTS, function(e, n) {
9
+ return i(t.InSkeleton, { key: n, attrs: { sizing: { width: 856, height: e } } });
10
+ }), 1) : t.store.listStatus === "error" ? i(t.InNoData, { staticClass: "d-f f-d-c j-c-c f-g-1", attrs: { id: "guido__display-condition-error", "button-status": "", icon: "no-data", "button-text": t.trans(`${t.KEY}.retry`), description: t.trans(`${t.KEY}.error-load`), title: t.trans(`${t.KEY}.error-load-title`) }, on: { click: t.loadList } }) : t.store.list.length ? t.filteredList.length ? i("ul", { staticClass: "guido-display-condition-select__list" }, s._l(t.filteredList, function(e) {
11
+ return i("li", { key: e.id, staticClass: "guido-display-condition-card", attrs: { "data-condition-id": e.id } }, [i("div", { staticClass: "guido-display-condition-card__header" }, [i("div", { staticClass: "guido-display-condition-card__text" }, [i("p", { staticClass: "guido-display-condition-card__name" }, [s._v(" " + s._s(e.name) + " ")]), e.description ? i("p", { staticClass: "guido-display-condition-card__description" }, [s._v(" " + s._s(e.description) + " ")]) : s._e()]), i("div", { staticClass: "guido-display-condition-card__actions" }, [i("div", { staticClass: "guido-display-condition-card__split" }, [i(t.InButtonV2, { attrs: { id: `guido__display-condition-select-${e.id}`, type: "subtle-primary", "label-text": t.trans(`${t.KEY}.select`) }, on: { click: function(n) {
12
+ return t.select(e);
13
+ } } }), i(t.InButtonV2, { attrs: { id: `guido__display-condition-menu-${e.id}`, "left-icon": "filled-dropdown-down", type: "subtle-primary", "label-text-status": !1 }, on: { click: function(n) {
14
+ return t.toggleMenu(e);
15
+ } } }), t.menuId === e.id ? i("div", { staticClass: "guido-display-condition-card__menu" }, [i("button", { staticClass: "guido-display-condition-card__menu-item", attrs: { id: `guido__display-condition-delete-${e.id}`, type: "button" }, on: { click: function(n) {
16
+ return t.requestDelete(e);
17
+ } } }, [s._v(" " + s._s(t.trans(`${t.KEY}.delete`)) + " ")])]) : s._e()], 1), i("span", { staticClass: "guido-display-condition-card__divider" }), i("button", { staticClass: "guido-display-condition-card__expand", attrs: { id: `guido__display-condition-expand-${e.id}`, type: "button", "aria-expanded": t.expandedId === e.id ? "true" : "false", "aria-label": t.trans(`${t.KEY}.preview`) }, on: { click: function(n) {
18
+ return t.toggleExpanded(e);
19
+ } } }, [i(t.InIcons, { attrs: { name: t.expandedId === e.id ? "filled-dropdown-up" : "filled-dropdown-down" } })], 1)])]), t.expandedId === e.id ? i("pre", { staticClass: "guido-display-condition-card__code" }, [s._v(s._s(t.codeOf(e)))]) : s._e()]);
20
+ }), 0) : i(t.InNoData, { staticClass: "d-f f-d-c j-c-c f-g-1", attrs: { id: "guido__display-condition-no-result", icon: "no-data", title: t.trans(`${t.KEY}.no-result`) } }) : i(t.InNoData, { staticClass: "d-f f-d-c j-c-c f-g-1", attrs: { id: "guido__display-condition-empty", "button-status": "", icon: "no-personalization", "button-text": t.trans(`${t.KEY}.create-new`), description: t.trans(`${t.KEY}.empty-description`), title: t.trans(`${t.KEY}.empty-title`) }, on: { click: function(e) {
21
+ return t.store.openCreate();
22
+ } } })], 1)]), t.store.pendingDelete ? i("div", { staticClass: "guido-display-condition-select__delete-modal" }, [i(t.WpModal, { attrs: { id: "guido__display-condition-delete-modal", size: "X-small", state: "danger", "close-on-outside-click": !1, "footer-button-options": t.deleteModalButtons, title: t.trans(`${t.KEY}.delete-confirm-title`) }, on: { close: t.closeDeleteModal, "primary-action": t.confirmDelete } }, [i("p", { staticClass: "guido-display-condition-select__delete-text" }, [s._v(" " + s._s(t.trans(`${t.KEY}.delete-confirm-description`, { name: t.store.pendingDelete.name })) + " ")])])], 1) : s._e()], 1);
23
+ }, l = [], c = /* @__PURE__ */ d(
24
+ a,
25
+ o,
26
+ l,
27
+ !1,
28
+ null,
29
+ "1fa46355"
30
+ );
31
+ const f = c.exports;
32
+ export {
33
+ f as default
34
+ };
@@ -0,0 +1,54 @@
1
+ import { defineComponent as x, ref as i, watch as S, computed as c } from "vue";
2
+ import _ from "../../wrappers/WpDrawer.vue.js";
3
+ import L from "../../wrappers/WpModal.vue.js";
4
+ import { useDisplayConditions as T } from "../../../composables/useDisplayConditions.js";
5
+ import { useTranslations as O } from "../../../composables/useTranslations.js";
6
+ import { useDisplayConditionStore as b } from "../../../stores/display-condition.js";
7
+ import { InSkeleton as C, InNoData as E, InIcons as M, InButtonV2 as h, InBasicTextInput as k } from "@useinsider/design-system-vue";
8
+ const J = /* @__PURE__ */ x({
9
+ __name: "DisplayConditionSelectDrawer",
10
+ setup($) {
11
+ const l = "email-editor.display-conditions", m = [40, 76, 76, 76], a = O(), t = b(), { loadList: d, select: g, deleteSaved: u, cancel: v, describeWithAcademyLink: p } = T(), r = i(""), s = i(null), o = i(null), n = i(!1);
12
+ S(() => t.isSelectOpen, (e) => {
13
+ e && (r.value = "", s.value = null, o.value = null, d());
14
+ }, { immediate: !0 });
15
+ const D = c(() => {
16
+ const e = r.value.trim().toLocaleLowerCase();
17
+ return e ? t.list.filter((f) => `${f.name} ${f.description}`.toLocaleLowerCase().includes(e)) : t.list;
18
+ }), y = c(() => p("select-description")), B = c(() => ({
19
+ cancelOrBackButton: {
20
+ styling: "ghost",
21
+ type: "secondary",
22
+ labelText: a(`${l}.back`),
23
+ leftIcon: "line-arrow-left"
24
+ }
25
+ })), I = c(() => ({
26
+ cancelOrBackButton: {
27
+ type: "secondary",
28
+ styling: "ghost",
29
+ labelText: a(`${l}.cancel`),
30
+ disabledStatus: n.value
31
+ },
32
+ primaryButton: {
33
+ type: "danger",
34
+ labelText: a(`${l}.delete`),
35
+ loadingStatus: n.value
36
+ }
37
+ }));
38
+ return { __sfc: !0, KEY: l, SKELETON_HEIGHTS: m, trans: a, store: t, loadList: d, select: g, deleteSaved: u, cancel: v, describeWithAcademyLink: p, search: r, expandedId: s, menuId: o, isDeleting: n, filteredList: D, descriptionText: y, footerButtonGroupOptions: B, deleteModalButtons: I, toggleExpanded: (e) => {
39
+ s.value = s.value === e.id ? null : e.id;
40
+ }, toggleMenu: (e) => {
41
+ o.value = o.value === e.id ? null : e.id;
42
+ }, requestDelete: (e) => {
43
+ o.value = null, t.pendingDelete = e;
44
+ }, confirmDelete: async () => {
45
+ !t.pendingDelete || n.value || (n.value = !0, await u(t.pendingDelete), n.value = !1);
46
+ }, closeDeleteModal: () => {
47
+ n.value || (t.pendingDelete = null);
48
+ }, codeOf: (e) => [e.codeBefore, e.codeAfter].filter(Boolean).join(`
49
+ `), WpDrawer: _, WpModal: L, InBasicTextInput: k, InButtonV2: h, InIcons: M, InNoData: E, InSkeleton: C };
50
+ }
51
+ });
52
+ export {
53
+ J as default
54
+ };
@@ -0,0 +1,17 @@
1
+ import e from "./DisplayConditionsHost.vue2.js";
2
+ import n from "../../../_virtual/_plugin-vue2_normalizer.js";
3
+ var r = function() {
4
+ var s = this, o = s._self._c, t = s._self._setupProxy;
5
+ return o("div", { staticClass: "guido-display-conditions-host" }, [o(t.DisplayConditionCreateDrawer), o(t.DisplayConditionSelectDrawer)], 1);
6
+ }, i = [], a = /* @__PURE__ */ n(
7
+ e,
8
+ r,
9
+ i,
10
+ !1,
11
+ null,
12
+ null
13
+ );
14
+ const p = a.exports;
15
+ export {
16
+ p as default
17
+ };
@@ -0,0 +1,22 @@
1
+ import { defineComponent as i, onMounted as s, onBeforeUnmount as m } from "vue";
2
+ import { useDisplayConditions as p } from "../../../composables/useDisplayConditions.js";
3
+ import { DisplayConditionEvent as n } from "../../../enums/display-condition.js";
4
+ import { useDisplayConditionStore as a } from "../../../stores/display-condition.js";
5
+ import d from "./DisplayConditionCreateDrawer.vue.js";
6
+ import f from "./DisplayConditionSelectDrawer.vue.js";
7
+ const E = /* @__PURE__ */ i({
8
+ __name: "DisplayConditionsHost",
9
+ setup(l) {
10
+ const o = a(), { handleOpen: t } = p(), e = (r) => {
11
+ t(r.detail);
12
+ };
13
+ return s(() => {
14
+ o.$reset(), document.addEventListener(n.OPEN, e);
15
+ }), m(() => {
16
+ document.removeEventListener(n.OPEN, e), o.$reset();
17
+ }), { __sfc: !0, store: o, handleOpen: t, onOpen: e, DisplayConditionCreateDrawer: d, DisplayConditionSelectDrawer: f };
18
+ }
19
+ });
20
+ export {
21
+ E as default
22
+ };
@@ -1,6 +1,7 @@
1
- import r from "../extensions/ModulesTabIcons/extension.js";
2
- import { useConfigStore as l } from "../stores/config.js";
3
- const a = {
1
+ import s from "../extensions/LinkTracking/extension.js";
2
+ import l from "../extensions/ModulesTabIcons/extension.js";
3
+ import { useConfigStore as r } from "../stores/config.js";
4
+ const c = {
4
5
  "amp-accordion": "ampAccordionEnabled",
5
6
  "amp-carousel": "ampCarouselEnabled",
6
7
  "amp-form-controls": "ampFormControlsEnabled",
@@ -14,7 +15,7 @@ const a = {
14
15
  "text-block": "textEnabled",
15
16
  "timer-block": "timerEnabled",
16
17
  "video-block": "videoEnabled"
17
- }, s = {
18
+ }, b = {
18
19
  "dynamic-content": () => import("../extensions/DynamicContent/extension.js"),
19
20
  "checkbox-block": () => import("../extensions/Blocks/Checkbox/extension.js"),
20
21
  "radio-button-block": () => import("../extensions/Blocks/RadioButton/extension.js"),
@@ -22,40 +23,50 @@ const a = {
22
23
  "unsubscribe-block": () => import("../extensions/Blocks/Unsubscribe/extension.js"),
23
24
  "coupon-block": () => import("../extensions/Blocks/CouponBlock/extension.js"),
24
25
  "items-block": () => import("../extensions/Blocks/Items/extension.js")
25
- }, i = (n) => {
26
+ }, m = (n) => {
26
27
  if (!n || !n.length)
27
28
  return {};
28
29
  const t = {};
29
30
  return n.forEach((o) => {
30
- const e = a[o];
31
+ const e = c[o];
31
32
  e && (t[e] = !1);
32
33
  }), t;
33
- }, b = () => [r], m = async (n) => {
34
- const t = b();
34
+ }, d = async ({ externalDisplayConditions: n, linkTrackingIds: t }) => {
35
+ const o = [l];
36
+ if (n) {
37
+ const e = await import("../extensions/DisplayConditions/extension.js");
38
+ o.push(e.default);
39
+ }
40
+ return t && o.push(s), o;
41
+ }, p = async (n, t = { externalDisplayConditions: !1, linkTrackingIds: !1 }) => {
42
+ const o = await d(t);
35
43
  if (!n || !n.length)
36
- return t;
37
- const o = await Promise.all(
38
- n.map(async (e) => {
39
- const c = s[e];
40
- return c ? (await c()).default : null;
44
+ return o;
45
+ const e = await Promise.all(
46
+ n.map(async (i) => {
47
+ const a = b[i];
48
+ return a ? (await a()).default : null;
41
49
  })
42
50
  );
43
51
  return [
44
- ...t,
45
- ...o.filter((e) => e !== null)
52
+ ...o,
53
+ ...e.filter((i) => i !== null)
46
54
  ];
47
- }, E = () => {
48
- const n = l();
55
+ }, g = () => {
56
+ const n = r();
49
57
  return {
50
58
  getStripoBlocksConfig: async () => {
51
59
  const o = n.blocks;
52
60
  return {
53
- baseBlocks: i(o == null ? void 0 : o.excludeDefaults),
54
- extensions: await m(o == null ? void 0 : o.includeCustoms)
61
+ baseBlocks: m(o == null ? void 0 : o.excludeDefaults),
62
+ extensions: await p(o == null ? void 0 : o.includeCustoms, {
63
+ externalDisplayConditions: n.externalDisplayConditions,
64
+ linkTrackingIds: n.isFeatureEnabled("linkTrackingIds")
65
+ })
55
66
  };
56
67
  }
57
68
  };
58
69
  };
59
70
  export {
60
- E as useBlocksConfig
71
+ g as useBlocksConfig
61
72
  };
@@ -0,0 +1,116 @@
1
+ import { useToaster as _ } from "./useToaster.js";
2
+ import { useTranslations as x } from "./useTranslations.js";
3
+ import { ACADEMY_LINKS as L } from "../enums/academy.js";
4
+ import { DisplayConditionSourceType as A, DISPLAY_CONDITION_LIMITS as r, DisplayConditionEvent as v } from "../enums/display-condition.js";
5
+ import { ToasterTypeOptions as l } from "../enums/toaster.js";
6
+ import { useDisplayConditionApi as O } from "../services/displayConditionApi.js";
7
+ import { useConfigStore as q } from "../stores/config.js";
8
+ import { useDisplayConditionStore as w } from "../stores/display-condition.js";
9
+ import { findInvalidCodeFields as P, nextConditionId as B } from "../utils/displayCondition.js";
10
+ import { escapeHtml as R } from "../utils/htmlEscape.js";
11
+ import { computed as X } from "vue";
12
+ const i = "email-editor.display-conditions", Y = 409, S = (n, m, s) => ({
13
+ id: B(),
14
+ name: n.name.trim(),
15
+ description: n.description.trim(),
16
+ beforeScript: n.codeBefore,
17
+ afterScript: n.codeAfter,
18
+ extraData: JSON.stringify(s === void 0 ? { source: m } : { source: m, savedId: s })
19
+ }), I = (n) => ({
20
+ name: n.name,
21
+ description: n.description,
22
+ codeBefore: n.codeBefore,
23
+ codeAfter: n.codeAfter
24
+ }), te = () => {
25
+ const n = w(), m = q(), s = O(), o = x(), { showToaster: p } = _(), u = X(() => {
26
+ var e;
27
+ return (e = m.features) != null && e.liquidSyntax ? "liquid" : "pongo";
28
+ }), f = (e) => {
29
+ const t = { condition: e };
30
+ return document.dispatchEvent(new CustomEvent(v.APPLY, { detail: t })), n.close(), t.applied === !0;
31
+ }, $ = () => {
32
+ n.view !== "none" && (document.dispatchEvent(new CustomEvent(v.CANCEL)), n.close());
33
+ }, D = (e) => {
34
+ if (e.mode === "select") {
35
+ n.openSelect();
36
+ return;
37
+ }
38
+ n.openCreate(e.mode === "edit" ? e.current : null);
39
+ }, h = async () => {
40
+ const e = ++n.listRequest;
41
+ n.listStatus = "loading";
42
+ try {
43
+ const t = await s.list(u.value);
44
+ e === n.listRequest && (n.list = t, n.listStatus = "loaded");
45
+ } catch (t) {
46
+ console.warn("Display conditions could not be loaded.", t), e === n.listRequest && (n.listStatus = "error");
47
+ }
48
+ }, N = (e) => {
49
+ const t = {}, d = e.name.trim();
50
+ d ? d.length < r.NAME_MIN ? t.name = o(`${i}.error-name-min`, { min: r.NAME_MIN }) : d.length > r.NAME_MAX && (t.name = o(`${i}.error-name-max`, { max: r.NAME_MAX })) : t.name = o(`${i}.error-name-required`);
51
+ const { DESCRIPTION_MAX: C } = r;
52
+ e.description.trim().length > C && (t.description = o(`${i}.error-description-max`, { max: C }));
53
+ const M = P(e.codeBefore, e.codeAfter);
54
+ return ["codeBefore", "codeAfter"].forEach((a) => {
55
+ e[a].trim() ? M.includes(a) ? t[a] = o(`${i}.error-code-invalid`) : e[a].length > r.CODE_MAX && (t[a] = o(`${i}.error-code-max`, { max: r.CODE_MAX })) : t[a] = o(`${i}.error-code-required`);
56
+ }), t;
57
+ }, y = (e, t) => {
58
+ p(e ? { type: l.Success, message: t } : { type: l.Error, message: o("products.something-went-wrong") });
59
+ }, g = (e) => o(
60
+ `${i}.${e}`,
61
+ {
62
+ academyLink: `<a href="${L.EMAIL_DISPLAY_CONDITIONS}" target="_blank" style="color: #0A2ECC; text-decoration: underline;">${o(`${i}.academy`)}</a>`
63
+ }
64
+ ), T = () => {
65
+ p({ type: l.Error, message: o(`${i}.validation-failed`) });
66
+ }, c = (e) => ({ name: R(e) }), E = (e, t) => {
67
+ e != null && e.authReported || (console.warn(t, e), p({ type: l.Error, message: t }));
68
+ };
69
+ return {
70
+ syntax: u,
71
+ handleOpen: D,
72
+ cancel: $,
73
+ loadList: h,
74
+ validate: N,
75
+ notifyInvalid: T,
76
+ describeWithAcademyLink: g,
77
+ createInline: (e) => {
78
+ y(
79
+ f(S(e, A.INLINE)),
80
+ o(`${i}.created`, c(e.name.trim()))
81
+ );
82
+ },
83
+ createAndSave: async (e) => {
84
+ try {
85
+ const t = await s.create(e, u.value);
86
+ return n.list = [t, ...n.list.filter((d) => d.id !== t.id)], y(
87
+ f(S(I(t), A.SAVED, t.id)),
88
+ o(`${i}.created-and-saved`, c(t.name))
89
+ ), {};
90
+ } catch (t) {
91
+ return (t == null ? void 0 : t.status) === Y ? { name: o(`${i}.error-name-exists`) } : (E(t, o(`${i}.save-failed`, c(e.name.trim()))), null);
92
+ }
93
+ },
94
+ select: (e) => {
95
+ y(
96
+ f(S(I(e), A.SAVED, e.id)),
97
+ o(`${i}.applied`, c(e.name))
98
+ );
99
+ },
100
+ deleteSaved: async (e) => {
101
+ try {
102
+ await s.remove(e.id), n.list = n.list.filter((t) => t.id !== e.id), p({
103
+ type: l.Success,
104
+ message: o(`${i}.deleted`, c(e.name))
105
+ });
106
+ } catch (t) {
107
+ E(t, o(`${i}.delete-failed`));
108
+ } finally {
109
+ n.pendingDelete = null;
110
+ }
111
+ }
112
+ };
113
+ };
114
+ export {
115
+ te as useDisplayConditions
116
+ };
@@ -16,8 +16,6 @@ const x = /* @__PURE__ */ new Set([
16
16
  "fix-tags-end",
17
17
  // Unwrap translate-injected <font dir="auto"> tags — pure removal, never emits AMP-forbidden output.
18
18
  "strip-font-tags",
19
- // Trim whitespace inside href values — attribute-value edit only, emits nothing new.
20
- "trim-href-whitespace",
21
19
  // Image domain corrections — plain string replacement.
22
20
  "replace-old-image-domain",
23
21
  "replace-old-v2-image-domain",
@@ -1,6 +1,5 @@
1
- import { stripFontTags as c } from "../../utils/stripFontTags.js";
2
- import { trimHrefWhitespace as l } from "../../utils/trimHrefWhitespace.js";
3
- const f = [
1
+ import { stripFontTags as p } from "../../utils/stripFontTags.js";
2
+ const d = [
4
3
  {
5
4
  id: "fix-url-encoding-start",
6
5
  description: "Replace {%22 with %7B%22 to fix URL encoding",
@@ -59,16 +58,9 @@ const f = [
59
58
  id: "strip-font-tags",
60
59
  description: 'Unwrap browser-translate-injected <font dir="auto"> tags, keeping inner content; other <font> elements are left intact.',
61
60
  type: "custom",
62
- processor: (e) => c(e),
61
+ processor: (e) => p(e),
63
62
  priority: 15
64
63
  },
65
- {
66
- id: "trim-href-whitespace",
67
- description: "Trim leading/trailing whitespace and &nbsp; from every href value",
68
- type: "custom",
69
- processor: (e) => l(e),
70
- priority: 16
71
- },
72
64
  {
73
65
  id: "remove-apty-iframe",
74
66
  description: "Cleanup Apty Iframe Code",
@@ -165,8 +157,8 @@ const f = [
165
157
  processor: (e) => {
166
158
  const t = (i) => i.toString(16).padStart(2, "0");
167
159
  return e.replace(/rgb\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*\)/gi, (i, o, n, r) => {
168
- const [s, a, p] = [Number(o), Number(n), Number(r)];
169
- return s > 255 || a > 255 || p > 255 ? i : `#${t(s)}${t(a)}${t(p)}`;
160
+ const [s, a, c] = [Number(o), Number(n), Number(r)];
161
+ return s > 255 || a > 255 || c > 255 ? i : `#${t(s)}${t(a)}${t(c)}`;
170
162
  }).replace(/#([0-9a-f])\1([0-9a-f])\2([0-9a-f])\3\b/gi, "#$1$2$3");
171
163
  },
172
164
  priority: 44
@@ -208,5 +200,5 @@ const f = [
208
200
  }
209
201
  ];
210
202
  export {
211
- f as defaultHtmlCompilerRules
203
+ d as defaultHtmlCompilerRules
212
204
  };
@@ -1,75 +1,76 @@
1
- import { PRODUCT_WRAPPER_SELECTOR as h, hasZeroWidthDeclaration as E, isZeroWidthValue as f, withWidthPin as T, PRODUCT_TD_SELECTOR as _, withoutZeroWidth as y } from "../../../extensions/Blocks/Items/constants/cardWidth.js";
2
- import { DefaultConfigValues as D } from "../../../extensions/Blocks/Items/enums/settingsEnums.js";
3
- import { protectLiquid as p, restoreLiquid as A } from "../../../utils/liquidProtection.js";
4
- const m = "MSO_ITEMS_HIDE_START", S = "MSO_ITEMS_HIDE_END", M = "mso-hide:all; max-height:0; overflow:hidden; font-size:0; line-height:0;", I = ".ins-product-cart td.horizontal-price, .ins-product-cart td.vertical-price", O = ".ins-product-td td.product-image-class img[width]", g = Number(D.productImageWidth);
5
- function C(t) {
1
+ import { PRODUCT_WRAPPER_SELECTOR as _, hasZeroWidthDeclaration as p, isZeroWidthValue as f, withWidthPin as y, PRODUCT_TD_SELECTOR as D, withoutZeroWidth as S } from "../../../extensions/Blocks/Items/constants/cardWidth.js";
2
+ import { DefaultConfigValues as M } from "../../../extensions/Blocks/Items/enums/settingsEnums.js";
3
+ import { protectLiquid as h, restoreLiquid as T } from "../../../utils/liquidProtection.js";
4
+ import { protectTableText as E, restoreTableText as m } from "../../../utils/protectTableText.js";
5
+ const A = "MSO_ITEMS_HIDE_START", b = "MSO_ITEMS_HIDE_END", I = "mso-hide:all; max-height:0; overflow:hidden; font-size:0; line-height:0;", O = ".ins-product-cart td.horizontal-price, .ins-product-cart td.vertical-price", g = ".ins-product-td td.product-image-class img[width]", H = Number(M.productImageWidth);
6
+ function P(t) {
6
7
  if (!t.includes("vertical-price") || !t.includes("ins-product-cart"))
7
8
  return t;
8
- const s = t.replaceAll("{%", "<!--{%").replaceAll("%}", "%}-->"), o = new DOMParser().parseFromString(s, "text/html");
9
+ const s = E(t).replaceAll("{%", "<!--{%").replaceAll("%}", "%}-->"), o = new DOMParser().parseFromString(s, "text/html");
9
10
  let n = !1;
10
- if (o.querySelectorAll(I).forEach((e) => {
11
+ if (o.querySelectorAll(O).forEach((e) => {
11
12
  var d, u;
12
- const r = e.getAttribute("style") || "";
13
- if (!/display\s*:\s*none/i.test(r))
13
+ const i = e.getAttribute("style") || "";
14
+ if (!/display\s*:\s*none/i.test(i))
14
15
  return;
15
16
  const l = e.previousSibling;
16
- if (((l == null ? void 0 : l.nodeType) !== Node.COMMENT_NODE || l.data !== m) && ((d = e.parentNode) == null || d.insertBefore(o.createComment(m), e), (u = e.parentNode) == null || u.insertBefore(o.createComment(S), e.nextSibling)), !/mso-hide/i.test(r)) {
17
- const a = r.trim().endsWith(";") ? " " : "; ";
18
- e.setAttribute("style", `${r}${a}${M}`);
17
+ if (((l == null ? void 0 : l.nodeType) !== Node.COMMENT_NODE || l.data !== A) && ((d = e.parentNode) == null || d.insertBefore(o.createComment(A), e), (u = e.parentNode) == null || u.insertBefore(o.createComment(b), e.nextSibling)), !/mso-hide/i.test(i)) {
18
+ const a = i.trim().endsWith(";") ? " " : "; ";
19
+ e.setAttribute("style", `${i}${a}${I}`);
19
20
  }
20
21
  n = !0;
21
22
  }), !n)
22
23
  return t;
23
- const c = s.match(/<!DOCTYPE[^>]*>/i);
24
- return ((c ? `${c[0]}
25
- ` : "") + o.documentElement.outerHTML).replaceAll("<!--{%", "{%").replaceAll("%}-->", "%}").replaceAll("&lt;!--{%", "{%").replaceAll("%}--&gt;", "%}");
24
+ const c = s.match(/<!DOCTYPE[^>]*>/i), r = c ? `${c[0]}
25
+ ` : "";
26
+ return m((r + o.documentElement.outerHTML).replaceAll("<!--{%", "{%").replaceAll("%}-->", "%}").replaceAll("&lt;!--{%", "{%").replaceAll("%}--&gt;", "%}"));
26
27
  }
27
- function N(t) {
28
+ function R(t) {
28
29
  if (!t.includes("ins-product-wrapper") && !t.includes("ins-product-td"))
29
30
  return t;
30
- const s = new DOMParser().parseFromString(p(t), "text/html");
31
+ const s = new DOMParser().parseFromString(h(E(t)), "text/html");
31
32
  let o = !1;
32
- if (s.querySelectorAll(h).forEach((i) => {
33
- const e = i.getAttribute("style") || "";
34
- if (!E(e) && !f(i.getAttribute("width")))
33
+ if (s.querySelectorAll(_).forEach((r) => {
34
+ const e = r.getAttribute("style") || "";
35
+ if (!p(e) && !f(r.getAttribute("width")))
35
36
  return;
36
- const r = T(e);
37
- r !== e && (i.setAttribute("style", r), o = !0), f(i.getAttribute("width")) && (i.setAttribute("width", "100%"), o = !0);
38
- }), s.querySelectorAll(_).forEach((i) => {
39
- const e = i.getAttribute("style") || "";
40
- if (E(e)) {
41
- const r = y(e);
42
- r ? i.setAttribute("style", r) : i.removeAttribute("style"), o = !0;
37
+ const i = y(e);
38
+ i !== e && (r.setAttribute("style", i), o = !0), f(r.getAttribute("width")) && (r.setAttribute("width", "100%"), o = !0);
39
+ }), s.querySelectorAll(D).forEach((r) => {
40
+ const e = r.getAttribute("style") || "";
41
+ if (p(e)) {
42
+ const i = S(e);
43
+ i ? r.setAttribute("style", i) : r.removeAttribute("style"), o = !0;
43
44
  }
44
- f(i.getAttribute("width")) && (i.removeAttribute("width"), o = !0);
45
+ f(r.getAttribute("width")) && (r.removeAttribute("width"), o = !0);
45
46
  }), !o)
46
47
  return t;
47
48
  const n = t.match(/<!DOCTYPE[^>]*>/i), c = n ? `${n[0]}
48
49
  ` : "";
49
- return A(c + s.documentElement.outerHTML);
50
+ return m(T(c + s.documentElement.outerHTML));
50
51
  }
51
- function L(t) {
52
+ function x(t) {
52
53
  if (!t.includes("product-image-class"))
53
54
  return t;
54
- const s = new DOMParser().parseFromString(p(t), "text/html");
55
+ const s = new DOMParser().parseFromString(h(E(t)), "text/html");
55
56
  let o = !1;
56
- if (s.querySelectorAll(O).forEach((i) => {
57
+ if (s.querySelectorAll(g).forEach((r) => {
57
58
  var u, a;
58
- const e = ((u = i.getAttribute("width")) == null ? void 0 : u.trim()) ?? "", r = ((a = i.getAttribute("style")) == null ? void 0 : a.trim()) ?? "";
59
- if (!/^\d+$/.test(e) || /(^|;)\s*min-width\s*:/i.test(r))
59
+ const e = ((u = r.getAttribute("width")) == null ? void 0 : u.trim()) ?? "", i = ((a = r.getAttribute("style")) == null ? void 0 : a.trim()) ?? "";
60
+ if (!/^\d+$/.test(e) || /(^|;)\s*min-width\s*:/i.test(i))
60
61
  return;
61
- const l = r && !r.endsWith(";") ? ";" : "", d = Math.min(Number(e), g);
62
- i.setAttribute("style", `${r}${l}min-width:${d}px;max-width:${e}px`), o = !0;
62
+ const l = i && !i.endsWith(";") ? ";" : "", d = Math.min(Number(e), H);
63
+ r.setAttribute("style", `${i}${l}min-width:${d}px;max-width:${e}px`), o = !0;
63
64
  }), !o)
64
65
  return t;
65
66
  const n = t.match(/<!DOCTYPE[^>]*>/i), c = n ? `${n[0]}
66
67
  ` : "";
67
- return A(c + s.documentElement.outerHTML);
68
+ return m(T(c + s.documentElement.outerHTML));
68
69
  }
69
70
  export {
70
- S as MSO_ITEMS_HIDE_END,
71
- m as MSO_ITEMS_HIDE_START,
72
- L as lockHorizontalItemImageWidths,
73
- N as normalizeItemsBlockWidths,
74
- C as wrapHiddenPriceTdsForOutlook
71
+ b as MSO_ITEMS_HIDE_END,
72
+ A as MSO_ITEMS_HIDE_START,
73
+ x as lockHorizontalItemImageWidths,
74
+ R as normalizeItemsBlockWidths,
75
+ P as wrapHiddenPriceTdsForOutlook
75
76
  };