@useinsider/guido 3.17.0-beta.978ff7e → 3.17.0-beta.a0d17c2

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 (60) hide show
  1. package/README.md +1 -0
  2. package/dist/@types/config/schemas.js +7 -6
  3. package/dist/components/Guido.vue.js +10 -10
  4. package/dist/components/Guido.vue2.js +82 -76
  5. package/dist/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue.js +21 -0
  6. package/dist/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue2.js +106 -0
  7. package/dist/components/organisms/extensions/recommendation/RemoveStrategyModal.vue.js +17 -0
  8. package/dist/components/organisms/extensions/recommendation/RemoveStrategyModal.vue2.js +57 -0
  9. package/dist/components/organisms/extensions/recommendation/StrategyInfoBoxContent.vue.js +19 -0
  10. package/dist/components/organisms/extensions/recommendation/StrategyInfoBoxContent.vue2.js +63 -0
  11. package/dist/composables/useCustomInterfaceAppearance.js +52 -38
  12. package/dist/composables/useRecommendation.js +41 -34
  13. package/dist/config/i18n/en/labels.json.js +1 -1
  14. package/dist/config/migrator/recommendation/settingsMapper.js +17 -17
  15. package/dist/config/migrator/recommendationMigrator.js +5 -4
  16. package/dist/enums/academy.js +2 -1
  17. package/dist/enums/date.js +5 -3
  18. package/dist/enums/extensions/recommendationBlock.js +3 -1
  19. package/dist/extensions/Blocks/Recommendation/block.js +26 -21
  20. package/dist/extensions/Blocks/Recommendation/constants/defaultConfig.js +30 -30
  21. package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +60 -59
  22. package/dist/extensions/Blocks/Recommendation/controls/main/index.js +246 -187
  23. package/dist/extensions/Blocks/Recommendation/controls/main/strategy.js +124 -0
  24. package/dist/extensions/Blocks/Recommendation/services/configService.js +54 -36
  25. package/dist/extensions/Blocks/Recommendation/store/recommendation.js +175 -79
  26. package/dist/extensions/Blocks/Recommendation/utils/nodeConfigWriter.js +22 -0
  27. package/dist/extensions/Blocks/common-control.js +22 -19
  28. package/dist/guido.css +1 -1
  29. package/dist/services/recommendationApi.js +69 -30
  30. package/dist/src/@types/config/schemas.d.ts +2 -0
  31. package/dist/src/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue.d.ts +3 -0
  32. package/dist/src/components/organisms/extensions/recommendation/RemoveStrategyModal.vue.d.ts +2 -0
  33. package/dist/src/components/organisms/extensions/recommendation/StrategyInfoBoxContent.vue.d.ts +15 -0
  34. package/dist/src/composables/useConfig.d.ts +2 -0
  35. package/dist/src/composables/useRecommendation.d.ts +1 -0
  36. package/dist/src/enums/academy.d.ts +1 -0
  37. package/dist/src/enums/date.d.ts +1 -0
  38. package/dist/src/enums/extensions/recommendationBlock.d.ts +2 -0
  39. package/dist/src/extensions/Blocks/Recommendation/constants/defaultConfig.d.ts +2 -6
  40. package/dist/src/extensions/Blocks/Recommendation/constants/index.d.ts +1 -1
  41. package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +44 -8
  42. package/dist/src/extensions/Blocks/Recommendation/controls/main/strategy.d.ts +16 -0
  43. package/dist/src/extensions/Blocks/Recommendation/services/configService.d.ts +12 -1
  44. package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +176 -10
  45. package/dist/src/extensions/Blocks/Recommendation/types/nodeConfig.d.ts +1 -0
  46. package/dist/src/extensions/Blocks/Recommendation/utils/nodeConfigWriter.d.ts +31 -0
  47. package/dist/src/extensions/Blocks/common-control.d.ts +4 -1
  48. package/dist/src/mock/api/recommendation-strategies.d.ts +2 -0
  49. package/dist/src/services/recommendationApi.d.ts +4 -1
  50. package/dist/src/stores/config.d.ts +18 -0
  51. package/dist/src/stores/save-as-template.d.ts +4 -3
  52. package/dist/src/utils/genericUtil.d.ts +5 -0
  53. package/dist/static/assets/icons/line-change.svg.js +5 -0
  54. package/dist/static/assets/icons/line-delete.svg.js +5 -0
  55. package/dist/static/assets/icons/line-plus.svg.js +5 -0
  56. package/dist/static/styles/components/recommendation-strategy.css.js +155 -0
  57. package/dist/utils/dateUtil.js +23 -10
  58. package/dist/utils/genericUtil.js +28 -27
  59. package/dist/utils/templatePreparation.js +35 -34
  60. package/package.json +2 -1
@@ -1,53 +1,67 @@
1
- import S from "../static/styles/base.css.js";
2
- import m from "../static/styles/components/alert-message.css.js";
3
- import e from "../static/styles/components/amp-block.css.js";
4
- import i from "../static/styles/components/base-input.css.js";
5
- import p from "../static/styles/components/button-group.css.js";
6
- import n from "../static/styles/components/button.css.js";
7
- import s from "../static/styles/components/combobox.css.js";
8
- import C from "../static/styles/components/counter.css.js";
9
- import f from "../static/styles/components/dropdown-menu.css.js";
10
- import a from "../static/styles/components/loader.css.js";
11
- import u from "../static/styles/components/narrow-panel.css.js";
12
- import c from "../static/styles/components/popup.css.js";
13
- import d from "../static/styles/components/switcher.css.js";
14
- import l from "../static/styles/components/tabs.css.js";
15
- import h from "../static/styles/components/tools.css.js";
16
- import w from "../static/styles/components/version-history.css.js";
17
- import y from "../static/styles/components/wide-panel.css.js";
18
- import B from "../static/styles/variables.css.js";
19
- const b = [
20
- B,
21
- // Must be on top
22
- S,
1
+ import S from "../static/assets/icons/line-change.svg.js";
2
+ import i from "../static/assets/icons/line-delete.svg.js";
3
+ import n from "../static/assets/icons/line-plus.svg.js";
4
+ import p from "../static/styles/base.css.js";
5
+ import s from "../static/styles/components/alert-message.css.js";
6
+ import C from "../static/styles/components/amp-block.css.js";
7
+ import a from "../static/styles/components/base-input.css.js";
8
+ import f from "../static/styles/components/button-group.css.js";
9
+ import c from "../static/styles/components/button.css.js";
10
+ import u from "../static/styles/components/combobox.css.js";
11
+ import l from "../static/styles/components/counter.css.js";
12
+ import d from "../static/styles/components/dropdown-menu.css.js";
13
+ import h from "../static/styles/components/loader.css.js";
14
+ import g from "../static/styles/components/narrow-panel.css.js";
15
+ import I from "../static/styles/components/popup.css.js";
16
+ import w from "../static/styles/components/recommendation-strategy.css.js";
17
+ import y from "../static/styles/components/switcher.css.js";
18
+ import b from "../static/styles/components/tabs.css.js";
19
+ import B from "../static/styles/components/tools.css.js";
20
+ import $ from "../static/styles/components/version-history.css.js";
21
+ import P from "../static/styles/components/wide-panel.css.js";
22
+ import x from "../static/styles/variables.css.js";
23
+ function r(t, o) {
24
+ return `--guido-icon-${t}: url("data:image/svg+xml,${encodeURIComponent(o.trim())}");`;
25
+ }
26
+ const A = `:host {
27
+ ${r("line-change", S)}
28
+ ${r("line-delete", i)}
29
+ ${r("line-plus", n)}
30
+ }`, R = [
31
+ x,
23
32
  // Must be on top
24
- m,
25
- e,
26
- i,
33
+ A,
27
34
  p,
28
- n,
35
+ // Must be on top
29
36
  s,
30
37
  C,
31
- f,
32
38
  a,
33
- u,
39
+ f,
34
40
  c,
35
- d,
41
+ u,
36
42
  l,
43
+ d,
37
44
  h,
38
- w,
39
- y
45
+ g,
46
+ I,
47
+ y,
48
+ b,
49
+ B,
50
+ $,
51
+ P,
52
+ w
53
+ // Last: overrides button.css / wide-panel.css defaults
40
54
  ].join(`
41
55
 
42
- `), v = () => ({ importCss: () => {
56
+ `), Y = () => ({ importCss: () => {
43
57
  const o = new CSSStyleSheet();
44
- o.replaceSync(b);
45
- const r = document.querySelector("ui-editor");
46
- if (!r)
58
+ o.replaceSync(R);
59
+ const e = document.querySelector("ui-editor");
60
+ if (!e)
47
61
  return;
48
- const t = r.shadowRoot;
49
- t && (t.adoptedStyleSheets = [o]);
62
+ const m = e.shadowRoot;
63
+ m && (m.adoptedStyleSheets = [o]);
50
64
  } });
51
65
  export {
52
- v as useCustomInterfaceAppearance
66
+ Y as useCustomInterfaceAppearance
53
67
  };
@@ -1,22 +1,22 @@
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";
1
+ import { getRecommendationFeedSourceMaps as y, URLS as I } from "../enums/extensions/recommendationBlock.js";
2
+ import { MinDeviceViewport as C, DefaultPadding as R } from "../enums/recommendation.js";
3
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";
4
+ import { generateCompleteFilterQuery as b } from "../extensions/Blocks/Recommendation/utils/filterUtil.js";
5
+ import { getPartnerRecommendationParams as h } from "../extensions/Blocks/Recommendation/utils/partnerCustomizations.js";
6
6
  import { sanitizeProductIds as x } from "../extensions/Blocks/Recommendation/utils/productIds.js";
7
7
  import { useConfigStore as P } from "../stores/config.js";
8
8
  const B = () => ({
9
9
  calculateCardWidth: ({
10
- mobileLeftPadding: a,
11
- mobileRightPadding: s,
12
- cardsInRow: c,
10
+ mobileLeftPadding: i,
11
+ mobileRightPadding: c,
12
+ cardsInRow: s,
13
13
  unresponsive: n
14
14
  }) => {
15
- const r = n ? c : 1, e = a + s + (r - 1) * b;
16
- return (C - e) / r;
15
+ const o = n ? s : 1, e = i + c + (o - 1) * R;
16
+ return (C - e) / o;
17
17
  },
18
- getRecommendationCampaignData: (a) => {
19
- const s = l(), c = Number(a), n = s.blockStates[c];
18
+ getRecommendationCampaignData: (i) => {
19
+ const c = l(), s = Number(i), n = c.blockStates[s];
20
20
  if (!n)
21
21
  return {
22
22
  textTrimming: !1,
@@ -30,47 +30,54 @@ const B = () => ({
30
30
  discountBeforeTextValue: "",
31
31
  discountAfterTextValue: ""
32
32
  };
33
- const { recommendationConfigs: r } = n, e = r.orientation === "grid" ? "vertical" : "horizontal";
33
+ const { recommendationConfigs: o } = n, e = o.orientation === "grid" ? "vertical" : "horizontal";
34
34
  return {
35
- textTrimming: r.textTrimming,
35
+ textTrimming: o.textTrimming,
36
36
  orientation: e,
37
37
  mobileLeftPadding: 0,
38
38
  mobileRightPadding: 0,
39
- cardsInRow: r.cardsInRow,
40
- unresponsive: r.unresponsive,
39
+ cardsInRow: o.cardsInRow,
40
+ unresponsive: o.unresponsive,
41
41
  priceBeforeTextValue: "",
42
42
  priceAfterTextValue: "",
43
43
  discountBeforeTextValue: "",
44
44
  discountAfterTextValue: ""
45
45
  };
46
46
  },
47
- buildCampaignUrl: (a, s) => {
47
+ buildCampaignUrl: (i, c) => {
48
48
  var m;
49
- const c = l(), n = P(), r = Number(a);
49
+ const s = l(), n = P(), o = Number(i);
50
50
  let e;
51
- if (s)
52
- e = s;
51
+ if (c)
52
+ e = c;
53
53
  else {
54
- const i = c.blockStates[r];
55
- if (!i)
54
+ const a = s.blockStates[o];
55
+ if (!a)
56
56
  return "";
57
- const { recommendationConfigs: o } = i;
57
+ const { recommendationConfigs: r } = a;
58
58
  e = {
59
- strategy: o.strategy,
60
- language: o.language,
61
- currencyCode: o.currencySettings.value,
62
- size: o.size,
63
- productIds: o.productIds,
64
- filters: o.filters,
65
- shuffleProducts: o.shuffleProducts
59
+ strategy: r.strategy,
60
+ strategyId: r.strategyId,
61
+ language: r.language,
62
+ currencyCode: r.currencySettings.value,
63
+ size: r.size,
64
+ productIds: r.productIds,
65
+ filters: r.filters,
66
+ shuffleProducts: r.shuffleProducts
66
67
  };
67
68
  }
68
- const f = ((m = I().find((i) => i.key === e.strategy)) == null ? void 0 : m.path) || "", t = new URLSearchParams();
69
+ if (e.strategyId && n.isFeatureEnabled("reusableRecommendationStrategy"))
70
+ return s.recommendationCampaignUrls[i] = {
71
+ strategyId: e.strategyId,
72
+ locale: e.language,
73
+ currency: e.currencyCode
74
+ }, "";
75
+ const g = ((m = y().find((a) => a.key === e.strategy)) == null ? void 0 : m.path) || "", t = new URLSearchParams();
69
76
  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", x(e.productIds)) : e.strategy === "similarViewed" && t.set("productId", "{itemId}"), e.strategy === "userBased" && t.set("userId", "{user_id}");
70
- const g = e.filters.filter((i) => i.isValid), d = h(g);
71
- d && t.set("filter", d), e.shuffleProducts && t.set("shuffle", "true"), Object.entries(y(n.partnerName, e.strategy)).forEach(([i, o]) => t.set(i, o));
72
- const p = decodeURIComponent(t.toString()), u = `${R.RECOMMENDATION_API_URL}/v2/${f}?${p}`;
73
- return c.recommendationCampaignUrls[a] = u, u;
77
+ const f = e.filters.filter((a) => a.isValid), d = b(f);
78
+ d && t.set("filter", d), e.shuffleProducts && t.set("shuffle", "true"), Object.entries(h(n.partnerName, e.strategy)).forEach(([a, r]) => t.set(a, r));
79
+ const p = decodeURIComponent(t.toString()), u = `${I.RECOMMENDATION_API_URL}/v2/${g}?${p}`;
80
+ return s.recommendationCampaignUrls[i] = u, u;
74
81
  }
75
82
  });
76
83
  export {
@@ -1,7 +1,7 @@
1
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
- "Recommendation Block": "Recommendation",
4
+ "Recommendation Block": "Recommendation Block",
5
5
  Items: e,
6
6
  "This block is switched from the Old Version to the New Version. We recommend you check the Recommendation 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 Recommendation block and test your message to ensure it works properly.",
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.",
@@ -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: "" },
@@ -70,6 +70,6 @@ function U(t, o, n) {
70
70
  };
71
71
  }
72
72
  export {
73
- A as mapCurrency,
74
- U as mapSettings
73
+ L as mapCurrency,
74
+ O as mapSettings
75
75
  };
@@ -1,7 +1,7 @@
1
1
  import { BlockId as f } from "../../enums/block.js";
2
2
  import { DEFAULT_NODE_CONFIG as b } from "../../extensions/Blocks/Recommendation/constants/defaultConfig.js";
3
- import { ATTR_RECOMMENDATION_TITLE as T } from "../../extensions/Blocks/Recommendation/constants/selectors.js";
4
- import { useTemplateStore as y } from "../../stores/template.js";
3
+ import { ATTR_RECOMMENDATION_TITLE as y } from "../../extensions/Blocks/Recommendation/constants/selectors.js";
4
+ import { useTemplateStore as T } from "../../stores/template.js";
5
5
  import { mapComposition as v } from "./recommendation/compositionMapper.js";
6
6
  import { extractCurrencyFromBlock as C, extractTitleText as M, hasVisibleTitle as R, extractCardBgColor as S, isPartnerManagedBlock as h } from "./recommendation/extractors.js";
7
7
  import { buildBlockHtml as w } from "./recommendation/htmlBuilder.js";
@@ -23,9 +23,10 @@ function B(n, t, a) {
23
23
  const i = a[String(o)] ?? {
24
24
  currencySettings: C(t)
25
25
  }, c = A(i, r, o), e = v((l = r.composition) == null ? void 0 : l.variables), d = M(t);
26
- e.titleVariable || (e.visibility[T] = R(t));
26
+ e.titleVariable || (e.visibility[y] = R(t));
27
27
  const p = S(t), g = {
28
28
  ...c,
29
+ strategyId: "",
29
30
  composition: e.composition,
30
31
  visibility: e.visibility,
31
32
  previousTitleHtml: b.previousTitleHtml,
@@ -61,7 +62,7 @@ function B(n, t, a) {
61
62
  function G(n, t = {}) {
62
63
  const a = new DOMParser(), o = a.parseFromString(n, "text/html"), r = Array.from(o.querySelectorAll(H));
63
64
  try {
64
- y().$patch((e) => {
65
+ T().$patch((e) => {
65
66
  e.migrations = {
66
67
  ...e.migrations,
67
68
  [f.Recommendation]: r.length
@@ -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,7 @@
1
- const t = "tr-TR", L = "default";
1
+ const T = "tr-TR", t = "tr-TR", E = "default", L = "UTC";
2
2
  export {
3
- L as DEFAULT,
4
- t as DEFAULT_LOCALE
3
+ E as DEFAULT,
4
+ T as DEFAULT_LOCALE,
5
+ L as DEFAULT_TZ,
6
+ t as DOTTED_DATE_LOCALE
5
7
  };
@@ -2,7 +2,9 @@ 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
+ RECOMMENDATION_STRATEGIES_PANEL_PATH: "/discovery/recommendation-strategies"
6
8
  }, c = {
7
9
  CLIENT_ID: "clientId"
8
10
  }, d = () => {
@@ -1,25 +1,27 @@
1
- var B = Object.defineProperty;
2
- var D = (a, c, t) => c in a ? B(a, c, { enumerable: !0, configurable: !0, writable: !0, value: t }) : a[c] = t;
3
- var h = (a, c, t) => D(a, typeof c != "symbol" ? c + "" : c, t);
4
- import { BlockId as R } from "../../../enums/block.js";
5
- import { getMigrationBannerHtml as y } from "../../../utils/migrationBannerHtml.js";
1
+ var R = Object.defineProperty;
2
+ var B = (a, c, t) => c in a ? R(a, c, { enumerable: !0, configurable: !0, writable: !0, value: t }) : a[c] = t;
3
+ var p = (a, c, t) => B(a, typeof c != "symbol" ? c + "" : c, t);
4
+ import { useConfig as D } from "../../../composables/useConfig.js";
5
+ import { BlockId as y } from "../../../enums/block.js";
6
+ import { getMigrationBannerHtml as C } from "../../../utils/migrationBannerHtml.js";
6
7
  import { Block as b, BlockCompositionType as A, ModificationDescription as g } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
7
- import { regenerateMobileProductRows as C } from "./controls/main/utils.js";
8
- import { ensureMobileCssRulesExist as p, setMobileLayoutOptOut as f, hasMobileLayoutOptOut as E } from "./controls/mobileLayout/cssRules.js";
8
+ import { CURRENT_CONFIG_VERSION as E, PRE_RRS_CONFIG_VERSION as S } from "./constants/defaultConfig.js";
9
+ import { regenerateMobileProductRows as N } from "./controls/main/utils.js";
10
+ import { ensureMobileCssRulesExist as h, setMobileLayoutOptOut as f, hasMobileLayoutOptOut as O } from "./controls/mobileLayout/cssRules.js";
9
11
  import { RecommendationConfigService as s } from "./services/configService.js";
10
12
  import { useRecommendationExtensionStore as d } from "./store/recommendation.js";
11
- import { getDefaultTemplate as S } from "./templates/grid/template.js";
12
- import { useRecommendationBlockWarning as M } from "./useRecommendationBlockWarning.js";
13
- const _ = R.Recommendation, m = "recommendation-block-v2", u = "recommendation-id", I = "hide-price";
13
+ import { getDefaultTemplate as M } from "./templates/grid/template.js";
14
+ import { useRecommendationBlockWarning as w } from "./useRecommendationBlockWarning.js";
15
+ const _ = y.Recommendation, m = "recommendation-block-v2", u = "recommendation-id", I = "hide-price";
14
16
  let k = !1;
15
- class P extends b {
17
+ class K extends b {
16
18
  constructor() {
17
19
  super();
18
20
  /**
19
21
  * Stores the ID generated in getTemplate() so onCreated() can reuse it.
20
22
  * This avoids generating a new (different) ID in onCreated().
21
23
  */
22
- h(this, "_pendingBlockId", null);
24
+ p(this, "_pendingBlockId", null);
23
25
  }
24
26
  getId() {
25
27
  return _;
@@ -39,7 +41,7 @@ class P extends b {
39
41
  );
40
42
  }
41
43
  getSettingsPanelTitleHtml() {
42
- return y(
44
+ return C(
43
45
  _,
44
46
  this.api.translate("Recommendation Block"),
45
47
  this.api.translate("This block is switched from the Old Version to the New Version. We recommend you check the Recommendation block and test your message to ensure it works properly.")
@@ -63,7 +65,7 @@ class P extends b {
63
65
  */
64
66
  getTemplate() {
65
67
  const t = this._generateNextId();
66
- return this._pendingBlockId = t, S(t);
68
+ return this._pendingBlockId = t, M(t);
67
69
  }
68
70
  /**
69
71
  * Called when a new block is dropped into the template
@@ -89,12 +91,15 @@ class P extends b {
89
91
  const { config: n, wasFreshDrop: o } = s.initializeConfig(
90
92
  this.api,
91
93
  t,
92
- { recommendationId: i }
94
+ {
95
+ recommendationId: i,
96
+ configVersion: D().isFeatureEnabled("reusableRecommendationStrategy") ? E : S
97
+ }
93
98
  ), r = d();
94
99
  if (r.setCurrentBlock(i), this._stampHidePrice(t, n.priceHideIfSameAsDiscounted), o) {
95
- p(this.api);
100
+ h(this.api);
96
101
  const l = this._getBlockElement(t);
97
- l && (f(this.api, l, !0), C({
102
+ l && (f(this.api, l, !0), N({
98
103
  currentNode: t,
99
104
  documentModifier: this.api.getDocumentModifier()
100
105
  }));
@@ -121,11 +126,11 @@ class P extends b {
121
126
  }
122
127
  this._healLingeringDuplicate(t), s.needsMigration(t) && this._migrateFromLegacy(t), this._healHidePriceAttr(t);
123
128
  try {
124
- k || (p(this.api), k = !0);
129
+ k || (h(this.api), k = !0);
125
130
  const e = s.getConfig(t), i = this._getBlockElement(t);
126
131
  if (i) {
127
132
  const n = !e.mobileLayoutEnabled;
128
- E(i) !== n && f(this.api, i, n);
133
+ O(i) !== n && f(this.api, i, n);
129
134
  }
130
135
  } catch {
131
136
  }
@@ -155,7 +160,7 @@ class P extends b {
155
160
  */
156
161
  _warnIfMultipleBlocks() {
157
162
  try {
158
- M().warnIfMultipleBlocks(this.api.getDocumentRootHtmlNode());
163
+ w().warnIfMultipleBlocks(this.api.getDocumentRootHtmlNode());
159
164
  } catch {
160
165
  }
161
166
  }
@@ -333,5 +338,5 @@ class P extends b {
333
338
  }
334
339
  export {
335
340
  _ as BLOCK_ID,
336
- P as RecommendationBlock
341
+ K as RecommendationBlock
337
342
  };
@@ -1,60 +1,61 @@
1
- import { DEFAULT_COLUMN_SPACING as n, DEFAULT_ROW_SPACING as s, DEFAULT_MOBILE_ROW_SPACING as R, DEFAULT_MOBILE_COLUMN_SPACING as O, DEFAULT_MOBILE_CARDS_IN_ROW as e, DEFAULT_CARDS_IN_ROW as U } from "./layout.js";
2
- import { ATTR_PRODUCT_IMAGE as o, ATTR_PRODUCT_NAME as t, ATTR_PRODUCT_OLD_PRICE as _, ATTR_PRODUCT_PRICE as T, ATTR_PRODUCT_OMNIBUS_PRICE as r, ATTR_PRODUCT_OMNIBUS_DISCOUNT as i, ATTR_PRODUCT_BUTTON as I, ATTR_RECOMMENDATION_TITLE as A } from "./selectors.js";
3
- const C = {
1
+ import { DEFAULT_COLUMN_SPACING as R, DEFAULT_ROW_SPACING as s, DEFAULT_MOBILE_ROW_SPACING as n, DEFAULT_MOBILE_COLUMN_SPACING as O, DEFAULT_MOBILE_CARDS_IN_ROW as e, DEFAULT_CARDS_IN_ROW as C } from "./layout.js";
2
+ import { ATTR_PRODUCT_IMAGE as o, ATTR_PRODUCT_NAME as t, ATTR_PRODUCT_OLD_PRICE as _, ATTR_PRODUCT_PRICE as T, ATTR_PRODUCT_OMNIBUS_PRICE as r, ATTR_PRODUCT_OMNIBUS_DISCOUNT as I, ATTR_PRODUCT_BUTTON as i, ATTR_RECOMMENDATION_TITLE as U } from "./selectors.js";
3
+ const A = 1, u = 2, D = {
4
4
  code: "USD",
5
5
  symbol: "USD",
6
6
  alignment: "after",
7
7
  decimalCount: 2,
8
8
  decimalSeparator: ".",
9
9
  thousandSeparator: ","
10
- }, D = {
10
+ }, E = {
11
11
  textBefore: "",
12
12
  textAfter: ""
13
13
  }, a = {
14
14
  textBefore: "",
15
15
  textAfter: ""
16
- }, E = [
16
+ }, c = [
17
17
  o,
18
18
  t,
19
19
  _,
20
20
  T,
21
21
  r,
22
- i,
23
- I
24
- ], c = {
25
- [A]: !0,
22
+ I,
23
+ i
24
+ ], N = {
25
+ [U]: !0,
26
26
  [o]: !0,
27
27
  [t]: !0,
28
28
  [T]: !0,
29
29
  [_]: !0,
30
30
  [r]: !1,
31
- [i]: !1,
32
- [I]: !0
33
- }, S = {
31
+ [I]: !1,
32
+ [i]: !0
33
+ }, m = {
34
34
  // Settings
35
35
  strategy: "mostPopular",
36
36
  productIds: [],
37
37
  size: "6",
38
38
  shuffleProducts: !1,
39
39
  language: "en_US",
40
- currency: C,
40
+ currency: D,
41
41
  filters: [],
42
+ strategyId: "",
42
43
  // Layout
43
44
  layout: "grid",
44
- cardsInRow: U,
45
+ cardsInRow: C,
45
46
  mobileCardsInRow: e,
46
47
  mobileLayoutEnabled: !1,
47
48
  previousMobileCardsInRow: e,
48
- columnSpacing: n,
49
+ columnSpacing: R,
49
50
  rowSpacing: s,
50
51
  mobileColumnSpacing: O,
51
- mobileRowSpacing: R,
52
+ mobileRowSpacing: n,
52
53
  // Composition
53
- composition: E,
54
- visibility: c,
54
+ composition: c,
55
+ visibility: N,
55
56
  previousTitleHtml: "",
56
57
  // Element settings
57
- omnibusPrice: D,
58
+ omnibusPrice: E,
58
59
  omnibusDiscount: a,
59
60
  textTrimming: !1,
60
61
  // Price placement (block-level, affects all cards)
@@ -65,18 +66,17 @@ const C = {
65
66
  // of "false" (the actual hiding happens server-side at send).
66
67
  priceHideIfSameAsDiscounted: !1,
67
68
  // Meta
68
- // Version NOT bumped: mergeWithDefaults() backfills the two new fields from
69
- // defaults, so no data transform (and no needsMigration trigger) is required.
70
- configVersion: 1,
69
+ configVersion: A,
71
70
  recommendationId: 0
72
- }, u = [11, 12], m = 1;
71
+ }, L = [11, 12];
73
72
  export {
74
- m as CURRENT_CONFIG_VERSION,
75
- E as DEFAULT_COMPOSITION,
76
- C as DEFAULT_CURRENCY,
77
- S as DEFAULT_NODE_CONFIG,
73
+ u as CURRENT_CONFIG_VERSION,
74
+ c as DEFAULT_COMPOSITION,
75
+ D as DEFAULT_CURRENCY,
76
+ m as DEFAULT_NODE_CONFIG,
78
77
  a as DEFAULT_OMNIBUS_DISCOUNT,
79
- D as DEFAULT_OMNIBUS_PRICE,
80
- c as DEFAULT_VISIBILITY,
81
- u as EXCLUDED_ALGORITHM_IDS
78
+ E as DEFAULT_OMNIBUS_PRICE,
79
+ N as DEFAULT_VISIBILITY,
80
+ L as EXCLUDED_ALGORITHM_IDS,
81
+ A as PRE_RRS_CONFIG_VERSION
82
82
  };