@useinsider/guido 3.11.0-beta.5099e81 → 3.11.0-beta.5589e48

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,13 +1,14 @@
1
- import { migrateCheckbox as o } from "./checkboxMigrator.js";
1
+ import { migrateCheckbox as t } from "./checkboxMigrator.js";
2
2
  import { migrateCouponBlock as i } from "./couponBlockMigrator.js";
3
3
  import { migrateItemsBlock as e } from "./itemsBlockMigrator.js";
4
4
  import { migrateRadioButton as a } from "./radioButtonMigrator.js";
5
- import { migrateRecommendation as g } from "./recommendationMigrator.js";
5
+ import { migrateRecommendation as c } from "./recommendationMigrator.js";
6
+ import { migrateSocialIcons as g } from "./socialIconMigrator.js";
6
7
  import { migrateUnsubscribe as n } from "./unsubscribeMigrator.js";
7
- const b = async (r, t = {}) => {
8
- let m = r;
9
- return m = o(m), m = a(m), m = await n(m), m = i(m), m = g(m, t), m = e(m), m;
8
+ const k = async (o, r = {}) => {
9
+ let m = o;
10
+ return m = t(m), m = a(m), m = await n(m), m = i(m), m = c(m, r), m = e(m), m = g(m), m;
10
11
  };
11
12
  export {
12
- b as migrate
13
+ k as migrate
13
14
  };
@@ -0,0 +1,29 @@
1
+ var u = Object.defineProperty;
2
+ var T = (e, t, r) => t in e ? u(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
3
+ var s = (e, t, r) => T(e, typeof t != "symbol" ? t + "" : t, r);
4
+ const i = "twitter", E = "xcom", o = "esd-tmp-icon-type", p = new RegExp(i, "i");
5
+ class g {
6
+ constructor() {
7
+ s(this, "parser");
8
+ this.parser = new DOMParser();
9
+ }
10
+ migrate(t) {
11
+ try {
12
+ if (!p.test(t))
13
+ return t;
14
+ const r = this.parser.parseFromString(t, "text/html"), a = r.querySelectorAll(`[${o}]`);
15
+ let n = !1;
16
+ return a.forEach((c) => {
17
+ String(c.getAttribute(o)).toLowerCase() === i && (c.setAttribute(o, E), n = !0);
18
+ }), n ? r.documentElement.outerHTML : t;
19
+ } catch (r) {
20
+ return console.error("SocialIconMigrator failed:", r), t;
21
+ }
22
+ }
23
+ }
24
+ function _(e) {
25
+ return new g().migrate(e);
26
+ }
27
+ export {
28
+ _ as migrateSocialIcons
29
+ };
@@ -1,14 +1,14 @@
1
- import { ModificationDescription as C, UIElementType as _, UEAttr as L } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
2
- import { CommonControl as D } from "../../../common-control.js";
3
- import { ItemsBlockControlId as R, ItemsBlockId as I } from "../../enums/controlEnums.js";
4
- import { productPairs as p } from "../../enums/productEnums.js";
5
- import { getItemsBlockConfig as l, setItemsBlockConfig as h, escapeReplacement as g } from "../../utils/nodeConfigUtils.js";
6
- const O = R.PRICE_FORMATTED_PRICE, a = {
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
+ import { productPairs as I } from "../../enums/productEnums.js";
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 k extends D {
9
+ class k extends h {
10
10
  getId() {
11
- return O;
11
+ return g;
12
12
  }
13
13
  getTemplate() {
14
14
  return `
@@ -18,58 +18,56 @@ class k extends D {
18
18
  `;
19
19
  }
20
20
  onRender() {
21
- const e = l(this.currentNode);
22
- this.api.updateValues({ [a.FORMATTED_PRICE]: (e == null ? void 0 : e.priceFormatted) ?? !0 }), this.api.onValueChanged(a.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 = l(this.currentNode);
29
- this.api.updateValues({ [a.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), !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 = l(this.currentNode), n = (t == null ? void 0 : t.type) ?? "CART_ITEMS", o = (t == null ? void 0 : t.priceSinglePrice) ?? !1, r = p.PAIRS_FOR_EXTENSION.price[n], i = p.PAIRS_FOR_EXTENSION.originalPrice[n], [E, m] = e ? [
36
- o ? r.DEFAULT_SINGLE_PRICE : r.DEFAULT_PRICE,
37
- o ? r.DEFAULT_SINGLE_PRICE_FORMATTED : r.DEFAULT_PRICE_FORMATTED
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
+ i ? r.DEFAULT_SINGLE_PRICE : r.DEFAULT_PRICE,
37
+ i ? r.DEFAULT_SINGLE_PRICE_FORMATTED : r.DEFAULT_PRICE_FORMATTED
38
38
  ] : [
39
- o ? r.DEFAULT_SINGLE_PRICE_FORMATTED : r.DEFAULT_PRICE_FORMATTED,
40
- o ? r.DEFAULT_SINGLE_PRICE : r.DEFAULT_PRICE
41
- ], T = o ? i.DEFAULT_SINGLE_PRICE : i.DEFAULT_PRICE, P = o ? i.DEFAULT_SINGLE_PRICE_FORMATTED : i.DEFAULT_PRICE_FORMATTED, [F, A] = e ? [T, P] : [P, T], s = this.api.getDocumentModifier();
42
- h(this.currentNode, this.api, { priceFormatted: e }, s);
43
- const c = this.currentNode.closest(".items-block");
44
- ((c == null ? void 0 : c.querySelectorAll(
45
- `[esd-extension-block-id="${I.PRICE}"]`
46
- )) || []).forEach((d) => {
47
- this._updatePriceBlock(s, d, E, m, e);
48
- }), ((c == null ? void 0 : c.querySelectorAll(
49
- `[esd-extension-block-id="${I.ORIGINAL_PRICE}"]`
50
- )) || []).forEach((d) => {
51
- this._updatePriceBlock(s, d, F, A, e);
52
- }), s.apply(new C(
53
- `Updated price to ${e ? "formatted" : "unformatted"}`
39
+ i ? r.DEFAULT_SINGLE_PRICE_FORMATTED : r.DEFAULT_PRICE_FORMATTED,
40
+ i ? r.DEFAULT_SINGLE_PRICE : r.DEFAULT_PRICE
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(
42
+ `[esd-extension-block-id="${_.PRICE}"]`
43
+ )) || [], E = this.api.getDocumentModifier();
44
+ C.forEach((a) => {
45
+ this._updatePriceBlock(E, a, p, m);
46
+ }), ((o == null ? void 0 : o.querySelectorAll(
47
+ `[esd-extension-block-id="${_.ORIGINAL_PRICE}"]`
48
+ )) || []).forEach((a) => {
49
+ this._updatePriceBlock(E, a, F, A);
50
+ }), E.apply(new L(
51
+ `Updated price to ${t ? "formatted" : "unformatted"}`
54
52
  ));
55
53
  }
56
- _updatePriceBlock(e, t, n, o, r) {
57
- const i = `data-formated="${r ? "true" : "false"}"`, E = t.getInnerHTML().trim().replace(n, g(o)).replace(/data-formated=(?:"[^"]*"|'[^']*')/g, i);
58
- e.modifyHtml(t).setInnerHtml(E);
54
+ _updatePriceBlock(t, e, n, i) {
55
+ const r = e.getInnerHTML().trim().replace(n, O(i));
56
+ t.modifyHtml(e).setInnerHtml(r);
59
57
  }
60
58
  _getFormattedPrice() {
61
59
  return `
62
60
  <div class="display-flex align-items-center justify-content-between">
63
- <${_.LABEL}
64
- ${L.LABEL.text}="${this.api.translate("Formatted Price (e.g. $9.90)")}"
61
+ <${P.LABEL}
62
+ ${D.LABEL.text}="${this.api.translate("Formatted Price (e.g. $9.90)")}"
65
63
  >
66
- </${_.LABEL}>
67
- ${this._GuToggle(a.FORMATTED_PRICE)}
64
+ </${P.LABEL}>
65
+ ${this._GuToggle(s.FORMATTED_PRICE)}
68
66
  </div>
69
67
  `;
70
68
  }
71
69
  }
72
70
  export {
73
- O as CONTROL_BLOCK_ID,
71
+ g as CONTROL_BLOCK_ID,
74
72
  k as PriceFormattedPriceControl
75
73
  };
@@ -0,0 +1 @@
1
+ export declare function migrateSocialIcons(html: string): string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@useinsider/guido",
3
- "version": "3.11.0-beta.5099e81",
3
+ "version": "3.11.0-beta.5589e48",
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",