@useinsider/guido 3.7.2-beta.0ef1511 → 3.7.2-beta.b9b817e
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/enums/extensions/recommendationBlock.js +3 -1
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +6 -6
- package/dist/services/recommendationApi.js +31 -19
- package/dist/src/enums/extensions/recommendationBlock.d.ts +1 -0
- package/package.json +10 -1
- package/dist/src/composables/validators/useUnsubscribeBlockValidator.test.d.ts +0 -1
- package/dist/src/extensions/Blocks/Recommendation/block.test.d.ts +0 -1
- package/dist/src/extensions/Blocks/Recommendation/utils/recommendationBlockCount.test.d.ts +0 -1
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { useTranslations as r } from "../../composables/useTranslations.js";
|
|
2
2
|
const l = {
|
|
3
|
-
RECOMMENDATION_API_URL: "https://recommendationv2.api.useinsider.com"
|
|
3
|
+
RECOMMENDATION_API_URL: "https://recommendationv2.api.useinsider.com",
|
|
4
|
+
// Relative path → same-origin as the embedding inone dashboard.
|
|
5
|
+
PRODUCT_ATTRIBUTES_PATH: "/product-attributes/get-attributes"
|
|
4
6
|
}, c = {
|
|
5
7
|
CLIENT_ID: "clientId"
|
|
6
8
|
}, d = () => {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { getRecommendationFeedSourceMaps as g, getOperatorOptions as R, PriceAttributes as C } from "../../../../enums/extensions/recommendationBlock.js";
|
|
2
2
|
import { useRecommendationApi as y } from "../../../../services/recommendationApi.js";
|
|
3
3
|
import { useConfigStore as G } from "../../../../stores/config.js";
|
|
4
|
-
import { defineStore as
|
|
5
|
-
import { DEFAULT_MOBILE_CARDS_IN_ROW as
|
|
4
|
+
import { defineStore as F } from "pinia";
|
|
5
|
+
import { DEFAULT_MOBILE_CARDS_IN_ROW as P, DEFAULT_CARDS_IN_ROW as D } from "../constants/layout.js";
|
|
6
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";
|
|
@@ -13,7 +13,7 @@ const h = y();
|
|
|
13
13
|
let m = null, u = null, d = null;
|
|
14
14
|
function k() {
|
|
15
15
|
return {
|
|
16
|
-
cardsInRow:
|
|
16
|
+
cardsInRow: D,
|
|
17
17
|
currencySettings: {
|
|
18
18
|
name: "USD",
|
|
19
19
|
value: "USD",
|
|
@@ -27,7 +27,7 @@ function k() {
|
|
|
27
27
|
productIds: [],
|
|
28
28
|
id: 1,
|
|
29
29
|
language: "en_US",
|
|
30
|
-
mobileCardsInRow:
|
|
30
|
+
mobileCardsInRow: P,
|
|
31
31
|
mobileLayoutEnabled: !1,
|
|
32
32
|
orientation: "grid",
|
|
33
33
|
recommendedProducts: [],
|
|
@@ -60,7 +60,7 @@ const L = () => ({
|
|
|
60
60
|
blockStates: {},
|
|
61
61
|
currentRecommendationId: null,
|
|
62
62
|
configVersion: 0
|
|
63
|
-
}), K =
|
|
63
|
+
}), K = F("guidoRecommendationExtension", {
|
|
64
64
|
state: () => L(),
|
|
65
65
|
getters: {
|
|
66
66
|
// ====================================================================
|
|
@@ -133,7 +133,7 @@ const L = () => ({
|
|
|
133
133
|
value: e.text
|
|
134
134
|
})),
|
|
135
135
|
getFilterList() {
|
|
136
|
-
return Object.values(this.filterList).map((t) => {
|
|
136
|
+
return Object.values(this.filterList).filter((t) => t.isFilterable !== 0 && t.isFilterable !== !1).map((t) => {
|
|
137
137
|
let e;
|
|
138
138
|
return t.type === "productAttribute" ? e = `product_attributes.${t.attributeName}` : C.includes(t.attributeName) ? e = `${t.attributeName}.${this.recommendationConfigs.currencySettings.value}` : e = t.attributeName, {
|
|
139
139
|
text: t.displayName,
|
|
@@ -1,40 +1,52 @@
|
|
|
1
|
-
import { useHttp as
|
|
2
|
-
import { QUERY_PARAMS as
|
|
3
|
-
const
|
|
4
|
-
|
|
1
|
+
import { useHttp as d } from "../composables/useHttp.js";
|
|
2
|
+
import { QUERY_PARAMS as l, URLS as u } from "../enums/extensions/recommendationBlock.js";
|
|
3
|
+
const R = (o) => o.reduce(
|
|
4
|
+
(a, t, s) => (a[s] = {
|
|
5
|
+
attributeName: t.attributeName,
|
|
6
|
+
attributeJs: t.attributeJs,
|
|
7
|
+
attributeType: t.attributeType,
|
|
8
|
+
type: t.type,
|
|
9
|
+
displayName: t.displayName,
|
|
10
|
+
isFilterable: t.isFilterable
|
|
11
|
+
}, a),
|
|
12
|
+
{}
|
|
13
|
+
), f = () => {
|
|
14
|
+
const { get: o } = d(), { get: a } = d({ headers: {} }), t = "6KcLM9TwheVB1mgK";
|
|
5
15
|
return {
|
|
6
16
|
fetchRecommendationCreateData: async () => {
|
|
7
17
|
try {
|
|
8
|
-
return (await
|
|
18
|
+
return (await o("/newsletter/recommendations/create-data")).data;
|
|
9
19
|
} catch (e) {
|
|
10
20
|
throw console.error("fetchUserModalState error:", e), e;
|
|
11
21
|
}
|
|
12
22
|
},
|
|
13
23
|
fetchRecommendationFilters: async () => {
|
|
14
24
|
try {
|
|
15
|
-
const { data: e } = await
|
|
16
|
-
|
|
25
|
+
const { data: e } = await o(
|
|
26
|
+
u.PRODUCT_ATTRIBUTES_PATH
|
|
27
|
+
), n = Array.isArray(e) ? e : (e == null ? void 0 : e.data) ?? [];
|
|
28
|
+
return R(n);
|
|
17
29
|
} catch (e) {
|
|
18
30
|
throw console.error("fetchRecommendationFilters error:", e), e;
|
|
19
31
|
}
|
|
20
32
|
},
|
|
21
|
-
fetchRecommendationProducts: async (e,
|
|
22
|
-
var
|
|
33
|
+
fetchRecommendationProducts: async (e, n) => {
|
|
34
|
+
var i;
|
|
23
35
|
try {
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
const
|
|
27
|
-
console.debug("🏁 Recommendation API Query:",
|
|
28
|
-
const
|
|
29
|
-
`${
|
|
36
|
+
const r = new URLSearchParams(Object.entries(n));
|
|
37
|
+
r.set(l.CLIENT_ID, t);
|
|
38
|
+
const m = decodeURIComponent(r.toString());
|
|
39
|
+
console.debug("🏁 Recommendation API Query:", m);
|
|
40
|
+
const c = await a(
|
|
41
|
+
`${u.RECOMMENDATION_API_URL}/v2/${e}?${m}`
|
|
30
42
|
);
|
|
31
|
-
return ((
|
|
32
|
-
} catch (
|
|
33
|
-
throw console.error("fetchRecommendationProducts error:",
|
|
43
|
+
return ((i = c == null ? void 0 : c.data) == null ? void 0 : i.data) ?? [];
|
|
44
|
+
} catch (r) {
|
|
45
|
+
throw console.error("fetchRecommendationProducts error:", r), r;
|
|
34
46
|
}
|
|
35
47
|
}
|
|
36
48
|
};
|
|
37
49
|
};
|
|
38
50
|
export {
|
|
39
|
-
|
|
51
|
+
f as useRecommendationApi
|
|
40
52
|
};
|
|
@@ -2,6 +2,7 @@ import type { TextValueObject } from '@@/Types/generic';
|
|
|
2
2
|
import type { RecommendationFeedItem } from '@@/Types/recommendation';
|
|
3
3
|
export declare const URLS: {
|
|
4
4
|
RECOMMENDATION_API_URL: string;
|
|
5
|
+
PRODUCT_ATTRIBUTES_PATH: string;
|
|
5
6
|
};
|
|
6
7
|
export declare const QUERY_PARAMS: {
|
|
7
8
|
CLIENT_ID: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@useinsider/guido",
|
|
3
|
-
"version": "3.7.2-beta.
|
|
3
|
+
"version": "3.7.2-beta.b9b817e",
|
|
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",
|
|
@@ -27,6 +27,8 @@
|
|
|
27
27
|
"test": "vitest run --coverage",
|
|
28
28
|
"test:watch": "vitest",
|
|
29
29
|
"test:visual-update": "npx playwright test --update-snapshots --reporter html",
|
|
30
|
+
"test:e2e:coverage": "E2E_COVERAGE=true playwright test",
|
|
31
|
+
"coverage:e2e:report": "nyc report --reporter=lcov --reporter=text-summary --report-dir=coverage/e2e",
|
|
30
32
|
"prepare": "husky",
|
|
31
33
|
"preinstall": "rm -rf ./node_modules/.vite"
|
|
32
34
|
},
|
|
@@ -74,10 +76,12 @@
|
|
|
74
76
|
"happy-dom": "15.11.7",
|
|
75
77
|
"husky": "9.1.7",
|
|
76
78
|
"msw": "2.10.3",
|
|
79
|
+
"nyc": "17.1.0",
|
|
77
80
|
"sass": "1.69.7",
|
|
78
81
|
"typescript": "5.5.4",
|
|
79
82
|
"typescript-eslint": "8.26.0",
|
|
80
83
|
"vite-plugin-dts": "4.5.4",
|
|
84
|
+
"vite-plugin-istanbul": "7.0.0",
|
|
81
85
|
"vitest": "2.1.9",
|
|
82
86
|
"vue-tsc": "2.2.10"
|
|
83
87
|
},
|
|
@@ -90,6 +94,11 @@
|
|
|
90
94
|
"msw": {
|
|
91
95
|
"workerDirectory": "public"
|
|
92
96
|
},
|
|
97
|
+
"nyc": {
|
|
98
|
+
"report-dir": "coverage/e2e",
|
|
99
|
+
"reporter": ["lcov", "text-summary"],
|
|
100
|
+
"all": false
|
|
101
|
+
},
|
|
93
102
|
"guido": {
|
|
94
103
|
"stripo": {
|
|
95
104
|
"version": "2.65.0"
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|