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

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 (62) 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/components/organisms/unsubscribe/UnsubscribePageSelection.vue.js +5 -5
  6. package/dist/components/organisms/unsubscribe/UnsubscribePageSelection.vue2.js +9 -9
  7. package/dist/composables/useBlocksConfig.js +24 -32
  8. package/dist/enums/academy.js +0 -1
  9. package/dist/guido.css +1 -1
  10. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js +92 -93
  11. package/dist/node_modules/valibot/dist/index.js +261 -297
  12. package/dist/src/@types/config/schemas.d.ts +0 -4
  13. package/dist/src/composables/useConfig.d.ts +0 -2
  14. package/dist/src/enums/academy.d.ts +0 -1
  15. package/dist/src/stores/config.d.ts +0 -166
  16. package/dist/src/stores/unsubscribe.d.ts +10 -0
  17. package/dist/stores/config.js +6 -13
  18. package/dist/stores/unsubscribe.js +28 -24
  19. package/dist/utils/pairProductVariables.js +14 -15
  20. package/package.json +1 -1
  21. package/dist/@types/display-condition.js +0 -25
  22. package/dist/components/organisms/display-conditions/CodeEditorField.vue.js +0 -20
  23. package/dist/components/organisms/display-conditions/CodeEditorField.vue2.js +0 -30
  24. package/dist/components/organisms/display-conditions/DisplayConditionCreateDrawer.vue.js +0 -30
  25. package/dist/components/organisms/display-conditions/DisplayConditionCreateDrawer.vue2.js +0 -71
  26. package/dist/components/organisms/display-conditions/DisplayConditionSelectDrawer.vue.js +0 -34
  27. package/dist/components/organisms/display-conditions/DisplayConditionSelectDrawer.vue2.js +0 -57
  28. package/dist/components/organisms/display-conditions/DisplayConditionsHost.vue.js +0 -17
  29. package/dist/components/organisms/display-conditions/DisplayConditionsHost.vue2.js +0 -22
  30. package/dist/composables/useDisplayConditions.js +0 -102
  31. package/dist/enums/display-condition.js +0 -12
  32. package/dist/extensions/DisplayConditions/bridge.js +0 -17
  33. package/dist/extensions/DisplayConditions/constants.js +0 -17
  34. package/dist/extensions/DisplayConditions/control.js +0 -178
  35. package/dist/extensions/DisplayConditions/display-conditions.css.js +0 -201
  36. package/dist/extensions/DisplayConditions/extension.js +0 -28
  37. package/dist/extensions/DisplayConditions/iconsRegistry.js +0 -20
  38. package/dist/extensions/DisplayConditions/library.js +0 -27
  39. package/dist/extensions/DisplayConditions/settingsPanel.js +0 -17
  40. package/dist/services/displayConditionApi.js +0 -39
  41. package/dist/src/@types/display-condition.d.ts +0 -59
  42. package/dist/src/components/organisms/display-conditions/CodeEditorField.vue.d.ts +0 -43
  43. package/dist/src/components/organisms/display-conditions/DisplayConditionCreateDrawer.vue.d.ts +0 -2
  44. package/dist/src/components/organisms/display-conditions/DisplayConditionSelectDrawer.vue.d.ts +0 -2
  45. package/dist/src/components/organisms/display-conditions/DisplayConditionsHost.vue.d.ts +0 -2
  46. package/dist/src/composables/useDisplayConditions.d.ts +0 -16
  47. package/dist/src/enums/display-condition.d.ts +0 -15
  48. package/dist/src/extensions/DisplayConditions/bridge.d.ts +0 -6
  49. package/dist/src/extensions/DisplayConditions/constants.d.ts +0 -14
  50. package/dist/src/extensions/DisplayConditions/control.d.ts +0 -23
  51. package/dist/src/extensions/DisplayConditions/extension.d.ts +0 -2
  52. package/dist/src/extensions/DisplayConditions/iconsRegistry.d.ts +0 -4
  53. package/dist/src/extensions/DisplayConditions/library.d.ts +0 -8
  54. package/dist/src/extensions/DisplayConditions/settingsPanel.d.ts +0 -5
  55. package/dist/src/mock/api/display-conditions.d.ts +0 -2
  56. package/dist/src/services/displayConditionApi.d.ts +0 -8
  57. package/dist/src/stores/display-condition.d.ts +0 -81
  58. package/dist/src/utils/displayCondition.d.ts +0 -10
  59. package/dist/src/utils/protectTableText.d.ts +0 -2
  60. package/dist/stores/display-condition.js +0 -28
  61. package/dist/utils/displayCondition.js +0 -26
  62. package/dist/utils/protectTableText.js +0 -22
@@ -1,29 +1,28 @@
1
- import { ITEMS_CURRENCY_ATTR as N, isCustomCurrencySymbol as Y } from "../extensions/Blocks/Items/constants/currency.js";
1
+ import { ITEMS_CURRENCY_ATTR as x, isCustomCurrencySymbol as Y } from "../extensions/Blocks/Items/constants/currency.js";
2
2
  import { productPairs as w } from "../extensions/Blocks/Items/enums/productEnums.js";
3
3
  import { escapeReplacement as X } from "../extensions/Blocks/Items/utils/nodeConfigUtils.js";
4
4
  import { preserveTextStyles as P } from "./preserveTextStyles.js";
5
- import { protectTableText as v, restoreTableText as B } from "./protectTableText.js";
6
- import { unwrapProductNameLinks as j } from "./unwrapProductNameLink.js";
5
+ import { unwrapProductNameLinks as v } from "./unwrapProductNameLink.js";
7
6
  const O = {
8
7
  CART_ITEMS: "ins_apr",
9
8
  BROWSED_ITEMS: "browsed_item",
10
9
  PURCHASED_ITEMS: "purchased_item"
11
10
  }, q = (S) => S.replaceAll("{%", "<!--{%").replaceAll("%}", "%}-->");
12
- function Q(S, y, b) {
11
+ function B(S, y, b) {
13
12
  let h = y;
14
13
  for (; h > 0 && /\s/.test(S[h - 1]); )
15
14
  h -= 1;
16
15
  return b.some((I) => S.endsWith(I, h));
17
16
  }
18
- function rt(S) {
19
- const y = q(v(S)), b = new DOMParser().parseFromString(y, "text/html");
20
- j(b);
17
+ function Z(S) {
18
+ const y = q(S), b = new DOMParser().parseFromString(y, "text/html");
19
+ v(b);
21
20
  const h = w.PAIRS_FOR_EXTENSION;
22
21
  Object.entries(h).forEach(([n, d]) => {
23
22
  b.querySelectorAll(".ins-product-td").forEach((r) => {
24
23
  const E = r.getAttribute("data-number") || "1", m = r.getAttribute("data-type") || "CART_ITEMS";
25
24
  r.querySelectorAll(`[product-attr="${n}"]`).forEach((t) => {
26
- var $, F, x, D;
25
+ var $, F, D, N;
27
26
  const g = t.getAttribute("data-type") || m, o = t.getAttribute("data-number") || E, f = d[g];
28
27
  if (f)
29
28
  switch (n) {
@@ -41,7 +40,7 @@ function rt(S) {
41
40
  }
42
41
  const i = (F = ($ = h.name) == null ? void 0 : $[g]) == null ? void 0 : F.ATTR;
43
42
  if (i && e.setAttribute("alt", `{{${i}_${o}}}`), a) {
44
- const s = (x = h.itemLink) == null ? void 0 : x[g];
43
+ const s = (D = h.itemLink) == null ? void 0 : D[g];
45
44
  if (s) {
46
45
  const _ = s.HREF, R = s.DEFAULT_HREF || "#!", u = a.href;
47
46
  (u === "#" || u === "" || u.endsWith("#!") || u.endsWith(R) || u === `${window.location.href}${R}` || !u || u === window.location.href) && (a.href = `{{${_}_${o}}}`);
@@ -61,18 +60,18 @@ function rt(S) {
61
60
  }
62
61
  case "price":
63
62
  case "originalPrice": {
64
- const e = f, a = t.getAttribute("data-formated"), l = t.getAttribute("data-single_price"), c = a === "true", i = l === "true", s = t.getAttribute(N.POSITION) || "before";
63
+ const e = f, a = t.getAttribute("data-formated"), l = t.getAttribute("data-single_price"), c = a === "true", i = l === "true", s = t.getAttribute(x.POSITION) || "before";
65
64
  let _;
66
65
  i ? _ = c ? e.SINGLE_PRICE_FORMATTED : e.SINGLE_PRICE : _ = c ? e.PRICE_FORMATTED : e.PRICE;
67
66
  const R = e.CURRENCY;
68
67
  let u = `{{${_}_${o}}}`;
69
- const H = (t.getAttribute(N.SYMBOL) || "").trim(), G = Y(H);
68
+ const H = (t.getAttribute(x.SYMBOL) || "").trim(), G = Y(H);
70
69
  let C = "";
71
70
  G ? C = H : R && (C = `{{${R}_${o}}}`), C && (u = s === "after" ? `${u} ${C}` : `${C} ${u}`), t.innerHTML = P(t, u);
72
71
  break;
73
72
  }
74
73
  case "quantity": {
75
- const e = f, a = e.ATTR, l = [e.DEFAULT, ...e.LEGACY_DEFAULTS], c = (D = t.textContent) == null ? void 0 : D.trim();
74
+ const e = f, a = e.ATTR, l = [e.DEFAULT, ...e.LEGACY_DEFAULTS], c = (N = t.textContent) == null ? void 0 : N.trim();
76
75
  c && l.includes(c) && (t.innerHTML = P(t, `{{${a}_${o}}}`));
77
76
  break;
78
77
  }
@@ -140,12 +139,12 @@ function rt(S) {
140
139
  const E = w.PAIRS_FOR_EXTENSION.price[d].PRICE, m = w.PAIRS_FOR_EXTENSION.originalPrice[d].PRICE, T = `{% if ${E}_${n} != ${m}_${n} %}`, t = [T, q(T)];
141
140
  let g = "", o = 0, f = 0, $ = A.indexOf(r);
142
141
  for (; $ !== -1; ) {
143
- const F = p[f] === !0 && !Q(A, $, t);
142
+ const F = p[f] === !0 && !B(A, $, t);
144
143
  g += A.slice(o, $) + (F ? `${T}${r}{% endif %}` : r), o = $ + r.length, f += 1, $ = A.indexOf(r, o);
145
144
  }
146
145
  A = g + A.slice(o);
147
- }), B(A.replaceAll("<!--{%", "{%").replaceAll("%}-->", "%}").replaceAll("&lt;!--{%", "{%").replaceAll("%}--&gt;", "%}"));
146
+ }), A.replaceAll("<!--{%", "{%").replaceAll("%}-->", "%}").replaceAll("&lt;!--{%", "{%").replaceAll("%}--&gt;", "%}");
148
147
  }
149
148
  export {
150
- rt as pairProductVariables
149
+ Z as pairProductVariables
151
150
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@useinsider/guido",
3
- "version": "3.21.2-beta.cfc5be2",
3
+ "version": "3.21.2-beta.eda5c2e",
4
4
  "description": "Guido is a Vue + TypeScript wrapper for Email Plugin. Easily embed the email editor in your Vue applications.",
5
5
  "main": "./dist/guido.umd.cjs",
6
6
  "module": "./dist/library.js",
@@ -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
- };