@equinor/fusion-framework-react 7.2.2 → 7.3.0-alpha-8ca2072f748f36baccdefa6e0d6544f474e92730

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/CHANGELOG.md CHANGED
@@ -1,5 +1,67 @@
1
1
  # Change Log
2
2
 
3
+ ## 7.3.0-alpha-8ca2072f748f36baccdefa6e0d6544f474e92730
4
+
5
+ ### Minor Changes
6
+
7
+ - [#2178](https://github.com/equinor/fusion-framework/pull/2178) [`c5d0818`](https://github.com/equinor/fusion-framework/commit/c5d0818df9793ac4d8a2aed2a07cf359d909d522) Thanks [@eikeland](https://github.com/eikeland)! - Adjusted module to the new app service API.
8
+
9
+ > [!WARNING]
10
+ > This will introduce breaking changes to the configuration of `AppConfigurator.client`.
11
+
12
+ **Added**
13
+
14
+ - Introduced `AppClient` class to handle application manifest and configuration queries.
15
+ - Added `zod` to validate the application manifest.
16
+
17
+ **Changed**
18
+
19
+ - Updated `AppModuleProvider` to use `AppClient` for fetching application manifests and configurations.
20
+ - Modified `AppConfigurator` to utilize `AppClient` for client configuration.
21
+ - Updated `useApps` hook with new input parameter for `filterByCurrentUser` in `fusion-framework-react`.
22
+
23
+ **Migration**
24
+
25
+ before:
26
+
27
+ ```ts
28
+ configurator.setClient({
29
+ getAppManifest: {
30
+ client: {
31
+ fn: ({ appKey }) => httpClient.json$<ApiApp>(`/apps/${appKey}`),
32
+ },
33
+ key: ({ appKey }) => appKey,
34
+ },
35
+ getAppManifests: {
36
+ client: {
37
+ fn: () => httpClient.json$<ApiApp[]>(`/apps`),
38
+ },
39
+ key: () => `all-apps`,
40
+ },
41
+ getAppConfig: {
42
+ client: {
43
+ fn: ({ appKey }) => httpClient.json$<ApiApp>(`/apps/${appKey}/config`),
44
+ },
45
+ key: ({ appKey }) => appKey,
46
+ },
47
+ });
48
+ ```
49
+
50
+ after:
51
+
52
+ ```ts
53
+ import { AppClient } from `@equinor/fusion-framework-module-app`;
54
+ configurator.setClient(new AppClient());
55
+ ```
56
+
57
+ custom client implementation:
58
+
59
+ ```ts
60
+ import { AppClient } from `@equinor/fusion-framework-module-app`;
61
+ class CustomAppClient implements IAppClient { ... }
62
+ configurator.setClient(new CustomAppClient());
63
+ ```
64
+
3
65
  ## 7.2.2
4
66
 
5
67
  ### Patch Changes
@@ -3,18 +3,14 @@ import { useMemo } from 'react';
3
3
  import { useAppProvider } from './useAppProvider';
4
4
  /**
5
5
  * React Hook - Get apps from framework
6
- * @param args Object with boolean member includeHidden
7
- * @returns Object {apps, isLoading} where apps is Array of AppManifest, isLoading is a boolean on observable complete
6
+ * @param args Object with filterByCurrentUser: boolean
7
+ * @returns Object {apps, isLoading, error} where apps is Array of ApplicationManifest, isLoading is a boolean on observable complete
8
+ * @since 7.1.1
8
9
  */
9
10
  export const useApps = (args) => {
10
11
  const provider = useAppProvider();
11
- const { value: manifests, complete, error, } = useObservableState(useMemo(() => provider.getAllAppManifests(), [provider]));
12
- const apps = useMemo(() => {
13
- if (manifests && !(args === null || args === void 0 ? void 0 : args.includeHidden)) {
14
- return manifests.filter((app) => !app.hide);
15
- }
16
- return manifests;
17
- }, [args, manifests]);
12
+ const { filterByCurrentUser } = args || {};
13
+ const { value: apps, complete, error, } = useObservableState(useMemo(() => provider.getAppManifests(filterByCurrentUser ? { filterByCurrentUser } : undefined), [provider, filterByCurrentUser]));
18
14
  return { apps, isLoading: !complete, error };
19
15
  };
20
16
  export default useApps;
@@ -1 +1 @@
1
- {"version":3,"file":"useApps.js","sourceRoot":"","sources":["../../../src/app/useApps.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AACtE,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAEhC,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD;;;;GAIG;AACH,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,IAEvB,EAA2E,EAAE;IAC1E,MA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