@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.
- package/dist/components/organisms/email-preview/desktop-preview/DesktopPreview.vue.js +16 -11
- package/dist/components/organisms/email-preview/mobile-preview/ContentView.vue.js +11 -11
- package/dist/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue2.js +51 -51
- package/dist/components/organisms/validation/ValidationErrorDrawer.vue.js +3 -3
- package/dist/composables/useAutoSave.js +13 -13
- package/dist/composables/useExport.js +7 -8
- package/dist/composables/useHtmlValidator.js +100 -102
- package/dist/composables/useToaster.js +10 -11
- package/dist/composables/useVersionHistoryApi.js +21 -22
- package/dist/composables/validators/useLiquidValidator.js +24 -26
- package/dist/config/migrator/itemsBlockMigrator.js +164 -161
- package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +59 -64
- package/dist/extensions/Blocks/Recommendation/templates/grid/elementRenderer.js +39 -40
- package/dist/extensions/Blocks/Recommendation/templates/list/elementRenderer.js +32 -33
- package/dist/extensions/Blocks/Recommendation/templates/utils.js +78 -79
- package/dist/extensions/Blocks/Recommendation/utils/compositionKeys.js +41 -50
- package/dist/guido.css +1 -1
- package/dist/package.json.js +4 -4
- package/dist/src/extensions/Blocks/Recommendation/utils/compositionKeys.d.ts +0 -2
- package/dist/src/stores/preview.d.ts +0 -3
- package/dist/stores/preview.js +15 -21
- package/dist/utils/pairProductVariables.js +98 -108
- package/package.json +1 -1
- package/dist/src/utils/ampPreviewSanitizer.d.ts +0 -5
- 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
|
|
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
|
|
14
|
-
import { base64EncodeWithSpecialChars as
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
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
|
|
26
|
-
return
|
|
23
|
+
function de(s, m) {
|
|
24
|
+
return m.some((f) => s.startsWith(`${f}_`));
|
|
27
25
|
}
|
|
28
|
-
const
|
|
29
|
-
function
|
|
30
|
-
const
|
|
31
|
-
return
|
|
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
|
|
34
|
-
const
|
|
31
|
+
function pe(s) {
|
|
32
|
+
const m = new Set(J);
|
|
35
33
|
return Object.values(s).forEach((f) => {
|
|
36
|
-
|
|
37
|
-
}),
|
|
34
|
+
m.add(ee(f).toLowerCase());
|
|
35
|
+
}), m;
|
|
38
36
|
}
|
|
39
|
-
function
|
|
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(
|
|
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 =
|
|
49
|
-
if (y &&
|
|
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
|
-
|
|
53
|
+
de(g, f) || g.includes(".") || E.push(g);
|
|
56
54
|
}), E;
|
|
57
55
|
}
|
|
58
|
-
function
|
|
59
|
-
return (s.replace(Y, "$1").match($) ?? []).filter((
|
|
60
|
-
const d =
|
|
61
|
-
return
|
|
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
|
|
65
|
-
const { showToaster: s } =
|
|
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
|
|
76
|
+
return pe(u.filterList);
|
|
79
77
|
}, C = async (e) => {
|
|
80
|
-
const
|
|
81
|
-
|
|
82
|
-
{ html:
|
|
83
|
-
), { status:
|
|
84
|
-
return
|
|
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:
|
|
87
|
-
}),
|
|
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:
|
|
90
|
-
}),
|
|
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
|
|
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 [
|
|
98
|
-
g(
|
|
95
|
+
const [l] = i;
|
|
96
|
+
g(l) && !t.includes(l) && (s({
|
|
99
97
|
type: c.Warning,
|
|
100
|
-
message:
|
|
101
|
-
}),
|
|
98
|
+
message: o("custom-fields.invalid-custom-fields")
|
|
99
|
+
}), r = !1);
|
|
102
100
|
}
|
|
103
|
-
}),
|
|
101
|
+
}), r;
|
|
104
102
|
}, R = async (e, t, n) => {
|
|
105
|
-
const
|
|
106
|
-
return S(e, t) &&
|
|
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:
|
|
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:
|
|
112
|
+
message: o("custom-fields.missing-closing-braces")
|
|
115
113
|
}), t < n && s({
|
|
116
114
|
type: c.Warning,
|
|
117
|
-
message:
|
|
115
|
+
message: o("custom-fields.missing-opening-braces")
|
|
118
116
|
}), t === n;
|
|
119
117
|
}, O = (e) => {
|
|
120
|
-
const t =
|
|
118
|
+
const t = Ce(e).length === 0;
|
|
121
119
|
return t || s({
|
|
122
120
|
type: c.Warning,
|
|
123
|
-
message:
|
|
121
|
+
message: o("custom-fields.invalid-custom-fields")
|
|
124
122
|
}), t;
|
|
125
|
-
}, b = (e, t, n,
|
|
123
|
+
}, b = (e, t, n, r) => {
|
|
126
124
|
if (p.value)
|
|
127
125
|
return !0;
|
|
128
|
-
const a =
|
|
126
|
+
const a = Ee(
|
|
129
127
|
e,
|
|
130
128
|
t,
|
|
131
|
-
|
|
129
|
+
ue(e),
|
|
132
130
|
n,
|
|
133
|
-
|
|
131
|
+
r
|
|
134
132
|
);
|
|
135
133
|
if (a.length > 0) {
|
|
136
134
|
const i = `
|
|
137
135
|
<ul>
|
|
138
|
-
${a.map((
|
|
136
|
+
${a.map((l) => `<li>${l}</li>`).join("")}
|
|
139
137
|
</ul>
|
|
140
138
|
`;
|
|
141
139
|
return s({
|
|
142
140
|
type: c.Error,
|
|
143
|
-
message:
|
|
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
|
|
147
|
+
let r = !0;
|
|
150
148
|
if (t && t.forEach((a) => {
|
|
151
|
-
const i = a.match(H),
|
|
152
|
-
(!i || a !== v) && !
|
|
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:
|
|
155
|
-
}),
|
|
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:
|
|
159
|
-
}),
|
|
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((
|
|
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:
|
|
170
|
-
}),
|
|
167
|
+
message: o("custom-conditions.missing-if-endif-tag")
|
|
168
|
+
}), r = !1);
|
|
171
169
|
}
|
|
172
|
-
return
|
|
170
|
+
return r;
|
|
173
171
|
}, N = (e) => {
|
|
174
|
-
const t = (e.match(/{% /gm) || []).length, n = (e.match(/ %}/gm) || []).length,
|
|
175
|
-
return
|
|
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:
|
|
178
|
-
}),
|
|
179
|
-
}, L = (e) => (e.match(/({%(.*?)%})/g) || []).filter((n) => n.includes("if")).map((n) => (n.match(/{{.*}}/gm) || []).length).reduce((n,
|
|
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:
|
|
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:
|
|
186
|
+
message: o(t ? ne : se)
|
|
189
187
|
}), !1;
|
|
190
|
-
},
|
|
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:
|
|
193
|
-
}), !1) : !0,
|
|
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:
|
|
195
|
+
message: o("newsletter.invalid-image-type")
|
|
198
196
|
}), !1);
|
|
199
197
|
}, D = (e) => {
|
|
200
|
-
const
|
|
201
|
-
return Array.from(
|
|
202
|
-
var
|
|
203
|
-
return !((
|
|
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:
|
|
204
|
+
message: o("unsubscribe-templates.select-checkbox-groups")
|
|
207
205
|
}), !1) : !0;
|
|
208
206
|
}, k = (e) => {
|
|
209
|
-
const
|
|
210
|
-
return Array.from(
|
|
211
|
-
var
|
|
212
|
-
return !((
|
|
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:
|
|
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
|
|
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,
|
|
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
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
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
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
const
|
|
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(),
|
|
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
|
|
16
|
+
function n() {
|
|
18
17
|
o(), t.hideToaster();
|
|
19
18
|
}
|
|
20
|
-
function
|
|
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}: ${
|
|
23
|
+
i({ type: T.Error, message: `${r}: ${m}` });
|
|
25
24
|
}
|
|
26
|
-
return { showToaster: i, hideToaster:
|
|
25
|
+
return { showToaster: i, hideToaster: n, handleError: a };
|
|
27
26
|
};
|
|
28
27
|
export {
|
|
29
|
-
|
|
28
|
+
p as useToaster
|
|
30
29
|
};
|
|
@@ -1,46 +1,45 @@
|
|
|
1
1
|
import { ToasterTypeOptions as t } from "../enums/toaster.js";
|
|
2
|
-
import { useVersionHistoryStore as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
|
|
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:
|
|
10
|
+
i({ type: t.Error, message: y });
|
|
12
11
|
return;
|
|
13
12
|
}
|
|
14
13
|
e(r);
|
|
15
|
-
},
|
|
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
|
-
|
|
21
|
+
o((e) => e.openVersionHistory(p, a));
|
|
23
22
|
},
|
|
24
23
|
closeVersionHistory: () => {
|
|
25
|
-
|
|
24
|
+
o((e) => e.closeVersionHistory());
|
|
26
25
|
},
|
|
27
26
|
switchToDesktopPreview: () => {
|
|
28
|
-
|
|
27
|
+
o((e) => e.switchToDesktopPreview());
|
|
29
28
|
},
|
|
30
29
|
switchToMobilePreview: () => {
|
|
31
|
-
|
|
30
|
+
o((e) => e.switchToMobilePreview());
|
|
32
31
|
},
|
|
33
32
|
previewVersion: (e) => {
|
|
34
|
-
|
|
35
|
-
const c =
|
|
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: ${
|
|
37
|
+
message: `Error compiling email: ${c}`
|
|
39
38
|
});
|
|
40
39
|
}));
|
|
41
40
|
},
|
|
42
41
|
restoreVersion: (e) => {
|
|
43
|
-
|
|
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
|
-
(
|
|
52
|
-
const c =
|
|
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: ${
|
|
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
|
-
|
|
62
|
+
d as useVersionHistoryApi
|
|
64
63
|
};
|
|
@@ -1,44 +1,42 @@
|
|
|
1
|
-
import { ToasterTypeOptions as
|
|
2
|
-
import { base64EncodeWithSpecialChars as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
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
|
|
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:
|
|
16
|
+
html: u(o),
|
|
19
17
|
ampHtml: null
|
|
20
18
|
}
|
|
21
19
|
}]);
|
|
22
|
-
if (!Array.isArray(
|
|
23
|
-
const
|
|
24
|
-
return
|
|
25
|
-
type:
|
|
26
|
-
message:
|
|
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 [
|
|
30
|
-
return n.length ? (
|
|
31
|
-
type:
|
|
32
|
-
message:
|
|
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 (
|
|
35
|
-
return
|
|
36
|
-
type:
|
|
37
|
-
message:
|
|
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
|
-
|
|
41
|
+
v as useLiquidValidator
|
|
44
42
|
};
|