@weaver-apps/service-desk 0.1.3 → 0.3.0

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/README.md CHANGED
@@ -7,10 +7,15 @@ gateway the host supplies, and holds no key.
7
7
  ## Compose it
8
8
 
9
9
  ```ts
10
- import { createServiceDeskPlugin, createHttpServiceDeskGateway, provideServiceDeskGateway } from '@weaver-apps/service-desk';
11
-
12
- provideTranslationNamespaces('service-desk'),
13
- provideCapabilityGrants({ 'service-desk': ['contributions', 'navigation', 'ui'] }),
10
+ import {
11
+ createHttpServiceDeskGateway,
12
+ createServiceDeskPlugin,
13
+ provideServiceDeskGateway,
14
+ serviceDeskPluginId,
15
+ } from '@weaver-apps/service-desk';
16
+
17
+ provideTranslationNamespaces(serviceDeskPluginId),
18
+ provideCapabilityGrants({ [serviceDeskPluginId]: ['contributions', 'navigation', 'ui'] }),
14
19
  ...providePlugins(createServiceDeskPlugin({ railItem: true })),
15
20
  provideServiceDeskGateway(createHttpServiceDeskGateway({ baseUrl: '/weaver-apps' })),
16
21
  ```
@@ -18,15 +23,38 @@ provideServiceDeskGateway(createHttpServiceDeskGateway({ baseUrl: '/weaver-apps'
18
23
  - `baseUrl` is a same-origin path the host's backend forwards to the server with the forwarding key and the
19
24
  signed-in person's tenant. The gateway appends the server's routes, such as
20
25
  `/service-desk/desks/{id}/requests`.
21
- - Serve the translations: copy `node_modules/@weaver-apps/service-desk/i18n/service-desk` to
22
- `i18n/service-desk`.
23
- - If the host compiles the shell's theme with Tailwind, add the package as an `@source`.
24
-
25
- ## Surfaces
26
-
27
- | Path | What it shows |
28
- |---|---|
29
- | `service-desk` | the tenant's desks |
30
- | `service-desk/:deskId` | one desk's requests, filtered and paged |
31
-
32
- `deskPath(id)` builds the second; a host that shows one entry per desk navigates there.
26
+ - Serve the translations: copy `node_modules/@weaver-apps/service-desk/i18n/weaver-apps-service-desk` to
27
+ `i18n/weaver-apps-service-desk`.
28
+ - Install AG Grid, a peer dependency the list is drawn with: `npm i ag-grid-community@^36.2 ag-grid-angular@^36.2
29
+ @ag-grid-community/locale@^36.2`. `@weaver-apps/data-grid`, the grid both Weaver Apps weavers share, comes along as a
30
+ dependency; the host composes nothing for it.
31
+ - If the host compiles the shell's theme with Tailwind, add the package and `@weaver-apps/data-grid` as an `@source`.
32
+
33
+ ## Names in the host
34
+
35
+ The plugin id is `weaver-apps-service-desk` (`serviceDeskPluginId`). Every id the plugin registers and every
36
+ icon it contributes starts with `weaver-apps-service-desk.`, its routes live under
37
+ `weaver-apps-service-desk/`, and its translations are the namespace `weaver-apps-service-desk`. The ids are
38
+ exported as `serviceDeskContributionIds`.
39
+
40
+ | Id | Path | What it shows |
41
+ |---|---|---|
42
+ | `weaver-apps-service-desk.desks` | `weaver-apps-service-desk` | the tenant's desks |
43
+ | `weaver-apps-service-desk.desk` | `weaver-apps-service-desk/:deskId` | one desk's requests, filtered and paged |
44
+ | `weaver-apps-service-desk.rail` | | the rail item, only with `railItem: true` |
45
+
46
+ A desk's requests are a grid that loads more as the person scrolls and shows how many match. A click on the
47
+ title, priority, status, raised or due header sorts them on the server (newest first by default); title and
48
+ description, the contact, and type, status and priority filter per column, the last three by any number of values.
49
+ By default the status filter holds open, in progress and completed.
50
+
51
+ `deskPath(id)` builds the address of one desk; a host that shows one entry per desk navigates there.
52
+
53
+ ## Moving from 0.1.x
54
+
55
+ 0.2.0 draws the list with AG Grid, so a host installs it (see above). It also renamed everything the plugin puts
56
+ into a host; a host composing it changes three places: the key of
57
+ its capability grant (`service-desk` becomes `weaver-apps-service-desk`), the translation namespace it
58
+ declares, and the folder it serves the translations from (`i18n/service-desk` becomes
59
+ `i18n/weaver-apps-service-desk`). Addresses saved under `service-desk/...` no longer resolve; build them with
60
+ `deskPath`.
@@ -0,0 +1,74 @@
1
+ import { s as serviceDeskHost, t as SERVICE_DESK_GATEWAY } from "./weaver-apps-service-desk-service-desk-gateway-BK42Rgow.mjs";
2
+ import { n as deskPath } from "./weaver-apps-service-desk-service-desk-paths-BmQrbz-V.mjs";
3
+ import * as i0 from "@angular/core";
4
+ import { CUSTOM_ELEMENTS_SCHEMA, ChangeDetectionStrategy, Component, inject, resource } from "@angular/core";
5
+ import { TranslocoPipe } from "@jsverse/transloco";
6
+ var DeskListPage = class DeskListPage {
7
+ gateway = inject(SERVICE_DESK_GATEWAY);
8
+ desks = resource({
9
+ ...ngDevMode ? { debugName: "desks" } : /* istanbul ignore next */ {},
10
+ loader: () => this.gateway.desks()
11
+ });
12
+ open(deskId) {
13
+ serviceDeskHost.navigate(deskPath(deskId));
14
+ }
15
+ async create() {
16
+ const name = await serviceDeskHost.ui.prompt({
17
+ title: "weaver-apps-service-desk.desks.create",
18
+ message: "weaver-apps-service-desk.desks.createMessage",
19
+ confirmLabel: "weaver-apps-service-desk.desks.createConfirm"
20
+ });
21
+ if (!name?.trim()) return;
22
+ try {
23
+ const desk = await this.gateway.saveDesk(crypto.randomUUID(), name.trim());
24
+ this.open(desk.id);
25
+ } catch {
26
+ serviceDeskHost.ui.toast({
27
+ message: "weaver-apps-service-desk.errors.create",
28
+ kind: "error"
29
+ });
30
+ }
31
+ }
32
+ static ɵfac = i0.ɵɵngDeclareFactory({
33
+ minVersion: "12.0.0",
34
+ version: "22.2.3",
35
+ ngImport: i0,
36
+ type: DeskListPage,
37
+ deps: [],
38
+ target: i0.ɵɵFactoryTarget.Component
39
+ });
40
+ static ɵcmp = i0.ɵɵngDeclareComponent({
41
+ minVersion: "17.0.0",
42
+ version: "22.2.3",
43
+ type: DeskListPage,
44
+ isStandalone: true,
45
+ selector: "wa-desk-list-page",
46
+ ngImport: i0,
47
+ template: "<div class=\"flex h-full flex-col gap-4 overflow-auto p-6\">\n <div class=\"flex items-center justify-between gap-4\">\n <h2 class=\"text-lg font-semibold text-content\">{{ 'weaver-apps-service-desk.desks.title' | transloco }}</h2>\n <button type=\"button\" class=\"lw-btn lw-btn--primary\" (click)=\"create()\">{{ 'weaver-apps-service-desk.desks.create' | transloco }}</button>\n </div>\n @if (desks.error()) {\n <p class=\"text-sm text-negative\" role=\"alert\">{{ 'weaver-apps-service-desk.errors.load' | transloco }}</p>\n } @else if (desks.hasValue()) {\n <ul role=\"list\" class=\"divide-y divide-border rounded-xl border border-border bg-surface\">\n @for (desk of desks.value(); track desk.id) {\n <li>\n <button type=\"button\" class=\"flex w-full items-center gap-3 px-4 py-3 text-left text-sm text-content hover:bg-surface-overlay\" (click)=\"open(desk.id)\">\n <lw-icon name=\"weaver-apps-service-desk.desk\" size=\"1.25rem\"></lw-icon>\n <span>{{ desk.name }}</span>\n </button>\n </li>\n } @empty {\n <li class=\"px-4 py-8 text-center text-sm text-content-faint\">{{ 'weaver-apps-service-desk.desks.empty' | transloco }}</li>\n }\n </ul>\n }\n</div>\n",
48
+ dependencies: [{
49
+ kind: "pipe",
50
+ type: TranslocoPipe,
51
+ name: "transloco"
52
+ }],
53
+ changeDetection: i0.ChangeDetectionStrategy.OnPush
54
+ });
55
+ };
56
+ i0.ɵɵngDeclareClassMetadata({
57
+ minVersion: "12.0.0",
58
+ version: "22.2.3",
59
+ ngImport: i0,
60
+ type: DeskListPage,
61
+ decorators: [{
62
+ type: Component,
63
+ args: [{
64
+ selector: "wa-desk-list-page",
65
+ imports: [TranslocoPipe],
66
+ schemas: [CUSTOM_ELEMENTS_SCHEMA],
67
+ changeDetection: ChangeDetectionStrategy.OnPush,
68
+ template: "<div class=\"flex h-full flex-col gap-4 overflow-auto p-6\">\n <div class=\"flex items-center justify-between gap-4\">\n <h2 class=\"text-lg font-semibold text-content\">{{ 'weaver-apps-service-desk.desks.title' | transloco }}</h2>\n <button type=\"button\" class=\"lw-btn lw-btn--primary\" (click)=\"create()\">{{ 'weaver-apps-service-desk.desks.create' | transloco }}</button>\n </div>\n @if (desks.error()) {\n <p class=\"text-sm text-negative\" role=\"alert\">{{ 'weaver-apps-service-desk.errors.load' | transloco }}</p>\n } @else if (desks.hasValue()) {\n <ul role=\"list\" class=\"divide-y divide-border rounded-xl border border-border bg-surface\">\n @for (desk of desks.value(); track desk.id) {\n <li>\n <button type=\"button\" class=\"flex w-full items-center gap-3 px-4 py-3 text-left text-sm text-content hover:bg-surface-overlay\" (click)=\"open(desk.id)\">\n <lw-icon name=\"weaver-apps-service-desk.desk\" size=\"1.25rem\"></lw-icon>\n <span>{{ desk.name }}</span>\n </button>\n </li>\n } @empty {\n <li class=\"px-4 py-8 text-center text-sm text-content-faint\">{{ 'weaver-apps-service-desk.desks.empty' | transloco }}</li>\n }\n </ul>\n }\n</div>\n"
69
+ }]
70
+ }]
71
+ });
72
+ export { DeskListPage };
73
+
74
+ //# sourceMappingURL=weaver-apps-service-desk-desk-list-page-DPxs6zRX.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"weaver-apps-service-desk-desk-list-page-DPxs6zRX.mjs","names":[],"sources":["../../../../libs/service-desk/src/lib/views/desk-list-page.ts","../../../../libs/service-desk/src/lib/views/desk-list-page.html"],"sourcesContent":["import { ChangeDetectionStrategy, Component, CUSTOM_ELEMENTS_SCHEMA, inject, resource } from '@angular/core';\nimport { TranslocoPipe } from '@jsverse/transloco';\nimport { SERVICE_DESK_GATEWAY } from '../gateway/service-desk-gateway';\nimport { serviceDeskHost } from '../plugin/service-desk-host';\nimport { deskPath } from '../plugin/service-desk-paths';\n\n@Component({\n selector: 'wa-desk-list-page',\n imports: [TranslocoPipe],\n schemas: [CUSTOM_ELEMENTS_SCHEMA],\n templateUrl: './desk-list-page.html',\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class DeskListPage {\n private readonly gateway = inject(SERVICE_DESK_GATEWAY);\n\n protected readonly desks = resource({ loader: () => this.gateway.desks() });\n\n protected open(deskId: string): void {\n serviceDeskHost.navigate(deskPath(deskId));\n }\n\n protected async create(): Promise<void> {\n const name = await serviceDeskHost.ui.prompt({\n title: 'weaver-apps-service-desk.desks.create',\n message: 'weaver-apps-service-desk.desks.createMessage',\n confirmLabel: 'weaver-apps-service-desk.desks.createConfirm',\n });\n if (!name?.trim()) {\n return;\n }\n try {\n const desk = await this.gateway.saveDesk(crypto.randomUUID(), name.trim());\n this.open(desk.id);\n } catch {\n serviceDeskHost.ui.toast({ message: 'weaver-apps-service-desk.errors.create', kind: 'error' });\n }\n }\n}\n","<div class=\"flex h-full flex-col gap-4 overflow-auto p-6\">\n <div class=\"flex items-center justify-between gap-4\">\n <h2 class=\"text-lg font-semibold text-content\">{{ 'weaver-apps-service-desk.desks.title' | transloco }}</h2>\n <button type=\"button\" class=\"lw-btn lw-btn--primary\" (click)=\"create()\">{{ 'weaver-apps-service-desk.desks.create' | transloco }}</button>\n </div>\n @if (desks.error()) {\n <p class=\"text-sm text-negative\" role=\"alert\">{{ 'weaver-apps-service-desk.errors.load' | transloco }}</p>\n } @else if (desks.hasValue()) {\n <ul role=\"list\" class=\"divide-y divide-border rounded-xl border border-border bg-surface\">\n @for (desk of desks.value(); track desk.id) {\n <li>\n <button type=\"button\" class=\"flex w-full items-center gap-3 px-4 py-3 text-left text-sm text-content hover:bg-surface-overlay\" (click)=\"open(desk.id)\">\n <lw-icon name=\"weaver-apps-service-desk.desk\" size=\"1.25rem\"></lw-icon>\n <span>{{ desk.name }}</span>\n </button>\n </li>\n } @empty {\n <li class=\"px-4 py-8 text-center text-sm text-content-faint\">{{ 'weaver-apps-service-desk.desks.empty' | transloco }}</li>\n }\n </ul>\n }\n</div>\n"],"mappings":";;;;;AAaA,IAAa,eAAb,MAAa,aAAY;CACN,UAAU,OAAO,oBAAoB;CAEnC,QAAQ,SAAQ;EAAA,GAAA,YAAA,EAAA,WAAA,QAAA,+BAAA,CAAA;EAAG,cAAc,KAAK,QAAQ,MAAK;CAAE,CAAA;CAE9D,KAAK,QAAc;EAC3B,gBAAgB,SAAS,SAAS,MAAM,CAAC;CAC3C;CAEU,MAAM,SAAM;EACpB,MAAM,OAAO,MAAM,gBAAgB,GAAG,OAAO;GAC3C,OAAO;GACP,SAAS;GACT,cAAc;EACf,CAAA;EACD,IAA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