@useinsider/guido 2.1.0-beta.1d0cd94 → 2.1.0-beta.3394453

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.
@@ -74,7 +74,7 @@ const w = {
74
74
  function F() {
75
75
  return String(Date.now() + Math.floor(Math.random() * 1e3));
76
76
  }
77
- function q(r) {
77
+ function $(r) {
78
78
  return r ? {
79
79
  CartItems: d.ITEMS_TYPE.CART_ITEMS,
80
80
  BrowsedItems: d.ITEMS_TYPE.BROWSED_ITEMS,
@@ -85,7 +85,7 @@ function q(r) {
85
85
  }[r] || d.ITEMS_TYPE.CART_ITEMS : d.ITEMS_TYPE.CART_ITEMS;
86
86
  }
87
87
  function R(r) {
88
- const t = (a, o) => a == null ? o : a === "1" || a === "true", e = (a, o) => a || o, i = r["data-type"] || r["data-source"], l = q(i);
88
+ const t = (a, o) => a == null ? o : a === "1" || a === "true", e = (a, o) => a || o, i = r["data-type"] || r["data-source"], l = $(i);
89
89
  let n = r["data-cart_items_select_control_value"] || g.cartItemsSelectControlValue;
90
90
  if (n && !n.includes("{{") && /^\d+$/.test(n)) {
91
91
  const a = parseInt(n) - 1, o = E[l];
@@ -124,7 +124,7 @@ function R(r) {
124
124
  buttonVisible: t(r["data-product_button_control_enabled"], !0)
125
125
  };
126
126
  }
127
- const $ = {
127
+ const q = {
128
128
  ins_apr: "CART_ITEMS",
129
129
  browsed_item: "BROWSED_ITEMS",
130
130
  purchased_item: "PURCHASED_ITEMS"
@@ -196,12 +196,12 @@ class V {
196
196
  */
197
197
  extractConfiguration(t) {
198
198
  var C, D, P;
199
- const e = ((C = t.querySelector("[data-type]")) == null ? void 0 : C.getAttribute("data-type")) || "CART_ITEMS", i = ((D = t.querySelector("[data-number]")) == null ? void 0 : D.getAttribute("data-number")) || "1", l = parseInt(i) - 1, n = E[e], a = ((P = n == null ? void 0 : n[l]) == null ? void 0 : P.value) || n[0].value, o = t.querySelector('[product-attr="price"]'), _ = (o == null ? void 0 : o.getAttribute("data-currency_symbol")) || "USD", f = ((o == null ? void 0 : o.getAttribute("data-curency")) || "before") === "after" ? "1" : "0", u = (o == null ? void 0 : o.getAttribute("data-formated")) !== "false", s = this.extractConfigBlockAttributes(t, e, i), b = s["data-card_orientation_control_value"];
200
- let S;
201
- b ? S = b === "horizontal" ? "horizontal" : "vertical" : S = t.querySelector('[colspan="2"]') !== null ? "vertical" : "horizontal";
199
+ const e = ((C = t.querySelector("[data-type]")) == null ? void 0 : C.getAttribute("data-type")) || "CART_ITEMS", i = ((D = t.querySelector("[data-number]")) == null ? void 0 : D.getAttribute("data-number")) || "1", l = parseInt(i) - 1, n = E[e], a = ((P = n == null ? void 0 : n[l]) == null ? void 0 : P.value) || n[0].value, o = t.querySelector('[product-attr="price"]'), _ = (o == null ? void 0 : o.getAttribute("data-currency_symbol")) || "USD", f = ((o == null ? void 0 : o.getAttribute("data-curency")) || "before") === "after" ? "1" : "0", u = (o == null ? void 0 : o.getAttribute("data-formated")) !== "false", s = this.extractConfigBlockAttributes(t, e, i), S = s["data-card_orientation_control_value"];
200
+ let b;
201
+ S ? b = S === "horizontal" ? "horizontal" : "vertical" : b = t.querySelector('[colspan="2"]') !== null ? "vertical" : "horizontal";
202
202
  const p = t.querySelector('a[product-attr="name"]'), T = (p == null ? void 0 : p.getAttribute("style")) || void 0, y = t.querySelector('a[product-attr="button"]'), m = (y == null ? void 0 : y.getAttribute("style")) || void 0, k = (o == null ? void 0 : o.getAttribute("style")) || void 0, I = t.querySelector("p.original-price"), h = (I == null ? void 0 : I.getAttribute("style")) || void 0, A = t.querySelector('[product-attr="quantity"]'), L = (A == null ? void 0 : A.getAttribute("style")) || void 0;
203
203
  return {
204
- orientation: S,
204
+ orientation: b,
205
205
  itemsType: e,
206
206
  itemId: a,
207
207
  currencySymbol: _,
@@ -299,14 +299,14 @@ class V {
299
299
  * - Purchased Items: purchased_item_total_product_kind, purchased_item_price_N, purchased_item_originalprice_N
300
300
  */
301
301
  removeJinjaConditionals(t) {
302
- let e = t.replace(
303
- /\{%\s*if\s+(ins_apr|browsed_item|purchased_item)_total_product_kind\s*(>|>)\s*\d+\s*%\}/g,
304
- ""
305
- );
302
+ let e = t;
306
303
  return e = e.replace(
307
- /\{%\s*if\s+(ins_apr|browsed_item|purchased_item)_price_\d+\s*(!=|!=)\s*\1_originalprice_\d+\s*%\}/g,
308
- ""
309
- ), e = e.replace(/\{%\s*endif\s*%\}/g, ""), e = e.replace(/\n\s*\n\s*\n/g, `
304
+ /\{%\s*if\s+(ins_apr|browsed_item|purchased_item)_price_(\d+)\s*(!=|!=)\s*\1_originalprice_\2\s*%\}([\s\S]*?)\{%\s*endif\s*%\}/g,
305
+ "$4"
306
+ ), e = e.replace(
307
+ /\{%\s*if\s+(ins_apr|browsed_item|purchased_item)_total_product_kind\s*(>|>)\s*\d+\s*%\}([\s\S]*?)\{%\s*endif\s*%\}/g,
308
+ "$3"
309
+ ), e = e.replace(/\n\s*\n\s*\n/g, `
310
310
 
311
311
  `), e;
312
312
  }
@@ -325,16 +325,16 @@ class V {
325
325
  const n = l.match(/^(ins_apr|browsed_item|purchased_item)_([a-z_]+)_(\d+)$/);
326
326
  if (!n)
327
327
  return i;
328
- const [, a, o, _] = n, c = $[a];
328
+ const [, a, o, _] = n, c = q[a];
329
329
  if (!c)
330
330
  return console.warn(`Unknown variable prefix: ${a}`), i;
331
331
  const f = w[o];
332
332
  if (!f)
333
333
  return console.warn(`Unknown variable suffix mapping for: ${o}`), i;
334
- const { pairsKey: u, defaultKey: s, isArray: b } = f, p = e[u][c];
334
+ const { pairsKey: u, defaultKey: s, isArray: S } = f, p = e[u][c];
335
335
  if (!p)
336
336
  return console.warn(`No data found for: ${u}.${c}`), i;
337
- if (b) {
337
+ if (S) {
338
338
  const y = parseInt(_) - 1, m = p[s];
339
339
  return Array.isArray(m) && m[y] ? m[y] : (console.warn(`Array value not found: ${u}.${c}.${s}[${y}]`), i);
340
340
  }
@@ -1,50 +1,50 @@
1
- import { currencyLocationMaps as p } from "../../../../../enums/extensions/recommendationBlock.js";
2
- import { UEAttr as y, ModificationDescription as R } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
3
- import { CommonControl as L } from "../../../common-control.js";
4
- import { ItemsBlockControlId as u } from "../../enums/controlEnums.js";
5
- import { getItemsBlockConfig as l, setItemsBlockConfig as N, escapeReplacement as I } from "../../utils/nodeConfigUtils.js";
6
- const T = u.PRICE_CURRENCY_LOCATION, i = {
1
+ import { currencyLocationMaps as u } from "../../../../../enums/extensions/recommendationBlock.js";
2
+ import { UEAttr as R, ModificationDescription as L } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
3
+ import { CommonControl as N } from "../../../common-control.js";
4
+ import { ItemsBlockControlId as m } from "../../enums/controlEnums.js";
5
+ import { getItemsBlockConfig as C, setItemsBlockConfig as I, escapeReplacement as T } from "../../utils/nodeConfigUtils.js";
6
+ const E = m.PRICE_CURRENCY_LOCATION, c = {
7
7
  CURRENCY_LOCATION: "currencyLocation"
8
8
  };
9
- class $ extends L {
9
+ class A extends N {
10
10
  getId() {
11
- return T;
11
+ return E;
12
12
  }
13
13
  getTemplate() {
14
14
  return `
15
- <div class="container ${u.PRICE_CURRENCY_LOCATION}">
15
+ <div class="container ${m.PRICE_CURRENCY_LOCATION}">
16
16
  ${this._getCurrencyLocation()}
17
17
  </div>
18
18
  `;
19
19
  }
20
20
  onRender() {
21
- const e = l(this.currentNode);
22
- this.api.setUIEAttribute(i.CURRENCY_LOCATION, y.SELECTPICKER.items, p), this.api.updateValues({ [i.CURRENCY_LOCATION]: (e == null ? void 0 : e.priceCurrencyLocation) ?? "0" }), this.api.onValueChanged(i.CURRENCY_LOCATION, (t) => {
21
+ const e = C(this.currentNode);
22
+ this.api.setUIEAttribute(c.CURRENCY_LOCATION, R.SELECTPICKER.items, u), this.api.updateValues({ [c.CURRENCY_LOCATION]: (e == null ? void 0 : e.priceCurrencyLocation) ?? "0" }), this.api.onValueChanged(c.CURRENCY_LOCATION, (t) => {
23
23
  this._onCurrencyLocationChange(t);
24
24
  });
25
25
  }
26
26
  onTemplateNodeUpdated(e) {
27
27
  super.onTemplateNodeUpdated(e), this.handleBlockInstanceChange(() => {
28
- const t = l(this.currentNode);
29
- this.api.updateValues({ [i.CURRENCY_LOCATION]: (t == null ? void 0 : t.priceCurrencyLocation) ?? "0" });
28
+ const t = C(this.currentNode);
29
+ this.api.updateValues({ [c.CURRENCY_LOCATION]: (t == null ? void 0 : t.priceCurrencyLocation) ?? "0" });
30
30
  });
31
31
  }
32
32
  _onCurrencyLocationChange(e) {
33
- if (console.debug("Currency location changed to: ", e), N(this.currentNode, this.api, { priceCurrencyLocation: e }), !this.currentNode)
33
+ if (console.debug("Currency location changed to: ", e), I(this.currentNode, this.api, { priceCurrencyLocation: e }), !this.currentNode)
34
34
  return;
35
35
  const t = this._getPriceBlocks();
36
36
  if (!t || t.length === 0)
37
37
  return;
38
- const r = l(this.currentNode), n = e || "0", o = (r == null ? void 0 : r.priceCurrencySymbol) ?? "";
39
- t.forEach((s) => {
40
- const c = this._getParagraph(s);
41
- if (!c)
38
+ const r = C(this.currentNode), n = e || "0", o = (r == null ? void 0 : r.priceCurrencySymbol) ?? "", i = this.api.getDocumentModifier();
39
+ t.forEach((a) => {
40
+ const s = this._getParagraph(a);
41
+ if (!s)
42
42
  return;
43
- const m = c.getInnerHTML().trim() || "", a = c.getInnerText().trim() || "", C = (o == null ? void 0 : o.trim()) || "", h = this._removeCurrencySymbol(a, C), d = this._detectSymbolInText(a) || C, g = this._buildPriceContent(h, d, n), _ = m.replace(a, I(g));
44
- this.api.getDocumentModifier().modifyHtml(c).setInnerHtml(_).apply(new R(
45
- `Updated currency location to ${n === "1" ? "after" : "before"}`
46
- ));
47
- });
43
+ const h = s.getInnerHTML().trim() || "", l = s.getInnerText().trim() || "", p = (o == null ? void 0 : o.trim()) || "", d = this._removeCurrencySymbol(l, p), g = this._detectSymbolInText(l) || p, _ = this._buildPriceContent(d, g, n), y = h.replace(l, T(_));
44
+ i.modifyHtml(s).setInnerHtml(y);
45
+ }), i.apply(new L(
46
+ `Updated currency location to ${n === "1" ? "after" : "before"}`
47
+ ));
48
48
  }
49
49
  _getPriceBlocks() {
50
50
  var e, t;
@@ -65,8 +65,8 @@ class $ extends L {
65
65
  } else {
66
66
  const o = r.match(/([^0-9.,\s]+)/);
67
67
  if (o && o[1]) {
68
- const s = o[1].trim(), c = new RegExp(`\\s*${this._escapeRegex(s)}\\s*`);
69
- n = r.replace(c, "").trim();
68
+ const i = o[1].trim(), a = new RegExp(`\\s*${this._escapeRegex(i)}\\s*`);
69
+ n = r.replace(a, "").trim();
70
70
  }
71
71
  }
72
72
  return n;
@@ -83,15 +83,15 @@ class $ extends L {
83
83
  ${this._GuTwoColumns([
84
84
  this._GuLabel({ text: "Currency Location" }),
85
85
  this._GuSelect({
86
- name: i.CURRENCY_LOCATION,
86
+ name: c.CURRENCY_LOCATION,
87
87
  placeholder: "",
88
- options: p
88
+ options: u
89
89
  })
90
90
  ])}
91
91
  `;
92
92
  }
93
93
  }
94
94
  export {
95
- T as CONTROL_BLOCK_ID,
96
- $ as PriceCurrencyLocationControl
95
+ E as CONTROL_BLOCK_ID,
96
+ A as PriceCurrencyLocationControl
97
97
  };
@@ -1,14 +1,14 @@
1
- var b = Object.defineProperty;
2
- var R = (s, c, e) => c in s ? b(s, c, { enumerable: !0, configurable: !0, writable: !0, value: e }) : s[c] = e;
3
- var h = (s, c, e) => R(s, typeof c != "symbol" ? c + "" : c, e);
4
- import { ModificationDescription as N } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
5
- import { CommonControl as B } from "../../../common-control.js";
1
+ var R = Object.defineProperty;
2
+ var N = (s, c, e) => c in s ? R(s, c, { enumerable: !0, configurable: !0, writable: !0, value: e }) : s[c] = e;
3
+ var h = (s, c, e) => N(s, typeof c != "symbol" ? c + "" : c, e);
4
+ import { ModificationDescription as B } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
5
+ import { CommonControl as E } from "../../../common-control.js";
6
6
  import { ItemsBlockControlId as y } from "../../enums/controlEnums.js";
7
- import { getItemsBlockConfig as m, setItemsBlockConfig as E, escapeReplacement as x } from "../../utils/nodeConfigUtils.js";
8
- const I = y.PRICE_CURRENCY_SYMBOL, p = {
7
+ import { getItemsBlockConfig as p, setItemsBlockConfig as x, escapeReplacement as f } from "../../utils/nodeConfigUtils.js";
8
+ const I = y.PRICE_CURRENCY_SYMBOL, u = {
9
9
  CURRENCY_SYMBOL: "currencySymbol"
10
10
  };
11
- class O extends B {
11
+ class P extends E {
12
12
  constructor() {
13
13
  super(...arguments);
14
14
  h(this, "originalPriceContents", /* @__PURE__ */ new Map());
@@ -24,8 +24,8 @@ class O extends B {
24
24
  `;
25
25
  }
26
26
  onRender() {
27
- const e = m(this.currentNode);
28
- this.api.updateValues({ [p.CURRENCY_SYMBOL]: (e == null ? void 0 : e.priceCurrencySymbol) ?? "" }), this._storeOriginalContents(), this.api.onValueChanged(p.CURRENCY_SYMBOL, (t) => {
27
+ const e = p(this.currentNode);
28
+ this.api.updateValues({ [u.CURRENCY_SYMBOL]: (e == null ? void 0 : e.priceCurrencySymbol) ?? "" }), this._storeOriginalContents(), this.api.onValueChanged(u.CURRENCY_SYMBOL, (t) => {
29
29
  this._onCurrencySymbolChange(t);
30
30
  });
31
31
  }
@@ -34,42 +34,42 @@ class O extends B {
34
34
  }
35
35
  onTemplateNodeUpdated(e) {
36
36
  super.onTemplateNodeUpdated(e), this.handleBlockInstanceChange(() => {
37
- const t = m(this.currentNode);
38
- this.api.updateValues({ [p.CURRENCY_SYMBOL]: (t == null ? void 0 : t.priceCurrencySymbol) ?? "" }), this._storeOriginalContents();
37
+ const t = p(this.currentNode);
38
+ this.api.updateValues({ [u.CURRENCY_SYMBOL]: (t == null ? void 0 : t.priceCurrencySymbol) ?? "" }), this._storeOriginalContents();
39
39
  });
40
40
  }
41
41
  _onCurrencySymbolChange(e) {
42
- var i;
42
+ var a;
43
43
  console.debug("Currency symbol changed to: ", e);
44
- const t = m(this.currentNode), o = ((i = t == null ? void 0 : t.priceCurrencySymbol) == null ? void 0 : i.trim()) || "";
45
- if (E(this.currentNode, this.api, { priceCurrencySymbol: e }), !this.currentNode)
44
+ const t = p(this.currentNode), o = ((a = t == null ? void 0 : t.priceCurrencySymbol) == null ? void 0 : a.trim()) || "";
45
+ if (x(this.currentNode, this.api, { priceCurrencySymbol: e }), !this.currentNode)
46
46
  return;
47
47
  const r = this._getPriceBlocks();
48
48
  if (!r || r.length === 0)
49
49
  return;
50
- const n = (e == null ? void 0 : e.trim()) || "", l = (t == null ? void 0 : t.priceCurrencyLocation) ?? "0";
51
- r.forEach((u) => {
52
- const a = this._getParagraph(u);
53
- if (!a)
50
+ const n = (e == null ? void 0 : e.trim()) || "", l = (t == null ? void 0 : t.priceCurrencyLocation) ?? "0", i = this.api.getDocumentModifier();
51
+ r.forEach((d) => {
52
+ const m = this._getParagraph(d);
53
+ if (!m)
54
54
  return;
55
- const d = a.getInnerHTML().trim() || "", C = a.getInnerText().trim() || "", g = this._removeCurrencySymbol(C, o), _ = this._buildPriceContent(g, n, l), S = d.replace(C, x(_));
56
- this.api.getDocumentModifier().modifyHtml(a).setInnerHtml(S).apply(new N(
57
- `Updated currency symbol to ${n || "removed"}`
58
- ));
59
- });
55
+ const g = m.getInnerHTML().trim() || "", C = m.getInnerText().trim() || "", _ = this._removeCurrencySymbol(C, o), S = this._buildPriceContent(_, n, l), b = g.replace(C, f(S));
56
+ i.modifyHtml(m).setInnerHtml(b);
57
+ }), i.apply(new B(
58
+ `Updated currency symbol to ${n || "removed"}`
59
+ ));
60
60
  }
61
61
  _storeOriginalContents() {
62
62
  if (!this.currentNode)
63
63
  return;
64
- const e = m(this.currentNode);
64
+ const e = p(this.currentNode);
65
65
  this.currentNode.querySelectorAll(
66
66
  ".items-block-price"
67
67
  ).forEach((o) => {
68
68
  var n;
69
69
  const r = o.querySelector("p");
70
70
  if (r && !this.originalPriceContents.has(r)) {
71
- const l = r.getInnerText() || "", i = ((n = e == null ? void 0 : e.priceCurrencySymbol) == null ? void 0 : n.trim()) || "", u = this._removeCurrencySymbol(l, i);
72
- this.originalPriceContents.set(r, u);
71
+ const l = r.getInnerText() || "", i = ((n = e == null ? void 0 : e.priceCurrencySymbol) == null ? void 0 : n.trim()) || "", a = this._removeCurrencySymbol(l, i);
72
+ this.originalPriceContents.set(r, a);
73
73
  }
74
74
  });
75
75
  }
@@ -106,7 +106,7 @@ class O extends B {
106
106
  ${this._GuTwoColumns([
107
107
  this._GuLabel({ text: "Currency Symbol" }),
108
108
  this._GuTextInput({
109
- name: p.CURRENCY_SYMBOL,
109
+ name: u.CURRENCY_SYMBOL,
110
110
  placeholder: "Enter Currency Symbol",
111
111
  className: "es-180w"
112
112
  })
@@ -116,5 +116,5 @@ class O extends B {
116
116
  }
117
117
  export {
118
118
  I as CONTROL_BLOCK_ID,
119
- O as PriceCurrencySymbolControl
119
+ P as PriceCurrencySymbolControl
120
120
  };
@@ -1,63 +1,65 @@
1
- import { ModificationDescription as A, UIElementType as P, UEAttr as C } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
2
- import { CommonControl as L } from "../../../common-control.js";
3
- import { ItemsBlockControlId as p, ItemsBlockId as _ } from "../../enums/controlEnums.js";
1
+ import { ModificationDescription as L, UIElementType as P, UEAttr as D } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
2
+ import { CommonControl as h } from "../../../common-control.js";
3
+ import { ItemsBlockControlId as R, ItemsBlockId as _ } from "../../enums/controlEnums.js";
4
4
  import { productPairs as I } from "../../enums/productEnums.js";
5
- import { getItemsBlockConfig as d, setItemsBlockConfig as D, escapeReplacement as h } from "../../utils/nodeConfigUtils.js";
6
- const g = p.PRICE_FORMATTED_PRICE, s = {
5
+ import { getItemsBlockConfig as d, setItemsBlockConfig as u, escapeReplacement as O } from "../../utils/nodeConfigUtils.js";
6
+ const g = R.PRICE_FORMATTED_PRICE, s = {
7
7
  FORMATTED_PRICE: "formattedPrice"
8
8
  };
9
- class $ extends L {
9
+ class k extends h {
10
10
  getId() {
11
11
  return g;
12
12
  }
13
13
  getTemplate() {
14
14
  return `
15
- <div class="container ${p.PRICE_FORMATTED_PRICE}">
15
+ <div class="container ${R.PRICE_FORMATTED_PRICE}">
16
16
  ${this._getFormattedPrice()}
17
17
  </div>
18
18
  `;
19
19
  }
20
20
  onRender() {
21
- const e = d(this.currentNode);
22
- this.api.updateValues({ [s.FORMATTED_PRICE]: (e == null ? void 0 : e.priceFormatted) ?? !0 }), this.api.onValueChanged(s.FORMATTED_PRICE, (t) => {
23
- this._onFormattedPriceChange(t);
21
+ const t = d(this.currentNode);
22
+ this.api.updateValues({ [s.FORMATTED_PRICE]: (t == null ? void 0 : t.priceFormatted) ?? !0 }), this.api.onValueChanged(s.FORMATTED_PRICE, (e) => {
23
+ this._onFormattedPriceChange(e);
24
24
  });
25
25
  }
26
- onTemplateNodeUpdated(e) {
27
- super.onTemplateNodeUpdated(e), this.handleBlockInstanceChange(() => {
28
- const t = d(this.currentNode);
29
- this.api.updateValues({ [s.FORMATTED_PRICE]: (t == null ? void 0 : t.priceFormatted) ?? !0 });
26
+ onTemplateNodeUpdated(t) {
27
+ super.onTemplateNodeUpdated(t), this.handleBlockInstanceChange(() => {
28
+ const e = d(this.currentNode);
29
+ this.api.updateValues({ [s.FORMATTED_PRICE]: (e == null ? void 0 : e.priceFormatted) ?? !0 });
30
30
  });
31
31
  }
32
- _onFormattedPriceChange(e) {
33
- if (console.debug("Formatted price changed to: ", e), D(this.currentNode, this.api, { priceFormatted: e }), !this.currentNode)
32
+ _onFormattedPriceChange(t) {
33
+ if (console.debug("Formatted price changed to: ", t), u(this.currentNode, this.api, { priceFormatted: t }), !this.currentNode)
34
34
  return;
35
- const t = d(this.currentNode), n = (t == null ? void 0 : t.type) ?? "CART_ITEMS", i = (t == null ? void 0 : t.priceSinglePrice) ?? !1, r = I.PAIRS_FOR_EXTENSION.price[n], o = I.PAIRS_FOR_EXTENSION.originalPrice[n], [E, R] = e ? [
35
+ const e = d(this.currentNode), n = (e == null ? void 0 : e.type) ?? "CART_ITEMS", i = (e == null ? void 0 : e.priceSinglePrice) ?? !1, r = I.PAIRS_FOR_EXTENSION.price[n], c = I.PAIRS_FOR_EXTENSION.originalPrice[n], [p, m] = t ? [
36
36
  i ? r.DEFAULT_SINGLE_PRICE : r.DEFAULT_PRICE,
37
37
  i ? r.DEFAULT_SINGLE_PRICE_FORMATTED : r.DEFAULT_PRICE_FORMATTED
38
38
  ] : [
39
39
  i ? r.DEFAULT_SINGLE_PRICE_FORMATTED : r.DEFAULT_PRICE_FORMATTED,
40
40
  i ? r.DEFAULT_SINGLE_PRICE : r.DEFAULT_PRICE
41
- ], l = i ? o.DEFAULT_SINGLE_PRICE : o.DEFAULT_PRICE, T = i ? o.DEFAULT_SINGLE_PRICE_FORMATTED : o.DEFAULT_PRICE_FORMATTED, [m, F] = e ? [l, T] : [T, l], c = this.currentNode.closest(".items-block");
42
- ((c == null ? void 0 : c.querySelectorAll(
41
+ ], l = i ? c.DEFAULT_SINGLE_PRICE : c.DEFAULT_PRICE, T = i ? c.DEFAULT_SINGLE_PRICE_FORMATTED : c.DEFAULT_PRICE_FORMATTED, [F, A] = t ? [l, T] : [T, l], o = this.currentNode.closest(".items-block"), C = (o == null ? void 0 : o.querySelectorAll(
43
42
  `[esd-extension-block-id="${_.PRICE}"]`
44
- )) || []).forEach((a) => {
45
- this._updatePriceBlock(a, E, R, e, "price");
46
- }), ((c == null ? void 0 : c.querySelectorAll(
43
+ )) || [], E = this.api.getDocumentModifier();
44
+ C.forEach((a) => {
45
+ this._updatePriceBlock(E, a, p, m);
46
+ }), ((o == null ? void 0 : o.querySelectorAll(
47
47
  `[esd-extension-block-id="${_.ORIGINAL_PRICE}"]`
48
48
  )) || []).forEach((a) => {
49
- this._updatePriceBlock(a, m, F, e, "original price");
50
- });
49
+ this._updatePriceBlock(E, a, F, A);
50
+ }), E.apply(new L(
51
+ `Updated price to ${t ? "formatted" : "unformatted"}`
52
+ ));
51
53
  }
52
- _updatePriceBlock(e, t, n, i, r) {
53
- const o = e.getInnerHTML().trim().replace(t, h(n)), E = `Updated ${r} to ${i ? "formatted" : "unformatted"}`;
54
- this.api.getDocumentModifier().modifyHtml(e).setInnerHtml(o).apply(new A(E));
54
+ _updatePriceBlock(t, e, n, i) {
55
+ const r = e.getInnerHTML().trim().replace(n, O(i));
56
+ t.modifyHtml(e).setInnerHtml(r);
55
57
  }
56
58
  _getFormattedPrice() {
57
59
  return `
58
60
  <div class="display-flex align-items-center justify-content-between">
59
61
  <${P.LABEL}
60
- ${C.LABEL.text}="${this.api.translate("Formatted Price (e.g. $9.90)")}"
62
+ ${D.LABEL.text}="${this.api.translate("Formatted Price (e.g. $9.90)")}"
61
63
  >
62
64
  </${P.LABEL}>
63
65
  ${this._GuToggle(s.FORMATTED_PRICE)}
@@ -67,5 +69,5 @@ class $ extends L {
67
69
  }
68
70
  export {
69
71
  g as CONTROL_BLOCK_ID,
70
- $ as PriceFormattedPriceControl
72
+ k as PriceFormattedPriceControl
71
73
  };
@@ -33,7 +33,6 @@ class C extends r {
33
33
  }
34
34
  _getHideDiscount() {
35
35
  return `
36
-
37
36
  <div class="display-flex align-items-center justify-content-between">
38
37
  <${o.LABEL}
39
38
  ${d.LABEL.text}="${this.api.translate("Hide if same as discounted ")}"
@@ -1,18 +1,18 @@
1
- import { ModificationDescription as P, UIElementType as _, UEAttr as S } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
2
- import { CommonControl as m } from "../../../common-control.js";
3
- import { ItemsBlockControlId as T, ItemsBlockId as g } from "../../enums/controlEnums.js";
4
- import { productPairs as R } from "../../enums/productEnums.js";
5
- import { getItemsBlockConfig as I, setItemsBlockConfig as u, escapeReplacement as A } from "../../utils/nodeConfigUtils.js";
6
- const h = T.PRICE_SINGLE_PRICE, l = {
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 = {
7
7
  SINGLE_PRICE: "singlePrice"
8
8
  };
9
- class M extends m {
9
+ class y extends h {
10
10
  getId() {
11
- return h;
11
+ return D;
12
12
  }
13
13
  getTemplate() {
14
14
  return `
15
- <div class="container ${T.PRICE_SINGLE_PRICE}">
15
+ <div class="container ${L.PRICE_SINGLE_PRICE}">
16
16
  ${this._getSinglePrice()}
17
17
  </div>
18
18
  `;
@@ -32,34 +32,36 @@ class M extends m {
32
32
  _onSinglePriceChange(e) {
33
33
  if (console.debug("Single price changed to: ", e), u(this.currentNode, this.api, { priceSinglePrice: e }), !this.currentNode)
34
34
  return;
35
- const t = I(this.currentNode), n = (t == null ? void 0 : t.type) ?? "CART_ITEMS", r = (t == null ? void 0 : t.priceFormatted) ?? !1, i = R.PAIRS_FOR_EXTENSION.price[n], c = R.PAIRS_FOR_EXTENSION.originalPrice[n], [E, d] = e ? [
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
36
  r ? i.DEFAULT_PRICE_FORMATTED : i.DEFAULT_PRICE,
37
37
  r ? i.DEFAULT_SINGLE_PRICE_FORMATTED : i.DEFAULT_SINGLE_PRICE
38
38
  ] : [
39
39
  r ? i.DEFAULT_SINGLE_PRICE_FORMATTED : i.DEFAULT_SINGLE_PRICE,
40
40
  r ? i.DEFAULT_PRICE_FORMATTED : i.DEFAULT_PRICE
41
- ], a = r ? c.DEFAULT_PRICE_FORMATTED : c.DEFAULT_PRICE, s = r ? c.DEFAULT_SINGLE_PRICE_FORMATTED : c.DEFAULT_SINGLE_PRICE, [L, C] = e ? [a, s] : [s, a], o = this.currentNode.closest(".items-block");
42
- ((o == null ? void 0 : o.querySelectorAll(
43
- `[esd-extension-block-id="${g.PRICE}"]`
44
- )) || []).forEach((p) => {
45
- this._updatePriceBlock(p, E, d, e, "price");
46
- }), ((o == null ? void 0 : o.querySelectorAll(
47
- `[esd-extension-block-id="${g.ORIGINAL_PRICE}"]`
48
- )) || []).forEach((p) => {
49
- this._updatePriceBlock(p, L, C, e, "original price");
50
- });
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}"]`
48
+ )) || []).forEach((a) => {
49
+ this._updatePriceBlock(E, a, g, C, e);
50
+ }), E.apply(new m(
51
+ `Updated price to ${e ? "single" : "total"} price`
52
+ ));
51
53
  }
52
- _updatePriceBlock(e, t, n, r, i) {
53
- const c = e.getInnerHTML().trim().replace(t, A(n)), E = `Updated ${i} to ${r ? "single" : "total"} price`;
54
- this.api.getDocumentModifier().modifyHtml(e).setInnerHtml(c).apply(new P(E)), e.querySelectorAll('[product-attr="price"], [product-attr="originalPrice"]').forEach((s) => {
55
- this.api.getDocumentModifier().modifyHtml(s).setAttribute("data-single_price", r ? "true" : "false").apply(new P("Update single price attribute"));
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");
56
58
  });
57
59
  }
58
60
  _getSinglePrice() {
59
61
  return `
60
62
  <div class="display-flex align-items-center justify-content-between">
61
63
  <${_.LABEL}
62
- ${S.LABEL.text}="${this.api.translate("Show Single Product Price")}"
64
+ ${A.LABEL.text}="${this.api.translate("Show Single Product Price")}"
63
65
  >
64
66
  </${_.LABEL}>
65
67
  ${this._GuToggle(l.SINGLE_PRICE)}
@@ -68,6 +70,6 @@ class M extends m {
68
70
  }
69
71
  }
70
72
  export {
71
- h as CONTROL_BLOCK_ID,
72
- M as PriceSinglePriceControl
73
+ D as CONTROL_BLOCK_ID,
74
+ y as PriceSinglePriceControl
73
75
  };
@@ -22,6 +22,8 @@ class U extends O {
22
22
  new T(
23
23
  _.SETTINGS,
24
24
  [
25
+ I.ORIGINAL_PRICE_STYLE,
26
+ I.ORIGINAL_PRICE_ALIGN,
25
27
  I.PRICE_ORIENTATION,
26
28
  I.ORIGINAL_PRICE_PADDINGS
27
29
  ]
@@ -29,17 +31,17 @@ class U extends O {
29
31
  new T(
30
32
  _.STYLES,
31
33
  [
32
- I.ORIGINAL_PRICE_STYLE,
33
- I.ORIGINAL_PRICE_ALIGN,
34
- I.ORIGINAL_PRICE_COLOR,
35
34
  I.ORIGINAL_PRICE_FONT_FAMILY,
36
- I.ORIGINAL_PRICE_SIZE
35
+ I.ORIGINAL_PRICE_SIZE,
36
+ I.ORIGINAL_PRICE_COLOR
37
37
  ]
38
38
  )
39
39
  ], N[E.PRICE] = [
40
40
  new T(
41
41
  _.SETTINGS,
42
42
  [
43
+ I.PRICE_STYLE,
44
+ I.PRICE_ALIGN,
43
45
  I.PRICE_HIDE_DISCOUNT,
44
46
  I.PRICE_FORMATTED_PRICE,
45
47
  I.PRICE_SINGLE_PRICE,
@@ -51,11 +53,9 @@ class U extends O {
51
53
  new T(
52
54
  _.STYLES,
53
55
  [
54
- I.PRICE_STYLE,
55
- I.PRICE_ALIGN,
56
- I.PRICE_COLOR,
57
56
  I.PRICE_FONT_FAMILY,
58
- I.PRICE_SIZE
57
+ I.PRICE_SIZE,
58
+ I.PRICE_COLOR
59
59
  ]
60
60
  )
61
61
  ], N[E.NAME] = [
@@ -77,17 +77,12 @@ class U extends O {
77
77
  ]
78
78
  )
79
79
  ], N[E.QUANTITY] = [
80
- new T(
81
- _.SETTINGS,
82
- [
83
- I.QUANTITY_FONT_FAMILY,
84
- I.QUANTITY_STYLE
85
- ]
86
- ),
87
80
  new T(
88
81
  _.STYLES,
89
82
  [
83
+ I.QUANTITY_STYLE,
90
84
  I.QUANTITY_ALIGN,
85
+ I.QUANTITY_FONT_FAMILY,
91
86
  I.QUANTITY_SIZE,
92
87
  I.QUANTITY_COLOR,
93
88
  I.QUANTITY_PADDINGS
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@useinsider/guido",
3
- "version": "2.1.0-beta.1d0cd94",
3
+ "version": "2.1.0-beta.3394453",
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",