@cosmicdrift/kumiko-samples 0.414.0 → 0.416.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 +21 -1
- package/packages/bundled-features/src/agent-tools/changes.json +6 -0
- package/packages/bundled-features/src/agent-tools/tool-catalog.ts +20 -1
- package/packages/bundled-features/src/agent-tools/tool-dispatch.ts +19 -5
- package/packages/bundled-features/src/auth-email-password/signup-token-store.ts +2 -3
- package/packages/bundled-features/src/auth-email-password/web/session.tsx +2 -1
- package/packages/bundled-features/src/auth-mfa/changes.json +6 -0
- package/packages/bundled-features/src/billing-foundation/changes.json +24 -0
- package/packages/bundled-features/src/billing-foundation/checkout-core.ts +11 -0
- package/packages/bundled-features/src/billing-foundation/checkout-ledger.ts +8 -0
- package/packages/bundled-features/src/billing-foundation/events.ts +7 -5
- package/packages/bundled-features/src/billing-foundation/handlers/create-checkout-session.write.ts +2 -0
- package/packages/bundled-features/src/billing-foundation/handlers/process-event.write.ts +76 -24
- package/packages/bundled-features/src/billing-foundation/handlers/process-payment-event.write.ts +5 -4
- package/packages/bundled-features/src/billing-foundation/handlers/start-plan-checkout.write.ts +2 -0
- package/packages/bundled-features/src/billing-foundation/webhook-handler.ts +2 -2
- package/packages/bundled-features/src/channel-whatsapp/changes.json +30 -0
- package/packages/bundled-features/src/channel-whatsapp/constants.ts +1 -0
- package/packages/bundled-features/src/channel-whatsapp/events.ts +4 -3
- package/packages/bundled-features/src/channel-whatsapp/graph-client.ts +37 -1
- package/packages/bundled-features/src/channel-whatsapp/inbound-handlers.ts +23 -2
- package/packages/bundled-features/src/channel-whatsapp/webhook-normalize.ts +27 -6
- package/packages/bundled-features/src/compliance-profiles/changes.json +5 -0
- package/packages/bundled-features/src/compliance-profiles/handlers/set-profile.write.ts +2 -0
- package/packages/bundled-features/src/data-retention/feature.ts +1 -0
- package/packages/bundled-features/src/delivery/changes.json +6 -0
- package/packages/bundled-features/src/delivery/handlers/opted-in-user-ids.query.ts +12 -3
- package/packages/bundled-features/src/document-ingest-foundation/changes.json +6 -0
- package/packages/bundled-features/src/document-ingest-foundation/feature.ts +1 -0
- package/packages/bundled-features/src/document-ingest-foundation/report-ingest-progress.ts +3 -1
- package/packages/bundled-features/src/documents/changes.json +6 -0
- package/packages/bundled-features/src/documents/feature.ts +10 -5
- package/packages/bundled-features/src/form-draft/feature.ts +1 -0
- package/packages/bundled-features/src/handbook-knowledge/README.md +64 -0
- package/packages/bundled-features/src/handbook-knowledge/changes.json +8 -0
- package/packages/bundled-features/src/handbook-knowledge/constants.ts +8 -0
- package/packages/bundled-features/src/handbook-knowledge/feature.ts +34 -0
- package/packages/bundled-features/src/handbook-knowledge/handbook-index.ts +66 -0
- package/packages/bundled-features/src/handbook-knowledge/handlers.ts +77 -0
- package/packages/bundled-features/src/handbook-knowledge/index.ts +10 -0
- package/packages/bundled-features/src/helpdesk/changes.json +6 -0
- package/packages/bundled-features/src/helpdesk/feature.ts +1 -0
- package/packages/bundled-features/src/helpdesk/handlers/reply.write.ts +3 -3
- package/packages/bundled-features/src/helpdesk/handlers/report.write.ts +3 -2
- package/packages/bundled-features/src/helpdesk/handlers/submit.write.ts +3 -2
- package/packages/bundled-features/src/helpdesk/legacy-contact-streams.ts +3 -1
- package/packages/bundled-features/src/helpdesk/lib.ts +9 -4
- package/packages/bundled-features/src/inbound-mail-foundation/account-poll.ts +4 -1
- package/packages/bundled-features/src/inbound-mail-foundation/changes.json +6 -0
- package/packages/bundled-features/src/inbound-mail-foundation/content-refetch.ts +11 -4
- package/packages/bundled-features/src/inbound-mail-foundation/entities.ts +18 -9
- package/packages/bundled-features/src/inbound-mail-foundation/events.ts +18 -9
- package/packages/bundled-features/src/inbound-mail-foundation/handlers/connect-account.write.ts +2 -1
- package/packages/bundled-features/src/inbound-mail-foundation/handlers/forget-message.write.ts +6 -0
- package/packages/bundled-features/src/inbound-mail-foundation/handlers/ingest-message-schema.ts +18 -5
- package/packages/bundled-features/src/inbound-mail-foundation/normalize-inbound-message.ts +22 -8
- package/packages/bundled-features/src/inbound-mail-foundation/sanitize-inbound-html.ts +2 -5
- package/packages/bundled-features/src/managed-pages/web/page-edit-screen.tsx +11 -5
- package/packages/bundled-features/src/shared/changes.json +6 -0
- package/packages/bundled-features/src/shared/hmac-signature.ts +4 -2
- package/packages/bundled-features/src/shared/index.ts +2 -1
- package/packages/bundled-features/src/shared/normalize-email.ts +3 -0
- package/packages/bundled-features/src/shared/send-best-effort.ts +16 -6
- package/packages/bundled-features/src/signature/README.md +59 -0
- package/packages/bundled-features/src/signature/changes.json +15 -0
- package/packages/bundled-features/src/signature/entity.ts +192 -0
- package/packages/bundled-features/src/signature/feature.ts +125 -0
- package/packages/bundled-features/src/signature/files.ts +107 -0
- package/packages/bundled-features/src/signature/grant.ts +79 -0
- package/packages/bundled-features/src/signature/handlers/anonymous.write.ts +88 -0
- package/packages/bundled-features/src/signature/handlers/cancel.write.ts +40 -0
- package/packages/bundled-features/src/signature/handlers/issue-link.write.ts +72 -0
- package/packages/bundled-features/src/signature/handlers/lifecycle.write.ts +99 -0
- package/packages/bundled-features/src/signature/handlers/link-internal.write.ts +261 -0
- package/packages/bundled-features/src/signature/handlers/request.write.ts +86 -0
- package/packages/bundled-features/src/signature/handlers/revoke-link.write.ts +23 -0
- package/packages/bundled-features/src/signature/handlers/sign-in-person.write.ts +69 -0
- package/packages/bundled-features/src/signature/i18n.ts +52 -0
- package/packages/bundled-features/src/signature/index.ts +33 -0
- package/packages/bundled-features/src/signature/lib.ts +125 -0
- package/packages/bundled-features/src/signature/options.ts +49 -0
- package/packages/bundled-features/src/signature/payloads.ts +71 -0
- package/packages/bundled-features/src/signature/png.ts +169 -0
- package/packages/bundled-features/src/signature/screens.ts +115 -0
- package/packages/bundled-features/src/signature/signature-page.ts +93 -0
- package/packages/bundled-features/src/signature/signing.ts +77 -0
- package/packages/bundled-features/src/signature/static-sign.ts +98 -0
- package/packages/bundled-features/src/signature/sweep.ts +161 -0
- package/packages/bundled-features/src/signature/user-data.ts +159 -0
- package/packages/bundled-features/src/signature/web/constants.ts +92 -0
- package/packages/bundled-features/src/signature/web/index.ts +31 -0
- package/packages/bundled-features/src/signature/web/pad.ts +147 -0
- package/packages/bundled-features/src/signature/web/signature-pad.tsx +82 -0
- package/packages/bundled-features/src/step-dispatcher/changes.json +6 -0
- package/packages/bundled-features/src/step-dispatcher/deliver-dispatch-request.ts +5 -2
- package/packages/bundled-features/src/step-dispatcher/feature.ts +14 -0
- package/packages/bundled-features/src/step-dispatcher/sweep-abandoned.ts +4 -0
- package/packages/bundled-features/src/subscription-paddle/backfill-checkout-ledger.ts +2 -0
- package/packages/bundled-features/src/subscription-paddle/changes.json +6 -0
- package/packages/bundled-features/src/subscription-paddle/redeliver-legacy-checkout.ts +23 -2
- package/packages/bundled-features/src/subscription-stripe/changes.json +12 -0
- package/packages/bundled-features/src/subscription-stripe/feature.ts +9 -0
- package/packages/bundled-features/src/subscription-stripe/plugin-methods.ts +7 -1
- package/packages/bundled-features/src/subscription-stripe/verify-webhook.ts +19 -5
- package/packages/bundled-features/src/template-resolver/changes.json +12 -0
- package/packages/bundled-features/src/template-resolver/seeding.ts +37 -7
- package/packages/bundled-features/src/template-resolver/web/web-preview-renderer.tsx +7 -1
- package/packages/bundled-features/src/tenant-inactivity/changes.json +6 -0
- package/packages/bundled-features/src/tenant-inactivity/check-inactive-tenants.ts +34 -16
- package/packages/bundled-features/src/tenant-inactivity/handlers/keep-account.write.ts +6 -0
- package/packages/bundled-features/src/tenant-inactivity/state-store.ts +12 -1
- package/packages/bundled-features/src/tenant-lifecycle/changes.json +6 -0
- package/packages/bundled-features/src/tenant-lifecycle/feature.ts +1 -0
- package/packages/bundled-features/src/user/resolve-verified-user-email.ts +3 -3
- package/packages/bundled-features/src/user-data-rights/feature.ts +1 -0
- package/packages/bundled-features/src/waitlist/handlers/reject.write.ts +1 -1
- package/packages/bundled-features/src/waitlist/handlers/submit.write.ts +2 -2
- package/packages/bundled-features/src/waitlist/import.ts +2 -1
- package/packages/bundled-features/src/waitlist/lib.ts +1 -5
- package/packages/bundled-features/src/waitlist/link-on-signup.ts +2 -2
- package/packages/bundled-features/src/workflow-runner/changes.json +6 -0
- package/packages/bundled-features/src/workflow-runner/handlers/resume-run.write.ts +4 -2
- package/samples/apps/admin-console/src/app/shell.tsx +1 -0
- package/samples/apps/use-all-bundled/feature-manifest.json +63 -1
- package/samples/apps/use-all-bundled/kumiko/migrations/0068_signature.rebuild.json +4 -0
- package/samples/apps/use-all-bundled/src/run-config.ts +35 -1
- package/samples/recipes/crypto-shredding-hr/README.md +11 -0
- package/samples/recipes/crypto-shredding-hr/src/feature.ts +27 -0
- package/samples/recipes/embedded/README.md +4 -0
- package/samples/recipes/embedded/src/entities/invoice.ts +6 -0
- package/samples/recipes/embedded/src/feature.ts +7 -1
- package/samples/recipes/embedded/src/handlers/invoice-receive.write.ts +1 -0
- package/samples/recipes/embedded/src/screens/invoice-receive.screen.ts +2 -0
- package/samples/recipes/handbook-knowledge/README.md +22 -0
- package/samples/recipes/handbook-knowledge/package.json +12 -0
- package/samples/recipes/handbook-knowledge/src/feature.ts +42 -0
- package/samples/recipes/record-detail-layout/src/feature.ts +36 -5
- package/samples/recipes/record-detail-layout/src/order-board.ts +10 -2
- package/samples/recipes/signature/README.md +21 -0
- package/samples/recipes/signature/package.json +13 -0
- package/samples/recipes/signature/src/feature.ts +26 -0
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { isUuid, parseTenantId, type TenantId } from "@cosmicdrift/kumiko-framework/engine";
|
|
2
|
+
import type { Temporal } from "@cosmicdrift/kumiko-types/temporal";
|
|
3
|
+
import {
|
|
4
|
+
peekTokenSubject,
|
|
5
|
+
type RowBoundGrantResult,
|
|
6
|
+
redeemRowBoundGrant,
|
|
7
|
+
signRowBoundGrant,
|
|
8
|
+
} from "../shared/index.ts";
|
|
9
|
+
import { SIGNATURE_LINK_TTL_DAYS } from "./web/constants.ts";
|
|
10
|
+
|
|
11
|
+
type AnchorCommit = Parameters<typeof redeemRowBoundGrant>[0]["commitAnchor"];
|
|
12
|
+
|
|
13
|
+
const SIGNATURE_LINK_PURPOSE = "signature-link";
|
|
14
|
+
const MINUTES_PER_DAY = 24 * 60;
|
|
15
|
+
|
|
16
|
+
// Signers live in the tenant of the request, but the anonymous link holder arrives in the default
|
|
17
|
+
// tenant. The tenant therefore travels in the (signed) subject; "_" cannot appear in a UUID and the
|
|
18
|
+
// subject must stay free of ":" and ".".
|
|
19
|
+
export type SignatureLinkSubject = { readonly tenantId: TenantId; readonly signerId: string };
|
|
20
|
+
|
|
21
|
+
export function signatureLinkSubject(parts: {
|
|
22
|
+
readonly tenantId: string;
|
|
23
|
+
readonly signerId: string;
|
|
24
|
+
}): string {
|
|
25
|
+
return `${parts.tenantId}_${parts.signerId}`;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export function parseSignatureLinkSubject(subject: string): SignatureLinkSubject | null {
|
|
29
|
+
const [rawTenantId, signerId, ...rest] = subject.split("_");
|
|
30
|
+
const tenantId = parseTenantId(rawTenantId);
|
|
31
|
+
if (rest.length > 0 || tenantId === null || !isUuid(signerId)) return null;
|
|
32
|
+
return { tenantId, signerId };
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// Reads the unverified subject only to pick the tenant to dispatch into; the grant is still
|
|
36
|
+
// verified against the signer's current anchor there.
|
|
37
|
+
export function peekSignatureLinkSubject(token: string): SignatureLinkSubject | null {
|
|
38
|
+
const subject = peekTokenSubject(token);
|
|
39
|
+
return subject === null ? null : parseSignatureLinkSubject(subject);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export function signSignatureLinkToken(args: {
|
|
43
|
+
readonly tenantId: string;
|
|
44
|
+
readonly signerId: string;
|
|
45
|
+
readonly linkAnchor: string;
|
|
46
|
+
readonly secret: string;
|
|
47
|
+
readonly now: Temporal.Instant;
|
|
48
|
+
}): { readonly token: string; readonly expiresAt: Temporal.Instant } {
|
|
49
|
+
return signRowBoundGrant({
|
|
50
|
+
subject: signatureLinkSubject(args),
|
|
51
|
+
purpose: SIGNATURE_LINK_PURPOSE,
|
|
52
|
+
anchor: args.linkAnchor,
|
|
53
|
+
ttlMinutes: SIGNATURE_LINK_TTL_DAYS * MINUTES_PER_DAY,
|
|
54
|
+
secret: args.secret,
|
|
55
|
+
now: args.now,
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export function redeemSignatureLinkToken(args: {
|
|
60
|
+
readonly token: string;
|
|
61
|
+
readonly secret: string;
|
|
62
|
+
readonly now: Temporal.Instant;
|
|
63
|
+
readonly loadLinkAnchor: (signerId: string) => Promise<string | null>;
|
|
64
|
+
readonly commitAnchor: AnchorCommit;
|
|
65
|
+
}): Promise<RowBoundGrantResult> {
|
|
66
|
+
return redeemRowBoundGrant({
|
|
67
|
+
token: args.token,
|
|
68
|
+
purpose: SIGNATURE_LINK_PURPOSE,
|
|
69
|
+
secret: args.secret,
|
|
70
|
+
now: args.now,
|
|
71
|
+
commitAnchor: args.commitAnchor,
|
|
72
|
+
loadAnchor: (subject) => {
|
|
73
|
+
const parsed = parseSignatureLinkSubject(subject);
|
|
74
|
+
return parsed === null ? Promise.resolve(null) : args.loadLinkAnchor(parsed.signerId);
|
|
75
|
+
},
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export type { RowBoundGrantResult };
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createSystemUser,
|
|
3
|
+
defineWriteHandler,
|
|
4
|
+
type HandlerContext,
|
|
5
|
+
type WriteResult,
|
|
6
|
+
} from "@cosmicdrift/kumiko-framework/engine";
|
|
7
|
+
import type { RateLimitDeclaration } from "@cosmicdrift/kumiko-types/handlers";
|
|
8
|
+
import { peekSignatureLinkSubject } from "../grant.ts";
|
|
9
|
+
import { invalidLink } from "../lib.ts";
|
|
10
|
+
import { DeclineByLinkSchema, OpenByLinkSchema, SignByLinkSchema } from "../payloads.ts";
|
|
11
|
+
import { decodeSignatureImage, invalidImage } from "../signing.ts";
|
|
12
|
+
import { SignatureInternalHandlers } from "../web/constants.ts";
|
|
13
|
+
|
|
14
|
+
const TENANT_SWITCH_REASON =
|
|
15
|
+
"the link holder arrives anonymously in the default tenant while the signer lives in the request's tenant; the tenant comes from the signed link subject and the internal handler verifies the grant there via ctx.dispatch.writeAs";
|
|
16
|
+
|
|
17
|
+
// One answer for every rejection, so a caller cannot tell forged from expired, revoked, used up or already signed.
|
|
18
|
+
async function forwardIntoLinkTenant(
|
|
19
|
+
ctx: Pick<HandlerContext, "dispatch">,
|
|
20
|
+
token: string,
|
|
21
|
+
qn: string,
|
|
22
|
+
payload: unknown,
|
|
23
|
+
): Promise<WriteResult> {
|
|
24
|
+
const subject = peekSignatureLinkSubject(token);
|
|
25
|
+
if (subject === null) return invalidLink();
|
|
26
|
+
const result = await ctx.dispatch.writeAs(createSystemUser(subject.tenantId), qn, payload);
|
|
27
|
+
return result.isSuccess ? result : invalidLink();
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export function createAnonymousLinkHandlers(rateLimit: RateLimitDeclaration) {
|
|
31
|
+
const openByLink = defineWriteHandler({
|
|
32
|
+
name: "open-by-link",
|
|
33
|
+
schema: OpenByLinkSchema,
|
|
34
|
+
access: { roles: ["anonymous"], anySignedIn: true },
|
|
35
|
+
rateLimit,
|
|
36
|
+
escapeHatch: { grants: ["systemIdentity"], reason: TENANT_SWITCH_REASON },
|
|
37
|
+
agent: { expose: false },
|
|
38
|
+
description:
|
|
39
|
+
"Anonymous: opens a signing link and returns the title, the signer's name and role and a short-lived document URL. Does not consume the link, counts the view up to a limit.",
|
|
40
|
+
handler: (event, ctx) =>
|
|
41
|
+
forwardIntoLinkTenant(
|
|
42
|
+
ctx,
|
|
43
|
+
event.payload.token,
|
|
44
|
+
SignatureInternalHandlers.linkOpen,
|
|
45
|
+
event.payload,
|
|
46
|
+
),
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
const signByLink = defineWriteHandler({
|
|
50
|
+
name: "sign-by-link",
|
|
51
|
+
schema: SignByLinkSchema,
|
|
52
|
+
access: { roles: ["anonymous"], personalData: "public-intake", anySignedIn: true },
|
|
53
|
+
rateLimit,
|
|
54
|
+
escapeHatch: { grants: ["systemIdentity"], reason: TENANT_SWITCH_REASON },
|
|
55
|
+
agent: { expose: false },
|
|
56
|
+
description:
|
|
57
|
+
"Anonymous: signs through a link with a drawn PNG signature, exactly once; the link is consumed by the signature.",
|
|
58
|
+
handler: async (event, ctx) => {
|
|
59
|
+
if (decodeSignatureImage(event.payload.imagePngBase64) === null) return invalidImage();
|
|
60
|
+
return forwardIntoLinkTenant(
|
|
61
|
+
ctx,
|
|
62
|
+
event.payload.token,
|
|
63
|
+
SignatureInternalHandlers.linkSign,
|
|
64
|
+
event.payload,
|
|
65
|
+
);
|
|
66
|
+
},
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
const declineByLink = defineWriteHandler({
|
|
70
|
+
name: "decline-by-link",
|
|
71
|
+
schema: DeclineByLinkSchema,
|
|
72
|
+
access: { roles: ["anonymous"], personalData: "public-intake", anySignedIn: true },
|
|
73
|
+
rateLimit,
|
|
74
|
+
escapeHatch: { grants: ["systemIdentity"], reason: TENANT_SWITCH_REASON },
|
|
75
|
+
agent: { expose: false },
|
|
76
|
+
description:
|
|
77
|
+
"Anonymous: declines to sign through a link with an optional reason; the request becomes declined and every link of it stops working.",
|
|
78
|
+
handler: (event, ctx) =>
|
|
79
|
+
forwardIntoLinkTenant(
|
|
80
|
+
ctx,
|
|
81
|
+
event.payload.token,
|
|
82
|
+
SignatureInternalHandlers.linkDecline,
|
|
83
|
+
event.payload,
|
|
84
|
+
),
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
return { openByLink, signByLink, declineByLink };
|
|
88
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { type AccessRule, defineWriteHandler } from "@cosmicdrift/kumiko-framework/engine";
|
|
2
|
+
import { signerExecutor } from "../entity.ts";
|
|
3
|
+
import { isUnsignedSigner, listSigners, setRequestStatus } from "../lib.ts";
|
|
4
|
+
import { RequestIdSchema } from "../payloads.ts";
|
|
5
|
+
import { SIGNATURE_REQUEST_STATUS } from "../web/constants.ts";
|
|
6
|
+
|
|
7
|
+
// Cancelling moves the request out of `open`, which already makes every link of it fail; the
|
|
8
|
+
// anchors are cleared as well so no token verifies against a cancelled request.
|
|
9
|
+
export function createCancelHandler(access: AccessRule) {
|
|
10
|
+
return defineWriteHandler<"cancel", typeof RequestIdSchema, { readonly cancelled: true }>({
|
|
11
|
+
name: "cancel",
|
|
12
|
+
schema: RequestIdSchema,
|
|
13
|
+
access,
|
|
14
|
+
agent: { risk: "mid" },
|
|
15
|
+
description:
|
|
16
|
+
"Cancels an open signature request; all its signing links stop working. Signatures already given stay on record.",
|
|
17
|
+
handler: async (event, ctx) => {
|
|
18
|
+
const user = event.user;
|
|
19
|
+
const moved = await setRequestStatus(
|
|
20
|
+
ctx,
|
|
21
|
+
user,
|
|
22
|
+
event.payload.requestId,
|
|
23
|
+
SIGNATURE_REQUEST_STATUS.Open,
|
|
24
|
+
{ status: SIGNATURE_REQUEST_STATUS.Cancelled },
|
|
25
|
+
);
|
|
26
|
+
if (!moved.isSuccess) return moved;
|
|
27
|
+
for (const signer of await listSigners(ctx, user, event.payload.requestId)) {
|
|
28
|
+
if (!isUnsignedSigner(signer) || signer.linkAnchor == null) continue;
|
|
29
|
+
const cleared = await signerExecutor.update(
|
|
30
|
+
{ id: signer.id, changes: { linkAnchor: null } },
|
|
31
|
+
user,
|
|
32
|
+
ctx.db,
|
|
33
|
+
{ skipOptimisticLock: true },
|
|
34
|
+
);
|
|
35
|
+
if (!cleared.isSuccess) return cleared;
|
|
36
|
+
}
|
|
37
|
+
return { isSuccess: true, data: { cancelled: true } };
|
|
38
|
+
},
|
|
39
|
+
});
|
|
40
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { type AccessRule, defineWriteHandler } from "@cosmicdrift/kumiko-framework/engine";
|
|
2
|
+
import {
|
|
3
|
+
NotFoundError,
|
|
4
|
+
UnprocessableError,
|
|
5
|
+
writeFailure,
|
|
6
|
+
} from "@cosmicdrift/kumiko-framework/errors";
|
|
7
|
+
import { generateId } from "@cosmicdrift/kumiko-framework/utils";
|
|
8
|
+
import { signerExecutor } from "../entity.ts";
|
|
9
|
+
import { signSignatureLinkToken } from "../grant.ts";
|
|
10
|
+
import { isOpenRequest, isUnsignedSigner, loadRequestOfSigner } from "../lib.ts";
|
|
11
|
+
import type { SignatureOptions } from "../options.ts";
|
|
12
|
+
import { SignerIdSchema } from "../payloads.ts";
|
|
13
|
+
|
|
14
|
+
export type IssueLinkData = { readonly signerId: string; readonly linkSentAt: string };
|
|
15
|
+
|
|
16
|
+
// A new link replaces the previous one: the anchor moves on, so the old token stops verifying.
|
|
17
|
+
export function createIssueLinkHandler(
|
|
18
|
+
access: AccessRule,
|
|
19
|
+
opts: Pick<SignatureOptions, "linkSecret" | "deliverLink" | "signaturePageUrl">,
|
|
20
|
+
) {
|
|
21
|
+
return defineWriteHandler<"issue-link", typeof SignerIdSchema, IssueLinkData>({
|
|
22
|
+
name: "issue-link",
|
|
23
|
+
schema: SignerIdSchema,
|
|
24
|
+
access,
|
|
25
|
+
agent: { risk: "mid" },
|
|
26
|
+
description:
|
|
27
|
+
"Sends a signing link to one signer of an open request, to the signer's own address; the link is never part of the result. An earlier link of that signer stops working. The link is valid for 14 days and a limited number of opens.",
|
|
28
|
+
handler: async (event, ctx) => {
|
|
29
|
+
const user = event.user;
|
|
30
|
+
const signer = await signerExecutor.detail({ id: event.payload.signerId }, user, ctx.db);
|
|
31
|
+
if (signer === null) return writeFailure(new NotFoundError("signer", event.payload.signerId));
|
|
32
|
+
const request = await loadRequestOfSigner(ctx, user, signer);
|
|
33
|
+
const now = ctx.tz.now();
|
|
34
|
+
if (request === null || !isOpenRequest(request, now) || !isUnsignedSigner(signer)) {
|
|
35
|
+
return writeFailure(new UnprocessableError("link_not_possible"));
|
|
36
|
+
}
|
|
37
|
+
if (typeof signer.email !== "string" || signer.email === "") {
|
|
38
|
+
return writeFailure(new UnprocessableError("signer_without_email"));
|
|
39
|
+
}
|
|
40
|
+
const linkAnchor = generateId();
|
|
41
|
+
const updated = await signerExecutor.update(
|
|
42
|
+
{
|
|
43
|
+
id: signer.id,
|
|
44
|
+
changes: { linkAnchor, linkSentAt: now, viewCount: 0 },
|
|
45
|
+
},
|
|
46
|
+
user,
|
|
47
|
+
ctx.db,
|
|
48
|
+
{ skipOptimisticLock: true },
|
|
49
|
+
);
|
|
50
|
+
if (!updated.isSuccess) return updated;
|
|
51
|
+
const grant = signSignatureLinkToken({
|
|
52
|
+
tenantId: user.tenantId,
|
|
53
|
+
signerId: signer.id,
|
|
54
|
+
linkAnchor,
|
|
55
|
+
secret: opts.linkSecret,
|
|
56
|
+
now,
|
|
57
|
+
});
|
|
58
|
+
await opts.deliverLink(ctx, {
|
|
59
|
+
signerId: String(signer.id),
|
|
60
|
+
requestId: String(request.id),
|
|
61
|
+
name: signer.name,
|
|
62
|
+
email: signer.email,
|
|
63
|
+
url: `${opts.signaturePageUrl}#${grant.token}`,
|
|
64
|
+
issuedBy: user,
|
|
65
|
+
});
|
|
66
|
+
return {
|
|
67
|
+
isSuccess: true,
|
|
68
|
+
data: { signerId: String(signer.id), linkSentAt: now.toString() },
|
|
69
|
+
};
|
|
70
|
+
},
|
|
71
|
+
});
|
|
72
|
+
}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { defineWriteHandler } from "@cosmicdrift/kumiko-framework/engine";
|
|
2
|
+
import { requestExecutor } from "../entity.ts";
|
|
3
|
+
import {
|
|
4
|
+
advanceIfAllSigned,
|
|
5
|
+
appendOutcomeEvent,
|
|
6
|
+
internalAccess,
|
|
7
|
+
isPastInstant,
|
|
8
|
+
listSigners,
|
|
9
|
+
setRequestStatus,
|
|
10
|
+
} from "../lib.ts";
|
|
11
|
+
import { FinishSchema, RequestIdSchema } from "../payloads.ts";
|
|
12
|
+
import { SIGNATURE_REQUEST_STATUS, SignatureEvents } from "../web/constants.ts";
|
|
13
|
+
|
|
14
|
+
// The writes of the sweep job. They run as handlers because a job may only append its own
|
|
15
|
+
// events through ctx.events, and every transition here must also hold the "exactly once" precondition.
|
|
16
|
+
export const finishHandler = defineWriteHandler({
|
|
17
|
+
name: "finish",
|
|
18
|
+
schema: FinishSchema,
|
|
19
|
+
access: internalAccess,
|
|
20
|
+
agent: { expose: false },
|
|
21
|
+
description:
|
|
22
|
+
"Internal: marks an all-signed request completed with its final PDF and emits the completed event once.",
|
|
23
|
+
handler: async (event, ctx) => {
|
|
24
|
+
const request = await requestExecutor.detail(
|
|
25
|
+
{ id: event.payload.requestId },
|
|
26
|
+
event.user,
|
|
27
|
+
ctx.db,
|
|
28
|
+
);
|
|
29
|
+
if (request === null) return { isSuccess: true, data: { finished: false } };
|
|
30
|
+
const moved = await setRequestStatus(
|
|
31
|
+
ctx,
|
|
32
|
+
event.user,
|
|
33
|
+
request.id,
|
|
34
|
+
SIGNATURE_REQUEST_STATUS.AllSigned,
|
|
35
|
+
{
|
|
36
|
+
status: SIGNATURE_REQUEST_STATUS.Completed,
|
|
37
|
+
completedFileId: event.payload.completedFileId,
|
|
38
|
+
completedAt: ctx.tz.now(),
|
|
39
|
+
},
|
|
40
|
+
);
|
|
41
|
+
if (!moved.isSuccess) return { isSuccess: true, data: { finished: false } };
|
|
42
|
+
const signers = await listSigners(ctx, event.user, request.id);
|
|
43
|
+
await appendOutcomeEvent(ctx, SignatureEvents.completed, {
|
|
44
|
+
requestId: request.id,
|
|
45
|
+
subjectType: request.subjectType,
|
|
46
|
+
subjectId: request.subjectId,
|
|
47
|
+
completedFileId: event.payload.completedFileId,
|
|
48
|
+
signerCount: signers.length,
|
|
49
|
+
});
|
|
50
|
+
return { isSuccess: true, data: { finished: true } };
|
|
51
|
+
},
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
export const expireHandler = defineWriteHandler({
|
|
55
|
+
name: "expire",
|
|
56
|
+
schema: RequestIdSchema,
|
|
57
|
+
access: internalAccess,
|
|
58
|
+
agent: { expose: false },
|
|
59
|
+
description:
|
|
60
|
+
"Internal: expires an open request whose deadline has passed and emits the expired event once.",
|
|
61
|
+
handler: async (event, ctx) => {
|
|
62
|
+
const request = await requestExecutor.detail(
|
|
63
|
+
{ id: event.payload.requestId },
|
|
64
|
+
event.user,
|
|
65
|
+
ctx.db,
|
|
66
|
+
);
|
|
67
|
+
if (request === null || !isPastInstant(request.expiresAt, ctx.tz.now())) {
|
|
68
|
+
return { isSuccess: true, data: { expired: false } };
|
|
69
|
+
}
|
|
70
|
+
const moved = await setRequestStatus(
|
|
71
|
+
ctx,
|
|
72
|
+
event.user,
|
|
73
|
+
request.id,
|
|
74
|
+
SIGNATURE_REQUEST_STATUS.Open,
|
|
75
|
+
{ status: SIGNATURE_REQUEST_STATUS.Expired },
|
|
76
|
+
);
|
|
77
|
+
if (!moved.isSuccess) return { isSuccess: true, data: { expired: false } };
|
|
78
|
+
await appendOutcomeEvent(ctx, SignatureEvents.expired, {
|
|
79
|
+
requestId: request.id,
|
|
80
|
+
subjectType: request.subjectType,
|
|
81
|
+
subjectId: request.subjectId,
|
|
82
|
+
});
|
|
83
|
+
return { isSuccess: true, data: { expired: true } };
|
|
84
|
+
},
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
// Two last signers committing at the same moment can each still see the other as unsigned; the
|
|
88
|
+
// sweep repeats the check so such a request cannot stay open for good.
|
|
89
|
+
export const reconcileHandler = defineWriteHandler({
|
|
90
|
+
name: "reconcile",
|
|
91
|
+
schema: RequestIdSchema,
|
|
92
|
+
access: internalAccess,
|
|
93
|
+
agent: { expose: false },
|
|
94
|
+
description: "Internal: moves an open request whose signers have all signed to all-signed.",
|
|
95
|
+
handler: async (event, ctx) => ({
|
|
96
|
+
isSuccess: true,
|
|
97
|
+
data: { advanced: await advanceIfAllSigned(ctx, event.user, event.payload.requestId) },
|
|
98
|
+
}),
|
|
99
|
+
});
|
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
import {
|
|
2
|
+
defineWriteHandler,
|
|
3
|
+
type HandlerContext,
|
|
4
|
+
type SessionUser,
|
|
5
|
+
} from "@cosmicdrift/kumiko-framework/engine";
|
|
6
|
+
import type { Temporal } from "@cosmicdrift/kumiko-types/temporal";
|
|
7
|
+
import { signerExecutor } from "../entity.ts";
|
|
8
|
+
import { discardGeneratedFile, signedDocumentUrl } from "../files.ts";
|
|
9
|
+
import { parseSignatureLinkSubject, redeemSignatureLinkToken } from "../grant.ts";
|
|
10
|
+
import {
|
|
11
|
+
advanceIfAllSigned,
|
|
12
|
+
appendOutcomeEvent,
|
|
13
|
+
internalAccess,
|
|
14
|
+
invalidLink,
|
|
15
|
+
isOpenRequest,
|
|
16
|
+
isUnsignedSigner,
|
|
17
|
+
loadRequestOfSigner,
|
|
18
|
+
type RequestRow,
|
|
19
|
+
type SignerRow,
|
|
20
|
+
setRequestStatus,
|
|
21
|
+
} from "../lib.ts";
|
|
22
|
+
import { DeclineByLinkSchema, OpenByLinkSchema, SignByLinkSchema } from "../payloads.ts";
|
|
23
|
+
import {
|
|
24
|
+
auditValuesOfRequest,
|
|
25
|
+
decodeSignatureImage,
|
|
26
|
+
invalidImage,
|
|
27
|
+
signatureChanges,
|
|
28
|
+
storeSignatureImage,
|
|
29
|
+
} from "../signing.ts";
|
|
30
|
+
import {
|
|
31
|
+
SIGNATURE_MAX_LINK_OPENS,
|
|
32
|
+
SIGNATURE_METHOD,
|
|
33
|
+
SIGNATURE_REQUEST_STATUS,
|
|
34
|
+
SIGNATURE_SIGNER_STATUS,
|
|
35
|
+
SignatureEvents,
|
|
36
|
+
} from "../web/constants.ts";
|
|
37
|
+
|
|
38
|
+
export type LinkOpenData = {
|
|
39
|
+
readonly title: string;
|
|
40
|
+
readonly signerName: string;
|
|
41
|
+
readonly role: string | null;
|
|
42
|
+
readonly documentUrl: string | null;
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
type LinkTarget = { readonly signer: SignerRow; readonly request: RequestRow };
|
|
46
|
+
|
|
47
|
+
const NO_CONSUME_REASON =
|
|
48
|
+
"opening a link only shows the document and counts the view; signing and declining consume the link";
|
|
49
|
+
|
|
50
|
+
// Anchor of a signer whose link may still act: unsigned, request open, link not revoked.
|
|
51
|
+
async function loadLiveTarget(
|
|
52
|
+
ctx: Pick<HandlerContext, "db">,
|
|
53
|
+
user: SessionUser,
|
|
54
|
+
signerId: string,
|
|
55
|
+
now: Temporal.Instant,
|
|
56
|
+
): Promise<LinkTarget | null> {
|
|
57
|
+
const signer = await signerExecutor.detail({ id: signerId }, user, ctx.db);
|
|
58
|
+
if (signer === null || !isUnsignedSigner(signer) || typeof signer.linkAnchor !== "string") {
|
|
59
|
+
return null;
|
|
60
|
+
}
|
|
61
|
+
const request = await loadRequestOfSigner(ctx, user, signer);
|
|
62
|
+
return request !== null && isOpenRequest(request, now) ? { signer, request } : null;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
function viewCountOf(signer: SignerRow): number {
|
|
66
|
+
return typeof signer.viewCount === "number" ? signer.viewCount : 0;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
function viewChanges(signer: SignerRow, now: Temporal.Instant): Record<string, unknown> {
|
|
70
|
+
return {
|
|
71
|
+
viewCount: viewCountOf(signer) + 1,
|
|
72
|
+
viewedAt: now,
|
|
73
|
+
...(signer.status === SIGNATURE_SIGNER_STATUS.Pending && {
|
|
74
|
+
status: SIGNATURE_SIGNER_STATUS.Viewed,
|
|
75
|
+
}),
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export function createLinkInternalHandlers(linkSecret: string) {
|
|
80
|
+
const linkOpen = defineWriteHandler<"link-open", typeof OpenByLinkSchema, LinkOpenData>({
|
|
81
|
+
name: "link-open",
|
|
82
|
+
schema: OpenByLinkSchema,
|
|
83
|
+
access: internalAccess,
|
|
84
|
+
agent: { expose: false },
|
|
85
|
+
description:
|
|
86
|
+
"Internal: verifies a signing link inside the request's tenant, counts the view and returns what the signing page shows. Reached only through open-by-link.",
|
|
87
|
+
handler: async (event, ctx) => {
|
|
88
|
+
const user = event.user;
|
|
89
|
+
const now = ctx.tz.now();
|
|
90
|
+
const found: { target: LinkTarget | null } = { target: null };
|
|
91
|
+
const redeemed = await redeemSignatureLinkToken({
|
|
92
|
+
token: event.payload.token,
|
|
93
|
+
secret: linkSecret,
|
|
94
|
+
now,
|
|
95
|
+
loadLinkAnchor: async (signerId) => {
|
|
96
|
+
const target = await loadLiveTarget(ctx, user, signerId, now);
|
|
97
|
+
if (target === null || viewCountOf(target.signer) >= SIGNATURE_MAX_LINK_OPENS)
|
|
98
|
+
return null;
|
|
99
|
+
found.target = target;
|
|
100
|
+
return typeof target.signer.linkAnchor === "string" ? target.signer.linkAnchor : null;
|
|
101
|
+
},
|
|
102
|
+
commitAnchor: { unsafeSkip: { reason: NO_CONSUME_REASON } },
|
|
103
|
+
});
|
|
104
|
+
const target = found.target;
|
|
105
|
+
if (!redeemed.ok || target === null) return invalidLink();
|
|
106
|
+
|
|
107
|
+
// A concurrent sign must never be overwritten by the view count, and two simultaneous opens
|
|
108
|
+
// must not both pass the open limit, so status and view count are preconditions.
|
|
109
|
+
const counted = await signerExecutor.update(
|
|
110
|
+
{ id: target.signer.id, changes: viewChanges(target.signer, now) },
|
|
111
|
+
user,
|
|
112
|
+
ctx.db,
|
|
113
|
+
{
|
|
114
|
+
skipOptimisticLock: true,
|
|
115
|
+
expect: { status: target.signer.status, viewCount: viewCountOf(target.signer) },
|
|
116
|
+
},
|
|
117
|
+
);
|
|
118
|
+
if (!counted.isSuccess) return invalidLink();
|
|
119
|
+
return {
|
|
120
|
+
isSuccess: true,
|
|
121
|
+
data: {
|
|
122
|
+
title: target.request.title,
|
|
123
|
+
signerName: target.signer.name,
|
|
124
|
+
role: target.signer.role ?? null,
|
|
125
|
+
documentUrl: await signedDocumentUrl(ctx, user, target.request.documentFileId),
|
|
126
|
+
},
|
|
127
|
+
};
|
|
128
|
+
},
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
const linkSign = defineWriteHandler<
|
|
132
|
+
"link-sign",
|
|
133
|
+
typeof SignByLinkSchema,
|
|
134
|
+
{ readonly requestStatus: string }
|
|
135
|
+
>({
|
|
136
|
+
name: "link-sign",
|
|
137
|
+
schema: SignByLinkSchema,
|
|
138
|
+
access: internalAccess,
|
|
139
|
+
agent: { expose: false },
|
|
140
|
+
description:
|
|
141
|
+
"Internal: verifies a signing link inside the request's tenant and records the signature exactly once; of two simultaneous submits one wins. Reached only through sign-by-link.",
|
|
142
|
+
handler: async (event, ctx) => {
|
|
143
|
+
const user = event.user;
|
|
144
|
+
const now = ctx.tz.now();
|
|
145
|
+
const png = decodeSignatureImage(event.payload.imagePngBase64);
|
|
146
|
+
if (png === null) return invalidImage();
|
|
147
|
+
const found: { target: LinkTarget | null } = { target: null };
|
|
148
|
+
const redeemed = await redeemSignatureLinkToken({
|
|
149
|
+
token: event.payload.token,
|
|
150
|
+
secret: linkSecret,
|
|
151
|
+
now,
|
|
152
|
+
loadLinkAnchor: async (signerId) => {
|
|
153
|
+
found.target = await loadLiveTarget(ctx, user, signerId, now);
|
|
154
|
+
const anchor = found.target?.signer.linkAnchor;
|
|
155
|
+
return typeof anchor === "string" ? anchor : null;
|
|
156
|
+
},
|
|
157
|
+
// Spends the anchor and writes the signature in one conditional update, so exactly one of
|
|
158
|
+
// two simultaneous submits passes.
|
|
159
|
+
commitAnchor: async (subject, expectedAnchor) => {
|
|
160
|
+
const parsed = parseSignatureLinkSubject(subject);
|
|
161
|
+
if (parsed === null) return false;
|
|
162
|
+
const image = await storeSignatureImage(ctx, user, png);
|
|
163
|
+
if (!image.isSuccess) return false;
|
|
164
|
+
const signed = await signerExecutor.update(
|
|
165
|
+
{
|
|
166
|
+
id: parsed.signerId,
|
|
167
|
+
changes: signatureChanges({
|
|
168
|
+
method: SIGNATURE_METHOD.Link,
|
|
169
|
+
imageFileId: image.data.id,
|
|
170
|
+
signedAt: now,
|
|
171
|
+
}),
|
|
172
|
+
},
|
|
173
|
+
user,
|
|
174
|
+
ctx.db,
|
|
175
|
+
{ skipOptimisticLock: true, expect: { linkAnchor: expectedAnchor } },
|
|
176
|
+
);
|
|
177
|
+
if (!signed.isSuccess) await discardGeneratedFile(ctx, user, image.data);
|
|
178
|
+
return signed.isSuccess;
|
|
179
|
+
},
|
|
180
|
+
});
|
|
181
|
+
const target = found.target;
|
|
182
|
+
if (!redeemed.ok || target === null) return invalidLink();
|
|
183
|
+
const allSigned = await advanceIfAllSigned(ctx, user, target.request.id);
|
|
184
|
+
return {
|
|
185
|
+
isSuccess: true,
|
|
186
|
+
data: {
|
|
187
|
+
requestStatus: allSigned
|
|
188
|
+
? SIGNATURE_REQUEST_STATUS.AllSigned
|
|
189
|
+
: SIGNATURE_REQUEST_STATUS.Open,
|
|
190
|
+
},
|
|
191
|
+
};
|
|
192
|
+
},
|
|
193
|
+
});
|
|
194
|
+
|
|
195
|
+
const linkDecline = defineWriteHandler<
|
|
196
|
+
"link-decline",
|
|
197
|
+
typeof DeclineByLinkSchema,
|
|
198
|
+
{ readonly declined: true }
|
|
199
|
+
>({
|
|
200
|
+
name: "link-decline",
|
|
201
|
+
schema: DeclineByLinkSchema,
|
|
202
|
+
access: internalAccess,
|
|
203
|
+
agent: { expose: false },
|
|
204
|
+
description:
|
|
205
|
+
"Internal: verifies a signing link inside the request's tenant, records the refusal exactly once and moves the request to declined. Reached only through decline-by-link.",
|
|
206
|
+
handler: async (event, ctx) => {
|
|
207
|
+
const user = event.user;
|
|
208
|
+
const now = ctx.tz.now();
|
|
209
|
+
const found: { target: LinkTarget | null } = { target: null };
|
|
210
|
+
const redeemed = await redeemSignatureLinkToken({
|
|
211
|
+
token: event.payload.token,
|
|
212
|
+
secret: linkSecret,
|
|
213
|
+
now,
|
|
214
|
+
loadLinkAnchor: async (signerId) => {
|
|
215
|
+
found.target = await loadLiveTarget(ctx, user, signerId, now);
|
|
216
|
+
const anchor = found.target?.signer.linkAnchor;
|
|
217
|
+
return typeof anchor === "string" ? anchor : null;
|
|
218
|
+
},
|
|
219
|
+
commitAnchor: async (subject, expectedAnchor) => {
|
|
220
|
+
const parsed = parseSignatureLinkSubject(subject);
|
|
221
|
+
if (parsed === null) return false;
|
|
222
|
+
const declined = await signerExecutor.update(
|
|
223
|
+
{
|
|
224
|
+
id: parsed.signerId,
|
|
225
|
+
changes: {
|
|
226
|
+
status: SIGNATURE_SIGNER_STATUS.Declined,
|
|
227
|
+
linkAnchor: null,
|
|
228
|
+
...(event.payload.reason !== undefined && { declineReason: event.payload.reason }),
|
|
229
|
+
...auditValuesOfRequest(),
|
|
230
|
+
},
|
|
231
|
+
},
|
|
232
|
+
user,
|
|
233
|
+
ctx.db,
|
|
234
|
+
{ skipOptimisticLock: true, expect: { linkAnchor: expectedAnchor } },
|
|
235
|
+
);
|
|
236
|
+
return declined.isSuccess;
|
|
237
|
+
},
|
|
238
|
+
});
|
|
239
|
+
const target = found.target;
|
|
240
|
+
if (!redeemed.ok || target === null) return invalidLink();
|
|
241
|
+
const moved = await setRequestStatus(
|
|
242
|
+
ctx,
|
|
243
|
+
user,
|
|
244
|
+
target.request.id,
|
|
245
|
+
SIGNATURE_REQUEST_STATUS.Open,
|
|
246
|
+
{ status: SIGNATURE_REQUEST_STATUS.Declined },
|
|
247
|
+
);
|
|
248
|
+
if (moved.isSuccess) {
|
|
249
|
+
await appendOutcomeEvent(ctx, SignatureEvents.declined, {
|
|
250
|
+
requestId: target.request.id,
|
|
251
|
+
subjectType: target.request.subjectType,
|
|
252
|
+
subjectId: target.request.subjectId,
|
|
253
|
+
signerId: target.signer.id,
|
|
254
|
+
});
|
|
255
|
+
}
|
|
256
|
+
return { isSuccess: true, data: { declined: true } };
|
|
257
|
+
},
|
|
258
|
+
});
|
|
259
|
+
|
|
260
|
+
return { linkOpen, linkSign, linkDecline };
|
|
261
|
+
}
|