@fluxo-dev/shell 0.0.25 → 0.0.27

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/index.esm.js CHANGED
@@ -1,14 +1,14 @@
1
1
  import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
2
2
  import * as React from 'react';
3
- import React__default, { useState, Suspense, forwardRef, createElement as createElement$2, useEffect, createContext, useContext, useLayoutEffect, useRef, useCallback, useMemo, memo, isValidElement, cloneElement, useImperativeHandle, lazy } from 'react';
3
+ import React__default, { useState, Suspense, forwardRef, createElement as createElement$2, useEffect, useCallback, createContext, useContext, useLayoutEffect, useRef, useMemo, memo, isValidElement, cloneElement, useImperativeHandle, lazy } from 'react';
4
4
  import { useSelector, Provider } from 'react-redux';
5
- import { useLocation, Navigate, matchPath, Outlet, useNavigate, Link, Route, useSearchParams, createBrowserRouter, RouterProvider } from 'react-router-dom';
6
- import { FluxoClientSys, AppType, AppState, FluxoStateDispatcher, UserService, AppMenuContextType, ApiKeyService, DomainRoleService, EmailServerProviderType } from '@fluxo-dev/api-client-base';
7
- import { AccessDenied, DataCard, NoData, ConfirmModal, ShellPage, ErrorPage as ErrorPage$1, WaitData, FlxRoutes } from '@fluxo-dev/ui-components';
5
+ import { useLocation, Navigate, Outlet, useNavigate, Link, useOutlet, Route, useSearchParams, createBrowserRouter, RouterProvider } from 'react-router-dom';
6
+ import { DataCard, useFlxNavigate, NoData, ConfirmModal, ShellPage, ErrorPage as ErrorPage$1, WaitData, FlxRoutes } from '@fluxo-dev/ui-components';
8
7
  import { ModuleLoader } from '@fluxo-dev/shell-mfe';
9
- import { Text, TextInput, ActionIcon, useMantineTheme, AppShell, Stack, Group, Burger, Badge, Drawer, NavLink, Popover, Avatar, Center, Divider, Button, Anchor, Tooltip, Space, useMantineColorScheme, UnstyledButton, Box, ThemeIcon, Collapse, ScrollArea, rem, Loader, Grid, PasswordInput, ColorSwatch, FileButton, NumberInput, Alert, ColorInput, Checkbox, Modal, Switch, Select, Chip, LoadingOverlay, Image as Image$1, Menu, Textarea, Table, MultiSelect, Card, MantineProvider } from '@mantine/core';
8
+ import { Text, TextInput, ActionIcon, useMantineTheme, AppShell, Stack, Group, Burger, Badge, Drawer, NavLink, Popover, Avatar, Center, Divider, Button, Tabs, Anchor, Tooltip, Space, useMantineColorScheme, UnstyledButton, Box, ThemeIcon, Collapse, ScrollArea, rem, Loader, Grid, PasswordInput, ColorSwatch, FileButton, NumberInput, Alert, ColorInput, Checkbox, Modal, Switch, Select, Chip, LoadingOverlay, Image as Image$1, Menu, Textarea, Table, MultiSelect, Card, MantineProvider } from '@mantine/core';
10
9
  import { openSpotlight, Spotlight } from '@mantine/spotlight';
11
10
  import { useOs, useHotkeys, useIdle } from '@mantine/hooks';
11
+ import { AppType, AppState, FluxoStateDispatcher, FluxoClientSys, UserService, AppMenuContextType, ApiKeyService, DomainRoleService, EmailServerProviderType } from '@fluxo-dev/api-client-base';
12
12
  import { showNotification, Notifications } from '@mantine/notifications';
13
13
  import { useAppSelector, store as store$4 } from '@fluxo-dev/state';
14
14
  import { useForm } from '@mantine/form';
@@ -1133,17 +1133,78 @@ for (var COLLECTION_NAME in DOMIterables) {
1133
1133
  }
1134
1134
  }
1135
1135
 
1136
- var $$8 = _export;
1137
1136
  var DESCRIPTORS$3 = descriptors;
1137
+ var fails$5 = fails$c;
1138
+ var objectKeys = objectKeys$2;
1139
+ var getOwnPropertySymbolsModule = objectGetOwnPropertySymbols;
1140
+ var propertyIsEnumerableModule = objectPropertyIsEnumerable;
1141
+ var toObject$2 = toObject$4;
1142
+ var IndexedObject = indexedObject;
1143
+
1144
+ var nativeAssign = Object.assign;
1145
+ var defineProperty$2 = Object.defineProperty;
1146
+
1147
+ // `Object.assign` method
1148
+ // https://tc39.github.io/ecma262/#sec-object.assign
1149
+ var objectAssign$1 = !nativeAssign || fails$5(function () {
1150
+ // should have correct order of operations (Edge bug)
1151
+ if (DESCRIPTORS$3 && nativeAssign({ b: 1 }, nativeAssign(defineProperty$2({}, 'a', {
1152
+ enumerable: true,
1153
+ get: function () {
1154
+ defineProperty$2(this, 'b', {
1155
+ value: 3,
1156
+ enumerable: false
1157
+ });
1158
+ }
1159
+ }), { b: 2 })).b !== 1) return true;
1160
+ // should work with symbols and should have deterministic property order (V8 bug)
1161
+ var A = {};
1162
+ var B = {};
1163
+ // eslint-disable-next-line no-undef
1164
+ var symbol = Symbol();
1165
+ var alphabet = 'abcdefghijklmnopqrst';
1166
+ A[symbol] = 7;
1167
+ alphabet.split('').forEach(function (chr) { B[chr] = chr; });
1168
+ return nativeAssign({}, A)[symbol] != 7 || objectKeys(nativeAssign({}, B)).join('') != alphabet;
1169
+ }) ? function assign(target, source) { // eslint-disable-line no-unused-vars
1170
+ var T = toObject$2(target);
1171
+ var argumentsLength = arguments.length;
1172
+ var index = 1;
1173
+ var getOwnPropertySymbols = getOwnPropertySymbolsModule.f;
1174
+ var propertyIsEnumerable = propertyIsEnumerableModule.f;
1175
+ while (argumentsLength > index) {
1176
+ var S = IndexedObject(arguments[index++]);
1177
+ var keys = getOwnPropertySymbols ? objectKeys(S).concat(getOwnPropertySymbols(S)) : objectKeys(S);
1178
+ var length = keys.length;
1179
+ var j = 0;
1180
+ var key;
1181
+ while (length > j) {
1182
+ key = keys[j++];
1183
+ if (!DESCRIPTORS$3 || propertyIsEnumerable.call(S, key)) T[key] = S[key];
1184
+ }
1185
+ } return T;
1186
+ } : nativeAssign;
1187
+
1188
+ var $$8 = _export;
1189
+ var assign$1 = objectAssign$1;
1190
+
1191
+ // `Object.assign` method
1192
+ // https://tc39.github.io/ecma262/#sec-object.assign
1193
+ $$8({ target: 'Object', stat: true, forced: Object.assign !== assign$1 }, {
1194
+ assign: assign$1
1195
+ });
1196
+
1197
+ var $$7 = _export;
1198
+ var DESCRIPTORS$2 = descriptors;
1138
1199
  var global$9 = global$l;
1139
1200
  var has$4 = has$e;
1140
1201
  var isObject$5 = isObject$b;
1141
- var defineProperty$2 = objectDefineProperty.f;
1202
+ var defineProperty$1 = objectDefineProperty.f;
1142
1203
  var copyConstructorProperties = copyConstructorProperties$2;
1143
1204
 
1144
1205
  var NativeSymbol = global$9.Symbol;
1145
1206
 
1146
- if (DESCRIPTORS$3 && typeof NativeSymbol == 'function' && (!('description' in NativeSymbol.prototype) ||
1207
+ if (DESCRIPTORS$2 && typeof NativeSymbol == 'function' && (!('description' in NativeSymbol.prototype) ||
1147
1208
  // Safari 12 bug
1148
1209
  NativeSymbol().description !== undefined
1149
1210
  )) {
@@ -1163,20 +1224,20 @@ if (DESCRIPTORS$3 && typeof NativeSymbol == 'function' && (!('description' in Na
1163
1224
  symbolPrototype.constructor = SymbolWrapper;
1164
1225
 
1165
1226
  var symbolToString = symbolPrototype.toString;
1166
- var native = String(NativeSymbol('test')) == 'Symbol(test)';
1227
+ var native$1 = String(NativeSymbol('test')) == 'Symbol(test)';
1167
1228
  var regexp = /^Symbol\((.*)\)[^)]+$/;
1168
- defineProperty$2(symbolPrototype, 'description', {
1229
+ defineProperty$1(symbolPrototype, 'description', {
1169
1230
  configurable: true,
1170
1231
  get: function description() {
1171
1232
  var symbol = isObject$5(this) ? this.valueOf() : this;
1172
1233
  var string = symbolToString.call(symbol);
1173
1234
  if (has$4(EmptyStringDescriptionStore, symbol)) return '';
1174
- var desc = native ? string.slice(7, -1) : string.replace(regexp, '$1');
1235
+ var desc = native$1 ? string.slice(7, -1) : string.replace(regexp, '$1');
1175
1236
  return desc === '' ? undefined : desc;
1176
1237
  }
1177
1238
  });
1178
1239
 
1179
- $$8({ global: true, forced: true }, {
1240
+ $$7({ global: true, forced: true }, {
1180
1241
  Symbol: SymbolWrapper
1181
1242
  });
1182
1243
  }
@@ -1195,7 +1256,7 @@ var redefineAll$1 = function (target, src, options) {
1195
1256
  var getBuiltIn$3 = getBuiltIn$6;
1196
1257
  var definePropertyModule = objectDefineProperty;
1197
1258
  var wellKnownSymbol$a = wellKnownSymbol$g;
1198
- var DESCRIPTORS$2 = descriptors;
1259
+ var DESCRIPTORS$1 = descriptors;
1199
1260
 
1200
1261
  var SPECIES$3 = wellKnownSymbol$a('species');
1201
1262
 
@@ -1203,7 +1264,7 @@ var setSpecies$1 = function (CONSTRUCTOR_NAME) {
1203
1264
  var Constructor = getBuiltIn$3(CONSTRUCTOR_NAME);
1204
1265
  var defineProperty = definePropertyModule.f;
1205
1266
 
1206
- if (DESCRIPTORS$2 && Constructor && !Constructor[SPECIES$3]) {
1267
+ if (DESCRIPTORS$1 && Constructor && !Constructor[SPECIES$3]) {
1207
1268
  defineProperty(Constructor, SPECIES$3, {
1208
1269
  configurable: true,
1209
1270
  get: function () { return this; }
@@ -1429,7 +1490,7 @@ var userAgent$1 = engineUserAgent;
1429
1490
  var engineIsIos = /(iphone|ipod|ipad).*applewebkit/i.test(userAgent$1);
1430
1491
 
1431
1492
  var global$7 = global$l;
1432
- var fails$5 = fails$c;
1493
+ var fails$4 = fails$c;
1433
1494
  var classof$4 = classofRaw$1;
1434
1495
  var bind$2 = functionBindContext;
1435
1496
  var html = html$2;
@@ -1510,7 +1571,7 @@ if (!set || !clear) {
1510
1571
  global$7.addEventListener &&
1511
1572
  typeof postMessage == 'function' &&
1512
1573
  !global$7.importScripts &&
1513
- !fails$5(post) &&
1574
+ !fails$4(post) &&
1514
1575
  location.protocol !== 'file:'
1515
1576
  ) {
1516
1577
  defer = post;
@@ -1686,7 +1747,7 @@ if (v8) {
1686
1747
 
1687
1748
  var engineV8Version = version && +version;
1688
1749
 
1689
- var $$7 = _export;
1750
+ var $$6 = _export;
1690
1751
  var global$3 = global$l;
1691
1752
  var getBuiltIn$1 = getBuiltIn$6;
1692
1753
  var NativePromise$1 = nativePromiseConstructor;
@@ -1978,7 +2039,7 @@ if (FORCED$1) {
1978
2039
  }, { unsafe: true });
1979
2040
 
1980
2041
  // wrap fetch result
1981
- if (typeof $fetch == 'function') $$7({ global: true, enumerable: true, forced: true }, {
2042
+ if (typeof $fetch == 'function') $$6({ global: true, enumerable: true, forced: true }, {
1982
2043
  // eslint-disable-next-line no-unused-vars
1983
2044
  fetch: function fetch(input /* , init */) {
1984
2045
  return promiseResolve$1(PromiseConstructor, $fetch.apply(global$3, arguments));
@@ -1987,7 +2048,7 @@ if (FORCED$1) {
1987
2048
  }
1988
2049
  }
1989
2050
 
1990
- $$7({ global: true, wrap: true, forced: FORCED$1 }, {
2051
+ $$6({ global: true, wrap: true, forced: FORCED$1 }, {
1991
2052
  Promise: PromiseConstructor
1992
2053
  });
1993
2054
 
@@ -1997,7 +2058,7 @@ setSpecies(PROMISE);
1997
2058
  PromiseWrapper = getBuiltIn$1(PROMISE);
1998
2059
 
1999
2060
  // statics
2000
- $$7({ target: PROMISE, stat: true, forced: FORCED$1 }, {
2061
+ $$6({ target: PROMISE, stat: true, forced: FORCED$1 }, {
2001
2062
  // `Promise.reject` method
2002
2063
  // https://tc39.github.io/ecma262/#sec-promise.reject
2003
2064
  reject: function reject(r) {
@@ -2007,7 +2068,7 @@ $$7({ target: PROMISE, stat: true, forced: FORCED$1 }, {
2007
2068
  }
2008
2069
  });
2009
2070
 
2010
- $$7({ target: PROMISE, stat: true, forced: FORCED$1 }, {
2071
+ $$6({ target: PROMISE, stat: true, forced: FORCED$1 }, {
2011
2072
  // `Promise.resolve` method
2012
2073
  // https://tc39.github.io/ecma262/#sec-promise.resolve
2013
2074
  resolve: function resolve(x) {
@@ -2015,7 +2076,7 @@ $$7({ target: PROMISE, stat: true, forced: FORCED$1 }, {
2015
2076
  }
2016
2077
  });
2017
2078
 
2018
- $$7({ target: PROMISE, stat: true, forced: INCORRECT_ITERATION }, {
2079
+ $$6({ target: PROMISE, stat: true, forced: INCORRECT_ITERATION }, {
2019
2080
  // `Promise.all` method
2020
2081
  // https://tc39.github.io/ecma262/#sec-promise.all
2021
2082
  all: function all(iterable) {
@@ -2062,22 +2123,22 @@ $$7({ target: PROMISE, stat: true, forced: INCORRECT_ITERATION }, {
2062
2123
  }
2063
2124
  });
2064
2125
 
2065
- var $$6 = _export;
2126
+ var $$5 = _export;
2066
2127
  var NativePromise = nativePromiseConstructor;
2067
- var fails$4 = fails$c;
2128
+ var fails$3 = fails$c;
2068
2129
  var getBuiltIn = getBuiltIn$6;
2069
2130
  var speciesConstructor = speciesConstructor$2;
2070
2131
  var promiseResolve = promiseResolve$2;
2071
2132
  var redefine$1 = redefine$6.exports;
2072
2133
 
2073
2134
  // Safari bug https://bugs.webkit.org/show_bug.cgi?id=200829
2074
- var NON_GENERIC = !!NativePromise && fails$4(function () {
2135
+ var NON_GENERIC = !!NativePromise && fails$3(function () {
2075
2136
  NativePromise.prototype['finally'].call({ then: function () { /* empty */ } }, function () { /* empty */ });
2076
2137
  });
2077
2138
 
2078
2139
  // `Promise.prototype.finally` method
2079
2140
  // https://tc39.github.io/ecma262/#sec-promise.prototype.finally
2080
- $$6({ target: 'Promise', proto: true, real: true, forced: NON_GENERIC }, {
2141
+ $$5({ target: 'Promise', proto: true, real: true, forced: NON_GENERIC }, {
2081
2142
  'finally': function (onFinally) {
2082
2143
  var C = speciesConstructor(this, getBuiltIn('Promise'));
2083
2144
  var isFunction = typeof onFinally == 'function';
@@ -2214,36 +2275,13 @@ function ProtectedRoute(_a) {
2214
2275
  const {
2215
2276
  loggedIn
2216
2277
  } = useSelector(state => state.user);
2217
- const {
2218
- routeRules
2219
- } = useSelector(state => state.routeRules);
2220
- const navigation = useLocation();
2278
+ useLocation();
2221
2279
  if (!loggedIn) {
2222
2280
  return jsx(Navigate, {
2223
2281
  to: "/auth/login",
2224
2282
  replace: true
2225
2283
  });
2226
2284
  }
2227
- let accessDenied = false;
2228
- let requiredPermissions = [];
2229
- routeRules.forEach(routeRule => {
2230
- const match = matchPath(`${routeRule.route}`, navigation.pathname);
2231
- if (match) {
2232
- if (routeRule.permissions.length === 0) {
2233
- return;
2234
- } else {
2235
- const res = FluxoClientSys.Instance.security.currentUser.hasPermissions(routeRule.permissions);
2236
- if (!res) {
2237
- accessDenied = true;
2238
- requiredPermissions = routeRule.permissions;
2239
- return;
2240
- }
2241
- }
2242
- }
2243
- });
2244
- if (accessDenied) return jsx(AccessDenied, {
2245
- requiredPermissions: requiredPermissions
2246
- });
2247
2285
  return children;
2248
2286
  }
2249
2287
 
@@ -2501,7 +2539,7 @@ var getOwnPropertySymbols = Object.getOwnPropertySymbols;
2501
2539
  var hasOwnProperty = Object.prototype.hasOwnProperty;
2502
2540
  var propIsEnumerable = Object.prototype.propertyIsEnumerable;
2503
2541
 
2504
- function toObject$2(val) {
2542
+ function toObject$1(val) {
2505
2543
  if (val === null || val === undefined) {
2506
2544
  throw new TypeError('Object.assign cannot be called with null or undefined');
2507
2545
  }
@@ -2553,9 +2591,9 @@ function shouldUseNative() {
2553
2591
  }
2554
2592
  }
2555
2593
 
2556
- var objectAssign$1 = shouldUseNative() ? Object.assign : function (target, source) {
2594
+ var objectAssign = shouldUseNative() ? Object.assign : function (target, source) {
2557
2595
  var from;
2558
- var to = toObject$2(target);
2596
+ var to = toObject$1(target);
2559
2597
  var symbols;
2560
2598
 
2561
2599
  for (var s = 1; s < arguments.length; s++) {
@@ -2703,7 +2741,7 @@ var checkPropTypes_1 = checkPropTypes$1;
2703
2741
  */
2704
2742
 
2705
2743
  var ReactIs$1 = reactIs.exports;
2706
- var assign$1 = objectAssign$1;
2744
+ var assign = objectAssign;
2707
2745
 
2708
2746
  var ReactPropTypesSecret$1 = ReactPropTypesSecret_1;
2709
2747
  var has$1 = has$3;
@@ -3142,7 +3180,7 @@ var factoryWithTypeCheckers = function(isValidElement, throwOnDirectAccess) {
3142
3180
  return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
3143
3181
  }
3144
3182
  // We need to check all keys in case some are required but missing from props.
3145
- var allKeys = assign$1({}, props[propName], shapeTypes);
3183
+ var allKeys = assign({}, props[propName], shapeTypes);
3146
3184
  for (var key in allKeys) {
3147
3185
  var checker = shapeTypes[key];
3148
3186
  if (has$1(shapeTypes, key) && typeof checker !== 'function') {
@@ -4078,22 +4116,6 @@ var IconReportSearch = createReactComponent("report-search", "IconReportSearch",
4078
4116
  ["path", { d: "M18.5 19.5l2.5 2.5", key: "svg-6" }]
4079
4117
  ]);
4080
4118
 
4081
- /**
4082
- * @tabler/icons-react v2.42.0 - MIT
4083
- */
4084
-
4085
- var IconRoute = createReactComponent("route", "IconRoute", [
4086
- ["path", { d: "M3 19a2 2 0 1 0 4 0a2 2 0 0 0 -4 0", key: "svg-0" }],
4087
- ["path", { d: "M19 7a2 2 0 1 0 0 -4a2 2 0 0 0 0 4z", key: "svg-1" }],
4088
- [
4089
- "path",
4090
- {
4091
- d: "M11 19h5.5a3.5 3.5 0 0 0 0 -7h-8a3.5 3.5 0 0 1 0 -7h4.5",
4092
- key: "svg-2"
4093
- }
4094
- ]
4095
- ]);
4096
-
4097
4119
  /**
4098
4120
  * @tabler/icons-react v2.42.0 - MIT
4099
4121
  */
@@ -4564,8 +4586,310 @@ function AppBar(props) {
4564
4586
  });
4565
4587
  }
4566
4588
 
4567
- function AppContent() {
4568
- return jsx(Outlet, {});
4589
+ // Unique ID creation requires a high quality random # generator. In the browser we therefore
4590
+ // require the crypto API and do not support built-in fallback to lower quality random number
4591
+ // generators (like Math.random()).
4592
+ let getRandomValues;
4593
+ const rnds8 = new Uint8Array(16);
4594
+ function rng() {
4595
+ // lazy load so that environments that need to polyfill have a chance to do so
4596
+ if (!getRandomValues) {
4597
+ // getRandomValues needs to be invoked in a context where "this" is a Crypto implementation.
4598
+ getRandomValues = typeof crypto !== 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto);
4599
+
4600
+ if (!getRandomValues) {
4601
+ throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported');
4602
+ }
4603
+ }
4604
+
4605
+ return getRandomValues(rnds8);
4606
+ }
4607
+
4608
+ /**
4609
+ * Convert array of 16 byte values to UUID string format of the form:
4610
+ * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
4611
+ */
4612
+
4613
+ const byteToHex = [];
4614
+
4615
+ for (let i = 0; i < 256; ++i) {
4616
+ byteToHex.push((i + 0x100).toString(16).slice(1));
4617
+ }
4618
+
4619
+ function unsafeStringify(arr, offset = 0) {
4620
+ // Note: Be careful editing this code! It's been tuned for performance
4621
+ // and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434
4622
+ return (byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + '-' + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + '-' + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + '-' + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + '-' + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]).toLowerCase();
4623
+ }
4624
+
4625
+ const randomUUID = typeof crypto !== 'undefined' && crypto.randomUUID && crypto.randomUUID.bind(crypto);
4626
+ var native = {
4627
+ randomUUID
4628
+ };
4629
+
4630
+ function v4(options, buf, offset) {
4631
+ if (native.randomUUID && !buf && !options) {
4632
+ return native.randomUUID();
4633
+ }
4634
+
4635
+ options = options || {};
4636
+ const rnds = options.random || (options.rng || rng)(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`
4637
+
4638
+ rnds[6] = rnds[6] & 0x0f | 0x40;
4639
+ rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided
4640
+
4641
+ if (buf) {
4642
+ offset = offset || 0;
4643
+
4644
+ for (let i = 0; i < 16; ++i) {
4645
+ buf[offset + i] = rnds[i];
4646
+ }
4647
+
4648
+ return buf;
4649
+ }
4650
+
4651
+ return unsafeStringify(rnds);
4652
+ }
4653
+
4654
+ class ShellSessionCollection {
4655
+ constructor(sessions = [], currentSessionId) {
4656
+ this._sessions = sessions;
4657
+ this._currentSessionId = currentSessionId;
4658
+ }
4659
+ get currentSession() {
4660
+ return this._currentSessionId ? this.getSession(this._currentSessionId) : null;
4661
+ }
4662
+ addSession(title, element, url) {
4663
+ const session = new ShellSession(title, element, url);
4664
+ this._sessions.push(session);
4665
+ return session;
4666
+ }
4667
+ removeSession(id) {
4668
+ this._sessions = this._sessions.filter(s => s.id !== id);
4669
+ }
4670
+ getSession(id) {
4671
+ return this._sessions.find(s => s.id === id);
4672
+ }
4673
+ get sessions() {
4674
+ return this._sessions;
4675
+ }
4676
+ getCurrentSessionId() {
4677
+ return this._currentSessionId;
4678
+ }
4679
+ getCurrentSession() {
4680
+ return this.getSession(this._currentSessionId);
4681
+ }
4682
+ setCurrentSession(id) {
4683
+ this._currentSessionId = id;
4684
+ }
4685
+ updateSession(id, title, element, url) {
4686
+ const session = this.getSession(id);
4687
+ if (session) {
4688
+ session.updateSession(title, element, url);
4689
+ }
4690
+ }
4691
+ getPreviuosSessionId() {
4692
+ const index = this._sessions.findIndex(s => s.id === this._currentSessionId);
4693
+ if (index > 0) {
4694
+ return this._sessions[index - 1].id;
4695
+ }
4696
+ return this._sessions[this._sessions.length - 1].id;
4697
+ }
4698
+ getNextSessionId() {
4699
+ const index = this._sessions.findIndex(s => s.id === this._currentSessionId);
4700
+ if (index < this._sessions.length - 1) {
4701
+ return this._sessions[index + 1].id;
4702
+ }
4703
+ return this._sessions[0].id;
4704
+ }
4705
+ }
4706
+ class ShellSession {
4707
+ constructor(title, element, url) {
4708
+ this._id = v4();
4709
+ this._title = title;
4710
+ this._element = element;
4711
+ this._url = url;
4712
+ }
4713
+ get id() {
4714
+ return this._id;
4715
+ }
4716
+ get title() {
4717
+ return this._title;
4718
+ }
4719
+ get element() {
4720
+ return this._element;
4721
+ }
4722
+ get url() {
4723
+ return this._url;
4724
+ }
4725
+ updateSession(title, element, url) {
4726
+ this._title = title;
4727
+ this._element = element;
4728
+ this._url = url;
4729
+ }
4730
+ }
4731
+
4732
+ const defaultState = {
4733
+ addSession: () => '',
4734
+ removeSession: () => {},
4735
+ getSession: () => {},
4736
+ sessions: () => [],
4737
+ updateSession: () => {},
4738
+ getCurrentSessionId: () => null,
4739
+ getCurrentSession: () => null,
4740
+ setCurrentSession: () => {},
4741
+ isCurrentSessionDisableable: () => false
4742
+ };
4743
+ const ShellSessionContext = /*#__PURE__*/React__default.createContext(defaultState);
4744
+ function ShellSessionProvider(props) {
4745
+ useHotkeys([['shift+s', () => {
4746
+ addSession(`Dashboard`, null, '/');
4747
+ }]]);
4748
+ useHotkeys([['shift+x', () => {
4749
+ removeSession(getCurrentSessionId());
4750
+ }]], [], true);
4751
+ useHotkeys([['shift+ArrowLeft', () => {
4752
+ setCurrentSession(sessionCollection.getPreviuosSessionId());
4753
+ }]], [], true);
4754
+ useHotkeys([['shift+ArrowRight', () => {
4755
+ setCurrentSession(sessionCollection.getNextSessionId());
4756
+ }]], [], true);
4757
+ const [sessionCollection, setSessionCollection] = React__default.useState(new ShellSessionCollection([], null));
4758
+ const navigate = useFlxNavigate();
4759
+ const addSession = useCallback((title, element, url) => {
4760
+ const cloned = new ShellSessionCollection(sessionCollection.sessions, sessionCollection.getCurrentSessionId());
4761
+ const s = cloned.addSession(title, element, url);
4762
+ cloned.setCurrentSession(s.id);
4763
+ setSessionCollection(cloned);
4764
+ navigate(s.url, {
4765
+ state: {
4766
+ title: title
4767
+ }
4768
+ });
4769
+ return s.id;
4770
+ }, [sessionCollection]);
4771
+ const removeSession = useCallback(id => {
4772
+ if (!isCurrentSessionDisableable()) return;
4773
+ const cloned = new ShellSessionCollection(sessionCollection.sessions, sessionCollection.getCurrentSessionId());
4774
+ cloned.removeSession(id);
4775
+ cloned.setCurrentSession(cloned.sessions[cloned.sessions.length - 1].id);
4776
+ setSessionCollection(cloned);
4777
+ }, [sessionCollection]);
4778
+ const getSession = useCallback(id => {
4779
+ return sessionCollection.getSession(id);
4780
+ }, [sessionCollection]);
4781
+ const sessions = useCallback(() => {
4782
+ return sessionCollection.sessions;
4783
+ }, [sessionCollection]);
4784
+ const updateSession = useCallback((id, title, element, url) => {
4785
+ const cloned = new ShellSessionCollection(sessionCollection.sessions, sessionCollection.getCurrentSessionId());
4786
+ cloned.updateSession(id, title, element, url);
4787
+ setSessionCollection(cloned);
4788
+ }, [sessionCollection]);
4789
+ const setCurrentSession = useCallback(id => {
4790
+ const cloned = new ShellSessionCollection(sessionCollection.sessions, id);
4791
+ cloned.setCurrentSession(id);
4792
+ setSessionCollection(cloned);
4793
+ navigate(cloned.getCurrentSession().url, {
4794
+ state: {
4795
+ title: cloned.getCurrentSession().title
4796
+ }
4797
+ });
4798
+ }, [sessionCollection]);
4799
+ const getCurrentSessionId = useCallback(() => {
4800
+ return sessionCollection.getCurrentSessionId();
4801
+ }, [sessionCollection]);
4802
+ const getCurrentSession = useCallback(() => {
4803
+ return sessionCollection.getCurrentSession();
4804
+ }, [sessionCollection]);
4805
+ const isCurrentSessionDisableable = useCallback(() => {
4806
+ return sessionCollection.sessions.length > 1;
4807
+ }, [sessionCollection]);
4808
+ return jsx(ShellSessionContext.Provider, {
4809
+ value: {
4810
+ sessions: sessions,
4811
+ addSession: addSession,
4812
+ removeSession: removeSession,
4813
+ getSession: getSession,
4814
+ updateSession: updateSession,
4815
+ getCurrentSessionId: getCurrentSessionId,
4816
+ getCurrentSession: getCurrentSession,
4817
+ setCurrentSession: setCurrentSession,
4818
+ isCurrentSessionDisableable: isCurrentSessionDisableable
4819
+ },
4820
+ children: props.children
4821
+ });
4822
+ }
4823
+
4824
+ function AppContent(props) {
4825
+ const sessionContext = React__default.useContext(ShellSessionContext);
4826
+ useEffect(() => {
4827
+ if (props.withMultipleSessions) {
4828
+ const newSessionId = sessionContext.addSession('Dashboard', null, '/');
4829
+ sessionContext.setCurrentSession(newSessionId);
4830
+ }
4831
+ }, []);
4832
+ const outletContext = useOutlet();
4833
+ const location = useLocation();
4834
+ useEffect(() => {
4835
+ var _a, _b;
4836
+ if (props.withMultipleSessions) {
4837
+ const currentSession = sessionContext.getCurrentSession();
4838
+ if (currentSession) {
4839
+ sessionContext.updateSession(currentSession.id, (_b = (_a = location.state) === null || _a === void 0 ? void 0 : _a.title) !== null && _b !== void 0 ? _b : 'Sessione', outletContext, location.pathname);
4840
+ }
4841
+ }
4842
+ }, [location]);
4843
+ return jsx(Fragment, {
4844
+ children: props.withMultipleSessions ? jsxs(Tabs, {
4845
+ value: sessionContext.getCurrentSessionId(),
4846
+ keepMounted: true,
4847
+ children: [jsxs(Tabs.List, {
4848
+ style: {
4849
+ alignItems: 'center',
4850
+ position: 'sticky',
4851
+ width: '100%',
4852
+ overflowAnchor: 'none',
4853
+ top: 48,
4854
+ zIndex: 50,
4855
+ marginBottom: 0,
4856
+ background: '#fff'
4857
+ },
4858
+ children: [sessionContext.sessions().map((session, i) => {
4859
+ return jsx(Tabs.Tab, {
4860
+ style: {
4861
+ borderTop: '2px solid #ececec'
4862
+ },
4863
+ value: session.id,
4864
+ onClick: v => {
4865
+ sessionContext.setCurrentSession(session.id);
4866
+ },
4867
+ children: session.title
4868
+ }, session.id);
4869
+ }), jsxs(Group, {
4870
+ ml: 'auto',
4871
+ children: [jsx(ActionIcon, {
4872
+ disabled: !sessionContext.isCurrentSessionDisableable(),
4873
+ onClick: () => sessionContext.removeSession(sessionContext.getCurrentSessionId()),
4874
+ children: jsx(IconX, {
4875
+ size: 18
4876
+ })
4877
+ }), jsx(ActionIcon, {
4878
+ onClick: () => sessionContext.addSession("Test", null, "/"),
4879
+ ml: 'auto',
4880
+ children: jsx(IconPlus, {
4881
+ size: 18
4882
+ })
4883
+ })]
4884
+ })]
4885
+ }), sessionContext.sessions().map(session => {
4886
+ return jsx(Tabs.Panel, {
4887
+ value: session.id,
4888
+ children: session.element
4889
+ }, session.id);
4890
+ })]
4891
+ }) : jsx(Outlet, {})
4892
+ });
4569
4893
  }
4570
4894
 
4571
4895
  function FooterBar(props) {
@@ -4646,6 +4970,9 @@ function FooterBar(props) {
4646
4970
  children: [hasAdminAccess && jsxs(Fragment, {
4647
4971
  children: [jsx(Link, {
4648
4972
  to: '/settings',
4973
+ state: {
4974
+ title: 'Amministrazione'
4975
+ },
4649
4976
  style: {
4650
4977
  textDecoration: 'none'
4651
4978
  },
@@ -4726,6 +5053,9 @@ function NavBarItem({
4726
5053
  color: colorScheme.colorScheme === 'dark' ? theme.colors.dark[0] : theme.colors.gray[7],
4727
5054
  borderLeft: `1px solid ${colorScheme.colorScheme === 'dark' ? theme.colors.dark[4] : theme.colors.gray[3]}`
4728
5055
  },
5056
+ state: {
5057
+ title: link.label
5058
+ },
4729
5059
  to: '/' + link.routerLink,
4730
5060
  children: link.label
4731
5061
  }, link.label + '_' + i);
@@ -4735,7 +5065,11 @@ function NavBarItem({
4735
5065
  children: navbarOpened ? jsxs(Fragment, {
4736
5066
  children: [jsx(UnstyledButton, {
4737
5067
  onClick: () => {
4738
- if (hasLinks) setOpened(o => !o);else navigate('/' + routerLink);
5068
+ if (hasLinks) setOpened(o => !o);else navigate('/' + routerLink, {
5069
+ state: {
5070
+ title: label
5071
+ }
5072
+ });
4739
5073
  },
4740
5074
  className: level === 0 ? style['control'] : style['controlSub'],
4741
5075
  children: jsxs(Group, {
@@ -4874,67 +5208,6 @@ function Navbar() {
4874
5208
  });
4875
5209
  }
4876
5210
 
4877
- var DESCRIPTORS$1 = descriptors;
4878
- var fails$3 = fails$c;
4879
- var objectKeys = objectKeys$2;
4880
- var getOwnPropertySymbolsModule = objectGetOwnPropertySymbols;
4881
- var propertyIsEnumerableModule = objectPropertyIsEnumerable;
4882
- var toObject$1 = toObject$4;
4883
- var IndexedObject = indexedObject;
4884
-
4885
- var nativeAssign = Object.assign;
4886
- var defineProperty$1 = Object.defineProperty;
4887
-
4888
- // `Object.assign` method
4889
- // https://tc39.github.io/ecma262/#sec-object.assign
4890
- var objectAssign = !nativeAssign || fails$3(function () {
4891
- // should have correct order of operations (Edge bug)
4892
- if (DESCRIPTORS$1 && nativeAssign({ b: 1 }, nativeAssign(defineProperty$1({}, 'a', {
4893
- enumerable: true,
4894
- get: function () {
4895
- defineProperty$1(this, 'b', {
4896
- value: 3,
4897
- enumerable: false
4898
- });
4899
- }
4900
- }), { b: 2 })).b !== 1) return true;
4901
- // should work with symbols and should have deterministic property order (V8 bug)
4902
- var A = {};
4903
- var B = {};
4904
- // eslint-disable-next-line no-undef
4905
- var symbol = Symbol();
4906
- var alphabet = 'abcdefghijklmnopqrst';
4907
- A[symbol] = 7;
4908
- alphabet.split('').forEach(function (chr) { B[chr] = chr; });
4909
- return nativeAssign({}, A)[symbol] != 7 || objectKeys(nativeAssign({}, B)).join('') != alphabet;
4910
- }) ? function assign(target, source) { // eslint-disable-line no-unused-vars
4911
- var T = toObject$1(target);
4912
- var argumentsLength = arguments.length;
4913
- var index = 1;
4914
- var getOwnPropertySymbols = getOwnPropertySymbolsModule.f;
4915
- var propertyIsEnumerable = propertyIsEnumerableModule.f;
4916
- while (argumentsLength > index) {
4917
- var S = IndexedObject(arguments[index++]);
4918
- var keys = getOwnPropertySymbols ? objectKeys(S).concat(getOwnPropertySymbols(S)) : objectKeys(S);
4919
- var length = keys.length;
4920
- var j = 0;
4921
- var key;
4922
- while (length > j) {
4923
- key = keys[j++];
4924
- if (!DESCRIPTORS$1 || propertyIsEnumerable.call(S, key)) T[key] = S[key];
4925
- }
4926
- } return T;
4927
- } : nativeAssign;
4928
-
4929
- var $$5 = _export;
4930
- var assign = objectAssign;
4931
-
4932
- // `Object.assign` method
4933
- // https://tc39.github.io/ecma262/#sec-object.assign
4934
- $$5({ target: 'Object', stat: true, forced: Object.assign !== assign }, {
4935
- assign: assign
4936
- });
4937
-
4938
5211
  class AppMenuService {
4939
5212
  getSpotlightMenu(menu, parentTitle) {
4940
5213
  return __awaiter(this, void 0, void 0, function* () {
@@ -4979,7 +5252,11 @@ function ShellSpotlight() {
4979
5252
  return Object.assign(Object.assign({}, group), {
4980
5253
  actions: group.actions.map(action => {
4981
5254
  return Object.assign(Object.assign({}, action), {
4982
- onClick: () => navigateTo(action.id)
5255
+ onClick: () => navigateTo(action.id, {
5256
+ state: {
5257
+ title: action.label
5258
+ }
5259
+ })
4983
5260
  });
4984
5261
  })
4985
5262
  });
@@ -5011,7 +5288,7 @@ function AppLayout(props) {
5011
5288
  const {
5012
5289
  navbarOpened
5013
5290
  } = useSelector(state => state.layout);
5014
- return jsxs(Fragment, {
5291
+ return jsxs(ShellSessionProvider, {
5015
5292
  children: [jsxs(AppShell, {
5016
5293
  padding: 0,
5017
5294
  styles: {
@@ -5040,7 +5317,9 @@ function AppLayout(props) {
5040
5317
  }), jsx(Navbar, {}), jsx(AppShell.Main, {
5041
5318
  children: jsx(Suspense, {
5042
5319
  fallback: jsx(Loader, {}),
5043
- children: jsx(AppContent, {})
5320
+ children: jsx(AppContent, {
5321
+ withMultipleSessions: props.withMultipleSessions
5322
+ })
5044
5323
  })
5045
5324
  }), jsx(AppShell.Footer, {
5046
5325
  children: jsx(FooterBar, {
@@ -20274,11 +20553,6 @@ function PermissionNavigator(props) {
20274
20553
  setDomainRolePermissions(res);
20275
20554
  setDomainRolePermissionLoaded(true);
20276
20555
  });
20277
- } else {
20278
- FluxoClientSys.Instance.security.routeRule.getPermissions(props.context.id).then(res => {
20279
- setDomainRolePermissions(res);
20280
- setDomainRolePermissionLoaded(true);
20281
- });
20282
20556
  }
20283
20557
  }, []);
20284
20558
  useEffect(() => {
@@ -20292,41 +20566,6 @@ function PermissionNavigator(props) {
20292
20566
  addOrRemovePermissionForDomainRole(permissionId);
20293
20567
  } else if (props.context.type === 'menu') {
20294
20568
  addOrRemovePermissionForMenu(permissionId);
20295
- } else if (props.context.type === 'route-rule') {
20296
- addOrRemovePermissionForRouteRule(permissionId);
20297
- }
20298
- };
20299
- const addOrRemovePermissionForRouteRule = menuItemId => {
20300
- if (selectedPermissionsIds.includes(menuItemId)) {
20301
- FluxoClientSys.Instance.security.routeRule.removePermission(+props.context.id, menuItemId).then(res => {
20302
- setSelectedPermissionsIds(selectedPermissionsIds.filter(p => p !== menuItemId));
20303
- showNotification({
20304
- title: "Permesso rimosso",
20305
- message: "Il permesso è stato rimosso correttamente",
20306
- color: "green"
20307
- });
20308
- }).catch(err => {
20309
- showNotification({
20310
- title: "Errore",
20311
- message: "Si è verificato un errore durante la rimozione del permesso",
20312
- color: "red"
20313
- });
20314
- });
20315
- } else {
20316
- FluxoClientSys.Instance.security.routeRule.addPermission(+props.context.id, menuItemId).then(res => {
20317
- setSelectedPermissionsIds([...selectedPermissionsIds, menuItemId]);
20318
- showNotification({
20319
- title: "Permesso aggiunto",
20320
- message: "Il permesso è stato aggiunto correttamente",
20321
- color: "green"
20322
- });
20323
- }).catch(err => {
20324
- showNotification({
20325
- title: "Errore",
20326
- message: "Si è verificato un errore durante l'aggiunta del permesso",
20327
- color: "red"
20328
- });
20329
- });
20330
20569
  }
20331
20570
  };
20332
20571
  const addOrRemovePermissionForMenu = menuItemId => {
@@ -29260,282 +29499,6 @@ function UsersGrid() {
29260
29499
  });
29261
29500
  }
29262
29501
 
29263
- function RouteRuleCreateForm(props) {
29264
- const [identifier, setIdentifier] = useState('');
29265
- const createRouteRule = () => {
29266
- if (!identifier) return;
29267
- const command = {
29268
- scope: props.scope,
29269
- packageName: props.packageName,
29270
- route: identifier
29271
- };
29272
- FluxoClientSys.Instance.security.routeRule.create(command).then(() => {
29273
- showNotification({
29274
- title: 'Regola creata',
29275
- message: `La regola ${props.scope}.${props.packageName}.${identifier} è stato creata con successo.`,
29276
- color: 'green'
29277
- });
29278
- props.onCreated();
29279
- }).catch(() => {
29280
- showNotification({
29281
- title: 'Errore',
29282
- message: `Si è verificato un errore durante la creazione della regola ${props.scope}.${props.packageName}.${identifier}.`,
29283
- color: 'red'
29284
- });
29285
- });
29286
- };
29287
- return jsxs(Stack, {
29288
- children: [jsx(TextInput, {
29289
- label: "Identificatore",
29290
- placeholder: 'Es: create',
29291
- required: true,
29292
- onChange: v => setIdentifier(v.target.value)
29293
- }), jsxs("p", {
29294
- children: ["Rotta: ", `${props.scope}/${props.packageName}/${identifier}`]
29295
- }), jsx(Divider, {}), jsxs(Group, {
29296
- justify: 'right',
29297
- children: [jsx(Button, {
29298
- variant: 'subtle',
29299
- onClick: props.onCanceled,
29300
- children: "Annulla"
29301
- }), jsx(Button, {
29302
- disabled: !identifier,
29303
- onClick: createRouteRule,
29304
- children: "Salva"
29305
- })]
29306
- })]
29307
- });
29308
- }
29309
-
29310
- function RouteRuleGrid() {
29311
- const [permissionScopes, setPermissionScopes] = useState([]);
29312
- const [permissionScopesLoaded, setPermissionScopesLoaded] = useState(false);
29313
- const [currentScope, setCurrentScope] = useState(null);
29314
- const [currentPackageName, setCurrentPackageName] = useState(null);
29315
- const [routeRules, setRouteRules] = useState([]);
29316
- const [permissionLoading, setPermissionLoading] = useState(false);
29317
- const [currentRouteRule, setCurrentRouteRule] = useState();
29318
- const [managePermissionModalOpened, setManagePermissionModalOpened] = useState(false);
29319
- const [createRouteRuleModalOpened, setCreateRouteRuleModalOpened] = useState(false);
29320
- useEffect(() => {
29321
- loadPermissionScopes();
29322
- }, []);
29323
- useEffect(() => {
29324
- if (currentScope && currentPackageName) getRouteRulesForScope();else setRouteRules([]);
29325
- }, [currentScope, currentPackageName]);
29326
- const getRouteRulesForScope = () => {
29327
- if (!currentScope || !currentPackageName) {
29328
- return;
29329
- }
29330
- setPermissionLoading(true);
29331
- FluxoClientSys.Instance.security.routeRule.getRouteRulesForScope(currentScope, currentPackageName).then(res => {
29332
- setRouteRules(res);
29333
- setPermissionLoading(false);
29334
- });
29335
- };
29336
- const loadPermissionScopes = () => {
29337
- FluxoClientSys.Instance.security.permission.getPermissionScopes().then(res => {
29338
- setPermissionScopes(res);
29339
- setPermissionScopesLoaded(true);
29340
- });
29341
- };
29342
- const deleteRouteRule = routeRule => {
29343
- FluxoClientSys.Instance.security.routeRule.delete(routeRule.id.toString()).then(() => {
29344
- showNotification({
29345
- title: 'Regola eliminata',
29346
- message: `La regola ${routeRule.scope}.${routeRule.packageName}.${routeRule.route} è stato eliminata con successo.`,
29347
- color: 'green'
29348
- });
29349
- getRouteRulesForScope();
29350
- }).catch(() => {
29351
- showNotification({
29352
- title: 'Errore',
29353
- message: `Si è verificato un errore durante l'eliminazione della regola ${routeRule.scope}.${routeRule.packageName}.${routeRule.route}.`,
29354
- color: 'red'
29355
- });
29356
- });
29357
- };
29358
- const getScopes = () => {
29359
- if (permissionScopes === undefined) return [];
29360
- return [...new Set(permissionScopes.map(a => a.scope))];
29361
- };
29362
- const getPackageNames = scope => {
29363
- if (permissionScopes === undefined || !scope) return [];
29364
- return [...new Set(permissionScopes.filter(a => a.scope === scope).map(a => a.packageName))];
29365
- };
29366
- return jsxs(DataCard, {
29367
- title: 'Regole sulle rotte',
29368
- children: [jsxs(Stack, {
29369
- children: [jsxs(Grid, {
29370
- children: [jsx(Grid.Col, {
29371
- span: 6,
29372
- children: jsx(Select, {
29373
- data: getScopes(),
29374
- searchable: true,
29375
- placeholder: 'Seleziona uno scope',
29376
- value: currentScope,
29377
- label: 'Scope',
29378
- onChange: v => {
29379
- setCurrentScope(v);
29380
- setCurrentPackageName(null);
29381
- }
29382
- })
29383
- }), jsx(Grid.Col, {
29384
- span: 6,
29385
- children: jsx(Select, {
29386
- disabled: !currentScope,
29387
- searchable: true,
29388
- placeholder: 'Seleziona un package name',
29389
- data: getPackageNames(currentScope),
29390
- value: currentPackageName,
29391
- label: 'Package name',
29392
- onChange: v => {
29393
- setCurrentPackageName(v);
29394
- }
29395
- })
29396
- })]
29397
- }), jsx(Divider, {}), (currentScope && currentPackageName && !permissionLoading && routeRules.length) === 0 && jsxs(Stack, {
29398
- children: [jsx(Group, {
29399
- justify: 'right',
29400
- align: 'center',
29401
- children: jsx(Button, {
29402
- leftSection: jsx(IconPlus, {
29403
- size: 18
29404
- }),
29405
- onClick: () => setCreateRouteRuleModalOpened(true),
29406
- children: "Nuova regola"
29407
- })
29408
- }), jsx(Center, {
29409
- children: jsx(Text, {
29410
- size: 'md',
29411
- children: "Nessuna regola esistente."
29412
- })
29413
- })]
29414
- }), (!currentScope || !currentPackageName) && jsxs(Stack, {
29415
- align: 'center',
29416
- mt: 32,
29417
- mb: 32,
29418
- children: [jsx(IconCloudOff, {
29419
- color: 'gray',
29420
- size: 64
29421
- }), jsx(Center, {
29422
- children: jsx(Text, {
29423
- size: 'md',
29424
- children: "Seleziona uno scope e un package name per visualizzare i permessi associati."
29425
- })
29426
- })]
29427
- }), !permissionLoading && routeRules.length > 0 && jsxs(Stack, {
29428
- children: [jsx(Group, {
29429
- justify: 'right',
29430
- align: 'center',
29431
- children: jsx(Button, {
29432
- leftSection: jsx(IconPlus, {
29433
- size: 18
29434
- }),
29435
- onClick: () => setCreateRouteRuleModalOpened(true),
29436
- children: "Nuova regola"
29437
- })
29438
- }), jsxs(Table, {
29439
- highlightOnHover: true,
29440
- children: [jsx(Table.Thead, {
29441
- children: jsxs(Table.Tr, {
29442
- children: [jsx(Table.Th, {
29443
- children: "Id"
29444
- }), jsx(Table.Th, {
29445
- children: "Scope"
29446
- }), jsx(Table.Th, {
29447
- children: "Rotta"
29448
- }), jsx(Table.Th, {
29449
- children: "Permessi"
29450
- }), jsx(Table.Th, {
29451
- style: {
29452
- maxWidth: 80,
29453
- width: 80
29454
- },
29455
- children: "Azioni"
29456
- })]
29457
- })
29458
- }), jsx(Table.Tbody, {
29459
- children: routeRules.map((element, i) => {
29460
- return jsxs(Table.Tr, {
29461
- children: [jsx(Table.Td, {
29462
- children: element.id
29463
- }), jsx(Table.Td, {
29464
- children: `${element.scope}.${element.packageName}`
29465
- }), jsx(Table.Td, {
29466
- children: `/${element.scope}/${element.packageName}/${element.route}`
29467
- }), jsx(Table.Td, {
29468
- children: element.permissionsCount
29469
- }), jsx(Table.Td, {
29470
- style: {
29471
- maxWidth: 130,
29472
- width: 130
29473
- },
29474
- children: jsxs(Group, {
29475
- children: [jsx(ActionIcon, {
29476
- onClick: () => {
29477
- setCurrentRouteRule(element);
29478
- setManagePermissionModalOpened(true);
29479
- },
29480
- children: jsx(IconLock, {
29481
- size: 18
29482
- })
29483
- }), jsx(ActionIcon, {
29484
- onClick: () => {
29485
- deleteRouteRule(element);
29486
- },
29487
- children: jsx(IconTrash, {
29488
- size: 18
29489
- })
29490
- })]
29491
- })
29492
- })]
29493
- }, i);
29494
- })
29495
- })]
29496
- })]
29497
- })]
29498
- }), currentRouteRule && jsx(Modal, {
29499
- size: '60%',
29500
- centered: true,
29501
- opened: managePermissionModalOpened,
29502
- onClose: () => {
29503
- getRouteRulesForScope();
29504
- setManagePermissionModalOpened(false);
29505
- setCurrentRouteRule(undefined);
29506
- },
29507
- title: `Gestione permessi ${currentRouteRule.route}`,
29508
- children: jsx(PermissionNavigator, {
29509
- context: {
29510
- type: 'route-rule',
29511
- id: currentRouteRule.id.toString()
29512
- },
29513
- onUpdate: () => {}
29514
- })
29515
- }), jsx(Modal, {
29516
- size: '60%',
29517
- centered: true,
29518
- opened: createRouteRuleModalOpened,
29519
- onClose: () => {
29520
- getRouteRulesForScope();
29521
- setCreateRouteRuleModalOpened(false);
29522
- },
29523
- title: `Crea nuova regola`,
29524
- children: jsx(RouteRuleCreateForm, {
29525
- scope: currentScope,
29526
- packageName: currentPackageName,
29527
- onCreated: () => {
29528
- getRouteRulesForScope();
29529
- setCreateRouteRuleModalOpened(false);
29530
- },
29531
- onCanceled: () => {
29532
- setCreateRouteRuleModalOpened(false);
29533
- }
29534
- })
29535
- })]
29536
- });
29537
- }
29538
-
29539
29502
  function EmailServerConfiguration() {
29540
29503
  var _a, _b;
29541
29504
  const [configExists, setConfigExists] = useState(false);
@@ -29788,7 +29751,7 @@ function EmailServerConfiguration() {
29788
29751
  })]
29789
29752
  })]
29790
29753
  })
29791
- }), jsx(DataCard, {
29754
+ }), !configExists && jsx(DataCard, {
29792
29755
  title: "Test invio email",
29793
29756
  children: jsxs(Stack, {
29794
29757
  children: [jsx(Alert, {
@@ -29907,24 +29870,6 @@ function Settings(props) {
29907
29870
  size: 18
29908
29871
  }),
29909
29872
  description: 'Gestisci i permessi utente'
29910
- }, {
29911
- key: 'routes',
29912
- title: jsxs(Text, {
29913
- children: ["Regole sulle rotte ", jsx("small", {
29914
- children: jsx("b", {
29915
- children: "(Avanzato)"
29916
- })
29917
- })]
29918
- }),
29919
- onClick: () => {
29920
- window.location.hash = 'routes';
29921
- setCurrentTab('routes');
29922
- },
29923
- disabled: false,
29924
- icon: jsx(IconRoute, {
29925
- size: 18
29926
- }),
29927
- description: 'Gestisci le regole sulle rotte'
29928
29873
  }]
29929
29874
  }, {
29930
29875
  name: 'Comunicazioni',
@@ -30075,8 +30020,6 @@ function Settings(props) {
30075
30020
  return jsx(DomainRoleGrid, {});
30076
30021
  case 'permissions':
30077
30022
  return jsx(PermissionGrid, {});
30078
- case 'routes':
30079
- return jsx(RouteRuleGrid, {});
30080
30023
  case 'print-server':
30081
30024
  return jsx(PrintServerList, {});
30082
30025
  case 'email-configuration':
@@ -30565,12 +30508,16 @@ function FluxoShell(props) {
30565
30508
  const generateRoutesFromEmbeddedModules = frontend => {
30566
30509
  const embeddedModules = [...frontend.modules, reportsModule, workflowModule];
30567
30510
  const rObjs = [];
30511
+ let routes = {};
30568
30512
  embeddedModules.forEach(eModule => {
30569
30513
  rObjs.push({
30570
30514
  path: `/${eModule.scope}/${eModule.name}/*`,
30571
30515
  children: eModule.getRouteObject()
30572
30516
  });
30517
+ const aa = eModule.getRouteMap();
30518
+ routes = Object.assign(Object.assign({}, routes), aa);
30573
30519
  });
30520
+ FluxoStateDispatcher.dispatchSetRoutes(routes);
30574
30521
  return rObjs;
30575
30522
  };
30576
30523
  const generateRoutesFromJitApps = frontend => {
@@ -30732,6 +30679,7 @@ function FluxoShell(props) {
30732
30679
  const FrontendLayout = () => {
30733
30680
  var _a, _b;
30734
30681
  return (_a = frontendByRender === null || frontendByRender === void 0 ? void 0 : frontendByRender.layout) !== null && _a !== void 0 ? _a : jsx(AppLayout, {
30682
+ withMultipleSessions: props.withMultipleSessions,
30735
30683
  brandName: (_b = props.brandName) !== null && _b !== void 0 ? _b : 'Fluxo',
30736
30684
  appVersion: props.appVersion
30737
30685
  });
@@ -30744,7 +30692,6 @@ function FluxoShell(props) {
30744
30692
  FluxoStateDispatcher.dispatchSetSysFeatures(res.features);
30745
30693
  FluxoStateDispatcher.dispatchSetUserPermissions(res.permissions.map(a => a.fullIdentifier));
30746
30694
  FluxoStateDispatcher.dispatchSetUserDomainRoles(res.domainRoles);
30747
- FluxoStateDispatcher.dispatchSetRouteRules(res.routeRules);
30748
30695
  FluxoStateDispatcher.dispatchSetFrontends(props.frontends.map(a => ({
30749
30696
  id: a.id,
30750
30697
  name: a.name
@@ -30752,6 +30699,7 @@ function FluxoShell(props) {
30752
30699
  FluxoStateDispatcher.dispatchSetCurrentFrontend(res.currentFrontend);
30753
30700
  FluxoStateDispatcher.dispatchAllowedFrontends(res.frontends);
30754
30701
  FluxoStateDispatcher.dispatchHasAdminAccess(res.hasAdminAccess);
30702
+ if (props.withMultipleSessions) FluxoStateDispatcher.dispatchSetSessionMode('multi-session');else FluxoStateDispatcher.dispatchSetSessionMode('single-session');
30755
30703
  const rObjs = [generateAuthRoutes(), {
30756
30704
  path: 'frontend-switcher',
30757
30705
  element: jsx(ProtectedRoute, {
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@fluxo-dev/shell",
3
- "version": "0.0.25",
3
+ "version": "0.0.27",
4
4
  "peerDependencies": {
5
- "@fluxo-dev/shell-hub": "0.0.25",
6
- "@fluxo-dev/shell-korebi": "0.0.25",
7
- "@fluxo-dev/shell-mfe": "0.0.25",
8
- "@fluxo-dev/shell-printing": "0.0.25",
9
- "@fluxo-dev/shell-reporting": "0.0.25",
10
- "@fluxo-dev/shell-workflow": "0.0.25"
5
+ "@fluxo-dev/shell-hub": "0.0.27",
6
+ "@fluxo-dev/shell-korebi": "0.0.27",
7
+ "@fluxo-dev/shell-mfe": "0.0.27",
8
+ "@fluxo-dev/shell-printing": "0.0.27",
9
+ "@fluxo-dev/shell-reporting": "0.0.27",
10
+ "@fluxo-dev/shell-workflow": "0.0.27"
11
11
  },
12
12
  "module": "./index.esm.js",
13
13
  "type": "module",
package/src/lib/app.d.ts CHANGED
@@ -16,6 +16,7 @@ export interface FluxoShellProps {
16
16
  frontends: ShellFrontend[];
17
17
  clientInitialization: () => Promise<void>;
18
18
  brandName?: string;
19
+ withMultipleSessions: boolean;
19
20
  }
20
21
  export declare function FluxoShell(props: FluxoShellProps): import("react/jsx-runtime").JSX.Element;
21
22
  export default FluxoShell;
@@ -1,6 +1,7 @@
1
1
  export interface AppLayoutProps {
2
2
  appVersion: string;
3
3
  brandName: string;
4
+ withMultipleSessions: boolean;
4
5
  }
5
6
  declare function AppLayout(props: AppLayoutProps): import("react/jsx-runtime").JSX.Element;
6
7
  export default AppLayout;
@@ -1,2 +1,5 @@
1
- declare function AppContent(): import("react/jsx-runtime").JSX.Element;
1
+ export interface AppContentProps {
2
+ withMultipleSessions: boolean;
3
+ }
4
+ declare function AppContent(props: AppContentProps): import("react/jsx-runtime").JSX.Element;
2
5
  export default AppContent;
@@ -0,0 +1,18 @@
1
+ import { ShellSession } from "./shell-session";
2
+ import React from "react";
3
+ interface ShellSessionContextData {
4
+ addSession: (title: string, element: React.ReactElement | null, url: string) => string;
5
+ removeSession: (id: string) => void;
6
+ getSession: (id: string) => void;
7
+ sessions: () => ShellSession[];
8
+ updateSession: (id: string, title: string, element: React.ReactElement | null, url: string) => void;
9
+ getCurrentSessionId: () => string | null;
10
+ getCurrentSession: () => ShellSession | null | undefined;
11
+ setCurrentSession: (id: string) => void;
12
+ isCurrentSessionDisableable: () => boolean;
13
+ }
14
+ export declare const ShellSessionContext: React.Context<ShellSessionContextData>;
15
+ export declare function ShellSessionProvider(props: {
16
+ children: React.ReactNode;
17
+ }): import("react/jsx-runtime").JSX.Element;
18
+ export {};
@@ -0,0 +1,29 @@
1
+ import React from "react";
2
+ export declare class ShellSessionCollection {
3
+ private _sessions;
4
+ private _currentSessionId;
5
+ constructor(sessions: ShellSession[] | undefined, currentSessionId: string | null);
6
+ get currentSession(): ShellSession | null | undefined;
7
+ addSession(title: string, element: React.ReactElement | null, url: string): ShellSession;
8
+ removeSession(id: string): void;
9
+ getSession(id: string): ShellSession | undefined;
10
+ get sessions(): ShellSession[];
11
+ getCurrentSessionId(): string | null;
12
+ getCurrentSession(): ShellSession | null | undefined;
13
+ setCurrentSession(id: string): void;
14
+ updateSession(id: string, title: string, element: React.ReactElement | null, url: string): void;
15
+ getPreviuosSessionId(): string;
16
+ getNextSessionId(): string;
17
+ }
18
+ export declare class ShellSession {
19
+ private readonly _id;
20
+ private _title;
21
+ private _element;
22
+ private _url;
23
+ constructor(title: string, element: React.ReactElement | null, url: string);
24
+ get id(): string;
25
+ get title(): string;
26
+ get element(): React.ReactElement | null;
27
+ get url(): string;
28
+ updateSession(title: string, element: React.ReactElement | null, url: string): void;
29
+ }
@@ -1,6 +1,6 @@
1
1
  export interface PermissionNavigatorProps {
2
2
  context: {
3
- type: 'domainRole' | 'menu' | 'route-rule';
3
+ type: 'domainRole' | 'menu';
4
4
  id: string;
5
5
  };
6
6
  onUpdate: (currentPermissionCount: number) => void;
@@ -1,7 +0,0 @@
1
- export interface RouteRuleCreateFormProps {
2
- scope: string;
3
- packageName: string;
4
- onCanceled: () => void;
5
- onCreated: () => void;
6
- }
7
- export declare function RouteRuleCreateForm(props: RouteRuleCreateFormProps): import("react/jsx-runtime").JSX.Element;
@@ -1 +0,0 @@
1
- export declare function RouteRuleGrid(): import("react/jsx-runtime").JSX.Element;