@useinsider/guido 3.2.0-beta.f2e037f → 3.2.0-beta.f708a56

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.
@@ -1,75 +1,75 @@
1
- import { ModificationDescription as m, UIElementType as _, UEAttr as A } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
2
- import { CommonControl as h } from "../../../common-control.js";
3
- import { ItemsBlockControlId as L, ItemsBlockId as R } from "../../enums/controlEnums.js";
4
- import { productPairs as T } from "../../enums/productEnums.js";
5
- import { getItemsBlockConfig as I, setItemsBlockConfig as u, escapeReplacement as N } from "../../utils/nodeConfigUtils.js";
6
- const D = L.PRICE_SINGLE_PRICE, l = {
1
+ import { ModificationDescription as S, UIElementType as d, UEAttr as m } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
2
+ import { CommonControl as A } from "../../../common-control.js";
3
+ import { ItemsBlockControlId as T, ItemsBlockId as p } from "../../enums/controlEnums.js";
4
+ import { productPairs as R } from "../../enums/productEnums.js";
5
+ import { getItemsBlockConfig as I, setItemsBlockConfig as N, escapeReplacement as h } from "../../utils/nodeConfigUtils.js";
6
+ const u = T.PRICE_SINGLE_PRICE, l = {
7
7
  SINGLE_PRICE: "singlePrice"
8
8
  };
9
- class y extends h {
9
+ class k extends A {
10
10
  getId() {
11
- return D;
11
+ return u;
12
12
  }
13
13
  getTemplate() {
14
14
  return `
15
- <div class="container ${L.PRICE_SINGLE_PRICE}">
15
+ <div class="container ${T.PRICE_SINGLE_PRICE}">
16
16
  ${this._getSinglePrice()}
17
17
  </div>
18
18
  `;
19
19
  }
20
20
  onRender() {
21
21
  const e = I(this.currentNode);
22
- this.api.updateValues({ [l.SINGLE_PRICE]: (e == null ? void 0 : e.priceSinglePrice) ?? !1 }), this.api.onValueChanged(l.SINGLE_PRICE, (t) => {
23
- this._onSinglePriceChange(t);
22
+ this.api.updateValues({ [l.SINGLE_PRICE]: (e == null ? void 0 : e.priceSinglePrice) ?? !1 }), this.api.onValueChanged(l.SINGLE_PRICE, (i) => {
23
+ this._onSinglePriceChange(i);
24
24
  });
25
25
  }
26
26
  onTemplateNodeUpdated(e) {
27
27
  super.onTemplateNodeUpdated(e), this.handleBlockInstanceChange(() => {
28
- const t = I(this.currentNode);
29
- this.api.updateValues({ [l.SINGLE_PRICE]: (t == null ? void 0 : t.priceSinglePrice) ?? !1 });
28
+ const i = I(this.currentNode);
29
+ this.api.updateValues({ [l.SINGLE_PRICE]: (i == null ? void 0 : i.priceSinglePrice) ?? !1 });
30
30
  });
31
31
  }
32
32
  _onSinglePriceChange(e) {
33
- if (console.debug("Single price changed to: ", e), u(this.currentNode, this.api, { priceSinglePrice: e }), !this.currentNode)
33
+ if (console.debug("Single price changed to: ", e), !this.currentNode)
34
34
  return;
35
- const t = I(this.currentNode), o = (t == null ? void 0 : t.type) ?? "CART_ITEMS", r = (t == null ? void 0 : t.priceFormatted) ?? !1, i = T.PAIRS_FOR_EXTENSION.price[o], c = T.PAIRS_FOR_EXTENSION.originalPrice[o], [P, p] = e ? [
36
- r ? i.DEFAULT_PRICE_FORMATTED : i.DEFAULT_PRICE,
37
- r ? i.DEFAULT_SINGLE_PRICE_FORMATTED : i.DEFAULT_SINGLE_PRICE
35
+ const i = I(this.currentNode), c = (i == null ? void 0 : i.type) ?? "CART_ITEMS", r = (i == null ? void 0 : i.priceFormatted) ?? !1, t = R.PAIRS_FOR_EXTENSION.price[c], n = R.PAIRS_FOR_EXTENSION.originalPrice[c], [E, g] = e ? [
36
+ r ? t.DEFAULT_PRICE_FORMATTED : t.DEFAULT_PRICE,
37
+ r ? t.DEFAULT_SINGLE_PRICE_FORMATTED : t.DEFAULT_SINGLE_PRICE
38
38
  ] : [
39
- r ? i.DEFAULT_SINGLE_PRICE_FORMATTED : i.DEFAULT_SINGLE_PRICE,
40
- r ? i.DEFAULT_PRICE_FORMATTED : i.DEFAULT_PRICE
41
- ], s = r ? c.DEFAULT_PRICE_FORMATTED : c.DEFAULT_PRICE, d = r ? c.DEFAULT_SINGLE_PRICE_FORMATTED : c.DEFAULT_SINGLE_PRICE, [g, C] = e ? [s, d] : [d, s], n = this.currentNode.closest(".items-block"), S = (n == null ? void 0 : n.querySelectorAll(
42
- `[esd-extension-block-id="${R.PRICE}"]`
43
- )) || [], E = this.api.getDocumentModifier();
44
- S.forEach((a) => {
45
- this._updatePriceBlock(E, a, P, p, e);
46
- }), ((n == null ? void 0 : n.querySelectorAll(
47
- `[esd-extension-block-id="${R.ORIGINAL_PRICE}"]`
39
+ r ? t.DEFAULT_SINGLE_PRICE_FORMATTED : t.DEFAULT_SINGLE_PRICE,
40
+ r ? t.DEFAULT_PRICE_FORMATTED : t.DEFAULT_PRICE
41
+ ], P = r ? n.DEFAULT_PRICE_FORMATTED : n.DEFAULT_PRICE, _ = r ? n.DEFAULT_SINGLE_PRICE_FORMATTED : n.DEFAULT_SINGLE_PRICE, [L, C] = e ? [P, _] : [_, P], s = this.api.getDocumentModifier();
42
+ N(this.currentNode, this.api, { priceSinglePrice: e }, s);
43
+ const o = this.currentNode.closest(".items-block");
44
+ ((o == null ? void 0 : o.querySelectorAll(
45
+ `[esd-extension-block-id="${p.PRICE}"]`
48
46
  )) || []).forEach((a) => {
49
- this._updatePriceBlock(E, a, g, C, e);
50
- }), E.apply(new m(
47
+ this._updatePriceBlock(s, a, E, g, e);
48
+ }), ((o == null ? void 0 : o.querySelectorAll(
49
+ `[esd-extension-block-id="${p.ORIGINAL_PRICE}"]`
50
+ )) || []).forEach((a) => {
51
+ this._updatePriceBlock(s, a, L, C, e);
52
+ }), s.apply(new S(
51
53
  `Updated price to ${e ? "single" : "total"} price`
52
54
  ));
53
55
  }
54
- _updatePriceBlock(e, t, o, r, i) {
55
- const c = t.getInnerHTML().trim().replace(o, N(r));
56
- e.modifyHtml(t).setInnerHtml(c), t.querySelectorAll('[product-attr="price"], [product-attr="originalPrice"]').forEach((s) => {
57
- e.modifyHtml(s).setAttribute("data-single_price", i ? "true" : "false");
58
- });
56
+ _updatePriceBlock(e, i, c, r, t) {
57
+ const n = `data-single_price="${t ? "true" : "false"}"`, E = i.getInnerHTML().trim().replace(c, h(r)).replace(/data-single_price=(?:"[^"]*"|'[^']*')/g, n);
58
+ e.modifyHtml(i).setInnerHtml(E);
59
59
  }
60
60
  _getSinglePrice() {
61
61
  return `
62
62
  <div class="display-flex align-items-center justify-content-between">
63
- <${_.LABEL}
64
- ${A.LABEL.text}="${this.api.translate("Show Single Product Price")}"
63
+ <${d.LABEL}
64
+ ${m.LABEL.text}="${this.api.translate("Show Single Product Price")}"
65
65
  >
66
- </${_.LABEL}>
66
+ </${d.LABEL}>
67
67
  ${this._GuToggle(l.SINGLE_PRICE)}
68
68
  </div>
69
69
  `;
70
70
  }
71
71
  }
72
72
  export {
73
- D as CONTROL_BLOCK_ID,
74
- y as PriceSinglePriceControl
73
+ u as CONTROL_BLOCK_ID,
74
+ k as PriceSinglePriceControl
75
75
  };
@@ -1,6 +1,6 @@
1
1
  import _ from "../../../../node_modules/lodash-es/flatMap.js";
2
- import a from "../../../../node_modules/lodash-es/range.js";
3
- const T = '<td align="center" class="ins-product-td items-block items-block-v2">', E = { PAIRS_FOR_EXTENSION: {
2
+ import E from "../../../../node_modules/lodash-es/range.js";
3
+ const T = '<td align="center" class="ins-product-td items-block items-block-v2">', a = { PAIRS_FOR_EXTENSION: {
4
4
  imageSrc: {
5
5
  CART_ITEMS: {
6
6
  ATTR: "ins_apr_img",
@@ -212,10 +212,10 @@ const T = '<td align="center" class="ins-product-td items-block items-block-v2">
212
212
  }
213
213
  } };
214
214
  function m(e, s = 8) {
215
- return a(1, s + 1).map((i) => `${e}_${i}`);
215
+ return E(1, s + 1).map((i) => `${e}_${i}`);
216
216
  }
217
- function t() {
218
- const { PAIRS_FOR_EXTENSION: e } = E, s = [];
217
+ function r() {
218
+ const { PAIRS_FOR_EXTENSION: e } = a, s = [];
219
219
  return s.push(
220
220
  e.imageSrc.CART_ITEMS.ATTR,
221
221
  e.imageSrc.BROWSED_ITEMS.ATTR,
@@ -234,22 +234,34 @@ function t() {
234
234
  ), s.push(
235
235
  e.price.CART_ITEMS.PRICE,
236
236
  e.price.CART_ITEMS.PRICE_FORMATTED,
237
+ e.price.CART_ITEMS.SINGLE_PRICE,
238
+ e.price.CART_ITEMS.SINGLE_PRICE_FORMATTED,
237
239
  e.price.CART_ITEMS.CURRENCY,
238
240
  e.price.BROWSED_ITEMS.PRICE,
239
241
  e.price.BROWSED_ITEMS.PRICE_FORMATTED,
242
+ e.price.BROWSED_ITEMS.SINGLE_PRICE,
243
+ e.price.BROWSED_ITEMS.SINGLE_PRICE_FORMATTED,
240
244
  e.price.BROWSED_ITEMS.CURRENCY,
241
245
  e.price.PURCHASED_ITEMS.PRICE,
242
246
  e.price.PURCHASED_ITEMS.PRICE_FORMATTED,
247
+ e.price.PURCHASED_ITEMS.SINGLE_PRICE,
248
+ e.price.PURCHASED_ITEMS.SINGLE_PRICE_FORMATTED,
243
249
  e.price.PURCHASED_ITEMS.CURRENCY
244
250
  ), s.push(
245
251
  e.originalPrice.CART_ITEMS.PRICE,
246
252
  e.originalPrice.CART_ITEMS.PRICE_FORMATTED,
253
+ e.originalPrice.CART_ITEMS.SINGLE_PRICE,
254
+ e.originalPrice.CART_ITEMS.SINGLE_PRICE_FORMATTED,
247
255
  e.originalPrice.CART_ITEMS.CURRENCY,
248
256
  e.originalPrice.BROWSED_ITEMS.PRICE,
249
257
  e.originalPrice.BROWSED_ITEMS.PRICE_FORMATTED,
258
+ e.originalPrice.BROWSED_ITEMS.SINGLE_PRICE,
259
+ e.originalPrice.BROWSED_ITEMS.SINGLE_PRICE_FORMATTED,
250
260
  e.originalPrice.BROWSED_ITEMS.CURRENCY,
251
261
  e.originalPrice.PURCHASED_ITEMS.PRICE,
252
262
  e.originalPrice.PURCHASED_ITEMS.PRICE_FORMATTED,
263
+ e.originalPrice.PURCHASED_ITEMS.SINGLE_PRICE,
264
+ e.originalPrice.PURCHASED_ITEMS.SINGLE_PRICE_FORMATTED,
253
265
  e.originalPrice.PURCHASED_ITEMS.CURRENCY
254
266
  ), s.push(
255
267
  e.button.CART_ITEMS.HREF,
@@ -262,11 +274,11 @@ function t() {
262
274
  ), s;
263
275
  }
264
276
  const o = _(
265
- t(),
277
+ r(),
266
278
  (e) => m(e)
267
279
  );
268
280
  export {
269
281
  o as itemsBlockDynamicVariables,
270
- E as productPairs,
282
+ a as productPairs,
271
283
  T as templateFirstLine
272
284
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@useinsider/guido",
3
- "version": "3.2.0-beta.f2e037f",
3
+ "version": "3.2.0-beta.f708a56",
4
4
  "description": "Guido is a Vue + TypeScript wrapper for Email Plugin. Easily embed the email editor in your Vue applications.",
5
5
  "main": "./dist/guido.umd.cjs",
6
6
  "module": "./dist/library.js",