@equinor/fusion-framework-react 7.2.1 → 7.2.2-alpha-afdec66178b3cac96597125945ba7e1b4ca2ca7e

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,13 +1,17 @@
1
- import { AppManifest } from '@equinor/fusion-framework-module-app';
1
+ import { ApplicationManifest } from '@equinor/fusion-framework-module-app';
2
+ type UseAppsArgs = {
3
+ /** @deprecated - no longer available */
4
+ includeHidden?: boolean;
5
+ filterByCurrentUser?: boolean;
6
+ };
2
7
  /**
3
8
  * React Hook - Get apps from framework
4
- * @param args Object with boolean member includeHidden
5
- * @returns Object {apps, isLoading} where apps is Array of AppManifest, isLoading is a boolean on observable complete
9
+ * @param args Object with filterByCurrentUser: boolean
10
+ * @returns Object {apps, isLoading, error} where apps is Array of ApplicationManifest, isLoading is a boolean on observable complete
11
+ * @since 7.1.1
6
12
  */
7
- export declare const useApps: (args?: {
8
- includeHidden: boolean;
9
- }) => {
10
- apps: AppManifest[] | undefined;
13
+ export declare const useApps: (args?: UseAppsArgs) => {
14
+ apps: ApplicationManifest[] | undefined;
11
15
  isLoading: boolean;
12
16
  error: unknown;
13
17
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@equinor/fusion-framework-react",
3
- "version": "7.2.1",
3
+ "version": "7.2.2-alpha-afdec66178b3cac96597125945ba7e1b4ca2ca7e",
4
4
  "description": "",
5
5
  "main": "dist/esm/index.js",
6
6
  "exports": {
@@ -69,11 +69,11 @@
69
69
  },
70
70
  "dependencies": {
71
71
  "rxjs": "^7.8.1",
72
- "@equinor/fusion-framework": "^7.2.6",
73
- "@equinor/fusion-framework-react-module": "^3.1.5",
74
- "@equinor/fusion-framework-module": "^4.3.4",
75
- "@equinor/fusion-observable": "^8.4.1",
76
- "@equinor/fusion-framework-react-module-http": "^6.0.3"
72
+ "@equinor/fusion-framework": "^7.2.7-alpha-afdec66178b3cac96597125945ba7e1b4ca2ca7e",
73
+ "@equinor/fusion-framework-module": "^4.3.5-alpha-afdec66178b3cac96597125945ba7e1b4ca2ca7e",
74
+ "@equinor/fusion-framework-react-module": "^3.1.6-alpha-afdec66178b3cac96597125945ba7e1b4ca2ca7e",
75
+ "@equinor/fusion-framework-react-module-http": "^7.0.0-alpha-afdec66178b3cac96597125945ba7e1b4ca2ca7e",
76
+ "@equinor/fusion-observable": "^8.4.1"
77
77
  },
78
78
  "devDependencies": {
79
79
  "@types/react": "^18.2.50",
@@ -81,17 +81,17 @@
81
81
  "react": "^18.2.0",
82
82
  "react-dom": "^18.2.0",
83
83
  "typescript": "^5.5.4",
84
- "@equinor/fusion-framework-module-feature-flag": "^1.1.8",
85
84
  "@equinor/fusion-framework-module-app": "^5.3.11",
86
- "@equinor/fusion-framework-module-event": "^4.2.3",
87
- "@equinor/fusion-framework-react-module-context": "^6.2.12"
85
+ "@equinor/fusion-framework-module-feature-flag": "^1.1.9-alpha-afdec66178b3cac96597125945ba7e1b4ca2ca7e",
86
+ "@equinor/fusion-framework-module-event": "^4.2.4-alpha-afdec66178b3cac96597125945ba7e1b4ca2ca7e",
87
+ "@equinor/fusion-framework-react-module-context": "^6.2.13-alpha-afdec66178b3cac96597125945ba7e1b4ca2ca7e"
88
88
  },
89
89
  "peerDependencies": {
90
90
  "@types/react": "^17.0.0 || ^18.0.0",
91
91
  "react": "^17.0.0 || ^18.0.0",
92
92
  "react-dom": "^17.0.0 || ^18.0.0",
93
- "@equinor/fusion-framework-react-module-signalr": "^3.0.14",
94
- "@equinor/fusion-framework-module-feature-flag": "^1.1.8"
93
+ "@equinor/fusion-framework-module-feature-flag": "^1.1.9-alpha-afdec66178b3cac96597125945ba7e1b4ca2ca7e",
94
+ "@equinor/fusion-framework-react-module-signalr": "^3.0.15-alpha-afdec66178b3cac96597125945ba7e1b4ca2ca7e"
95
95
  },
96
96
  "peerDependenciesMeta": {
97
97
  "@equinor/fusion-framework-module-event": {
@@ -1,30 +1,40 @@
1
- import { AppManifest } from '@equinor/fusion-framework-module-app';
1
+ import { ApplicationManifest } from '@equinor/fusion-framework-module-app';
2
2
  import { useObservableState } from '@equinor/fusion-observable/react';
3
3
  import { useMemo } from 'react';
4
4
 
5
5
  import { useAppProvider } from './useAppProvider';
6
6
 
7
+ type UseAppsArgs = {
8
+ /** @deprecated - no longer available */
9
+ includeHidden?: boolean;
10
+ // only show apps that the current user has access to
11
+ filterByCurrentUser?: boolean;
12
+ };
13
+
7
14
  /**
8
15
  * React Hook - Get apps from framework
9
- * @param args Object with boolean member includeHidden
10
- * @returns Object {apps, isLoading} where apps is Array of AppManifest, isLoading is a boolean on observable complete
16
+ * @param args Object with filterByCurrentUser: boolean
17
+ * @returns Object {apps, isLoading, error} where apps is Array of ApplicationManifest, isLoading is a boolean on observable complete
18
+ * @since 7.1.1
11
19
  */
12
- export const useApps = (args?: {
13
- includeHidden: boolean;
14
- }): { apps: AppManifest[] | undefined; isLoading: boolean; error: unknown } => {
20
+ export const useApps = (
21
+ args?: UseAppsArgs,
22
+ ): { apps: ApplicationManifest[] | undefined; isLoading: boolean; error: unknown } => {
15
23
  const provider = useAppProvider();
24
+
25
+ const { filterByCurrentUser } = args || {};
26
+
16
27
  const {
17
- value: manifests,
28
+ value: apps,
18
29
  complete,
19
30
  error,
20
- } = useObservableState(useMemo(() => provider.getAllAppManifests(), [provider]));
21
-
22
- const apps = useMemo(() => {
23
- if (manifests && !args?.includeHidden) {
24
- return manifests.filter((app) => !app.hide);
25
- }
26
- return manifests;
27
- }, [args, manifests]);
31
+ } = useObservableState(
32
+ useMemo(
33
+ () =>
34
+ provider.getAppManifests(filterByCurrentUser ? { filterByCurrentUser } : undefined),
35
+ [provider, filterByCurrentUser],
36
+ ),
37
+ );
28
38
 
29
39
  return { apps, isLoading: !complete, error };
30
40
  };