@coworkee/airworks 0.0.1035 → 0.0.1037

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,4 @@
1
- import type { AppFactory, Coworkee, CoworkeeApp } from '../../coworkee.ts';
1
+ import { type AppFactory, type Coworkee, type CoworkeeApp } from '../../coworkee.ts';
2
2
  export declare const administrationAppId = "coworkee.administration";
3
3
  /** Every administration app the user may open, grouped like the administration menu of the web app. */
4
4
  export declare const administrationApp: (coworkee: Coworkee) => CoworkeeApp;
@@ -1,3 +1,4 @@
1
+ import { launcherApp } from "../../coworkee.js";
1
2
  import { esc } from "../../dom.js";
2
3
  import { icons } from "../../icons.js";
3
4
  import { aiSettingsApp } from "../assistant.js";
@@ -12,7 +13,7 @@ const allowed = (coworkee) => coworkee.apps.filter((app) => app.group && !app.hi
12
13
  /** Every administration app the user may open, grouped like the administration menu of the web app. */
13
14
  export const administrationApp = (coworkee) => {
14
15
  const definition = (visible) => ({
15
- id: administrationAppId, title: coworkee.t('Administration'), icon: icons.adminPanel, accent: '#35496b', width: 760, height: 560, singleInstance: true,
16
+ id: administrationAppId, title: coworkee.t('Administration'), icon: icons.adminPanel, accent: '#35496b', width: 760, height: 560, singleInstance: true, launcherGroup: coworkee.t('Administration'),
16
17
  requiredPermissions: visible ? [] : [nobody],
17
18
  render: ({ host }) => {
18
19
  const { t } = coworkee;
@@ -37,7 +38,7 @@ export const administrationApp = (coworkee) => {
37
38
  return;
38
39
  visible = now;
39
40
  coworkee.airWorks.unregisterApp(administrationAppId);
40
- coworkee.airWorks.registerApp(definition(now));
41
+ coworkee.airWorks.registerApp(launcherApp(definition(now), coworkee.t));
41
42
  };
42
43
  coworkee.airWorks.on('access-changed', update);
43
44
  return definition(false);
@@ -9,6 +9,8 @@ export type EntityAppOptions = EntityTableOptions & {
9
9
  icon?: string;
10
10
  accent?: string;
11
11
  requiredPermissions?: string[];
12
+ /** Heading in the full-screen launcher, e.g. the nav group of the set's page. */
13
+ launcherGroup?: string;
12
14
  };
13
15
  /** One entity set as its own desktop app, e.g. entityApp({ entitySet: 'Products', requiredPermissions: ['Catalog.Products.View'] }). */
14
16
  export declare const entityApp: (options: EntityAppOptions) => (coworkee: Coworkee) => CoworkeeApp;
package/dist/apps/data.js CHANGED
@@ -82,6 +82,7 @@ export const entityApp = (options) => (coworkee) => ({
82
82
  width: 900,
83
83
  height: 580,
84
84
  requiredPermissions: options.requiredPermissions,
85
+ launcherGroup: options.launcherGroup,
85
86
  render: ({ host, onClose }) => {
86
87
  host.classList.add('cw-host');
87
88
  host.innerHTML = '<div class="cw-app"></div>';
@@ -17,6 +17,8 @@ export type EmbedOptions = {
17
17
  height?: number;
18
18
  requiredPermissions?: string[];
19
19
  group?: string;
20
+ launcherGroup?: string;
21
+ shortcut?: boolean;
20
22
  };
21
23
  /** The page of the web client (the full editor) while the BFF knows the web client, otherwise the lighter app built here. */
22
24
  export declare const embedOr: (options: EmbedOptions, fallback: AppFactory) => AppFactory;
package/dist/apps/web.js CHANGED
@@ -22,7 +22,7 @@ function frame(coworkee, host, path, title) {
22
22
  */
23
23
  export const embedApp = (options) => (coworkee) => coworkee.user.appUrl ? [{
24
24
  id: options.id, title: coworkee.t(options.title), icon: options.icon ?? icons.web, accent: options.accent ?? '#35496b',
25
- width: options.width ?? 1100, height: options.height ?? 700, requiredPermissions: options.requiredPermissions, group: options.group,
25
+ width: options.width ?? 1100, height: options.height ?? 700, requiredPermissions: options.requiredPermissions, group: options.group, launcherGroup: options.launcherGroup, shortcut: options.shortcut,
26
26
  render: ({ host }) => frame(coworkee, host, options.path, coworkee.t(options.title)),
27
27
  }] : [];
28
28
  /** The page of the web client (the full editor) while the BFF knows the web client, otherwise the lighter app built here. */
@@ -8,11 +8,15 @@ export type AirWorksApi = typeof AirWorks;
8
8
  export type CoworkeeApp = AppDefinition & {
9
9
  probe?: string;
10
10
  hostOnly?: boolean;
11
- /** Section of the administration app (Identity, System, ...); such apps get no desktop shortcut of their own. */
11
+ /** Section of the administration app (Identity, System, ...); such apps get no desktop shortcut of their own and are listed under Administration in the full-screen launcher. */
12
12
  group?: string;
13
+ /** Heading of the app in the full-screen launcher (AirWorks `group`), e.g. People; wins over Administration. */
14
+ launcherGroup?: string;
13
15
  /** false: no desktop shortcut at the start (the app stays in the start menu). */
14
16
  shortcut?: boolean;
15
17
  };
18
+ /** The AirWorks app of a Coworkee app: launcherGroup, or Administration for a section of the administration, becomes the launcher heading. */
19
+ export declare function launcherApp({ probe, hostOnly, group, shortcut, launcherGroup, ...app }: CoworkeeApp, t: Translate): AppDefinition;
16
20
  export type AppFactory = (coworkee: Coworkee) => CoworkeeApp | CoworkeeApp[];
17
21
  export type CoworkeeOptions = {
18
22
  /** Shown in the start menu, on the sign-in card and in the browser tab. */
package/dist/coworkee.js CHANGED
@@ -3,6 +3,11 @@ import { bffAuthProvider } from "./auth.js";
3
3
  import { toast } from "./dom.js";
4
4
  import { defaultMudExFrameUrl, defaultMudExUrl } from "./mudex.js";
5
5
  import { globalSearchProvider } from "./search.js";
6
+ /** The AirWorks app of a Coworkee app: launcherGroup, or Administration for a section of the administration, becomes the launcher heading. */
7
+ export function launcherApp({ probe, hostOnly, group, shortcut, launcherGroup, ...app }, t) {
8
+ const heading = launcherGroup ?? (group ? t('Administration') : undefined);
9
+ return heading ? { ...app, group: heading } : app;
10
+ }
6
11
  /** English of the MudBlazor keys the apps borrow; the API serves them only for other languages. */
7
12
  const mudTexts = {
8
13
  MudDataGridPager_InfoFormat: '{0}-{1} of {2}', MudTablePager_PreviousPage: 'Previous page', MudTablePager_NextPage: 'Next page', MudDataGrid_Loading: 'Loading...',
@@ -100,11 +105,12 @@ export async function useCoworkee(airWorks, options) {
100
105
  };
101
106
  const shortcuts = [];
102
107
  async function add(definition) {
103
- const { probe, hostOnly, group, shortcut, ...app } = definition;
108
+ const { probe, hostOnly } = definition;
104
109
  if (hostOnly && !user.systemTenant)
105
110
  return undefined;
106
111
  if (probe && !(user.isAuthenticated && await quietly(() => apiRequest(probe).then(() => true), false)))
107
112
  return undefined;
113
+ const app = launcherApp(definition, coworkee.t);
108
114
  airWorks.unregisterApp(app.id);
109
115
  airWorks.registerApp(app);
110
116
  const known = coworkee.apps.findIndex((item) => item.id === app.id);
@@ -125,6 +131,7 @@ export async function useCoworkee(airWorks, options) {
125
131
  defaults: { systemColor: palette(theme, mode).primary },
126
132
  storageKey: `coworkee.airworks.${location.host}`,
127
133
  webLinks: true,
134
+ ...(user.launcher === 'menu' || user.launcher === 'overlay' ? { launcher: user.launcher } : {}),
128
135
  ...options.airWorks,
129
136
  });
130
137
  if (user.isAuthenticated && user.userId)
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import type { AppFactory } from './coworkee.ts';
2
- export { useCoworkee, type AirWorksApi, type AppFactory, type Coworkee, type CoworkeeApp, type CoworkeeOptions } from './coworkee.ts';
2
+ export { launcherApp, useCoworkee, type AirWorksApi, type AppFactory, type Coworkee, type CoworkeeApp, type CoworkeeOptions } from './coworkee.ts';
3
3
  export { bffAuthProvider, sessionOf } from './auth.ts';
4
4
  export { loadMudEx, defaultMudExFrameUrl, defaultMudExUrl, mudExFrame } from './mudex.ts';
5
5
  export { icons } from './icons.ts';
package/dist/index.js CHANGED
@@ -9,7 +9,7 @@ import { webPageApp } from "./apps/web.js";
9
9
  import { reportDesignerApp } from "./apps/report-designer.js";
10
10
  import { reportApp, reportsApp } from "./apps/reports.js";
11
11
  import { settingsApp } from "./apps/settings.js";
12
- export { useCoworkee } from "./coworkee.js";
12
+ export { launcherApp, useCoworkee } from "./coworkee.js";
13
13
  export { bffAuthProvider, sessionOf } from "./auth.js";
14
14
  export { loadMudEx, defaultMudExFrameUrl, defaultMudExUrl, mudExFrame } from "./mudex.js";
15
15
  export { icons } from "./icons.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coworkee/airworks",
3
- "version": "0.0.1035",
3
+ "version": "0.0.1037",
4
4
  "description": "AirWorks web desktop for Coworkee apps: sign-in through the app's BFF, theme, texts, realtime and apps for settings, files, data, chat, reports, the assistant and the administration",
5
5
  "license": "MIT",
6
6
  "homepage": "https://fgilde.github.io/CoworkeeLib/web/airworks/",
@@ -40,13 +40,13 @@
40
40
  "test": "node --test \"test/**/*.test.ts\""
41
41
  },
42
42
  "dependencies": {
43
- "@coworkee/client": "0.0.1035"
43
+ "@coworkee/client": "0.0.1037"
44
44
  },
45
45
  "peerDependencies": {
46
46
  "@fgilde/airworks": ">=0.4.0"
47
47
  },
48
48
  "devDependencies": {
49
- "@fgilde/airworks": "git+https://github.com/fgilde/AirWorks.git#12e8507b22f11f99bba2c093fb81f617e751ff1f",
49
+ "@fgilde/airworks": "git+https://github.com/fgilde/AirWorks.git#9657ff3967a9dd8fa5dc2b7502c2b2e3d4e20d72",
50
50
  "typescript": "^5.9.3"
51
51
  }
52
52
  }