From fd2c7d6b129dfada2b27e1b0e1bca8f2c518cd84 Mon Sep 17 00:00:00 2001 From: Matt Date: Thu, 14 May 2026 15:27:37 +0200 Subject: [PATCH] feat(send-dialog): surface per-port attachment threshold in preview UI MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Per PRE-DEPLOY-PLAN § 1.3.9. Adds an informational banner to the SendDocumentDialog explaining the size cutoff at which the attachment switches from inline to a 24h signed-link download. Threshold sourced from the existing `email_attach_threshold_mb` setting, plumbed through the previewBody return shape so rep-facing dialogs don't need to call the admin-only sales-config endpoint. Bounce monitoring deferred to land alongside the email_bounces table in Step 3 (schema additions). Co-Authored-By: Claude Opus 4.7 (1M context) --- src/components/shared/send-document-dialog.tsx | 17 ++++++++++++++++- src/lib/services/document-sends.service.ts | 18 ++++++++++++++++-- 2 files changed, 32 insertions(+), 3 deletions(-) diff --git a/src/components/shared/send-document-dialog.tsx b/src/components/shared/send-document-dialog.tsx index e689e1c0..8d7d3830 100644 --- a/src/components/shared/send-document-dialog.tsx +++ b/src/components/shared/send-document-dialog.tsx @@ -56,7 +56,12 @@ interface SendDocumentDialogProps { } interface PreviewResponse { - data: { html: string; markdown: string; unresolved: string[] }; + data: { + html: string; + markdown: string; + unresolved: string[]; + attachmentThresholdMb: number; + }; } export function SendDocumentDialog(props: SendDocumentDialogProps) { @@ -97,6 +102,9 @@ function SendDocumentDialogInner({ // Live preview via /api/v1/document-sends/preview. Re-runs whenever the // body text or recipient changes (debounce-by-react-query for free). + // The preview also surfaces the per-port attachment-size threshold so + // the rep can see up-front whether their attachment will go inline vs + // as a 24h download link. const previewQuery = useQuery({ queryKey: [ 'document-sends-preview', @@ -205,6 +213,13 @@ function SendDocumentDialogInner({

+ {previewQuery.data?.data.attachmentThresholdMb !== undefined && ( +

+ Files over {previewQuery.data.data.attachmentThresholdMb} MB are + sent as a 24-hour download link instead of an inline attachment. +

+ )} +