@useinsider/guido 3.20.1-beta.d2cba14 → 3.20.1-beta.da6efd5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/dist/@types/config/schemas.js +41 -39
- package/dist/@types/display-condition.js +25 -0
- package/dist/components/Guido.vue.js +6 -6
- package/dist/components/Guido.vue2.js +78 -76
- package/dist/components/organisms/display-conditions/CodeEditorField.vue.js +20 -0
- package/dist/components/organisms/display-conditions/CodeEditorField.vue2.js +30 -0
- package/dist/components/organisms/display-conditions/DisplayConditionCreateDrawer.vue.js +30 -0
- package/dist/components/organisms/display-conditions/DisplayConditionCreateDrawer.vue2.js +71 -0
- package/dist/components/organisms/display-conditions/DisplayConditionSelectDrawer.vue.js +34 -0
- package/dist/components/organisms/display-conditions/DisplayConditionSelectDrawer.vue2.js +57 -0
- package/dist/components/organisms/display-conditions/DisplayConditionsHost.vue.js +17 -0
- package/dist/components/organisms/display-conditions/DisplayConditionsHost.vue2.js +22 -0
- package/dist/composables/useBlocksConfig.js +32 -24
- package/dist/composables/useDisplayConditions.js +111 -0
- package/dist/composables/useLegacyStrategyConversion.js +16 -16
- package/dist/enums/academy.js +1 -0
- package/dist/enums/display-condition.js +12 -0
- package/dist/extensions/Blocks/Recommendation/controls/main/index.js +296 -223
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +219 -205
- package/dist/extensions/Blocks/Recommendation/utils/blockRefresh.js +19 -0
- package/dist/extensions/Blocks/Recommendation/utils/nodeConfigWriter.js +51 -36
- package/dist/extensions/Blocks/Recommendation/utils/strategyCommit.js +31 -35
- package/dist/extensions/DisplayConditions/bridge.js +17 -0
- package/dist/extensions/DisplayConditions/constants.js +17 -0
- package/dist/extensions/DisplayConditions/control.js +169 -0
- package/dist/extensions/DisplayConditions/display-conditions.css.js +201 -0
- package/dist/extensions/DisplayConditions/extension.js +28 -0
- package/dist/extensions/DisplayConditions/iconsRegistry.js +20 -0
- package/dist/extensions/DisplayConditions/library.js +25 -0
- package/dist/extensions/DisplayConditions/settingsPanel.js +17 -0
- package/dist/guido.css +1 -1
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js +93 -92
- package/dist/node_modules/valibot/dist/index.js +297 -261
- package/dist/services/displayConditionApi.js +39 -0
- package/dist/src/@types/config/schemas.d.ts +4 -0
- package/dist/src/@types/display-condition.d.ts +59 -0
- package/dist/src/components/organisms/display-conditions/CodeEditorField.vue.d.ts +43 -0
- package/dist/src/components/organisms/display-conditions/DisplayConditionCreateDrawer.vue.d.ts +2 -0
- package/dist/src/components/organisms/display-conditions/DisplayConditionSelectDrawer.vue.d.ts +2 -0
- package/dist/src/components/organisms/display-conditions/DisplayConditionsHost.vue.d.ts +2 -0
- package/dist/src/composables/useConfig.d.ts +2 -0
- package/dist/src/composables/useDisplayConditions.d.ts +16 -0
- package/dist/src/enums/academy.d.ts +1 -0
- package/dist/src/enums/display-condition.d.ts +15 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +18 -3
- package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +8 -1
- package/dist/src/extensions/Blocks/Recommendation/utils/blockRefresh.d.ts +17 -0
- package/dist/src/extensions/Blocks/Recommendation/utils/nodeConfigWriter.d.ts +7 -0
- package/dist/src/extensions/DisplayConditions/bridge.d.ts +6 -0
- package/dist/src/extensions/DisplayConditions/constants.d.ts +14 -0
- package/dist/src/extensions/DisplayConditions/control.d.ts +21 -0
- package/dist/src/extensions/DisplayConditions/extension.d.ts +2 -0
- package/dist/src/extensions/DisplayConditions/iconsRegistry.d.ts +4 -0
- package/dist/src/extensions/DisplayConditions/library.d.ts +8 -0
- package/dist/src/extensions/DisplayConditions/settingsPanel.d.ts +5 -0
- package/dist/src/mock/api/display-conditions.d.ts +2 -0
- package/dist/src/services/displayConditionApi.d.ts +9 -0
- package/dist/src/stores/config.d.ts +166 -0
- package/dist/src/stores/display-condition.d.ts +81 -0
- package/dist/src/utils/displayCondition.d.ts +4 -0
- package/dist/src/utils/protectTableText.d.ts +2 -0
- package/dist/stores/config.js +7 -0
- package/dist/stores/display-condition.js +28 -0
- package/dist/utils/displayCondition.js +21 -0
- package/dist/utils/pairProductVariables.js +15 -14
- package/dist/utils/protectTableText.js +22 -0
- package/package.json +1 -1
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { defineComponent as D, reactive as $, ref as s, watch as C, computed as u } from "vue";
|
|
2
|
+
import O from "../../wrappers/WpDrawer.vue.js";
|
|
3
|
+
import { useDisplayConditions as T } from "../../../composables/useDisplayConditions.js";
|
|
4
|
+
import { useTranslations as L } from "../../../composables/useTranslations.js";
|
|
5
|
+
import { ACADEMY_LINKS as x } from "../../../enums/academy.js";
|
|
6
|
+
import { DISPLAY_CONDITION_LIMITS as h } from "../../../enums/display-condition.js";
|
|
7
|
+
import { useDisplayConditionStore as k } from "../../../stores/display-condition.js";
|
|
8
|
+
import { InRadioButton as N, InBasicTextInput as w } from "@useinsider/design-system-vue";
|
|
9
|
+
import E from "./CodeEditorField.vue.js";
|
|
10
|
+
const J = /* @__PURE__ */ D({
|
|
11
|
+
__name: "DisplayConditionCreateDrawer",
|
|
12
|
+
setup(Y) {
|
|
13
|
+
const i = "email-editor.display-conditions", n = L(), c = k(), { validate: p, notifyInvalid: l, createInline: f, createAndSave: m, cancel: y } = T(), d = () => ({ name: "", description: "", codeBefore: "", codeAfter: "" }), e = $(d()), o = s({}), a = s(!1), v = s(), _ = s();
|
|
14
|
+
C(() => c.isCreateOpen, (r) => {
|
|
15
|
+
if (!r)
|
|
16
|
+
return;
|
|
17
|
+
const { editing: t } = c;
|
|
18
|
+
Object.assign(e, t ? {
|
|
19
|
+
name: t.name,
|
|
20
|
+
description: t.description,
|
|
21
|
+
codeBefore: t.beforeScript,
|
|
22
|
+
codeAfter: t.afterScript
|
|
23
|
+
} : d()), o.value = {}, a.value = !1;
|
|
24
|
+
}, { immediate: !0 });
|
|
25
|
+
const g = u(() => n(`${i}.create-description`, {
|
|
26
|
+
academyLink: `<a href="${x.EMAIL_DISPLAY_CONDITIONS}" class="guido-display-condition-academy" target="_blank">${n(`${i}.academy`)}</a>`
|
|
27
|
+
})), S = u(() => ({
|
|
28
|
+
cancelOrBackButton: {
|
|
29
|
+
styling: "ghost",
|
|
30
|
+
type: "secondary",
|
|
31
|
+
labelText: n(`${i}.cancel`),
|
|
32
|
+
disabledStatus: a.value
|
|
33
|
+
},
|
|
34
|
+
secondaryButton: {
|
|
35
|
+
styling: "solid",
|
|
36
|
+
type: "subtle-primary",
|
|
37
|
+
labelText: n(`${i}.create-and-save`),
|
|
38
|
+
loadingStatus: a.value
|
|
39
|
+
},
|
|
40
|
+
primaryButton: {
|
|
41
|
+
styling: "solid",
|
|
42
|
+
type: "primary",
|
|
43
|
+
labelText: n(`${i}.create`),
|
|
44
|
+
disabledStatus: a.value
|
|
45
|
+
}
|
|
46
|
+
})), B = (r, t) => {
|
|
47
|
+
t !== e[r] && (e[r] = t, o.value[r] && (o.value = { ...o.value, [r]: void 0 }));
|
|
48
|
+
}, A = u(() => `${n(`${i}.condition-description`)} <span class="guido-display-condition-create__optional">(${n(`${i}.optional`)})</span>`);
|
|
49
|
+
return { __sfc: !0, KEY: i, trans: n, store: c, validate: p, notifyInvalid: l, createInline: f, createAndSave: m, cancel: y, emptyDraft: d, draft: e, errors: o, isSaving: a, codeBeforeRef: v, codeAfterRef: _, descriptionText: g, footerButtonGroupOptions: S, updateField: B, descriptionLabel: A, submit: async (r) => {
|
|
50
|
+
var I, b;
|
|
51
|
+
if (a.value)
|
|
52
|
+
return;
|
|
53
|
+
if (e.codeBefore = ((I = v.value) == null ? void 0 : I.read()) ?? e.codeBefore, e.codeAfter = ((b = _.value) == null ? void 0 : b.read()) ?? e.codeAfter, o.value = p(e, r), Object.keys(o.value).length) {
|
|
54
|
+
l();
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
if (r === "inline") {
|
|
58
|
+
f({ ...e });
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
a.value = !0;
|
|
62
|
+
const t = await m({ ...e });
|
|
63
|
+
a.value = !1, o.value = t ?? {}, Object.keys(o.value).length && l();
|
|
64
|
+
}, close: () => {
|
|
65
|
+
a.value || y();
|
|
66
|
+
}, WpDrawer: O, DISPLAY_CONDITION_LIMITS: h, InBasicTextInput: w, InRadioButton: N, CodeEditorField: E };
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
export {
|
|
70
|
+
J as default
|
|
71
|
+
};
|
|
@@ -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" }, [i(t.InBasicTextInput, { staticClass: "mb-4 w-1", attrs: { id: "guido__display-condition-search-input", name: "displayConditionSearch", "character-counter-status": !1, "disabled-status": t.store.listStatus !== "loaded" || !t.store.list.length, "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
|
+
} } }), t.store.listStatus === "loading" || t.store.listStatus === "idle" ? i("div", { staticClass: "guido-display-condition-select__list", attrs: { "data-testid": "display-condition-loading" } }, s._l(3, function(e) {
|
|
9
|
+
return i(t.InSkeleton, { key: e, attrs: { sizing: { width: 857, height: 78 } } });
|
|
10
|
+
}), 1) : t.store.listStatus === "error" ? i(t.InNoData, { 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`) }, 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, { attrs: { id: "guido__display-condition-no-result", icon: "no-data", title: t.trans(`${t.KEY}.no-result`) } }) : i(t.InNoData, { attrs: { id: "guido__display-condition-empty", "button-status": "", icon: "no-data", "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
|
+
"2561eb6a"
|
|
30
|
+
);
|
|
31
|
+
const y = c.exports;
|
|
32
|
+
export {
|
|
33
|
+
y as default
|
|
34
|
+
};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { defineComponent as I, ref as i, watch as _, computed as r } from "vue";
|
|
2
|
+
import B from "../../wrappers/WpDrawer.vue.js";
|
|
3
|
+
import L from "../../wrappers/WpModal.vue.js";
|
|
4
|
+
import { useDisplayConditions as S } from "../../../composables/useDisplayConditions.js";
|
|
5
|
+
import { useTranslations as x } from "../../../composables/useTranslations.js";
|
|
6
|
+
import { ACADEMY_LINKS as $ } from "../../../enums/academy.js";
|
|
7
|
+
import { useDisplayConditionStore as C } from "../../../stores/display-condition.js";
|
|
8
|
+
import { InSkeleton as M, InNoData as O, InIcons as T, InButtonV2 as b, InBasicTextInput as k } from "@useinsider/design-system-vue";
|
|
9
|
+
const H = /* @__PURE__ */ I({
|
|
10
|
+
__name: "DisplayConditionSelectDrawer",
|
|
11
|
+
setup(h) {
|
|
12
|
+
const o = "email-editor.display-conditions", l = x(), t = C(), { loadList: d, select: m, deleteSaved: u, cancel: f } = S(), c = i(""), s = i(null), a = i(null), n = i(!1);
|
|
13
|
+
_(() => t.isSelectOpen, (e) => {
|
|
14
|
+
e && (c.value = "", s.value = null, a.value = null, d());
|
|
15
|
+
}, { immediate: !0 });
|
|
16
|
+
const g = r(() => {
|
|
17
|
+
const e = c.value.trim().toLocaleLowerCase();
|
|
18
|
+
return e ? t.list.filter((p) => `${p.name} ${p.description}`.toLocaleLowerCase().includes(e)) : t.list;
|
|
19
|
+
}), D = r(() => l(`${o}.select-description`, {
|
|
20
|
+
academyLink: `<a href="${$.EMAIL_DISPLAY_CONDITIONS}" class="guido-display-condition-academy" target="_blank">${l(`${o}.academy`)}</a>`
|
|
21
|
+
})), v = r(() => ({
|
|
22
|
+
cancelOrBackButton: {
|
|
23
|
+
styling: "ghost",
|
|
24
|
+
type: "secondary",
|
|
25
|
+
labelText: l(`${o}.back`),
|
|
26
|
+
leftIcon: "line-arrow-left"
|
|
27
|
+
}
|
|
28
|
+
})), y = r(() => ({
|
|
29
|
+
cancelOrBackButton: {
|
|
30
|
+
type: "secondary",
|
|
31
|
+
styling: "ghost",
|
|
32
|
+
labelText: l(`${o}.cancel`),
|
|
33
|
+
disabledStatus: n.value
|
|
34
|
+
},
|
|
35
|
+
primaryButton: {
|
|
36
|
+
type: "danger",
|
|
37
|
+
labelText: l(`${o}.delete`),
|
|
38
|
+
loadingStatus: n.value
|
|
39
|
+
}
|
|
40
|
+
}));
|
|
41
|
+
return { __sfc: !0, KEY: o, trans: l, store: t, loadList: d, select: m, deleteSaved: u, cancel: f, search: c, expandedId: s, menuId: a, isDeleting: n, filteredList: g, descriptionText: D, footerButtonGroupOptions: v, deleteModalButtons: y, toggleExpanded: (e) => {
|
|
42
|
+
s.value = s.value === e.id ? null : e.id;
|
|
43
|
+
}, toggleMenu: (e) => {
|
|
44
|
+
a.value = a.value === e.id ? null : e.id;
|
|
45
|
+
}, requestDelete: (e) => {
|
|
46
|
+
a.value = null, t.pendingDelete = e;
|
|
47
|
+
}, confirmDelete: async () => {
|
|
48
|
+
!t.pendingDelete || n.value || (n.value = !0, await u(t.pendingDelete), n.value = !1);
|
|
49
|
+
}, closeDeleteModal: () => {
|
|
50
|
+
n.value || (t.pendingDelete = null);
|
|
51
|
+
}, codeOf: (e) => [e.codeBefore, e.codeAfter].filter(Boolean).join(`
|
|
52
|
+
`), WpDrawer: B, WpModal: L, InBasicTextInput: k, InButtonV2: b, InIcons: T, InNoData: O, InSkeleton: M };
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
export {
|
|
56
|
+
H as default
|
|
57
|
+
};
|
|
@@ -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,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { useConfigStore as
|
|
3
|
-
const
|
|
1
|
+
import l from "../extensions/ModulesTabIcons/extension.js";
|
|
2
|
+
import { useConfigStore as c } from "../stores/config.js";
|
|
3
|
+
const s = {
|
|
4
4
|
"amp-accordion": "ampAccordionEnabled",
|
|
5
5
|
"amp-carousel": "ampCarouselEnabled",
|
|
6
6
|
"amp-form-controls": "ampFormControlsEnabled",
|
|
@@ -14,7 +14,7 @@ const a = {
|
|
|
14
14
|
"text-block": "textEnabled",
|
|
15
15
|
"timer-block": "timerEnabled",
|
|
16
16
|
"video-block": "videoEnabled"
|
|
17
|
-
},
|
|
17
|
+
}, i = {
|
|
18
18
|
"dynamic-content": () => import("../extensions/DynamicContent/extension.js"),
|
|
19
19
|
"checkbox-block": () => import("../extensions/Blocks/Checkbox/extension.js"),
|
|
20
20
|
"radio-button-block": () => import("../extensions/Blocks/RadioButton/extension.js"),
|
|
@@ -22,40 +22,48 @@ const a = {
|
|
|
22
22
|
"unsubscribe-block": () => import("../extensions/Blocks/Unsubscribe/extension.js"),
|
|
23
23
|
"coupon-block": () => import("../extensions/Blocks/CouponBlock/extension.js"),
|
|
24
24
|
"items-block": () => import("../extensions/Blocks/Items/extension.js")
|
|
25
|
-
},
|
|
26
|
-
if (!
|
|
25
|
+
}, b = (o) => {
|
|
26
|
+
if (!o || !o.length)
|
|
27
27
|
return {};
|
|
28
28
|
const t = {};
|
|
29
|
-
return
|
|
30
|
-
const e =
|
|
29
|
+
return o.forEach((n) => {
|
|
30
|
+
const e = s[n];
|
|
31
31
|
e && (t[e] = !1);
|
|
32
32
|
}), t;
|
|
33
|
-
},
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
33
|
+
}, m = async (o) => {
|
|
34
|
+
if (!o)
|
|
35
|
+
return [l];
|
|
36
|
+
const t = await import("../extensions/DisplayConditions/extension.js");
|
|
37
|
+
return [l, t.default];
|
|
38
|
+
}, d = async (o, t = !1) => {
|
|
39
|
+
const n = await m(t);
|
|
40
|
+
if (!o || !o.length)
|
|
41
|
+
return n;
|
|
42
|
+
const e = await Promise.all(
|
|
43
|
+
o.map(async (r) => {
|
|
44
|
+
const a = i[r];
|
|
45
|
+
return a ? (await a()).default : null;
|
|
41
46
|
})
|
|
42
47
|
);
|
|
43
48
|
return [
|
|
44
|
-
...
|
|
45
|
-
...
|
|
49
|
+
...n,
|
|
50
|
+
...e.filter((r) => r !== null)
|
|
46
51
|
];
|
|
47
|
-
},
|
|
48
|
-
const
|
|
52
|
+
}, k = () => {
|
|
53
|
+
const o = c();
|
|
49
54
|
return {
|
|
50
55
|
getStripoBlocksConfig: async () => {
|
|
51
|
-
const
|
|
56
|
+
const n = o.blocks;
|
|
52
57
|
return {
|
|
53
|
-
baseBlocks:
|
|
54
|
-
extensions: await
|
|
58
|
+
baseBlocks: b(n == null ? void 0 : n.excludeDefaults),
|
|
59
|
+
extensions: await d(
|
|
60
|
+
n == null ? void 0 : n.includeCustoms,
|
|
61
|
+
o.externalDisplayConditions
|
|
62
|
+
)
|
|
55
63
|
};
|
|
56
64
|
}
|
|
57
65
|
};
|
|
58
66
|
};
|
|
59
67
|
export {
|
|
60
|
-
|
|
68
|
+
k as useBlocksConfig
|
|
61
69
|
};
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { useToaster as x } from "./useToaster.js";
|
|
2
|
+
import { useTranslations as M } from "./useTranslations.js";
|
|
3
|
+
import { DISPLAY_CONDITION_LIMITS as r, DisplayConditionEvent as E } from "../enums/display-condition.js";
|
|
4
|
+
import { ToasterTypeOptions as l } from "../enums/toaster.js";
|
|
5
|
+
import { useDisplayConditionApi as N } from "../services/displayConditionApi.js";
|
|
6
|
+
import { useConfigStore as T } from "../stores/config.js";
|
|
7
|
+
import { useDisplayConditionStore as _ } from "../stores/display-condition.js";
|
|
8
|
+
import { parseSource as O, findInvalidCodeFields as B } from "../utils/displayCondition.js";
|
|
9
|
+
import { escapeHtml as L } from "../utils/htmlEscape.js";
|
|
10
|
+
import { computed as X } from "vue";
|
|
11
|
+
const i = "email-editor.display-conditions", y = (n, f, a) => ({
|
|
12
|
+
id: f,
|
|
13
|
+
name: n.name.trim(),
|
|
14
|
+
description: n.description.trim(),
|
|
15
|
+
beforeScript: n.codeBefore,
|
|
16
|
+
afterScript: n.codeAfter,
|
|
17
|
+
extraData: JSON.stringify({ source: a })
|
|
18
|
+
}), Q = () => {
|
|
19
|
+
const n = _(), f = T(), a = N(), o = M(), { showToaster: c } = x(), p = X(() => {
|
|
20
|
+
var e;
|
|
21
|
+
return (e = f.features) != null && e.liquidSyntax ? "liquid" : "pongo";
|
|
22
|
+
}), v = (e) => {
|
|
23
|
+
const t = { condition: e };
|
|
24
|
+
document.dispatchEvent(new CustomEvent(E.APPLY, { detail: t })), n.close();
|
|
25
|
+
}, g = () => {
|
|
26
|
+
n.view !== "none" && (document.dispatchEvent(new CustomEvent(E.CANCEL)), n.close());
|
|
27
|
+
}, C = (e) => {
|
|
28
|
+
if (e.mode === "select") {
|
|
29
|
+
n.openSelect();
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
n.openCreate(e.mode === "edit" ? e.current : null);
|
|
33
|
+
}, $ = async () => {
|
|
34
|
+
n.listStatus = "loading";
|
|
35
|
+
try {
|
|
36
|
+
const e = await a.list(p.value);
|
|
37
|
+
n.list = e.data, n.listStatus = "loaded";
|
|
38
|
+
} catch (e) {
|
|
39
|
+
console.warn("Display conditions could not be loaded.", e), n.listStatus = "error";
|
|
40
|
+
}
|
|
41
|
+
}, h = (e, t) => {
|
|
42
|
+
const s = {}, u = e.name.trim();
|
|
43
|
+
t === "save" && !u ? s.name = o(`${i}.error-name-required`) : u && u.length < r.NAME_MIN ? s.name = o(`${i}.error-name-min`, { min: r.NAME_MIN }) : u.length > r.NAME_MAX && (s.name = o(`${i}.error-name-max`, { max: r.NAME_MAX }));
|
|
44
|
+
const { DESCRIPTION_MAX: S } = r;
|
|
45
|
+
e.description.trim().length > S && (s.description = o(`${i}.error-description-max`, { max: S }));
|
|
46
|
+
const I = B(e.codeBefore, e.codeAfter);
|
|
47
|
+
return ["codeBefore", "codeAfter"].forEach((d) => {
|
|
48
|
+
e[d].trim() ? I.includes(d) ? s[d] = o(`${i}.error-code-invalid`) : e[d].length > r.CODE_MAX && (s[d] = o(`${i}.error-code-max`, { max: r.CODE_MAX })) : s[d] = o(`${i}.error-code-required`);
|
|
49
|
+
}), s;
|
|
50
|
+
}, D = () => {
|
|
51
|
+
c({ type: l.Error, message: o(`${i}.validation-failed`) });
|
|
52
|
+
}, m = (e) => ({ name: L(e) }), A = (e, t) => {
|
|
53
|
+
e != null && e.authReported || (console.warn(t, e), c({ type: l.Error, message: t }));
|
|
54
|
+
};
|
|
55
|
+
return {
|
|
56
|
+
syntax: p,
|
|
57
|
+
handleOpen: C,
|
|
58
|
+
cancel: g,
|
|
59
|
+
loadList: $,
|
|
60
|
+
validate: h,
|
|
61
|
+
notifyInvalid: D,
|
|
62
|
+
createInline: (e) => {
|
|
63
|
+
const t = n.editing && O(n.editing) === "inline" ? n.editing.id : Date.now();
|
|
64
|
+
v(y(e, t, "inline")), c({
|
|
65
|
+
type: l.Success,
|
|
66
|
+
message: o(`${i}.created`, m(e.name.trim()))
|
|
67
|
+
});
|
|
68
|
+
},
|
|
69
|
+
createAndSave: async (e) => {
|
|
70
|
+
try {
|
|
71
|
+
if (await a.nameExists(e.name, p.value))
|
|
72
|
+
return { name: o(`${i}.error-name-exists`) };
|
|
73
|
+
const t = await a.create(e, p.value);
|
|
74
|
+
return n.list = [t, ...n.list.filter((s) => s.id !== t.id)], v(y({
|
|
75
|
+
name: t.name,
|
|
76
|
+
description: t.description,
|
|
77
|
+
codeBefore: t.codeBefore,
|
|
78
|
+
codeAfter: t.codeAfter
|
|
79
|
+
}, t.id, "saved")), c({
|
|
80
|
+
type: l.Success,
|
|
81
|
+
message: o(`${i}.created-and-saved`, m(t.name))
|
|
82
|
+
}), {};
|
|
83
|
+
} catch (t) {
|
|
84
|
+
return A(t, o(`${i}.save-failed`, m(e.name.trim()))), null;
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
select: (e) => {
|
|
88
|
+
v(y({
|
|
89
|
+
name: e.name,
|
|
90
|
+
description: e.description,
|
|
91
|
+
codeBefore: e.codeBefore,
|
|
92
|
+
codeAfter: e.codeAfter
|
|
93
|
+
}, e.id, "saved")), c({ type: l.Success, message: o(`${i}.applied`, m(e.name)) });
|
|
94
|
+
},
|
|
95
|
+
deleteSaved: async (e) => {
|
|
96
|
+
try {
|
|
97
|
+
await a.remove(e.id), n.list = n.list.filter((t) => t.id !== e.id), c({
|
|
98
|
+
type: l.Success,
|
|
99
|
+
message: o(`${i}.deleted`, m(e.name))
|
|
100
|
+
});
|
|
101
|
+
} catch (t) {
|
|
102
|
+
A(t, o(`${i}.delete-failed`));
|
|
103
|
+
} finally {
|
|
104
|
+
n.pendingDelete = null;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
};
|
|
108
|
+
};
|
|
109
|
+
export {
|
|
110
|
+
Q as useDisplayConditions
|
|
111
|
+
};
|
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
import { useRecommendation as
|
|
1
|
+
import { useRecommendation as S } from "./useRecommendation.js";
|
|
2
2
|
import { useToaster as I } from "./useToaster.js";
|
|
3
3
|
import { useTranslations as v } from "./useTranslations.js";
|
|
4
4
|
import { ToasterTypeOptions as g } from "../enums/toaster.js";
|
|
5
5
|
import "../extensions/Blocks/Recommendation/constants/selectors.js";
|
|
6
6
|
import { CURRENT_CONFIG_VERSION as L } from "../extensions/Blocks/Recommendation/constants/defaultConfig.js";
|
|
7
|
-
import { useRecommendationExtensionStore as
|
|
8
|
-
import { resolveMigrationTarget as
|
|
7
|
+
import { useRecommendationExtensionStore as R } from "../extensions/Blocks/Recommendation/store/recommendation.js";
|
|
8
|
+
import { resolveMigrationTarget as b, buildLegacyMigrationPayload as k } from "../extensions/Blocks/Recommendation/utils/legacyStrategyMigration.js";
|
|
9
9
|
import { commitBlockChangeOutsidePanel as T } from "../extensions/Blocks/Recommendation/utils/nodeConfigWriter.js";
|
|
10
10
|
import { useConfigStore as h } from "../stores/config.js";
|
|
11
11
|
const F = () => {
|
|
12
|
-
const e =
|
|
12
|
+
const e = R(), o = h(), { buildCampaignUrl: m } = S(), { showToaster: c } = I(), a = v();
|
|
13
13
|
return { convertLegacyStrategy: async () => {
|
|
14
14
|
const t = e.currentRecommendationId;
|
|
15
15
|
if (t === null || !e.isLegacyStrategyBlock || e.legacyConversionLoading)
|
|
16
16
|
return "";
|
|
17
|
-
const { strategy: d, productIds: y, size: l, strategyId: p, nodeConfigVersion: u } = e.recommendationConfigs, f = { strategyId: p, size: l, nodeConfigVersion: u }, s =
|
|
18
|
-
campaignId:
|
|
19
|
-
templateLibraryId:
|
|
20
|
-
}),
|
|
17
|
+
const { strategy: d, productIds: y, size: l, strategyId: p, nodeConfigVersion: u } = e.recommendationConfigs, f = { strategyId: p, size: l, nodeConfigVersion: u }, s = b({
|
|
18
|
+
campaignId: o.campaignId,
|
|
19
|
+
templateLibraryId: o.templateLibraryId
|
|
20
|
+
}), C = k({
|
|
21
21
|
blockId: t,
|
|
22
22
|
url: m(String(t)),
|
|
23
|
-
campaignId:
|
|
24
|
-
variationId:
|
|
23
|
+
campaignId: o.campaignId,
|
|
24
|
+
variationId: o.variationId,
|
|
25
25
|
strategy: d,
|
|
26
26
|
productIds: y,
|
|
27
27
|
target: s
|
|
28
28
|
});
|
|
29
|
-
let
|
|
29
|
+
let r;
|
|
30
30
|
try {
|
|
31
|
-
|
|
31
|
+
r = await e.convertLegacyStrategy(C, s);
|
|
32
32
|
} catch (i) {
|
|
33
33
|
return console.error("[useLegacyStrategyConversion] migration failed", i), c({
|
|
34
34
|
type: g.Error,
|
|
@@ -40,7 +40,7 @@ const F = () => {
|
|
|
40
40
|
}), "";
|
|
41
41
|
}
|
|
42
42
|
try {
|
|
43
|
-
await e.
|
|
43
|
+
await e.fetchRecommendationProductsForBlock(t);
|
|
44
44
|
} catch (i) {
|
|
45
45
|
console.error("[useLegacyStrategyConversion] product refetch failed", i);
|
|
46
46
|
}
|
|
@@ -48,16 +48,16 @@ const F = () => {
|
|
|
48
48
|
return n ? T(
|
|
49
49
|
t,
|
|
50
50
|
{
|
|
51
|
-
strategyId:
|
|
51
|
+
strategyId: r,
|
|
52
52
|
size: n.recommendationConfigs.size,
|
|
53
53
|
configVersion: L
|
|
54
54
|
},
|
|
55
55
|
n.recommendationProducts,
|
|
56
56
|
"Converted legacy recommendation strategy"
|
|
57
|
-
) ? (e.currentRecommendationId === t && e.openLegacyStrategyUpdatedModal(),
|
|
57
|
+
) ? (e.currentRecommendationId === t && e.openLegacyStrategyUpdatedModal(), r) : (console.error("[useLegacyStrategyConversion] node write failed", t), e.revertLegacyConversion(t, f), c({
|
|
58
58
|
type: g.Error,
|
|
59
59
|
message: a("email-editor.legacy-strategy-update-failed")
|
|
60
|
-
}), "") :
|
|
60
|
+
}), "") : r;
|
|
61
61
|
} };
|
|
62
62
|
};
|
|
63
63
|
export {
|
package/dist/enums/academy.js
CHANGED
|
@@ -2,6 +2,7 @@ const e = "https://academy.insiderone.com", o = {
|
|
|
2
2
|
EMAIL_EDITOR: `${e}/docs/email-drag-and-drop-editor`,
|
|
3
3
|
GLOBAL_UNSUBSCRIBE: `${e}/docs/global-unsubscribe-preference-center`,
|
|
4
4
|
AMP_FOR_EMAILS: `${e}/docs/amp-for-emails`,
|
|
5
|
+
EMAIL_DISPLAY_CONDITIONS: `${e}/docs/new-editor-add-display-conditions-to-an-email`,
|
|
5
6
|
EMAIL_RECOMMENDATION_BLOCK: `${e}/docs/new-editor-email-recommendation-block`
|
|
6
7
|
};
|
|
7
8
|
export {
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
var N = /* @__PURE__ */ ((I) => (I.OPEN = "display-condition:open", I.APPLY = "display-condition:apply", I.CANCEL = "display-condition:cancel", I))(N || {}), A = /* @__PURE__ */ ((I) => (I.INLINE = "inline", I.SAVED = "saved", I))(A || {});
|
|
2
|
+
const M = {
|
|
3
|
+
NAME_MIN: 2,
|
|
4
|
+
NAME_MAX: 40,
|
|
5
|
+
DESCRIPTION_MAX: 200,
|
|
6
|
+
CODE_MAX: 65535
|
|
7
|
+
};
|
|
8
|
+
export {
|
|
9
|
+
M as DISPLAY_CONDITION_LIMITS,
|
|
10
|
+
N as DisplayConditionEvent,
|
|
11
|
+
A as DisplayConditionSourceType
|
|
12
|
+
};
|