@useinsider/guido 3.28.0-beta.fdbde3f → 3.28.1-beta.70df1f2
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.
- package/dist/composables/useRecommendation.js +8 -16
- package/dist/config/compiler/recommendationCompilerRules.js +29 -41
- package/dist/enums/recommendation.js +4 -5
- package/dist/package.json.js +2 -2
- package/dist/src/composables/useRecommendation.d.ts +0 -4
- package/dist/src/enums/recommendation.d.ts +0 -1
- package/dist/utils/templatePreparation.js +9 -9
- package/package.json +2 -2
|
@@ -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
|
|
7
|
-
import { useConfigStore as
|
|
8
|
-
const
|
|
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 =
|
|
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",
|
|
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
|
-
|
|
81
|
+
M as useRecommendation
|
|
90
82
|
};
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { useRecommendation as
|
|
2
|
-
import { DUMMY_IMAGE_MAPPINGS as
|
|
3
|
-
import { prepareRecommendationBlocks as
|
|
4
|
-
const
|
|
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(
|
|
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 } =
|
|
45
|
+
const { calculateCardWidth: e, getRecommendationCampaignData: r } = R();
|
|
46
46
|
let o = t;
|
|
47
|
-
const i = o.match(
|
|
47
|
+
const i = o.match(m.ID);
|
|
48
48
|
if (i) {
|
|
49
|
-
const
|
|
50
|
-
if (i.forEach((
|
|
51
|
-
const
|
|
52
|
-
|
|
53
|
-
}),
|
|
54
|
-
const
|
|
55
|
-
o = o.replace(n.REGULAR_NAME_HEIGHT, `${n.TRIMMED_NAME_HEIGHT} ${
|
|
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) =>
|
|
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
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
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) || [],
|
|
151
|
-
return i.every((
|
|
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
|
-
|
|
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
|
-
|
|
49
|
+
o as CSS,
|
|
51
50
|
m as DUMMY_IMAGE_MAPPINGS,
|
|
52
51
|
e as DefaultPadding,
|
|
53
|
-
|
|
52
|
+
a as HTML,
|
|
54
53
|
t as MinDeviceViewport,
|
|
55
54
|
n as REGEX,
|
|
56
55
|
s as VerticalOrientation
|
package/dist/package.json.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
const o = "3.28.
|
|
1
|
+
const o = "3.28.1-beta.70df1f2", s = { stripo: { version: "2.86.1" } }, t = {
|
|
2
2
|
version: o,
|
|
3
3
|
guido: s
|
|
4
4
|
};
|
|
5
5
|
export {
|
|
6
|
-
|
|
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;
|
|
@@ -50,17 +50,17 @@ const Y = () => {
|
|
|
50
50
|
const n = L(), s = N(), o = z(), { getCompiledEmail: r, getTemplateData: e } = x(), { writeTrackingIds: i } = F(), { compileHtml: t, compileAmpHtml: c } = I(), { isFeatureEnabled: a } = D();
|
|
51
51
|
return {
|
|
52
52
|
prepareTemplateDetails: async (h) => {
|
|
53
|
-
let { html: m, css:
|
|
53
|
+
let { html: m, css: p, syncModulesIds: u = [] } = h ?? await e();
|
|
54
54
|
if (a("linkTrackingIds")) {
|
|
55
55
|
const { changed: P, nextSeq: E } = i(s.trackIdSessionFloor);
|
|
56
|
-
s.trackIdSessionFloor = E, P && ({ html: m, css:
|
|
56
|
+
s.trackIdSessionFloor = E, P && ({ html: m, css: p, syncModulesIds: u = [] } = await e());
|
|
57
57
|
}
|
|
58
58
|
const { html: T, ampHtml: d = "", ampErrors: w = [] } = await r({
|
|
59
59
|
minimize: !0,
|
|
60
60
|
resetDataSavedFlag: !1
|
|
61
|
-
})
|
|
62
|
-
|
|
63
|
-
const { compiledHtml: A, stats: l, appliedRules: y } = t(T), C = d && c(d).compiledHtml, k = n.getSelectedDynamicContentList, H = b();
|
|
61
|
+
});
|
|
62
|
+
o.selectedUnsubscribePages.length && await o.fetchTemplates(), await S(m);
|
|
63
|
+
const { compiledHtml: A, stats: l, appliedRules: y } = t(T), C = d && c(d).compiledHtml, k = n.getSelectedDynamicContentList, H = b(), f = M(m);
|
|
64
64
|
return console.debug("HTML Compilation Stats:", {
|
|
65
65
|
originalSize: l.originalSize,
|
|
66
66
|
compiledSize: l.compiledSize,
|
|
@@ -71,17 +71,17 @@ const Y = () => {
|
|
|
71
71
|
dynamicContentList: k,
|
|
72
72
|
compiledHtml: A,
|
|
73
73
|
rawHtml: m,
|
|
74
|
-
css:
|
|
74
|
+
css: p,
|
|
75
75
|
ampHtml: C,
|
|
76
76
|
ampErrors: w,
|
|
77
|
-
modules:
|
|
77
|
+
modules: u.map(Number),
|
|
78
78
|
recommendation: {
|
|
79
79
|
campaignUrls: H.recommendationCampaignUrls,
|
|
80
80
|
configs: {}
|
|
81
81
|
},
|
|
82
82
|
unsubscribe: {
|
|
83
|
-
status:
|
|
84
|
-
config:
|
|
83
|
+
status: f.length > 0,
|
|
84
|
+
config: f
|
|
85
85
|
}
|
|
86
86
|
};
|
|
87
87
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@useinsider/guido",
|
|
3
|
-
"version": "3.28.
|
|
3
|
+
"version": "3.28.1-beta.70df1f2",
|
|
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",
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
"dependencies": {
|
|
62
62
|
"@stripoinc/ui-editor-extensions": "3.11.0",
|
|
63
63
|
"@useinsider/design-system-organisms": "0.0.3-beta.d816f06",
|
|
64
|
-
"@useinsider/design-system-vue": "2.
|
|
64
|
+
"@useinsider/design-system-vue": "2.7.0",
|
|
65
65
|
"@vueuse/core": "11.3.0",
|
|
66
66
|
"lodash-es": "4.17.21",
|
|
67
67
|
"pinia": "2.3.1",
|