@equinor/fusion-framework-cli 9.8.6 → 9.9.0

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,31 @@
1
1
  # Change Log
2
2
 
3
+ ## 9.9.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#1933](https://github.com/equinor/fusion-framework/pull/1933) [`701c297`](https://github.com/equinor/fusion-framework/commit/701c29709351ff80864d26311efc72a439cd4098) Thanks [@odinr](https://github.com/odinr)! - CLI will now update pathname when current context changes
8
+
9
+ CLI will now resolve initial context _(if context module enabled)_
10
+
11
+ Fixes: https://github.com/equinor/fusion/issues/307
12
+
13
+ Will work even if not application has not enabled navigation
14
+
15
+ ### Patch Changes
16
+
17
+ - [#1929](https://github.com/equinor/fusion-framework/pull/1929) [`86e7556`](https://github.com/equinor/fusion-framework/commit/86e7556b212f42501ef5e885fea36d20002e43ac) Thanks [@dependabot](https://github.com/apps/dependabot)! - Update to latest fusion-react-context-selector
18
+
19
+ - Updated dependencies []:
20
+ - @equinor/fusion-framework-app@8.1.4
21
+ - @equinor/fusion-framework-react-components-people-provider@1.2.6
22
+
23
+ ## 9.8.7
24
+
25
+ ### Patch Changes
26
+
27
+ - [#1930](https://github.com/equinor/fusion-framework/pull/1930) [`057f204`](https://github.com/equinor/fusion-framework/commit/057f204fc01ee6579280b621bc83ca74589acd6b) Thanks [@eikeland](https://github.com/eikeland)! - update fusion-react-context-selector
28
+
3
29
  ## 9.8.6
4
30
 
5
31
  ### Patch Changes
@@ -6,6 +6,7 @@ import Header from './Header';
6
6
  import { useFramework } from '@equinor/fusion-framework-react';
7
7
  import { useState } from 'react';
8
8
  import { styled } from 'styled-components';
9
+ import { useAppContextNavigation } from './useAppContextNavigation';
9
10
  const Styled = {
10
11
  ContentContainer: styled.div `
11
12
  display: grid;
@@ -38,6 +39,7 @@ const routes = [
38
39
  export const Router = () => {
39
40
  const { navigation } = useFramework().modules;
40
41
  const [router] = useState(() => navigation.createRouter(routes));
42
+ useAppContextNavigation();
41
43
  return (_jsx(RouterProvider, { router: router, fallbackElement: _jsx("p", { children: "wooot" }) }));
42
44
  };
43
45
  //# sourceMappingURL=Router.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Router.js","sourceRoot":"","sources":["../../../src/bin/dev-portal/Router.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,wDAAwD,CAAC;AAE7F,OAAO,EAAE,MAAM,EAAE,cAAc,EAAuB,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC1F,OAAO,SAAS,MAAM,aAAa,CAAC;AACpC,OAAO,MAAM,MAAM,UAAU,CAAC;AAE9B,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAE/D,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjC,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAE3C,MAAM,MAAM,GAAG;IACX,gBAAgB,EAAE,MAAM,CAAC,GAAG,CAAA;;;;;;KAM3B;CACJ,CAAC;AAEF,MAAM,IAAI,GAAG,GAAG,EAAE;IACd,mBAAmB,CAAC,EAAE,cAAc,EAAE,CAAC,MAAc,EAAE,EAAE,CAAC,SAAS,MAAM,EAAE,EAAE,CAAC,CAAC;IAC/E,OAAO,CACH,MAAC,MAAM,CAAC,gBAAgB,eACpB,KAAC,MAAM,KAAG,EACV,KAAC,MAAM,KAAG,IACY,CAC7B,CAAC;AACN,CAAC,CAAC;AAGF,MAAM,QAAQ,GAAG,GAAG,EAAE;IAClB,MAAM,EAAE,MAAM,EAAE,GAAG,SAAS,EAAE,CAAC;IAC/B,OAAO,MAAM,CAAC,CAAC,CAAC,KAAC,SAAS,IAAC,MAAM,EAAE,MAAM,GAAI,CAAC,CAAC,CAAC,IAAI,CAAC;AACzD,CAAC,CAAC;AAEF,MAAM,MAAM,GAAG;IACX;QACI,IAAI,EAAE,GAAG;QAC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O,CACH,MAAC,MAAM,CAAC,gBAAgB,eACpB,KAAC,MAAM,KAAG,EACV,KAAC,MAAM,KAAG,IACY,CAC7B,CAAC;AACN,CAAC,CAAC;AAGF,MAAM,QAAQ,GAAG,GAAG,EAAE;IAClB,MAAM,EAAE,MAAM,EAAE,GAAG,SAAS,EAAE,CAAC;IAC/B,OAAO,MAAM,CAAC,CAAC,CAAC,KAAC,SAAS,IAAC,MAAM,EAAE,MAAM,GAAI,CAAC,CAAC,CAAC,IAAI,CAAC;AACzD,CAAC,CAAC;AAEF,MAAM,MAAM,GAAG;IACX;QACI,IAAI,EAAE,GAAG;QACT,OAAO,EAAE,KAAC,IAAI,KAAG;QACjB,QAAQ,EAAE;YACN;gBACI,IAAI,EAAE,gBAAgB;gBACtB,OAAO,EAAE,KAAC,QAAQ,KAAG;aACxB;SACJ;KACJ;CACJ,CAAC;AAGF,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,EAAE;IACvB,MAAM,EAAE,UAAU,EAAE,GAAG,YAAY,EAAsB,CAAC,OAAO,CAAC;IAClE,MAAM,CAAC,MAAM,CAAC,GAAG,QAAQ,CAAC,GAAG,EAAE,CAAC,UAAU,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC,CAAC;IAEjE,uBAAuB,EAAE,CAAC;IAC1B,OAAO,CACH,KAAC,cAAc,IACX,MAAM,EAAE,MAAkD,EAC1D,eAAe,EAAE,gCAAY,GAC/B,CACL,CAAC;AACN,CAAC,CAAC"}
@@ -0,0 +1,47 @@
1
+ import { useCallback } from 'react';
2
+ import { useCurrentAppModules } from '@equinor/fusion-framework-react/app';
3
+ import { extractContextIdFromPath } from '@equinor/fusion-framework-module-context/utils';
4
+ import { useObservableSubscription } from '@equinor/fusion-observable/react';
5
+ import { EMPTY } from 'rxjs';
6
+ import { useFrameworkModule } from '@equinor/fusion-framework-react';
7
+ export const useAppContextNavigation = () => {
8
+ var _a;
9
+ const navigation = useFrameworkModule('navigation');
10
+ const { modules } = useCurrentAppModules();
11
+ const { context, navigation: appNavigation } = modules !== null && modules !== void 0 ? modules : {};
12
+ useObservableSubscription((_a = context === null || context === void 0 ? void 0 : context.currentContext$) !== null && _a !== void 0 ? _a : EMPTY, useCallback((item) => {
13
+ if (item === undefined || navigation === undefined) {
14
+ return;
15
+ }
16
+ const currentPathname = appNavigation
17
+ ?
18
+ appNavigation.path.pathname
19
+ :
20
+ navigation.path.pathname;
21
+ console.debug('🌍 Portal:', appNavigation
22
+ ? 'App has its own navigation, using it to navigate.'
23
+ : 'App does not have its own navigation, using portal navigation.');
24
+ const pathContextId = extractContextIdFromPath(currentPathname);
25
+ const pathname = pathContextId
26
+ ? item
27
+ ?
28
+ currentPathname.replace(pathContextId, item.id)
29
+ :
30
+ '/'
31
+ :
32
+ `/${item === null || item === void 0 ? void 0 : item.id}`;
33
+ console.debug('🌍 Portal:', "context changed, navigating to app's context url:", pathContextId
34
+ ? `found context id [${pathContextId}] in url, ${item ? `replacing with [${item.id}]` : 'context was cleared, navigating to root'}`
35
+ : `could not find context id in url, navigating to context id [${item ? item.id : 'root'}]`);
36
+ if (appNavigation) {
37
+ appNavigation.replace(Object.assign(Object.assign({}, appNavigation.path), { pathname }));
38
+ }
39
+ else {
40
+ navigation.replace(Object.assign(Object.assign({}, navigation.path), { pathname }));
41
+ }
42
+ }, [
43
+ navigation,
44
+ appNavigation,
45
+ ]));
46
+ };
47
+ //# sourceMappingURL=useAppContextNavigation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useAppContextNavigation.js","sourceRoot":"","sources":["../../../src/bin/dev-portal/useAppContextNavigation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAEpC,OAAO,EAAE,oBAAoB,EAAE,MAAM,qCAAqC,CAAC;AAG3E,OAAO,EAAE,wBAAwB,EAAE,MAAM,gDAAgD,CAAC;AAI1F,OAAO,EAAE,yBAAyB,EAAE,MAAM,kCAAkC,CAAC;AAC7E,OAAO,EAAE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