@cosmicdrift/kumiko-document-designer 0.0.0-stage → 0.363.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/LICENSE +57 -0
- package/README.md +37 -2
- package/dist/constants.d.ts +24 -0
- package/dist/constants.js +33 -0
- package/dist/feature.d.ts +2 -0
- package/dist/feature.js +85 -0
- package/dist/i18n.d.ts +6 -0
- package/dist/i18n.js +670 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/list-definition.d.ts +6 -0
- package/dist/list-definition.js +109 -0
- package/dist/web/cells.d.ts +10 -0
- package/dist/web/cells.js +87 -0
- package/dist/web/client-plugin.d.ts +12 -0
- package/dist/web/client-plugin.js +43 -0
- package/dist/web/compose-layout.d.ts +6 -0
- package/dist/web/compose-layout.js +13 -0
- package/dist/web/errors.d.ts +6 -0
- package/dist/web/errors.js +24 -0
- package/dist/web/field-issue-text.d.ts +4 -0
- package/dist/web/field-issue-text.js +12 -0
- package/dist/web/file-name.d.ts +2 -0
- package/dist/web/file-name.js +17 -0
- package/dist/web/i18n.d.ts +2 -0
- package/dist/web/i18n.js +170 -0
- package/dist/web/index.d.ts +6 -0
- package/dist/web/index.js +7 -0
- package/dist/web/layout-editor-body.d.ts +14 -0
- package/dist/web/layout-editor-body.js +142 -0
- package/dist/web/layout-editor.d.ts +2 -0
- package/dist/web/layout-editor.js +41 -0
- package/dist/web/layout-html.d.ts +7 -0
- package/dist/web/layout-html.js +81 -0
- package/dist/web/layout-rails.d.ts +18 -0
- package/dist/web/layout-rails.js +107 -0
- package/dist/web/layout-types.d.ts +62 -0
- package/dist/web/layout-types.js +1 -0
- package/dist/web/layout-users.d.ts +3 -0
- package/dist/web/layout-users.js +8 -0
- package/dist/web/mail-dialogs.d.ts +29 -0
- package/dist/web/mail-dialogs.js +15 -0
- package/dist/web/mail-draft.d.ts +17 -0
- package/dist/web/mail-draft.js +132 -0
- package/dist/web/mail-edit-center.d.ts +17 -0
- package/dist/web/mail-edit-center.js +11 -0
- package/dist/web/mail-editor-body.d.ts +18 -0
- package/dist/web/mail-editor-body.js +193 -0
- package/dist/web/mail-editor.d.ts +2 -0
- package/dist/web/mail-editor.js +71 -0
- package/dist/web/mail-footer.d.ts +21 -0
- package/dist/web/mail-footer.js +44 -0
- package/dist/web/mail-header.d.ts +23 -0
- package/dist/web/mail-header.js +16 -0
- package/dist/web/mail-left-rail.d.ts +18 -0
- package/dist/web/mail-left-rail.js +53 -0
- package/dist/web/mail-origin-bar.d.ts +17 -0
- package/dist/web/mail-origin-bar.js +84 -0
- package/dist/web/mail-pdf-link-modal.d.ts +11 -0
- package/dist/web/mail-pdf-link-modal.js +54 -0
- package/dist/web/mail-preview-side.d.ts +12 -0
- package/dist/web/mail-preview-side.js +48 -0
- package/dist/web/mail-preview.d.ts +20 -0
- package/dist/web/mail-preview.js +43 -0
- package/dist/web/mail-right-rail.d.ts +19 -0
- package/dist/web/mail-right-rail.js +47 -0
- package/dist/web/mail-types.d.ts +112 -0
- package/dist/web/mail-types.js +1 -0
- package/dist/web/mail-upload-modal.d.ts +16 -0
- package/dist/web/mail-upload-modal.js +56 -0
- package/dist/web/mail-versions.d.ts +6 -0
- package/dist/web/mail-versions.js +43 -0
- package/dist/web/origin-bar.d.ts +13 -0
- package/dist/web/origin-bar.js +82 -0
- package/dist/web/overrides-drawer.d.ts +9 -0
- package/dist/web/overrides-drawer.js +19 -0
- package/dist/web/overview-row.d.ts +21 -0
- package/dist/web/overview-row.js +47 -0
- package/dist/web/page-canvas.d.ts +18 -0
- package/dist/web/page-canvas.js +38 -0
- package/dist/web/pdf-meta.d.ts +23 -0
- package/dist/web/pdf-meta.js +101 -0
- package/dist/web/pdf-preview.d.ts +4 -0
- package/dist/web/pdf-preview.js +99 -0
- package/dist/web/pdf-template-editor.d.ts +8 -0
- package/dist/web/pdf-template-editor.js +326 -0
- package/dist/web/placeholder-panel.d.ts +21 -0
- package/dist/web/placeholder-panel.js +35 -0
- package/dist/web/preview-record-picker.d.ts +12 -0
- package/dist/web/preview-record-picker.js +7 -0
- package/dist/web/rail.d.ts +18 -0
- package/dist/web/rail.js +14 -0
- package/dist/web/settings-panel.d.ts +17 -0
- package/dist/web/settings-panel.js +25 -0
- package/dist/web/status-label.d.ts +7 -0
- package/dist/web/status-label.js +18 -0
- package/dist/web/template-rows.d.ts +9 -0
- package/dist/web/template-rows.js +34 -0
- package/dist/web/types.d.ts +103 -0
- package/dist/web/types.js +3 -0
- package/dist/web/use-insert-targets.d.ts +9 -0
- package/dist/web/use-insert-targets.js +17 -0
- package/dist/web/use-mail-persistence.d.ts +15 -0
- package/dist/web/use-mail-persistence.js +49 -0
- package/dist/web/use-overview-rows.d.ts +7 -0
- package/dist/web/use-overview-rows.js +19 -0
- package/dist/web/use-settled-value.d.ts +2 -0
- package/dist/web/use-settled-value.js +18 -0
- package/dist/web/use-test-mail.d.ts +15 -0
- package/dist/web/use-test-mail.js +27 -0
- package/dist/web/used-by-label.d.ts +9 -0
- package/dist/web/used-by-label.js +32 -0
- package/package.json +63 -4
- package/src/changes.json +20 -0
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import type { FieldIssue } from "@cosmicdrift/kumiko-headless";
|
|
2
|
+
export type TemplateScope = "system" | "tenant";
|
|
3
|
+
export type TemplateStatus = "draft" | "active" | "archived";
|
|
4
|
+
export declare const DOCUMENT_PDF_KIND: "document-pdf";
|
|
5
|
+
export declare const PDF_LAYOUT_KIND: "pdf-layout";
|
|
6
|
+
export declare const DEFAULT_LAYOUT_SLUG = "default";
|
|
7
|
+
export type TemplateListRow = {
|
|
8
|
+
readonly id: string;
|
|
9
|
+
readonly tenantId: string;
|
|
10
|
+
readonly slug: string;
|
|
11
|
+
readonly kind: string;
|
|
12
|
+
readonly locale: string;
|
|
13
|
+
readonly scope: TemplateScope;
|
|
14
|
+
readonly status: TemplateStatus;
|
|
15
|
+
readonly contentFormat: string;
|
|
16
|
+
readonly modifiedAt: string | null;
|
|
17
|
+
};
|
|
18
|
+
export type TemplateDetail = {
|
|
19
|
+
readonly id: string;
|
|
20
|
+
readonly version: number;
|
|
21
|
+
readonly tenantId: string;
|
|
22
|
+
readonly slug: string;
|
|
23
|
+
readonly kind: string;
|
|
24
|
+
readonly locale: string;
|
|
25
|
+
readonly content: string;
|
|
26
|
+
readonly contentFormat: string;
|
|
27
|
+
readonly variableSchema: string | null;
|
|
28
|
+
readonly linkedResources: string | null;
|
|
29
|
+
readonly meta: string | null;
|
|
30
|
+
readonly scope: TemplateScope;
|
|
31
|
+
readonly parentTemplateId: string | null;
|
|
32
|
+
readonly status: TemplateStatus;
|
|
33
|
+
readonly modifiedAt: string | null;
|
|
34
|
+
};
|
|
35
|
+
export type VariableType = "text" | "link" | "money" | "date" | "list";
|
|
36
|
+
export type VariableInfo = {
|
|
37
|
+
readonly type: VariableType;
|
|
38
|
+
readonly label?: string;
|
|
39
|
+
readonly required?: boolean;
|
|
40
|
+
};
|
|
41
|
+
export type ValidationWarning = {
|
|
42
|
+
readonly code: string;
|
|
43
|
+
readonly detail: string;
|
|
44
|
+
readonly i18nKey: string;
|
|
45
|
+
};
|
|
46
|
+
export type ValidationResult = {
|
|
47
|
+
readonly canSave: boolean;
|
|
48
|
+
readonly canPublish: boolean;
|
|
49
|
+
readonly issues: readonly FieldIssue[];
|
|
50
|
+
readonly publishIssues: readonly FieldIssue[];
|
|
51
|
+
readonly used: readonly string[];
|
|
52
|
+
readonly unknown: readonly string[];
|
|
53
|
+
readonly missingRequired: readonly string[];
|
|
54
|
+
readonly warnings: readonly ValidationWarning[];
|
|
55
|
+
readonly variables: Readonly<Record<string, VariableInfo>>;
|
|
56
|
+
readonly systemPlaceholders: readonly string[];
|
|
57
|
+
};
|
|
58
|
+
export type LayoutRegionsHtml = {
|
|
59
|
+
readonly header: string;
|
|
60
|
+
readonly signature: string;
|
|
61
|
+
readonly footer: string;
|
|
62
|
+
};
|
|
63
|
+
export type PreviewResult = {
|
|
64
|
+
readonly layout: {
|
|
65
|
+
readonly slug: string;
|
|
66
|
+
readonly scope: TemplateScope;
|
|
67
|
+
readonly html: string;
|
|
68
|
+
readonly regions: LayoutRegionsHtml;
|
|
69
|
+
} | null;
|
|
70
|
+
};
|
|
71
|
+
export type PuppeteerStatus = {
|
|
72
|
+
readonly available: true;
|
|
73
|
+
} | {
|
|
74
|
+
readonly available: false;
|
|
75
|
+
readonly error?: string;
|
|
76
|
+
readonly message?: string;
|
|
77
|
+
};
|
|
78
|
+
export type PdfPreviewResult = {
|
|
79
|
+
readonly fileName: string;
|
|
80
|
+
readonly pdfBase64: string;
|
|
81
|
+
readonly pageCount: number;
|
|
82
|
+
readonly sizeBytes: number;
|
|
83
|
+
readonly durationMs: number;
|
|
84
|
+
};
|
|
85
|
+
export type TenantOverrides = {
|
|
86
|
+
readonly activeOverrides: number;
|
|
87
|
+
readonly draftOverrides: number;
|
|
88
|
+
readonly totalTenants: number | null;
|
|
89
|
+
};
|
|
90
|
+
export type SaveResult = {
|
|
91
|
+
readonly id: string;
|
|
92
|
+
readonly slug: string;
|
|
93
|
+
readonly isNew: boolean;
|
|
94
|
+
};
|
|
95
|
+
export type TemplateUsage = {
|
|
96
|
+
readonly usedBy: readonly {
|
|
97
|
+
readonly qualifiedName: string;
|
|
98
|
+
readonly feature: string;
|
|
99
|
+
readonly notification: string;
|
|
100
|
+
readonly trigger: string | null;
|
|
101
|
+
readonly role: string;
|
|
102
|
+
}[];
|
|
103
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { DocumentEditorHandle } from "@cosmicdrift/kumiko-bundled-features/template-resolver/web";
|
|
2
|
+
export type InsertField = "subject" | "previewText" | "body";
|
|
3
|
+
export type InsertTargets = {
|
|
4
|
+
readonly register: (field: InsertField) => (handle: DocumentEditorHandle) => void;
|
|
5
|
+
readonly markFocused: (field: InsertField) => () => void;
|
|
6
|
+
readonly insertPlaceholder: (name: string) => void;
|
|
7
|
+
readonly insertResource: (key: string) => void;
|
|
8
|
+
};
|
|
9
|
+
export declare function useInsertTargets(): InsertTargets;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { useRef } from "react";
|
|
2
|
+
// The editors are lazy and report their handle once loaded; the rails insert into whichever
|
|
3
|
+
// field had focus last (the content when none had).
|
|
4
|
+
export function useInsertTargets() {
|
|
5
|
+
const handles = useRef({});
|
|
6
|
+
const lastFocused = useRef("body");
|
|
7
|
+
return {
|
|
8
|
+
register: (field) => (handle) => {
|
|
9
|
+
handles.current[field] = handle;
|
|
10
|
+
},
|
|
11
|
+
markFocused: (field) => () => {
|
|
12
|
+
lastFocused.current = field;
|
|
13
|
+
},
|
|
14
|
+
insertPlaceholder: (name) => handles.current[lastFocused.current]?.insertPlaceholder(name),
|
|
15
|
+
insertResource: (key) => handles.current.body?.insertResource(key),
|
|
16
|
+
};
|
|
17
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { MailDraft, TemplateRowView } from "./mail-types.js";
|
|
2
|
+
export type MailPersistence = {
|
|
3
|
+
readonly save: (draft: MailDraft, publish: boolean) => Promise<boolean>;
|
|
4
|
+
readonly busy: boolean;
|
|
5
|
+
readonly error: string | null;
|
|
6
|
+
readonly clearError: () => void;
|
|
7
|
+
};
|
|
8
|
+
export declare function useMailPersistence(args: {
|
|
9
|
+
readonly slug: string;
|
|
10
|
+
readonly locale: string;
|
|
11
|
+
readonly title: string;
|
|
12
|
+
readonly isSystemAdmin: boolean;
|
|
13
|
+
readonly row: TemplateRowView | null;
|
|
14
|
+
readonly sender: unknown;
|
|
15
|
+
}): MailPersistence;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
// @runtime client
|
|
2
|
+
import { TemplateResolverHandlers } from "@cosmicdrift/kumiko-bundled-features/template-resolver/web";
|
|
3
|
+
import { useMutation, useTranslation } from "@cosmicdrift/kumiko-renderer";
|
|
4
|
+
import { useState } from "react";
|
|
5
|
+
import { errorTextWithFieldIssues } from "./field-issue-text.js";
|
|
6
|
+
import { buildMeta, parseJsonRecord } from "./mail-draft.js";
|
|
7
|
+
// One write for save and publish. The overview title is passed on every write because the
|
|
8
|
+
// upsert replaces a missing title with null and find-by-id does not return it.
|
|
9
|
+
export function useMailPersistence(args) {
|
|
10
|
+
const t = useTranslation();
|
|
11
|
+
const upsertTenant = useMutation(TemplateResolverHandlers.upsertTenant);
|
|
12
|
+
const upsertSystem = useMutation(TemplateResolverHandlers.upsertSystem);
|
|
13
|
+
const publishSystem = useMutation(TemplateResolverHandlers.publishSystem);
|
|
14
|
+
const [error, setError] = useState(null);
|
|
15
|
+
const save = async (draft, publish) => {
|
|
16
|
+
setError(null);
|
|
17
|
+
const base = {
|
|
18
|
+
slug: args.slug,
|
|
19
|
+
kind: "mail",
|
|
20
|
+
locale: args.locale,
|
|
21
|
+
title: args.title,
|
|
22
|
+
content: draft.body,
|
|
23
|
+
contentFormat: "html",
|
|
24
|
+
meta: buildMeta(draft, args.sender),
|
|
25
|
+
variableSchema: parseJsonRecord(args.row?.variableSchema),
|
|
26
|
+
};
|
|
27
|
+
const saved = args.isSystemAdmin
|
|
28
|
+
? await upsertSystem.mutate(base)
|
|
29
|
+
: await upsertTenant.mutate({ ...base, status: publish ? "active" : "draft" });
|
|
30
|
+
if (!saved.isSuccess) {
|
|
31
|
+
setError(errorTextWithFieldIssues(saved.error, t));
|
|
32
|
+
return false;
|
|
33
|
+
}
|
|
34
|
+
if (args.isSystemAdmin && publish) {
|
|
35
|
+
const published = await publishSystem.mutate({ id: saved.data.id });
|
|
36
|
+
if (!published.isSuccess) {
|
|
37
|
+
setError(errorTextWithFieldIssues(published.error, t));
|
|
38
|
+
return false;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
return true;
|
|
42
|
+
};
|
|
43
|
+
return {
|
|
44
|
+
save,
|
|
45
|
+
busy: upsertTenant.pending || upsertSystem.pending || publishSystem.pending,
|
|
46
|
+
error,
|
|
47
|
+
clearError: () => setError(null),
|
|
48
|
+
};
|
|
49
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type OverviewRowView } from "./overview-row.js";
|
|
2
|
+
export type OverviewRows = {
|
|
3
|
+
readonly rows: readonly OverviewRowView[];
|
|
4
|
+
readonly loaded: boolean;
|
|
5
|
+
readonly refetch: () => Promise<void>;
|
|
6
|
+
};
|
|
7
|
+
export declare function useOverviewRows(kind: string, search?: string): OverviewRows;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// @runtime client
|
|
2
|
+
import { TemplateResolverQueries } from "@cosmicdrift/kumiko-bundled-features/template-resolver/web";
|
|
3
|
+
import { useQuery } from "@cosmicdrift/kumiko-renderer";
|
|
4
|
+
import { parseOverviewRow } from "./overview-row.js";
|
|
5
|
+
// One overview row per slug and kind; the filter is applied on the server.
|
|
6
|
+
export function useOverviewRows(kind, search) {
|
|
7
|
+
const query = useQuery(TemplateResolverQueries.overview, {
|
|
8
|
+
filters: [{ field: "kind", op: "in", value: [kind] }],
|
|
9
|
+
limit: 200,
|
|
10
|
+
...(search !== undefined && { search }),
|
|
11
|
+
});
|
|
12
|
+
return {
|
|
13
|
+
rows: (query.data?.rows ?? []).flatMap((row) => parseOverviewRow(row) ?? []),
|
|
14
|
+
loaded: query.data !== null,
|
|
15
|
+
refetch: async () => {
|
|
16
|
+
await query.refetch();
|
|
17
|
+
},
|
|
18
|
+
};
|
|
19
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
// @runtime client
|
|
2
|
+
import { useCallback, useRef, useState } from "react";
|
|
3
|
+
export const SETTLE_DELAY_MS = 400;
|
|
4
|
+
// Handler-driven debounce: the timer starts in the change handler, so no effect is needed.
|
|
5
|
+
// A timer that fires after unmount only sets state on an unmounted component, which is a no-op.
|
|
6
|
+
export function useSettledValue(initial) {
|
|
7
|
+
const [settled, setSettled] = useState(initial);
|
|
8
|
+
const timer = useRef(null);
|
|
9
|
+
const push = useCallback((next) => {
|
|
10
|
+
if (timer.current !== null)
|
|
11
|
+
clearTimeout(timer.current);
|
|
12
|
+
timer.current = setTimeout(() => {
|
|
13
|
+
timer.current = null;
|
|
14
|
+
setSettled(next);
|
|
15
|
+
}, SETTLE_DELAY_MS);
|
|
16
|
+
}, []);
|
|
17
|
+
return [settled, push];
|
|
18
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export type TestMailState = {
|
|
2
|
+
readonly kind: "idle";
|
|
3
|
+
} | {
|
|
4
|
+
readonly kind: "sent";
|
|
5
|
+
readonly subject: string;
|
|
6
|
+
} | {
|
|
7
|
+
readonly kind: "error";
|
|
8
|
+
readonly text: string;
|
|
9
|
+
};
|
|
10
|
+
export type TestMail = {
|
|
11
|
+
readonly state: TestMailState;
|
|
12
|
+
readonly pending: boolean;
|
|
13
|
+
readonly send: (payload: Readonly<Record<string, unknown>>) => Promise<void>;
|
|
14
|
+
};
|
|
15
|
+
export declare function useTestMail(): TestMail;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
// @runtime client
|
|
2
|
+
import { TemplateResolverHandlers } from "@cosmicdrift/kumiko-bundled-features/template-resolver/web";
|
|
3
|
+
import { dispatcherErrorText, useMutation, useTranslation } from "@cosmicdrift/kumiko-renderer";
|
|
4
|
+
import { useState } from "react";
|
|
5
|
+
const TOO_MANY_REQUESTS = 429;
|
|
6
|
+
// The recipient is always the caller; the server never returns the address.
|
|
7
|
+
export function useTestMail() {
|
|
8
|
+
const t = useTranslation();
|
|
9
|
+
const sendTest = useMutation(TemplateResolverHandlers.sendTest);
|
|
10
|
+
const [state, setState] = useState({ kind: "idle" });
|
|
11
|
+
const send = async (payload) => {
|
|
12
|
+
setState({ kind: "idle" });
|
|
13
|
+
const result = await sendTest.mutate(payload);
|
|
14
|
+
if (result.isSuccess) {
|
|
15
|
+
setState({ kind: "sent", subject: result.data.subject });
|
|
16
|
+
}
|
|
17
|
+
else {
|
|
18
|
+
setState({
|
|
19
|
+
kind: "error",
|
|
20
|
+
text: result.error.httpStatus === TOO_MANY_REQUESTS
|
|
21
|
+
? t("documentDesigner.mail.testMail.rateLimited")
|
|
22
|
+
: dispatcherErrorText(result.error, t),
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
return { state, pending: sendTest.pending, send };
|
|
27
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { OverviewRowView, OverviewUsageView } from "./overview-row.js";
|
|
2
|
+
type Translate = (key: string, params?: Readonly<Record<string, unknown>>) => string;
|
|
3
|
+
export declare function usageParts(t: Translate, usage: OverviewUsageView): {
|
|
4
|
+
readonly feature: string;
|
|
5
|
+
readonly notification: string;
|
|
6
|
+
};
|
|
7
|
+
export declare function usageLabel(t: Translate, usage: OverviewUsageView): string;
|
|
8
|
+
export declare function usedByLabel(t: Translate, row: OverviewRowView): string;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
// @runtime client
|
|
2
|
+
import { DEFAULT_LAYOUT_SLUG } from "../constants.js";
|
|
3
|
+
// t() returns the key itself when no translation exists.
|
|
4
|
+
function translateOrRaw(t, key, raw) {
|
|
5
|
+
const translated = t(key);
|
|
6
|
+
return translated === key ? raw : translated;
|
|
7
|
+
}
|
|
8
|
+
export function usageParts(t, usage) {
|
|
9
|
+
return {
|
|
10
|
+
feature: translateOrRaw(t, `${usage.feature}:feature.label`, usage.feature),
|
|
11
|
+
notification: translateOrRaw(t, `${usage.feature}:notify.${usage.notification}.label`, usage.notification),
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
export function usageLabel(t, usage) {
|
|
15
|
+
const { feature, notification } = usageParts(t, usage);
|
|
16
|
+
return usage.feature === "" ? notification : `${feature} · ${notification}`;
|
|
17
|
+
}
|
|
18
|
+
export function usedByLabel(t, row) {
|
|
19
|
+
const emptyMark = "–";
|
|
20
|
+
if (row.kind === "mail-layout" || row.kind === "pdf-layout") {
|
|
21
|
+
if (row.slug === DEFAULT_LAYOUT_SLUG) {
|
|
22
|
+
return t(row.kind === "mail-layout"
|
|
23
|
+
? "documentDesigner.usedBy.allMails"
|
|
24
|
+
: "documentDesigner.usedBy.allPdfs");
|
|
25
|
+
}
|
|
26
|
+
return row.usedByCount === 0
|
|
27
|
+
? emptyMark
|
|
28
|
+
: t("documentDesigner.usedBy.templates", { count: row.usedByCount });
|
|
29
|
+
}
|
|
30
|
+
const first = row.usedBy[0];
|
|
31
|
+
return first === undefined ? emptyMark : usageLabel(t, first);
|
|
32
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,65 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cosmicdrift/kumiko-document-designer",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.363.0",
|
|
4
|
+
"description": "Document designer for Kumiko: template overview, layout editor (mail layout, PDF letterhead) and the PDF template editor.",
|
|
5
|
+
"license": "BUSL-1.1",
|
|
6
|
+
"author": "Marc Frost <marc@cosmicdriftgamestudio.com>",
|
|
7
|
+
"type": "module",
|
|
8
|
+
"kumiko": {
|
|
9
|
+
"runtime": "runtime"
|
|
10
|
+
},
|
|
11
|
+
"exports": {
|
|
12
|
+
".": {
|
|
13
|
+
"types": "./dist/index.d.ts",
|
|
14
|
+
"default": "./dist/index.js"
|
|
15
|
+
},
|
|
16
|
+
"./web": {
|
|
17
|
+
"types": "./dist/web/index.d.ts",
|
|
18
|
+
"default": "./dist/web/index.js"
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
"dependencies": {
|
|
22
|
+
"@cosmicdrift/kumiko-bundled-features": "0.363.0",
|
|
23
|
+
"@cosmicdrift/kumiko-framework": "0.363.0",
|
|
24
|
+
"@cosmicdrift/kumiko-headless": "0.363.0",
|
|
25
|
+
"@cosmicdrift/kumiko-renderer": "0.363.0",
|
|
26
|
+
"@cosmicdrift/kumiko-renderer-puppeteer-client": "0.363.0",
|
|
27
|
+
"@cosmicdrift/kumiko-renderer-web": "0.363.0",
|
|
28
|
+
"@cosmicdrift/kumiko-types": "0.363.0",
|
|
29
|
+
"pdfjs-dist": "6.3.289",
|
|
30
|
+
"react": "^19.2.6"
|
|
31
|
+
},
|
|
32
|
+
"devDependencies": {
|
|
33
|
+
"@testing-library/react": "^16.3.2",
|
|
34
|
+
"@types/react": "^19.2.14"
|
|
35
|
+
},
|
|
36
|
+
"repository": {
|
|
37
|
+
"type": "git",
|
|
38
|
+
"url": "git+https://github.com/CosmicDriftGameStudio/kumiko-framework.git",
|
|
39
|
+
"directory": "packages/document-designer"
|
|
40
|
+
},
|
|
41
|
+
"homepage": "https://kumiko.rocks",
|
|
42
|
+
"bugs": {
|
|
43
|
+
"url": "https://github.com/CosmicDriftGameStudio/kumiko-framework/issues"
|
|
44
|
+
},
|
|
45
|
+
"publishConfig": {
|
|
46
|
+
"registry": "https://registry.npmjs.org",
|
|
47
|
+
"access": "public",
|
|
48
|
+
"exports": {
|
|
49
|
+
".": {
|
|
50
|
+
"types": "./dist/index.d.ts",
|
|
51
|
+
"default": "./dist/index.js"
|
|
52
|
+
},
|
|
53
|
+
"./web": {
|
|
54
|
+
"types": "./dist/web/index.d.ts",
|
|
55
|
+
"default": "./dist/web/index.js"
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
"files": [
|
|
60
|
+
"dist",
|
|
61
|
+
"src/changes.json",
|
|
62
|
+
"README.md",
|
|
63
|
+
"LICENSE"
|
|
64
|
+
]
|
|
65
|
+
}
|
package/src/changes.json
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"version": "0.363.0",
|
|
4
|
+
"type": "improvement",
|
|
5
|
+
"title": "Mail templates open in a mail editor with preview and test mail",
|
|
6
|
+
"detail": "The \"Edit\" row action of a mail template opens the new mail-editor screen: subject, preview text and content with placeholders from the notification, logo and file attachments, PDF-template attachments, layout and category, sandboxed preview (HTML or text, desktop or 375 px), test mail to the signed-in user and the audit-based version list. PreviewRecordPickerProvider is an optional slot for a \"pick a record\" action in the preview."
|
|
7
|
+
},
|
|
8
|
+
{
|
|
9
|
+
"version": "0.363.0",
|
|
10
|
+
"type": "improvement",
|
|
11
|
+
"title": "Template overview, layout editor and an options object for documentDesignerClient",
|
|
12
|
+
"detail": "The package gains the server feature createDocumentDesignerFeature with the templates and platform-templates overviews and the layout-editor screen. documentDesignerClient now takes an options object instead of a screen id, and appLocales sets the languages column of the overview. The feature declares the pdf-template-editor screen (PDF_TEMPLATE_EDITOR_SCREEN_ID) and PDF rows open the PDF editor."
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
"version": "0.363.0",
|
|
16
|
+
"type": "improvement",
|
|
17
|
+
"title": "New package with the PDF template editor screen",
|
|
18
|
+
"detail": "\"@cosmicdrift/kumiko-document-designer/web\" exports documentDesignerClient(screenId), PdfTemplateEditorScreen, PdfTemplateEditor and documentDesignerTranslations. The screen takes the template from the URL (?slug=...&locale=...), edits the system template for a SystemAdmin and a tenant customisation for everyone else, and previews the printed PDF with pdf.js. template-resolver/web additionally exports DocumentEditorHandle, TemplateResolverQueries, TemplateResolverHandlers and TemplateResolverErrors."
|
|
19
|
+
}
|
|
20
|
+
]
|