@useinsider/guido 3.21.0-beta.ed1d11f → 3.21.0-beta.f049776

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.
@@ -0,0 +1,43 @@
1
+ var g = Object.defineProperty;
2
+ var m = (n, t, e) => t in n ? g(n, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[t] = e;
3
+ var u = (n, t, e) => m(n, typeof t != "symbol" ? t + "" : t, e);
4
+ const A = "td.coupon-block.ins-coupon-code:not([esd-extension-block-id])", f = /* @__PURE__ */ new Set(["left", "center", "right", "justify"]), p = /(?:^|;)\s*text-align\s*:\s*([^;]+)/i;
5
+ function s(n) {
6
+ const t = n == null ? void 0 : n.trim().toLowerCase();
7
+ return t && f.has(t) ? t : null;
8
+ }
9
+ class y {
10
+ constructor() {
11
+ u(this, "parser");
12
+ this.parser = new DOMParser();
13
+ }
14
+ migrate(t) {
15
+ try {
16
+ const e = this.parser.parseFromString(t, "text/html"), i = e.querySelectorAll(A);
17
+ let o = !1;
18
+ return i.forEach((r) => {
19
+ this.normalizeBlock(r) && (o = !0);
20
+ }), o ? e.documentElement.outerHTML : t;
21
+ } catch (e) {
22
+ return console.error("CouponBlockAlignmentMigrator failed:", e), t;
23
+ }
24
+ }
25
+ normalizeBlock(t) {
26
+ var l;
27
+ const e = t.querySelector(".ins-title"), i = (e == null ? void 0 : e.getAttribute("style")) ?? "", o = s((l = p.exec(i)) == null ? void 0 : l[1]), r = s(t.getAttribute("align")) ?? s(e == null ? void 0 : e.getAttribute("align")) ?? o;
28
+ if (!r)
29
+ return !1;
30
+ let c = !1;
31
+ if (s(t.getAttribute("align")) || (t.setAttribute("align", r), c = !0), e && !o) {
32
+ const a = i.trim().replace(/;+$/, "");
33
+ e.setAttribute("style", a ? `${a}; text-align: ${r}` : `text-align: ${r}`), c = !0;
34
+ }
35
+ return c;
36
+ }
37
+ }
38
+ function S(n) {
39
+ return new y().migrate(n);
40
+ }
41
+ export {
42
+ S as migrateCouponBlockAlignment
43
+ };
@@ -1,17 +1,18 @@
1
1
  import { migrateCheckbox as i } from "./checkboxMigrator.js";
2
- import { migrateCouponBlock as e } from "./couponBlockMigrator.js";
3
- import { migrateItemsBlock as a } from "./itemsBlockMigrator.js";
4
- import { migrateProductNameLink as n } from "./productNameLinkMigrator.js";
2
+ import { migrateCouponBlockAlignment as e } from "./couponBlockAlignmentMigrator.js";
3
+ import { migrateCouponBlock as a } from "./couponBlockMigrator.js";
4
+ import { migrateItemsBlock as n } from "./itemsBlockMigrator.js";
5
+ import { migrateProductNameLink as g } from "./productNameLinkMigrator.js";
5
6
  import { migrateRadioButton as c } from "./radioButtonMigrator.js";
6
- import { migrateRecommendation as g } from "./recommendationMigrator.js";
7
+ import { migrateRecommendation as p } from "./recommendationMigrator.js";
7
8
  import { migrateRecommendationPartnerScope as f } from "./recommendationPartnerMigrator.js";
8
- import { migrateRecommendationTitle as p } from "./recommendationTitleMigrator.js";
9
+ import { migrateRecommendationTitle as l } from "./recommendationTitleMigrator.js";
9
10
  import { migrateSocialIcons as d } from "./socialIconMigrator.js";
10
- import { migrateUnsubscribe as l } from "./unsubscribeMigrator.js";
11
- const h = async (r, t = {}, o) => {
11
+ import { migrateUnsubscribe as s } from "./unsubscribeMigrator.js";
12
+ const y = async (r, t = {}, o) => {
12
13
  let m = r;
13
- return m = i(m), m = c(m), m = await l(m), m = e(m), m = g(m, t), o && (m = f(m, o)), m = p(m), m = a(m), m = n(m), m = d(m), m;
14
+ return m = i(m), m = c(m), m = await s(m), m = e(m), m = a(m), m = p(m, t), o && (m = f(m, o)), m = l(m), m = n(m), m = g(m), m = d(m), m;
14
15
  };
15
16
  export {
16
- h as migrate
17
+ y as migrate
17
18
  };
@@ -0,0 +1 @@
1
+ export declare function migrateCouponBlockAlignment(html: string): string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@useinsider/guido",
3
- "version": "3.21.0-beta.ed1d11f",
3
+ "version": "3.21.0-beta.f049776",
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",