@useinsider/guido 3.23.0-beta.668404b → 3.23.0-beta.7f00553

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,8 +16,6 @@ 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",
21
19
  // Image domain corrections — plain string replacement.
22
20
  "replace-old-image-domain",
23
21
  "replace-old-v2-image-domain",
@@ -1,6 +1,5 @@
1
- import { stripFontTags as c } from "../../utils/stripFontTags.js";
2
- import { trimHrefWhitespace as l } from "../../utils/trimHrefWhitespace.js";
3
- const f = [
1
+ import { stripFontTags as p } from "../../utils/stripFontTags.js";
2
+ const d = [
4
3
  {
5
4
  id: "fix-url-encoding-start",
6
5
  description: "Replace {%22 with %7B%22 to fix URL encoding",
@@ -59,16 +58,9 @@ const f = [
59
58
  id: "strip-font-tags",
60
59
  description: 'Unwrap browser-translate-injected <font dir="auto"> tags, keeping inner content; other <font> elements are left intact.',
61
60
  type: "custom",
62
- processor: (e) => c(e),
61
+ processor: (e) => p(e),
63
62
  priority: 15
64
63
  },
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
- },
72
64
  {
73
65
  id: "remove-apty-iframe",
74
66
  description: "Cleanup Apty Iframe Code",
@@ -165,8 +157,8 @@ const f = [
165
157
  processor: (e) => {
166
158
  const t = (i) => i.toString(16).padStart(2, "0");
167
159
  return e.replace(/rgb\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*\)/gi, (i, o, n, r) => {
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)}`;
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)}`;
170
162
  }).replace(/#([0-9a-f])\1([0-9a-f])\2([0-9a-f])\3\b/gi, "#$1$2$3");
171
163
  },
172
164
  priority: 44
@@ -208,5 +200,5 @@ const f = [
208
200
  }
209
201
  ];
210
202
  export {
211
- f as defaultHtmlCompilerRules
203
+ d as defaultHtmlCompilerRules
212
204
  };
@@ -1,4 +1,4 @@
1
- const o = "3.23.0-beta.668404b", s = { stripo: { version: "2.81.1" } }, t = {
1
+ const o = "3.23.0-beta.7f00553", s = { stripo: { version: "2.81.1" } }, t = {
2
2
  version: o,
3
3
  guido: s
4
4
  };
@@ -1,66 +1,70 @@
1
- import { useActionsApi as h } from "../composables/useActionsApi.js";
2
- import { useConfig as S } from "../composables/useConfig.js";
3
- import { useHttp as v } from "../composables/useHttp.js";
1
+ import { useActionsApi as v } from "../composables/useActionsApi.js";
2
+ import { useConfig as A } from "../composables/useConfig.js";
3
+ import { useHttp as E } from "../composables/useHttp.js";
4
4
  import { useToaster as x } from "../composables/useToaster.js";
5
- import { useTranslations as A } from "../composables/useTranslations.js";
6
- import { useHtmlDocumentCountValidator as E } from "../composables/validators/useHtmlDocumentCountValidator.js";
7
- import { useLiquidValidator as N } from "../composables/validators/useLiquidValidator.js";
8
- import { EditorType as H } from "../enums/defaults.js";
9
- import { ToasterTypeOptions as P } from "../enums/toaster.js";
10
- import { useRecommendationExtensionStore as D } from "../extensions/Blocks/Recommendation/store/recommendation.js";
11
- import { useSaveAsTemplateStore as L } from "../stores/save-as-template.js";
5
+ import { useTranslations as N } from "../composables/useTranslations.js";
6
+ import { useHtmlDocumentCountValidator as H } from "../composables/validators/useHtmlDocumentCountValidator.js";
7
+ import { useLiquidValidator as P } from "../composables/validators/useLiquidValidator.js";
8
+ import { EditorType as D } from "../enums/defaults.js";
9
+ import { ToasterTypeOptions as T } from "../enums/toaster.js";
10
+ import { useRecommendationExtensionStore as L } from "../extensions/Blocks/Recommendation/store/recommendation.js";
11
+ import { useSaveAsTemplateStore as q } from "../stores/save-as-template.js";
12
12
  import { base64EncodeWithSpecialChars as r } from "../utils/base64.js";
13
- import { isPlainObject as q } from "../utils/genericUtil.js";
13
+ import { isPlainObject as w } from "../utils/genericUtil.js";
14
14
  import { useTemplatePreparation as F } from "../utils/templatePreparation.js";
15
15
  const Z = () => {
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();
16
+ const { get: m, post: l } = E(), { handleError: o, showToaster: i } = x(), { config: c, isFeatureEnabled: p } = A(), { validateLiquidSyntax: b } = P(), { validateSingleHtmlDocument: h } = H(), { getTemplateData: C } = v(), u = N();
17
17
  return {
18
18
  getCategories: async () => {
19
19
  try {
20
- const { data: e = [] } = await n("/newsletter/template-library/get-template-categories");
21
- return e;
20
+ const { data: e } = await m("/newsletter/template-library/get-template-categories");
21
+ if (Array.isArray(e))
22
+ return e;
23
+ if (w(e) && e.type === "alert" && typeof e.message == "string")
24
+ return i({ message: e.message, type: T.Error }), [];
25
+ throw new Error("Unexpected get-template-categories response");
22
26
  } catch (e) {
23
- return s(e, "Failed to fetch template categories"), [];
27
+ return o(e, "Failed to fetch template categories"), [];
24
28
  }
25
29
  },
26
30
  checkTemplateNameAvailability: async (e) => {
27
- const { data: { status: t = !1 } } = await n(
31
+ const { data: { status: t = !1 } } = await m(
28
32
  `/newsletter/template-library/template-name-exists?name=${e}`
29
33
  );
30
34
  return !t;
31
35
  },
32
36
  createCategory: async (e) => {
33
37
  try {
34
- const { data: { id: t } } = await m(
38
+ const { data: { id: t } } = await l(
35
39
  "/newsletter/template-library/create-category",
36
40
  { name: e }
37
41
  );
38
42
  return t.toString();
39
43
  } catch (t) {
40
- return s(t, "Failed to create category"), "";
44
+ return o(t, "Failed to create category"), "";
41
45
  }
42
46
  },
43
47
  createTemplate: async () => {
44
48
  var e, t, d, y;
45
49
  try {
46
- const { prepareTemplateDetails: i } = F(), o = L(), g = await b();
47
- if (!w(g.html))
50
+ const { prepareTemplateDetails: n } = F(), s = q(), g = await C();
51
+ if (!h(g.html))
48
52
  return !1;
49
- const a = await i(g);
50
- if (p("liquidSyntax") && !await T(a.compiledHtml))
53
+ const a = await n(g);
54
+ if (p("liquidSyntax") && !await b(a.compiledHtml))
51
55
  return !1;
52
- const C = {
53
- name: o.getTemplateName,
54
- categories: o.getSelectedCategoryIds,
56
+ const S = {
57
+ name: s.getTemplateName,
58
+ categories: s.getSelectedCategoryIds,
55
59
  productId: ((t = (e = c.value) == null ? void 0 : e.partner) == null ? void 0 : t.productType) || 0,
56
- editorType: H,
60
+ editorType: D,
57
61
  messageType: ((y = (d = c.value) == null ? void 0 : d.partner) == null ? void 0 : y.messageType) || 0,
58
62
  content: r(a.compiledHtml),
59
63
  css: r(a.css),
60
64
  unsubscriptionPreferencePageStatus: !1,
61
65
  unsubscriptionPreferencePages: [],
62
66
  recommendationCampaignUrls: r(
63
- D().recommendationCampaignUrls
67
+ L().recommendationCampaignUrls
64
68
  ),
65
69
  recommendationConfigs: r({}),
66
70
  isGuido: !0,
@@ -72,27 +76,27 @@ const Z = () => {
72
76
  css: a.css,
73
77
  dynamicContentList: a.dynamicContentList
74
78
  })
75
- }, { data: f } = await m(
79
+ }, { data: f } = await l(
76
80
  "/newsletter/template-library/create-template",
77
- C
81
+ S
78
82
  );
79
- if (!q(f))
83
+ if (!w(f))
80
84
  throw new Error("Unexpected create-template response");
81
- return f.type === "alert" ? (l({
85
+ return f.type === "alert" ? (i({
82
86
  message: u(
83
87
  "newsletter.template-library-save-alert",
84
- { templateName: o.getTemplateName }
88
+ { templateName: s.getTemplateName }
85
89
  ),
86
- type: P.Error
87
- }), !1) : (l({
90
+ type: T.Error
91
+ }), !1) : (i({
88
92
  message: u(
89
93
  "newsletter.template-library-save-success",
90
- { templateName: o.getTemplateName }
94
+ { templateName: s.getTemplateName }
91
95
  ),
92
96
  type: "success"
93
97
  }), !0);
94
- } catch (i) {
95
- return s(i, "Failed to create template"), !1;
98
+ } catch (n) {
99
+ return o(n, "Failed to create template"), !1;
96
100
  }
97
101
  }
98
102
  };
@@ -1,6 +1,6 @@
1
1
  import { useTemplateLibraryApi as o } from "../services/templateLibraryApi.js";
2
- import { defineStore as i } from "pinia";
3
- const r = () => ({
2
+ import { defineStore as r } from "pinia";
3
+ const i = () => ({
4
4
  templateName: "",
5
5
  categories: [],
6
6
  selectedCategories: [],
@@ -17,8 +17,8 @@ const r = () => ({
17
17
  editor: 2,
18
18
  message: 1
19
19
  }
20
- }), g = i("guidoSaveAsTemplate", {
21
- state: () => r(),
20
+ }), g = r("guidoSaveAsTemplate", {
21
+ state: () => i(),
22
22
  getters: {
23
23
  getTemplateName: (e) => e.templateName.trim(),
24
24
  getSelectedCategoryIds: (e) => e.selectedCategories.map((a) => Number(a.value))
@@ -26,7 +26,7 @@ const r = () => ({
26
26
  actions: {
27
27
  async fetchCategories() {
28
28
  const { getCategories: e } = o(), a = await e();
29
- this.categories = a.map((t) => ({
29
+ this.categories = (Array.isArray(a) ? a : []).map((t) => ({
30
30
  value: t.id.toString(),
31
31
  text: t.name
32
32
  })).sort((t, s) => t.text.localeCompare(s.text));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@useinsider/guido",
3
- "version": "3.23.0-beta.668404b",
3
+ "version": "3.23.0-beta.7f00553",
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",
@@ -1,5 +0,0 @@
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,10 +0,0 @@
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
- };