@useinsider/guido 1.0.3-beta.8496f2a → 1.0.3-beta.8646ecc

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 (150) hide show
  1. package/README.md +32 -3
  2. package/dist/components/Guido.vue.js +1 -1
  3. package/dist/components/Guido.vue2.js +73 -79
  4. package/dist/components/organisms/LoadingWrapper.vue.js +1 -1
  5. package/dist/components/organisms/header/RightSlot.vue.js +1 -1
  6. package/dist/components/organisms/header/RightSlot.vue2.js +20 -21
  7. package/dist/components/organisms/onboarding/OnboardingWrapper.vue2.js +18 -20
  8. package/dist/composables/useActionsApi.js +1 -1
  9. package/dist/composables/useGuidoActions.js +9 -19
  10. package/dist/composables/useHtmlCompiler.js +13 -15
  11. package/dist/composables/useHtmlValidator.js +35 -36
  12. package/dist/composables/useStripo.js +40 -46
  13. package/dist/config/compiler/unsubscribeCompilerRules.js +28 -33
  14. package/dist/enums/defaults.js +1 -2
  15. package/dist/enums/onboarding.js +3 -7
  16. package/dist/enums/unsubscribe.js +25 -27
  17. package/dist/extensions/Blocks/Checkbox/control.js +14 -15
  18. package/dist/extensions/Blocks/Checkbox/template.js +9 -14
  19. package/dist/extensions/Blocks/Items/block.js +28 -29
  20. package/dist/extensions/Blocks/Items/controls/cardComposition.js +57 -151
  21. package/dist/extensions/Blocks/Items/controls/name/trimming.js +2 -2
  22. package/dist/extensions/Blocks/Items/controls/settingsControl.js +117 -149
  23. package/dist/extensions/Blocks/Items/enums/productEnums.js +5 -83
  24. package/dist/extensions/Blocks/Items/enums/settingsEnums.js +1 -7
  25. package/dist/extensions/Blocks/Items/layouts/horizontal.html.js +56 -57
  26. package/dist/extensions/Blocks/Items/layouts/vertical.html.js +55 -54
  27. package/dist/extensions/Blocks/Items/settingsPanel.js +31 -56
  28. package/dist/extensions/Blocks/Items/template.js +59 -138
  29. package/dist/extensions/Blocks/RadioButton/control.js +17 -18
  30. package/dist/extensions/Blocks/RadioButton/template.js +9 -18
  31. package/dist/extensions/Blocks/Recommendation/store/recommendation.js +1 -1
  32. package/dist/extensions/Blocks/Unsubscribe/block.js +27 -27
  33. package/dist/extensions/DynamicContent/dynamic-content-modal.js +19 -25
  34. package/dist/extensions/DynamicContent/dynamic-content.js +33 -128
  35. package/dist/guido.css +1 -1
  36. package/dist/node_modules/lodash-es/_arrayLikeKeys.js +12 -13
  37. package/dist/node_modules/lodash-es/keysIn.js +3 -3
  38. package/dist/package.json.js +1 -1
  39. package/dist/src/@types/generic.d.ts +6 -27
  40. package/dist/src/components/Guido.vue.d.ts +2 -3
  41. package/dist/src/composables/useGuidoActions.d.ts +0 -9
  42. package/dist/src/enums/onboarding.d.ts +0 -4
  43. package/dist/src/extensions/Blocks/Checkbox/template.d.ts +1 -1
  44. package/dist/src/extensions/Blocks/Items/block.d.ts +0 -14
  45. package/dist/src/extensions/Blocks/Items/controls/cardComposition.d.ts +7 -20
  46. package/dist/src/extensions/Blocks/Items/controls/settingsControl.d.ts +2 -8
  47. package/dist/src/extensions/Blocks/Items/enums/productEnums.d.ts +0 -8
  48. package/dist/src/extensions/Blocks/Items/enums/settingsEnums.d.ts +0 -6
  49. package/dist/src/extensions/Blocks/Items/template.d.ts +1 -9
  50. package/dist/src/extensions/Blocks/RadioButton/template.d.ts +1 -1
  51. package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +1 -1
  52. package/dist/src/extensions/DynamicContent/dynamic-content-modal.d.ts +2 -9
  53. package/dist/src/extensions/DynamicContent/dynamic-content.d.ts +2 -52
  54. package/dist/src/stores/config.d.ts +2 -3
  55. package/dist/src/stores/dynamic-content.d.ts +3 -3
  56. package/dist/src/stores/editor.d.ts +1 -1
  57. package/dist/src/stores/onboarding.d.ts +1 -335
  58. package/dist/src/stores/preview.d.ts +1 -1
  59. package/dist/src/stores/recommendation.d.ts +1 -1
  60. package/dist/src/stores/save-as-template.d.ts +1 -1
  61. package/dist/src/stores/toaster.d.ts +1 -1
  62. package/dist/src/stores/unsubscribe.d.ts +1 -1
  63. package/dist/src/stores/version-history.d.ts +1 -1
  64. package/dist/src/utils/genericUtil.d.ts +0 -1
  65. package/dist/stores/config.js +5 -5
  66. package/dist/stores/dynamic-content.js +2 -2
  67. package/dist/stores/editor.js +1 -1
  68. package/dist/stores/onboarding.js +36 -44
  69. package/dist/stores/preview.js +1 -1
  70. package/dist/stores/recommendation.js +3 -3
  71. package/dist/stores/save-as-template.js +2 -2
  72. package/dist/stores/toaster.js +1 -1
  73. package/dist/stores/unsubscribe.js +1 -1
  74. package/dist/stores/version-history.js +4 -4
  75. package/dist/utils/genericUtil.js +6 -17
  76. package/package.json +11 -4
  77. package/dist/components/organisms/onboarding/ItemsOnboarding.vue.js +0 -21
  78. package/dist/components/organisms/onboarding/ItemsOnboarding.vue2.js +0 -99
  79. package/dist/config/compiler/itemsCompilerRules.js +0 -14
  80. package/dist/node_modules/lodash-es/_DataView.js +0 -6
  81. package/dist/node_modules/lodash-es/_Promise.js +0 -6
  82. package/dist/node_modules/lodash-es/_Set.js +0 -6
  83. package/dist/node_modules/lodash-es/_SetCache.js +0 -13
  84. package/dist/node_modules/lodash-es/_WeakMap.js +0 -6
  85. package/dist/node_modules/lodash-es/_arrayFilter.js +0 -10
  86. package/dist/node_modules/lodash-es/_arrayMap.js +0 -8
  87. package/dist/node_modules/lodash-es/_arrayPush.js +0 -8
  88. package/dist/node_modules/lodash-es/_arraySome.js +0 -9
  89. package/dist/node_modules/lodash-es/_baseEach.js +0 -6
  90. package/dist/node_modules/lodash-es/_baseFlatten.js +0 -13
  91. package/dist/node_modules/lodash-es/_baseForOwn.js +0 -8
  92. package/dist/node_modules/lodash-es/_baseGet.js +0 -11
  93. package/dist/node_modules/lodash-es/_baseGetAllKeys.js +0 -9
  94. package/dist/node_modules/lodash-es/_baseHasIn.js +0 -6
  95. package/dist/node_modules/lodash-es/_baseIsEqual.js +0 -8
  96. package/dist/node_modules/lodash-es/_baseIsEqualDeep.js +0 -32
  97. package/dist/node_modules/lodash-es/_baseIsMatch.js +0 -29
  98. package/dist/node_modules/lodash-es/_baseIteratee.js +0 -11
  99. package/dist/node_modules/lodash-es/_baseKeys.js +0 -14
  100. package/dist/node_modules/lodash-es/_baseMap.js +0 -11
  101. package/dist/node_modules/lodash-es/_baseMatches.js +0 -12
  102. package/dist/node_modules/lodash-es/_baseMatchesProperty.js +0 -17
  103. package/dist/node_modules/lodash-es/_baseProperty.js +0 -8
  104. package/dist/node_modules/lodash-es/_basePropertyDeep.js +0 -9
  105. package/dist/node_modules/lodash-es/_baseRange.js +0 -9
  106. package/dist/node_modules/lodash-es/_baseToString.js +0 -18
  107. package/dist/node_modules/lodash-es/_baseTrim.js +0 -8
  108. package/dist/node_modules/lodash-es/_cacheHas.js +0 -6
  109. package/dist/node_modules/lodash-es/_castPath.js +0 -10
  110. package/dist/node_modules/lodash-es/_createBaseEach.js +0 -15
  111. package/dist/node_modules/lodash-es/_createRange.js +0 -11
  112. package/dist/node_modules/lodash-es/_equalArrays.js +0 -40
  113. package/dist/node_modules/lodash-es/_equalByTag.js +0 -45
  114. package/dist/node_modules/lodash-es/_equalObjects.js +0 -36
  115. package/dist/node_modules/lodash-es/_getAllKeys.js +0 -9
  116. package/dist/node_modules/lodash-es/_getMatchData.js +0 -12
  117. package/dist/node_modules/lodash-es/_getSymbols.js +0 -10
  118. package/dist/node_modules/lodash-es/_getTag.js +0 -28
  119. package/dist/node_modules/lodash-es/_hasPath.js +0 -19
  120. package/dist/node_modules/lodash-es/_isFlattenable.js +0 -10
  121. package/dist/node_modules/lodash-es/_isKey.js +0 -12
  122. package/dist/node_modules/lodash-es/_isStrictComparable.js +0 -7
  123. package/dist/node_modules/lodash-es/_mapToArray.js +0 -9
  124. package/dist/node_modules/lodash-es/_matchesStrictComparable.js +0 -8
  125. package/dist/node_modules/lodash-es/_memoizeCapped.js +0 -11
  126. package/dist/node_modules/lodash-es/_nativeKeys.js +0 -5
  127. package/dist/node_modules/lodash-es/_setCacheAdd.js +0 -7
  128. package/dist/node_modules/lodash-es/_setCacheHas.js +0 -6
  129. package/dist/node_modules/lodash-es/_setToArray.js +0 -9
  130. package/dist/node_modules/lodash-es/_stringToPath.js +0 -10
  131. package/dist/node_modules/lodash-es/_toKey.js +0 -10
  132. package/dist/node_modules/lodash-es/_trimmedEndIndex.js +0 -9
  133. package/dist/node_modules/lodash-es/flatMap.js +0 -8
  134. package/dist/node_modules/lodash-es/get.js +0 -8
  135. package/dist/node_modules/lodash-es/hasIn.js +0 -8
  136. package/dist/node_modules/lodash-es/isSymbol.js +0 -9
  137. package/dist/node_modules/lodash-es/keys.js +0 -9
  138. package/dist/node_modules/lodash-es/map.js +0 -11
  139. package/dist/node_modules/lodash-es/property.js +0 -10
  140. package/dist/node_modules/lodash-es/range.js +0 -5
  141. package/dist/node_modules/lodash-es/stubArray.js +0 -6
  142. package/dist/node_modules/lodash-es/toFinite.js +0 -14
  143. package/dist/node_modules/lodash-es/toNumber.js +0 -22
  144. package/dist/node_modules/lodash-es/toString.js +0 -7
  145. package/dist/src/components/organisms/onboarding/ItemsOnboarding.vue.d.ts +0 -2
  146. package/dist/src/config/compiler/itemsCompilerRules.d.ts +0 -2
  147. package/dist/src/utils/environmentUtil.d.ts +0 -5
  148. package/dist/src/utils/pairProductVariables.d.ts +0 -7
  149. package/dist/utils/environmentUtil.js +0 -4
  150. package/dist/utils/pairProductVariables.js +0 -136
@@ -1,29 +1,28 @@
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 = {
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 = {
16
15
  ITEMS_TYPE: "itemsType",
17
16
  ORIENTATION: "orientation",
18
17
  ITEM_IDS: "itemIds"
19
18
  };
20
- class Z extends D {
19
+ class z extends b {
21
20
  constructor() {
22
21
  super(...arguments);
23
- C(this, "store", U());
22
+ R(this, "store", H());
24
23
  }
25
24
  getId() {
26
- return w;
25
+ return $;
27
26
  }
28
27
  getTemplate() {
29
28
  return `
@@ -42,18 +41,11 @@ class Z extends D {
42
41
  }), this._listenToFormUpdates();
43
42
  }
44
43
  onTemplateNodeUpdated(e) {
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
- );
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();
57
49
  }
58
50
  onDestroy() {
59
51
  const e = this._getTemplateData();
@@ -67,7 +59,7 @@ class Z extends D {
67
59
  name: o.ITEMS_TYPE,
68
60
  className: "es-100",
69
61
  placeholder: "Select Item Type",
70
- options: R
62
+ options: P
71
63
  })
72
64
  ])}
73
65
  `;
@@ -78,7 +70,7 @@ class Z extends D {
78
70
  this._GuLabel({ text: "Orientation" }),
79
71
  this._GuRadioButton({
80
72
  name: o.ORIENTATION,
81
- buttons: L
73
+ buttons: x
82
74
  })
83
75
  ])}
84
76
  `;
@@ -97,38 +89,38 @@ class Z extends D {
97
89
  `;
98
90
  }
99
91
  _onOrientationChange(e) {
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();
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();
101
93
  }
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());
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());
105
97
  }
106
98
  _onItemIdsChange(e) {
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();
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();
108
100
  }
109
101
  _initializeSelectItems() {
110
102
  this.api.setUIEAttribute(
111
103
  o.ITEMS_TYPE,
112
- b.SELECTPICKER.items,
113
- R
104
+ f.SELECTPICKER.items,
105
+ P
114
106
  );
115
- const { itemsType: e, itemIds: i } = this.store;
107
+ const { itemsType: e, itemIds: t } = this.store;
116
108
  this.api.updateValues({
117
109
  [o.ITEMS_TYPE]: e
118
110
  });
119
- const t = N[e];
111
+ const i = S[e];
120
112
  this.api.setUIEAttribute(
121
113
  o.ITEM_IDS,
122
- b.SELECTPICKER.items,
123
- t
114
+ f.SELECTPICKER.items,
115
+ i
124
116
  ), this.api.updateValues({
125
- [o.ITEM_IDS]: i
117
+ [o.ITEM_IDS]: t
126
118
  });
127
119
  }
128
120
  _listenToFormUpdates() {
129
121
  this.api.onValueChanged(
130
122
  o.ITEMS_TYPE,
131
- (e) => this._onItemsTypeChange(e)
123
+ (e, t) => this._onItemsTypeChange(e, t)
132
124
  ), this.api.onValueChanged(
133
125
  o.ORIENTATION,
134
126
  (e) => this._onOrientationChange(e)
@@ -140,142 +132,118 @@ class Z extends D {
140
132
  _renderTemplate() {
141
133
  const {
142
134
  orientation: e,
143
- itemsType: i,
144
- itemIds: t,
135
+ itemsType: t,
136
+ itemIds: i,
145
137
  currencySymbol: r,
146
138
  currencyLocation: n,
147
139
  formattedPrice: s
148
140
  } = this.store;
149
- this.api.getDocumentModifier().modifyHtml(this.currentNode).setInnerHtml(F({
141
+ this.api.getDocumentModifier().modifyHtml(this.currentNode).setInnerHtml(U({
150
142
  orientation: e,
151
- itemsType: i,
152
- itemId: t,
143
+ itemsType: t,
144
+ itemId: i,
153
145
  currencySymbol: r,
154
146
  currencyLocation: n,
155
147
  formattedPrice: s
156
- })).apply(new d("Updated template"));
148
+ })).apply(new m("Updated template"));
157
149
  }
158
150
  _getTemplateData() {
159
- const { itemsType: e, itemIds: i, formattedPrice: t } = this.store, r = N[e].findIndex((s) => s.value === i), n = r > -1 ? r : 0;
151
+ const { itemsType: e, itemIds: t, formattedPrice: i } = this.store, r = S[e].findIndex((s) => s.value === t), n = r > -1 ? r : 0;
160
152
  return {
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
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
167
159
  };
168
160
  }
169
161
  _updateImageSrc(e) {
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"));
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"));
173
165
  }
174
166
  _updateName(e) {
175
167
  var n;
176
- const i = (n = this.currentNode) == null ? void 0 : n.querySelector(`[esd-extension-block-id="${m.NAME}"]`);
177
- if (!i)
168
+ const t = (n = this.currentNode) == null ? void 0 : n.querySelector(`[esd-extension-block-id="${a.NAME}"]`);
169
+ if (!t)
178
170
  return;
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"));
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"));
182
174
  }
183
175
  _updatePrice(e) {
184
- var E;
185
- const i = (E = this.currentNode) == null ? void 0 : E.querySelector(`[esd-extension-block-id="${m.PRICE}"]`);
186
- if (!i)
187
- return;
188
- const t = this._getParagraphFromBlock(i);
176
+ var g;
177
+ const t = (g = this.currentNode) == null ? void 0 : g.querySelector(`[esd-extension-block-id="${a.PRICE}"]`);
189
178
  if (!t)
190
179
  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"));
180
+ const i = this._getParagraphFromBlock(t);
181
+ if (!i)
182
+ 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"));
193
185
  }
194
186
  _updateOriginalPrice(e) {
195
- var y;
196
- const i = (y = this.currentNode) == null ? void 0 : y.querySelector(
197
- `[esd-extension-block-id="${m.ORIGINAL_PRICE}"]`
187
+ var E;
188
+ const t = (E = this.currentNode) == null ? void 0 : E.querySelector(
189
+ `[esd-extension-block-id="${a.ORIGINAL_PRICE}"]`
198
190
  );
199
- if (!i)
200
- return;
201
- const t = this._getParagraphFromBlock(i);
202
191
  if (!t)
203
192
  return;
204
- const r = t.querySelector("s");
193
+ const i = this._getParagraphFromBlock(t);
194
+ if (!i)
195
+ return;
196
+ const r = i.querySelector("s");
205
197
  if (!r)
206
198
  return;
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"));
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"));
209
201
  }
210
202
  _updateQuantity(e) {
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}"]`);
203
+ var n;
204
+ const t = (n = this.currentNode) == null ? void 0 : n.querySelector(`[esd-extension-block-id="${a.QUANTITY}"]`);
213
205
  if (!t)
214
206
  return;
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"));
218
- }
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)
229
- return;
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"));
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"));
233
210
  }
234
- _updateDataTypeAttributes(e) {
235
- if (!this.currentNode)
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)
236
215
  return;
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"));
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"));
242
219
  }
243
- _updateDataNumberAttributes(e) {
244
- if (!this.currentNode)
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)
245
226
  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"));
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"));
262
230
  }
263
231
  _reFillTemplate() {
264
232
  const e = this._getTemplateData();
265
- this._updateImageSrc(e.imageSrc), this._updateName(e.name), this._updatePrice(e.price), this._updateOriginalPrice(e.originalPrice), this._updateQuantity(e.quantity);
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);
266
234
  }
267
235
  _recalculateTrimming() {
268
236
  var r;
269
237
  if (!this.store.nameTrimming || !this.currentNode)
270
238
  return;
271
- const e = (r = this.currentNode) == null ? void 0 : r.querySelector(`[esd-extension-block-id="${m.NAME}"]`);
239
+ const e = (r = this.currentNode) == null ? void 0 : r.querySelector(`[esd-extension-block-id="${a.NAME}"]`);
272
240
  if (!e)
273
241
  return;
274
- const i = e.querySelector("p");
275
- if (!i)
242
+ const t = e.querySelector("p");
243
+ if (!t)
276
244
  return;
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"));
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"));
279
247
  }
280
248
  _getParagraphFromBlock(e) {
281
249
  return e.querySelector("p");
@@ -283,30 +251,30 @@ class Z extends D {
283
251
  _escapeRegex(e) {
284
252
  return e.replace(/[-\\^$*+?().|[\]{}]/g, "\\$&");
285
253
  }
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();
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();
292
260
  } else {
293
- const n = t.match(/([^0-9.,\s]+)/);
261
+ const n = i.match(/([^0-9.,\s]+)/);
294
262
  if (n && n[1]) {
295
- const s = n[1].trim(), a = new RegExp(`\\s*${this._escapeRegex(s)}\\s*`);
296
- r = t.replace(a, "").trim();
263
+ const s = n[1].trim(), c = new RegExp(`\\s*${this._escapeRegex(s)}\\s*`);
264
+ r = i.replace(c, "").trim();
297
265
  }
298
266
  }
299
267
  return r;
300
268
  }
301
- _replacePriceNumber(e, i) {
302
- const t = /([0-9][0-9,.]*)/;
303
- return e.replace(t, i).trim();
269
+ _replacePriceNumber(e, t) {
270
+ const i = /([0-9][0-9,.]*)/;
271
+ return e.replace(i, t).trim();
304
272
  }
305
- _buildPriceContent(e, i, t) {
306
- return i ? t === "1" ? `${e}&nbsp;${i}&nbsp;` : `${i}&nbsp;${e}` : e;
273
+ _buildPriceContent(e, t, i) {
274
+ return t ? i === "1" ? `${e}&nbsp;${t}&nbsp;` : `${t}&nbsp;${e}` : e;
307
275
  }
308
276
  }
309
277
  export {
310
- w as CONTROL_BLOCK_ID,
311
- Z as ItemsBlockControl
278
+ $ as CONTROL_BLOCK_ID,
279
+ z as ItemsBlockControl
312
280
  };
@@ -1,6 +1,4 @@
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 = {
1
+ const e = {
4
2
  TYPE: "data-type",
5
3
  ITEMS_INDEX_SELECT_CONTROL_VALUE: "data-cart_items_select_control_value",
6
4
  ORIENTATION: "data-card_orientation_control_value",
@@ -17,14 +15,8 @@ const o = '<td align="center" class="ins-product-td items-block items-block-v2">
17
15
  BLOCK_INSTANCE_ID: "data-block-instance-id",
18
16
  NAME_CONTROL_ENABLED: "data-product_name_control_enabled",
19
17
  QUANTITY_CONTROL_ENABLED: "data-product_quantity_control_enabled",
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: {
18
+ PRICE_CONTROL_OPENED: "data-product_price_control_opened"
19
+ }, s = { PAIRS_FOR_EXTENSION: {
28
20
  imageSrc: {
29
21
  CART_ITEMS: {
30
22
  ATTR: "ins_apr_img",
@@ -195,79 +187,9 @@ const o = '<td align="center" class="ins-product-td items-block items-block-v2">
195
187
  DEFAULT_HREF: "#!",
196
188
  DEFAULT_LABEL: "Buy"
197
189
  }
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
- }
212
190
  }
213
191
  } };
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
- );
268
192
  export {
269
- R as configAttributes,
270
- p as itemsBlockDynamicVariables,
271
- t as productPairs,
272
- o as templateFirstLine
193
+ e as configAttributes,
194
+ s as productPairs
273
195
  };
@@ -28,13 +28,7 @@ const e = {
28
28
  productImageLinkControlValue: "{{Abandoned Cart Item (1) Image}}",
29
29
  productNameControlEnabled: "1",
30
30
  productQuantityControlEnabled: "1",
31
- productPriceControlOpened: "1",
32
- productImageVisible: "1",
33
- productNameVisible: "1",
34
- productQuantityVisible: "1",
35
- productPriceVisible: "1",
36
- productOriginalPriceVisible: "1",
37
- productButtonVisible: "1"
31
+ productPriceControlOpened: "1"
38
32
  }, o = {
39
33
  [e.ITEMS_TYPE.CART_ITEMS]: [
40
34
  { text: "Abandoned Cart Item (1)", value: "{{Abandoned Cart Item (1) Url}}" },
@@ -1,60 +1,59 @@
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>
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>
58
57
  </td>
59
58
  `;
60
59
  export {