@useinsider/guido 2.0.0-beta.5ccd854 → 2.0.0-beta.689d09e

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 (77) hide show
  1. package/README.md +2 -0
  2. package/dist/@types/config/schemas.js +55 -39
  3. package/dist/components/Guido.vue.js +1 -1
  4. package/dist/components/Guido.vue2.js +15 -17
  5. package/dist/components/organisms/header/LeftSlot.vue.js +12 -12
  6. package/dist/components/organisms/header/LeftSlot.vue2.js +6 -6
  7. package/dist/components/organisms/header/RightSlot.vue2.js +10 -10
  8. package/dist/composables/useConfig.js +29 -27
  9. package/dist/composables/useSave.js +13 -11
  10. package/dist/composables/useStripo.js +42 -40
  11. package/dist/config/migrator/itemsBlockMigrator.js +184 -125
  12. package/dist/extensions/Blocks/CouponBlock/constants.js +4 -0
  13. package/dist/extensions/Blocks/CouponBlock/controls/index.js +29 -0
  14. package/dist/extensions/Blocks/CouponBlock/extension.js +5 -4
  15. package/dist/extensions/Blocks/CouponBlock/settingsPanel.js +20 -14
  16. package/dist/extensions/Blocks/CouponBlock/template.js +22 -11
  17. package/dist/extensions/Blocks/Items/block.js +1 -1
  18. package/dist/extensions/Blocks/Items/controls/button/link.js +22 -29
  19. package/dist/extensions/Blocks/Items/controls/cardComposition.js +59 -36
  20. package/dist/extensions/Blocks/Items/controls/image/link.js +23 -30
  21. package/dist/extensions/Blocks/Items/controls/name/trimming.js +25 -25
  22. package/dist/extensions/Blocks/Items/controls/price/currencyLocation.js +19 -17
  23. package/dist/extensions/Blocks/Items/controls/price/currencySymbol.js +31 -29
  24. package/dist/extensions/Blocks/Items/controls/price/formattedPrice.js +44 -38
  25. package/dist/extensions/Blocks/Items/controls/price/hideDiscount.js +21 -19
  26. package/dist/extensions/Blocks/Items/controls/price/priceOrientation.js +1 -1
  27. package/dist/extensions/Blocks/Items/controls/price/singlePrice.js +93 -0
  28. package/dist/extensions/Blocks/Items/controls/settingsControl.js +99 -95
  29. package/dist/extensions/Blocks/Items/enums/controlEnums.js +2 -2
  30. package/dist/extensions/Blocks/Items/enums/productEnums.js +43 -45
  31. package/dist/extensions/Blocks/Items/enums/settingsEnums.js +2 -1
  32. package/dist/extensions/Blocks/Items/extension.js +7 -6
  33. package/dist/extensions/Blocks/Items/layouts/horizontal.html.js +0 -1
  34. package/dist/extensions/Blocks/Items/layouts/vertical.html.js +0 -1
  35. package/dist/extensions/Blocks/Items/settingsPanel.js +27 -26
  36. package/dist/extensions/Blocks/Items/store/items-block.js +9 -5
  37. package/dist/extensions/Blocks/Items/template.js +285 -221
  38. package/dist/extensions/Blocks/Items/utils/nodeConfigUtils.js +94 -82
  39. package/dist/extensions/Blocks/Unsubscribe/extension.js +9 -9
  40. package/dist/extensions/Blocks/common-control.js +45 -57
  41. package/dist/extensions/Blocks/controlFactories.js +139 -118
  42. package/dist/guido.css +1 -1
  43. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js +53 -48
  44. package/dist/package.json.js +7 -0
  45. package/dist/services/stripoApi.js +6 -10
  46. package/dist/src/@types/config/index.d.ts +2 -2
  47. package/dist/src/@types/config/schemas.d.ts +30 -0
  48. package/dist/src/@types/config/types.d.ts +7 -1
  49. package/dist/src/composables/useConfig.d.ts +8 -0
  50. package/dist/src/extensions/Blocks/CouponBlock/constants.d.ts +14 -0
  51. package/dist/src/extensions/Blocks/CouponBlock/controls/index.d.ts +108 -0
  52. package/dist/src/extensions/Blocks/CouponBlock/template.d.ts +1 -1
  53. package/dist/src/extensions/Blocks/Items/controls/button/link.d.ts +0 -2
  54. package/dist/src/extensions/Blocks/Items/controls/cardComposition.d.ts +9 -0
  55. package/dist/src/extensions/Blocks/Items/controls/image/link.d.ts +0 -2
  56. package/dist/src/extensions/Blocks/Items/controls/price/singlePrice.d.ts +18 -0
  57. package/dist/src/extensions/Blocks/Items/enums/controlEnums.d.ts +1 -0
  58. package/dist/src/extensions/Blocks/Items/enums/productEnums.d.ts +24 -26
  59. package/dist/src/extensions/Blocks/Items/enums/settingsEnums.d.ts +1 -0
  60. package/dist/src/extensions/Blocks/Items/store/items-block.d.ts +2 -0
  61. package/dist/src/extensions/Blocks/Items/template.d.ts +3 -1
  62. package/dist/src/extensions/Blocks/Items/utils/nodeConfigUtils.d.ts +4 -2
  63. package/dist/src/extensions/Blocks/common-control.d.ts +1 -7
  64. package/dist/src/extensions/Blocks/controlFactories.d.ts +30 -7
  65. package/dist/src/stores/config.d.ts +164 -1
  66. package/dist/static/styles/components/button.css.js +1 -1
  67. package/dist/stores/config.js +7 -0
  68. package/dist/utils/pairProductVariables.js +61 -58
  69. package/package.json +1 -1
  70. package/dist/extensions/Blocks/Items/utils/configBlockUtils.js +0 -17
  71. package/dist/extensions/Blocks/Items/utils/syncAttributeFromConfigBlock.js +0 -28
  72. package/dist/extensions/Blocks/Items/utils/syncAttributesFromConfigBlock.js +0 -67
  73. package/dist/extensions/Blocks/Items/utils/updateAttributes.js +0 -46
  74. package/dist/src/extensions/Blocks/Items/utils/configBlockUtils.d.ts +0 -23
  75. package/dist/src/extensions/Blocks/Items/utils/syncAttributeFromConfigBlock.d.ts +0 -32
  76. package/dist/src/extensions/Blocks/Items/utils/syncAttributesFromConfigBlock.d.ts +0 -50
  77. package/dist/src/extensions/Blocks/Items/utils/updateAttributes.d.ts +0 -8
@@ -1,8 +1,9 @@
1
1
  import { ExtensionBuilder as o } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
2
2
  import { CouponBlock as t } from "./block.js";
3
- import { CouponIconsRegistry as i } from "./iconsRegistry.js";
4
- import { CouponBlockSettings as n } from "./settingsPanel.js";
5
- const p = new o().addBlock(t).withSettingsPanelRegistry(n).withIconsRegistry(i).build();
3
+ import { TextAlignControl as n, TextColorControl as r, TextSizeControl as l, TextStyleControl as d, TextFontFamilyControl as e, TextBackgroundControl as i, TextPaddingsControl as C, TextLineSpacingControl as a } from "./controls/index.js";
4
+ import { CouponIconsRegistry as s } from "./iconsRegistry.js";
5
+ import { CouponBlockSettings as m } from "./settingsPanel.js";
6
+ const u = new o().addBlock(t).withSettingsPanelRegistry(m).addControl(n).addControl(r).addControl(l).addControl(d).addControl(e).addControl(i).addControl(C).addControl(a).withIconsRegistry(s).build();
6
7
  export {
7
- p as default
8
+ u as default
8
9
  };
@@ -1,24 +1,30 @@
1
- import { SettingsPanelRegistry as T, SettingsPanelTab as o, SettingsTab as O, TextControls as t } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
2
- import { COUPON_BLOCK_ID as N } from "./block.js";
3
- class _ extends T {
1
+ import { SettingsPanelRegistry as n, SettingsPanelTab as o, SettingsTab as t } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
2
+ import { COUPON_BLOCK_ID as E } from "./block.js";
3
+ import { CouponControlId as T } from "./constants.js";
4
+ class i extends n {
4
5
  registerBlockControls(e) {
5
- e[N] = [
6
+ e[E] = [
6
7
  new o(
7
- O.SETTINGS,
8
+ t.SETTINGS,
8
9
  [
9
- t.FONT_FAMILY,
10
- t.FONT_SIZE,
11
- t.FORMAT,
12
- t.FONT_COLOR,
13
- t.TEXT_BLOCK_BACKGROUND_COLOR,
14
- t.ALIGN,
15
- t.LINE_HEIGHT,
16
- t.INTERNAL_INDENTS
10
+ T.TEXT_STYLE,
11
+ T.TEXT_ALIGN,
12
+ T.TEXT_PADDINGS
13
+ ]
14
+ ),
15
+ new o(
16
+ t.STYLES,
17
+ [
18
+ T.TEXT_BACKGROUND,
19
+ T.TEXT_FONT_FAMILY,
20
+ T.TEXT_LINE_SPACING,
21
+ T.TEXT_SIZE,
22
+ T.TEXT_COLOR
17
23
  ]
18
24
  )
19
25
  ];
20
26
  }
21
27
  }
22
28
  export {
23
- _ as CouponBlockSettings
29
+ i as CouponBlockSettings
24
30
  };
@@ -1,18 +1,29 @@
1
- const o = `
2
- <td class="coupon-block ins-coupon-code esd-block-text coupon-block-v2">
3
- <p class="ins-title" contenteditable="false">{@COUPON_CODE}</p>
4
- </td>`, e = `
5
- <td
6
- class="coupon-block coupon-block-v2 ins-coupon-code esd-block-text esd-extension-block"
7
- esd-extension-block-id="coupon-block"
1
+ import { BlockType as o } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
2
+ import { COUPON_BLOCK_ID as e } from "./block.js";
3
+ const t = `
4
+ <${o.BLOCK_TEXT}
5
+ class="coupon-block ins-coupon-code coupon-block-v2 es-p10"
6
+ align="center"
7
+ esd-extension-block-id="${e}">
8
+ <p
9
+ path="1"
10
+ contenteditable="false"
11
+ style="font-size: 16px; color: #333333;">
12
+ <strong path="1,0">{@COUPON_CODE}</strong>
13
+ </p>
14
+ </${o.BLOCK_TEXT}>
15
+ `, l = `
16
+ <td
17
+ class="coupon-block coupon-block-v2 ins-coupon-code esd-block-text esd-extension-block"
18
+ esd-extension-block-id="${e}"
8
19
  >
9
20
  <p class="ins-title" contenteditable="false">{@COUPON_CODE}</p>
10
21
  </td>
11
22
  `;
12
- function t() {
13
- return o;
23
+ function s() {
24
+ return t;
14
25
  }
15
26
  export {
16
- e as default,
17
- t as getDefaultTemplate
27
+ l as default,
28
+ s as getDefaultTemplate
18
29
  };
@@ -41,7 +41,7 @@ class O extends u {
41
41
  return;
42
42
  const t = e.getNodeConfig(), l = t && Object.keys(t).length > 0, r = a(i);
43
43
  if (r != null && r.initialized)
44
- l ? r.blockInstanceId || this.api.getDocumentModifier().modifyHtml(e).setNodeConfig({ ...r, blockInstanceId: String(Date.now()) }).apply(new n("Assign block instance ID to block")) : this.api.getDocumentModifier().modifyHtml(e).setNodeConfig(r).apply(new n("Migrate legacy esd-config-block to nodeConfig"));
44
+ l ? r.blockInstanceId || this.api.getDocumentModifier().modifyHtml(e).setNodeConfig({ ...r, blockInstanceId: String(Date.now()) }).apply(new n("Assign block instance ID to block")) : this.api.getDocumentModifier().modifyHtml(e).setNodeConfig(r).apply(new n("Migrate legacy config to nodeConfig"));
45
45
  else {
46
46
  const m = I();
47
47
  this.api.getDocumentModifier().modifyHtml(e).setNodeConfig(m).apply(new n("Initialize Items block with default configuration")), d().startOnboarding("itemsOnboarding");
@@ -1,59 +1,52 @@
1
- var r = Object.defineProperty;
2
- var a = (o, e, t) => e in o ? r(o, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[e] = t;
3
- var s = (o, e, t) => a(o, typeof e != "symbol" ? e + "" : e, t);
1
+ var a = Object.defineProperty;
2
+ var l = (e, t, n) => t in e ? a(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
+ var i = (e, t, n) => l(e, typeof t != "symbol" ? t + "" : t, n);
4
4
  import { CommonControl as u } from "../../../common-control.js";
5
5
  import { ItemsBlockControlId as d } from "../../enums/controlEnums.js";
6
- import { useItemsBlockStore as l } from "../../store/items-block.js";
7
- import { syncButtonLinkFromAttributes as h } from "../../utils/syncAttributesFromConfigBlock.js";
8
- import { updateConfigBlockAttributes as m } from "../../utils/updateAttributes.js";
9
- const i = d.BUTTON_LINK, n = {
6
+ import { useItemsBlockStore as m } from "../../store/items-block.js";
7
+ import { getItemsBlockConfig as L } from "../../utils/nodeConfigUtils.js";
8
+ const r = d.BUTTON_LINK, s = {
10
9
  LINK: "link"
11
10
  };
12
- class C extends u {
11
+ class N extends u {
13
12
  constructor() {
14
13
  super(...arguments);
15
- s(this, "store", l());
14
+ i(this, "store", m());
16
15
  }
17
16
  getId() {
18
- return i;
17
+ return r;
19
18
  }
20
19
  getTemplate() {
21
20
  return `
22
- <div class="${i}">
21
+ <div class="container ${r}">
23
22
  ${this._getLink()}
24
23
  </div>
25
24
  `;
26
25
  }
27
26
  onRender() {
28
27
  this.api.updateValues({
29
- [n.LINK]: this.store.buttonLink
30
- }), this._listenToFormUpdates();
28
+ [s.LINK]: this.store.buttonLink
29
+ });
31
30
  }
32
- onTemplateNodeUpdated(t) {
33
- super.onTemplateNodeUpdated(t), this.handleBlockInstanceChange(
34
- () => h(this.currentNode),
31
+ onTemplateNodeUpdated(n) {
32
+ super.onTemplateNodeUpdated(n), this.handleBlockInstanceChange(
33
+ () => {
34
+ const o = L(this.currentNode);
35
+ o != null && o.buttonLink && this.store.setButtonLink(o.buttonLink);
36
+ },
35
37
  () => {
36
38
  this.api.updateValues({
37
- [n.LINK]: this.store.buttonLink
39
+ [s.LINK]: this.store.buttonLink
38
40
  });
39
41
  }
40
42
  );
41
43
  }
42
- _listenToFormUpdates() {
43
- this.api.onValueChanged(
44
- n.LINK,
45
- (t) => this._onLinkChange(t)
46
- );
47
- }
48
- _onLinkChange(t) {
49
- console.debug("Button link changed to: ", t), this.store.setButtonLink(t), m(this.currentNode, this.api);
50
- }
51
44
  _getLink() {
52
45
  return `
53
46
  ${this._GuOneColumn([
54
47
  this._GuLabel({ text: "Link" }),
55
48
  this._GuTextInput({
56
- name: n.LINK,
49
+ name: s.LINK,
57
50
  placeholder: "Enter Link",
58
51
  className: "es-100",
59
52
  disabled: !0
@@ -63,6 +56,6 @@ class C extends u {
63
56
  }
64
57
  }
65
58
  export {
66
- C as ButtonLinkControl,
67
- i as CONTROL_BLOCK_ID
59
+ N as ButtonLinkControl,
60
+ r as CONTROL_BLOCK_ID
68
61
  };
@@ -1,13 +1,13 @@
1
- var P = Object.defineProperty;
2
- var _ = (a, n, t) => n in a ? P(a, n, { enumerable: !0, configurable: !0, writable: !0, value: t }) : a[n] = t;
3
- var d = (a, n, t) => _(a, typeof n != "symbol" ? n + "" : n, t);
4
- import { ModificationDescription as r } from "../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
5
- import { CommonControl as u } from "../../common-control.js";
1
+ var O = Object.defineProperty;
2
+ var y = (a, r, t) => r in a ? O(a, r, { enumerable: !0, configurable: !0, writable: !0, value: t }) : a[r] = t;
3
+ var P = (a, r, t) => y(a, typeof r != "symbol" ? r + "" : r, t);
4
+ import { ModificationDescription as l } from "../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
5
+ import { CommonControl as I } from "../../common-control.js";
6
6
  import { ItemsBlockId as s } from "../enums/controlEnums.js";
7
- import { SETTINGS_ENUMS as R } from "../enums/settingsEnums.js";
8
- import { useItemsBlockStore as O } from "../store/items-block.js";
9
- import { getItemsBlockConfig as C, setItemsBlockConfig as h } from "../utils/nodeConfigUtils.js";
10
- const I = "ui-elements-items-card-composition-block", i = {
7
+ import { SETTINGS_ENUMS as h } from "../enums/settingsEnums.js";
8
+ import { useItemsBlockStore as p } from "../store/items-block.js";
9
+ import { getItemsBlockConfig as R, setItemsBlockConfig as U } from "../utils/nodeConfigUtils.js";
10
+ const b = "ui-elements-items-card-composition-block", i = {
11
11
  PRODUCT_IMAGE: "image",
12
12
  PRODUCT_NAME: "name",
13
13
  PRODUCT_QUANTITY: "quantity",
@@ -15,11 +15,11 @@ const I = "ui-elements-items-card-composition-block", i = {
15
15
  PRODUCT_ORIGINAL_PRICE: "originalPrice",
16
16
  PRODUCT_BUTTON: "button"
17
17
  };
18
- class N extends u {
18
+ class S extends I {
19
19
  constructor() {
20
20
  super(...arguments);
21
- d(this, "store", O());
22
- d(this, "visibilityState", {
21
+ P(this, "store", p());
22
+ P(this, "visibilityState", {
23
23
  [i.PRODUCT_IMAGE]: !0,
24
24
  [i.PRODUCT_NAME]: !0,
25
25
  [i.PRODUCT_QUANTITY]: !0,
@@ -29,7 +29,7 @@ class N extends u {
29
29
  });
30
30
  }
31
31
  getId() {
32
- return I;
32
+ return b;
33
33
  }
34
34
  getTemplate() {
35
35
  return `
@@ -82,7 +82,7 @@ class N extends u {
82
82
  });
83
83
  }
84
84
  _syncVisibilityFromAttributes() {
85
- const t = C(this.currentNode);
85
+ const t = R(this.currentNode);
86
86
  if (!t)
87
87
  return;
88
88
  const e = {
@@ -93,9 +93,9 @@ class N extends u {
93
93
  [i.PRODUCT_ORIGINAL_PRICE]: "originalPriceVisible",
94
94
  [i.PRODUCT_BUTTON]: "buttonVisible"
95
95
  };
96
- Object.entries(e).forEach(([o, l]) => {
97
- const T = t[l];
98
- this.visibilityState[o] = T !== !1;
96
+ Object.entries(e).forEach(([o, n]) => {
97
+ const c = t[n];
98
+ this.visibilityState[o] = c !== !1;
99
99
  });
100
100
  }
101
101
  /**
@@ -104,7 +104,7 @@ class N extends u {
104
104
  * and mark it as '0'
105
105
  */
106
106
  _handleBrowsedItemsQuantity() {
107
- const t = this.store.itemsType !== R.ITEMS_TYPE.BROWSED_ITEMS, e = C(this.currentNode);
107
+ const t = this.store.itemsType !== h.ITEMS_TYPE.BROWSED_ITEMS, e = R(this.currentNode);
108
108
  if (!e)
109
109
  return;
110
110
  const o = e.quantityControlEnabled !== !1;
@@ -120,16 +120,16 @@ class N extends u {
120
120
  [i.PRODUCT_BUTTON]: s.BUTTON
121
121
  };
122
122
  Object.entries(t).forEach(([e, o]) => {
123
- var c;
124
- const l = (c = this.currentNode) == null ? void 0 : c.querySelector(`[esd-extension-block-id="${o}"]`);
125
- if (!l)
123
+ var d;
124
+ const n = (d = this.currentNode) == null ? void 0 : d.querySelector(`[esd-extension-block-id="${o}"]`);
125
+ if (!n)
126
126
  return;
127
- const T = this.visibilityState[e];
128
- this.api.getDocumentModifier().modifyHtml(l).setStyle("display", T ? "table-cell" : "none").apply(new r(`Applied ${e} visibility from attributes`));
129
- });
127
+ const c = this.visibilityState[e];
128
+ this.api.getDocumentModifier().modifyHtml(n).setStyle("display", c ? "table-cell" : "none").apply(new l(`Applied ${e} visibility from attributes`));
129
+ }), this._updatePriceCellWidthsForVerticalLayout();
130
130
  }
131
131
  _updateVisibilityAttribute(t, e) {
132
- const l = {
132
+ const n = {
133
133
  [i.PRODUCT_IMAGE]: "imageVisible",
134
134
  [i.PRODUCT_NAME]: "nameVisible",
135
135
  [i.PRODUCT_QUANTITY]: "quantityControlEnabled",
@@ -137,8 +137,8 @@ class N extends u {
137
137
  [i.PRODUCT_ORIGINAL_PRICE]: "originalPriceVisible",
138
138
  [i.PRODUCT_BUTTON]: "buttonVisible"
139
139
  }[t];
140
- l && h(this.currentNode, this.api, {
141
- [l]: e
140
+ n && U(this.currentNode, this.api, {
141
+ [n]: e
142
142
  });
143
143
  }
144
144
  _listenToFormUpdates() {
@@ -150,41 +150,64 @@ class N extends u {
150
150
  _onProductImageChange(t) {
151
151
  var o;
152
152
  const e = (o = this.currentNode) == null ? void 0 : o.querySelector(`[esd-extension-block-id="${s.IMAGE}"]`);
153
- e && (this.visibilityState[i.PRODUCT_IMAGE] = t, this.api.getDocumentModifier().modifyHtml(e).setStyle("display", t ? "table-cell" : "none").apply(new r(`Product image visibility changed to ${t ? "visible" : "hidden"}`)), this._updateVisibilityAttribute(i.PRODUCT_IMAGE, t));
153
+ e && (this.visibilityState[i.PRODUCT_IMAGE] = t, this.api.getDocumentModifier().modifyHtml(e).setStyle("display", t ? "table-cell" : "none").apply(new l(`Product image visibility changed to ${t ? "visible" : "hidden"}`)), this._updateVisibilityAttribute(i.PRODUCT_IMAGE, t));
154
154
  }
155
155
  _onProductNameChange(t) {
156
156
  var o;
157
157
  const e = (o = this.currentNode) == null ? void 0 : o.querySelector(`[esd-extension-block-id="${s.NAME}"]`);
158
- e && (this.visibilityState[i.PRODUCT_NAME] = t, this.api.getDocumentModifier().modifyHtml(e).setStyle("display", t ? "table-cell" : "none").apply(new r(`Product name visibility changed to ${t ? "visible" : "hidden"}`)), this._updateVisibilityAttribute(i.PRODUCT_NAME, t));
158
+ e && (this.visibilityState[i.PRODUCT_NAME] = t, this.api.getDocumentModifier().modifyHtml(e).setStyle("display", t ? "table-cell" : "none").apply(new l(`Product name visibility changed to ${t ? "visible" : "hidden"}`)), this._updateVisibilityAttribute(i.PRODUCT_NAME, t));
159
159
  }
160
160
  _onProductQuantityChange(t) {
161
161
  var o;
162
162
  const e = (o = this.currentNode) == null ? void 0 : o.querySelector(`[esd-extension-block-id="${s.QUANTITY}"]`);
163
- e && (this.visibilityState[i.PRODUCT_QUANTITY] = t, this.api.getDocumentModifier().modifyHtml(e).setStyle("display", t ? "table-cell" : "none").apply(new r(
163
+ e && (this.visibilityState[i.PRODUCT_QUANTITY] = t, this.api.getDocumentModifier().modifyHtml(e).setStyle("display", t ? "table-cell" : "none").apply(new l(
164
164
  `Product quantity visibility changed to ${t ? "visible" : "hidden"}`
165
165
  )), this._updateVisibilityAttribute(i.PRODUCT_QUANTITY, t));
166
166
  }
167
167
  _onProductPriceChange(t) {
168
168
  var o;
169
169
  const e = (o = this.currentNode) == null ? void 0 : o.querySelector(`[esd-extension-block-id="${s.PRICE}"]`);
170
- e && (this.visibilityState[i.PRODUCT_PRICE] = t, this.api.getDocumentModifier().modifyHtml(e).setStyle("display", t ? "table-cell" : "none").apply(new r(`Product price visibility changed to ${t ? "visible" : "hidden"}`)), this._updateVisibilityAttribute(i.PRODUCT_PRICE, t));
170
+ e && (this.visibilityState[i.PRODUCT_PRICE] = t, this.api.getDocumentModifier().modifyHtml(e).setStyle("display", t ? "table-cell" : "none").apply(new l(`Product price visibility changed to ${t ? "visible" : "hidden"}`)), this._updateVisibilityAttribute(i.PRODUCT_PRICE, t), this._updatePriceCellWidthsForVerticalLayout());
171
171
  }
172
172
  _onProductOriginalPriceChange(t) {
173
173
  var o;
174
174
  const e = (o = this.currentNode) == null ? void 0 : o.querySelector(
175
175
  `[esd-extension-block-id="${s.ORIGINAL_PRICE}"]`
176
176
  );
177
- e && (this.visibilityState[i.PRODUCT_ORIGINAL_PRICE] = t, this.api.getDocumentModifier().modifyHtml(e).setStyle("display", t ? "table-cell" : "none").apply(new r(
177
+ e && (this.visibilityState[i.PRODUCT_ORIGINAL_PRICE] = t, this.api.getDocumentModifier().modifyHtml(e).setStyle("display", t ? "table-cell" : "none").apply(new l(
178
178
  `Product original price visibility changed to ${t ? "visible" : "hidden"}`
179
- )), this._updateVisibilityAttribute(i.PRODUCT_ORIGINAL_PRICE, t));
179
+ )), this._updateVisibilityAttribute(i.PRODUCT_ORIGINAL_PRICE, t), this._updatePriceCellWidthsForVerticalLayout());
180
+ }
181
+ /**
182
+ * Updates both price cell widths in vertical layout based on priceOrientation and visibility.
183
+ * - When priceOrientation is 'vertical': both cells are 100% (stacked layout)
184
+ * - When priceOrientation is 'horizontal':
185
+ * - When original price is hidden, price cell expands to 100%
186
+ * - When price is hidden, original price cell expands to 100%
187
+ * - When both are visible, they share 50% each
188
+ */
189
+ _updatePriceCellWidthsForVerticalLayout() {
190
+ var u, _;
191
+ if (!(this.store.orientation === h.ORIENTATION.VERTICAL))
192
+ return;
193
+ const e = (u = this.currentNode) == null ? void 0 : u.querySelector(".product-price-class"), o = (_ = this.currentNode) == null ? void 0 : _.querySelector(".product-original-price-class"), n = this.store.priceOrientation === "vertical", c = this.visibilityState[i.PRODUCT_PRICE], d = this.visibilityState[i.PRODUCT_ORIGINAL_PRICE], T = this.api.getDocumentModifier();
194
+ if (e) {
195
+ const C = n || !d ? "100%" : "50%";
196
+ T.modifyHtml(e).setStyle("width", C);
197
+ }
198
+ if (o) {
199
+ const C = n || !c ? "100%" : "50%";
200
+ T.modifyHtml(o).setStyle("width", C);
201
+ }
202
+ T.apply(new l("Updated price cell widths for vertical layout"));
180
203
  }
181
204
  _onProductButtonChange(t) {
182
205
  var o;
183
206
  const e = (o = this.currentNode) == null ? void 0 : o.querySelector(`[esd-extension-block-id="${s.BUTTON}"]`);
184
- e && (this.visibilityState[i.PRODUCT_BUTTON] = t, this.api.getDocumentModifier().modifyHtml(e).setStyle("display", t ? "table-cell" : "none").apply(new r(`Product button visibility changed to ${t ? "visible" : "hidden"}`)), this._updateVisibilityAttribute(i.PRODUCT_BUTTON, t));
207
+ e && (this.visibilityState[i.PRODUCT_BUTTON] = t, this.api.getDocumentModifier().modifyHtml(e).setStyle("display", t ? "table-cell" : "none").apply(new l(`Product button visibility changed to ${t ? "visible" : "hidden"}`)), this._updateVisibilityAttribute(i.PRODUCT_BUTTON, t));
185
208
  }
186
209
  }
187
210
  export {
188
- I as COMPOSITION_CONTROL_BLOCK_ID,
189
- N as ItemsBlockCardCompositionControl
211
+ b as COMPOSITION_CONTROL_BLOCK_ID,
212
+ S as ItemsBlockCardCompositionControl
190
213
  };
@@ -1,59 +1,52 @@
1
- var r = Object.defineProperty;
2
- var a = (o, t, e) => t in o ? r(o, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : o[t] = e;
3
- var i = (o, t, e) => a(o, typeof t != "symbol" ? t + "" : t, e);
4
- import { CommonControl as m } from "../../../common-control.js";
1
+ var a = Object.defineProperty;
2
+ var m = (t, e, n) => e in t ? a(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
3
+ var s = (t, e, n) => m(t, typeof e != "symbol" ? e + "" : e, n);
4
+ import { CommonControl as l } from "../../../common-control.js";
5
5
  import { ItemsBlockControlId as d } from "../../enums/controlEnums.js";
6
- import { useItemsBlockStore as l } from "../../store/items-block.js";
7
- import { syncImageLinkFromAttributes as h } from "../../utils/syncAttributesFromConfigBlock.js";
8
- import { updateConfigBlockAttributes as p } from "../../utils/updateAttributes.js";
9
- const s = d.IMAGE_LINK, n = {
6
+ import { useItemsBlockStore as L } from "../../store/items-block.js";
7
+ import { getItemsBlockConfig as p } from "../../utils/nodeConfigUtils.js";
8
+ const r = d.IMAGE_LINK, i = {
10
9
  LINK: "link"
11
10
  };
12
- class N extends m {
11
+ class g extends l {
13
12
  constructor() {
14
13
  super(...arguments);
15
- i(this, "store", l());
14
+ s(this, "store", L());
16
15
  }
17
16
  getId() {
18
- return s;
17
+ return r;
19
18
  }
20
19
  getTemplate() {
21
20
  return `
22
- <div class="${s}">
21
+ <div class="container ${r}">
23
22
  ${this._getLink()}
24
23
  </div>
25
24
  `;
26
25
  }
27
26
  onRender() {
28
27
  this.api.updateValues({
29
- [n.LINK]: this.store.imageLink
30
- }), this._listenToFormUpdates();
28
+ [i.LINK]: this.store.imageLink
29
+ });
31
30
  }
32
- onTemplateNodeUpdated(e) {
33
- super.onTemplateNodeUpdated(e), this.handleBlockInstanceChange(
34
- () => h(this.currentNode),
31
+ onTemplateNodeUpdated(n) {
32
+ super.onTemplateNodeUpdated(n), this.handleBlockInstanceChange(
33
+ () => {
34
+ const o = p(this.currentNode);
35
+ o != null && o.imageLink && this.store.setImageLink(o.imageLink);
36
+ },
35
37
  () => {
36
38
  this.api.updateValues({
37
- [n.LINK]: this.store.imageLink
39
+ [i.LINK]: this.store.imageLink
38
40
  });
39
41
  }
40
42
  );
41
43
  }
42
- _listenToFormUpdates() {
43
- this.api.onValueChanged(
44
- n.LINK,
45
- (e) => this._onLinkChange(e)
46
- );
47
- }
48
- _onLinkChange(e) {
49
- console.debug("Image link changed to: ", e), this.store.setImageLink(e), p(this.currentNode, this.api);
50
- }
51
44
  _getLink() {
52
45
  return `
53
46
  ${this._GuOneColumn([
54
47
  this._GuLabel({ text: "Link" }),
55
48
  this._GuTextInput({
56
- name: n.LINK,
49
+ name: i.LINK,
57
50
  placeholder: "Enter Link",
58
51
  className: "es-100",
59
52
  disabled: !0
@@ -63,6 +56,6 @@ class N extends m {
63
56
  }
64
57
  }
65
58
  export {
66
- s as CONTROL_BLOCK_ID,
67
- N as ImageLinkControl
59
+ r as CONTROL_BLOCK_ID,
60
+ g as ImageLinkControl
68
61
  };
@@ -1,65 +1,65 @@
1
1
  var d = Object.defineProperty;
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 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";
2
+ var g = (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) => g(i, typeof t != "symbol" ? t + "" : t, e);
4
+ import { ModificationDescription as a, UIElementType as l, UEAttr as h } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
5
5
  import { CommonControl as c } from "../../../common-control.js";
6
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 M } from "../../utils/syncAttributesFromConfigBlock.js";
10
- import { updateConfigBlockAttributes as u } from "../../utils/updateAttributes.js";
11
- const y = p.NAME_TRIMMING, o = {
9
+ import { getItemsBlockConfig as f, setItemsBlockConfig as M } from "../../utils/nodeConfigUtils.js";
10
+ const y = p.NAME_TRIMMING, m = {
12
11
  TRIMMING: "trimming"
13
12
  };
14
13
  class _ extends c {
15
14
  constructor() {
16
15
  super(...arguments);
17
- n(this, "store", N());
16
+ s(this, "store", N());
18
17
  }
19
18
  getId() {
20
19
  return y;
21
20
  }
22
21
  getTemplate() {
23
22
  return `
24
- <div class="${p.NAME_TRIMMING}">
23
+ <div class="container ${p.NAME_TRIMMING}">
25
24
  ${this._getTextTrimming()}
26
25
  </div>
27
26
  `;
28
27
  }
29
28
  onRender() {
30
- this.api.updateValues({ [o.TRIMMING]: this.store.nameTrimming }), this.api.onValueChanged(o.TRIMMING, (e) => {
29
+ this.api.updateValues({ [m.TRIMMING]: this.store.nameTrimming }), this.api.onValueChanged(m.TRIMMING, (e) => {
31
30
  this._onTrimmingChange(e);
32
31
  });
33
32
  }
34
33
  onTemplateNodeUpdated(e) {
35
34
  super.onTemplateNodeUpdated(e), this.handleBlockInstanceChange(
36
- () => M(this.currentNode),
37
35
  () => {
38
- this.api.updateValues({ [o.TRIMMING]: this.store.nameTrimming });
36
+ const o = f(this.currentNode);
37
+ o && this.store.setNameTrimming(o.nameTrimming ?? !0);
38
+ },
39
+ () => {
40
+ this.api.updateValues({ [m.TRIMMING]: this.store.nameTrimming });
39
41
  }
40
42
  );
41
43
  }
42
44
  _onTrimmingChange(e) {
43
- this.store.setNameTrimming(e), u(this.currentNode, this.api), this.api.updateValues({ [o.TRIMMING]: e }), this._applyTrimmingStyles(e);
45
+ this.store.setNameTrimming(e), M(this.currentNode, this.api, { nameTrimming: e }), this.api.updateValues({ [m.TRIMMING]: e }), this._applyTrimmingStyles(e);
44
46
  }
45
47
  _applyTrimmingStyles(e) {
46
- var s;
47
- const r = (s = this.currentNode) == null ? void 0 : s.querySelector("p > a");
48
- if (!r)
48
+ var r;
49
+ const o = (r = this.currentNode) == null ? void 0 : r.querySelector("p > a");
50
+ if (!o)
49
51
  return;
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
+ const T = e !== void 0 ? e : this.store.nameTrimming, n = this.store.orientation === I.ORIENTATION.VERTICAL;
53
+ T ? this.api.getDocumentModifier().modifyHtml(o).setStyle("white-space", "nowrap").setStyle("overflow", "hidden").setStyle("text-overflow", "ellipsis").setStyle("max-width", n ? "130px" : "520px").apply(new a("Text Trimming Enabled")) : this.api.getDocumentModifier().modifyHtml(o).removeStyle("white-space").removeStyle("overflow").removeStyle("text-overflow").removeStyle("max-width").setStyle("max-width", n ? "130px" : "520px").apply(new a("Text Trimming Disabled"));
52
54
  }
53
55
  _getTextTrimming() {
54
56
  return `
55
- <div class="container">
56
- <div class="display-flex align-items-center justify-content-between">
57
- <${l.LABEL}
58
- ${g.LABEL.text}="${this.api.translate("Text Trimming")}"
59
- >
60
- </${l.LABEL}>
61
- ${this._GuToggle(o.TRIMMING)}
62
- </div>
57
+ <div class="display-flex align-items-center justify-content-between">
58
+ <${l.LABEL}
59
+ ${h.LABEL.text}="${this.api.translate("Text Trimming")}"
60
+ >
61
+ </${l.LABEL}>
62
+ ${this._GuToggle(m.TRIMMING)}
63
63
  </div>
64
64
  `;
65
65
  }