@useinsider/guido 3.6.0-beta.dc3a2aa → 3.6.0-beta.ee02cfc

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.
@@ -2,15 +2,16 @@ import { getRecommendationFeedSourceMaps as g, getOperatorOptions as R, PriceAtt
2
2
  import { useRecommendationApi as y } from "../../../../services/recommendationApi.js";
3
3
  import { useConfigStore as G } from "../../../../stores/config.js";
4
4
  import { defineStore as P } from "pinia";
5
- import { DEFAULT_CARDS_IN_ROW as F } from "../constants/layout.js";
6
- import { EXCLUDED_ALGORITHM_IDS as D } from "../constants/defaultConfig.js";
5
+ import { DEFAULT_MOBILE_CARDS_IN_ROW as D, DEFAULT_CARDS_IN_ROW as F } from "../constants/layout.js";
6
+ import { EXCLUDED_ALGORITHM_IDS as w } from "../constants/defaultConfig.js";
7
7
  import { getDefaultProducts as S } from "../templates/utils.js";
8
8
  import { generateCompleteFilterQuery as b } from "../utils/filterUtil.js";
9
- import { isFilterValid as v } from "../validation/filterSchema.js";
10
- import { isConfigValid as w } from "../validation/requiredFields.js";
9
+ import { getPartnerRecommendationParams as v } from "../utils/partnerCustomizations.js";
10
+ import { isFilterValid as N } from "../validation/filterSchema.js";
11
+ import { isConfigValid as x } from "../validation/requiredFields.js";
11
12
  const h = y();
12
13
  let m = null, u = null, d = null;
13
- function I() {
14
+ function k() {
14
15
  return {
15
16
  cardsInRow: F,
16
17
  currencySettings: {
@@ -26,6 +27,7 @@ function I() {
26
27
  productIds: [],
27
28
  id: 1,
28
29
  language: "en_US",
30
+ mobileCardsInRow: D,
29
31
  mobileLayoutEnabled: !1,
30
32
  orientation: "grid",
31
33
  recommendedProducts: [],
@@ -38,9 +40,9 @@ function I() {
38
40
  customAttributes: []
39
41
  };
40
42
  }
41
- function k() {
43
+ function I() {
42
44
  return {
43
- recommendationConfigs: I(),
45
+ recommendationConfigs: k(),
44
46
  recommendationProducts: [],
45
47
  filterStatus: !1,
46
48
  filterSelectionDrawerStatus: !1,
@@ -49,7 +51,7 @@ function k() {
49
51
  filterSnapshot: null
50
52
  };
51
53
  }
52
- const N = () => ({
54
+ const L = () => ({
53
55
  recommendationCampaignUrls: {},
54
56
  activePredictiveAlgorithms: [],
55
57
  languages: {},
@@ -58,8 +60,8 @@ const N = () => ({
58
60
  blockStates: {},
59
61
  currentRecommendationId: null,
60
62
  configVersion: 0
61
- }), M = P("guidoRecommendationExtension", {
62
- state: () => N(),
63
+ }), K = P("guidoRecommendationExtension", {
64
+ state: () => L(),
63
65
  getters: {
64
66
  // ====================================================================
65
67
  // Proxy Getters — Backward Compatible Access to Current Block State
@@ -69,7 +71,7 @@ const N = () => ({
69
71
  * This allows all existing code that reads `store.recommendationConfigs` to work unchanged.
70
72
  */
71
73
  recommendationConfigs(t) {
72
- return t.currentRecommendationId !== null && t.blockStates[t.currentRecommendationId] ? t.blockStates[t.currentRecommendationId].recommendationConfigs : I();
74
+ return t.currentRecommendationId !== null && t.blockStates[t.currentRecommendationId] ? t.blockStates[t.currentRecommendationId].recommendationConfigs : k();
73
75
  },
74
76
  /**
75
77
  * Proxy getter: delegates to blockStates[currentRecommendationId].recommendationProducts
@@ -115,7 +117,7 @@ const N = () => ({
115
117
  },
116
118
  getActivePredictiveAlgorithms: (t) => {
117
119
  const e = g(), r = [];
118
- return t.activePredictiveAlgorithms.filter((n) => !D.includes(n)).forEach((n) => {
120
+ return t.activePredictiveAlgorithms.filter((n) => !w.includes(n)).forEach((n) => {
119
121
  r.push(...e.filter((c) => c.id === n));
120
122
  }), r.map((n) => ({
121
123
  text: n.name,
@@ -155,7 +157,7 @@ const N = () => ({
155
157
  setCurrentBlock(t) {
156
158
  this.blockStates[t] || (this.blockStates = {
157
159
  ...this.blockStates,
158
- [t]: k()
160
+ [t]: I()
159
161
  }), this.currentRecommendationId = t;
160
162
  },
161
163
  /**
@@ -223,7 +225,7 @@ const N = () => ({
223
225
  decimalCount: String(e.currencyDecimalCount),
224
226
  decimalSeparator: r(e.currencyDecimalSeparator, ","),
225
227
  thousandSeparator: r(e.currencyThousandSeparator, ".")
226
- }, c = !this.blockStates[t], i = c ? k() : this.blockStates[t];
228
+ }, c = !this.blockStates[t], i = c ? I() : this.blockStates[t];
227
229
  i.recommendationConfigs = {
228
230
  ...i.recommendationConfigs,
229
231
  strategy: e.strategy,
@@ -378,7 +380,7 @@ const N = () => ({
378
380
  const n = [...e.recommendationConfigs.filters];
379
381
  n[r] = {
380
382
  ...t,
381
- isValid: v(t)
383
+ isValid: N(t)
382
384
  }, e.recommendationConfigs.filters = n;
383
385
  }
384
386
  },
@@ -424,7 +426,7 @@ const N = () => ({
424
426
  * every block's recommendationConfigs across user edits.
425
427
  */
426
428
  hasInvalidBlock() {
427
- return Object.values(this.blockStates).some((t) => !w(t.recommendationConfigs, this));
429
+ return Object.values(this.blockStates).some((t) => !x(t.recommendationConfigs, this));
428
430
  },
429
431
  // ====================================================================
430
432
  // Per-Block Product Fetching
@@ -453,7 +455,10 @@ const N = () => ({
453
455
  details: !0,
454
456
  campaignId: o.variationId
455
457
  };
456
- r.strategy === "manualMerchandising" ? a.productId = r.productIds.join(",") : r.strategy === "similarViewed" && (a.productId = "{itemId}"), r.strategy === "userBased" && (a.userId = "{user_id}"), c && (a.filter = c), r.shuffleProducts && (a.shuffle = !0);
458
+ r.strategy === "manualMerchandising" ? a.productId = r.productIds.join(",") : r.strategy === "similarViewed" && (a.productId = "{itemId}"), r.strategy === "userBased" && (a.userId = "{user_id}"), c && (a.filter = c), r.shuffleProducts && (a.shuffle = !0), Object.assign(
459
+ a,
460
+ v(o.partnerName, r.strategy)
461
+ );
457
462
  let f;
458
463
  try {
459
464
  f = await h.fetchRecommendationProducts(i, a);
@@ -471,5 +476,5 @@ const N = () => ({
471
476
  }
472
477
  });
473
478
  export {
474
- M as useRecommendationExtensionStore
479
+ K as useRecommendationExtensionStore
475
480
  };
@@ -1,5 +1,5 @@
1
1
  import { RecommendationBlockId as s } from "../../constants/blockIds.js";
2
- import { ATTR_PRODUCT_ATTR as u, CSS_CLASS_RECO_BUTTON as p, ATTR_PRODUCT_BUTTON as m, ATTR_PRODUCT_OMNIBUS_DISCOUNT as h, ATTR_PRODUCT_OMNIBUS_PRICE as y, ATTR_PRODUCT_OLD_PRICE as T, ATTR_PRODUCT_PRICE as f, ATTR_PRODUCT_NAME as x, ATTR_PRODUCT_IMAGE as _ } from "../../constants/selectors.js";
2
+ import { ATTR_PRODUCT_ATTR as u, CSS_CLASS_RECO_BUTTON as p, ATTR_PRODUCT_BUTTON as m, ATTR_PRODUCT_OMNIBUS_DISCOUNT as h, ATTR_PRODUCT_OMNIBUS_PRICE as y, ATTR_PRODUCT_OLD_PRICE as T, ATTR_PRODUCT_PRICE as f, ATTR_PRODUCT_NAME as _, ATTR_PRODUCT_IMAGE as x } from "../../constants/selectors.js";
3
3
  import { useRecommendationExtensionStore as $ } from "../../store/recommendation.js";
4
4
  import { formatPrice as C } from "../../utils/priceFormatter.js";
5
5
  import { CUSTOM_CELL_HTML as R, sanitizeImageUrl as O } from "../utils.js";
@@ -23,7 +23,7 @@ function i(t, e = "price") {
23
23
  });
24
24
  }
25
25
  const S = {
26
- [_]: (t) => `
26
+ [x]: (t) => `
27
27
  <td class="${l}" style="padding: ${a}; height: 100%;" valign="top">
28
28
  <table
29
29
  class="product-card-segment"
@@ -51,7 +51,7 @@ const S = {
51
51
  </table>
52
52
  </td>
53
53
  `,
54
- [x]: (t) => `
54
+ [_]: (t) => `
55
55
  <td class="${l}" style="padding: ${a}; height: 100%;" valign="middle">
56
56
  <table
57
57
  class="product-card-segment"
@@ -115,9 +115,7 @@ const S = {
115
115
  class="esd-block-text product-old-price es-p15l es-p15r"
116
116
  align="center"
117
117
  esd-extension-block-id="${s.OLD_PRICE}">
118
- <p
119
- contenteditable="false"
120
- style="font-size: 14px; color: #999999; text-decoration: line-through;">
118
+ <p contenteditable="false" style="font-size: 14px; color: #999999;">
121
119
  <strong>${i(t, "original_price")}</strong>
122
120
  </p>
123
121
  </td>
@@ -0,0 +1,21 @@
1
+ const i = [
2
+ "ozonebg",
3
+ "ozonehr",
4
+ "ozonero",
5
+ "ozoneinfo",
6
+ "babybg",
7
+ "ozongr",
8
+ "iboodat",
9
+ "iboodbe",
10
+ "iboodde",
11
+ "iboodfr",
12
+ "iboodnl",
13
+ "iboodpl"
14
+ ], r = ["interencheres", "interencherespreprod"], d = ["lodenfrey", "lodenfreyuat"], c = "manualMerchandising";
15
+ function s(e, n) {
16
+ const o = {};
17
+ return i.includes(e) && (o.excludePurchaseDay = "30", o.userId = "{user_id}"), r.includes(e) && (o.hp = "1"), d.includes(e) && n === c && (o.includeOutOfStockItems = "true"), o;
18
+ }
19
+ export {
20
+ s as getPartnerRecommendationParams
21
+ };
@@ -1,29 +1,29 @@
1
- function $(a, e) {
2
- const { thousandSeparator: u, decimalSeparator: t, decimalCount: r } = e, m = Number(Math.abs(a).toPrecision(15)), [c, i = ""] = String(m).split("."), n = i.padEnd(r, "0"), s = c.replace(
1
+ function d(a, t) {
2
+ const { thousandSeparator: s, decimalSeparator: e, decimalCount: r } = t, u = Math.abs(a).toFixed(r), [c, o] = u.split("."), n = c.replace(
3
3
  /\B(?=(\d{3})+(?!\d))/g,
4
- u
5
- ), o = a < 0 ? "-" : "";
6
- return r > 0 && n ? `${o}${s}${t}${n}` : `${o}${s}`;
4
+ s
5
+ ), i = a < 0 ? "-" : "";
6
+ return r > 0 && o ? `${i}${n}${e}${o}` : `${i}${n}`;
7
7
  }
8
- function d(a) {
9
- const { price: e, currency: u } = a, {
10
- symbol: t,
8
+ function m(a) {
9
+ const { price: t, currency: s } = a, {
10
+ symbol: e,
11
11
  alignment: r,
12
- thousandSeparator: m,
12
+ thousandSeparator: u,
13
13
  decimalSeparator: c,
14
- decimalCount: i
15
- } = u;
16
- if (typeof e != "number" || Number.isNaN(e)) {
17
- const s = "0".repeat(i), o = `0${c}${s}`;
18
- return r === "before" ? `${t} ${o}` : `${o} ${t}`;
14
+ decimalCount: o
15
+ } = s;
16
+ if (typeof t != "number" || Number.isNaN(t)) {
17
+ const i = "0".repeat(o), $ = `0${c}${i}`;
18
+ return r === "before" ? `${e} ${$}` : `${$} ${e}`;
19
19
  }
20
- const n = $(e, {
21
- thousandSeparator: m,
20
+ const n = d(t, {
21
+ thousandSeparator: u,
22
22
  decimalSeparator: c,
23
- decimalCount: i
23
+ decimalCount: o
24
24
  });
25
- return r === "before" ? `${t} ${n}` : `${n} ${t}`;
25
+ return r === "before" ? `${e} ${n}` : `${n} ${e}`;
26
26
  }
27
27
  export {
28
- d as formatPrice
28
+ m as formatPrice
29
29
  };
@@ -18,6 +18,7 @@ export * from './utils';
18
18
  export declare class RecommendationBlockControl extends CommonControl {
19
19
  private store;
20
20
  private storeUnsubscription;
21
+ private syncedBlockIds;
21
22
  private algorithmControl;
22
23
  private localeControl;
23
24
  private currencyControl;
@@ -13,6 +13,7 @@ export interface PerBlockConfigs {
13
13
  filters: Filter[];
14
14
  id: number;
15
15
  language: string;
16
+ mobileCardsInRow: number;
16
17
  mobileLayoutEnabled: boolean;
17
18
  orientation: Orientation;
18
19
  productIds: string[];
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Returns the extra recommendation feed query params for an account, if any.
3
+ * Accounts without customizations get an empty object.
4
+ * @param partnerName Account subdomain (`config.partner.name`)
5
+ * @param strategy Recommendation strategy key of the block
6
+ */
7
+ export declare function getPartnerRecommendationParams(partnerName: string, strategy: string): Record<string, string>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@useinsider/guido",
3
- "version": "3.6.0-beta.dc3a2aa",
3
+ "version": "3.6.0-beta.ee02cfc",
4
4
  "description": "Guido is a Vue + TypeScript wrapper for Email Plugin. Easily embed the email editor in your Vue applications.",
5
5
  "main": "./dist/guido.umd.cjs",
6
6
  "module": "./dist/library.js",