export const DIRECTION_OPTIONS = [
|
{ id: 0, labelKey: 'page.integrationRecord.enums.direction.none' },
|
{ id: 1, labelKey: 'page.integrationRecord.enums.direction.inbound' },
|
{ id: 2, labelKey: 'page.integrationRecord.enums.direction.outbound' },
|
];
|
|
export const buildDirectionChoices = (translate) =>
|
DIRECTION_OPTIONS.map(option => ({
|
id: option.id,
|
name: translate(option.labelKey),
|
}));
|
|
export const getDirectionLabel = (translate, value) => {
|
if (value === null || value === undefined) {
|
return '';
|
}
|
const numericValue = typeof value === 'number' ? value : Number(value);
|
if (Number.isNaN(numericValue)) {
|
return '';
|
}
|
const option = DIRECTION_OPTIONS.find(opt => opt.id === numericValue);
|
if (!option) {
|
return '';
|
}
|
return translate(option.labelKey);
|
};
|