@websline/cms-view-utils 1.7.1 → 1.7.2
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/package.json +42 -41
- package/src/client/fetchRatings.js +29 -0
- package/src/index.js +1 -0
package/package.json
CHANGED
|
@@ -1,42 +1,43 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
2
|
+
"name": "@websline/cms-view-utils",
|
|
3
|
+
"version": "1.7.2",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"files": [
|
|
6
|
+
"src",
|
|
7
|
+
"dist"
|
|
8
|
+
],
|
|
9
|
+
"exports": {
|
|
10
|
+
".": "./src/index.js",
|
|
11
|
+
"./server": "./src/server.js",
|
|
12
|
+
"./components/*": "./src/components/*",
|
|
13
|
+
"./preview-bridge": "./dist/previewBridge.global.js",
|
|
14
|
+
"./edit-scroll": "./dist/editScroll.global.js",
|
|
15
|
+
"./dist/*": "./dist/*"
|
|
16
|
+
},
|
|
17
|
+
"dependencies": {
|
|
18
|
+
"jsonwebtoken": "^9.0.3",
|
|
19
|
+
"tailwind-merge": "^3.6.0"
|
|
20
|
+
},
|
|
21
|
+
"devDependencies": {
|
|
22
|
+
"@eslint/compat": "^2.1.0",
|
|
23
|
+
"@eslint/js": "^10.0.1",
|
|
24
|
+
"eslint": "^10.9.0",
|
|
25
|
+
"eslint-config-prettier": "^10.1.8",
|
|
26
|
+
"eslint-plugin-svelte": "^3.23.0",
|
|
27
|
+
"globals": "^17.11.0",
|
|
28
|
+
"prettier": "^3.9.6",
|
|
29
|
+
"prettier-plugin-svelte": "^4.1.1",
|
|
30
|
+
"prettier-plugin-tailwindcss": "^0.8.1",
|
|
31
|
+
"tsup": "^8.5.1"
|
|
32
|
+
},
|
|
33
|
+
"peerDependencies": {
|
|
34
|
+
"svelte": "^5.0.0"
|
|
35
|
+
},
|
|
36
|
+
"scripts": {
|
|
37
|
+
"build": "tsup",
|
|
38
|
+
"prepublishOnly": "pnpm build",
|
|
39
|
+
"format": "prettier --write .",
|
|
40
|
+
"lint": "prettier --check . && eslint ."
|
|
41
|
+
},
|
|
42
|
+
"sideEffects": false
|
|
43
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Fetch ABM guest reviews, newest first, page by page.
|
|
3
|
+
*
|
|
4
|
+
* @param {object} options
|
|
5
|
+
* @param {string} options.locale - Locale code, e.g. `"de"`.
|
|
6
|
+
* @param {number} [options.page] - 1-based page number. Invalid values fall back to 1.
|
|
7
|
+
* @param {number} [options.pageSize] - Reviews per page: 6, 9, 12, 15 or 18. Anything else falls back to 12.
|
|
8
|
+
* @returns {Promise<object>} `{ items, pagination }` — `pagination` carries `page`, `pages`, `pageSize` and `total`. A page past the end has empty `items`.
|
|
9
|
+
*/
|
|
10
|
+
const fetchRatings = async ({ locale, page, pageSize }) => {
|
|
11
|
+
const params = new URLSearchParams();
|
|
12
|
+
|
|
13
|
+
if (page != null) {
|
|
14
|
+
params.set("page", page);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
if (pageSize != null) {
|
|
18
|
+
params.set("pageSize", pageSize);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const query = params.toString();
|
|
22
|
+
const url = `/api/cms/api/public/abm-ratings/${locale}${query ? `?${query}` : ""}`;
|
|
23
|
+
|
|
24
|
+
const response = await fetch(url, { method: "GET" });
|
|
25
|
+
|
|
26
|
+
return response.json();
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export { fetchRatings };
|
package/src/index.js
CHANGED
|
@@ -6,6 +6,7 @@ export { fetchCollections } from "./client/fetchCollections.js";
|
|
|
6
6
|
export { fetchBoards } from "./client/fetchBoards.js";
|
|
7
7
|
export { fetchBoard } from "./client/fetchBoard.js";
|
|
8
8
|
export { fetchPageTeasers } from "./client/fetchPageTeasers.js";
|
|
9
|
+
export { fetchRatings } from "./client/fetchRatings.js";
|
|
9
10
|
|
|
10
11
|
export { default as AddBlockPlaceholder } from "./components/AddBlockPlaceholder.svelte";
|
|
11
12
|
export { default as BlockWrapper } from "./components/BlockWrapper.svelte";
|