@useinsider/guido 1.0.3-beta.8646ecc → 1.0.3-beta.87cb92a

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 (149) hide show
  1. package/README.md +6 -32
  2. package/dist/components/Guido.vue.js +1 -1
  3. package/dist/components/Guido.vue2.js +79 -73
  4. package/dist/components/organisms/header/RightSlot.vue.js +1 -1
  5. package/dist/components/organisms/header/RightSlot.vue2.js +23 -22
  6. package/dist/components/organisms/onboarding/ItemsOnboarding.vue.js +21 -0
  7. package/dist/components/organisms/onboarding/ItemsOnboarding.vue2.js +99 -0
  8. package/dist/components/organisms/onboarding/OnboardingWrapper.vue2.js +20 -18
  9. package/dist/composables/useActionsApi.js +1 -1
  10. package/dist/composables/useGuidoActions.js +19 -9
  11. package/dist/composables/useHtmlCompiler.js +15 -13
  12. package/dist/composables/useHtmlValidator.js +36 -35
  13. package/dist/composables/useStripo.js +46 -40
  14. package/dist/config/compiler/itemsCompilerRules.js +14 -0
  15. package/dist/config/compiler/unsubscribeCompilerRules.js +33 -28
  16. package/dist/enums/defaults.js +2 -1
  17. package/dist/enums/onboarding.js +7 -3
  18. package/dist/enums/unsubscribe.js +27 -25
  19. package/dist/extensions/Blocks/Checkbox/control.js +15 -14
  20. package/dist/extensions/Blocks/Checkbox/template.js +14 -9
  21. package/dist/extensions/Blocks/Items/block.js +29 -28
  22. package/dist/extensions/Blocks/Items/controls/cardComposition.js +151 -57
  23. package/dist/extensions/Blocks/Items/controls/name/trimming.js +2 -2
  24. package/dist/extensions/Blocks/Items/controls/settingsControl.js +149 -117
  25. package/dist/extensions/Blocks/Items/enums/productEnums.js +83 -5
  26. package/dist/extensions/Blocks/Items/enums/settingsEnums.js +7 -1
  27. package/dist/extensions/Blocks/Items/layouts/horizontal.html.js +57 -56
  28. package/dist/extensions/Blocks/Items/layouts/vertical.html.js +54 -55
  29. package/dist/extensions/Blocks/Items/settingsPanel.js +56 -31
  30. package/dist/extensions/Blocks/Items/template.js +138 -59
  31. package/dist/extensions/Blocks/RadioButton/control.js +18 -17
  32. package/dist/extensions/Blocks/RadioButton/template.js +18 -9
  33. package/dist/extensions/Blocks/Recommendation/store/recommendation.js +1 -1
  34. package/dist/extensions/Blocks/Unsubscribe/block.js +27 -27
  35. package/dist/extensions/DynamicContent/dynamic-content-modal.js +25 -19
  36. package/dist/extensions/DynamicContent/dynamic-content.js +128 -33
  37. package/dist/guido.css +1 -1
  38. package/dist/node_modules/lodash-es/_DataView.js +6 -0
  39. package/dist/node_modules/lodash-es/_Promise.js +6 -0
  40. package/dist/node_modules/lodash-es/_Set.js +6 -0
  41. package/dist/node_modules/lodash-es/_SetCache.js +13 -0
  42. package/dist/node_modules/lodash-es/_WeakMap.js +6 -0
  43. package/dist/node_modules/lodash-es/_arrayFilter.js +10 -0
  44. package/dist/node_modules/lodash-es/_arrayLikeKeys.js +13 -12
  45. package/dist/node_modules/lodash-es/_arrayMap.js +8 -0
  46. package/dist/node_modules/lodash-es/_arrayPush.js +8 -0
  47. package/dist/node_modules/lodash-es/_arraySome.js +9 -0
  48. package/dist/node_modules/lodash-es/_baseEach.js +6 -0
  49. package/dist/node_modules/lodash-es/_baseFlatten.js +13 -0
  50. package/dist/node_modules/lodash-es/_baseForOwn.js +8 -0
  51. package/dist/node_modules/lodash-es/_baseGet.js +11 -0
  52. package/dist/node_modules/lodash-es/_baseGetAllKeys.js +9 -0
  53. package/dist/node_modules/lodash-es/_baseHasIn.js +6 -0
  54. package/dist/node_modules/lodash-es/_baseIsEqual.js +8 -0
  55. package/dist/node_modules/lodash-es/_baseIsEqualDeep.js +32 -0
  56. package/dist/node_modules/lodash-es/_baseIsMatch.js +29 -0
  57. package/dist/node_modules/lodash-es/_baseIteratee.js +11 -0
  58. package/dist/node_modules/lodash-es/_baseKeys.js +14 -0
  59. package/dist/node_modules/lodash-es/_baseMap.js +11 -0
  60. package/dist/node_modules/lodash-es/_baseMatches.js +12 -0
  61. package/dist/node_modules/lodash-es/_baseMatchesProperty.js +17 -0
  62. package/dist/node_modules/lodash-es/_baseProperty.js +8 -0
  63. package/dist/node_modules/lodash-es/_basePropertyDeep.js +9 -0
  64. package/dist/node_modules/lodash-es/_baseRange.js +9 -0
  65. package/dist/node_modules/lodash-es/_baseToString.js +18 -0
  66. package/dist/node_modules/lodash-es/_baseTrim.js +8 -0
  67. package/dist/node_modules/lodash-es/_cacheHas.js +6 -0
  68. package/dist/node_modules/lodash-es/_castPath.js +10 -0
  69. package/dist/node_modules/lodash-es/_createBaseEach.js +15 -0
  70. package/dist/node_modules/lodash-es/_createRange.js +11 -0
  71. package/dist/node_modules/lodash-es/_equalArrays.js +40 -0
  72. package/dist/node_modules/lodash-es/_equalByTag.js +45 -0
  73. package/dist/node_modules/lodash-es/_equalObjects.js +36 -0
  74. package/dist/node_modules/lodash-es/_getAllKeys.js +9 -0
  75. package/dist/node_modules/lodash-es/_getMatchData.js +12 -0
  76. package/dist/node_modules/lodash-es/_getSymbols.js +10 -0
  77. package/dist/node_modules/lodash-es/_getTag.js +28 -0
  78. package/dist/node_modules/lodash-es/_hasPath.js +19 -0
  79. package/dist/node_modules/lodash-es/_isFlattenable.js +10 -0
  80. package/dist/node_modules/lodash-es/_isKey.js +12 -0
  81. package/dist/node_modules/lodash-es/_isStrictComparable.js +7 -0
  82. package/dist/node_modules/lodash-es/_mapToArray.js +9 -0
  83. package/dist/node_modules/lodash-es/_matchesStrictComparable.js +8 -0
  84. package/dist/node_modules/lodash-es/_memoizeCapped.js +11 -0
  85. package/dist/node_modules/lodash-es/_nativeKeys.js +5 -0
  86. package/dist/node_modules/lodash-es/_setCacheAdd.js +7 -0
  87. package/dist/node_modules/lodash-es/_setCacheHas.js +6 -0
  88. package/dist/node_modules/lodash-es/_setToArray.js +9 -0
  89. package/dist/node_modules/lodash-es/_stringToPath.js +10 -0
  90. package/dist/node_modules/lodash-es/_toKey.js +10 -0
  91. package/dist/node_modules/lodash-es/_trimmedEndIndex.js +9 -0
  92. package/dist/node_modules/lodash-es/flatMap.js +8 -0
  93. package/dist/node_modules/lodash-es/get.js +8 -0
  94. package/dist/node_modules/lodash-es/hasIn.js +8 -0
  95. package/dist/node_modules/lodash-es/isSymbol.js +9 -0
  96. package/dist/node_modules/lodash-es/keys.js +9 -0
  97. package/dist/node_modules/lodash-es/keysIn.js +3 -3
  98. package/dist/node_modules/lodash-es/map.js +11 -0
  99. package/dist/node_modules/lodash-es/property.js +10 -0
  100. package/dist/node_modules/lodash-es/range.js +5 -0
  101. package/dist/node_modules/lodash-es/stubArray.js +6 -0
  102. package/dist/node_modules/lodash-es/toFinite.js +14 -0
  103. package/dist/node_modules/lodash-es/toNumber.js +22 -0
  104. package/dist/node_modules/lodash-es/toString.js +7 -0
  105. package/dist/package.json.js +1 -1
  106. package/dist/src/@types/generic.d.ts +27 -6
  107. package/dist/src/components/Guido.vue.d.ts +3 -2
  108. package/dist/src/components/organisms/onboarding/ItemsOnboarding.vue.d.ts +2 -0
  109. package/dist/src/composables/useGuidoActions.d.ts +9 -0
  110. package/dist/src/config/compiler/itemsCompilerRules.d.ts +2 -0
  111. package/dist/src/enums/onboarding.d.ts +4 -0
  112. package/dist/src/extensions/Blocks/Checkbox/template.d.ts +1 -1
  113. package/dist/src/extensions/Blocks/Items/block.d.ts +14 -0
  114. package/dist/src/extensions/Blocks/Items/controls/cardComposition.d.ts +20 -7
  115. package/dist/src/extensions/Blocks/Items/controls/settingsControl.d.ts +8 -2
  116. package/dist/src/extensions/Blocks/Items/enums/productEnums.d.ts +8 -0
  117. package/dist/src/extensions/Blocks/Items/enums/settingsEnums.d.ts +6 -0
  118. package/dist/src/extensions/Blocks/Items/template.d.ts +9 -1
  119. package/dist/src/extensions/Blocks/RadioButton/template.d.ts +1 -1
  120. package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +1 -1
  121. package/dist/src/extensions/DynamicContent/dynamic-content-modal.d.ts +9 -2
  122. package/dist/src/extensions/DynamicContent/dynamic-content.d.ts +52 -2
  123. package/dist/src/stores/config.d.ts +3 -2
  124. package/dist/src/stores/dynamic-content.d.ts +3 -3
  125. package/dist/src/stores/editor.d.ts +1 -1
  126. package/dist/src/stores/onboarding.d.ts +335 -1
  127. package/dist/src/stores/preview.d.ts +1 -1
  128. package/dist/src/stores/recommendation.d.ts +1 -1
  129. package/dist/src/stores/save-as-template.d.ts +1 -1
  130. package/dist/src/stores/toaster.d.ts +1 -1
  131. package/dist/src/stores/unsubscribe.d.ts +1 -1
  132. package/dist/src/stores/version-history.d.ts +1 -1
  133. package/dist/src/utils/environmentUtil.d.ts +5 -0
  134. package/dist/src/utils/genericUtil.d.ts +1 -0
  135. package/dist/src/utils/pairProductVariables.d.ts +7 -0
  136. package/dist/stores/config.js +5 -5
  137. package/dist/stores/dynamic-content.js +2 -2
  138. package/dist/stores/editor.js +1 -1
  139. package/dist/stores/onboarding.js +44 -36
  140. package/dist/stores/preview.js +1 -1
  141. package/dist/stores/recommendation.js +3 -3
  142. package/dist/stores/save-as-template.js +2 -2
  143. package/dist/stores/toaster.js +1 -1
  144. package/dist/stores/unsubscribe.js +1 -1
  145. package/dist/stores/version-history.js +4 -4
  146. package/dist/utils/environmentUtil.js +4 -0
  147. package/dist/utils/genericUtil.js +17 -6
  148. package/dist/utils/pairProductVariables.js +136 -0
  149. package/package.json +4 -11
@@ -1,28 +1,29 @@
1
- var M = Object.defineProperty;
2
- var A = (u, p, e) => p in u ? M(u, p, { enumerable: !0, configurable: !0, writable: !0, value: e }) : u[p] = e;
3
- var R = (u, p, e) => A(u, typeof p != "symbol" ? p + "" : p, e);
4
- import { UEAttr as f, ModificationDescription as m } from "../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
5
- import { CommonControl as b } from "../../common-control.js";
6
- import { ItemsBlockId as a } from "../enums/controlEnums.js";
7
- import { productPairs as d } from "../enums/productEnums.js";
8
- import { ItemTypeOptions as P, OrientationOptions as x, ItemInCartOptions as S, SETTINGS_ENUMS as y } from "../enums/settingsEnums.js";
9
- import L from "../layouts/horizontal.html.js";
10
- import D from "../layouts/vertical.html.js";
11
- import { useItemsBlockStore as H } from "../store/items-block.js";
12
- import { getDefaultTemplate as U } from "../template.js";
13
- import { updateConfigBlockAttributes as O } from "../utils/updateAttributes.js";
14
- const $ = "ui-elements-items-block", o = {
1
+ var P = Object.defineProperty;
2
+ var M = (T, u, e) => u in T ? P(T, u, { enumerable: !0, configurable: !0, writable: !0, value: e }) : T[u] = e;
3
+ var C = (T, u, e) => M(T, typeof u != "symbol" ? u + "" : u, e);
4
+ import { UEAttr as b, ModificationDescription as d } from "../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
5
+ import { CommonControl as D } from "../../common-control.js";
6
+ import { ItemsBlockId as m } from "../enums/controlEnums.js";
7
+ import { productPairs as p, templateFirstLine as A } from "../enums/productEnums.js";
8
+ import { ItemTypeOptions as R, OrientationOptions as L, ItemInCartOptions as N, SETTINGS_ENUMS as S } from "../enums/settingsEnums.js";
9
+ import x from "../layouts/horizontal.html.js";
10
+ import H from "../layouts/vertical.html.js";
11
+ import { useItemsBlockStore as U } from "../store/items-block.js";
12
+ import { getDefaultTemplate as F } from "../template.js";
13
+ import { syncCurrencySymbolFromAttributes as $, syncCurrencyLocationFromAttributes as k, syncFormattedPriceFromAttributes as q } from "../utils/syncAttributesFromConfigBlock.js";
14
+ import { updateConfigBlockAttributes as f } from "../utils/updateAttributes.js";
15
+ const w = "ui-elements-items-block", o = {
15
16
  ITEMS_TYPE: "itemsType",
16
17
  ORIENTATION: "orientation",
17
18
  ITEM_IDS: "itemIds"
18
19
  };
19
- class z extends b {
20
+ class Z extends D {
20
21
  constructor() {
21
22
  super(...arguments);
22
- R(this, "store", H());
23
+ C(this, "store", U());
23
24
  }
24
25
  getId() {
25
- return $;
26
+ return w;
26
27
  }
27
28
  getTemplate() {
28
29
  return `
@@ -41,11 +42,18 @@ class z extends b {
41
42
  }), this._listenToFormUpdates();
42
43
  }
43
44
  onTemplateNodeUpdated(e) {
44
- this.currentNode = e, this.api.updateValues({
45
- [o.ORIENTATION]: this.store.orientation,
46
- [o.ITEMS_TYPE]: this.store.itemsType,
47
- [o.ITEM_IDS]: this.store.itemIds
48
- }), this._initializeSelectItems();
45
+ super.onTemplateNodeUpdated(e), this.handleBlockInstanceChange(
46
+ () => {
47
+ $(this.currentNode), k(this.currentNode), q(this.currentNode);
48
+ },
49
+ () => {
50
+ this.api.updateValues({
51
+ [o.ORIENTATION]: this.store.orientation,
52
+ [o.ITEMS_TYPE]: this.store.itemsType,
53
+ [o.ITEM_IDS]: this.store.itemIds
54
+ }), this._initializeSelectItems();
55
+ }
56
+ );
49
57
  }
50
58
  onDestroy() {
51
59
  const e = this._getTemplateData();
@@ -59,7 +67,7 @@ class z extends b {
59
67
  name: o.ITEMS_TYPE,
60
68
  className: "es-100",
61
69
  placeholder: "Select Item Type",
62
- options: P
70
+ options: R
63
71
  })
64
72
  ])}
65
73
  `;
@@ -70,7 +78,7 @@ class z extends b {
70
78
  this._GuLabel({ text: "Orientation" }),
71
79
  this._GuRadioButton({
72
80
  name: o.ORIENTATION,
73
- buttons: x
81
+ buttons: L
74
82
  })
75
83
  ])}
76
84
  `;
@@ -89,38 +97,38 @@ class z extends b {
89
97
  `;
90
98
  }
91
99
  _onOrientationChange(e) {
92
- console.debug("Orientation changed to: ", e), this.store.setOrientation(e), this.api.updateValues({ [o.ORIENTATION]: e }), O(this.currentNode, this.api), this._reOrderTemplate(), this._recalculateTrimming();
100
+ console.debug("Orientation changed to: ", e), this.store.setOrientation(e), this.api.updateValues({ [o.ORIENTATION]: e }), f(this.currentNode, this.api), this._reOrderTemplate(), this._recalculateTrimming();
93
101
  }
94
- _onItemsTypeChange(e, t) {
95
- const { itemIds: i } = this.store, r = y.ITEMS_TYPE[e], n = S[t].findIndex((c) => c.value === i), s = S[e][n];
96
- r && (this.store.setItemsType(r), this.store.setItemIds(s.value), O(this.currentNode, this.api), this._initializeSelectItems(), this._reFillTemplate());
102
+ _onItemsTypeChange(e) {
103
+ const i = S.ITEMS_TYPE[e], t = N[e], r = t == null ? void 0 : t[0];
104
+ !i || !r || (this.store.setItemsType(i), this.store.setItemIds(r.value), f(this.currentNode, this.api), this._updateDataTypeAttributes(i), this._initializeSelectItems(), this._reFillTemplate());
97
105
  }
98
106
  _onItemIdsChange(e) {
99
- console.debug("Item ids changed to: ", e), this.store.setItemIds(e), this.api.updateValues({ [o.ITEM_IDS]: e }), O(this.currentNode, this.api), this._reFillTemplate();
107
+ console.debug("Item ids changed to: ", e), this.store.setItemIds(e), this.api.updateValues({ [o.ITEM_IDS]: e }), f(this.currentNode, this.api), this._updateDataNumberAttributes(e), this._reFillTemplate();
100
108
  }
101
109
  _initializeSelectItems() {
102
110
  this.api.setUIEAttribute(
103
111
  o.ITEMS_TYPE,
104
- f.SELECTPICKER.items,
105
- P
112
+ b.SELECTPICKER.items,
113
+ R
106
114
  );
107
- const { itemsType: e, itemIds: t } = this.store;
115
+ const { itemsType: e, itemIds: i } = this.store;
108
116
  this.api.updateValues({
109
117
  [o.ITEMS_TYPE]: e
110
118
  });
111
- const i = S[e];
119
+ const t = N[e];
112
120
  this.api.setUIEAttribute(
113
121
  o.ITEM_IDS,
114
- f.SELECTPICKER.items,
115
- i
122
+ b.SELECTPICKER.items,
123
+ t
116
124
  ), this.api.updateValues({
117
- [o.ITEM_IDS]: t
125
+ [o.ITEM_IDS]: i
118
126
  });
119
127
  }
120
128
  _listenToFormUpdates() {
121
129
  this.api.onValueChanged(
122
130
  o.ITEMS_TYPE,
123
- (e, t) => this._onItemsTypeChange(e, t)
131
+ (e) => this._onItemsTypeChange(e)
124
132
  ), this.api.onValueChanged(
125
133
  o.ORIENTATION,
126
134
  (e) => this._onOrientationChange(e)
@@ -132,118 +140,142 @@ class z extends b {
132
140
  _renderTemplate() {
133
141
  const {
134
142
  orientation: e,
135
- itemsType: t,
136
- itemIds: i,
143
+ itemsType: i,
144
+ itemIds: t,
137
145
  currencySymbol: r,
138
146
  currencyLocation: n,
139
147
  formattedPrice: s
140
148
  } = this.store;
141
- this.api.getDocumentModifier().modifyHtml(this.currentNode).setInnerHtml(U({
149
+ this.api.getDocumentModifier().modifyHtml(this.currentNode).setInnerHtml(F({
142
150
  orientation: e,
143
- itemsType: t,
144
- itemId: i,
151
+ itemsType: i,
152
+ itemId: t,
145
153
  currencySymbol: r,
146
154
  currencyLocation: n,
147
155
  formattedPrice: s
148
- })).apply(new m("Updated template"));
156
+ })).apply(new d("Updated template"));
149
157
  }
150
158
  _getTemplateData() {
151
- const { itemsType: e, itemIds: t, formattedPrice: i } = this.store, r = S[e].findIndex((s) => s.value === t), n = r > -1 ? r : 0;
159
+ const { itemsType: e, itemIds: i, formattedPrice: t } = this.store, r = N[e].findIndex((s) => s.value === i), n = r > -1 ? r : 0;
152
160
  return {
153
- imageSrc: d.PAIRS_FOR_EXTENSION.imageSrc[e].DEFAULT[n],
154
- name: d.PAIRS_FOR_EXTENSION.name[e].DEFAULT[n],
155
- price: i ? d.PAIRS_FOR_EXTENSION.price[e].DEFAULT_PRICE_FORMATTED : d.PAIRS_FOR_EXTENSION.price[e].DEFAULT_PRICE,
156
- originalPrice: i ? d.PAIRS_FOR_EXTENSION.originalPrice[e].DEFAULT_PRICE_FORMATTED : d.PAIRS_FOR_EXTENSION.originalPrice[e].DEFAULT_PRICE,
157
- quantity: d.PAIRS_FOR_EXTENSION.quantity[e].DEFAULT,
158
- button: d.PAIRS_FOR_EXTENSION.button[e].DEFAULT_LABEL
161
+ imageSrc: p.PAIRS_FOR_EXTENSION.imageSrc[e].DEFAULT[n],
162
+ name: p.PAIRS_FOR_EXTENSION.name[e].DEFAULT[n],
163
+ price: t ? p.PAIRS_FOR_EXTENSION.price[e].DEFAULT_PRICE_FORMATTED : p.PAIRS_FOR_EXTENSION.price[e].DEFAULT_PRICE,
164
+ originalPrice: t ? p.PAIRS_FOR_EXTENSION.originalPrice[e].DEFAULT_PRICE_FORMATTED : p.PAIRS_FOR_EXTENSION.originalPrice[e].DEFAULT_PRICE,
165
+ quantity: p.PAIRS_FOR_EXTENSION.quantity[e].DEFAULT,
166
+ button: p.PAIRS_FOR_EXTENSION.button[e].DEFAULT_LABEL
159
167
  };
160
168
  }
161
169
  _updateImageSrc(e) {
162
- var i;
163
- const t = (i = this.currentNode) == null ? void 0 : i.querySelector(`[esd-extension-block-id="${a.IMAGE}"] img`);
164
- t && this.api.getDocumentModifier().modifyHtml(t).setAttribute("src", e).apply(new m("Updated image src"));
170
+ var t;
171
+ const i = (t = this.currentNode) == null ? void 0 : t.querySelector(`[esd-extension-block-id="${m.IMAGE}"] img`);
172
+ i && this.api.getDocumentModifier().modifyHtml(i).setAttribute("src", e).apply(new d("Updated image src"));
165
173
  }
166
174
  _updateName(e) {
167
175
  var n;
168
- const t = (n = this.currentNode) == null ? void 0 : n.querySelector(`[esd-extension-block-id="${a.NAME}"]`);
169
- if (!t)
176
+ const i = (n = this.currentNode) == null ? void 0 : n.querySelector(`[esd-extension-block-id="${m.NAME}"]`);
177
+ if (!i)
170
178
  return;
171
- const i = t.getInnerText().trim();
172
- let r = t.getInnerHTML();
173
- r = r.replace(i, e), this.api.getDocumentModifier().modifyHtml(t).setInnerHtml(r).apply(new m("Updated name"));
179
+ const t = i.getInnerText().trim();
180
+ let r = i.getInnerHTML();
181
+ r = r.replace(t, e), this.api.getDocumentModifier().modifyHtml(i).setInnerHtml(r).apply(new d("Updated name"));
174
182
  }
175
183
  _updatePrice(e) {
176
- var g;
177
- const t = (g = this.currentNode) == null ? void 0 : g.querySelector(`[esd-extension-block-id="${a.PRICE}"]`);
178
- if (!t)
179
- return;
180
- const i = this._getParagraphFromBlock(t);
184
+ var E;
185
+ const i = (E = this.currentNode) == null ? void 0 : E.querySelector(`[esd-extension-block-id="${m.PRICE}"]`);
181
186
  if (!i)
182
187
  return;
183
- const r = i.getInnerHTML() || "", n = i.getInnerText() || "", { currencySymbol: s, currencyLocation: c } = this.store, I = (s == null ? void 0 : s.trim()) || "", l = this._removeCurrencySymbol(n, I), T = this._replacePriceNumber(l, e), h = this._buildPriceContent(T, I, c), _ = r.replace(n, h);
184
- this.api.getDocumentModifier().modifyHtml(i).setInnerHtml(_).apply(new m("Updated price"));
188
+ const t = this._getParagraphFromBlock(i);
189
+ if (!t)
190
+ return;
191
+ const r = t.getInnerHTML() || "", n = t.getInnerText() || "", { currencySymbol: s, currencyLocation: a } = this.store, l = (s == null ? void 0 : s.trim()) || "", c = this._removeCurrencySymbol(n, l), h = this._replacePriceNumber(c, e), I = this._buildPriceContent(h, l, a), _ = r.replace(n, I);
192
+ this.api.getDocumentModifier().modifyHtml(t).setInnerHtml(_).apply(new d("Updated price"));
185
193
  }
186
194
  _updateOriginalPrice(e) {
187
- var E;
188
- const t = (E = this.currentNode) == null ? void 0 : E.querySelector(
189
- `[esd-extension-block-id="${a.ORIGINAL_PRICE}"]`
195
+ var y;
196
+ const i = (y = this.currentNode) == null ? void 0 : y.querySelector(
197
+ `[esd-extension-block-id="${m.ORIGINAL_PRICE}"]`
190
198
  );
191
- if (!t)
192
- return;
193
- const i = this._getParagraphFromBlock(t);
194
199
  if (!i)
195
200
  return;
196
- const r = i.querySelector("s");
201
+ const t = this._getParagraphFromBlock(i);
202
+ if (!t)
203
+ return;
204
+ const r = t.querySelector("s");
197
205
  if (!r)
198
206
  return;
199
- const n = r.getInnerHTML() || "", s = r.getInnerText() || "", { currencySymbol: c, currencyLocation: I } = this.store, l = (c == null ? void 0 : c.trim()) || "", T = this._removeCurrencySymbol(s, l), h = this._replacePriceNumber(T, e), _ = this._buildPriceContent(h, l, I), N = `<s>${n.replace(s, _)}</s>`;
200
- this.api.getDocumentModifier().modifyHtml(i).setInnerHtml(N).apply(new m("Updated original price"));
207
+ const n = r.getInnerHTML() || "", s = r.getInnerText() || "", { currencySymbol: a, currencyLocation: l } = this.store, c = (a == null ? void 0 : a.trim()) || "", h = this._removeCurrencySymbol(s, c), I = this._replacePriceNumber(h, e), _ = this._buildPriceContent(I, c, l), g = `<s>${n.replace(s, _)}</s>`;
208
+ this.api.getDocumentModifier().modifyHtml(t).setInnerHtml(g).apply(new d("Updated original price"));
201
209
  }
202
210
  _updateQuantity(e) {
203
- var n;
204
- const t = (n = this.currentNode) == null ? void 0 : n.querySelector(`[esd-extension-block-id="${a.QUANTITY}"]`);
211
+ var a;
212
+ const i = this.store.itemsType !== S.ITEMS_TYPE.BROWSED_ITEMS, t = (a = this.currentNode) == null ? void 0 : a.querySelector(`[esd-extension-block-id="${m.QUANTITY}"]`);
205
213
  if (!t)
206
214
  return;
207
- const i = t.getInnerText().trim();
208
- let r = t.getInnerHTML();
209
- r = r.replace(i, e), this.api.getDocumentModifier().modifyHtml(t).setInnerHtml(r).apply(new m("Updated quantity"));
215
+ const r = t.getStyle("display") === "none", n = t.getInnerText().trim();
216
+ let s = t.getInnerHTML();
217
+ s = s.replace(n, e), this.api.getDocumentModifier().modifyHtml(t).setInnerHtml(s).setStyle("display", i && !r ? "table-cell" : "none").apply(new d("Updated quantity"));
210
218
  }
211
- _updateButton(e) {
212
- var n;
213
- const t = (n = this.currentNode) == null ? void 0 : n.querySelector(`[esd-extension-block-id="${a.BUTTON}"]`);
214
- if (!t)
219
+ /**
220
+ * @todo Optimize template reordering for performance.
221
+ * @description Reorders the template structure based on current orientation and visibility settings.
222
+ */
223
+ _reOrderTemplate() {
224
+ var h, I, _, E, g, y, O;
225
+ const e = (h = this.currentNode) == null ? void 0 : h.querySelector(`[esd-extension-block-id="${m.IMAGE}"]`), i = (I = this.currentNode) == null ? void 0 : I.querySelector(`[esd-extension-block-id="${m.NAME}"]`), t = (_ = this.currentNode) == null ? void 0 : _.querySelector(`[esd-extension-block-id="${m.PRICE}"]`), r = (E = this.currentNode) == null ? void 0 : E.querySelector(
226
+ `[esd-extension-block-id="${m.ORIGINAL_PRICE}"]`
227
+ ), n = (g = this.currentNode) == null ? void 0 : g.querySelector(`[esd-extension-block-id="${m.QUANTITY}"]`), s = (y = this.currentNode) == null ? void 0 : y.querySelector(`[esd-extension-block-id="${m.BUTTON}"]`), a = (O = this.currentNode) == null ? void 0 : O.querySelector("esd-config-block");
228
+ if (!e || !i || !t || !r || !n || !s || !a)
215
229
  return;
216
- const i = t.getInnerText().trim();
217
- let r = t.getInnerHTML();
218
- r = r.replace(i, e), this.api.getDocumentModifier().modifyHtml(t).setInnerHtml(r).apply(new m("Updated button"));
230
+ const { orientation: l } = this.store;
231
+ let c = l === S.ORIENTATION.VERTICAL ? H : x;
232
+ c = c.replace("{-{-TEMPLATE_FIRST_LINE-}-}", A).replace("{-{-PRODUCT_IMAGE-}-}", e.getOuterHTML()).replace("{-{-PRODUCT_NAME-}-}", i.getOuterHTML()).replace("{-{-PRODUCT_PRICE-}-}", t.getOuterHTML()).replace("{-{-PRODUCT_ORIGINAL_PRICE-}-}", r.getOuterHTML()).replace("{-{-PRODUCT_QUANTITY-}-}", n.getOuterHTML()).replace("{-{-PRODUCT_BUTTON-}-}", s.getOuterHTML()).replace("{-{-CONFIG_BLOCK-}-}", a.getOuterHTML()), c = c.trim().replace(A, "").slice(0, -5), this.api.getDocumentModifier().modifyHtml(this.currentNode).setInnerHtml(c).apply(new d("Reordered template"));
219
233
  }
220
- _reOrderTemplate() {
221
- var T, h, _, g, N, E, C;
222
- const e = (T = this.currentNode) == null ? void 0 : T.querySelector(`[esd-extension-block-id="${a.IMAGE}"]`), t = (h = this.currentNode) == null ? void 0 : h.querySelector(`[esd-extension-block-id="${a.NAME}"]`), i = (_ = this.currentNode) == null ? void 0 : _.querySelector(`[esd-extension-block-id="${a.PRICE}"]`), r = (g = this.currentNode) == null ? void 0 : g.querySelector(
223
- `[esd-extension-block-id="${a.ORIGINAL_PRICE}"]`
224
- ), n = (N = this.currentNode) == null ? void 0 : N.querySelector(`[esd-extension-block-id="${a.QUANTITY}"]`), s = (E = this.currentNode) == null ? void 0 : E.querySelector(`[esd-extension-block-id="${a.BUTTON}"]`), c = (C = this.currentNode) == null ? void 0 : C.querySelector("esd-config-block");
225
- if (!e || !t || !i || !r || !n || !s || !c)
234
+ _updateDataTypeAttributes(e) {
235
+ if (!this.currentNode)
226
236
  return;
227
- const { orientation: I } = this.store;
228
- let l = I === y.ORIENTATION.VERTICAL ? D : L;
229
- l = l.replace("{-{-PRODUCT_IMAGE-}-}", e.getOuterHTML()).replace("{-{-PRODUCT_NAME-}-}", t.getOuterHTML()).replace("{-{-PRODUCT_PRICE-}-}", i.getOuterHTML()).replace("{-{-PRODUCT_ORIGINAL_PRICE-}-}", r.getOuterHTML()).replace("{-{-PRODUCT_QUANTITY-}-}", n.getOuterHTML()).replace("{-{-PRODUCT_BUTTON-}-}", s.getOuterHTML()).replace("{-{-CONFIG_BLOCK-}-}", c.getOuterHTML()), l = l.trim().replace('<td align="center" class="ins-product-td items-block">', "").slice(0, -5), this.api.getDocumentModifier().modifyHtml(this.currentNode).setInnerHtml(l).apply(new m("Reordered template"));
237
+ const i = this.currentNode.closest(".ins-product-td"), t = this.api.getDocumentModifier();
238
+ i && t.modifyHtml(i).setAttribute("data-type", e), this.currentNode.querySelectorAll("[data-type]").forEach((n) => {
239
+ const s = n;
240
+ t.modifyHtml(s).setAttribute("data-type", e);
241
+ }), t.apply(new d("Updated data-type attribute"));
242
+ }
243
+ _updateDataNumberAttributes(e) {
244
+ if (!this.currentNode)
245
+ return;
246
+ const { itemsType: i } = this.store, t = N[i].findIndex((l) => l.value === e);
247
+ let r = "1";
248
+ if (t >= 0)
249
+ r = String(t + 1);
250
+ else if (e) {
251
+ const l = e.match(/\((\d+)\)/);
252
+ if (l) {
253
+ const [, c] = l;
254
+ r = c;
255
+ }
256
+ }
257
+ const n = this.currentNode.closest(".ins-product-td"), s = this.api.getDocumentModifier();
258
+ n && s.modifyHtml(n).setAttribute("data-number", r), this.currentNode.querySelectorAll("[data-number]").forEach((l) => {
259
+ const c = l;
260
+ s.modifyHtml(c).setAttribute("data-number", r);
261
+ }), s.apply(new d("Updated data-number attribute"));
230
262
  }
231
263
  _reFillTemplate() {
232
264
  const e = this._getTemplateData();
233
- this._updateImageSrc(e.imageSrc), this._updateName(e.name), this._updatePrice(e.price), this._updateOriginalPrice(e.originalPrice), this._updateQuantity(e.quantity), this._updateButton(e.button);
265
+ this._updateImageSrc(e.imageSrc), this._updateName(e.name), this._updatePrice(e.price), this._updateOriginalPrice(e.originalPrice), this._updateQuantity(e.quantity);
234
266
  }
235
267
  _recalculateTrimming() {
236
268
  var r;
237
269
  if (!this.store.nameTrimming || !this.currentNode)
238
270
  return;
239
- const e = (r = this.currentNode) == null ? void 0 : r.querySelector(`[esd-extension-block-id="${a.NAME}"]`);
271
+ const e = (r = this.currentNode) == null ? void 0 : r.querySelector(`[esd-extension-block-id="${m.NAME}"]`);
240
272
  if (!e)
241
273
  return;
242
- const t = e.querySelector("p");
243
- if (!t)
274
+ const i = e.querySelector("p");
275
+ if (!i)
244
276
  return;
245
- const i = this.store.orientation === y.ORIENTATION.VERTICAL;
246
- this.api.getDocumentModifier().modifyHtml(t).setStyle("white-space", "nowrap").setStyle("overflow", "hidden").setStyle("text-overflow", "ellipsis").setStyle("max-width", i ? "130px" : "100%").apply(new m("Recalculated trimming after orientation change"));
277
+ const t = this.store.orientation === S.ORIENTATION.VERTICAL;
278
+ this.api.getDocumentModifier().modifyHtml(i).setStyle("white-space", "nowrap").setStyle("overflow", "hidden").setStyle("text-overflow", "ellipsis").setStyle("max-width", t ? "130px" : "100%").apply(new d("Recalculated trimming after orientation change"));
247
279
  }
248
280
  _getParagraphFromBlock(e) {
249
281
  return e.querySelector("p");
@@ -251,30 +283,30 @@ class z extends b {
251
283
  _escapeRegex(e) {
252
284
  return e.replace(/[-\\^$*+?().|[\]{}]/g, "\\$&");
253
285
  }
254
- _removeCurrencySymbol(e, t) {
255
- const i = e || "";
256
- let r = i;
257
- if (t) {
258
- const n = new RegExp(`\\s*${this._escapeRegex(t)}\\s*`);
259
- r = i.replace(n, "").trim();
286
+ _removeCurrencySymbol(e, i) {
287
+ const t = e || "";
288
+ let r = t;
289
+ if (i) {
290
+ const n = new RegExp(`\\s*${this._escapeRegex(i)}\\s*`);
291
+ r = t.replace(n, "").trim();
260
292
  } else {
261
- const n = i.match(/([^0-9.,\s]+)/);
293
+ const n = t.match(/([^0-9.,\s]+)/);
262
294
  if (n && n[1]) {
263
- const s = n[1].trim(), c = new RegExp(`\\s*${this._escapeRegex(s)}\\s*`);
264
- r = i.replace(c, "").trim();
295
+ const s = n[1].trim(), a = new RegExp(`\\s*${this._escapeRegex(s)}\\s*`);
296
+ r = t.replace(a, "").trim();
265
297
  }
266
298
  }
267
299
  return r;
268
300
  }
269
- _replacePriceNumber(e, t) {
270
- const i = /([0-9][0-9,.]*)/;
271
- return e.replace(i, t).trim();
301
+ _replacePriceNumber(e, i) {
302
+ const t = /([0-9][0-9,.]*)/;
303
+ return e.replace(t, i).trim();
272
304
  }
273
- _buildPriceContent(e, t, i) {
274
- return t ? i === "1" ? `${e}&nbsp;${t}&nbsp;` : `${t}&nbsp;${e}` : e;
305
+ _buildPriceContent(e, i, t) {
306
+ return i ? t === "1" ? `${e}&nbsp;${i}&nbsp;` : `${i}&nbsp;${e}` : e;
275
307
  }
276
308
  }
277
309
  export {
278
- $ as CONTROL_BLOCK_ID,
279
- z as ItemsBlockControl
310
+ w as CONTROL_BLOCK_ID,
311
+ Z as ItemsBlockControl
280
312
  };
@@ -1,4 +1,6 @@
1
- const e = {
1
+ import _ from "../../../../node_modules/lodash-es/flatMap.js";
2
+ import i from "../../../../node_modules/lodash-es/range.js";
3
+ const o = '<td align="center" class="ins-product-td items-block items-block-v2">', R = {
2
4
  TYPE: "data-type",
3
5
  ITEMS_INDEX_SELECT_CONTROL_VALUE: "data-cart_items_select_control_value",
4
6
  ORIENTATION: "data-card_orientation_control_value",
@@ -15,8 +17,14 @@ const e = {
15
17
  BLOCK_INSTANCE_ID: "data-block-instance-id",
16
18
  NAME_CONTROL_ENABLED: "data-product_name_control_enabled",
17
19
  QUANTITY_CONTROL_ENABLED: "data-product_quantity_control_enabled",
18
- PRICE_CONTROL_OPENED: "data-product_price_control_opened"
19
- }, s = { PAIRS_FOR_EXTENSION: {
20
+ PRICE_CONTROL_OPENED: "data-product_price_control_opened",
21
+ PRODUCT_IMAGE_VISIBLE: "data-product_image_visible",
22
+ PRODUCT_NAME_VISIBLE: "data-product_name_visible",
23
+ PRODUCT_QUANTITY_VISIBLE: "data-product_quantity_visible",
24
+ PRODUCT_PRICE_VISIBLE: "data-product_price_visible",
25
+ PRODUCT_ORIGINAL_PRICE_VISIBLE: "data-product_original_price_visible",
26
+ PRODUCT_BUTTON_VISIBLE: "data-product_button_visible"
27
+ }, t = { PAIRS_FOR_EXTENSION: {
20
28
  imageSrc: {
21
29
  CART_ITEMS: {
22
30
  ATTR: "ins_apr_img",
@@ -187,9 +195,79 @@ const e = {
187
195
  DEFAULT_HREF: "#!",
188
196
  DEFAULT_LABEL: "Buy"
189
197
  }
198
+ },
199
+ itemLink: {
200
+ CART_ITEMS: {
201
+ HREF: "ins_apr_url",
202
+ DEFAULT_HREF: "#!"
203
+ },
204
+ BROWSED_ITEMS: {
205
+ HREF: "browsed_item_url",
206
+ DEFAULT_HREF: "#!"
207
+ },
208
+ PURCHASED_ITEMS: {
209
+ HREF: "purchased_item_url",
210
+ DEFAULT_HREF: "#!"
211
+ }
190
212
  }
191
213
  } };
214
+ function m(e, a = 8) {
215
+ return i(1, a + 1).map((s) => `${e}_${s}`);
216
+ }
217
+ function E() {
218
+ const { PAIRS_FOR_EXTENSION: e } = t, a = [];
219
+ return a.push(
220
+ e.imageSrc.CART_ITEMS.ATTR,
221
+ e.imageSrc.BROWSED_ITEMS.ATTR,
222
+ e.imageSrc.PURCHASED_ITEMS.ATTR
223
+ ), a.push(
224
+ e.name.CART_ITEMS.ATTR,
225
+ e.name.CART_ITEMS.HREF,
226
+ e.name.BROWSED_ITEMS.ATTR,
227
+ e.name.BROWSED_ITEMS.HREF,
228
+ e.name.PURCHASED_ITEMS.ATTR,
229
+ e.name.PURCHASED_ITEMS.HREF
230
+ ), a.push(
231
+ e.quantity.CART_ITEMS.ATTR,
232
+ e.quantity.BROWSED_ITEMS.ATTR,
233
+ e.quantity.PURCHASED_ITEMS.ATTR
234
+ ), a.push(
235
+ e.price.CART_ITEMS.PRICE,
236
+ e.price.CART_ITEMS.PRICE_FORMATTED,
237
+ e.price.CART_ITEMS.CURRENCY,
238
+ e.price.BROWSED_ITEMS.PRICE,
239
+ e.price.BROWSED_ITEMS.PRICE_FORMATTED,
240
+ e.price.BROWSED_ITEMS.CURRENCY,
241
+ e.price.PURCHASED_ITEMS.PRICE,
242
+ e.price.PURCHASED_ITEMS.PRICE_FORMATTED,
243
+ e.price.PURCHASED_ITEMS.CURRENCY
244
+ ), a.push(
245
+ e.originalPrice.CART_ITEMS.PRICE,
246
+ e.originalPrice.CART_ITEMS.PRICE_FORMATTED,
247
+ e.originalPrice.CART_ITEMS.CURRENCY,
248
+ e.originalPrice.BROWSED_ITEMS.PRICE,
249
+ e.originalPrice.BROWSED_ITEMS.PRICE_FORMATTED,
250
+ e.originalPrice.BROWSED_ITEMS.CURRENCY,
251
+ e.originalPrice.PURCHASED_ITEMS.PRICE,
252
+ e.originalPrice.PURCHASED_ITEMS.PRICE_FORMATTED,
253
+ e.originalPrice.PURCHASED_ITEMS.CURRENCY
254
+ ), a.push(
255
+ e.button.CART_ITEMS.HREF,
256
+ e.button.BROWSED_ITEMS.HREF,
257
+ e.button.PURCHASED_ITEMS.HREF
258
+ ), a.push(
259
+ e.itemLink.CART_ITEMS.HREF,
260
+ e.itemLink.BROWSED_ITEMS.HREF,
261
+ e.itemLink.PURCHASED_ITEMS.HREF
262
+ ), a;
263
+ }
264
+ const p = _(
265
+ E(),
266
+ (e) => m(e)
267
+ );
192
268
  export {
193
- e as configAttributes,
194
- s as productPairs
269
+ R as configAttributes,
270
+ p as itemsBlockDynamicVariables,
271
+ t as productPairs,
272
+ o as templateFirstLine
195
273
  };
@@ -28,7 +28,13 @@ const e = {
28
28
  productImageLinkControlValue: "{{Abandoned Cart Item (1) Image}}",
29
29
  productNameControlEnabled: "1",
30
30
  productQuantityControlEnabled: "1",
31
- productPriceControlOpened: "1"
31
+ productPriceControlOpened: "1",
32
+ productImageVisible: "1",
33
+ productNameVisible: "1",
34
+ productQuantityVisible: "1",
35
+ productPriceVisible: "1",
36
+ productOriginalPriceVisible: "1",
37
+ productButtonVisible: "1"
32
38
  }, o = {
33
39
  [e.ITEMS_TYPE.CART_ITEMS]: [
34
40
  { text: "Abandoned Cart Item (1)", value: "{{Abandoned Cart Item (1) Url}}" },
@@ -1,59 +1,60 @@
1
- const t = `<td align="center" class="ins-product-td items-block items-block-v2">
2
- <table class="es-left ins-product-wrapper" cellspacing="0" cellpadding="0" align="left" width="100%">
3
- {-{-CONFIG_BLOCK-}-}
4
- <tbody>
5
- <tr>
6
- <td class="es-p20b es-p10r es-p10l es-m-p20b es-p10t" width="100%" align="center">
7
- <table class="ins-product-cart" width="100%" cellspacing="0" cellpadding="0">
8
- <tr style="vertical-align: top">
9
- <td colspan="2" width="100%" align="center" data-slot-1>
10
- <table width="100%">
11
- <tbody>
12
- {-{-PRODUCT_IMAGE-}-}
13
- </tbody>
14
- </table>
15
- </td>
16
- </tr>
17
- {-{-PRODUCT_NAME-}-}
18
- <tr>
19
- <td width="50%" style=" width: 50%;display: block;float: left;">
20
- <table width="100%">
21
- <tbody>
22
- {-{-PRODUCT_PRICE-}-}
23
- </tbody>
24
- </table>
25
- </td>
26
- <td width="50%" style=" width: 50%;display: block;float: left;">
27
- <table width="100%">
28
- <tbody>
29
- {-{-PRODUCT_ORIGINAL_PRICE-}-}
30
- </tbody>
31
- </table>
32
- </td>
33
- </tr>
34
- <tr>
35
- <td width="100%">
36
- <table width="100%">
37
- <tbody>
38
- {-{-PRODUCT_QUANTITY-}-}
39
- </tbody>
40
- </table>
41
- </td>
42
- </tr>
43
- <tr>
44
- <td width="100%">
45
- <table width="100%">
46
- <tbody>
47
- {-{-PRODUCT_BUTTON-}-}
48
- </tbody>
49
- </table>
50
- </td>
51
- </tr>
52
- </table>
53
- </td>
54
- </tr>
55
- </tbody>
56
- </table>
1
+ const t = `{-{-TEMPLATE_FIRST_LINE-}-}
2
+ <table class="es-left ins-product-wrapper" cellspacing="0" cellpadding="0" align="left" width="100%">
3
+ {-{-CONFIG_BLOCK-}-}
4
+ <tbody>
5
+ <tr>
6
+ <td class="es-p20b es-p10r es-p10l es-m-p20b es-p10t" width="100%" align="center">
7
+ <table class="ins-product-cart" width="100%" cellspacing="0" cellpadding="0">
8
+ <tr style="vertical-align: top">
9
+ <td colspan="2" width="100%" align="center" data-slot-1>
10
+ <table width="100%">
11
+ <tbody>
12
+ {-{-PRODUCT_IMAGE-}-}
13
+ </tbody>
14
+ </table>
15
+ </td>
16
+ </tr>
17
+ {-{-PRODUCT_NAME-}-}
18
+ <tr>
19
+ <td width="50%" style=" width: 50%;display: block;float: left;" class="product-price-class">
20
+ <table width="100%">
21
+ <tbody>
22
+ {-{-PRODUCT_PRICE-}-}
23
+ </tbody>
24
+ </table>
25
+ </td>
26
+ <td width="50%" style=" width: 50%;display: block;float: left;"
27
+ class="product-original-price-class">
28
+ <table width="100%">
29
+ <tbody>
30
+ {-{-PRODUCT_ORIGINAL_PRICE-}-}
31
+ </tbody>
32
+ </table>
33
+ </td>
34
+ </tr>
35
+ <tr>
36
+ <td width="100%">
37
+ <table width="100%">
38
+ <tbody>
39
+ {-{-PRODUCT_QUANTITY-}-}
40
+ </tbody>
41
+ </table>
42
+ </td>
43
+ </tr>
44
+ <tr>
45
+ <td width="100%">
46
+ <table width="100%">
47
+ <tbody>
48
+ {-{-PRODUCT_BUTTON-}-}
49
+ </tbody>
50
+ </table>
51
+ </td>
52
+ </tr>
53
+ </table>
54
+ </td>
55
+ </tr>
56
+ </tbody>
57
+ </table>
57
58
  </td>
58
59
  `;
59
60
  export {