()
| 413 | const maxSupportChatPages = 10; |
| 414 | |
| 415 | export const getCompanySupportChats = async (): Promise< |
| 416 | CompanySupportChat[] |
| 417 | > => { |
| 418 | const chats: CompanySupportChat[] = []; |
| 419 | let after: string | undefined; |
| 420 | |
| 421 | for (let page = 0; page < maxSupportChatPages; page += 1) { |
| 422 | // eslint-disable-next-line no-await-in-loop |
| 423 | const res = await gqlClient.request<{ |
| 424 | companySupportChats: Connection<CompanySupportChat>; |
| 425 | }>(COMPANY_SUPPORT_CHATS_QUERY, { first: supportChatsPageSize, after }); |
| 426 | const { edges, pageInfo } = res.companySupportChats; |
| 427 | chats.push(...edges.map(({ node }) => node)); |
| 428 | |
| 429 | if (!pageInfo?.hasNextPage || !pageInfo.endCursor) { |
| 430 | break; |
| 431 | } |
| 432 | after = pageInfo.endCursor; |
| 433 | } |
| 434 | |
| 435 | return chats; |
| 436 | }; |
| 437 | |
| 438 | export const getCompanySupportChat = async ( |
| 439 | id: string, |
no test coverage detected