@entur-partner/app-shell 6.3.0 → 6.3.1
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/dist/AppShell.d.ts +2 -2
- package/dist/ConsentManagerProvider.d.ts +2 -2
- package/dist/EnvironmentBanner.d.ts +1 -2
- package/dist/MenuProvider.d.ts +2 -2
- package/dist/PostHogProviderWrapper.d.ts +2 -2
- package/dist/app-shell.cjs.development.js +111 -84
- package/dist/app-shell.cjs.development.js.map +1 -1
- package/dist/app-shell.cjs.production.min.js +1 -1
- package/dist/app-shell.cjs.production.min.js.map +1 -1
- package/dist/app-shell.esm.js +87 -60
- package/dist/app-shell.esm.js.map +1 -1
- package/package.json +8 -8
package/dist/AppShell.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type Auth0ContextInterface, type GetTokenSilentlyOptions } from "@auth0/auth0-react";
|
|
2
2
|
import { Environment } from "@entur-partner/common";
|
|
3
3
|
import type { User } from "@entur-partner/micro-frontend";
|
|
4
|
-
import
|
|
4
|
+
import { type ReactNode } from "react";
|
|
5
5
|
import type { DecorateUserFn } from "./types/UserTypes";
|
|
6
6
|
export interface AppShellValues {
|
|
7
7
|
logout: Auth0ContextInterface["logout"];
|
|
@@ -23,4 +23,4 @@ export interface AppShellProps {
|
|
|
23
23
|
replace?: boolean;
|
|
24
24
|
}) => void;
|
|
25
25
|
}
|
|
26
|
-
export declare const AppShell: ({ children, audience, domain, clientId, decorateUser, environment, redirectUri, navigate, }: AppShellProps) =>
|
|
26
|
+
export declare const AppShell: ({ children, audience, domain, clientId, decorateUser, environment, redirectUri, navigate, }: AppShellProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
2
|
import type { Consents } from "./types/ConsentTypes";
|
|
3
3
|
declare global {
|
|
4
4
|
interface Window {
|
|
@@ -12,5 +12,5 @@ export declare const useConsentManager: () => Consents;
|
|
|
12
12
|
type Props = {
|
|
13
13
|
children: ReactNode;
|
|
14
14
|
};
|
|
15
|
-
export declare const ConsentManagerProvider: ({ children }: Props) =>
|
|
15
|
+
export declare const ConsentManagerProvider: ({ children }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
16
16
|
export {};
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { type Environment } from "@entur-partner/common";
|
|
2
|
-
import React from "react";
|
|
3
2
|
type EnvironmentBannerProps = {
|
|
4
3
|
environment: Exclude<Environment, Environment.Production>;
|
|
5
4
|
};
|
|
6
|
-
export declare const EnvironmentBanner: ({ environment }: EnvironmentBannerProps) =>
|
|
5
|
+
export declare const EnvironmentBanner: ({ environment }: EnvironmentBannerProps) => import("react/jsx-runtime").JSX.Element;
|
|
7
6
|
export {};
|
package/dist/MenuProvider.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import type { MenuItem, NavigationFunction } from "@entur-partner/micro-frontend";
|
|
2
|
-
import
|
|
2
|
+
import { type FC, type ReactNode } from "react";
|
|
3
3
|
interface MenuContextType {
|
|
4
4
|
getItemsForPath: (path: string) => MenuItem[];
|
|
5
5
|
addItems: (items: MenuItem[], path: string) => void;
|
|
6
6
|
getMFNavigate: (path: string) => NavigationFunction | undefined;
|
|
7
7
|
setMFNavigate: (path: string, navigation: NavigationFunction) => void;
|
|
8
8
|
}
|
|
9
|
-
export declare const MenuContext:
|
|
9
|
+
export declare const MenuContext: import("react").Context<MenuContextType>;
|
|
10
10
|
export declare const useMenuGroupItems: (path: string) => MenuItem[];
|
|
11
11
|
export declare const useMenu: () => MenuContextType;
|
|
12
12
|
export declare const useMFNavigation: (path: string) => NavigationFunction | undefined;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
2
|
type Props = {
|
|
3
3
|
/**
|
|
4
4
|
* Debug mode for PostHog.
|
|
@@ -28,5 +28,5 @@ type Props = {
|
|
|
28
28
|
forceDisablePostHog?: boolean;
|
|
29
29
|
children: ReactNode;
|
|
30
30
|
};
|
|
31
|
-
export declare const PostHogProviderWrapper: ({ debug, postHogApiKey, isStandalone, project, forceDisablePostHog, children, }: Props) =>
|
|
31
|
+
export declare const PostHogProviderWrapper: ({ debug, postHogApiKey, isStandalone, project, forceDisablePostHog, children, }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
32
32
|
export {};
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
5
6
|
var auth0React = require('@auth0/auth0-react');
|
|
6
7
|
var alert = require('@entur/alert');
|
|
7
8
|
var loader = require('@entur/loader');
|
|
@@ -9,9 +10,9 @@ var tokens = require('@entur/tokens');
|
|
|
9
10
|
var typography = require('@entur/typography');
|
|
10
11
|
var common = require('@entur-partner/common');
|
|
11
12
|
var util = require('@entur-partner/util');
|
|
12
|
-
var
|
|
13
|
+
var react = require('react');
|
|
13
14
|
var postHog = require('posthog-js');
|
|
14
|
-
var react = require('posthog-js/react');
|
|
15
|
+
var react$1 = require('posthog-js/react');
|
|
15
16
|
|
|
16
17
|
function asyncGeneratorStep(n, t, e, r, o, a, c) {
|
|
17
18
|
try {
|
|
@@ -224,7 +225,7 @@ function _wrapNativeSuper(t) {
|
|
|
224
225
|
|
|
225
226
|
var EnvironmentBanner = function EnvironmentBanner(_ref) {
|
|
226
227
|
var environment = _ref.environment;
|
|
227
|
-
return
|
|
228
|
+
return jsxRuntime.jsx("div", {
|
|
228
229
|
className: "epp-environment-banner",
|
|
229
230
|
style: {
|
|
230
231
|
position: "fixed",
|
|
@@ -254,7 +255,7 @@ var Authenticate = function Authenticate(_ref) {
|
|
|
254
255
|
var children = _ref.children,
|
|
255
256
|
decorateUser = _ref.decorateUser,
|
|
256
257
|
getReturnPath = _ref.getReturnPath;
|
|
257
|
-
var _useState =
|
|
258
|
+
var _useState = react.useState(undefined),
|
|
258
259
|
userWithPermission = _useState[0],
|
|
259
260
|
setUserWithPermission = _useState[1];
|
|
260
261
|
var _useAuth = auth0React.useAuth0(),
|
|
@@ -265,7 +266,7 @@ var Authenticate = function Authenticate(_ref) {
|
|
|
265
266
|
isLoading = _useAuth.isLoading,
|
|
266
267
|
isAuthenticated = _useAuth.isAuthenticated,
|
|
267
268
|
error = _useAuth.error;
|
|
268
|
-
|
|
269
|
+
react.useEffect(function () {
|
|
269
270
|
var fetchUserData = /*#__PURE__*/function () {
|
|
270
271
|
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
|
|
271
272
|
var token, decoratedUser, _t;
|
|
@@ -307,43 +308,55 @@ var Authenticate = function Authenticate(_ref) {
|
|
|
307
308
|
returnTo: getReturnPath()
|
|
308
309
|
}
|
|
309
310
|
});
|
|
310
|
-
return
|
|
311
|
+
return jsxRuntime.jsx(loader.Loader, {
|
|
311
312
|
style: {
|
|
312
313
|
marginTop: tokens.space.extraLarge9
|
|
313
|
-
}
|
|
314
|
-
|
|
314
|
+
},
|
|
315
|
+
children: "Redirecting to login page"
|
|
316
|
+
});
|
|
315
317
|
}
|
|
316
318
|
if (isLoading || !userWithPermission) {
|
|
317
|
-
return
|
|
319
|
+
return jsxRuntime.jsx(loader.Loader, {
|
|
318
320
|
style: {
|
|
319
321
|
marginTop: tokens.space.extraLarge9
|
|
320
|
-
}
|
|
321
|
-
|
|
322
|
+
},
|
|
323
|
+
children: "Authenticating"
|
|
324
|
+
});
|
|
322
325
|
}
|
|
323
326
|
if (error) {
|
|
324
327
|
console.error(error);
|
|
325
|
-
return
|
|
328
|
+
return jsxRuntime.jsxs(alert.BannerAlertBox, {
|
|
326
329
|
variant: "error",
|
|
327
330
|
title: "Authentication failed",
|
|
328
331
|
style: {
|
|
329
332
|
maxWidth: "600px",
|
|
330
333
|
margin: "0 auto"
|
|
331
|
-
}
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
334
|
+
},
|
|
335
|
+
children: [jsxRuntime.jsxs(typography.Paragraph, {
|
|
336
|
+
children: ["Something went wrong while trying to authenticate you. If the problem persists you should contact", " ", jsxRuntime.jsx(typography.Link, {
|
|
337
|
+
href: "mailto:support@entur.org",
|
|
338
|
+
children: "support@entur.org"
|
|
339
|
+
}), " to get it resolved."]
|
|
340
|
+
}), jsxRuntime.jsxs(typography.Paragraph, {
|
|
341
|
+
children: ["Authentication failed with: ", jsxRuntime.jsx(typography.CodeText, {
|
|
342
|
+
children: error == null ? void 0 : error.toString()
|
|
343
|
+
})]
|
|
344
|
+
})]
|
|
345
|
+
});
|
|
335
346
|
}
|
|
336
347
|
util.assertIsDefined(userWithPermission);
|
|
337
|
-
return
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
348
|
+
return jsxRuntime.jsx(jsxRuntime.Fragment, {
|
|
349
|
+
children: children({
|
|
350
|
+
user: userWithPermission,
|
|
351
|
+
logout: function logout() {
|
|
352
|
+
return userLogout(_logout);
|
|
353
|
+
},
|
|
354
|
+
getToken: getAccessTokenSilently
|
|
355
|
+
})
|
|
356
|
+
});
|
|
344
357
|
};
|
|
345
358
|
var AppShell = function AppShell(_ref3) {
|
|
346
|
-
var
|
|
359
|
+
var _children = _ref3.children,
|
|
347
360
|
audience = _ref3.audience,
|
|
348
361
|
domain = _ref3.domain,
|
|
349
362
|
clientId = _ref3.clientId,
|
|
@@ -368,22 +381,26 @@ var AppShell = function AppShell(_ref3) {
|
|
|
368
381
|
window.history.replaceState({}, "", destination);
|
|
369
382
|
}
|
|
370
383
|
};
|
|
371
|
-
return
|
|
384
|
+
return jsxRuntime.jsx(auth0React.Auth0Provider, {
|
|
372
385
|
domain: domain,
|
|
373
386
|
clientId: clientId,
|
|
374
387
|
authorizationParams: {
|
|
375
388
|
redirect_uri: redirectUri != null ? redirectUri : window.location.origin,
|
|
376
389
|
audience: audience
|
|
377
390
|
},
|
|
378
|
-
onRedirectCallback: handleRedirectCallback
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
391
|
+
onRedirectCallback: handleRedirectCallback,
|
|
392
|
+
children: jsxRuntime.jsx(Authenticate, {
|
|
393
|
+
decorateUser: decorateUser,
|
|
394
|
+
getReturnPath: getCurrentAppPath,
|
|
395
|
+
children: function children(params) {
|
|
396
|
+
return jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
397
|
+
children: [environment && environment !== common.Environment.Production && jsxRuntime.jsx(EnvironmentBanner, {
|
|
398
|
+
environment: environment
|
|
399
|
+
}), _children(params)]
|
|
400
|
+
});
|
|
401
|
+
}
|
|
402
|
+
})
|
|
403
|
+
});
|
|
387
404
|
};
|
|
388
405
|
|
|
389
406
|
var ORGANISATION_STORAGE_KEY = "EP::activeOrgId";
|
|
@@ -459,18 +476,18 @@ var convertUCServicesToConsents = function convertUCServicesToConsents(services)
|
|
|
459
476
|
}, DEFAULT_CONSENT_GIVEN);
|
|
460
477
|
};
|
|
461
478
|
|
|
462
|
-
var ConsentContext = /*#__PURE__*/
|
|
479
|
+
var ConsentContext = /*#__PURE__*/react.createContext(DEFAULT_CONSENT_GIVEN);
|
|
463
480
|
var useConsentManager = function useConsentManager() {
|
|
464
|
-
var context =
|
|
481
|
+
var context = react.useContext(ConsentContext);
|
|
465
482
|
return context;
|
|
466
483
|
};
|
|
467
484
|
var ConsentManagerProvider = function ConsentManagerProvider(_ref) {
|
|
468
485
|
var children = _ref.children;
|
|
469
|
-
var _useState =
|
|
486
|
+
var _useState = react.useState(DEFAULT_CONSENT_GIVEN),
|
|
470
487
|
consentManager = _useState[0],
|
|
471
488
|
setConsentManager = _useState[1];
|
|
472
489
|
// Initialize consent manager from local storage once
|
|
473
|
-
|
|
490
|
+
react.useEffect(function () {
|
|
474
491
|
if (typeof window === "undefined") return;
|
|
475
492
|
var ucData = ucUiStorage.get();
|
|
476
493
|
if (ucData) {
|
|
@@ -480,7 +497,7 @@ var ConsentManagerProvider = function ConsentManagerProvider(_ref) {
|
|
|
480
497
|
}
|
|
481
498
|
}, []);
|
|
482
499
|
// Listen for Usercentrics consent events and update consent manager state
|
|
483
|
-
|
|
500
|
+
react.useEffect(function () {
|
|
484
501
|
var handleConsentEvent = /*#__PURE__*/function () {
|
|
485
502
|
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(event) {
|
|
486
503
|
var customEvent, services, updatedConsentManager;
|
|
@@ -511,23 +528,24 @@ var ConsentManagerProvider = function ConsentManagerProvider(_ref) {
|
|
|
511
528
|
return window.removeEventListener("UC_CONSENT", handleConsentEvent);
|
|
512
529
|
};
|
|
513
530
|
}, []);
|
|
514
|
-
return
|
|
515
|
-
value: consentManager
|
|
516
|
-
|
|
531
|
+
return jsxRuntime.jsx(ConsentContext.Provider, {
|
|
532
|
+
value: consentManager,
|
|
533
|
+
children: children
|
|
534
|
+
});
|
|
517
535
|
};
|
|
518
536
|
|
|
519
|
-
var LanguageContext = /*#__PURE__*/
|
|
537
|
+
var LanguageContext = /*#__PURE__*/react.createContext(undefined);
|
|
520
538
|
var useLanguageState = function useLanguageState(language) {
|
|
521
|
-
var _useState =
|
|
539
|
+
var _useState = react.useState(language),
|
|
522
540
|
activeLanguage = _useState[0],
|
|
523
541
|
setLanguage = _useState[1];
|
|
524
|
-
|
|
542
|
+
react.useEffect(function () {
|
|
525
543
|
languageStorage.set(activeLanguage);
|
|
526
544
|
}, [activeLanguage]);
|
|
527
545
|
return [activeLanguage, setLanguage];
|
|
528
546
|
};
|
|
529
547
|
var useLanguage = function useLanguage() {
|
|
530
|
-
var context =
|
|
548
|
+
var context = react.useContext(LanguageContext);
|
|
531
549
|
util.assertIsDefined(context);
|
|
532
550
|
return context;
|
|
533
551
|
};
|
|
@@ -537,15 +555,16 @@ var LanguageProvider = function LanguageProvider(_ref) {
|
|
|
537
555
|
var _useLanguageState = useLanguageState(language),
|
|
538
556
|
activeLanguage = _useLanguageState[0],
|
|
539
557
|
setLanguage = _useLanguageState[1];
|
|
540
|
-
return
|
|
558
|
+
return jsxRuntime.jsx(LanguageContext.Provider, {
|
|
541
559
|
value: {
|
|
542
560
|
language: activeLanguage,
|
|
543
561
|
setLanguage: setLanguage
|
|
544
|
-
}
|
|
545
|
-
|
|
562
|
+
},
|
|
563
|
+
children: children
|
|
564
|
+
});
|
|
546
565
|
};
|
|
547
566
|
|
|
548
|
-
var MenuContext = /*#__PURE__*/
|
|
567
|
+
var MenuContext = /*#__PURE__*/react.createContext({
|
|
549
568
|
addItems: function addItems() {},
|
|
550
569
|
getItemsForPath: function getItemsForPath() {
|
|
551
570
|
return [];
|
|
@@ -556,11 +575,11 @@ var MenuContext = /*#__PURE__*/React.createContext({
|
|
|
556
575
|
setMFNavigate: function setMFNavigate() {}
|
|
557
576
|
});
|
|
558
577
|
var useMenuGroupItems = function useMenuGroupItems(path) {
|
|
559
|
-
var context =
|
|
578
|
+
var context = react.useContext(MenuContext);
|
|
560
579
|
return context.getItemsForPath(path);
|
|
561
580
|
};
|
|
562
581
|
var useMenu = function useMenu() {
|
|
563
|
-
return
|
|
582
|
+
return react.useContext(MenuContext);
|
|
564
583
|
};
|
|
565
584
|
var useMFNavigation = function useMFNavigation(path) {
|
|
566
585
|
var _useMenu = useMenu(),
|
|
@@ -569,13 +588,13 @@ var useMFNavigation = function useMFNavigation(path) {
|
|
|
569
588
|
};
|
|
570
589
|
var MenuProvider = function MenuProvider(_ref) {
|
|
571
590
|
var children = _ref.children;
|
|
572
|
-
var _useState =
|
|
591
|
+
var _useState = react.useState({}),
|
|
573
592
|
groups = _useState[0],
|
|
574
593
|
setGroups = _useState[1];
|
|
575
|
-
var _useState2 =
|
|
594
|
+
var _useState2 = react.useState({}),
|
|
576
595
|
navFuncs = _useState2[0],
|
|
577
596
|
setNavFuncs = _useState2[1];
|
|
578
|
-
var addItems =
|
|
597
|
+
var addItems = react.useCallback(function (newItems, path) {
|
|
579
598
|
setGroups(function (prevState) {
|
|
580
599
|
var _extends2;
|
|
581
600
|
return _extends({}, prevState, (_extends2 = {}, _extends2[path] = newItems, _extends2));
|
|
@@ -590,7 +609,7 @@ var MenuProvider = function MenuProvider(_ref) {
|
|
|
590
609
|
return _extends({}, prev, (_extends3 = {}, _extends3[path] = navigation, _extends3));
|
|
591
610
|
});
|
|
592
611
|
};
|
|
593
|
-
return
|
|
612
|
+
return jsxRuntime.jsx(MenuContext.Provider, {
|
|
594
613
|
value: {
|
|
595
614
|
addItems: addItems,
|
|
596
615
|
getItemsForPath: function getItemsForPath(path) {
|
|
@@ -599,8 +618,9 @@ var MenuProvider = function MenuProvider(_ref) {
|
|
|
599
618
|
},
|
|
600
619
|
getMFNavigate: getMFNavigate,
|
|
601
620
|
setMFNavigate: setMFNavigate
|
|
602
|
-
}
|
|
603
|
-
|
|
621
|
+
},
|
|
622
|
+
children: children
|
|
623
|
+
});
|
|
604
624
|
};
|
|
605
625
|
|
|
606
626
|
var _excluded$1 = ["navigate", "children", "onClick", "target"];
|
|
@@ -615,7 +635,7 @@ var MicroFrontendLink = function MicroFrontendLink(_ref) {
|
|
|
615
635
|
rest = _objectWithoutPropertiesLoose(_ref, _excluded$1);
|
|
616
636
|
return (
|
|
617
637
|
// biome-ignore lint/a11y/noStaticElementInteractions: Ignore lint rule for now. No changes in code.
|
|
618
|
-
|
|
638
|
+
jsxRuntime.jsx("a", _extends({
|
|
619
639
|
// biome-ignore lint/a11y/useValidAnchor: Ignore lint rule for now. No changes in code.
|
|
620
640
|
onClick: function onClick(event) {
|
|
621
641
|
try {
|
|
@@ -637,26 +657,28 @@ var MicroFrontendLink = function MicroFrontendLink(_ref) {
|
|
|
637
657
|
}
|
|
638
658
|
},
|
|
639
659
|
target: target
|
|
640
|
-
}, rest
|
|
660
|
+
}, rest, {
|
|
661
|
+
children: children
|
|
662
|
+
}))
|
|
641
663
|
);
|
|
642
664
|
};
|
|
643
665
|
|
|
644
|
-
var OrganisationContext = /*#__PURE__*/
|
|
666
|
+
var OrganisationContext = /*#__PURE__*/react.createContext(undefined);
|
|
645
667
|
var useOrganisation = function useOrganisation() {
|
|
646
|
-
var context =
|
|
668
|
+
var context = react.useContext(OrganisationContext);
|
|
647
669
|
util.assertIsDefined(context);
|
|
648
670
|
return context;
|
|
649
671
|
};
|
|
650
672
|
var useOrganisationId = function useOrganisationId() {
|
|
651
|
-
var context =
|
|
673
|
+
var context = react.useContext(OrganisationContext);
|
|
652
674
|
util.assertIsDefined(context);
|
|
653
675
|
return context.organisationId;
|
|
654
676
|
};
|
|
655
677
|
var useOrganisationState = function useOrganisationState(initialOrganisationId) {
|
|
656
|
-
var _useState =
|
|
678
|
+
var _useState = react.useState(Number(initialOrganisationId)),
|
|
657
679
|
organisationId = _useState[0],
|
|
658
680
|
setOrganisationId = _useState[1];
|
|
659
|
-
|
|
681
|
+
react.useEffect(function () {
|
|
660
682
|
organisationStorage.set(organisationId.toString());
|
|
661
683
|
}, [organisationId]);
|
|
662
684
|
return [organisationId, setOrganisationId];
|
|
@@ -667,12 +689,13 @@ var OrganisationProvider = function OrganisationProvider(_ref) {
|
|
|
667
689
|
var _useOrganisationState = useOrganisationState(organisationId),
|
|
668
690
|
orgId = _useOrganisationState[0],
|
|
669
691
|
setOrganisationId = _useOrganisationState[1];
|
|
670
|
-
return
|
|
692
|
+
return jsxRuntime.jsx(OrganisationContext.Provider, {
|
|
671
693
|
value: {
|
|
672
694
|
organisationId: orgId,
|
|
673
695
|
setOrganisationId: setOrganisationId
|
|
674
|
-
}
|
|
675
|
-
|
|
696
|
+
},
|
|
697
|
+
children: children
|
|
698
|
+
});
|
|
676
699
|
};
|
|
677
700
|
|
|
678
701
|
var OrganisationsError = /*#__PURE__*/function (_Error) {
|
|
@@ -696,15 +719,15 @@ var OrganisationSelector = function OrganisationSelector(_ref) {
|
|
|
696
719
|
selectedOrganisationId = _ref.selectedOrganisationId,
|
|
697
720
|
onChange = _ref.onChange,
|
|
698
721
|
rest = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
699
|
-
var _useState =
|
|
722
|
+
var _useState = react.useState([]),
|
|
700
723
|
organisations = _useState[0],
|
|
701
724
|
setOrganisations = _useState[1];
|
|
702
725
|
var _useLanguage = useLanguage(),
|
|
703
726
|
language = _useLanguage.language;
|
|
704
|
-
var _useState2 =
|
|
727
|
+
var _useState2 = react.useState("LOADING"),
|
|
705
728
|
status = _useState2[0],
|
|
706
729
|
setStatus = _useState2[1];
|
|
707
|
-
|
|
730
|
+
react.useEffect(function () {
|
|
708
731
|
var fetchOrganisations = /*#__PURE__*/function () {
|
|
709
732
|
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
|
|
710
733
|
var token, organisations;
|
|
@@ -758,15 +781,16 @@ var OrganisationSelector = function OrganisationSelector(_ref) {
|
|
|
758
781
|
}, [getOrganisations, getToken]);
|
|
759
782
|
switch (status) {
|
|
760
783
|
case "LOADING":
|
|
761
|
-
return
|
|
762
|
-
className: "eds-contrast"
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
784
|
+
return jsxRuntime.jsx("div", {
|
|
785
|
+
className: "eds-contrast",
|
|
786
|
+
children: jsxRuntime.jsx(loader.SkeletonRectangle, {
|
|
787
|
+
style: {
|
|
788
|
+
height: "2.4rem"
|
|
789
|
+
}
|
|
790
|
+
})
|
|
791
|
+
});
|
|
768
792
|
case "SUCCESS":
|
|
769
|
-
return
|
|
793
|
+
return jsxRuntime.jsx(common.OrganisationDropDown, _extends({
|
|
770
794
|
label: language === "nb" || language === "nb-NO" ? "Organisasjon" : "Organisation",
|
|
771
795
|
selectedOrganisationId: selectedOrganisationId,
|
|
772
796
|
organisations: organisations,
|
|
@@ -789,7 +813,7 @@ var PostHogProviderWrapper = function PostHogProviderWrapper(_ref) {
|
|
|
789
813
|
forceDisablePostHog = _ref$forceDisablePost === void 0 ? false : _ref$forceDisablePost,
|
|
790
814
|
children = _ref.children;
|
|
791
815
|
var consents = useConsentManager();
|
|
792
|
-
|
|
816
|
+
react.useEffect(function () {
|
|
793
817
|
if (!postHogApiKey || forceDisablePostHog) {
|
|
794
818
|
return;
|
|
795
819
|
}
|
|
@@ -806,7 +830,9 @@ var PostHogProviderWrapper = function PostHogProviderWrapper(_ref) {
|
|
|
806
830
|
} else {
|
|
807
831
|
console.warn("AppShellStandalone Warning: PostHog tracking is disabled by force. PostHog will not be initialized.");
|
|
808
832
|
}
|
|
809
|
-
return
|
|
833
|
+
return jsxRuntime.jsx(jsxRuntime.Fragment, {
|
|
834
|
+
children: children
|
|
835
|
+
});
|
|
810
836
|
}
|
|
811
837
|
postHog.init(postHogApiKey, {
|
|
812
838
|
debug: debug,
|
|
@@ -815,9 +841,10 @@ var PostHogProviderWrapper = function PostHogProviderWrapper(_ref) {
|
|
|
815
841
|
opt_out_capturing_by_default: true,
|
|
816
842
|
autocapture: isStandalone
|
|
817
843
|
}, project);
|
|
818
|
-
return
|
|
819
|
-
client: postHog
|
|
820
|
-
|
|
844
|
+
return jsxRuntime.jsx(react$1.PostHogProvider, {
|
|
845
|
+
client: postHog,
|
|
846
|
+
children: children
|
|
847
|
+
});
|
|
821
848
|
};
|
|
822
849
|
|
|
823
850
|
exports.AppShell = AppShell;
|