@useinsider/guido 3.16.0 → 3.17.0-beta.24a776b

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 (58) hide show
  1. package/README.md +1 -0
  2. package/dist/@types/config/schemas.js +12 -6
  3. package/dist/components/Guido.vue.js +6 -6
  4. package/dist/components/Guido.vue2.js +66 -63
  5. package/dist/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue.js +18 -0
  6. package/dist/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue2.js +65 -0
  7. package/dist/composables/useConfig.js +37 -30
  8. package/dist/composables/useCustomInterfaceAppearance.js +52 -38
  9. package/dist/composables/useRecommendation.js +51 -42
  10. package/dist/composables/useStripo.js +30 -29
  11. package/dist/config/migrator/itemsBlockMigrator.js +1 -1
  12. package/dist/config/migrator/recommendation/settingsMapper.js +19 -17
  13. package/dist/config/migrator/recommendationMigrator.js +56 -37
  14. package/dist/enums/academy.js +2 -1
  15. package/dist/enums/date.js +4 -3
  16. package/dist/enums/extensions/recommendationBlock.js +4 -1
  17. package/dist/enums/recommendation.js +17 -17
  18. package/dist/extensions/Blocks/Items/enums/productEnums.js +45 -45
  19. package/dist/extensions/Blocks/Recommendation/block.js +26 -21
  20. package/dist/extensions/Blocks/Recommendation/constants/defaultConfig.js +36 -34
  21. package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +96 -95
  22. package/dist/extensions/Blocks/Recommendation/controls/main/algorithm.js +37 -26
  23. package/dist/extensions/Blocks/Recommendation/controls/main/index.js +147 -150
  24. package/dist/extensions/Blocks/Recommendation/controls/main/strategy.js +136 -0
  25. package/dist/extensions/Blocks/Recommendation/services/configService.js +35 -35
  26. package/dist/extensions/Blocks/Recommendation/store/recommendation.js +247 -107
  27. package/dist/extensions/Blocks/Recommendation/utils/productIds.js +6 -0
  28. package/dist/extensions/Blocks/common-control.js +22 -19
  29. package/dist/guido.css +1 -1
  30. package/dist/services/recommendationApi.js +72 -30
  31. package/dist/src/@types/config/schemas.d.ts +12 -0
  32. package/dist/src/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue.d.ts +3 -0
  33. package/dist/src/composables/useConfig.d.ts +3 -0
  34. package/dist/src/composables/useRecommendation.d.ts +1 -0
  35. package/dist/src/enums/academy.d.ts +1 -0
  36. package/dist/src/enums/extensions/recommendationBlock.d.ts +2 -0
  37. package/dist/src/extensions/Blocks/Recommendation/constants/defaultConfig.d.ts +7 -6
  38. package/dist/src/extensions/Blocks/Recommendation/constants/index.d.ts +1 -1
  39. package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +9 -3
  40. package/dist/src/extensions/Blocks/Recommendation/controls/main/strategy.d.ts +29 -0
  41. package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +204 -10
  42. package/dist/src/extensions/Blocks/Recommendation/types/nodeConfig.d.ts +6 -0
  43. package/dist/src/extensions/Blocks/Recommendation/utils/productIds.d.ts +6 -0
  44. package/dist/src/extensions/Blocks/common-control.d.ts +4 -1
  45. package/dist/src/mock/api/recommendation-strategies.d.ts +63 -0
  46. package/dist/src/services/recommendationApi.d.ts +4 -1
  47. package/dist/src/stores/config.d.ts +18 -0
  48. package/dist/src/stores/template.d.ts +14 -0
  49. package/dist/src/utils/strategyInfoBox.d.ts +18 -0
  50. package/dist/static/assets/icons/line-change.svg.js +5 -0
  51. package/dist/static/assets/icons/line-delete.svg.js +5 -0
  52. package/dist/static/assets/icons/line-plus.svg.js +5 -0
  53. package/dist/static/styles/components/recommendation-strategy.css.js +172 -0
  54. package/dist/stores/template.js +13 -8
  55. package/dist/utils/dateUtil.js +23 -10
  56. package/dist/utils/strategyInfoBox.js +37 -0
  57. package/dist/utils/templatePreparation.js +37 -34
  58. package/package.json +2 -1
@@ -1,22 +1,24 @@
1
- import { getRecommendationFeedSourceMaps as I, URLS as R } from "../enums/extensions/recommendationBlock.js";
2
- import { MinDeviceViewport as C, DefaultPadding as b } from "../enums/recommendation.js";
3
- import { useRecommendationExtensionStore as l } from "../extensions/Blocks/Recommendation/store/recommendation.js";
4
- import { generateCompleteFilterQuery as h } from "../extensions/Blocks/Recommendation/utils/filterUtil.js";
5
- import { getPartnerRecommendationParams as y } from "../extensions/Blocks/Recommendation/utils/partnerCustomizations.js";
6
- import { useConfigStore as x } from "../stores/config.js";
7
- const k = () => ({
1
+ import { useConfig as I } from "./useConfig.js";
2
+ import { getRecommendationFeedSourceMaps as C, URLS as R } from "../enums/extensions/recommendationBlock.js";
3
+ import { MinDeviceViewport as b, DefaultPadding as h } from "../enums/recommendation.js";
4
+ import { useRecommendationExtensionStore as f } from "../extensions/Blocks/Recommendation/store/recommendation.js";
5
+ import { generateCompleteFilterQuery as x } from "../extensions/Blocks/Recommendation/utils/filterUtil.js";
6
+ import { getPartnerRecommendationParams as P } from "../extensions/Blocks/Recommendation/utils/partnerCustomizations.js";
7
+ import { sanitizeProductIds as S } from "../extensions/Blocks/Recommendation/utils/productIds.js";
8
+ import { useConfigStore as T } from "../stores/config.js";
9
+ const M = () => ({
8
10
  calculateCardWidth: ({
9
- mobileLeftPadding: a,
10
- mobileRightPadding: s,
11
- cardsInRow: c,
12
- unresponsive: o
11
+ mobileLeftPadding: s,
12
+ mobileRightPadding: c,
13
+ cardsInRow: a,
14
+ unresponsive: n
13
15
  }) => {
14
- const r = o ? c : 1, e = a + s + (r - 1) * b;
15
- return (C - e) / r;
16
+ const o = n ? a : 1, d = s + c + (o - 1) * h;
17
+ return (b - d) / o;
16
18
  },
17
- getRecommendationCampaignData: (a) => {
18
- const s = l(), c = Number(a), o = s.blockStates[c];
19
- if (!o)
19
+ getRecommendationCampaignData: (s) => {
20
+ const c = f(), a = Number(s), n = c.blockStates[a];
21
+ if (!n)
20
22
  return {
21
23
  textTrimming: !1,
22
24
  orientation: "vertical",
@@ -29,49 +31,56 @@ const k = () => ({
29
31
  discountBeforeTextValue: "",
30
32
  discountAfterTextValue: ""
31
33
  };
32
- const { recommendationConfigs: r } = o, e = r.orientation === "grid" ? "vertical" : "horizontal";
34
+ const { recommendationConfigs: o } = n, d = o.orientation === "grid" ? "vertical" : "horizontal";
33
35
  return {
34
- textTrimming: r.textTrimming,
35
- orientation: e,
36
+ textTrimming: o.textTrimming,
37
+ orientation: d,
36
38
  mobileLeftPadding: 0,
37
39
  mobileRightPadding: 0,
38
- cardsInRow: r.cardsInRow,
39
- unresponsive: r.unresponsive,
40
+ cardsInRow: o.cardsInRow,
41
+ unresponsive: o.unresponsive,
40
42
  priceBeforeTextValue: "",
41
43
  priceAfterTextValue: "",
42
44
  discountBeforeTextValue: "",
43
45
  discountAfterTextValue: ""
44
46
  };
45
47
  },
46
- buildCampaignUrl: (a, s) => {
47
- var m;
48
- const c = l(), o = x(), r = Number(a);
48
+ buildCampaignUrl: (s, c) => {
49
+ var l;
50
+ const a = f(), n = T(), { isRrsSessionActive: o } = I(), d = Number(s);
49
51
  let e;
50
- if (s)
51
- e = s;
52
+ if (c)
53
+ e = c;
52
54
  else {
53
- const i = c.blockStates[r];
55
+ const i = a.blockStates[d];
54
56
  if (!i)
55
57
  return "";
56
- const { recommendationConfigs: n } = i;
58
+ const { recommendationConfigs: r } = i;
57
59
  e = {
58
- strategy: n.strategy,
59
- language: n.language,
60
- currencyCode: n.currencySettings.value,
61
- size: n.size,
62
- productIds: n.productIds,
63
- filters: n.filters,
64
- shuffleProducts: n.shuffleProducts
60
+ strategy: r.strategy,
61
+ strategyId: r.strategyId,
62
+ language: r.language,
63
+ currencyCode: r.currencySettings.value,
64
+ size: r.size,
65
+ productIds: r.productIds,
66
+ filters: r.filters,
67
+ shuffleProducts: r.shuffleProducts
65
68
  };
66
69
  }
67
- const f = ((m = I().find((i) => i.key === e.strategy)) == null ? void 0 : m.path) || "", t = new URLSearchParams();
68
- t.set("locale", e.language), t.set("currency", e.currencyCode), t.set("partnerName", o.partnerName), t.set("size", e.size), t.set("details", "true"), t.set("campaignId", o.variationId), e.strategy === "manualMerchandising" ? t.set("productId", e.productIds.join(",")) : e.strategy === "similarViewed" && t.set("productId", "{itemId}"), e.strategy === "userBased" && t.set("userId", "{user_id}");
69
- const g = e.filters.filter((i) => i.isValid), d = h(g);
70
- d && t.set("filter", d), e.shuffleProducts && t.set("shuffle", "true"), Object.entries(y(o.partnerName, e.strategy)).forEach(([i, n]) => t.set(i, n));
71
- const p = decodeURIComponent(t.toString()), u = `${R.RECOMMENDATION_API_URL}/v2/${f}?${p}`;
72
- return c.recommendationCampaignUrls[a] = u, u;
70
+ if (o() && e.strategyId)
71
+ return a.recommendationCampaignUrls[s] = {
72
+ strategyId: e.strategyId,
73
+ locale: e.language,
74
+ currency: e.currencyCode
75
+ }, "";
76
+ const g = ((l = C().find((i) => i.key === e.strategy)) == null ? void 0 : l.path) || "", t = new URLSearchParams();
77
+ t.set("locale", e.language), t.set("currency", e.currencyCode), t.set("partnerName", n.partnerName), t.set("size", e.size), t.set("details", "true"), t.set("campaignId", n.variationId), e.strategy === "manualMerchandising" ? t.set("productId", S(e.productIds)) : e.strategy === "similarViewed" && t.set("productId", "{itemId}"), e.strategy === "userBased" && t.set("userId", "{user_id}");
78
+ const p = e.filters.filter((i) => i.isValid), u = x(p);
79
+ u && t.set("filter", u), e.shuffleProducts && t.set("shuffle", "true"), Object.entries(P(n.partnerName, e.strategy)).forEach(([i, r]) => t.set(i, r));
80
+ const y = decodeURIComponent(t.toString()), m = `${R.RECOMMENDATION_API_URL}/v2/${g}?${y}`;
81
+ return a.recommendationCampaignUrls[s] = m, m;
73
82
  }
74
83
  });
75
84
  export {
76
- k as useRecommendation
85
+ M as useRecommendation
77
86
  };
@@ -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 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) => {
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) => {
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`, 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);
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);
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 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;
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;
35
35
  await window.UIEditor.initEditor(
36
36
  document.querySelector("#guido-editor"),
37
37
  {
@@ -57,6 +57,7 @@ const Ct = () => {
57
57
  messageSettingsEnabled: !0,
58
58
  displayGmailAnnotations: !0,
59
59
  displayHiddenPreheader: !1,
60
+ keepModuleStylesEnabled: !0,
60
61
  displayTitle: !1,
61
62
  displayUTM: !1,
62
63
  selectElementAfterDrop: !0,
@@ -77,38 +78,38 @@ const Ct = () => {
77
78
  )
78
79
  }
79
80
  ],
80
- async onTokenRefreshRequest(e) {
81
+ async onTokenRefreshRequest(t) {
81
82
  try {
82
- const d = await T();
83
- e(d);
83
+ const d = await M();
84
+ t(d);
84
85
  } catch (d) {
85
86
  p(d, "Failed to refresh token");
86
87
  }
87
88
  },
88
89
  onTemplateLoaded() {
89
90
  try {
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;
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;
93
94
  }, 1e3);
94
- } catch (e) {
95
- p(e, "Failed to load custom interface appearance");
95
+ } catch (t) {
96
+ p(t, "Failed to load custom interface appearance");
96
97
  }
97
98
  },
98
- onCodeEditorVisibilityChanged(e) {
99
- t.isCodeEditorOpen = e;
99
+ onCodeEditorVisibilityChanged(t) {
100
+ e.isCodeEditorOpen = t;
100
101
  },
101
- onEditorVisualModeChanged(e) {
102
- t.editorVisualMode = e.toLowerCase();
102
+ onEditorVisualModeChanged(t) {
103
+ e.editorVisualMode = t.toLowerCase();
103
104
  },
104
- onVersionHistoryVisibilityChanged(e) {
105
- t.isVersionHistoryOpen = e;
105
+ onVersionHistoryVisibilityChanged(t) {
106
+ e.isVersionHistoryOpen = t;
106
107
  },
107
108
  onDataChanged() {
108
- t.hasChanges = !0;
109
+ e.hasChanges = !0;
109
110
  },
110
- onEvent: F,
111
- onModuleAdd: M,
111
+ onEvent: B,
112
+ onModuleAdd: F,
112
113
  notifications: V(),
113
114
  ignoreClickOutsideSelectors: [
114
115
  "#guido-dynamic-content-modal",
@@ -124,11 +125,11 @@ const Ct = () => {
124
125
  const a = b();
125
126
  try {
126
127
  await f();
127
- const [r, t] = await Promise.all([
128
- v(),
129
- B()
128
+ const [r, e] = await Promise.all([
129
+ T(),
130
+ v()
130
131
  ]);
131
- a.syncModulesEnabled = t, await _(i, s, o, r, t);
132
+ a.syncModulesEnabled = e, await _(i, s, o, r, e);
132
133
  } catch {
133
134
  a.loadingStatus = !1, k({
134
135
  type: X.Error,
@@ -145,5 +146,5 @@ const Ct = () => {
145
146
  } };
146
147
  };
147
148
  export {
148
- Ct as useStripo
149
+ Ce as useStripo
149
150
  };
@@ -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://s3.../img_1.jpeg (CART_ITEMS)
384
+ * - {{ins_apr_img_1}} → https://web-image.useinsider.com/.../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,10 +1,10 @@
1
- import { CURRENT_CONFIG_VERSION as s, DEFAULT_CURRENCY as i } from "../../../extensions/Blocks/Recommendation/constants/defaultConfig.js";
2
- import { DEFAULT_CARDS_IN_ROW as m, DEFAULT_MOBILE_ROW_SPACING as p, DEFAULT_MOBILE_COLUMN_SPACING as d, DEFAULT_ROW_SPACING as f, DEFAULT_COLUMN_SPACING as S, DEFAULT_MOBILE_CARDS_IN_ROW as a } from "../../../extensions/Blocks/Recommendation/constants/layout.js";
1
+ import { PRE_RRS_CONFIG_VERSION as s, DEFAULT_CURRENCY as i } from "../../../extensions/Blocks/Recommendation/constants/defaultConfig.js";
2
+ import { DEFAULT_CARDS_IN_ROW as m, DEFAULT_MOBILE_ROW_SPACING as p, DEFAULT_MOBILE_COLUMN_SPACING as d, DEFAULT_ROW_SPACING as S, DEFAULT_COLUMN_SPACING as f, DEFAULT_MOBILE_CARDS_IN_ROW as a } from "../../../extensions/Blocks/Recommendation/constants/layout.js";
3
3
  import { mapLegacyStrategy as l } from "../../../extensions/Blocks/Recommendation/utils/legacyStrategyMap.js";
4
4
  function c(t) {
5
5
  return t === "0" || t === 0 ? "before" : "after";
6
6
  }
7
- function I(t) {
7
+ function _(t) {
8
8
  if (typeof t == "number" && Number.isFinite(t))
9
9
  return t;
10
10
  if (typeof t == "string") {
@@ -14,13 +14,13 @@ function I(t) {
14
14
  }
15
15
  return i.decimalCount;
16
16
  }
17
- function _(t) {
17
+ function I(t) {
18
18
  return t === "." || t === "," || t === " " || t === "" ? t : ",";
19
19
  }
20
- function N(t) {
20
+ function A(t) {
21
21
  return t === "." || t === "," || t === " " ? t : ".";
22
22
  }
23
- function A(t) {
23
+ function L(t) {
24
24
  if (!t || typeof t != "object")
25
25
  return { ...i };
26
26
  const o = t, n = o.value ?? o.name ?? i.code, r = o.symbol ?? n;
@@ -28,18 +28,18 @@ function A(t) {
28
28
  code: n,
29
29
  symbol: r,
30
30
  alignment: c(o.alignment),
31
- decimalCount: I(o.decimalCount),
32
- decimalSeparator: N(o.decimalSeparator),
33
- thousandSeparator: _(o.thousandSeparator)
31
+ decimalCount: _(o.decimalCount),
32
+ decimalSeparator: A(o.decimalSeparator),
33
+ thousandSeparator: I(o.thousandSeparator)
34
34
  };
35
35
  }
36
- function L(t) {
36
+ function N(t) {
37
37
  return t === "horizontal" || t === "list" ? "list" : "grid";
38
38
  }
39
39
  function R(t) {
40
40
  return l(t) || "mostPopular";
41
41
  }
42
- function U(t, o, n) {
42
+ function O(t, o, n) {
43
43
  const r = o.rowCount ?? t.cardsInRow ?? m, u = o.totalCount ?? (typeof t.size == "string" ? parseInt(t.size) : t.size) ?? 6;
44
44
  return {
45
45
  recommendationId: n,
@@ -48,15 +48,15 @@ function U(t, o, n) {
48
48
  size: String(u),
49
49
  shuffleProducts: !!t.shuffleProducts,
50
50
  language: t.language ?? "en_US",
51
- currency: A(t.currencySettings),
51
+ currency: L(t.currencySettings),
52
52
  filters: (t.filters ?? []).map((e) => ({ ...e })),
53
- layout: L(t.orientation ?? o.orientation),
53
+ layout: N(t.orientation ?? o.orientation),
54
54
  cardsInRow: r,
55
55
  mobileCardsInRow: a,
56
56
  mobileLayoutEnabled: !1,
57
57
  previousMobileCardsInRow: a,
58
- columnSpacing: S,
59
- rowSpacing: f,
58
+ columnSpacing: f,
59
+ rowSpacing: S,
60
60
  mobileColumnSpacing: d,
61
61
  mobileRowSpacing: p,
62
62
  omnibusPrice: { textBefore: "", textAfter: "" },
@@ -66,10 +66,12 @@ function U(t, o, n) {
66
66
  // gated). New Guido blocks default differently (see DEFAULT_NODE_CONFIG).
67
67
  priceMovedToNextLine: !!t.isPriceMovedToNextLine,
68
68
  priceHideIfSameAsDiscounted: !!t.isPriceDeletedForZeroSale,
69
+ // Legacy blocks stay on the pre-RRS era marker: the campaign they belong
70
+ // to keeps the old settings panel until its own migration ships.
69
71
  configVersion: s
70
72
  };
71
73
  }
72
74
  export {
73
- A as mapCurrency,
74
- U as mapSettings
75
+ L as mapCurrency,
76
+ O as mapSettings
75
77
  };
@@ -1,31 +1,34 @@
1
1
  import { BlockId as f } from "../../enums/block.js";
2
- import { useTemplateStore as b } from "../../stores/template.js";
3
- import { mapComposition as y } from "./recommendation/compositionMapper.js";
4
- import { extractCurrencyFromBlock as v, extractTitleText as C, extractCardBgColor as M, isPartnerManagedBlock as S } from "./recommendation/extractors.js";
2
+ import { PRE_RRS_CONFIG_VERSION as y, CURRENT_CONFIG_VERSION as R } from "../../extensions/Blocks/Recommendation/constants/defaultConfig.js";
3
+ import { useTemplateStore as S } from "../../stores/template.js";
4
+ import { mapComposition as b } from "./recommendation/compositionMapper.js";
5
+ import { extractCurrencyFromBlock as h, extractTitleText as C, extractCardBgColor as v, isPartnerManagedBlock as B } from "./recommendation/extractors.js";
5
6
  import { buildBlockHtml as w } from "./recommendation/htmlBuilder.js";
6
- import { parseRecommendationId as x, parseLegacyConfig as R } from "./recommendation/parseLegacyConfig.js";
7
- import { mapSettings as T } from "./recommendation/settingsMapper.js";
8
- const h = 'td[esd-dev-product-config][class*="ins-recommendation-v3-block-"]:not(.recommendation-block-v2), td.product-block[esd-handler-name*="EmailRecommendationV3"][esd-dev-product-config]:not(.recommendation-block-v2)';
9
- function B(i, t, a) {
10
- var d;
11
- const o = x(t);
12
- if (o === null)
7
+ import { parseRecommendationId as x, parseLegacyConfig as A } from "./recommendation/parseLegacyConfig.js";
8
+ import { mapSettings as E } from "./recommendation/settingsMapper.js";
9
+ const M = 'td[esd-dev-product-config][class*="ins-recommendation-v3-block-"]:not(.recommendation-block-v2), td.product-block[esd-handler-name*="EmailRecommendationV3"][esd-dev-product-config]:not(.recommendation-block-v2)';
10
+ function T(s, t, o) {
11
+ var l;
12
+ const e = x(t);
13
+ if (e === null)
13
14
  return console.warn(
14
15
  "[RecommendationMigrator] Skipping block — missing/invalid `ins-recommendation-v3-campaign-id`"
15
16
  ), !1;
16
- const r = R(t);
17
+ const r = A(t);
17
18
  if (!r)
18
19
  return console.warn(
19
- `[RecommendationMigrator] Aborting block id=${o} — \`esd-dev-product-config\` missing or unable to be parsed`
20
+ `[RecommendationMigrator] Aborting block id=${e} — \`esd-dev-product-config\` missing or unable to be parsed`
20
21
  ), !1;
21
- const n = a[String(o)] ?? {
22
- currencySettings: v(t)
23
- }, c = T(n, r, o), e = y((d = r.composition) == null ? void 0 : d.variables), l = C(t), g = M(t), p = {
24
- ...c,
25
- composition: e.composition,
26
- visibility: e.visibility,
27
- textTrimming: e.anyTextTrimming
28
- }, m = S(t), u = `
22
+ const a = o[String(e)] ?? {
23
+ currencySettings: h(t)
24
+ }, n = E(a, r, e), c = b((l = r.composition) == null ? void 0 : l.variables), i = C(t), g = v(t), p = {
25
+ ...n,
26
+ // Legacy blocks predate RRS — never strategy-backed.
27
+ strategyId: "",
28
+ composition: c.composition,
29
+ visibility: c.visibility,
30
+ textTrimming: c.anyTextTrimming
31
+ }, m = B(t), u = `
29
32
  <table>
30
33
  <tbody>
31
34
  <tr>
@@ -34,9 +37,9 @@ function B(i, t, a) {
34
37
  <tbody>
35
38
  <tr>${w({
36
39
  nodeConfig: p,
37
- composition: e,
40
+ composition: c,
38
41
  cardBg: g,
39
- titleText: l,
42
+ titleText: i,
40
43
  legacyId: t.getAttribute("id") ?? void 0,
41
44
  legacyBgColor: t.getAttribute("bgcolor") ?? void 0,
42
45
  preserveInnerHtml: m ? t.innerHTML : void 0,
@@ -48,32 +51,48 @@ function B(i, t, a) {
48
51
  </tr>
49
52
  </tbody>
50
53
  </table>
51
- `, s = i.parseFromString(u, "text/html").querySelector("td.esd-structure");
52
- return !s || !t.parentNode ? (console.warn(
53
- `[RecommendationMigrator] Aborting block id=${o} — failed to construct new HTML element`
54
- ), !1) : (t.parentNode.replaceChild(s, t), !0);
54
+ `, d = s.parseFromString(u, "text/html").querySelector("td.esd-structure");
55
+ return !d || !t.parentNode ? (console.warn(
56
+ `[RecommendationMigrator] Aborting block id=${e} — failed to construct new HTML element`
57
+ ), !1) : (t.parentNode.replaceChild(d, t), !0);
55
58
  }
56
- function q(i, t = {}) {
57
- const a = new DOMParser(), o = a.parseFromString(i, "text/html"), r = Array.from(o.querySelectorAll(h));
59
+ function k(s, t) {
60
+ let o = t, e = !1;
61
+ return s.querySelectorAll(".recommendation-block-v2").forEach((r) => {
62
+ const a = r.getAttribute("esd-ext-config");
63
+ if (!a) {
64
+ o = !0;
65
+ return;
66
+ }
67
+ try {
68
+ const n = JSON.parse(a);
69
+ (n.configVersion ?? y) < R && (o = !0), n.strategyId && (e = !0);
70
+ } catch {
71
+ o = !0;
72
+ }
73
+ }), { hasPreRrsBlocks: o, hasAssignedStrategy: e };
74
+ }
75
+ function q(s, t = {}) {
76
+ const o = new DOMParser(), e = o.parseFromString(s, "text/html"), r = Array.from(e.querySelectorAll(M)), a = k(e, r.length > 0);
58
77
  try {
59
- b().$patch((e) => {
60
- e.migrations = {
61
- ...e.migrations,
78
+ S().$patch((i) => {
79
+ i.migrations = {
80
+ ...i.migrations,
62
81
  [f.Recommendation]: r.length
63
- };
82
+ }, i.hasPreRrsRecommendationBlocks = a.hasPreRrsBlocks, i.hasAssignedStrategyBlocks = a.hasAssignedStrategy;
64
83
  });
65
84
  } catch {
66
85
  }
67
86
  if (r.length === 0)
68
- return i;
87
+ return s;
69
88
  let n = 0;
70
89
  return r.forEach((c) => {
71
90
  try {
72
- B(a, c, t) && (n += 1);
73
- } catch (e) {
74
- console.error("[RecommendationMigrator] Unexpected error migrating block:", e);
91
+ T(o, c, t) && (n += 1);
92
+ } catch (i) {
93
+ console.error("[RecommendationMigrator] Unexpected error migrating block:", i);
75
94
  }
76
- }), n > 0 && console.info(`[RecommendationMigrator] Migrated ${n} legacy Recommendation block(s)`), o.documentElement.outerHTML;
95
+ }), n > 0 && console.info(`[RecommendationMigrator] Migrated ${n} legacy Recommendation block(s)`), e.documentElement.outerHTML;
77
96
  }
78
97
  export {
79
98
  q as migrateRecommendation
@@ -1,7 +1,8 @@
1
1
  const e = "https://academy.insiderone.com", o = {
2
2
  EMAIL_EDITOR: `${e}/docs/email-drag-and-drop-editor`,
3
3
  GLOBAL_UNSUBSCRIBE: `${e}/docs/global-unsubscribe-preference-center`,
4
- AMP_FOR_EMAILS: `${e}/docs/amp-for-emails`
4
+ AMP_FOR_EMAILS: `${e}/docs/amp-for-emails`,
5
+ EMAIL_RECOMMENDATION_BLOCK: `${e}/docs/new-editor-email-recommendation-block`
5
6
  };
6
7
  export {
7
8
  o as ACADEMY_LINKS
@@ -1,5 +1,6 @@
1
- const t = "tr-TR", L = "default";
1
+ const t = "tr-TR", T = "default", L = "UTC";
2
2
  export {
3
- L as DEFAULT,
4
- t as DEFAULT_LOCALE
3
+ T as DEFAULT,
4
+ t as DEFAULT_LOCALE,
5
+ L as DEFAULT_TZ
5
6
  };
@@ -2,7 +2,10 @@ import { useTranslations as r } from "../../composables/useTranslations.js";
2
2
  const l = {
3
3
  RECOMMENDATION_API_URL: "https://recommendationv2.api.useinsider.com",
4
4
  // Relative path → same-origin as the embedding inone dashboard.
5
- PRODUCT_ATTRIBUTES_PATH: "/product-attributes/get-attributes"
5
+ PRODUCT_ATTRIBUTES_PATH: "/product-attributes/get-attributes",
6
+ RECOMMENDATION_STRATEGIES_PATH: "/api/recommendation-strategies",
7
+ // Panel route of the Recommendation Strategies listing.
8
+ RECOMMENDATION_STRATEGIES_PANEL_PATH: "/discovery/recommendation-strategies"
6
9
  }, c = {
7
10
  CLIENT_ID: "clientId"
8
11
  }, d = () => {
@@ -1,15 +1,15 @@
1
- const e = 20, s = 320, t = "vertical", m = {
1
+ const e = 20, t = 320, s = "vertical", m = {
2
2
  CART_ABANDONMENT: {
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"
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"
7
7
  },
8
8
  BROWSE_ABANDONMENT: {
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"
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"
13
13
  }
14
14
  }, i = {
15
15
  DISCOUNT: "discount",
@@ -23,7 +23,7 @@ const e = 20, s = 320, t = "vertical", m = {
23
23
  },
24
24
  ELSE: "{% else %}",
25
25
  END_IF: "{% endif %}"
26
- }, a = {
26
+ }, n = {
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, s = 320, t = "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
- }, n = {
35
- PARAGRAPH_END_TAG: "</p>"
36
34
  }, o = {
35
+ PARAGRAPH_END_TAG: "</p>"
36
+ }, a = {
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, s = 320, t = "vertical", m = {
47
47
  export {
48
48
  i as ATTRIBUTES,
49
49
  _ as CONDITIONS,
50
- o as CSS,
50
+ a as CSS,
51
51
  m as DUMMY_IMAGE_MAPPINGS,
52
52
  e as DefaultPadding,
53
- n as HTML,
54
- s as MinDeviceViewport,
55
- a as REGEX,
56
- t as VerticalOrientation
53
+ o as HTML,
54
+ t as MinDeviceViewport,
55
+ n as REGEX,
56
+ s as VerticalOrientation
57
57
  };