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

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,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
@@ -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,16 +1,16 @@
1
1
  import { useRecommendation as N } from "../../composables/useRecommendation.js";
2
- import { DUMMY_IMAGE_MAPPINGS as C, REGEX as d, VerticalOrientation as $, CSS as n, ATTRIBUTES as p, CONDITIONS as A, HTML as g } from "../../enums/recommendation.js";
2
+ import { DUMMY_IMAGE_MAPPINGS as h, REGEX as d, VerticalOrientation as $, CSS as n, ATTRIBUTES as p, CONDITIONS as A, HTML as g } from "../../enums/recommendation.js";
3
3
  import { prepareRecommendationBlocks as O } from "./utils/recommendationCompilerUtils.js";
4
- const P = "https://s3-eu-west-1.amazonaws.com/", D = (t) => t.replace("https://", P), U = [
4
+ const H = [
5
5
  {
6
6
  id: "replace-images-with-variable-names",
7
7
  description: "Replacing dummy images with variable names in recommendation module",
8
8
  type: "custom",
9
9
  processor: (t) => {
10
10
  let e = t;
11
- return Object.entries(C).forEach(([, i]) => {
12
- Object.entries(i).forEach(([o, r]) => {
13
- e = e.replaceAll(D(r), `{{${o}}}`).replaceAll(r, `{{${o}}}`);
11
+ return Object.entries(h).forEach(([, r]) => {
12
+ Object.entries(r).forEach(([o, i]) => {
13
+ e = e.replaceAll(i, `{{${o}}}`);
14
14
  });
15
15
  }), e;
16
16
  },
@@ -42,13 +42,13 @@ const P = "https://s3-eu-west-1.amazonaws.com/", D = (t) => t.replace("https://"
42
42
  description: "Adding recommendation unresponsive css",
43
43
  type: "custom",
44
44
  processor: (t) => {
45
- const { calculateCardWidth: e, getRecommendationCampaignData: i } = N();
45
+ const { calculateCardWidth: e, getRecommendationCampaignData: r } = N();
46
46
  let o = t;
47
- const r = o.match(d.ID);
48
- if (r) {
47
+ const i = o.match(d.ID);
48
+ if (i) {
49
49
  const s = [];
50
- if (r.forEach((c) => {
51
- const m = /recommendation-id="(.*?)"/i.exec(c), E = m ? m[1].trim() : "", u = i(E);
50
+ if (i.forEach((c) => {
51
+ const m = /recommendation-id="(.*?)"/i.exec(c), E = m ? m[1].trim() : "", u = r(E);
52
52
  u.textTrimming && u.orientation === $ && s.push(e(u));
53
53
  }), s.length) {
54
54
  const c = `width:${Math.min(...s)}px!important;`;
@@ -72,25 +72,25 @@ const P = "https://s3-eu-west-1.amazonaws.com/", D = (t) => t.replace("https://"
72
72
  type: "custom",
73
73
  processor: (t) => {
74
74
  let e = t;
75
- const i = e.match(d.ATTRIBUTE_PARAGRAPH), { getRecommendationCampaignData: o } = N();
76
- return i !== null && i.forEach((r) => {
77
- const s = r.match(d.CUSTOM_FIELD);
75
+ const r = e.match(d.ATTRIBUTE_PARAGRAPH), { getRecommendationCampaignData: o } = N();
76
+ return r !== null && r.forEach((i) => {
77
+ const s = i.match(d.CUSTOM_FIELD);
78
78
  if (!s)
79
79
  return;
80
- const [c] = s, m = c.match(d.CUSTOM_FIELD_INDEXES_PART), E = c.match(d.CUSTOM_FIELD_NAME_PART), u = r.match(d.ATTRIBUTE_PARAGRAPH_START_TAG);
80
+ const [c] = s, m = c.match(d.CUSTOM_FIELD_INDEXES_PART), E = c.match(d.CUSTOM_FIELD_NAME_PART), u = i.match(d.ATTRIBUTE_PARAGRAPH_START_TAG);
81
81
  if (!m || !E || !u)
82
82
  return;
83
- const [b] = m, [I] = E, [T] = u, _ = I.substring(1, I.length - 2), S = T.match(d.COMPOSITION) !== null;
83
+ const [T] = m, [I] = E, [_] = u, b = I.substring(1, I.length - 2), S = _.match(d.COMPOSITION) !== null;
84
84
  let a = c;
85
85
  if (S) {
86
- const f = b.substring(2, b.length - 3), l = o(f);
87
- _ === p.OMNIBUS_PRICE && (l.priceBeforeTextValue && (a = `${l.priceBeforeTextValue}${a}`), l.priceAfterTextValue && (a = `${a}${l.priceAfterTextValue}`)), _ === p.OMNIBUS_DISCOUNT && (l.discountBeforeTextValue && (a = `${l.discountBeforeTextValue}${a}`), l.discountAfterTextValue && (a = `${a}${l.discountAfterTextValue}`));
86
+ const y = T.substring(2, T.length - 3), l = o(y);
87
+ b === p.OMNIBUS_PRICE && (l.priceBeforeTextValue && (a = `${l.priceBeforeTextValue}${a}`), l.priceAfterTextValue && (a = `${a}${l.priceAfterTextValue}`)), b === p.OMNIBUS_DISCOUNT && (l.discountBeforeTextValue && (a = `${l.discountBeforeTextValue}${a}`), l.discountAfterTextValue && (a = `${a}${l.discountAfterTextValue}`));
88
88
  }
89
- const R = b.substring(2);
90
- let y = "";
91
- _ in A.IF && (y = A.IF[_].replaceAll(`{${p.DISCOUNT}}`, `${R}${p.DISCOUNT}`).replaceAll(`{${p.OMNIBUS_DISCOUNT}}`, `${R}${p.OMNIBUS_DISCOUNT}`).replaceAll(`{${p.OMNIBUS_PRICE}}`, `${R}${p.OMNIBUS_PRICE}`));
92
- const h = `${T}${a}${g.PARAGRAPH_END_TAG}`, M = `${y}${S ? h : r}${A.ELSE}${T}${g.PARAGRAPH_END_TAG}${A.END_IF}`;
93
- e = e.replace(r, M);
89
+ const R = T.substring(2);
90
+ let f = "";
91
+ b in A.IF && (f = A.IF[b].replaceAll(`{${p.DISCOUNT}}`, `${R}${p.DISCOUNT}`).replaceAll(`{${p.OMNIBUS_DISCOUNT}}`, `${R}${p.OMNIBUS_DISCOUNT}`).replaceAll(`{${p.OMNIBUS_PRICE}}`, `${R}${p.OMNIBUS_PRICE}`));
92
+ const M = `${_}${a}${g.PARAGRAPH_END_TAG}`, C = `${f}${S ? M : i}${A.ELSE}${_}${g.PARAGRAPH_END_TAG}${A.END_IF}`;
93
+ e = e.replace(i, C);
94
94
  }), e;
95
95
  },
96
96
  priority: 53
@@ -114,7 +114,7 @@ const P = "https://s3-eu-west-1.amazonaws.com/", D = (t) => t.replace("https://"
114
114
  const e = /\s+(?:esd-extension-block-id|data-attribute-type|data-visibility|data-text-before|data-text-after|data-same-price|product-attr|composition)="[^"]*"/g;
115
115
  return t.replace(
116
116
  /<!--REC_START-->([\s\S]*?)<!--REC_END-->/g,
117
- (i, o) => `<!--REC_START-->${o.replace(e, "")}<!--REC_END-->`
117
+ (r, o) => `<!--REC_START-->${o.replace(e, "")}<!--REC_END-->`
118
118
  );
119
119
  },
120
120
  priority: 55
@@ -146,9 +146,9 @@ const P = "https://s3-eu-west-1.amazonaws.com/", D = (t) => t.replace("https://"
146
146
  ""
147
147
  ), e = e.replace(
148
148
  /@media[^{]*max-width\s*:\s*480px[^{]*\{((?:[^{}]*\{[^{}]*\})*[^{}]*)\}/g,
149
- (i, o) => {
150
- const r = o.match(/[^{}]+\{[^{}]*\}/g) || [], s = /ins-recommendation|product-image-cell|button-cell|product-info-cell/;
151
- return r.every((m) => s.test(m)) ? "" : i;
149
+ (r, o) => {
150
+ const i = o.match(/[^{}]+\{[^{}]*\}/g) || [], s = /ins-recommendation|product-image-cell|button-cell|product-info-cell/;
151
+ return i.every((m) => s.test(m)) ? "" : r;
152
152
  }
153
153
  )), e;
154
154
  },
@@ -167,7 +167,7 @@ const P = "https://s3-eu-west-1.amazonaws.com/", D = (t) => t.replace("https://"
167
167
  /<a\b[^>]*\bes-button\b[^>]*>/g,
168
168
  (e) => e.replace(
169
169
  /([;"]color:)([^;"]+)/g,
170
- (i, o, r) => r.includes("!important") ? i : `${o}${r} !important`
170
+ (r, o, i) => i.includes("!important") ? r : `${o}${i} !important`
171
171
  )
172
172
  ),
173
173
  priority: 58
@@ -184,8 +184,8 @@ const P = "https://s3-eu-west-1.amazonaws.com/", D = (t) => t.replace("https://"
184
184
  description: "Collapse whitespace inside recommendation blocks and strip boundary markers",
185
185
  type: "custom",
186
186
  processor: (t) => {
187
- const e = (i) => i.replace(/>\s+</g, "><").replace(/<[^>]+>/g, (o) => o.replace(/\s+/g, " "));
188
- return t.replace(/<!--REC_START-->([\s\S]*?)<!--REC_END-->/g, (i, o) => e(o)).replaceAll("<!--REC_START-->", "").replaceAll("<!--REC_END-->", "");
187
+ const e = (r) => r.replace(/>\s+</g, "><").replace(/<[^>]+>/g, (o) => o.replace(/\s+/g, " "));
188
+ return t.replace(/<!--REC_START-->([\s\S]*?)<!--REC_END-->/g, (r, o) => e(o)).replaceAll("<!--REC_START-->", "").replaceAll("<!--REC_END-->", "");
189
189
  },
190
190
  priority: 99
191
191
  },
@@ -208,5 +208,5 @@ const P = "https://s3-eu-west-1.amazonaws.com/", D = (t) => t.replace("https://"
208
208
  }
209
209
  ];
210
210
  export {
211
- U as recommendationCompilerRules
211
+ H as recommendationCompilerRules
212
212
  };
@@ -381,7 +381,7 @@ class H {
381
381
  * Supports all block types by detecting prefix and using appropriate type:
382
382
  *
383
383
  * Examples:
384
- * - {{ins_apr_img_1}} → https://web-image.useinsider.com/.../img_1.jpeg (CART_ITEMS)
384
+ * - {{ins_apr_img_1}} → https://s3.../img_1.jpeg (CART_ITEMS)
385
385
  * - {{browsed_item_name_2}} → 'Set of Sprite Yoga Straps' (BROWSED_ITEMS)
386
386
  * - {{purchased_item_formattedprice_5}} → '1,490.49' (PURCHASED_ITEMS)
387
387
  */
@@ -1,15 +1,15 @@
1
- const e = 20, t = 320, s = "vertical", m = {
1
+ const e = 20, s = 320, t = "vertical", m = {
2
2
  CART_ABANDONMENT: {
3
- ins_apr_img_1: "https://web-image.useinsider.com/email-assets/dummyImages/ins_apr_img_1.png",
4
- ins_apr_img_2: "https://web-image.useinsider.com/email-assets/dummyImages/ins_apr_img_2.png",
5
- ins_apr_img_3: "https://web-image.useinsider.com/email-assets/dummyImages/ins_apr_img_3.png",
6
- ins_apr_img_4: "https://web-image.useinsider.com/email-assets/dummyImages/ins_apr_img_4.png"
3
+ ins_apr_img_1: "https://s3-eu-west-1.amazonaws.com/web-image.useinsider.com/email-assets/dummyImages/ins_apr_img_1.png",
4
+ ins_apr_img_2: "https://s3-eu-west-1.amazonaws.com/web-image.useinsider.com/email-assets/dummyImages/ins_apr_img_2.png",
5
+ ins_apr_img_3: "https://s3-eu-west-1.amazonaws.com/web-image.useinsider.com/email-assets/dummyImages/ins_apr_img_3.png",
6
+ ins_apr_img_4: "https://s3-eu-west-1.amazonaws.com/web-image.useinsider.com/email-assets/dummyImages/ins_apr_img_4.png"
7
7
  },
8
8
  BROWSE_ABANDONMENT: {
9
- browsed_item_img_1: "https://web-image.useinsider.com/email-assets/dummyImages/browsed_item_img_1.jpg",
10
- browsed_item_img_2: "https://web-image.useinsider.com/email-assets/dummyImages/browsed_item_img_2.jpg",
11
- browsed_item_img_3: "https://web-image.useinsider.com/email-assets/dummyImages/browsed_item_img_3.jpg",
12
- browsed_item_img_4: "https://web-image.useinsider.com/email-assets/dummyImages/browsed_item_img_4.jpg"
9
+ browsed_item_img_1: "https://s3-eu-west-1.amazonaws.com/web-image.useinsider.com/email-assets/dummyImages/browsed_item_img_1.jpg",
10
+ browsed_item_img_2: "https://s3-eu-west-1.amazonaws.com/web-image.useinsider.com/email-assets/dummyImages/browsed_item_img_2.jpg",
11
+ browsed_item_img_3: "https://s3-eu-west-1.amazonaws.com/web-image.useinsider.com/email-assets/dummyImages/browsed_item_img_3.jpg",
12
+ browsed_item_img_4: "https://s3-eu-west-1.amazonaws.com/web-image.useinsider.com/email-assets/dummyImages/browsed_item_img_4.jpg"
13
13
  }
14
14
  }, i = {
15
15
  DISCOUNT: "discount",
@@ -23,7 +23,7 @@ const e = 20, t = 320, s = "vertical", m = {
23
23
  },
24
24
  ELSE: "{% else %}",
25
25
  END_IF: "{% endif %}"
26
- }, n = {
26
+ }, a = {
27
27
  ID: /recommendation-id="(.*?)"/gi,
28
28
  ATTRIBUTE_PARAGRAPH: /<p[^>]*?product-attr="(discount|omnibus_discount|omnibus_price)"[^>]*>[\S\s]*?<\/p>/gm,
29
29
  ATTRIBUTE_PARAGRAPH_START_TAG: /<p[^>]*?product-attr="(discount|omnibus_discount|omnibus_price)"[^>]*>/gm,
@@ -31,9 +31,9 @@ const e = 20, t = 320, s = "vertical", m = {
31
31
  CUSTOM_FIELD: /{{(?:reco_)?[0-9]+_[0-8]_(discount|omnibus_discount|omnibus_price)}}/gm,
32
32
  CUSTOM_FIELD_INDEXES_PART: /{{(?:reco_)?[0-9]+_[0-8]_/gm,
33
33
  CUSTOM_FIELD_NAME_PART: /_(discount|omnibus_discount|omnibus_price)}}/gm
34
- }, o = {
34
+ }, n = {
35
35
  PARAGRAPH_END_TAG: "</p>"
36
- }, a = {
36
+ }, o = {
37
37
  REGULAR_NAME_HEIGHT: ".ext-product-name.ins-vertical p { height:90px!important;",
38
38
  TRIMMED_NAME_HEIGHT: ".ext-product-name.ins-vertical p { height:18px!important;",
39
39
  ELLIPSIS: "text-overflow:ellipsis!important; white-space:nowrap!important;",
@@ -47,11 +47,11 @@ const e = 20, t = 320, s = "vertical", m = {
47
47
  export {
48
48
  i as ATTRIBUTES,
49
49
  _ as CONDITIONS,
50
- a as CSS,
50
+ o as CSS,
51
51
  m as DUMMY_IMAGE_MAPPINGS,
52
52
  e as DefaultPadding,
53
- o as HTML,
54
- t as MinDeviceViewport,
55
- n as REGEX,
56
- s as VerticalOrientation
53
+ n as HTML,
54
+ s as MinDeviceViewport,
55
+ a as REGEX,
56
+ t as VerticalOrientation
57
57
  };
@@ -1,12 +1,12 @@
1
- import { BlockId as f } from "../../../enums/block.js";
2
- import { useOnboardingStore as g } from "../../../stores/onboarding.js";
3
- import { getMigrationBannerHtml as y } from "../../../utils/migrationBannerHtml.js";
4
- import { Block as I, BlockCompositionType as C, ModificationDescription as c } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
5
- import { SETTINGS_ENUMS as d, DefaultConfigValues as m } from "./enums/settingsEnums.js";
6
- import { getDefaultTemplate as b } from "./template.js";
7
- import { getItemsBlockContainer as l, getItemsBlockConfig as u, deriveItemNumber as h, getDefaultItemsBlockConfig as N } from "./utils/nodeConfigUtils.js";
8
- const p = f.Items;
9
- class O extends I {
1
+ import { BlockId as g } from "../../../enums/block.js";
2
+ import { useOnboardingStore as y } from "../../../stores/onboarding.js";
3
+ import { getMigrationBannerHtml as I } from "../../../utils/migrationBannerHtml.js";
4
+ import { Block as C, BlockCompositionType as b, ModificationDescription as c } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
5
+ import { SETTINGS_ENUMS as l, DefaultConfigValues as d } from "./enums/settingsEnums.js";
6
+ import { getDefaultTemplate as h } from "./template.js";
7
+ import { getItemsBlockContainer as u, getItemsBlockConfig as f, deriveItemNumber as D, getDefaultItemsBlockConfig as N } from "./utils/nodeConfigUtils.js";
8
+ const p = g.Items;
9
+ class E extends C {
10
10
  getId() {
11
11
  return p;
12
12
  }
@@ -14,7 +14,7 @@ class O extends I {
14
14
  return "items-icon";
15
15
  }
16
16
  getBlockCompositionType() {
17
- return C.CONTAINER;
17
+ return b.CONTAINER;
18
18
  }
19
19
  getName() {
20
20
  return this.api.translate("Items");
@@ -23,20 +23,20 @@ class O extends I {
23
23
  return this.api.translate("Items lets you display personalized products based on user behavior.");
24
24
  }
25
25
  getSettingsPanelTitleHtml() {
26
- return y(
26
+ return I(
27
27
  p,
28
28
  this.api.translate("Items"),
29
29
  this.api.translate("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.")
30
30
  );
31
31
  }
32
32
  getTemplate() {
33
- return b({
34
- orientation: d.ORIENTATION.VERTICAL,
35
- itemsType: d.ITEMS_TYPE.CART_ITEMS,
33
+ return h({
34
+ orientation: l.ORIENTATION.VERTICAL,
35
+ itemsType: l.ITEMS_TYPE.CART_ITEMS,
36
36
  itemId: "{{Abandoned Cart Item (1) Url}}",
37
- currencySymbol: m.productPriceCurrencySymbolControlValue,
38
- currencyLocation: m.productPriceCurrencyLocationControlValue,
39
- formattedPrice: m.productPriceFormattedControlValue === "1"
37
+ currencySymbol: d.productPriceCurrencySymbolControlValue,
38
+ currencyLocation: d.productPriceCurrencyLocationControlValue,
39
+ formattedPrice: d.productPriceFormattedControlValue === "1"
40
40
  });
41
41
  }
42
42
  allowInnerBlocksDND() {
@@ -45,23 +45,23 @@ class O extends I {
45
45
  canBeSavedAsModule() {
46
46
  return !0;
47
47
  }
48
- onCreated(e) {
49
- const t = this.api.getDocumentModifier(), o = this.api.getDocumentRootCssNode();
50
- o.querySelector('[product-attr="imageSrc"] img') || t.modifyCss(o).appendRule('[product-attr="imageSrc"] img {object-fit: contain;}');
51
- const i = l(e);
52
- if (!i)
48
+ onCreated(n) {
49
+ const t = this.api.getDocumentModifier(), a = this.api.getDocumentRootCssNode();
50
+ a.querySelector('[product-attr="imageSrc"] img') || t.modifyCss(a).appendRule('[product-attr="imageSrc"] img {object-fit: contain;}');
51
+ const e = u(n);
52
+ if (!e)
53
53
  return;
54
- const r = i.getNodeConfig(), s = r && Object.keys(r).length > 0, n = u(e);
55
- if (n != null && n.initialized)
56
- if (s)
57
- n.blockInstanceId || this.api.getDocumentModifier().modifyHtml(i).setNodeConfig({ ...n, blockInstanceId: String(Date.now()) }).apply(new c("Assign block instance ID to block"));
54
+ const o = e.getNodeConfig(), r = o && Object.keys(o).length > 0, i = f(n);
55
+ if (i != null && i.initialized)
56
+ if (r)
57
+ i.blockInstanceId || this.api.getDocumentModifier().modifyHtml(e).setNodeConfig({ ...i, blockInstanceId: String(Date.now()) }).apply(new c("Assign block instance ID to block"));
58
58
  else {
59
- const a = this.api.getDocumentModifier();
60
- a.modifyHtml(i).setNodeConfig(n), this._stampProductTdDomAttributes(i, n, a), a.apply(new c("Migrate legacy config to nodeConfig"));
59
+ const s = this.api.getDocumentModifier();
60
+ s.modifyHtml(e).setNodeConfig(i), this._stampProductTdDomAttributes(e, i, s), s.apply(new c("Migrate legacy config to nodeConfig"));
61
61
  }
62
62
  else {
63
- const a = N();
64
- this.api.getDocumentModifier().modifyHtml(i).setNodeConfig(a).apply(new c("Initialize Items block with default configuration")), g().startOnboarding("itemsOnboarding");
63
+ const s = N(), m = this.api.getDocumentModifier();
64
+ m.modifyHtml(e).setNodeConfig(s), this._stampProductTdDomAttributes(e, s, m, !0), m.apply(new c("Initialize Items block with default configuration")), y().startOnboarding("itemsOnboarding");
65
65
  }
66
66
  }
67
67
  /**
@@ -70,18 +70,18 @@ class O extends I {
70
70
  * into nodeConfig, so without this a reused module would reset to defaults.
71
71
  * Guarded to the nodeConfig-empty case so it runs once and never loops.
72
72
  */
73
- onDocumentChanged(e) {
74
- const t = l(e);
73
+ onDocumentChanged(n) {
74
+ const t = u(n);
75
75
  if (!t)
76
76
  return;
77
- const o = t.getNodeConfig();
78
- if (o && Object.keys(o).length > 0)
77
+ const a = t.getNodeConfig();
78
+ if (a && Object.keys(a).length > 0)
79
79
  return;
80
- const r = u(e);
81
- if (!(r != null && r.initialized))
80
+ const o = f(n);
81
+ if (!(o != null && o.initialized))
82
82
  return;
83
- const s = this.api.getDocumentModifier();
84
- s.modifyHtml(t).setNodeConfig(r), this._stampProductTdDomAttributes(t, r, s), s.apply(new c("Recover Items block config from saved module"));
83
+ const r = this.api.getDocumentModifier();
84
+ r.modifyHtml(t).setNodeConfig(o), this._stampProductTdDomAttributes(t, o, r), r.apply(new c("Recover Items block config from saved module"));
85
85
  }
86
86
  /**
87
87
  * Bakes the compiler-read DOM attributes (`data-type`, `data-number`, `data-nodup`) onto the
@@ -91,12 +91,14 @@ class O extends I {
91
91
  * restored before export. The name `<a>` carries no data-type/data-number of its own and
92
92
  * relies on this td-level fallback in pairProductVariables.
93
93
  */
94
- _stampProductTdDomAttributes(e, t, o) {
95
- const i = h(t.itemsSelectValue, t.type);
96
- o.modifyHtml(e).setAttribute("data-type", t.type), o.modifyHtml(e).setAttribute("data-number", i), o.modifyHtml(e).setAttribute("data-nodup", String(t.priceHideDiscount));
94
+ _stampProductTdDomAttributes(n, t, a, e = !1) {
95
+ const o = D(t.itemsSelectValue, t.type), r = (i, s) => {
96
+ e && n.getAttribute(i) || a.modifyHtml(n).setAttribute(i, s);
97
+ };
98
+ r("data-type", t.type), r("data-number", o), r("data-nodup", String(t.priceHideDiscount));
97
99
  }
98
100
  }
99
101
  export {
100
102
  p as BLOCK_ID,
101
- O as ItemsBlock
103
+ E as ItemsBlock
102
104
  };