@useinsider/guido 3.28.0 → 3.28.1-beta.5919d57

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.
@@ -3,9 +3,9 @@ import { MinDeviceViewport as C, DefaultPadding as R } from "../enums/recommenda
3
3
  import { useRecommendationExtensionStore as g } from "../extensions/Blocks/Recommendation/store/recommendation.js";
4
4
  import { generateCompleteFilterQuery as b } from "../extensions/Blocks/Recommendation/utils/filterUtil.js";
5
5
  import { getPartnerRecommendationParams as h } from "../extensions/Blocks/Recommendation/utils/partnerCustomizations.js";
6
- import { sanitizeProductIds as x } from "../extensions/Blocks/Recommendation/utils/productIds.js";
7
- import { useConfigStore as P } from "../stores/config.js";
8
- const B = () => ({
6
+ import { sanitizeProductIds as P } from "../extensions/Blocks/Recommendation/utils/productIds.js";
7
+ import { useConfigStore as S } from "../stores/config.js";
8
+ const M = () => ({
9
9
  calculateCardWidth: ({
10
10
  mobileLeftPadding: s,
11
11
  mobileRightPadding: c,
@@ -24,11 +24,7 @@ const B = () => ({
24
24
  mobileLeftPadding: 0,
25
25
  mobileRightPadding: 0,
26
26
  cardsInRow: 2,
27
- unresponsive: !1,
28
- priceBeforeTextValue: "",
29
- priceAfterTextValue: "",
30
- discountBeforeTextValue: "",
31
- discountAfterTextValue: ""
27
+ unresponsive: !1
32
28
  };
33
29
  const { recommendationConfigs: i } = a, e = i.orientation === "grid" ? "vertical" : "horizontal";
34
30
  return {
@@ -37,16 +33,12 @@ const B = () => ({
37
33
  mobileLeftPadding: 0,
38
34
  mobileRightPadding: 0,
39
35
  cardsInRow: i.cardsInRow,
40
- unresponsive: i.unresponsive,
41
- priceBeforeTextValue: "",
42
- priceAfterTextValue: "",
43
- discountBeforeTextValue: "",
44
- discountAfterTextValue: ""
36
+ unresponsive: i.unresponsive
45
37
  };
46
38
  },
47
39
  buildCampaignUrl: (s, c) => {
48
40
  var l;
49
- const o = g(), a = P(), i = Number(s);
41
+ const o = g(), a = S(), i = Number(s);
50
42
  let e;
51
43
  if (c)
52
44
  e = c;
@@ -78,7 +70,7 @@ const B = () => ({
78
70
  return delete r[s], o.recommendationCampaignUrls = r, "";
79
71
  }
80
72
  const t = new URLSearchParams();
81
- t.set("locale", e.language), t.set("currency", e.currencyCode), t.set("partnerName", a.partnerName), t.set("size", e.size), t.set("details", "true"), t.set("campaignId", a.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}");
73
+ t.set("locale", e.language), t.set("currency", e.currencyCode), t.set("partnerName", a.partnerName), t.set("size", e.size), t.set("details", "true"), t.set("campaignId", a.variationId), e.strategy === "manualMerchandising" ? t.set("productId", P(e.productIds)) : e.strategy === "similarViewed" && t.set("productId", "{itemId}"), e.strategy === "userBased" && t.set("userId", "{user_id}");
82
74
  const f = e.filters.filter((r) => r.isValid), m = b(f);
83
75
  m && t.set("filter", m), e.shuffleProducts && t.set("shuffle", "true"), Object.entries(h(a.partnerName, e.strategy)).forEach(([r, n]) => t.set(r, n));
84
76
  const p = decodeURIComponent(t.toString()), u = `${I.RECOMMENDATION_API_URL}/v2/${d}?${p}`;
@@ -86,5 +78,5 @@ const B = () => ({
86
78
  }
87
79
  });
88
80
  export {
89
- B as useRecommendation
81
+ M as useRecommendation
90
82
  };
@@ -1,14 +1,14 @@
1
- import { useRecommendation as N } from "../../composables/useRecommendation.js";
2
- import { DUMMY_IMAGE_MAPPINGS as h, REGEX as d, VerticalOrientation as $, CSS as n, ATTRIBUTES as p, CONDITIONS as A, HTML as g } from "../../enums/recommendation.js";
3
- import { prepareRecommendationBlocks as O } from "./utils/recommendationCompilerUtils.js";
4
- const H = [
1
+ import { useRecommendation as R } from "../../composables/useRecommendation.js";
2
+ import { DUMMY_IMAGE_MAPPINGS as A, REGEX as m, VerticalOrientation as y, CSS as n, CONDITIONS as u, ATTRIBUTES as l, HTML as I } from "../../enums/recommendation.js";
3
+ import { prepareRecommendationBlocks as S } from "./utils/recommendationCompilerUtils.js";
4
+ const f = [
5
5
  {
6
6
  id: "replace-images-with-variable-names",
7
7
  description: "Replacing dummy images with variable names in recommendation module",
8
8
  type: "custom",
9
9
  processor: (t) => {
10
10
  let e = t;
11
- return Object.entries(h).forEach(([, r]) => {
11
+ return Object.entries(A).forEach(([, r]) => {
12
12
  Object.entries(r).forEach(([o, i]) => {
13
13
  e = e.replaceAll(i, `{{${o}}}`);
14
14
  });
@@ -42,17 +42,17 @@ const H = [
42
42
  description: "Adding recommendation unresponsive css",
43
43
  type: "custom",
44
44
  processor: (t) => {
45
- const { calculateCardWidth: e, getRecommendationCampaignData: r } = N();
45
+ const { calculateCardWidth: e, getRecommendationCampaignData: r } = R();
46
46
  let o = t;
47
- const i = o.match(d.ID);
47
+ const i = o.match(m.ID);
48
48
  if (i) {
49
- const s = [];
50
- if (i.forEach((c) => {
51
- const m = /recommendation-id="(.*?)"/i.exec(c), E = m ? m[1].trim() : "", u = r(E);
52
- u.textTrimming && u.orientation === $ && s.push(e(u));
53
- }), s.length) {
54
- const c = `width:${Math.min(...s)}px!important;`;
55
- o = o.replace(n.REGULAR_NAME_HEIGHT, `${n.TRIMMED_NAME_HEIGHT} ${c} ${n.ELLIPSIS}`).replace(n.REGULAR_NAME_CONTAINER_HEIGHT, n.TRIMMED_NAME_CONTAINER_CSS).replace(n.RESPONSIVE_NAME_SIZE, `${n.RESPONSIVE_NAME_HEIGHT} ${c} ${n.ELLIPSIS}`).replace(n.RESPONSIVE_NAME_CONTAINER_HEIGHT, n.TRIMMED_RESPONSIVE_NAME_CONTAINER_CSS);
49
+ const c = [];
50
+ if (i.forEach((s) => {
51
+ const a = /recommendation-id="(.*?)"/i.exec(s), d = a ? a[1].trim() : "", p = r(d);
52
+ p.textTrimming && p.orientation === y && c.push(e(p));
53
+ }), c.length) {
54
+ const s = `width:${Math.min(...c)}px!important;`;
55
+ o = o.replace(n.REGULAR_NAME_HEIGHT, `${n.TRIMMED_NAME_HEIGHT} ${s} ${n.ELLIPSIS}`).replace(n.REGULAR_NAME_CONTAINER_HEIGHT, n.TRIMMED_NAME_CONTAINER_CSS).replace(n.RESPONSIVE_NAME_SIZE, `${n.RESPONSIVE_NAME_HEIGHT} ${s} ${n.ELLIPSIS}`).replace(n.RESPONSIVE_NAME_CONTAINER_HEIGHT, n.TRIMMED_RESPONSIVE_NAME_CONTAINER_CSS);
56
56
  }
57
57
  }
58
58
  return o;
@@ -63,36 +63,24 @@ const H = [
63
63
  id: "prepare-recommendations",
64
64
  description: "Replacing product data with template variables in recommendation blocks",
65
65
  type: "custom",
66
- processor: (t) => O(t),
66
+ processor: (t) => S(t),
67
67
  priority: 48
68
68
  },
69
69
  {
70
70
  id: "add-discount-conditions",
71
71
  description: "Adding discount conditions to the recommendation block",
72
72
  type: "custom",
73
- processor: (t) => {
74
- let e = t;
75
- const r = e.match(d.ATTRIBUTE_PARAGRAPH), { getRecommendationCampaignData: o } = N();
76
- return r !== null && r.forEach((i) => {
77
- const s = i.match(d.CUSTOM_FIELD);
78
- if (!s)
79
- return;
80
- const [c] = s, m = c.match(d.CUSTOM_FIELD_INDEXES_PART), E = c.match(d.CUSTOM_FIELD_NAME_PART), u = i.match(d.ATTRIBUTE_PARAGRAPH_START_TAG);
81
- if (!m || !E || !u)
82
- return;
83
- const [T] = m, [I] = E, [_] = u, b = I.substring(1, I.length - 2), S = _.match(d.COMPOSITION) !== null;
84
- let a = c;
85
- if (S) {
86
- const y = T.substring(2, T.length - 3), l = o(y);
87
- b === p.OMNIBUS_PRICE && (l.priceBeforeTextValue && (a = `${l.priceBeforeTextValue}${a}`), l.priceAfterTextValue && (a = `${a}${l.priceAfterTextValue}`)), b === p.OMNIBUS_DISCOUNT && (l.discountBeforeTextValue && (a = `${l.discountBeforeTextValue}${a}`), l.discountAfterTextValue && (a = `${a}${l.discountAfterTextValue}`));
88
- }
89
- const R = T.substring(2);
90
- let f = "";
91
- b in A.IF && (f = A.IF[b].replaceAll(`{${p.DISCOUNT}}`, `${R}${p.DISCOUNT}`).replaceAll(`{${p.OMNIBUS_DISCOUNT}}`, `${R}${p.OMNIBUS_DISCOUNT}`).replaceAll(`{${p.OMNIBUS_PRICE}}`, `${R}${p.OMNIBUS_PRICE}`));
92
- const M = `${_}${a}${g.PARAGRAPH_END_TAG}`, C = `${f}${S ? M : i}${A.ELSE}${_}${g.PARAGRAPH_END_TAG}${A.END_IF}`;
93
- e = e.replace(i, C);
94
- }), e;
95
- },
73
+ processor: (t) => t.replace(m.ATTRIBUTE_PARAGRAPH, (e) => {
74
+ const r = e.match(m.CUSTOM_FIELD);
75
+ if (!r)
76
+ return e;
77
+ const [o] = r, i = o.match(m.CUSTOM_FIELD_INDEXES_PART), c = o.match(m.CUSTOM_FIELD_NAME_PART), s = e.match(m.ATTRIBUTE_PARAGRAPH_START_TAG);
78
+ if (!i || !c || !s)
79
+ return e;
80
+ const [a] = i, [d] = c, [p] = s, b = d.substring(1, d.length - 2), E = a.substring(2);
81
+ let _ = "";
82
+ return b in u.IF && (_ = u.IF[b].replaceAll(`{${l.DISCOUNT}}`, `${E}${l.DISCOUNT}`).replaceAll(`{${l.OMNIBUS_DISCOUNT}}`, `${E}${l.OMNIBUS_DISCOUNT}`).replaceAll(`{${l.OMNIBUS_PRICE}}`, `${E}${l.OMNIBUS_PRICE}`)), `${_}${e}${u.ELSE}${p}${I.PARAGRAPH_END_TAG}${u.END_IF}`;
83
+ }),
96
84
  priority: 53
97
85
  },
98
86
  {
@@ -147,8 +135,8 @@ const H = [
147
135
  ), e = e.replace(
148
136
  /@media[^{]*max-width\s*:\s*480px[^{]*\{((?:[^{}]*\{[^{}]*\})*[^{}]*)\}/g,
149
137
  (r, o) => {
150
- const i = o.match(/[^{}]+\{[^{}]*\}/g) || [], s = /ins-recommendation|product-image-cell|button-cell|product-info-cell/;
151
- return i.every((m) => s.test(m)) ? "" : r;
138
+ const i = o.match(/[^{}]+\{[^{}]*\}/g) || [], c = /ins-recommendation|product-image-cell|button-cell|product-info-cell/;
139
+ return i.every((a) => c.test(a)) ? "" : r;
152
140
  }
153
141
  )), e;
154
142
  },
@@ -208,5 +196,5 @@ const H = [
208
196
  }
209
197
  ];
210
198
  export {
211
- H as recommendationCompilerRules
199
+ f as recommendationCompilerRules
212
200
  };
@@ -27,13 +27,12 @@ const e = 20, t = 320, s = "vertical", m = {
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,
30
- COMPOSITION: /composition="true"/gm,
31
30
  CUSTOM_FIELD: /{{(?:reco_)?[0-9]+_[0-8]_(discount|omnibus_discount|omnibus_price)}}/gm,
32
31
  CUSTOM_FIELD_INDEXES_PART: /{{(?:reco_)?[0-9]+_[0-8]_/gm,
33
32
  CUSTOM_FIELD_NAME_PART: /_(discount|omnibus_discount|omnibus_price)}}/gm
34
- }, o = {
35
- PARAGRAPH_END_TAG: "</p>"
36
33
  }, a = {
34
+ PARAGRAPH_END_TAG: "</p>"
35
+ }, o = {
37
36
  REGULAR_NAME_HEIGHT: ".ext-product-name.ins-vertical p { height:90px!important;",
38
37
  TRIMMED_NAME_HEIGHT: ".ext-product-name.ins-vertical p { height:18px!important;",
39
38
  ELLIPSIS: "text-overflow:ellipsis!important; white-space:nowrap!important;",
@@ -47,10 +46,10 @@ const e = 20, t = 320, s = "vertical", m = {
47
46
  export {
48
47
  i as ATTRIBUTES,
49
48
  _ as CONDITIONS,
50
- a as CSS,
49
+ o as CSS,
51
50
  m as DUMMY_IMAGE_MAPPINGS,
52
51
  e as DefaultPadding,
53
- o as HTML,
52
+ a as HTML,
54
53
  t as MinDeviceViewport,
55
54
  n as REGEX,
56
55
  s as VerticalOrientation
@@ -1,9 +1,9 @@
1
- const o = "3.28.0", s = { stripo: { version: "2.86.1" } }, n = {
1
+ const o = "3.28.1-beta.5919d57", s = { stripo: { version: "2.86.1" } }, t = {
2
2
  version: o,
3
3
  guido: s
4
4
  };
5
5
  export {
6
- n as default,
6
+ t as default,
7
7
  s as guido,
8
8
  o as version
9
9
  };
@@ -8,10 +8,6 @@ type CardWidthParams = {
8
8
  interface CampaignData extends CardWidthParams {
9
9
  textTrimming: boolean;
10
10
  orientation: string;
11
- priceBeforeTextValue: string;
12
- priceAfterTextValue: string;
13
- discountBeforeTextValue: string;
14
- discountAfterTextValue: string;
15
11
  }
16
12
  export declare const useRecommendation: () => {
17
13
  calculateCardWidth: ({ mobileLeftPadding, mobileRightPadding, cardsInRow, unresponsive, }: CardWidthParams) => number;
@@ -33,7 +33,6 @@ export declare const REGEX: {
33
33
  ID: RegExp;
34
34
  ATTRIBUTE_PARAGRAPH: RegExp;
35
35
  ATTRIBUTE_PARAGRAPH_START_TAG: RegExp;
36
- COMPOSITION: RegExp;
37
36
  CUSTOM_FIELD: RegExp;
38
37
  CUSTOM_FIELD_INDEXES_PART: RegExp;
39
38
  CUSTOM_FIELD_NAME_PART: RegExp;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@useinsider/guido",
3
- "version": "3.28.0",
3
+ "version": "3.28.1-beta.5919d57",
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",