@useinsider/guido 3.27.1-beta.7722b9b → 3.27.1-beta.95af24c

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,14 +1,15 @@
1
- import { defaultHtmlCompilerRules as d } from "../config/compiler/htmlCompilerRules.js";
2
- import { itemsCompilerRules as f } from "../config/compiler/itemsCompilerRules.js";
1
+ import { defaultHtmlCompilerRules as f } from "../config/compiler/htmlCompilerRules.js";
2
+ import { itemsCompilerRules as d } from "../config/compiler/itemsCompilerRules.js";
3
3
  import { liquidCompilerRules as g } from "../config/compiler/liquidCompilerRules.js";
4
4
  import { outlookCompilerRules as R } from "../config/compiler/outlookCompilerRules.js";
5
- import { recommendationCompilerRules as v } from "../config/compiler/recommendationCompilerRules.js";
5
+ import { pongoCompilerRules as v } from "../config/compiler/pongoCompilerRules.js";
6
+ import { recommendationCompilerRules as C } from "../config/compiler/recommendationCompilerRules.js";
6
7
  import { socialCompilerRules as H } from "../config/compiler/socialCompilerRules.js";
7
8
  import { unsubscribeCompilerRules as b } from "../config/compiler/unsubscribeCompilerRules.js";
8
9
  import { createHtmlCompiler as n } from "../utils/htmlCompiler.js";
9
10
  import { computed as p } from "vue";
10
- import { useConfig as C } from "./useConfig.js";
11
- const x = /* @__PURE__ */ new Set([
11
+ import { useConfig as x } from "./useConfig.js";
12
+ const A = /* @__PURE__ */ new Set([
12
13
  // URL/tag encoding fixes — keep merge-tag and placeholder integrity intact.
13
14
  "fix-url-encoding-start",
14
15
  "fix-url-encoding-end",
@@ -30,21 +31,23 @@ const x = /* @__PURE__ */ new Set([
30
31
  "add-universal-link-flags",
31
32
  // Coupon placeholder replacement (only present when liquidSyntax is enabled).
32
33
  "liquid-coupon-code",
34
+ // Pongo only: collapses line breaks inside {% %} tags, which pongo2 cannot parse in AMP either.
35
+ "pongo-single-line-tags",
33
36
  // Editor-only attribute strip — AMP4EMAIL has no `contenteditable`, so leaving
34
37
  // it in narrows/breaks rendering. Pure attribute removal, emits nothing.
35
38
  "remove-contenteditable"
36
- ]), I = () => {
37
- const { compiler: i, isFeatureEnabled: u, partner: a } = C(), c = p(() => {
39
+ ]), M = () => {
40
+ const { compiler: i, isFeatureEnabled: u, partner: a } = x(), c = p(() => {
38
41
  var m, l;
39
42
  const e = ((m = i.value) == null ? void 0 : m.customRules) || [];
40
43
  return [
41
- ...!!((l = i.value) != null && l.ignoreDefaultRules) ? [] : d,
42
- ...v,
44
+ ...!!((l = i.value) != null && l.ignoreDefaultRules) ? [] : f,
45
+ ...C,
43
46
  ...b,
44
- ...f,
47
+ ...d,
45
48
  ...R,
46
49
  ...H,
47
- ...u("liquidSyntax") ? g : [],
50
+ ...u("liquidSyntax") ? g : v,
48
51
  ...e.map((t, o) => ({
49
52
  ...t,
50
53
  priority: t.priority + 1e3 + o
@@ -53,7 +56,7 @@ const x = /* @__PURE__ */ new Set([
53
56
  ];
54
57
  }), r = p(() => {
55
58
  var t;
56
- const e = c.value, s = n(e), m = n(e.filter((o) => x.has(o.id))), l = (t = a.value) == null ? void 0 : t.fallbackFont;
59
+ const e = c.value, s = n(e), m = n(e.filter((o) => A.has(o.id))), l = (t = a.value) == null ? void 0 : t.fallbackFont;
57
60
  return {
58
61
  compileHtml: (o) => s.compile(o, void 0, l),
59
62
  compileAmpHtml: (o) => m.compile(o, void 0, l)
@@ -62,5 +65,5 @@ const x = /* @__PURE__ */ new Set([
62
65
  return { compileHtml: (e) => r.value.compileHtml(e), compileAmpHtml: (e) => r.value.compileAmpHtml(e) };
63
66
  };
64
67
  export {
65
- I as useHtmlCompiler
68
+ M as useHtmlCompiler
66
69
  };
@@ -1,66 +1,66 @@
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 { DISPLAY_CONDITIONS_REGEX as G, DISPLAY_CONDITIONS_EXCEPTIONS_REGEX as H, CampaignCouldNotBeSavedKey as K, CanNotMakeAnyChangesForRunningKey as P, DATA_ATTRIBUTE_REGEX as X, DYNAMIC_CONTENT_TAG_REGEX as Y, ALLOWED_DYNAMIC_SYSTEM_TOKENS as $, 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
- import { BLOCK_ROOT_SELECTOR as j } from "../extensions/Blocks/Checkbox/constants/selectors.js";
7
- import { itemsBlockDynamicVariables as q } from "../extensions/Blocks/Items/enums/productEnums.js";
8
- import { BLOCK_ROOT_SELECTOR as z } from "../extensions/Blocks/RadioButton/constants/selectors.js";
9
- import { RECOMMENDATION_VARIABLE_BUILTIN_ATTRIBUTES as Z } from "../extensions/Blocks/Recommendation/constants/selectors.js";
10
- import { useRecommendationExtensionStore as J } from "../extensions/Blocks/Recommendation/store/recommendation.js";
11
- import { filterToProductAttrValue as Q } from "../extensions/Blocks/Recommendation/utils/compositionKeys.js";
12
- import { STRATEGY_FIELD_KEY as ee, RecommendationAssignStrategyKey as te, RecommendationRequiredFieldsKey as ne } from "../extensions/Blocks/Recommendation/validation/requiredFields.js";
13
- import { useRecommendationStore as se } from "../stores/recommendation.js";
14
- import { base64EncodeWithSpecialChars as re } from "../utils/base64.js";
15
- import { computed as oe } from "vue";
16
- import { useHttp as ie } from "./useHttp.js";
17
- import { useToaster as ae } from "./useToaster.js";
18
- import { useTranslations as ce } from "./useTranslations.js";
19
- const le = /recommendation-id="(\d+)"/g;
20
- function me(s) {
21
- return [...s.matchAll(le)].map((m) => m[1]);
6
+ import { BLOCK_ROOT_SELECTOR as q } from "../extensions/Blocks/Checkbox/constants/selectors.js";
7
+ import { itemsBlockDynamicVariables as z } from "../extensions/Blocks/Items/enums/productEnums.js";
8
+ import { BLOCK_ROOT_SELECTOR as Z } from "../extensions/Blocks/RadioButton/constants/selectors.js";
9
+ import { RECOMMENDATION_VARIABLE_BUILTIN_ATTRIBUTES as J } from "../extensions/Blocks/Recommendation/constants/selectors.js";
10
+ import { useRecommendationExtensionStore as Q } from "../extensions/Blocks/Recommendation/store/recommendation.js";
11
+ import { filterToProductAttrValue as ee } from "../extensions/Blocks/Recommendation/utils/compositionKeys.js";
12
+ import { STRATEGY_FIELD_KEY as te, RecommendationAssignStrategyKey as ne, RecommendationRequiredFieldsKey as se } from "../extensions/Blocks/Recommendation/validation/requiredFields.js";
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]);
22
22
  }
23
- function ue(s, m) {
23
+ function de(s, m) {
24
24
  return m.some((f) => s.startsWith(`${f}_`));
25
25
  }
26
- const de = /^(\d+)_\d+_(.+)$/;
27
- function fe(s) {
28
- const m = s.match(de);
26
+ const fe = /^(\d+)_\d+_(.+)$/;
27
+ function ge(s) {
28
+ const m = s.match(fe);
29
29
  return m ? { recoId: m[1], attribute: m[2] } : null;
30
30
  }
31
- function ge(s) {
32
- const m = new Set(Z);
31
+ function pe(s) {
32
+ const m = new Set(J);
33
33
  return Object.values(s).forEach((f) => {
34
- m.add(Q(f).toLowerCase());
34
+ m.add(ee(f).toLowerCase());
35
35
  }), m;
36
36
  }
37
- function pe(s, m, f, o, d) {
37
+ function Ee(s, m, f, o, d) {
38
38
  const u = s.match(/{{([a-zA-Z0-9_.\s]*)}}/gm);
39
39
  if (!u)
40
40
  return [];
41
- const p = new Set(m.map((y) => y.toLowerCase())), E = [];
42
- return u.forEach((y) => {
43
- const g = y.slice(2, -2).trim().toLowerCase();
41
+ const p = new Set(m.map((C) => C.toLowerCase())), E = [];
42
+ return u.forEach((C) => {
43
+ const g = C.slice(2, -2).trim().toLowerCase();
44
44
  if (g !== "" && p.has(g))
45
45
  return;
46
- const C = fe(g);
47
- if (C && o.has(C.recoId)) {
48
- if (!d || d.has(C.attribute))
46
+ const y = ge(g);
47
+ if (y && o.has(y.recoId)) {
48
+ if (!d || d.has(y.attribute))
49
49
  return;
50
50
  E.push(g);
51
51
  return;
52
52
  }
53
- ue(g, f) || g.includes(".") || E.push(g);
53
+ de(g, f) || g.includes(".") || E.push(g);
54
54
  }), E;
55
55
  }
56
- function Ee(s) {
57
- return (s.replace(X, "$1").match(Y) ?? []).filter((o) => {
56
+ function Ce(s) {
57
+ return (s.replace(Y, "$1").match($) ?? []).filter((o) => {
58
58
  const d = o.slice(2, -2), u = d.indexOf("|"), p = (u === -1 ? d : d.slice(0, u)).trim();
59
- return $.includes(p) ? !1 : U.test(p) ? u !== -1 && d.slice(u + 1).trim() === "" : !0;
59
+ return U.includes(p) ? !1 : j.test(p) ? u !== -1 && d.slice(u + 1).trim() === "" : !0;
60
60
  });
61
61
  }
62
- const ke = () => {
63
- const { showToaster: s } = ae(), { post: m } = ie(), { config: f } = V(), o = ce(), d = se(), u = J(), p = oe(
62
+ const Ve = () => {
63
+ const { showToaster: s } = ce(), { post: m } = ae(), { config: f } = V(), o = le(), d = re(), u = Q(), p = ie(
64
64
  () => {
65
65
  var e, t;
66
66
  return ((t = (e = f.value) == null ? void 0 : e.partner) == null ? void 0 : t.messageType) === W.transactional;
@@ -73,20 +73,20 @@ const ke = () => {
73
73
  } catch {
74
74
  return null;
75
75
  }
76
- return ge(u.filterList);
77
- }, y = async (e) => {
76
+ return pe(u.filterList);
77
+ }, C = async (e) => {
78
78
  const n = await m(
79
79
  "/newsletter/template-library/check-template-html-body",
80
- { html: re(e) }
80
+ { html: oe(e) }
81
81
  ), { status: r, message: a } = n.data;
82
82
  return r || s({
83
83
  type: c.Error,
84
84
  message: r === void 0 ? a : o("newsletter.invalid-url-link-for-toaster")
85
- }), o(K), a === o(P) && s({
85
+ }), o(X), a === o(P) && s({
86
86
  type: c.Error,
87
87
  message: o("newsletter.already-in-progress")
88
88
  }), r;
89
- }, g = (e) => !["if", "endif", "else", "elif", "now"].includes(e.toLowerCase()), C = (e) => ["if", "endif"].includes(e.toLowerCase()), I = (e, t) => {
89
+ }, g = (e) => !["if", "endif", "else", "elif", "now"].includes(e.toLowerCase()), y = (e) => ["if", "endif"].includes(e.toLowerCase()), S = (e, t) => {
90
90
  const n = e.match(/({%(.*?)%})/g);
91
91
  let r = !0;
92
92
  return n !== null && !p.value && n.forEach((a) => {
@@ -100,12 +100,12 @@ const ke = () => {
100
100
  }
101
101
  }), r;
102
102
  }, R = async (e, t, n) => {
103
- const r = n ? await y(e) : !0;
104
- return I(e, t) && r;
105
- }, A = (e) => e.length > 0 ? !0 : (s({
103
+ const r = n ? await C(e) : !0;
104
+ return S(e, t) && r;
105
+ }, _ = (e) => e.length > 0 ? !0 : (s({
106
106
  type: c.Warning,
107
107
  message: o("newsletter.html-content-is-empty")
108
- }), !1), _ = (e) => {
108
+ }), !1), A = (e) => {
109
109
  const t = (e.match(/{/gm) || []).length, n = (e.match(/}/gm) || []).length;
110
110
  return t > n && s({
111
111
  type: c.Warning,
@@ -114,19 +114,19 @@ const ke = () => {
114
114
  type: c.Warning,
115
115
  message: o("custom-fields.missing-opening-braces")
116
116
  }), t === n;
117
- }, b = (e) => {
118
- const t = Ee(e).length === 0;
117
+ }, O = (e) => {
118
+ const t = Ce(e).length === 0;
119
119
  return t || s({
120
120
  type: c.Warning,
121
121
  message: o("custom-fields.invalid-custom-fields")
122
122
  }), t;
123
- }, O = (e, t, n, r) => {
123
+ }, b = (e, t, n, r) => {
124
124
  if (p.value)
125
125
  return !0;
126
- const a = pe(
126
+ const a = Ee(
127
127
  e,
128
128
  t,
129
- me(e),
129
+ ue(e),
130
130
  n,
131
131
  r
132
132
  );
@@ -143,10 +143,10 @@ const ke = () => {
143
143
  }
144
144
  return !0;
145
145
  }, w = (e) => {
146
- const t = e.match(/{%(.*?)%}/g), n = [];
146
+ const t = e.match(G), n = [];
147
147
  let r = !0;
148
148
  if (t && t.forEach((a) => {
149
- const i = a.match(G), l = a.match(H), v = (i == null ? void 0 : i.join("")) || "";
149
+ const i = a.match(H), l = a.match(K), v = (i == null ? void 0 : i.join("")) || "";
150
150
  (!i || a !== v) && !l && (s({
151
151
  type: c.Error,
152
152
  message: o("newsletter.display-conditions-invalid-syntax")
@@ -155,9 +155,9 @@ const ke = () => {
155
155
  type: c.Error,
156
156
  message: o("custom-conditions.wrong-equality-operators")
157
157
  }), r = !1);
158
- const S = h.match(/^[a-zA-Z]*$/g);
159
- S && S.forEach((T) => {
160
- C(T) && n.push(T);
158
+ const T = h.match(/^[a-zA-Z]*$/g);
159
+ T && T.forEach((I) => {
160
+ y(I) && n.push(I);
161
161
  });
162
162
  });
163
163
  }), n.length) {
@@ -168,22 +168,22 @@ const ke = () => {
168
168
  }), r = !1);
169
169
  }
170
170
  return r;
171
- }, L = (e) => {
171
+ }, N = (e) => {
172
172
  const t = (e.match(/{% /gm) || []).length, n = (e.match(/ %}/gm) || []).length, r = t === n;
173
173
  return r || s({
174
174
  type: c.Warning,
175
175
  message: o("custom-conditions.no-space-after-braces")
176
176
  }), r;
177
- }, N = (e) => (e.match(/({%(.*?)%})/g) || []).filter((n) => n.includes("if")).map((n) => (n.match(/{{.*}}/gm) || []).length).reduce((n, r) => n + r, 0) > 0 ? (s({
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({
178
178
  type: c.Warning,
179
179
  message: o("custom-conditions.no-braces-inside-if-tag")
180
180
  }), !1) : !0, B = () => {
181
181
  if (!u.hasInvalidBlock())
182
182
  return !0;
183
- const e = u.invalidBlockFields(), t = e.length > 0 && e.every((n) => n === ee);
183
+ const e = u.invalidBlockFields(), t = e.length > 0 && e.every((n) => n === te);
184
184
  return s({
185
185
  type: t ? c.Warning : c.Error,
186
- message: o(t ? te : ne)
186
+ message: o(t ? ne : se)
187
187
  }), !1;
188
188
  }, F = () => d.recommendationConfigs && Object.values(d.recommendationConfigs).find((t) => t.filters.find((n) => n.value === "")) !== void 0 ? (s({
189
189
  type: c.Error,
@@ -195,7 +195,7 @@ const ke = () => {
195
195
  message: o("newsletter.invalid-image-type")
196
196
  }), !1);
197
197
  }, D = (e) => {
198
- const r = new DOMParser().parseFromString(e, "text/html").querySelectorAll(j);
198
+ const r = new DOMParser().parseFromString(e, "text/html").querySelectorAll(q);
199
199
  return Array.from(r).find((i) => {
200
200
  var l;
201
201
  return !((l = i.id) != null && l.trim());
@@ -204,7 +204,7 @@ const ke = () => {
204
204
  message: o("unsubscribe-templates.select-checkbox-groups")
205
205
  }), !1) : !0;
206
206
  }, k = (e) => {
207
- const r = new DOMParser().parseFromString(e, "text/html").querySelectorAll(z);
207
+ const r = new DOMParser().parseFromString(e, "text/html").querySelectorAll(Z);
208
208
  return Array.from(r).find((i) => {
209
209
  var l;
210
210
  return !((l = i.id) != null && l.trim());
@@ -216,18 +216,18 @@ const ke = () => {
216
216
  return { validateHtml: async (e, t, n = !1) => {
217
217
  var v, h;
218
218
  const r = [
219
- ...t.map((S) => S.value),
220
- ...q,
219
+ ...t.map((T) => T.value),
220
+ ...z,
221
221
  ...((h = (v = f.value) == null ? void 0 : v.template) == null ? void 0 : h.customFieldAttributes) ?? []
222
222
  ], a = M(e), i = await E(a);
223
- return await R(e, r, n) && A(e) && _(e) && b(e) && O(e, r, a, i) && w(e) && L(e) && N(e) && B() && F() && x(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);
224
224
  } };
225
225
  };
226
226
  export {
227
- ge as buildPartnerAttributeNameSet,
228
- pe as findInvalidCustomFields,
229
- Ee as getInvalidDynamicContentTags,
230
- me as getRecommendationBlockIds,
231
- fe as parseRecommendationVariable,
232
- 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
233
233
  };
@@ -1,58 +1,58 @@
1
1
  import { getIgnoredRecommendationBlockIds as Y } from "../config/compiler/utils/recommendationIgnoreUtils.js";
2
- import { CanNotMakeAnyChangesForRunningKey as k, DISPLAY_CONDITIONS_REGEX as U, DISPLAY_CONDITIONS_EXCEPTIONS_REGEX as M } from "../enums/html-validator.js";
2
+ import { CanNotMakeAnyChangesForRunningKey as k, CONDITION_TAG_REGEX as U, DISPLAY_CONDITIONS_REGEX as M, DISPLAY_CONDITIONS_EXCEPTIONS_REGEX as x } from "../enums/html-validator.js";
3
3
  import { SaveValidationRule as o } from "../enums/save-validation.js";
4
4
  import { ToasterTypeOptions as r } from "../enums/toaster.js";
5
- import { BLOCK_ROOT_SELECTOR as x } from "../extensions/Blocks/Checkbox/constants/selectors.js";
5
+ import { BLOCK_ROOT_SELECTOR as G } from "../extensions/Blocks/Checkbox/constants/selectors.js";
6
6
  import { itemsBlockDynamicVariables as W } from "../extensions/Blocks/Items/enums/productEnums.js";
7
- import { BLOCK_ROOT_SELECTOR as G } from "../extensions/Blocks/RadioButton/constants/selectors.js";
8
- import { useRecommendationExtensionStore as P } from "../extensions/Blocks/Recommendation/store/recommendation.js";
9
- import { getInvalidFields as q, STRATEGY_FIELD_KEY as H, RecommendationAssignStrategyKey as V, RecommendationRequiredFieldsKey as X } from "../extensions/Blocks/Recommendation/validation/requiredFields.js";
10
- import { useConfigStore as j } from "../stores/config.js";
11
- import { useDynamicContentStore as z } from "../stores/dynamic-content.js";
12
- import { useRecommendationStore as $ } from "../stores/recommendation.js";
7
+ import { BLOCK_ROOT_SELECTOR as P } from "../extensions/Blocks/RadioButton/constants/selectors.js";
8
+ import { useRecommendationExtensionStore as q } from "../extensions/Blocks/Recommendation/store/recommendation.js";
9
+ import { getInvalidFields as H, STRATEGY_FIELD_KEY as V, RecommendationAssignStrategyKey as X, RecommendationRequiredFieldsKey as j } from "../extensions/Blocks/Recommendation/validation/requiredFields.js";
10
+ import { useConfigStore as z } from "../stores/config.js";
11
+ import { useDynamicContentStore as $ } from "../stores/dynamic-content.js";
12
+ import { useRecommendationStore as Q } from "../stores/recommendation.js";
13
13
  import { base64EncodeWithSpecialChars as T } from "../utils/base64.js";
14
- import { escapeHtml as Q } from "../utils/htmlEscape.js";
15
- import { useTemplatePreparation as Z } from "../utils/templatePreparation.js";
16
- import { useActionsApi as J } from "./useActionsApi.js";
17
- import { useConfig as ee } from "./useConfig.js";
18
- import { useHtmlCompiler as te } from "./useHtmlCompiler.js";
19
- import { buildPartnerAttributeNameSet as ne, getInvalidDynamicContentTags as ie, getRecommendationBlockIds as oe, findInvalidCustomFields as re } from "./useHtmlValidator.js";
20
- import { useHttp as se } from "./useHttp.js";
21
- import { useTranslations as ae } from "./useTranslations.js";
22
- import { findInvalidCouponBlocks as ce, COUPON_TAG_MODIFIED_KEY as le } from "./validators/useCouponBlockValidator.js";
23
- import { hasInsiderUnsubscribeCode as ue, EXTERNALLY_MANAGED_UNSUBSCRIBE_KEY as me, findDuplicateUnsubPageTypes as de, countUnsubBlocksWithoutPage as pe, EMPTY_BLOCK_KEY as ge } from "./validators/useUnsubscribeBlockValidator.js";
24
- const fe = "newsletter.html-content-is-empty", ye = "custom-fields.missing-closing-braces", Ee = "custom-fields.missing-opening-braces", S = "custom-fields.invalid-custom-fields", Ie = "newsletter.display-conditions-invalid-syntax", Se = "custom-conditions.wrong-equality-operators", _e = "custom-conditions.missing-if-endif-tag", Ce = "custom-conditions.no-space-after-braces", he = "custom-conditions.no-braces-inside-if-tag", ke = "newsletter.fill-all-necessary-fields", Te = "newsletter.invalid-image-type", Fe = "unsubscribe-templates.select-checkbox-groups", be = "unsubscribe-templates.select-radio-button-groups", F = "newsletter.invalid-url-link-for-toaster", b = "journey-builder.liquid-validation-failed", Re = "/newsletter/template-library/check-template-html-body", Le = /src="[^"]*\.(svg|pst)"/gm, L = /({%(.*?)%})/g, Ne = ["if", "endif", "else", "elif", "now"], Oe = (t) => !Ne.includes(t.toLowerCase()), Ae = (t) => ["if", "endif"].includes(t.toLowerCase());
25
- function De(t) {
26
- return ce(t).map((i) => ({
14
+ import { escapeHtml as Z } from "../utils/htmlEscape.js";
15
+ import { useTemplatePreparation as J } from "../utils/templatePreparation.js";
16
+ import { useActionsApi as ee } from "./useActionsApi.js";
17
+ import { useConfig as te } from "./useConfig.js";
18
+ import { useHtmlCompiler as ne } from "./useHtmlCompiler.js";
19
+ import { buildPartnerAttributeNameSet as ie, getInvalidDynamicContentTags as oe, getRecommendationBlockIds as re, findInvalidCustomFields as se } from "./useHtmlValidator.js";
20
+ import { useHttp as ae } from "./useHttp.js";
21
+ import { useTranslations as ce } from "./useTranslations.js";
22
+ import { findInvalidCouponBlocks as le, COUPON_TAG_MODIFIED_KEY as ue } from "./validators/useCouponBlockValidator.js";
23
+ import { hasInsiderUnsubscribeCode as me, EXTERNALLY_MANAGED_UNSUBSCRIBE_KEY as de, findDuplicateUnsubPageTypes as pe, countUnsubBlocksWithoutPage as ge, EMPTY_BLOCK_KEY as fe } from "./validators/useUnsubscribeBlockValidator.js";
24
+ const ye = "newsletter.html-content-is-empty", Ee = "custom-fields.missing-closing-braces", Ie = "custom-fields.missing-opening-braces", S = "custom-fields.invalid-custom-fields", Se = "newsletter.display-conditions-invalid-syntax", _e = "custom-conditions.wrong-equality-operators", Ce = "custom-conditions.missing-if-endif-tag", he = "custom-conditions.no-space-after-braces", ke = "custom-conditions.no-braces-inside-if-tag", Te = "newsletter.fill-all-necessary-fields", Fe = "newsletter.invalid-image-type", be = "unsubscribe-templates.select-checkbox-groups", Re = "unsubscribe-templates.select-radio-button-groups", F = "newsletter.invalid-url-link-for-toaster", b = "journey-builder.liquid-validation-failed", Ne = "/newsletter/template-library/check-template-html-body", Oe = /src="[^"]*\.(svg|pst)"/gm, N = /({%(.*?)%})/g, Le = ["if", "endif", "else", "elif", "now"], Ae = (t) => !Le.includes(t.toLowerCase()), De = (t) => ["if", "endif"].includes(t.toLowerCase());
25
+ function ve(t) {
26
+ return le(t).map((i) => ({
27
27
  rule: o.CouponTagModified,
28
28
  type: r.Warning,
29
- key: le,
29
+ key: ue,
30
30
  detail: i
31
31
  }));
32
32
  }
33
- function ve(t) {
34
- return de(t).map((i) => ({
33
+ function Ke(t) {
34
+ return pe(t).map((i) => ({
35
35
  rule: o.DuplicateUnsubBlock,
36
36
  type: r.Error,
37
37
  key: i.messageKey
38
38
  }));
39
39
  }
40
- function Ke(t) {
41
- return Array.from({ length: pe(t) }, () => ({
40
+ function Be(t) {
41
+ return Array.from({ length: ge(t) }, () => ({
42
42
  rule: o.UnsubBlockMissingTemplate,
43
43
  type: r.Warning,
44
- key: ge
44
+ key: fe
45
45
  }));
46
46
  }
47
- function Be(t) {
48
- return ue(t) ? [{
47
+ function we(t) {
48
+ return me(t) ? [{
49
49
  rule: o.ExternallyManagedUnsubscribe,
50
50
  type: r.Warning,
51
- key: me
51
+ key: de
52
52
  }] : [];
53
53
  }
54
- function we(t, i) {
55
- const n = t.match(L);
54
+ function Ye(t, i) {
55
+ const n = t.match(N);
56
56
  if (!n)
57
57
  return [];
58
58
  const u = [];
@@ -60,7 +60,7 @@ function we(t, i) {
60
60
  const c = m.slice(2, -2).trim().match(/(".*?"|[^"\s]+)(?=\s*|\s*$)/g);
61
61
  if (c && c.length > 0) {
62
62
  const [d] = c;
63
- Oe(d) && !i.includes(d) && u.push({
63
+ Ae(d) && !i.includes(d) && u.push({
64
64
  rule: o.CustomFieldScript,
65
65
  type: r.Warning,
66
66
  key: S,
@@ -69,32 +69,32 @@ function we(t, i) {
69
69
  }
70
70
  }), u;
71
71
  }
72
- function Ye(t) {
73
- return t.length > 0 ? [] : [{ rule: o.EmptyHtml, type: r.Warning, key: fe }];
74
- }
75
72
  function Ue(t) {
73
+ return t.length > 0 ? [] : [{ rule: o.EmptyHtml, type: r.Warning, key: ye }];
74
+ }
75
+ function Me(t) {
76
76
  const i = (t.match(/{/gm) || []).length, n = (t.match(/}/gm) || []).length;
77
77
  return i > n ? [{
78
78
  rule: o.MismatchedBraces,
79
79
  type: r.Warning,
80
- key: ye
80
+ key: Ee
81
81
  }] : i < n ? [{
82
82
  rule: o.MismatchedBraces,
83
83
  type: r.Warning,
84
- key: Ee
84
+ key: Ie
85
85
  }] : [];
86
86
  }
87
- function Me(t) {
88
- return ie(t).map((i) => ({
87
+ function xe(t) {
88
+ return oe(t).map((i) => ({
89
89
  rule: o.InvalidDynamicTag,
90
90
  type: r.Warning,
91
91
  key: S,
92
92
  detail: i
93
93
  }));
94
94
  }
95
- function xe(t, i, n, u) {
96
- const m = oe(t);
97
- return re(t, i, m, n, u).map((c) => ({
95
+ function Ge(t, i, n, u) {
96
+ const m = re(t);
97
+ return se(t, i, m, n, u).map((c) => ({
98
98
  rule: o.InvalidCustomField,
99
99
  type: r.Error,
100
100
  key: S,
@@ -102,21 +102,21 @@ function xe(t, i, n, u) {
102
102
  }));
103
103
  }
104
104
  function We(t) {
105
- const i = t.match(/{%(.*?)%}/g), n = [], u = [];
105
+ const i = t.match(U), n = [], u = [];
106
106
  if (i && i.forEach((m) => {
107
- const c = m.match(U), d = m.match(M), I = (c == null ? void 0 : c.join("")) || "";
107
+ const c = m.match(M), d = m.match(x), I = (c == null ? void 0 : c.join("")) || "";
108
108
  (!c || m !== I) && !d && u.push({
109
109
  rule: o.ConditionsSyntax,
110
110
  type: r.Error,
111
- key: Ie,
111
+ key: Se,
112
112
  detail: m
113
113
  }), c && c.forEach((g) => {
114
114
  g.trim() === "=" && u.push({
115
115
  rule: o.WrongEqualityOperator,
116
116
  type: r.Error,
117
- key: Se
117
+ key: _e
118
118
  }), (g.match(/^[a-zA-Z]*$/g) ?? []).forEach((f) => {
119
- Ae(f) && n.push(f);
119
+ De(f) && n.push(f);
120
120
  });
121
121
  });
122
122
  }), n.length) {
@@ -124,31 +124,31 @@ function We(t) {
124
124
  m !== c && u.push({
125
125
  rule: o.MissingIfEndif,
126
126
  type: r.Error,
127
- key: _e
127
+ key: Ce
128
128
  });
129
129
  }
130
130
  return u;
131
131
  }
132
- function Ge(t) {
132
+ function Pe(t) {
133
133
  const i = (t.match(/{% /gm) || []).length, n = (t.match(/ %}/gm) || []).length;
134
134
  return i === n ? [] : [{
135
135
  rule: o.ConditionTagSpacing,
136
136
  type: r.Warning,
137
- key: Ce
137
+ key: he
138
138
  }];
139
139
  }
140
- function Pe(t) {
141
- return (t.match(L) || []).filter((n) => n.includes("if")).map((n) => (n.match(/{{.*}}/gm) || []).length).reduce((n, u) => n + u, 0) === 0 ? [] : [{
140
+ function qe(t) {
141
+ return (t.match(N) || []).filter((n) => n.includes("if")).map((n) => (n.match(/{{.*}}/gm) || []).length).reduce((n, u) => n + u, 0) === 0 ? [] : [{
142
142
  rule: o.BracesInsideIfTag,
143
143
  type: r.Warning,
144
- key: he
144
+ key: ke
145
145
  }];
146
146
  }
147
- function qe(t) {
148
- return (t.match(Le) ?? []).map((i) => ({
147
+ function He(t) {
148
+ return (t.match(Oe) ?? []).map((i) => ({
149
149
  rule: o.InvalidImageType,
150
150
  type: r.Error,
151
- key: Te,
151
+ key: Fe,
152
152
  detail: i
153
153
  }));
154
154
  }
@@ -159,12 +159,12 @@ function R(t, i, n, u) {
159
159
  return !((d = c.id) != null && d.trim());
160
160
  }).map(() => ({ rule: n, type: r.Error, key: u }));
161
161
  }
162
- const ft = () => {
163
- const { config: t, isFeatureEnabled: i } = ee(), n = ae(), { post: u } = se(), { getCompiledEmail: m, getTemplateData: c } = J(), { compileHtml: d } = te(), { hydrateRecommendationStore: I } = Z(), g = z(), f = $(), y = P(), N = j(), O = (e) => ({
162
+ const yt = () => {
163
+ const { config: t, isFeatureEnabled: i } = te(), n = ce(), { post: u } = ae(), { getCompiledEmail: m, getTemplateData: c } = ee(), { compileHtml: d } = ne(), { hydrateRecommendationStore: I } = J(), g = $(), f = Q(), y = q(), O = z(), L = (e) => ({
164
164
  rule: e.rule,
165
165
  type: e.type,
166
166
  detail: e.detail,
167
- message: "key" in e ? n(e.key) : Q(e.message)
167
+ message: "key" in e ? n(e.key) : Z(e.message)
168
168
  }), A = async (e) => {
169
169
  if (e.size === 0)
170
170
  return /* @__PURE__ */ new Set();
@@ -173,10 +173,10 @@ const ft = () => {
173
173
  } catch {
174
174
  return null;
175
175
  }
176
- return ne(y.filterList);
176
+ return ie(y.filterList);
177
177
  }, D = async (e) => {
178
178
  try {
179
- const a = await u(Re, { html: T(e) }), { status: s, message: l } = a.data, p = [], E = s === void 0 && !!l && l !== n(F);
179
+ const a = await u(Ne, { html: T(e) }), { status: s, message: l } = a.data, p = [], E = s === void 0 && !!l && l !== n(F);
180
180
  return s || p.push({
181
181
  rule: o.InvalidLinks,
182
182
  type: r.Error,
@@ -225,17 +225,17 @@ const ft = () => {
225
225
  }];
226
226
  }
227
227
  }, K = () => {
228
- const e = Object.values(y.blockStates).map((s) => q(s.recommendationConfigs, y)).filter((s) => s.length > 0).map((s) => {
229
- const l = s.every((p) => p === H);
228
+ const e = Object.values(y.blockStates).map((s) => H(s.recommendationConfigs, y)).filter((s) => s.length > 0).map((s) => {
229
+ const l = s.every((p) => p === V);
230
230
  return {
231
231
  rule: o.RecommendationRequiredFields,
232
232
  type: l ? r.Warning : r.Error,
233
- key: l ? V : X
233
+ key: l ? X : j
234
234
  };
235
235
  }), a = (f.recommendationConfigs ?? []).filter((s) => s.filters.some((l) => l.value === "")).map(() => ({
236
236
  rule: o.RecommendationFilters,
237
237
  type: r.Error,
238
- key: ke
238
+ key: Te
239
239
  }));
240
240
  return [...e, ...a];
241
241
  }, B = async (e, a) => {
@@ -244,39 +244,39 @@ const ft = () => {
244
244
  ...a.map((w) => w.value),
245
245
  ...W,
246
246
  ...((h = (C = t.value) == null ? void 0 : C.template) == null ? void 0 : h.customFieldAttributes) ?? []
247
- ], l = Y(e), p = await A(l), { isTransactional: E } = N;
247
+ ], l = Y(e), p = await A(l), { isTransactional: E } = O;
248
248
  return [
249
249
  ...await D(e),
250
- ...E ? [] : we(e, s),
251
- ...Ye(e),
250
+ ...E ? [] : Ye(e, s),
252
251
  ...Ue(e),
253
252
  ...Me(e),
254
- ...E ? [] : xe(e, s, l, p),
253
+ ...xe(e),
254
+ ...E ? [] : Ge(e, s, l, p),
255
255
  ...We(e),
256
- ...Ge(e),
257
256
  ...Pe(e),
258
- ...K(),
259
257
  ...qe(e),
258
+ ...K(),
259
+ ...He(e),
260
260
  ...R(
261
261
  e,
262
- x,
262
+ G,
263
263
  o.CheckboxUnsubGroup,
264
- Fe
264
+ be
265
265
  ),
266
266
  ...R(
267
267
  e,
268
- G,
268
+ P,
269
269
  o.RadioButtonUnsubGroup,
270
- be
270
+ Re
271
271
  )
272
272
  ];
273
273
  }, _ = async (e, a, s) => [
274
- ...De(e),
275
- ...i("blockUnsubscribeLinks") ? Be(s) : [],
276
274
  ...ve(e),
275
+ ...i("blockUnsubscribeLinks") ? we(s) : [],
277
276
  ...Ke(e),
277
+ ...Be(e),
278
278
  ...i("liquidSyntax") ? await v(e) : await B(e, a)
279
- ].map(O);
279
+ ].map(L);
280
280
  return { collectSaveValidationErrors: _, validateCurrentTemplate: async () => {
281
281
  const { html: e } = await c();
282
282
  await I(e);
@@ -285,5 +285,5 @@ const ft = () => {
285
285
  } };
286
286
  };
287
287
  export {
288
- ft as useSaveValidation
288
+ yt as useSaveValidation
289
289
  };
@@ -0,0 +1,13 @@
1
+ import { CONDITION_TAG_REGEX as s } from "../../enums/html-validator.js";
2
+ const r = /[^\S\r\n\u2028\u2029]*[\r\n\u2028\u2029]+\s*/g, i = [
3
+ {
4
+ id: "pongo-single-line-tags",
5
+ description: "Collapse line breaks inside {% %} tags to a space",
6
+ type: "custom",
7
+ processor: (e) => e.replace(s, (o) => o.replace(r, " ")),
8
+ priority: 50
9
+ }
10
+ ];
11
+ export {
12
+ i as pongoCompilerRules
13
+ };
@@ -1,16 +1,17 @@
1
- const n = "newsletter.already-in-progress", e = "newsletter.campaign-could-not-be-saved", s = / (==|<=|>=|!=|>|<|in) | (if|elif|endif|else|and|or) |("[\S ]+")|('[\S ]+')|([^”\s\n]+)|(({%)|( %}))/gm, o = /{%( )*now( )(".*")( )*%}/gm, E = /\{\{[^{}]+\}\}/g, _ = /(\s)data-[\w-]+=(?:"[^"]*"|'[^']*')/g, i = /^[A-Za-z0-9_.]+$/, t = [
1
+ const n = "newsletter.already-in-progress", s = "newsletter.campaign-could-not-be-saved", e = / (==|<=|>=|!=|>|<|in) | (if|elif|endif|else|and|or) |("[\S ]+")|('[\S ]+')|([^”\s\n]+)|(({%)|( %}))/gm, E = /{%( )*now( )(".*")( )*%}/gm, o = /{%(?:(?!{%)[\s\S])*?%}/g, _ = /\{\{[^{}]+\}\}/g, t = /(\s)data-[\w-]+=(?:"[^"]*"|'[^']*')/g, i = /^[A-Za-z0-9_.]+$/, a = [
2
2
  "ins-unsubscribe-link",
3
3
  "ins-global-unsubscribe-link",
4
4
  "ins-preferences-unsubscribe-link",
5
5
  "@COUPON_CODE"
6
6
  ];
7
7
  export {
8
- t as ALLOWED_DYNAMIC_SYSTEM_TOKENS,
9
- e as CampaignCouldNotBeSavedKey,
8
+ a as ALLOWED_DYNAMIC_SYSTEM_TOKENS,
9
+ o as CONDITION_TAG_REGEX,
10
+ s as CampaignCouldNotBeSavedKey,
10
11
  n as CanNotMakeAnyChangesForRunningKey,
11
- _ as DATA_ATTRIBUTE_REGEX,
12
- o as DISPLAY_CONDITIONS_EXCEPTIONS_REGEX,
13
- s as DISPLAY_CONDITIONS_REGEX,
14
- E as DYNAMIC_CONTENT_TAG_REGEX,
12
+ t as DATA_ATTRIBUTE_REGEX,
13
+ E as DISPLAY_CONDITIONS_EXCEPTIONS_REGEX,
14
+ e as DISPLAY_CONDITIONS_REGEX,
15
+ _ as DYNAMIC_CONTENT_TAG_REGEX,
15
16
  i as VALID_DYNAMIC_VARIABLE_REGEX
16
17
  };
@@ -1,4 +1,4 @@
1
- const o = "3.27.1-beta.7722b9b", s = { stripo: { version: "2.86.1" } }, t = {
1
+ const o = "3.27.1-beta.95af24c", s = { stripo: { version: "2.86.1" } }, t = {
2
2
  version: o,
3
3
  guido: s
4
4
  };
@@ -0,0 +1,2 @@
1
+ import type { CompilerRule } from '@@/Types/html-compiler';
2
+ export declare const pongoCompilerRules: CompilerRule[];
@@ -3,6 +3,7 @@ export declare const CanNotMakeAnyChangesKey = "newsletter.can-not-make-any-chan
3
3
  export declare const CampaignCouldNotBeSavedKey = "newsletter.campaign-could-not-be-saved";
4
4
  export declare const DISPLAY_CONDITIONS_REGEX: RegExp;
5
5
  export declare const DISPLAY_CONDITIONS_EXCEPTIONS_REGEX: RegExp;
6
+ export declare const CONDITION_TAG_REGEX: RegExp;
6
7
  export declare const REMOVE_CONDITIONS_REGEX: RegExp;
7
8
  export declare const DYNAMIC_CONTENT_TAG_REGEX: RegExp;
8
9
  export declare const DATA_ATTRIBUTE_REGEX: RegExp;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@useinsider/guido",
3
- "version": "3.27.1-beta.7722b9b",
3
+ "version": "3.27.1-beta.95af24c",
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",