@useinsider/guido 2.0.0-beta.13ba613 → 2.0.0-beta.1ba7e26

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,32 +1,32 @@
1
1
  var r = Object.defineProperty;
2
- var a = (o, e, t) => e in o ? r(o, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[e] = t;
3
- var s = (o, e, t) => a(o, typeof e != "symbol" ? e + "" : e, t);
2
+ var a = (n, e, t) => e in n ? r(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
3
+ var i = (n, e, t) => a(n, typeof e != "symbol" ? e + "" : e, t);
4
4
  import { CommonControl as u } from "../../../common-control.js";
5
5
  import { ItemsBlockControlId as d } from "../../enums/controlEnums.js";
6
6
  import { useItemsBlockStore as l } from "../../store/items-block.js";
7
7
  import { syncButtonLinkFromAttributes as h } from "../../utils/syncAttributesFromConfigBlock.js";
8
8
  import { updateConfigBlockAttributes as m } from "../../utils/updateAttributes.js";
9
- const i = d.BUTTON_LINK, n = {
9
+ const s = d.BUTTON_LINK, o = {
10
10
  LINK: "link"
11
11
  };
12
12
  class C extends u {
13
13
  constructor() {
14
14
  super(...arguments);
15
- s(this, "store", l());
15
+ i(this, "store", l());
16
16
  }
17
17
  getId() {
18
- return i;
18
+ return s;
19
19
  }
20
20
  getTemplate() {
21
21
  return `
22
- <div class="${i}">
22
+ <div class="container ${s}">
23
23
  ${this._getLink()}
24
24
  </div>
25
25
  `;
26
26
  }
27
27
  onRender() {
28
28
  this.api.updateValues({
29
- [n.LINK]: this.store.buttonLink
29
+ [o.LINK]: this.store.buttonLink
30
30
  }), this._listenToFormUpdates();
31
31
  }
32
32
  onTemplateNodeUpdated(t) {
@@ -34,14 +34,14 @@ class C extends u {
34
34
  () => h(this.currentNode),
35
35
  () => {
36
36
  this.api.updateValues({
37
- [n.LINK]: this.store.buttonLink
37
+ [o.LINK]: this.store.buttonLink
38
38
  });
39
39
  }
40
40
  );
41
41
  }
42
42
  _listenToFormUpdates() {
43
43
  this.api.onValueChanged(
44
- n.LINK,
44
+ o.LINK,
45
45
  (t) => this._onLinkChange(t)
46
46
  );
47
47
  }
@@ -53,7 +53,7 @@ class C extends u {
53
53
  ${this._GuOneColumn([
54
54
  this._GuLabel({ text: "Link" }),
55
55
  this._GuTextInput({
56
- name: n.LINK,
56
+ name: o.LINK,
57
57
  placeholder: "Enter Link",
58
58
  className: "es-100",
59
59
  disabled: !0
@@ -64,5 +64,5 @@ class C extends u {
64
64
  }
65
65
  export {
66
66
  C as ButtonLinkControl,
67
- i as CONTROL_BLOCK_ID
67
+ s as CONTROL_BLOCK_ID
68
68
  };
@@ -1,12 +1,12 @@
1
1
  var r = Object.defineProperty;
2
- var a = (o, t, e) => t in o ? r(o, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : o[t] = e;
3
- var i = (o, t, e) => a(o, typeof t != "symbol" ? t + "" : t, e);
2
+ var a = (n, t, e) => t in n ? r(n, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[t] = e;
3
+ var i = (n, t, e) => a(n, typeof t != "symbol" ? t + "" : t, e);
4
4
  import { CommonControl as m } from "../../../common-control.js";
5
5
  import { ItemsBlockControlId as d } from "../../enums/controlEnums.js";
6
6
  import { useItemsBlockStore as l } from "../../store/items-block.js";
7
7
  import { syncImageLinkFromAttributes as h } from "../../utils/syncAttributesFromConfigBlock.js";
8
8
  import { updateConfigBlockAttributes as p } from "../../utils/updateAttributes.js";
9
- const s = d.IMAGE_LINK, n = {
9
+ const s = d.IMAGE_LINK, o = {
10
10
  LINK: "link"
11
11
  };
12
12
  class N extends m {
@@ -19,14 +19,14 @@ class N extends m {
19
19
  }
20
20
  getTemplate() {
21
21
  return `
22
- <div class="${s}">
22
+ <div class="container ${s}">
23
23
  ${this._getLink()}
24
24
  </div>
25
25
  `;
26
26
  }
27
27
  onRender() {
28
28
  this.api.updateValues({
29
- [n.LINK]: this.store.imageLink
29
+ [o.LINK]: this.store.imageLink
30
30
  }), this._listenToFormUpdates();
31
31
  }
32
32
  onTemplateNodeUpdated(e) {
@@ -34,14 +34,14 @@ class N extends m {
34
34
  () => h(this.currentNode),
35
35
  () => {
36
36
  this.api.updateValues({
37
- [n.LINK]: this.store.imageLink
37
+ [o.LINK]: this.store.imageLink
38
38
  });
39
39
  }
40
40
  );
41
41
  }
42
42
  _listenToFormUpdates() {
43
43
  this.api.onValueChanged(
44
- n.LINK,
44
+ o.LINK,
45
45
  (e) => this._onLinkChange(e)
46
46
  );
47
47
  }
@@ -53,7 +53,7 @@ class N extends m {
53
53
  ${this._GuOneColumn([
54
54
  this._GuLabel({ text: "Link" }),
55
55
  this._GuTextInput({
56
- name: n.LINK,
56
+ name: o.LINK,
57
57
  placeholder: "Enter Link",
58
58
  className: "es-100",
59
59
  disabled: !0
@@ -1,6 +1,6 @@
1
1
  var d = Object.defineProperty;
2
2
  var h = (i, t, e) => t in i ? d(i, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : i[t] = e;
3
- var n = (i, t, e) => h(i, typeof t != "symbol" ? t + "" : t, e);
3
+ var s = (i, t, e) => h(i, typeof t != "symbol" ? t + "" : t, e);
4
4
  import { ModificationDescription as a, UIElementType as l, UEAttr as g } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
5
5
  import { CommonControl as c } from "../../../common-control.js";
6
6
  import { ItemsBlockControlId as p } from "../../enums/controlEnums.js";
@@ -11,17 +11,17 @@ import { updateConfigBlockAttributes as u } from "../../utils/updateAttributes.j
11
11
  const y = p.NAME_TRIMMING, o = {
12
12
  TRIMMING: "trimming"
13
13
  };
14
- class _ extends c {
14
+ class v extends c {
15
15
  constructor() {
16
16
  super(...arguments);
17
- n(this, "store", N());
17
+ s(this, "store", N());
18
18
  }
19
19
  getId() {
20
20
  return y;
21
21
  }
22
22
  getTemplate() {
23
23
  return `
24
- <div class="${p.NAME_TRIMMING}">
24
+ <div class="container ${p.NAME_TRIMMING}">
25
25
  ${this._getTextTrimming()}
26
26
  </div>
27
27
  `;
@@ -43,8 +43,8 @@ class _ extends c {
43
43
  this.store.setNameTrimming(e), u(this.currentNode, this.api), this.api.updateValues({ [o.TRIMMING]: e }), this._applyTrimmingStyles(e);
44
44
  }
45
45
  _applyTrimmingStyles(e) {
46
- var s;
47
- const r = (s = this.currentNode) == null ? void 0 : s.querySelector("p > a");
46
+ var n;
47
+ const r = (n = this.currentNode) == null ? void 0 : n.querySelector("p > a");
48
48
  if (!r)
49
49
  return;
50
50
  const T = e !== void 0 ? e : this.store.nameTrimming, m = this.store.orientation === I.ORIENTATION.VERTICAL;
@@ -52,19 +52,17 @@ class _ extends c {
52
52
  }
53
53
  _getTextTrimming() {
54
54
  return `
55
- <div class="container">
56
- <div class="display-flex align-items-center justify-content-between">
57
- <${l.LABEL}
58
- ${g.LABEL.text}="${this.api.translate("Text Trimming")}"
59
- >
60
- </${l.LABEL}>
61
- ${this._GuToggle(o.TRIMMING)}
62
- </div>
55
+ <div class="display-flex align-items-center justify-content-between">
56
+ <${l.LABEL}
57
+ ${g.LABEL.text}="${this.api.translate("Text Trimming")}"
58
+ >
59
+ </${l.LABEL}>
60
+ ${this._GuToggle(o.TRIMMING)}
63
61
  </div>
64
62
  `;
65
63
  }
66
64
  }
67
65
  export {
68
66
  y as CONTROL_BLOCK_ID,
69
- _ as NameTrimmingControl
67
+ v as NameTrimmingControl
70
68
  };
@@ -21,7 +21,7 @@ class Y extends T {
21
21
  }
22
22
  getTemplate() {
23
23
  return `
24
- <div class="${h.PRICE_CURRENCY_LOCATION}">
24
+ <div class="container ${h.PRICE_CURRENCY_LOCATION}">
25
25
  ${this._getCurrencyLocation()}
26
26
  </div>
27
27
  `;
@@ -21,7 +21,7 @@ class P extends R {
21
21
  }
22
22
  getTemplate() {
23
23
  return `
24
- <div class="${h.PRICE_CURRENCY_SYMBOL}">
24
+ <div class="container ${h.PRICE_CURRENCY_SYMBOL}">
25
25
  ${this._getCurrencySymbol()}
26
26
  </div>
27
27
  `;
@@ -3,12 +3,12 @@ var I = (r, e, t) => e in r ? _(r, e, { enumerable: !0, configurable: !0, writab
3
3
  var P = (r, e, t) => I(r, typeof e != "symbol" ? e + "" : e, t);
4
4
  import { ModificationDescription as F, UIElementType as m, UEAttr as C } 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 l, ItemsBlockId as A } from "../../enums/controlEnums.js";
6
+ import { ItemsBlockControlId as p, ItemsBlockId as A } from "../../enums/controlEnums.js";
7
7
  import { productPairs as T } from "../../enums/productEnums.js";
8
8
  import { useItemsBlockStore as u } from "../../store/items-block.js";
9
9
  import { syncFormattedPriceFromAttributes as g } from "../../utils/syncAttributesFromConfigBlock.js";
10
10
  import { updateConfigBlockAttributes as D } from "../../utils/updateAttributes.js";
11
- const f = l.PRICE_FORMATTED_PRICE, n = {
11
+ const f = p.PRICE_FORMATTED_PRICE, s = {
12
12
  FORMATTED_PRICE: "formattedPrice"
13
13
  };
14
14
  class y extends h {
@@ -21,13 +21,13 @@ class y extends h {
21
21
  }
22
22
  getTemplate() {
23
23
  return `
24
- <div class="${l.PRICE_FORMATTED_PRICE}">
24
+ <div class="container ${p.PRICE_FORMATTED_PRICE}">
25
25
  ${this._getFormattedPrice()}
26
26
  </div>
27
27
  `;
28
28
  }
29
29
  onRender() {
30
- this.api.updateValues({ [n.FORMATTED_PRICE]: this.store.formattedPrice }), this.api.onValueChanged(n.FORMATTED_PRICE, (t) => {
30
+ this.api.updateValues({ [s.FORMATTED_PRICE]: this.store.formattedPrice }), this.api.onValueChanged(s.FORMATTED_PRICE, (t) => {
31
31
  this._onFormattedPriceChange(t);
32
32
  });
33
33
  }
@@ -35,14 +35,14 @@ class y extends h {
35
35
  super.onTemplateNodeUpdated(t), this.handleBlockInstanceChange(
36
36
  () => g(this.currentNode),
37
37
  () => {
38
- this.api.updateValues({ [n.FORMATTED_PRICE]: this.store.formattedPrice });
38
+ this.api.updateValues({ [s.FORMATTED_PRICE]: this.store.formattedPrice });
39
39
  }
40
40
  );
41
41
  }
42
42
  _onFormattedPriceChange(t) {
43
43
  if (console.debug("Formatted price changed to: ", t), this.store.setFormattedPrice(t), D(this.currentNode, this.api), !this.currentNode)
44
44
  return;
45
- const { itemsType: s } = this.store, i = T.PAIRS_FOR_EXTENSION.price[s], o = T.PAIRS_FOR_EXTENSION.originalPrice[s], [c, a] = t ? [i.DEFAULT_PRICE, i.DEFAULT_PRICE_FORMATTED] : [i.DEFAULT_PRICE_FORMATTED, i.DEFAULT_PRICE], [p, R] = t ? [o.DEFAULT_PRICE, o.DEFAULT_PRICE_FORMATTED] : [o.DEFAULT_PRICE_FORMATTED, o.DEFAULT_PRICE];
45
+ const { itemsType: n } = this.store, i = T.PAIRS_FOR_EXTENSION.price[n], o = T.PAIRS_FOR_EXTENSION.originalPrice[n], [c, a] = t ? [i.DEFAULT_PRICE, i.DEFAULT_PRICE_FORMATTED] : [i.DEFAULT_PRICE_FORMATTED, i.DEFAULT_PRICE], [l, R] = t ? [o.DEFAULT_PRICE, o.DEFAULT_PRICE_FORMATTED] : [o.DEFAULT_PRICE_FORMATTED, o.DEFAULT_PRICE];
46
46
  this._updatePriceBlock(
47
47
  this.currentNode,
48
48
  c,
@@ -50,22 +50,20 @@ class y extends h {
50
50
  "price"
51
51
  );
52
52
  const d = this.currentNode.closest(".items-block"), E = d == null ? void 0 : d.querySelector(`[esd-extension-block-id="${A.ORIGINAL_PRICE}"]`);
53
- E && this._updatePriceBlock(E, p, R, "original price");
53
+ E && this._updatePriceBlock(E, l, R, "original price");
54
54
  }
55
- _updatePriceBlock(t, s, i, o) {
56
- const c = t.getInnerHTML().replace(s, i), a = `Updated ${o} to ${this.store.formattedPrice ? "formatted" : "unformatted"}`;
55
+ _updatePriceBlock(t, n, i, o) {
56
+ const c = t.getInnerHTML().replace(n, i), a = `Updated ${o} to ${this.store.formattedPrice ? "formatted" : "unformatted"}`;
57
57
  this.api.getDocumentModifier().modifyHtml(t).setInnerHtml(c).apply(new F(a));
58
58
  }
59
59
  _getFormattedPrice() {
60
60
  return `
61
- <div class="container">
62
- <div class="display-flex align-items-center justify-content-between">
63
- <${m.LABEL}
64
- ${C.LABEL.text}="${this.api.translate("Formatted Price (e.g. $9.90)")}"
65
- >
66
- </${m.LABEL}>
67
- ${this._GuToggle(n.FORMATTED_PRICE)}
68
- </div>
61
+ <div class="display-flex align-items-center justify-content-between">
62
+ <${m.LABEL}
63
+ ${C.LABEL.text}="${this.api.translate("Formatted Price (e.g. $9.90)")}"
64
+ >
65
+ </${m.LABEL}>
66
+ ${this._GuToggle(s.FORMATTED_PRICE)}
69
67
  </div>
70
68
  `;
71
69
  }
@@ -1,32 +1,32 @@
1
1
  var d = Object.defineProperty;
2
2
  var a = (i, e, t) => e in i ? d(i, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[e] = t;
3
- var o = (i, e, t) => a(i, typeof e != "symbol" ? e + "" : e, t);
4
- import { UIElementType as n, UEAttr as c } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
5
- import { CommonControl as u } from "../../../common-control.js";
3
+ var s = (i, e, t) => a(i, typeof e != "symbol" ? e + "" : e, t);
4
+ import { UIElementType as n, UEAttr as u } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
5
+ import { CommonControl as c } from "../../../common-control.js";
6
6
  import { ItemsBlockControlId as r } from "../../enums/controlEnums.js";
7
7
  import { useItemsBlockStore as D } from "../../store/items-block.js";
8
8
  import { syncHideDiscountFromAttributes as p } from "../../utils/syncAttributesFromConfigBlock.js";
9
9
  import { updateConfigBlockAttributes as I } from "../../utils/updateAttributes.js";
10
- const l = r.PRICE_HIDE_DISCOUNT, s = {
10
+ const h = r.PRICE_HIDE_DISCOUNT, o = {
11
11
  HIDE_DISCOUNT: "hideDiscount"
12
12
  };
13
- class N extends u {
13
+ class N extends c {
14
14
  constructor() {
15
15
  super(...arguments);
16
- o(this, "store", D());
16
+ s(this, "store", D());
17
17
  }
18
18
  getId() {
19
- return l;
19
+ return h;
20
20
  }
21
21
  getTemplate() {
22
22
  return `
23
- <div class="${r.PRICE_HIDE_DISCOUNT}">
23
+ <div class="container ${r.PRICE_HIDE_DISCOUNT}">
24
24
  ${this._getHideDiscount()}
25
25
  </div>
26
26
  `;
27
27
  }
28
28
  onRender() {
29
- this.api.updateValues({ [s.HIDE_DISCOUNT]: this.store.hideDiscount }), this.api.onValueChanged(s.HIDE_DISCOUNT, (t) => {
29
+ this.api.updateValues({ [o.HIDE_DISCOUNT]: this.store.hideDiscount }), this.api.onValueChanged(o.HIDE_DISCOUNT, (t) => {
30
30
  this._onHideDiscountChange(t);
31
31
  });
32
32
  }
@@ -34,28 +34,28 @@ class N extends u {
34
34
  super.onTemplateNodeUpdated(t), this.handleBlockInstanceChange(
35
35
  () => p(this.currentNode),
36
36
  () => {
37
- this.api.updateValues({ [s.HIDE_DISCOUNT]: this.store.hideDiscount });
37
+ this.api.updateValues({ [o.HIDE_DISCOUNT]: this.store.hideDiscount });
38
38
  }
39
39
  );
40
40
  }
41
41
  _onHideDiscountChange(t) {
42
- this.store.setHideDiscount(t), I(this.currentNode, this.api), this.api.updateValues({ [s.HIDE_DISCOUNT]: t });
42
+ this.store.setHideDiscount(t), I(this.currentNode, this.api), this.api.updateValues({ [o.HIDE_DISCOUNT]: t });
43
43
  }
44
44
  _getHideDiscount() {
45
45
  return `
46
- <div class="container">
46
+
47
47
  <div class="display-flex align-items-center justify-content-between">
48
48
  <${n.LABEL}
49
- ${c.LABEL.text}="${this.api.translate("Hide if same as discounted ")}"
49
+ ${u.LABEL.text}="${this.api.translate("Hide if same as discounted ")}"
50
50
  >
51
51
  </${n.LABEL}>
52
- ${this._GuToggle(s.HIDE_DISCOUNT)}
52
+ ${this._GuToggle(o.HIDE_DISCOUNT)}
53
53
  </div>
54
54
  </div>
55
55
  `;
56
56
  }
57
57
  }
58
58
  export {
59
- l as CONTROL_BLOCK_ID,
59
+ h as CONTROL_BLOCK_ID,
60
60
  N as PriceHideDiscountControl
61
61
  };
@@ -23,7 +23,7 @@ class H extends y {
23
23
  }
24
24
  getTemplate() {
25
25
  return `
26
- <div class="${O.PRICE_ORIENTATION}">
26
+ <div class="container ${O.PRICE_ORIENTATION}">
27
27
  ${this._getPriceOrientation()}
28
28
  </div>
29
29
  `;
@@ -1,45 +1,51 @@
1
- import { BlockType as $, BlockAttr as R } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
2
- import { ItemsBlockId as b } from "./enums/controlEnums.js";
3
- import { productPairs as c, templateFirstLine as v } from "./enums/productEnums.js";
4
- import { ItemInCartOptions as X, SETTINGS_ENUMS as y, DefaultConfigValues as P } from "./enums/settingsEnums.js";
5
- import K from "./layouts/horizontal.html.js";
6
- import z from "./layouts/vertical.html.js";
7
- let [N] = c.PAIRS_FOR_EXTENSION.imageSrc.CART_ITEMS.DEFAULT, [A] = c.PAIRS_FOR_EXTENSION.name.CART_ITEMS.DEFAULT, [f] = c.PAIRS_FOR_EXTENSION.price.CART_ITEMS.DEFAULT_PRICE_FORMATTED, [k] = c.PAIRS_FOR_EXTENSION.originalPrice.CART_ITEMS.DEFAULT_PRICE_FORMATTED, [m] = c.PAIRS_FOR_EXTENSION.quantity.CART_ITEMS.DEFAULT;
8
- const S = (e) => e.split(";").map((t) => t.trim()).filter((t) => !t.toLowerCase().startsWith("text-align")).join("; ").replace(/;\s*$/, ""), G = (e, t, n) => {
9
- const a = n || P.productImageWidth;
1
+ import { BlockType as u, BlockAttr as R } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
2
+ import { ItemsBlockId as O } from "./enums/controlEnums.js";
3
+ import { productPairs as d, templateFirstLine as z } from "./enums/productEnums.js";
4
+ import { ItemInCartOptions as K, SETTINGS_ENUMS as g, DefaultConfigValues as m } from "./enums/settingsEnums.js";
5
+ import G from "./layouts/horizontal.html.js";
6
+ import Q from "./layouts/vertical.html.js";
7
+ let [k] = d.PAIRS_FOR_EXTENSION.imageSrc.CART_ITEMS.DEFAULT, [A] = d.PAIRS_FOR_EXTENSION.name.CART_ITEMS.DEFAULT, [f] = d.PAIRS_FOR_EXTENSION.price.CART_ITEMS.DEFAULT_PRICE_FORMATTED, [y] = d.PAIRS_FOR_EXTENSION.originalPrice.CART_ITEMS.DEFAULT_PRICE_FORMATTED, [P] = d.PAIRS_FOR_EXTENSION.quantity.CART_ITEMS.DEFAULT;
8
+ const V = (t, e) => t.split(";").map((n) => n.trim()).filter((n) => !n.toLowerCase().startsWith(e.toLowerCase())).join("; ").replace(/;\s*$/, ""), x = (t) => V(t, "text-align"), S = (t, e) => {
9
+ const n = new RegExp(`${e}\\s*:\\s*([^;]+)`, "i"), a = t.match(n);
10
+ return a ? a[1].trim() : null;
11
+ }, N = (t, e, n) => new RegExp(`(${e}\\s*:\\s*)[^;]+`, "gi").test(t) ? t.replace(
12
+ new RegExp(`(${e}\\s*:\\s*)[^;]+`, "gi"),
13
+ `$1${n}`
14
+ ) : t, W = (t, e, n) => {
15
+ const a = n || m.productImageWidth;
10
16
  return `
11
17
  <td class="esd-block-image document-node-component default-block-component selectable ng-star-inserted"
12
18
  align="center"
13
19
  esd-extension-block-id="items-block-image"
14
20
  data-slot-1=""
15
21
  product-attr="imageSrc"
16
- data-type="${e}"
17
- data-number="${t}"
22
+ data-type="${t}"
23
+ data-number="${e}"
18
24
  style="font-size: 0px;">
19
25
  <a class="document-node-component ng-star-inserted"
20
26
  target="_blank"
21
27
  href="#!">
22
28
  <img class="adapt-img document-node-component ng-star-inserted"
23
- src="${N}"
29
+ src="${k}"
24
30
  alt="${A}"
25
31
  width="${a}">
26
32
  </a>
27
33
  </td>
28
34
  `;
29
- }, Q = (e, t) => `
30
- <${$.BLOCK_IMAGE}
31
- ${R.BLOCK_IMAGE.src}="${N}"
35
+ }, q = (t, e) => `
36
+ <${u.BLOCK_IMAGE}
37
+ ${R.BLOCK_IMAGE.src}="${k}"
32
38
  ${R.BLOCK_IMAGE.alt}="${A}"
33
39
  ${R.BLOCK_IMAGE.href}="#!"
34
- ${R.BLOCK_IMAGE.width}="${P.productImageWidth}"
35
- ${R.BLOCK_IMAGE.height}="${P.productImageWidth}"
36
- esd-extension-block-id="${b.IMAGE}"
40
+ ${R.BLOCK_IMAGE.width}="${m.productImageWidth}"
41
+ ${R.BLOCK_IMAGE.height}="${m.productImageWidth}"
42
+ esd-extension-block-id="${O.IMAGE}"
37
43
  data-slot-1
38
44
  product-attr="imageSrc"
39
- data-type="${e}"
40
- data-number="${t}"
45
+ data-type="${t}"
46
+ data-number="${e}"
41
47
  />
42
- `, W = (e, t, n, a) => {
48
+ `, j = (t, e, n, a) => {
43
49
  const l = `
44
50
  text-decoration:none;
45
51
  font-size: inherit;
@@ -50,37 +56,45 @@ const S = (e) => e.split(";").map((t) => t.trim()).filter((t) => !t.toLowerCase(
50
56
  display: block;
51
57
  word-wrap:break-word;
52
58
  white-space: nowrap;
53
- width: ${n === y.ORIENTATION.HORIZONTAL ? "130px" : "520px"};
59
+ width: ${n === g.ORIENTATION.HORIZONTAL ? "130px" : "520px"};
54
60
  overflow: hidden;
55
61
  text-overflow: ellipsis;
56
- `, o = a || l;
57
- return t ? `
62
+ `;
63
+ if (e) {
64
+ const o = x(a || l), c = S(o, "color"), s = S(o, "font-size"), p = [
65
+ c ? `color: ${c}` : "",
66
+ s ? `font-size: ${s}` : ""
67
+ ].filter(Boolean).join("; "), i = N(
68
+ N(o, "color", "inherit"),
69
+ "font-size",
70
+ "inherit"
71
+ );
72
+ return `
58
73
  <td class="esd-block-text es-p10"
59
74
  align="center"
60
75
  width="100%"
61
- data-type="${e}"
62
- esd-extension-block-id="${b.NAME}"
76
+ data-type="${t}"
77
+ esd-extension-block-id="${O.NAME}"
63
78
  style="display: table-cell;">
64
- <div id="renderedContent" class="service-element text-block-input-area text-block-preview-area"
65
- style="outline: none;" contenteditable="">
66
- <p contenteditable="false" path="1">
67
- <a
68
- href="#!"
69
- style="${o}"
70
- product-attr="name"
71
- data-slot-2
72
- width="100%">
73
- ${A}
74
- </a>
75
- </p>
76
- </div>
79
+ <p contenteditable="false" path="1"${p ? ` style="${p}"` : ""}>
80
+ <a
81
+ href="#!"
82
+ style="${i}"
83
+ product-attr="name"
84
+ data-slot-2
85
+ width="100%">
86
+ ${A}
87
+ </a>
88
+ </p>
77
89
  </td>
78
- ` : `<${$.BLOCK_TEXT}
90
+ `;
91
+ }
92
+ return `<${u.BLOCK_TEXT}
79
93
  width="100%"
80
94
  align="center"
81
95
  class="es-p10"
82
- data-type="${e}"
83
- esd-extension-block-id="${b.NAME}"
96
+ data-type="${t}"
97
+ esd-extension-block-id="${O.NAME}"
84
98
  >
85
99
  <p contenteditable="false">
86
100
  <a
@@ -105,17 +119,17 @@ const S = (e) => e.split(";").map((t) => t.trim()).filter((t) => !t.toLowerCase(
105
119
  ${A}
106
120
  </a>
107
121
  </p>
108
- </${$.BLOCK_TEXT}>
122
+ </${u.BLOCK_TEXT}>
109
123
  `;
110
- }, q = (e, t, n, a, r, l, o) => {
111
- let d = f;
124
+ }, H = (t, e, n, a, r, l, o) => {
125
+ let c = f;
112
126
  if (a && a.trim()) {
113
- const u = `&nbsp;${a.trim()}&nbsp;`;
114
- d = (r || "0") === "1" ? `${f}${u}` : `${u}${f}`;
127
+ const E = `&nbsp;${a.trim()}&nbsp;`;
128
+ c = (r || "0") === "1" ? `${f}${E}` : `${E}${f}`;
115
129
  }
116
- const s = r === "1" ? "after" : "before", T = `data-formated="${n ? "true" : "false"}"`, i = `data-curency="${s}"`, E = a ? `data-currency_symbol="${a}"` : "";
130
+ const s = r === "1" ? "after" : "before", p = `data-formated="${n ? "true" : "false"}"`, i = `data-curency="${s}"`, T = a ? `data-currency_symbol="${a}"` : "";
117
131
  if (l) {
118
- const p = S(o || "color: #060606; white-space: nowrap; font-size: 20px;");
132
+ const $ = x(o || "color: #060606; white-space: nowrap; font-size: 20px;");
119
133
  return `
120
134
  <td class="esd-block-text items-block-price"
121
135
  align="center"
@@ -124,19 +138,19 @@ const S = (e) => e.split(";").map((t) => t.trim()).filter((t) => !t.toLowerCase(
124
138
  <p product-attr="price"
125
139
  contenteditable="false"
126
140
  data-slot-4
127
- data-type="${e}"
128
- data-number="${t}"
129
- ${T}
141
+ data-type="${t}"
142
+ data-number="${e}"
143
+ ${p}
130
144
  ${i}
131
- ${E}
132
- style="${p}">
133
- ${d}
145
+ ${T}
146
+ style="${$}">
147
+ ${c}
134
148
  </p>
135
149
  </td>`;
136
150
  }
137
151
  return `
138
- <${$.BLOCK_TEXT}
139
- esd-extension-block-id="${b.PRICE}"
152
+ <${u.BLOCK_TEXT}
153
+ esd-extension-block-id="${O.PRICE}"
140
154
  class="items-block-price"
141
155
  width="100%"
142
156
  align="center"
@@ -145,48 +159,48 @@ const S = (e) => e.split(";").map((t) => t.trim()).filter((t) => !t.toLowerCase(
145
159
  product-attr="price"
146
160
  contenteditable="false"
147
161
  data-slot-4
148
- data-type="${e}"
149
- data-number="${t}"
150
- ${T}
162
+ data-type="${t}"
163
+ data-number="${e}"
164
+ ${p}
151
165
  ${i}
152
166
  ${a ? `data-currency_symbol="${a}"` : ""}
153
167
  >
154
- ${d}
168
+ ${c}
155
169
  </p>
156
- </${$.BLOCK_TEXT}>
170
+ </${u.BLOCK_TEXT}>
157
171
  `;
158
- }, V = (e, t, n, a, r, l, o = !0, d) => {
159
- let s = k;
172
+ }, Y = (t, e, n, a, r, l, o = !0, c) => {
173
+ let s = y;
160
174
  if (a && a.trim()) {
161
- const p = `&nbsp;${a.trim()}&nbsp;`;
162
- s = (r || "0") === "1" ? `${k}${p}` : `${p}${k}`;
175
+ const $ = `&nbsp;${a.trim()}&nbsp;`;
176
+ s = (r || "0") === "1" ? `${y}${$}` : `${$}${y}`;
163
177
  }
164
- const T = r === "1" ? "after" : "before", i = `data-formated="${n ? "true" : "false"}"`, E = `data-curency="${T}"`, u = o ? "" : ' style="display: none;"';
178
+ const p = r === "1" ? "after" : "before", i = `data-formated="${n ? "true" : "false"}"`, T = `data-curency="${p}"`, E = o ? "" : ' style="display: none;"';
165
179
  if (l) {
166
- const O = S(d || "color: #cc0000; white-space: nowrap; font-size: 19px;");
180
+ const b = x(c || "color: #cc0000; white-space: nowrap; font-size: 19px;");
167
181
  return `
168
182
  <td class="esd-block-text items-block-price"
169
183
  esd-extension-block-id="items-block-original-price"
170
184
  width="100%"
171
- align="center"${u}>
185
+ align="center"${E}>
172
186
  <p
173
187
  product-attr="originalPrice"
174
188
  contenteditable="false"
175
189
  data-slot-5
176
- data-type="${e}"
177
- data-number="${t}"
190
+ data-type="${t}"
191
+ data-number="${e}"
178
192
  ${i}
179
- ${E}
193
+ ${T}
180
194
  ${a ? `data-currency_symbol="${a}"` : ""}
181
- style="${O}">
195
+ style="${b}">
182
196
  <s>${s}</s>
183
197
  </p>
184
198
  </td>`;
185
199
  }
186
200
  return `
187
- <${$.BLOCK_TEXT}
201
+ <${u.BLOCK_TEXT}
188
202
  class="items-block-price"
189
- esd-extension-block-id="${b.ORIGINAL_PRICE}"
203
+ esd-extension-block-id="${O.ORIGINAL_PRICE}"
190
204
  width="100%"
191
205
  align="center"
192
206
  ${o ? "" : 'style="display: none;"'}
@@ -196,124 +210,124 @@ const S = (e) => e.split(";").map((t) => t.trim()).filter((t) => !t.toLowerCase(
196
210
  contenteditable="false"
197
211
  data-slot-5
198
212
  style="color: #cc0000"
199
- data-type="${e}"
200
- data-number="${t}"
213
+ data-type="${t}"
214
+ data-number="${e}"
201
215
  ${i}
202
- ${E}
216
+ ${T}
203
217
  ${a ? `data-currency_symbol="${a}"` : ""}
204
218
  >
205
219
  <s>${s}</s>
206
220
  </p>
207
- </${$.BLOCK_TEXT}>
221
+ </${u.BLOCK_TEXT}>
208
222
  `;
209
- }, H = (e = !0, t, n) => {
210
- const a = e ? "" : 'style="display: none;"';
211
- return t ? `
223
+ }, Z = (t = !0, e, n) => {
224
+ const a = t ? "" : 'style="display: none;"';
225
+ return e ? `
212
226
  <td class="esd-block-text es-p10 document-node-component default-block-component selectable"
213
227
  width="100%" align="center" esd-extension-block-id="items-block-quantity" ${a}>
214
228
  <div class="service-element text-block-input-area text-block-preview-area"
215
229
  style="outline: none;" contenteditable="">
216
230
  <p product-attr="quantity" data-slot-3="" contenteditable="false" width="100%" path="1"
217
231
  style="${n || "text-align: center; font-size: 14px;"}">
218
- ${m}
232
+ ${P}
219
233
  </p>
220
234
  </div>
221
235
  </td>` : `
222
- <${$.BLOCK_TEXT}
236
+ <${u.BLOCK_TEXT}
223
237
  width="100%"
224
238
  align="center"
225
239
  class="es-p10"
226
- esd-extension-block-id="${b.QUANTITY}"
227
- ${e ? "" : 'style="display: none;"'}
240
+ esd-extension-block-id="${O.QUANTITY}"
241
+ ${t ? "" : 'style="display: none;"'}
228
242
  >
229
243
  <p
230
244
  product-attr="quantity"
231
245
  data-slot-3
232
246
  contenteditable="false"
233
247
  width="100%">
234
- ${m}
248
+ ${P}
235
249
  </p>
236
- </${$.BLOCK_TEXT}>
250
+ </${u.BLOCK_TEXT}>
237
251
  `;
238
- }, j = (e, t, n = "Buy", a, r) => a ? `
252
+ }, J = (t, e, n = "Buy", a, r) => a ? `
239
253
  <td class="esd-block-button ins-button default-block-component selectable"
240
254
  align="center" width="100%" name="buy-button" caption="${n}"
241
255
  esd-extension-block-id="items-block-button"
242
- product-attr="button" data-slot-6="" data-type="${e}" data-number="${t}">
256
+ product-attr="button" data-slot-6="" data-type="${t}" data-number="${e}">
243
257
  <span class="es-button-border" style="border-width: 0px;">
244
258
  <a class="es-button" href="#!" target="_blank" style="${r || ""}">
245
259
  ${n}
246
260
  </a>
247
261
  </span>
248
262
  </td>` : `
249
- <${$.BLOCK_BUTTON}
263
+ <${u.BLOCK_BUTTON}
250
264
  width="100%"
251
265
  class="ins-button"
252
266
  name="buy-button"
253
267
  caption="${n}"
254
268
  align="center"
255
- esd-extension-block-id="${b.BUTTON}"
269
+ esd-extension-block-id="${O.BUTTON}"
256
270
  product-attr="button"
257
271
  data-slot-6
258
- data-type="${e}"
259
- data-number="${t}"
272
+ data-type="${t}"
273
+ data-number="${e}"
260
274
  >${n}
261
- </${$.BLOCK_BUTTON}>
262
- `, Y = (e) => !e || Object.keys(e).length === 0 ? '<esd-config-block style="display: none;"></esd-config-block>' : `<esd-config-block style="display: none;" ${Object.entries(e).map(([n, a]) => `${n}="${a}"`).join(" ")}></esd-config-block>`, Z = (e, t, n) => {
263
- const a = t === y.ORIENTATION.VERTICAL, r = n === "horizontal";
264
- return a ? r ? e : e.replace(
275
+ </${u.BLOCK_BUTTON}>
276
+ `, tt = (t) => !t || Object.keys(t).length === 0 ? '<esd-config-block style="display: none;"></esd-config-block>' : `<esd-config-block style="display: none;" ${Object.entries(t).map(([n, a]) => `${n}="${a}"`).join(" ")}></esd-config-block>`, et = (t, e, n) => {
277
+ const a = e === g.ORIENTATION.VERTICAL, r = n === "horizontal";
278
+ return a ? r ? t : t.replace(
265
279
  /<td\s+[^>]*class="[^"]*product-(?:original-)?price-class[^"]*"[^>]*>/gi,
266
280
  (l) => l.replace(/width="50%"/gi, 'width="100%"').replace(/width:\s*50%;/gi, "width: 100%;")
267
- ) : r ? e : e.replace(
281
+ ) : r ? t : t.replace(
268
282
  /<td\s+[^>]*class="[^"]*horizontal-price[^"]*"[^>]*>/gi,
269
283
  (l) => /style\s*=\s*"/i.test(l) ? l.replace(/style\s*=\s*"([^"]*)"/i, 'style="display: none; $1"') : l.replace(/>$/, ' style="display: none;">')
270
284
  ).replace(
271
285
  /<td\s+[^>]*class="[^"]*vertical-price[^"]*"[^>]*>/gi,
272
286
  (l) => l.replace(/display:\s*none;?/gi, "display: table-cell;")
273
287
  );
274
- }, J = (e) => e ? `<td align="center"
288
+ }, at = (t) => t ? `<td align="center"
275
289
  esd-extension-block-id="items-block" width="560"
276
290
  data-number="4"
277
- class="ins-product-td items-block items-block-v2 esd-items-block esd-extension-block esd-container-frame">` : v, g = (e, t, n, a, r, l, o, d, s, T, i, E, u, p = "horizontal", O, _, I) => {
278
- const x = `${`data-type="${t}" data-number="${n}"`} data-orientation="${a}"`, L = e.replace(
291
+ class="ins-product-td items-block items-block-v2 esd-items-block esd-extension-block esd-container-frame">` : z, L = (t, e, n, a, r, l, o, c, s, p, i, T, E, $ = "horizontal", b, _, I) => {
292
+ const F = `${`data-type="${e}" data-number="${n}"`} data-orientation="${a}"`, C = t.replace(
279
293
  /<td([^>]*class="[^"]*ins-product-td[^"]*"[^>]*)>/,
280
- `<td$1 ${x}>`
281
- ), F = s == null ? void 0 : s["data-product_image_control_image-width"], C = l ? G(t, n, F) : Q(t, n), M = (i == null ? void 0 : i.buttonLabel) || "Buy", U = (i == null ? void 0 : i.quantityControlEnabled) !== void 0 ? i.quantityControlEnabled : !0, D = (i == null ? void 0 : i.originalPriceVisible) !== void 0 ? i.originalPriceVisible : (s == null ? void 0 : s["data-product_original_price_control_enabled"]) !== "false", B = L.replace("{-{-TEMPLATE_FIRST_LINE-}-}", J(l)).replace("{-{-PRODUCT_IMAGE-}-}", C).replace("{-{-PRODUCT_NAME-}-}", W(t, l, a, E)).replaceAll(
294
+ `<td$1 ${F}>`
295
+ ), M = s == null ? void 0 : s["data-product_image_control_image-width"], U = l ? W(e, n, M) : q(e, n), B = (i == null ? void 0 : i.buttonLabel) || "Buy", D = (i == null ? void 0 : i.quantityControlEnabled) !== void 0 ? i.quantityControlEnabled : !0, X = (i == null ? void 0 : i.originalPriceVisible) !== void 0 ? i.originalPriceVisible : (s == null ? void 0 : s["data-product_original_price_control_enabled"]) !== "false", v = C.replace("{-{-TEMPLATE_FIRST_LINE-}-}", at(l)).replace("{-{-PRODUCT_IMAGE-}-}", U).replace("{-{-PRODUCT_NAME-}-}", j(e, l, a, T)).replaceAll(
282
296
  "{-{-PRODUCT_PRICE-}-}",
283
- q(t, n, r, o, d, l, O)
297
+ H(e, n, r, o, c, l, b)
284
298
  ).replaceAll(
285
299
  "{-{-PRODUCT_ORIGINAL_PRICE-}-}",
286
- V(
287
- t,
300
+ Y(
301
+ e,
288
302
  n,
289
303
  r,
290
304
  o,
291
- d,
305
+ c,
292
306
  l,
293
- D,
307
+ X,
294
308
  _
295
309
  )
296
- ).replace("{-{-PRODUCT_QUANTITY-}-}", H(U, l, I)).replace("{-{-PRODUCT_BUTTON-}-}", j(t, n, M, l, u)).replace("{-{-CONFIG_BLOCK-}-}", Y(s));
297
- return Z(B, a, p);
310
+ ).replace("{-{-PRODUCT_QUANTITY-}-}", Z(D, l, I)).replace("{-{-PRODUCT_BUTTON-}-}", J(e, n, B, l, E)).replace("{-{-CONFIG_BLOCK-}-}", tt(s));
311
+ return et(v, a, $);
298
312
  };
299
- function st({
300
- orientation: e,
301
- itemsType: t = y.ITEMS_TYPE.CART_ITEMS,
313
+ function ct({
314
+ orientation: t,
315
+ itemsType: e = g.ITEMS_TYPE.CART_ITEMS,
302
316
  itemId: n,
303
317
  currencySymbol: a,
304
318
  currencyLocation: r,
305
319
  migrate: l = !1,
306
320
  formattedPrice: o = !0,
307
- configBlockAttributes: d,
321
+ configBlockAttributes: c,
308
322
  nodeConfig: s,
309
- nameStyles: T,
323
+ nameStyles: p,
310
324
  buttonStyles: i,
311
- priceStyles: E,
312
- originalPriceStyles: u,
313
- quantityStyles: p,
314
- priceOrientation: O
325
+ priceStyles: T,
326
+ originalPriceStyles: E,
327
+ quantityStyles: $,
328
+ priceOrientation: b
315
329
  }) {
316
- const _ = X[t].findIndex((h) => h.value === n);
330
+ const _ = K[e].findIndex((h) => h.value === n);
317
331
  let I = "1";
318
332
  if (_ >= 0)
319
333
  I = String(_ + 1);
@@ -321,48 +335,48 @@ function st({
321
335
  const h = n.match(/\((\d+)\)/);
322
336
  h && h[1] && ([, I] = h);
323
337
  }
324
- N = c.PAIRS_FOR_EXTENSION.imageSrc[t].DEFAULT[_ >= 0 ? _ : 0], A = c.PAIRS_FOR_EXTENSION.name[t].DEFAULT[_ >= 0 ? _ : 0], f = o ? c.PAIRS_FOR_EXTENSION.price[t].DEFAULT_PRICE_FORMATTED : c.PAIRS_FOR_EXTENSION.price[t].DEFAULT_PRICE, k = o ? c.PAIRS_FOR_EXTENSION.originalPrice[t].DEFAULT_PRICE_FORMATTED : c.PAIRS_FOR_EXTENSION.originalPrice[t].DEFAULT_PRICE, m = c.PAIRS_FOR_EXTENSION.quantity[t].DEFAULT;
325
- const w = O || (s == null ? void 0 : s.priceOrientation) || "horizontal";
326
- return e === y.ORIENTATION.VERTICAL ? g(
327
- z,
328
- t,
329
- I,
338
+ k = d.PAIRS_FOR_EXTENSION.imageSrc[e].DEFAULT[_ >= 0 ? _ : 0], A = d.PAIRS_FOR_EXTENSION.name[e].DEFAULT[_ >= 0 ? _ : 0], f = o ? d.PAIRS_FOR_EXTENSION.price[e].DEFAULT_PRICE_FORMATTED : d.PAIRS_FOR_EXTENSION.price[e].DEFAULT_PRICE, y = o ? d.PAIRS_FOR_EXTENSION.originalPrice[e].DEFAULT_PRICE_FORMATTED : d.PAIRS_FOR_EXTENSION.originalPrice[e].DEFAULT_PRICE, P = d.PAIRS_FOR_EXTENSION.quantity[e].DEFAULT;
339
+ const w = b || (s == null ? void 0 : s.priceOrientation) || "horizontal";
340
+ return t === g.ORIENTATION.VERTICAL ? L(
341
+ Q,
330
342
  e,
343
+ I,
344
+ t,
331
345
  o,
332
346
  l,
333
347
  a,
334
348
  r,
335
- d,
349
+ c,
336
350
  void 0,
337
351
  // nodup
338
352
  s,
339
- T,
353
+ p,
340
354
  i,
341
355
  w,
356
+ T,
342
357
  E,
343
- u,
344
- p
345
- ) : g(
346
- K,
347
- t,
348
- I,
358
+ $
359
+ ) : L(
360
+ G,
349
361
  e,
362
+ I,
363
+ t,
350
364
  o,
351
365
  l,
352
366
  a,
353
367
  r,
354
- d,
368
+ c,
355
369
  void 0,
356
370
  // nodup
357
371
  s,
358
- T,
372
+ p,
359
373
  i,
360
374
  w,
375
+ T,
361
376
  E,
362
- u,
363
- p
377
+ $
364
378
  );
365
379
  }
366
380
  export {
367
- st as getDefaultTemplate
381
+ ct as getDefaultTemplate
368
382
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@useinsider/guido",
3
- "version": "2.0.0-beta.13ba613",
3
+ "version": "2.0.0-beta.1ba7e26",
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",