@equinor/fusion-framework-dev-portal 1.1.2 → 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 CHANGED
@@ -1,5 +1,17 @@
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
+
9
+ ## 1.1.3
10
+
11
+ ### Patch Changes
12
+
13
+ - [#3446](https://github.com/equinor/fusion-framework/pull/3446) [`706c8a3`](https://github.com/equinor/fusion-framework/commit/706c8a3eebd7a4cb86cf457f50252a4a61520c15) Thanks [@dependabot](https://github.com/apps/dependabot)! - Updated @equinor/fusion-wc-person from 3.2.0 to 3.2.1.
14
+
3
15
  ## 1.1.2
4
16
 
5
17
  ### 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 qLe(a) {
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().optional(),
48184
+ jobTitle: nt().nullish(),
48185
48185
  accountType: nl(["Employee", "Consultant", "External", "Application", "Local"]).optional(),
48186
48186
  accountClassification: nl(["Unclassified", "Internal", "External"]).nullish()
48187
48187
  })
@@ -53760,9 +53760,11 @@ const YI = _r`
53760
53760
  text-overflow: ellipsis;
53761
53761
  -webkit-line-clamp: 2;
53762
53762
  -webkit-box-orient: vertical;
53763
+ white-space: break-spaces;
53763
53764
  }
53764
53765
  .person-card__department,
53765
53766
  .person-card__jobtitle {
53767
+ white-space: break-spaces;
53766
53768
  font-size: calc(
53767
53769
  ${oe(re.typography.paragraph.caption.getVariable("fontSize"))} * var(--content-resize, 1)
53768
53770
  );
@@ -63748,18 +63750,17 @@ class vi extends Gi {
63748
63750
  complete: (e) => {
63749
63751
  var r, n;
63750
63752
  const { accountType: i, accountClassification: o, name: s } = e, u = Nm(this.getRenderClasses(i, o));
63751
- return Ae`<div>
63752
- <fwc-avatar
63753
- class=${u}
63754
- .size=${this.size}
63755
- ?clickable=${this.clickable}
63756
- ?disabled=${this.disabled}
63757
- @click=${this.handleOnClick}
63758
- @mouseover=${this.handleMouseOver}
63759
- @mouseout=${this.handleMouseOut}
63760
- border
63761
- >
63762
- ${this.showLetter ? Ae`${(r = s?.substring(0, 1)) === null || r === void 0 ? void 0 : r.toUpperCase()}` : (n = this.tasks) === null || n === void 0 ? void 0 : n.photo.render({
63753
+ return Ae`<fwc-avatar
63754
+ class=${u}
63755
+ .size=${this.size}
63756
+ ?clickable=${this.clickable}
63757
+ ?disabled=${this.disabled}
63758
+ @click=${this.handleOnClick}
63759
+ @mouseover=${this.handleMouseOver}
63760
+ @mouseout=${this.handleMouseOut}
63761
+ border
63762
+ >
63763
+ ${this.showLetter ? Ae`${(r = s?.substring(0, 1)) === null || r === void 0 ? void 0 : r.toUpperCase()}` : (n = this.tasks) === null || n === void 0 ? void 0 : n.photo.render({
63763
63764
  complete: (f) => Ae`<img src="${f}" alt="${s}" />`,
63764
63765
  pending: () => this.renderImagePlaceholder(!0),
63765
63766
  error: () => {
@@ -63767,8 +63768,7 @@ class vi extends Gi {
63767
63768
  return console.log("failed"), Ae`${(f = s?.substring(0, 1)) === null || f === void 0 ? void 0 : f.toUpperCase()}`;
63768
63769
  }
63769
63770
  })}
63770
- </fwc-avatar>
63771
- </div>`;
63771
+ </fwc-avatar>`;
63772
63772
  },
63773
63773
  pending: () => Ae`<fwc-avatar size=${this.size}>${this.renderImagePlaceholder(!0)}</fwc-avatar>`,
63774
63774
  error: () => Ae`<fwc-avatar size=${this.size} inactive>${this.renderImagePlaceholder(!1)}</fwc-avatar>`
@@ -63929,6 +63929,9 @@ const HSe = _r`
63929
63929
  :host([size='large']) {
63930
63930
  --fwc-avatar-size: 3.5rem;
63931
63931
  }
63932
+ .person-list__avatar {
63933
+ display: flex;
63934
+ }
63932
63935
  .person-list__item {
63933
63936
  display: flex;
63934
63937
  justify-content: space-between;
@@ -85765,7 +85768,20 @@ const LLe = {
85765
85768
  ]
85766
85769
  }
85767
85770
  );
85768
- }, 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 = () => {
85769
85785
  const t = NI("navigation"), { modules: e } = NQ(), { context: r, navigation: n } = e ?? {};
85770
85786
  iY(
85771
85787
  // if the context is not available, use an empty observable
@@ -85789,27 +85805,20 @@ const LLe = {
85789
85805
  console.debug("🌍 Portal:", "current context was cleared, navigating to root"), n ? n.replace("/") : t.replace("/");
85790
85806
  return;
85791
85807
  }
85792
- const s = oK(o), u = s ? i ? (
85793
- // context id exists in the url, replace it with the new context id
85794
- o.replace(s, i.id)
85795
- ) : (
85796
- // context was cleared, set the path to the root
85797
- "/"
85798
- ) : (
85799
- // could not find context id in the url, set the path to the new context id
85800
- `/${i?.id}`
85808
+ const s = ZLe(
85809
+ o,
85810
+ i,
85811
+ r,
85812
+ r?.extractContextIdFromPath?.(o) ?? oK(o)
85801
85813
  );
85802
- console.debug(
85803
- "🌍 Portal:",
85804
- "context changed, navigating to app's context url:",
85805
- 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"}]`
85806
- ), 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 });
85807
85815
  },
85808
85816
  [
85809
85817
  // framework navigation instance, should not change
85810
85818
  t,
85811
85819
  // application navigation instance, may change when the application changes
85812
- n
85820
+ n,
85821
+ r
85813
85822
  ]
85814
85823
  )
85815
85824
  );
@@ -85832,33 +85841,33 @@ const LLe = {
85832
85841
  max-width: 100%;
85833
85842
  display: grid;
85834
85843
  `
85835
- }, zLe = () => (GTe({ resolveAppPath: (t) => `/apps/${t}` }), /* @__PURE__ */ D.jsxs(zk.ContentContainer, { children: [
85844
+ }, ULe = () => (GTe({ resolveAppPath: (t) => `/apps/${t}` }), /* @__PURE__ */ D.jsxs(zk.ContentContainer, { children: [
85836
85845
  /* @__PURE__ */ D.jsx(zk.Head, { children: /* @__PURE__ */ D.jsx(HLe, {}) }),
85837
85846
  /* @__PURE__ */ D.jsx(zk.Main, { children: /* @__PURE__ */ D.jsx(yRe, {}) })
85838
- ] })), ULe = () => {
85847
+ ] })), VLe = () => {
85839
85848
  const { appKey: t } = nRe();
85840
85849
  return t ? /* @__PURE__ */ D.jsx(hNe, { appKey: t }) : null;
85841
- }, VLe = [
85850
+ }, jLe = [
85842
85851
  {
85843
85852
  path: "/",
85844
- element: /* @__PURE__ */ D.jsx(zLe, {}),
85853
+ element: /* @__PURE__ */ D.jsx(ULe, {}),
85845
85854
  children: [
85846
85855
  {
85847
85856
  path: "apps/:appKey/*",
85848
- element: /* @__PURE__ */ D.jsx(ULe, {})
85857
+ element: /* @__PURE__ */ D.jsx(VLe, {})
85849
85858
  }
85850
85859
  ]
85851
85860
  }
85852
- ], jLe = () => {
85853
- const { navigation: t } = zp().modules, [e] = P.useState(() => t.createRouter(VLe));
85854
- return ZLe(), /* @__PURE__ */ D.jsx(
85861
+ ], FLe = () => {
85862
+ const { navigation: t } = zp().modules, [e] = P.useState(() => t.createRouter(jLe));
85863
+ return zLe(), /* @__PURE__ */ D.jsx(
85855
85864
  NRe,
85856
85865
  {
85857
85866
  router: e,
85858
85867
  fallbackElement: /* @__PURE__ */ D.jsx("p", { children: "wooot" })
85859
85868
  }
85860
85869
  );
85861
- }, FLe = '<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>', BLe = new Blob([FLe], { type: "image/svg+xml" }), eZe = (t, e) => {
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) => {
85862
85871
  Fne.createRoot(t).render(
85863
85872
  /* @__PURE__ */ D.jsx(yge, { theme: re, children: /* @__PURE__ */ D.jsx(
85864
85873
  p1e,
@@ -85866,12 +85875,12 @@ const LLe = {
85866
85875
  configure: BTe,
85867
85876
  parent: e.ref,
85868
85877
  fallback: /* @__PURE__ */ D.jsx(rY, { text: "Loading framework" }),
85869
- children: /* @__PURE__ */ D.jsx(cEe, { options: { fallbackImage: BLe }, children: /* @__PURE__ */ D.jsx(jLe, {}) })
85878
+ children: /* @__PURE__ */ D.jsx(cEe, { options: { fallbackImage: qLe }, children: /* @__PURE__ */ D.jsx(FLe, {}) })
85870
85879
  }
85871
85880
  ) })
85872
85881
  );
85873
85882
  };
85874
85883
  export {
85875
- eZe as default,
85876
- eZe as render
85884
+ tZe as default,
85885
+ tZe as render
85877
85886
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@equinor/fusion-framework-dev-portal",
3
- "version": "1.1.2",
3
+ "version": "1.1.4",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "module": "./dist/main.js",
@@ -40,21 +40,21 @@
40
40
  "tsx": "^4.19.3",
41
41
  "typescript": "^5.8.2",
42
42
  "vite": "^7.1.5",
43
- "@equinor/fusion-framework": "^7.3.19",
43
+ "@equinor/fusion-framework": "^7.3.20",
44
44
  "@equinor/fusion-framework-app": "^10.0.0",
45
- "@equinor/fusion-framework-dev-server": "^1.1.2",
45
+ "@equinor/fusion-framework-module-app": "^7.0.1",
46
+ "@equinor/fusion-framework-dev-server": "^1.1.3",
46
47
  "@equinor/fusion-framework-module-bookmark": "^3.0.1",
47
- "@equinor/fusion-framework-module-context": "^7.0.0",
48
48
  "@equinor/fusion-framework-module-feature-flag": "^1.1.24",
49
- "@equinor/fusion-framework-module-services": "^7.1.1",
50
- "@equinor/fusion-framework-module-app": "^7.0.1",
51
- "@equinor/fusion-framework-react": "^7.4.18",
49
+ "@equinor/fusion-framework-module-context": "^7.0.0",
50
+ "@equinor/fusion-framework-module-services": "^7.1.2",
52
51
  "@equinor/fusion-framework-module-navigation": "^6.0.0",
53
- "@equinor/fusion-framework-react-components-bookmark": "^1.1.0",
52
+ "@equinor/fusion-framework-react": "^7.4.18",
53
+ "@equinor/fusion-framework-react-components-people-provider": "^1.5.23",
54
54
  "@equinor/fusion-framework-react-module-bookmark": "^5.0.1",
55
- "@equinor/fusion-observable": "^8.5.4",
56
- "@equinor/fusion-framework-react-components-people-provider": "^1.5.22",
57
- "@equinor/fusion-query": "^5.2.14"
55
+ "@equinor/fusion-framework-react-components-bookmark": "^1.1.0",
56
+ "@equinor/fusion-query": "^5.2.14",
57
+ "@equinor/fusion-observable": "^8.5.4"
58
58
  },
59
59
  "scripts": {
60
60
  "start": "tsx dev-server.ts",
@@ -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 { ContextItem, ContextModule } from '@equinor/fusion-framework-module-context';
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
- // extract the context id from the current path
67
- const pathContextId = extractContextIdFromPath(currentPathname);
68
-
69
- // generate path to the selected context
70
- const pathname = pathContextId
71
- ? item
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';
2
+ export const version = '1.1.4';