import { DELIVERY_CARRIERS as SHARED_DELIVERY_CARRIERS } from '@shared/constants/delivery-carrier' export const DELIVERY_CARRIER_CODES = SHARED_DELIVERY_CARRIERS as typeof SHARED_DELIVERY_CARRIERS export type DeliveryCarrierCode = (typeof DELIVERY_CARRIER_CODES)[number] export const DELIVERY_CARRIER_OPTIONS: ReadonlyArray<{ code: DeliveryCarrierCode; label: string }> = [ { code: 'RUSSIAN_POST', label: 'Почта России' }, { code: 'OZON_PVZ', label: 'Озон доставка (пункт выдачи)' }, { code: 'YANDEX_PVZ', label: 'Яндекс доставка (пункт выдачи)' }, { code: 'FIVE_POST', label: '5Post (пункт выдачи)' }, ] const carrierLabelMap: Record = Object.fromEntries( DELIVERY_CARRIER_OPTIONS.map((o) => [o.code, o.label]), ) as Record export function deliveryCarrierLabelRu(code: string | null | undefined): string | null { if (!code) return null return carrierLabelMap[code as DeliveryCarrierCode] ?? code }