wcz-layout 10.2.2 → 11.0.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 (115) hide show
  1. package/dist/{ChatLayout-CkS9oyPp.mjs → ChatLayout-B0MBrI-Y.mjs} +839 -371
  2. package/dist/ChatLayout-B0MBrI-Y.mjs.map +1 -0
  3. package/dist/{ExtractFile-ClTc-e1H.d.mts → ExtractFile-BQUXpuBS.d.mts} +27 -3
  4. package/dist/FileMeta-B5VU-eCi.d.mts +55 -0
  5. package/dist/FileMeta-BexXC_45.mjs +35 -0
  6. package/dist/FileMeta-BexXC_45.mjs.map +1 -0
  7. package/dist/QueryClientParam-BG9Q_9XU.d.mts +6 -0
  8. package/dist/{Translate-BiCjnlyx.mjs → Translate-C43AmXYW.mjs} +25 -37
  9. package/dist/Translate-C43AmXYW.mjs.map +1 -0
  10. package/dist/User-CvLutatT.d.mts +10 -0
  11. package/dist/ai.d.mts +1 -1
  12. package/dist/ai.mjs +2 -2
  13. package/dist/ai.mjs.map +1 -1
  14. package/dist/auth.d.mts +6 -14
  15. package/dist/auth.mjs +15 -38
  16. package/dist/auth.mjs.map +1 -1
  17. package/dist/{authMiddleware-D4GSt7m9.mjs → authMiddleware-ANa9Tlmp.mjs} +10 -15
  18. package/dist/authMiddleware-ANa9Tlmp.mjs.map +1 -0
  19. package/dist/{ChatLayout-BmLySLXy.d.mts → components-2HKj8GpC.d.mts} +219 -255
  20. package/dist/components.d.mts +2 -126
  21. package/dist/components.mjs +871 -919
  22. package/dist/components.mjs.map +1 -1
  23. package/dist/data/client.d.mts +299 -57
  24. package/dist/data/client.mjs +5 -6
  25. package/dist/data/client.mjs.map +1 -1
  26. package/dist/data/server.d.mts +6 -5
  27. package/dist/data/server.mjs +3 -5
  28. package/dist/data/server.mjs.map +1 -1
  29. package/dist/env-C4WLVJMm.mjs +32 -0
  30. package/dist/env-C4WLVJMm.mjs.map +1 -0
  31. package/dist/file-DBqTibcr.mjs +176 -0
  32. package/dist/file-DBqTibcr.mjs.map +1 -0
  33. package/dist/file-hecCQszp.mjs +114 -0
  34. package/dist/file-hecCQszp.mjs.map +1 -0
  35. package/dist/hooks.d.mts +11 -91
  36. package/dist/hooks.mjs +152 -960
  37. package/dist/hooks.mjs.map +1 -1
  38. package/dist/i18n-ZRiIIdpb.mjs +563 -0
  39. package/dist/i18n-ZRiIIdpb.mjs.map +1 -0
  40. package/dist/index.d.mts +3 -35
  41. package/dist/index.mjs +409 -510
  42. package/dist/index.mjs.map +1 -1
  43. package/dist/layout-DeTB6Ai1.mjs +224 -0
  44. package/dist/layout-DeTB6Ai1.mjs.map +1 -0
  45. package/dist/middleware.d.mts +1 -1
  46. package/dist/middleware.mjs +2 -2
  47. package/dist/models.d.mts +34 -42
  48. package/dist/models.mjs +4 -6
  49. package/dist/models.mjs.map +1 -1
  50. package/dist/oidc--D2ox365.mjs +97 -0
  51. package/dist/oidc--D2ox365.mjs.map +1 -0
  52. package/dist/peoplesoft-DhwB8jrM.d.mts +204 -0
  53. package/dist/tokens-C4djIAhl.mjs +97 -0
  54. package/dist/tokens-C4djIAhl.mjs.map +1 -0
  55. package/dist/useDialogs-QER-2rVG.mjs +297 -0
  56. package/dist/useDialogs-QER-2rVG.mjs.map +1 -0
  57. package/dist/{user-Bc2nLjAG.mjs → user-DQx1BanQ.mjs} +4 -20
  58. package/dist/user-DQx1BanQ.mjs.map +1 -0
  59. package/dist/{utils-CNYCSgip.d.mts → utils-BnyAEKW7.d.mts} +7 -9
  60. package/dist/{utils-CgabUlDD.mjs → utils-H4BskGF8.mjs} +21 -20
  61. package/dist/utils-H4BskGF8.mjs.map +1 -0
  62. package/dist/utils.d.mts +21 -4
  63. package/dist/utils.mjs +5 -4
  64. package/dist/vite.mjs +98 -32
  65. package/dist/vite.mjs.map +1 -1
  66. package/package.json +16 -43
  67. package/skills/ai/SKILL.md +1 -4
  68. package/skills/general/SKILL.md +15 -8
  69. package/skills/general/references/auth.md +10 -16
  70. package/skills/general/references/languages.md +56 -0
  71. package/skills/migrations/versions/migrate-v10-to-v11.md +98 -22
  72. package/skills/migrations/versions/migrate-v9-to-v10.md +22 -22
  73. package/skills/services/SKILL.md +1 -1
  74. package/skills/services/docs/email.md +2 -2
  75. package/skills/services/docs/file.md +100 -85
  76. package/skills/services/docs/layout.md +2 -3
  77. package/skills/start/steps/02-project-name-setup.md +1 -1
  78. package/skills/start/steps/06-entra-setup.md +1 -1
  79. package/skills/start/steps/08-generate-favicon.md +1 -1
  80. package/skills/table/SKILL.md +18 -5
  81. package/src/lib/locales/cs.json +120 -0
  82. package/src/lib/locales/en.json +119 -0
  83. package/src/lib/locales/uk.json +121 -0
  84. package/src/lib/locales/zh-TW.json +118 -0
  85. package/dist/ChatLayout-CkS9oyPp.mjs.map +0 -1
  86. package/dist/DialogsContext-D23fJjYR.mjs +0 -6
  87. package/dist/DialogsContext-D23fJjYR.mjs.map +0 -1
  88. package/dist/FileMeta-B39e2FLC.d.mts +0 -17
  89. package/dist/FileMeta-CPBWI_jA.mjs +0 -18
  90. package/dist/FileMeta-CPBWI_jA.mjs.map +0 -1
  91. package/dist/QueryClientParam-CTV1vj76.d.mts +0 -8
  92. package/dist/RouterListItemButton-CF-8w-08.mjs +0 -62
  93. package/dist/RouterListItemButton-CF-8w-08.mjs.map +0 -1
  94. package/dist/Translate-BiCjnlyx.mjs.map +0 -1
  95. package/dist/User-aJksXItw.d.mts +0 -12
  96. package/dist/authMiddleware-D4GSt7m9.mjs.map +0 -1
  97. package/dist/createApi-CF4ZL82B.mjs +0 -24
  98. package/dist/createApi-CF4ZL82B.mjs.map +0 -1
  99. package/dist/env-Cddts_dn.mjs +0 -49
  100. package/dist/env-Cddts_dn.mjs.map +0 -1
  101. package/dist/file-D4kSR_lC.mjs +0 -149
  102. package/dist/file-D4kSR_lC.mjs.map +0 -1
  103. package/dist/file-DcwYjofa.mjs +0 -150
  104. package/dist/file-DcwYjofa.mjs.map +0 -1
  105. package/dist/layout-6We_KFgN.mjs +0 -107
  106. package/dist/layout-6We_KFgN.mjs.map +0 -1
  107. package/dist/peoplesoft-DH31FCMC.mjs +0 -125
  108. package/dist/peoplesoft-DH31FCMC.mjs.map +0 -1
  109. package/dist/peoplesoft-DXukeeFr.d.mts +0 -161
  110. package/dist/providers-DOFje2P6.mjs +0 -56
  111. package/dist/providers-DOFje2P6.mjs.map +0 -1
  112. package/dist/tokens-DNe_Qifk.mjs +0 -204
  113. package/dist/tokens-DNe_Qifk.mjs.map +0 -1
  114. package/dist/user-Bc2nLjAG.mjs.map +0 -1
  115. package/dist/utils-CgabUlDD.mjs.map +0 -1
@@ -1,43 +1,60 @@
1
1
  # file
2
2
 
3
+ Files live in the WCZ file service, under the app's `package.json` name (set automatically; never
4
+ passed). App servers call it with the signed-in user's Entra token, or with the app token when
5
+ nobody is signed in (public routes, jobs). Browsers use the URLs it returns (`<img src>`,
6
+ `<a href>`, `window.open`) and upload straight to it. No token ever reaches the browser: every URL
7
+ is signed for one file, for 2-3 hours, unless the file is `public`.
8
+
3
9
  ## Client
4
10
 
5
11
  `import { ... } from "wcz-layout/data/client";`
6
12
 
7
- - Query:
8
- `fileMetasQueryOptions(GetFileMetasSchema)` → `FileMeta[]` // metadata of all files under `subId`
9
- `fileThumbnailQueryOptions(FileSchema)` → `string` // thumbnail as object URL, disabled while `id` is empty
10
- `fileQueryOptions(FileSchema)` → `string` // file content as object URL for preview, disabled while `id` is empty
13
+ - Query (refreshed hourly so their URLs never expire; read URLs from the query, never store them):
14
+ `fileMetasQueryOptions({ subId })` → `FileMeta[]` // files under `subId` the caller can read
15
+ `fileMetaQueryOptions({ id })` → `FileMeta` // one file, disabled while `id` is empty
11
16
  - Mutation:
12
- `downloadFileMutationOptions()` → `mutate(FileSchema & { fileName, fileExtension })` // downloads and saves as `fileName.fileExtension`
13
- `openFileMutationOptions({ target })` → `mutate(FileSchema)` // opens file in new tab; `target` is a `useRef<Window | null>`, open `about:blank` into it synchronously in the click handler to avoid popup blockers
14
- `updateFileMetaMutationOptions({ queryClient })` → `mutate(UpdateFileMetaSchema)` // update metadata (e.g. rename `fileName`), invalidates metas
15
- `deleteFileMutationOptions({ queryClient })` → `mutate(FileSchema)` // delete single file, invalidates metas
16
- `batchDeleteFilesMutationOptions({ queryClient })` → `mutate(GetFileMetasSchema)` // delete all files under `subId`, invalidates metas
17
- `uploadFileMutationOptions({ queryClient })` → `mutate(UploadFileMetaSchema & { setProgress? })` → `{ id, appName, subId, fileName }` // uploads directly from browser via TUS (1 MB chunks), `setProgress(percent)` for a progress bar, invalidates metas of `subId`
17
+ `uploadFileMutationOptions({ queryClient })` → `mutate({ subId, file, id?, public?, permissions?, setProgress?, signal? })` → `FileMeta` // 1 MiB chunks straight to the file service; retries network failures for ~2 min and resumes; `setProgress(percent)`; `signal` cancels; the type comes from the extension; invalidates metas of `subId`
18
+ `updateFileMetaMutationOptions({ queryClient })` → `mutate(UpdateFileMetaSchema)` → `FileMeta` // rename (base name), move to another `subId`, change `public` / `permissions`; needs write
19
+ `deleteFileMutationOptions({ queryClient })` → `mutate({ id })` // needs write
20
+ `batchDeleteFilesMutationOptions({ queryClient })` → `mutate({ subId })` // every file under `subId`, or none when the caller can't delete one of them
21
+
22
+ Open, show and download with the URLs: `window.open(meta.urls.view)` (Office files open as PDF,
23
+ types the browser can't show download), `<img src={meta.urls.thumbnail}>` (default icon for
24
+ non-images), `<a href={meta.urls.download}>` (always the original, as an attachment).
18
25
 
19
26
  ## Server
20
27
 
21
28
  `import { ... } from "wcz-layout/data/server";`
22
29
 
23
- - Fetch:
24
- `getFileMetas({ data: GetFileMetasSchema })` → `FileMeta[]` // metadata of all files under `subId`
25
- `getFileThumbnail({ data: FileSchema })` → `Response` // thumbnail binary stream
26
- `getFile({ data: FileSchema })` → `Response` // file binary stream, `Content-Disposition: inline`
27
- `downloadFile({ data: FileSchema })` → `Response` // file binary stream for download
28
- - Mutate:
29
- `updateFileMeta({ data: UpdateFileMetaSchema })` → `void` // update metadata
30
- `deleteFile({ data: FileSchema })` → `void` // delete single file
31
- `batchDeleteFiles({ data: GetFileMetasSchema })` → `void` // delete all files under `subId`
32
- `uploadFile({ data: UploadFileMetaSchema })` → `{ id, appName, subId, fileName }` // server-originated uploads only, client uploads go direct via `uploadFileMutationOptions`
30
+ `getFileMetas`, `getFileMeta`, `updateFileMeta`, `deleteFile`, `batchDeleteFiles` take
31
+ `{ data }` like the client ones.
32
+ `uploadFile({ data: UploadFileSchema })` → `FileMeta` // server-originated files, e.g. a generated report
33
+ File bytes on the server: `fetch(meta.urls.download)`.
34
+
35
+ ## Permissions
36
+
37
+ `public` and `permissions` decide access; omitted, everyone the app serves reads and changes the
38
+ file: every employee, and anonymous visitors of a public route.
39
+
40
+ - `public: true` — anyone reads it without signing in (stable, unsigned URLs). Never grants write.
41
+ - `permissions: { read, write }` — both required when sent. Each is `null` (no restriction:
42
+ read = everyone, write = whoever can read) or a non-empty list of
43
+ `{ group: "<sAMAccountName>" }` / `{ employeeId: "<id>" }`. Write implies read.
44
+ - Anonymous visitors (the app token) have no groups and no employee ID: they reach only files
45
+ without a list, so restrict `write` (e.g. to an admin group) to keep them from changing or
46
+ deleting files, and `read` to hide files from them.
47
+ - A group must reach the File API token: with "Groups assigned to the application" it has to be
48
+ assigned to the File API registration. Employee entries have no such limit.
49
+ - `meta.canWrite` tells whether the caller may rename or delete it; hide those actions otherwise.
33
50
 
34
51
  ## Components
35
52
 
36
53
  `import { Dropzone, FileViewer } from "wcz-layout/components";`
37
54
 
38
55
  - `<Dropzone onDrop progress? sx? {...DropzoneOptions} />` // react-dropzone area (`accept`, `maxFiles`, `disabled`, `onDropAccepted`, …), `progress` (0-100) shows upload progress
39
- - `<FileViewer appName subId actions? onDelete?>{(component) => <component.Grid /> | <component.List />}</FileViewer>` // fetches metas itself, renders nothing when there are no files
40
- - `actions?: { download?: boolean, delete?: boolean }` // both enabled by default
56
+ - `<FileViewer subId actions? onDelete?>{(component) => <component.Grid /> | <component.List />}</FileViewer>` // fetches metas itself, renders nothing when there are no files; thumbnails load lazily, and hovering a file (up to 20 MB) prefetches it so it opens instantly
57
+ - `actions?: { download?: boolean, delete?: boolean }` // both enabled by default; delete shows only where `canWrite`
41
58
  - `onDelete?: ({ remainingFileMetas: FileMeta[], deletedFileMeta: FileMeta }) => void`
42
59
  - `component.Grid` props: `size?: number` (default 150), `itemBar?: "hidden" | "always" | "onMouseEnter"` (default on hover), `sx?`
43
60
  - `component.List` props: `sx?`
@@ -45,81 +62,83 @@
45
62
  ## Schemas/Models
46
63
 
47
64
  ```ts
48
- const FileMetaSchema = z.object({
49
- id: z.uuid(),
50
- subId: z.uuid(),
51
- appName: z.string().trim().min(1).max(255),
52
- fileName: z.string().trim().min(1).max(255),
53
- fileExtension: z.string().trim().min(1).max(255),
54
- fileSize: z.number().min(0),
55
- mediaSubType: z.string().trim().min(1).max(255),
56
- mediaType: z.string().trim().min(1).max(255),
57
- mimeType: z.string().trim().min(1).max(255),
58
- createdBy: z.string().trim().min(1).max(255),
59
- createdDate: z.date(),
65
+ const FilePrincipalSchema = z.union([
66
+ z.strictObject({ group: z.string().trim().min(1) }),
67
+ z.strictObject({ employeeId: z.string().trim().min(1) }),
68
+ ]);
69
+ const FilePermissionsSchema = z.object({
70
+ read: z.array(FilePrincipalSchema).min(1).nullable(),
71
+ write: z.array(FilePrincipalSchema).min(1).nullable(),
60
72
  });
61
73
 
62
- const GetFileMetasSchema = z.object({
63
- appName: z.string().min(1).max(255),
64
- subId: z.uuid(),
65
- });
66
-
67
- const FileSchema = z.object({
68
- appName: z.string().min(1).max(255),
74
+ const FileMetaSchema = z.object({
69
75
  id: z.uuid(),
76
+ appName: z.string(),
77
+ subId: z.string(),
78
+ fileName: z.string(), // without the extension
79
+ fileExtension: z.string(),
80
+ fileSize: z.number(),
81
+ mimeType: z.string(), // from the extension
82
+ mediaType: z.string(), // "image", "video", "application", …
83
+ mediaSubType: z.string(),
84
+ public: z.boolean(),
85
+ permissions: FilePermissionsSchema,
86
+ canWrite: z.boolean(),
87
+ urls: z.object({
88
+ view: z.url(),
89
+ download: z.url(),
90
+ thumbnail: z.url(),
91
+ install: z.string().optional(), // .ipa only: itms-services:// install link
92
+ }),
70
93
  });
71
94
 
72
- const UpdateFileMetaSchema = FileMetaSchema.extend({
73
- fileName: z.string().min(1).max(255),
95
+ const GetFileMetasSchema = z.object({ subId: z.string().min(1).max(255) });
96
+ const FileSchema = z.object({ id: z.uuid() });
97
+ const UpdateFileMetaSchema = FileSchema.extend({
98
+ fileName: z.string().trim().min(1).max(255).optional(),
99
+ subId: z.string().min(1).max(255).optional(),
100
+ public: z.boolean().optional(),
101
+ permissions: FilePermissionsSchema.optional(),
74
102
  });
75
-
76
- const UploadFileMetaSchema = z.object({
77
- id: z.uuid().default(uuidv7),
78
- appName: z.string().min(1).max(255),
79
- subId: z.uuid(),
103
+ const UploadFileSchema = z.object({
104
+ id: z.uuidv7().default(uuidv7),
105
+ subId: z.string().min(1).max(255),
80
106
  file: z.instanceof(File),
107
+ public: z.boolean().optional(),
108
+ permissions: FilePermissionsSchema.optional(),
81
109
  });
82
110
  ```
83
111
 
84
112
  ## Examples
85
113
 
86
114
  ```tsx
87
- import { useRef, useState } from "react";
115
+ import { useState } from "react";
88
116
  import { useMutation, useQuery } from "@tanstack/react-query";
89
117
  import {
90
118
  deleteFileMutationOptions,
91
- downloadFileMutationOptions,
92
119
  fileMetasQueryOptions,
93
- fileQueryOptions,
94
- openFileMutationOptions,
95
120
  uploadFileMutationOptions,
96
121
  } from "wcz-layout/data/client";
97
122
  import { Dropzone, FileViewer } from "wcz-layout/components";
98
- import { useInView } from "wcz-layout/hooks";
99
-
100
- const { queryClient } = Route.useRouteContext();
101
123
 
102
- // fetch metas (lazily when in view) + fetch first file
103
- const { ref, inView } = useInView({ triggerOnce: true });
124
+ const { queryClient, user } = Route.useRouteContext();
104
125
 
105
- const { data: fileMetas = [] } = useQuery({
106
- ...fileMetasQueryOptions({ appName: packageJson.name, subId }),
107
- enabled: inView,
108
- });
109
-
110
- const { data: file } = useQuery({
111
- ...fileQueryOptions({ appName: packageJson.name, id: fileMetas[0]?.id ?? "" }),
112
- enabled: !!fileMetas[0],
113
- });
114
-
115
- // upload via Dropzone
126
+ // upload via Dropzone; only the uploader and HR may read, only HR may change
116
127
  const [progress, setProgress] = useState(0);
117
128
  const { mutateAsync: uploadFile } = useMutation(uploadFileMutationOptions({ queryClient }));
118
129
 
119
130
  const onDrop = async (acceptedFiles: File[]) => {
120
131
  await Promise.allSettled(
121
132
  acceptedFiles.map((file) =>
122
- uploadFile({ appName: packageJson.name, subId, file, setProgress }),
133
+ uploadFile({
134
+ subId,
135
+ file,
136
+ setProgress,
137
+ permissions: {
138
+ read: [{ employeeId: user.employeeId }, { group: "hr" }],
139
+ write: [{ group: "hr" }],
140
+ },
141
+ }),
123
142
  ),
124
143
  );
125
144
  setProgress(0);
@@ -127,24 +146,20 @@ const onDrop = async (acceptedFiles: File[]) => {
127
146
 
128
147
  <Dropzone onDrop={onDrop} progress={progress} />;
129
148
 
130
- // download / delete
131
- const { mutate: download } = useMutation(downloadFileMutationOptions());
132
- const { mutate: remove } = useMutation(deleteFileMutationOptions({ queryClient }));
149
+ // public route (no requireAuth): anonymous visitors add photos only admins may delete
150
+ uploadFile({ subId, file, permissions: { read: null, write: [{ group: "canteen-admins" }] } });
133
151
 
134
- download({
135
- appName: packageJson.name,
136
- id: meta.id,
137
- fileName: meta.fileName,
138
- fileExtension: meta.fileExtension,
139
- });
140
- remove({ appName: packageJson.name, id: meta.id });
152
+ // own list: open, show, download, delete
153
+ const { data: fileMetas = [] } = useQuery(fileMetasQueryOptions({ subId }));
154
+ const { mutate: remove } = useMutation(deleteFileMutationOptions({ queryClient }));
141
155
 
142
- // open file
143
- const target = useRef<Window | null>(null);
144
- const { mutate: openFile } = useMutation(openFileMutationOptions({ target }));
156
+ <img src={meta.urls.thumbnail} alt="" loading="lazy" />;
157
+ <Button onClick={() => window.open(meta.urls.view, "_blank", "noopener")}>Open</Button>;
158
+ <Button href={meta.urls.download}>Download</Button>;
159
+ {
160
+ meta.canWrite && <Button onClick={() => remove({ id: meta.id })}>Delete</Button>;
161
+ }
145
162
 
146
163
  // File Viewer - no manual fetch of metas needed
147
- <FileViewer appName={packageJson.name} subId={subId}>
148
- {(component) => <component.Grid />} // or component.List
149
- </FileViewer>;
164
+ <FileViewer subId={subId}>{(component) => <component.Grid />} // or component.List</FileViewer>;
150
165
  ```
@@ -5,7 +5,7 @@ gateway env of its own for them.
5
5
 
6
6
  ## Notes
7
7
 
8
- - **Setup:** add `LAYOUT_BASE_URL: z.url()` to the `server` block of `src/env.ts` with the layout
8
+ - **Setup:** add `LAYOUT_BASE_URL: z.url()` to `server` in `src/env.ts` with the layout
9
9
  app's URL in `.env`, and `layout: "api://wistron.com/devportal/access_as_user"` to the app's
10
10
  scopes. `AI_BASE_URL` is a different thing: the AI gateway `chatAdapter` calls (see the `ai` skill).
11
11
  - **Translate instead of prompting:** text a user typed (a name, a question, a description) gets
@@ -16,7 +16,7 @@ gateway env of its own for them.
16
16
  - One call per text, not streamed. Translate several texts with one call each, in parallel.
17
17
  - **Extract instead of prompting:** data read from a document or photo (an invoice, a label, a
18
18
  form) comes from `extractFile`; never send a file to a model from the app. Upload the file with
19
- the file service first, then pass its `appName` and `fileId`.
19
+ the file service first, then pass its `fileId`.
20
20
  - **File access:** the layout app downloads the file on behalf of the signed-in user (OBO), so it
21
21
  reads only files that user can open. A call without a user (a background job on the server
22
22
  `extractFile`) reads the file with the layout app's own token instead.
@@ -61,7 +61,6 @@ const TranslateSchema = z.object({
61
61
  type Translation = { detected: string } & Record<string, string>; // { detected: "cs", en, cs, uk }
62
62
 
63
63
  const ExtractFileSchema = z.object({
64
- appName: z.string().min(1).max(255),
65
64
  fileId: z.uuid(),
66
65
  fields: z.record(
67
66
  z.string().regex(/^[A-Za-z][A-Za-z0-9_]{0,63}$/), // 1 to 50 fields
@@ -16,4 +16,4 @@ Using the full name, search-and-replace across the **entire workspace**:
16
16
  | `project-name` | kebab-case version (e.g. `user-input`) |
17
17
  | `Project Name` | Title Case version (e.g. `User Input`) |
18
18
 
19
- If a short name was provided, set the `short_name` property in `public/manifest.json` to it.
19
+ If a short name was provided, set the `short_name` property in `public/manifest.webmanifest` to it.
@@ -74,7 +74,7 @@ SESSION_SECRET=<generated-64-char-hex>
74
74
 
75
75
  3. **Certificates & secrets:** open the **Client secrets** tab → **+ New client secret**. Leave **Description** empty and set **Expires** to `730 days (24 months)` — always these values, never ask the user — then click **Add**. **CRITICAL — one chance only:** the new row's **Value** column holds the secret and is shown _only_ immediately after creation; once you leave or reload the blade it is masked forever and the app must get a brand-new secret. Read that **Value** from the row's textbox in the page snapshot, and write it into `ENTRA_CLIENT_SECRET` in `.env.local` as your very next action, before any other click or navigation. The neighbouring **Secret ID** column is a plain GUID and is _not_ the secret — writing it there is a silent, unrecoverable mistake. The cell renders truncated with `…`, so take the textbox's full value from the snapshot, and never print it in chat or a commit.
76
76
  4. **Token configuration:** click **Add groups claim**. In the panel tick **Security groups** only, then expand each of **ID**, **Access**, and **SAML** in "Customize token properties by type" and switch the radio from `Group ID` to `sAMAccountName`. Click **Add**. The list should then show a `groups` claim with token type `ID, Access, SAML`.
77
- 5. **Expose an API:** next to **Application ID URI** click **Add** (or **Edit** if one exists). The portal prefills `api://<client-id>` — replace it with `api://wistron.com/<app-name>` (for `wh-fg-preparation`: `api://wistron.com/wh-fg-preparation`) and **Save**. Then **+ Add a scope** named `access_as_user`, set **Who can consent?** to `Admins and users`, and fill only the two required fields — **Admin consent display name** and **Admin consent description**. Leave the user consent fields empty (optional) and **State** on `Enabled`, then click **Add scope**. Do not navigate away or report progress as complete until the saved `api://wistron.com/<app-name>` URI and enabled `access_as_user` scope are both visible in the portal. Then set the `api` key in `src/lib/auth/scopes.ts` to the plain string `"api://wistron.com/<app-name>/access_as_user"` (`Scope` is `string | Partial<Record<ProviderId, string>>` — an array fails `satisfies Scopes`), matching the scope exactly as the portal lists it; leave the other keys untouched.
77
+ 5. **Expose an API:** next to **Application ID URI** click **Add** (or **Edit** if one exists). The portal prefills `api://<client-id>` — replace it with `api://wistron.com/<app-name>` (for `wh-fg-preparation`: `api://wistron.com/wh-fg-preparation`) and **Save**. Then **+ Add a scope** named `access_as_user`, set **Who can consent?** to `Admins and users`, and fill only the two required fields — **Admin consent display name** and **Admin consent description**. Leave the user consent fields empty (optional) and **State** on `Enabled`, then click **Add scope**. Do not navigate away or report progress as complete until the saved `api://wistron.com/<app-name>` URI and enabled `access_as_user` scope are both visible in the portal. Then set the `api` key in `src/lib/auth/scopes.ts` to the plain string `"api://wistron.com/<app-name>/access_as_user"` (every `Scopes` value is one string — an array fails `satisfies Scopes`), matching the scope exactly as the portal lists it; leave the other keys untouched.
78
78
  6. **Owners:** first read the current table once. Add only missing people from this fixed list: Radim Staworowski, Martin Husar, Dalibor Homola, Patrik Lorenc, Tien Thanh Tran, Sebastian Ondruska. In the picker, search each missing full name, wait for the exact name and Wistron UPN match, select it, then replace the search text with the next name without closing the picker. Submit the batch once and verify all six names in the refreshed table.
79
79
  7. **Manifest:** the page opens the **Microsoft Graph App Manifest (New)** JSON in a Monaco editor. Do not retype the JSON — click into the editor, press `Ctrl+H`, and run Replace All twice: `"acceptMappedClaims": null` → `"acceptMappedClaims": true`, then `"requestedAccessTokenVersion": null` → `"requestedAccessTokenVersion": 2` (both live in the `api` object, one match each). Verify both edited lines, then click **Save**.
80
80
 
@@ -3,6 +3,6 @@
3
3
  1. Ask the user for the absolute filesystem path to their app logo. Recommend a square PNG, JPG, BMP, or WEBP image at least 512 x 512 pixels, but continue with a smaller image when the user provides one.
4
4
  2. Verify that the supplied path exists and is an image file.
5
5
  3. Check whether `favicons` is installed globally. If it is missing, run `npm install --global favicons`. Do not add it to this project's dependencies.
6
- 4. Set `NODE_PATH` to the result of `npm root --global` and use a temporary CommonJS Node script to call `favicons(sourcePath, options)`. Enable Android and favicon output, enable Apple output with `background: "transparent"`, and disable Apple startup, Windows, and Yandex assets. Write the returned `images` and `files` entries to `/public`.
6
+ 4. Set `NODE_PATH` to the result of `npm root --global` and use a temporary CommonJS Node script to call `favicons(sourcePath, options)`. Enable Android and favicon output, enable Apple output with `background: "transparent"`, and disable Apple startup, Windows, and Yandex assets. Write only the returned `images` entries to `/public` (skip `files` so `public/manifest.webmanifest` is not overwritten).
7
7
  5. Keep only the existing favicon assets that the template owns: `android-chrome-192x192.png`, `android-chrome-512x512.png`, `apple-touch-icon.png`, `favicon-16x16.png`, `favicon-32x32.png`, and `favicon.ico`. Delete any additional generated assets and the temporary script. Leave unrelated public assets unchanged.
8
8
  6. Verify that all six favicon assets exist, then report completion to the user.
@@ -26,7 +26,7 @@ setup: `LayoutTable` (`wcz-layout/components`) does both.
26
26
  link or another interactive element.
27
27
  - Selection and actions display columns: `size: 50`, `enableResizing: false`,
28
28
  `enableCellSelection: false`; each extra visible action button adds about 40 px.
29
- - `meta` keys: `label`, `align`, `variant`, `options`, `flex`. A column whose `header` is not
29
+ - `meta` keys: `label`, `align`, `variant`, `options`, `flex`, `edit`. A column whose `header` is not
30
30
  a plain string needs `meta.label` (header menu, column selector and filter picker read it).
31
31
  - `meta.variant` picks the filter: `"text"` (default), `"number"`, `"boolean"`, `"date"`,
32
32
  `"select"`, `"multi-select"`. Select variants build their options from the faceted unique
@@ -42,14 +42,27 @@ setup: `LayoutTable` (`wcz-layout/components`) does both.
42
42
  delete, `when("settled")`, then `table.resetRowSelection()`; `catch` alerts. Icons are
43
43
  `fontSize="small"` inside a `Tooltip`.
44
44
  - `LayoutTable` props: `title`, `actions`, `showToolbar`, `loading`, `pagination`,
45
- `pageSizeOptions`, `onRowClick`, `onRowDoubleClick`, `sx`, and `disableSearch`,
45
+ `onRowClick`, `onRowDoubleClick`, `onRowUpdate`, `editSchema`, `sx`, and `disableSearch`,
46
46
  `disableColumnFilter`, `disableColumnSelector`, `disableColumnMenu`.
47
+ - Inline editing: a column opts in with `meta.edit`, a bound form field (forms):
48
+ `edit: (field) => <field.TextField />`, `<field.NumberField />`, `<field.Checkbox />`, or
49
+ `<field.Autocomplete options={statusEnum.enumValues} disableClearable />`. `LayoutTable` saves
50
+ with `onRowUpdate={(row) => handleOnUpdate(row).when("settled")}` (the optimistic update; on
51
+ failure alert and rethrow, which keeps the editor open) and validates with
52
+ `editSchema={<Entity>Schema}`. A hovered row outlines its editable cells and the hovered one
53
+ shows a pencil; the pencil, a double-click, Enter or F2 edits the cell instead of running the
54
+ row action. Enter or a click outside saves, Escape cancels. Date columns stay read-only: the
55
+ pickers hold `Dayjs`, not the row's `Date`.
56
+ - `pagination` pages 25 rows, a fixed size with no rows-per-page picker; any other `pageSize`
57
+ in state or `initialState` is reset to 25 and page 0.
47
58
  - Server-paged tables (reports, lists sorted over more rows than the browser should hold;
48
59
  deep offset collection queries load a growing prefix, see client-db): use Query/server pages.
49
60
  Load upstream Query integration/state guidance for request keys, totals and manual flags; pass
50
- `manualPagination: true`, `rowCount` and controlled `state.pagination` /
51
- `onPaginationChange` (plus the `manual*` flags for what the server sorts and filters) to
52
- `useLayoutTable`, with `pagination` on `LayoutTable`.
61
+ `manualPagination: true`, `rowCount` (the server's total) and controlled `state.pagination`
62
+ (start it at `{ pageIndex: 0, pageSize: 25 }`) / `onPaginationChange` (plus the `manual*`
63
+ flags for what the server sorts and filters) to `useLayoutTable`, with `pagination` on
64
+ `LayoutTable`. No total yet: `pageCount: -1`, and the pager shows "of more than N" with
65
+ Next enabled.
53
66
 
54
67
  ## Example
55
68
 
@@ -0,0 +1,120 @@
1
+ {
2
+ "Layout": {
3
+ "LogIn": "Přihlásit se",
4
+ "Logout": "Odhlásit se",
5
+ "Language": "Jazyk",
6
+ "Appearance": "Vzhled",
7
+ "Light": "Světlý",
8
+ "Dark": "Tmavý",
9
+ "System": "Systém",
10
+ "ThisPageCouldNotBeFound": "Tato stránka nebyla nalezena.",
11
+ "Settings": "Nastavení",
12
+ "Unauthorized": "Neoprávněný",
13
+ "TestEnvironment": "Jste v <env>TESTOVACÍM</env> prostředí",
14
+ "Dialog": {
15
+ "Confirm": "Potvrdit",
16
+ "Cancel": "Zrušit",
17
+ "Alert": "Upozornění"
18
+ },
19
+ "File": {
20
+ "AreYouSureYouWantToDelete": "Opravdu chcete smazat {{name}}?",
21
+ "DragSomeFilesHereOrClickToSelectThem": "Přetáhněte sem některé soubory nebo je vyberte kliknutím",
22
+ "Delete": "Smazat",
23
+ "Download": "Stáhnout"
24
+ },
25
+ "Table": {
26
+ "Search": "Hledat",
27
+ "ClearSearch": "Zrušit hledání",
28
+ "ColumnMenu": "Nabídka sloupce",
29
+ "Filters": "Filtry",
30
+ "AddFilter": "Přidat filtr",
31
+ "RemoveFilter": "Odebrat filtr",
32
+ "ClearFilters": "Zrušit filtry",
33
+ "And": "a",
34
+ "Or": "nebo",
35
+ "Field": "Pole",
36
+ "Operator": "Operátor",
37
+ "Value": "Hodnota",
38
+ "NoValueRequired": "Hodnota není potřeba",
39
+ "From": "Od",
40
+ "To": "Do",
41
+ "DaysFromToday": "Dnů od dneška",
42
+ "NoRows": "Žádné řádky",
43
+ "SortAscending": "Seřadit vzestupně",
44
+ "SortDescending": "Seřadit sestupně",
45
+ "ClearSort": "Zrušit řazení",
46
+ "PinStart": "Připnout na začátek",
47
+ "PinEnd": "Připnout na konec",
48
+ "Unpin": "Odepnout",
49
+ "GroupBy": "Seskupit podle sloupce",
50
+ "Ungroup": "Zrušit seskupení",
51
+ "RowActions": "Akce řádku",
52
+ "EditCell": "Upravit",
53
+ "SelectedCount_one": "{{count}} vybraný",
54
+ "SelectedCount_few": "{{count}} vybrané",
55
+ "SelectedCount_other": "{{count}} vybraných",
56
+ "MoveLeft": "Posunout doleva",
57
+ "MoveRight": "Posunout doprava",
58
+ "Columns": "Sloupce",
59
+ "ShowHideAll": "Zobrazit/skrýt vše",
60
+ "HideColumn": "Skrýt sloupec",
61
+ "Operators": {
62
+ "includesString": "obsahuje",
63
+ "notIncludesString": "neobsahuje",
64
+ "equalsString": "je",
65
+ "notEqualsString": "není",
66
+ "startsWith": "začíná na",
67
+ "endsWith": "končí na",
68
+ "isEmpty": "je prázdné",
69
+ "isNotEmpty": "není prázdné",
70
+ "equals": "je",
71
+ "notEquals": "není",
72
+ "greaterThan": "je větší než",
73
+ "greaterThanOrEqualTo": "je větší nebo rovno",
74
+ "lessThan": "je menší než",
75
+ "lessThanOrEqualTo": "je menší nebo rovno",
76
+ "inRange": "je mezi",
77
+ "isRelativeToToday": "je relativní ke dnešku",
78
+ "Date": {
79
+ "lessThan": "je před",
80
+ "lessThanOrEqualTo": "je nejpozději",
81
+ "greaterThan": "je po",
82
+ "greaterThanOrEqualTo": "je nejdříve"
83
+ }
84
+ }
85
+ },
86
+ "Chat": {
87
+ "Assistant": "Asistent",
88
+ "Message": "Zeptejte se na cokoliv",
89
+ "Send": "Odeslat",
90
+ "Stop": "Zastavit",
91
+ "NewChat": "Nový chat",
92
+ "NewChatConfirm": "Začít nový chat? Tato konverzace bude smazána.",
93
+ "Reasoning": "Přemýšlím…",
94
+ "Regenerate": "Vygenerovat znovu",
95
+ "AreYouSure": "Opravdu?",
96
+ "RenderFailed": "Tento obsah nelze zobrazit.",
97
+ "Attach": "Připojit soubory",
98
+ "DropFiles": "Přetažením sem soubory připojíte",
99
+ "FileNotRead": "Soubor „{{name}}“ nelze připojit. Připojte obrázek nebo dokument (PDF, Word, Excel, PowerPoint, CSV nebo text) do 10 MB.",
100
+ "WritingCode": "Píšu kód…",
101
+ "RunningCode": "Spouštím kód…",
102
+ "RanCode": "Kód spuštěn",
103
+ "FindingTools": "Hledám nástroje…",
104
+ "FoundTools": "Nástroje vyhledány",
105
+ "ReadingPage": "Čtu stránku…",
106
+ "ReadPage": "Stránka přečtena",
107
+ "Clicking": "Klikám…",
108
+ "Clicked": "Kliknuto na „{{target}}“",
109
+ "Filling": "Vyplňuji…",
110
+ "Filled": "Vyplněno „{{target}}“",
111
+ "PressingKey": "Mačkám klávesu…",
112
+ "PressedKey": "Stisknuta klávesa {{target}}",
113
+ "UsingTool": "Používám nástroj {{name}}…",
114
+ "UsedTool": "Použit nástroj {{name}}",
115
+ "ToolStopped": "Nástroj {{name}} nedoběhl"
116
+ }
117
+ },
118
+ "Homepage": "Domovská stránka",
119
+ "GettingStarted": "Začínáme"
120
+ }
@@ -0,0 +1,119 @@
1
+ {
2
+ "Layout": {
3
+ "LogIn": "Log In",
4
+ "Logout": "Logout",
5
+ "Language": "Language",
6
+ "Appearance": "Appearance",
7
+ "Light": "Light",
8
+ "Dark": "Dark",
9
+ "System": "System",
10
+ "ThisPageCouldNotBeFound": "This page could not be found.",
11
+ "Settings": "Settings",
12
+ "Unauthorized": "Unauthorized",
13
+ "TestEnvironment": "You’re in the <env>TEST</env> environment",
14
+ "Dialog": {
15
+ "Confirm": "Confirm",
16
+ "Cancel": "Cancel",
17
+ "Alert": "Alert"
18
+ },
19
+ "File": {
20
+ "AreYouSureYouWantToDelete": "Are you sure you want to delete {{name}}?",
21
+ "DragSomeFilesHereOrClickToSelectThem": "Drag some files here or click to select them",
22
+ "Delete": "Delete",
23
+ "Download": "Download"
24
+ },
25
+ "Table": {
26
+ "Search": "Search",
27
+ "ClearSearch": "Clear search",
28
+ "ColumnMenu": "Column menu",
29
+ "Filters": "Filters",
30
+ "AddFilter": "Add filter",
31
+ "RemoveFilter": "Remove filter",
32
+ "ClearFilters": "Clear filters",
33
+ "And": "and",
34
+ "Or": "or",
35
+ "Field": "Field",
36
+ "Operator": "Operator",
37
+ "Value": "Value",
38
+ "NoValueRequired": "No value required",
39
+ "From": "From",
40
+ "To": "To",
41
+ "DaysFromToday": "Days from today",
42
+ "NoRows": "No rows",
43
+ "SortAscending": "Sort ascending",
44
+ "SortDescending": "Sort descending",
45
+ "ClearSort": "Clear sort",
46
+ "PinStart": "Pin to start",
47
+ "PinEnd": "Pin to end",
48
+ "Unpin": "Unpin",
49
+ "GroupBy": "Group by this column",
50
+ "Ungroup": "Stop grouping",
51
+ "RowActions": "Row actions",
52
+ "EditCell": "Edit",
53
+ "SelectedCount_one": "{{count}} selected",
54
+ "SelectedCount_other": "{{count}} selected",
55
+ "MoveLeft": "Move left",
56
+ "MoveRight": "Move right",
57
+ "Columns": "Columns",
58
+ "ShowHideAll": "Show/Hide all",
59
+ "HideColumn": "Hide column",
60
+ "Operators": {
61
+ "includesString": "contains",
62
+ "notIncludesString": "does not contain",
63
+ "equalsString": "is",
64
+ "notEqualsString": "is not",
65
+ "startsWith": "starts with",
66
+ "endsWith": "ends with",
67
+ "isEmpty": "is empty",
68
+ "isNotEmpty": "is not empty",
69
+ "equals": "is",
70
+ "notEquals": "is not",
71
+ "greaterThan": "is greater than",
72
+ "greaterThanOrEqualTo": "is greater than or equal to",
73
+ "lessThan": "is less than",
74
+ "lessThanOrEqualTo": "is less than or equal to",
75
+ "inRange": "is between",
76
+ "isRelativeToToday": "is relative to today",
77
+ "Date": {
78
+ "lessThan": "is before",
79
+ "lessThanOrEqualTo": "is on or before",
80
+ "greaterThan": "is after",
81
+ "greaterThanOrEqualTo": "is on or after"
82
+ }
83
+ }
84
+ },
85
+ "Chat": {
86
+ "Assistant": "Assistant",
87
+ "Message": "Ask anything",
88
+ "Send": "Send",
89
+ "Stop": "Stop",
90
+ "NewChat": "New chat",
91
+ "NewChatConfirm": "Start a new chat? This conversation will be deleted.",
92
+ "Reasoning": "Reasoning…",
93
+ "Regenerate": "Regenerate",
94
+ "AreYouSure": "Are you sure?",
95
+ "RenderFailed": "This content could not be displayed.",
96
+ "Attach": "Attach files",
97
+ "DropFiles": "Drop files to attach them",
98
+ "FileNotRead": "“{{name}}” cannot be attached. Attach an image or a document (PDF, Word, Excel, PowerPoint, CSV or text) of up to 10 MB.",
99
+ "WritingCode": "Writing code…",
100
+ "RunningCode": "Running code…",
101
+ "RanCode": "Ran code",
102
+ "FindingTools": "Looking up tools…",
103
+ "FoundTools": "Looked up tools",
104
+ "ReadingPage": "Reading the page…",
105
+ "ReadPage": "Read the page",
106
+ "Clicking": "Clicking…",
107
+ "Clicked": "Clicked “{{target}}”",
108
+ "Filling": "Filling in…",
109
+ "Filled": "Filled in “{{target}}”",
110
+ "PressingKey": "Pressing a key…",
111
+ "PressedKey": "Pressed {{target}}",
112
+ "UsingTool": "Using {{name}}…",
113
+ "UsedTool": "Used {{name}}",
114
+ "ToolStopped": "{{name}} did not finish"
115
+ }
116
+ },
117
+ "Homepage": "Homepage",
118
+ "GettingStarted": "Getting Started"
119
+ }