Skip to content

Commit

Permalink
fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
Hassan Wari authored and Hassan Wari committed Dec 17, 2024
1 parent a853b5e commit 617d189
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions integrations/gorgias/actions/create-ticket.ts
Original file line number Diff line number Diff line change
Expand Up @@ -170,12 +170,22 @@ async function checkSmsChannel(nango: NangoAction): Promise<'phone' | 'email'> {

for (const item of settingsItems) {
if (item.type === 'ticket-assignment') {
const ticketAssignmentData = item.data as TicketAssignmentData;
if (ticketAssignmentData.assignment_channels.includes('sms')) {
return 'phone';
if (isTicketAssignmentData(item.data)) {
if (item.data.assignment_channels.includes('sms')) {
return 'phone';
}
}
}
}

return 'email';
}

function isTicketAssignmentData(data: any): data is TicketAssignmentData {
return (
data &&
typeof data === 'object' &&
Array.isArray(data.assignment_channels) &&
data.assignment_channels.every((channel: any) => typeof channel === 'string')
);
}

0 comments on commit 617d189

Please sign in to comment.