@websline/cms-view-utils 1.3.1 → 1.3.3

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@websline/cms-view-utils",
3
- "version": "1.3.1",
3
+ "version": "1.3.3",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "src",
@@ -0,0 +1,20 @@
1
+ const fetchCollections = async ({ identifier, itemUuid, limit, locale }) => {
2
+ const params = new URLSearchParams();
3
+
4
+ if (limit != null) {
5
+ params.set("limit", limit);
6
+ }
7
+
8
+ if (itemUuid != null && itemUuid !== "") {
9
+ params.set("itemUuid", itemUuid);
10
+ }
11
+
12
+ const query = params.toString();
13
+ const url = `/api/cms/api/public/collections/${locale}/${identifier}${query ? `?${query}` : ""}`;
14
+
15
+ const response = await fetch(url, { method: "GET" });
16
+
17
+ return response.json();
18
+ };
19
+
20
+ export { fetchCollections };
package/src/index.js CHANGED
@@ -2,6 +2,7 @@ export { isValid } from "./editor/blockValidation.js";
2
2
  export { fetchSimilarRooms } from "./client/fetchSimilarRooms.js";
3
3
  export { fetchSimilarPackages } from "./client/fetchSimilarPackages.js";
4
4
  export { fetchFaqs } from "./client/fetchFaqs.js";
5
+ export { fetchCollections } from "./client/fetchCollections.js";
5
6
 
6
7
  export { default as AddBlockPlaceholder } from "./components/AddBlockPlaceholder.svelte";
7
8
  export { default as BlockWrapper } from "./components/BlockWrapper.svelte";
@@ -19,6 +19,7 @@ const withRequestFilter = (options = {}) => {
19
19
  const isExcludedPath = additionalExcludePaths.some((p) =>
20
20
  url.pathname.startsWith(p),
21
21
  );
22
+ const isAstroApiCall = url.pathname.startsWith("/api/");
22
23
 
23
24
  return (
24
25
  request.method !== "GET" ||
@@ -26,6 +27,7 @@ const withRequestFilter = (options = {}) => {
26
27
  isErrorRoute ||
27
28
  hasFileExtension ||
28
29
  isExcludedPath ||
30
+ isAstroApiCall ||
29
31
  customFilter?.(context) === true
30
32
  );
31
33
  };