@useinsider/guido 2.1.0-beta.3c29284 → 2.1.0-beta.e6bf76b

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,76 +1,82 @@
1
- var R = Object.defineProperty;
2
- var _ = (i, t, e) => t in i ? R(i, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : i[t] = e;
3
- var m = (i, t, e) => _(i, typeof t != "symbol" ? t + "" : t, e);
4
- import { ModificationDescription as F, UIElementType as P, UEAttr as C } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
1
+ var C = Object.defineProperty;
2
+ var A = (n, r, e) => r in n ? C(n, r, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[r] = e;
3
+ var _ = (n, r, e) => A(n, typeof r != "symbol" ? r + "" : r, e);
4
+ import { ModificationDescription as L, UIElementType as m, UEAttr as g } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
5
5
  import { CommonControl as h } from "../../../common-control.js";
6
- import { ItemsBlockControlId as p, ItemsBlockId as g } from "../../enums/controlEnums.js";
7
- import { productPairs as T } from "../../enums/productEnums.js";
8
- import { useItemsBlockStore as A } from "../../store/items-block.js";
9
- import { getItemsBlockConfig as f, setItemsBlockConfig as u } from "../../utils/nodeConfigUtils.js";
10
- const D = p.PRICE_FORMATTED_PRICE, n = {
6
+ import { ItemsBlockControlId as l, ItemsBlockId as D } from "../../enums/controlEnums.js";
7
+ import { productPairs as I } from "../../enums/productEnums.js";
8
+ import { useItemsBlockStore as O } from "../../store/items-block.js";
9
+ import { getItemsBlockConfig as u, setItemsBlockConfig as f } from "../../utils/nodeConfigUtils.js";
10
+ const N = l.PRICE_FORMATTED_PRICE, c = {
11
11
  FORMATTED_PRICE: "formattedPrice"
12
12
  };
13
- class k extends h {
13
+ class y extends h {
14
14
  constructor() {
15
15
  super(...arguments);
16
- m(this, "store", A());
16
+ _(this, "store", O());
17
17
  }
18
18
  getId() {
19
- return D;
19
+ return N;
20
20
  }
21
21
  getTemplate() {
22
22
  return `
23
- <div class="container ${p.PRICE_FORMATTED_PRICE}">
23
+ <div class="container ${l.PRICE_FORMATTED_PRICE}">
24
24
  ${this._getFormattedPrice()}
25
25
  </div>
26
26
  `;
27
27
  }
28
28
  onRender() {
29
- this.api.updateValues({ [n.FORMATTED_PRICE]: this.store.formattedPrice }), this.api.onValueChanged(n.FORMATTED_PRICE, (e) => {
29
+ this.api.updateValues({ [c.FORMATTED_PRICE]: this.store.formattedPrice }), this.api.onValueChanged(c.FORMATTED_PRICE, (e) => {
30
30
  this._onFormattedPriceChange(e);
31
31
  });
32
32
  }
33
33
  onTemplateNodeUpdated(e) {
34
34
  super.onTemplateNodeUpdated(e), this.handleBlockInstanceChange(
35
35
  () => {
36
- const r = f(this.currentNode);
37
- r && this.store.setFormattedPrice(r.priceFormatted ?? !0);
36
+ const o = u(this.currentNode);
37
+ o && this.store.setFormattedPrice(o.priceFormatted ?? !0);
38
38
  },
39
39
  () => {
40
- this.api.updateValues({ [n.FORMATTED_PRICE]: this.store.formattedPrice });
40
+ this.api.updateValues({ [c.FORMATTED_PRICE]: this.store.formattedPrice });
41
41
  }
42
42
  );
43
43
  }
44
44
  _onFormattedPriceChange(e) {
45
- if (console.debug("Formatted price changed to: ", e), this.store.setFormattedPrice(e), u(this.currentNode, this.api, { priceFormatted: e }), !this.currentNode)
45
+ if (console.debug("Formatted price changed to: ", e), this.store.setFormattedPrice(e), f(this.currentNode, this.api, { priceFormatted: e }), !this.currentNode)
46
46
  return;
47
- const { itemsType: r } = this.store, o = T.PAIRS_FOR_EXTENSION.price[r], s = T.PAIRS_FOR_EXTENSION.originalPrice[r], [c, a] = e ? [o.DEFAULT_PRICE, o.DEFAULT_PRICE_FORMATTED] : [o.DEFAULT_PRICE_FORMATTED, o.DEFAULT_PRICE], [l, I] = e ? [s.DEFAULT_PRICE, s.DEFAULT_PRICE_FORMATTED] : [s.DEFAULT_PRICE_FORMATTED, s.DEFAULT_PRICE];
47
+ const { itemsType: o, singlePrice: i } = this.store, t = I.PAIRS_FOR_EXTENSION.price[o], s = I.PAIRS_FOR_EXTENSION.originalPrice[o], [E, R] = e ? [
48
+ i ? t.DEFAULT_SINGLE_PRICE : t.DEFAULT_PRICE,
49
+ i ? t.DEFAULT_SINGLE_PRICE_FORMATTED : t.DEFAULT_PRICE_FORMATTED
50
+ ] : [
51
+ i ? t.DEFAULT_SINGLE_PRICE_FORMATTED : t.DEFAULT_PRICE_FORMATTED,
52
+ i ? t.DEFAULT_SINGLE_PRICE : t.DEFAULT_PRICE
53
+ ], d = i ? s.DEFAULT_SINGLE_PRICE : s.DEFAULT_PRICE, P = i ? s.DEFAULT_SINGLE_PRICE_FORMATTED : s.DEFAULT_PRICE_FORMATTED, [p, F] = e ? [d, P] : [P, d];
48
54
  this._updatePriceBlock(
49
55
  this.currentNode,
50
- c,
51
- a,
56
+ E,
57
+ R,
52
58
  "price"
53
59
  );
54
- const d = this.currentNode.closest(".items-block"), E = d == null ? void 0 : d.querySelector(`[esd-extension-block-id="${g.ORIGINAL_PRICE}"]`);
55
- E && this._updatePriceBlock(E, l, I, "original price");
60
+ const a = this.currentNode.closest(".items-block"), T = a == null ? void 0 : a.querySelector(`[esd-extension-block-id="${D.ORIGINAL_PRICE}"]`);
61
+ T && this._updatePriceBlock(T, p, F, "original price");
56
62
  }
57
- _updatePriceBlock(e, r, o, s) {
58
- const c = e.getInnerHTML().replace(r, o), a = `Updated ${s} to ${this.store.formattedPrice ? "formatted" : "unformatted"}`;
59
- this.api.getDocumentModifier().modifyHtml(e).setInnerHtml(c).apply(new F(a));
63
+ _updatePriceBlock(e, o, i, t) {
64
+ const s = e.getInnerHTML().replace(o, i), E = `Updated ${t} to ${this.store.formattedPrice ? "formatted" : "unformatted"}`;
65
+ this.api.getDocumentModifier().modifyHtml(e).setInnerHtml(s).apply(new L(E));
60
66
  }
61
67
  _getFormattedPrice() {
62
68
  return `
63
69
  <div class="display-flex align-items-center justify-content-between">
64
- <${P.LABEL}
65
- ${C.LABEL.text}="${this.api.translate("Formatted Price (e.g. $9.90)")}"
70
+ <${m.LABEL}
71
+ ${g.LABEL.text}="${this.api.translate("Formatted Price (e.g. $9.90)")}"
66
72
  >
67
- </${P.LABEL}>
68
- ${this._GuToggle(n.FORMATTED_PRICE)}
73
+ </${m.LABEL}>
74
+ ${this._GuToggle(c.FORMATTED_PRICE)}
69
75
  </div>
70
76
  `;
71
77
  }
72
78
  }
73
79
  export {
74
- D as CONTROL_BLOCK_ID,
75
- k as PriceFormattedPriceControl
80
+ N as CONTROL_BLOCK_ID,
81
+ y as PriceFormattedPriceControl
76
82
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@useinsider/guido",
3
- "version": "2.1.0-beta.3c29284",
3
+ "version": "2.1.0-beta.e6bf76b",
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",