@headless-adminapp/app 1.4.33 → 1.4.39

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.
@@ -1,4 +1,5 @@
1
- export declare function useExperienceView(logicalName: string, viewId?: string, associated?: boolean, viewIds?: string[]): {
2
- view: import("@headless-adminapp/core/experience/view").View<import("@headless-adminapp/core/schema").SchemaAttributes> | undefined;
1
+ import { View, ViewExperience } from '@headless-adminapp/core/experience/view';
2
+ export declare function useExperienceView(logicalName: string, viewId?: string, associated?: boolean, viewIds?: string[], view?: ViewExperience<any>): {
3
+ view: View<import("@headless-adminapp/core/schema").SchemaAttributes> | undefined;
3
4
  isLoadingView: boolean;
4
5
  };
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.useExperienceView = useExperienceView;
4
4
  const react_query_1 = require("@tanstack/react-query");
5
5
  const useExperienceStore_1 = require("./useExperienceStore");
6
- function useExperienceView(logicalName, viewId, associated, viewIds) {
6
+ function useExperienceView(logicalName, viewId, associated, viewIds, view) {
7
7
  const experienceStore = (0, useExperienceStore_1.useExperienceStore)();
8
8
  const { data, isPending } = (0, react_query_1.useQuery)({
9
9
  queryKey: [
@@ -12,8 +12,17 @@ function useExperienceView(logicalName, viewId, associated, viewIds) {
12
12
  viewId,
13
13
  associated,
14
14
  viewIds,
15
+ view,
15
16
  ],
16
17
  queryFn: async () => {
18
+ if (view) {
19
+ return {
20
+ id: '__custom-view__',
21
+ name: 'Custom View',
22
+ experience: view,
23
+ logicalName: logicalName,
24
+ };
25
+ }
17
26
  if (associated) {
18
27
  return experienceStore.getAssociatedView(logicalName, viewId, viewIds);
19
28
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@headless-adminapp/app",
3
- "version": "1.4.33",
3
+ "version": "1.4.39",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -38,5 +38,5 @@
38
38
  "uuid": "11.0.3",
39
39
  "yup": "^1.4.0"
40
40
  },
41
- "gitHead": "a6fc880774f7d5a7fb5b1a8e1654262904df93fc"
41
+ "gitHead": "0602dd5f3870963fbcf207a55fb02ebe69a974c0"
42
42
  }
@@ -10,7 +10,9 @@ async function handleResponseError(response) {
10
10
  if (response.headers.get('content-type')?.includes('application/json')) {
11
11
  const data = await response.json();
12
12
  if (data.error) {
13
- throw new transport_1.HttpError(response.status, data.error);
13
+ const message = typeof data.error === 'string' ? data.error : data.error.message;
14
+ const code = data.error?.code;
15
+ throw new transport_1.HttpError(response.status, message, code);
14
16
  }
15
17
  }
16
18
  throw new transport_1.HttpError(response.status, response.statusText);