@igstack/app-catalog-frontend-core 6.13.1 → 6.15.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.
Files changed (33) hide show
  1. package/dist/esm/index.d.ts +1 -1
  2. package/dist/esm/modules/appCatalog/ui/pages/ServiceDesksPage.d.ts +4 -3
  3. package/dist/esm/modules/appCatalog/ui/pages/ServiceDesksPage.js +73 -54
  4. package/dist/esm/modules/appCatalog/ui/pages/ServiceDesksPage.js.map +1 -1
  5. package/dist/esm/modules/appCatalog/ui/serviceDesks/ServiceDeskCard.d.ts +9 -10
  6. package/dist/esm/modules/appCatalog/ui/serviceDesks/ServiceDeskCard.js +39 -61
  7. package/dist/esm/modules/appCatalog/ui/serviceDesks/ServiceDeskCard.js.map +1 -1
  8. package/dist/esm/modules/appCatalog/ui/serviceDesks/ServiceDeskDetail.d.ts +3 -4
  9. package/dist/esm/modules/appCatalog/ui/serviceDesks/ServiceDeskDetail.js +9 -42
  10. package/dist/esm/modules/appCatalog/ui/serviceDesks/ServiceDeskDetail.js.map +1 -1
  11. package/dist/esm/modules/appCatalog/ui/serviceDesks/searchServiceDesks.d.ts +13 -0
  12. package/dist/esm/modules/appCatalog/ui/serviceDesks/searchServiceDesks.js +26 -0
  13. package/dist/esm/modules/appCatalog/ui/serviceDesks/searchServiceDesks.js.map +1 -1
  14. package/dist/esm/routeTree.gen.d.ts +34 -8
  15. package/dist/esm/routeTree.gen.js +13 -3
  16. package/dist/esm/routeTree.gen.js.map +1 -1
  17. package/dist/esm/routes/_layout/service-desks.$slug.d.ts +13 -0
  18. package/dist/esm/routes/_layout/service-desks._slug.js +14 -0
  19. package/dist/esm/routes/_layout/service-desks._slug.js.map +1 -0
  20. package/dist/esm/routes/_layout/service-desks.d.ts +0 -1
  21. package/dist/esm/routes/_layout/service-desks.js +5 -9
  22. package/dist/esm/routes/_layout/service-desks.js.map +1 -1
  23. package/dist/esm/types/uiSettings.d.ts +10 -0
  24. package/package.json +4 -4
  25. package/src/index.tsx +6 -1
  26. package/src/modules/appCatalog/ui/pages/ServiceDesksPage.tsx +121 -64
  27. package/src/modules/appCatalog/ui/serviceDesks/ServiceDeskCard.tsx +40 -59
  28. package/src/modules/appCatalog/ui/serviceDesks/ServiceDeskDetail.tsx +17 -59
  29. package/src/modules/appCatalog/ui/serviceDesks/searchServiceDesks.ts +36 -0
  30. package/src/routeTree.gen.ts +35 -5
  31. package/src/routes/_layout/service-desks.$slug.tsx +17 -0
  32. package/src/routes/_layout/service-desks.tsx +3 -7
  33. package/src/types/uiSettings.ts +11 -0
@@ -16,9 +16,8 @@ import { liveOptions } from './searchServiceDesks'
16
16
  import type { PortalDesk } from './searchServiceDesks'
17
17
 
18
18
  /**
19
- * A desk's card, opened from a result (then `form` is the form clicked) or from
20
- * the desk list (then it covers every form). Overview reads top to bottom like a
21
- * short page: what the request is for, the one way into it, what it asks, and
19
+ * One form's card, at `/service-desks/<slug>`. Overview reads top to bottom like
20
+ * a short page: what the request is for, the one way into it, what it asks, and
22
21
  * what happens after. Behind this card says where the card comes from.
23
22
  *
24
23
  * One link only: the button. The header is the subject, not a second door.
@@ -29,7 +28,7 @@ export function ServiceDeskDetail({
29
28
  onClose,
30
29
  }: {
31
30
  desk: PortalDesk
32
- form?: ServiceRequestType
31
+ form: ServiceRequestType
33
32
  onClose: () => void
34
33
  }) {
35
34
  const portal = desk.config.portal
@@ -37,21 +36,21 @@ export function ServiceDeskDetail({
37
36
  const band = (
38
37
  <div className="pr-20">
39
38
  <h2 className="m-0 font-serif text-[28px] font-semibold leading-tight tracking-tight">
40
- {form?.name ?? desk.displayName}
39
+ {form.name}
41
40
  </h2>
42
41
  <p className="mt-1 text-[14px] text-muted-foreground">
43
42
  <span className="font-semibold tracking-wide" title="Portal key">
44
43
  {portal.key}
45
44
  </span>
46
- {form && <> · {desk.displayName}</>}
45
+ · {desk.displayName}
47
46
  </p>
48
47
  </div>
49
48
  )
50
49
 
51
50
  return (
52
51
  <DetailDialogShell
53
- label={`${form?.name ?? desk.displayName} details`}
54
- shownKey={`${desk.slug}:${form?.id ?? ''}`}
52
+ label={`${form.name} details`}
53
+ shownKey={`${desk.slug}:${form.id}`}
55
54
  maxWidthClass="max-w-[min(1000px,94vw)]"
56
55
  focusSelector="[data-primary-action]"
57
56
  onClose={onClose}
@@ -102,20 +101,19 @@ function Overview({
102
101
  form,
103
102
  }: {
104
103
  desk: PortalDesk
105
- form?: ServiceRequestType
104
+ form: ServiceRequestType
106
105
  }) {
107
106
  const portal = desk.config.portal
108
- const url = form?.url ?? desk.config.url
109
107
  return (
110
108
  <div className="flex max-w-[760px] flex-col gap-8 pt-1">
111
109
  <div>
112
- {form?.description && (
110
+ {form.description && (
113
111
  <p className="text-[17px] leading-[1.6]">{form.description}</p>
114
112
  )}
115
113
  {desk.config.description && (
116
114
  <p
117
115
  className={
118
- form?.description
116
+ form.description
119
117
  ? 'mt-2 text-[14px] text-muted-foreground'
120
118
  : 'text-[17px] leading-[1.6]'
121
119
  }
@@ -123,55 +121,15 @@ function Overview({
123
121
  {desk.config.description}
124
122
  </p>
125
123
  )}
126
- {url && (
127
- <div className="mt-5">
128
- <OpenButton
129
- url={url}
130
- label={form ? 'Open the form' : 'Open the portal'}
131
- />
132
- </div>
133
- )}
124
+ <div className="mt-5">
125
+ <OpenButton url={form.url} label="Open the form" />
126
+ </div>
134
127
  </div>
135
128
 
136
- {form ? (
137
- <div>
138
- <Heading>You will be asked for</Heading>
139
- <FieldList fields={form.fields} />
140
- </div>
141
- ) : (
142
- <div>
143
- <Heading>Forms on this portal</Heading>
144
- {portal.requestTypes.length ? (
145
- <ul className="flex flex-col gap-4">
146
- {portal.requestTypes.map((rt) => (
147
- <li key={rt.id}>
148
- <a
149
- href={rt.url}
150
- target="_blank"
151
- rel="noopener noreferrer"
152
- className="inline-flex items-center gap-1 text-[15px] font-medium underline decoration-muted-foreground/40 underline-offset-2 hover:decoration-foreground"
153
- >
154
- {rt.name}
155
- <ExternalLink
156
- className="size-3.5 text-muted-foreground"
157
- aria-hidden="true"
158
- />
159
- </a>
160
- {rt.description && (
161
- <p className="text-[14px] text-muted-foreground">
162
- {rt.description}
163
- </p>
164
- )}
165
- </li>
166
- ))}
167
- </ul>
168
- ) : (
169
- <p className="text-[14px] text-muted-foreground">
170
- This desk publishes no forms.
171
- </p>
172
- )}
173
- </div>
174
- )}
129
+ <div>
130
+ <Heading>You will be asked for</Heading>
131
+ <FieldList fields={form.fields} />
132
+ </div>
175
133
 
176
134
  <div>
177
135
  <Heading>After you file</Heading>
@@ -171,3 +171,39 @@ export function searchServiceDesks(
171
171
  .sort((a, b) => b.tier - a.tier || a.order - b.order)
172
172
  .map((r) => r.result)
173
173
  }
174
+
175
+ /**
176
+ * A form's address in the Service Desks view: the desk's key and the form's id,
177
+ * `/service-desks/help-42`. The id, not the name, so a renamed form keeps its
178
+ * links; the key, so the address still says which desk it belongs to.
179
+ */
180
+ export function formSlug(desk: PortalDesk, form: ServiceRequestType): string {
181
+ return `${desk.config.portal.key.toLowerCase()}-${form.id}`
182
+ }
183
+
184
+ /** The desk and form behind a `formSlug`, or undefined. */
185
+ export function findBySlug(
186
+ desks: PortalDesk[],
187
+ slug: string,
188
+ ): { desk: PortalDesk; form: ServiceRequestType } | undefined {
189
+ for (const desk of desks) {
190
+ const key = `${desk.config.portal.key.toLowerCase()}-`
191
+ if (!slug.startsWith(key)) continue
192
+ const form = desk.config.portal.requestTypes.find(
193
+ (f) => f.id === slug.slice(key.length),
194
+ )
195
+ if (form) return { desk, form }
196
+ }
197
+ return undefined
198
+ }
199
+
200
+ /** Every form of every desk, unmatched: the Service Desks view with no search. */
201
+ export function allForms(desks: PortalDesk[]): FormResult[] {
202
+ return desks.flatMap((desk) =>
203
+ desk.config.portal.requestTypes.map((form) => ({
204
+ desk,
205
+ form,
206
+ fieldMatches: [],
207
+ })),
208
+ )
209
+ }
@@ -18,6 +18,7 @@ import { Route as LayoutServiceDesksRouteImport } from './routes/_layout/service
18
18
  import { Route as AuthCallbackRouteImport } from './routes/auth.callback'
19
19
  import { Route as LayoutAppSlugRouteImport } from './routes/_layout/app.$slug'
20
20
  import { Route as LayoutCommunitySlugRouteImport } from './routes/_layout/community.$slug'
21
+ import { Route as LayoutServiceDesksSlugRouteImport } from './routes/_layout/service-desks.$slug'
21
22
  import { Route as LayoutCatalogAppsIndexRouteImport } from './routes/_layout/catalog.apps.index'
22
23
  import { Route as LayoutAppSlugSubSubSlugRouteImport } from './routes/_layout/app.$slug_.sub.$subSlug'
23
24
 
@@ -65,6 +66,11 @@ const LayoutCommunitySlugRoute = LayoutCommunitySlugRouteImport.update({
65
66
  path: '/$slug',
66
67
  getParentRoute: () => LayoutCommunityRoute,
67
68
  } as any)
69
+ const LayoutServiceDesksSlugRoute = LayoutServiceDesksSlugRouteImport.update({
70
+ id: '/$slug',
71
+ path: '/$slug',
72
+ getParentRoute: () => LayoutServiceDesksRoute,
73
+ } as any)
68
74
  const LayoutCatalogAppsIndexRoute = LayoutCatalogAppsIndexRouteImport.update({
69
75
  id: '/catalog/apps/',
70
76
  path: '/catalog/apps/',
@@ -81,10 +87,11 @@ export interface FileRoutesByFullPath {
81
87
  '/community': typeof LayoutCommunityRouteWithChildren
82
88
  '/login': typeof LayoutLoginRoute
83
89
  '/mcp': typeof LayoutMcpRoute
84
- '/service-desks': typeof LayoutServiceDesksRoute
90
+ '/service-desks': typeof LayoutServiceDesksRouteWithChildren
85
91
  '/auth/callback': typeof AuthCallbackRoute
86
92
  '/app/$slug': typeof LayoutAppSlugRoute
87
93
  '/community/$slug': typeof LayoutCommunitySlugRoute
94
+ '/service-desks/$slug': typeof LayoutServiceDesksSlugRoute
88
95
  '/catalog/apps/': typeof LayoutCatalogAppsIndexRoute
89
96
  '/app/$slug/sub/$subSlug': typeof LayoutAppSlugSubSubSlugRoute
90
97
  }
@@ -92,11 +99,12 @@ export interface FileRoutesByTo {
92
99
  '/community': typeof LayoutCommunityRouteWithChildren
93
100
  '/login': typeof LayoutLoginRoute
94
101
  '/mcp': typeof LayoutMcpRoute
95
- '/service-desks': typeof LayoutServiceDesksRoute
102
+ '/service-desks': typeof LayoutServiceDesksRouteWithChildren
96
103
  '/auth/callback': typeof AuthCallbackRoute
97
104
  '/': typeof LayoutIndexRoute
98
105
  '/app/$slug': typeof LayoutAppSlugRoute
99
106
  '/community/$slug': typeof LayoutCommunitySlugRoute
107
+ '/service-desks/$slug': typeof LayoutServiceDesksSlugRoute
100
108
  '/catalog/apps': typeof LayoutCatalogAppsIndexRoute
101
109
  '/app/$slug/sub/$subSlug': typeof LayoutAppSlugSubSubSlugRoute
102
110
  }
@@ -106,11 +114,12 @@ export interface FileRoutesById {
106
114
  '/_layout/community': typeof LayoutCommunityRouteWithChildren
107
115
  '/_layout/login': typeof LayoutLoginRoute
108
116
  '/_layout/mcp': typeof LayoutMcpRoute
109
- '/_layout/service-desks': typeof LayoutServiceDesksRoute
117
+ '/_layout/service-desks': typeof LayoutServiceDesksRouteWithChildren
110
118
  '/auth/callback': typeof AuthCallbackRoute
111
119
  '/_layout/': typeof LayoutIndexRoute
112
120
  '/_layout/app/$slug': typeof LayoutAppSlugRoute
113
121
  '/_layout/community/$slug': typeof LayoutCommunitySlugRoute
122
+ '/_layout/service-desks/$slug': typeof LayoutServiceDesksSlugRoute
114
123
  '/_layout/catalog/apps/': typeof LayoutCatalogAppsIndexRoute
115
124
  '/_layout/app/$slug_/sub/$subSlug': typeof LayoutAppSlugSubSubSlugRoute
116
125
  }
@@ -125,6 +134,7 @@ export interface FileRouteTypes {
125
134
  | '/auth/callback'
126
135
  | '/app/$slug'
127
136
  | '/community/$slug'
137
+ | '/service-desks/$slug'
128
138
  | '/catalog/apps/'
129
139
  | '/app/$slug/sub/$subSlug'
130
140
  fileRoutesByTo: FileRoutesByTo
@@ -137,6 +147,7 @@ export interface FileRouteTypes {
137
147
  | '/'
138
148
  | '/app/$slug'
139
149
  | '/community/$slug'
150
+ | '/service-desks/$slug'
140
151
  | '/catalog/apps'
141
152
  | '/app/$slug/sub/$subSlug'
142
153
  id:
@@ -150,6 +161,7 @@ export interface FileRouteTypes {
150
161
  | '/_layout/'
151
162
  | '/_layout/app/$slug'
152
163
  | '/_layout/community/$slug'
164
+ | '/_layout/service-desks/$slug'
153
165
  | '/_layout/catalog/apps/'
154
166
  | '/_layout/app/$slug_/sub/$subSlug'
155
167
  fileRoutesById: FileRoutesById
@@ -224,6 +236,13 @@ declare module '@tanstack/react-router' {
224
236
  preLoaderRoute: typeof LayoutCommunitySlugRouteImport
225
237
  parentRoute: typeof LayoutCommunityRoute
226
238
  }
239
+ '/_layout/service-desks/$slug': {
240
+ id: '/_layout/service-desks/$slug'
241
+ path: '/$slug'
242
+ fullPath: '/service-desks/$slug'
243
+ preLoaderRoute: typeof LayoutServiceDesksSlugRouteImport
244
+ parentRoute: typeof LayoutServiceDesksRoute
245
+ }
227
246
  '/_layout/catalog/apps/': {
228
247
  id: '/_layout/catalog/apps/'
229
248
  path: '/catalog/apps'
@@ -253,11 +272,22 @@ const LayoutCommunityRouteWithChildren = LayoutCommunityRoute._addFileChildren(
253
272
  LayoutCommunityRouteChildren,
254
273
  )
255
274
 
275
+ interface LayoutServiceDesksRouteChildren {
276
+ LayoutServiceDesksSlugRoute: typeof LayoutServiceDesksSlugRoute
277
+ }
278
+
279
+ const LayoutServiceDesksRouteChildren: LayoutServiceDesksRouteChildren = {
280
+ LayoutServiceDesksSlugRoute: LayoutServiceDesksSlugRoute,
281
+ }
282
+
283
+ const LayoutServiceDesksRouteWithChildren =
284
+ LayoutServiceDesksRoute._addFileChildren(LayoutServiceDesksRouteChildren)
285
+
256
286
  interface LayoutRouteChildren {
257
287
  LayoutCommunityRoute: typeof LayoutCommunityRouteWithChildren
258
288
  LayoutLoginRoute: typeof LayoutLoginRoute
259
289
  LayoutMcpRoute: typeof LayoutMcpRoute
260
- LayoutServiceDesksRoute: typeof LayoutServiceDesksRoute
290
+ LayoutServiceDesksRoute: typeof LayoutServiceDesksRouteWithChildren
261
291
  LayoutIndexRoute: typeof LayoutIndexRoute
262
292
  LayoutAppSlugRoute: typeof LayoutAppSlugRoute
263
293
  LayoutCatalogAppsIndexRoute: typeof LayoutCatalogAppsIndexRoute
@@ -268,7 +298,7 @@ const LayoutRouteChildren: LayoutRouteChildren = {
268
298
  LayoutCommunityRoute: LayoutCommunityRouteWithChildren,
269
299
  LayoutLoginRoute: LayoutLoginRoute,
270
300
  LayoutMcpRoute: LayoutMcpRoute,
271
- LayoutServiceDesksRoute: LayoutServiceDesksRoute,
301
+ LayoutServiceDesksRoute: LayoutServiceDesksRouteWithChildren,
272
302
  LayoutIndexRoute: LayoutIndexRoute,
273
303
  LayoutAppSlugRoute: LayoutAppSlugRoute,
274
304
  LayoutCatalogAppsIndexRoute: LayoutCatalogAppsIndexRoute,
@@ -0,0 +1,17 @@
1
+ import { createFileRoute } from '@tanstack/react-router'
2
+ import { z } from 'zod'
3
+
4
+ const searchSchema = z.object({
5
+ /** The card's tab, owned by DetailTabs. */
6
+ tab: z.string().optional(),
7
+ })
8
+
9
+ /**
10
+ * One form's card, `/service-desks/<desk key>-<form id>`. Renders nothing: the
11
+ * parent `/service-desks` route owns the page and reads the slug from the
12
+ * router, so opening a card never remounts the list or loses the search.
13
+ */
14
+ export const Route = createFileRoute('/_layout/service-desks/$slug')({
15
+ component: () => null,
16
+ validateSearch: searchSchema,
17
+ })
@@ -7,16 +7,12 @@ import { ServiceDesksPage } from '~/modules/appCatalog/ui/pages/ServiceDesksPage
7
7
  // text lives in sessionStorage now).
8
8
  const searchSchema = z.object({
9
9
  q: z.string().optional(),
10
- /** The desk whose card is open (its approval-method slug). */
11
- desk: z.string().optional(),
12
10
  /**
13
- * The form the card was opened on, when it came from a search result. A
14
- * number when the id is all digits: the router writes a digit-only string
15
- * as `"69"`, quotes and all, and a hand-typed `form=69` reads back as one.
11
+ * Legacy card address, `?desk=<method slug>&form=<id>`, shipped briefly before
12
+ * cards moved to `/service-desks/<slug>`. Read once and redirected.
16
13
  */
14
+ desk: z.string().optional(),
17
15
  form: z.union([z.number(), z.string()]).optional(),
18
- /** The card's tab, owned by DetailTabs. */
19
- tab: z.string().optional(),
20
16
  })
21
17
 
22
18
  export const Route = createFileRoute('/_layout/service-desks')({
@@ -23,6 +23,15 @@ export interface AreasSettings {
23
23
  dayToDayLabel?: string
24
24
  }
25
25
 
26
+ /**
27
+ * Presentation of the Service Desks view's area sections. A desk's area comes
28
+ * from its portal data, so the core knows none of them.
29
+ */
30
+ export interface ServiceDesksSettings {
31
+ /** Icon per area name, as the portals spell it. Areas without one show the accent bar. */
32
+ areaIcons?: Record<string, AreaIcon>
33
+ }
34
+
26
35
  /**
27
36
  * UI settings passed from the app entry point.
28
37
  */
@@ -43,6 +52,8 @@ export interface UiSettings {
43
52
  chatChannelUrlTemplate?: string
44
53
  /** Area sections on the home view: icons and the day-to-day fold. */
45
54
  areas?: AreasSettings
55
+ /** The Service Desks view's area sections. */
56
+ serviceDesks?: ServiceDesksSettings
46
57
  /** PWA auto-update configuration (idle timeout, check interval, debug) */
47
58
  pwaAutoUpdate?: PwaAutoUpdateOptions
48
59
  /**