feat(campaign-ui): add explicit job retry controls
This commit is contained in:
@@ -313,6 +313,8 @@ export type CampaignAttachmentPreviewFile = {
|
||||
checksum_sha256?: string;
|
||||
size_bytes?: number;
|
||||
content_type?: string | null;
|
||||
linked_to_campaign?: boolean;
|
||||
share?: Record<string, unknown> | null;
|
||||
};
|
||||
|
||||
export type CampaignAttachmentPreviewRule = {
|
||||
@@ -334,6 +336,8 @@ export type CampaignAttachmentPreviewRule = {
|
||||
zip_filename?: string | null;
|
||||
matches: CampaignAttachmentPreviewFile[];
|
||||
match_count: number;
|
||||
linked_match_count?: number;
|
||||
unlinked_match_count?: number;
|
||||
issues: Record<string, unknown>[];
|
||||
};
|
||||
|
||||
@@ -341,15 +345,37 @@ export type CampaignAttachmentPreviewResponse = {
|
||||
campaign_id: string;
|
||||
version_id: string;
|
||||
shared_file_count: number;
|
||||
candidate_file_count?: number;
|
||||
matched_file_count?: number;
|
||||
linked_file_count?: number;
|
||||
unlinked_file_count?: number;
|
||||
rules: CampaignAttachmentPreviewRule[];
|
||||
linkable_files?: CampaignAttachmentPreviewFile[];
|
||||
unused_shared_files: CampaignAttachmentPreviewFile[];
|
||||
};
|
||||
|
||||
export type CampaignAttachmentPreviewPayload = {
|
||||
include_unmatched?: boolean;
|
||||
include_unlinked_candidates?: boolean;
|
||||
campaign_json?: Record<string, unknown>;
|
||||
};
|
||||
|
||||
export type CampaignAttachmentLinkMatchesPayload = {
|
||||
campaign_json?: Record<string, unknown> | null;
|
||||
dry_run?: boolean;
|
||||
};
|
||||
|
||||
export type CampaignAttachmentLinkMatchesResponse = {
|
||||
campaign_id: string;
|
||||
version_id: string;
|
||||
matched_file_count: number;
|
||||
already_linked_file_count: number;
|
||||
linked_file_count: number;
|
||||
dry_run?: boolean;
|
||||
linked_files: CampaignAttachmentPreviewFile[];
|
||||
linkable_files: CampaignAttachmentPreviewFile[];
|
||||
};
|
||||
|
||||
export type CampaignMockSendPayload = {
|
||||
version_id?: string | null;
|
||||
send?: boolean;
|
||||
@@ -365,6 +391,13 @@ export type CampaignReviewStatePayload = {
|
||||
reviewed_message_keys: string[];
|
||||
};
|
||||
|
||||
export type CampaignSendJobPayload = {
|
||||
include_warnings?: boolean;
|
||||
dry_run?: boolean;
|
||||
use_rate_limit?: boolean;
|
||||
enqueue_imap_task?: boolean;
|
||||
};
|
||||
|
||||
|
||||
export type CampaignJobsQuery = {
|
||||
versionId?: string;
|
||||
@@ -702,11 +735,12 @@ versionId: string)
|
||||
export async function validateVersion(
|
||||
settings: ApiSettings,
|
||||
versionId: string,
|
||||
checkFiles = false)
|
||||
checkFiles = false,
|
||||
linkUnsharedMatches = false)
|
||||
: Promise<Record<string, unknown>> {
|
||||
return apiFetch<Record<string, unknown>>(settings, `/api/v1/campaigns/versions/${versionId}/validate`, {
|
||||
method: "POST",
|
||||
body: JSON.stringify({ check_files: checkFiles })
|
||||
body: JSON.stringify({ check_files: checkFiles, link_unshared_matches: linkUnsharedMatches })
|
||||
});
|
||||
}
|
||||
|
||||
@@ -735,6 +769,19 @@ payload: CampaignAttachmentPreviewPayload = {})
|
||||
);
|
||||
}
|
||||
|
||||
export function linkCampaignAttachmentMatches(
|
||||
settings: ApiSettings,
|
||||
campaignId: string,
|
||||
versionId: string,
|
||||
payload: CampaignAttachmentLinkMatchesPayload = {})
|
||||
: Promise<CampaignAttachmentLinkMatchesResponse> {
|
||||
return apiFetch<CampaignAttachmentLinkMatchesResponse>(
|
||||
settings,
|
||||
`/api/v1/campaigns/${campaignId}/versions/${versionId}/attachments/link-matches`,
|
||||
{ method: "POST", body: JSON.stringify(payload) }
|
||||
);
|
||||
}
|
||||
|
||||
export async function getCampaignSummary(
|
||||
settings: ApiSettings,
|
||||
campaignId: string,
|
||||
@@ -846,6 +893,18 @@ payload: Record<string, unknown> = {})
|
||||
});
|
||||
}
|
||||
|
||||
export async function sendCampaignJob(
|
||||
settings: ApiSettings,
|
||||
campaignId: string,
|
||||
jobId: string,
|
||||
payload: CampaignSendJobPayload = {})
|
||||
: Promise<Record<string, unknown>> {
|
||||
return apiFetch<Record<string, unknown>>(settings, `/api/v1/campaigns/${campaignId}/jobs/${jobId}/send`, {
|
||||
method: "POST",
|
||||
body: JSON.stringify(payload)
|
||||
});
|
||||
}
|
||||
|
||||
export async function resolveCampaignJobOutcome(
|
||||
settings: ApiSettings,
|
||||
campaignId: string,
|
||||
|
||||
Reference in New Issue
Block a user