deploy
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
export const DELIVERY_CARRIER_CODES = ['RUSSIAN_POST', 'OZON_PVZ', 'YANDEX_PVZ', 'FIVE_POST'] as const
|
||||
|
||||
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<DeliveryCarrierCode, string> = Object.fromEntries(
|
||||
DELIVERY_CARRIER_OPTIONS.map((o) => [o.code, o.label]),
|
||||
) as Record<DeliveryCarrierCode, string>
|
||||
|
||||
export function deliveryCarrierLabelRu(code: string | null | undefined): string | null {
|
||||
if (!code) return null
|
||||
return carrierLabelMap[code as DeliveryCarrierCode] ?? code
|
||||
}
|
||||
Reference in New Issue
Block a user