@useinsider/guido 3.30.0-beta.64ede62 → 3.30.0-beta.6972d4f

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.
Files changed (25) hide show
  1. package/dist/components/organisms/email-preview/desktop-preview/DesktopPreview.vue.js +16 -11
  2. package/dist/components/organisms/email-preview/mobile-preview/ContentView.vue.js +11 -11
  3. package/dist/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue2.js +51 -51
  4. package/dist/components/organisms/validation/ValidationErrorDrawer.vue.js +3 -3
  5. package/dist/composables/useAutoSave.js +13 -13
  6. package/dist/composables/useExport.js +7 -8
  7. package/dist/composables/useHtmlValidator.js +100 -102
  8. package/dist/composables/useToaster.js +10 -11
  9. package/dist/composables/useVersionHistoryApi.js +21 -22
  10. package/dist/composables/validators/useLiquidValidator.js +24 -26
  11. package/dist/config/migrator/itemsBlockMigrator.js +164 -161
  12. package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +59 -64
  13. package/dist/extensions/Blocks/Recommendation/templates/grid/elementRenderer.js +39 -40
  14. package/dist/extensions/Blocks/Recommendation/templates/list/elementRenderer.js +32 -33
  15. package/dist/extensions/Blocks/Recommendation/templates/utils.js +78 -79
  16. package/dist/extensions/Blocks/Recommendation/utils/compositionKeys.js +41 -50
  17. package/dist/guido.css +1 -1
  18. package/dist/package.json.js +4 -4
  19. package/dist/src/extensions/Blocks/Recommendation/utils/compositionKeys.d.ts +0 -2
  20. package/dist/src/stores/preview.d.ts +0 -3
  21. package/dist/stores/preview.js +15 -21
  22. package/dist/utils/pairProductVariables.js +98 -108
  23. package/package.json +1 -1
  24. package/dist/src/utils/ampPreviewSanitizer.d.ts +0 -5
  25. package/dist/utils/ampPreviewSanitizer.js +0 -46
@@ -1,7 +1,7 @@
1
1
  import { useConfig as V } from "./useConfig.js";
2
2
  import { getIgnoredRecommendationBlockIds as M } from "../config/compiler/utils/recommendationIgnoreUtils.js";
3
3
  import { TemplateTypes as W } from "../enums/defaults.js";
4
- import { CONDITION_TAG_REGEX as G, DISPLAY_CONDITIONS_REGEX as H, DISPLAY_CONDITIONS_EXCEPTIONS_REGEX as K, CampaignCouldNotBeSavedKey as P, CanNotMakeAnyChangesForRunningKey as X, DATA_ATTRIBUTE_REGEX as Y, DYNAMIC_CONTENT_TAG_REGEX as $, ALLOWED_DYNAMIC_SYSTEM_TOKENS as j, VALID_DYNAMIC_VARIABLE_REGEX as U } from "../enums/html-validator.js";
4
+ import { CONDITION_TAG_REGEX as G, DISPLAY_CONDITIONS_REGEX as H, DISPLAY_CONDITIONS_EXCEPTIONS_REGEX as K, CampaignCouldNotBeSavedKey as X, CanNotMakeAnyChangesForRunningKey as P, DATA_ATTRIBUTE_REGEX as Y, DYNAMIC_CONTENT_TAG_REGEX as $, ALLOWED_DYNAMIC_SYSTEM_TOKENS as U, VALID_DYNAMIC_VARIABLE_REGEX as j } from "../enums/html-validator.js";
5
5
  import { ToasterTypeOptions as c } from "../enums/toaster.js";
6
6
  import { BLOCK_ROOT_SELECTOR as q } from "../extensions/Blocks/Checkbox/constants/selectors.js";
7
7
  import { itemsBlockDynamicVariables as z } from "../extensions/Blocks/Items/enums/productEnums.js";
@@ -10,59 +10,57 @@ import { RECOMMENDATION_VARIABLE_BUILTIN_ATTRIBUTES as J } from "../extensions/B
10
10
  import { useRecommendationExtensionStore as Q } from "../extensions/Blocks/Recommendation/store/recommendation.js";
11
11
  import { filterToProductAttrValue as ee } from "../extensions/Blocks/Recommendation/utils/compositionKeys.js";
12
12
  import { STRATEGY_FIELD_KEY as te, RecommendationAssignStrategyKey as ne, RecommendationRequiredFieldsKey as se } from "../extensions/Blocks/Recommendation/validation/requiredFields.js";
13
- import { useRecommendationStore as oe } from "../stores/recommendation.js";
14
- import { base64EncodeWithSpecialChars as re } from "../utils/base64.js";
15
- import { isPlainObject as ie, asText as ae } from "../utils/genericUtil.js";
16
- import { escapeHtml as ce } from "../utils/htmlEscape.js";
17
- import { computed as me } from "vue";
18
- import { useHttp as le } from "./useHttp.js";
19
- import { useToaster as ue } from "./useToaster.js";
20
- import { useTranslations as de } from "./useTranslations.js";
21
- const fe = /recommendation-id="(\d+)"/g;
22
- function ge(s) {
23
- return [...s.matchAll(fe)].map((l) => l[1]);
13
+ import { useRecommendationStore as re } from "../stores/recommendation.js";
14
+ import { base64EncodeWithSpecialChars as oe } from "../utils/base64.js";
15
+ import { computed as ie } from "vue";
16
+ import { useHttp as ae } from "./useHttp.js";
17
+ import { useToaster as ce } from "./useToaster.js";
18
+ import { useTranslations as le } from "./useTranslations.js";
19
+ const me = /recommendation-id="(\d+)"/g;
20
+ function ue(s) {
21
+ return [...s.matchAll(me)].map((m) => m[1]);
24
22
  }
25
- function pe(s, l) {
26
- return l.some((f) => s.startsWith(`${f}_`));
23
+ function de(s, m) {
24
+ return m.some((f) => s.startsWith(`${f}_`));
27
25
  }
28
- const Ee = /^(\d+)_\d+_(.+)$/;
29
- function Ce(s) {
30
- const l = s.match(Ee);
31
- return l ? { recoId: l[1], attribute: l[2] } : null;
26
+ const fe = /^(\d+)_\d+_(.+)$/;
27
+ function ge(s) {
28
+ const m = s.match(fe);
29
+ return m ? { recoId: m[1], attribute: m[2] } : null;
32
30
  }
33
- function ye(s) {
34
- const l = new Set(J);
31
+ function pe(s) {
32
+ const m = new Set(J);
35
33
  return Object.values(s).forEach((f) => {
36
- l.add(ee(f).toLowerCase());
37
- }), l;
34
+ m.add(ee(f).toLowerCase());
35
+ }), m;
38
36
  }
39
- function he(s, l, f, r, d) {
37
+ function Ee(s, m, f, o, d) {
40
38
  const u = s.match(/{{([a-zA-Z0-9_.\s]*)}}/gm);
41
39
  if (!u)
42
40
  return [];
43
- const p = new Set(l.map((C) => C.toLowerCase())), E = [];
41
+ const p = new Set(m.map((C) => C.toLowerCase())), E = [];
44
42
  return u.forEach((C) => {
45
43
  const g = C.slice(2, -2).trim().toLowerCase();
46
44
  if (g !== "" && p.has(g))
47
45
  return;
48
- const y = Ce(g);
49
- if (y && r.has(y.recoId)) {
46
+ const y = ge(g);
47
+ if (y && o.has(y.recoId)) {
50
48
  if (!d || d.has(y.attribute))
51
49
  return;
52
50
  E.push(g);
53
51
  return;
54
52
  }
55
- pe(g, f) || g.includes(".") || E.push(g);
53
+ de(g, f) || g.includes(".") || E.push(g);
56
54
  }), E;
57
55
  }
58
- function ve(s) {
59
- return (s.replace(Y, "$1").match($) ?? []).filter((r) => {
60
- const d = r.slice(2, -2), u = d.indexOf("|"), p = (u === -1 ? d : d.slice(0, u)).trim();
61
- return j.includes(p) ? !1 : U.test(p) ? u !== -1 && d.slice(u + 1).trim() === "" : !0;
56
+ function Ce(s) {
57
+ return (s.replace(Y, "$1").match($) ?? []).filter((o) => {
58
+ const d = o.slice(2, -2), u = d.indexOf("|"), p = (u === -1 ? d : d.slice(0, u)).trim();
59
+ return U.includes(p) ? !1 : j.test(p) ? u !== -1 && d.slice(u + 1).trim() === "" : !0;
62
60
  });
63
61
  }
64
- const Ke = () => {
65
- const { showToaster: s } = ue(), { post: l } = le(), { config: f } = V(), r = de(), d = oe(), u = Q(), p = me(
62
+ const Ve = () => {
63
+ const { showToaster: s } = ce(), { post: m } = ae(), { config: f } = V(), o = le(), d = re(), u = Q(), p = ie(
66
64
  () => {
67
65
  var e, t;
68
66
  return ((t = (e = f.value) == null ? void 0 : e.partner) == null ? void 0 : t.messageType) === W.transactional;
@@ -75,161 +73,161 @@ const Ke = () => {
75
73
  } catch {
76
74
  return null;
77
75
  }
78
- return ye(u.filterList);
76
+ return pe(u.filterList);
79
77
  }, C = async (e) => {
80
- const t = "/newsletter/template-library/check-template-html-body", { data: n } = await l(
81
- t,
82
- { html: re(e) }
83
- ), { status: o, message: a } = ie(n) ? n : { status: void 0, message: void 0 }, i = ae(a);
84
- return o || s({
78
+ const n = await m(
79
+ "/newsletter/template-library/check-template-html-body",
80
+ { html: oe(e) }
81
+ ), { status: r, message: a } = n.data;
82
+ return r || s({
85
83
  type: c.Error,
86
- message: o === void 0 && i !== "" ? ce(i) : r("newsletter.invalid-url-link-for-toaster")
87
- }), r(P), a === r(X) && s({
84
+ message: r === void 0 ? a : o("newsletter.invalid-url-link-for-toaster")
85
+ }), o(X), a === o(P) && s({
88
86
  type: c.Error,
89
- message: r("newsletter.already-in-progress")
90
- }), !!o;
87
+ message: o("newsletter.already-in-progress")
88
+ }), r;
91
89
  }, g = (e) => !["if", "endif", "else", "elif", "now"].includes(e.toLowerCase()), y = (e) => ["if", "endif"].includes(e.toLowerCase()), S = (e, t) => {
92
90
  const n = e.match(/({%(.*?)%})/g);
93
- let o = !0;
91
+ let r = !0;
94
92
  return n !== null && !p.value && n.forEach((a) => {
95
93
  const i = a.slice(2, -2).trim().match(/(".*?"|[^"\s]+)(?=\s*|\s*$)/g);
96
94
  if (i && i.length > 0) {
97
- const [m] = i;
98
- g(m) && !t.includes(m) && (s({
95
+ const [l] = i;
96
+ g(l) && !t.includes(l) && (s({
99
97
  type: c.Warning,
100
- message: r("custom-fields.invalid-custom-fields")
101
- }), o = !1);
98
+ message: o("custom-fields.invalid-custom-fields")
99
+ }), r = !1);
102
100
  }
103
- }), o;
101
+ }), r;
104
102
  }, R = async (e, t, n) => {
105
- const o = n ? await C(e) : !0;
106
- return S(e, t) && o;
103
+ const r = n ? await C(e) : !0;
104
+ return S(e, t) && r;
107
105
  }, _ = (e) => e.length > 0 ? !0 : (s({
108
106
  type: c.Warning,
109
- message: r("newsletter.html-content-is-empty")
107
+ message: o("newsletter.html-content-is-empty")
110
108
  }), !1), A = (e) => {
111
109
  const t = (e.match(/{/gm) || []).length, n = (e.match(/}/gm) || []).length;
112
110
  return t > n && s({
113
111
  type: c.Warning,
114
- message: r("custom-fields.missing-closing-braces")
112
+ message: o("custom-fields.missing-closing-braces")
115
113
  }), t < n && s({
116
114
  type: c.Warning,
117
- message: r("custom-fields.missing-opening-braces")
115
+ message: o("custom-fields.missing-opening-braces")
118
116
  }), t === n;
119
117
  }, O = (e) => {
120
- const t = ve(e).length === 0;
118
+ const t = Ce(e).length === 0;
121
119
  return t || s({
122
120
  type: c.Warning,
123
- message: r("custom-fields.invalid-custom-fields")
121
+ message: o("custom-fields.invalid-custom-fields")
124
122
  }), t;
125
- }, b = (e, t, n, o) => {
123
+ }, b = (e, t, n, r) => {
126
124
  if (p.value)
127
125
  return !0;
128
- const a = he(
126
+ const a = Ee(
129
127
  e,
130
128
  t,
131
- ge(e),
129
+ ue(e),
132
130
  n,
133
- o
131
+ r
134
132
  );
135
133
  if (a.length > 0) {
136
134
  const i = `
137
135
  <ul>
138
- ${a.map((m) => `<li>${m}</li>`).join("")}
136
+ ${a.map((l) => `<li>${l}</li>`).join("")}
139
137
  </ul>
140
138
  `;
141
139
  return s({
142
140
  type: c.Error,
143
- message: r("custom-fields.invalid-custom-fields") + i
141
+ message: o("custom-fields.invalid-custom-fields") + i
144
142
  }), !1;
145
143
  }
146
144
  return !0;
147
145
  }, w = (e) => {
148
146
  const t = e.match(G), n = [];
149
- let o = !0;
147
+ let r = !0;
150
148
  if (t && t.forEach((a) => {
151
- const i = a.match(H), m = a.match(K), v = (i == null ? void 0 : i.join("")) || "";
152
- (!i || a !== v) && !m && (s({
149
+ const i = a.match(H), l = a.match(K), v = (i == null ? void 0 : i.join("")) || "";
150
+ (!i || a !== v) && !l && (s({
153
151
  type: c.Error,
154
- message: r("newsletter.display-conditions-invalid-syntax")
155
- }), o = !1), i && i.forEach((h) => {
152
+ message: o("newsletter.display-conditions-invalid-syntax")
153
+ }), r = !1), i && i.forEach((h) => {
156
154
  h.trim() === "=" && (s({
157
155
  type: c.Error,
158
- message: r("custom-conditions.wrong-equality-operators")
159
- }), o = !1);
156
+ message: o("custom-conditions.wrong-equality-operators")
157
+ }), r = !1);
160
158
  const T = h.match(/^[a-zA-Z]*$/g);
161
159
  T && T.forEach((I) => {
162
160
  y(I) && n.push(I);
163
161
  });
164
162
  });
165
163
  }), n.length) {
166
- const a = n.filter((m) => m === "if"), i = n.filter((m) => m === "endif");
164
+ const a = n.filter((l) => l === "if"), i = n.filter((l) => l === "endif");
167
165
  a.length !== i.length && (s({
168
166
  type: c.Error,
169
- message: r("custom-conditions.missing-if-endif-tag")
170
- }), o = !1);
167
+ message: o("custom-conditions.missing-if-endif-tag")
168
+ }), r = !1);
171
169
  }
172
- return o;
170
+ return r;
173
171
  }, N = (e) => {
174
- const t = (e.match(/{% /gm) || []).length, n = (e.match(/ %}/gm) || []).length, o = t === n;
175
- return o || s({
172
+ const t = (e.match(/{% /gm) || []).length, n = (e.match(/ %}/gm) || []).length, r = t === n;
173
+ return r || s({
176
174
  type: c.Warning,
177
- message: r("custom-conditions.no-space-after-braces")
178
- }), o;
179
- }, L = (e) => (e.match(/({%(.*?)%})/g) || []).filter((n) => n.includes("if")).map((n) => (n.match(/{{.*}}/gm) || []).length).reduce((n, o) => n + o, 0) > 0 ? (s({
175
+ message: o("custom-conditions.no-space-after-braces")
176
+ }), r;
177
+ }, L = (e) => (e.match(/({%(.*?)%})/g) || []).filter((n) => n.includes("if")).map((n) => (n.match(/{{.*}}/gm) || []).length).reduce((n, r) => n + r, 0) > 0 ? (s({
180
178
  type: c.Warning,
181
- message: r("custom-conditions.no-braces-inside-if-tag")
179
+ message: o("custom-conditions.no-braces-inside-if-tag")
182
180
  }), !1) : !0, B = () => {
183
181
  if (!u.hasInvalidBlock())
184
182
  return !0;
185
183
  const e = u.invalidBlockFields(), t = e.length > 0 && e.every((n) => n === te);
186
184
  return s({
187
185
  type: t ? c.Warning : c.Error,
188
- message: r(t ? ne : se)
186
+ message: o(t ? ne : se)
189
187
  }), !1;
190
- }, x = () => d.recommendationConfigs && Object.values(d.recommendationConfigs).find((t) => t.filters.find((n) => n.value === "")) !== void 0 ? (s({
188
+ }, F = () => d.recommendationConfigs && Object.values(d.recommendationConfigs).find((t) => t.filters.find((n) => n.value === "")) !== void 0 ? (s({
191
189
  type: c.Error,
192
- message: r("newsletter.fill-all-necessary-fields")
193
- }), !1) : !0, F = (e) => {
190
+ message: o("newsletter.fill-all-necessary-fields")
191
+ }), !1) : !0, x = (e) => {
194
192
  const t = /src="[^"]*\.(svg|pst)"/gm;
195
193
  return e.match(t) === null ? !0 : (s({
196
194
  type: c.Error,
197
- message: r("newsletter.invalid-image-type")
195
+ message: o("newsletter.invalid-image-type")
198
196
  }), !1);
199
197
  }, D = (e) => {
200
- const o = new DOMParser().parseFromString(e, "text/html").querySelectorAll(q);
201
- return Array.from(o).find((i) => {
202
- var m;
203
- return !((m = i.id) != null && m.trim());
198
+ const r = new DOMParser().parseFromString(e, "text/html").querySelectorAll(q);
199
+ return Array.from(r).find((i) => {
200
+ var l;
201
+ return !((l = i.id) != null && l.trim());
204
202
  }) ? (s({
205
203
  type: c.Error,
206
- message: r("unsubscribe-templates.select-checkbox-groups")
204
+ message: o("unsubscribe-templates.select-checkbox-groups")
207
205
  }), !1) : !0;
208
206
  }, k = (e) => {
209
- const o = new DOMParser().parseFromString(e, "text/html").querySelectorAll(Z);
210
- return Array.from(o).find((i) => {
211
- var m;
212
- return !((m = i.id) != null && m.trim());
207
+ const r = new DOMParser().parseFromString(e, "text/html").querySelectorAll(Z);
208
+ return Array.from(r).find((i) => {
209
+ var l;
210
+ return !((l = i.id) != null && l.trim());
213
211
  }) ? (s({
214
212
  type: c.Error,
215
- message: r("unsubscribe-templates.select-radio-button-groups")
213
+ message: o("unsubscribe-templates.select-radio-button-groups")
216
214
  }), !1) : !0;
217
215
  };
218
216
  return { validateHtml: async (e, t, n = !1) => {
219
217
  var v, h;
220
- const o = [
218
+ const r = [
221
219
  ...t.map((T) => T.value),
222
220
  ...z,
223
221
  ...((h = (v = f.value) == null ? void 0 : v.template) == null ? void 0 : h.customFieldAttributes) ?? []
224
222
  ], a = M(e), i = await E(a);
225
- return await R(e, o, n) && _(e) && A(e) && O(e) && b(e, o, a, i) && w(e) && N(e) && L(e) && B() && x() && F(e) && D(e) && k(e);
223
+ return await R(e, r, n) && _(e) && A(e) && O(e) && b(e, r, a, i) && w(e) && N(e) && L(e) && B() && F() && x(e) && D(e) && k(e);
226
224
  } };
227
225
  };
228
226
  export {
229
- ye as buildPartnerAttributeNameSet,
230
- he as findInvalidCustomFields,
231
- ve as getInvalidDynamicContentTags,
232
- ge as getRecommendationBlockIds,
233
- Ce as parseRecommendationVariable,
234
- Ke as useHtmlValidator
227
+ pe as buildPartnerAttributeNameSet,
228
+ Ee as findInvalidCustomFields,
229
+ Ce as getInvalidDynamicContentTags,
230
+ ue as getRecommendationBlockIds,
231
+ ge as parseRecommendationVariable,
232
+ Ve as useHtmlValidator
235
233
  };
@@ -1,30 +1,29 @@
1
1
  import { ToasterTypeOptions as T } from "../enums/toaster.js";
2
- import { useToasterStore as c } from "../stores/toaster.js";
3
- import { escapeHtml as u } from "../utils/htmlEscape.js";
4
- import { nextTick as d } from "vue";
5
- const s = /* @__PURE__ */ new WeakMap(), l = () => {
6
- const t = c(), o = () => {
2
+ import { useToasterStore as u } from "../stores/toaster.js";
3
+ import { nextTick as c } from "vue";
4
+ const s = /* @__PURE__ */ new WeakMap(), p = () => {
5
+ const t = u(), o = () => {
7
6
  const e = s.get(t);
8
7
  e && (clearTimeout(e), s.delete(t));
9
8
  };
10
9
  function i(e = { message: "" }) {
11
- o(), t.hideToaster(), d(() => {
10
+ o(), t.hideToaster(), c(() => {
12
11
  t.showToaster(e), t.shouldAutoHide && s.set(t, setTimeout(() => {
13
12
  t.hideToaster(), o();
14
13
  }, 6e3));
15
14
  });
16
15
  }
17
- function a() {
16
+ function n() {
18
17
  o(), t.hideToaster();
19
18
  }
20
- function n(e, r) {
19
+ function a(e, r) {
21
20
  if (e != null && e.authReported)
22
21
  return;
23
22
  const m = e instanceof Error ? e.message : String(e);
24
- i({ type: T.Error, message: `${r}: ${u(m)}` });
23
+ i({ type: T.Error, message: `${r}: ${m}` });
25
24
  }
26
- return { showToaster: i, hideToaster: a, handleError: n };
25
+ return { showToaster: i, hideToaster: n, handleError: a };
27
26
  };
28
27
  export {
29
- l as useToaster
28
+ p as useToaster
30
29
  };
@@ -1,46 +1,45 @@
1
1
  import { ToasterTypeOptions as t } from "../enums/toaster.js";
2
- import { useVersionHistoryStore as w } from "../stores/version-history.js";
3
- import { escapeHtml as p } from "../utils/htmlEscape.js";
4
- import { findEditorApi as y, EDITOR_NOT_READY_MESSAGE as V } from "../utils/stripoEditorApi.js";
5
- import { useToaster as l } from "./useToaster.js";
6
- const P = () => {
7
- const n = w(), { showToaster: i } = l(), s = (e) => {
8
- var o;
9
- const r = (o = y()) == null ? void 0 : o.versionHistoryApi;
2
+ import { useVersionHistoryStore as m } from "../stores/version-history.js";
3
+ import { findEditorApi as w, EDITOR_NOT_READY_MESSAGE as y } from "../utils/stripoEditorApi.js";
4
+ import { useToaster as V } from "./useToaster.js";
5
+ const d = () => {
6
+ const n = m(), { showToaster: i } = V(), o = (e) => {
7
+ var s;
8
+ const r = (s = w()) == null ? void 0 : s.versionHistoryApi;
10
9
  if (!r) {
11
- i({ type: t.Error, message: V });
10
+ i({ type: t.Error, message: y });
12
11
  return;
13
12
  }
14
13
  e(r);
15
- }, m = (e) => {
14
+ }, p = (e) => {
16
15
  n.$reset(), n.updateState(e);
17
16
  }, a = () => {
18
17
  n.$reset();
19
18
  };
20
19
  return {
21
20
  openVersionHistory: () => {
22
- s((e) => e.openVersionHistory(m, a));
21
+ o((e) => e.openVersionHistory(p, a));
23
22
  },
24
23
  closeVersionHistory: () => {
25
- s((e) => e.closeVersionHistory());
24
+ o((e) => e.closeVersionHistory());
26
25
  },
27
26
  switchToDesktopPreview: () => {
28
- s((e) => e.switchToDesktopPreview());
27
+ o((e) => e.switchToDesktopPreview());
29
28
  },
30
29
  switchToMobilePreview: () => {
31
- s((e) => e.switchToMobilePreview());
30
+ o((e) => e.switchToMobilePreview());
32
31
  },
33
32
  previewVersion: (e) => {
34
- s((r) => r.previewVersion(e, (o) => {
35
- const c = o instanceof Error ? o.message : String(o);
33
+ o((r) => r.previewVersion(e, (s) => {
34
+ const c = s instanceof Error ? s.message : String(s);
36
35
  i({
37
36
  type: t.Error,
38
- message: `Error compiling email: ${p(c)}`
37
+ message: `Error compiling email: ${c}`
39
38
  });
40
39
  }));
41
40
  },
42
41
  restoreVersion: (e) => {
43
- s((r) => r.restoreVersion(
42
+ o((r) => r.restoreVersion(
44
43
  e,
45
44
  () => {
46
45
  i({
@@ -48,11 +47,11 @@ const P = () => {
48
47
  message: "Your version has been restored successfully."
49
48
  });
50
49
  },
51
- (o) => {
52
- const c = o instanceof Error ? o.message : String(o);
50
+ (s) => {
51
+ const c = s instanceof Error ? s.message : String(s);
53
52
  i({
54
53
  type: t.Error,
55
- message: `Error compiling email: ${p(c)}`
54
+ message: `Error compiling email: ${c}`
56
55
  });
57
56
  }
58
57
  ));
@@ -60,5 +59,5 @@ const P = () => {
60
59
  };
61
60
  };
62
61
  export {
63
- P as useVersionHistoryApi
62
+ d as useVersionHistoryApi
64
63
  };
@@ -1,44 +1,42 @@
1
- import { ToasterTypeOptions as s } from "../../enums/toaster.js";
2
- import { base64EncodeWithSpecialChars as d } from "../../utils/base64.js";
3
- import { asText as m } from "../../utils/genericUtil.js";
4
- import { escapeHtml as o } from "../../utils/htmlEscape.js";
5
- import { useHttp as p } from "../useHttp.js";
6
- import { useToaster as c } from "../useToaster.js";
7
- import { useTranslations as f } from "../useTranslations.js";
8
- const j = () => {
9
- const { post: l } = p(), { showToaster: a } = c(), i = f();
10
- return { validateLiquidSyntax: async (u) => {
1
+ import { ToasterTypeOptions as r } from "../../enums/toaster.js";
2
+ import { base64EncodeWithSpecialChars as u } from "../../utils/base64.js";
3
+ import { useHttp as d } from "../useHttp.js";
4
+ import { useToaster as p } from "../useToaster.js";
5
+ import { useTranslations as c } from "../useTranslations.js";
6
+ const v = () => {
7
+ const { post: i } = d(), { showToaster: t } = p(), s = c();
8
+ return { validateLiquidSyntax: async (o) => {
11
9
  try {
12
- const t = await l("/newsletter/contents/validate-syntax", [{
10
+ const e = await i("/newsletter/contents/validate-syntax", [{
13
11
  identifier: "default",
14
12
  syntax: "liquid",
15
13
  contents: {
16
14
  subject: null,
17
15
  preheader: null,
18
- html: d(u),
16
+ html: u(o),
19
17
  ampHtml: null
20
18
  }
21
19
  }]);
22
- if (!Array.isArray(t.data)) {
23
- const e = t.data;
24
- return a({
25
- type: s.Warning,
26
- message: typeof (e == null ? void 0 : e.message) == "string" ? o(e.message) : i("journey-builder.liquid-validation-failed")
20
+ if (!Array.isArray(e.data)) {
21
+ const l = e.data;
22
+ return t({
23
+ type: r.Warning,
24
+ message: l.message ?? s("journey-builder.liquid-validation-failed")
27
25
  }), !1;
28
26
  }
29
- const [r] = t.data, n = Object.values((r == null ? void 0 : r.errors) ?? {});
30
- return n.length ? (a({
31
- type: s.Warning,
32
- message: o(m(n[0]).replace(/^line \d+:\s*/, ""))
27
+ const [a] = e.data, n = Object.values((a == null ? void 0 : a.errors) ?? {});
28
+ return n.length ? (t({
29
+ type: r.Warning,
30
+ message: n[0].replace(/^line \d+:\s*/, "")
33
31
  }), !1) : !0;
34
- } catch (t) {
35
- return t != null && t.authReported || a({
36
- type: s.Error,
37
- message: i("journey-builder.liquid-validation-failed")
32
+ } catch (e) {
33
+ return e != null && e.authReported || t({
34
+ type: r.Error,
35
+ message: s("journey-builder.liquid-validation-failed")
38
36
  }), !1;
39
37
  }
40
38
  } };
41
39
  };
42
40
  export {
43
- j as useLiquidValidator
41
+ v as useLiquidValidator
44
42
  };