|
|
/** QuoteProvider 接口契约(PRD 附录 A / 技术设计 §7.1) */
|
|
|
|
|
|
export type ProviderAddress = {
|
|
|
street: string;
|
|
|
city: string;
|
|
|
state: string;
|
|
|
zip: string;
|
|
|
placeId: string;
|
|
|
formattedAddress: string;
|
|
|
selectedFromSuggestions: boolean;
|
|
|
mothershipOptionId: string;
|
|
|
mothershipDisplayLabel: string;
|
|
|
selectedFromMothership: boolean;
|
|
|
};
|
|
|
|
|
|
export type QuoteRequest = {
|
|
|
cargoHash: string;
|
|
|
/** 候选 API 返回的单会话 ID,复用 browser storageState */
|
|
|
quoteSessionId?: string;
|
|
|
pickup: ProviderAddress;
|
|
|
delivery: ProviderAddress;
|
|
|
weightLb: number;
|
|
|
dimsIn: { l: number; w: number; h: number };
|
|
|
palletCount: number;
|
|
|
cargoType: string;
|
|
|
/** MotherShip dashboard 登录态:附加服务 / 可提货时间 */
|
|
|
pickupAccessorials?: string[];
|
|
|
deliveryAccessorials?: string[];
|
|
|
readyDate?: string;
|
|
|
readyTime?: string;
|
|
|
cargoLines?: Array<{
|
|
|
cargoType: string;
|
|
|
quantity: number;
|
|
|
weightLb: number;
|
|
|
lengthIn: number;
|
|
|
widthIn: number;
|
|
|
heightIn: number;
|
|
|
}>;
|
|
|
mothershipDetails?: {
|
|
|
pickup?: {
|
|
|
company_name?: string;
|
|
|
suite?: string;
|
|
|
contact_first?: string;
|
|
|
contact_last?: string;
|
|
|
contact_email?: string;
|
|
|
contact_phone?: string;
|
|
|
reference?: string;
|
|
|
notes?: string;
|
|
|
opens_at?: string;
|
|
|
closes_at?: string;
|
|
|
};
|
|
|
delivery?: {
|
|
|
company_name?: string;
|
|
|
suite?: string;
|
|
|
contact_first?: string;
|
|
|
contact_last?: string;
|
|
|
contact_email?: string;
|
|
|
contact_phone?: string;
|
|
|
reference?: string;
|
|
|
notes?: string;
|
|
|
opens_at?: string;
|
|
|
closes_at?: string;
|
|
|
};
|
|
|
request_delivery_appointment?: boolean;
|
|
|
fba_number?: string;
|
|
|
fba_po_number?: string;
|
|
|
cargo?: Array<{
|
|
|
piece_count_type?: string;
|
|
|
piece_count_qty?: number;
|
|
|
description?: string;
|
|
|
nmfc?: string;
|
|
|
hazmat?: boolean;
|
|
|
alcohol?: boolean;
|
|
|
tobacco?: boolean;
|
|
|
}>;
|
|
|
};
|
|
|
/** 结账选价:承运商名子串,如 ABF / Roadrunner */
|
|
|
preferredCarrier?: string;
|
|
|
/** 保障方案 */
|
|
|
coverage?: "basic" | "freight_protect";
|
|
|
/** FreightProtect 货值(USD) */
|
|
|
cargoValueUsd?: number;
|
|
|
};
|
|
|
|
|
|
export type RateOptionKind = "lowest" | "fastest" | "bestValue" | (string & {});
|
|
|
|
|
|
export type QuoteItem = {
|
|
|
serviceLevel: string;
|
|
|
rateOption: RateOptionKind;
|
|
|
carrier: string;
|
|
|
transitDays: string;
|
|
|
transitDescription: string;
|
|
|
rawFreight: number;
|
|
|
surcharges: number;
|
|
|
rawTotal: number;
|
|
|
};
|
|
|
|
|
|
export type QuoteResult = {
|
|
|
/** 至少含核心 4 档;MotherShip 有 bestValue 等扩展档时一并返回 */
|
|
|
items: QuoteItem[];
|
|
|
sourceType: "rpa";
|
|
|
confidenceScore: number;
|
|
|
};
|
|
|
|
|
|
export interface QuoteProvider {
|
|
|
getQuote(req: QuoteRequest): Promise<QuoteResult>;
|
|
|
healthCheck(): Promise<boolean>;
|
|
|
}
|