@useinsider/guido 1.0.3-beta.c43738a → 1.0.3-beta.c600a63

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 (31) hide show
  1. package/README.md +3 -0
  2. package/dist/components/Guido.vue.js +1 -1
  3. package/dist/components/organisms/LoadingWrapper.vue.js +1 -1
  4. package/dist/components/organisms/header/RightSlot.vue2.js +13 -13
  5. package/dist/enums/defaults.js +5 -4
  6. package/dist/extensions/Blocks/Items/controls/name/trimming.js +25 -25
  7. package/dist/extensions/Blocks/Items/controls/price/priceOrientation.js +92 -0
  8. package/dist/extensions/Blocks/Items/controls/settingsControl.js +94 -90
  9. package/dist/extensions/Blocks/Items/enums/controlEnums.js +2 -2
  10. package/dist/extensions/Blocks/Items/enums/productEnums.js +3 -2
  11. package/dist/extensions/Blocks/Items/enums/settingsEnums.js +3 -2
  12. package/dist/extensions/Blocks/Items/extension.js +7 -6
  13. package/dist/extensions/Blocks/Items/layouts/horizontal.html.js +2 -2
  14. package/dist/extensions/Blocks/Items/layouts/vertical.html.js +17 -5
  15. package/dist/extensions/Blocks/Items/settingsPanel.js +25 -24
  16. package/dist/extensions/Blocks/Items/store/items-block.js +8 -4
  17. package/dist/extensions/Blocks/Items/template.js +65 -59
  18. package/dist/extensions/Blocks/Items/utils/syncAttributesFromConfigBlock.js +35 -26
  19. package/dist/extensions/Blocks/Items/utils/updateAttributes.js +29 -27
  20. package/dist/extensions/Blocks/Unsubscribe/block.js +34 -30
  21. package/dist/guido.css +1 -1
  22. package/dist/services/stripoApi.js +31 -26
  23. package/dist/src/enums/defaults.d.ts +1 -0
  24. package/dist/src/extensions/Blocks/Items/controls/price/priceOrientation.d.ts +15 -0
  25. package/dist/src/extensions/Blocks/Items/enums/controlEnums.d.ts +1 -0
  26. package/dist/src/extensions/Blocks/Items/enums/productEnums.d.ts +1 -0
  27. package/dist/src/extensions/Blocks/Items/enums/settingsEnums.d.ts +1 -0
  28. package/dist/src/extensions/Blocks/Items/store/items-block.d.ts +2 -0
  29. package/dist/src/extensions/Blocks/Items/utils/syncAttributesFromConfigBlock.d.ts +6 -0
  30. package/dist/src/extensions/Blocks/Unsubscribe/block.d.ts +3 -4
  31. package/package.json +3 -1
package/README.md CHANGED
@@ -600,6 +600,9 @@ Create a `.env` file with the following variables: (You can get env variables fr
600
600
  VITE_STRIPO_PLUGIN_ID=your_plugin_id
601
601
  VITE_STRIPO_SECRET_KEY=your_secret_key
602
602
  VITE_STRIPO_ROLE=your_role
603
+
604
+ # Playwright Test Configuration (Optional - for local debugging only)
605
+ HEADED=false # Set to 'true' to run tests with visible browser
603
606
  ```
604
607
 
605
608
  ### Project Structure
@@ -12,7 +12,7 @@ var t = function() {
12
12
  n,
13
13
  !1,
14
14
  null,
15
- "23c413c9"
15
+ "98181b5a"
16
16
  );
17
17
  const v = s.exports;
18
18
  export {
@@ -10,7 +10,7 @@ var s = function() {
10
10
  n,
11
11
  !1,
12
12
  null,
13
- "dced5582"
13
+ "07c4b2d8"
14
14
  );
15
15
  const l = _.exports;
16
16
  export {
@@ -1,4 +1,4 @@
1
- import { defineComponent as H, ref as p, computed as _ } from "vue";
1
+ import { defineComponent as H, ref as m, computed as _ } from "vue";
2
2
  import { useConfig as h } from "../../../composables/useConfig.js";
3
3
  import { useExport as V } from "../../../composables/useExport.js";
4
4
  import { useTestEmailClick as x } from "../../../composables/useGuidoActions.js";
@@ -10,25 +10,25 @@ import { getTooltipOptions as O } from "../../../utils/tooltipUtils.js";
10
10
  import { InButtonV2 as A } from "@useinsider/design-system-vue";
11
11
  const J = /* @__PURE__ */ H({
12
12
  __name: "RightSlot",
13
- setup(k, { expose: m }) {
14
- const { config: c } = h(), { exportHtml: r } = V(), { save: n } = E(), { openVersionHistory: i, closeVersionHistory: a } = w(), t = C(), o = T(), e = p(!1), s = p(!1), u = x(), f = () => {
15
- if (t.isVersionHistoryOpen) {
13
+ setup(k, { expose: c }) {
14
+ const { config: u } = h(), { exportHtml: r } = V(), { save: n } = E(), { openVersionHistory: i, closeVersionHistory: a } = w(), o = C(), t = T(), e = m(!1), s = m(!1), f = x(), v = () => {
15
+ if (o.isVersionHistoryOpen) {
16
16
  a();
17
17
  return;
18
18
  }
19
19
  i();
20
- }, v = async () => {
20
+ }, d = async () => {
21
21
  e.value = !0, await r(), e.value = !1;
22
- }, d = () => {
23
- t.isSaveAsTemplateDrawerOpen = !0;
24
- }, y = _(() => t.isVersionHistoryOpen ? o("newsletter.close-version-history") : o("newsletter.version-history")), l = async (S) => {
25
- s.value = !0, t.loadingStatus = !0;
26
- const g = await n(S);
27
- return s.value = !1, t.loadingStatus = !1, g;
22
+ }, y = () => {
23
+ o.isSaveAsTemplateDrawerOpen = !0;
24
+ }, S = _(() => o.isVersionHistoryOpen ? t("newsletter.close-version-history") : t("newsletter.version-history")), l = async (p) => {
25
+ s.value = !0, o.loadingStatus = !0;
26
+ const g = await n(p);
27
+ return s.value = !1, p && (o.loadingStatus = !1), g;
28
28
  };
29
- return m({
29
+ return c({
30
30
  handleSave: l
31
- }), { __sfc: !0, config: c, exportHtml: r, save: n, openVersionHistory: i, closeVersionHistory: a, editorStore: t, trans: o, isExporting: e, isSaving: s, testEmailClick: u, handleVersionHistory: f, handleExport: v, handleSaveAs: d, versionHistoryTooltipText: y, handleSave: l, getTooltipOptions: O, InButtonV2: A };
31
+ }), { __sfc: !0, config: u, exportHtml: r, save: n, openVersionHistory: i, closeVersionHistory: a, editorStore: o, trans: t, isExporting: e, isSaving: s, testEmailClick: f, handleVersionHistory: v, handleExport: d, handleSaveAs: y, versionHistoryTooltipText: S, handleSave: l, getTooltipOptions: O, InButtonV2: A };
32
32
  }
33
33
  });
34
34
  export {
@@ -23,11 +23,11 @@ const e = {
23
23
  }, t = {
24
24
  promotional: 1,
25
25
  transactional: 2
26
- }, a = "email", o = "Guido User", s = t.promotional, n = 2, i = {
26
+ }, a = "email", o = "Guido User", s = t.promotional, n = 2, i = 13, u = {
27
27
  email: 60,
28
28
  architect: 49,
29
29
  unsubscribePages: 97
30
- }, u = [
30
+ }, r = [
31
31
  "alfredtesting",
32
32
  "electio",
33
33
  "eurekatest",
@@ -65,7 +65,8 @@ export {
65
65
  a as DefaultProductType,
66
66
  o as DefaultUsername,
67
67
  n as EditorType,
68
- i as ProductIds,
69
- u as TEST_PARTNER_LIST,
68
+ i as MAX_DEFAULT_TEMPLATE_ID,
69
+ u as ProductIds,
70
+ r as TEST_PARTNER_LIST,
70
71
  t as TemplateTypes
71
72
  };
@@ -1,70 +1,70 @@
1
1
  var d = Object.defineProperty;
2
2
  var h = (i, t, e) => t in i ? d(i, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : i[t] = e;
3
- var s = (i, t, e) => h(i, typeof t != "symbol" ? t + "" : t, e);
4
- import { ModificationDescription as n, UIElementType as a, UEAttr as g } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
3
+ var n = (i, t, e) => h(i, typeof t != "symbol" ? t + "" : t, e);
4
+ import { ModificationDescription as a, UIElementType as l, UEAttr as g } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
5
5
  import { CommonControl as c } from "../../../common-control.js";
6
- import { ItemsBlockControlId as l } from "../../enums/controlEnums.js";
6
+ import { ItemsBlockControlId as p } from "../../enums/controlEnums.js";
7
7
  import { SETTINGS_ENUMS as I } from "../../enums/settingsEnums.js";
8
8
  import { useItemsBlockStore as N } from "../../store/items-block.js";
9
- import { syncNameTrimmingFromAttributes as y } from "../../utils/syncAttributesFromConfigBlock.js";
10
- import { updateConfigBlockAttributes as M } from "../../utils/updateAttributes.js";
11
- const f = l.NAME_TRIMMING, r = {
9
+ import { syncNameTrimmingFromAttributes as M } from "../../utils/syncAttributesFromConfigBlock.js";
10
+ import { updateConfigBlockAttributes as u } from "../../utils/updateAttributes.js";
11
+ const y = p.NAME_TRIMMING, o = {
12
12
  TRIMMING: "trimming"
13
13
  };
14
- class R extends c {
14
+ class _ extends c {
15
15
  constructor() {
16
16
  super(...arguments);
17
- s(this, "store", N());
17
+ n(this, "store", N());
18
18
  }
19
19
  getId() {
20
- return f;
20
+ return y;
21
21
  }
22
22
  getTemplate() {
23
23
  return `
24
- <div class="${l.NAME_TRIMMING}">
24
+ <div class="${p.NAME_TRIMMING}">
25
25
  ${this._getTextTrimming()}
26
26
  </div>
27
27
  `;
28
28
  }
29
29
  onRender() {
30
- this.api.updateValues({ [r.TRIMMING]: this.store.nameTrimming }), this.api.onValueChanged(r.TRIMMING, (e) => {
30
+ this.api.updateValues({ [o.TRIMMING]: this.store.nameTrimming }), this.api.onValueChanged(o.TRIMMING, (e) => {
31
31
  this._onTrimmingChange(e);
32
32
  });
33
33
  }
34
34
  onTemplateNodeUpdated(e) {
35
35
  super.onTemplateNodeUpdated(e), this.handleBlockInstanceChange(
36
- () => y(this.currentNode),
36
+ () => M(this.currentNode),
37
37
  () => {
38
- this.api.updateValues({ [r.TRIMMING]: this.store.nameTrimming });
38
+ this.api.updateValues({ [o.TRIMMING]: this.store.nameTrimming });
39
39
  }
40
- ), this.store.nameTrimming && this._applyTrimmingStyles();
40
+ );
41
41
  }
42
42
  _onTrimmingChange(e) {
43
- this.store.setNameTrimming(e), M(this.currentNode, this.api), this.api.updateValues({ [r.TRIMMING]: e }), this._applyTrimmingStyles(e);
43
+ this.store.setNameTrimming(e), u(this.currentNode, this.api), this.api.updateValues({ [o.TRIMMING]: e }), this._applyTrimmingStyles(e);
44
44
  }
45
45
  _applyTrimmingStyles(e) {
46
- var m;
47
- const o = (m = this.currentNode) == null ? void 0 : m.querySelector("p > a");
48
- if (!o)
46
+ var s;
47
+ const r = (s = this.currentNode) == null ? void 0 : s.querySelector("p > a");
48
+ if (!r)
49
49
  return;
50
- const p = e !== void 0 ? e : this.store.nameTrimming, T = this.store.orientation === I.ORIENTATION.VERTICAL;
51
- p ? this.api.getDocumentModifier().modifyHtml(o).setStyle("white-space", "nowrap").setStyle("overflow", "hidden").setStyle("text-overflow", "ellipsis").setStyle("max-width", T ? "130px" : "550px").apply(new n("Text Trimming Enabled")) : this.api.getDocumentModifier().modifyHtml(o).removeStyle("white-space").removeStyle("overflow").removeStyle("text-overflow").removeStyle("max-width").apply(new n("Text Trimming Disabled"));
50
+ const T = e !== void 0 ? e : this.store.nameTrimming, m = this.store.orientation === I.ORIENTATION.VERTICAL;
51
+ T ? this.api.getDocumentModifier().modifyHtml(r).setStyle("white-space", "nowrap").setStyle("overflow", "hidden").setStyle("text-overflow", "ellipsis").setStyle("max-width", m ? "130px" : "520px").apply(new a("Text Trimming Enabled")) : this.api.getDocumentModifier().modifyHtml(r).removeStyle("white-space").removeStyle("overflow").removeStyle("text-overflow").removeStyle("max-width").setStyle("max-width", m ? "130px" : "520px").apply(new a("Text Trimming Disabled"));
52
52
  }
53
53
  _getTextTrimming() {
54
54
  return `
55
55
  <div class="container">
56
56
  <div class="display-flex align-items-center justify-content-between">
57
- <${a.LABEL}
57
+ <${l.LABEL}
58
58
  ${g.LABEL.text}="${this.api.translate("Text Trimming")}"
59
59
  >
60
- </${a.LABEL}>
61
- ${this._GuToggle(r.TRIMMING)}
60
+ </${l.LABEL}>
61
+ ${this._GuToggle(o.TRIMMING)}
62
62
  </div>
63
63
  </div>
64
64
  `;
65
65
  }
66
66
  }
67
67
  export {
68
- f as CONTROL_BLOCK_ID,
69
- R as NameTrimmingControl
68
+ y as CONTROL_BLOCK_ID,
69
+ _ as NameTrimmingControl
70
70
  };
@@ -0,0 +1,92 @@
1
+ var I = Object.defineProperty;
2
+ var y = (n, o, t) => o in n ? I(n, o, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[o] = t;
3
+ var m = (n, o, t) => y(n, typeof o != "symbol" ? o + "" : o, t);
4
+ import { ModificationDescription as h } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
5
+ import { CommonControl as E } from "../../../common-control.js";
6
+ import { ItemsBlockControlId as O } from "../../enums/controlEnums.js";
7
+ import { SETTINGS_ENUMS as N } from "../../enums/settingsEnums.js";
8
+ import { useItemsBlockStore as f } from "../../store/items-block.js";
9
+ import { syncPriceOrientationFromAttributes as T } from "../../utils/syncAttributesFromConfigBlock.js";
10
+ import { updateConfigBlockAttributes as P } from "../../utils/updateAttributes.js";
11
+ const _ = O.PRICE_ORIENTATION, p = {
12
+ PRICE_ORIENTATION: "priceOrientation"
13
+ }, C = [
14
+ { icon: "vertical-orientation", value: "vertical" },
15
+ { icon: "horizontal-orientation", value: "horizontal" }
16
+ ];
17
+ class v extends E {
18
+ constructor() {
19
+ super(...arguments);
20
+ m(this, "store", f());
21
+ }
22
+ getId() {
23
+ return _;
24
+ }
25
+ getTemplate() {
26
+ return `
27
+ <div class="${O.PRICE_ORIENTATION}">
28
+ ${this._getPriceOrientation()}
29
+ </div>
30
+ `;
31
+ }
32
+ onRender() {
33
+ this.api.updateValues({ [p.PRICE_ORIENTATION]: this.store.priceOrientation }), this.api.onValueChanged(p.PRICE_ORIENTATION, (t) => {
34
+ this._onPriceOrientationChange(t);
35
+ });
36
+ }
37
+ onTemplateNodeUpdated(t) {
38
+ super.onTemplateNodeUpdated(t), this.handleBlockInstanceChange(
39
+ () => {
40
+ T(this.currentNode);
41
+ },
42
+ () => {
43
+ this.api.updateValues({ [p.PRICE_ORIENTATION]: this.store.priceOrientation });
44
+ }
45
+ );
46
+ }
47
+ _onPriceOrientationChange(t) {
48
+ if (console.debug("Price orientation changed to: ", t), this.store.setPriceOrientation(t), P(this.currentNode, this.api), !this.currentNode)
49
+ return;
50
+ const { orientation: i } = this.store, r = i === N.ORIENTATION.VERTICAL, e = t === "horizontal";
51
+ r ? this._updateVerticalLayout(e) : this._updateHorizontalLayout(e);
52
+ }
53
+ _updateHorizontalLayout(t) {
54
+ var c, l, d, a;
55
+ const i = ((l = (c = this.currentNode) == null ? void 0 : c.closest(".ins-product-td")) == null ? void 0 : l.querySelectorAll(".product-price-class")) || [], r = ((a = (d = this.currentNode) == null ? void 0 : d.closest(".ins-product-td")) == null ? void 0 : a.querySelectorAll(".product-original-price-class")) || [];
56
+ if (!i || !r)
57
+ return;
58
+ const e = t ? "50%" : "100%", s = this.api.getDocumentModifier();
59
+ i.forEach((u) => {
60
+ s.modifyHtml(u).setAttribute("width", e).setStyle("width", e);
61
+ }), r.forEach((u) => {
62
+ s.modifyHtml(u).setAttribute("width", e).setStyle("width", e);
63
+ }), s.apply(new h(`Updated original price element width to ${e}`));
64
+ }
65
+ _updateVerticalLayout(t) {
66
+ var s, c, l, d;
67
+ const i = ((c = (s = this.currentNode) == null ? void 0 : s.closest(".ins-product-td")) == null ? void 0 : c.querySelectorAll(".horizontal-price")) || [], r = (d = (l = this.currentNode) == null ? void 0 : l.closest(".ins-product-td")) == null ? void 0 : d.querySelector(".vertical-price");
68
+ if (!i || !r || i.length === 0)
69
+ return;
70
+ const e = this.api.getDocumentModifier();
71
+ t ? (i.forEach((a) => {
72
+ e.modifyHtml(a).setStyle("display", "table-cell");
73
+ }), e.modifyHtml(r).setStyle("display", "none").apply(new h("Hide vertical price element"))) : (i.forEach((a) => {
74
+ e.modifyHtml(a).setStyle("display", "none");
75
+ }), e.modifyHtml(r).setStyle("display", "table-cell").apply(new h("Show vertical price element")));
76
+ }
77
+ _getPriceOrientation() {
78
+ return `
79
+ ${this._GuTwoColumns([
80
+ this._GuLabel({ text: "Price Orientation" }),
81
+ this._GuRadioButton({
82
+ name: p.PRICE_ORIENTATION,
83
+ buttons: C
84
+ })
85
+ ])}
86
+ `;
87
+ }
88
+ }
89
+ export {
90
+ _ as CONTROL_BLOCK_ID,
91
+ v as PriceOrientationControl
92
+ };