@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.
- package/dist/composables/useRecommendation.js +33 -34
- package/dist/composables/useStripoEventHandler.js +13 -11
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +9 -13
- package/dist/src/composables/useStripoEventHandler.test.d.ts +1 -0
- package/package.json +1 -1
- package/dist/extensions/Blocks/Recommendation/utils/partnerCustomizations.js +0 -21
- package/dist/src/extensions/Blocks/Recommendation/utils/partnerCustomizations.d.ts +0 -7
|
@@ -1,22 +1,21 @@
|
|
|
1
|
-
import { getRecommendationFeedSourceMaps as I, URLS as
|
|
2
|
-
import { MinDeviceViewport as
|
|
3
|
-
import { useRecommendationExtensionStore as
|
|
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
|
|
6
|
+
const w = () => ({
|
|
8
7
|
calculateCardWidth: ({
|
|
9
|
-
mobileLeftPadding:
|
|
8
|
+
mobileLeftPadding: o,
|
|
10
9
|
mobileRightPadding: s,
|
|
11
|
-
cardsInRow:
|
|
12
|
-
unresponsive:
|
|
10
|
+
cardsInRow: a,
|
|
11
|
+
unresponsive: n
|
|
13
12
|
}) => {
|
|
14
|
-
const r =
|
|
15
|
-
return (
|
|
13
|
+
const r = n ? a : 1, e = o + s + (r - 1) * b;
|
|
14
|
+
return (R - e) / r;
|
|
16
15
|
},
|
|
17
|
-
getRecommendationCampaignData: (
|
|
18
|
-
const s =
|
|
19
|
-
if (!
|
|
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 } =
|
|
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: (
|
|
47
|
-
var
|
|
48
|
-
const
|
|
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
|
|
54
|
-
if (!
|
|
52
|
+
const c = a.blockStates[r];
|
|
53
|
+
if (!c)
|
|
55
54
|
return "";
|
|
56
|
-
const { recommendationConfigs:
|
|
55
|
+
const { recommendationConfigs: i } = c;
|
|
57
56
|
e = {
|
|
58
|
-
strategy:
|
|
59
|
-
language:
|
|
60
|
-
currencyCode:
|
|
61
|
-
size:
|
|
62
|
-
productIds:
|
|
63
|
-
filters:
|
|
64
|
-
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 = ((
|
|
68
|
-
t.set("locale", e.language), t.set("currency", e.currencyCode), t.set("partnerName",
|
|
69
|
-
const g = e.filters.filter((
|
|
70
|
-
d && t.set("filter", d), e.shuffleProducts && t.set("shuffle", "true")
|
|
71
|
-
const p = decodeURIComponent(t.toString()), u = `${
|
|
72
|
-
return
|
|
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
|
-
|
|
75
|
+
w as useRecommendation
|
|
77
76
|
};
|
|
@@ -1,33 +1,35 @@
|
|
|
1
|
-
import { useStripoApi as
|
|
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:
|
|
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(),
|
|
10
|
-
if (
|
|
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
|
-
|
|
16
|
+
t.syncModulesEnabled && (console.debug("[module_saved] Saved module data:", e), await r(e));
|
|
17
17
|
},
|
|
18
18
|
module_dropped: async (e) => {
|
|
19
|
-
if (!
|
|
19
|
+
if (!t.syncModulesEnabled)
|
|
20
20
|
return;
|
|
21
|
-
const { moduleId: o } = e,
|
|
22
|
-
console.debug("[module_dropped] Sync module data:",
|
|
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
|
-
|
|
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
|
|
30
|
-
console.debug("Stripo Event: ", e, 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 {
|
|
10
|
-
import {
|
|
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
|
|
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
|
-
}),
|
|
63
|
-
state: () =>
|
|
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:
|
|
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) => !
|
|
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)
|
|
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
|
-
|
|
474
|
+
M as useRecommendationExtensionStore
|
|
479
475
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@useinsider/guido",
|
|
3
|
-
"version": "3.6.0-beta.
|
|
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>;
|