@australiangreens/ag-internal-components 0.0.79 → 0.0.80
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.
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import { PropsWithChildren } from 'react';
|
|
2
|
+
export interface AuthGuardProps {
|
|
3
|
+
appName?: string;
|
|
4
|
+
}
|
|
2
5
|
/**
|
|
3
6
|
* Use as parent of main app (but within Auth0Provider) so when an anonymous
|
|
4
7
|
* user visits the will be redirected to the login page and returned to the page
|
|
@@ -12,5 +15,5 @@ import { PropsWithChildren } from 'react';
|
|
|
12
15
|
*
|
|
13
16
|
* Do not use this if any routes need to be accessible to anonymous users.
|
|
14
17
|
*/
|
|
15
|
-
export default function AuthGuard({ children }: PropsWithChildren): JSX.Element;
|
|
18
|
+
export default function AuthGuard({ children, appName, }: PropsWithChildren<AuthGuardProps>): JSX.Element;
|
|
16
19
|
//# sourceMappingURL=AuthGuard.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AuthGuard.d.ts","sourceRoot":"","sources":["../../../src/components/AuthGuard/AuthGuard.tsx"],"names":[],"mappings":"AAUA,OAAO,EAAE,iBAAiB,EAAa,MAAM,OAAO,CAAC;AASrD;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,OAAO,UAAU,SAAS,CAAC,
|
|
1
|
+
{"version":3,"file":"AuthGuard.d.ts","sourceRoot":"","sources":["../../../src/components/AuthGuard/AuthGuard.tsx"],"names":[],"mappings":"AAUA,OAAO,EAAE,iBAAiB,EAAa,MAAM,OAAO,CAAC;AASrD,MAAM,WAAW,cAAc;IAC7B,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,OAAO,UAAU,SAAS,CAAC,EAChC,QAAQ,EACR,OAAmB,GACpB,EAAE,iBAAiB,CAAC,cAAc,CAAC,eAkDnC"}
|
package/dist/esm/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
var Ft = Object.defineProperty, Et = Object.defineProperties;
|
|
2
|
-
var
|
|
2
|
+
var Pt = Object.getOwnPropertyDescriptors;
|
|
3
3
|
var j = Object.getOwnPropertySymbols;
|
|
4
4
|
var Te = Object.prototype.hasOwnProperty, ye = Object.prototype.propertyIsEnumerable;
|
|
5
5
|
var de = (e, t, n) => t in e ? Ft(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n, a = (e, t) => {
|
|
@@ -9,7 +9,7 @@ var de = (e, t, n) => t in e ? Ft(e, t, { enumerable: !0, configurable: !0, writ
|
|
|
9
9
|
for (var n of j(t))
|
|
10
10
|
ye.call(t, n) && de(e, n, t[n]);
|
|
11
11
|
return e;
|
|
12
|
-
}, b = (e, t) => Et(e,
|
|
12
|
+
}, b = (e, t) => Et(e, Pt(t));
|
|
13
13
|
var Oe = (e, t) => {
|
|
14
14
|
var n = {};
|
|
15
15
|
for (var i in e)
|
|
@@ -21,24 +21,24 @@ var Oe = (e, t) => {
|
|
|
21
21
|
};
|
|
22
22
|
var Fe = (e, t, n) => (de(e, typeof t != "symbol" ? t + "" : t, n), n);
|
|
23
23
|
var z = (e, t, n) => new Promise((i, r) => {
|
|
24
|
-
var s = (
|
|
24
|
+
var s = (l) => {
|
|
25
25
|
try {
|
|
26
|
-
d(n.next(
|
|
26
|
+
d(n.next(l));
|
|
27
27
|
} catch (u) {
|
|
28
28
|
r(u);
|
|
29
29
|
}
|
|
30
|
-
},
|
|
30
|
+
}, c = (l) => {
|
|
31
31
|
try {
|
|
32
|
-
d(n.throw(
|
|
32
|
+
d(n.throw(l));
|
|
33
33
|
} catch (u) {
|
|
34
34
|
r(u);
|
|
35
35
|
}
|
|
36
|
-
}, d = (
|
|
36
|
+
}, d = (l) => l.done ? i(l.value) : Promise.resolve(l.value).then(s, c);
|
|
37
37
|
d((n = n.apply(e, t)).next());
|
|
38
38
|
});
|
|
39
39
|
import { jsxs as p, Fragment as B, jsx as o } from "react/jsx-runtime";
|
|
40
40
|
import { useState as F, createContext as Xe, useCallback as ne, useContext as Qe, createElement as fe, useEffect as me, useRef as ue } from "react";
|
|
41
|
-
import { Typography as E, Button as oe, Paper as Ke, Box as $, Drawer as ve, Dialog as Ye, DialogTitle as Je, DialogContent as Ze, DialogActions as je, Autocomplete as xe, TextField as we, CircularProgress as Ae, Chip as
|
|
41
|
+
import { Typography as E, Button as oe, Paper as Ke, Box as $, Drawer as ve, Dialog as Ye, DialogTitle as Je, DialogContent as Ze, DialogActions as je, Autocomplete as xe, TextField as we, CircularProgress as Ae, Chip as Nt, Tooltip as Bt, Stack as Lt, styled as Se, IconButton as Q, Container as et, useTheme as re, useMediaQuery as _t, Collapse as Mt, Avatar as Ee, Fade as Rt, Skeleton as Pe, Toolbar as Ht, Divider as Ne, CssBaseline as Wt, Snackbar as zt, Alert as Ut, LinearProgress as Gt, FormHelperText as Vt } from "@mui/material";
|
|
42
42
|
import qt from "@mui/material/CssBaseline";
|
|
43
43
|
import { styled as R, createTheme as tt, alpha as pe } from "@mui/material/styles";
|
|
44
44
|
import { AgError as Xt } from "@australiangreens/ag-error";
|
|
@@ -138,14 +138,14 @@ const ut = Xe(null), dn = {}, un = {}, pn = ({
|
|
|
138
138
|
overrideActions: t = un,
|
|
139
139
|
children: n
|
|
140
140
|
}) => {
|
|
141
|
-
const [{ open: i }, r] = F({ open: !0 }), s = ne((
|
|
142
|
-
r({ open:
|
|
143
|
-
}, []),
|
|
144
|
-
r((
|
|
141
|
+
const [{ open: i }, r] = F({ open: !0 }), s = ne((l) => {
|
|
142
|
+
r({ open: l });
|
|
143
|
+
}, []), c = ne(() => {
|
|
144
|
+
r((l) => b(a({}, l), { open: !l.open }));
|
|
145
145
|
}, []), d = a(a({
|
|
146
146
|
open: i,
|
|
147
147
|
setOpen: s,
|
|
148
|
-
toggleOpen:
|
|
148
|
+
toggleOpen: c
|
|
149
149
|
}, e), t);
|
|
150
150
|
return /* @__PURE__ */ o(ut.Provider, { value: d, children: n });
|
|
151
151
|
}, hn = () => {
|
|
@@ -260,9 +260,9 @@ const fn = ({
|
|
|
260
260
|
maxWidth: i,
|
|
261
261
|
primaryButton: r,
|
|
262
262
|
secondaryButton: s,
|
|
263
|
-
onClose:
|
|
263
|
+
onClose: c,
|
|
264
264
|
sx: d,
|
|
265
|
-
"data-testid":
|
|
265
|
+
"data-testid": l,
|
|
266
266
|
disableCloseOnBackdropOrEscape: u = !1
|
|
267
267
|
}) => {
|
|
268
268
|
var A, m;
|
|
@@ -272,11 +272,11 @@ const fn = ({
|
|
|
272
272
|
{
|
|
273
273
|
open: e,
|
|
274
274
|
onClose: (S, k) => z(void 0, null, function* () {
|
|
275
|
-
u && (k === "backdropClick" || k === "escapeKeyDown") || v || (s != null && s.onClick ? yield s.onClick() :
|
|
275
|
+
u && (k === "backdropClick" || k === "escapeKeyDown") || v || (s != null && s.onClick ? yield s.onClick() : c());
|
|
276
276
|
}),
|
|
277
277
|
fullWidth: !0,
|
|
278
278
|
maxWidth: i != null ? i : "xs",
|
|
279
|
-
"data-testid":
|
|
279
|
+
"data-testid": l,
|
|
280
280
|
sx: d,
|
|
281
281
|
children: [
|
|
282
282
|
/* @__PURE__ */ o(Je, { children: t }),
|
|
@@ -285,7 +285,7 @@ const fn = ({
|
|
|
285
285
|
/* @__PURE__ */ o(
|
|
286
286
|
oe,
|
|
287
287
|
{
|
|
288
|
-
onClick: (A = s == null ? void 0 : s.onClick) != null ? A :
|
|
288
|
+
onClick: (A = s == null ? void 0 : s.onClick) != null ? A : c,
|
|
289
289
|
"data-testid": s == null ? void 0 : s.testId,
|
|
290
290
|
disabled: (s == null ? void 0 : s.disabled) || v,
|
|
291
291
|
color: s == null ? void 0 : s.buttonColor,
|
|
@@ -329,9 +329,9 @@ function Io({
|
|
|
329
329
|
minLength: i = 0,
|
|
330
330
|
label: r,
|
|
331
331
|
value: s,
|
|
332
|
-
"data-testid":
|
|
332
|
+
"data-testid": c,
|
|
333
333
|
sx: d,
|
|
334
|
-
textFieldColor:
|
|
334
|
+
textFieldColor: l,
|
|
335
335
|
textFieldVariant: u = "filled",
|
|
336
336
|
loadingText: v = "Loading...",
|
|
337
337
|
noOptionsText: w = "No options",
|
|
@@ -342,26 +342,26 @@ function Io({
|
|
|
342
342
|
disablePortal: I = !1
|
|
343
343
|
}) {
|
|
344
344
|
const [g, D] = F(""), H = (h, f) => {
|
|
345
|
-
const O = s.filter((
|
|
345
|
+
const O = s.filter((N) => N.id !== f);
|
|
346
346
|
n(O, "delete", h);
|
|
347
|
-
}, { data:
|
|
347
|
+
}, { data: P, isLoading: _ } = pt({
|
|
348
348
|
inputValue: g,
|
|
349
349
|
label: r,
|
|
350
350
|
lookup: e,
|
|
351
351
|
minLength: i,
|
|
352
352
|
preLoadedOptions: k
|
|
353
353
|
}), T = g.length >= i;
|
|
354
|
-
return /* @__PURE__ */ p("div", { "data-testid":
|
|
354
|
+
return /* @__PURE__ */ p("div", { "data-testid": c, children: [
|
|
355
355
|
/* @__PURE__ */ o(
|
|
356
356
|
xe,
|
|
357
357
|
{
|
|
358
358
|
sx: d,
|
|
359
|
-
"data-testid":
|
|
359
|
+
"data-testid": c ? `${c}:Autocomplete` : void 0,
|
|
360
360
|
disablePortal: I,
|
|
361
361
|
multiple: !0,
|
|
362
362
|
getOptionLabel: (h) => typeof h == "string" ? h : h.label,
|
|
363
363
|
loading: T ? _ : !1,
|
|
364
|
-
options: [...s, ...
|
|
364
|
+
options: [...s, ...P != null ? P : []],
|
|
365
365
|
filterSelectedOptions: !0,
|
|
366
366
|
includeInputInList: !0,
|
|
367
367
|
value: s,
|
|
@@ -386,26 +386,26 @@ function Io({
|
|
|
386
386
|
h.InputProps.endAdornment
|
|
387
387
|
] })
|
|
388
388
|
}),
|
|
389
|
-
"data-testid":
|
|
389
|
+
"data-testid": c ? `${c}:Autocomplete:TextField` : void 0,
|
|
390
390
|
onKeyDown: (f) => {
|
|
391
391
|
(f.key === "Backspace" || f.key === "Delete") && f.stopPropagation();
|
|
392
392
|
},
|
|
393
|
-
color:
|
|
393
|
+
color: l
|
|
394
394
|
})
|
|
395
395
|
),
|
|
396
396
|
renderTags: () => null,
|
|
397
397
|
isOptionEqualToValue: (h, f) => h.id === f.id,
|
|
398
398
|
renderOption: (h, f, O) => {
|
|
399
399
|
if (t) {
|
|
400
|
-
const
|
|
400
|
+
const N = Jt(f.label, O.inputValue, {
|
|
401
401
|
insideWords: !0,
|
|
402
402
|
findAllOccurrences: !0
|
|
403
|
-
}), x = Zt(f.label,
|
|
403
|
+
}), x = Zt(f.label, N);
|
|
404
404
|
return /* @__PURE__ */ fe(
|
|
405
405
|
"li",
|
|
406
406
|
b(a({}, h), {
|
|
407
407
|
key: f.id,
|
|
408
|
-
"data-testid":
|
|
408
|
+
"data-testid": c ? `${c}:Autocomplete:option(${f.id.toString()})` : void 0
|
|
409
409
|
}),
|
|
410
410
|
/* @__PURE__ */ o("div", { children: x.map((C, M) => /* @__PURE__ */ o(
|
|
411
411
|
"span",
|
|
@@ -423,7 +423,7 @@ function Io({
|
|
|
423
423
|
"li",
|
|
424
424
|
b(a({}, h), {
|
|
425
425
|
key: f.id,
|
|
426
|
-
"data-testid":
|
|
426
|
+
"data-testid": c ? `${c}:option(${f.id.toString()})` : void 0
|
|
427
427
|
}),
|
|
428
428
|
f.label
|
|
429
429
|
);
|
|
@@ -431,7 +431,7 @@ function Io({
|
|
|
431
431
|
}
|
|
432
432
|
),
|
|
433
433
|
s.length > 0 && /* @__PURE__ */ o($, { children: s.map((h) => /* @__PURE__ */ o(
|
|
434
|
-
|
|
434
|
+
Nt,
|
|
435
435
|
{
|
|
436
436
|
sx: {
|
|
437
437
|
marginTop: 1,
|
|
@@ -456,12 +456,12 @@ function Io({
|
|
|
456
456
|
children: /* @__PURE__ */ o(E, { style: { whiteSpace: "normal" }, children: h.chipLabel ? h.chipLabel : h.label })
|
|
457
457
|
}
|
|
458
458
|
),
|
|
459
|
-
"data-testid":
|
|
459
|
+
"data-testid": c ? `${c}:Chip(${h.id.toString()})` : void 0,
|
|
460
460
|
onDelete: (f) => H(f, h.id),
|
|
461
461
|
deleteIcon: /* @__PURE__ */ o(
|
|
462
462
|
Qt,
|
|
463
463
|
{
|
|
464
|
-
"data-testid":
|
|
464
|
+
"data-testid": c ? `${c}:Chip(${h.id.toString()}):deleteIcon` : void 0
|
|
465
465
|
}
|
|
466
466
|
)
|
|
467
467
|
},
|
|
@@ -477,9 +477,9 @@ const To = ({
|
|
|
477
477
|
value: i,
|
|
478
478
|
sx: r,
|
|
479
479
|
textFieldColor: s,
|
|
480
|
-
textFieldVariant:
|
|
480
|
+
textFieldVariant: c = "filled",
|
|
481
481
|
"data-testid": d,
|
|
482
|
-
noOptionsText:
|
|
482
|
+
noOptionsText: l = "No options",
|
|
483
483
|
minLength: u = 3,
|
|
484
484
|
disablePortal: v = !1,
|
|
485
485
|
preLoadedOptions: w
|
|
@@ -504,14 +504,14 @@ const To = ({
|
|
|
504
504
|
disablePortal: v,
|
|
505
505
|
filterOptions: (g) => g,
|
|
506
506
|
value: i,
|
|
507
|
-
noOptionsText: I ?
|
|
507
|
+
noOptionsText: I ? l : "Start typing to search",
|
|
508
508
|
getOptionLabel: (g) => g.label,
|
|
509
509
|
renderInput: (g) => /* @__PURE__ */ o(
|
|
510
510
|
we,
|
|
511
511
|
b(a({
|
|
512
512
|
"data-testid": d ? `${d}:Autocomplete:TextField` : void 0
|
|
513
513
|
}, g), {
|
|
514
|
-
variant:
|
|
514
|
+
variant: c,
|
|
515
515
|
label: n,
|
|
516
516
|
color: s
|
|
517
517
|
})
|
|
@@ -547,26 +547,29 @@ function xn(e) {
|
|
|
547
547
|
const t = e.error, n = (i = e == null ? void 0 : e.error_description) != null ? i : "";
|
|
548
548
|
return t === "access_denied" && n.startsWith("User did not authorize the request");
|
|
549
549
|
}
|
|
550
|
-
function yo({
|
|
551
|
-
|
|
550
|
+
function yo({
|
|
551
|
+
children: e,
|
|
552
|
+
appName: t = "the app"
|
|
553
|
+
}) {
|
|
554
|
+
const { isAuthenticated: n, isLoading: i, error: r, loginWithRedirect: s, logout: c } = nn();
|
|
552
555
|
if (me(() => {
|
|
553
|
-
if (
|
|
556
|
+
if (i || n || r)
|
|
554
557
|
return;
|
|
555
|
-
const
|
|
558
|
+
const d = {
|
|
556
559
|
appState: {
|
|
557
560
|
returnTo: `${window.location.pathname}${window.location.search}`
|
|
558
561
|
}
|
|
559
562
|
};
|
|
560
|
-
|
|
561
|
-
}, [
|
|
562
|
-
let
|
|
563
|
-
return vn(
|
|
564
|
-
/* @__PURE__ */ o(Je, { children:
|
|
565
|
-
/* @__PURE__ */ o(Ze, { children: /* @__PURE__ */ o(E, { children:
|
|
566
|
-
/* @__PURE__ */ o(je, { children: /* @__PURE__ */ o(oe, { onClick: () =>
|
|
563
|
+
s(d);
|
|
564
|
+
}, [i, n, r, s]), r && mn(r)) {
|
|
565
|
+
let d = "Auth error", l = "An unknown Auth0 error occurred.";
|
|
566
|
+
return vn(r) ? (d = "Unauthorised", l = `You are not authorised to access ${t}.`) : xn(r) ? (d = "App not authorised", l = `You have not authorised ${t} to access your user profile. This is necessary to use ${t}.`) : Cn(r) && (d = "Unauthorised", l = "Authorisation with auth0 failed for an unknown reason."), /* @__PURE__ */ p(Ye, { open: !0, children: [
|
|
567
|
+
/* @__PURE__ */ o(Je, { children: d }),
|
|
568
|
+
/* @__PURE__ */ o(Ze, { children: /* @__PURE__ */ o(E, { children: l }) }),
|
|
569
|
+
/* @__PURE__ */ o(je, { children: /* @__PURE__ */ o(oe, { onClick: () => c({ logoutParams: { returnTo: window.location.origin } }), children: "Logout" }) })
|
|
567
570
|
] });
|
|
568
571
|
}
|
|
569
|
-
return
|
|
572
|
+
return n ? /* @__PURE__ */ o(B, { children: e }) : /* @__PURE__ */ o(on, { variant: "rectangular", animation: "pulse", height: "100vh", width: "100vw" });
|
|
570
573
|
}
|
|
571
574
|
const wn = 24, An = 64, G = "TopBar", y = {
|
|
572
575
|
topStripe: `${G}-topStripe`,
|
|
@@ -728,9 +731,9 @@ function Me({
|
|
|
728
731
|
},
|
|
729
732
|
titleText: r = "",
|
|
730
733
|
width: s = ht,
|
|
731
|
-
showCloseArrow:
|
|
734
|
+
showCloseArrow: c = !0,
|
|
732
735
|
debugOpacity: d = !1,
|
|
733
|
-
headerBoxProps:
|
|
736
|
+
headerBoxProps: l = {},
|
|
734
737
|
onOpened: u,
|
|
735
738
|
onClosed: v,
|
|
736
739
|
"data-testid": w,
|
|
@@ -755,14 +758,14 @@ function Me({
|
|
|
755
758
|
navBarWidthOpen: m,
|
|
756
759
|
navBarWidthClosed: S,
|
|
757
760
|
children: [
|
|
758
|
-
/* @__PURE__ */ o(Dn, b(a({ anchor: t },
|
|
761
|
+
/* @__PURE__ */ o(Dn, b(a({ anchor: t }, l), { children: t === "left" ? /* @__PURE__ */ p(B, { children: [
|
|
759
762
|
/* @__PURE__ */ o(E, { variant: "h6", color: "inherit", component: "div", children: r }),
|
|
760
|
-
|
|
763
|
+
c && /* @__PURE__ */ p(Q, { onClick: i, size: "large", "aria-label": "Close left side panel", children: [
|
|
761
764
|
/* @__PURE__ */ o(it, { "data-testid": "arrowbackicon" }),
|
|
762
765
|
" "
|
|
763
766
|
] })
|
|
764
767
|
] }) : /* @__PURE__ */ p(B, { children: [
|
|
765
|
-
|
|
768
|
+
c && /* @__PURE__ */ p(Q, { onClick: i, size: "large", "aria-label": "Close right side panel", children: [
|
|
766
769
|
/* @__PURE__ */ o(ot, {}),
|
|
767
770
|
" "
|
|
768
771
|
] }),
|
|
@@ -823,19 +826,19 @@ function Oo({
|
|
|
823
826
|
rightPanel: i,
|
|
824
827
|
sidePanelsAreMutuallyExclusive: r = !0,
|
|
825
828
|
debugOpacity: s = !1,
|
|
826
|
-
pageContainerProps:
|
|
829
|
+
pageContainerProps: c,
|
|
827
830
|
pageContentDataTestId: d,
|
|
828
|
-
topBarDataTestId:
|
|
831
|
+
topBarDataTestId: l,
|
|
829
832
|
navBarOpen: u,
|
|
830
833
|
navBarWidthOpen: v,
|
|
831
834
|
navBarWidthClosed: w
|
|
832
835
|
}) {
|
|
833
|
-
const [A, m] = F(he), [S, k] = F(ge), [I, g] = F(he), [D, H] = F(ge),
|
|
836
|
+
const [A, m] = F(he), [S, k] = F(ge), [I, g] = F(he), [D, H] = F(ge), P = n !== void 0, _ = i !== void 0, {
|
|
834
837
|
titleText: T,
|
|
835
838
|
content: h,
|
|
836
839
|
flavour: f,
|
|
837
840
|
open: O,
|
|
838
|
-
onChangeOpen:
|
|
841
|
+
onChangeOpen: N,
|
|
839
842
|
width: x,
|
|
840
843
|
arrowButtons: C,
|
|
841
844
|
startOpen: M,
|
|
@@ -861,12 +864,12 @@ function Oo({
|
|
|
861
864
|
Z !== ge && (k(Z), H(Z));
|
|
862
865
|
}, [Z]);
|
|
863
866
|
const le = O === void 0 ? A : O, ce = ae === void 0 ? S : ae, $e = (W) => {
|
|
864
|
-
O === void 0 && (m(W), r && _ && (W ? (k(!1), H(S)) : k(D))),
|
|
867
|
+
O === void 0 && (m(W), r && _ && (W ? (k(!1), H(S)) : k(D))), N && N(W);
|
|
865
868
|
}, Ie = (W) => {
|
|
866
|
-
ae === void 0 && (k(W), r &&
|
|
869
|
+
ae === void 0 && (k(W), r && P && (W ? (m(!1), g(A)) : m(I))), De && De(W);
|
|
867
870
|
};
|
|
868
871
|
return /* @__PURE__ */ p($, { children: [
|
|
869
|
-
|
|
872
|
+
P && /* @__PURE__ */ o(
|
|
870
873
|
Me,
|
|
871
874
|
{
|
|
872
875
|
"data-testid": Dt,
|
|
@@ -908,8 +911,8 @@ function Oo({
|
|
|
908
911
|
bn,
|
|
909
912
|
a(a({
|
|
910
913
|
titleText: t,
|
|
911
|
-
"data-testid":
|
|
912
|
-
},
|
|
914
|
+
"data-testid": l
|
|
915
|
+
}, P && f === "push" ? {
|
|
913
916
|
leftPanel: {
|
|
914
917
|
open: le,
|
|
915
918
|
width: x,
|
|
@@ -938,7 +941,7 @@ function Oo({
|
|
|
938
941
|
width: se
|
|
939
942
|
}
|
|
940
943
|
} : {}), {
|
|
941
|
-
children: /* @__PURE__ */ o(In, b(a({ "data-testid": d },
|
|
944
|
+
children: /* @__PURE__ */ o(In, b(a({ "data-testid": d }, c), { children: e }))
|
|
942
945
|
})
|
|
943
946
|
)
|
|
944
947
|
] });
|
|
@@ -958,7 +961,7 @@ const te = "Navbar", X = {
|
|
|
958
961
|
// userInfoHolder: `${PREFIX}-userInfoHolder`,
|
|
959
962
|
// settings: `${PREFIX}-settings`,
|
|
960
963
|
// pieChartIcon: `${PREFIX}-pieChartIcon`,
|
|
961
|
-
},
|
|
964
|
+
}, Pn = R($, { name: "NavBar" })(({ theme: e }) => ({
|
|
962
965
|
[`&.${X.root}`]: {
|
|
963
966
|
display: "flex"
|
|
964
967
|
},
|
|
@@ -980,7 +983,7 @@ const te = "Navbar", X = {
|
|
|
980
983
|
})), ie = (e, t, n) => e.transitions.create(t, {
|
|
981
984
|
easing: e.transitions.easing.sharp,
|
|
982
985
|
duration: n === "leaving" ? e.transitions.duration.leavingScreen : e.transitions.duration.enteringScreen
|
|
983
|
-
}),
|
|
986
|
+
}), Nn = (e) => {
|
|
984
987
|
const t = re();
|
|
985
988
|
return /* @__PURE__ */ o(
|
|
986
989
|
Mt,
|
|
@@ -1065,9 +1068,9 @@ function Mn({ user: e, domainCode: t, open: n }) {
|
|
|
1065
1068
|
) : /* @__PURE__ */ o(Ee, { sx: { width: "100%", height: "100%" } })
|
|
1066
1069
|
}
|
|
1067
1070
|
),
|
|
1068
|
-
/* @__PURE__ */ o(
|
|
1069
|
-
e != null && e.name ? /* @__PURE__ */ o(E, { children: e.name }) : /* @__PURE__ */ o(
|
|
1070
|
-
t ? /* @__PURE__ */ o(E, { children: t.toUpperCase() }) : /* @__PURE__ */ o(
|
|
1071
|
+
/* @__PURE__ */ o(Nn, { sx: { width: "100%" }, in: n, children: /* @__PURE__ */ o(Rt, { in: n, children: /* @__PURE__ */ p($, { width: "100%", display: "flex", flexDirection: "column", alignItems: "center", children: [
|
|
1072
|
+
e != null && e.name ? /* @__PURE__ */ o(E, { children: e.name }) : /* @__PURE__ */ o(Pe, { animation: !1, width: "50%" }),
|
|
1073
|
+
t ? /* @__PURE__ */ o(E, { children: t.toUpperCase() }) : /* @__PURE__ */ o(Pe, { animation: !1, width: "25%" })
|
|
1071
1074
|
] }) }) })
|
|
1072
1075
|
]
|
|
1073
1076
|
}
|
|
@@ -1080,12 +1083,12 @@ function Rn({
|
|
|
1080
1083
|
"data-testid": i,
|
|
1081
1084
|
top: r,
|
|
1082
1085
|
middle: s,
|
|
1083
|
-
bottom:
|
|
1086
|
+
bottom: c,
|
|
1084
1087
|
user: d,
|
|
1085
|
-
domainCode:
|
|
1088
|
+
domainCode: l
|
|
1086
1089
|
}) {
|
|
1087
1090
|
const u = gt(), v = rt(K);
|
|
1088
|
-
return /* @__PURE__ */ o(
|
|
1091
|
+
return /* @__PURE__ */ o(Pn, { className: X.root, "data-testid": i, children: /* @__PURE__ */ p(
|
|
1089
1092
|
Bn,
|
|
1090
1093
|
{
|
|
1091
1094
|
open: e,
|
|
@@ -1104,13 +1107,13 @@ function Rn({
|
|
|
1104
1107
|
!u && /* @__PURE__ */ o(Ht, {}),
|
|
1105
1108
|
r && /* @__PURE__ */ p($, { flexGrow: "0", children: [
|
|
1106
1109
|
r,
|
|
1107
|
-
/* @__PURE__ */ o(
|
|
1110
|
+
/* @__PURE__ */ o(Ne, { variant: "middle" })
|
|
1108
1111
|
] }),
|
|
1109
1112
|
/* @__PURE__ */ o($, { flexGrow: "1", children: Array.isArray(s) ? /* @__PURE__ */ o(En, { links: s }) : s }),
|
|
1110
1113
|
/* @__PURE__ */ p($, { flexGrow: "0", children: [
|
|
1111
|
-
/* @__PURE__ */ o(
|
|
1112
|
-
/* @__PURE__ */ o(Mn, { user: d, domainCode:
|
|
1113
|
-
|
|
1114
|
+
/* @__PURE__ */ o(Ne, { variant: "middle" }),
|
|
1115
|
+
/* @__PURE__ */ o(Mn, { user: d, domainCode: l, open: e }),
|
|
1116
|
+
c && /* @__PURE__ */ o(B, { children: c })
|
|
1114
1117
|
] })
|
|
1115
1118
|
]
|
|
1116
1119
|
}
|
|
@@ -1153,7 +1156,7 @@ function Un({
|
|
|
1153
1156
|
"data-testid": n,
|
|
1154
1157
|
middle: i
|
|
1155
1158
|
}) {
|
|
1156
|
-
const r = rt(K), s = () => r((
|
|
1159
|
+
const r = rt(K), s = () => r((l) => !l), c = re(), d = gt();
|
|
1157
1160
|
return /* @__PURE__ */ o("header", { "data-testid": n, children: /* @__PURE__ */ p(
|
|
1158
1161
|
Ke,
|
|
1159
1162
|
{
|
|
@@ -1169,7 +1172,7 @@ function Un({
|
|
|
1169
1172
|
gap: 2,
|
|
1170
1173
|
flexShrink: 0,
|
|
1171
1174
|
height: t,
|
|
1172
|
-
zIndex: d ? 0 :
|
|
1175
|
+
zIndex: d ? 0 : c.zIndex.drawer + 1
|
|
1173
1176
|
},
|
|
1174
1177
|
children: [
|
|
1175
1178
|
/* @__PURE__ */ o(Q, { size: "medium", color: "inherit", sx: { padding: 1.5 }, onClick: s, children: /* @__PURE__ */ o(Yt, { fontSize: "medium" }) }),
|
|
@@ -1186,9 +1189,9 @@ function Fo({
|
|
|
1186
1189
|
pageContainerProps: i,
|
|
1187
1190
|
pageContentDataTestId: r,
|
|
1188
1191
|
topBarDataTestId: s,
|
|
1189
|
-
navBarDataTestId:
|
|
1192
|
+
navBarDataTestId: c,
|
|
1190
1193
|
navBarMiddle: d,
|
|
1191
|
-
navBarBottom:
|
|
1194
|
+
navBarBottom: l,
|
|
1192
1195
|
user: u,
|
|
1193
1196
|
domainCode: v
|
|
1194
1197
|
}) {
|
|
@@ -1215,13 +1218,13 @@ function Fo({
|
|
|
1215
1218
|
open: w,
|
|
1216
1219
|
top: g,
|
|
1217
1220
|
middle: d,
|
|
1218
|
-
bottom:
|
|
1221
|
+
bottom: l,
|
|
1219
1222
|
user: u,
|
|
1220
1223
|
domainCode: v,
|
|
1221
1224
|
widthOpen: A,
|
|
1222
1225
|
widthClosed: m,
|
|
1223
1226
|
offsetTop: k,
|
|
1224
|
-
"data-testid":
|
|
1227
|
+
"data-testid": c
|
|
1225
1228
|
}
|
|
1226
1229
|
),
|
|
1227
1230
|
/* @__PURE__ */ o(
|
|
@@ -1258,20 +1261,20 @@ const Gn = {
|
|
|
1258
1261
|
borderBottomRightRadius: "0px"
|
|
1259
1262
|
}, Kn = {}, Yn = {}, wt = Xe(null);
|
|
1260
1263
|
function Jn(s) {
|
|
1261
|
-
var
|
|
1264
|
+
var c = s, {
|
|
1262
1265
|
overrideState: e = Kn,
|
|
1263
1266
|
overrideActions: t = Yn,
|
|
1264
1267
|
shouldClose: n = Vn.shouldClose,
|
|
1265
1268
|
children: i
|
|
1266
|
-
} =
|
|
1269
|
+
} = c, r = Oe(c, [
|
|
1267
1270
|
"overrideState",
|
|
1268
1271
|
"overrideActions",
|
|
1269
1272
|
"shouldClose",
|
|
1270
1273
|
"children"
|
|
1271
1274
|
]);
|
|
1272
|
-
var
|
|
1273
|
-
const [{ open: d },
|
|
1274
|
-
|
|
1275
|
+
var N;
|
|
1276
|
+
const [{ open: d }, l] = F({ open: !1 }), u = ue([]), v = ue(Date.now()), w = ue(0), A = ne((x) => {
|
|
1277
|
+
l({ open: x });
|
|
1275
1278
|
}, []), m = ne((x = {}) => {
|
|
1276
1279
|
w.current += 1, u.current.length >= Ue && Date.now() - v.current >= Ge && (v.current = Date.now(), console.error(
|
|
1277
1280
|
`SaladBarProvider: MAX_QUEUE_LENGTH (${Ue}) hit ${w.current} times in last ${Ge}ms)`
|
|
@@ -1279,17 +1282,17 @@ function Jn(s) {
|
|
|
1279
1282
|
const C = a(b(a({}, ze), {
|
|
1280
1283
|
key: Xn()
|
|
1281
1284
|
}), x);
|
|
1282
|
-
return u.current.push(C), u.current.length === 1 &&
|
|
1285
|
+
return u.current.push(C), u.current.length === 1 && l({ open: !0 }), C.key;
|
|
1283
1286
|
}, []), S = (x = "", C = {}) => m(a({ message: x, severity: "success" }, C)), k = (x = "", C = {}) => m(a({ message: x, severity: "info" }, C)), I = (x = "", C = {}) => m(a({ message: x, severity: "warning" }, C)), g = (x = "", C = {}) => m(a({ message: x, severity: "error" }, C)), D = (x) => {
|
|
1284
1287
|
const C = u.current.findIndex((M) => M.key === x);
|
|
1285
1288
|
if (C !== -1)
|
|
1286
|
-
return C === 0 ? (
|
|
1289
|
+
return C === 0 ? (l({ open: !1 }), u.current[0]) : u.current.splice(C, 1);
|
|
1287
1290
|
}, H = (x, C) => {
|
|
1288
|
-
n(x, C) &&
|
|
1289
|
-
},
|
|
1291
|
+
n(x, C) && l({ open: !1 });
|
|
1292
|
+
}, P = () => {
|
|
1290
1293
|
}, _ = () => {
|
|
1291
|
-
u.current.shift(), u.current.length > 0 &&
|
|
1292
|
-
}, T = (
|
|
1294
|
+
u.current.shift(), u.current.length > 0 && l({ open: !0 });
|
|
1295
|
+
}, T = (N = u.current[0]) != null ? N : a({}, ze), h = {};
|
|
1293
1296
|
"autoHideDuration" in T && (h.autoHideDuration = T.autoHideDuration);
|
|
1294
1297
|
const f = a(a({}, Gn), r), O = a(a({
|
|
1295
1298
|
open: d,
|
|
@@ -1310,7 +1313,7 @@ function Jn(s) {
|
|
|
1310
1313
|
onClose: H,
|
|
1311
1314
|
TransitionProps: {
|
|
1312
1315
|
onExited: _,
|
|
1313
|
-
onExit:
|
|
1316
|
+
onExit: P
|
|
1314
1317
|
},
|
|
1315
1318
|
sx: { zIndex: qn },
|
|
1316
1319
|
children: /* @__PURE__ */ p("div", { children: [
|
|
@@ -1339,7 +1342,7 @@ function Zn() {
|
|
|
1339
1342
|
}
|
|
1340
1343
|
const Eo = Y(
|
|
1341
1344
|
(e = { autoHideDuration: 1 }, t = {}, n = {}) => ({ children: i }) => /* @__PURE__ */ o(Jn, b(a({}, e), { overrideState: t, overrideActions: n, children: i }))
|
|
1342
|
-
), jn = rn(),
|
|
1345
|
+
), jn = rn(), Po = ({
|
|
1343
1346
|
children: e,
|
|
1344
1347
|
store: t
|
|
1345
1348
|
}) => /* @__PURE__ */ o(at, { store: t != null ? t : jn, children: e }), At = "domainCode";
|
|
@@ -1366,7 +1369,7 @@ const Ve = L(
|
|
|
1366
1369
|
}, to = (e) => {
|
|
1367
1370
|
var t;
|
|
1368
1371
|
return e === null ? "N/A" : (t = eo[e]) != null ? t : "";
|
|
1369
|
-
},
|
|
1372
|
+
}, No = ({
|
|
1370
1373
|
isLoading: e,
|
|
1371
1374
|
isOpen: t,
|
|
1372
1375
|
onClose: n,
|
|
@@ -1374,10 +1377,10 @@ const Ve = L(
|
|
|
1374
1377
|
applicationName: r,
|
|
1375
1378
|
handleLogout: s
|
|
1376
1379
|
}) => {
|
|
1377
|
-
const [
|
|
1378
|
-
|
|
1380
|
+
const [c, d] = V(St), [l, u] = F(c), { enqueueSuccessNotification: v } = Zn(), w = i.length === 0, A = !!c && !i.includes(c) && !i.includes(l), m = !c || w || A, S = () => z(void 0, null, function* () {
|
|
1381
|
+
l ? (d(l), v(`Set domain to ${l}`), n()) : d("");
|
|
1379
1382
|
}), k = () => z(void 0, null, function* () {
|
|
1380
|
-
|
|
1383
|
+
c && !w && !A ? (u(c), n()) : m && s();
|
|
1381
1384
|
});
|
|
1382
1385
|
let I;
|
|
1383
1386
|
return w ? I = "Unable to retrieve your active organisations. Try logging in again." : A && (I = "You no longer have any roles in your chosen organisation. Please choose another."), /* @__PURE__ */ p(
|
|
@@ -1388,7 +1391,7 @@ const Ve = L(
|
|
|
1388
1391
|
primaryButton: {
|
|
1389
1392
|
text: "Confirm",
|
|
1390
1393
|
onClick: S,
|
|
1391
|
-
disabled: !
|
|
1394
|
+
disabled: !l || w || A,
|
|
1392
1395
|
buttonColor: "primary"
|
|
1393
1396
|
},
|
|
1394
1397
|
secondaryButton: {
|
|
@@ -1409,7 +1412,7 @@ const Ve = L(
|
|
|
1409
1412
|
loading: e,
|
|
1410
1413
|
multiple: !1,
|
|
1411
1414
|
disableClearable: !1,
|
|
1412
|
-
value:
|
|
1415
|
+
value: l !== "" ? l : null,
|
|
1413
1416
|
onChange: (g, D) => u(D != null ? D : ""),
|
|
1414
1417
|
getOptionLabel: to,
|
|
1415
1418
|
options: [...i],
|
|
@@ -1605,11 +1608,11 @@ const Ve = L(
|
|
|
1605
1608
|
export {
|
|
1606
1609
|
fn as AgDialog,
|
|
1607
1610
|
Fo as AppLayout,
|
|
1608
|
-
|
|
1611
|
+
Po as AtomProvider,
|
|
1609
1612
|
yo as AuthGuard,
|
|
1610
1613
|
wt as Context,
|
|
1611
1614
|
be as ContextError,
|
|
1612
|
-
|
|
1615
|
+
No as DomainCodeDialog,
|
|
1613
1616
|
So as ExampleComponent,
|
|
1614
1617
|
Io as FetchAutocomplete,
|
|
1615
1618
|
oo as HydrateAtoms,
|