@useinsider/guido 3.22.0-beta.504713d → 3.22.0-beta.53526b4

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,55 @@
1
+ var A = Object.defineProperty;
2
+ var m = (n, e, t) => e in n ? A(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
3
+ var l = (n, e, t) => m(n, typeof e != "symbol" ? e + "" : e, t);
4
+ const f = "td.coupon-block.ins-coupon-code:not([esd-extension-block-id])", p = /* @__PURE__ */ new Set(["left", "center", "right", "justify"]), u = /^text-align\s*:\s*(.*)$/i, c = /\s*!\s*important\s*$/i, d = /(?:[^;"'(]|"[^"]*"|'[^']*'|\([^)]*\)|["'(])+/g;
5
+ function a(n) {
6
+ const e = n == null ? void 0 : n.trim().toLowerCase();
7
+ return e && p.has(e) ? e : null;
8
+ }
9
+ function h(n) {
10
+ return (n.match(d) ?? []).map((e) => e.trim()).filter(Boolean);
11
+ }
12
+ function T(n) {
13
+ const e = n.reduce((t, i) => {
14
+ var s;
15
+ const r = (s = u.exec(i)) == null ? void 0 : s[1];
16
+ if (r === void 0)
17
+ return t;
18
+ const o = c.test(r);
19
+ return o || !(t != null && t.important) ? { value: r.replace(c, ""), important: o } : t;
20
+ }, null);
21
+ return a(e == null ? void 0 : e.value);
22
+ }
23
+ class b {
24
+ constructor() {
25
+ l(this, "parser");
26
+ this.parser = new DOMParser();
27
+ }
28
+ migrate(e) {
29
+ if (!e.includes("coupon-block"))
30
+ return e;
31
+ try {
32
+ const t = this.parser.parseFromString(e, "text/html"), i = t.querySelectorAll(f);
33
+ let r = !1;
34
+ return i.forEach((o) => {
35
+ this.normalizeBlock(o) && (r = !0);
36
+ }), r ? t.documentElement.outerHTML : e;
37
+ } catch (t) {
38
+ return console.error("CouponBlockAlignmentMigrator failed:", t), e;
39
+ }
40
+ }
41
+ // The block cell's align is the only alignment the editor's control and the export read.
42
+ normalizeBlock(e) {
43
+ const t = e.querySelector(".ins-title"), i = h((t == null ? void 0 : t.getAttribute("style")) ?? ""), r = i.filter((g) => !u.test(g)), o = T(i) ?? a(t == null ? void 0 : t.getAttribute("align")) ?? a(e.getAttribute("align"));
44
+ if (!o)
45
+ return !1;
46
+ let s = !1;
47
+ return e.getAttribute("align") !== o && (e.setAttribute("align", o), s = !0), t != null && t.hasAttribute("align") && (t.removeAttribute("align"), s = !0), t && r.length < i.length && (r.length ? t.setAttribute("style", r.join("; ")) : t.removeAttribute("style"), s = !0), s;
48
+ }
49
+ }
50
+ function L(n) {
51
+ return new b().migrate(n);
52
+ }
53
+ export {
54
+ L as migrateCouponBlockAlignment
55
+ };
@@ -1,18 +1,19 @@
1
1
  import { migrateCheckbox as i } from "./checkboxMigrator.js";
2
- import { migrateCouponBlock as e } from "./couponBlockMigrator.js";
3
- import { migrateFullStoryScripts as a } from "./fullStoryScriptMigrator.js";
4
- import { migrateItemsBlock as n } from "./itemsBlockMigrator.js";
5
- import { migrateProductNameLink as c } from "./productNameLinkMigrator.js";
6
- import { migrateRadioButton as g } from "./radioButtonMigrator.js";
7
- import { migrateRecommendation as p } from "./recommendationMigrator.js";
8
- import { migrateRecommendationPartnerScope as f } from "./recommendationPartnerMigrator.js";
9
- import { migrateRecommendationTitle as l } from "./recommendationTitleMigrator.js";
10
- import { migrateSocialIcons as s } from "./socialIconMigrator.js";
2
+ import { migrateCouponBlockAlignment as e } from "./couponBlockAlignmentMigrator.js";
3
+ import { migrateCouponBlock as a } from "./couponBlockMigrator.js";
4
+ import { migrateFullStoryScripts as n } from "./fullStoryScriptMigrator.js";
5
+ import { migrateItemsBlock as g } from "./itemsBlockMigrator.js";
6
+ import { migrateProductNameLink as p } from "./productNameLinkMigrator.js";
7
+ import { migrateRadioButton as c } from "./radioButtonMigrator.js";
8
+ import { migrateRecommendation as f } from "./recommendationMigrator.js";
9
+ import { migrateRecommendationPartnerScope as l } from "./recommendationPartnerMigrator.js";
10
+ import { migrateRecommendationTitle as s } from "./recommendationTitleMigrator.js";
11
+ import { migrateSocialIcons as u } from "./socialIconMigrator.js";
11
12
  import { migrateUnsubscribe as d } from "./unsubscribeMigrator.js";
12
- const h = async (o, t = {}, r) => {
13
- let m = o;
14
- return m = i(m), m = g(m), m = await d(m), m = e(m), m = p(m, t), r && (m = f(m, r)), m = l(m), m = n(m), m = c(m), m = s(m), m = a(m), m;
13
+ const A = async (r, t = {}, o) => {
14
+ let m = r;
15
+ return m = i(m), m = c(m), m = await d(m), m = e(m), m = a(m), m = f(m, t), o && (m = l(m, o)), m = s(m), m = g(m), m = p(m), m = u(m), m = n(m), m;
15
16
  };
16
17
  export {
17
- h as migrate
18
+ A as migrate
18
19
  };
@@ -1,4 +1,4 @@
1
- const o = "3.22.0-beta.504713d", s = { stripo: { version: "2.81.1" } }, t = {
1
+ const o = "3.22.0-beta.53526b4", s = { stripo: { version: "2.81.1" } }, t = {
2
2
  version: o,
3
3
  guido: s
4
4
  };
@@ -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.22.0-beta.504713d",
3
+ "version": "3.22.0-beta.53526b4",
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",
@@ -59,7 +59,7 @@
59
59
  "dependencies": {
60
60
  "@stripoinc/ui-editor-extensions": "3.11.0",
61
61
  "@useinsider/design-system-organisms": "0.0.3-beta.d816f06",
62
- "@useinsider/design-system-vue": "2.5.0",
62
+ "@useinsider/design-system-vue": "2.3.1",
63
63
  "@vueuse/core": "11.3.0",
64
64
  "lodash-es": "4.17.21",
65
65
  "pinia": "2.3.1",