@equinor/fusion-framework-react-app 0.7.0-0 → 0.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.
@@ -1 +1 @@
1
- export { useCurrentUser, useFramework, useHttpClient } from '@equinor/fusion-framework-react/hooks';
1
+ export { useCurrentUser, useFramework, useHttpClient as useFrameworkHttpClient, } from '@equinor/fusion-framework-react/hooks';
@@ -1,2 +1 @@
1
- export { IHttpClient, HttpClientMsal, FetchRequestInit, } from '@equinor/fusion-framework-module-http';
2
- export { useHttpClient } from './useHttpClient';
1
+ export * from '@equinor/fusion-framework-react/http';
@@ -1,7 +1,6 @@
1
1
  export { appModules } from '@equinor/fusion-framework-app';
2
- export type { AppConfigurator, AppModules, AppModulesInstance, AppManifest, } from '@equinor/fusion-framework-app';
2
+ export type { AppConfigurator, AppConfigCallback, AppModules, AppModulesInstance, AppManifest, } from '@equinor/fusion-framework-app';
3
3
  export { useAppModule } from './useAppModule';
4
4
  export { useAppModules } from './useAppModules';
5
5
  export { createApp } from './create-app';
6
- export { createLegacyApp } from './create-legacy-app';
7
6
  export { default } from './create-app';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@equinor/fusion-framework-react-app",
3
- "version": "0.7.0-0",
3
+ "version": "0.7.2",
4
4
  "description": "",
5
5
  "main": "dist/esm/index.js",
6
6
  "exports": {
@@ -39,22 +39,19 @@
39
39
  "directory": "packages/react"
40
40
  },
41
41
  "dependencies": {
42
- "@equinor/fusion-framework": "^3.0.0",
43
- "@equinor/fusion-framework-app": "^0.2.0",
44
- "@equinor/fusion-framework-module": "^0.4.2",
45
- "@equinor/fusion-framework-module-event": "^0.1.2",
46
- "@equinor/fusion-framework-module-http": "^1.0.0",
47
- "@equinor/fusion-framework-module-msal": "^0.4.0",
48
- "@equinor/fusion-framework-react": "^0.2.19",
49
- "@equinor/fusion-framework-react-module-app-config": "^0.1.4",
50
- "@equinor/fusion-observable": "^0.3.0"
42
+ "@equinor/fusion-framework-app": "^0.2.2",
43
+ "@equinor/fusion-framework-module": "^0.4.3",
44
+ "@equinor/fusion-framework-module-event": "^0.1.3",
45
+ "@equinor/fusion-framework-module-msal": "^0.4.1",
46
+ "@equinor/fusion-framework-react": "^0.3.2",
47
+ "@equinor/fusion-framework-react-module-app-config": "^0.1.6"
51
48
  },
52
49
  "devDependencies": {
53
50
  "@types/react": "^17.0.11",
54
51
  "@types/react-dom": "^17.0.7",
55
52
  "react": "^17.0.2",
56
53
  "react-dom": "^17.0.2",
57
- "typescript": "^4.7.4"
54
+ "typescript": "^4.8.2"
58
55
  },
59
56
  "peerDependencies": {
60
57
  "@types/react": "^16.9.0 || ^17.0.0 || ^18.0.0",
@@ -68,5 +65,6 @@
68
65
  "react-dom": {
69
66
  "optional": true
70
67
  }
71
- }
68
+ },
69
+ "gitHead": "3f2046693f0bbae193616f29444dd95efb101c16"
72
70
  }
@@ -1 +1,5 @@
1
- export { useCurrentUser, useFramework, useHttpClient } from '@equinor/fusion-framework-react/hooks';
1
+ export {
2
+ useCurrentUser,
3
+ useFramework,
4
+ useHttpClient as useFrameworkHttpClient,
5
+ } from '@equinor/fusion-framework-react/hooks';
package/src/http/index.ts CHANGED
@@ -1,7 +1 @@
1
- export {
2
- IHttpClient,
3
- HttpClientMsal,
4
- FetchRequestInit,
5
- } from '@equinor/fusion-framework-module-http';
6
-
7
- export { useHttpClient } from './useHttpClient';
1
+ export * from '@equinor/fusion-framework-react/http';
package/src/index.ts CHANGED
@@ -7,6 +7,7 @@ export { appModules } from '@equinor/fusion-framework-app';
7
7
 
8
8
  export type {
9
9
  AppConfigurator,
10
+ AppConfigCallback,
10
11
  AppModules,
11
12
  AppModulesInstance,
12
13
  AppManifest,
@@ -16,6 +17,5 @@ export { useAppModule } from './useAppModule';
16
17
  export { useAppModules } from './useAppModules';
17
18
 
18
19
  export { createApp } from './create-app';
19
- export { createLegacyApp } from './create-legacy-app';
20
20
 
21
21
  export { default } from './create-app';
package/tsconfig.json CHANGED
@@ -9,10 +9,7 @@
9
9
  },
10
10
  "references": [
11
11
  {
12
- "path": "../observable"
13
- },
14
- {
15
- "path": "../framework"
12
+ "path": "../module"
16
13
  },
17
14
  {
18
15
  "path": "../app"
@@ -23,9 +20,6 @@
23
20
  {
24
21
  "path": "../module"
25
22
  },
26
- {
27
- "path": "../module-http"
28
- },
29
23
  {
30
24
  "path": "../module-msal"
31
25
  },
@@ -1,15 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { Suspense, useMemo } from 'react';
3
- import { useFramework } from '@equinor/fusion-framework-react/hooks';
4
- import { createApp } from './create-app';
5
- export const createLegacyApp = (Component, configure, modules) => {
6
- return () => {
7
- const fusion = useFramework();
8
- const RenderComponent = useMemo(() => {
9
- const creator = createApp(Component, configure, modules);
10
- return creator(fusion, { name: '' });
11
- }, []);
12
- return (_jsx(Suspense, { fallback: _jsx("p", { children: "loading app" }), children: _jsx(RenderComponent, {}) }));
13
- };
14
- };
15
- //# sourceMappingURL=create-legacy-app.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"create-legacy-app.js","sourceRoot":"","sources":["../../src/create-legacy-app.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAE1C,OAAO,EAAE,YAAY,EAAE,MAAM,uCAAuC,CAAC;AAKrE,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC,MAAM,CAAC,MAAM,eAAe,GAAG,CAC3B,SAA8B,EAC9B,SAAqC,EACrC,OAAkB,EACpB,EAAE;IACA,OAAO,GAAgB,EAAE;QACrB,MAAM,MAAM,GAAG,YAAY,EAAE,CAAC;QAC9B,MAAM,eAAe,GAAG,OAAO,CAAC,GAAG,EAAE;YACjC,MAAM,OAAO,GAAG,SAAS,CAAC,SAAS,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC;YACzD,OAAO,OAAO,CAAC,MAAM,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,CAAC;QACzC,CAAC,EAAE,EAAE,CAAC,CAAC;QACP,OAAO,CACH,KAAC,QAAQ,IAAC,QAAQ,EAAE,sCAAkB,YAClC,KAAC,eAAe,KAAG,GACZ,CACd,CAAC;IACN,CAAC,CAAC;AACN,CAAC,CAAC"}
@@ -1,14 +0,0 @@
1
- import { useMemo } from 'react';
2
- import { useAppModule } from '../useAppModule';
3
- export const useHttpClient = (name) => {
4
- const http = useAppModule('http');
5
- const client = useMemo(() => {
6
- if (http.hasClient(name)) {
7
- return http.createClient(name);
8
- }
9
- throw Error(`no configured client for key [${name}]`);
10
- }, [name]);
11
- return client;
12
- };
13
- export default useHttpClient;
14
- //# sourceMappingURL=useHttpClient.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useHttpClient.js","sourceRoot":"","sources":["../../../src/http/useHttpClient.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAChC,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAa/C,MAAM,CAAC,MAAM,aAAa,GAAG,CAA6C,IAAY,EAAS,EAAE;IAC7F,MAAM,IAAI,GAAG,YAAY,CAAC,MAAM,CAAC,CAAC;IAClC,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,EAAE;QACxB,IAAI,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE;YACtB,OAAO,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;SAClC;QACD,MAAM,KAAK,CAAC,iCAAiC,IAAI,GAAG,CAAC,CAAC;IAC1D,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC;IAEX,OAAO,MAA0B,CAAC;AACtC,CAAC,CAAC;AAEF,eAAe,aAAa,CAAC"}
@@ -1,3 +0,0 @@
1
- import type { AnyModule } from '@equinor/fusion-framework-module';
2
- import type { AppConfigurator } from '@equinor/fusion-framework-app';
3
- export declare const createLegacyApp: <TModules extends AnyModule[]>(Component: React.ComponentType, configure?: AppConfigurator<TModules> | undefined, modules?: TModules | undefined) => () => JSX.Element;
@@ -1,8 +0,0 @@
1
- import { HttpClientMsal, IHttpClient } from '@equinor/fusion-framework-module-http';
2
- export declare const useHttpClient: <TType extends IHttpClient<import("@equinor/fusion-framework-module-http").FetchRequest, Response> = HttpClientMsal<RequestInit & {
3
- uri: string;
4
- path: string;
5
- } & {
6
- scopes?: string[] | undefined;
7
- }, Response>>(name: string) => TType;
8
- export default useHttpClient;
@@ -1,27 +0,0 @@
1
- import { Suspense, useMemo } from 'react';
2
-
3
- import { useFramework } from '@equinor/fusion-framework-react/hooks';
4
-
5
- import type { AnyModule } from '@equinor/fusion-framework-module';
6
- import type { AppConfigurator } from '@equinor/fusion-framework-app';
7
-
8
- import { createApp } from './create-app';
9
-
10
- export const createLegacyApp = <TModules extends Array<AnyModule>>(
11
- Component: React.ComponentType,
12
- configure?: AppConfigurator<TModules>,
13
- modules?: TModules
14
- ) => {
15
- return (): JSX.Element => {
16
- const fusion = useFramework();
17
- const RenderComponent = useMemo(() => {
18
- const creator = createApp(Component, configure, modules);
19
- return creator(fusion, { name: '' });
20
- }, []);
21
- return (
22
- <Suspense fallback={<p>loading app</p>}>
23
- <RenderComponent />
24
- </Suspense>
25
- );
26
- };
27
- };
@@ -1,29 +0,0 @@
1
- /* eslint-disable @typescript-eslint/ban-types */
2
- import { HttpClientMsal, IHttpClient } from '@equinor/fusion-framework-module-http';
3
- import { useMemo } from 'react';
4
- import { useAppModule } from '../useAppModule';
5
-
6
- /**
7
- * Use a configured client from application modules
8
- *
9
- * creates a new client from configured client by name and memorizes the instance.
10
- * if provided name changes a new client will be created
11
- *
12
- * @see {@link IHttpClient}
13
- * @see {@link @equinor/fusion-framework-module-http.IHttpClientConfigurator.configureClient|configureClient}
14
- * @template TType type-hint return type, useful if custom Ctor is provided in config
15
- * @param name Named client from configuration
16
- */
17
- export const useHttpClient = <TType extends IHttpClient = HttpClientMsal>(name: string): TType => {
18
- const http = useAppModule('http');
19
- const client = useMemo(() => {
20
- if (http.hasClient(name)) {
21
- return http.createClient(name);
22
- }
23
- throw Error(`no configured client for key [${name}]`);
24
- }, [name]);
25
- // TODO - abort on unmount?
26
- return client as unknown as TType;
27
- };
28
-
29
- export default useHttpClient;