@useinsider/guido 3.14.0-beta.1abaa5e → 3.14.0-beta.1e474dd

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/composables/useAllowlist.js +30 -48
  2. package/dist/composables/useHtmlCompiler.js +16 -19
  3. package/dist/composables/useHtmlValidator.js +50 -50
  4. package/dist/config/compiler/htmlCompilerRules.js +7 -34
  5. package/dist/config/i18n/en/labels.json.js +7 -3
  6. package/dist/config/migrator/recommendation/compositionMapper.js +26 -23
  7. package/dist/config/migrator/recommendation/htmlBuilder.js +156 -155
  8. package/dist/extensions/Blocks/Recommendation/constants/selectors.js +15 -13
  9. package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +346 -314
  10. package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +44 -43
  11. package/dist/extensions/Blocks/Recommendation/templates/grid/template.js +16 -16
  12. package/dist/extensions/Blocks/Recommendation/templates/list/template.js +16 -16
  13. package/dist/extensions/Blocks/Recommendation/templates/utils.js +120 -120
  14. package/dist/extensions/Blocks/Recommendation/utils/captureStyleTemplates.js +55 -54
  15. package/dist/extensions/Blocks/Recommendation/utils/compositionKeys.js +89 -0
  16. package/dist/extensions/Blocks/common-control.js +42 -35
  17. package/dist/src/composables/useHtmlValidator.d.ts +3 -2
  18. package/dist/src/config/migrator/recommendation/types.d.ts +1 -0
  19. package/dist/src/extensions/Blocks/Recommendation/constants/index.d.ts +1 -1
  20. package/dist/src/extensions/Blocks/Recommendation/constants/selectors.d.ts +4 -0
  21. package/dist/src/extensions/Blocks/Recommendation/controls/cardComposition/index.d.ts +22 -5
  22. package/dist/src/extensions/Blocks/Recommendation/templates/utils.d.ts +12 -11
  23. package/dist/src/extensions/Blocks/Recommendation/utils/compositionKeys.d.ts +52 -0
  24. package/dist/src/extensions/Blocks/common-control.d.ts +3 -1
  25. package/package.json +1 -1
@@ -1,68 +1,50 @@
1
1
  import { useAllowlistApi as A } from "../services/allowlistApi.js";
2
- import { base64EncodeWithSpecialChars as f } from "../utils/base64.js";
3
- import { useTranslations as D } from "./useTranslations.js";
4
- import { useUserRole as E } from "./useUserRole.js";
5
- const _ = /(?:https?:\/\/|www\.)[^\s"'<>()]+/gi, L = /&quot;\/\//gi, w = "s3-eu-west-1.amazonaws.com", d = [
6
- "insider-email",
7
- "web-image.useinsider.com",
8
- "image.useinsider.com",
9
- "panel-assets.useinsider.com",
10
- "stripo-editor-image"
11
- ], N = ({ hostname: r, pathname: l }) => {
12
- const n = r.toLowerCase();
13
- if (n === w) {
14
- const i = l.split("/")[1].toLowerCase();
15
- return d.includes(i);
16
- }
17
- return d.some((i) => n === `${i}.${w}`);
18
- }, m = {
2
+ import { base64EncodeWithSpecialChars as p } from "../utils/base64.js";
3
+ import { useTranslations as h } from "./useTranslations.js";
4
+ import { useUserRole as D } from "./useUserRole.js";
5
+ const f = /(?:https?:\/\/|www\.)[^\s"'<>()]+/gi, E = /&quot;\/\//gi, i = {
19
6
  MANAGE: "journey-builder.domain-allowlist-warning",
20
7
  NON_MANAGE: "settings.allow-list-warning-not-admin-architect",
21
8
  ADD_BUTTON: "settings.allow-list-warning-add-button"
22
- }, g = /* @__PURE__ */ new Set(), O = (r) => `/settings?openAddModal=true&type=domain&values=${f(r)}#security`, C = () => {
23
- const { checkDomain: r } = A(), { getIsManageUser: l } = E(), n = D(), i = (t, e) => {
24
- const a = `${t || ""} ${e || ""}`.replace(L, "https://").match(_) || [], s = /* @__PURE__ */ new Set();
25
- return a.forEach((c) => {
26
- const h = /^https?:\/\//i.test(c) ? c : `https://${c}`;
9
+ }, w = /* @__PURE__ */ new Set(), O = (n) => `/settings?openAddModal=true&type=domain&values=${p(n)}#security`, M = () => {
10
+ const { checkDomain: n } = A(), { getIsManageUser: l } = D(), a = h(), d = (t, s) => {
11
+ const c = `${t || ""} ${s || ""}`.replace(E, "https://").match(f) || [], e = /* @__PURE__ */ new Set();
12
+ return c.forEach((r) => {
13
+ const g = /^https?:\/\//i.test(r) ? r : `https://${r}`;
27
14
  try {
28
- const u = new URL(h);
29
- if (N(u))
30
- return;
31
- u.hostname && s.add(u.hostname.replace(/^www\./i, "").toLowerCase());
15
+ const { hostname: u } = new URL(g);
16
+ u && e.add(u.replace(/^www\./i, "").toLowerCase());
32
17
  } catch {
33
18
  }
34
- }), [...s];
35
- }, p = async (t) => {
36
- if (g.has(t))
19
+ }), [...e];
20
+ }, m = async (t) => {
21
+ if (w.has(t))
37
22
  return !0;
38
23
  try {
39
- const e = await r(t);
40
- return e && g.add(t), e;
41
- } catch (e) {
42
- return console.error("[GUIDO_ALLOWLIST] isDomainAllowlisted failed", t, e), !0;
24
+ const s = await n(t);
25
+ return s && w.add(t), s;
26
+ } catch (s) {
27
+ return console.error("[GUIDO_ALLOWLIST] isDomainAllowlisted failed", t, s), !0;
43
28
  }
44
29
  };
45
- return { getBlockedDomains: async (t, e) => {
30
+ return { getBlockedDomains: async (t, s) => {
46
31
  try {
47
- const o = i(t, e);
32
+ const o = d(t, s);
48
33
  return o.length ? (await Promise.all(
49
- o.map(async (s) => ({ domain: s, allowlisted: await p(s) }))
50
- )).filter((s) => !s.allowlisted).map((s) => s.domain) : [];
34
+ o.map(async (e) => ({ domain: e, allowlisted: await m(e) }))
35
+ )).filter((e) => !e.allowlisted).map((e) => e.domain) : [];
51
36
  } catch (o) {
52
37
  return console.error("[GUIDO_ALLOWLIST] getBlockedDomains failed", o), [];
53
38
  }
54
- }, resolveToast: async (t) => {
55
- const e = await l(), o = t.length ? ` (${t.join(", ")})` : "", a = (s) => `${s}${o}`;
56
- return e ? {
57
- message: a(n(m.MANAGE)),
58
- actionButton: {
59
- text: n(m.ADD_BUTTON),
60
- onClick: () => window.open(O(t.join(",")), "_blank")
61
- }
62
- } : { message: a(n(m.NON_MANAGE)) };
63
- } };
39
+ }, resolveToast: async (t) => await l() ? {
40
+ message: a(i.MANAGE),
41
+ actionButton: {
42
+ text: a(i.ADD_BUTTON),
43
+ onClick: () => window.open(O(t.join(",")), "_blank")
44
+ }
45
+ } : { message: a(i.NON_MANAGE) } };
64
46
  };
65
47
  export {
66
48
  O as buildAllowlistSettingsUrl,
67
- C as useAllowlist
49
+ M as useAllowlist
68
50
  };
@@ -1,13 +1,13 @@
1
- import { defaultHtmlCompilerRules as g } from "../config/compiler/htmlCompilerRules.js";
2
- import { itemsCompilerRules as R } from "../config/compiler/itemsCompilerRules.js";
3
- import { liquidCompilerRules as b } from "../config/compiler/liquidCompilerRules.js";
4
- import { outlookCompilerRules as C } from "../config/compiler/outlookCompilerRules.js";
1
+ import { defaultHtmlCompilerRules as R } from "../config/compiler/htmlCompilerRules.js";
2
+ import { itemsCompilerRules as g } from "../config/compiler/itemsCompilerRules.js";
3
+ import { liquidCompilerRules as C } from "../config/compiler/liquidCompilerRules.js";
4
+ import { outlookCompilerRules as b } from "../config/compiler/outlookCompilerRules.js";
5
5
  import { recommendationCompilerRules as v } from "../config/compiler/recommendationCompilerRules.js";
6
- import { socialCompilerRules as y } from "../config/compiler/socialCompilerRules.js";
7
- import { unsubscribeCompilerRules as H } from "../config/compiler/unsubscribeCompilerRules.js";
6
+ import { socialCompilerRules as H } from "../config/compiler/socialCompilerRules.js";
7
+ import { unsubscribeCompilerRules as x } from "../config/compiler/unsubscribeCompilerRules.js";
8
8
  import { createHtmlCompiler as s } from "../utils/htmlCompiler.js";
9
- import { useConfig as x } from "./useConfig.js";
10
- const h = /* @__PURE__ */ new Set([
9
+ import { useConfig as k } from "./useConfig.js";
10
+ const y = /* @__PURE__ */ new Set([
11
11
  // URL/tag encoding fixes — keep merge-tag and placeholder integrity intact.
12
12
  "fix-url-encoding-start",
13
13
  "fix-url-encoding-end",
@@ -18,9 +18,6 @@ const h = /* @__PURE__ */ new Set([
18
18
  // Image domain corrections — plain string replacement.
19
19
  "replace-old-image-domain",
20
20
  "replace-old-v2-image-domain",
21
- "replace-s3-path-style-web-image-domain",
22
- "replace-s3-path-style-image-domain",
23
- "replace-s3-path-style-panel-assets-domain",
24
21
  // Unsubscribe domain — the actual fix: injects the real unsubscribe href in
25
22
  // place of the `{{ins-*-unsubscribe-link}}` placeholders, plus related
26
23
  // unsubscribe-only cleanups. All pure regex/text, no AMP-forbidden output.
@@ -35,21 +32,21 @@ const h = /* @__PURE__ */ new Set([
35
32
  "remove-contenteditable"
36
33
  ]), M = () => {
37
34
  var i, m, r;
38
- const { compiler: o, isFeatureEnabled: a, partner: n } = x(), p = ((i = o.value) == null ? void 0 : i.customRules) || [], l = [
39
- ...!!((m = o.value) != null && m.ignoreDefaultRules) ? [] : g,
35
+ const { compiler: o, isFeatureEnabled: n, partner: a } = k(), p = ((i = o.value) == null ? void 0 : i.customRules) || [], l = [
36
+ ...!!((m = o.value) != null && m.ignoreDefaultRules) ? [] : R,
40
37
  ...v,
38
+ ...x,
39
+ ...g,
40
+ ...b,
41
41
  ...H,
42
- ...R,
43
- ...C,
44
- ...y,
45
- ...a("liquidSyntax") ? b : [],
42
+ ...n("liquidSyntax") ? C : [],
46
43
  ...p.map((e, f) => ({
47
44
  ...e,
48
45
  priority: e.priority + 1e3 + f
49
46
  // Ensure additional rules run after default rules
50
47
  }))
51
- ], c = s(l), u = l.filter((e) => h.has(e.id)), d = s(u), t = (r = n.value) == null ? void 0 : r.fallbackFont;
52
- return { compileHtml: (e) => c.compile(e, void 0, t), compileAmpHtml: (e) => d.compile(e, void 0, t) };
48
+ ], u = s(l), c = l.filter((e) => y.has(e.id)), d = s(c), t = (r = a.value) == null ? void 0 : r.fallbackFont;
49
+ return { compileHtml: (e) => u.compile(e, void 0, t), compileAmpHtml: (e) => d.compile(e, void 0, t) };
53
50
  };
54
51
  export {
55
52
  M as useHtmlCompiler
@@ -6,7 +6,7 @@ import { ToasterTypeOptions as c } from "../enums/toaster.js";
6
6
  import { itemsBlockDynamicVariables as z } from "../extensions/Blocks/Items/enums/productEnums.js";
7
7
  import { RECOMMENDATION_VARIABLE_BUILTIN_ATTRIBUTES as Z } from "../extensions/Blocks/Recommendation/constants/selectors.js";
8
8
  import { useRecommendationExtensionStore as J } from "../extensions/Blocks/Recommendation/store/recommendation.js";
9
- import { resolveProductAttrValue as Q } from "../extensions/Blocks/Recommendation/templates/utils.js";
9
+ import { filterToProductAttrValue as Q } from "../extensions/Blocks/Recommendation/utils/compositionKeys.js";
10
10
  import { RecommendationRequiredFieldsKey as ee } from "../extensions/Blocks/Recommendation/validation/requiredFields.js";
11
11
  import { useRecommendationStore as te } from "../stores/recommendation.js";
12
12
  import { base64EncodeWithSpecialChars as ne } from "../utils/base64.js";
@@ -14,25 +14,25 @@ import { useHttp as se } from "./useHttp.js";
14
14
  import { useToaster as re } from "./useToaster.js";
15
15
  import { useTranslations as oe } from "./useTranslations.js";
16
16
  const ie = /recommendation-id="(\d+)"/g;
17
- function ae(t) {
18
- return [...t.matchAll(ie)].map((m) => m[1]);
17
+ function ae(n) {
18
+ return [...n.matchAll(ie)].map((m) => m[1]);
19
19
  }
20
- function ce(t, m) {
21
- return m.some((f) => t.startsWith(`${f}_`));
20
+ function ce(n, m) {
21
+ return m.some((f) => n.startsWith(`${f}_`));
22
22
  }
23
23
  const le = /^(\d+)_\d+_(.+)$/;
24
- function me(t) {
25
- const m = t.match(le);
24
+ function me(n) {
25
+ const m = n.match(le);
26
26
  return m ? { recoId: m[1], attribute: m[2] } : null;
27
27
  }
28
- function ue(t) {
28
+ function ue(n) {
29
29
  const m = new Set(Z);
30
- return Object.values(t).forEach((f) => {
31
- m.add(Q(f.attributeName, t).toLowerCase());
30
+ return Object.values(n).forEach((f) => {
31
+ m.add(Q(f).toLowerCase());
32
32
  }), m;
33
33
  }
34
- function de(t, m, f, o, d) {
35
- const u = t.match(/{{([a-zA-Z0-9_.\s]*)}}/gm);
34
+ function de(n, m, f, o, d) {
35
+ const u = n.match(/{{([a-zA-Z0-9_.\s]*)}}/gm);
36
36
  if (!u)
37
37
  return [];
38
38
  const p = new Set(m.map((h) => h.toLowerCase())), E = [];
@@ -50,15 +50,15 @@ function de(t, m, f, o, d) {
50
50
  ce(g, f) || g.includes(".") || E.push(g);
51
51
  }), E;
52
52
  }
53
- function fe(t) {
54
- return (t.replace(U, "$1").match(j) ?? []).filter((o) => {
53
+ function fe(n) {
54
+ return (n.replace(U, "$1").match(j) ?? []).filter((o) => {
55
55
  const d = o.slice(2, -2), u = d.indexOf("|"), p = (u === -1 ? d : d.slice(0, u)).trim();
56
56
  return q.includes(p) ? !1 : K.test(p) ? u !== -1 && d.slice(u + 1).trim() === "" : !0;
57
57
  });
58
58
  }
59
59
  const xe = () => {
60
60
  var b, S;
61
- const { showToaster: t } = re(), { post: m } = se(), { config: f } = W(), o = oe(), d = te(), u = J(), p = ((S = (b = f.value) == null ? void 0 : b.partner) == null ? void 0 : S.messageType) === H.transactional, E = async (e) => {
61
+ const { showToaster: n } = re(), { post: m } = se(), { config: f } = W(), o = oe(), d = te(), u = J(), p = ((S = (b = f.value) == null ? void 0 : b.partner) == null ? void 0 : S.messageType) === H.transactional, E = async (e) => {
62
62
  if (e.size === 0)
63
63
  return /* @__PURE__ */ new Set();
64
64
  try {
@@ -68,59 +68,59 @@ const xe = () => {
68
68
  }
69
69
  return ue(u.filterList);
70
70
  }, h = async (e) => {
71
- const n = await m(
71
+ const t = await m(
72
72
  "/newsletter/template-library/check-template-html-body",
73
73
  { html: ne(e) }
74
- ), { status: r, message: a } = n.data;
75
- return r || t({
74
+ ), { status: r, message: a } = t.data;
75
+ return r || n({
76
76
  type: c.Error,
77
77
  message: r === void 0 ? a : o("newsletter.invalid-url-link-for-toaster")
78
- }), o($), a === o(Y) && t({
78
+ }), o($), a === o(Y) && n({
79
79
  type: c.Error,
80
80
  message: o("newsletter.already-in-progress")
81
81
  }), r;
82
82
  }, g = (e) => !["if", "endif", "else", "elif", "now"].includes(e.toLowerCase()), y = (e) => ["if", "endif"].includes(e.toLowerCase()), T = (e, s) => {
83
- const n = e.match(/({%(.*?)%})/g);
83
+ const t = e.match(/({%(.*?)%})/g);
84
84
  let r = !0;
85
- return n !== null && !p && n.forEach((a) => {
85
+ return t !== null && !p && t.forEach((a) => {
86
86
  const i = a.slice(2, -2).trim().match(/(".*?"|[^"\s]+)(?=\s*|\s*$)/g);
87
87
  if (i && i.length > 0) {
88
88
  const [l] = i;
89
- g(l) && !s.includes(l) && (t({
89
+ g(l) && !s.includes(l) && (n({
90
90
  type: c.Warning,
91
91
  message: o("custom-fields.invalid-custom-fields")
92
92
  }), r = !1);
93
93
  }
94
94
  }), r;
95
- }, w = async (e, s, n) => {
96
- const r = n ? await h(e) : !0;
95
+ }, w = async (e, s, t) => {
96
+ const r = t ? await h(e) : !0;
97
97
  return T(e, s) && r;
98
- }, R = (e) => e.length > 0 ? !0 : (t({
98
+ }, R = (e) => e.length > 0 ? !0 : (n({
99
99
  type: c.Warning,
100
100
  message: o("newsletter.html-content-is-empty")
101
101
  }), !1), _ = (e) => {
102
- const s = (e.match(/{/gm) || []).length, n = (e.match(/}/gm) || []).length;
103
- return s > n && t({
102
+ const s = (e.match(/{/gm) || []).length, t = (e.match(/}/gm) || []).length;
103
+ return s > t && n({
104
104
  type: c.Warning,
105
105
  message: o("custom-fields.missing-closing-braces")
106
- }), s < n && t({
106
+ }), s < t && n({
107
107
  type: c.Warning,
108
108
  message: o("custom-fields.missing-opening-braces")
109
- }), s === n;
109
+ }), s === t;
110
110
  }, N = (e) => {
111
111
  const s = fe(e).length === 0;
112
- return s || t({
112
+ return s || n({
113
113
  type: c.Warning,
114
114
  message: o("custom-fields.invalid-custom-fields")
115
115
  }), s;
116
- }, x = (e, s, n, r) => {
116
+ }, x = (e, s, t, r) => {
117
117
  if (p)
118
118
  return !0;
119
119
  const a = de(
120
120
  e,
121
121
  s,
122
122
  ae(e),
123
- n,
123
+ t,
124
124
  r
125
125
  );
126
126
  if (a.length > 0) {
@@ -129,56 +129,56 @@ const xe = () => {
129
129
  ${a.map((l) => `<li>${l}</li>`).join("")}
130
130
  </ul>
131
131
  `;
132
- return t({
132
+ return n({
133
133
  type: c.Error,
134
134
  message: o("custom-fields.invalid-custom-fields") + i
135
135
  }), !1;
136
136
  }
137
137
  return !0;
138
138
  }, O = (e) => {
139
- const s = e.match(/{%(.*?)%}/g), n = [];
139
+ const s = e.match(/{%(.*?)%}/g), t = [];
140
140
  let r = !0;
141
141
  if (s && s.forEach((a) => {
142
142
  const i = a.match(P), l = a.match(X), v = (i == null ? void 0 : i.join("")) || "";
143
- (!i || a !== v) && !l && (t({
143
+ (!i || a !== v) && !l && (n({
144
144
  type: c.Error,
145
145
  message: o("newsletter.display-conditions-invalid-syntax")
146
146
  }), r = !1), i && i.forEach((C) => {
147
- C.trim() === "=" && (t({
147
+ C.trim() === "=" && (n({
148
148
  type: c.Error,
149
149
  message: o("custom-conditions.wrong-equality-operators")
150
150
  }), r = !1);
151
151
  const I = C.match(/^[a-zA-Z]*$/g);
152
152
  I && I.forEach((A) => {
153
- y(A) && n.push(A);
153
+ y(A) && t.push(A);
154
154
  });
155
155
  });
156
- }), n.length) {
157
- const a = n.filter((l) => l === "if"), i = n.filter((l) => l === "endif");
158
- a.length !== i.length && (t({
156
+ }), t.length) {
157
+ const a = t.filter((l) => l === "if"), i = t.filter((l) => l === "endif");
158
+ a.length !== i.length && (n({
159
159
  type: c.Error,
160
160
  message: o("custom-conditions.missing-if-endif-tag")
161
161
  }), r = !1);
162
162
  }
163
163
  return r;
164
164
  }, k = (e) => {
165
- const s = (e.match(/{% /gm) || []).length, n = (e.match(/ %}/gm) || []).length, r = s === n;
166
- return r || t({
165
+ const s = (e.match(/{% /gm) || []).length, t = (e.match(/ %}/gm) || []).length, r = s === t;
166
+ return r || n({
167
167
  type: c.Warning,
168
168
  message: o("custom-conditions.no-space-after-braces")
169
169
  }), r;
170
- }, B = (e) => (e.match(/({%(.*?)%})/g) || []).filter((n) => n.includes("if")).map((n) => (n.match(/{{.*}}/gm) || []).length).reduce((n, r) => n + r, 0) > 0 ? (t({
170
+ }, B = (e) => (e.match(/({%(.*?)%})/g) || []).filter((t) => t.includes("if")).map((t) => (t.match(/{{.*}}/gm) || []).length).reduce((t, r) => t + r, 0) > 0 ? (n({
171
171
  type: c.Warning,
172
172
  message: o("custom-conditions.no-braces-inside-if-tag")
173
- }), !1) : !0, D = () => u.hasInvalidBlock() ? (t({
173
+ }), !1) : !0, D = () => u.hasInvalidBlock() ? (n({
174
174
  type: c.Error,
175
175
  message: o(ee)
176
- }), !1) : !0, F = () => d.recommendationConfigs && Object.values(d.recommendationConfigs).find((s) => s.filters.find((n) => n.value === "")) !== void 0 ? (t({
176
+ }), !1) : !0, F = () => d.recommendationConfigs && Object.values(d.recommendationConfigs).find((s) => s.filters.find((t) => t.value === "")) !== void 0 ? (n({
177
177
  type: c.Error,
178
178
  message: o("newsletter.fill-all-necessary-fields")
179
179
  }), !1) : !0, L = (e) => {
180
180
  const s = /src="[^"]*\.(svg|pst)"/gm;
181
- return e.match(s) === null ? !0 : (t({
181
+ return e.match(s) === null ? !0 : (n({
182
182
  type: c.Error,
183
183
  message: o("newsletter.invalid-image-type")
184
184
  }), !1);
@@ -187,7 +187,7 @@ const xe = () => {
187
187
  return Array.from(r).find((i) => {
188
188
  var l;
189
189
  return !((l = i.id) != null && l.trim());
190
- }) ? (t({
190
+ }) ? (n({
191
191
  type: c.Error,
192
192
  message: o("unsubscribe-templates.select-checkbox-groups")
193
193
  }), !1) : !0;
@@ -196,19 +196,19 @@ const xe = () => {
196
196
  return Array.from(r).find((i) => {
197
197
  var l;
198
198
  return !((l = i.id) != null && l.trim());
199
- }) ? (t({
199
+ }) ? (n({
200
200
  type: c.Error,
201
201
  message: o("unsubscribe-templates.select-radio-button-groups")
202
202
  }), !1) : !0;
203
203
  };
204
- return { validateHtml: async (e, s, n = !1) => {
204
+ return { validateHtml: async (e, s, t = !1) => {
205
205
  var v, C;
206
206
  const r = [
207
207
  ...s.map((I) => I.value),
208
208
  ...z,
209
209
  ...((C = (v = f.value) == null ? void 0 : v.template) == null ? void 0 : C.customFieldAttributes) ?? []
210
210
  ], a = G(e), i = await E(a);
211
- return await w(e, r, n) && R(e) && _(e) && N(e) && x(e, r, a, i) && O(e) && k(e) && B(e) && D() && F() && L(e) && V(e) && M(e);
211
+ return await w(e, r, t) && R(e) && _(e) && N(e) && x(e, r, a, i) && O(e) && k(e) && B(e) && D() && F() && L(e) && V(e) && M(e);
212
212
  } };
213
213
  };
214
214
  export {
@@ -122,10 +122,10 @@ const d = [
122
122
  ], i = /<head>([\S\s]*)<\/head>/, o = new RegExp(i);
123
123
  if (!e.match(o))
124
124
  return e;
125
- let s = e;
126
- return t.forEach((r) => {
127
- s = s.replace("</head>", `${r}</head>`);
128
- }), s;
125
+ let r = e;
126
+ return t.forEach((s) => {
127
+ r = r.replace("</head>", `${s}</head>`);
128
+ }), r;
129
129
  },
130
130
  priority: 30
131
131
  },
@@ -147,33 +147,6 @@ const d = [
147
147
  replaceAll: !0,
148
148
  priority: 41
149
149
  },
150
- {
151
- id: "replace-s3-path-style-web-image-domain",
152
- description: "Rewriting path-style S3 asset URLs to the web-image.useinsider.com domain",
153
- type: "replace",
154
- search: "s3-eu-west-1.amazonaws.com/web-image.useinsider.com",
155
- replacement: "web-image.useinsider.com",
156
- replaceAll: !0,
157
- priority: 42
158
- },
159
- {
160
- id: "replace-s3-path-style-image-domain",
161
- description: "Rewriting path-style S3 asset URLs to the image.useinsider.com domain",
162
- type: "replace",
163
- search: "s3-eu-west-1.amazonaws.com/image.useinsider.com",
164
- replacement: "image.useinsider.com",
165
- replaceAll: !0,
166
- priority: 43
167
- },
168
- {
169
- id: "replace-s3-path-style-panel-assets-domain",
170
- description: "Rewriting path-style S3 asset URLs to the panel-assets.useinsider.com domain",
171
- type: "replace",
172
- search: "s3-eu-west-1.amazonaws.com/panel-assets.useinsider.com",
173
- replacement: "panel-assets.useinsider.com",
174
- replaceAll: !0,
175
- priority: 46
176
- },
177
150
  {
178
151
  id: "convert-rgb-to-hex",
179
152
  // SD-142395: rgb()/6-digit hex are verbose; hex/3-digit shorthand is byte-identical
@@ -183,9 +156,9 @@ const d = [
183
156
  type: "custom",
184
157
  processor: (e) => {
185
158
  const t = (i) => i.toString(16).padStart(2, "0");
186
- return e.replace(/rgb\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*\)/gi, (i, o, a, s) => {
187
- const [r, n, c] = [Number(o), Number(a), Number(s)];
188
- return r > 255 || n > 255 || c > 255 ? i : `#${t(r)}${t(n)}${t(c)}`;
159
+ return e.replace(/rgb\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*\)/gi, (i, o, n, r) => {
160
+ const [s, a, c] = [Number(o), Number(n), Number(r)];
161
+ return s > 255 || a > 255 || c > 255 ? i : `#${t(s)}${t(a)}${t(c)}`;
189
162
  }).replace(/#([0-9a-f])\1([0-9a-f])\2([0-9a-f])\3\b/gi, "#$1$2$3");
190
163
  },
191
164
  priority: 44
@@ -1,4 +1,4 @@
1
- const e = "Items", o = {
1
+ const e = "Items", o = "Default", t = "Custom", s = {
2
2
  "Global Styles & Layout": "Global Styles and Layout",
3
3
  "Structures & Modules": "Structures and Modules",
4
4
  "Recommendation Block": "Recommendation",
@@ -7,9 +7,13 @@ const e = "Items", o = {
7
7
  "This block is switched from the Old Version to the New Version. We recommend you check the Items block and test your message to ensure it works properly.": "This block is switched from the Old Version to the New Version. We recommend you check the Items block and test your message to ensure it works properly.",
8
8
  "Pixel Tracking Opt-in": "Pixel Tracking Opt-in",
9
9
  "OPT-IN SELECTION": "OPT-IN SELECTION",
10
- "UNSUBSCRIBE GROUPS": "UNSUBSCRIBE GROUPS"
10
+ "UNSUBSCRIBE GROUPS": "UNSUBSCRIBE GROUPS",
11
+ Default: o,
12
+ Custom: t
11
13
  };
12
14
  export {
15
+ t as Custom,
16
+ o as Default,
13
17
  e as Items,
14
- o as default
18
+ s as default
15
19
  };
@@ -1,4 +1,4 @@
1
- import { DEFAULT_COMPOSITION as d, DEFAULT_VISIBILITY as I } from "../../../extensions/Blocks/Recommendation/constants/defaultConfig.js";
1
+ import { DEFAULT_COMPOSITION as p, DEFAULT_VISIBILITY as I } from "../../../extensions/Blocks/Recommendation/constants/defaultConfig.js";
2
2
  import { ATTR_CUSTOM_PREFIX as l, ATTR_PRODUCT_BUTTON as k, ATTR_PRODUCT_OMNIBUS_DISCOUNT as A, ATTR_PRODUCT_OMNIBUS_PRICE as x, ATTR_PRODUCT_OLD_PRICE as f, ATTR_PRODUCT_PRICE as R, ATTR_PRODUCT_NAME as h, ATTR_PRODUCT_IMAGE as y } from "../../../extensions/Blocks/Recommendation/constants/selectors.js";
3
3
  import { mapTextTheme as E, mapButtonTheme as O, mapImageTheme as b } from "./themeMapper.js";
4
4
  const C = "__title__", a = "product_attribute.";
@@ -23,19 +23,22 @@ function N(r) {
23
23
  return { key: k, kind: "button" };
24
24
  default:
25
25
  if (r.variableType === "p_attribute" || t.startsWith("p_attribute_")) {
26
- const s = r.value ?? "", o = s.startsWith(a) ? s.slice(a.length) : s;
27
- return o ? {
28
- key: `${l}${o}`,
26
+ const o = r.value ?? "", s = o.startsWith(a) ? o.slice(a.length) : o;
27
+ if (!s)
28
+ return null;
29
+ const e = o || `${a}${s}`;
30
+ return {
31
+ key: `${l}${e}`,
29
32
  kind: "custom",
30
- customAttrName: o,
31
- customAttrValue: s || `${a}${o}`
32
- } : null;
33
+ customAttrName: s,
34
+ customAttrValue: e
35
+ };
33
36
  }
34
37
  return null;
35
38
  }
36
39
  }
37
- function p(r) {
38
- const t = d.indexOf(r);
40
+ function _(r) {
41
+ const t = p.indexOf(r);
39
42
  return t === -1 ? Number.POSITIVE_INFINITY : t;
40
43
  }
41
44
  function S(r) {
@@ -48,8 +51,8 @@ function S(r) {
48
51
  anyTextTrimming: !1
49
52
  };
50
53
  if (!r || r.length === 0)
51
- return t.composition = [...d], t;
52
- const s = [];
54
+ return t.composition = [...p], t;
55
+ const o = [];
53
56
  r.forEach((e, i) => {
54
57
  const n = N(e);
55
58
  if (n) {
@@ -57,7 +60,7 @@ function S(r) {
57
60
  t.titleVariable = e;
58
61
  return;
59
62
  }
60
- s.push({
63
+ o.push({
61
64
  key: n.key,
62
65
  kind: n.kind,
63
66
  hidden: e.hidden === !0,
@@ -68,30 +71,30 @@ function S(r) {
68
71
  originalIndex: i
69
72
  });
70
73
  }
71
- }), s.sort((e, i) => {
74
+ }), o.sort((e, i) => {
72
75
  if (e.positionIdx !== i.positionIdx)
73
76
  return e.positionIdx - i.positionIdx;
74
- const n = p(e.key), u = p(i.key);
77
+ const n = _(e.key), u = _(i.key);
75
78
  return n !== u ? n - u : e.originalIndex - i.originalIndex;
76
79
  });
77
- const o = {};
78
- return s.forEach((e) => {
79
- const { key: i, kind: n, hidden: u, legacy: m, customAttrName: c, customAttrValue: T } = e;
80
- switch (t.composition.push(i), t.visibility[i] = !u, n === "custom" && c && T && (t.customAttributes.includes(c) || t.customAttributes.push(c), t.customAttrValues[i] = T), n) {
80
+ const s = {};
81
+ return o.forEach((e) => {
82
+ const { key: i, kind: n, hidden: u, legacy: c, customAttrName: d, customAttrValue: m } = e;
83
+ switch (t.composition.push(i), t.visibility[i] = !u, n === "custom" && d && m && (t.customAttributes.includes(m) || t.customAttributes.push(m), t.customAttrValues[i] = m), n) {
81
84
  case "image":
82
- o[i] = b(m.theme);
85
+ s[i] = b(c.theme);
83
86
  break;
84
87
  case "button":
85
- o[i] = O(m.theme);
88
+ s[i] = O(c.theme);
86
89
  break;
87
90
  case "text":
88
91
  case "custom": {
89
- const _ = E(m.theme);
90
- o[i] = _, _.textTrimming && (t.anyTextTrimming = !0);
92
+ const T = E(c.theme);
93
+ s[i] = T, T.textTrimming && (t.anyTextTrimming = !0);
91
94
  break;
92
95
  }
93
96
  }
94
- }), t.perElementStyles = o, t;
97
+ }), t.perElementStyles = s, t;
95
98
  }
96
99
  export {
97
100
  S as mapComposition