@useinsider/guido 1.0.3-beta.cd0d7f3 → 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 (163) hide show
  1. package/README.md +0 -3
  2. package/dist/components/Guido.vue.js +1 -1
  3. package/dist/components/Guido.vue2.js +73 -79
  4. package/dist/components/organisms/header/RightSlot.vue.js +1 -1
  5. package/dist/components/organisms/header/RightSlot.vue2.js +22 -23
  6. package/dist/components/organisms/onboarding/OnboardingWrapper.vue2.js +18 -20
  7. package/dist/composables/useActionsApi.js +1 -1
  8. package/dist/composables/useGuidoActions.js +9 -19
  9. package/dist/composables/useHtmlCompiler.js +13 -15
  10. package/dist/composables/useHtmlValidator.js +35 -36
  11. package/dist/composables/useStripo.js +36 -38
  12. package/dist/config/compiler/unsubscribeCompilerRules.js +28 -33
  13. package/dist/enums/defaults.js +1 -2
  14. package/dist/enums/onboarding.js +3 -7
  15. package/dist/enums/unsubscribe.js +25 -27
  16. package/dist/extensions/Blocks/Items/block.js +42 -38
  17. package/dist/extensions/Blocks/Items/controls/button/link.js +17 -25
  18. package/dist/extensions/Blocks/Items/controls/cardComposition.js +57 -151
  19. package/dist/extensions/Blocks/Items/controls/image/link.js +20 -28
  20. package/dist/extensions/Blocks/Items/controls/name/trimming.js +22 -29
  21. package/dist/extensions/Blocks/Items/controls/price/currencyLocation.js +18 -25
  22. package/dist/extensions/Blocks/Items/controls/price/currencySymbol.js +8 -18
  23. package/dist/extensions/Blocks/Items/controls/price/formattedPrice.js +30 -37
  24. package/dist/extensions/Blocks/Items/controls/price/hideDiscount.js +14 -37
  25. package/dist/extensions/Blocks/Items/controls/settingsControl.js +118 -148
  26. package/dist/extensions/Blocks/Items/enums/productEnums.js +5 -96
  27. package/dist/extensions/Blocks/Items/enums/settingsEnums.js +7 -20
  28. package/dist/extensions/Blocks/Items/extension.js +4 -4
  29. package/dist/extensions/Blocks/Items/layouts/horizontal.html.js +8 -6
  30. package/dist/extensions/Blocks/Items/layouts/vertical.html.js +12 -7
  31. package/dist/extensions/Blocks/Items/settingsPanel.js +45 -71
  32. package/dist/extensions/Blocks/Items/store/items-block.js +1 -5
  33. package/dist/extensions/Blocks/Items/template.js +63 -149
  34. package/dist/extensions/Blocks/Recommendation/store/recommendation.js +1 -1
  35. package/dist/extensions/Blocks/common-control.js +125 -164
  36. package/dist/extensions/DynamicContent/dynamic-content-modal.js +19 -25
  37. package/dist/extensions/DynamicContent/dynamic-content.js +33 -128
  38. package/dist/guido.css +1 -1
  39. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js +2 -12
  40. package/dist/node_modules/lodash-es/_arrayLikeKeys.js +12 -13
  41. package/dist/node_modules/lodash-es/keysIn.js +3 -3
  42. package/dist/package.json.js +1 -1
  43. package/dist/src/@types/generic.d.ts +6 -27
  44. package/dist/src/components/Guido.vue.d.ts +2 -3
  45. package/dist/src/composables/useGuidoActions.d.ts +0 -9
  46. package/dist/src/enums/onboarding.d.ts +0 -4
  47. package/dist/src/extensions/Blocks/Items/block.d.ts +0 -1
  48. package/dist/src/extensions/Blocks/Items/controls/cardComposition.d.ts +7 -20
  49. package/dist/src/extensions/Blocks/Items/controls/price/currencySymbol.d.ts +0 -1
  50. package/dist/src/extensions/Blocks/Items/controls/price/hideDiscount.d.ts +1 -5
  51. package/dist/src/extensions/Blocks/Items/controls/settingsControl.d.ts +0 -3
  52. package/dist/src/extensions/Blocks/Items/enums/productEnums.d.ts +0 -18
  53. package/dist/src/extensions/Blocks/Items/enums/settingsEnums.d.ts +0 -14
  54. package/dist/src/extensions/Blocks/Items/store/items-block.d.ts +1 -3
  55. package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +1 -1
  56. package/dist/src/extensions/Blocks/common-control.d.ts +2 -25
  57. package/dist/src/extensions/DynamicContent/dynamic-content-modal.d.ts +2 -9
  58. package/dist/src/extensions/DynamicContent/dynamic-content.d.ts +2 -52
  59. package/dist/src/stores/config.d.ts +2 -3
  60. package/dist/src/stores/dynamic-content.d.ts +3 -3
  61. package/dist/src/stores/editor.d.ts +1 -1
  62. package/dist/src/stores/onboarding.d.ts +1 -335
  63. package/dist/src/stores/preview.d.ts +1 -1
  64. package/dist/src/stores/recommendation.d.ts +1 -1
  65. package/dist/src/stores/save-as-template.d.ts +1 -1
  66. package/dist/src/stores/toaster.d.ts +1 -1
  67. package/dist/src/stores/unsubscribe.d.ts +1 -1
  68. package/dist/src/stores/version-history.d.ts +1 -1
  69. package/dist/src/utils/genericUtil.d.ts +0 -1
  70. package/dist/stores/config.js +5 -5
  71. package/dist/stores/dynamic-content.js +2 -2
  72. package/dist/stores/editor.js +1 -1
  73. package/dist/stores/onboarding.js +36 -44
  74. package/dist/stores/preview.js +1 -1
  75. package/dist/stores/recommendation.js +3 -3
  76. package/dist/stores/save-as-template.js +2 -2
  77. package/dist/stores/toaster.js +1 -1
  78. package/dist/stores/unsubscribe.js +1 -1
  79. package/dist/stores/version-history.js +4 -4
  80. package/dist/utils/genericUtil.js +6 -17
  81. package/package.json +3 -3
  82. package/dist/components/organisms/onboarding/ItemsOnboarding.vue.js +0 -21
  83. package/dist/components/organisms/onboarding/ItemsOnboarding.vue2.js +0 -99
  84. package/dist/config/compiler/itemsCompilerRules.js +0 -14
  85. package/dist/extensions/Blocks/Items/utils/configBlockUtils.js +0 -17
  86. package/dist/extensions/Blocks/Items/utils/syncAttributeFromConfigBlock.js +0 -28
  87. package/dist/extensions/Blocks/Items/utils/syncAttributesFromConfigBlock.js +0 -67
  88. package/dist/extensions/Blocks/Items/utils/updateAttributes.js +0 -44
  89. package/dist/node_modules/lodash-es/_DataView.js +0 -6
  90. package/dist/node_modules/lodash-es/_Promise.js +0 -6
  91. package/dist/node_modules/lodash-es/_Set.js +0 -6
  92. package/dist/node_modules/lodash-es/_SetCache.js +0 -13
  93. package/dist/node_modules/lodash-es/_WeakMap.js +0 -6
  94. package/dist/node_modules/lodash-es/_arrayFilter.js +0 -10
  95. package/dist/node_modules/lodash-es/_arrayMap.js +0 -8
  96. package/dist/node_modules/lodash-es/_arrayPush.js +0 -8
  97. package/dist/node_modules/lodash-es/_arraySome.js +0 -9
  98. package/dist/node_modules/lodash-es/_baseEach.js +0 -6
  99. package/dist/node_modules/lodash-es/_baseFlatten.js +0 -13
  100. package/dist/node_modules/lodash-es/_baseForOwn.js +0 -8
  101. package/dist/node_modules/lodash-es/_baseGet.js +0 -11
  102. package/dist/node_modules/lodash-es/_baseGetAllKeys.js +0 -9
  103. package/dist/node_modules/lodash-es/_baseHasIn.js +0 -6
  104. package/dist/node_modules/lodash-es/_baseIsEqual.js +0 -8
  105. package/dist/node_modules/lodash-es/_baseIsEqualDeep.js +0 -32
  106. package/dist/node_modules/lodash-es/_baseIsMatch.js +0 -29
  107. package/dist/node_modules/lodash-es/_baseIteratee.js +0 -11
  108. package/dist/node_modules/lodash-es/_baseKeys.js +0 -14
  109. package/dist/node_modules/lodash-es/_baseMap.js +0 -11
  110. package/dist/node_modules/lodash-es/_baseMatches.js +0 -12
  111. package/dist/node_modules/lodash-es/_baseMatchesProperty.js +0 -17
  112. package/dist/node_modules/lodash-es/_baseProperty.js +0 -8
  113. package/dist/node_modules/lodash-es/_basePropertyDeep.js +0 -9
  114. package/dist/node_modules/lodash-es/_baseRange.js +0 -9
  115. package/dist/node_modules/lodash-es/_baseToString.js +0 -18
  116. package/dist/node_modules/lodash-es/_baseTrim.js +0 -8
  117. package/dist/node_modules/lodash-es/_cacheHas.js +0 -6
  118. package/dist/node_modules/lodash-es/_castPath.js +0 -10
  119. package/dist/node_modules/lodash-es/_createBaseEach.js +0 -15
  120. package/dist/node_modules/lodash-es/_createRange.js +0 -11
  121. package/dist/node_modules/lodash-es/_equalArrays.js +0 -40
  122. package/dist/node_modules/lodash-es/_equalByTag.js +0 -45
  123. package/dist/node_modules/lodash-es/_equalObjects.js +0 -36
  124. package/dist/node_modules/lodash-es/_getAllKeys.js +0 -9
  125. package/dist/node_modules/lodash-es/_getMatchData.js +0 -12
  126. package/dist/node_modules/lodash-es/_getSymbols.js +0 -10
  127. package/dist/node_modules/lodash-es/_getTag.js +0 -28
  128. package/dist/node_modules/lodash-es/_hasPath.js +0 -19
  129. package/dist/node_modules/lodash-es/_isFlattenable.js +0 -10
  130. package/dist/node_modules/lodash-es/_isKey.js +0 -12
  131. package/dist/node_modules/lodash-es/_isStrictComparable.js +0 -7
  132. package/dist/node_modules/lodash-es/_mapToArray.js +0 -9
  133. package/dist/node_modules/lodash-es/_matchesStrictComparable.js +0 -8
  134. package/dist/node_modules/lodash-es/_memoizeCapped.js +0 -11
  135. package/dist/node_modules/lodash-es/_nativeKeys.js +0 -5
  136. package/dist/node_modules/lodash-es/_setCacheAdd.js +0 -7
  137. package/dist/node_modules/lodash-es/_setCacheHas.js +0 -6
  138. package/dist/node_modules/lodash-es/_setToArray.js +0 -9
  139. package/dist/node_modules/lodash-es/_stringToPath.js +0 -10
  140. package/dist/node_modules/lodash-es/_toKey.js +0 -10
  141. package/dist/node_modules/lodash-es/_trimmedEndIndex.js +0 -9
  142. package/dist/node_modules/lodash-es/flatMap.js +0 -8
  143. package/dist/node_modules/lodash-es/get.js +0 -8
  144. package/dist/node_modules/lodash-es/hasIn.js +0 -8
  145. package/dist/node_modules/lodash-es/isSymbol.js +0 -9
  146. package/dist/node_modules/lodash-es/keys.js +0 -9
  147. package/dist/node_modules/lodash-es/map.js +0 -11
  148. package/dist/node_modules/lodash-es/property.js +0 -10
  149. package/dist/node_modules/lodash-es/range.js +0 -5
  150. package/dist/node_modules/lodash-es/stubArray.js +0 -6
  151. package/dist/node_modules/lodash-es/toFinite.js +0 -14
  152. package/dist/node_modules/lodash-es/toNumber.js +0 -22
  153. package/dist/node_modules/lodash-es/toString.js +0 -7
  154. package/dist/src/components/organisms/onboarding/ItemsOnboarding.vue.d.ts +0 -2
  155. package/dist/src/config/compiler/itemsCompilerRules.d.ts +0 -2
  156. package/dist/src/extensions/Blocks/Items/utils/configBlockUtils.d.ts +0 -23
  157. package/dist/src/extensions/Blocks/Items/utils/syncAttributeFromConfigBlock.d.ts +0 -32
  158. package/dist/src/extensions/Blocks/Items/utils/syncAttributesFromConfigBlock.d.ts +0 -44
  159. package/dist/src/extensions/Blocks/Items/utils/updateAttributes.d.ts +0 -8
  160. package/dist/src/utils/environmentUtil.d.ts +0 -5
  161. package/dist/src/utils/pairProductVariables.d.ts +0 -7
  162. package/dist/utils/environmentUtil.js +0 -4
  163. package/dist/utils/pairProductVariables.js +0 -136
@@ -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,27 +1,25 @@
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 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";
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 l } 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 y } from "../../utils/syncAttributesFromConfigBlock.js";
10
- import { updateConfigBlockAttributes as M } from "../../utils/updateAttributes.js";
11
- const f = l.NAME_TRIMMING, r = {
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 R extends c {
12
+ class x extends c {
15
13
  constructor() {
16
14
  super(...arguments);
17
- s(this, "store", N());
15
+ s(this, "store", y());
18
16
  }
19
17
  getId() {
20
- return f;
18
+ return M;
21
19
  }
22
20
  getTemplate() {
23
21
  return `
24
- <div class="${l.NAME_TRIMMING}">
22
+ <div class="${a.NAME_TRIMMING}">
25
23
  ${this._getTextTrimming()}
26
24
  </div>
27
25
  `;
@@ -32,32 +30,27 @@ class R extends c {
32
30
  });
33
31
  }
34
32
  onTemplateNodeUpdated(e) {
35
- super.onTemplateNodeUpdated(e), this.handleBlockInstanceChange(
36
- () => y(this.currentNode),
37
- () => {
38
- this.api.updateValues({ [r.TRIMMING]: this.store.nameTrimming });
39
- }
40
- ), this.store.nameTrimming && this._applyTrimmingStyles();
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), M(this.currentNode, this.api), this.api.updateValues({ [r.TRIMMING]: e }), this._applyTrimmingStyles(e);
36
+ this.store.setNameTrimming(e), this._applyTrimmingStyles(e);
44
37
  }
45
38
  _applyTrimmingStyles(e) {
46
- var m;
47
- const o = (m = this.currentNode) == null ? void 0 : m.querySelector("p");
48
- if (!o)
39
+ var o;
40
+ const m = (o = this.currentNode) == null ? void 0 : o.querySelector("p");
41
+ if (!m)
49
42
  return;
50
- const p = e !== void 0 ? e : this.store.nameTrimming, T = this.store.orientation === I.ORIENTATION.VERTICAL;
51
- p ? this.api.getDocumentModifier().modifyHtml(o).setStyle("white-space", "nowrap").setStyle("overflow", "hidden").setStyle("text-overflow", "ellipsis").setStyle("max-width", T ? "130px" : "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"));
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
- <${a.LABEL}
58
- ${g.LABEL.text}="${this.api.translate("Text Trimming")}"
50
+ <${l.LABEL}
51
+ ${h.LABEL.text}="${this.api.translate("Text Trimming")}"
59
52
  >
60
- </${a.LABEL}>
53
+ </${l.LABEL}>
61
54
  ${this._GuToggle(r.TRIMMING)}
62
55
  </div>
63
56
  </div>
@@ -65,6 +58,6 @@ class R extends c {
65
58
  }
66
59
  }
67
60
  export {
68
- f as CONTROL_BLOCK_ID,
69
- R as NameTrimmingControl
61
+ M as CONTROL_BLOCK_ID,
62
+ x as NameTrimmingControl
70
63
  };
@@ -1,23 +1,21 @@
1
- var L = Object.defineProperty;
2
- var R = (i, o, e) => o in i ? L(i, o, { enumerable: !0, configurable: !0, writable: !0, value: e }) : i[o] = e;
3
- var p = (i, o, e) => R(i, typeof o != "symbol" ? o + "" : o, e);
1
+ var R = Object.defineProperty;
2
+ var y = (s, o, e) => o in s ? R(s, o, { enumerable: !0, configurable: !0, writable: !0, value: e }) : s[o] = e;
3
+ var p = (s, o, e) => y(s, typeof o != "symbol" ? o + "" : o, e);
4
4
  import { currencyLocationMaps as m } from "../../../../../enums/extensions/recommendationBlock.js";
5
- import { UEAttr as N, ModificationDescription as I } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
5
+ import { UEAttr as I, ModificationDescription as N } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
6
6
  import { CommonControl as T } from "../../../common-control.js";
7
7
  import { ItemsBlockControlId as h } from "../../enums/controlEnums.js";
8
8
  import { useItemsBlockStore as E } from "../../store/items-block.js";
9
- import { syncCurrencyLocationFromAttributes as f } from "../../utils/syncAttributesFromConfigBlock.js";
10
- import { updateConfigBlockAttributes as O } from "../../utils/updateAttributes.js";
11
- const b = h.PRICE_CURRENCY_LOCATION, a = {
9
+ const O = h.PRICE_CURRENCY_LOCATION, a = {
12
10
  CURRENCY_LOCATION: "currencyLocation"
13
11
  };
14
- class Y extends T {
12
+ class S extends T {
15
13
  constructor() {
16
14
  super(...arguments);
17
15
  p(this, "store", E());
18
16
  }
19
17
  getId() {
20
- return b;
18
+ return O;
21
19
  }
22
20
  getTemplate() {
23
21
  return `
@@ -27,31 +25,26 @@ class Y extends T {
27
25
  `;
28
26
  }
29
27
  onRender() {
30
- this.api.setUIEAttribute(a.CURRENCY_LOCATION, N.SELECTPICKER.items, m), this.api.updateValues({ [a.CURRENCY_LOCATION]: this.store.currencyLocation }), this.api.onValueChanged(a.CURRENCY_LOCATION, (e) => {
28
+ this.api.setUIEAttribute(a.CURRENCY_LOCATION, I.SELECTPICKER.items, m), this.api.updateValues({ [a.CURRENCY_LOCATION]: this.store.currencyLocation }), this.api.onValueChanged(a.CURRENCY_LOCATION, (e) => {
31
29
  this._onCurrencyLocationChange(e);
32
30
  });
33
31
  }
34
32
  onTemplateNodeUpdated(e) {
35
- super.onTemplateNodeUpdated(e), this.handleBlockInstanceChange(
36
- () => f(this.currentNode),
37
- () => {
38
- this.api.updateValues({ [a.CURRENCY_LOCATION]: this.store.currencyLocation });
39
- }
40
- );
33
+ this.currentNode = e, this.api.updateValues({ [a.CURRENCY_LOCATION]: this.store.currencyLocation });
41
34
  }
42
35
  _onCurrencyLocationChange(e) {
43
- if (console.debug("Currency location changed to: ", e), this.store.setCurrencyLocation(e), O(this.currentNode, this.api), !this.currentNode)
36
+ if (console.debug("Currency location changed to: ", e), this.store.setCurrencyLocation(e), !this.currentNode)
44
37
  return;
45
38
  const t = this._getPriceBlocks();
46
39
  if (!t || t.length === 0)
47
40
  return;
48
41
  const r = e || "0", { currencySymbol: n } = this.store;
49
42
  t.forEach((c) => {
50
- const s = this._getParagraph(c);
51
- if (!s)
43
+ const i = this._getParagraph(c);
44
+ if (!i)
52
45
  return;
53
- const u = s.getInnerHTML() || "", l = s.getInnerText() || "", C = (n == null ? void 0 : n.trim()) || "", d = this._removeCurrencySymbol(l, C), g = this._detectSymbolInText(l) || C, _ = this._buildPriceContent(d, g, r), y = u.replace(l, _);
54
- this.api.getDocumentModifier().modifyHtml(s).setInnerHtml(y).apply(new I(
46
+ const C = i.getInnerHTML() || "", l = i.getInnerText() || "", u = (n == null ? void 0 : n.trim()) || "", d = this._removeCurrencySymbol(l, u), _ = this._detectSymbolInText(l) || u, g = this._buildPriceContent(d, _, r), L = C.replace(l, g);
47
+ this.api.getDocumentModifier().modifyHtml(i).setInnerHtml(L).apply(new N(
55
48
  `Updated currency location to ${r === "1" ? "after" : "before"}`
56
49
  ));
57
50
  });
@@ -75,8 +68,8 @@ class Y extends T {
75
68
  } else {
76
69
  const c = r.match(/([^0-9.,\s]+)/);
77
70
  if (c && c[1]) {
78
- const s = c[1].trim(), u = new RegExp(`\\s*${this._escapeRegex(s)}\\s*`);
79
- n = r.replace(u, "").trim();
71
+ const i = c[1].trim(), C = new RegExp(`\\s*${this._escapeRegex(i)}\\s*`);
72
+ n = r.replace(C, "").trim();
80
73
  }
81
74
  }
82
75
  return n;
@@ -102,6 +95,6 @@ class Y extends T {
102
95
  }
103
96
  }
104
97
  export {
105
- b as CONTROL_BLOCK_ID,
106
- Y as PriceCurrencyLocationControl
98
+ O as CONTROL_BLOCK_ID,
99
+ S as PriceCurrencyLocationControl
107
100
  };
@@ -3,14 +3,12 @@ var _ = (c, s, e) => s in c ? S(c, s, { enumerable: !0, configurable: !0, writab
3
3
  var u = (c, s, e) => _(c, typeof s != "symbol" ? s + "" : s, e);
4
4
  import { ModificationDescription as b } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
5
5
  import { CommonControl as R } from "../../../common-control.js";
6
- import { ItemsBlockControlId as h } from "../../enums/controlEnums.js";
6
+ import { ItemsBlockControlId as p } from "../../enums/controlEnums.js";
7
7
  import { useItemsBlockStore as f } from "../../store/items-block.js";
8
- import { syncCurrencySymbolFromAttributes as N } from "../../utils/syncAttributesFromConfigBlock.js";
9
- import { updateConfigBlockAttributes as B } from "../../utils/updateAttributes.js";
10
- const E = h.PRICE_CURRENCY_SYMBOL, m = {
8
+ const E = p.PRICE_CURRENCY_SYMBOL, m = {
11
9
  CURRENCY_SYMBOL: "currencySymbol"
12
10
  };
13
- class P extends R {
11
+ class M extends R {
14
12
  constructor() {
15
13
  super(...arguments);
16
14
  u(this, "store", f());
@@ -21,7 +19,7 @@ class P extends R {
21
19
  }
22
20
  getTemplate() {
23
21
  return `
24
- <div class="${h.PRICE_CURRENCY_SYMBOL}">
22
+ <div class="${p.PRICE_CURRENCY_SYMBOL}">
25
23
  ${this._getCurrencySymbol()}
26
24
  </div>
27
25
  `;
@@ -31,22 +29,14 @@ class P extends R {
31
29
  this._onCurrencySymbolChange(e);
32
30
  });
33
31
  }
34
- onDestroy() {
35
- super.onDestroy(), this.originalPriceContents.clear();
36
- }
37
32
  onTemplateNodeUpdated(e) {
38
- super.onTemplateNodeUpdated(e), this.handleBlockInstanceChange(
39
- () => N(this.currentNode),
40
- () => {
41
- this.api.updateValues({ [m.CURRENCY_SYMBOL]: this.store.currencySymbol }), this._storeOriginalContents();
42
- }
43
- );
33
+ this.currentNode = e, this.api.updateValues({ [m.CURRENCY_SYMBOL]: this.store.currencySymbol }), this._storeOriginalContents();
44
34
  }
45
35
  _onCurrencySymbolChange(e) {
46
36
  var i;
47
37
  console.debug("Currency symbol changed to: ", e);
48
38
  const r = ((i = this.store.currencySymbol) == null ? void 0 : i.trim()) || "";
49
- if (this.store.setCurrencySymbol(e), B(this.currentNode, this.api), !this.currentNode)
39
+ if (this.store.setCurrencySymbol(e), !this.currentNode)
50
40
  return;
51
41
  const t = this._getPriceBlocks();
52
42
  if (!t || t.length === 0)
@@ -56,7 +46,7 @@ class P extends R {
56
46
  const a = this._getParagraph(l);
57
47
  if (!a)
58
48
  return;
59
- const y = a.getInnerHTML() || "", p = a.getInnerText() || "", C = this._removeCurrencySymbol(p, r), g = this._buildPriceContent(C, o, n), d = y.replace(p, g);
49
+ const C = a.getInnerHTML() || "", h = a.getInnerText() || "", y = this._removeCurrencySymbol(h, r), g = this._buildPriceContent(y, o, n), d = C.replace(h, g);
60
50
  this.api.getDocumentModifier().modifyHtml(a).setInnerHtml(d).apply(new b(
61
51
  `Updated currency symbol to ${o || "removed"}`
62
52
  ));
@@ -119,5 +109,5 @@ class P extends R {
119
109
  }
120
110
  export {
121
111
  E as CONTROL_BLOCK_ID,
122
- P as PriceCurrencySymbolControl
112
+ M as PriceCurrencySymbolControl
123
113
  };