import type { DispatchPalletCandidateDto } from './api/dispatches' export type SmartDispatchWarehouseTab = 'ALL' | 'LAX' | 'NYC' export function matchesSmartDispatchWarehouseTab( candidate: Pick, tab: SmartDispatchWarehouseTab, ) { if (tab === 'ALL') return true const warehouse = [candidate.overseasWarehouseCode, candidate.overseasWarehouseName] .map((value) => String(value || '').trim().toLowerCase()) .filter(Boolean) .join(' ') if (tab === 'LAX') return /lax|洛杉矶|los angeles/.test(warehouse) return /nyc|jfk|(?:^|[^a-z])ny(?:[^a-z]|$)|纽约|new[ -]?york/.test(warehouse) }