@useinsider/guido 3.21.2-beta.cfc5be2 → 3.21.2-beta.eea8885

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 (58) hide show
  1. package/README.md +0 -1
  2. package/dist/@types/config/schemas.js +39 -41
  3. package/dist/components/Guido.vue.js +6 -6
  4. package/dist/components/Guido.vue2.js +79 -81
  5. package/dist/composables/useBlocksConfig.js +24 -32
  6. package/dist/enums/academy.js +0 -1
  7. package/dist/guido.css +1 -1
  8. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js +92 -93
  9. package/dist/node_modules/valibot/dist/index.js +261 -297
  10. package/dist/src/@types/config/schemas.d.ts +0 -4
  11. package/dist/src/composables/useConfig.d.ts +0 -2
  12. package/dist/src/enums/academy.d.ts +0 -1
  13. package/dist/src/stores/config.d.ts +0 -166
  14. package/dist/stores/config.js +6 -13
  15. package/dist/utils/pairProductVariables.js +98 -91
  16. package/package.json +1 -1
  17. package/dist/@types/display-condition.js +0 -25
  18. package/dist/components/organisms/display-conditions/CodeEditorField.vue.js +0 -20
  19. package/dist/components/organisms/display-conditions/CodeEditorField.vue2.js +0 -30
  20. package/dist/components/organisms/display-conditions/DisplayConditionCreateDrawer.vue.js +0 -30
  21. package/dist/components/organisms/display-conditions/DisplayConditionCreateDrawer.vue2.js +0 -71
  22. package/dist/components/organisms/display-conditions/DisplayConditionSelectDrawer.vue.js +0 -34
  23. package/dist/components/organisms/display-conditions/DisplayConditionSelectDrawer.vue2.js +0 -57
  24. package/dist/components/organisms/display-conditions/DisplayConditionsHost.vue.js +0 -17
  25. package/dist/components/organisms/display-conditions/DisplayConditionsHost.vue2.js +0 -22
  26. package/dist/composables/useDisplayConditions.js +0 -102
  27. package/dist/enums/display-condition.js +0 -12
  28. package/dist/extensions/DisplayConditions/bridge.js +0 -17
  29. package/dist/extensions/DisplayConditions/constants.js +0 -17
  30. package/dist/extensions/DisplayConditions/control.js +0 -178
  31. package/dist/extensions/DisplayConditions/display-conditions.css.js +0 -201
  32. package/dist/extensions/DisplayConditions/extension.js +0 -28
  33. package/dist/extensions/DisplayConditions/iconsRegistry.js +0 -20
  34. package/dist/extensions/DisplayConditions/library.js +0 -27
  35. package/dist/extensions/DisplayConditions/settingsPanel.js +0 -17
  36. package/dist/services/displayConditionApi.js +0 -39
  37. package/dist/src/@types/display-condition.d.ts +0 -59
  38. package/dist/src/components/organisms/display-conditions/CodeEditorField.vue.d.ts +0 -43
  39. package/dist/src/components/organisms/display-conditions/DisplayConditionCreateDrawer.vue.d.ts +0 -2
  40. package/dist/src/components/organisms/display-conditions/DisplayConditionSelectDrawer.vue.d.ts +0 -2
  41. package/dist/src/components/organisms/display-conditions/DisplayConditionsHost.vue.d.ts +0 -2
  42. package/dist/src/composables/useDisplayConditions.d.ts +0 -16
  43. package/dist/src/enums/display-condition.d.ts +0 -15
  44. package/dist/src/extensions/DisplayConditions/bridge.d.ts +0 -6
  45. package/dist/src/extensions/DisplayConditions/constants.d.ts +0 -14
  46. package/dist/src/extensions/DisplayConditions/control.d.ts +0 -23
  47. package/dist/src/extensions/DisplayConditions/extension.d.ts +0 -2
  48. package/dist/src/extensions/DisplayConditions/iconsRegistry.d.ts +0 -4
  49. package/dist/src/extensions/DisplayConditions/library.d.ts +0 -8
  50. package/dist/src/extensions/DisplayConditions/settingsPanel.d.ts +0 -5
  51. package/dist/src/mock/api/display-conditions.d.ts +0 -2
  52. package/dist/src/services/displayConditionApi.d.ts +0 -8
  53. package/dist/src/stores/display-condition.d.ts +0 -81
  54. package/dist/src/utils/displayCondition.d.ts +0 -10
  55. package/dist/src/utils/protectTableText.d.ts +0 -2
  56. package/dist/stores/display-condition.js +0 -28
  57. package/dist/utils/displayCondition.js +0 -26
  58. package/dist/utils/protectTableText.js +0 -22
@@ -1,25 +0,0 @@
1
- import { object as e, optional as a, string as o, nullish as i, number as t, picklist as n, array as c } from "../node_modules/valibot/dist/index.js";
2
- const s = n(["liquid", "pongo"]), d = n(["codeOnly", "logicBuilder"]), r = e({
3
- id: t(),
4
- name: o(),
5
- description: i(o(), ""),
6
- syntax: s,
7
- method: d,
8
- codeBefore: o(),
9
- codeAfter: i(o(), ""),
10
- createdAt: a(o())
11
- }), p = e({
12
- data: c(r),
13
- meta: e({
14
- totalCount: t(),
15
- perPage: t(),
16
- currentPage: t(),
17
- lastPage: t()
18
- })
19
- });
20
- export {
21
- p as DisplayConditionListResponseSchema,
22
- d as DisplayConditionMethodSchema,
23
- s as DisplayConditionSyntaxSchema,
24
- r as SavedDisplayConditionSchema
25
- };
@@ -1,20 +0,0 @@
1
- import i from "./CodeEditorField.vue2.js";
2
- /* empty css */
3
- import s from "../../../_virtual/_plugin-vue2_normalizer.js";
4
- var a = function() {
5
- var e = this, r = e._self._c, o = e._self._setupProxy;
6
- return r("div", { staticClass: "guido-code-editor-field", attrs: { id: e.id } }, [r("p", { staticClass: "guido-code-editor-field__label" }, [e._v(" " + e._s(e.label) + " ")]), r(o.InCodeSnippet, { attrs: { code: e.value, disable: e.disabled, "focus-editor": !1, invalid: !!e.error, "invalid-message": e.error, options: o.options, size: { height: e.error ? 196 : 216 }, "syntax-check": !1 }, on: { input: function(t) {
7
- return o.emit("input", t);
8
- }, ready: o.onReady } })], 1);
9
- }, n = [], d = /* @__PURE__ */ s(
10
- i,
11
- a,
12
- n,
13
- !1,
14
- null,
15
- "e96c7aa3"
16
- );
17
- const p = d.exports;
18
- export {
19
- p as default
20
- };
@@ -1,30 +0,0 @@
1
- import { defineComponent as s, computed as u } from "vue";
2
- import { InCodeSnippet as i } from "@useinsider/design-system-vue";
3
- const m = /* @__PURE__ */ s({
4
- __name: "CodeEditorField",
5
- props: {
6
- id: null,
7
- label: null,
8
- value: null,
9
- placeholder: { default: "" },
10
- error: { default: "" },
11
- disabled: { type: Boolean, default: !1 }
12
- },
13
- emits: ["input"],
14
- setup(t, { expose: n, emit: d }) {
15
- const l = t;
16
- let e = null;
17
- const a = u(() => ({
18
- mode: "liquid",
19
- lint: !1,
20
- foldGutter: !1,
21
- placeholder: l.placeholder
22
- })), r = (p) => {
23
- e = p;
24
- }, o = () => (e == null ? void 0 : e.state.doc.toString()) ?? l.value;
25
- return n({ read: o }), { __sfc: !0, props: l, emit: d, view: e, options: a, onReady: r, read: o, InCodeSnippet: i };
26
- }
27
- });
28
- export {
29
- m as default
30
- };
@@ -1,30 +0,0 @@
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
- "a4b2ccb9"
26
- );
27
- const f = d.exports;
28
- export {
29
- f as default
30
- };
@@ -1,71 +0,0 @@
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 r = "email-editor.display-conditions", i = 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, (n) => {
15
- if (!n)
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(() => i(`${r}.create-description`, {
26
- academyLink: `<a href="${x.EMAIL_DISPLAY_CONDITIONS}" class="guido-display-condition-academy" target="_blank">${i(`${r}.academy`)}</a>`
27
- })), S = u(() => ({
28
- cancelOrBackButton: {
29
- styling: "ghost",
30
- type: "secondary",
31
- labelText: i(`${r}.cancel`),
32
- disabledStatus: a.value
33
- },
34
- secondaryButton: {
35
- styling: "solid",
36
- type: "subtle-primary",
37
- labelText: i(`${r}.create-and-save`),
38
- loadingStatus: a.value
39
- },
40
- primaryButton: {
41
- styling: "solid",
42
- type: "primary",
43
- labelText: i(`${r}.create`),
44
- disabledStatus: a.value
45
- }
46
- })), B = (n, t) => {
47
- t !== e[n] && (e[n] = t, o.value[n] && (o.value = { ...o.value, [n]: void 0 }));
48
- }, A = u(() => `${i(`${r}.condition-description`)} <span class="guido-display-condition-create__optional">(${i(`${r}.optional`)})</span>`);
49
- return { __sfc: !0, KEY: r, trans: i, 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 (n) => {
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), Object.keys(o.value).length) {
54
- l();
55
- return;
56
- }
57
- if (n === "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
- };
@@ -1,34 +0,0 @@
1
- import a from "./DisplayConditionSelectDrawer.vue2.js";
2
- /* empty css */
3
- import o from "../../../_virtual/_plugin-vue2_normalizer.js";
4
- var d = 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" }, [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, { 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, { 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-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__ */ o(
24
- a,
25
- d,
26
- l,
27
- !1,
28
- null,
29
- "10ac7a13"
30
- );
31
- const y = c.exports;
32
- export {
33
- y as default
34
- };
@@ -1,57 +0,0 @@
1
- import { defineComponent as _, ref as i, watch as S, computed as c } from "vue";
2
- import B from "../../wrappers/WpDrawer.vue.js";
3
- import L from "../../wrappers/WpModal.vue.js";
4
- import { useDisplayConditions as x } from "../../../composables/useDisplayConditions.js";
5
- import { useTranslations as O } from "../../../composables/useTranslations.js";
6
- import { ACADEMY_LINKS as T } from "../../../enums/academy.js";
7
- import { useDisplayConditionStore as $ } from "../../../stores/display-condition.js";
8
- import { InSkeleton as C, InNoData as E, InIcons as M, InButtonV2 as b, InBasicTextInput as k } from "@useinsider/design-system-vue";
9
- const J = /* @__PURE__ */ _({
10
- __name: "DisplayConditionSelectDrawer",
11
- setup(h) {
12
- const o = "email-editor.display-conditions", m = [40, 76, 76, 76], l = O(), t = $(), { loadList: d, select: f, deleteSaved: u, cancel: g } = x(), r = i(""), s = i(null), a = i(null), n = i(!1);
13
- S(() => t.isSelectOpen, (e) => {
14
- e && (r.value = "", s.value = null, a.value = null, d());
15
- }, { immediate: !0 });
16
- const D = c(() => {
17
- const e = r.value.trim().toLocaleLowerCase();
18
- return e ? t.list.filter((p) => `${p.name} ${p.description}`.toLocaleLowerCase().includes(e)) : t.list;
19
- }), v = c(() => l(`${o}.select-description`, {
20
- academyLink: `<a href="${T.EMAIL_DISPLAY_CONDITIONS}" class="guido-display-condition-academy" target="_blank">${l(`${o}.academy`)}</a>`
21
- })), y = c(() => ({
22
- cancelOrBackButton: {
23
- styling: "ghost",
24
- type: "secondary",
25
- labelText: l(`${o}.back`),
26
- leftIcon: "line-arrow-left"
27
- }
28
- })), I = c(() => ({
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, SKELETON_HEIGHTS: m, trans: l, store: t, loadList: d, select: f, deleteSaved: u, cancel: g, search: r, expandedId: s, menuId: a, isDeleting: n, filteredList: D, descriptionText: v, footerButtonGroupOptions: y, deleteModalButtons: I, 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: M, InNoData: E, InSkeleton: C };
53
- }
54
- });
55
- export {
56
- J as default
57
- };
@@ -1,17 +0,0 @@
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
- };
@@ -1,22 +0,0 @@
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,102 +0,0 @@
1
- import { useToaster as T } from "./useToaster.js";
2
- import { useTranslations as x } from "./useTranslations.js";
3
- import { DISPLAY_CONDITION_LIMITS as s, DisplayConditionEvent as S } from "../enums/display-condition.js";
4
- import { ToasterTypeOptions as d } from "../enums/toaster.js";
5
- import { useDisplayConditionApi as M } from "../services/displayConditionApi.js";
6
- import { useConfigStore as N } from "../stores/config.js";
7
- import { useDisplayConditionStore as _ } from "../stores/display-condition.js";
8
- import { findInvalidCodeFields as O, nextConditionId as L } from "../utils/displayCondition.js";
9
- import { escapeHtml as B } from "../utils/htmlEscape.js";
10
- import { computed as P } from "vue";
11
- const i = "email-editor.display-conditions", X = 409, y = (n, p, r) => ({
12
- id: L(),
13
- name: n.name.trim(),
14
- description: n.description.trim(),
15
- beforeScript: n.codeBefore,
16
- afterScript: n.codeAfter,
17
- extraData: JSON.stringify(r === void 0 ? { source: p } : { source: p, savedId: r })
18
- }), C = (n) => ({
19
- name: n.name,
20
- description: n.description,
21
- codeBefore: n.codeBefore,
22
- codeAfter: n.codeAfter
23
- }), U = () => {
24
- const n = _(), p = N(), r = M(), o = x(), { showToaster: a } = T(), u = P(() => {
25
- var e;
26
- return (e = p.features) != null && e.liquidSyntax ? "liquid" : "pongo";
27
- }), f = (e) => {
28
- const t = { condition: e };
29
- document.dispatchEvent(new CustomEvent(S.APPLY, { detail: t })), n.close();
30
- }, E = () => {
31
- n.view !== "none" && (document.dispatchEvent(new CustomEvent(S.CANCEL)), n.close());
32
- }, $ = (e) => {
33
- if (e.mode === "select") {
34
- n.openSelect();
35
- return;
36
- }
37
- n.openCreate(e.mode === "edit" ? e.current : null);
38
- }, g = async () => {
39
- n.listStatus = "loading";
40
- try {
41
- n.list = await r.list(u.value), n.listStatus = "loaded";
42
- } catch (e) {
43
- console.warn("Display conditions could not be loaded.", e), n.listStatus = "error";
44
- }
45
- }, h = (e) => {
46
- const t = {}, m = e.name.trim();
47
- m ? m.length < s.NAME_MIN ? t.name = o(`${i}.error-name-min`, { min: s.NAME_MIN }) : m.length > s.NAME_MAX && (t.name = o(`${i}.error-name-max`, { max: s.NAME_MAX })) : t.name = o(`${i}.error-name-required`);
48
- const { DESCRIPTION_MAX: A } = s;
49
- e.description.trim().length > A && (t.description = o(`${i}.error-description-max`, { max: A }));
50
- const D = O(e.codeBefore, e.codeAfter);
51
- return ["codeBefore", "codeAfter"].forEach((c) => {
52
- e[c].trim() ? D.includes(c) ? t[c] = o(`${i}.error-code-invalid`) : e[c].length > s.CODE_MAX && (t[c] = o(`${i}.error-code-max`, { max: s.CODE_MAX })) : t[c] = o(`${i}.error-code-required`);
53
- }), t;
54
- }, I = () => {
55
- a({ type: d.Error, message: o(`${i}.validation-failed`) });
56
- }, l = (e) => ({ name: B(e) }), v = (e, t) => {
57
- e != null && e.authReported || (console.warn(t, e), a({ type: d.Error, message: t }));
58
- };
59
- return {
60
- syntax: u,
61
- handleOpen: $,
62
- cancel: E,
63
- loadList: g,
64
- validate: h,
65
- notifyInvalid: I,
66
- createInline: (e) => {
67
- f(y(e, "inline")), a({
68
- type: d.Success,
69
- message: o(`${i}.created`, l(e.name.trim()))
70
- });
71
- },
72
- createAndSave: async (e) => {
73
- try {
74
- const t = await r.create(e, u.value);
75
- return n.list = [t, ...n.list.filter((m) => m.id !== t.id)], f(y(C(t), "saved", t.id)), a({
76
- type: d.Success,
77
- message: o(`${i}.created-and-saved`, l(t.name))
78
- }), {};
79
- } catch (t) {
80
- return (t == null ? void 0 : t.status) === X ? { name: o(`${i}.error-name-exists`) } : (v(t, o(`${i}.save-failed`, l(e.name.trim()))), null);
81
- }
82
- },
83
- select: (e) => {
84
- f(y(C(e), "saved", e.id)), a({ type: d.Success, message: o(`${i}.applied`, l(e.name)) });
85
- },
86
- deleteSaved: async (e) => {
87
- try {
88
- await r.remove(e.id), n.list = n.list.filter((t) => t.id !== e.id), a({
89
- type: d.Success,
90
- message: o(`${i}.deleted`, l(e.name))
91
- });
92
- } catch (t) {
93
- v(t, o(`${i}.delete-failed`));
94
- } finally {
95
- n.pendingDelete = null;
96
- }
97
- }
98
- };
99
- };
100
- export {
101
- U as useDisplayConditions
102
- };
@@ -1,12 +0,0 @@
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
- };
@@ -1,17 +0,0 @@
1
- import { DisplayConditionEvent as e } from "../../enums/display-condition.js";
2
- let n = null;
3
- const p = (E, t) => {
4
- n == null || n();
5
- const i = (o) => {
6
- n == null || n(), t.onApply(o.detail.condition);
7
- }, m = () => {
8
- var o;
9
- n == null || n(), (o = t.onCancel) == null || o.call(t);
10
- };
11
- document.addEventListener(e.APPLY, i), document.addEventListener(e.CANCEL, m), n = () => {
12
- document.removeEventListener(e.APPLY, i), document.removeEventListener(e.CANCEL, m), n = null;
13
- }, document.dispatchEvent(new CustomEvent(e.OPEN, { detail: E }));
14
- };
15
- export {
16
- p as requestDisplayCondition
17
- };
@@ -1,17 +0,0 @@
1
- import { BlockType as o } from "../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
2
- const n = "conditions", t = "guido-display-conditions-control", c = 10, s = [o.STRIPE, o.STRUCTURE, o.CONTAINER], d = {
3
- PLUS: "guido-display-condition-plus",
4
- EDIT: "guido-display-condition-edit",
5
- TRASH: "guido-display-condition-trash",
6
- CHEVRON: "guido-display-condition-chevron"
7
- }, e = ["applyConditionSwitcher", "applyCondition", "displayConditions"], I = "You can add Display Condition by selecting an existing condition or creating a new one to show specific content.", O = "You can create or select a display condition to control content visibility based on your recipients' properties or events.";
8
- export {
9
- O as APPLIED_DESCRIPTION,
10
- e as BUILT_IN_CONDITION_CONTROLS,
11
- t as CONDITIONS_CONTROL_ID,
12
- n as CONDITIONS_TAB_ID,
13
- s as CONDITION_BLOCK_TYPES,
14
- d as CONDITION_ICONS,
15
- I as EMPTY_DESCRIPTION,
16
- c as MAX_COLLAPSED_LINES
17
- };