Attachment preview
This commit is contained in:
@@ -131,6 +131,51 @@ export type CampaignSendNowPayload = {
|
||||
enqueue_imap_task?: boolean;
|
||||
};
|
||||
|
||||
|
||||
export type CampaignAttachmentPreviewFile = {
|
||||
id: string;
|
||||
version_id?: string;
|
||||
blob_id?: string;
|
||||
display_path: string;
|
||||
filename: string;
|
||||
owner_type: string;
|
||||
owner_id: string;
|
||||
checksum_sha256?: string;
|
||||
size_bytes?: number;
|
||||
content_type?: string | null;
|
||||
};
|
||||
|
||||
export type CampaignAttachmentPreviewRule = {
|
||||
source: "global" | "entry";
|
||||
entry_index: number;
|
||||
entry_id?: string | null;
|
||||
index: number;
|
||||
attachment_id?: string | null;
|
||||
label?: string | null;
|
||||
required: boolean;
|
||||
pattern: string;
|
||||
base_path_name?: string | null;
|
||||
base_path?: string | null;
|
||||
status: "ok" | "missing" | "ambiguous";
|
||||
behavior?: string | null;
|
||||
matches: CampaignAttachmentPreviewFile[];
|
||||
match_count: number;
|
||||
issues: Record<string, unknown>[];
|
||||
};
|
||||
|
||||
export type CampaignAttachmentPreviewResponse = {
|
||||
campaign_id: string;
|
||||
version_id: string;
|
||||
shared_file_count: number;
|
||||
rules: CampaignAttachmentPreviewRule[];
|
||||
unused_shared_files: CampaignAttachmentPreviewFile[];
|
||||
};
|
||||
|
||||
export type CampaignAttachmentPreviewPayload = {
|
||||
include_unmatched?: boolean;
|
||||
campaign_json?: Record<string, unknown>;
|
||||
};
|
||||
|
||||
export type CampaignMockSendPayload = {
|
||||
version_id?: string | null;
|
||||
send?: boolean;
|
||||
@@ -309,6 +354,20 @@ export async function buildVersion(
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
export function previewCampaignAttachments(
|
||||
settings: ApiSettings,
|
||||
campaignId: string,
|
||||
versionId: string,
|
||||
payload: CampaignAttachmentPreviewPayload = {}
|
||||
): Promise<CampaignAttachmentPreviewResponse> {
|
||||
return apiFetch<CampaignAttachmentPreviewResponse>(
|
||||
settings,
|
||||
`/api/v1/campaigns/${campaignId}/versions/${versionId}/attachments/preview`,
|
||||
{ method: "POST", body: JSON.stringify(payload) }
|
||||
);
|
||||
}
|
||||
|
||||
export async function getCampaignSummary(settings: ApiSettings, campaignId: string): Promise<CampaignSummary> {
|
||||
return apiFetch<CampaignSummary>(settings, `/api/v1/campaigns/${campaignId}/summary`);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user