@cosmicdrift/kumiko-bundled-features 0.422.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.
Files changed (111) hide show
  1. package/dist/document-draft/entity.d.ts +320 -0
  2. package/dist/document-draft/entity.js +98 -0
  3. package/dist/document-draft/feature.d.ts +3 -0
  4. package/dist/document-draft/feature.js +42 -0
  5. package/dist/document-draft/handlers/blocks.query.d.ts +28 -0
  6. package/dist/document-draft/handlers/blocks.query.js +48 -0
  7. package/dist/document-draft/handlers/by-subject.query.d.ts +16 -0
  8. package/dist/document-draft/handlers/by-subject.query.js +42 -0
  9. package/dist/document-draft/handlers/create.write.d.ts +17 -0
  10. package/dist/document-draft/handlers/create.write.js +83 -0
  11. package/dist/document-draft/handlers/discard.write.d.ts +8 -0
  12. package/dist/document-draft/handlers/discard.write.js +27 -0
  13. package/dist/document-draft/handlers/finalize.write.d.ts +21 -0
  14. package/dist/document-draft/handlers/finalize.write.js +73 -0
  15. package/dist/document-draft/handlers/patch.write.d.ts +1420 -0
  16. package/dist/document-draft/handlers/patch.write.js +65 -0
  17. package/dist/document-draft/handlers/revise.write.d.ts +12 -0
  18. package/dist/document-draft/handlers/revise.write.js +39 -0
  19. package/dist/document-draft/handlers/save.write.d.ts +12 -0
  20. package/dist/document-draft/handlers/save.write.js +40 -0
  21. package/dist/document-draft/i18n.d.ts +6 -0
  22. package/dist/document-draft/i18n.js +20 -0
  23. package/dist/document-draft/index.d.ts +5 -0
  24. package/dist/document-draft/index.js +3 -0
  25. package/dist/document-draft/lib.d.ts +13 -0
  26. package/dist/document-draft/lib.js +42 -0
  27. package/dist/document-draft/options.d.ts +35 -0
  28. package/dist/document-draft/options.js +1 -0
  29. package/dist/document-draft/payloads.d.ts +1440 -0
  30. package/dist/document-draft/payloads.js +35 -0
  31. package/dist/document-draft/screens/editor-screen.d.ts +3 -0
  32. package/dist/document-draft/screens/editor-screen.js +13 -0
  33. package/dist/document-draft/user-data.d.ts +13 -0
  34. package/dist/document-draft/user-data.js +43 -0
  35. package/dist/document-draft/web/client-plugin.d.ts +7 -0
  36. package/dist/document-draft/web/client-plugin.js +13 -0
  37. package/dist/document-draft/web/constants.d.ts +41 -0
  38. package/dist/document-draft/web/constants.js +42 -0
  39. package/dist/document-draft/web/editor-screen.d.ts +2 -0
  40. package/dist/document-draft/web/editor-screen.js +181 -0
  41. package/dist/document-draft/web/i18n.d.ts +99 -0
  42. package/dist/document-draft/web/i18n.js +52 -0
  43. package/dist/document-draft/web/index.d.ts +3 -0
  44. package/dist/document-draft/web/index.js +3 -0
  45. package/dist/shared/index.d.ts +1 -0
  46. package/dist/shared/index.js +1 -0
  47. package/dist/shared/subject-scope.d.ts +21 -0
  48. package/dist/signature/feature.js +1 -1
  49. package/dist/signature/handlers/cancel.write.d.ts +1 -1
  50. package/dist/signature/handlers/issue-link.write.d.ts +1 -1
  51. package/dist/signature/handlers/request.write.d.ts +1 -1
  52. package/dist/signature/handlers/revoke-link.write.d.ts +1 -1
  53. package/dist/signature/handlers/sign-in-person.write.d.ts +1 -1
  54. package/dist/signature/options.d.ts +2 -1
  55. package/dist/signature/subject-queries.d.ts +1 -1
  56. package/dist/template-resolver/api.d.ts +3 -1
  57. package/dist/template-resolver/boot-rules.d.ts +5 -0
  58. package/dist/template-resolver/boot-rules.js +5 -0
  59. package/dist/template-resolver/feature.d.ts +2 -0
  60. package/dist/template-resolver/feature.js +15 -1
  61. package/dist/template-resolver/handlers/create-variant.write.d.ts +17 -0
  62. package/dist/template-resolver/handlers/create-variant.write.js +112 -0
  63. package/dist/template-resolver/handlers/document-base.d.ts +1 -0
  64. package/dist/template-resolver/handlers/document-base.js +2 -0
  65. package/dist/template-resolver/handlers/overview.query.d.ts +6 -0
  66. package/dist/template-resolver/handlers/overview.query.js +29 -3
  67. package/dist/template-resolver/handlers/patch-draft.write.js +9 -1
  68. package/dist/template-resolver/handlers/template-write.d.ts +8 -2
  69. package/dist/template-resolver/handlers/template-write.js +87 -12
  70. package/dist/template-resolver/handlers/toggle-status.write.js +26 -5
  71. package/dist/template-resolver/handlers/upsert-tenant.write.js +1 -0
  72. package/dist/template-resolver/handlers/variants.query.d.ts +11 -0
  73. package/dist/template-resolver/handlers/variants.query.js +62 -0
  74. package/dist/template-resolver/i18n.js +1 -0
  75. package/dist/template-resolver/index.d.ts +5 -1
  76. package/dist/template-resolver/index.js +5 -1
  77. package/dist/template-resolver/seeding.d.ts +2 -0
  78. package/dist/template-resolver/seeding.js +12 -1
  79. package/dist/template-resolver/template-delivery-policy.d.ts +13 -4
  80. package/dist/template-resolver/template-delivery-policy.js +38 -2
  81. package/dist/template-resolver/template-edit-policy.d.ts +3 -0
  82. package/dist/template-resolver/template-edit-policy.js +2 -2
  83. package/dist/template-resolver/template-meta.d.ts +1 -0
  84. package/dist/template-resolver/template-meta.js +1 -0
  85. package/dist/template-resolver/template-variants.d.ts +11 -0
  86. package/dist/template-resolver/template-variants.js +43 -0
  87. package/dist/template-resolver/web/document-tiptap-content.js +7 -2
  88. package/dist/template-resolver/web/document-tiptap-toolbar.js +8 -4
  89. package/dist/template-resolver/web/i18n.js +22 -0
  90. package/dist/template-resolver/web/index.d.ts +1 -0
  91. package/dist/template-resolver/web/index.js +1 -0
  92. package/dist/template-resolver/web/qualified-names.d.ts +5 -0
  93. package/dist/template-resolver/web/qualified-names.js +5 -0
  94. package/dist/template-resolver/web/system-placeholders.d.ts +4 -0
  95. package/dist/template-resolver/web/system-placeholders.js +13 -0
  96. package/dist/tenant/handlers/update-member-roles.write.js +1 -1
  97. package/dist/tenant/i18n.js +0 -1
  98. package/dist/tenant-inactivity/constants.d.ts +1 -1
  99. package/dist/tenant-inactivity/constants.js +1 -1
  100. package/dist/tenant-lifecycle/constants.d.ts +1 -1
  101. package/dist/tenant-lifecycle/constants.js +1 -1
  102. package/package.json +27 -11
  103. package/src/document-draft/changes.json +8 -0
  104. package/src/helpdesk/changes.json +6 -0
  105. package/src/signature/changes.json +6 -0
  106. package/src/template-resolver/changes.json +30 -0
  107. package/src/tenant/changes.json +7 -0
  108. package/src/tenant-inactivity/changes.json +7 -0
  109. package/src/tenant-lifecycle/changes.json +7 -0
  110. package/dist/signature/subject-scope.d.ts +0 -11
  111. /package/dist/{signature → shared}/subject-scope.js +0 -0
@@ -16,8 +16,13 @@ function tableClasses(canvas, page) {
16
16
  ? cn(page
17
17
  ? "[&_table]:mb-(--doc-line) [&_table]:mt-0 [&_.ProseMirror>.tableWrapper:last-child_table]:mb-0"
18
18
  : "[&_table]:mb-2 [&_table]:mt-6 [&_.ProseMirror>:first-child_table]:mt-0 [&_.ProseMirror>table:first-child]:mt-0", "[&_td:last-child>p[data-size=small][data-align=right]]:whitespace-nowrap")
19
- : "[&_table]:my-2";
19
+ : cn("[&_table]:my-2",
20
+ // The repeat strip is absolutely placed above its table and needs a line of room inside the wrapper.
21
+ "[&_.tableWrapper:has([data-testid=document-repeat-strip])_table]:mt-[var(--doc-line,1.25rem)]!");
20
22
  }
23
+ // A wide table scrolls inside its wrapper instead of pushing past the editor frame. Not on the
24
+ // paper canvas, where tables are bounded by the page.
25
+ const TABLE_SCROLL_CLASS = "[&_.tableWrapper]:max-w-full [&_.tableWrapper]:overflow-x-auto";
21
26
  // The PDF prints cells top-aligned, header like body text and no rules unless the layout sets a
22
27
  // table style; the dashed outline only marks the cells while editing, like the frame outline.
23
28
  function cellClasses(canvas, print) {
@@ -39,7 +44,7 @@ export function renderEditorContent(editor, canvas, hosted, print, mailSpacing =
39
44
  // Preflight strips paragraph and list margins; a mail body in a form field needs them back.
40
45
  mailSpacing &&
41
46
  "[&_p]:my-3 [&_ul]:my-3 [&_ol]:my-3 [&_li>p]:my-0 [&_.ProseMirror>:first-child]:mt-0 [&_.ProseMirror>:last-child]:mb-0", print !== "none" &&
42
- "[&_td]:relative [&_th]:relative [&_.column-resize-handle]:pointer-events-none [&_.column-resize-handle]:absolute [&_.column-resize-handle]:-right-0.5 [&_.column-resize-handle]:bottom-0 [&_.column-resize-handle]:top-0 [&_.column-resize-handle]:w-1 [&_.column-resize-handle]:bg-primary", "[&_[data-borders=none]_td]:border-transparent [&_[data-borders=none]_th]:border-transparent", "[&_ul]:list-disc [&_ol]:list-decimal [&_ul]:pl-6 [&_ol]:pl-6", headingClasses(canvas, page), "[&_a]:underline [&_a]:text-primary", "[&_strong]:font-bold [&_em]:italic [&_u]:underline", tableClasses(canvas, page),
47
+ "[&_td]:relative [&_th]:relative [&_.column-resize-handle]:pointer-events-none [&_.column-resize-handle]:absolute [&_.column-resize-handle]:-right-0.5 [&_.column-resize-handle]:bottom-0 [&_.column-resize-handle]:top-0 [&_.column-resize-handle]:w-1 [&_.column-resize-handle]:bg-primary", "[&_[data-borders=none]_td]:border-transparent [&_[data-borders=none]_th]:border-transparent", "[&_ul]:list-disc [&_ol]:list-decimal [&_ul]:pl-6 [&_ol]:pl-6", headingClasses(canvas, page), "[&_a]:underline [&_a]:text-primary", "[&_strong]:font-bold [&_em]:italic [&_u]:underline", tableClasses(canvas, page), !page && TABLE_SCROLL_CLASS,
43
48
  // A layout region has no content below its table; margins there only inflate the region box.
44
49
  hosted && "[&_td>div]:my-0 [&_.ProseMirror>.tableWrapper:last-child_table]:mb-0", "[&_table]:w-full [&_table]:border-collapse", "[&_td>p]:m-0 [&_th>p]:m-0 [&_th]:text-left", cellClasses(canvas, print), "[&_tr[data-each]>td]:bg-muted/50", "[&_[data-align=left]]:text-left [&_[data-align=center]]:text-center [&_[data-align=right]]:text-right [&_[data-align=justify]]:text-justify", "[&_p[data-size=small]]:text-xs [&_p[data-size=small]]:text-muted-foreground", "[&_a[data-button]]:inline-block [&_a[data-button]]:rounded-full [&_a[data-button]]:bg-primary [&_a[data-button]]:px-4 [&_a[data-button]]:py-1.5 [&_a[data-button]]:text-primary-foreground [&_a[data-button]]:no-underline",
45
50
  // A chip in the button would be primary on primary; it inverts to stay readable.
@@ -97,11 +97,15 @@ function renderPrintBlockMenu(c) {
97
97
  onSelect: () => c.runPrintBlock(block),
98
98
  })) }));
99
99
  }
100
+ // The form-field toolbar wraps on desktop; under md every row is one line that swipes sideways.
101
+ // `relative` makes the row the containing block of absolutely placed children (hidden inputs, popover
102
+ // anchors); without it they escape the scroll clip and widen the page.
103
+ const NARROW_SCROLL_ROW = "relative gap-1 p-1 max-md:flex-nowrap max-md:overflow-x-auto md:flex-wrap [&>*]:shrink-0";
100
104
  function renderPrintStyleRow(c) {
101
105
  const { canvas } = c;
102
106
  return (_jsxs("div", { className: cn("flex items-center border-b border-input", canvas
103
- ? "min-h-9 flex-wrap gap-1.5 bg-background px-1.5 py-1 [&>*]:shrink-0"
104
- : "flex-wrap gap-1 p-1"), children: [renderPrintTextStyleGroup(c), renderPrintTableGroup(c)] }));
107
+ ? "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"
108
+ : NARROW_SCROLL_ROW), children: [renderPrintTextStyleGroup(c), renderPrintTableGroup(c)] }));
105
109
  }
106
110
  export function renderToolbarBar(c) {
107
111
  return (_jsxs(_Fragment, { children: [renderMainToolbarRow(c), c.print !== "none" && renderPrintStyleRow(c)] }));
@@ -128,6 +132,6 @@ function renderMainToolbarRow(c) {
128
132
  const inlineBlocks = c.blocks.filter((block) => !menuBlocks.includes(block));
129
133
  const overflowItems = overflowItemsOf(c, menuBlocks, blockButtons);
130
134
  return (_jsxs("div", { className: cn("flex items-center border-b border-input", canvas
131
- ? "min-h-9 flex-nowrap gap-0 overflow-hidden bg-background px-1.5 [&>*]:shrink-0 [&_button]:h-7 [&_button]:gap-1 [&_button]:px-1 [&_button]:text-xs"
132
- : "flex-wrap gap-1 p-1"), children: [renderParagraphStyleSelect(c), _jsx(Separator, { compact: compact || canvas }), renderMarkButtons(c), _jsx(Separator, { compact: compact || canvas }), renderListButtons(c), renderPlaceholderButton(c), inlineBlocks.length > 0 && _jsx(Separator, { compact: compact || canvas }), inlineBlocks.map((block) => renderInlineBlock(c, block, blockButtons)), c.print !== "none" && _jsx(Separator, { compact: compact || canvas }), renderPrintBlockMenu(c), overflowItems.length > 0 && ActionOverflowMenu !== undefined && (_jsx("span", { className: "ml-auto shrink-0", children: _jsx(ActionOverflowMenu, { items: overflowItems, label: t("template-resolver.documentEditor.more"), testId: `${id}-toolbar-more` }) }))] }));
135
+ ? "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"
136
+ : NARROW_SCROLL_ROW), children: [renderParagraphStyleSelect(c), _jsx(Separator, { compact: compact || canvas }), renderMarkButtons(c), _jsx(Separator, { compact: compact || canvas }), renderListButtons(c), renderPlaceholderButton(c), inlineBlocks.length > 0 && _jsx(Separator, { compact: compact || canvas }), inlineBlocks.map((block) => renderInlineBlock(c, block, blockButtons)), c.print !== "none" && _jsx(Separator, { compact: compact || canvas }), renderPrintBlockMenu(c), overflowItems.length > 0 && ActionOverflowMenu !== undefined && (_jsx("span", { className: "ml-auto shrink-0", children: _jsx(ActionOverflowMenu, { items: overflowItems, label: t("template-resolver.documentEditor.more"), testId: `${id}-toolbar-more` }) }))] }));
133
137
  }
@@ -5,6 +5,22 @@
5
5
  // Keys follow `template-resolver.editor.<slug>`.
6
6
  export const defaultTranslations = {
7
7
  en: {
8
+ "template-resolver.systemPlaceholder.tenantName": "Company name",
9
+ "template-resolver.systemPlaceholder.signature": "Signature",
10
+ "template-resolver.systemPlaceholder.imprint": "Imprint",
11
+ "template-resolver.systemPlaceholder.unsubscribeUrl": "Unsubscribe link",
12
+ "template-resolver.systemPlaceholder.page": "Page number",
13
+ "template-resolver.systemPlaceholder.pages": "Page count",
14
+ "template-resolver.systemPlaceholder.companyAddress": "Address",
15
+ "template-resolver.systemPlaceholder.companyPhone": "Phone",
16
+ "template-resolver.systemPlaceholder.companyEmail": "Email",
17
+ "template-resolver.systemPlaceholder.companyWebsite": "Website",
18
+ "template-resolver.systemPlaceholder.companyRegister": "Commercial register",
19
+ "template-resolver.systemPlaceholder.companyVatId": "VAT ID",
20
+ "template-resolver.systemPlaceholder.companyManagement": "Management",
21
+ "template-resolver.systemPlaceholder.companyBank": "Bank",
22
+ "template-resolver.systemPlaceholder.companyIban": "IBAN",
23
+ "template-resolver.systemPlaceholder.companyBic": "BIC",
8
24
  "template-resolver.documentEditor.button": "Button",
9
25
  "template-resolver.documentEditor.buttonDefaultText": "Confirm",
10
26
  "template-resolver.documentEditor.buttonTarget": "Button target",
@@ -87,6 +103,12 @@ export const defaultTranslations = {
87
103
  "templateResolver.errors.patch.regionRequired": "A PDF layout is edited one region at a time; set region to header, signature or footer.",
88
104
  "templateResolver.errors.patch.regionNotAllowed": "A region only applies to PDF layouts, not to {kind}.",
89
105
  "templateResolver.errors.patch.layoutExists": "A layout with the slug {slug} already exists.",
106
+ "templateResolver.errors.patch.variantsNotEnabled": "Variants are not enabled for the template {slug}.",
107
+ "templateResolver.errors.patch.variantExists": "A variant with the slug {slug} already exists.",
108
+ "templateResolver.errors.patch.variantNameInvalid": "The short name must be lowercase letters, digits and dashes; give one or change the title.",
109
+ "templateResolver.errors.patch.variablesInheritedFromBase": "A variant uses the variables of its base template {slug}; change them there.",
110
+ "templateResolver.errors.patch.invalidVariantOf": "The variant must belong to the base template in its slug.",
111
+ "templateResolver.errors.variantUnknown": "The variant {variant} does not exist.",
90
112
  "templateResolver.errors.template.reservedLayoutSlug": "The prefix {prefix} is reserved for tenant layouts.",
91
113
  "templateResolver.errors.patch.emptyFormat": "Give at least one of align, style or textStyle.",
92
114
  "templateResolver.errors.patch.unknownBlock": "The block {blockId} does not exist in the template.",
@@ -14,4 +14,5 @@ export { PDF_CORNER_MARK_INSET_MM, PDF_CORNER_MARK_LEG_MM, PDF_DEFAULT_FONT_SIZE
14
14
  export { PlaceholderLineEditor, type PlaceholderLineEditorProps, } from "./placeholder-line-editor-lazy.tsx";
15
15
  export { previewTargetOfKind } from "./preview-targets.ts";
16
16
  export { TemplateResolverErrors, TemplateResolverHandlers, TemplateResolverQueries, } from "./qualified-names.ts";
17
+ export { SYSTEM_PLACEHOLDER_TYPE, systemPlaceholderLabel, translatedOr, } from "./system-placeholders.ts";
17
18
  export { WebPreviewRenderer } from "./web-preview-renderer.tsx";
@@ -17,4 +17,5 @@ export { PDF_CORNER_MARK_INSET_MM, PDF_CORNER_MARK_LEG_MM, PDF_DEFAULT_FONT_SIZE
17
17
  export { PlaceholderLineEditor, } from "./placeholder-line-editor-lazy.js";
18
18
  export { previewTargetOfKind } from "./preview-targets.js";
19
19
  export { TemplateResolverErrors, TemplateResolverHandlers, TemplateResolverQueries, } from "./qualified-names.js";
20
+ export { SYSTEM_PLACEHOLDER_TYPE, systemPlaceholderLabel, translatedOr, } from "./system-placeholders.js";
20
21
  export { WebPreviewRenderer } from "./web-preview-renderer.js";
@@ -21,6 +21,7 @@ export declare const TemplateResolverHandlers: {
21
21
  readonly applyLayout: "template-resolver:write:apply-layout";
22
22
  readonly createLayout: "template-resolver:write:create-layout";
23
23
  readonly publishTemplates: "template-resolver:write:publish-templates";
24
+ readonly createVariant: "template-resolver:write:create-variant";
24
25
  };
25
26
  export declare const ConfigHandlers: {
26
27
  readonly set: "config:write:set";
@@ -40,6 +41,7 @@ export declare const TemplateResolverQueries: {
40
41
  readonly documentBlocks: "template-resolver:query:document-blocks";
41
42
  readonly exportBundle: "template-resolver:query:export-bundle";
42
43
  readonly sendTestStatus: "template-resolver:query:send-test-status";
44
+ readonly variants: "template-resolver:query:variants";
43
45
  readonly bySlug: "template-resolver:query:by-slug";
44
46
  readonly byTenant: "template-resolver:query:by-tenant";
45
47
  };
@@ -70,4 +72,7 @@ export declare const TemplateResolverErrors: {
70
72
  readonly testMailNoChannel: "template_test_mail_no_channel";
71
73
  readonly testMailNoAddress: "template_test_mail_no_address";
72
74
  readonly testMailFailed: "template_test_mail_failed";
75
+ readonly variantsNotEnabled: "variants_not_enabled";
76
+ readonly variantExists: "variant_exists";
77
+ readonly variantNameInvalid: "variant_name_invalid";
73
78
  };
@@ -22,6 +22,7 @@ export const TemplateResolverHandlers = {
22
22
  applyLayout: "template-resolver:write:apply-layout",
23
23
  createLayout: "template-resolver:write:create-layout",
24
24
  publishTemplates: "template-resolver:write:publish-templates",
25
+ createVariant: "template-resolver:write:create-variant",
25
26
  };
26
27
  // The config feature's write handler, which applyLayout dispatches to for the tenant default layout.
27
28
  export const ConfigHandlers = { set: "config:write:set" };
@@ -40,6 +41,7 @@ export const TemplateResolverQueries = {
40
41
  documentBlocks: "template-resolver:query:document-blocks",
41
42
  exportBundle: "template-resolver:query:export-bundle",
42
43
  sendTestStatus: "template-resolver:query:send-test-status",
44
+ variants: "template-resolver:query:variants",
43
45
  // Public pair — anonymous-reachable, kind pinned to text-block.
44
46
  bySlug: "template-resolver:query:by-slug",
45
47
  byTenant: "template-resolver:query:by-tenant",
@@ -79,4 +81,7 @@ export const TemplateResolverErrors = {
79
81
  testMailNoChannel: "template_test_mail_no_channel",
80
82
  testMailNoAddress: "template_test_mail_no_address",
81
83
  testMailFailed: "template_test_mail_failed",
84
+ variantsNotEnabled: "variants_not_enabled",
85
+ variantExists: "variant_exists",
86
+ variantNameInvalid: "variant_name_invalid",
82
87
  };
@@ -0,0 +1,4 @@
1
+ import type { Translate } from "@cosmicdrift/kumiko-renderer/headless";
2
+ export declare const SYSTEM_PLACEHOLDER_TYPE: Readonly<Partial<Record<string, "link">>>;
3
+ export declare function translatedOr(t: Translate, key: string, fallback: string): string;
4
+ export declare function systemPlaceholderLabel(t: Translate, name: string): string;
@@ -0,0 +1,13 @@
1
+ // Placeholders the renderer fills in; only the ones that are not plain text are listed.
2
+ export const SYSTEM_PLACEHOLDER_TYPE = {
3
+ imprint: "link",
4
+ unsubscribeUrl: "link",
5
+ };
6
+ // t() returns the key itself without a translation.
7
+ export function translatedOr(t, key, fallback) {
8
+ const translated = t(key);
9
+ return translated === key ? fallback : translated;
10
+ }
11
+ export function systemPlaceholderLabel(t, name) {
12
+ return translatedOr(t, `template-resolver.systemPlaceholder.${name}`, name);
13
+ }
@@ -41,7 +41,7 @@ export const updateMemberRolesWrite = defineWriteHandler({
41
41
  // manage memberships cross-tenant (payload.tenantId). TenantAdmin and Admin
42
42
  // are session-scoped (event.user.tenantId).
43
43
  access: { roles: ["system", ...access.admin] },
44
- description: "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 or TenantOwner, 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.",
44
+ description: "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.",
45
45
  agent: { risk: "high" },
46
46
  handler: async (event, ctx) => {
47
47
  if (!ctx.systemDb) {
@@ -48,7 +48,6 @@ export const TENANT_I18N = {
48
48
  "tenant:entity:__action-form__:field:roles:option:Member": { en: "Member" },
49
49
  "tenant:entity:__action-form__:field:roles:option:Admin": { en: "Admin" },
50
50
  "tenant:entity:__action-form__:field:roles:option:TenantAdmin": { en: "Tenant Admin" },
51
- "tenant:entity:__action-form__:field:roles:option:TenantOwner": { en: "Tenant Owner" },
52
51
  "tenant:entity:__action-form__:field:roles:option:DataProtectionOfficer": {
53
52
  en: "Data Protection Officer",
54
53
  },
@@ -1,6 +1,6 @@
1
1
  export declare const TENANT_INACTIVITY_FEATURE = "tenant-inactivity";
2
2
  export declare const TENANT_INACTIVITY_STATE_ENTITY = "tenant-inactivity-state";
3
- export declare const TENANT_KEEP_ACCOUNT_ROLES: readonly ["TenantOwner", "TenantAdmin", "Admin"];
3
+ export declare const TENANT_KEEP_ACCOUNT_ROLES: readonly ["TenantAdmin", "Admin"];
4
4
  export declare const TenantInactivityJobs: {
5
5
  readonly check: "tenant-inactivity:job:check-inactive-tenants";
6
6
  };
@@ -1,7 +1,7 @@
1
1
  export const TENANT_INACTIVITY_FEATURE = "tenant-inactivity";
2
2
  export const TENANT_INACTIVITY_STATE_ENTITY = "tenant-inactivity-state";
3
3
  // Stays import-free for the client-safe subpath; a test ties it to TENANT_ACCOUNT_CLOSE_ROLES.
4
- export const TENANT_KEEP_ACCOUNT_ROLES = ["TenantOwner", "TenantAdmin", "Admin"];
4
+ export const TENANT_KEEP_ACCOUNT_ROLES = ["TenantAdmin", "Admin"];
5
5
  export const TenantInactivityJobs = {
6
6
  check: `${TENANT_INACTIVITY_FEATURE}:job:check-inactive-tenants`,
7
7
  };
@@ -1,5 +1,5 @@
1
1
  export declare const TENANT_LIFECYCLE_FEATURE: "tenant-lifecycle";
2
- export declare const TENANT_ACCOUNT_CLOSE_ROLES: readonly ["TenantOwner", "Admin"];
2
+ export declare const TENANT_ACCOUNT_CLOSE_ROLES: readonly ["Admin"];
3
3
  export declare const TENANT_AGGREGATE_TYPE: "tenant";
4
4
  export declare const DESTRUCTION_REQUESTED_EVENT_SHORT: "destruction-requested";
5
5
  export declare const DESTRUCTION_CANCELLED_EVENT_SHORT: "destruction-cancelled";
@@ -1,5 +1,5 @@
1
1
  export const TENANT_LIFECYCLE_FEATURE = "tenant-lifecycle";
2
- export const TENANT_ACCOUNT_CLOSE_ROLES = ["TenantOwner", "Admin"];
2
+ export const TENANT_ACCOUNT_CLOSE_ROLES = ["Admin"];
3
3
  export const TENANT_AGGREGATE_TYPE = "tenant";
4
4
  const EVENT_PREFIX = `${TENANT_LIFECYCLE_FEATURE}:event:`;
5
5
  export const DESTRUCTION_REQUESTED_EVENT_SHORT = "destruction-requested";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cosmicdrift/kumiko-bundled-features",
3
- "version": "0.422.0",
3
+ "version": "0.424.0",
4
4
  "description": "Built-in features — tenant, user, auth, delivery. The stuff you'd rewrite anyway, already typed.",
5
5
  "license": "MIT",
6
6
  "author": "Marc Frost <marc@cosmicdriftgamestudio.com>",
@@ -604,6 +604,14 @@
604
604
  "types": "./dist/signature/web/index.d.ts",
605
605
  "default": "./dist/signature/web/index.js"
606
606
  },
607
+ "./document-draft": {
608
+ "types": "./dist/document-draft/index.d.ts",
609
+ "default": "./dist/document-draft/index.js"
610
+ },
611
+ "./document-draft/web": {
612
+ "types": "./dist/document-draft/web/index.d.ts",
613
+ "default": "./dist/document-draft/web/index.js"
614
+ },
607
615
  "./signature/static-sign": {
608
616
  "types": "./dist/signature/static-sign.d.ts",
609
617
  "default": "./dist/signature/static-sign.js"
@@ -646,9 +654,9 @@
646
654
  }
647
655
  },
648
656
  "dependencies": {
649
- "@cosmicdrift/kumiko-framework": "0.422.0",
650
- "@cosmicdrift/kumiko-renderer": "0.422.0",
651
- "@cosmicdrift/kumiko-types": "0.422.0",
657
+ "@cosmicdrift/kumiko-framework": "0.424.0",
658
+ "@cosmicdrift/kumiko-renderer": "0.424.0",
659
+ "@cosmicdrift/kumiko-types": "0.424.0",
652
660
  "@fontsource/arimo": "^5.3.0",
653
661
  "@fontsource/caladea": "^5.3.0",
654
662
  "@fontsource/carlito": "^5.3.0",
@@ -1273,6 +1281,14 @@
1273
1281
  "types": "./dist/signature/web/index.d.ts",
1274
1282
  "default": "./dist/signature/web/index.js"
1275
1283
  },
1284
+ "./document-draft": {
1285
+ "types": "./dist/document-draft/index.d.ts",
1286
+ "default": "./dist/document-draft/index.js"
1287
+ },
1288
+ "./document-draft/web": {
1289
+ "types": "./dist/document-draft/web/index.d.ts",
1290
+ "default": "./dist/document-draft/web/index.js"
1291
+ },
1276
1292
  "./signature/static-sign": {
1277
1293
  "types": "./dist/signature/static-sign.d.ts",
1278
1294
  "default": "./dist/signature/static-sign.js"
@@ -1323,19 +1339,19 @@
1323
1339
  "LICENSE"
1324
1340
  ],
1325
1341
  "devDependencies": {
1326
- "@cosmicdrift/kumiko-locale-de": "0.422.0",
1327
- "@cosmicdrift/kumiko-locale-es": "0.422.0",
1328
- "@cosmicdrift/kumiko-locale-fr": "0.422.0",
1329
- "@cosmicdrift/kumiko-locale-it": "0.422.0",
1330
- "@cosmicdrift/kumiko-renderer-mail-html": "0.422.0",
1331
- "@cosmicdrift/kumiko-testing": "0.422.0",
1342
+ "@cosmicdrift/kumiko-locale-de": "0.424.0",
1343
+ "@cosmicdrift/kumiko-locale-es": "0.424.0",
1344
+ "@cosmicdrift/kumiko-locale-fr": "0.424.0",
1345
+ "@cosmicdrift/kumiko-locale-it": "0.424.0",
1346
+ "@cosmicdrift/kumiko-renderer-mail-html": "0.424.0",
1347
+ "@cosmicdrift/kumiko-testing": "0.424.0",
1332
1348
  "@testing-library/user-event": "^14.6.8",
1333
1349
  "@types/sanitize-html": "^2.16.2",
1334
1350
  "jsqr": "^1.4.0",
1335
1351
  "unpdf": "^1.9.1"
1336
1352
  },
1337
1353
  "peerDependencies": {
1338
- "@cosmicdrift/kumiko-testing": "0.422.0"
1354
+ "@cosmicdrift/kumiko-testing": "0.424.0"
1339
1355
  },
1340
1356
  "peerDependenciesMeta": {
1341
1357
  "@cosmicdrift/kumiko-testing": {
@@ -0,0 +1,8 @@
1
+ [
2
+ {
3
+ "version": "0.424.0",
4
+ "type": "improvement",
5
+ "title": "document-draft bundle for per-object PDF drafts",
6
+ "detail": "`createDocumentDraftFeature({ subjectTypes, pdf: { render, store }, retention?, access?, authorizeSubject?, unscopedRoles?, subjectScreens? })` adds the entity `documentDraft` (table `read_document_drafts`, so apps that mount it need a schema migration) and the handlers `create`, `patch`, `save`, `finalize`, `revise`, `discard` and the queries `blocks` and `by-subject`. `create` copies a template or one of its variants (placeholders stay in the body) and freezes the `variables`; `patch` takes the ops of `template-resolver:write:patch-draft` except `setVariable`, `setMeta` and `setResource` (`op_not_allowed`); `finalize` prints the draft body and stores the PDF. `{ render: renderPdfBeforeTransaction, store: storeRenderedPdf }` from renderer-puppeteer-client fits `pdf` without an adapter. Body, variables and last change are personal data of the draft row; `forgetDocumentDraftsOfSubject(ctx, subject)` purges the drafts of an erased object and erases their keys. The bundle requires `user-data-rights`. The editor is the dormant custom screen `document-draft:screen:document-draft-editor`, mounted with `documentDraftClient()` from `@cosmicdrift/kumiko-bundled-features/document-draft/web`: it opens with the draft id, edits the text, lists the deviations from the template, saves, finalizes or discards (then opens `subjectScreens[subjectType]` with the subject id) and reopens a finalized draft. The subject scope (`createSubjectScope`) moved from signature to the shared barrel and is used by both bundles."
7
+ }
8
+ ]
@@ -1,4 +1,10 @@
1
1
  [
2
+ {
3
+ "version": "0.424.0",
4
+ "type": "fix",
5
+ "title": "helpdesk tests no longer flake on a guessed wrong nonce",
6
+ "detail": "A guessed wrong nonce still solved the challenge with probability 2^-bits at the low test difficulty, so the dropped-submit and wrong-nonce tests failed now and then. The tests now search for a nonce that fails verification. No runtime change."
7
+ },
2
8
  {
3
9
  "version": "0.415.0",
4
10
  "type": "fix",
@@ -1,4 +1,10 @@
1
1
  [
2
+ {
3
+ "version": "0.424.0",
4
+ "type": "breaking",
5
+ "title": "authorizeSubject receives the subject scope context instead of the full handler context",
6
+ "migration": "The ctx argument of `authorizeSubject` (`AuthorizeSignatureSubject`, `AuthorizeDocumentDraftSubject`) is now `SubjectScopeContext` from the shared barrel: `db`, `registry` and `services` only, because the check also runs in `beforeTransaction`, before a draft is printed. A callback that reads only these compiles unchanged; one that used `ctx.user`, `ctx.dispatch` or `ctx.events` takes the user from its second argument and reads through `ctx.db` instead."
7
+ },
2
8
  {
3
9
  "version": "0.420.0",
4
10
  "type": "fix",
@@ -1,4 +1,34 @@
1
1
  [
2
+ {
3
+ "version": "0.424.0",
4
+ "type": "improvement",
5
+ "title": "document ops, sanitizer and block diff are exported",
6
+ "detail": "The barrel exports `applyDocumentOps`, `documentOpsSchema`, `documentBlocksOf`, `allowedBlocksFor`, `parseDocumentJson`, `serializeDocumentJson`, `diffTemplateBlocks`, `splitTemplateBlocks` and `VARIANT_UNKNOWN_REASON`, so a bundle that keeps its own copy of a document can edit it with the same operations."
7
+ },
8
+ {
9
+ "version": "0.424.0",
10
+ "type": "fix",
11
+ "title": "form-field document editor keeps tables in frame, scrolls its toolbar and leaves room for the repeat strip",
12
+ "detail": "Under md the toolbar rows of the form-field editor are one line that swipes sideways instead of wrapping. Wide tables scroll inside their wrapper instead of leaving the editor frame, and a table with a repeat strip gets a line of room above it so the strip no longer covers the previous paragraph. The document-draft editor shows the template's variable label (or the company-data name) on a placeholder chip that has no value yet."
13
+ },
14
+ {
15
+ "version": "0.424.0",
16
+ "type": "fix",
17
+ "title": "The variants query no longer requires TenantAdmin or User",
18
+ "detail": "`template-resolver:query:variants` is open to every authenticated user, because whoever may create a document from a base template must be able to list its variants and an app's role names are unknown to the framework. The result is unchanged: slug, title, scope and locale of the active system variants and the caller's own tenant's variants, never another tenant's."
19
+ },
20
+ {
21
+ "version": "0.423.0",
22
+ "type": "improvement",
23
+ "title": "Variants of a PDF template",
24
+ "detail": "A `tenantEditable` entry of kind `document-pdf` accepts `variants: true` (any other kind fails boot with `template-resolver/tenant-editable-variants-need-pdf`). A variant is a `document-pdf` row with the slug `<base>:<name>` (name: one kebab segment, at most 40 characters) and `meta.variantOf = <base>`; its title is the title column. The new write `template-resolver:write:create-variant` ({baseSlug, title, name?, locale?}; `name` is derived from the title when omitted, `locale` defaults to `de`) copies the base as the caller's tenant draft with the base's content, variables, linked images and settings, and is refused with `variants_not_enabled` when the base entry lacks `variants: true` (also for a TenantAdmin) and with `variant_exists` for a taken slug. A variant's `variableSchema` follows its base: every write without an explicit schema (`patch-draft`, `create-variant`, publish) stores the base's current effective schema, so a base that gains a variable does not lock its variants and publish gates the required placeholders against it. `setVariable` on a variant and an `upsert-tenant` schema that differs from the base are refused with `variables_inherited_from_base`; `patch-draft` also refuses a change of `variantOf` (`variant_of_immutable`). The overview query rows carry `variantOf` (base slug or null), `variantsEnabled` and `locale`, and list a variant right after its base; the document designer shows them and offers \"Variante anlegen\" on bases that allow variants. The new query `template-resolver:query:variants` ({baseSlug, locale}) returns the active variants as {slug, title, scope, locale}, system and own, never another tenant's. Editing and delivery of variants follow the base's entry, so removing the base from `tenantEditable` stops serving tenant variants. `seedSystemTemplate` takes `variantOf` for system variants."
25
+ },
26
+ {
27
+ "version": "0.423.0",
28
+ "type": "improvement",
29
+ "title": "patch-draft description tells agents to use heading blocks for section titles",
30
+ "detail": "The `patch-draft` description says that a heading stays with the block that follows it on print, so section titles should be `heading` blocks."
31
+ },
2
32
  {
3
33
  "version": "0.422.0",
4
34
  "type": "improvement",
@@ -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",
@@ -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",
@@ -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,11 +0,0 @@
1
- import type { HandlerContext, SessionUser } from "@cosmicdrift/kumiko-framework/engine";
2
- import type { SignatureOptions } from "./options.ts";
3
- export type SubjectScope = {
4
- isScoped(user: SessionUser): boolean;
5
- allows(ctx: HandlerContext, user: SessionUser, subjectType: unknown, subjectId: unknown): Promise<boolean>;
6
- allowsRequest(ctx: HandlerContext, user: SessionUser, request: {
7
- readonly subjectType?: unknown;
8
- readonly subjectId?: unknown;
9
- }): Promise<boolean>;
10
- };
11
- export declare function createSubjectScope(opts: Pick<SignatureOptions, "authorizeSubject" | "unscopedRoles">): SubjectScope;
File without changes