@useinsider/guido 1.0.3-beta.cdff8ce → 1.0.3-beta.ce3ed00

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 (177) hide show
  1. package/README.md +32 -6
  2. package/dist/components/Guido.vue.js +1 -1
  3. package/dist/components/Guido.vue2.js +73 -79
  4. package/dist/components/organisms/LoadingWrapper.vue.js +1 -1
  5. package/dist/components/organisms/header/RightSlot.vue.js +1 -1
  6. package/dist/components/organisms/header/RightSlot.vue2.js +20 -21
  7. package/dist/components/organisms/onboarding/OnboardingWrapper.vue2.js +18 -20
  8. package/dist/composables/useActionsApi.js +1 -1
  9. package/dist/composables/useGuidoActions.js +9 -19
  10. package/dist/composables/useHtmlCompiler.js +13 -15
  11. package/dist/composables/useHtmlValidator.js +35 -36
  12. package/dist/composables/useStripo.js +41 -47
  13. package/dist/config/compiler/unsubscribeCompilerRules.js +28 -33
  14. package/dist/enums/defaults.js +1 -2
  15. package/dist/enums/onboarding.js +3 -7
  16. package/dist/enums/unsubscribe.js +25 -27
  17. package/dist/extensions/Blocks/Checkbox/control.js +14 -15
  18. package/dist/extensions/Blocks/Checkbox/template.js +9 -14
  19. package/dist/extensions/Blocks/Items/block.js +43 -40
  20. package/dist/extensions/Blocks/Items/controls/button/link.js +17 -25
  21. package/dist/extensions/Blocks/Items/controls/cardComposition.js +57 -151
  22. package/dist/extensions/Blocks/Items/controls/image/link.js +20 -28
  23. package/dist/extensions/Blocks/Items/controls/name/trimming.js +22 -29
  24. package/dist/extensions/Blocks/Items/controls/price/currencyLocation.js +18 -25
  25. package/dist/extensions/Blocks/Items/controls/price/currencySymbol.js +8 -18
  26. package/dist/extensions/Blocks/Items/controls/price/formattedPrice.js +30 -37
  27. package/dist/extensions/Blocks/Items/controls/price/hideDiscount.js +14 -37
  28. package/dist/extensions/Blocks/Items/controls/settingsControl.js +130 -167
  29. package/dist/extensions/Blocks/Items/enums/controlEnums.js +2 -2
  30. package/dist/extensions/Blocks/Items/enums/productEnums.js +5 -98
  31. package/dist/extensions/Blocks/Items/enums/settingsEnums.js +7 -21
  32. package/dist/extensions/Blocks/Items/extension.js +8 -9
  33. package/dist/extensions/Blocks/Items/layouts/horizontal.html.js +59 -57
  34. package/dist/extensions/Blocks/Items/layouts/vertical.html.js +61 -67
  35. package/dist/extensions/Blocks/Items/settingsPanel.js +43 -69
  36. package/dist/extensions/Blocks/Items/store/items-block.js +4 -12
  37. package/dist/extensions/Blocks/Items/template.js +63 -150
  38. package/dist/extensions/Blocks/RadioButton/control.js +17 -18
  39. package/dist/extensions/Blocks/RadioButton/template.js +9 -18
  40. package/dist/extensions/Blocks/Recommendation/store/recommendation.js +1 -1
  41. package/dist/extensions/Blocks/Unsubscribe/block.js +41 -45
  42. package/dist/extensions/Blocks/common-control.js +125 -164
  43. package/dist/extensions/DynamicContent/dynamic-content-modal.js +19 -25
  44. package/dist/extensions/DynamicContent/dynamic-content.js +33 -128
  45. package/dist/guido.css +1 -1
  46. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js +2 -12
  47. package/dist/node_modules/lodash-es/_arrayLikeKeys.js +12 -13
  48. package/dist/node_modules/lodash-es/keysIn.js +3 -3
  49. package/dist/package.json.js +1 -1
  50. package/dist/src/@types/generic.d.ts +6 -27
  51. package/dist/src/components/Guido.vue.d.ts +2 -3
  52. package/dist/src/composables/useGuidoActions.d.ts +0 -9
  53. package/dist/src/enums/onboarding.d.ts +0 -4
  54. package/dist/src/extensions/Blocks/Checkbox/template.d.ts +1 -1
  55. package/dist/src/extensions/Blocks/Items/block.d.ts +0 -15
  56. package/dist/src/extensions/Blocks/Items/controls/cardComposition.d.ts +7 -20
  57. package/dist/src/extensions/Blocks/Items/controls/price/currencySymbol.d.ts +0 -1
  58. package/dist/src/extensions/Blocks/Items/controls/price/hideDiscount.d.ts +1 -5
  59. package/dist/src/extensions/Blocks/Items/controls/settingsControl.d.ts +2 -8
  60. package/dist/src/extensions/Blocks/Items/enums/controlEnums.d.ts +0 -1
  61. package/dist/src/extensions/Blocks/Items/enums/productEnums.d.ts +0 -20
  62. package/dist/src/extensions/Blocks/Items/enums/settingsEnums.d.ts +0 -15
  63. package/dist/src/extensions/Blocks/Items/store/items-block.d.ts +1 -5
  64. package/dist/src/extensions/Blocks/Items/template.d.ts +1 -9
  65. package/dist/src/extensions/Blocks/RadioButton/template.d.ts +1 -1
  66. package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +1 -1
  67. package/dist/src/extensions/Blocks/Unsubscribe/block.d.ts +4 -3
  68. package/dist/src/extensions/Blocks/common-control.d.ts +2 -25
  69. package/dist/src/extensions/DynamicContent/dynamic-content-modal.d.ts +2 -9
  70. package/dist/src/extensions/DynamicContent/dynamic-content.d.ts +2 -52
  71. package/dist/src/stores/config.d.ts +2 -3
  72. package/dist/src/stores/dynamic-content.d.ts +3 -3
  73. package/dist/src/stores/editor.d.ts +1 -1
  74. package/dist/src/stores/onboarding.d.ts +1 -335
  75. package/dist/src/stores/preview.d.ts +1 -1
  76. package/dist/src/stores/recommendation.d.ts +1 -1
  77. package/dist/src/stores/save-as-template.d.ts +1 -1
  78. package/dist/src/stores/toaster.d.ts +1 -1
  79. package/dist/src/stores/unsubscribe.d.ts +1 -1
  80. package/dist/src/stores/version-history.d.ts +1 -1
  81. package/dist/src/utils/genericUtil.d.ts +0 -1
  82. package/dist/stores/config.js +5 -5
  83. package/dist/stores/dynamic-content.js +2 -2
  84. package/dist/stores/editor.js +1 -1
  85. package/dist/stores/onboarding.js +36 -44
  86. package/dist/stores/preview.js +1 -1
  87. package/dist/stores/recommendation.js +3 -3
  88. package/dist/stores/save-as-template.js +2 -2
  89. package/dist/stores/toaster.js +1 -1
  90. package/dist/stores/unsubscribe.js +1 -1
  91. package/dist/stores/version-history.js +4 -4
  92. package/dist/utils/genericUtil.js +6 -17
  93. package/package.json +12 -7
  94. package/dist/components/organisms/onboarding/ItemsOnboarding.vue.js +0 -21
  95. package/dist/components/organisms/onboarding/ItemsOnboarding.vue2.js +0 -99
  96. package/dist/config/compiler/itemsCompilerRules.js +0 -14
  97. package/dist/extensions/Blocks/Items/controls/price/priceOrientation.js +0 -92
  98. package/dist/extensions/Blocks/Items/utils/configBlockUtils.js +0 -17
  99. package/dist/extensions/Blocks/Items/utils/syncAttributeFromConfigBlock.js +0 -28
  100. package/dist/extensions/Blocks/Items/utils/syncAttributesFromConfigBlock.js +0 -76
  101. package/dist/extensions/Blocks/Items/utils/updateAttributes.js +0 -46
  102. package/dist/node_modules/lodash-es/_DataView.js +0 -6
  103. package/dist/node_modules/lodash-es/_Promise.js +0 -6
  104. package/dist/node_modules/lodash-es/_Set.js +0 -6
  105. package/dist/node_modules/lodash-es/_SetCache.js +0 -13
  106. package/dist/node_modules/lodash-es/_WeakMap.js +0 -6
  107. package/dist/node_modules/lodash-es/_arrayFilter.js +0 -10
  108. package/dist/node_modules/lodash-es/_arrayMap.js +0 -8
  109. package/dist/node_modules/lodash-es/_arrayPush.js +0 -8
  110. package/dist/node_modules/lodash-es/_arraySome.js +0 -9
  111. package/dist/node_modules/lodash-es/_baseEach.js +0 -6
  112. package/dist/node_modules/lodash-es/_baseFlatten.js +0 -13
  113. package/dist/node_modules/lodash-es/_baseForOwn.js +0 -8
  114. package/dist/node_modules/lodash-es/_baseGet.js +0 -11
  115. package/dist/node_modules/lodash-es/_baseGetAllKeys.js +0 -9
  116. package/dist/node_modules/lodash-es/_baseHasIn.js +0 -6
  117. package/dist/node_modules/lodash-es/_baseIsEqual.js +0 -8
  118. package/dist/node_modules/lodash-es/_baseIsEqualDeep.js +0 -32
  119. package/dist/node_modules/lodash-es/_baseIsMatch.js +0 -29
  120. package/dist/node_modules/lodash-es/_baseIteratee.js +0 -11
  121. package/dist/node_modules/lodash-es/_baseKeys.js +0 -14
  122. package/dist/node_modules/lodash-es/_baseMap.js +0 -11
  123. package/dist/node_modules/lodash-es/_baseMatches.js +0 -12
  124. package/dist/node_modules/lodash-es/_baseMatchesProperty.js +0 -17
  125. package/dist/node_modules/lodash-es/_baseProperty.js +0 -8
  126. package/dist/node_modules/lodash-es/_basePropertyDeep.js +0 -9
  127. package/dist/node_modules/lodash-es/_baseRange.js +0 -9
  128. package/dist/node_modules/lodash-es/_baseToString.js +0 -18
  129. package/dist/node_modules/lodash-es/_baseTrim.js +0 -8
  130. package/dist/node_modules/lodash-es/_cacheHas.js +0 -6
  131. package/dist/node_modules/lodash-es/_castPath.js +0 -10
  132. package/dist/node_modules/lodash-es/_createBaseEach.js +0 -15
  133. package/dist/node_modules/lodash-es/_createRange.js +0 -11
  134. package/dist/node_modules/lodash-es/_equalArrays.js +0 -40
  135. package/dist/node_modules/lodash-es/_equalByTag.js +0 -45
  136. package/dist/node_modules/lodash-es/_equalObjects.js +0 -36
  137. package/dist/node_modules/lodash-es/_getAllKeys.js +0 -9
  138. package/dist/node_modules/lodash-es/_getMatchData.js +0 -12
  139. package/dist/node_modules/lodash-es/_getSymbols.js +0 -10
  140. package/dist/node_modules/lodash-es/_getTag.js +0 -28
  141. package/dist/node_modules/lodash-es/_hasPath.js +0 -19
  142. package/dist/node_modules/lodash-es/_isFlattenable.js +0 -10
  143. package/dist/node_modules/lodash-es/_isKey.js +0 -12
  144. package/dist/node_modules/lodash-es/_isStrictComparable.js +0 -7
  145. package/dist/node_modules/lodash-es/_mapToArray.js +0 -9
  146. package/dist/node_modules/lodash-es/_matchesStrictComparable.js +0 -8
  147. package/dist/node_modules/lodash-es/_memoizeCapped.js +0 -11
  148. package/dist/node_modules/lodash-es/_nativeKeys.js +0 -5
  149. package/dist/node_modules/lodash-es/_setCacheAdd.js +0 -7
  150. package/dist/node_modules/lodash-es/_setCacheHas.js +0 -6
  151. package/dist/node_modules/lodash-es/_setToArray.js +0 -9
  152. package/dist/node_modules/lodash-es/_stringToPath.js +0 -10
  153. package/dist/node_modules/lodash-es/_toKey.js +0 -10
  154. package/dist/node_modules/lodash-es/_trimmedEndIndex.js +0 -9
  155. package/dist/node_modules/lodash-es/flatMap.js +0 -8
  156. package/dist/node_modules/lodash-es/get.js +0 -8
  157. package/dist/node_modules/lodash-es/hasIn.js +0 -8
  158. package/dist/node_modules/lodash-es/isSymbol.js +0 -9
  159. package/dist/node_modules/lodash-es/keys.js +0 -9
  160. package/dist/node_modules/lodash-es/map.js +0 -11
  161. package/dist/node_modules/lodash-es/property.js +0 -10
  162. package/dist/node_modules/lodash-es/range.js +0 -5
  163. package/dist/node_modules/lodash-es/stubArray.js +0 -6
  164. package/dist/node_modules/lodash-es/toFinite.js +0 -14
  165. package/dist/node_modules/lodash-es/toNumber.js +0 -22
  166. package/dist/node_modules/lodash-es/toString.js +0 -7
  167. package/dist/src/components/organisms/onboarding/ItemsOnboarding.vue.d.ts +0 -2
  168. package/dist/src/config/compiler/itemsCompilerRules.d.ts +0 -2
  169. package/dist/src/extensions/Blocks/Items/controls/price/priceOrientation.d.ts +0 -15
  170. package/dist/src/extensions/Blocks/Items/utils/configBlockUtils.d.ts +0 -23
  171. package/dist/src/extensions/Blocks/Items/utils/syncAttributeFromConfigBlock.d.ts +0 -32
  172. package/dist/src/extensions/Blocks/Items/utils/syncAttributesFromConfigBlock.d.ts +0 -50
  173. package/dist/src/extensions/Blocks/Items/utils/updateAttributes.d.ts +0 -8
  174. package/dist/src/utils/environmentUtil.d.ts +0 -5
  175. package/dist/src/utils/pairProductVariables.d.ts +0 -7
  176. package/dist/utils/environmentUtil.js +0 -4
  177. package/dist/utils/pairProductVariables.js +0 -136
@@ -1,20 +1,18 @@
1
- import { useOnboardingStore as y } from "../../../stores/onboarding.js";
2
- import { Block as R, BlockCompositionType as L, ModificationDescription as a } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
1
+ import { Block as b, BlockCompositionType as E, ModificationDescription as f } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
3
2
  import { configAttributes as t } from "./enums/productEnums.js";
4
- import { DefaultConfigValues as e, SETTINGS_ENUMS as l } from "./enums/settingsEnums.js";
5
- import { useItemsBlockStore as S } from "./store/items-block.js";
6
- import { getDefaultTemplate as V } from "./template.js";
7
- import { syncCurrencySymbolFromAttributes as B, syncCurrencyLocationFromAttributes as U, syncFormattedPriceFromAttributes as k } from "./utils/syncAttributesFromConfigBlock.js";
8
- const M = "items-block";
9
- class x extends R {
3
+ import { DefaultConfigValues as n, SETTINGS_ENUMS as m } from "./enums/settingsEnums.js";
4
+ import { useItemsBlockStore as p } from "./store/items-block.js";
5
+ import { getDefaultTemplate as A } from "./template.js";
6
+ const _ = "items-block";
7
+ class D extends b {
10
8
  getId() {
11
- return M;
9
+ return _;
12
10
  }
13
11
  getIcon() {
14
12
  return "items-icon";
15
13
  }
16
14
  getBlockCompositionType() {
17
- return L.CONTAINER;
15
+ return E.CONTAINER;
18
16
  }
19
17
  getName() {
20
18
  return this.api.translate("Items");
@@ -23,45 +21,50 @@ class x extends R {
23
21
  return this.api.translate("Items lets you display personalized products based on user behavior.");
24
22
  }
25
23
  getTemplate() {
26
- return V({
27
- orientation: l.ORIENTATION.HORIZONTAL,
28
- itemsType: l.ITEMS_TYPE.CART_ITEMS,
24
+ const e = p();
25
+ return A({
26
+ orientation: m.ORIENTATION.HORIZONTAL,
27
+ itemsType: m.ITEMS_TYPE.CART_ITEMS,
29
28
  itemId: "{{Abandoned Cart Item (1) Url}}",
30
- currencySymbol: e.productPriceCurrencySymbolControlValue,
31
- currencyLocation: e.productPriceCurrencyLocationControlValue,
32
- formattedPrice: e.productPriceFormattedControlValue === "1"
29
+ currencySymbol: e.currencySymbol,
30
+ currencyLocation: e.currencyLocation,
31
+ formattedPrice: e.formattedPrice
33
32
  });
34
33
  }
35
34
  allowInnerBlocksDND() {
36
35
  return !1;
37
36
  }
38
- onCreated(r) {
39
- const n = r.querySelector("esd-config-block");
40
- if (!n)
37
+ onCreated(e) {
38
+ const r = e.querySelector("esd-config-block");
39
+ if (!r)
41
40
  return;
42
- const o = n, s = o.getAttribute("data-initialized") || "0", u = o.getAttribute(t.BLOCK_INSTANCE_ID), c = () => String(Date.now() + Math.floor(Math.random() * 1e3));
43
- if (Number(s)) {
44
- if (!u) {
45
- const i = c();
46
- this.api.getDocumentModifier().modifyHtml(o).setAttribute(t.BLOCK_INSTANCE_ID, i).apply(new a("Assign block instance ID to legacy block"));
47
- }
48
- } else {
49
- const i = e.itemsType, I = e.cartItemsSelectControlValue, d = e.cardOrientationControlValue, m = e.productNameTrimmingControlValue, C = e.productPriceHideDiscountControlValue, b = e.productPriceFormattedControlValue, T = e.productPriceCurrencySymbolControlValue, A = e.productPriceCurrencyLocationControlValue, E = e.productButtonLinkControlValue, O = e.productImageLinkControlValue, _ = e.productImageVisible, p = e.productNameVisible, N = e.productQuantityVisible, f = e.productPriceVisible, g = e.productOriginalPriceVisible, D = e.productButtonVisible, P = c();
50
- this.api.getDocumentModifier().modifyHtml(o).setAttribute("data-source", i).setAttribute(t.TYPE, i).setAttribute(t.ITEMS_INDEX_SELECT_CONTROL_VALUE, I).setAttribute(t.ORIENTATION, d).setAttribute(t.PRODUCT_NAME_TRIMMING, m).setAttribute(t.PRODUCT_PRICE_HIDE_DISCOUNT, C).setAttribute(t.PRODUCT_PRICE_FORMATTED, b).setAttribute(t.PRODUCT_PRICE_CURRENCY_SYMBOL, T).setAttribute(t.PRODUCT_PRICE_CURRENCY_LOCATION, A).setAttribute(t.PRODUCT_BUTTON_LINK, E).setAttribute(t.PRODUCT_IMAGE_LINK, O).setAttribute(t.BLOCK_INSTANCE_ID, P).setAttribute("data-initialized", "1").setAttribute(t.NAME_CONTROL_ENABLED, e.productNameControlEnabled).setAttribute(
51
- t.QUANTITY_CONTROL_ENABLED,
52
- e.productQuantityControlEnabled
53
- ).setAttribute(t.PRICE_CONTROL_OPENED, e.productPriceControlOpened).setAttribute(t.PRODUCT_IMAGE_VISIBLE, _).setAttribute(t.PRODUCT_NAME_VISIBLE, p).setAttribute(t.PRODUCT_QUANTITY_VISIBLE, N).setAttribute(t.PRODUCT_PRICE_VISIBLE, f).setAttribute(t.PRODUCT_ORIGINAL_PRICE_VISIBLE, g).setAttribute(t.PRODUCT_BUTTON_VISIBLE, D).apply(new a("Initialize config block attributes with defaults")), y().startOnboarding("itemsOnboarding");
54
- }
55
- }
56
- onSelect(r) {
57
- const n = r.querySelector("esd-config-block"), o = S();
58
- if (!n)
41
+ const I = this.api.getDocumentModifier(), o = r, T = o.getAttribute("data-initialized"), i = p(), { itemsType: a, itemIds: s, orientation: c } = i;
42
+ if (T === "1") {
43
+ const d = o.getAttribute(t.TYPE), u = o.getAttribute(t.ITEMS_INDEX_SELECT_CONTROL_VALUE), l = o.getAttribute(t.ORIENTATION);
44
+ (d || u || l) && i.updateFromAttributes({
45
+ itemsType: d || void 0,
46
+ itemIds: u || void 0,
47
+ orientation: l || void 0
48
+ });
59
49
  return;
60
- const s = n, u = s.getAttribute(t.TYPE) || e.itemsType, c = s.getAttribute(t.ITEMS_INDEX_SELECT_CONTROL_VALUE) || e.cartItemsSelectControlValue, i = s.getAttribute(t.ORIENTATION) || e.cardOrientationControlValue;
61
- o.setItemsType(u), o.setItemIds(c), o.setOrientation(i), B(r), U(r), k(r);
50
+ }
51
+ I.modifyHtml(r).setAttribute(
52
+ t.TYPE,
53
+ a
54
+ ).setAttribute(
55
+ t.ITEMS_INDEX_SELECT_CONTROL_VALUE,
56
+ s
57
+ ).setAttribute(
58
+ t.ORIENTATION,
59
+ c
60
+ ).setAttribute("data-product_name_control_enabled", n.productNameControlEnabled).setAttribute("data-product_quantity_control_enabled", n.productQuantityControlEnabled).setAttribute("data-product_price_control_opened", n.productPriceControlOpened).setAttribute("data-initialized", "1").apply(new f("Initialize config block")), i.updateFromAttributes({
61
+ itemsType: a,
62
+ itemIds: s,
63
+ orientation: c
64
+ });
62
65
  }
63
66
  }
64
67
  export {
65
- M as BLOCK_ID,
66
- x as ItemsBlock
68
+ _ as BLOCK_ID,
69
+ D as ItemsBlock
67
70
  };
@@ -1,18 +1,16 @@
1
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);
4
- import { CommonControl as u } from "../../../common-control.js";
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 = {
2
+ var a = (n, e, t) => e in n ? r(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
3
+ var s = (n, e, t) => a(n, typeof e != "symbol" ? e + "" : e, t);
4
+ import { CommonControl as l } from "../../../common-control.js";
5
+ import { ItemsBlockControlId as u } from "../../enums/controlEnums.js";
6
+ import { useItemsBlockStore as L } from "../../store/items-block.js";
7
+ const i = u.BUTTON_LINK, o = {
10
8
  LINK: "link"
11
9
  };
12
- class C extends u {
10
+ class k extends l {
13
11
  constructor() {
14
12
  super(...arguments);
15
- s(this, "store", l());
13
+ s(this, "store", L());
16
14
  }
17
15
  getId() {
18
16
  return i;
@@ -26,43 +24,37 @@ class C extends u {
26
24
  }
27
25
  onRender() {
28
26
  this.api.updateValues({
29
- [n.LINK]: this.store.buttonLink
27
+ [o.LINK]: this.store.buttonLink
30
28
  }), this._listenToFormUpdates();
31
29
  }
32
30
  onTemplateNodeUpdated(t) {
33
- super.onTemplateNodeUpdated(t), this.handleBlockInstanceChange(
34
- () => h(this.currentNode),
35
- () => {
36
- this.api.updateValues({
37
- [n.LINK]: this.store.buttonLink
38
- });
39
- }
40
- );
31
+ this.currentNode = t, this.api.updateValues({
32
+ [o.LINK]: this.store.buttonLink
33
+ });
41
34
  }
42
35
  _listenToFormUpdates() {
43
36
  this.api.onValueChanged(
44
- n.LINK,
37
+ o.LINK,
45
38
  (t) => this._onLinkChange(t)
46
39
  );
47
40
  }
48
41
  _onLinkChange(t) {
49
- console.debug("Button link changed to: ", t), this.store.setButtonLink(t), m(this.currentNode, this.api);
42
+ console.debug("Button link changed to: ", t), this.store.setButtonLink(t);
50
43
  }
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: o.LINK,
57
50
  placeholder: "Enter Link",
58
- className: "es-100",
59
- disabled: !0
51
+ className: "es-100"
60
52
  })
61
53
  ])}
62
54
  `;
63
55
  }
64
56
  }
65
57
  export {
66
- C as ButtonLinkControl,
58
+ k as ButtonLinkControl,
67
59
  i as CONTROL_BLOCK_ID
68
60
  };
@@ -1,14 +1,7 @@
1
- var c = Object.defineProperty;
2
- var I = (a, n, t) => n in a ? c(a, n, { enumerable: !0, configurable: !0, writable: !0, value: t }) : a[n] = t;
3
- var _ = (a, n, t) => I(a, typeof n != "symbol" ? n + "" : n, t);
4
- import { ModificationDescription as l } from "../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
5
- import { CommonControl as R } from "../../common-control.js";
6
- import { ItemsBlockId as s } from "../enums/controlEnums.js";
7
- import { configAttributes as C } from "../enums/productEnums.js";
8
- import { SETTINGS_ENUMS as u } from "../enums/settingsEnums.js";
9
- import { useItemsBlockStore as O } from "../store/items-block.js";
10
- import { getConfigBlock as P, attributeToBoolean as U } from "../utils/configBlockUtils.js";
11
- const h = "ui-elements-items-card-composition-block", i = {
1
+ import { UIElementType as a, UEAttr as l, ModificationDescription as o } from "../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
2
+ import { CommonControl as s } from "../../common-control.js";
3
+ import { ItemsBlockId as r } from "../enums/controlEnums.js";
4
+ const d = "ui-elements-items-card-composition-block", i = {
12
5
  PRODUCT_IMAGE: "image",
13
6
  PRODUCT_NAME: "name",
14
7
  PRODUCT_QUANTITY: "quantity",
@@ -16,21 +9,9 @@ const h = "ui-elements-items-card-composition-block", i = {
16
9
  PRODUCT_ORIGINAL_PRICE: "originalPrice",
17
10
  PRODUCT_BUTTON: "button"
18
11
  };
19
- class g extends R {
20
- constructor() {
21
- super(...arguments);
22
- _(this, "store", O());
23
- _(this, "visibilityState", {
24
- [i.PRODUCT_IMAGE]: !0,
25
- [i.PRODUCT_NAME]: !0,
26
- [i.PRODUCT_QUANTITY]: !0,
27
- [i.PRODUCT_PRICE]: !0,
28
- [i.PRODUCT_ORIGINAL_PRICE]: !0,
29
- [i.PRODUCT_BUTTON]: !0
30
- });
31
- }
12
+ class g extends s {
32
13
  getId() {
33
- return h;
14
+ return d;
34
15
  }
35
16
  getTemplate() {
36
17
  return `
@@ -42,152 +23,77 @@ class g extends R {
42
23
  { name: i.PRODUCT_PRICE, label: "Product Price" },
43
24
  { name: i.PRODUCT_ORIGINAL_PRICE, label: "Product Original Price" },
44
25
  { name: i.PRODUCT_BUTTON, label: "Product Button" }
45
- ].map((e) => this._getToggleContainer(e)).join("")}
26
+ ].map((t) => this._getToggleContainer(t)).join("")}
46
27
  </div>
47
28
  `;
48
29
  }
49
30
  onRender() {
50
- this._syncVisibilityFromAttributes(), this._handleBrowsedItemsQuantity(), this._initializeToggles(), this._listenToFormUpdates();
31
+ this._initializeToggles(), this._listenToFormUpdates();
51
32
  }
52
- onTemplateNodeUpdated(t) {
53
- super.onTemplateNodeUpdated(t), this.handleBlockInstanceChange(
54
- () => {
55
- this._syncVisibilityFromAttributes(), this._handleBrowsedItemsQuantity(), this._applyVisibilityStyles();
56
- },
57
- () => {
58
- this._updateTogglesFromState();
59
- }
60
- );
33
+ onDestroy() {
61
34
  }
62
- _getToggleContainer({ name: t, label: e }) {
35
+ _getToggleContainer({ name: e, label: t }) {
63
36
  return `
64
- <div class="container" name="${t}Container">
37
+ <div class="container">
65
38
  <div class="display-flex align-items-center justify-content-between">
66
- ${this._GuLabel({ text: e, name: `${t}Label` })}
67
- ${this._GuToggle(t)}
39
+ <${a.LABEL} ${l.LABEL.text}="${t}"></${a.LABEL}>
40
+ ${this._GuToggle(e)}
68
41
  </div>
69
42
  </div>
70
43
  `;
71
44
  }
72
45
  _initializeToggles() {
73
- this._updateTogglesFromState();
74
- }
75
- _updateTogglesFromState() {
76
46
  this.api.updateValues({
77
- [i.PRODUCT_IMAGE]: this.visibilityState[i.PRODUCT_IMAGE],
78
- [i.PRODUCT_NAME]: this.visibilityState[i.PRODUCT_NAME],
79
- [i.PRODUCT_QUANTITY]: this.visibilityState[i.PRODUCT_QUANTITY],
80
- [i.PRODUCT_PRICE]: this.visibilityState[i.PRODUCT_PRICE],
81
- [i.PRODUCT_ORIGINAL_PRICE]: this.visibilityState[i.PRODUCT_ORIGINAL_PRICE],
82
- [i.PRODUCT_BUTTON]: this.visibilityState[i.PRODUCT_BUTTON]
83
- });
84
- }
85
- _syncVisibilityFromAttributes() {
86
- const t = P(this.currentNode);
87
- if (!t)
88
- return;
89
- const e = {
90
- [i.PRODUCT_IMAGE]: "PRODUCT_IMAGE_VISIBLE",
91
- [i.PRODUCT_NAME]: "PRODUCT_NAME_VISIBLE",
92
- [i.PRODUCT_QUANTITY]: "PRODUCT_QUANTITY_VISIBLE",
93
- [i.PRODUCT_PRICE]: "PRODUCT_PRICE_VISIBLE",
94
- [i.PRODUCT_ORIGINAL_PRICE]: "PRODUCT_ORIGINAL_PRICE_VISIBLE",
95
- [i.PRODUCT_BUTTON]: "PRODUCT_BUTTON_VISIBLE"
96
- };
97
- Object.entries(e).forEach(([o, r]) => {
98
- const T = t.getAttribute(C[r]);
99
- this.visibilityState[o] = U(T, !0);
100
- });
101
- }
102
- /**
103
- * If itemsType is not BROWSED_ITEMS, show quantity
104
- * If itemsType is BROWSED_ITEMS, hide quantity
105
- * and mark it as '0'
106
- */
107
- _handleBrowsedItemsQuantity() {
108
- var r;
109
- const t = this.store.itemsType !== u.ITEMS_TYPE.BROWSED_ITEMS, e = (r = this.currentNode) == null ? void 0 : r.querySelector("esd-config-block");
110
- if (!e)
111
- return;
112
- const o = e.getAttribute(C.PRODUCT_QUANTITY_VISIBLE) === "1";
113
- this.visibilityState[i.PRODUCT_QUANTITY] = t && o, this.api.setVisibility(`${i.PRODUCT_QUANTITY}Container`, t), this._updateVisibilityAttribute(i.PRODUCT_QUANTITY, t && o);
114
- }
115
- _applyVisibilityStyles() {
116
- const t = {
117
- [i.PRODUCT_IMAGE]: s.IMAGE,
118
- [i.PRODUCT_NAME]: s.NAME,
119
- [i.PRODUCT_QUANTITY]: s.QUANTITY,
120
- [i.PRODUCT_PRICE]: s.PRICE,
121
- [i.PRODUCT_ORIGINAL_PRICE]: s.ORIGINAL_PRICE,
122
- [i.PRODUCT_BUTTON]: s.BUTTON
123
- };
124
- Object.entries(t).forEach(([e, o]) => {
125
- var d;
126
- const r = (d = this.currentNode) == null ? void 0 : d.querySelector(`[esd-extension-block-id="${o}"]`);
127
- if (!r)
128
- return;
129
- const T = this.visibilityState[e];
130
- this.api.getDocumentModifier().modifyHtml(r).setStyle("display", T ? "table-cell" : "none").apply(new l(`Applied ${e} visibility from attributes`));
47
+ [i.PRODUCT_IMAGE]: !0,
48
+ [i.PRODUCT_NAME]: !0,
49
+ [i.PRODUCT_QUANTITY]: !0,
50
+ [i.PRODUCT_PRICE]: !0,
51
+ [i.PRODUCT_ORIGINAL_PRICE]: !0,
52
+ [i.PRODUCT_BUTTON]: !0
131
53
  });
132
54
  }
133
- _updateVisibilityAttribute(t, e) {
134
- const o = P(this.currentNode);
135
- if (!o)
136
- return;
137
- const T = {
138
- [i.PRODUCT_IMAGE]: "PRODUCT_IMAGE_VISIBLE",
139
- [i.PRODUCT_NAME]: "PRODUCT_NAME_VISIBLE",
140
- [i.PRODUCT_QUANTITY]: "PRODUCT_QUANTITY_VISIBLE",
141
- [i.PRODUCT_PRICE]: "PRODUCT_PRICE_VISIBLE",
142
- [i.PRODUCT_ORIGINAL_PRICE]: "PRODUCT_ORIGINAL_PRICE_VISIBLE",
143
- [i.PRODUCT_BUTTON]: "PRODUCT_BUTTON_VISIBLE"
144
- }[t];
145
- T && this.api.getDocumentModifier().modifyHtml(o).setAttribute(C[T], e ? "1" : "0").apply(new l(`Updated ${t} visibility attribute`));
146
- }
147
55
  _listenToFormUpdates() {
148
- this.api.onValueChanged(i.PRODUCT_IMAGE, (t) => this._onProductImageChange(t)), this.api.onValueChanged(i.PRODUCT_NAME, (t) => this._onProductNameChange(t)), this.api.onValueChanged(i.PRODUCT_QUANTITY, (t) => this._onProductQuantityChange(t)), this.api.onValueChanged(i.PRODUCT_PRICE, (t) => this._onProductPriceChange(t)), this.api.onValueChanged(
56
+ this.api.onValueChanged(i.PRODUCT_IMAGE, (e) => this._onProductImageChange(e)), this.api.onValueChanged(i.PRODUCT_NAME, (e) => this._onProductNameChange(e)), this.api.onValueChanged(i.PRODUCT_QUANTITY, (e) => this._onProductQuantityChange(e)), this.api.onValueChanged(i.PRODUCT_PRICE, (e) => this._onProductPriceChange(e)), this.api.onValueChanged(
149
57
  i.PRODUCT_ORIGINAL_PRICE,
150
- (t) => this._onProductOriginalPriceChange(t)
151
- ), this.api.onValueChanged(i.PRODUCT_BUTTON, (t) => this._onProductButtonChange(t));
152
- }
153
- _onProductImageChange(t) {
154
- var o;
155
- const e = (o = this.currentNode) == null ? void 0 : o.querySelector(`[esd-extension-block-id="${s.IMAGE}"]`);
156
- 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));
157
- }
158
- _onProductNameChange(t) {
159
- var o;
160
- const e = (o = this.currentNode) == null ? void 0 : o.querySelector(`[esd-extension-block-id="${s.NAME}"]`);
161
- 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));
162
- }
163
- _onProductQuantityChange(t) {
164
- var o;
165
- const e = (o = this.currentNode) == null ? void 0 : o.querySelector(`[esd-extension-block-id="${s.QUANTITY}"]`);
166
- e && (this.visibilityState[i.PRODUCT_QUANTITY] = t, this.api.getDocumentModifier().modifyHtml(e).setStyle("display", t ? "table-cell" : "none").apply(new l(
167
- `Product quantity visibility changed to ${t ? "visible" : "hidden"}`
168
- )), this._updateVisibilityAttribute(i.PRODUCT_QUANTITY, t));
169
- }
170
- _onProductPriceChange(t) {
171
- var o;
172
- const e = (o = this.currentNode) == null ? void 0 : o.querySelector(`[esd-extension-block-id="${s.PRICE}"]`);
173
- 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));
174
- }
175
- _onProductOriginalPriceChange(t) {
176
- var o;
177
- const e = (o = this.currentNode) == null ? void 0 : o.querySelector(
178
- `[esd-extension-block-id="${s.ORIGINAL_PRICE}"]`
179
- );
180
- e && (this.visibilityState[i.PRODUCT_ORIGINAL_PRICE] = t, this.api.getDocumentModifier().modifyHtml(e).setStyle("display", t ? "table-cell" : "none").apply(new l(
181
- `Product original price visibility changed to ${t ? "visible" : "hidden"}`
182
- )), this._updateVisibilityAttribute(i.PRODUCT_ORIGINAL_PRICE, t));
183
- }
184
- _onProductButtonChange(t) {
185
- var o;
186
- const e = (o = this.currentNode) == null ? void 0 : o.querySelector(`[esd-extension-block-id="${s.BUTTON}"]`);
187
- 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));
58
+ (e) => this._onProductOriginalPriceChange(e)
59
+ ), this.api.onValueChanged(i.PRODUCT_BUTTON, (e) => this._onProductButtonChange(e));
60
+ }
61
+ _onProductImageChange(e) {
62
+ var n;
63
+ const t = (n = this.currentNode) == null ? void 0 : n.querySelector(`[esd-extension-block-id="${r.IMAGE}"]`);
64
+ t && this.api.getDocumentModifier().modifyHtml(t).setStyle("display", e ? "table-cell" : "none").apply(new o(`Product image visibility changed to ${e ? "visible" : "hidden"}`));
65
+ }
66
+ _onProductNameChange(e) {
67
+ var n;
68
+ const t = (n = this.currentNode) == null ? void 0 : n.querySelector(`[esd-extension-block-id="${r.NAME}"]`);
69
+ t && this.api.getDocumentModifier().modifyHtml(t).setStyle("display", e ? "table-cell" : "none").apply(new o(`Product name visibility changed to ${e ? "visible" : "hidden"}`));
70
+ }
71
+ _onProductQuantityChange(e) {
72
+ var n;
73
+ const t = (n = this.currentNode) == null ? void 0 : n.querySelector(`[esd-extension-block-id="${r.QUANTITY}"]`);
74
+ t && this.api.getDocumentModifier().modifyHtml(t).setStyle("display", e ? "table-cell" : "none").apply(new o(
75
+ `Product quantity visibility changed to ${e ? "visible" : "hidden"}`
76
+ ));
77
+ }
78
+ _onProductPriceChange(e) {
79
+ var n;
80
+ const t = (n = this.currentNode) == null ? void 0 : n.querySelector(`[esd-extension-block-id="${r.PRICE}"]`);
81
+ t && this.api.getDocumentModifier().modifyHtml(t).setStyle("display", e ? "table-cell" : "none").apply(new o(`Product price visibility changed to ${e ? "visible" : "hidden"}`));
82
+ }
83
+ _onProductOriginalPriceChange(e) {
84
+ var n;
85
+ const t = (n = this.currentNode) == null ? void 0 : n.querySelector(`[esd-extension-block-id="${r.ORIGINAL_PRICE}"]`);
86
+ t && this.api.getDocumentModifier().modifyHtml(t).setStyle("display", e ? "table-cell" : "none").apply(new o(
87
+ `Product original price visibility changed to ${e ? "visible" : "hidden"}`
88
+ ));
89
+ }
90
+ _onProductButtonChange(e) {
91
+ var n;
92
+ const t = (n = this.currentNode) == null ? void 0 : n.querySelector(`[esd-extension-block-id="${r.BUTTON}"]`);
93
+ t && this.api.getDocumentModifier().modifyHtml(t).setStyle("display", e ? "table-cell" : "none").apply(new o(`Product button visibility changed to ${e ? "visible" : "hidden"}`));
188
94
  }
189
95
  }
190
96
  export {
191
- h as COMPOSITION_CONTROL_BLOCK_ID,
97
+ d as COMPOSITION_CONTROL_BLOCK_ID,
192
98
  g as ItemsBlockCardCompositionControl
193
99
  };
@@ -1,68 +1,60 @@
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);
1
+ var a = Object.defineProperty;
2
+ var r = (n, t, e) => t in n ? a(n, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[t] = e;
3
+ var s = (n, t, e) => r(n, typeof t != "symbol" ? t + "" : t, e);
4
4
  import { CommonControl as m } from "../../../common-control.js";
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 = {
5
+ import { ItemsBlockControlId as l } from "../../enums/controlEnums.js";
6
+ import { useItemsBlockStore as L } from "../../store/items-block.js";
7
+ const i = l.IMAGE_LINK, o = {
10
8
  LINK: "link"
11
9
  };
12
- class N extends m {
10
+ class u extends m {
13
11
  constructor() {
14
12
  super(...arguments);
15
- i(this, "store", l());
13
+ s(this, "store", L());
16
14
  }
17
15
  getId() {
18
- return s;
16
+ return i;
19
17
  }
20
18
  getTemplate() {
21
19
  return `
22
- <div class="${s}">
20
+ <div class="${i}">
23
21
  ${this._getLink()}
24
22
  </div>
25
23
  `;
26
24
  }
27
25
  onRender() {
28
26
  this.api.updateValues({
29
- [n.LINK]: this.store.imageLink
27
+ [o.LINK]: this.store.imageLink
30
28
  }), this._listenToFormUpdates();
31
29
  }
32
30
  onTemplateNodeUpdated(e) {
33
- super.onTemplateNodeUpdated(e), this.handleBlockInstanceChange(
34
- () => h(this.currentNode),
35
- () => {
36
- this.api.updateValues({
37
- [n.LINK]: this.store.imageLink
38
- });
39
- }
40
- );
31
+ this.currentNode = e, this.api.updateValues({
32
+ [o.LINK]: this.store.imageLink
33
+ });
41
34
  }
42
35
  _listenToFormUpdates() {
43
36
  this.api.onValueChanged(
44
- n.LINK,
37
+ o.LINK,
45
38
  (e) => this._onLinkChange(e)
46
39
  );
47
40
  }
48
41
  _onLinkChange(e) {
49
- console.debug("Image link changed to: ", e), this.store.setImageLink(e), p(this.currentNode, this.api);
42
+ console.debug("Image link changed to: ", e), this.store.setImageLink(e);
50
43
  }
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: o.LINK,
57
50
  placeholder: "Enter Link",
58
- className: "es-100",
59
- disabled: !0
51
+ className: "es-100"
60
52
  })
61
53
  ])}
62
54
  `;
63
55
  }
64
56
  }
65
57
  export {
66
- s as CONTROL_BLOCK_ID,
67
- N as ImageLinkControl
58
+ i as CONTROL_BLOCK_ID,
59
+ u as ImageLinkControl
68
60
  };
@@ -1,70 +1,63 @@
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 n, 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
- import { ItemsBlockControlId as p } from "../../enums/controlEnums.js";
6
+ import { ItemsBlockControlId as a } from "../../enums/controlEnums.js";
7
7
  import { SETTINGS_ENUMS as I } from "../../enums/settingsEnums.js";
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 = {
8
+ import { useItemsBlockStore as y } from "../../store/items-block.js";
9
+ const M = a.NAME_TRIMMING, r = {
12
10
  TRIMMING: "trimming"
13
11
  };
14
- class _ extends c {
12
+ class x extends c {
15
13
  constructor() {
16
14
  super(...arguments);
17
- n(this, "store", N());
15
+ s(this, "store", y());
18
16
  }
19
17
  getId() {
20
- return y;
18
+ return M;
21
19
  }
22
20
  getTemplate() {
23
21
  return `
24
- <div class="${p.NAME_TRIMMING}">
22
+ <div class="${a.NAME_TRIMMING}">
25
23
  ${this._getTextTrimming()}
26
24
  </div>
27
25
  `;
28
26
  }
29
27
  onRender() {
30
- this.api.updateValues({ [o.TRIMMING]: this.store.nameTrimming }), this.api.onValueChanged(o.TRIMMING, (e) => {
28
+ this.api.updateValues({ [r.TRIMMING]: this.store.nameTrimming }), this.api.onValueChanged(r.TRIMMING, (e) => {
31
29
  this._onTrimmingChange(e);
32
30
  });
33
31
  }
34
32
  onTemplateNodeUpdated(e) {
35
- super.onTemplateNodeUpdated(e), this.handleBlockInstanceChange(
36
- () => M(this.currentNode),
37
- () => {
38
- this.api.updateValues({ [o.TRIMMING]: this.store.nameTrimming });
39
- }
40
- );
33
+ this.currentNode = e, this.api.updateValues({ [r.TRIMMING]: this.store.nameTrimming }), this.store.nameTrimming && this._applyTrimmingStyles();
41
34
  }
42
35
  _onTrimmingChange(e) {
43
- this.store.setNameTrimming(e), u(this.currentNode, this.api), this.api.updateValues({ [o.TRIMMING]: e }), this._applyTrimmingStyles(e);
36
+ this.store.setNameTrimming(e), this._applyTrimmingStyles(e);
44
37
  }
45
38
  _applyTrimmingStyles(e) {
46
- var s;
47
- const r = (s = this.currentNode) == null ? void 0 : s.querySelector("p > a");
48
- if (!r)
39
+ var o;
40
+ const m = (o = this.currentNode) == null ? void 0 : o.querySelector("p");
41
+ if (!m)
49
42
  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"));
43
+ const T = e !== void 0 ? e : this.store.nameTrimming, p = this.store.orientation === I.ORIENTATION.VERTICAL;
44
+ T ? this.api.getDocumentModifier().modifyHtml(m).setStyle("white-space", "nowrap").setStyle("overflow", "hidden").setStyle("text-overflow", "ellipsis").setStyle("max-width", p ? "130px" : "100%").apply(new n("Text Trimming Enabled")) : this.api.getDocumentModifier().modifyHtml(m).removeStyle("white-space").removeStyle("overflow").removeStyle("text-overflow").removeStyle("max-width").apply(new n("Text Trimming Disabled"));
52
45
  }
53
46
  _getTextTrimming() {
54
47
  return `
55
48
  <div class="container">
56
49
  <div class="display-flex align-items-center justify-content-between">
57
50
  <${l.LABEL}
58
- ${g.LABEL.text}="${this.api.translate("Text Trimming")}"
51
+ ${h.LABEL.text}="${this.api.translate("Text Trimming")}"
59
52
  >
60
53
  </${l.LABEL}>
61
- ${this._GuToggle(o.TRIMMING)}
54
+ ${this._GuToggle(r.TRIMMING)}
62
55
  </div>
63
56
  </div>
64
57
  `;
65
58
  }
66
59
  }
67
60
  export {
68
- y as CONTROL_BLOCK_ID,
69
- _ as NameTrimmingControl
61
+ M as CONTROL_BLOCK_ID,
62
+ x as NameTrimmingControl
70
63
  };