@useinsider/guido 3.15.0-beta.afdb685 → 3.15.0-beta.bc7091e

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 (32) hide show
  1. package/dist/composables/useAllowlist.js +48 -30
  2. package/dist/composables/useHtmlCompiler.js +19 -16
  3. package/dist/composables/useHtmlValidator.js +50 -50
  4. package/dist/composables/useStripo.js +29 -30
  5. package/dist/config/compiler/htmlCompilerRules.js +34 -7
  6. package/dist/config/compiler/recommendationCompilerRules.js +30 -30
  7. package/dist/config/i18n/en/labels.json.js +7 -3
  8. package/dist/config/migrator/itemsBlockMigrator.js +1 -1
  9. package/dist/config/migrator/recommendation/compositionMapper.js +26 -23
  10. package/dist/config/migrator/recommendation/htmlBuilder.js +156 -155
  11. package/dist/enums/recommendation.js +17 -17
  12. package/dist/extensions/Blocks/Items/enums/productEnums.js +45 -45
  13. package/dist/extensions/Blocks/Recommendation/constants/selectors.js +18 -15
  14. package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +363 -322
  15. package/dist/extensions/Blocks/Recommendation/controls/main/layoutOrientation.js +8 -8
  16. package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +271 -231
  17. package/dist/extensions/Blocks/Recommendation/templates/grid/template.js +16 -16
  18. package/dist/extensions/Blocks/Recommendation/templates/list/template.js +16 -16
  19. package/dist/extensions/Blocks/Recommendation/templates/utils.js +120 -120
  20. package/dist/extensions/Blocks/Recommendation/utils/captureStyleTemplates.js +55 -54
  21. package/dist/extensions/Blocks/Recommendation/utils/compositionKeys.js +89 -0
  22. package/dist/extensions/Blocks/common-control.js +42 -35
  23. package/dist/src/composables/useHtmlValidator.d.ts +3 -2
  24. package/dist/src/config/migrator/recommendation/types.d.ts +1 -0
  25. package/dist/src/extensions/Blocks/Recommendation/constants/index.d.ts +1 -1
  26. package/dist/src/extensions/Blocks/Recommendation/constants/selectors.d.ts +6 -0
  27. package/dist/src/extensions/Blocks/Recommendation/controls/cardComposition/index.d.ts +27 -5
  28. package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.d.ts +4 -2
  29. package/dist/src/extensions/Blocks/Recommendation/templates/utils.d.ts +12 -11
  30. package/dist/src/extensions/Blocks/Recommendation/utils/compositionKeys.d.ts +47 -0
  31. package/dist/src/extensions/Blocks/common-control.d.ts +3 -1
  32. package/package.json +1 -1
@@ -1,50 +1,68 @@
1
1
  import { useAllowlistApi as A } from "../services/allowlistApi.js";
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 = {
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 = {
6
19
  MANAGE: "journey-builder.domain-allowlist-warning",
7
20
  NON_MANAGE: "settings.allow-list-warning-not-admin-architect",
8
21
  ADD_BUTTON: "settings.allow-list-warning-add-button"
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}`;
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}`;
14
27
  try {
15
- const { hostname: u } = new URL(g);
16
- u && e.add(u.replace(/^www\./i, "").toLowerCase());
28
+ const u = new URL(h);
29
+ if (N(u))
30
+ return;
31
+ u.hostname && s.add(u.hostname.replace(/^www\./i, "").toLowerCase());
17
32
  } catch {
18
33
  }
19
- }), [...e];
20
- }, m = async (t) => {
21
- if (w.has(t))
34
+ }), [...s];
35
+ }, p = async (t) => {
36
+ if (g.has(t))
22
37
  return !0;
23
38
  try {
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;
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;
28
43
  }
29
44
  };
30
- return { getBlockedDomains: async (t, s) => {
45
+ return { getBlockedDomains: async (t, e) => {
31
46
  try {
32
- const o = d(t, s);
47
+ const o = i(t, e);
33
48
  return o.length ? (await Promise.all(
34
- o.map(async (e) => ({ domain: e, allowlisted: await m(e) }))
35
- )).filter((e) => !e.allowlisted).map((e) => e.domain) : [];
49
+ o.map(async (s) => ({ domain: s, allowlisted: await p(s) }))
50
+ )).filter((s) => !s.allowlisted).map((s) => s.domain) : [];
36
51
  } catch (o) {
37
52
  return console.error("[GUIDO_ALLOWLIST] getBlockedDomains failed", o), [];
38
53
  }
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) } };
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
+ } };
46
64
  };
47
65
  export {
48
66
  O as buildAllowlistSettingsUrl,
49
- M as useAllowlist
67
+ C as useAllowlist
50
68
  };
@@ -1,13 +1,13 @@
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";
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";
5
5
  import { recommendationCompilerRules as v } from "../config/compiler/recommendationCompilerRules.js";
6
- import { socialCompilerRules as H } from "../config/compiler/socialCompilerRules.js";
7
- import { unsubscribeCompilerRules as x } from "../config/compiler/unsubscribeCompilerRules.js";
6
+ import { socialCompilerRules as y } from "../config/compiler/socialCompilerRules.js";
7
+ import { unsubscribeCompilerRules as H } from "../config/compiler/unsubscribeCompilerRules.js";
8
8
  import { createHtmlCompiler as s } from "../utils/htmlCompiler.js";
9
- import { useConfig as k } from "./useConfig.js";
10
- const y = /* @__PURE__ */ new Set([
9
+ import { useConfig as x } from "./useConfig.js";
10
+ const h = /* @__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,6 +18,9 @@ const y = /* @__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",
21
24
  // Unsubscribe domain — the actual fix: injects the real unsubscribe href in
22
25
  // place of the `{{ins-*-unsubscribe-link}}` placeholders, plus related
23
26
  // unsubscribe-only cleanups. All pure regex/text, no AMP-forbidden output.
@@ -32,21 +35,21 @@ const y = /* @__PURE__ */ new Set([
32
35
  "remove-contenteditable"
33
36
  ]), M = () => {
34
37
  var i, m, r;
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,
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,
37
40
  ...v,
38
- ...x,
39
- ...g,
40
- ...b,
41
41
  ...H,
42
- ...n("liquidSyntax") ? C : [],
42
+ ...R,
43
+ ...C,
44
+ ...y,
45
+ ...a("liquidSyntax") ? b : [],
43
46
  ...p.map((e, f) => ({
44
47
  ...e,
45
48
  priority: e.priority + 1e3 + f
46
49
  // Ensure additional rules run after default rules
47
50
  }))
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) };
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) };
50
53
  };
51
54
  export {
52
55
  M as useHtmlCompiler
@@ -6,7 +6,7 @@ import { ToasterTypeOptions as c } from "../enums/toaster.js";
6
6
  import { itemsBlockDynamicVariables as q } from "../extensions/Blocks/Items/enums/productEnums.js";
7
7
  import { RECOMMENDATION_VARIABLE_BUILTIN_ATTRIBUTES as K } from "../extensions/Blocks/Recommendation/constants/selectors.js";
8
8
  import { useRecommendationExtensionStore as z } from "../extensions/Blocks/Recommendation/store/recommendation.js";
9
- import { resolveProductAttrValue as Z } from "../extensions/Blocks/Recommendation/templates/utils.js";
9
+ import { filterToProductAttrValue as Z } from "../extensions/Blocks/Recommendation/utils/compositionKeys.js";
10
10
  import { RecommendationRequiredFieldsKey as J } from "../extensions/Blocks/Recommendation/validation/requiredFields.js";
11
11
  import { useRecommendationStore as Q } from "../stores/recommendation.js";
12
12
  import { base64EncodeWithSpecialChars as ee } from "../utils/base64.js";
@@ -15,25 +15,25 @@ import { useHttp as ne } from "./useHttp.js";
15
15
  import { useToaster as se } from "./useToaster.js";
16
16
  import { useTranslations as re } from "./useTranslations.js";
17
17
  const oe = /recommendation-id="(\d+)"/g;
18
- function ie(n) {
19
- return [...n.matchAll(oe)].map((m) => m[1]);
18
+ function ie(s) {
19
+ return [...s.matchAll(oe)].map((m) => m[1]);
20
20
  }
21
- function ae(n, m) {
22
- return m.some((f) => n.startsWith(`${f}_`));
21
+ function ae(s, m) {
22
+ return m.some((f) => s.startsWith(`${f}_`));
23
23
  }
24
24
  const ce = /^(\d+)_\d+_(.+)$/;
25
- function le(n) {
26
- const m = n.match(ce);
25
+ function le(s) {
26
+ const m = s.match(ce);
27
27
  return m ? { recoId: m[1], attribute: m[2] } : null;
28
28
  }
29
- function me(n) {
29
+ function me(s) {
30
30
  const m = new Set(K);
31
- return Object.values(n).forEach((f) => {
32
- m.add(Z(f.attributeName, n).toLowerCase());
31
+ return Object.values(s).forEach((f) => {
32
+ m.add(Z(f).toLowerCase());
33
33
  }), m;
34
34
  }
35
- function ue(n, m, f, o, d) {
36
- const u = n.match(/{{([a-zA-Z0-9_.\s]*)}}/gm);
35
+ function ue(s, m, f, o, d) {
36
+ const u = s.match(/{{([a-zA-Z0-9_.\s]*)}}/gm);
37
37
  if (!u)
38
38
  return [];
39
39
  const g = new Set(m.map((h) => h.toLowerCase())), E = [];
@@ -51,14 +51,14 @@ function ue(n, m, f, o, d) {
51
51
  ae(p, f) || p.includes(".") || E.push(p);
52
52
  }), E;
53
53
  }
54
- function de(n) {
55
- return (n.replace($, "$1").match(Y) ?? []).filter((o) => {
54
+ function de(s) {
55
+ return (s.replace($, "$1").match(Y) ?? []).filter((o) => {
56
56
  const d = o.slice(2, -2), u = d.indexOf("|"), g = (u === -1 ? d : d.slice(0, u)).trim();
57
57
  return U.includes(g) ? !1 : j.test(g) ? u !== -1 && d.slice(u + 1).trim() === "" : !0;
58
58
  });
59
59
  }
60
60
  const xe = () => {
61
- const { showToaster: n } = se(), { post: m } = ne(), { config: f } = V(), o = re(), d = Q(), u = z(), g = te(
61
+ const { showToaster: s } = se(), { post: m } = ne(), { config: f } = V(), o = re(), d = Q(), u = z(), g = te(
62
62
  () => {
63
63
  var e, t;
64
64
  return ((t = (e = f.value) == null ? void 0 : e.partner) == null ? void 0 : t.messageType) === W.transactional;
@@ -73,59 +73,59 @@ const xe = () => {
73
73
  }
74
74
  return me(u.filterList);
75
75
  }, h = async (e) => {
76
- const s = await m(
76
+ const n = await m(
77
77
  "/newsletter/template-library/check-template-html-body",
78
78
  { html: ee(e) }
79
- ), { status: r, message: a } = s.data;
80
- return r || n({
79
+ ), { status: r, message: a } = n.data;
80
+ return r || s({
81
81
  type: c.Error,
82
82
  message: r === void 0 ? a : o("newsletter.invalid-url-link-for-toaster")
83
- }), o(P), a === o(X) && n({
83
+ }), o(P), a === o(X) && s({
84
84
  type: c.Error,
85
85
  message: o("newsletter.already-in-progress")
86
86
  }), r;
87
87
  }, p = (e) => !["if", "endif", "else", "elif", "now"].includes(e.toLowerCase()), y = (e) => ["if", "endif"].includes(e.toLowerCase()), S = (e, t) => {
88
- const s = e.match(/({%(.*?)%})/g);
88
+ const n = e.match(/({%(.*?)%})/g);
89
89
  let r = !0;
90
- return s !== null && !g.value && s.forEach((a) => {
90
+ return n !== null && !g.value && n.forEach((a) => {
91
91
  const i = a.slice(2, -2).trim().match(/(".*?"|[^"\s]+)(?=\s*|\s*$)/g);
92
92
  if (i && i.length > 0) {
93
93
  const [l] = i;
94
- p(l) && !t.includes(l) && (n({
94
+ p(l) && !t.includes(l) && (s({
95
95
  type: c.Warning,
96
96
  message: o("custom-fields.invalid-custom-fields")
97
97
  }), r = !1);
98
98
  }
99
99
  }), r;
100
- }, A = async (e, t, s) => {
101
- const r = s ? await h(e) : !0;
100
+ }, A = async (e, t, n) => {
101
+ const r = n ? await h(e) : !0;
102
102
  return S(e, t) && r;
103
- }, T = (e) => e.length > 0 ? !0 : (n({
103
+ }, T = (e) => e.length > 0 ? !0 : (s({
104
104
  type: c.Warning,
105
105
  message: o("newsletter.html-content-is-empty")
106
106
  }), !1), w = (e) => {
107
- const t = (e.match(/{/gm) || []).length, s = (e.match(/}/gm) || []).length;
108
- return t > s && n({
107
+ const t = (e.match(/{/gm) || []).length, n = (e.match(/}/gm) || []).length;
108
+ return t > n && s({
109
109
  type: c.Warning,
110
110
  message: o("custom-fields.missing-closing-braces")
111
- }), t < s && n({
111
+ }), t < n && s({
112
112
  type: c.Warning,
113
113
  message: o("custom-fields.missing-opening-braces")
114
- }), t === s;
114
+ }), t === n;
115
115
  }, R = (e) => {
116
116
  const t = de(e).length === 0;
117
- return t || n({
117
+ return t || s({
118
118
  type: c.Warning,
119
119
  message: o("custom-fields.invalid-custom-fields")
120
120
  }), t;
121
- }, _ = (e, t, s, r) => {
121
+ }, _ = (e, t, n, r) => {
122
122
  if (g.value)
123
123
  return !0;
124
124
  const a = ue(
125
125
  e,
126
126
  t,
127
127
  ie(e),
128
- s,
128
+ n,
129
129
  r
130
130
  );
131
131
  if (a.length > 0) {
@@ -134,56 +134,56 @@ const xe = () => {
134
134
  ${a.map((l) => `<li>${l}</li>`).join("")}
135
135
  </ul>
136
136
  `;
137
- return n({
137
+ return s({
138
138
  type: c.Error,
139
139
  message: o("custom-fields.invalid-custom-fields") + i
140
140
  }), !1;
141
141
  }
142
142
  return !0;
143
143
  }, N = (e) => {
144
- const t = e.match(/{%(.*?)%}/g), s = [];
144
+ const t = e.match(/{%(.*?)%}/g), n = [];
145
145
  let r = !0;
146
146
  if (t && t.forEach((a) => {
147
147
  const i = a.match(G), l = a.match(H), C = (i == null ? void 0 : i.join("")) || "";
148
- (!i || a !== C) && !l && (n({
148
+ (!i || a !== C) && !l && (s({
149
149
  type: c.Error,
150
150
  message: o("newsletter.display-conditions-invalid-syntax")
151
151
  }), r = !1), i && i.forEach((v) => {
152
- v.trim() === "=" && (n({
152
+ v.trim() === "=" && (s({
153
153
  type: c.Error,
154
154
  message: o("custom-conditions.wrong-equality-operators")
155
155
  }), r = !1);
156
156
  const I = v.match(/^[a-zA-Z]*$/g);
157
157
  I && I.forEach((b) => {
158
- y(b) && s.push(b);
158
+ y(b) && n.push(b);
159
159
  });
160
160
  });
161
- }), s.length) {
162
- const a = s.filter((l) => l === "if"), i = s.filter((l) => l === "endif");
163
- a.length !== i.length && (n({
161
+ }), n.length) {
162
+ const a = n.filter((l) => l === "if"), i = n.filter((l) => l === "endif");
163
+ a.length !== i.length && (s({
164
164
  type: c.Error,
165
165
  message: o("custom-conditions.missing-if-endif-tag")
166
166
  }), r = !1);
167
167
  }
168
168
  return r;
169
169
  }, x = (e) => {
170
- const t = (e.match(/{% /gm) || []).length, s = (e.match(/ %}/gm) || []).length, r = t === s;
171
- return r || n({
170
+ const t = (e.match(/{% /gm) || []).length, n = (e.match(/ %}/gm) || []).length, r = t === n;
171
+ return r || s({
172
172
  type: c.Warning,
173
173
  message: o("custom-conditions.no-space-after-braces")
174
174
  }), r;
175
- }, O = (e) => (e.match(/({%(.*?)%})/g) || []).filter((s) => s.includes("if")).map((s) => (s.match(/{{.*}}/gm) || []).length).reduce((s, r) => s + r, 0) > 0 ? (n({
175
+ }, O = (e) => (e.match(/({%(.*?)%})/g) || []).filter((n) => n.includes("if")).map((n) => (n.match(/{{.*}}/gm) || []).length).reduce((n, r) => n + r, 0) > 0 ? (s({
176
176
  type: c.Warning,
177
177
  message: o("custom-conditions.no-braces-inside-if-tag")
178
- }), !1) : !0, k = () => u.hasInvalidBlock() ? (n({
178
+ }), !1) : !0, k = () => u.hasInvalidBlock() ? (s({
179
179
  type: c.Error,
180
180
  message: o(J)
181
- }), !1) : !0, B = () => d.recommendationConfigs && Object.values(d.recommendationConfigs).find((t) => t.filters.find((s) => s.value === "")) !== void 0 ? (n({
181
+ }), !1) : !0, B = () => d.recommendationConfigs && Object.values(d.recommendationConfigs).find((t) => t.filters.find((n) => n.value === "")) !== void 0 ? (s({
182
182
  type: c.Error,
183
183
  message: o("newsletter.fill-all-necessary-fields")
184
184
  }), !1) : !0, D = (e) => {
185
185
  const t = /src="[^"]*\.(svg|pst)"/gm;
186
- return e.match(t) === null ? !0 : (n({
186
+ return e.match(t) === null ? !0 : (s({
187
187
  type: c.Error,
188
188
  message: o("newsletter.invalid-image-type")
189
189
  }), !1);
@@ -192,7 +192,7 @@ const xe = () => {
192
192
  return Array.from(r).find((i) => {
193
193
  var l;
194
194
  return !((l = i.id) != null && l.trim());
195
- }) ? (n({
195
+ }) ? (s({
196
196
  type: c.Error,
197
197
  message: o("unsubscribe-templates.select-checkbox-groups")
198
198
  }), !1) : !0;
@@ -201,19 +201,19 @@ const xe = () => {
201
201
  return Array.from(r).find((i) => {
202
202
  var l;
203
203
  return !((l = i.id) != null && l.trim());
204
- }) ? (n({
204
+ }) ? (s({
205
205
  type: c.Error,
206
206
  message: o("unsubscribe-templates.select-radio-button-groups")
207
207
  }), !1) : !0;
208
208
  };
209
- return { validateHtml: async (e, t, s = !1) => {
209
+ return { validateHtml: async (e, t, n = !1) => {
210
210
  var C, v;
211
211
  const r = [
212
212
  ...t.map((I) => I.value),
213
213
  ...q,
214
214
  ...((v = (C = f.value) == null ? void 0 : C.template) == null ? void 0 : v.customFieldAttributes) ?? []
215
215
  ], a = M(e), i = await E(a);
216
- return await A(e, r, s) && T(e) && w(e) && R(e) && _(e, r, a, i) && N(e) && x(e) && O(e) && k() && B() && D(e) && F(e) && L(e);
216
+ return await A(e, r, n) && T(e) && w(e) && R(e) && _(e, r, a, i) && N(e) && x(e) && O(e) && k() && B() && D(e) && F(e) && L(e);
217
217
  } };
218
218
  };
219
219
  export {
@@ -16,22 +16,22 @@ import { useEditorStore as b } from "../stores/editor.js";
16
16
  import { buildMergeTagEntries as W, flattenDynamicContentList as Y } from "../utils/genericUtil.js";
17
17
  import Z from "../package.json.js";
18
18
  let n = null;
19
- const Ce = () => {
20
- const { features: c, template: u, isFeatureEnabled: m } = q(), { handleError: p, showToaster: k } = G(), { getToken: M, getCustomFonts: T, getSyncModulesStatus: v } = K(), { handleEvent: B } = z(), { handleModuleAdd: F } = j(), { getStripoBlocksConfig: A } = O(), { getStripoNotifications: V } = $(), f = () => n || (n = new Promise((i, s) => {
19
+ const Ct = () => {
20
+ const { features: c, template: u, isFeatureEnabled: m } = q(), { handleError: p, showToaster: k } = G(), { getToken: T, getCustomFonts: v, getSyncModulesStatus: B } = K(), { handleEvent: F } = z(), { handleModuleAdd: M } = j(), { getStripoBlocksConfig: A } = O(), { getStripoNotifications: V } = $(), f = () => n || (n = new Promise((i, s) => {
21
21
  var l;
22
22
  if (document.getElementById("UiEditorScript")) {
23
23
  i();
24
24
  return;
25
25
  }
26
- const o = Z.guido, r = `https://email-static.useinsider.com/guido/${(l = o == null ? void 0 : o.stripo) == null ? void 0 : l.version}/UIEditor.js`, e = document.createElement("script");
27
- e.id = "UiEditorScript", e.type = "module", e.src = r, e.onload = () => i(), e.onerror = () => {
28
- e.remove(), s(new Error(`Failed to load Stripo UIEditor script from S3: ${r}`));
29
- }, document.body.appendChild(e);
26
+ const o = Z.guido, r = `https://email-static.useinsider.com/guido/${(l = o == null ? void 0 : o.stripo) == null ? void 0 : l.version}/UIEditor.js`, t = document.createElement("script");
27
+ t.id = "UiEditorScript", t.type = "module", t.src = r, t.onload = () => i(), t.onerror = () => {
28
+ t.remove(), s(new Error(`Failed to load Stripo UIEditor script from S3: ${r}`));
29
+ }, document.body.appendChild(t);
30
30
  }), n.catch(() => {
31
31
  n = null;
32
32
  }), n), _ = async (i, s, o, a = [], r = !1) => {
33
33
  var y, E, h, C;
34
- const e = b(), { html: l, css: D } = i, { baseBlocks: g, extensions: R } = await A(), S = ((y = c.value) == null ? void 0 : y.displayConditions) ?? !0, P = ((E = c.value) == null ? void 0 : E.modulesDisabled) ?? !1, U = ((h = u.value) == null ? void 0 : h.forceRecreate) ?? !1;
34
+ const t = b(), { html: l, css: D } = i, { baseBlocks: g, extensions: R } = await A(), S = ((y = c.value) == null ? void 0 : y.displayConditions) ?? !0, P = ((E = c.value) == null ? void 0 : E.modulesDisabled) ?? !1, U = ((h = u.value) == null ? void 0 : h.forceRecreate) ?? !1;
35
35
  await window.UIEditor.initEditor(
36
36
  document.querySelector("#guido-editor"),
37
37
  {
@@ -57,7 +57,6 @@ const Ce = () => {
57
57
  messageSettingsEnabled: !0,
58
58
  displayGmailAnnotations: !0,
59
59
  displayHiddenPreheader: !1,
60
- keepModuleStylesEnabled: !0,
61
60
  displayTitle: !1,
62
61
  displayUTM: !1,
63
62
  selectElementAfterDrop: !0,
@@ -78,38 +77,38 @@ const Ce = () => {
78
77
  )
79
78
  }
80
79
  ],
81
- async onTokenRefreshRequest(t) {
80
+ async onTokenRefreshRequest(e) {
82
81
  try {
83
- const d = await M();
84
- t(d);
82
+ const d = await T();
83
+ e(d);
85
84
  } catch (d) {
86
85
  p(d, "Failed to refresh token");
87
86
  }
88
87
  },
89
88
  onTemplateLoaded() {
90
89
  try {
91
- const { importCss: t } = H(), { activateCustomViewStyles: d, updateTimerInClonedTemplate: I } = L(), { injectFullStory: x } = N();
92
- t(), d(), x(), I(), o.onReady(), e.isStripoInitialized = !0, e.loadingStatus = !1, setTimeout(() => {
93
- e.hasChanges = !1;
90
+ const { importCss: e } = H(), { activateCustomViewStyles: d, updateTimerInClonedTemplate: I } = L(), { injectFullStory: x } = N();
91
+ e(), d(), x(), I(), o.onReady(), t.isStripoInitialized = !0, t.loadingStatus = !1, setTimeout(() => {
92
+ t.hasChanges = !1;
94
93
  }, 1e3);
95
- } catch (t) {
96
- p(t, "Failed to load custom interface appearance");
94
+ } catch (e) {
95
+ p(e, "Failed to load custom interface appearance");
97
96
  }
98
97
  },
99
- onCodeEditorVisibilityChanged(t) {
100
- e.isCodeEditorOpen = t;
98
+ onCodeEditorVisibilityChanged(e) {
99
+ t.isCodeEditorOpen = e;
101
100
  },
102
- onEditorVisualModeChanged(t) {
103
- e.editorVisualMode = t.toLowerCase();
101
+ onEditorVisualModeChanged(e) {
102
+ t.editorVisualMode = e.toLowerCase();
104
103
  },
105
- onVersionHistoryVisibilityChanged(t) {
106
- e.isVersionHistoryOpen = t;
104
+ onVersionHistoryVisibilityChanged(e) {
105
+ t.isVersionHistoryOpen = e;
107
106
  },
108
107
  onDataChanged() {
109
- e.hasChanges = !0;
108
+ t.hasChanges = !0;
110
109
  },
111
- onEvent: B,
112
- onModuleAdd: F,
110
+ onEvent: F,
111
+ onModuleAdd: M,
113
112
  notifications: V(),
114
113
  ignoreClickOutsideSelectors: [
115
114
  "#guido-dynamic-content-modal",
@@ -125,11 +124,11 @@ const Ce = () => {
125
124
  const a = b();
126
125
  try {
127
126
  await f();
128
- const [r, e] = await Promise.all([
129
- T(),
130
- v()
127
+ const [r, t] = await Promise.all([
128
+ v(),
129
+ B()
131
130
  ]);
132
- a.syncModulesEnabled = e, await _(i, s, o, r, e);
131
+ a.syncModulesEnabled = t, await _(i, s, o, r, t);
133
132
  } catch {
134
133
  a.loadingStatus = !1, k({
135
134
  type: X.Error,
@@ -146,5 +145,5 @@ const Ce = () => {
146
145
  } };
147
146
  };
148
147
  export {
149
- Ce as useStripo
148
+ Ct as useStripo
150
149
  };
@@ -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 r = e;
126
- return t.forEach((s) => {
127
- r = r.replace("</head>", `${s}</head>`);
128
- }), r;
125
+ let s = e;
126
+ return t.forEach((r) => {
127
+ s = s.replace("</head>", `${r}</head>`);
128
+ }), s;
129
129
  },
130
130
  priority: 30
131
131
  },
@@ -147,6 +147,33 @@ 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
+ },
150
177
  {
151
178
  id: "convert-rgb-to-hex",
152
179
  // SD-142395: rgb()/6-digit hex are verbose; hex/3-digit shorthand is byte-identical
@@ -156,9 +183,9 @@ const d = [
156
183
  type: "custom",
157
184
  processor: (e) => {
158
185
  const t = (i) => i.toString(16).padStart(2, "0");
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)}`;
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)}`;
162
189
  }).replace(/#([0-9a-f])\1([0-9a-f])\2([0-9a-f])\3\b/gi, "#$1$2$3");
163
190
  },
164
191
  priority: 44