@cosmicdrift/kumiko-samples 0.421.0 → 0.424.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/package.json +1 -1
- package/packages/bundled-features/package.json +11 -1
- package/packages/bundled-features/src/document-draft/README.md +84 -0
- package/packages/bundled-features/src/document-draft/changes.json +8 -0
- package/packages/bundled-features/src/document-draft/entity.ts +125 -0
- package/packages/bundled-features/src/document-draft/feature.ts +56 -0
- package/packages/bundled-features/src/document-draft/handlers/blocks.query.ts +63 -0
- package/packages/bundled-features/src/document-draft/handlers/by-subject.query.ts +50 -0
- package/packages/bundled-features/src/document-draft/handlers/create.write.ts +110 -0
- package/packages/bundled-features/src/document-draft/handlers/discard.write.ts +32 -0
- package/packages/bundled-features/src/document-draft/handlers/finalize.write.ts +103 -0
- package/packages/bundled-features/src/document-draft/handlers/patch.write.ts +86 -0
- package/packages/bundled-features/src/document-draft/handlers/revise.write.ts +46 -0
- package/packages/bundled-features/src/document-draft/handlers/save.write.ts +53 -0
- package/packages/bundled-features/src/document-draft/i18n.ts +22 -0
- package/packages/bundled-features/src/document-draft/index.ts +21 -0
- package/packages/bundled-features/src/document-draft/lib.ts +77 -0
- package/packages/bundled-features/src/document-draft/options.ts +51 -0
- package/packages/bundled-features/src/document-draft/payloads.ts +45 -0
- package/packages/bundled-features/src/document-draft/screens/editor-screen.ts +17 -0
- package/packages/bundled-features/src/document-draft/user-data.ts +63 -0
- package/packages/bundled-features/src/document-draft/web/client-plugin.tsx +20 -0
- package/packages/bundled-features/src/document-draft/web/constants.ts +56 -0
- package/packages/bundled-features/src/document-draft/web/editor-screen.tsx +418 -0
- package/packages/bundled-features/src/document-draft/web/i18n.ts +54 -0
- package/packages/bundled-features/src/document-draft/web/index.ts +14 -0
- package/packages/bundled-features/src/helpdesk/changes.json +6 -0
- package/packages/bundled-features/src/shared/index.ts +6 -0
- package/packages/bundled-features/src/{signature → shared}/subject-scope.ts +17 -6
- package/packages/bundled-features/src/signature/changes.json +6 -0
- package/packages/bundled-features/src/signature/feature.ts +1 -1
- package/packages/bundled-features/src/signature/handlers/cancel.write.ts +1 -1
- package/packages/bundled-features/src/signature/handlers/issue-link.write.ts +1 -1
- package/packages/bundled-features/src/signature/handlers/request.write.ts +1 -1
- package/packages/bundled-features/src/signature/handlers/revoke-link.write.ts +1 -1
- package/packages/bundled-features/src/signature/handlers/sign-in-person.write.ts +1 -1
- package/packages/bundled-features/src/signature/options.ts +2 -1
- package/packages/bundled-features/src/signature/subject-queries.ts +1 -1
- package/packages/bundled-features/src/template-resolver/README.md +1 -0
- package/packages/bundled-features/src/template-resolver/api.ts +3 -1
- package/packages/bundled-features/src/template-resolver/boot-rules.ts +5 -0
- package/packages/bundled-features/src/template-resolver/changes.json +36 -0
- package/packages/bundled-features/src/template-resolver/compile-document-body.ts +51 -6
- package/packages/bundled-features/src/template-resolver/document-print-only.ts +1 -0
- package/packages/bundled-features/src/template-resolver/feature.ts +15 -1
- package/packages/bundled-features/src/template-resolver/handlers/create-variant.write.ts +134 -0
- package/packages/bundled-features/src/template-resolver/handlers/document-base.ts +3 -0
- package/packages/bundled-features/src/template-resolver/handlers/overview.query.ts +44 -1
- package/packages/bundled-features/src/template-resolver/handlers/patch-draft.write.ts +12 -1
- package/packages/bundled-features/src/template-resolver/handlers/template-write.ts +111 -11
- package/packages/bundled-features/src/template-resolver/handlers/toggle-status.write.ts +29 -4
- package/packages/bundled-features/src/template-resolver/handlers/upsert-tenant.write.ts +1 -0
- package/packages/bundled-features/src/template-resolver/handlers/variants.query.ts +89 -0
- package/packages/bundled-features/src/template-resolver/i18n.ts +1 -0
- package/packages/bundled-features/src/template-resolver/index.ts +26 -0
- package/packages/bundled-features/src/template-resolver/seeding.ts +16 -1
- package/packages/bundled-features/src/template-resolver/template-delivery-policy.ts +56 -6
- package/packages/bundled-features/src/template-resolver/template-edit-policy.ts +5 -5
- package/packages/bundled-features/src/template-resolver/template-meta.ts +1 -0
- package/packages/bundled-features/src/template-resolver/template-variants.ts +50 -0
- package/packages/bundled-features/src/template-resolver/web/document-images.ts +29 -8
- package/packages/bundled-features/src/template-resolver/web/document-tiptap-content.tsx +10 -1
- package/packages/bundled-features/src/template-resolver/web/document-tiptap-toolbar.tsx +10 -4
- package/packages/bundled-features/src/template-resolver/web/i18n.ts +26 -0
- package/packages/bundled-features/src/template-resolver/web/index.ts +5 -0
- package/packages/bundled-features/src/template-resolver/web/qualified-names.ts +5 -0
- package/packages/bundled-features/src/template-resolver/web/system-placeholders.ts +17 -0
- package/packages/bundled-features/src/tenant/changes.json +7 -0
- package/packages/bundled-features/src/tenant/handlers/update-member-roles.write.ts +1 -1
- package/packages/bundled-features/src/tenant/i18n.ts +0 -1
- package/packages/bundled-features/src/tenant-inactivity/changes.json +7 -0
- package/packages/bundled-features/src/tenant-inactivity/constants.ts +1 -1
- package/packages/bundled-features/src/tenant-lifecycle/changes.json +7 -0
- package/packages/bundled-features/src/tenant-lifecycle/constants.ts +1 -1
- package/samples/apps/ui-walkthrough/src/run-config.ts +1 -0
- package/samples/apps/use-all-bundled/feature-manifest.json +37 -1
- package/samples/apps/use-all-bundled/kumiko/migrations/0069_document-draft.rebuild.json +4 -0
- package/samples/apps/use-all-bundled/src/app/client.tsx +3 -0
- package/samples/apps/use-all-bundled/src/run-config.ts +8 -0
- package/samples/recipes/list-table-options/README.md +9 -1
- package/samples/recipes/list-table-options/src/feature.ts +28 -1
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { propertyOf } from "@cosmicdrift/kumiko-types/type-guards";
|
|
2
|
+
import * as z from "zod";
|
|
3
|
+
|
|
4
|
+
export const VARIANT_SEPARATOR = ":";
|
|
5
|
+
export const VARIANT_KIND = "document-pdf" as const;
|
|
6
|
+
export const VARIANT_NAME_MAX_LENGTH = 40;
|
|
7
|
+
export const VARIANT_UNKNOWN_REASON = "template_variant_unknown";
|
|
8
|
+
|
|
9
|
+
// One kebab segment: the variant slug is `<base>:<name>` and a second ":" would read as another base.
|
|
10
|
+
export const variantNameSchema = z
|
|
11
|
+
.string()
|
|
12
|
+
.min(1)
|
|
13
|
+
.max(VARIANT_NAME_MAX_LENGTH)
|
|
14
|
+
.regex(/^[a-z0-9]+(-[a-z0-9]+)*$/, "name must be kebab-case (lowercase, digits, dashes)");
|
|
15
|
+
|
|
16
|
+
export function variantSlug(baseSlug: string, name: string): string {
|
|
17
|
+
return `${baseSlug}${VARIANT_SEPARATOR}${name}`;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export function isVariantSlugOf(slug: string, baseSlug: string): boolean {
|
|
21
|
+
const prefix = `${baseSlug}${VARIANT_SEPARATOR}`;
|
|
22
|
+
return slug.startsWith(prefix) && variantNameSchema.safeParse(slug.slice(prefix.length)).success;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// Stored meta is untrusted JSON; only a string counts as a base slug.
|
|
26
|
+
export function readVariantOf(meta: unknown): string | null {
|
|
27
|
+
const variantOf = propertyOf(meta, "variantOf");
|
|
28
|
+
return typeof variantOf === "string" ? variantOf : null;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export function variantOfMatchesSlug(slug: string, meta: unknown): boolean {
|
|
32
|
+
const variantOf = readVariantOf(meta);
|
|
33
|
+
return variantOf === null || isVariantSlugOf(slug, variantOf);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
// German special letters are transliterated and the rest kebab-cased, so any title yields a valid name.
|
|
37
|
+
export function variantNameFromTitle(title: string): string {
|
|
38
|
+
return title
|
|
39
|
+
.toLowerCase()
|
|
40
|
+
.replace(/ä/g, "ae")
|
|
41
|
+
.replace(/ö/g, "oe")
|
|
42
|
+
.replace(/ü/g, "ue")
|
|
43
|
+
.replace(/ß/g, "ss")
|
|
44
|
+
.normalize("NFD")
|
|
45
|
+
.replace(/[̀-ͯ]/g, "")
|
|
46
|
+
.replace(/[^a-z0-9]+/g, "-")
|
|
47
|
+
.replace(/^-+|-+$/g, "")
|
|
48
|
+
.slice(0, VARIANT_NAME_MAX_LENGTH)
|
|
49
|
+
.replace(/-+$/g, "");
|
|
50
|
+
}
|
|
@@ -1,7 +1,16 @@
|
|
|
1
1
|
// The record's photos: a block bound to an `images` variable whose FileRef ids the
|
|
2
2
|
// app passes at render time. Universal like document-schema.ts.
|
|
3
|
+
|
|
4
|
+
import { isOneOf } from "@cosmicdrift/kumiko-types/type-guards";
|
|
3
5
|
import { Node } from "@tiptap/core";
|
|
4
|
-
|
|
6
|
+
|
|
7
|
+
export const DOCUMENT_IMAGE_COLUMNS = ["1", "2", "3"] as const;
|
|
8
|
+
|
|
9
|
+
export type DocumentImageColumns = (typeof DOCUMENT_IMAGE_COLUMNS)[number];
|
|
10
|
+
|
|
11
|
+
export function readDocumentImageColumns(value: unknown): DocumentImageColumns | null {
|
|
12
|
+
return isOneOf(DOCUMENT_IMAGE_COLUMNS, value) ? value : null;
|
|
13
|
+
}
|
|
5
14
|
|
|
6
15
|
export function createDocumentImagesNode(isReferenceName: (value: string) => boolean) {
|
|
7
16
|
return Node.create({
|
|
@@ -9,20 +18,32 @@ export function createDocumentImagesNode(isReferenceName: (value: string) => boo
|
|
|
9
18
|
group: "block",
|
|
10
19
|
atom: true,
|
|
11
20
|
addAttributes() {
|
|
12
|
-
return { variable: { default: null } };
|
|
21
|
+
return { variable: { default: null }, columns: { default: null } };
|
|
13
22
|
},
|
|
14
23
|
parseHTML() {
|
|
15
24
|
return [
|
|
16
|
-
|
|
25
|
+
{
|
|
17
26
|
tag: "div[data-images]",
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
27
|
+
getAttrs: (element) => {
|
|
28
|
+
const variable = element.getAttribute("data-images");
|
|
29
|
+
if (variable === null || !isReferenceName(variable)) return false;
|
|
30
|
+
return {
|
|
31
|
+
variable,
|
|
32
|
+
columns: readDocumentImageColumns(element.getAttribute("data-image-columns")),
|
|
33
|
+
};
|
|
34
|
+
},
|
|
35
|
+
},
|
|
22
36
|
];
|
|
23
37
|
},
|
|
24
38
|
renderHTML({ node }) {
|
|
25
|
-
|
|
39
|
+
const columns = readDocumentImageColumns(node.attrs["columns"]);
|
|
40
|
+
return [
|
|
41
|
+
"div",
|
|
42
|
+
{
|
|
43
|
+
"data-images": node.attrs["variable"],
|
|
44
|
+
...(columns !== null && { "data-image-columns": columns }),
|
|
45
|
+
},
|
|
46
|
+
];
|
|
26
47
|
},
|
|
27
48
|
});
|
|
28
49
|
}
|
|
@@ -29,9 +29,17 @@ function tableClasses(canvas: boolean, page: boolean): string {
|
|
|
29
29
|
: "[&_table]:mb-2 [&_table]:mt-6 [&_.ProseMirror>:first-child_table]:mt-0 [&_.ProseMirror>table:first-child]:mt-0",
|
|
30
30
|
"[&_td:last-child>p[data-size=small][data-align=right]]:whitespace-nowrap",
|
|
31
31
|
)
|
|
32
|
-
:
|
|
32
|
+
: cn(
|
|
33
|
+
"[&_table]:my-2",
|
|
34
|
+
// The repeat strip is absolutely placed above its table and needs a line of room inside the wrapper.
|
|
35
|
+
"[&_.tableWrapper:has([data-testid=document-repeat-strip])_table]:mt-[var(--doc-line,1.25rem)]!",
|
|
36
|
+
);
|
|
33
37
|
}
|
|
34
38
|
|
|
39
|
+
// A wide table scrolls inside its wrapper instead of pushing past the editor frame. Not on the
|
|
40
|
+
// paper canvas, where tables are bounded by the page.
|
|
41
|
+
const TABLE_SCROLL_CLASS = "[&_.tableWrapper]:max-w-full [&_.tableWrapper]:overflow-x-auto";
|
|
42
|
+
|
|
35
43
|
// The PDF prints cells top-aligned, header like body text and no rules unless the layout sets a
|
|
36
44
|
// table style; the dashed outline only marks the cells while editing, like the frame outline.
|
|
37
45
|
function cellClasses(canvas: boolean, print: DocumentPrintMode): string {
|
|
@@ -82,6 +90,7 @@ export function renderEditorContent(
|
|
|
82
90
|
"[&_a]:underline [&_a]:text-primary",
|
|
83
91
|
"[&_strong]:font-bold [&_em]:italic [&_u]:underline",
|
|
84
92
|
tableClasses(canvas, page),
|
|
93
|
+
!page && TABLE_SCROLL_CLASS,
|
|
85
94
|
// A layout region has no content below its table; margins there only inflate the region box.
|
|
86
95
|
hosted && "[&_td>div]:my-0 [&_.ProseMirror>.tableWrapper:last-child_table]:mb-0",
|
|
87
96
|
"[&_table]:w-full [&_table]:border-collapse",
|
|
@@ -186,6 +186,12 @@ function renderPrintBlockMenu(c: TiptapContext): ReactNode {
|
|
|
186
186
|
);
|
|
187
187
|
}
|
|
188
188
|
|
|
189
|
+
// The form-field toolbar wraps on desktop; under md every row is one line that swipes sideways.
|
|
190
|
+
// `relative` makes the row the containing block of absolutely placed children (hidden inputs, popover
|
|
191
|
+
// anchors); without it they escape the scroll clip and widen the page.
|
|
192
|
+
const NARROW_SCROLL_ROW =
|
|
193
|
+
"relative gap-1 p-1 max-md:flex-nowrap max-md:overflow-x-auto md:flex-wrap [&>*]:shrink-0";
|
|
194
|
+
|
|
189
195
|
function renderPrintStyleRow(c: TiptapContext): ReactNode {
|
|
190
196
|
const { canvas } = c;
|
|
191
197
|
return (
|
|
@@ -193,8 +199,8 @@ function renderPrintStyleRow(c: TiptapContext): ReactNode {
|
|
|
193
199
|
className={cn(
|
|
194
200
|
"flex items-center border-b border-input",
|
|
195
201
|
canvas
|
|
196
|
-
? "min-h-9
|
|
197
|
-
:
|
|
202
|
+
? "relative min-h-9 gap-1.5 bg-background px-1.5 py-1 max-md:flex-nowrap max-md:overflow-x-auto md:flex-wrap [&>*]:shrink-0"
|
|
203
|
+
: NARROW_SCROLL_ROW,
|
|
198
204
|
)}
|
|
199
205
|
>
|
|
200
206
|
{renderPrintTextStyleGroup(c)}
|
|
@@ -245,8 +251,8 @@ function renderMainToolbarRow(c: TiptapContext): ReactNode {
|
|
|
245
251
|
className={cn(
|
|
246
252
|
"flex items-center border-b border-input",
|
|
247
253
|
canvas
|
|
248
|
-
? "min-h-9 flex-nowrap gap-0 overflow-
|
|
249
|
-
:
|
|
254
|
+
? "relative min-h-9 flex-nowrap gap-0 overflow-x-auto bg-background md:overflow-hidden px-1.5 [&>*]:shrink-0 [&_button]:h-7 [&_button]:gap-1 [&_button]:px-1 [&_button]:text-xs"
|
|
255
|
+
: NARROW_SCROLL_ROW,
|
|
250
256
|
)}
|
|
251
257
|
>
|
|
252
258
|
{renderParagraphStyleSelect(c)}
|
|
@@ -8,6 +8,22 @@ import type { TranslationsByLocale } from "@cosmicdrift/kumiko-renderer";
|
|
|
8
8
|
|
|
9
9
|
export const defaultTranslations: TranslationsByLocale = {
|
|
10
10
|
en: {
|
|
11
|
+
"template-resolver.systemPlaceholder.tenantName": "Company name",
|
|
12
|
+
"template-resolver.systemPlaceholder.signature": "Signature",
|
|
13
|
+
"template-resolver.systemPlaceholder.imprint": "Imprint",
|
|
14
|
+
"template-resolver.systemPlaceholder.unsubscribeUrl": "Unsubscribe link",
|
|
15
|
+
"template-resolver.systemPlaceholder.page": "Page number",
|
|
16
|
+
"template-resolver.systemPlaceholder.pages": "Page count",
|
|
17
|
+
"template-resolver.systemPlaceholder.companyAddress": "Address",
|
|
18
|
+
"template-resolver.systemPlaceholder.companyPhone": "Phone",
|
|
19
|
+
"template-resolver.systemPlaceholder.companyEmail": "Email",
|
|
20
|
+
"template-resolver.systemPlaceholder.companyWebsite": "Website",
|
|
21
|
+
"template-resolver.systemPlaceholder.companyRegister": "Commercial register",
|
|
22
|
+
"template-resolver.systemPlaceholder.companyVatId": "VAT ID",
|
|
23
|
+
"template-resolver.systemPlaceholder.companyManagement": "Management",
|
|
24
|
+
"template-resolver.systemPlaceholder.companyBank": "Bank",
|
|
25
|
+
"template-resolver.systemPlaceholder.companyIban": "IBAN",
|
|
26
|
+
"template-resolver.systemPlaceholder.companyBic": "BIC",
|
|
11
27
|
"template-resolver.documentEditor.button": "Button",
|
|
12
28
|
"template-resolver.documentEditor.buttonDefaultText": "Confirm",
|
|
13
29
|
"template-resolver.documentEditor.buttonTarget": "Button target",
|
|
@@ -112,6 +128,16 @@ export const defaultTranslations: TranslationsByLocale = {
|
|
|
112
128
|
"templateResolver.errors.patch.regionNotAllowed":
|
|
113
129
|
"A region only applies to PDF layouts, not to {kind}.",
|
|
114
130
|
"templateResolver.errors.patch.layoutExists": "A layout with the slug {slug} already exists.",
|
|
131
|
+
"templateResolver.errors.patch.variantsNotEnabled":
|
|
132
|
+
"Variants are not enabled for the template {slug}.",
|
|
133
|
+
"templateResolver.errors.patch.variantExists": "A variant with the slug {slug} already exists.",
|
|
134
|
+
"templateResolver.errors.patch.variantNameInvalid":
|
|
135
|
+
"The short name must be lowercase letters, digits and dashes; give one or change the title.",
|
|
136
|
+
"templateResolver.errors.patch.variablesInheritedFromBase":
|
|
137
|
+
"A variant uses the variables of its base template {slug}; change them there.",
|
|
138
|
+
"templateResolver.errors.patch.invalidVariantOf":
|
|
139
|
+
"The variant must belong to the base template in its slug.",
|
|
140
|
+
"templateResolver.errors.variantUnknown": "The variant {variant} does not exist.",
|
|
115
141
|
"templateResolver.errors.template.reservedLayoutSlug":
|
|
116
142
|
"The prefix {prefix} is reserved for tenant layouts.",
|
|
117
143
|
"templateResolver.errors.patch.emptyFormat": "Give at least one of align, style or textStyle.",
|
|
@@ -79,4 +79,9 @@ export {
|
|
|
79
79
|
TemplateResolverHandlers,
|
|
80
80
|
TemplateResolverQueries,
|
|
81
81
|
} from "./qualified-names.ts";
|
|
82
|
+
export {
|
|
83
|
+
SYSTEM_PLACEHOLDER_TYPE,
|
|
84
|
+
systemPlaceholderLabel,
|
|
85
|
+
translatedOr,
|
|
86
|
+
} from "./system-placeholders.ts";
|
|
82
87
|
export { WebPreviewRenderer } from "./web-preview-renderer.tsx";
|
|
@@ -23,6 +23,7 @@ export const TemplateResolverHandlers = {
|
|
|
23
23
|
applyLayout: "template-resolver:write:apply-layout",
|
|
24
24
|
createLayout: "template-resolver:write:create-layout",
|
|
25
25
|
publishTemplates: "template-resolver:write:publish-templates",
|
|
26
|
+
createVariant: "template-resolver:write:create-variant",
|
|
26
27
|
} as const;
|
|
27
28
|
|
|
28
29
|
// The config feature's write handler, which applyLayout dispatches to for the tenant default layout.
|
|
@@ -43,6 +44,7 @@ export const TemplateResolverQueries = {
|
|
|
43
44
|
documentBlocks: "template-resolver:query:document-blocks",
|
|
44
45
|
exportBundle: "template-resolver:query:export-bundle",
|
|
45
46
|
sendTestStatus: "template-resolver:query:send-test-status",
|
|
47
|
+
variants: "template-resolver:query:variants",
|
|
46
48
|
// Public pair — anonymous-reachable, kind pinned to text-block.
|
|
47
49
|
bySlug: "template-resolver:query:by-slug",
|
|
48
50
|
byTenant: "template-resolver:query:by-tenant",
|
|
@@ -85,4 +87,7 @@ export const TemplateResolverErrors = {
|
|
|
85
87
|
testMailNoChannel: "template_test_mail_no_channel",
|
|
86
88
|
testMailNoAddress: "template_test_mail_no_address",
|
|
87
89
|
testMailFailed: "template_test_mail_failed",
|
|
90
|
+
variantsNotEnabled: "variants_not_enabled",
|
|
91
|
+
variantExists: "variant_exists",
|
|
92
|
+
variantNameInvalid: "variant_name_invalid",
|
|
88
93
|
} as const;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { Translate } from "@cosmicdrift/kumiko-renderer/headless";
|
|
2
|
+
|
|
3
|
+
// Placeholders the renderer fills in; only the ones that are not plain text are listed.
|
|
4
|
+
export const SYSTEM_PLACEHOLDER_TYPE: Readonly<Partial<Record<string, "link">>> = {
|
|
5
|
+
imprint: "link",
|
|
6
|
+
unsubscribeUrl: "link",
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
// t() returns the key itself without a translation.
|
|
10
|
+
export function translatedOr(t: Translate, key: string, fallback: string): string {
|
|
11
|
+
const translated = t(key);
|
|
12
|
+
return translated === key ? fallback : translated;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export function systemPlaceholderLabel(t: Translate, name: string): string {
|
|
16
|
+
return translatedOr(t, `template-resolver.systemPlaceholder.${name}`, name);
|
|
17
|
+
}
|
|
@@ -1,4 +1,11 @@
|
|
|
1
1
|
[
|
|
2
|
+
{
|
|
3
|
+
"version": "0.423.0",
|
|
4
|
+
"type": "breaking",
|
|
5
|
+
"title": "The TenantOwner role option is removed from the member roles form",
|
|
6
|
+
"detail": "The role option label `tenant:entity:__action-form__:field:roles:option:TenantOwner` is gone together with the role.",
|
|
7
|
+
"migration": "Remove any app translation or screen reference to the `TenantOwner` role option."
|
|
8
|
+
},
|
|
2
9
|
{
|
|
3
10
|
"version": "0.414.0",
|
|
4
11
|
"type": "fix",
|
|
@@ -74,7 +74,7 @@ export const updateMemberRolesWrite = defineWriteHandler({
|
|
|
74
74
|
// are session-scoped (event.user.tenantId).
|
|
75
75
|
access: { roles: ["system", ...access.admin] },
|
|
76
76
|
description:
|
|
77
|
-
"Sets the roles a user holds in a tenant, rejecting reserved role names and any grant that would raise the target above the caller; roles the caller could not grant (platform roles such as DataProtectionOfficer
|
|
77
|
+
"Sets the roles a user holds in a tenant, rejecting reserved role names and any grant that would raise the target above the caller; roles the caller could not grant (platform roles such as DataProtectionOfficer, undeclared or higher-tier app roles) are kept, only the system user replaces the full list; admins act on their own tenant, SystemAdmins on any.",
|
|
78
78
|
agent: { risk: "high" },
|
|
79
79
|
handler: async (event, ctx) => {
|
|
80
80
|
if (!ctx.systemDb) {
|
|
@@ -50,7 +50,6 @@ export const TENANT_I18N: Readonly<Record<string, LocalizedString>> = {
|
|
|
50
50
|
"tenant:entity:__action-form__:field:roles:option:Member": { en: "Member" },
|
|
51
51
|
"tenant:entity:__action-form__:field:roles:option:Admin": { en: "Admin" },
|
|
52
52
|
"tenant:entity:__action-form__:field:roles:option:TenantAdmin": { en: "Tenant Admin" },
|
|
53
|
-
"tenant:entity:__action-form__:field:roles:option:TenantOwner": { en: "Tenant Owner" },
|
|
54
53
|
"tenant:entity:__action-form__:field:roles:option:DataProtectionOfficer": {
|
|
55
54
|
en: "Data Protection Officer",
|
|
56
55
|
},
|
|
@@ -1,4 +1,11 @@
|
|
|
1
1
|
[
|
|
2
|
+
{
|
|
3
|
+
"version": "0.423.0",
|
|
4
|
+
"type": "breaking",
|
|
5
|
+
"title": "TenantOwner is no longer a keep-account role",
|
|
6
|
+
"detail": "`TENANT_KEEP_ACCOUNT_ROLES` is now `[\"TenantAdmin\", \"Admin\"]`; the inactivity warning mail and the keep-account handlers address these roles only.",
|
|
7
|
+
"migration": "Grant `Admin` or `TenantAdmin` instead of `TenantOwner`."
|
|
8
|
+
},
|
|
2
9
|
{
|
|
3
10
|
"version": "0.415.0",
|
|
4
11
|
"type": "fix",
|
|
@@ -2,7 +2,7 @@ export const TENANT_INACTIVITY_FEATURE = "tenant-inactivity";
|
|
|
2
2
|
export const TENANT_INACTIVITY_STATE_ENTITY = "tenant-inactivity-state";
|
|
3
3
|
|
|
4
4
|
// Stays import-free for the client-safe subpath; a test ties it to TENANT_ACCOUNT_CLOSE_ROLES.
|
|
5
|
-
export const TENANT_KEEP_ACCOUNT_ROLES = ["
|
|
5
|
+
export const TENANT_KEEP_ACCOUNT_ROLES = ["TenantAdmin", "Admin"] as const;
|
|
6
6
|
|
|
7
7
|
export const TenantInactivityJobs = {
|
|
8
8
|
check: `${TENANT_INACTIVITY_FEATURE}:job:check-inactive-tenants`,
|
|
@@ -1,4 +1,11 @@
|
|
|
1
1
|
[
|
|
2
|
+
{
|
|
3
|
+
"version": "0.423.0",
|
|
4
|
+
"type": "breaking",
|
|
5
|
+
"title": "TenantOwner no longer closes the account",
|
|
6
|
+
"detail": "`TENANT_ACCOUNT_CLOSE_ROLES` is now `[\"Admin\"]`. `TenantAdmin` is not added, so the set of roles that may request or cancel tenant destruction only loses the removed role.",
|
|
7
|
+
"migration": "Grant `Admin` instead of `TenantOwner` to members who close the account."
|
|
8
|
+
},
|
|
2
9
|
{
|
|
3
10
|
"version": "0.418.0",
|
|
4
11
|
"type": "fix",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export const TENANT_LIFECYCLE_FEATURE = "tenant-lifecycle" as const;
|
|
2
2
|
|
|
3
|
-
export const TENANT_ACCOUNT_CLOSE_ROLES = ["
|
|
3
|
+
export const TENANT_ACCOUNT_CLOSE_ROLES = ["Admin"] as const;
|
|
4
4
|
|
|
5
5
|
export const TENANT_AGGREGATE_TYPE = "tenant" as const;
|
|
6
6
|
|
|
@@ -48,6 +48,7 @@ const TENANT_EDITABLE_TEMPLATES: readonly TenantEditableTemplate[] = [
|
|
|
48
48
|
kind: "document-pdf" as const,
|
|
49
49
|
slug,
|
|
50
50
|
access: { roles: ["TenantAdmin"] },
|
|
51
|
+
...(slug === "billing:invoice" && { variants: true as const }),
|
|
51
52
|
})),
|
|
52
53
|
...(["mail-layout", "pdf-layout"] as const).map((kind) => ({
|
|
53
54
|
kind,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"source": "samples/apps/use-all-bundled APP_FEATURES (composeFeatures includeBundled + signup)",
|
|
3
|
-
"featureCount":
|
|
3
|
+
"featureCount": 97,
|
|
4
4
|
"features": [
|
|
5
5
|
{
|
|
6
6
|
"name": "account-security",
|
|
@@ -881,6 +881,41 @@
|
|
|
881
881
|
"recommended": false
|
|
882
882
|
}
|
|
883
883
|
},
|
|
884
|
+
{
|
|
885
|
+
"name": "document-draft",
|
|
886
|
+
"description": "Document drafts: one editable copy of a PDF document template per object (for example a lease contract). A draft is created from a template or one of its variants with the values for its placeholders, changed with the structured operations of template patch-draft or the editor, and finalized to a stored PDF through the injected print function; the template stays unchanged. Revise reopens a finalized draft. Body, variables and the last change are personal data of the draft, which is its own crypto-shredding subject.",
|
|
887
|
+
"toggleableDefault": null,
|
|
888
|
+
"requires": [
|
|
889
|
+
"files",
|
|
890
|
+
"template-resolver",
|
|
891
|
+
"user-data-rights"
|
|
892
|
+
],
|
|
893
|
+
"optionalRequires": [],
|
|
894
|
+
"configReads": [],
|
|
895
|
+
"exposesApis": [],
|
|
896
|
+
"usesApis": [],
|
|
897
|
+
"extensionsUsed": [
|
|
898
|
+
{
|
|
899
|
+
"extensionName": "userData",
|
|
900
|
+
"entityName": "documentDraft"
|
|
901
|
+
}
|
|
902
|
+
],
|
|
903
|
+
"configKeys": [],
|
|
904
|
+
"secrets": [],
|
|
905
|
+
"writeHandlers": [
|
|
906
|
+
"document-draft:write:create",
|
|
907
|
+
"document-draft:write:discard",
|
|
908
|
+
"document-draft:write:finalize",
|
|
909
|
+
"document-draft:write:patch",
|
|
910
|
+
"document-draft:write:revise",
|
|
911
|
+
"document-draft:write:save"
|
|
912
|
+
],
|
|
913
|
+
"uiHints": {
|
|
914
|
+
"displayLabel": "Document drafts",
|
|
915
|
+
"category": "data",
|
|
916
|
+
"recommended": false
|
|
917
|
+
}
|
|
918
|
+
},
|
|
884
919
|
{
|
|
885
920
|
"name": "document-ingest-foundation",
|
|
886
921
|
"description": "Shared PDF/Scan/Image → normalized-text ingest primitive. Owns the `documentExtract` entity (fileRefId, storageKey, per-page text + metadata) as an implicit entity-projection, the per-tenant `ocrLanguage`/`maxPagesPerFile` config keys, the `documentIngestProvider` extension-point providers register accepted mimeTypes/size caps under, and a fileRef.created/fileRef.restored trigger that resolves the provider for a file's mimeType and requests ingest via `documentIngest.requested` tagged with the winning provider — a delete→restore round-trip re-requests ingest the same way a fresh upload does. An orphan-extract guard forgets any `documentExtract` whose fileRef is no longer live at processing time, regardless of how a provider's own write races the fileRef's delete/forget — providers should write through `writeDocumentExtractForLiveFileRef`.",
|
|
@@ -3099,6 +3134,7 @@
|
|
|
3099
3134
|
"template-resolver:write:archive-system",
|
|
3100
3135
|
"template-resolver:write:copy-locale",
|
|
3101
3136
|
"template-resolver:write:create-layout",
|
|
3137
|
+
"template-resolver:write:create-variant",
|
|
3102
3138
|
"template-resolver:write:discard-draft",
|
|
3103
3139
|
"template-resolver:write:discard-draft-system",
|
|
3104
3140
|
"template-resolver:write:import-bundle",
|
|
@@ -24,6 +24,7 @@ import { complianceProfilesClient } from "@cosmicdrift/kumiko-bundled-features/c
|
|
|
24
24
|
import { configClient } from "@cosmicdrift/kumiko-bundled-features/config/web";
|
|
25
25
|
import { customFieldsClient } from "@cosmicdrift/kumiko-bundled-features/custom-fields/web";
|
|
26
26
|
import { deliveryClient } from "@cosmicdrift/kumiko-bundled-features/delivery/web";
|
|
27
|
+
import { documentDraftClient } from "@cosmicdrift/kumiko-bundled-features/document-draft/web";
|
|
27
28
|
import { featureTogglesClient } from "@cosmicdrift/kumiko-bundled-features/feature-toggles/web";
|
|
28
29
|
import { foldersClient } from "@cosmicdrift/kumiko-bundled-features/folders/web";
|
|
29
30
|
import { inboundMailFoundationClient } from "@cosmicdrift/kumiko-bundled-features/inbound-mail-foundation/web";
|
|
@@ -137,6 +138,8 @@ createKumikoApp({
|
|
|
137
138
|
// PDF template editor with live PDF preview, mounted as the custom screen
|
|
138
139
|
// app-screens declares (no nav entry; opened by URL).
|
|
139
140
|
documentDesignerClient(),
|
|
141
|
+
// Editor screen of per-object document drafts, opened by URL with the draft id.
|
|
142
|
+
documentDraftClient(),
|
|
140
143
|
appScreens,
|
|
141
144
|
],
|
|
142
145
|
});
|
|
@@ -43,6 +43,7 @@ import { createCustomFieldsFeature } from "@cosmicdrift/kumiko-bundled-features/
|
|
|
43
43
|
import { createDataRetentionFeature } from "@cosmicdrift/kumiko-bundled-features/data-retention";
|
|
44
44
|
import { createDeliveryFeature } from "@cosmicdrift/kumiko-bundled-features/delivery";
|
|
45
45
|
import { createDerivativesSharpFeature } from "@cosmicdrift/kumiko-bundled-features/derivatives-sharp";
|
|
46
|
+
import { createDocumentDraftFeature } from "@cosmicdrift/kumiko-bundled-features/document-draft";
|
|
46
47
|
import { createDocumentIngestFoundationFeature } from "@cosmicdrift/kumiko-bundled-features/document-ingest-foundation";
|
|
47
48
|
import { createDocumentsFeature } from "@cosmicdrift/kumiko-bundled-features/documents";
|
|
48
49
|
import {
|
|
@@ -111,6 +112,8 @@ import { localeDe } from "@cosmicdrift/kumiko-locale-de";
|
|
|
111
112
|
import {
|
|
112
113
|
createRendererPuppeteerClientFeature,
|
|
113
114
|
renderHtmlToPdf,
|
|
115
|
+
renderPdfBeforeTransaction,
|
|
116
|
+
storeRenderedPdf,
|
|
114
117
|
} from "@cosmicdrift/kumiko-renderer-puppeteer-client";
|
|
115
118
|
import { ADMIN_NAV_QN, ADMIN_NAV_WORKSPACES, adminNavFeature } from "./app/admin-nav-feature";
|
|
116
119
|
import { DEV_TENANT_ID } from "./app/auth-constants";
|
|
@@ -390,6 +393,11 @@ export const APP_FEATURES = [
|
|
|
390
393
|
/* smoke-only */
|
|
391
394
|
},
|
|
392
395
|
}),
|
|
396
|
+
// document-draft: the app hands over the client's print and store functions as they are.
|
|
397
|
+
createDocumentDraftFeature({
|
|
398
|
+
subjectTypes: ["lease"],
|
|
399
|
+
pdf: { render: renderPdfBeforeTransaction, store: storeRenderedPdf },
|
|
400
|
+
}),
|
|
393
401
|
createHandbookKnowledgeFeature({
|
|
394
402
|
pages: {
|
|
395
403
|
defaultLocale: "en",
|
|
@@ -27,7 +27,15 @@ the `table` block renders and behaves as before.
|
|
|
27
27
|
updates every id in one write, bounded by `.max(MAX_BULK_SELECTION)` and
|
|
28
28
|
reading each id through the tenant-scoped executor. The form has a `preview`:
|
|
29
29
|
the `task:set-status-preview` query returns the affected tasks with old and
|
|
30
|
-
new status from the same plan function the handler applies.
|
|
30
|
+
new status from the same plan function the handler applies. A preview list
|
|
31
|
+
column with `type: "file"` shows a FileRef id as file name and download link.
|
|
32
|
+
- `submitThrough`: a screen can open the form with
|
|
33
|
+
`useNavigateWithInitialValues(screen, values, { submitThrough: { handler:
|
|
34
|
+
"task-board:write:task:set-status-via", wrap: { via: "inbox" }, valuesKey:
|
|
35
|
+
"values" } })`. The submit then goes to `task:set-status-via` as
|
|
36
|
+
`{ via, values }`; that handler calls `task:set-status` through
|
|
37
|
+
`ctx.dispatch.write` and returns its data unchanged plus `via`, because the
|
|
38
|
+
form reads its redirect and success facts from the response.
|
|
31
39
|
- `table.grouping`: the server groups the list by status; each header shows the
|
|
32
40
|
group's count and estimate sum, "done" starts collapsed and the view menu
|
|
33
41
|
offers grouping by priority or none.
|
|
@@ -309,6 +309,26 @@ export function createTaskBoardFeature(
|
|
|
309
309
|
},
|
|
310
310
|
});
|
|
311
311
|
|
|
312
|
+
// Target of `useNavigateWithInitialValues(screen, values, { submitThrough })`: the form
|
|
313
|
+
// submits `{ ...wrap, [valuesKey]: values }` here. The wrapper returns the inner data
|
|
314
|
+
// unchanged (plus `via`) because the form reads its redirect id and success facts from it.
|
|
315
|
+
r.writeHandler({
|
|
316
|
+
name: "task:set-status-via",
|
|
317
|
+
schema: z.object({
|
|
318
|
+
via: z.string(),
|
|
319
|
+
values: setStatusInput.extend({ note: z.string().optional() }),
|
|
320
|
+
}),
|
|
321
|
+
access: openAccess.access,
|
|
322
|
+
handler: async (event, ctx) => {
|
|
323
|
+
const inner = await ctx.dispatch.write("task-board:write:task:set-status", {
|
|
324
|
+
...event.payload.values,
|
|
325
|
+
});
|
|
326
|
+
if (!inner.isSuccess) return inner;
|
|
327
|
+
const innerData = typeof inner.data === "object" && inner.data !== null ? inner.data : {};
|
|
328
|
+
return { isSuccess: true as const, data: { ...innerData, via: event.payload.via } };
|
|
329
|
+
},
|
|
330
|
+
});
|
|
331
|
+
|
|
312
332
|
// The preview runs the same plan the write handler runs, so the two cannot drift apart.
|
|
313
333
|
r.queryHandler({
|
|
314
334
|
name: "task:set-status-preview",
|
|
@@ -322,7 +342,12 @@ export function createTaskBoardFeature(
|
|
|
322
342
|
if ("missingId" in plan) throw new NotFoundError("task");
|
|
323
343
|
return {
|
|
324
344
|
count: plan.rows.filter((row) => row.before !== row.after).length,
|
|
325
|
-
tasks: plan.rows.map(({ title, before, after }) => ({
|
|
345
|
+
tasks: plan.rows.map(({ title, before, after }) => ({
|
|
346
|
+
title,
|
|
347
|
+
before,
|
|
348
|
+
after,
|
|
349
|
+
attachmentId: null,
|
|
350
|
+
})),
|
|
326
351
|
};
|
|
327
352
|
},
|
|
328
353
|
});
|
|
@@ -355,6 +380,8 @@ export function createTaskBoardFeature(
|
|
|
355
380
|
{ field: "title", label: "Task" },
|
|
356
381
|
{ field: "before", label: "Now" },
|
|
357
382
|
{ field: "after", label: "New" },
|
|
383
|
+
// A FileRef id (null here) is shown with file name and download link.
|
|
384
|
+
{ field: "attachmentId", label: "Attachment", type: "file" },
|
|
358
385
|
],
|
|
359
386
|
},
|
|
360
387
|
},
|