@useinsider/guido 3.17.0-beta.58179dc → 3.17.0-beta.668ca65

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 (80) hide show
  1. package/README.md +1 -0
  2. package/dist/@types/config/schemas.js +7 -6
  3. package/dist/components/Guido.vue.js +8 -8
  4. package/dist/components/Guido.vue2.js +77 -73
  5. package/dist/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue.js +21 -0
  6. package/dist/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue2.js +105 -0
  7. package/dist/components/organisms/extensions/recommendation/StrategyInfoBoxContent.vue.js +19 -0
  8. package/dist/components/organisms/extensions/recommendation/StrategyInfoBoxContent.vue2.js +62 -0
  9. package/dist/composables/useCustomInterfaceAppearance.js +52 -38
  10. package/dist/composables/useRecommendation.js +41 -34
  11. package/dist/config/migrator/index.js +8 -9
  12. package/dist/config/migrator/recommendation/compositionMapper.js +20 -20
  13. package/dist/config/migrator/recommendation/extractors.js +24 -29
  14. package/dist/config/migrator/recommendation/htmlBuilder.js +130 -116
  15. package/dist/config/migrator/recommendation/settingsMapper.js +17 -17
  16. package/dist/config/migrator/recommendationMigrator.js +14 -16
  17. package/dist/enums/academy.js +2 -1
  18. package/dist/enums/date.js +5 -3
  19. package/dist/enums/extensions/recommendationBlock.js +3 -1
  20. package/dist/extensions/Blocks/Recommendation/block.js +27 -51
  21. package/dist/extensions/Blocks/Recommendation/constants/blockIds.js +1 -1
  22. package/dist/extensions/Blocks/Recommendation/constants/controlIds.js +1 -1
  23. package/dist/extensions/Blocks/Recommendation/constants/defaultConfig.js +24 -25
  24. package/dist/extensions/Blocks/Recommendation/constants/selectors.js +28 -34
  25. package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +256 -323
  26. package/dist/extensions/Blocks/Recommendation/controls/main/index.js +162 -167
  27. package/dist/extensions/Blocks/Recommendation/controls/main/strategy.js +124 -0
  28. package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +0 -1
  29. package/dist/extensions/Blocks/Recommendation/extension.js +29 -31
  30. package/dist/extensions/Blocks/Recommendation/services/configService.js +35 -35
  31. package/dist/extensions/Blocks/Recommendation/settingsPanel.js +4 -23
  32. package/dist/extensions/Blocks/Recommendation/store/recommendation.js +165 -79
  33. package/dist/extensions/Blocks/Recommendation/templates/grid/template.js +3 -3
  34. package/dist/extensions/Blocks/Recommendation/templates/utils.js +107 -85
  35. package/dist/extensions/Blocks/common-control.js +22 -19
  36. package/dist/guido.css +1 -1
  37. package/dist/services/recommendationApi.js +69 -30
  38. package/dist/src/@types/config/schemas.d.ts +2 -0
  39. package/dist/src/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue.d.ts +3 -0
  40. package/dist/src/components/organisms/extensions/recommendation/StrategyInfoBoxContent.vue.d.ts +15 -0
  41. package/dist/src/composables/useConfig.d.ts +2 -0
  42. package/dist/src/composables/useRecommendation.d.ts +1 -0
  43. package/dist/src/config/migrator/recommendation/extractors.d.ts +0 -8
  44. package/dist/src/enums/academy.d.ts +1 -0
  45. package/dist/src/enums/date.d.ts +1 -0
  46. package/dist/src/enums/extensions/recommendationBlock.d.ts +2 -0
  47. package/dist/src/extensions/Blocks/Recommendation/block.d.ts +0 -15
  48. package/dist/src/extensions/Blocks/Recommendation/constants/blockIds.d.ts +1 -2
  49. package/dist/src/extensions/Blocks/Recommendation/constants/controlIds.d.ts +0 -7
  50. package/dist/src/extensions/Blocks/Recommendation/constants/defaultConfig.d.ts +2 -7
  51. package/dist/src/extensions/Blocks/Recommendation/constants/index.d.ts +2 -2
  52. package/dist/src/extensions/Blocks/Recommendation/constants/selectors.d.ts +0 -10
  53. package/dist/src/extensions/Blocks/Recommendation/controls/cardComposition/index.d.ts +0 -10
  54. package/dist/src/extensions/Blocks/Recommendation/controls/index.d.ts +0 -1
  55. package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +10 -4
  56. package/dist/src/extensions/Blocks/Recommendation/controls/main/strategy.d.ts +16 -0
  57. package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.d.ts +0 -1
  58. package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +150 -10
  59. package/dist/src/extensions/Blocks/Recommendation/types/nodeConfig.d.ts +1 -0
  60. package/dist/src/extensions/Blocks/common-control.d.ts +4 -1
  61. package/dist/src/mock/api/recommendation-strategies.d.ts +2 -0
  62. package/dist/src/services/recommendationApi.d.ts +4 -1
  63. package/dist/src/stores/config.d.ts +18 -0
  64. package/dist/src/stores/save-as-template.d.ts +4 -3
  65. package/dist/static/assets/icons/line-change.svg.js +5 -0
  66. package/dist/static/assets/icons/line-delete.svg.js +5 -0
  67. package/dist/static/assets/icons/line-plus.svg.js +5 -0
  68. package/dist/static/styles/components/recommendation-strategy.css.js +155 -0
  69. package/dist/static/styles/customEditorStyle.css.js +1 -3
  70. package/dist/utils/dateUtil.js +23 -10
  71. package/dist/utils/templatePreparation.js +35 -34
  72. package/package.json +2 -1
  73. package/dist/config/migrator/recommendationTitleMigrator.js +0 -119
  74. package/dist/extensions/Blocks/Recommendation/controls/title/index.js +0 -44
  75. package/dist/extensions/Blocks/Recommendation/templates/titleRows.js +0 -33
  76. package/dist/extensions/Blocks/Recommendation/utils/legacyTitle.js +0 -20
  77. package/dist/src/config/migrator/recommendationTitleMigrator.d.ts +0 -5
  78. package/dist/src/extensions/Blocks/Recommendation/controls/title/index.d.ts +0 -86
  79. package/dist/src/extensions/Blocks/Recommendation/templates/titleRows.d.ts +0 -13
  80. package/dist/src/extensions/Blocks/Recommendation/utils/legacyTitle.d.ts +0 -20
@@ -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 {
@@ -2,15 +2,14 @@ import { migrateCheckbox as t } from "./checkboxMigrator.js";
2
2
  import { migrateCouponBlock as i } from "./couponBlockMigrator.js";
3
3
  import { migrateItemsBlock as e } from "./itemsBlockMigrator.js";
4
4
  import { migrateProductNameLink as a } from "./productNameLinkMigrator.js";
5
- import { migrateRadioButton as n } from "./radioButtonMigrator.js";
6
- import { migrateRecommendation as c } from "./recommendationMigrator.js";
7
- import { migrateRecommendationTitle as g } from "./recommendationTitleMigrator.js";
8
- import { migrateSocialIcons as p } from "./socialIconMigrator.js";
9
- import { migrateUnsubscribe as f } from "./unsubscribeMigrator.js";
10
- const C = async (o, r = {}) => {
11
- let m = o;
12
- return m = t(m), m = n(m), m = await f(m), m = i(m), m = c(m, r), m = g(m), m = e(m), m = a(m), m = p(m), m;
5
+ import { migrateRadioButton as c } from "./radioButtonMigrator.js";
6
+ import { migrateRecommendation as g } from "./recommendationMigrator.js";
7
+ import { migrateSocialIcons as n } from "./socialIconMigrator.js";
8
+ import { migrateUnsubscribe as p } from "./unsubscribeMigrator.js";
9
+ const x = async (r, o = {}) => {
10
+ let m = r;
11
+ return m = t(m), m = c(m), m = await p(m), m = i(m), m = g(m, o), m = e(m), m = a(m), m = n(m), m;
13
12
  };
14
13
  export {
15
- C as migrate
14
+ x as migrate
16
15
  };
@@ -1,34 +1,34 @@
1
1
  import { DEFAULT_COMPOSITION as p, DEFAULT_VISIBILITY as I } from "../../../extensions/Blocks/Recommendation/constants/defaultConfig.js";
2
- import { ATTR_RECOMMENDATION_TITLE as l, ATTR_CUSTOM_PREFIX as k, ATTR_PRODUCT_BUTTON as A, ATTR_PRODUCT_OMNIBUS_DISCOUNT as R, ATTR_PRODUCT_OMNIBUS_PRICE as x, ATTR_PRODUCT_OLD_PRICE as f, ATTR_PRODUCT_PRICE as h, ATTR_PRODUCT_NAME as E, ATTR_PRODUCT_IMAGE as O } from "../../../extensions/Blocks/Recommendation/constants/selectors.js";
3
- import { mapTextTheme as b, mapButtonTheme as y, mapImageTheme as N } from "./themeMapper.js";
4
- const C = "__title__", T = "product_attribute.";
5
- function P(r) {
2
+ import { ATTR_CUSTOM_PREFIX as l, ATTR_PRODUCT_BUTTON as k, ATTR_PRODUCT_OMNIBUS_DISCOUNT as A, ATTR_PRODUCT_OMNIBUS_PRICE as x, ATTR_PRODUCT_OLD_PRICE as f, ATTR_PRODUCT_PRICE as R, ATTR_PRODUCT_NAME as h, ATTR_PRODUCT_IMAGE as y } from "../../../extensions/Blocks/Recommendation/constants/selectors.js";
3
+ import { mapTextTheme as E, mapButtonTheme as O, mapImageTheme as b } from "./themeMapper.js";
4
+ const C = "__title__", a = "product_attribute.";
5
+ function N(r) {
6
6
  const t = r.variable ?? "";
7
7
  switch (t) {
8
8
  case "p_recommendation_title":
9
9
  return { key: C, kind: "title" };
10
10
  case "p_image":
11
- return { key: O, kind: "image" };
11
+ return { key: y, kind: "image" };
12
12
  case "p_name":
13
- return { key: E, kind: "text" };
14
- case "p_price":
15
13
  return { key: h, kind: "text" };
14
+ case "p_price":
15
+ return { key: R, kind: "text" };
16
16
  case "p_original_price":
17
17
  return { key: f, kind: "text" };
18
18
  case "p_omnibus_price":
19
19
  return { key: x, kind: "text" };
20
20
  case "p_omnibus_discount":
21
- return { key: R, kind: "text" };
21
+ return { key: A, kind: "text" };
22
22
  case "p_button":
23
- return { key: A, kind: "button" };
23
+ return { key: k, kind: "button" };
24
24
  default:
25
25
  if (r.variableType === "p_attribute" || t.startsWith("p_attribute_")) {
26
- const o = r.value ?? "", s = o.startsWith(T) ? o.slice(T.length) : o;
26
+ const o = r.value ?? "", s = o.startsWith(a) ? o.slice(a.length) : o;
27
27
  if (!s)
28
28
  return null;
29
- const e = o || `${T}${s}`;
29
+ const e = o || `${a}${s}`;
30
30
  return {
31
- key: `${k}${e}`,
31
+ key: `${l}${e}`,
32
32
  kind: "custom",
33
33
  customAttrName: s,
34
34
  customAttrValue: e
@@ -41,7 +41,7 @@ function _(r) {
41
41
  const t = p.indexOf(r);
42
42
  return t === -1 ? Number.POSITIVE_INFINITY : t;
43
43
  }
44
- function V(r) {
44
+ function S(r) {
45
45
  const t = {
46
46
  composition: [],
47
47
  visibility: { ...I },
@@ -54,10 +54,10 @@ function V(r) {
54
54
  return t.composition = [...p], t;
55
55
  const o = [];
56
56
  r.forEach((e, i) => {
57
- const n = P(e);
57
+ const n = N(e);
58
58
  if (n) {
59
59
  if (n.kind === "title") {
60
- t.titleVariable = e, t.visibility[l] = e.hidden !== !0;
60
+ t.titleVariable = e;
61
61
  return;
62
62
  }
63
63
  o.push({
@@ -82,20 +82,20 @@ function V(r) {
82
82
  const { key: i, kind: n, hidden: u, legacy: c, customAttrName: d, customAttrValue: m } = e;
83
83
  switch (t.composition.push(i), t.visibility[i] = !u, n === "custom" && d && m && (t.customAttributes.includes(m) || t.customAttributes.push(m), t.customAttrValues[i] = m), n) {
84
84
  case "image":
85
- s[i] = N(c.theme);
85
+ s[i] = b(c.theme);
86
86
  break;
87
87
  case "button":
88
- s[i] = y(c.theme);
88
+ s[i] = O(c.theme);
89
89
  break;
90
90
  case "text":
91
91
  case "custom": {
92
- const a = b(c.theme);
93
- s[i] = a, a.textTrimming && (t.anyTextTrimming = !0);
92
+ const T = E(c.theme);
93
+ s[i] = T, T.textTrimming && (t.anyTextTrimming = !0);
94
94
  break;
95
95
  }
96
96
  }
97
97
  }), t.perElementStyles = s, t;
98
98
  }
99
99
  export {
100
- V as mapComposition
100
+ S as mapComposition
101
101
  };
@@ -1,54 +1,49 @@
1
1
  import { CURRENCY_ATTR as n, CSS_CLASS_SKIP_COMPILE as c } from "../../../extensions/Blocks/Recommendation/constants/selectors.js";
2
2
  const a = "You May Also Like!";
3
- function A(t) {
4
- var i;
5
- const e = t.querySelector(".ext-recommendation-title");
6
- if (!e)
3
+ function l(t) {
4
+ var o;
5
+ const r = t.querySelector(".ext-recommendation-title");
6
+ if (!r)
7
7
  return a;
8
- const r = (i = e.textContent) == null ? void 0 : i.trim();
9
- return r && r.length > 0 ? r : a;
8
+ const e = (o = r.textContent) == null ? void 0 : o.trim();
9
+ return e && e.length > 0 ? e : a;
10
10
  }
11
11
  function m(t) {
12
- const e = t.querySelector(".ext-recommendation-title");
13
- return e ? !/display\s*:\s*none/i.test(e.getAttribute("style") ?? "") : !1;
14
- }
15
- function d(t) {
16
- const e = [
12
+ const r = [
17
13
  t,
18
14
  ...Array.from(t.querySelectorAll(".product-card, .ext-recommendation-card"))
19
15
  ];
20
- let r = "";
21
- return e.some((i) => {
22
- const o = i.getAttribute("bgcolor");
23
- if (o && o.trim())
24
- return r = o.trim(), !0;
25
- const u = (i.getAttribute("style") ?? "").match(/background-color\s*:\s*([^;]+)/i);
26
- return u && u[1] ? (r = u[1].trim(), !0) : !1;
27
- }), r;
16
+ let e = "";
17
+ return r.some((o) => {
18
+ const i = o.getAttribute("bgcolor");
19
+ if (i && i.trim())
20
+ return e = i.trim(), !0;
21
+ const u = (o.getAttribute("style") ?? "").match(/background-color\s*:\s*([^;]+)/i);
22
+ return u && u[1] ? (e = u[1].trim(), !0) : !1;
23
+ }), e;
28
24
  }
29
25
  function C(t) {
30
- const e = t.getAttribute(n.CURRENCY);
31
- if (!e)
26
+ const r = t.getAttribute(n.CURRENCY);
27
+ if (!r)
32
28
  return;
33
- const r = t.getAttribute(n.SYMBOL);
29
+ const e = t.getAttribute(n.SYMBOL);
34
30
  return {
35
- value: e,
31
+ value: r,
36
32
  // An empty `currency-symbol` is omitted so `mapCurrency` falls back to
37
33
  // the currency code as the symbol.
38
- ...r ? { symbol: r } : {},
34
+ ...e ? { symbol: e } : {},
39
35
  alignment: t.getAttribute(n.ALIGNMENT) ?? "",
40
36
  decimalCount: t.getAttribute(n.DECIMAL_COUNT) ?? "",
41
37
  decimalSeparator: t.getAttribute(n.DECIMAL_SEPARATOR) ?? "",
42
38
  thousandSeparator: t.getAttribute(n.THOUSAND_SEPARATOR) ?? ""
43
39
  };
44
40
  }
45
- function g(t) {
41
+ function d(t) {
46
42
  return t.classList.contains(c);
47
43
  }
48
44
  export {
49
- d as extractCardBgColor,
45
+ m as extractCardBgColor,
50
46
  C as extractCurrencyFromBlock,
51
- A as extractTitleText,
52
- m as hasVisibleTitle,
53
- g as isPartnerManagedBlock
47
+ l as extractTitleText,
48
+ d as isPartnerManagedBlock
54
49
  };