@useinsider/guido 3.6.0-beta.3eeb930 → 3.6.0-beta.4f2bf14

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,22 +1,21 @@
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";
1
+ import { getRecommendationFeedSourceMaps as I, URLS as C } from "../enums/extensions/recommendationBlock.js";
2
+ import { MinDeviceViewport as R, DefaultPadding as b } from "../enums/recommendation.js";
3
+ import { useRecommendationExtensionStore as m } from "../extensions/Blocks/Recommendation/store/recommendation.js";
4
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
5
  import { useConfigStore as x } from "../stores/config.js";
7
- const k = () => ({
6
+ const w = () => ({
8
7
  calculateCardWidth: ({
9
- mobileLeftPadding: a,
8
+ mobileLeftPadding: o,
10
9
  mobileRightPadding: s,
11
- cardsInRow: c,
12
- unresponsive: o
10
+ cardsInRow: a,
11
+ unresponsive: n
13
12
  }) => {
14
- const r = o ? c : 1, e = a + s + (r - 1) * b;
15
- return (C - e) / r;
13
+ const r = n ? a : 1, e = o + s + (r - 1) * b;
14
+ return (R - e) / r;
16
15
  },
17
- getRecommendationCampaignData: (a) => {
18
- const s = l(), c = Number(a), o = s.blockStates[c];
19
- if (!o)
16
+ getRecommendationCampaignData: (o) => {
17
+ const s = m(), a = Number(o), n = s.blockStates[a];
18
+ if (!n)
20
19
  return {
21
20
  textTrimming: !1,
22
21
  orientation: "vertical",
@@ -29,7 +28,7 @@ const k = () => ({
29
28
  discountBeforeTextValue: "",
30
29
  discountAfterTextValue: ""
31
30
  };
32
- const { recommendationConfigs: r } = o, e = r.orientation === "grid" ? "vertical" : "horizontal";
31
+ const { recommendationConfigs: r } = n, e = r.orientation === "grid" ? "vertical" : "horizontal";
33
32
  return {
34
33
  textTrimming: r.textTrimming,
35
34
  orientation: e,
@@ -43,35 +42,35 @@ const k = () => ({
43
42
  discountAfterTextValue: ""
44
43
  };
45
44
  },
46
- buildCampaignUrl: (a, s) => {
47
- var m;
48
- const c = l(), o = x(), r = Number(a);
45
+ buildCampaignUrl: (o, s) => {
46
+ var l;
47
+ const a = m(), n = x(), r = Number(o);
49
48
  let e;
50
49
  if (s)
51
50
  e = s;
52
51
  else {
53
- const i = c.blockStates[r];
54
- if (!i)
52
+ const c = a.blockStates[r];
53
+ if (!c)
55
54
  return "";
56
- const { recommendationConfigs: n } = i;
55
+ const { recommendationConfigs: i } = c;
57
56
  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
57
+ strategy: i.strategy,
58
+ language: i.language,
59
+ currencyCode: i.currencySettings.value,
60
+ size: i.size,
61
+ productIds: i.productIds,
62
+ filters: i.filters,
63
+ shuffleProducts: i.shuffleProducts
65
64
  };
66
65
  }
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;
66
+ const f = ((l = I().find((c) => c.key === e.strategy)) == null ? void 0 : l.path) || "", t = new URLSearchParams();
67
+ 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", e.productIds.join(",")) : e.strategy === "similarViewed" && t.set("productId", "{itemId}"), e.strategy === "userBased" && t.set("userId", "{user_id}");
68
+ const g = e.filters.filter((c) => c.isValid), d = h(g);
69
+ d && t.set("filter", d), e.shuffleProducts && t.set("shuffle", "true");
70
+ const p = decodeURIComponent(t.toString()), u = `${C.RECOMMENDATION_API_URL}/v2/${f}?${p}`;
71
+ return a.recommendationCampaignUrls[o] = u, u;
73
72
  }
74
73
  });
75
74
  export {
76
- k as useRecommendation
75
+ w as useRecommendation
77
76
  };
@@ -1,33 +1,35 @@
1
- import { useStripoApi as i } from "../services/stripoApi.js";
1
+ import { useStripoApi as c } from "../services/stripoApi.js";
2
2
  import { useEditorStore as u } from "../stores/editor.js";
3
3
  import { useOnboardingStore as l } from "../stores/onboarding.js";
4
4
  import { useUnsubscribeStore as b } from "../stores/unsubscribe.js";
5
5
  const v = () => {
6
- const { updateSyncModule: d, getSyncModule: r } = i(), n = u(), s = b(), a = {
6
+ const { updateSyncModule: r, getSyncModule: a } = c(), t = u(), s = b(), i = {
7
7
  block_dropped: ({ blockName: e }) => {
8
8
  if (e === "BLOCK_TEXT") {
9
- const o = l(), t = !o.shouldShowOnboarding("textBlockOnboarding"), c = o.isActive("textBlockOnboarding");
10
- if (t || c)
9
+ const o = l(), n = !o.shouldShowOnboarding("textBlockOnboarding"), d = o.isActive("textBlockOnboarding");
10
+ if (n || d)
11
11
  return;
12
12
  o.start("textBlockOnboarding");
13
13
  }
14
14
  },
15
15
  module_saved: async (e) => {
16
- n.syncModulesEnabled && (console.debug("[module_saved] Saved module data:", e), await d(e));
16
+ t.syncModulesEnabled && (console.debug("[module_saved] Saved module data:", e), await r(e));
17
17
  },
18
18
  module_dropped: async (e) => {
19
- if (!n.syncModulesEnabled)
19
+ if (!t.syncModulesEnabled)
20
20
  return;
21
- const { moduleId: o } = e, t = await r(o);
22
- console.debug("[module_dropped] Sync module data:", t), t.unsubscriptionPreferencePages.length && await s.fetchTemplates();
21
+ const { moduleId: o } = e, n = await a(o);
22
+ console.debug("[module_dropped] Sync module data:", n), n.unsubscriptionPreferencePages.length && (await s.fetchTemplates(), s.addUnsubscribePages(
23
+ n.unsubscriptionPreferencePages.map((d) => d.id)
24
+ ));
23
25
  },
24
26
  module_updated: async (e) => {
25
- n.syncModulesEnabled && (console.debug("[module_updated] Updated module data:", e), await d(e));
27
+ t.syncModulesEnabled && (console.debug("[module_updated] Updated module data:", e), await r(e));
26
28
  }
27
29
  };
28
30
  return { handleEvent: async (e, o) => {
29
- const t = a[e];
30
- console.debug("Stripo Event: ", e, o), t && await t(o);
31
+ const n = i[e];
32
+ console.debug("Stripo Event: ", e, o), n && await n(o);
31
33
  } };
32
34
  };
33
35
  export {
@@ -6,9 +6,8 @@ import { DEFAULT_CARDS_IN_ROW as F } from "../constants/layout.js";
6
6
  import { EXCLUDED_ALGORITHM_IDS as D } 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 { getPartnerRecommendationParams as v } from "../utils/partnerCustomizations.js";
10
- import { isFilterValid as w } from "../validation/filterSchema.js";
11
- import { isConfigValid as N } from "../validation/requiredFields.js";
9
+ import { isFilterValid as v } from "../validation/filterSchema.js";
10
+ import { isConfigValid as w } from "../validation/requiredFields.js";
12
11
  const h = y();
13
12
  let m = null, u = null, d = null;
14
13
  function I() {
@@ -50,7 +49,7 @@ function k() {
50
49
  filterSnapshot: null
51
50
  };
52
51
  }
53
- const x = () => ({
52
+ const N = () => ({
54
53
  recommendationCampaignUrls: {},
55
54
  activePredictiveAlgorithms: [],
56
55
  languages: {},
@@ -59,8 +58,8 @@ const x = () => ({
59
58
  blockStates: {},
60
59
  currentRecommendationId: null,
61
60
  configVersion: 0
62
- }), T = P("guidoRecommendationExtension", {
63
- state: () => x(),
61
+ }), M = P("guidoRecommendationExtension", {
62
+ state: () => N(),
64
63
  getters: {
65
64
  // ====================================================================
66
65
  // Proxy Getters — Backward Compatible Access to Current Block State
@@ -379,7 +378,7 @@ const x = () => ({
379
378
  const n = [...e.recommendationConfigs.filters];
380
379
  n[r] = {
381
380
  ...t,
382
- isValid: w(t)
381
+ isValid: v(t)
383
382
  }, e.recommendationConfigs.filters = n;
384
383
  }
385
384
  },
@@ -425,7 +424,7 @@ const x = () => ({
425
424
  * every block's recommendationConfigs across user edits.
426
425
  */
427
426
  hasInvalidBlock() {
428
- return Object.values(this.blockStates).some((t) => !N(t.recommendationConfigs, this));
427
+ return Object.values(this.blockStates).some((t) => !w(t.recommendationConfigs, this));
429
428
  },
430
429
  // ====================================================================
431
430
  // Per-Block Product Fetching
@@ -454,10 +453,7 @@ const x = () => ({
454
453
  details: !0,
455
454
  campaignId: o.variationId
456
455
  };
457
- 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(
458
- a,
459
- v(o.partnerName, r.strategy)
460
- );
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);
461
457
  let f;
462
458
  try {
463
459
  f = await h.fetchRecommendationProducts(i, a);
@@ -475,5 +471,5 @@ const x = () => ({
475
471
  }
476
472
  });
477
473
  export {
478
- T as useRecommendationExtensionStore
474
+ M as useRecommendationExtensionStore
479
475
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@useinsider/guido",
3
- "version": "3.6.0-beta.3eeb930",
3
+ "version": "3.6.0-beta.4f2bf14",
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",
@@ -1,21 +0,0 @@
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,7 +0,0 @@
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>;