@useinsider/guido 3.27.1-beta.07db3f3 → 3.27.1-beta.389502e

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
  };