@fluxo-dev/api-client-base 0.0.26 → 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.cjs.js CHANGED
@@ -1761,6 +1761,12 @@ class FluxoStateDispatcher {
1761
1761
  static dispatchSetCurrentFrontend(frontend) {
1762
1762
  state.store.dispatch(state.setCurrentFrontend(frontend));
1763
1763
  }
1764
+ static dispatchSetSessionMode(mode) {
1765
+ state.store.dispatch(state.setMode(mode));
1766
+ }
1767
+ static dispatchSetRoutes(routes) {
1768
+ state.store.dispatch(state.setRoutes(routes));
1769
+ }
1764
1770
  }
1765
1771
 
1766
1772
  class AuthService {
@@ -2432,6 +2438,12 @@ class EmbeddedModule {
2432
2438
  }
2433
2439
  constructor(name, description, author, version, scope) {
2434
2440
  this._navigation = [];
2441
+ this.getFullyQualifiedRoute = (route, parent = undefined) => {
2442
+ const r1 = "/" + this.scope + "/" + this.name + "/";
2443
+ const r2 = r1 + `${parent && parent !== '/' ? parent + '/' : ''}`;
2444
+ const r3 = r2 + `${route.route && route.route !== '/' ? route.route : ''}`;
2445
+ return r3;
2446
+ };
2435
2447
  this._name = name;
2436
2448
  this._description = description;
2437
2449
  this._author = author;
@@ -2441,6 +2453,23 @@ class EmbeddedModule {
2441
2453
  attachNavigation(navigationConfig) {
2442
2454
  this._navigation.push(navigationConfig);
2443
2455
  }
2456
+ // Generate dictionary of routes recursively
2457
+ getRouteMap(routes = undefined, parent = undefined) {
2458
+ const r = routes !== null && routes !== void 0 ? routes : this._navigation.map(a => a.routes).map(a => a).flat();
2459
+ if (!r || r.length === 0) return {};
2460
+ const routeMap = {};
2461
+ r.map(route => {
2462
+ if (route.route) {
2463
+ routeMap[this.getFullyQualifiedRoute(route, parent)] = {
2464
+ title: route.title
2465
+ };
2466
+ if (route.routes && route.routes.length > 0) {
2467
+ Object.assign(routeMap, this.getRouteMap(route.routes, route.route));
2468
+ }
2469
+ }
2470
+ });
2471
+ return routeMap;
2472
+ }
2444
2473
  getRouteObject(routes = undefined) {
2445
2474
  const r = routes !== null && routes !== void 0 ? routes : this._navigation.map(a => a.routes).map(a => a).flat();
2446
2475
  if (!r || r.length === 0) return [];
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@fluxo-dev/api-client-base",
3
- "version": "0.0.26",
3
+ "version": "0.0.27",
4
4
  "type": "commonjs",
5
5
  "peerDependencies": {
6
- "@fluxo-dev/state": "0.0.26"
6
+ "@fluxo-dev/state": "0.0.27"
7
7
  },
8
8
  "main": "./index.cjs.js"
9
9
  }
@@ -16,6 +16,12 @@ export declare class EmbeddedModule {
16
16
  private _navigation;
17
17
  constructor(name: string, description: string, author: string, version: string, scope: string);
18
18
  attachNavigation(navigationConfig: EmbeddedModuleNavigation): void;
19
+ getRouteMap(routes?: EmbeddedModuleRoute[] | undefined, parent?: string | undefined): {
20
+ [id: string]: {
21
+ title: string | undefined;
22
+ };
23
+ };
24
+ private getFullyQualifiedRoute;
19
25
  getRouteObject(routes?: EmbeddedModuleRoute[] | undefined): RouteObject[];
20
26
  getEmbeddedModule(): FluxoEmbeddedModuleConfiguration;
21
27
  }
@@ -26,5 +32,6 @@ export interface EmbeddedModuleNavigation {
26
32
  export interface EmbeddedModuleRoute {
27
33
  route?: string;
28
34
  component?: any;
35
+ title?: string;
29
36
  routes?: EmbeddedModuleRoute[];
30
37
  }
@@ -22,4 +22,10 @@ export declare class FluxoStateDispatcher {
22
22
  name: string;
23
23
  }[]): void;
24
24
  static dispatchSetCurrentFrontend(frontend: string): void;
25
+ static dispatchSetSessionMode(mode: 'single-session' | 'multi-session'): void;
26
+ static dispatchSetRoutes(routes: {
27
+ [id: string]: {
28
+ title: string | undefined;
29
+ };
30
+ }): void;
25
31
  }