@useinsider/guido 3.23.0-beta.9b14463 → 3.23.0-beta.a3a0b68

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.
@@ -16,6 +16,8 @@ const x = /* @__PURE__ */ new Set([
16
16
  "fix-tags-end",
17
17
  // Unwrap translate-injected <font dir="auto"> tags — pure removal, never emits AMP-forbidden output.
18
18
  "strip-font-tags",
19
+ // Trim whitespace inside href values — attribute-value edit only, emits nothing new.
20
+ "trim-href-whitespace",
19
21
  // Image domain corrections — plain string replacement.
20
22
  "replace-old-image-domain",
21
23
  "replace-old-v2-image-domain",
@@ -1,5 +1,6 @@
1
- import { stripFontTags as p } from "../../utils/stripFontTags.js";
2
- const d = [
1
+ import { stripFontTags as c } from "../../utils/stripFontTags.js";
2
+ import { trimHrefWhitespace as l } from "../../utils/trimHrefWhitespace.js";
3
+ const f = [
3
4
  {
4
5
  id: "fix-url-encoding-start",
5
6
  description: "Replace {%22 with %7B%22 to fix URL encoding",
@@ -58,9 +59,16 @@ const d = [
58
59
  id: "strip-font-tags",
59
60
  description: 'Unwrap browser-translate-injected <font dir="auto"> tags, keeping inner content; other <font> elements are left intact.',
60
61
  type: "custom",
61
- processor: (e) => p(e),
62
+ processor: (e) => c(e),
62
63
  priority: 15
63
64
  },
65
+ {
66
+ id: "trim-href-whitespace",
67
+ description: "Trim leading/trailing whitespace and &nbsp; from every href value",
68
+ type: "custom",
69
+ processor: (e) => l(e),
70
+ priority: 16
71
+ },
64
72
  {
65
73
  id: "remove-apty-iframe",
66
74
  description: "Cleanup Apty Iframe Code",
@@ -157,8 +165,8 @@ const d = [
157
165
  processor: (e) => {
158
166
  const t = (i) => i.toString(16).padStart(2, "0");
159
167
  return e.replace(/rgb\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*\)/gi, (i, o, n, r) => {
160
- const [s, a, c] = [Number(o), Number(n), Number(r)];
161
- return s > 255 || a > 255 || c > 255 ? i : `#${t(s)}${t(a)}${t(c)}`;
168
+ const [s, a, p] = [Number(o), Number(n), Number(r)];
169
+ return s > 255 || a > 255 || p > 255 ? i : `#${t(s)}${t(a)}${t(p)}`;
162
170
  }).replace(/#([0-9a-f])\1([0-9a-f])\2([0-9a-f])\3\b/gi, "#$1$2$3");
163
171
  },
164
172
  priority: 44
@@ -200,5 +208,5 @@ const d = [
200
208
  }
201
209
  ];
202
210
  export {
203
- d as defaultHtmlCompilerRules
211
+ f as defaultHtmlCompilerRules
204
212
  };
@@ -1,9 +1,9 @@
1
- const o = "3.23.0-beta.9b14463", s = { stripo: { version: "2.81.1" } }, t = {
1
+ const o = "3.23.0-beta.a3a0b68", s = { stripo: { version: "2.83.1" } }, a = {
2
2
  version: o,
3
3
  guido: s
4
4
  };
5
5
  export {
6
- t as default,
6
+ a as default,
7
7
  s as guido,
8
8
  o as version
9
9
  };
@@ -1,63 +1,60 @@
1
- import { useActionsApi as A } from "../composables/useActionsApi.js";
1
+ import { useActionsApi as h } from "../composables/useActionsApi.js";
2
2
  import { useConfig as S } from "../composables/useConfig.js";
3
- import { useHttp as E } from "../composables/useHttp.js";
3
+ import { useHttp as v } from "../composables/useHttp.js";
4
4
  import { useToaster as x } from "../composables/useToaster.js";
5
- import { useTranslations as P } from "../composables/useTranslations.js";
6
- import { useHtmlDocumentCountValidator as L } from "../composables/validators/useHtmlDocumentCountValidator.js";
5
+ import { useTranslations as A } from "../composables/useTranslations.js";
6
+ import { useHtmlDocumentCountValidator as E } from "../composables/validators/useHtmlDocumentCountValidator.js";
7
7
  import { useLiquidValidator as N } from "../composables/validators/useLiquidValidator.js";
8
8
  import { EditorType as H } from "../enums/defaults.js";
9
- import { ToasterTypeOptions as T } from "../enums/toaster.js";
9
+ import { ToasterTypeOptions as P } from "../enums/toaster.js";
10
10
  import { useRecommendationExtensionStore as D } from "../extensions/Blocks/Recommendation/store/recommendation.js";
11
- import { useSaveAsTemplateStore as q } from "../stores/save-as-template.js";
11
+ import { useSaveAsTemplateStore as L } from "../stores/save-as-template.js";
12
12
  import { base64EncodeWithSpecialChars as r } from "../utils/base64.js";
13
- import { isPlainObject as w } from "../utils/genericUtil.js";
13
+ import { isPlainObject as q } from "../utils/genericUtil.js";
14
14
  import { useTemplatePreparation as F } from "../utils/templatePreparation.js";
15
15
  const Z = () => {
16
- const { get: l, post: c } = E(), { handleError: o, showToaster: i } = x(), { config: p, isFeatureEnabled: u } = S(), { validateLiquidSyntax: b } = N(), { validateSingleHtmlDocument: C } = L(), { getTemplateData: h } = A(), n = P();
16
+ const { get: n, post: m } = v(), { handleError: s, showToaster: l } = x(), { config: c, isFeatureEnabled: p } = S(), { validateLiquidSyntax: T } = N(), { validateSingleHtmlDocument: w } = E(), { getTemplateData: b } = h(), u = A();
17
17
  return {
18
18
  getCategories: async () => {
19
19
  try {
20
- const { data: e } = await l("/newsletter/template-library/get-template-categories");
21
- return Array.isArray(e) ? e : ((!w(e) || e.type !== "alert") && console.error("[TEMPLATE_LIBRARY_API] Unexpected get-template-categories response", e), i({
22
- message: n("newsletter.template-library-service-error"),
23
- type: T.Error
24
- }), []);
20
+ const { data: e = [] } = await n("/newsletter/template-library/get-template-categories");
21
+ return e;
25
22
  } catch (e) {
26
- return o(e, "Failed to fetch template categories"), [];
23
+ return s(e, "Failed to fetch template categories"), [];
27
24
  }
28
25
  },
29
26
  checkTemplateNameAvailability: async (e) => {
30
- const { data: { status: t = !1 } } = await l(
27
+ const { data: { status: t = !1 } } = await n(
31
28
  `/newsletter/template-library/template-name-exists?name=${e}`
32
29
  );
33
30
  return !t;
34
31
  },
35
32
  createCategory: async (e) => {
36
33
  try {
37
- const { data: { id: t } } = await c(
34
+ const { data: { id: t } } = await m(
38
35
  "/newsletter/template-library/create-category",
39
36
  { name: e }
40
37
  );
41
38
  return t.toString();
42
39
  } catch (t) {
43
- return o(t, "Failed to create category"), "";
40
+ return s(t, "Failed to create category"), "";
44
41
  }
45
42
  },
46
43
  createTemplate: async () => {
47
44
  var e, t, d, y;
48
45
  try {
49
- const { prepareTemplateDetails: m } = F(), s = q(), g = await h();
50
- if (!C(g.html))
46
+ const { prepareTemplateDetails: i } = F(), o = L(), g = await b();
47
+ if (!w(g.html))
51
48
  return !1;
52
- const a = await m(g);
53
- if (u("liquidSyntax") && !await b(a.compiledHtml))
49
+ const a = await i(g);
50
+ if (p("liquidSyntax") && !await T(a.compiledHtml))
54
51
  return !1;
55
- const v = {
56
- name: s.getTemplateName,
57
- categories: s.getSelectedCategoryIds,
58
- productId: ((t = (e = p.value) == null ? void 0 : e.partner) == null ? void 0 : t.productType) || 0,
52
+ const C = {
53
+ name: o.getTemplateName,
54
+ categories: o.getSelectedCategoryIds,
55
+ productId: ((t = (e = c.value) == null ? void 0 : e.partner) == null ? void 0 : t.productType) || 0,
59
56
  editorType: H,
60
- messageType: ((y = (d = p.value) == null ? void 0 : d.partner) == null ? void 0 : y.messageType) || 0,
57
+ messageType: ((y = (d = c.value) == null ? void 0 : d.partner) == null ? void 0 : y.messageType) || 0,
61
58
  content: r(a.compiledHtml),
62
59
  css: r(a.css),
63
60
  unsubscriptionPreferencePageStatus: !1,
@@ -68,34 +65,34 @@ const Z = () => {
68
65
  recommendationConfigs: r({}),
69
66
  isGuido: !0,
70
67
  // eslint-disable-next-line camelcase
71
- template_engine: u("liquidSyntax") ? 1 : 0,
68
+ template_engine: p("liquidSyntax") ? 1 : 0,
72
69
  stripoConfig: r({
73
70
  editor: "stripo",
74
71
  html: a.rawHtml,
75
72
  css: a.css,
76
73
  dynamicContentList: a.dynamicContentList
77
74
  })
78
- }, { data: f } = await c(
75
+ }, { data: f } = await m(
79
76
  "/newsletter/template-library/create-template",
80
- v
77
+ C
81
78
  );
82
- if (!w(f))
79
+ if (!q(f))
83
80
  throw new Error("Unexpected create-template response");
84
- return f.type === "alert" ? (i({
85
- message: n(
81
+ return f.type === "alert" ? (l({
82
+ message: u(
86
83
  "newsletter.template-library-save-alert",
87
- { templateName: s.getTemplateName }
84
+ { templateName: o.getTemplateName }
88
85
  ),
89
- type: T.Error
90
- }), !1) : (i({
91
- message: n(
86
+ type: P.Error
87
+ }), !1) : (l({
88
+ message: u(
92
89
  "newsletter.template-library-save-success",
93
- { templateName: s.getTemplateName }
90
+ { templateName: o.getTemplateName }
94
91
  ),
95
92
  type: "success"
96
93
  }), !0);
97
- } catch (m) {
98
- return o(m, "Failed to create template"), !1;
94
+ } catch (i) {
95
+ return s(i, "Failed to create template"), !1;
99
96
  }
100
97
  }
101
98
  };
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Browsers ignore whitespace around an href, but the send-time link rewrite does not:
3
+ * a trailing space ends up inside the path and a leading one skips the tracking params.
4
+ */
5
+ export declare function trimHrefWhitespace(html: string): string;
@@ -1,4 +1,4 @@
1
- const s = "2.81.1", n = ["UIEditor.js", "zone.js", "styles-BWH3PMR4.css", "polyfills-FF3RLU5F.js", "main-5LCHF56A.js", "chunk-2HYLRI4G.js", "chunk-4SN7BSQN.js", "chunk-5IY7ZG3R.js", "chunk-62K3AMOD.js", "chunk-GK543IRH.js", "chunk-L2EPGQ76.js", "chunk-LXS5IGCQ.js", "chunk-PNWIGF4L.js", "chunk-S2TYCIH3.js", "chunk-S5UZ4LUK.js", "chunk-V2AGQPVL.js", "chunk-XZ6MUAN5.js", "chunk-ZPL4VL4O.js", "assets/css/uiEditor.css", "assets/i18n/en.json", "assets/icons/ui-editor-icons.sprite.svg", "assets/icons/ui-editor-icons.map.json", "assets/imageeditor/scripts.min.js", "assets/imageeditor/assets/icons/merged.svg"], i = {
1
+ const s = "2.83.1", n = ["UIEditor.js", "zone.js", "styles-BWH3PMR4.css", "polyfills-FF3RLU5F.js", "main-OTN2PYRT.js", "chunk-62K3AMOD.js", "chunk-6RGJBGUG.js", "chunk-6W43DTQG.js", "chunk-EC4WGEOZ.js", "chunk-GLBBUJ54.js", "chunk-GPJLJCMF.js", "chunk-MDCDEJUH.js", "chunk-P7HQTFJV.js", "chunk-PA4WGBC4.js", "chunk-QMDAV6OU.js", "chunk-R2F3ADM2.js", "chunk-YSKQ2TWF.js", "chunk-ZU5ASRKR.js", "assets/css/uiEditor.css", "assets/i18n/en.json", "assets/icons/ui-editor-icons.sprite.svg", "assets/icons/ui-editor-icons.map.json", "assets/imageeditor/scripts.min.js", "assets/imageeditor/assets/icons/merged.svg"], i = {
2
2
  version: s,
3
3
  files: n
4
4
  };
@@ -0,0 +1,10 @@
1
+ const E = /(<[a-z][\w:-]*(?:\s[^>]*?)?\shref\s*=\s*)(["'])([\s\S]*?)\2/gi, c = /^(?:\s|&nbsp;|&#160;|&#xa0;)+|(?:\s|&nbsp;|&#160;|&#xa0;)+$/gi;
2
+ function a(e) {
3
+ return !e || !/href/i.test(e) ? e : e.replace(E, (i, s, r, n) => {
4
+ const t = n.replace(c, "");
5
+ return `${s}${r}${t}${r}`;
6
+ });
7
+ }
8
+ export {
9
+ a as trimHrefWhitespace
10
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@useinsider/guido",
3
- "version": "3.23.0-beta.9b14463",
3
+ "version": "3.23.0-beta.a3a0b68",
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",
@@ -128,7 +128,7 @@
128
128
  },
129
129
  "guido": {
130
130
  "stripo": {
131
- "version": "2.81.1"
131
+ "version": "2.83.1"
132
132
  }
133
133
  }
134
134
  }