@equinor/fusion-framework-dev-portal 1.1.3 → 1.1.4
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 +6 -0
- package/dist/main.js +38 -32
- package/package.json +7 -7
- package/src/useAppContextNavigation.ts +54 -20
- package/src/version.ts +1 -1
- package/tsconfig.tsbuildinfo +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @equinor/fusion-framework-dev-portal
|
|
2
2
|
|
|
3
|
+
## 1.1.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#3471](https://github.com/equinor/fusion-framework/pull/3471) [`1db21e2`](https://github.com/equinor/fusion-framework/commit/1db21e21410f37bd9a8c1d31ab4f68452578a51e) Thanks [@asbjornhaland](https://github.com/asbjornhaland)! - Re-add support for custom context path extraction and generation
|
|
8
|
+
|
|
3
9
|
## 1.1.3
|
|
4
10
|
|
|
5
11
|
### Patch Changes
|
package/dist/main.js
CHANGED
|
@@ -13223,7 +13223,7 @@ Check the render method of \`` + a + "`." : "";
|
|
|
13223
13223
|
};
|
|
13224
13224
|
}
|
|
13225
13225
|
}
|
|
13226
|
-
function
|
|
13226
|
+
function GLe(a) {
|
|
13227
13227
|
return a;
|
|
13228
13228
|
}
|
|
13229
13229
|
function DX(a) {
|
|
@@ -15454,10 +15454,10 @@ Incoming: %s`, Fe, "[" + c.join(", ") + "]", "[" + a.join(", ") + "]");
|
|
|
15454
15454
|
}
|
|
15455
15455
|
return [A, S];
|
|
15456
15456
|
}
|
|
15457
|
-
function GLe(a, c, h) {
|
|
15458
|
-
}
|
|
15459
15457
|
function KLe(a, c, h) {
|
|
15460
15458
|
}
|
|
15459
|
+
function WLe(a, c, h) {
|
|
15460
|
+
}
|
|
15461
15461
|
function q7(a, c, h) {
|
|
15462
15462
|
var m = zn, y = Ed(), S, T = Na();
|
|
15463
15463
|
if (T) {
|
|
@@ -48181,7 +48181,7 @@ const HL = nt().datetime({ offset: !0 }).transform((t) => new Date(t)), gT = {
|
|
|
48181
48181
|
name: nt(),
|
|
48182
48182
|
mail: nt().optional(),
|
|
48183
48183
|
phoneNumber: nt().optional(),
|
|
48184
|
-
jobTitle: nt().
|
|
48184
|
+
jobTitle: nt().nullish(),
|
|
48185
48185
|
accountType: nl(["Employee", "Consultant", "External", "Application", "Local"]).optional(),
|
|
48186
48186
|
accountClassification: nl(["Unclassified", "Internal", "External"]).nullish()
|
|
48187
48187
|
})
|
|
@@ -85768,7 +85768,20 @@ const LLe = {
|
|
|
85768
85768
|
]
|
|
85769
85769
|
}
|
|
85770
85770
|
);
|
|
85771
|
-
}, ZLe = () => {
|
|
85771
|
+
}, ZLe = (t, e, r, n) => {
|
|
85772
|
+
if (n) {
|
|
85773
|
+
const o = r?.generatePathFromContext?.(e, t) ?? t.replace(n, e.id);
|
|
85774
|
+
return console.debug(
|
|
85775
|
+
"🌍 Portal: context changed, navigating to app's context url:",
|
|
85776
|
+
`found context id [${n}] in url, replacing with [${o}]`
|
|
85777
|
+
), o;
|
|
85778
|
+
}
|
|
85779
|
+
const i = r?.generatePathFromContext?.(e, t) ?? `/${e?.id}`;
|
|
85780
|
+
return console.debug(
|
|
85781
|
+
"🌍 Portal: context changed, navigating to app's context url:",
|
|
85782
|
+
`could not find context id in url, navigating to path [${i}]`
|
|
85783
|
+
), i;
|
|
85784
|
+
}, zLe = () => {
|
|
85772
85785
|
const t = NI("navigation"), { modules: e } = NQ(), { context: r, navigation: n } = e ?? {};
|
|
85773
85786
|
iY(
|
|
85774
85787
|
// if the context is not available, use an empty observable
|
|
@@ -85792,27 +85805,20 @@ const LLe = {
|
|
|
85792
85805
|
console.debug("🌍 Portal:", "current context was cleared, navigating to root"), n ? n.replace("/") : t.replace("/");
|
|
85793
85806
|
return;
|
|
85794
85807
|
}
|
|
85795
|
-
const s =
|
|
85796
|
-
|
|
85797
|
-
|
|
85798
|
-
|
|
85799
|
-
|
|
85800
|
-
"/"
|
|
85801
|
-
) : (
|
|
85802
|
-
// could not find context id in the url, set the path to the new context id
|
|
85803
|
-
`/${i?.id}`
|
|
85808
|
+
const s = ZLe(
|
|
85809
|
+
o,
|
|
85810
|
+
i,
|
|
85811
|
+
r,
|
|
85812
|
+
r?.extractContextIdFromPath?.(o) ?? oK(o)
|
|
85804
85813
|
);
|
|
85805
|
-
|
|
85806
|
-
"🌍 Portal:",
|
|
85807
|
-
"context changed, navigating to app's context url:",
|
|
85808
|
-
s ? `found context id [${s}] in url, ${i ? `replacing with [${i.id}]` : "context was cleared, navigating to root"}` : `could not find context id in url, navigating to context id [${i ? i.id : "root"}]`
|
|
85809
|
-
), n ? n.replace({ ...n.path, pathname: u }) : t.replace({ ...t.path, pathname: u });
|
|
85814
|
+
n ? n.replace({ ...n.path, pathname: s }) : t.replace({ ...t.path, pathname: s });
|
|
85810
85815
|
},
|
|
85811
85816
|
[
|
|
85812
85817
|
// framework navigation instance, should not change
|
|
85813
85818
|
t,
|
|
85814
85819
|
// application navigation instance, may change when the application changes
|
|
85815
|
-
n
|
|
85820
|
+
n,
|
|
85821
|
+
r
|
|
85816
85822
|
]
|
|
85817
85823
|
)
|
|
85818
85824
|
);
|
|
@@ -85835,33 +85841,33 @@ const LLe = {
|
|
|
85835
85841
|
max-width: 100%;
|
|
85836
85842
|
display: grid;
|
|
85837
85843
|
`
|
|
85838
|
-
},
|
|
85844
|
+
}, ULe = () => (GTe({ resolveAppPath: (t) => `/apps/${t}` }), /* @__PURE__ */ D.jsxs(zk.ContentContainer, { children: [
|
|
85839
85845
|
/* @__PURE__ */ D.jsx(zk.Head, { children: /* @__PURE__ */ D.jsx(HLe, {}) }),
|
|
85840
85846
|
/* @__PURE__ */ D.jsx(zk.Main, { children: /* @__PURE__ */ D.jsx(yRe, {}) })
|
|
85841
|
-
] })),
|
|
85847
|
+
] })), VLe = () => {
|
|
85842
85848
|
const { appKey: t } = nRe();
|
|
85843
85849
|
return t ? /* @__PURE__ */ D.jsx(hNe, { appKey: t }) : null;
|
|
85844
|
-
},
|
|
85850
|
+
}, jLe = [
|
|
85845
85851
|
{
|
|
85846
85852
|
path: "/",
|
|
85847
|
-
element: /* @__PURE__ */ D.jsx(
|
|
85853
|
+
element: /* @__PURE__ */ D.jsx(ULe, {}),
|
|
85848
85854
|
children: [
|
|
85849
85855
|
{
|
|
85850
85856
|
path: "apps/:appKey/*",
|
|
85851
|
-
element: /* @__PURE__ */ D.jsx(
|
|
85857
|
+
element: /* @__PURE__ */ D.jsx(VLe, {})
|
|
85852
85858
|
}
|
|
85853
85859
|
]
|
|
85854
85860
|
}
|
|
85855
|
-
],
|
|
85856
|
-
const { navigation: t } = zp().modules, [e] = P.useState(() => t.createRouter(
|
|
85857
|
-
return
|
|
85861
|
+
], FLe = () => {
|
|
85862
|
+
const { navigation: t } = zp().modules, [e] = P.useState(() => t.createRouter(jLe));
|
|
85863
|
+
return zLe(), /* @__PURE__ */ D.jsx(
|
|
85858
85864
|
NRe,
|
|
85859
85865
|
{
|
|
85860
85866
|
router: e,
|
|
85861
85867
|
fallbackElement: /* @__PURE__ */ D.jsx("p", { children: "wooot" })
|
|
85862
85868
|
}
|
|
85863
85869
|
);
|
|
85864
|
-
},
|
|
85870
|
+
}, BLe = '<svg height="24px" width="24px" fill="#999" viewBox="0 0 24 24" title="person" role="img" xmlns="http://www.w3.org/2000/svg"><rect width="100%" height="100%" fill="#eee" /><path d="M12 4C9.79 4 8 5.79 8 8s1.79 4 4 4 4-1.79 4-4-1.79-4-4-4Zm2 4c0-1.1-.9-2-2-2s-2 .9-2 2 .9 2 2 2 2-.9 2-2Zm4 10c-.2-.71-3.3-2-6-2-2.69 0-5.77 1.28-6 2h12ZM4 18c0-2.66 5.33-4 8-4s8 1.34 8 4v2H4v-2Z" fill-rule="evenodd" clip-rule="evenodd" class="sc-dmqHEX eydzYY"></path></svg>', qLe = new Blob([BLe], { type: "image/svg+xml" }), tZe = (t, e) => {
|
|
85865
85871
|
Fne.createRoot(t).render(
|
|
85866
85872
|
/* @__PURE__ */ D.jsx(yge, { theme: re, children: /* @__PURE__ */ D.jsx(
|
|
85867
85873
|
p1e,
|
|
@@ -85869,12 +85875,12 @@ const LLe = {
|
|
|
85869
85875
|
configure: BTe,
|
|
85870
85876
|
parent: e.ref,
|
|
85871
85877
|
fallback: /* @__PURE__ */ D.jsx(rY, { text: "Loading framework" }),
|
|
85872
|
-
children: /* @__PURE__ */ D.jsx(cEe, { options: { fallbackImage:
|
|
85878
|
+
children: /* @__PURE__ */ D.jsx(cEe, { options: { fallbackImage: qLe }, children: /* @__PURE__ */ D.jsx(FLe, {}) })
|
|
85873
85879
|
}
|
|
85874
85880
|
) })
|
|
85875
85881
|
);
|
|
85876
85882
|
};
|
|
85877
85883
|
export {
|
|
85878
|
-
|
|
85879
|
-
|
|
85884
|
+
tZe as default,
|
|
85885
|
+
tZe as render
|
|
85880
85886
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@equinor/fusion-framework-dev-portal",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.4",
|
|
4
4
|
"description": "",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "./dist/main.js",
|
|
@@ -40,19 +40,19 @@
|
|
|
40
40
|
"tsx": "^4.19.3",
|
|
41
41
|
"typescript": "^5.8.2",
|
|
42
42
|
"vite": "^7.1.5",
|
|
43
|
+
"@equinor/fusion-framework": "^7.3.20",
|
|
43
44
|
"@equinor/fusion-framework-app": "^10.0.0",
|
|
44
|
-
"@equinor/fusion-framework-dev-server": "^1.1.2",
|
|
45
45
|
"@equinor/fusion-framework-module-app": "^7.0.1",
|
|
46
|
-
"@equinor/fusion-framework": "^
|
|
46
|
+
"@equinor/fusion-framework-dev-server": "^1.1.3",
|
|
47
47
|
"@equinor/fusion-framework-module-bookmark": "^3.0.1",
|
|
48
|
-
"@equinor/fusion-framework-module-context": "^7.0.0",
|
|
49
48
|
"@equinor/fusion-framework-module-feature-flag": "^1.1.24",
|
|
49
|
+
"@equinor/fusion-framework-module-context": "^7.0.0",
|
|
50
|
+
"@equinor/fusion-framework-module-services": "^7.1.2",
|
|
50
51
|
"@equinor/fusion-framework-module-navigation": "^6.0.0",
|
|
51
|
-
"@equinor/fusion-framework-module-services": "^7.1.1",
|
|
52
52
|
"@equinor/fusion-framework-react": "^7.4.18",
|
|
53
|
-
"@equinor/fusion-framework-react-components-bookmark": "^1.1.0",
|
|
54
|
-
"@equinor/fusion-framework-react-module-bookmark": "^5.0.1",
|
|
55
53
|
"@equinor/fusion-framework-react-components-people-provider": "^1.5.23",
|
|
54
|
+
"@equinor/fusion-framework-react-module-bookmark": "^5.0.1",
|
|
55
|
+
"@equinor/fusion-framework-react-components-bookmark": "^1.1.0",
|
|
56
56
|
"@equinor/fusion-query": "^5.2.14",
|
|
57
57
|
"@equinor/fusion-observable": "^8.5.4"
|
|
58
58
|
},
|
|
@@ -2,7 +2,11 @@ import { useCallback } from 'react';
|
|
|
2
2
|
|
|
3
3
|
import { useCurrentAppModules } from '@equinor/fusion-framework-react/app';
|
|
4
4
|
|
|
5
|
-
import type {
|
|
5
|
+
import type {
|
|
6
|
+
ContextItem,
|
|
7
|
+
ContextModule,
|
|
8
|
+
IContextProvider,
|
|
9
|
+
} from '@equinor/fusion-framework-module-context';
|
|
6
10
|
import { extractContextIdFromPath } from '@equinor/fusion-framework-module-context/utils';
|
|
7
11
|
|
|
8
12
|
import type { NavigationModule } from '@equinor/fusion-framework-module-navigation';
|
|
@@ -13,6 +17,48 @@ import { useFrameworkModule } from '@equinor/fusion-framework-react';
|
|
|
13
17
|
|
|
14
18
|
type CurrentAppModules = [ContextModule, NavigationModule];
|
|
15
19
|
|
|
20
|
+
/**
|
|
21
|
+
* Generates a pathname for navigation based on the current pathname,
|
|
22
|
+
* context item, and optional context provider. If a `pathContextId` is provided,
|
|
23
|
+
* it replaces the existing context ID in the pathname. Otherwise, it constructs
|
|
24
|
+
* a new pathname using the context item's ID.
|
|
25
|
+
*
|
|
26
|
+
* @param currentPathname - The current URL pathname.
|
|
27
|
+
* @param item - The context item containing the ID to be used in the pathname.
|
|
28
|
+
* @param context - An optional context provider with a method to generate a pathname from the context item.
|
|
29
|
+
* @param pathContextId - An optional context ID present in the current URL to be replaced.
|
|
30
|
+
* @returns The generated pathname for navigation.
|
|
31
|
+
*/
|
|
32
|
+
const generatePathname = (
|
|
33
|
+
currentPathname: string,
|
|
34
|
+
item: ContextItem,
|
|
35
|
+
context?: IContextProvider,
|
|
36
|
+
pathContextId?: string,
|
|
37
|
+
) => {
|
|
38
|
+
if (pathContextId) {
|
|
39
|
+
// context id exists in the url, replace it with the new context id
|
|
40
|
+
const pathname =
|
|
41
|
+
context?.generatePathFromContext?.(item, currentPathname) ??
|
|
42
|
+
currentPathname.replace(pathContextId, item.id);
|
|
43
|
+
|
|
44
|
+
console.debug(
|
|
45
|
+
`🌍 Portal: context changed, navigating to app's context url:`,
|
|
46
|
+
`found context id [${pathContextId}] in url, replacing with [${pathname}]`,
|
|
47
|
+
);
|
|
48
|
+
|
|
49
|
+
return pathname;
|
|
50
|
+
}
|
|
51
|
+
// could not find context id in the url, set the path to the new context id
|
|
52
|
+
const pathname = context?.generatePathFromContext?.(item, currentPathname) ?? `/${item?.id}`;
|
|
53
|
+
|
|
54
|
+
console.debug(
|
|
55
|
+
`🌍 Portal: context changed, navigating to app's context url:`,
|
|
56
|
+
`could not find context id in url, navigating to path [${pathname}]`,
|
|
57
|
+
);
|
|
58
|
+
|
|
59
|
+
return pathname;
|
|
60
|
+
};
|
|
61
|
+
|
|
16
62
|
/**
|
|
17
63
|
* when current application changes, this hook will observe the application module instances.
|
|
18
64
|
* If the module has Context and Navigation, this hook will navigate when the context changes
|
|
@@ -63,25 +109,12 @@ export const useAppContextNavigation = () => {
|
|
|
63
109
|
return;
|
|
64
110
|
}
|
|
65
111
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
? // context id exists in the url, replace it with the new context id
|
|
73
|
-
currentPathname.replace(pathContextId, item.id)
|
|
74
|
-
: // context was cleared, set the path to the root
|
|
75
|
-
'/'
|
|
76
|
-
: // could not find context id in the url, set the path to the new context id
|
|
77
|
-
`/${item?.id}`;
|
|
78
|
-
|
|
79
|
-
console.debug(
|
|
80
|
-
'🌍 Portal:',
|
|
81
|
-
"context changed, navigating to app's context url:",
|
|
82
|
-
pathContextId
|
|
83
|
-
? `found context id [${pathContextId}] in url, ${item ? `replacing with [${item.id}]` : 'context was cleared, navigating to root'}`
|
|
84
|
-
: `could not find context id in url, navigating to context id [${item ? item.id : 'root'}]`,
|
|
112
|
+
const pathname = generatePathname(
|
|
113
|
+
currentPathname,
|
|
114
|
+
item,
|
|
115
|
+
context,
|
|
116
|
+
context?.extractContextIdFromPath?.(currentPathname) ??
|
|
117
|
+
extractContextIdFromPath(currentPathname),
|
|
85
118
|
);
|
|
86
119
|
|
|
87
120
|
// if app has its own navigation, use it to navigate
|
|
@@ -98,6 +131,7 @@ export const useAppContextNavigation = () => {
|
|
|
98
131
|
navigation,
|
|
99
132
|
// application navigation instance, may change when the application changes
|
|
100
133
|
appNavigation,
|
|
134
|
+
context,
|
|
101
135
|
],
|
|
102
136
|
),
|
|
103
137
|
);
|
package/src/version.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// Generated by genversion.
|
|
2
|
-
export const version = '1.1.
|
|
2
|
+
export const version = '1.1.4';
|