@onereach/channel-transformer
Version:
Convert data model between different channels (Slack, Microsoft Teams, Generic...)
14 lines (10 loc) • 472 B
text/typescript
import { IGenericAttachments } from "../../../generic/types";
import { IZendeskContent } from "../../types";
const makeZendeskAttachment = (att) => ({
type: 'file',
mediaUrl: att.text
});
export const transformFileUpload = ({ props }: IGenericAttachments): Array<IZendeskContent> => {
const attachments = props?.value?.staticValue || props?.value?.filesValue;
return attachments.reduce((acc, att) => (acc.push(makeZendeskAttachment(att)), acc), []);
};