@equinor/roma-framework 3.0.1 → 5.0.0-beta.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.
Files changed (48) hide show
  1. package/cypress.mjs +14 -124
  2. package/dev-portal/lib/api/ms-graph/api/group/find-group.d.ts +2 -0
  3. package/dev-portal/lib/api/ms-graph/api/group/get-groups-by-ids.d.ts +2 -0
  4. package/dev-portal/lib/api/ms-graph/api/user/get-user-by-id.d.ts +9 -0
  5. package/dev-portal/lib/api/ms-graph/api/user/search.d.ts +4 -0
  6. package/dev-portal/lib/api/ms-graph/index.d.ts +4 -0
  7. package/dev-portal/lib/api/roma/api/app-controller/app-controller.d.ts +10 -10
  8. package/dev-portal/lib/api/roma/api/category-controller/category-controller.d.ts +8 -8
  9. package/dev-portal/lib/api/roma/api/environment-controller/environment-controller.d.ts +2 -2
  10. package/dev-portal/lib/api/roma/api/feedback-controller/feedback-controller.d.ts +4 -4
  11. package/dev-portal/lib/api/roma/api/roma-configuration-controller/roma-configuration-controller.d.ts +14 -14
  12. package/dev-portal/lib/api/roma/api/server-side-event-controller/server-side-event-controller.d.ts +2 -2
  13. package/dev-portal/lib/api/roma/api/service-controller/service-controller.d.ts +8 -8
  14. package/dev-portal/lib/api/roma/api/setting-controller/setting-controller.d.ts +20 -20
  15. package/dev-portal/lib/app-provider.d.ts +7 -1
  16. package/dev-portal/lib/dev-portal/ErrorViewer.d.ts +2 -2
  17. package/dev-portal/lib/dev-portal/PortalStyles.d.ts +276 -0
  18. package/dev-portal/lib/dev-portal/config/AppClient.d.ts +67 -3
  19. package/dev-portal/lib/make-component.d.ts +1 -1
  20. package/dev-portal/lib/test-utils/modules.d.ts +6 -7
  21. package/dev-portal/lib/test-utils/roma-cypress-wrapper.d.ts +2 -2
  22. package/dev-portal/package.json +4 -2
  23. package/dev-portal/roma-framework.umd.js +27033 -15635
  24. package/lib/api/ms-graph/api/group/find-group.d.ts +2 -0
  25. package/lib/api/ms-graph/api/group/get-groups-by-ids.d.ts +2 -0
  26. package/lib/api/ms-graph/api/user/get-user-by-id.d.ts +9 -0
  27. package/lib/api/ms-graph/api/user/search.d.ts +4 -0
  28. package/lib/api/ms-graph/index.d.ts +4 -0
  29. package/lib/api/roma/api/app-controller/app-controller.d.ts +10 -10
  30. package/lib/api/roma/api/category-controller/category-controller.d.ts +8 -8
  31. package/lib/api/roma/api/environment-controller/environment-controller.d.ts +2 -2
  32. package/lib/api/roma/api/feedback-controller/feedback-controller.d.ts +4 -4
  33. package/lib/api/roma/api/roma-configuration-controller/roma-configuration-controller.d.ts +14 -14
  34. package/lib/api/roma/api/server-side-event-controller/server-side-event-controller.d.ts +2 -2
  35. package/lib/api/roma/api/service-controller/service-controller.d.ts +8 -8
  36. package/lib/api/roma/api/setting-controller/setting-controller.d.ts +20 -20
  37. package/lib/app-provider.d.ts +7 -1
  38. package/lib/dev-portal/ErrorViewer.d.ts +2 -2
  39. package/lib/dev-portal/PortalStyles.d.ts +276 -0
  40. package/lib/dev-portal/config/AppClient.d.ts +67 -3
  41. package/lib/make-component.d.ts +1 -1
  42. package/lib/test-utils/modules.d.ts +6 -7
  43. package/lib/test-utils/roma-cypress-wrapper.d.ts +2 -2
  44. package/package.json +4 -2
  45. package/roma-framework.mjs +497 -177
  46. package/{router-DDzmmkip.mjs → router-lZjM0_Ti.mjs} +177 -108
  47. package/dev-portal/lib/dev-portal/config.d.ts +0 -3
  48. package/lib/dev-portal/config.d.ts +0 -3
@@ -1,11 +1,3 @@
1
- var __typeError = (msg) => {
2
- throw TypeError(msg);
3
- };
4
- var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
5
- var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
6
- var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
7
- var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
8
- var _config, _connections, _builderCallbacks, _endpoints, _manifests;
9
1
  import { jsx, jsxs, Fragment } from "react/jsx-runtime";
10
2
  import { useFramework, FrameworkProvider } from "@equinor/fusion-framework-react";
11
3
  import { configureModules } from "@equinor/fusion-framework-app";
@@ -13,25 +5,25 @@ import * as React from "react";
13
5
  import { useState, useEffect, lazy, useRef, createContext, useContext, useMemo } from "react";
14
6
  import { ModuleProvider } from "@equinor/fusion-framework-react-module";
15
7
  import styled, { StyleSheetManager, keyframes } from "styled-components";
16
- import { EdsProvider, StarProgress, Typography, Card, Button, TopBar, SideSheet, Menu, Tooltip, Icon } from "@equinor/eds-core-react";
17
- import { E as EmptyError, o as operate, c as createOperatorSubscriber, i as innerFrom, a as identity, b as isFunction, I as IntlProvider, d as invariant, j as joinPaths, g as getPathContributingMatches, r as resolveTo, w as warning, s as stripBasename, e as createPath, B as BehaviorSubject, f as firstValueFrom, h as getDefaultExportFromCjs, k as of, l as from } from "./router-DDzmmkip.mjs";
8
+ import { EdsProvider, StarProgress, Typography, Card, Button, TopBar, Chip, SideSheet, Menu, Tooltip, Icon, List } from "@equinor/eds-core-react";
9
+ import { E as EmptyError, o as operate, c as createOperatorSubscriber, i as innerFrom, a as identity, b as isFunction, I as IntlProvider, d as invariant, j as joinPaths, g as getResolveToMatches, r as resolveTo, w as warning, s as stripBasename, e as createPath, m as matchPath, B as BehaviorSubject, f as firstValueFrom, h as getDefaultExportFromCjs, k as of, l as from } from "./router-lZjM0_Ti.mjs";
18
10
  import { QueryClient, QueryClientProvider, useQueryClient, useQuery, useMutation } from "@tanstack/react-query";
19
11
  import { useCurrentApp, useApps as useApps$1 } from "@equinor/fusion-framework-react/app";
20
12
  import { App } from "@equinor/fusion-framework-module-app/app";
13
+ import { tokens } from "@equinor/eds-tokens";
14
+ import "react-dom";
21
15
  import { comment_more, accessible, account_circle, help_outline } from "@equinor/eds-icons";
22
16
  import { enableAppModule } from "@equinor/fusion-framework-module-app";
23
17
  import { enableContext } from "@equinor/fusion-framework-module-context";
24
18
  import { enableNavigation } from "@equinor/fusion-framework-module-navigation";
25
19
  import { ModuleConfigBuilder } from "@equinor/fusion-framework-module";
26
20
  import { enableServiceDiscovery } from "@equinor/fusion-framework-module-service-discovery";
27
- import { tokens } from "@equinor/eds-tokens";
28
21
  import { useHttpClient } from "@equinor/fusion-framework-react-module-http";
29
22
  const createExtraScopePlugin = (scope) => {
30
23
  const plugin = (element, index, childEls) => {
31
24
  if (element.type === "rule") {
32
25
  element.props = element.props.map((value) => {
33
- var _a;
34
- if (((_a = element.parent) == null ? void 0 : _a.type) === "@keyframes") {
26
+ if (element.parent?.type === "@keyframes") {
35
27
  return value;
36
28
  }
37
29
  const containerMatch = `div[id^='eds-']`;
@@ -335,7 +327,6 @@ function AppLoader({
335
327
  return appModule;
336
328
  }
337
329
  useEffect(() => {
338
- var _a;
339
330
  setError(null);
340
331
  if (!app) {
341
332
  dispatchEvent("onAppInitializeFailed", { detail: "App not found" });
@@ -344,13 +335,13 @@ function AppLoader({
344
335
  }
345
336
  setLoading(true);
346
337
  const el = document.createElement("div");
347
- (_a = ref.current) == null ? void 0 : _a.appendChild(el);
338
+ ref.current?.appendChild(el);
348
339
  const appModule = renderApplication(el);
349
340
  setLoading(false);
350
341
  const currentRef = ref.current;
351
342
  return () => {
352
343
  try {
353
- currentRef == null ? void 0 : currentRef.removeChild(el);
344
+ currentRef?.removeChild(el);
354
345
  } catch {
355
346
  }
356
347
  appModule.dispose();
@@ -368,16 +359,6 @@ function AppLoader({
368
359
  error && /* @__PURE__ */ jsx(ErrorViewer, { error })
369
360
  ] });
370
361
  }
371
- /**
372
- * React Router v6.15.0
373
- *
374
- * Copyright (c) Remix Software Inc.
375
- *
376
- * This source code is licensed under the MIT license found in the
377
- * LICENSE.md file in the root directory of this source tree.
378
- *
379
- * @license MIT
380
- */
381
362
  function _extends$1() {
382
363
  _extends$1 = Object.assign ? Object.assign.bind() : function(target) {
383
364
  for (var i = 1; i < arguments.length; i++) {
@@ -490,6 +471,7 @@ function useNavigateUnstable() {
490
471
  let dataRouterContext = React.useContext(DataRouterContext);
491
472
  let {
492
473
  basename,
474
+ future,
493
475
  navigator: navigator2
494
476
  } = React.useContext(NavigationContext);
495
477
  let {
@@ -498,7 +480,7 @@ function useNavigateUnstable() {
498
480
  let {
499
481
  pathname: locationPathname
500
482
  } = useLocation();
501
- let routePathnamesJson = JSON.stringify(getPathContributingMatches(matches).map((match) => match.pathnameBase));
483
+ let routePathnamesJson = JSON.stringify(getResolveToMatches(matches, future.v7_relativeSplatPath));
502
484
  let activeRef = React.useRef(false);
503
485
  useIsomorphicLayoutEffect(() => {
504
486
  activeRef.current = true;
@@ -532,22 +514,25 @@ function useResolvedPath(to, _temp2) {
532
514
  let {
533
515
  relative
534
516
  } = _temp2 === void 0 ? {} : _temp2;
517
+ let {
518
+ future
519
+ } = React.useContext(NavigationContext);
535
520
  let {
536
521
  matches
537
522
  } = React.useContext(RouteContext);
538
523
  let {
539
524
  pathname: locationPathname
540
525
  } = useLocation();
541
- let routePathnamesJson = JSON.stringify(getPathContributingMatches(matches).map((match) => match.pathnameBase));
526
+ let routePathnamesJson = JSON.stringify(getResolveToMatches(matches, future.v7_relativeSplatPath));
542
527
  return React.useMemo(() => resolveTo(to, JSON.parse(routePathnamesJson), locationPathname, relative === "path"), [to, routePathnamesJson, locationPathname, relative]);
543
528
  }
544
- var DataRouterHook$1 = /* @__PURE__ */ function(DataRouterHook2) {
529
+ var DataRouterHook$1 = /* @__PURE__ */ (function(DataRouterHook2) {
545
530
  DataRouterHook2["UseBlocker"] = "useBlocker";
546
531
  DataRouterHook2["UseRevalidator"] = "useRevalidator";
547
532
  DataRouterHook2["UseNavigateStable"] = "useNavigate";
548
533
  return DataRouterHook2;
549
- }(DataRouterHook$1 || {});
550
- var DataRouterStateHook$1 = /* @__PURE__ */ function(DataRouterStateHook2) {
534
+ })(DataRouterHook$1 || {});
535
+ var DataRouterStateHook$1 = /* @__PURE__ */ (function(DataRouterStateHook2) {
551
536
  DataRouterStateHook2["UseBlocker"] = "useBlocker";
552
537
  DataRouterStateHook2["UseLoaderData"] = "useLoaderData";
553
538
  DataRouterStateHook2["UseActionData"] = "useActionData";
@@ -559,9 +544,9 @@ var DataRouterStateHook$1 = /* @__PURE__ */ function(DataRouterStateHook2) {
559
544
  DataRouterStateHook2["UseNavigateStable"] = "useNavigate";
560
545
  DataRouterStateHook2["UseRouteId"] = "useRouteId";
561
546
  return DataRouterStateHook2;
562
- }(DataRouterStateHook$1 || {});
547
+ })(DataRouterStateHook$1 || {});
563
548
  function getDataRouterConsoleError$1(hookName) {
564
- return hookName + " must be used within a data router. See https://reactrouter.com/routers/picking-a-router.";
549
+ return hookName + " must be used within a data router. See https://reactrouter.com/v6/routers/picking-a-router.";
565
550
  }
566
551
  function useDataRouterContext$1(hookName) {
567
552
  let ctx = React.useContext(DataRouterContext);
@@ -609,16 +594,6 @@ function useNavigateStable() {
609
594
  }
610
595
  new Promise(() => {
611
596
  });
612
- /**
613
- * React Router DOM v6.15.0
614
- *
615
- * Copyright (c) Remix Software Inc.
616
- *
617
- * This source code is licensed under the MIT license found in the
618
- * LICENSE.md file in the root directory of this source tree.
619
- *
620
- * @license MIT
621
- */
622
597
  function _extends() {
623
598
  _extends = Object.assign ? Object.assign.bind() : function(target) {
624
599
  for (var i = 1; i < arguments.length; i++) {
@@ -747,11 +722,26 @@ function getFormSubmissionInfo(target, basename) {
747
722
  body
748
723
  };
749
724
  }
750
- const _excluded = ["onClick", "relative", "reloadDocument", "replace", "state", "target", "to", "preventScrollReset"], _excluded2 = ["aria-current", "caseSensitive", "className", "end", "style", "to", "children"], _excluded3 = ["reloadDocument", "replace", "state", "method", "action", "onSubmit", "submit", "relative", "preventScrollReset"];
725
+ const _excluded = ["onClick", "relative", "reloadDocument", "replace", "state", "target", "to", "preventScrollReset", "viewTransition"], _excluded2 = ["aria-current", "caseSensitive", "className", "end", "style", "to", "viewTransition", "children"], _excluded3 = ["fetcherKey", "navigate", "reloadDocument", "replace", "state", "method", "action", "onSubmit", "relative", "preventScrollReset", "viewTransition"];
726
+ const REACT_ROUTER_VERSION = "6";
727
+ try {
728
+ window.__reactRouterVersion = REACT_ROUTER_VERSION;
729
+ } catch (e) {
730
+ }
731
+ const ViewTransitionContext = /* @__PURE__ */ React.createContext({
732
+ isTransitioning: false
733
+ });
734
+ if (process.env.NODE_ENV !== "production") {
735
+ ViewTransitionContext.displayName = "ViewTransition";
736
+ }
737
+ const FetchersContext = /* @__PURE__ */ React.createContext(/* @__PURE__ */ new Map());
738
+ if (process.env.NODE_ENV !== "production") {
739
+ FetchersContext.displayName = "Fetchers";
740
+ }
751
741
  if (process.env.NODE_ENV !== "production") ;
752
742
  const isBrowser = typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined";
753
743
  const ABSOLUTE_URL_REGEX = /^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;
754
- const Link = /* @__PURE__ */ React.forwardRef(function LinkWithRef(_ref4, ref) {
744
+ const Link = /* @__PURE__ */ React.forwardRef(function LinkWithRef(_ref7, ref) {
755
745
  let {
756
746
  onClick,
757
747
  relative,
@@ -760,8 +750,9 @@ const Link = /* @__PURE__ */ React.forwardRef(function LinkWithRef(_ref4, ref) {
760
750
  state,
761
751
  target,
762
752
  to,
763
- preventScrollReset
764
- } = _ref4, rest = _objectWithoutPropertiesLoose(_ref4, _excluded);
753
+ preventScrollReset,
754
+ viewTransition
755
+ } = _ref7, rest = _objectWithoutPropertiesLoose(_ref7, _excluded);
765
756
  let {
766
757
  basename
767
758
  } = React.useContext(NavigationContext);
@@ -792,7 +783,8 @@ const Link = /* @__PURE__ */ React.forwardRef(function LinkWithRef(_ref4, ref) {
792
783
  state,
793
784
  target,
794
785
  preventScrollReset,
795
- relative
786
+ relative,
787
+ viewTransition
796
788
  });
797
789
  function handleClick(event) {
798
790
  if (onClick) onClick(event);
@@ -813,7 +805,7 @@ const Link = /* @__PURE__ */ React.forwardRef(function LinkWithRef(_ref4, ref) {
813
805
  if (process.env.NODE_ENV !== "production") {
814
806
  Link.displayName = "Link";
815
807
  }
816
- const NavLink = /* @__PURE__ */ React.forwardRef(function NavLinkWithRef(_ref5, ref) {
808
+ const NavLink = /* @__PURE__ */ React.forwardRef(function NavLinkWithRef(_ref8, ref) {
817
809
  let {
818
810
  "aria-current": ariaCurrentProp = "page",
819
811
  caseSensitive = false,
@@ -821,16 +813,21 @@ const NavLink = /* @__PURE__ */ React.forwardRef(function NavLinkWithRef(_ref5,
821
813
  end = false,
822
814
  style: styleProp,
823
815
  to,
816
+ viewTransition,
824
817
  children
825
- } = _ref5, rest = _objectWithoutPropertiesLoose(_ref5, _excluded2);
818
+ } = _ref8, rest = _objectWithoutPropertiesLoose(_ref8, _excluded2);
826
819
  let path = useResolvedPath(to, {
827
820
  relative: rest.relative
828
821
  });
829
822
  let location = useLocation();
830
823
  let routerState = React.useContext(DataRouterStateContext);
831
824
  let {
832
- navigator: navigator2
825
+ navigator: navigator2,
826
+ basename
833
827
  } = React.useContext(NavigationContext);
828
+ let isTransitioning = routerState != null && // Conditional usage is OK here because the usage of a data router is static
829
+ // eslint-disable-next-line react-hooks/rules-of-hooks
830
+ useViewTransitionState(path) && viewTransition === true;
834
831
  let toPathname = navigator2.encodeLocation ? navigator2.encodeLocation(path).pathname : path.pathname;
835
832
  let locationPathname = location.pathname;
836
833
  let nextLocationPathname = routerState && routerState.navigation && routerState.navigation.location ? routerState.navigation.location.pathname : null;
@@ -839,62 +836,56 @@ const NavLink = /* @__PURE__ */ React.forwardRef(function NavLinkWithRef(_ref5,
839
836
  nextLocationPathname = nextLocationPathname ? nextLocationPathname.toLowerCase() : null;
840
837
  toPathname = toPathname.toLowerCase();
841
838
  }
842
- let isActive = locationPathname === toPathname || !end && locationPathname.startsWith(toPathname) && locationPathname.charAt(toPathname.length) === "/";
839
+ if (nextLocationPathname && basename) {
840
+ nextLocationPathname = stripBasename(nextLocationPathname, basename) || nextLocationPathname;
841
+ }
842
+ const endSlashPosition = toPathname !== "/" && toPathname.endsWith("/") ? toPathname.length - 1 : toPathname.length;
843
+ let isActive = locationPathname === toPathname || !end && locationPathname.startsWith(toPathname) && locationPathname.charAt(endSlashPosition) === "/";
843
844
  let isPending = nextLocationPathname != null && (nextLocationPathname === toPathname || !end && nextLocationPathname.startsWith(toPathname) && nextLocationPathname.charAt(toPathname.length) === "/");
845
+ let renderProps = {
846
+ isActive,
847
+ isPending,
848
+ isTransitioning
849
+ };
844
850
  let ariaCurrent = isActive ? ariaCurrentProp : void 0;
845
851
  let className;
846
852
  if (typeof classNameProp === "function") {
847
- className = classNameProp({
848
- isActive,
849
- isPending
850
- });
853
+ className = classNameProp(renderProps);
851
854
  } else {
852
- className = [classNameProp, isActive ? "active" : null, isPending ? "pending" : null].filter(Boolean).join(" ");
855
+ className = [classNameProp, isActive ? "active" : null, isPending ? "pending" : null, isTransitioning ? "transitioning" : null].filter(Boolean).join(" ");
853
856
  }
854
- let style = typeof styleProp === "function" ? styleProp({
855
- isActive,
856
- isPending
857
- }) : styleProp;
857
+ let style = typeof styleProp === "function" ? styleProp(renderProps) : styleProp;
858
858
  return /* @__PURE__ */ React.createElement(Link, _extends({}, rest, {
859
859
  "aria-current": ariaCurrent,
860
860
  className,
861
861
  ref,
862
862
  style,
863
- to
864
- }), typeof children === "function" ? children({
865
- isActive,
866
- isPending
867
- }) : children);
863
+ to,
864
+ viewTransition
865
+ }), typeof children === "function" ? children(renderProps) : children);
868
866
  });
869
867
  if (process.env.NODE_ENV !== "production") {
870
868
  NavLink.displayName = "NavLink";
871
869
  }
872
- const Form = /* @__PURE__ */ React.forwardRef((props, ref) => {
873
- let submit = useSubmit();
874
- return /* @__PURE__ */ React.createElement(FormImpl, _extends({}, props, {
875
- submit,
876
- ref
877
- }));
878
- });
879
- if (process.env.NODE_ENV !== "production") {
880
- Form.displayName = "Form";
881
- }
882
- const FormImpl = /* @__PURE__ */ React.forwardRef((_ref6, forwardedRef) => {
870
+ const Form = /* @__PURE__ */ React.forwardRef((_ref9, forwardedRef) => {
883
871
  let {
872
+ fetcherKey,
873
+ navigate,
884
874
  reloadDocument,
885
875
  replace,
886
876
  state,
887
877
  method = defaultMethod,
888
878
  action,
889
879
  onSubmit,
890
- submit,
891
880
  relative,
892
- preventScrollReset
893
- } = _ref6, props = _objectWithoutPropertiesLoose(_ref6, _excluded3);
894
- let formMethod = method.toLowerCase() === "get" ? "get" : "post";
881
+ preventScrollReset,
882
+ viewTransition
883
+ } = _ref9, props = _objectWithoutPropertiesLoose(_ref9, _excluded3);
884
+ let submit = useSubmit();
895
885
  let formAction = useFormAction(action, {
896
886
  relative
897
887
  });
888
+ let formMethod = method.toLowerCase() === "get" ? "get" : "post";
898
889
  let submitHandler = (event) => {
899
890
  onSubmit && onSubmit(event);
900
891
  if (event.defaultPrevented) return;
@@ -902,11 +893,14 @@ const FormImpl = /* @__PURE__ */ React.forwardRef((_ref6, forwardedRef) => {
902
893
  let submitter = event.nativeEvent.submitter;
903
894
  let submitMethod = (submitter == null ? void 0 : submitter.getAttribute("formmethod")) || method;
904
895
  submit(submitter || event.currentTarget, {
896
+ fetcherKey,
905
897
  method: submitMethod,
898
+ navigate,
906
899
  replace,
907
900
  state,
908
901
  relative,
909
- preventScrollReset
902
+ preventScrollReset,
903
+ viewTransition
910
904
  });
911
905
  };
912
906
  return /* @__PURE__ */ React.createElement("form", _extends({
@@ -917,7 +911,7 @@ const FormImpl = /* @__PURE__ */ React.forwardRef((_ref6, forwardedRef) => {
917
911
  }, props));
918
912
  });
919
913
  if (process.env.NODE_ENV !== "production") {
920
- FormImpl.displayName = "FormImpl";
914
+ Form.displayName = "Form";
921
915
  }
922
916
  if (process.env.NODE_ENV !== "production") ;
923
917
  var DataRouterHook;
@@ -926,14 +920,16 @@ var DataRouterHook;
926
920
  DataRouterHook2["UseSubmit"] = "useSubmit";
927
921
  DataRouterHook2["UseSubmitFetcher"] = "useSubmitFetcher";
928
922
  DataRouterHook2["UseFetcher"] = "useFetcher";
923
+ DataRouterHook2["useViewTransitionState"] = "useViewTransitionState";
929
924
  })(DataRouterHook || (DataRouterHook = {}));
930
925
  var DataRouterStateHook;
931
926
  (function(DataRouterStateHook2) {
927
+ DataRouterStateHook2["UseFetcher"] = "useFetcher";
932
928
  DataRouterStateHook2["UseFetchers"] = "useFetchers";
933
929
  DataRouterStateHook2["UseScrollRestoration"] = "useScrollRestoration";
934
930
  })(DataRouterStateHook || (DataRouterStateHook = {}));
935
931
  function getDataRouterConsoleError(hookName) {
936
- return hookName + " must be used within a data router. See https://reactrouter.com/routers/picking-a-router.";
932
+ return hookName + " must be used within a data router. See https://reactrouter.com/v6/routers/picking-a-router.";
937
933
  }
938
934
  function useDataRouterContext(hookName) {
939
935
  let ctx = React.useContext(DataRouterContext);
@@ -946,7 +942,8 @@ function useLinkClickHandler(to, _temp) {
946
942
  replace: replaceProp,
947
943
  state,
948
944
  preventScrollReset,
949
- relative
945
+ relative,
946
+ viewTransition
950
947
  } = _temp === void 0 ? {} : _temp;
951
948
  let navigate = useNavigate();
952
949
  let location = useLocation();
@@ -961,16 +958,19 @@ function useLinkClickHandler(to, _temp) {
961
958
  replace,
962
959
  state,
963
960
  preventScrollReset,
964
- relative
961
+ relative,
962
+ viewTransition
965
963
  });
966
964
  }
967
- }, [location, navigate, path, replaceProp, state, target, to, preventScrollReset, relative]);
965
+ }, [location, navigate, path, replaceProp, state, target, to, preventScrollReset, relative, viewTransition]);
968
966
  }
969
967
  function validateClientSideSubmission() {
970
968
  if (typeof document === "undefined") {
971
969
  throw new Error("You are calling submit during the server render. Try calling submit within a `useEffect` or callback instead.");
972
970
  }
973
971
  }
972
+ let fetcherId = 0;
973
+ let getUniqueFetcherId = () => "__" + String(++fetcherId) + "__";
974
974
  function useSubmit() {
975
975
  let {
976
976
  router
@@ -991,16 +991,30 @@ function useSubmit() {
991
991
  formData,
992
992
  body
993
993
  } = getFormSubmissionInfo(target, basename);
994
- router.navigate(options.action || action, {
995
- preventScrollReset: options.preventScrollReset,
996
- formData,
997
- body,
998
- formMethod: options.method || method,
999
- formEncType: options.encType || encType,
1000
- replace: options.replace,
1001
- state: options.state,
1002
- fromRouteId: currentRouteId
1003
- });
994
+ if (options.navigate === false) {
995
+ let key = options.fetcherKey || getUniqueFetcherId();
996
+ router.fetch(key, currentRouteId, options.action || action, {
997
+ preventScrollReset: options.preventScrollReset,
998
+ formData,
999
+ body,
1000
+ formMethod: options.method || method,
1001
+ formEncType: options.encType || encType,
1002
+ flushSync: options.flushSync
1003
+ });
1004
+ } else {
1005
+ router.navigate(options.action || action, {
1006
+ preventScrollReset: options.preventScrollReset,
1007
+ formData,
1008
+ body,
1009
+ formMethod: options.method || method,
1010
+ formEncType: options.encType || encType,
1011
+ replace: options.replace,
1012
+ state: options.state,
1013
+ fromRouteId: currentRouteId,
1014
+ flushSync: options.flushSync,
1015
+ viewTransition: options.viewTransition
1016
+ });
1017
+ }
1004
1018
  }, [router, basename, currentRouteId]);
1005
1019
  }
1006
1020
  function useFormAction(action, _temp2) {
@@ -1019,10 +1033,14 @@ function useFormAction(action, _temp2) {
1019
1033
  let location = useLocation();
1020
1034
  if (action == null) {
1021
1035
  path.search = location.search;
1022
- if (match.route.index) {
1023
- let params = new URLSearchParams(path.search);
1036
+ let params = new URLSearchParams(path.search);
1037
+ let indexValues = params.getAll("index");
1038
+ let hasNakedIndexParam = indexValues.some((v) => v === "");
1039
+ if (hasNakedIndexParam) {
1024
1040
  params.delete("index");
1025
- path.search = params.toString() ? "?" + params.toString() : "";
1041
+ indexValues.filter((v) => v).forEach((v) => params.append("index", v));
1042
+ let qs = params.toString();
1043
+ path.search = qs ? "?" + qs : "";
1026
1044
  }
1027
1045
  }
1028
1046
  if ((!action || action === ".") && match.route.index) {
@@ -1033,6 +1051,25 @@ function useFormAction(action, _temp2) {
1033
1051
  }
1034
1052
  return createPath(path);
1035
1053
  }
1054
+ function useViewTransitionState(to, opts) {
1055
+ if (opts === void 0) {
1056
+ opts = {};
1057
+ }
1058
+ let vtContext = React.useContext(ViewTransitionContext);
1059
+ !(vtContext != null) ? process.env.NODE_ENV !== "production" ? invariant(false, "`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?") : invariant(false) : void 0;
1060
+ let {
1061
+ basename
1062
+ } = useDataRouterContext(DataRouterHook.useViewTransitionState);
1063
+ let path = useResolvedPath(to, {
1064
+ relative: opts.relative
1065
+ });
1066
+ if (!vtContext.isTransitioning) {
1067
+ return false;
1068
+ }
1069
+ let currentPath = stripBasename(vtContext.currentLocation.pathname, basename) || vtContext.currentLocation.pathname;
1070
+ let nextPath = stripBasename(vtContext.nextLocation.pathname, basename) || vtContext.nextLocation.pathname;
1071
+ return matchPath(path.pathname, nextPath) != null || matchPath(path.pathname, currentPath) != null;
1072
+ }
1036
1073
  const AppContext = createContext({
1037
1074
  isLoading: false,
1038
1075
  apps: void 0
@@ -1089,7 +1126,7 @@ const AppViewer = () => {
1089
1126
  const { appKey } = useParams();
1090
1127
  const { apps } = useApps({ includeHidden: true });
1091
1128
  const app = useMemo(() => {
1092
- return apps == null ? void 0 : apps.find((app2) => app2.appKey === appKey);
1129
+ return apps?.find((app2) => app2.appKey === appKey);
1093
1130
  }, [appKey, apps]);
1094
1131
  if (!apps) {
1095
1132
  return /* @__PURE__ */ jsx(EquinorLoader, { text: "Loading apps..." });
@@ -1138,6 +1175,12 @@ const Styled = {
1138
1175
  margin-left: 1.5rem;
1139
1176
  `
1140
1177
  };
1178
+ const EnvChip = styled(Chip)`
1179
+ background-color: ${tokens.colors.interactive.primary__resting.rgba};
1180
+ color: ${tokens.colors.text.static_icons__primary_white.hex};
1181
+ margin-left: 16px;
1182
+ padding: 0 32px;
1183
+ `;
1141
1184
  const StyledSideSheet = styled(SideSheet)`
1142
1185
  position: fixed;
1143
1186
  right: 0;
@@ -1189,17 +1232,16 @@ const HeaderMenu = ({ menuState }) => {
1189
1232
  const { event } = useFramework().modules;
1190
1233
  const { auth } = useFramework().modules;
1191
1234
  const user = useMemo(() => {
1192
- return auth.defaultAccount;
1235
+ return auth.account;
1193
1236
  }, [auth]);
1194
1237
  const roles = useMemo(() => {
1195
- var _a;
1196
- return ((_a = user == null ? void 0 : user.idTokenClaims) == null ? void 0 : _a.roles) ?? ["No access role"];
1238
+ return user?.idTokenClaims?.roles ?? ["No access role"];
1197
1239
  }, [user]);
1198
1240
  const getFeedbackAreaFromTags = (currentApp2, applications2) => {
1199
1241
  const manifest = applications2.find(
1200
- (app) => app.appKey === (currentApp2 == null ? void 0 : currentApp2.appKey)
1242
+ (app) => app.appKey === currentApp2?.appKey
1201
1243
  );
1202
- const tags = (manifest == null ? void 0 : manifest.keywords) ?? [];
1244
+ const tags = manifest?.keywords ?? [];
1203
1245
  if (tags.includes("trading")) return "10543";
1204
1246
  if (tags.includes("liquids-operations")) return "10511";
1205
1247
  return "10540";
@@ -1310,6 +1352,16 @@ const HeaderMenu = ({ menuState }) => {
1310
1352
  ) })
1311
1353
  ] });
1312
1354
  };
1355
+ const getEnvironment = async () => {
1356
+ const request = await fetch("/_discovery/environments/current");
1357
+ const environment = await request.json();
1358
+ const isProd = environment.type === "Production";
1359
+ return {
1360
+ name: environment.type,
1361
+ environmentName: environment.environmentName,
1362
+ isProd
1363
+ };
1364
+ };
1313
1365
  const Header = () => {
1314
1366
  const [a11yOpen, setA11yOpen] = useState(false);
1315
1367
  const [userMenuOpen, setUserMenuOpen] = useState(false);
@@ -1323,15 +1375,31 @@ const Header = () => {
1323
1375
  activityLogOpen,
1324
1376
  setActivityLogOpen
1325
1377
  };
1378
+ const [env, setEnv] = useState(null);
1379
+ useEffect(() => {
1380
+ getEnvironment().then((info) => {
1381
+ setEnv(info);
1382
+ });
1383
+ }, []);
1326
1384
  return /* @__PURE__ */ jsxs(Fragment, { children: [
1327
- /* @__PURE__ */ jsxs(TopBarFadeIn, { id: "cli-top-bar", children: [
1328
- /* @__PURE__ */ jsx(TopBar.Header, { children: /* @__PURE__ */ jsxs(Styled.Title, { children: [
1329
- /* @__PURE__ */ jsx(Icon, { color: "#eb0037", data: logoIcon, viewBox: "0 0 42 48" }),
1330
- /* @__PURE__ */ jsx("span", { children: "Roma" })
1331
- ] }) }),
1332
- /* @__PURE__ */ jsx(TopBar.CustomContent, {}),
1333
- /* @__PURE__ */ jsx(TopBar.Actions, { children: /* @__PURE__ */ jsx(HeaderMenu, { menuState: headerMenuState }) })
1334
- ] }),
1385
+ /* @__PURE__ */ jsxs(
1386
+ TopBarFadeIn,
1387
+ {
1388
+ id: "cli-top-bar",
1389
+ style: !env?.isProd ? {
1390
+ backgroundColor: tokens.colors.interactive.warning__highlight.rgba
1391
+ } : void 0,
1392
+ children: [
1393
+ /* @__PURE__ */ jsx(TopBar.Header, { children: /* @__PURE__ */ jsxs(Styled.Title, { children: [
1394
+ /* @__PURE__ */ jsx(Icon, { color: "#eb0037", data: logoIcon, viewBox: "0 0 42 48" }),
1395
+ /* @__PURE__ */ jsx("span", { children: "Roma" }),
1396
+ env && !env?.isProd && /* @__PURE__ */ jsx(EnvChip, { children: env?.environmentName?.split(" ")[0].toUpperCase() })
1397
+ ] }) }),
1398
+ /* @__PURE__ */ jsx(TopBar.CustomContent, {}),
1399
+ /* @__PURE__ */ jsx(TopBar.Actions, { children: /* @__PURE__ */ jsx(HeaderMenu, { menuState: headerMenuState }) })
1400
+ ]
1401
+ }
1402
+ ),
1335
1403
  /* @__PURE__ */ jsx(SideSheets, { apps: allApps, menuState: headerMenuState })
1336
1404
  ] });
1337
1405
  };
@@ -1670,50 +1738,46 @@ class Connection {
1670
1738
  }
1671
1739
  }
1672
1740
  class SseModuleProvider {
1741
+ #config;
1742
+ #connections = {};
1673
1743
  constructor(config) {
1674
- __privateAdd(this, _config);
1675
- __privateAdd(this, _connections, {});
1676
- __privateSet(this, _config, config);
1744
+ this.#config = config;
1677
1745
  }
1678
1746
  connect(name) {
1679
- if (!(name in __privateGet(this, _connections))) {
1680
- __privateGet(this, _connections)[name] = new Connection();
1681
- const options = __privateGet(this, _config).endpoints[name];
1747
+ if (!(name in this.#connections)) {
1748
+ this.#connections[name] = new Connection();
1749
+ const options = this.#config.endpoints[name];
1682
1750
  this.createConnection(name, options);
1683
1751
  }
1684
- return __privateGet(this, _connections)[name];
1752
+ return this.#connections[name];
1685
1753
  }
1686
1754
  createConnection(name, options) {
1687
- const config = __privateGet(this, _connections)[name];
1755
+ const config = this.#connections[name];
1688
1756
  setupEventSource(options, config.messageList, config.abort).catch(
1689
1757
  (err) => console.error(`Failed to set up connection for ${name}:`, err)
1690
1758
  );
1691
1759
  }
1692
1760
  }
1693
- _config = new WeakMap();
1694
- _connections = new WeakMap();
1695
1761
  class SseModuleConfigBuilder extends ModuleConfigBuilder {
1696
1762
  addEndpoint(name, config) {
1697
1763
  this._config.addEndpoint(name, config);
1698
1764
  }
1699
1765
  }
1700
1766
  class SseConfigurator {
1701
- constructor() {
1702
- __privateAdd(this, _builderCallbacks, []);
1703
- __privateAdd(this, _endpoints, {});
1704
- }
1767
+ #builderCallbacks = [];
1768
+ #endpoints = {};
1705
1769
  /**
1706
1770
  * register SSE endpoint configuration.
1707
1771
  */
1708
1772
  addEndpoint(name, config) {
1709
- __privateGet(this, _endpoints)[name] = config;
1773
+ this.#endpoints[name] = config;
1710
1774
  }
1711
1775
  /**
1712
1776
  * add callback for building config on when configurator is creating config.
1713
1777
  * {@link SseConfigurator.createConfig}
1714
1778
  */
1715
1779
  onCreateConfig(cb) {
1716
- __privateGet(this, _builderCallbacks).push(cb);
1780
+ this.#builderCallbacks.push(cb);
1717
1781
  }
1718
1782
  /**
1719
1783
  * normally executed in `init` phase of module, which creates configuration to the module provider.
@@ -1721,20 +1785,18 @@ class SseConfigurator {
1721
1785
  * await all registered hub configurations.
1722
1786
  */
1723
1787
  async createConfig(init) {
1724
- for (const cb of __privateGet(this, _builderCallbacks)) {
1788
+ for (const cb of this.#builderCallbacks) {
1725
1789
  const builder = new SseModuleConfigBuilder(
1726
1790
  init,
1727
1791
  this
1728
1792
  );
1729
1793
  await Promise.resolve(cb(builder));
1730
1794
  }
1731
- return { endpoints: __privateGet(this, _endpoints) };
1795
+ return { endpoints: this.#endpoints };
1732
1796
  }
1733
1797
  }
1734
- _builderCallbacks = new WeakMap();
1735
- _endpoints = new WeakMap();
1736
1798
  const moduleKey = "sse";
1737
- const module = {
1799
+ const module$1 = {
1738
1800
  name: moduleKey,
1739
1801
  configure: () => new SseConfigurator(),
1740
1802
  initialize: async (init) => {
@@ -1756,7 +1818,9 @@ const configureFromFramework = async (args, builder) => {
1756
1818
  options: {
1757
1819
  accessTokenFactory: async () => {
1758
1820
  const token = await authProvider.acquireAccessToken({
1759
- scopes: service.defaultScopes
1821
+ request: {
1822
+ scopes: service.scopes ?? service.defaultScopes
1823
+ }
1760
1824
  });
1761
1825
  if (!token) {
1762
1826
  throw Error("failed to acquire access token");
@@ -1770,7 +1834,7 @@ const configureFromFramework = async (args, builder) => {
1770
1834
  function enableSse(configurator, name, optionsOrCallback) {
1771
1835
  {
1772
1836
  configurator.addConfig({
1773
- module,
1837
+ module: module$1,
1774
1838
  configure: (sseConfigurator) => {
1775
1839
  sseConfigurator.onCreateConfig(
1776
1840
  (builder) => configureFromFramework({ name }, builder)
@@ -3890,16 +3954,17 @@ const rootSchema = create$3({
3890
3954
  })
3891
3955
  });
3892
3956
  class CustomAppClient {
3893
- constructor(client) {
3894
- __privateAdd(this, _manifests, []);
3957
+ constructor(client, graphClient) {
3895
3958
  this.client = client;
3959
+ this.graphClient = graphClient;
3896
3960
  }
3961
+ #manifests = [];
3897
3962
  // eslint-disable-next-line no-empty-pattern
3898
3963
  getAppConfig({}) {
3899
3964
  return of({});
3900
3965
  }
3901
3966
  getAppManifest({ appKey }) {
3902
- const manifest = __privateGet(this, _manifests).find(
3967
+ const manifest = this.#manifests.find(
3903
3968
  (manifest2) => manifest2.appKey === appKey
3904
3969
  );
3905
3970
  if (!manifest)
@@ -3911,7 +3976,75 @@ class CustomAppClient {
3911
3976
  getAppManifests() {
3912
3977
  return this.client.fetch$(`/api/apps`).pipe(
3913
3978
  switchMap(
3914
- (r) => from(r.json())
3979
+ (r) => from(r.json()).pipe(
3980
+ catchError(() => {
3981
+ let message = "Error fetching app manifests: ";
3982
+ if (r.status === 403 || r.status === 401) {
3983
+ message = /* @__PURE__ */ jsxs("div", { children: [
3984
+ /* @__PURE__ */ jsx(Typography, { children: "You are not authorized to view this page." }),
3985
+ /* @__PURE__ */ jsx("br", {}),
3986
+ " ",
3987
+ /* @__PURE__ */ jsx(Typography, { variant: "body_short", children: "Please apply for the relevant roles in Access IT:" }),
3988
+ /* @__PURE__ */ jsx("br", {}),
3989
+ /* @__PURE__ */ jsxs(List, { children: [
3990
+ /* @__PURE__ */ jsx(List.Item, { children: /* @__PURE__ */ jsx(
3991
+ Tooltip,
3992
+ {
3993
+ title: "Will also grant access to Roma Workbench",
3994
+ children: /* @__PURE__ */ jsx(
3995
+ Typography,
3996
+ {
3997
+ variant: "body_short_link",
3998
+ as: "a",
3999
+ href: "https://accessit.equinor.com/Search/Search?term=COMMERCIAL+OPERATOR+LIQUIDS+ACCESS+CONTROL",
4000
+ children: "Cargo Operations - Commercial Operator"
4001
+ }
4002
+ )
4003
+ }
4004
+ ) }),
4005
+ /* @__PURE__ */ jsx(List.Item, { children: /* @__PURE__ */ jsx(
4006
+ Tooltip,
4007
+ {
4008
+ title: "Apply for the access & sales office relevant for your role",
4009
+ children: /* @__PURE__ */ jsx(
4010
+ Typography,
4011
+ {
4012
+ variant: "body_short_link",
4013
+ as: "a",
4014
+ href: "https://accessit.equinor.com/Search/Search?term=LIQUIDS+ACCESS+CONTROL",
4015
+ children: "Trading systems"
4016
+ }
4017
+ )
4018
+ }
4019
+ ) }),
4020
+ /* @__PURE__ */ jsx(List.Item, { children: /* @__PURE__ */ jsx(
4021
+ Tooltip,
4022
+ {
4023
+ title: "Autogranted via cargo / trading roles",
4024
+ children: /* @__PURE__ */ jsx(
4025
+ Typography,
4026
+ {
4027
+ variant: "body_short_link",
4028
+ as: "a",
4029
+ href: "https://accessit.equinor.com/Search/Search?term=User+%28TOPS+ROMA%29",
4030
+ children: "Roma Workbench - TOPS ROMA User"
4031
+ }
4032
+ )
4033
+ }
4034
+ ) })
4035
+ ] })
4036
+ ] });
4037
+ } else {
4038
+ message = `${message} ${r.statusText}`;
4039
+ }
4040
+ window.Fusion.modules.event.dispatchEvent("workbenchInitError", {
4041
+ detail: {
4042
+ message
4043
+ }
4044
+ });
4045
+ return of([]);
4046
+ })
4047
+ )
3915
4048
  ),
3916
4049
  map(
3917
4050
  (v) => v.map((vv) => {
@@ -3925,6 +4058,7 @@ class CustomAppClient {
3925
4058
  return {
3926
4059
  ...vv,
3927
4060
  entry: pathname,
4061
+ config: vv.config ?? { groups: null, admins: null, roles: null },
3928
4062
  keywords: vv.keywords ?? vv.tags,
3929
4063
  appKey: vv.appKey ?? vv.key,
3930
4064
  name: vv.displayName ?? vv.name,
@@ -3940,7 +4074,18 @@ class CustomAppClient {
3940
4074
  };
3941
4075
  })
3942
4076
  ),
3943
- tap((v) => __privateSet(this, _manifests, v)),
4077
+ switchMap((apps) => {
4078
+ return this.graphClient.fetch(`v1.0/me/memberOf?$select=id`).then((r) => r.json()).then((res) => {
4079
+ const list = res.value.map(
4080
+ (v) => v.id
4081
+ );
4082
+ return apps.map((app) => ({
4083
+ ...app,
4084
+ hasAccess: (app.config?.groups ?? []).length === 0 || app.config?.groups.some((g) => list.includes(g))
4085
+ }));
4086
+ });
4087
+ }),
4088
+ tap((v) => this.#manifests = v),
3944
4089
  catchError((err) => {
3945
4090
  console.error("Error fetching app manifests", err);
3946
4091
  return of([]);
@@ -3955,8 +4100,12 @@ class CustomAppClient {
3955
4100
  console.log("updateAppSettings");
3956
4101
  return of({});
3957
4102
  }
4103
+ [Symbol.dispose]() {
4104
+ }
4105
+ getAppBuild(args) {
4106
+ return of({});
4107
+ }
3958
4108
  }
3959
- _manifests = new WeakMap();
3960
4109
  class ServiceDiscoveryClient {
3961
4110
  constructor() {
3962
4111
  this.cacheTime = 0;
@@ -3983,14 +4132,18 @@ class ServiceDiscoveryClient {
3983
4132
  }
3984
4133
  }
3985
4134
  const configure = async (config) => {
3986
- var _a;
3987
4135
  const request = await fetch("/_discovery/environments/current");
3988
4136
  const environment = await request.json();
3989
4137
  const services = environment.services;
3990
4138
  if (!services) {
3991
4139
  throw new Error(`ServiceDiscoveryMissingError: No services found`);
3992
4140
  }
3993
- const portalService = (_a = environment.services) == null ? void 0 : _a.find((v) => v.key === "portal");
4141
+ const portalService = environment.services?.find(
4142
+ (v) => v.key === "portal"
4143
+ );
4144
+ const graphService = environment.services?.find(
4145
+ (v) => v.key === "graph"
4146
+ );
3994
4147
  if (!portalService || !environment.frontendClientId) {
3995
4148
  const error = [];
3996
4149
  if (!portalService) error.push(`Missing service: "portal"`);
@@ -3998,12 +4151,13 @@ const configure = async (config) => {
3998
4151
  throw new Error(`Missing environment information:
3999
4152
  ${error.join("\n")}`);
4000
4153
  }
4001
- config.logger.level = 2;
4002
4154
  config.configureMsal(
4003
4155
  {
4004
- tenantId: "3aa4a235-b6e2-48d5-9195-7fcf05b459b0",
4005
- clientId: environment.frontendClientId,
4006
- redirectUri: "/authentication/login-callback"
4156
+ auth: {
4157
+ tenantId: "3aa4a235-b6e2-48d5-9195-7fcf05b459b0",
4158
+ clientId: environment.frontendClientId,
4159
+ redirectUri: "/authentication/login-callback"
4160
+ }
4007
4161
  },
4008
4162
  true
4009
4163
  );
@@ -4015,8 +4169,15 @@ ${error.join("\n")}`);
4015
4169
  builder.setAssetUri(`/`);
4016
4170
  builder.setClient(async (client) => {
4017
4171
  const http = await client.requireInstance("http");
4018
- const httpClient = http.createClient(portalService);
4019
- return new CustomAppClient(httpClient);
4172
+ const httpClient = http.createClient({
4173
+ ...portalService,
4174
+ baseUri: portalService.uri ?? portalService.baseUri
4175
+ });
4176
+ const graphHttpClient = http.createClient({
4177
+ ...graphService,
4178
+ baseUri: graphService?.uri ?? graphService?.baseUri
4179
+ });
4180
+ return new CustomAppClient(httpClient, graphHttpClient);
4020
4181
  });
4021
4182
  });
4022
4183
  enableNavigation(config);
@@ -4146,7 +4307,7 @@ const getGetSettingByUserAndIdQueryKey = (userId, id) => {
4146
4307
  };
4147
4308
  const useGetSettingByUserAndIdQueryOptions = (userId, id, options) => {
4148
4309
  const { query: queryOptions } = options ?? {};
4149
- const queryKey = (queryOptions == null ? void 0 : queryOptions.queryKey) ?? getGetSettingByUserAndIdQueryKey(userId, id);
4310
+ const queryKey = queryOptions?.queryKey ?? getGetSettingByUserAndIdQueryKey(userId, id);
4150
4311
  const getSettingByUserAndId = useGetSettingByUserAndIdHook();
4151
4312
  const queryFn = ({ signal }) => getSettingByUserAndId(userId, id, signal);
4152
4313
  return {
@@ -4227,7 +4388,7 @@ const getGetPublicSettingByUserAndIdQueryKey = (appShortName, id) => {
4227
4388
  };
4228
4389
  const useGetPublicSettingByUserAndIdQueryOptions = (appShortName, id, options) => {
4229
4390
  const { query: queryOptions } = options ?? {};
4230
- const queryKey = (queryOptions == null ? void 0 : queryOptions.queryKey) ?? getGetPublicSettingByUserAndIdQueryKey(appShortName, id);
4391
+ const queryKey = queryOptions?.queryKey ?? getGetPublicSettingByUserAndIdQueryKey(appShortName, id);
4231
4392
  const getPublicSettingByUserAndId = useGetPublicSettingByUserAndIdHook();
4232
4393
  const queryFn = ({ signal }) => getPublicSettingByUserAndId(appShortName, id, signal);
4233
4394
  return {
@@ -4308,7 +4469,7 @@ const getGetSettingsByUserIdQueryKey = (userId) => {
4308
4469
  };
4309
4470
  const useGetSettingsByUserIdQueryOptions = (userId, options) => {
4310
4471
  const { query: queryOptions } = options ?? {};
4311
- const queryKey = (queryOptions == null ? void 0 : queryOptions.queryKey) ?? getGetSettingsByUserIdQueryKey(userId);
4472
+ const queryKey = queryOptions?.queryKey ?? getGetSettingsByUserIdQueryKey(userId);
4312
4473
  const getSettingsByUserId = useGetSettingsByUserIdHook();
4313
4474
  const queryFn = ({ signal }) => getSettingsByUserId(userId, signal);
4314
4475
  return {
@@ -4363,7 +4524,7 @@ const getGetSettingsByAppShortNameQueryKey = (appShortName) => {
4363
4524
  };
4364
4525
  const useGetSettingsByAppShortNameQueryOptions = (appShortName, options) => {
4365
4526
  const { query: queryOptions } = options ?? {};
4366
- const queryKey = (queryOptions == null ? void 0 : queryOptions.queryKey) ?? getGetSettingsByAppShortNameQueryKey(appShortName);
4527
+ const queryKey = queryOptions?.queryKey ?? getGetSettingsByAppShortNameQueryKey(appShortName);
4367
4528
  const getSettingsByAppShortName = useGetSettingsByAppShortNameHook();
4368
4529
  const queryFn = ({ signal }) => getSettingsByAppShortName(appShortName, signal);
4369
4530
  return {
@@ -4443,7 +4604,7 @@ const getGetAllAppsQueryKey = () => {
4443
4604
  };
4444
4605
  const useGetAllAppsQueryOptions = (options) => {
4445
4606
  const { query: queryOptions } = options ?? {};
4446
- const queryKey = (queryOptions == null ? void 0 : queryOptions.queryKey) ?? getGetAllAppsQueryKey();
4607
+ const queryKey = queryOptions?.queryKey ?? getGetAllAppsQueryKey();
4447
4608
  const getAllApps = useGetAllAppsHook();
4448
4609
  const queryFn = ({ signal }) => getAllApps(signal);
4449
4610
  return { queryKey, queryFn, ...queryOptions };
@@ -4489,7 +4650,7 @@ const getGetAppByKeyQueryKey = (key) => {
4489
4650
  };
4490
4651
  const useGetAppByKeyQueryOptions = (key, options) => {
4491
4652
  const { query: queryOptions } = options ?? {};
4492
- const queryKey = (queryOptions == null ? void 0 : queryOptions.queryKey) ?? getGetAppByKeyQueryKey(key);
4653
+ const queryKey = queryOptions?.queryKey ?? getGetAppByKeyQueryKey(key);
4493
4654
  const getAppByKey = useGetAppByKeyHook();
4494
4655
  const queryFn = ({ signal }) => getAppByKey(key, signal);
4495
4656
  return {
@@ -4535,7 +4696,7 @@ const getGetAllServicesQueryKey = () => {
4535
4696
  };
4536
4697
  const useGetAllServicesQueryOptions = (options) => {
4537
4698
  const { query: queryOptions } = options ?? {};
4538
- const queryKey = (queryOptions == null ? void 0 : queryOptions.queryKey) ?? getGetAllServicesQueryKey();
4699
+ const queryKey = queryOptions?.queryKey ?? getGetAllServicesQueryKey();
4539
4700
  const getAllServices = useGetAllServicesHook();
4540
4701
  const queryFn = ({ signal }) => getAllServices(signal);
4541
4702
  return { queryKey, queryFn, ...queryOptions };
@@ -4585,7 +4746,7 @@ const getGetServiceByKeyQueryKey = (key) => {
4585
4746
  };
4586
4747
  const useGetServiceByKeyQueryOptions = (key, options) => {
4587
4748
  const { query: queryOptions } = options ?? {};
4588
- const queryKey = (queryOptions == null ? void 0 : queryOptions.queryKey) ?? getGetServiceByKeyQueryKey(key);
4749
+ const queryKey = queryOptions?.queryKey ?? getGetServiceByKeyQueryKey(key);
4589
4750
  const getServiceByKey = useGetServiceByKeyHook();
4590
4751
  const queryFn = ({ signal }) => getServiceByKey(key, signal);
4591
4752
  return {
@@ -4638,7 +4799,7 @@ const getGetAllCategoriesQueryKey = () => {
4638
4799
  };
4639
4800
  const useGetAllCategoriesQueryOptions = (options) => {
4640
4801
  const { query: queryOptions } = options ?? {};
4641
- const queryKey = (queryOptions == null ? void 0 : queryOptions.queryKey) ?? getGetAllCategoriesQueryKey();
4802
+ const queryKey = queryOptions?.queryKey ?? getGetAllCategoriesQueryKey();
4642
4803
  const getAllCategories = useGetAllCategoriesHook();
4643
4804
  const queryFn = ({ signal }) => getAllCategories(signal);
4644
4805
  return { queryKey, queryFn, ...queryOptions };
@@ -4688,7 +4849,7 @@ const getGetCategoryByIdQueryKey = (id) => {
4688
4849
  };
4689
4850
  const useGetCategoryByIdQueryOptions = (id, options) => {
4690
4851
  const { query: queryOptions } = options ?? {};
4691
- const queryKey = (queryOptions == null ? void 0 : queryOptions.queryKey) ?? getGetCategoryByIdQueryKey(id);
4852
+ const queryKey = queryOptions?.queryKey ?? getGetCategoryByIdQueryKey(id);
4692
4853
  const getCategoryById = useGetCategoryByIdHook();
4693
4854
  const queryFn = ({ signal }) => getCategoryById(id, signal);
4694
4855
  return {
@@ -4741,7 +4902,7 @@ const getStreamEventsQueryKey = () => {
4741
4902
  };
4742
4903
  const useStreamEventsQueryOptions = (options) => {
4743
4904
  const { query: queryOptions } = options ?? {};
4744
- const queryKey = (queryOptions == null ? void 0 : queryOptions.queryKey) ?? getStreamEventsQueryKey();
4905
+ const queryKey = queryOptions?.queryKey ?? getStreamEventsQueryKey();
4745
4906
  const streamEvents = useStreamEventsHook();
4746
4907
  const queryFn = ({ signal }) => streamEvents(signal);
4747
4908
  return { queryKey, queryFn, ...queryOptions };
@@ -4767,7 +4928,7 @@ const getGetCurrentEnvironmentQueryKey = () => {
4767
4928
  };
4768
4929
  const useGetCurrentEnvironmentQueryOptions = (options) => {
4769
4930
  const { query: queryOptions } = options ?? {};
4770
- const queryKey = (queryOptions == null ? void 0 : queryOptions.queryKey) ?? getGetCurrentEnvironmentQueryKey();
4931
+ const queryKey = queryOptions?.queryKey ?? getGetCurrentEnvironmentQueryKey();
4771
4932
  const getCurrentEnvironment = useGetCurrentEnvironmentHook();
4772
4933
  const queryFn = ({ signal }) => getCurrentEnvironment(signal);
4773
4934
  return { queryKey, queryFn, ...queryOptions };
@@ -4796,7 +4957,7 @@ const getGetRomaConfigurationByIdQueryKey = (id) => {
4796
4957
  };
4797
4958
  const useGetRomaConfigurationByIdQueryOptions = (id, options) => {
4798
4959
  const { query: queryOptions } = options ?? {};
4799
- const queryKey = (queryOptions == null ? void 0 : queryOptions.queryKey) ?? getGetRomaConfigurationByIdQueryKey(id);
4960
+ const queryKey = queryOptions?.queryKey ?? getGetRomaConfigurationByIdQueryKey(id);
4800
4961
  const getRomaConfigurationById = useGetRomaConfigurationByIdHook();
4801
4962
  const queryFn = ({ signal }) => getRomaConfigurationById(id, signal);
4802
4963
  return {
@@ -4873,7 +5034,7 @@ const getGetAllRomaConfigurationQueryKey = () => {
4873
5034
  };
4874
5035
  const useGetAllRomaConfigurationQueryOptions = (options) => {
4875
5036
  const { query: queryOptions } = options ?? {};
4876
- const queryKey = (queryOptions == null ? void 0 : queryOptions.queryKey) ?? getGetAllRomaConfigurationQueryKey();
5037
+ const queryKey = queryOptions?.queryKey ?? getGetAllRomaConfigurationQueryKey();
4877
5038
  const getAllRomaConfiguration = useGetAllRomaConfigurationHook();
4878
5039
  const queryFn = ({ signal }) => getAllRomaConfiguration(signal);
4879
5040
  return { queryKey, queryFn, ...queryOptions };
@@ -4923,7 +5084,7 @@ const getGetAllRomaConfigurationTypesQueryKey = () => {
4923
5084
  };
4924
5085
  const useGetAllRomaConfigurationTypesQueryOptions = (options) => {
4925
5086
  const { query: queryOptions } = options ?? {};
4926
- const queryKey = (queryOptions == null ? void 0 : queryOptions.queryKey) ?? getGetAllRomaConfigurationTypesQueryKey();
5087
+ const queryKey = queryOptions?.queryKey ?? getGetAllRomaConfigurationTypesQueryKey();
4927
5088
  const getAllRomaConfigurationTypes = useGetAllRomaConfigurationTypesHook();
4928
5089
  const queryFn = ({ signal }) => getAllRomaConfigurationTypes(signal);
4929
5090
  return { queryKey, queryFn, ...queryOptions };
@@ -4949,7 +5110,7 @@ const getGetAllRomaConfigurationByTypeQueryKey = (type) => {
4949
5110
  };
4950
5111
  const useGetAllRomaConfigurationByTypeQueryOptions = (type, options) => {
4951
5112
  const { query: queryOptions } = options ?? {};
4952
- const queryKey = (queryOptions == null ? void 0 : queryOptions.queryKey) ?? getGetAllRomaConfigurationByTypeQueryKey(type);
5113
+ const queryKey = queryOptions?.queryKey ?? getGetAllRomaConfigurationByTypeQueryKey(type);
4953
5114
  const getAllRomaConfigurationByType = useGetAllRomaConfigurationByTypeHook();
4954
5115
  const queryFn = ({ signal }) => getAllRomaConfigurationByType(type, signal);
4955
5116
  return {
@@ -5008,7 +5169,7 @@ const getListFeedbacksByCurrentUserQueryKey = (params) => {
5008
5169
  };
5009
5170
  const useListFeedbacksByCurrentUserQueryOptions = (params, options) => {
5010
5171
  const { query: queryOptions } = options ?? {};
5011
- const queryKey = (queryOptions == null ? void 0 : queryOptions.queryKey) ?? getListFeedbacksByCurrentUserQueryKey(params);
5172
+ const queryKey = queryOptions?.queryKey ?? getListFeedbacksByCurrentUserQueryKey(params);
5012
5173
  const listFeedbacksByCurrentUser = useListFeedbacksByCurrentUserHook();
5013
5174
  const queryFn = ({ signal }) => listFeedbacksByCurrentUser(params, signal);
5014
5175
  return { queryKey, queryFn, ...queryOptions };
@@ -5055,6 +5216,70 @@ const useFindGroupMembers = (groupId, query) => {
5055
5216
  queryFn: () => findGroupMembers(client, groupId, query)
5056
5217
  });
5057
5218
  };
5219
+ const findGroup$1 = async (client, query) => {
5220
+ const headers = {
5221
+ ConsistencyLevel: "eventual"
5222
+ // Required to search by name
5223
+ };
5224
+ const params = new URLSearchParams();
5225
+ params.set("$count", "true");
5226
+ params.set("$orderby", "displayName");
5227
+ params.set("$select", "displayName,id");
5228
+ if (query) {
5229
+ params.set("$search", `"displayName:${query}"`);
5230
+ }
5231
+ const req = await client.fetch(`v1.0/groups?${params.toString()}`, {
5232
+ headers
5233
+ });
5234
+ if (req.status === 504) {
5235
+ throw new Error(`Application took to long to respond`);
5236
+ }
5237
+ const res = await req.json();
5238
+ if (req.status >= 400) {
5239
+ throw new Error(res.error.message);
5240
+ } else {
5241
+ return res;
5242
+ }
5243
+ };
5244
+ const useFindGroup = (query) => {
5245
+ const client = useHttpClient("graph");
5246
+ return useQuery({
5247
+ queryKey: ["graph", "group", "members", query],
5248
+ queryFn: () => findGroup$1(client, query),
5249
+ enabled: query.length > 2
5250
+ });
5251
+ };
5252
+ const findGroup = async (client, ids) => {
5253
+ const headers = {
5254
+ ConsistencyLevel: "eventual"
5255
+ // Required to search by name
5256
+ };
5257
+ const params = new URLSearchParams();
5258
+ params.set("$count", "true");
5259
+ params.set("$orderby", "displayName");
5260
+ params.set("$select", "displayName,id");
5261
+ params.set("$filter", `id in ('${ids.join("', '")}')`);
5262
+ const req = await client.fetch(`v1.0/groups?${params.toString()}`, {
5263
+ headers
5264
+ });
5265
+ if (req.status === 504) {
5266
+ throw new Error(`Application took to long to respond`);
5267
+ }
5268
+ const res = await req.json();
5269
+ if (req.status >= 400) {
5270
+ throw new Error(res.error.message);
5271
+ } else {
5272
+ return res;
5273
+ }
5274
+ };
5275
+ const useFindGroupById = (ids) => {
5276
+ const client = useHttpClient("graph");
5277
+ return useQuery({
5278
+ queryKey: ["graph", "group", "members", ids],
5279
+ queryFn: () => findGroup(client, ids),
5280
+ enabled: ids.length > 0
5281
+ });
5282
+ };
5058
5283
  const findUsersByMail = async (client, email, fields) => {
5059
5284
  const headers = {
5060
5285
  ConsistencyLevel: "eventual"
@@ -5095,6 +5320,97 @@ const useFindUsersByShortname = (shortnames, fields = ["displayName", "mail", "g
5095
5320
  const emails = (shortnames ?? []).map((name) => `${name}@equinor.com`);
5096
5321
  return useFindUsersByMail(emails, fields);
5097
5322
  };
5323
+ const searchUser = async (client, query) => {
5324
+ const headers = {
5325
+ ConsistencyLevel: "eventual"
5326
+ // Required to search by name
5327
+ };
5328
+ const params = new URLSearchParams();
5329
+ params.set("$orderby", "displayName");
5330
+ if (query) {
5331
+ params.set("$search", `"displayName:${query}" OR "mail:${query}"`);
5332
+ }
5333
+ const req = await client.fetch(`/v1.0/users?${params.toString()}`, {
5334
+ headers
5335
+ });
5336
+ if (req.status === 504) {
5337
+ throw new Error(`Application took to long to respond`);
5338
+ }
5339
+ const res = await req.json();
5340
+ if (req.status >= 400) {
5341
+ throw new Error(res.error.message);
5342
+ } else {
5343
+ return res;
5344
+ }
5345
+ };
5346
+ const searchServicePrincipal = async (client, query) => {
5347
+ const headers = {
5348
+ ConsistencyLevel: "eventual"
5349
+ // Required to search by name
5350
+ };
5351
+ const params = new URLSearchParams();
5352
+ params.set("$orderby", "displayName");
5353
+ params.set("$select", "id,appId,displayName");
5354
+ if (query) {
5355
+ params.set("$search", `"displayName:${query}"`);
5356
+ }
5357
+ const req = await client.fetch(
5358
+ `/v1.0/servicePrincipals?${params.toString()}`,
5359
+ {
5360
+ headers
5361
+ }
5362
+ );
5363
+ if (req.status === 504) {
5364
+ throw new Error(`Application took to long to respond`);
5365
+ }
5366
+ const res = await req.json();
5367
+ if (req.status >= 400) {
5368
+ throw new Error(res.error.message);
5369
+ } else {
5370
+ return res;
5371
+ }
5372
+ };
5373
+ const useFindUser = (query) => {
5374
+ const client = useHttpClient("graph");
5375
+ return useQuery({
5376
+ queryKey: ["graph", "group", "members", query],
5377
+ queryFn: async () => {
5378
+ const users = await searchUser(client, query);
5379
+ const servicePrincipals = await searchServicePrincipal(client, query);
5380
+ return {
5381
+ value: [...users.value ?? [], ...servicePrincipals.value ?? []]
5382
+ };
5383
+ },
5384
+ select: (data) => data ? data.value : [],
5385
+ enabled: query.length > 2
5386
+ });
5387
+ };
5388
+ const findUserById = async (client, id, fields) => {
5389
+ const headers = {
5390
+ ConsistencyLevel: "eventual"
5391
+ // Required to search by name
5392
+ };
5393
+ const req = await client.fetch(`v1.0/users/${id}`, {
5394
+ headers
5395
+ });
5396
+ if (req.status === 504) {
5397
+ throw new Error(`Application took to long to respond`);
5398
+ }
5399
+ const res = await req.json();
5400
+ if (req.status >= 400) {
5401
+ throw new Error(res.error.message);
5402
+ } else {
5403
+ return res;
5404
+ }
5405
+ };
5406
+ const useFindUserById = (id, fields = ["displayName", "mail", "givenName"]) => {
5407
+ const client = useHttpClient("graph");
5408
+ return useQuery({
5409
+ queryKey: ["graph", "user", "id", id],
5410
+ queryFn: () => findUserById(client, id),
5411
+ enabled: !!id
5412
+ });
5413
+ };
5098
5414
  const checkRomaApi = (queryKey) => {
5099
5415
  const first = (queryKey ?? []).at(0);
5100
5416
  if (typeof first === "string") {
@@ -5110,10 +5426,7 @@ function createIDBPersister(idbValidKey = "reactQuery") {
5110
5426
  clientState: {
5111
5427
  ...persistedClient.clientState,
5112
5428
  queries: persistedClient.clientState.queries.filter(
5113
- (query) => {
5114
- var _a;
5115
- return query.queryKey.includes("persist") || checkRomaApi(query.queryKey) || ((_a = query.meta) == null ? void 0 : _a.persist);
5116
- }
5429
+ (query) => query.queryKey.includes("persist") || checkRomaApi(query.queryKey) || query.meta?.persist
5117
5430
  )
5118
5431
  }
5119
5432
  };
@@ -5163,15 +5476,17 @@ function useGetApiRoles(api, defaultEmptyArray = true) {
5163
5476
  useEffect(() => {
5164
5477
  serviceDiscovery.resolveService(api).then(async (s) => {
5165
5478
  const jwt = await auth.acquireAccessToken({
5166
- scopes: s.defaultScopes
5479
+ request: {
5480
+ scopes: s.scopes ?? s.defaultScopes
5481
+ }
5167
5482
  });
5168
5483
  if (!jwt) {
5169
5484
  throw new Error(`No jwt found for ${api}`);
5170
5485
  }
5171
5486
  const token = parseJwt(jwt);
5172
- if (((roles == null ? void 0 : roles.length) ?? 0) === 0) setRoles((token == null ? void 0 : token.roles) ?? []);
5487
+ if ((roles?.length ?? 0) === 0) setRoles(token?.roles ?? []);
5173
5488
  });
5174
- }, [api, auth, serviceDiscovery, roles == null ? void 0 : roles.length]);
5489
+ }, [api, auth, serviceDiscovery, roles?.length]);
5175
5490
  if (defaultEmptyArray) return roles ?? [];
5176
5491
  return roles;
5177
5492
  }
@@ -5370,8 +5685,8 @@ const useManageWatchList = (system) => {
5370
5685
  }
5371
5686
  });
5372
5687
  const framework = useFramework();
5373
- const user = framework.modules.auth.defaultAccount;
5374
- const userId = (user == null ? void 0 : user.username.split("@")[0].toLowerCase()) ?? "MISSINGUSER";
5688
+ const user = framework.modules.auth.account;
5689
+ const userId = user?.username.split("@")[0].toLowerCase() ?? "MISSINGUSER";
5375
5690
  const queryClient = useQueryClient();
5376
5691
  const updateMutator = useUpdateByUserIdAndId();
5377
5692
  const createMutator = useCreateSettingByUserId();
@@ -5464,6 +5779,7 @@ export {
5464
5779
  StyleProvider,
5465
5780
  configure,
5466
5781
  createIDBPersister,
5782
+ findUserById,
5467
5783
  findUsersByMail,
5468
5784
  getGetAllAppsQueryKey,
5469
5785
  getGetAllCategoriesQueryKey,
@@ -5526,7 +5842,11 @@ export {
5526
5842
  useDeleteServiceByKey,
5527
5843
  useDeleteServiceByKeyHook,
5528
5844
  useDeleteServiceByKeyMutationOptions,
5845
+ useFindGroup,
5846
+ useFindGroupById,
5529
5847
  useFindGroupMembers,
5848
+ useFindUser,
5849
+ useFindUserById,
5530
5850
  useFindUsersByMail,
5531
5851
  useFindUsersByShortname,
5532
5852
  useGetAllApps,