@useinsider/guido 3.1.1-beta.b369df0 → 3.1.1-beta.be402b7

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,40 +1,50 @@
1
- import { usePartner as N } from "../../composables/usePartner.js";
2
- import { LINK_REGEXES as l, LINK_TYPES as S, INSIDER_ID as R, URLS as _ } from "../../enums/unsubscribe.js";
3
- import { parsePageList as U } from "../../extensions/Blocks/Unsubscribe/utils/utils.js";
4
- import { useConfigStore as B } from "../../stores/config.js";
5
- import { useDynamicContentStore as y } from "../../stores/dynamic-content.js";
6
- import { useUnsubscribeStore as L } from "../../stores/unsubscribe.js";
7
- const D = [
1
+ import { usePartner as I } from "../../composables/usePartner.js";
2
+ import { LINK_REGEXES as p, LINK_TYPES as R, INSIDER_ID as b, URLS as y } from "../../enums/unsubscribe.js";
3
+ import { parsePageList as _ } from "../../extensions/Blocks/Unsubscribe/utils/utils.js";
4
+ import { useConfigStore as N } from "../../stores/config.js";
5
+ import { useDynamicContentStore as U } from "../../stores/dynamic-content.js";
6
+ import { useUnsubscribeStore as C } from "../../stores/unsubscribe.js";
7
+ const G = [
8
8
  {
9
9
  id: "add-unsubscribe-link-values",
10
10
  description: "Adding unsubscribe link values",
11
11
  type: "custom",
12
- processor: (t) => {
13
- const { getPartnerName: i } = N(), c = B(), n = y(), u = L(), a = c.variationId;
14
- if (!a)
15
- return t;
16
- let e = t;
17
- const r = `/${i()}/email/${a}?user={{iid}}`;
18
- return new DOMParser().parseFromString(e, "text/html").querySelectorAll(".unsubscribe-block-v2[data-unsubscribe-page-list]").forEach((p) => {
19
- var g;
20
- const m = p.getAttribute("data-unsubscribe-page-list");
21
- if (!m)
12
+ processor: (i) => {
13
+ const { getPartnerName: n } = I(), a = N(), t = U(), g = C(), o = a.variationId;
14
+ if (console.debug("[SD-136953][compiler] variationId:", o), !o)
15
+ return i;
16
+ let e = i;
17
+ const s = `/${n()}/email/${o}?user={{iid}}`, d = new DOMParser().parseFromString(e, "text/html").querySelectorAll(".unsubscribe-block-v2[data-unsubscribe-page-list]");
18
+ console.debug("[SD-136953][compiler] blocks found:", d.length);
19
+ let c = !1, l = !1;
20
+ return d.forEach((f) => {
21
+ var S;
22
+ const u = f.getAttribute("data-unsubscribe-page-list");
23
+ if (!u)
22
24
  return;
23
- const I = U(m), d = ((g = u.templates) == null ? void 0 : g.filter(
24
- (o) => I.includes(o.id)
25
- )) ?? [], E = d.some((o) => o.type === S.UNSUBSCRIBE_LINK_TYPE), b = d.some((o) => o.type === S.PREFERENCES_LINK_TYPE), f = p.outerHTML;
26
- let s = f;
27
- (E || b) && n.selectedDynamicContentList.push({
28
- text: R,
29
- value: R,
30
- fallback: ""
31
- }), E && (s = s.replace(
32
- l.GLOBAL_UNSUBSCRIBE_LINK_REGEX,
33
- _.UNSUBSCRIBE_URL + r
34
- )), b && (s = s.replace(
35
- l.PREFERENCES_UNSUBSCRIBE_LINK_REGEX,
36
- _.PREFERENCES_URL + r
37
- )), s = s.replace(l.UNSUBSCRIBE_LINK_REGEX, ""), e = e.replace(f, s);
25
+ const E = _(u), m = ((S = g.templates) == null ? void 0 : S.filter(
26
+ (r) => E.includes(r.id)
27
+ )) ?? [];
28
+ m.some((r) => r.type === R.UNSUBSCRIBE_LINK_TYPE) && (c = !0), m.some((r) => r.type === R.PREFERENCES_LINK_TYPE) && (l = !0), console.debug("[SD-136953][compiler] block:", {
29
+ pageIds: E,
30
+ pagesInBlock: m.map((r) => ({ id: r.id, type: r.type })),
31
+ hasUnsubscribePage: c,
32
+ hasPreferencesPage: l
33
+ });
34
+ }), (c || l) && (t.selectedDynamicContentList.some((u) => u.value === b) || t.selectedDynamicContentList.push({
35
+ text: b,
36
+ value: b,
37
+ fallback: ""
38
+ })), c && (e = e.replace(
39
+ p.GLOBAL_UNSUBSCRIBE_LINK_REGEX,
40
+ y.UNSUBSCRIBE_URL + s
41
+ )), l && (e = e.replace(
42
+ p.PREFERENCES_UNSUBSCRIBE_LINK_REGEX,
43
+ y.PREFERENCES_URL + s
44
+ )), d.length && (e = e.replace(p.UNSUBSCRIBE_LINK_REGEX, "")), console.debug("[SD-136953][compiler] result:", {
45
+ hasUnsubscribePage: c,
46
+ hasPreferencesPage: l,
47
+ stillHasPlaceholder: e.includes("{{ins-global-unsubscribe-link}}")
38
48
  }), e;
39
49
  },
40
50
  priority: 60
@@ -43,7 +53,7 @@ const D = [
43
53
  id: "remove-data-ogsb-button-styles",
44
54
  description: "Removing styles like [data-ogsb] .es-button.es-button-123 { background: red; }",
45
55
  type: "regex",
46
- pattern: l.DATA_OGSB_BUTTON_CSS_REGEX,
56
+ pattern: p.DATA_OGSB_BUTTON_CSS_REGEX,
47
57
  replacement: "",
48
58
  flags: "g",
49
59
  priority: 61
@@ -52,31 +62,31 @@ const D = [
52
62
  id: "format-comment-braces",
53
63
  description: "Adding spaces around comment braces for proper formatting",
54
64
  type: "custom",
55
- processor: (t) => t.replace(/{#/g, "{ #").replace(/#}/g, "# }"),
65
+ processor: (i) => i.replace(/{#/g, "{ #").replace(/#}/g, "# }"),
56
66
  priority: 62
57
67
  },
58
68
  {
59
69
  id: "add-universal-link-flags",
60
70
  description: "Adding universal link flags",
61
71
  type: "custom",
62
- processor: (t) => {
63
- let i = t;
64
- const c = i.match(/<a[^>]+>(.*?)<\/a>/gm);
65
- return c && c.forEach((n) => {
66
- if (n.includes("insEmail=1"))
72
+ processor: (i) => {
73
+ let n = i;
74
+ const a = n.match(/<a[^>]+>(.*?)<\/a>/gm);
75
+ return a && a.forEach((t) => {
76
+ if (t.includes("insEmail=1"))
67
77
  return;
68
- if (n.match(/<a\s+(?:[^>]*?\s+)?href=(["'`”])(.*?)\1\s+(?:[^>]*?\s+)?universal=(["'`”])true\3/gm)) {
69
- const a = n.replace(/href=(["'`”])(.*?)\1/gm, (e) => {
70
- const r = e.slice(6, e.length - 1).trim();
71
- return e.includes("?") || e.includes("#") ? r.slice(-1) === "&" ? e.replace(r, `${r}insEmail=1`) : e.replace(r, `${r}&insEmail=1`) : e.replace(r, `${r}?insEmail=1`);
78
+ if (t.match(/<a\s+(?:[^>]*?\s+)?href=(["'`”])(.*?)\1\s+(?:[^>]*?\s+)?universal=(["'`”])true\3/gm)) {
79
+ const o = t.replace(/href=(["'`”])(.*?)\1/gm, (e) => {
80
+ const s = e.slice(6, e.length - 1).trim();
81
+ return e.includes("?") || e.includes("#") ? s.slice(-1) === "&" ? e.replace(s, `${s}insEmail=1`) : e.replace(s, `${s}&insEmail=1`) : e.replace(s, `${s}?insEmail=1`);
72
82
  });
73
- i = i.replace(n, a);
83
+ n = n.replace(t, o);
74
84
  }
75
- }), i;
85
+ }), n;
76
86
  },
77
87
  priority: 63
78
88
  }
79
89
  ];
80
90
  export {
81
- D as unsubscribeCompilerRules
91
+ G as unsubscribeCompilerRules
82
92
  };
@@ -44,6 +44,7 @@ export interface TooltipOptions {
44
44
  x: number;
45
45
  y: number;
46
46
  };
47
+ preventXss?: boolean;
47
48
  }
48
49
  export type TextValueObject = {
49
50
  text: string;
@@ -1,37 +1,50 @@
1
1
  import { useActionsApi as f } from "../composables/useActionsApi.js";
2
- import { useHtmlCompiler as C } from "../composables/useHtmlCompiler.js";
3
- import { useRecommendationExtensionStore as T } from "../extensions/Blocks/Recommendation/store/recommendation.js";
4
- import { useDynamicContentStore as x } from "../stores/dynamic-content.js";
2
+ import { useHtmlCompiler as h } from "../composables/useHtmlCompiler.js";
3
+ import { useRecommendationExtensionStore as C } from "../extensions/Blocks/Recommendation/store/recommendation.js";
4
+ import { useDynamicContentStore as D } from "../stores/dynamic-content.js";
5
5
  import { useUnsubscribeStore as y } from "../stores/unsubscribe.js";
6
6
  const E = () => {
7
- const o = x(), t = y(), { getCompiledEmail: i, getTemplateData: n, editorSave: s } = f(), { compileHtml: m } = C();
7
+ const n = D(), e = y(), { getCompiledEmail: a, getTemplateData: l, editorSave: m } = f(), { compileHtml: c } = h();
8
8
  return {
9
9
  prepareTemplateDetails: async () => {
10
- const { html: a, ampHtml: r = "", ampErrors: c = [] } = await i({
10
+ const { html: s, ampHtml: r = "", ampErrors: p = [] } = await a({
11
11
  minimize: !0,
12
12
  resetDataSavedFlag: !1
13
- }), { html: l, css: p, syncModulesIds: u = [] } = await n(), { compiledHtml: d, stats: e, appliedRules: S } = m(a), g = o.getSelectedDynamicContentList, b = T();
14
- return s(), console.debug("HTML Compilation Stats:", {
15
- originalSize: e.originalSize,
16
- compiledSize: e.compiledSize,
17
- reduction: `${e.reductionPercentage.toFixed(2)}%`,
18
- appliedRules: S,
19
- executionTime: `${e.executionTime.toFixed(2)}ms`
13
+ }), { html: u, css: d, syncModulesIds: b = [] } = await l();
14
+ console.debug("[SD-136953] Pre-compile state:", {
15
+ selectedPages: e.selectedUnsubscribePages,
16
+ templatesCount: e.templates.length,
17
+ hasPlaceholder: s.includes("{{ins-global-unsubscribe-link}}")
18
+ }), e.selectedUnsubscribePages.length && await e.fetchTemplates(), console.debug("[SD-136953] Post-fetch state:", {
19
+ templatesCount: e.templates.length,
20
+ templates: e.templates.map((i) => ({ id: i.id, type: i.type }))
21
+ });
22
+ const { compiledHtml: o, stats: t, appliedRules: g } = c(s);
23
+ console.debug("[SD-136953] Post-compile:", {
24
+ stillHasPlaceholder: o.includes("{{ins-global-unsubscribe-link}}")
25
+ });
26
+ const S = n.getSelectedDynamicContentList, P = C();
27
+ return m(), console.debug("HTML Compilation Stats:", {
28
+ originalSize: t.originalSize,
29
+ compiledSize: t.compiledSize,
30
+ reduction: `${t.reductionPercentage.toFixed(2)}%`,
31
+ appliedRules: g,
32
+ executionTime: `${t.executionTime.toFixed(2)}ms`
20
33
  }), {
21
- dynamicContentList: g,
22
- compiledHtml: d,
23
- rawHtml: l,
24
- css: p,
34
+ dynamicContentList: S,
35
+ compiledHtml: o,
36
+ rawHtml: u,
37
+ css: d,
25
38
  ampHtml: r,
26
- ampErrors: c,
27
- modules: u.map(Number),
39
+ ampErrors: p,
40
+ modules: b.map(Number),
28
41
  recommendation: {
29
- campaignUrls: b.recommendationCampaignUrls,
42
+ campaignUrls: P.recommendationCampaignUrls,
30
43
  configs: {}
31
44
  },
32
45
  unsubscribe: {
33
- status: t.unsubscribePagesStatus,
34
- config: t.selectedUnsubscribePages
46
+ status: e.unsubscribePagesStatus,
47
+ config: e.selectedUnsubscribePages
35
48
  }
36
49
  };
37
50
  }
@@ -1,10 +1,11 @@
1
- const o = (i, t = {}) => ({
2
- id: i,
1
+ const e = (s, t = {}) => ({
2
+ id: s,
3
3
  dynamicPosition: t.dynamicPosition ?? !1,
4
4
  staticPosition: t.staticPosition ?? "bottom center",
5
5
  iconStatus: t.iconStatus ?? !1,
6
- offset: t.offset
6
+ offset: t.offset,
7
+ preventXss: t.preventXss
7
8
  });
8
9
  export {
9
- o as getTooltipOptions
10
+ e as getTooltipOptions
10
11
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@useinsider/guido",
3
- "version": "3.1.1-beta.b369df0",
3
+ "version": "3.1.1-beta.be402b7",
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",
@@ -33,7 +33,7 @@
33
33
  "license": "ISC",
34
34
  "dependencies": {
35
35
  "@stripoinc/ui-editor-extensions": "3.5.0",
36
- "@useinsider/design-system-vue": "1.1.0",
36
+ "@useinsider/design-system-vue": "0.14.28",
37
37
  "@vueuse/core": "11.3.0",
38
38
  "lodash-es": "4.17.21",
39
39
  "pinia": "2.3.1",