@useinsider/guido 3.23.0-beta.ff29317 → 3.24.0-beta.0abeefe
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 +39 -37
- package/dist/@types/display-condition.js +25 -0
- package/dist/components/Guido.vue.js +4 -4
- package/dist/components/Guido.vue2.js +98 -92
- package/dist/components/organisms/display-conditions/CodeEditorField.vue.js +17 -0
- package/dist/components/organisms/display-conditions/CodeEditorField.vue2.js +41 -0
- package/dist/components/organisms/display-conditions/DisplayConditionCreateDrawer.vue.js +30 -0
- package/dist/components/organisms/display-conditions/DisplayConditionCreateDrawer.vue2.js +81 -0
- package/dist/components/organisms/display-conditions/DisplayConditionListState.vue.js +17 -0
- package/dist/components/organisms/display-conditions/DisplayConditionListState.vue2.js +45 -0
- package/dist/components/organisms/display-conditions/DisplayConditionSelectDrawer.vue.js +36 -0
- package/dist/components/organisms/display-conditions/DisplayConditionSelectDrawer.vue2.js +63 -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 +31 -20
- package/dist/composables/useDisplayConditions.js +117 -0
- package/dist/composables/useTranslations.js +2 -1
- package/dist/config/compiler/utils/itemsCompilerUtils.js +43 -42
- package/dist/config/compiler/utils/recommendationCompilerUtils.js +67 -64
- package/dist/enums/academy.js +1 -0
- package/dist/enums/display-condition.js +12 -0
- package/dist/extensions/DisplayConditions/bridge.js +25 -0
- package/dist/extensions/DisplayConditions/constants.js +26 -0
- package/dist/extensions/DisplayConditions/control.js +215 -0
- package/dist/extensions/DisplayConditions/display-conditions.css.js +226 -0
- package/dist/extensions/DisplayConditions/extension.js +28 -0
- package/dist/extensions/DisplayConditions/iconsRegistry.js +20 -0
- package/dist/extensions/DisplayConditions/library.js +30 -0
- package/dist/extensions/DisplayConditions/settingsPanel.js +17 -0
- package/dist/extensions/LinkTracking/extension.js +17 -0
- package/dist/extensions/LinkTracking/writer.js +41 -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/package.json.js +6 -6
- 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 +60 -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/DisplayConditionListState.vue.d.ts +18 -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 +18 -0
- package/dist/src/enums/academy.d.ts +1 -0
- package/dist/src/enums/display-condition.d.ts +15 -0
- package/dist/src/extensions/DisplayConditions/bridge.d.ts +7 -0
- package/dist/src/extensions/DisplayConditions/constants.d.ts +23 -0
- package/dist/src/extensions/DisplayConditions/control.d.ts +25 -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/extensions/LinkTracking/extension.d.ts +2 -0
- package/dist/src/extensions/LinkTracking/writer.d.ts +13 -0
- package/dist/src/mock/api/display-conditions.d.ts +2 -0
- package/dist/src/services/displayConditionApi.d.ts +8 -0
- package/dist/src/stores/config.d.ts +167 -0
- package/dist/src/stores/display-condition.d.ts +84 -0
- package/dist/src/utils/displayCondition.d.ts +11 -0
- package/dist/src/utils/linkTrackingIds.d.ts +22 -5
- package/dist/src/utils/protectTableText.d.ts +2 -0
- package/dist/stores/config.js +13 -6
- package/dist/stores/display-condition.js +29 -0
- package/dist/utils/displayCondition.js +26 -0
- package/dist/utils/linkTrackingIds.js +82 -48
- package/dist/utils/pairProductVariables.js +30 -29
- package/dist/utils/protectTableText.js +22 -0
- package/dist/utils/templatePreparation.js +67 -57
- package/package.json +1 -1
|
@@ -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 mt-0 mb-4 f-s-1 f-w-600 l-h-6 l-s-5 t-t-u t-c-55" }, [i._v(" " + i._s(e.trans(`${e.KEY}.select-method`)) + " ")]), t("div", { staticClass: "guido-display-condition-create__methods d-f mb-4" }, [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
|
+
"1d9700d1"
|
|
26
|
+
);
|
|
27
|
+
const f = d.exports;
|
|
28
|
+
export {
|
|
29
|
+
f as default
|
|
30
|
+
};
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { defineComponent as w, reactive as L, ref as c, computed as u, watch as N } from "vue";
|
|
2
|
+
import R from "../../wrappers/WpDrawer.vue.js";
|
|
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
|
+
const Z = /* @__PURE__ */ w({
|
|
10
|
+
__name: "DisplayConditionCreateDrawer",
|
|
11
|
+
setup(K) {
|
|
12
|
+
const n = Y(), p = E(), {
|
|
13
|
+
validate: v,
|
|
14
|
+
notifyInvalid: f,
|
|
15
|
+
createInline: y,
|
|
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
|
+
let d = 0;
|
|
21
|
+
N(() => p.isCreateOpen, (a) => {
|
|
22
|
+
if (d += 1, !a)
|
|
23
|
+
return;
|
|
24
|
+
const { editing: t } = p;
|
|
25
|
+
Object.assign(e, t ? {
|
|
26
|
+
name: t.name,
|
|
27
|
+
description: t.description,
|
|
28
|
+
codeBefore: t.beforeScript,
|
|
29
|
+
codeAfter: t.afterScript
|
|
30
|
+
} : m()), o.value = {}, r.value = !1;
|
|
31
|
+
}, { immediate: !0 });
|
|
32
|
+
const C = u(() => B("create-description")), D = u(() => ({
|
|
33
|
+
cancelOrBackButton: {
|
|
34
|
+
styling: "ghost",
|
|
35
|
+
type: "secondary",
|
|
36
|
+
labelText: n(`${i}.cancel`),
|
|
37
|
+
disabledStatus: s.value
|
|
38
|
+
},
|
|
39
|
+
secondaryButton: {
|
|
40
|
+
styling: "solid",
|
|
41
|
+
type: "subtle-primary",
|
|
42
|
+
labelText: n(`${i}.create-and-save`),
|
|
43
|
+
loadingStatus: r.value
|
|
44
|
+
},
|
|
45
|
+
primaryButton: {
|
|
46
|
+
styling: "solid",
|
|
47
|
+
type: "primary",
|
|
48
|
+
labelText: n(`${i}.create`),
|
|
49
|
+
disabledStatus: s.value
|
|
50
|
+
}
|
|
51
|
+
})), O = (a, t) => {
|
|
52
|
+
t !== e[a] && (e[a] = t, o.value[a] && (o.value = { ...o.value, [a]: void 0 }));
|
|
53
|
+
}, T = u(() => `${n(`${i}.condition-description`)} <span class="guido-display-condition-create__optional t-c-53">(${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
|
+
var S, A;
|
|
56
|
+
if (s.value)
|
|
57
|
+
return;
|
|
58
|
+
const t = d;
|
|
59
|
+
l.value = !0;
|
|
60
|
+
const [$, x] = await Promise.all([(S = g.value) == null ? void 0 : S.read(), (A = I.value) == null ? void 0 : A.read()]);
|
|
61
|
+
if (l.value = !1, t !== d)
|
|
62
|
+
return;
|
|
63
|
+
if (e.codeBefore = $ ?? e.codeBefore, e.codeAfter = x ?? e.codeAfter, o.value = v(e), Object.keys(o.value).length) {
|
|
64
|
+
f();
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
if (a === "inline") {
|
|
68
|
+
y({ ...e });
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
r.value = !0;
|
|
72
|
+
const h = await _({ ...e });
|
|
73
|
+
r.value = !1, o.value = h ?? {}, Object.keys(o.value).length && f();
|
|
74
|
+
}, close: () => {
|
|
75
|
+
s.value || b();
|
|
76
|
+
}, WpDrawer: R, KEY: i, DISPLAY_CONDITION_LIMITS: j, InBasicTextInput: F, InRadioButton: P, CodeEditorField: G };
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
export {
|
|
80
|
+
Z as default
|
|
81
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import n from "./DisplayConditionListState.vue2.js";
|
|
2
|
+
import o from "../../../_virtual/_plugin-vue2_normalizer.js";
|
|
3
|
+
var s = function() {
|
|
4
|
+
var e = this, i = e._self._c, t = e._self._setupProxy;
|
|
5
|
+
return i(t.InNoData, { staticClass: "d-f f-d-c j-c-c f-g-1", attrs: { id: t.view.id, "button-status": !!t.view.buttonText, "button-text": t.view.buttonText, description: t.view.description, icon: t.view.icon, title: t.view.title }, on: { click: t.onClick } });
|
|
6
|
+
}, r = [], c = /* @__PURE__ */ o(
|
|
7
|
+
n,
|
|
8
|
+
s,
|
|
9
|
+
r,
|
|
10
|
+
!1,
|
|
11
|
+
null,
|
|
12
|
+
null
|
|
13
|
+
);
|
|
14
|
+
const f = c.exports;
|
|
15
|
+
export {
|
|
16
|
+
f as default
|
|
17
|
+
};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { defineComponent as s, computed as a } from "vue";
|
|
2
|
+
import { DISPLAY_CONDITIONS_TRANS_KEY as e } from "../../../composables/useDisplayConditions.js";
|
|
3
|
+
import { useTranslations as c } from "../../../composables/useTranslations.js";
|
|
4
|
+
import { InNoData as p } from "@useinsider/design-system-vue";
|
|
5
|
+
const y = /* @__PURE__ */ s({
|
|
6
|
+
__name: "DisplayConditionListState",
|
|
7
|
+
props: {
|
|
8
|
+
state: null
|
|
9
|
+
},
|
|
10
|
+
emits: ["retry", "create"],
|
|
11
|
+
setup(i, { emit: r }) {
|
|
12
|
+
const o = i, t = c(), n = a(() => {
|
|
13
|
+
switch (o.state) {
|
|
14
|
+
case "error":
|
|
15
|
+
return {
|
|
16
|
+
id: "guido__display-condition-error",
|
|
17
|
+
icon: "no-data",
|
|
18
|
+
title: t(`${e}.error-load-title`),
|
|
19
|
+
description: t(`${e}.error-load`),
|
|
20
|
+
buttonText: t(`${e}.retry`)
|
|
21
|
+
};
|
|
22
|
+
case "empty":
|
|
23
|
+
return {
|
|
24
|
+
id: "guido__display-condition-empty",
|
|
25
|
+
icon: "no-personalization",
|
|
26
|
+
title: t(`${e}.empty-title`),
|
|
27
|
+
description: t(`${e}.empty-description`),
|
|
28
|
+
buttonText: t(`${e}.create-new`)
|
|
29
|
+
};
|
|
30
|
+
default:
|
|
31
|
+
return {
|
|
32
|
+
id: "guido__display-condition-no-result",
|
|
33
|
+
icon: "no-data",
|
|
34
|
+
title: t(`${e}.no-result`)
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
return { __sfc: !0, props: o, emit: r, trans: t, view: n, onClick: () => {
|
|
39
|
+
o.state === "error" ? r("retry") : o.state === "empty" && r("create");
|
|
40
|
+
}, InNoData: p };
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
export {
|
|
44
|
+
y as default
|
|
45
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import o from "./DisplayConditionSelectDrawer.vue2.js";
|
|
2
|
+
/* empty css */
|
|
3
|
+
import d from "../../../_virtual/_plugin-vue2_normalizer.js";
|
|
4
|
+
var a = function() {
|
|
5
|
+
var s = this, e = s._self._c, t = s._self._setupProxy;
|
|
6
|
+
return e("div", { staticClass: "guido-display-condition-select-root" }, [e(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 } }, [e("div", { staticClass: "guido-display-condition-select d-f f-d-c f-g-1" }, [t.store.listStatus === "loaded" && t.store.list.length ? e(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(i) {
|
|
7
|
+
t.search = i;
|
|
8
|
+
} } }) : s._e(), t.store.listStatus === "loading" || t.store.listStatus === "idle" ? e("div", { staticClass: "guido-display-condition-select__list", attrs: { "data-testid": "display-condition-loading" } }, s._l(t.SKELETON_HEIGHTS, function(i, n) {
|
|
9
|
+
return e(t.InSkeleton, { key: n, attrs: { sizing: { width: 856, height: i } } });
|
|
10
|
+
}), 1) : t.listState ? e(t.DisplayConditionListState, { attrs: { state: t.listState }, on: { create: function(i) {
|
|
11
|
+
return t.store.openCreate();
|
|
12
|
+
}, retry: t.loadList } }) : e("ul", { staticClass: "guido-display-condition-select__list" }, s._l(t.filteredList, function(i) {
|
|
13
|
+
return e("li", { key: i.id, staticClass: "guido-display-condition-card bor-w-1 bor-s-s bor-c-50 bor-r-1 b-c-4", attrs: { "data-condition-id": i.id } }, [e("div", { staticClass: "guido-display-condition-card__header" }, [e("div", { staticClass: "guido-display-condition-card__text" }, [e("p", { staticClass: "guido-display-condition-card__name m-0 f-s-13 f-w-600 l-h-2 t-c-55" }, [s._v(" " + s._s(i.name) + " ")]), i.description ? e("p", { staticClass: "guido-display-condition-card__description mt-1 mb-0 f-s-1 l-h-1 t-c-53" }, [s._v(" " + s._s(i.description) + " ")]) : s._e()]), e("div", { staticClass: "guido-display-condition-card__actions" }, [e("div", { staticClass: "guido-display-condition-card__split" }, [e(t.InButtonV2, { attrs: { id: `guido__display-condition-select-${i.id}`, type: "subtle-primary", "label-text": t.trans(`${t.KEY}.select`) }, on: { click: function(n) {
|
|
14
|
+
return t.select(i);
|
|
15
|
+
} } }), e(t.InButtonV2, { attrs: { id: `guido__display-condition-menu-${i.id}`, "left-icon": "filled-dropdown-down", type: "subtle-primary", "label-text-status": !1 }, on: { click: function(n) {
|
|
16
|
+
return t.toggleMenu(i);
|
|
17
|
+
} } }), e(t.InDropdownMenu, { staticClass: "guido-display-condition-card__menu", attrs: { id: `guido__display-condition-menu-list-${i.id}`, "box-width": "basedOnLongestItem", "static-position": "bottom right", "dynamic-position": !1, options: t.menuOptions(i), "select-all-option-status": !1, status: t.menuId === i.id }, on: { clickOutside: function(n) {
|
|
18
|
+
return t.closeMenu(i);
|
|
19
|
+
}, optionClick: function(n) {
|
|
20
|
+
return t.requestDelete(i);
|
|
21
|
+
} } })], 1), e("span", { staticClass: "guido-display-condition-card__divider" }), e(t.InButtonV2, { attrs: { id: `guido__display-condition-expand-${i.id}`, styling: "text", type: "secondary", "label-text-status": !1, "left-icon": t.expandedId === i.id ? "filled-dropdown-up" : "filled-dropdown-down", "selected-status": t.expandedId === i.id, "tooltip-options": t.expandTooltip(i), "tooltip-text": t.trans(`${t.KEY}.preview`) }, on: { click: function(n) {
|
|
22
|
+
return t.toggleExpanded(i);
|
|
23
|
+
} } })], 1)]), t.expandedId === i.id ? e("pre", { staticClass: "guido-display-condition-card__code bor-w-1 bor-s-s bor-c-50 bor-r-1 b-c-4 f-s-2 l-h-2" }, [s._v(s._s(t.codeOf(i)))]) : s._e()]);
|
|
24
|
+
}), 0)], 1)]), t.store.pendingDelete ? e("div", { staticClass: "guido-display-condition-select__delete-modal" }, [e(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 } }, [e("p", { staticClass: "guido-display-condition-select__delete-text m-0 t-c-55" }, [s._v(" " + s._s(t.trans(`${t.KEY}.delete-confirm-description`, { name: t.store.pendingDelete.name })) + " ")])])], 1) : s._e()], 1);
|
|
25
|
+
}, l = [], c = /* @__PURE__ */ d(
|
|
26
|
+
o,
|
|
27
|
+
a,
|
|
28
|
+
l,
|
|
29
|
+
!1,
|
|
30
|
+
null,
|
|
31
|
+
"62c5ac25"
|
|
32
|
+
);
|
|
33
|
+
const f = c.exports;
|
|
34
|
+
export {
|
|
35
|
+
f as default
|
|
36
|
+
};
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { defineComponent as T, ref as r, watch as I, computed as i } from "vue";
|
|
2
|
+
import O from "../../wrappers/WpDrawer.vue.js";
|
|
3
|
+
import B from "../../wrappers/WpModal.vue.js";
|
|
4
|
+
import { useDisplayConditions as L, DISPLAY_CONDITIONS_TRANS_KEY as s } from "../../../composables/useDisplayConditions.js";
|
|
5
|
+
import { useTranslations as M } from "../../../composables/useTranslations.js";
|
|
6
|
+
import { useDisplayConditionStore as h } from "../../../stores/display-condition.js";
|
|
7
|
+
import { getTooltipOptions as C } from "../../../utils/tooltipUtils.js";
|
|
8
|
+
import { InSkeleton as $, InDropdownMenu as E, InButtonV2 as b, InBasicTextInput as k } from "@useinsider/design-system-vue";
|
|
9
|
+
import w from "./DisplayConditionListState.vue.js";
|
|
10
|
+
const ee = /* @__PURE__ */ T({
|
|
11
|
+
__name: "DisplayConditionSelectDrawer",
|
|
12
|
+
setup(A) {
|
|
13
|
+
const g = [40, 76, 76, 76], l = M(), t = h(), { loadList: c, select: v, deleteSaved: d, cancel: D, describeWithAcademyLink: p } = L(), u = r(""), a = r(null), n = r(null), o = r(!1);
|
|
14
|
+
I(() => t.isSelectOpen, (e) => {
|
|
15
|
+
e && (u.value = "", a.value = null, n.value = null, c());
|
|
16
|
+
}, { immediate: !0 });
|
|
17
|
+
const f = i(() => {
|
|
18
|
+
const e = u.value.trim().toLocaleLowerCase();
|
|
19
|
+
return e ? t.list.filter((m) => `${m.name} ${m.description}`.toLocaleLowerCase().includes(e)) : t.list;
|
|
20
|
+
}), y = i(() => t.listStatus === "error" ? "error" : t.list.length ? f.value.length ? null : "no-result" : "empty"), _ = i(() => p("select-description")), S = i(() => ({
|
|
21
|
+
cancelOrBackButton: {
|
|
22
|
+
styling: "ghost",
|
|
23
|
+
type: "secondary",
|
|
24
|
+
labelText: l(`${s}.back`),
|
|
25
|
+
leftIcon: "line-arrow-left"
|
|
26
|
+
}
|
|
27
|
+
})), x = i(() => ({
|
|
28
|
+
cancelOrBackButton: {
|
|
29
|
+
type: "secondary",
|
|
30
|
+
styling: "ghost",
|
|
31
|
+
labelText: l(`${s}.cancel`),
|
|
32
|
+
disabledStatus: o.value
|
|
33
|
+
},
|
|
34
|
+
primaryButton: {
|
|
35
|
+
type: "danger",
|
|
36
|
+
labelText: l(`${s}.delete`),
|
|
37
|
+
loadingStatus: o.value
|
|
38
|
+
}
|
|
39
|
+
}));
|
|
40
|
+
return { __sfc: !0, SKELETON_HEIGHTS: g, trans: l, store: t, loadList: c, select: v, deleteSaved: d, cancel: D, describeWithAcademyLink: p, search: u, expandedId: a, menuId: n, isDeleting: o, filteredList: f, listState: y, descriptionText: _, footerButtonGroupOptions: S, deleteModalButtons: x, toggleExpanded: (e) => {
|
|
41
|
+
a.value = a.value === e.id ? null : e.id;
|
|
42
|
+
}, toggleMenu: (e) => {
|
|
43
|
+
n.value = n.value === e.id ? null : e.id;
|
|
44
|
+
}, closeMenu: (e) => {
|
|
45
|
+
n.value === e.id && (n.value = null);
|
|
46
|
+
}, expandTooltip: (e) => C(
|
|
47
|
+
`guido__display-condition-expand-tooltip-${e.id}`,
|
|
48
|
+
{ staticPosition: "top right" }
|
|
49
|
+
), menuOptions: (e) => [
|
|
50
|
+
{ text: l(`${s}.delete`), value: `guido__display-condition-delete-${e.id}` }
|
|
51
|
+
], requestDelete: (e) => {
|
|
52
|
+
n.value = null, t.pendingDelete = e;
|
|
53
|
+
}, confirmDelete: async () => {
|
|
54
|
+
!t.pendingDelete || o.value || (o.value = !0, await d(t.pendingDelete), o.value = !1);
|
|
55
|
+
}, closeDeleteModal: () => {
|
|
56
|
+
o.value || (t.pendingDelete = null);
|
|
57
|
+
}, codeOf: (e) => [e.codeBefore, e.codeAfter].filter(Boolean).join(`
|
|
58
|
+
`), WpDrawer: O, WpModal: B, KEY: s, InBasicTextInput: k, InButtonV2: b, InDropdownMenu: E, InSkeleton: $, DisplayConditionListState: w };
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
export {
|
|
62
|
+
ee as default
|
|
63
|
+
};
|
|
@@ -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
|
|
2
|
-
import
|
|
3
|
-
|
|
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
|
-
},
|
|
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
|
-
},
|
|
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 =
|
|
31
|
+
const e = c[o];
|
|
31
32
|
e && (t[e] = !1);
|
|
32
33
|
}), t;
|
|
33
|
-
},
|
|
34
|
-
const
|
|
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
|
|
37
|
-
const
|
|
38
|
-
n.map(async (
|
|
39
|
-
const
|
|
40
|
-
return
|
|
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
|
-
...
|
|
45
|
-
...
|
|
52
|
+
...o,
|
|
53
|
+
...e.filter((i) => i !== null)
|
|
46
54
|
];
|
|
47
|
-
},
|
|
48
|
-
const n =
|
|
55
|
+
}, g = () => {
|
|
56
|
+
const n = r();
|
|
49
57
|
return {
|
|
50
58
|
getStripoBlocksConfig: async () => {
|
|
51
59
|
const o = n.blocks;
|
|
52
60
|
return {
|
|
53
|
-
baseBlocks:
|
|
54
|
-
extensions: await
|
|
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
|
-
|
|
71
|
+
g as useBlocksConfig
|
|
61
72
|
};
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { useToaster as M } 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 y, DISPLAY_CONDITION_LIMITS as s, DisplayConditionEvent as I } 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 P } from "../stores/display-condition.js";
|
|
9
|
+
import { findInvalidCodeFields as Y, nextConditionId as w } from "../utils/displayCondition.js";
|
|
10
|
+
import { escapeHtml as R } from "../utils/htmlEscape.js";
|
|
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
|
+
name: n.name.trim(),
|
|
15
|
+
description: n.description.trim(),
|
|
16
|
+
beforeScript: n.codeBefore,
|
|
17
|
+
afterScript: n.codeAfter,
|
|
18
|
+
extraData: JSON.stringify(r === void 0 ? { source: m } : { source: m, savedId: r })
|
|
19
|
+
}), v = (n) => ({
|
|
20
|
+
name: n.name,
|
|
21
|
+
description: n.description,
|
|
22
|
+
codeBefore: n.codeBefore,
|
|
23
|
+
codeAfter: n.codeAfter
|
|
24
|
+
}), ne = () => {
|
|
25
|
+
const n = P(), m = q(), r = O(), o = x(), { showToaster: p } = M(), u = B(() => {
|
|
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(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
|
+
if (e.mode === "select") {
|
|
35
|
+
n.openSelect();
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
n.openCreate(e.mode === "edit" ? e.current : null);
|
|
39
|
+
}, $ = async () => {
|
|
40
|
+
const e = ++n.listRequest;
|
|
41
|
+
n.listStatus = "loading";
|
|
42
|
+
try {
|
|
43
|
+
const t = await r.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
|
+
}, h = (e) => {
|
|
49
|
+
const t = {}, d = e.name.trim();
|
|
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
|
+
e.description.trim().length > C && (t.description = o(`${i}.error-description-max`, { max: C }));
|
|
53
|
+
const g = Y(e.codeBefore, e.codeAfter, u.value);
|
|
54
|
+
return ["codeBefore", "codeAfter"].forEach((a) => {
|
|
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
|
+
}), t;
|
|
57
|
+
}, A = (e, t) => {
|
|
58
|
+
p(e ? { type: l.Success, message: t } : { type: l.Error, message: o("products.something-went-wrong") });
|
|
59
|
+
}, T = (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
|
+
), _ = () => {
|
|
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: N,
|
|
72
|
+
cancel: D,
|
|
73
|
+
loadList: $,
|
|
74
|
+
validate: h,
|
|
75
|
+
notifyInvalid: _,
|
|
76
|
+
describeWithAcademyLink: T,
|
|
77
|
+
createInline: (e) => {
|
|
78
|
+
A(
|
|
79
|
+
f(S(e, y.INLINE)),
|
|
80
|
+
o(`${i}.created`, c(e.name.trim()))
|
|
81
|
+
);
|
|
82
|
+
},
|
|
83
|
+
createAndSave: async (e) => {
|
|
84
|
+
try {
|
|
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
|
+
o(`${i}.created-and-saved`, c(t.name))
|
|
89
|
+
), {};
|
|
90
|
+
} catch (t) {
|
|
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
|
+
}
|
|
93
|
+
},
|
|
94
|
+
select: (e) => {
|
|
95
|
+
A(
|
|
96
|
+
f(S(v(e), y.SAVED, e.id)),
|
|
97
|
+
o(`${i}.applied`, c(e.name))
|
|
98
|
+
);
|
|
99
|
+
},
|
|
100
|
+
deleteSaved: async (e) => {
|
|
101
|
+
try {
|
|
102
|
+
await r.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
|
+
X as DISPLAY_CONDITIONS_TRANS_KEY,
|
|
116
|
+
ne as useDisplayConditions
|
|
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
|
};
|