Update hivegrid-cloud reference to latest main
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
e98d38e716
commit
7b21524c86
3781 files changed
+373484
-225607
No files matched your search
+52
@@ -0,0 +1,52 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
import { buildProjectSignaturePanelVM, signatureDocumentStatusKey, signatureProviderKey, signatureSignerStatusKey } from "../index.js";
|
||||
|
||||
const I18N_KEY = /^[a-z][a-z0-9]*(?:[.-][a-z0-9]+)*$/;
|
||||
|
||||
describe("buildProjectSignaturePanelVM", () => {
|
||||
it("keeps AK-P16d project signatures as a ready panel with i18n keys", () => {
|
||||
const vm = buildProjectSignaturePanelVM({
|
||||
canRead: true,
|
||||
canSend: true,
|
||||
canRevoke: false,
|
||||
canAdmin: false,
|
||||
rows: [
|
||||
{
|
||||
id: "doc-1",
|
||||
title: "Angebot 2026",
|
||||
provider: "ses_selfhosted",
|
||||
providerKey: signatureProviderKey("ses_selfhosted"),
|
||||
status: "sent",
|
||||
statusKey: signatureDocumentStatusKey("sent"),
|
||||
sourcePdfFileId: "file-1",
|
||||
signedPdfFileId: null,
|
||||
completionCertFileId: null,
|
||||
sentAtIso: "2026-07-01T10:00:00.000Z",
|
||||
completedAtIso: null,
|
||||
expiresAtIso: null,
|
||||
signers: [
|
||||
{
|
||||
id: "signer-1",
|
||||
signerName: "Erika Mustermann",
|
||||
signerEmail: "erika@example.test",
|
||||
signerRole: "kunde",
|
||||
status: "viewed",
|
||||
statusKey: signatureSignerStatusKey("viewed"),
|
||||
signedAtIso: null,
|
||||
lastReminderAtIso: null,
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
expect(vm.status).toBe("ready");
|
||||
if (vm.status !== "ready") throw new Error("expected ready");
|
||||
expect(vm.data.rows).toHaveLength(1);
|
||||
expect(vm.data.rows[0]?.statusKey).toMatch(I18N_KEY);
|
||||
expect(vm.data.rows[0]?.signers[0]?.statusKey).toMatch(I18N_KEY);
|
||||
expect(vm.data.createActionIntent).toBe("createSignatureDraft");
|
||||
expect(vm.data.designBlockedByKey).toMatch(I18N_KEY);
|
||||
});
|
||||
});
|
||||
+90
@@ -0,0 +1,90 @@
|
||||
import type { VMState } from "../index.js";
|
||||
|
||||
export type SignatureProvider = "ses_selfhosted" | "pandadoc_byok";
|
||||
export type SignatureDocumentStatus = "draft" | "sent" | "viewed" | "signed" | "declined" | "revoked" | "expired";
|
||||
export type SignatureSignerStatus = "draft" | "sent" | "viewed" | "otp_verified" | "signed" | "declined" | "revoked" | "expired";
|
||||
export type SignatureSignerRole = "kunde" | "bauherr" | "auftraggeber" | "rechnungsempfaenger" | "intern";
|
||||
|
||||
export interface ProjectSignatureSignerRow {
|
||||
readonly id: string;
|
||||
readonly signerName: string;
|
||||
readonly signerEmail: string;
|
||||
readonly signerRole: SignatureSignerRole;
|
||||
readonly status: SignatureSignerStatus;
|
||||
readonly statusKey: string;
|
||||
readonly signedAtIso: string | null;
|
||||
readonly lastReminderAtIso: string | null;
|
||||
}
|
||||
|
||||
export interface ProjectSignatureDocumentRow {
|
||||
readonly id: string;
|
||||
readonly title: string;
|
||||
readonly provider: SignatureProvider;
|
||||
readonly providerKey: string;
|
||||
readonly status: SignatureDocumentStatus;
|
||||
readonly statusKey: string;
|
||||
readonly sourcePdfFileId: string;
|
||||
readonly signedPdfFileId: string | null;
|
||||
readonly completionCertFileId: string | null;
|
||||
readonly sentAtIso: string | null;
|
||||
readonly completedAtIso: string | null;
|
||||
readonly expiresAtIso: string | null;
|
||||
readonly signers: readonly ProjectSignatureSignerRow[];
|
||||
}
|
||||
|
||||
export interface ProjectSignaturePanelData {
|
||||
readonly rows: readonly ProjectSignatureDocumentRow[];
|
||||
readonly canRead: boolean;
|
||||
readonly canSend: boolean;
|
||||
readonly canRevoke: boolean;
|
||||
readonly canAdmin: boolean;
|
||||
readonly createActionIntent: string;
|
||||
readonly sendActionIntent: string;
|
||||
readonly remindActionIntent: string;
|
||||
readonly revokeActionIntent: string;
|
||||
readonly emptyHeadlineKey: string;
|
||||
readonly emptyBodyKey: string;
|
||||
readonly designBlockedByKey: string;
|
||||
}
|
||||
|
||||
export type ProjectSignaturePanelVM = VMState<ProjectSignaturePanelData>;
|
||||
|
||||
export interface BuildProjectSignaturePanelVMInput {
|
||||
readonly rows: readonly ProjectSignatureDocumentRow[];
|
||||
readonly canRead: boolean;
|
||||
readonly canSend: boolean;
|
||||
readonly canRevoke: boolean;
|
||||
readonly canAdmin: boolean;
|
||||
}
|
||||
|
||||
export function buildProjectSignaturePanelVM(input: BuildProjectSignaturePanelVMInput): ProjectSignaturePanelVM {
|
||||
return {
|
||||
status: "ready",
|
||||
data: {
|
||||
rows: input.rows,
|
||||
canRead: input.canRead,
|
||||
canSend: input.canSend,
|
||||
canRevoke: input.canRevoke,
|
||||
canAdmin: input.canAdmin,
|
||||
createActionIntent: "createSignatureDraft",
|
||||
sendActionIntent: "sendSignatureDocument",
|
||||
remindActionIntent: "remindSignatureSigner",
|
||||
revokeActionIntent: "revokeSignatureDocument",
|
||||
emptyHeadlineKey: "signature.project.empty.headline",
|
||||
emptyBodyKey: "signature.project.empty.body",
|
||||
designBlockedByKey: "signature.project.designblockedby",
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
export function signatureDocumentStatusKey(status: SignatureDocumentStatus): string {
|
||||
return `signature.status.document.${status}`;
|
||||
}
|
||||
|
||||
export function signatureSignerStatusKey(status: SignatureSignerStatus): string {
|
||||
return `signature.status.signer.${status}`;
|
||||
}
|
||||
|
||||
export function signatureProviderKey(provider: SignatureProvider): string {
|
||||
return `signature.provider.${provider}`;
|
||||
}
|
||||
Reference in new issue
Block a user