@useinsider/guido 1.0.3-beta.3dd93d0 → 1.0.3-beta.3f12f40

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 (125) hide show
  1. package/README.md +32 -3
  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/components/organisms/onboarding/ItemsOnboarding.vue.js +4 -4
  6. package/dist/components/organisms/onboarding/ItemsOnboarding.vue2.js +41 -44
  7. package/dist/composables/useActionsApi.js +1 -1
  8. package/dist/composables/useHtmlCompiler.js +13 -15
  9. package/dist/composables/useHtmlValidator.js +35 -36
  10. package/dist/composables/useStripo.js +25 -29
  11. package/dist/enums/defaults.js +4 -5
  12. package/dist/enums/onboarding.js +2 -3
  13. package/dist/enums/unsubscribe.js +26 -27
  14. package/dist/extensions/Blocks/Checkbox/control.js +14 -15
  15. package/dist/extensions/Blocks/Checkbox/template.js +9 -14
  16. package/dist/extensions/Blocks/Items/block.js +26 -26
  17. package/dist/extensions/Blocks/Items/controls/cardComposition.js +57 -151
  18. package/dist/extensions/Blocks/Items/controls/name/trimming.js +25 -25
  19. package/dist/extensions/Blocks/Items/controls/settingsControl.js +129 -165
  20. package/dist/extensions/Blocks/Items/enums/controlEnums.js +2 -2
  21. package/dist/extensions/Blocks/Items/enums/productEnums.js +5 -84
  22. package/dist/extensions/Blocks/Items/enums/settingsEnums.js +2 -9
  23. package/dist/extensions/Blocks/Items/extension.js +6 -7
  24. package/dist/extensions/Blocks/Items/layouts/horizontal.html.js +56 -57
  25. package/dist/extensions/Blocks/Items/layouts/vertical.html.js +56 -67
  26. package/dist/extensions/Blocks/Items/settingsPanel.js +43 -69
  27. package/dist/extensions/Blocks/Items/store/items-block.js +4 -8
  28. package/dist/extensions/Blocks/Items/template.js +62 -147
  29. package/dist/extensions/Blocks/Items/utils/syncAttributesFromConfigBlock.js +26 -35
  30. package/dist/extensions/Blocks/Items/utils/updateAttributes.js +27 -29
  31. package/dist/extensions/Blocks/RadioButton/control.js +17 -18
  32. package/dist/extensions/Blocks/RadioButton/template.js +9 -18
  33. package/dist/extensions/Blocks/Unsubscribe/block.js +41 -45
  34. package/dist/guido.css +1 -1
  35. package/dist/node_modules/lodash-es/_arrayLikeKeys.js +12 -13
  36. package/dist/node_modules/lodash-es/keysIn.js +3 -3
  37. package/dist/services/stripoApi.js +26 -38
  38. package/dist/src/enums/defaults.d.ts +0 -1
  39. package/dist/src/enums/onboarding.d.ts +0 -1
  40. package/dist/src/extensions/Blocks/Checkbox/template.d.ts +1 -1
  41. package/dist/src/extensions/Blocks/Items/block.d.ts +0 -14
  42. package/dist/src/extensions/Blocks/Items/controls/cardComposition.d.ts +7 -20
  43. package/dist/src/extensions/Blocks/Items/controls/settingsControl.d.ts +2 -8
  44. package/dist/src/extensions/Blocks/Items/enums/controlEnums.d.ts +0 -1
  45. package/dist/src/extensions/Blocks/Items/enums/productEnums.d.ts +0 -9
  46. package/dist/src/extensions/Blocks/Items/enums/settingsEnums.d.ts +0 -7
  47. package/dist/src/extensions/Blocks/Items/store/items-block.d.ts +0 -2
  48. package/dist/src/extensions/Blocks/Items/template.d.ts +1 -9
  49. package/dist/src/extensions/Blocks/Items/utils/syncAttributesFromConfigBlock.d.ts +0 -6
  50. package/dist/src/extensions/Blocks/RadioButton/template.d.ts +1 -1
  51. package/dist/src/extensions/Blocks/Unsubscribe/block.d.ts +4 -3
  52. package/package.json +10 -5
  53. package/dist/config/compiler/itemsCompilerRules.js +0 -14
  54. package/dist/extensions/Blocks/Items/controls/price/priceOrientation.js +0 -92
  55. package/dist/node_modules/lodash-es/_DataView.js +0 -6
  56. package/dist/node_modules/lodash-es/_Promise.js +0 -6
  57. package/dist/node_modules/lodash-es/_Set.js +0 -6
  58. package/dist/node_modules/lodash-es/_SetCache.js +0 -13
  59. package/dist/node_modules/lodash-es/_WeakMap.js +0 -6
  60. package/dist/node_modules/lodash-es/_arrayFilter.js +0 -10
  61. package/dist/node_modules/lodash-es/_arrayMap.js +0 -8
  62. package/dist/node_modules/lodash-es/_arrayPush.js +0 -8
  63. package/dist/node_modules/lodash-es/_arraySome.js +0 -9
  64. package/dist/node_modules/lodash-es/_baseEach.js +0 -6
  65. package/dist/node_modules/lodash-es/_baseFlatten.js +0 -13
  66. package/dist/node_modules/lodash-es/_baseForOwn.js +0 -8
  67. package/dist/node_modules/lodash-es/_baseGet.js +0 -11
  68. package/dist/node_modules/lodash-es/_baseGetAllKeys.js +0 -9
  69. package/dist/node_modules/lodash-es/_baseHasIn.js +0 -6
  70. package/dist/node_modules/lodash-es/_baseIsEqual.js +0 -8
  71. package/dist/node_modules/lodash-es/_baseIsEqualDeep.js +0 -32
  72. package/dist/node_modules/lodash-es/_baseIsMatch.js +0 -29
  73. package/dist/node_modules/lodash-es/_baseIteratee.js +0 -11
  74. package/dist/node_modules/lodash-es/_baseKeys.js +0 -14
  75. package/dist/node_modules/lodash-es/_baseMap.js +0 -11
  76. package/dist/node_modules/lodash-es/_baseMatches.js +0 -12
  77. package/dist/node_modules/lodash-es/_baseMatchesProperty.js +0 -17
  78. package/dist/node_modules/lodash-es/_baseProperty.js +0 -8
  79. package/dist/node_modules/lodash-es/_basePropertyDeep.js +0 -9
  80. package/dist/node_modules/lodash-es/_baseRange.js +0 -9
  81. package/dist/node_modules/lodash-es/_baseToString.js +0 -18
  82. package/dist/node_modules/lodash-es/_baseTrim.js +0 -8
  83. package/dist/node_modules/lodash-es/_cacheHas.js +0 -6
  84. package/dist/node_modules/lodash-es/_castPath.js +0 -10
  85. package/dist/node_modules/lodash-es/_createBaseEach.js +0 -15
  86. package/dist/node_modules/lodash-es/_createRange.js +0 -11
  87. package/dist/node_modules/lodash-es/_equalArrays.js +0 -40
  88. package/dist/node_modules/lodash-es/_equalByTag.js +0 -45
  89. package/dist/node_modules/lodash-es/_equalObjects.js +0 -36
  90. package/dist/node_modules/lodash-es/_getAllKeys.js +0 -9
  91. package/dist/node_modules/lodash-es/_getMatchData.js +0 -12
  92. package/dist/node_modules/lodash-es/_getSymbols.js +0 -10
  93. package/dist/node_modules/lodash-es/_getTag.js +0 -28
  94. package/dist/node_modules/lodash-es/_hasPath.js +0 -19
  95. package/dist/node_modules/lodash-es/_isFlattenable.js +0 -10
  96. package/dist/node_modules/lodash-es/_isKey.js +0 -12
  97. package/dist/node_modules/lodash-es/_isStrictComparable.js +0 -7
  98. package/dist/node_modules/lodash-es/_mapToArray.js +0 -9
  99. package/dist/node_modules/lodash-es/_matchesStrictComparable.js +0 -8
  100. package/dist/node_modules/lodash-es/_memoizeCapped.js +0 -11
  101. package/dist/node_modules/lodash-es/_nativeKeys.js +0 -5
  102. package/dist/node_modules/lodash-es/_setCacheAdd.js +0 -7
  103. package/dist/node_modules/lodash-es/_setCacheHas.js +0 -6
  104. package/dist/node_modules/lodash-es/_setToArray.js +0 -9
  105. package/dist/node_modules/lodash-es/_stringToPath.js +0 -10
  106. package/dist/node_modules/lodash-es/_toKey.js +0 -10
  107. package/dist/node_modules/lodash-es/_trimmedEndIndex.js +0 -9
  108. package/dist/node_modules/lodash-es/flatMap.js +0 -8
  109. package/dist/node_modules/lodash-es/get.js +0 -8
  110. package/dist/node_modules/lodash-es/hasIn.js +0 -8
  111. package/dist/node_modules/lodash-es/isSymbol.js +0 -9
  112. package/dist/node_modules/lodash-es/keys.js +0 -9
  113. package/dist/node_modules/lodash-es/map.js +0 -11
  114. package/dist/node_modules/lodash-es/property.js +0 -10
  115. package/dist/node_modules/lodash-es/range.js +0 -5
  116. package/dist/node_modules/lodash-es/stubArray.js +0 -6
  117. package/dist/node_modules/lodash-es/toFinite.js +0 -14
  118. package/dist/node_modules/lodash-es/toNumber.js +0 -22
  119. package/dist/node_modules/lodash-es/toString.js +0 -7
  120. package/dist/src/config/compiler/itemsCompilerRules.d.ts +0 -2
  121. package/dist/src/extensions/Blocks/Items/controls/price/priceOrientation.d.ts +0 -15
  122. package/dist/src/utils/environmentUtil.d.ts +0 -5
  123. package/dist/src/utils/pairProductVariables.d.ts +0 -7
  124. package/dist/utils/environmentUtil.js +0 -4
  125. package/dist/utils/pairProductVariables.js +0 -136
@@ -1,26 +1,25 @@
1
- import { useTranslations as n } from "../composables/useTranslations.js";
2
- import { getEnvironmentPrefix as R } from "../utils/environmentUtil.js";
3
- const e = n(), I = {
1
+ import { useTranslations as e } from "../composables/useTranslations.js";
2
+ const s = e(), R = {
4
3
  UNSUBSCRIBE_LINK_TYPE: 1,
5
4
  PREFERENCES_LINK_TYPE: 3
6
- }, r = {
5
+ }, S = {
7
6
  UNSUBSCRIBE_LINK_REGEX: /{{ins-unsubscribe-link}}/g,
8
7
  DATA_OGSB_BUTTON_CSS_REGEX: "\\[data-ogsb\\]\\s*\\.es-button\\.es-button-[0-9]+\\s*\\{(?:[^\\}]*)\\}",
9
8
  GLOBAL_UNSUBSCRIBE_LINK_REGEX: /{{ins-global-unsubscribe-link}}/g,
10
9
  PREFERENCES_UNSUBSCRIBE_LINK_REGEX: /{{ins-preferences-unsubscribe-link}}/g
11
- }, s = R(), _ = {
12
- UNSUBSCRIBE_URL: `https://mail.${s}.com/user/v1/unsub`,
13
- PREFERENCES_URL: `https://mail.${s}.com/user/v1/prefs`
14
- }, i = "iid", B = {
10
+ }, N = {
11
+ UNSUBSCRIBE_URL: "https://mail.useinsider.com/user/v1/unsub",
12
+ PREFERENCES_URL: "https://mail.useinsider.com/user/v1/prefs"
13
+ }, I = "iid", _ = {
15
14
  name: "Global Unsubscribe",
16
15
  sendGridId: "G"
17
- }, C = "https://academy.useinsider.com/docs/global-unsubscribe-preference-center", c = "/email/unsubscribe-pages", E = {
16
+ }, i = "https://academy.useinsider.com/docs/global-unsubscribe-preference-center", r = "/email/unsubscribe-pages", E = {
18
17
  GLOBAL_UNSUBSCRIBE: 1,
19
18
  GLOBAL_UNSUBSCRIBE_CONFIRMATION_PAGE: 2,
20
19
  SUBSCRIPTION_PREFERENCE_CENTER: 3,
21
20
  SUBSCRIPTION_PREFERENCE_CONFIRMATION: 4,
22
21
  RESUBSCRIBE: 5
23
- }, t = {
22
+ }, B = {
24
23
  [E.GLOBAL_UNSUBSCRIBE]: [
25
24
  E.GLOBAL_UNSUBSCRIBE,
26
25
  E.GLOBAL_UNSUBSCRIBE_CONFIRMATION_PAGE,
@@ -30,27 +29,27 @@ const e = n(), I = {
30
29
  E.SUBSCRIPTION_PREFERENCE_CENTER,
31
30
  E.SUBSCRIPTION_PREFERENCE_CONFIRMATION
32
31
  ]
33
- }, U = {
34
- [E.GLOBAL_UNSUBSCRIBE]: e("unsubscription-preference.type-global-unsubscribe"),
35
- [E.GLOBAL_UNSUBSCRIBE_CONFIRMATION_PAGE]: e("unsubscription-preference.type-global-unsubscription-confirmation"),
36
- [E.RESUBSCRIBE]: e("unsubscription-preference.type-resubscribe"),
37
- [E.SUBSCRIPTION_PREFERENCE_CENTER]: e("unsubscription-preference.type-subscription-preferences-center"),
38
- [E.SUBSCRIPTION_PREFERENCE_CONFIRMATION]: e("unsubscription-preference.type-subscription-preferences-confirmation")
39
- }, o = {
32
+ }, C = {
33
+ [E.GLOBAL_UNSUBSCRIBE]: s("unsubscription-preference.type-global-unsubscribe"),
34
+ [E.GLOBAL_UNSUBSCRIBE_CONFIRMATION_PAGE]: s("unsubscription-preference.type-global-unsubscription-confirmation"),
35
+ [E.RESUBSCRIBE]: s("unsubscription-preference.type-resubscribe"),
36
+ [E.SUBSCRIPTION_PREFERENCE_CENTER]: s("unsubscription-preference.type-subscription-preferences-center"),
37
+ [E.SUBSCRIPTION_PREFERENCE_CONFIRMATION]: s("unsubscription-preference.type-subscription-preferences-confirmation")
38
+ }, c = {
40
39
  default: "{{ins-unsubscribe-link}}",
41
40
  [E.GLOBAL_UNSUBSCRIBE]: "{{ins-global-unsubscribe-link}}",
42
41
  [E.SUBSCRIPTION_PREFERENCE_CENTER]: "{{ins-preferences-unsubscribe-link}}"
43
42
  };
44
43
  export {
45
- C as ACADEMY_LINK,
46
- B as DEFAULT_UNSUBSCRIBE_GROUP,
47
- i as INSIDER_ID,
48
- r as LINK_REGEXES,
49
- I as LINK_TYPES,
50
- o as MERGE_TAGS,
44
+ i as ACADEMY_LINK,
45
+ _ as DEFAULT_UNSUBSCRIBE_GROUP,
46
+ I as INSIDER_ID,
47
+ S as LINK_REGEXES,
48
+ R as LINK_TYPES,
49
+ c as MERGE_TAGS,
51
50
  E as PAGE_TYPES,
52
- t as TYPE_COLLECTIONS,
53
- U as TYPE_TRANSLATIONS,
54
- c as UNSUBSCRIBE_PAGES_LINK,
55
- _ as URLS
51
+ B as TYPE_COLLECTIONS,
52
+ C as TYPE_TRANSLATIONS,
53
+ r as UNSUBSCRIBE_PAGES_LINK,
54
+ N as URLS
56
55
  };
@@ -2,9 +2,9 @@ var d = Object.defineProperty;
2
2
  var l = (r, n, e) => n in r ? d(r, n, { enumerable: !0, configurable: !0, writable: !0, value: e }) : r[n] = e;
3
3
  var o = (r, n, e) => l(r, typeof n != "symbol" ? n + "" : n, e);
4
4
  import { useHttp as L } from "../../../composables/useHttp.js";
5
- import { DEFAULT_UNSUBSCRIBE_GROUP as c } from "../../../enums/unsubscribe.js";
5
+ import { DEFAULT_UNSUBSCRIBE_GROUP as u } from "../../../enums/unsubscribe.js";
6
6
  import { Control as h, UIElementType as i, UEAttr as t, ModificationDescription as p } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
7
- const m = "ui-elements-checkbox", u = "select", { get: C } = L();
7
+ const m = "ui-elements-checkbox", a = "select", { get: C } = L();
8
8
  class S extends h {
9
9
  constructor() {
10
10
  super(...arguments);
@@ -16,16 +16,15 @@ class S extends h {
16
16
  return m;
17
17
  }
18
18
  _setFormValues() {
19
- if (this.selectedUnsubGroup = "", this.currentNode && "getAttribute" in this.currentNode) {
19
+ if (this.currentNode && "getAttribute" in this.currentNode) {
20
20
  const e = this.currentNode.getAttribute("id");
21
21
  if (e) {
22
- const s = e === c.sendGridId ? e : Number(e);
23
- s && (this.selectedUnsubGroup = s);
22
+ const s = e === u.sendGridId ? e : Number(e);
23
+ s && (this.selectedUnsubGroup = s, this.api.updateValues({
24
+ [a]: this.selectedUnsubGroup
25
+ }));
24
26
  }
25
27
  }
26
- this.api.updateValues({
27
- [u]: this.selectedUnsubGroup
28
- });
29
28
  }
30
29
  _getLabel(e, s = `${Math.random()}`) {
31
30
  return `
@@ -55,7 +54,7 @@ class S extends h {
55
54
  </${i.LABEL}>
56
55
 
57
56
  <${i.SELECTPICKER}
58
- ${t.SELECTPICKER.name}="${u}"
57
+ ${t.SELECTPICKER.name}="${a}"
59
58
  ${t.SELECTPICKER.placeholder}="${this.api.translate("Select Unsubscribe Group")}">
60
59
  ${this._getSelect()}
61
60
  </${i.SELECTPICKER}>
@@ -67,21 +66,21 @@ class S extends h {
67
66
  this.currentNode && this.api.getDocumentModifier().modifyHtml(this.currentNode).setAttribute("id", e.toString()).apply(new p(`Updated text to ${e}`));
68
67
  }
69
68
  _listenToFormUpdates() {
70
- this.api.onValueChanged(u, (e) => this._onSelectChange(e));
69
+ this.api.onValueChanged(a, (e) => this._onSelectChange(e));
71
70
  }
72
71
  onTemplateNodeUpdated(e) {
73
- this.currentNode = e, this._setFormValues();
72
+ this.currentNode = e;
74
73
  }
75
74
  // eslint-disable-next-line @typescript-eslint/no-misused-promises
76
75
  async onRender() {
77
76
  const e = await C(
78
77
  "/unsubscribe-groups/unsubscribe-list"
79
- ), s = [c, ...e.data], E = s.map((a) => ({
80
- [t.SELECT_ITEM.text]: a.name,
81
- [t.SELECT_ITEM.value]: a.sendGridId
78
+ ), s = [u, ...e.data], E = s.map((c) => ({
79
+ [t.SELECT_ITEM.text]: c.name,
80
+ [t.SELECT_ITEM.value]: c.sendGridId
82
81
  }));
83
82
  this.unsubList = s, this.api.setUIEAttribute(
84
- u,
83
+ a,
85
84
  t.SELECTPICKER.items,
86
85
  E
87
86
  ), this._setFormValues(), this._listenToFormUpdates();
@@ -3,7 +3,7 @@ const e = {
3
3
  TITLE: "Unsubscribe From All Email Lists",
4
4
  DESCRIPTION: "You will still receive important transactional and billing-related emails."
5
5
  }, l = `
6
- <td align="left" class="checkbox-block checkbox-block-v2 esd-block-checkbox es-p20">
6
+ <td align="left" class="checkbox-block-v2 esd-block-checkbox es-p20">
7
7
  <table cellpadding="0" cellspacing="0" role="presentation" width="100%">
8
8
  <tbody>
9
9
  <tr>
@@ -26,16 +26,11 @@ const e = {
26
26
  </tbody>
27
27
  </table>
28
28
  </td>
29
- `, o = `
30
- <td
31
- align="left"
32
- esd-extension-block-id="checkbox-block"
33
- class="
34
- checkbox-block
35
- checkbox-block-v2
36
- esd-block-checkbox
37
- esd-checkbox-block
38
- esd-extension-block es-p20"
29
+ `, i = `
30
+ <td
31
+ align="left"
32
+ esd-extension-block-id="checkbox-block"
33
+ class="checkbox-block-v2 esd-block-checkbox esd-checkbox-block esd-extension-block es-p20"
39
34
  >
40
35
  <table cellpadding="0" cellspacing="0" role="presentation" width="100%">
41
36
  <tbody>
@@ -60,10 +55,10 @@ const e = {
60
55
  </table>
61
56
  </td>
62
57
  `;
63
- function a() {
58
+ function c() {
64
59
  return l.replace("{-{-TITLE-}-}", `<p path="1">${e.TITLE}</p>`).replace("{-{-DESCRIPTION-}-}", `<p path="1">${e.DESCRIPTION}</p>`);
65
60
  }
66
61
  export {
67
- o as default,
68
- a as getDefaultTemplate
62
+ i as default,
63
+ c as getDefaultTemplate
69
64
  };
@@ -1,20 +1,19 @@
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 { useOnboardingStore as f } from "../../../stores/onboarding.js";
2
+ import { Block as _, BlockCompositionType as g, ModificationDescription as u } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
3
3
  import { configAttributes as t } from "./enums/productEnums.js";
4
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 {
5
+ import { useItemsBlockStore as d } from "./store/items-block.js";
6
+ import { getDefaultTemplate as D } from "./template.js";
7
+ const y = "items-block";
8
+ class V extends _ {
10
9
  getId() {
11
- return M;
10
+ return y;
12
11
  }
13
12
  getIcon() {
14
13
  return "items-icon";
15
14
  }
16
15
  getBlockCompositionType() {
17
- return L.CONTAINER;
16
+ return g.CONTAINER;
18
17
  }
19
18
  getName() {
20
19
  return this.api.translate("Items");
@@ -23,13 +22,14 @@ class x extends R {
23
22
  return this.api.translate("Items lets you display personalized products based on user behavior.");
24
23
  }
25
24
  getTemplate() {
26
- return V({
25
+ const r = d();
26
+ return D({
27
27
  orientation: l.ORIENTATION.HORIZONTAL,
28
28
  itemsType: l.ITEMS_TYPE.CART_ITEMS,
29
29
  itemId: "{{Abandoned Cart Item (1) Url}}",
30
- currencySymbol: e.productPriceCurrencySymbolControlValue,
31
- currencyLocation: e.productPriceCurrencyLocationControlValue,
32
- formattedPrice: e.productPriceFormattedControlValue === "1"
30
+ currencySymbol: r.currencySymbol,
31
+ currencyLocation: r.currencyLocation,
32
+ formattedPrice: r.formattedPrice
33
33
  });
34
34
  }
35
35
  allowInnerBlocksDND() {
@@ -39,29 +39,29 @@ class x extends R {
39
39
  const n = r.querySelector("esd-config-block");
40
40
  if (!n)
41
41
  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"));
42
+ const o = n, c = o.getAttribute("data-initialized") || "0", a = o.getAttribute(t.BLOCK_INSTANCE_ID), s = () => String(Date.now() + Math.floor(Math.random() * 1e3));
43
+ if (Number(c)) {
44
+ if (!a) {
45
+ const i = s();
46
+ this.api.getDocumentModifier().modifyHtml(o).setAttribute(t.BLOCK_INSTANCE_ID, i).apply(new u("Assign block instance ID to legacy block"));
47
47
  }
48
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(
49
+ const i = e.itemsType, m = e.cartItemsSelectControlValue, I = e.cardOrientationControlValue, C = e.productNameTrimmingControlValue, T = e.productPriceHideDiscountControlValue, E = e.productPriceFormattedControlValue, b = e.productPriceCurrencySymbolControlValue, O = e.productPriceCurrencyLocationControlValue, A = e.productButtonLinkControlValue, N = e.productImageLinkControlValue, p = s();
50
+ this.api.getDocumentModifier().modifyHtml(o).setAttribute("data-source", i).setAttribute(t.TYPE, i).setAttribute(t.ITEMS_INDEX_SELECT_CONTROL_VALUE, m).setAttribute(t.ORIENTATION, I).setAttribute(t.PRODUCT_NAME_TRIMMING, C).setAttribute(t.PRODUCT_PRICE_HIDE_DISCOUNT, T).setAttribute(t.PRODUCT_PRICE_FORMATTED, E).setAttribute(t.PRODUCT_PRICE_CURRENCY_SYMBOL, b).setAttribute(t.PRODUCT_PRICE_CURRENCY_LOCATION, O).setAttribute(t.PRODUCT_BUTTON_LINK, A).setAttribute(t.PRODUCT_IMAGE_LINK, N).setAttribute(t.BLOCK_INSTANCE_ID, p).setAttribute("data-initialized", "1").setAttribute(t.NAME_CONTROL_ENABLED, e.productNameControlEnabled).setAttribute(
51
51
  t.QUANTITY_CONTROL_ENABLED,
52
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");
53
+ ).setAttribute(t.PRICE_CONTROL_OPENED, e.productPriceControlOpened).apply(new u("Initialize config block attributes with defaults")), f().startOnboarding("itemsOnboarding");
54
54
  }
55
55
  }
56
56
  onSelect(r) {
57
- const n = r.querySelector("esd-config-block"), o = S();
57
+ const n = r.querySelector("esd-config-block"), o = d();
58
58
  if (!n)
59
59
  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);
60
+ const c = n, a = c.getAttribute(t.TYPE) || e.itemsType, s = c.getAttribute(t.ITEMS_INDEX_SELECT_CONTROL_VALUE) || e.cartItemsSelectControlValue, i = c.getAttribute(t.ORIENTATION) || e.cardOrientationControlValue;
61
+ o.setItemsType(a), o.setItemIds(s), o.setOrientation(i);
62
62
  }
63
63
  }
64
64
  export {
65
- M as BLOCK_ID,
66
- x as ItemsBlock
65
+ y as BLOCK_ID,
66
+ V as ItemsBlock
67
67
  };
@@ -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,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 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";
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";
5
5
  import { CommonControl as c } from "../../../common-control.js";
6
- import { ItemsBlockControlId as p } from "../../enums/controlEnums.js";
6
+ import { ItemsBlockControlId as l } 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 { syncNameTrimmingFromAttributes as y } from "../../utils/syncAttributesFromConfigBlock.js";
10
+ import { updateConfigBlockAttributes as M } from "../../utils/updateAttributes.js";
11
+ const f = l.NAME_TRIMMING, r = {
12
12
  TRIMMING: "trimming"
13
13
  };
14
- class _ extends c {
14
+ class R extends c {
15
15
  constructor() {
16
16
  super(...arguments);
17
- n(this, "store", N());
17
+ s(this, "store", N());
18
18
  }
19
19
  getId() {
20
- return y;
20
+ return f;
21
21
  }
22
22
  getTemplate() {
23
23
  return `
24
- <div class="${p.NAME_TRIMMING}">
24
+ <div class="${l.NAME_TRIMMING}">
25
25
  ${this._getTextTrimming()}
26
26
  </div>
27
27
  `;
28
28
  }
29
29
  onRender() {
30
- this.api.updateValues({ [o.TRIMMING]: this.store.nameTrimming }), this.api.onValueChanged(o.TRIMMING, (e) => {
30
+ this.api.updateValues({ [r.TRIMMING]: this.store.nameTrimming }), this.api.onValueChanged(r.TRIMMING, (e) => {
31
31
  this._onTrimmingChange(e);
32
32
  });
33
33
  }
34
34
  onTemplateNodeUpdated(e) {
35
35
  super.onTemplateNodeUpdated(e), this.handleBlockInstanceChange(
36
- () => M(this.currentNode),
36
+ () => y(this.currentNode),
37
37
  () => {
38
- this.api.updateValues({ [o.TRIMMING]: this.store.nameTrimming });
38
+ this.api.updateValues({ [r.TRIMMING]: this.store.nameTrimming });
39
39
  }
40
- );
40
+ ), this.store.nameTrimming && this._applyTrimmingStyles();
41
41
  }
42
42
  _onTrimmingChange(e) {
43
- this.store.setNameTrimming(e), u(this.currentNode, this.api), this.api.updateValues({ [o.TRIMMING]: e }), this._applyTrimmingStyles(e);
43
+ this.store.setNameTrimming(e), M(this.currentNode, this.api), this.api.updateValues({ [r.TRIMMING]: e }), this._applyTrimmingStyles(e);
44
44
  }
45
45
  _applyTrimmingStyles(e) {
46
- var s;
47
- const r = (s = this.currentNode) == null ? void 0 : s.querySelector("p > a");
48
- if (!r)
46
+ var m;
47
+ const o = (m = this.currentNode) == null ? void 0 : m.querySelector("p");
48
+ if (!o)
49
49
  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"));
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" : "100%").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"));
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
- <${l.LABEL}
57
+ <${a.LABEL}
58
58
  ${g.LABEL.text}="${this.api.translate("Text Trimming")}"
59
59
  >
60
- </${l.LABEL}>
61
- ${this._GuToggle(o.TRIMMING)}
60
+ </${a.LABEL}>
61
+ ${this._GuToggle(r.TRIMMING)}
62
62
  </div>
63
63
  </div>
64
64
  `;
65
65
  }
66
66
  }
67
67
  export {
68
- y as CONTROL_BLOCK_ID,
69
- _ as NameTrimmingControl
68
+ f as CONTROL_BLOCK_ID,
69
+ R as NameTrimmingControl
70
70
  };