@burdenoff/microfe-channel 2026.519.1 → 2026.520.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. package/dist/channel/ChannelRoot.d.ts.map +1 -1
  2. package/dist/channel/ChannelRoot.js +23 -29
  3. package/dist/channel/ChannelRoot.js.map +1 -1
  4. package/dist/channel/components/AdapterCredentialsForm.js +7 -7
  5. package/dist/channel/components/AdapterCredentialsForm.js.map +1 -1
  6. package/dist/channel/components/FeatureNotEnabled.d.ts +3 -0
  7. package/dist/channel/components/FeatureNotEnabled.d.ts.map +1 -1
  8. package/dist/channel/components/FeatureNotEnabled.js +31 -13
  9. package/dist/channel/components/FeatureNotEnabled.js.map +1 -1
  10. package/dist/channel/hooks/useChannels.d.ts +17 -3
  11. package/dist/channel/hooks/useChannels.d.ts.map +1 -1
  12. package/dist/channel/hooks/useChannels.js +64 -18
  13. package/dist/channel/hooks/useChannels.js.map +1 -1
  14. package/dist/channel/modules/channels/pages/ChannelDashboardPage.d.ts.map +1 -1
  15. package/dist/channel/modules/channels/pages/ChannelDashboardPage.js +307 -274
  16. package/dist/channel/modules/channels/pages/ChannelDashboardPage.js.map +1 -1
  17. package/dist/channel/modules/channels/pages/ChannelDetailsPage.d.ts.map +1 -1
  18. package/dist/channel/modules/channels/pages/ChannelDetailsPage.js +31 -31
  19. package/dist/channel/modules/channels/pages/ChannelDetailsPage.js.map +1 -1
  20. package/dist/channel/modules/channels/pages/ChannelSettingsPage.d.ts.map +1 -1
  21. package/dist/channel/modules/channels/pages/ChannelSettingsPage.js +22 -22
  22. package/dist/channel/modules/channels/pages/ChannelSettingsPage.js.map +1 -1
  23. package/dist/channel/modules/channels/pages/ChannelUsersPage.d.ts.map +1 -1
  24. package/dist/channel/modules/channels/pages/ChannelUsersPage.js +193 -137
  25. package/dist/channel/modules/channels/pages/ChannelUsersPage.js.map +1 -1
  26. package/dist/channel/modules/channels/pages/ChannelsListPage.d.ts.map +1 -1
  27. package/dist/channel/modules/channels/pages/ChannelsListPage.js +320 -248
  28. package/dist/channel/modules/channels/pages/ChannelsListPage.js.map +1 -1
  29. package/dist/channel/modules/channels/pages/ConnectionDetailsPage.d.ts.map +1 -1
  30. package/dist/channel/modules/channels/pages/ConnectionDetailsPage.js +5 -5
  31. package/dist/channel/modules/channels/pages/ConnectionDetailsPage.js.map +1 -1
  32. package/dist/channel/modules/channels/pages/ConnectionsListPage.d.ts.map +1 -1
  33. package/dist/channel/modules/channels/pages/ConnectionsListPage.js +160 -112
  34. package/dist/channel/modules/channels/pages/ConnectionsListPage.js.map +1 -1
  35. package/dist/channel/modules/channels/pages/CreateChannelPage.js +4 -4
  36. package/dist/channel/modules/channels/pages/CreateChannelPage.js.map +1 -1
  37. package/dist/channel/modules/channels/pages/DeliveryHistoryPage.d.ts.map +1 -1
  38. package/dist/channel/modules/channels/pages/DeliveryHistoryPage.js +221 -157
  39. package/dist/channel/modules/channels/pages/DeliveryHistoryPage.js.map +1 -1
  40. package/dist/channel/modules/channels/pages/EditChannelPage.js +9 -9
  41. package/dist/channel/modules/channels/pages/EditChannelPage.js.map +1 -1
  42. package/dist/channel/modules/channels/pages/SendMessagePage.d.ts.map +1 -1
  43. package/dist/channel/modules/channels/pages/SendMessagePage.js +89 -89
  44. package/dist/channel/modules/channels/pages/SendMessagePage.js.map +1 -1
  45. package/dist/channel/modules/channels/pages/WebhookEventsPage.d.ts.map +1 -1
  46. package/dist/channel/modules/channels/pages/WebhookEventsPage.js +188 -126
  47. package/dist/channel/modules/channels/pages/WebhookEventsPage.js.map +1 -1
  48. package/dist/generated/global-operations.d.ts +2 -0
  49. package/dist/generated/global-operations.d.ts.map +1 -1
  50. package/dist/generated/global-operations.js +2 -0
  51. package/dist/generated/global-operations.js.map +1 -1
  52. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"useChannels.js","names":[],"sources":["../../../src/channel/hooks/useChannels.ts"],"sourcesContent":["/**\n * Channel Hooks\n * GraphQL queries and mutations for channel management\n *\n * All types are derived from codegen-generated types (src/generated/global-types.ts)\n * and operation result types (src/generated/global-operations.ts).\n */\n\nimport { useState, useCallback, useEffect } from 'react';\nimport { getGlobalChannelClient } from '../graphql/global-client';\nimport { useChannel as useChannelContext } from '../providers/ChannelProvider';\nimport { emitShellEvent, reportShellError } from '../utils/shellBridge';\nimport {\n GetChannelsDocument,\n GetChannelDocument,\n CreateChannelDocument,\n UpdateChannelDocument,\n DeleteChannelDocument,\n ActivateChannelDocument,\n DeactivateChannelDocument,\n RunChannelHealthCheckDocument,\n CreateConnectionDocument,\n UpdateConnectionDocument,\n DeleteConnectionDocument,\n TestConnectionHealthDocument,\n DeliverNotificationDocument,\n GetDeliveryAttemptsDocument,\n GetWebhookEventsDocument,\n GetUserPlatformConnectionsDocument,\n RetryDeliveryDocument,\n GetDeliveryStatsDocument,\n type GetChannelsQuery,\n type GetChannelQuery,\n type CreateChannelMutation,\n type UpdateChannelMutation,\n type RunChannelHealthCheckMutation,\n type CreateConnectionMutation,\n type UpdateConnectionMutation,\n type TestConnectionHealthMutation,\n type DeliverNotificationMutation,\n type GetDeliveryAttemptsQuery,\n type GetWebhookEventsQuery,\n type GetUserPlatformConnectionsQuery,\n type RetryDeliveryMutation,\n type GetDeliveryStatsQuery,\n} from '../../generated/global-operations';\n\n/** Forward an operational error to the shell SRE sink. */\nfunction report(error: unknown, action: string, context: Record<string, unknown> = {}) {\n reportShellError(error, { module: 'channel', context: { action, ...context } });\n}\n\n// ============================================================================\n// TYPES — derived from codegen, exposed as string unions for convenience.\n//\n// Codegen generates TypeScript enums (e.g., ChannelPlatform.Email = 'EMAIL').\n// Pages/components use string literals ('EMAIL', 'ACTIVE', etc.) which are\n// not directly assignable to TS enums. We re-export the underlying string\n// union types so consumers can use plain strings without casting.\n// ============================================================================\n\nimport type {\n ChannelPlatform as _ChannelPlatform,\n ChannelStatus as _ChannelStatus,\n ChannelAuthType as _ChannelAuthType,\n ConnectionHealth as _ConnectionHealth,\n AdapterType as _AdapterType,\n DeliveryPriority as _DeliveryPriority,\n DeliveryStatus as _DeliveryStatus,\n ChannelFilterInput as _ChannelFilterInput,\n CreateChannelInput as _CreateChannelInput,\n UpdateChannelInput as _UpdateChannelInput,\n CreateConnectionInput as _CreateConnectionInput,\n UpdateConnectionInput as _UpdateConnectionInput,\n ChannelHealthCheck as _ChannelHealthCheck,\n ConnectionTestResult as _ConnectionTestResult,\n ChannelDeliveryResult as _ChannelDeliveryResult,\n ChannelDeliveryError as _ChannelDeliveryError,\n ChannelDeliveryContentInput as _ChannelDeliveryContentInput,\n ChannelDeliveryInput as _ChannelDeliveryInput,\n BulkChannelDeliveryResult as _BulkChannelDeliveryResult,\n UserPresenceStatus as _UserPresenceStatus,\n PairingStatus as _PairingStatus,\n WebhookProcessingStatus as _WebhookProcessingStatus,\n} from '../../generated/global-types';\n\n// ── Enum-like string unions (backward-compatible with string literal usage) ──\n\n/** Communication platform — extends generated enum with values pending backend schema update */\nexport type ChannelPlatform = `${_ChannelPlatform}` | 'INAPP';\n/** Channel lifecycle status */\nexport type ChannelStatus = `${_ChannelStatus}`;\n/** Authentication method for connections */\nexport type ChannelAuthType = `${_ChannelAuthType}`;\n/** Connection health status */\nexport type ConnectionHealth = `${_ConnectionHealth}`;\n/** Specific adapter/provider type — extends generated enum with values pending backend schema update */\nexport type AdapterType =\n | `${_AdapterType}`\n | 'INAPP_NATIVE'\n | 'NOVU'\n | 'KNOCKLABS'\n | 'SENDGRID'\n | 'MAILGUN'\n | 'POSTMARK'\n | 'MANDRILL'\n | 'RESEND'\n | 'SMTP'\n | 'VONAGE'\n | 'PLIVO'\n | 'MESSAGEBIRD'\n | 'INFOBIP'\n | 'APNS'\n | 'ONESIGNAL'\n | 'EXPO'\n | 'WEBCHAT_NATIVE'\n | 'SLACK_WEBHOOK'\n | 'TEAMS_WEBHOOK'\n | 'DISCORD_WEBHOOK';\n/** Delivery priority level */\nexport type DeliveryPriority = `${_DeliveryPriority}`;\n/** Message delivery status */\nexport type DeliveryStatus = `${_DeliveryStatus}`;\n/** User presence status on a platform */\nexport type UserPresenceStatus = `${_UserPresenceStatus}`;\n/** Pairing status for Bundle-2 flow */\nexport type PairingStatus = `${_PairingStatus}`;\n/** Webhook event processing status */\nexport type WebhookProcessingStatus = `${_WebhookProcessingStatus}`;\n\n// ── Utility: recursively unwrap codegen enums to string unions ──────────────\n// Codegen generates TS enums that are not assignable from string literals.\n// This mapped type converts `ChannelPlatform` (enum) → `'EMAIL' | 'SMS' | ...`\n// at every nested level of a type, making all Input/Result types compatible\n// with plain string usage.\n\ntype EnumToString<T> = [T] extends [null]\n ? null\n : T extends null | undefined\n ? EnumToString<NonNullable<T>> | Extract<T, null | undefined>\n : T extends _ChannelPlatform\n ? ChannelPlatform\n : T extends _ChannelStatus\n ? ChannelStatus\n : T extends _ChannelAuthType\n ? ChannelAuthType\n : T extends _ConnectionHealth\n ? ConnectionHealth\n : T extends _AdapterType\n ? AdapterType\n : T extends _DeliveryPriority\n ? DeliveryPriority\n : T extends _DeliveryStatus\n ? DeliveryStatus\n : T extends _UserPresenceStatus\n ? UserPresenceStatus\n : T extends _PairingStatus\n ? PairingStatus\n : T extends _WebhookProcessingStatus\n ? WebhookProcessingStatus\n : T extends Array<infer U>\n ? Array<EnumToString<U>>\n : T extends object\n ? { [K in keyof T]: EnumToString<T[K]> }\n : T;\n\n// ── Input types (used by mutations) ─────────────────────────────────────────\n\nexport type CreateChannelInput = EnumToString<_CreateChannelInput>;\nexport type UpdateChannelInput = EnumToString<_UpdateChannelInput>;\nexport type CreateConnectionInput = EnumToString<_CreateConnectionInput>;\nexport type UpdateConnectionInput = EnumToString<_UpdateConnectionInput>;\nexport type ChannelFilterInput = EnumToString<_ChannelFilterInput>;\nexport type ChannelDeliveryContentInput = EnumToString<_ChannelDeliveryContentInput>;\nexport type ChannelDeliveryInput = EnumToString<_ChannelDeliveryInput>;\nexport type {\n ChannelPaginationInput,\n ChannelDeliveryOptionsInput,\n ChannelRetryPolicyInput,\n BulkChannelDeliveryInput,\n} from '../../generated/global-types';\n\n// ── Schema result types ─────────────────────────────────────────────────────\n\nexport type ChannelHealthCheck = EnumToString<_ChannelHealthCheck>;\nexport type ConnectionTestResult = EnumToString<_ConnectionTestResult>;\nexport type ChannelDeliveryResult = EnumToString<_ChannelDeliveryResult>;\nexport type ChannelDeliveryError = EnumToString<_ChannelDeliveryError>;\nexport type BulkChannelDeliveryResult = EnumToString<_BulkChannelDeliveryResult>;\n\n// ── Derived types from query results ──────────────────────────────────────\n// These represent the actual shape of data returned by our GraphQL operations,\n// not the full schema types (which include __typename, nested relations, etc.)\n\n/** Channel as returned by GetChannels query (list item) */\nexport type Channel = NonNullable<GetChannelsQuery['getChannels']['items'][number]>;\n\n/** Channel as returned by GetChannel query (full detail) */\nexport type ChannelDetail = NonNullable<GetChannelQuery['getChannel']>;\n\n/** ChannelConnection from the GetChannel query (full connection detail) */\nexport type ChannelConnection = NonNullable<ChannelDetail['connection']>;\n\n/** ChannelList response shape */\nexport type ChannelList = GetChannelsQuery['getChannels'];\n\n/** Message delivery attempt as returned by GetDeliveryAttempts query */\nexport type DeliveryAttempt = NonNullable<\n GetDeliveryAttemptsQuery['getChannelDeliveryAttempts']['items'][number]\n>;\n\n/** Webhook event as returned by GetWebhookEvents query */\nexport type WebhookEvent = NonNullable<\n GetWebhookEventsQuery['getChannelWebhookEvents']['items'][number]\n>;\n\n/** User platform connection as returned by GetUserPlatformConnections query */\nexport type UserPlatformConnection = NonNullable<\n GetUserPlatformConnectionsQuery['listUserPlatformConnectionsByChannel']['items'][number]\n>;\n\n/** Delivery statistics as returned by GetDeliveryStats query */\nexport type DeliveryStats = NonNullable<GetDeliveryStatsQuery['getDeliveryStats']>;\n\n// ============================================================================\n// HOOKS\n// ============================================================================\n\n/**\n * Hook for managing channels list\n */\nexport function useChannels(initialFilter?: ChannelFilterInput) {\n const { authToken, apiGatewayUrl, organizationId } = useChannelContext();\n const [channels, setChannels] = useState<Channel[]>([]);\n const [isLoading, setIsLoading] = useState(true);\n const [error, setError] = useState<string | null>(null);\n const [hasMore, setHasMore] = useState(false);\n const [total, setTotal] = useState(0);\n const [filter, setFilter] = useState<ChannelFilterInput>(initialFilter ?? {});\n\n // Get Apollo client with auth token and organization context\n const getClient = useCallback(() => {\n return getGlobalChannelClient(apiGatewayUrl, authToken, organizationId);\n }, [apiGatewayUrl, authToken, organizationId]);\n\n // Fetch channels\n const fetchChannels = useCallback(\n async (pagination?: { offset?: number; limit?: number }) => {\n setIsLoading(true);\n setError(null);\n\n try {\n const client = getClient();\n const result = await client.query<GetChannelsQuery>({\n query: GetChannelsDocument,\n variables: {\n filter,\n pagination: pagination ?? { offset: 0, limit: 50 },\n },\n fetchPolicy: 'network-only',\n });\n\n const data = result.data?.getChannels;\n if (data) {\n setChannels(data.items);\n setTotal(data.total);\n setHasMore(data.hasMore);\n }\n } catch (err: unknown) {\n const message = err instanceof Error ? err.message : 'Failed to fetch channels';\n report(err, 'Failed to fetch channels');\n setError(message);\n } finally {\n setIsLoading(false);\n }\n },\n [getClient, filter]\n );\n\n // Initial fetch — defer to microtask to avoid synchronous setState in effect\n useEffect(() => {\n void Promise.resolve().then(() => fetchChannels());\n }, [fetchChannels]);\n\n // Create channel\n const createChannel = useCallback(\n async (input: CreateChannelInput): Promise<Channel | null> => {\n try {\n const client = getClient();\n const result = await client.mutate<CreateChannelMutation>({\n mutation: CreateChannelDocument,\n variables: { input },\n });\n const created = (result.data?.createChannel as Channel) ?? null;\n if (created) {\n emitShellEvent('channel.created', { id: created.id, platform: created.platform });\n }\n await fetchChannels();\n return created;\n } catch (err: unknown) {\n const message = err instanceof Error ? err.message : 'Failed to create channel';\n report(err, 'Failed to create channel');\n setError(message);\n return null;\n }\n },\n [getClient, fetchChannels]\n );\n\n // Update channel\n const updateChannel = useCallback(\n async (id: string, input: UpdateChannelInput): Promise<Channel | null> => {\n try {\n const client = getClient();\n const result = await client.mutate<UpdateChannelMutation>({\n mutation: UpdateChannelDocument,\n variables: { id, input },\n });\n emitShellEvent('channel.updated', { id });\n await fetchChannels();\n return (result.data?.updateChannel as Channel) ?? null;\n } catch (err: unknown) {\n const message = err instanceof Error ? err.message : 'Failed to update channel';\n report(err, 'Failed to update channel');\n setError(message);\n return null;\n }\n },\n [getClient, fetchChannels]\n );\n\n // Delete channel\n const deleteChannel = useCallback(\n async (id: string): Promise<boolean> => {\n try {\n const client = getClient();\n await client.mutate({\n mutation: DeleteChannelDocument,\n variables: { id },\n });\n emitShellEvent('channel.deleted', { id });\n await fetchChannels();\n return true;\n } catch (err: unknown) {\n const message = err instanceof Error ? err.message : 'Failed to delete channel';\n report(err, 'Failed to delete channel');\n setError(message);\n return false;\n }\n },\n [getClient, fetchChannels]\n );\n\n // Activate channel\n const activateChannel = useCallback(\n async (id: string): Promise<boolean> => {\n try {\n const client = getClient();\n await client.mutate({\n mutation: ActivateChannelDocument,\n variables: { id },\n });\n emitShellEvent('channel.updated', { id, action: 'activated' });\n await fetchChannels();\n return true;\n } catch (err: unknown) {\n const message = err instanceof Error ? err.message : 'Failed to activate channel';\n report(err, 'Failed to activate channel');\n setError(message);\n return false;\n }\n },\n [getClient, fetchChannels]\n );\n\n // Deactivate channel\n const deactivateChannel = useCallback(\n async (id: string): Promise<boolean> => {\n try {\n const client = getClient();\n await client.mutate({\n mutation: DeactivateChannelDocument,\n variables: { id },\n });\n emitShellEvent('channel.updated', { id, action: 'deactivated' });\n await fetchChannels();\n return true;\n } catch (err: unknown) {\n const message = err instanceof Error ? err.message : 'Failed to deactivate channel';\n report(err, 'Failed to deactivate channel');\n setError(message);\n return false;\n }\n },\n [getClient, fetchChannels]\n );\n\n // Run health check\n const runHealthCheck = useCallback(\n async (id: string): Promise<ChannelHealthCheck | null> => {\n try {\n const client = getClient();\n const result = await client.mutate<RunChannelHealthCheckMutation>({\n mutation: RunChannelHealthCheckDocument,\n variables: { id },\n });\n await fetchChannels();\n return (result.data?.runChannelHealthCheck as ChannelHealthCheck) ?? null;\n } catch (err: unknown) {\n const message = err instanceof Error ? err.message : 'Failed to run health check';\n report(err, 'Failed to run health check');\n setError(message);\n return null;\n }\n },\n [getClient, fetchChannels]\n );\n\n // Update filter\n const updateFilter = useCallback((newFilter: Partial<ChannelFilterInput>) => {\n setFilter((prev) => ({ ...prev, ...newFilter }));\n }, []);\n\n // Reset filter\n const resetFilter = useCallback(() => {\n setFilter({});\n }, []);\n\n // Deliver notification via channel\n const deliverNotification = useCallback(\n async (\n input: ChannelDeliveryInput\n ): Promise<{ success: boolean; results?: ChannelDeliveryResult[]; error?: string }> => {\n try {\n const client = getClient();\n const result = await client.mutate<DeliverNotificationMutation>({\n mutation: DeliverNotificationDocument,\n variables: { input },\n });\n\n const data = result.data?.deliverNotification;\n if (data) {\n emitShellEvent('delivery.completed', {\n success: data.success ?? false,\n messageId: data.messageId,\n platform: data.platform,\n status: data.status,\n });\n return {\n success: data.success ?? false,\n results: [data as ChannelDeliveryResult],\n };\n }\n return { success: false, error: 'No data returned' };\n } catch (err: unknown) {\n const message = err instanceof Error ? err.message : 'Failed to deliver notification';\n report(err, 'Failed to deliver notification');\n return { success: false, error: message };\n }\n },\n [getClient]\n );\n\n return {\n channels,\n isLoading,\n error,\n hasMore,\n total,\n filter,\n refetch: fetchChannels,\n createChannel,\n updateChannel,\n deleteChannel,\n activateChannel,\n deactivateChannel,\n runHealthCheck,\n updateFilter,\n resetFilter,\n deliverNotification,\n };\n}\n\n/**\n * Hook for managing a single channel\n */\nexport function useChannel(id: string | undefined) {\n const { authToken, apiGatewayUrl, organizationId } = useChannelContext();\n const [channel, setChannel] = useState<ChannelDetail | null>(null);\n const [isLoading, setIsLoading] = useState(true);\n const [error, setError] = useState<string | null>(null);\n\n // Get Apollo client with auth token and organization context\n const getClient = useCallback(() => {\n return getGlobalChannelClient(apiGatewayUrl, authToken, organizationId);\n }, [apiGatewayUrl, authToken, organizationId]);\n\n // Fetch channel\n const fetchChannel = useCallback(async () => {\n if (!id) {\n setChannel(null);\n setIsLoading(false);\n return;\n }\n\n setIsLoading(true);\n setError(null);\n\n try {\n const client = getClient();\n const result = await client.query<GetChannelQuery>({\n query: GetChannelDocument,\n variables: { id },\n fetchPolicy: 'network-only',\n });\n\n setChannel(result.data?.getChannel ?? null);\n } catch (err: unknown) {\n const message = err instanceof Error ? err.message : 'Failed to fetch channel';\n report(err, 'Failed to fetch channel');\n setError(message);\n } finally {\n setIsLoading(false);\n }\n }, [id, getClient]);\n\n useEffect(() => {\n void Promise.resolve().then(() => fetchChannel());\n }, [fetchChannel]);\n\n // Update channel\n const updateChannel = useCallback(\n async (input: UpdateChannelInput): Promise<ChannelDetail | null> => {\n if (!id) return null;\n\n try {\n const client = getClient();\n const result = await client.mutate<UpdateChannelMutation>({\n mutation: UpdateChannelDocument,\n variables: { id, input },\n });\n emitShellEvent('channel.updated', { id });\n await fetchChannel();\n return (result.data?.updateChannel as ChannelDetail) ?? null;\n } catch (err: unknown) {\n const message = err instanceof Error ? err.message : 'Failed to update channel';\n report(err, 'Failed to update channel');\n setError(message);\n return null;\n }\n },\n [id, getClient, fetchChannel]\n );\n\n // Run health check\n const runHealthCheck = useCallback(async (): Promise<ChannelHealthCheck | null> => {\n if (!id) return null;\n\n try {\n const client = getClient();\n const result = await client.mutate<RunChannelHealthCheckMutation>({\n mutation: RunChannelHealthCheckDocument,\n variables: { id },\n });\n await fetchChannel();\n return (result.data?.runChannelHealthCheck as ChannelHealthCheck) ?? null;\n } catch (err: unknown) {\n const message = err instanceof Error ? err.message : 'Failed to run health check';\n report(err, 'Failed to run health check');\n setError(message);\n return null;\n }\n }, [id, getClient, fetchChannel]);\n\n // Create connection\n const createConnection = useCallback(\n async (input: Omit<CreateConnectionInput, 'channelId'>): Promise<ChannelConnection | null> => {\n if (!id) return null;\n\n try {\n const client = getClient();\n const result = await client.mutate<CreateConnectionMutation>({\n mutation: CreateConnectionDocument,\n variables: { input: { ...input, channelId: id } },\n });\n const created = (result.data?.createConnection as ChannelConnection) ?? null;\n if (created) {\n emitShellEvent('connection.created', { id: created.id, channelId: id });\n }\n await fetchChannel();\n return created;\n } catch (err: unknown) {\n const message = err instanceof Error ? err.message : 'Failed to create connection';\n report(err, 'Failed to create connection');\n setError(message);\n return null;\n }\n },\n [id, getClient, fetchChannel]\n );\n\n // Update connection\n const updateConnection = useCallback(\n async (\n connectionId: string,\n input: UpdateConnectionInput\n ): Promise<ChannelConnection | null> => {\n try {\n const client = getClient();\n const result = await client.mutate<UpdateConnectionMutation>({\n mutation: UpdateConnectionDocument,\n variables: { id: connectionId, input },\n });\n emitShellEvent('connection.updated', { id: connectionId });\n await fetchChannel();\n return (result.data?.updateConnection as ChannelConnection) ?? null;\n } catch (err: unknown) {\n const message = err instanceof Error ? err.message : 'Failed to update connection';\n report(err, 'Failed to update connection');\n setError(message);\n return null;\n }\n },\n [getClient, fetchChannel]\n );\n\n // Delete connection\n // Returns void on success; throws on failure (never returns false).\n const deleteConnection = useCallback(\n async (connectionId: string): Promise<void> => {\n try {\n const client = getClient();\n await client.mutate({\n mutation: DeleteConnectionDocument,\n variables: { id: connectionId },\n update(cache) {\n cache.evict({ id: `ChannelConnection:${connectionId}` });\n cache.gc();\n },\n });\n emitShellEvent('connection.deleted', { id: connectionId });\n await fetchChannel();\n } catch (err: unknown) {\n report(err, 'Failed to delete connection');\n throw err;\n }\n },\n [getClient, fetchChannel]\n );\n\n // Test connection\n const testConnection = useCallback(\n async (connectionId: string): Promise<ConnectionTestResult | null> => {\n try {\n const client = getClient();\n const result = await client.mutate<TestConnectionHealthMutation>({\n mutation: TestConnectionHealthDocument,\n variables: { id: connectionId },\n });\n await fetchChannel();\n return (result.data?.testConnectionHealth as ConnectionTestResult) ?? null;\n } catch (err: unknown) {\n report(err, 'Failed to test connection');\n throw err;\n }\n },\n [getClient, fetchChannel]\n );\n\n // Send test message via channel using deliverNotification\n const sendTestNotification = useCallback(\n async (\n recipient: string,\n message: string,\n options?: { subject?: string; html?: string }\n ): Promise<ChannelDeliveryResult | null> => {\n if (!channel) return null;\n\n try {\n const client = getClient();\n\n // Build content based on platform\n const content: ChannelDeliveryContentInput = {\n text: message,\n };\n\n // Add platform-specific content\n if (channel.platform === 'EMAIL') {\n content.subject = options?.subject ?? 'Test Notification';\n if (options?.html) {\n content.html = options.html;\n }\n } else if (channel.platform === 'PUSH') {\n content.title = options?.subject ?? 'Test Notification';\n }\n\n const input: ChannelDeliveryInput = {\n platform: channel.platform,\n organizationId: channel.organizationId,\n recipient,\n content,\n connectionId: channel.connection?.id,\n };\n\n const result = await client.mutate<DeliverNotificationMutation>({\n mutation: DeliverNotificationDocument,\n variables: { input },\n });\n\n const out = (result.data?.deliverNotification as ChannelDeliveryResult) ?? null;\n if (out) {\n emitShellEvent('delivery.completed', {\n success: out.success ?? false,\n messageId: out.messageId,\n platform: out.platform,\n status: out.status,\n test: true,\n });\n }\n return out;\n } catch (err: unknown) {\n report(err, 'Failed to send test message');\n throw err;\n }\n },\n [channel, getClient]\n );\n\n // Fetch delivery attempts\n const fetchDeliveryAttempts = useCallback(\n async (limit: number = 50): Promise<DeliveryAttempt[]> => {\n if (!id) return [];\n\n try {\n const client = getClient();\n const result = await client.query<GetDeliveryAttemptsQuery>({\n query: GetDeliveryAttemptsDocument,\n variables: { channelId: id, limit },\n fetchPolicy: 'network-only',\n });\n return result.data?.getChannelDeliveryAttempts?.items ?? [];\n } catch (err: unknown) {\n const message = err instanceof Error ? err.message : 'Failed to fetch delivery attempts';\n report(err, 'Failed to fetch delivery attempts');\n setError(message);\n return [];\n }\n },\n [id, getClient]\n );\n\n // Fetch webhook events\n const fetchWebhookEvents = useCallback(\n async (limit: number = 50): Promise<WebhookEvent[]> => {\n if (!id) return [];\n\n try {\n const client = getClient();\n const result = await client.query<GetWebhookEventsQuery>({\n query: GetWebhookEventsDocument,\n variables: { channelId: id, limit },\n fetchPolicy: 'network-only',\n });\n return result.data?.getChannelWebhookEvents?.items ?? [];\n } catch (err: unknown) {\n const message = err instanceof Error ? err.message : 'Failed to fetch webhook events';\n report(err, 'Failed to fetch webhook events');\n setError(message);\n return [];\n }\n },\n [id, getClient]\n );\n\n // Fetch user platform connections\n const fetchUserPlatformConnections = useCallback(\n async (limit: number = 50): Promise<UserPlatformConnection[]> => {\n if (!id) return [];\n\n try {\n const client = getClient();\n const result = await client.query<GetUserPlatformConnectionsQuery>({\n query: GetUserPlatformConnectionsDocument,\n variables: { channelId: id, pagination: { limit } },\n fetchPolicy: 'network-only',\n });\n return result.data?.listUserPlatformConnectionsByChannel?.items ?? [];\n } catch (err: unknown) {\n const message =\n err instanceof Error ? err.message : 'Failed to fetch user platform connections';\n report(err, 'Failed to fetch user platform connections');\n setError(message);\n return [];\n }\n },\n [id, getClient]\n );\n\n // Retry a failed delivery\n const retryDelivery = useCallback(\n async (attemptId: string): Promise<{ success: boolean; error?: string }> => {\n try {\n const client = getClient();\n const result = await client.mutate<RetryDeliveryMutation>({\n mutation: RetryDeliveryDocument,\n variables: { attemptId },\n });\n const data = result.data?.retryDelivery;\n if (data?.success) {\n emitShellEvent('delivery.completed', {\n success: true,\n attemptId,\n messageId: data.messageId,\n retried: true,\n });\n // Refresh the delivery attempts list\n await fetchDeliveryAttempts();\n return { success: true };\n } else {\n return { success: false, error: data?.error || 'Retry failed' };\n }\n } catch (err: unknown) {\n const message = err instanceof Error ? err.message : 'Failed to retry delivery';\n report(err, 'Failed to retry delivery');\n return { success: false, error: message };\n }\n },\n [getClient, fetchDeliveryAttempts]\n );\n\n // Fetch delivery statistics\n const fetchDeliveryStats = useCallback(\n async (startDate?: string, endDate?: string): Promise<DeliveryStats | null> => {\n if (!id) return null;\n\n try {\n const client = getClient();\n const result = await client.query<GetDeliveryStatsQuery>({\n query: GetDeliveryStatsDocument,\n variables: { channelId: id, startDate, endDate },\n fetchPolicy: 'network-only',\n });\n return result.data?.getDeliveryStats ?? null;\n } catch (err: unknown) {\n const message = err instanceof Error ? err.message : 'Failed to fetch delivery stats';\n report(err, 'Failed to fetch delivery stats');\n setError(message);\n return null;\n }\n },\n [id, getClient]\n );\n\n return {\n channel,\n isLoading,\n error,\n refetch: fetchChannel,\n updateChannel,\n runHealthCheck,\n createConnection,\n updateConnection,\n deleteConnection,\n testConnection,\n sendTestNotification,\n fetchDeliveryAttempts,\n fetchWebhookEvents,\n fetchUserPlatformConnections,\n retryDelivery,\n fetchDeliveryStats,\n };\n}\n"],"mappings":";;;;;;AAgDA,SAAS,EAAO,GAAgB,GAAgB,IAAmC,EAAE,EAAE;AACrF,GAAiB,GAAO;EAAE,QAAQ;EAAW,SAAS;GAAE;GAAQ,GAAG;GAAS;EAAE,CAAC;;AAsLjF,SAAgB,EAAY,GAAoC;CAC9D,IAAM,EAAE,cAAW,kBAAe,sBAAmB,GAAmB,EAClE,CAAC,GAAU,KAAe,EAAoB,EAAE,CAAC,EACjD,CAAC,GAAW,KAAgB,EAAS,GAAK,EAC1C,CAAC,GAAO,KAAY,EAAwB,KAAK,EACjD,CAAC,GAAS,KAAc,EAAS,GAAM,EACvC,CAAC,GAAO,KAAY,EAAS,EAAE,EAC/B,CAAC,GAAQ,KAAa,EAA6B,KAAiB,EAAE,CAAC,EAGvE,IAAY,QACT,EAAuB,GAAe,GAAW,EAAe,EACtE;EAAC;EAAe;EAAW;EAAe,CAAC,EAGxC,IAAgB,EACpB,OAAO,MAAqD;AAE1D,EADA,EAAa,GAAK,EAClB,EAAS,KAAK;AAEd,MAAI;GAWF,IAAM,KATS,MADA,GAAW,CACE,MAAwB;IAClD,OAAO;IACP,WAAW;KACT;KACA,YAAY,KAAc;MAAE,QAAQ;MAAG,OAAO;MAAI;KACnD;IACD,aAAa;IACd,CAAC,EAEkB,MAAM;AAC1B,GAAI,MACF,EAAY,EAAK,MAAM,EACvB,EAAS,EAAK,MAAM,EACpB,EAAW,EAAK,QAAQ;WAEnB,GAAc;GACrB,IAAM,IAAU,aAAe,QAAQ,EAAI,UAAU;AAErD,GADA,EAAO,GAAK,2BAA2B,EACvC,EAAS,EAAQ;YACT;AACR,KAAa,GAAM;;IAG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,WAAW;MAAE,WAAW;MAAI;MAAW;MAAS;KAChD,aAAa;KACd,CAAC,EACY,MAAM,oBAAoB;YACjC,GAAc;IACrB,IAAM,IAAU,aAAe,QAAQ,EAAI,UAAU;AAGrD,WAFA,EAAO,GAAK,iCAAiC,EAC7C,EAAS,EAAQ,EACV;;KAGX,CAAC,GAAI,EAAU,CAChB;EAmBA"}
1
+ {"version":3,"file":"useChannels.js","names":[],"sources":["../../../src/channel/hooks/useChannels.ts"],"sourcesContent":["/**\n * Channel Hooks\n * GraphQL queries and mutations for channel management\n *\n * All types are derived from codegen-generated types (src/generated/global-types.ts)\n * and operation result types (src/generated/global-operations.ts).\n */\n\nimport { useState, useCallback, useEffect } from 'react';\nimport { getGlobalChannelClient } from '../graphql/global-client';\nimport { useChannel as useChannelContext } from '../providers/ChannelProvider';\nimport { emitShellEvent, reportShellError } from '../utils/shellBridge';\nimport {\n GetChannelsDocument,\n GetChannelDocument,\n CreateChannelDocument,\n UpdateChannelDocument,\n DeleteChannelDocument,\n ActivateChannelDocument,\n DeactivateChannelDocument,\n RunChannelHealthCheckDocument,\n CreateConnectionDocument,\n UpdateConnectionDocument,\n DeleteConnectionDocument,\n TestConnectionHealthDocument,\n DeliverNotificationDocument,\n GetDeliveryAttemptsDocument,\n GetWebhookEventsDocument,\n GetUserPlatformConnectionsDocument,\n RetryDeliveryDocument,\n GetDeliveryStatsDocument,\n type GetChannelsQuery,\n type GetChannelQuery,\n type CreateChannelMutation,\n type UpdateChannelMutation,\n type RunChannelHealthCheckMutation,\n type CreateConnectionMutation,\n type UpdateConnectionMutation,\n type TestConnectionHealthMutation,\n type DeliverNotificationMutation,\n type GetDeliveryAttemptsQuery,\n type GetWebhookEventsQuery,\n type GetUserPlatformConnectionsQuery,\n type RetryDeliveryMutation,\n type GetDeliveryStatsQuery,\n} from '../../generated/global-operations';\n\n/** Forward an operational error to the shell SRE sink. */\nfunction report(error: unknown, action: string, context: Record<string, unknown> = {}) {\n reportShellError(error, { module: 'channel', context: { action, ...context } });\n}\n\n// ============================================================================\n// TYPES — derived from codegen, exposed as string unions for convenience.\n//\n// Codegen generates TypeScript enums (e.g., ChannelPlatform.Email = 'EMAIL').\n// Pages/components use string literals ('EMAIL', 'ACTIVE', etc.) which are\n// not directly assignable to TS enums. We re-export the underlying string\n// union types so consumers can use plain strings without casting.\n// ============================================================================\n\nimport type {\n ChannelPlatform as _ChannelPlatform,\n ChannelStatus as _ChannelStatus,\n ChannelAuthType as _ChannelAuthType,\n ConnectionHealth as _ConnectionHealth,\n AdapterType as _AdapterType,\n DeliveryPriority as _DeliveryPriority,\n DeliveryStatus as _DeliveryStatus,\n ChannelFilterInput as _ChannelFilterInput,\n CreateChannelInput as _CreateChannelInput,\n UpdateChannelInput as _UpdateChannelInput,\n CreateConnectionInput as _CreateConnectionInput,\n UpdateConnectionInput as _UpdateConnectionInput,\n ChannelHealthCheck as _ChannelHealthCheck,\n ConnectionTestResult as _ConnectionTestResult,\n ChannelDeliveryResult as _ChannelDeliveryResult,\n ChannelDeliveryError as _ChannelDeliveryError,\n ChannelDeliveryContentInput as _ChannelDeliveryContentInput,\n ChannelDeliveryInput as _ChannelDeliveryInput,\n BulkChannelDeliveryResult as _BulkChannelDeliveryResult,\n UserPresenceStatus as _UserPresenceStatus,\n PairingStatus as _PairingStatus,\n WebhookProcessingStatus as _WebhookProcessingStatus,\n} from '../../generated/global-types';\n\n// ── Enum-like string unions (backward-compatible with string literal usage) ──\n\n/** Communication platform — extends generated enum with values pending backend schema update */\nexport type ChannelPlatform = `${_ChannelPlatform}` | 'INAPP';\n/** Channel lifecycle status */\nexport type ChannelStatus = `${_ChannelStatus}`;\n/** Authentication method for connections */\nexport type ChannelAuthType = `${_ChannelAuthType}`;\n/** Connection health status */\nexport type ConnectionHealth = `${_ConnectionHealth}`;\n/** Specific adapter/provider type — extends generated enum with values pending backend schema update */\nexport type AdapterType =\n | `${_AdapterType}`\n | 'INAPP_NATIVE'\n | 'NOVU'\n | 'KNOCKLABS'\n | 'SENDGRID'\n | 'MAILGUN'\n | 'POSTMARK'\n | 'MANDRILL'\n | 'RESEND'\n | 'SMTP'\n | 'VONAGE'\n | 'PLIVO'\n | 'MESSAGEBIRD'\n | 'INFOBIP'\n | 'APNS'\n | 'ONESIGNAL'\n | 'EXPO'\n | 'WEBCHAT_NATIVE'\n | 'SLACK_WEBHOOK'\n | 'TEAMS_WEBHOOK'\n | 'DISCORD_WEBHOOK';\n/** Delivery priority level */\nexport type DeliveryPriority = `${_DeliveryPriority}`;\n/** Message delivery status */\nexport type DeliveryStatus = `${_DeliveryStatus}`;\n/** User presence status on a platform */\nexport type UserPresenceStatus = `${_UserPresenceStatus}`;\n/** Pairing status for Bundle-2 flow */\nexport type PairingStatus = `${_PairingStatus}`;\n/** Webhook event processing status */\nexport type WebhookProcessingStatus = `${_WebhookProcessingStatus}`;\n\n// ── Utility: recursively unwrap codegen enums to string unions ──────────────\n// Codegen generates TS enums that are not assignable from string literals.\n// This mapped type converts `ChannelPlatform` (enum) → `'EMAIL' | 'SMS' | ...`\n// at every nested level of a type, making all Input/Result types compatible\n// with plain string usage.\n\ntype EnumToString<T> = [T] extends [null]\n ? null\n : T extends null | undefined\n ? EnumToString<NonNullable<T>> | Extract<T, null | undefined>\n : T extends _ChannelPlatform\n ? ChannelPlatform\n : T extends _ChannelStatus\n ? ChannelStatus\n : T extends _ChannelAuthType\n ? ChannelAuthType\n : T extends _ConnectionHealth\n ? ConnectionHealth\n : T extends _AdapterType\n ? AdapterType\n : T extends _DeliveryPriority\n ? DeliveryPriority\n : T extends _DeliveryStatus\n ? DeliveryStatus\n : T extends _UserPresenceStatus\n ? UserPresenceStatus\n : T extends _PairingStatus\n ? PairingStatus\n : T extends _WebhookProcessingStatus\n ? WebhookProcessingStatus\n : T extends Array<infer U>\n ? Array<EnumToString<U>>\n : T extends object\n ? { [K in keyof T]: EnumToString<T[K]> }\n : T;\n\n// ── Input types (used by mutations) ─────────────────────────────────────────\n\nexport type CreateChannelInput = EnumToString<_CreateChannelInput>;\nexport type UpdateChannelInput = EnumToString<_UpdateChannelInput>;\nexport type CreateConnectionInput = EnumToString<_CreateConnectionInput>;\nexport type UpdateConnectionInput = EnumToString<_UpdateConnectionInput>;\nexport type ChannelFilterInput = EnumToString<_ChannelFilterInput>;\nexport type ChannelDeliveryContentInput = EnumToString<_ChannelDeliveryContentInput>;\nexport type ChannelDeliveryInput = EnumToString<_ChannelDeliveryInput>;\nexport type {\n ChannelPaginationInput,\n ChannelDeliveryOptionsInput,\n ChannelRetryPolicyInput,\n BulkChannelDeliveryInput,\n} from '../../generated/global-types';\n\n// ── Schema result types ─────────────────────────────────────────────────────\n\nexport type ChannelHealthCheck = EnumToString<_ChannelHealthCheck>;\nexport type ConnectionTestResult = EnumToString<_ConnectionTestResult>;\nexport type ChannelDeliveryResult = EnumToString<_ChannelDeliveryResult>;\nexport type ChannelDeliveryError = EnumToString<_ChannelDeliveryError>;\nexport type BulkChannelDeliveryResult = EnumToString<_BulkChannelDeliveryResult>;\n\n// ── Derived types from query results ──────────────────────────────────────\n// These represent the actual shape of data returned by our GraphQL operations,\n// not the full schema types (which include __typename, nested relations, etc.)\n\n/** Channel as returned by GetChannels query (list item) */\nexport type Channel = NonNullable<GetChannelsQuery['getChannels']['items'][number]>;\n\n/** Channel as returned by GetChannel query (full detail) */\nexport type ChannelDetail = NonNullable<GetChannelQuery['getChannel']>;\n\n/** ChannelConnection from the GetChannel query (full connection detail) */\nexport type ChannelConnection = NonNullable<ChannelDetail['connection']>;\n\n/** ChannelList response shape */\nexport type ChannelList = GetChannelsQuery['getChannels'];\n\n/** Message delivery attempt as returned by GetDeliveryAttempts query */\nexport type DeliveryAttempt = NonNullable<\n GetDeliveryAttemptsQuery['getChannelDeliveryAttempts']['items'][number]\n>;\n\n/** Webhook event as returned by GetWebhookEvents query */\nexport type WebhookEvent = NonNullable<\n GetWebhookEventsQuery['getChannelWebhookEvents']['items'][number]\n>;\n\n/** User platform connection as returned by GetUserPlatformConnections query */\nexport type UserPlatformConnection = NonNullable<\n GetUserPlatformConnectionsQuery['listUserPlatformConnectionsByChannel']['items'][number]\n>;\n\n/** Delivery statistics as returned by GetDeliveryStats query */\nexport type DeliveryStats = NonNullable<GetDeliveryStatsQuery['getDeliveryStats']>;\n\n// ============================================================================\n// HOOKS\n// ============================================================================\n\n/**\n * Hook for managing channels list\n */\nexport function useChannels(initialFilter?: ChannelFilterInput) {\n const { authToken, apiGatewayUrl, organizationId } = useChannelContext();\n const [channels, setChannels] = useState<Channel[]>([]);\n const [isLoading, setIsLoading] = useState(true);\n const [error, setError] = useState<string | null>(null);\n const [hasMore, setHasMore] = useState(false);\n const [total, setTotal] = useState(0);\n const [filter, setFilter] = useState<ChannelFilterInput>(initialFilter ?? {});\n\n // Get Apollo client with auth token and organization context\n const getClient = useCallback(() => {\n return getGlobalChannelClient(apiGatewayUrl, authToken, organizationId);\n }, [apiGatewayUrl, authToken, organizationId]);\n\n // Fetch channels\n const fetchChannels = useCallback(\n async (pagination?: { offset?: number; limit?: number }) => {\n setIsLoading(true);\n setError(null);\n\n try {\n const client = getClient();\n const result = await client.query<GetChannelsQuery>({\n query: GetChannelsDocument,\n variables: {\n filter,\n pagination: pagination ?? { offset: 0, limit: 50 },\n },\n fetchPolicy: 'network-only',\n });\n\n const data = result.data?.getChannels;\n if (data) {\n setChannels(data.items);\n setTotal(data.total);\n setHasMore(data.hasMore);\n }\n } catch (err: unknown) {\n const message = err instanceof Error ? err.message : 'Failed to fetch channels';\n report(err, 'Failed to fetch channels');\n setError(message);\n } finally {\n setIsLoading(false);\n }\n },\n [getClient, filter]\n );\n\n // Initial fetch — defer to microtask to avoid synchronous setState in effect\n useEffect(() => {\n void Promise.resolve().then(() => fetchChannels());\n }, [fetchChannels]);\n\n // Create channel\n const createChannel = useCallback(\n async (input: CreateChannelInput): Promise<Channel | null> => {\n try {\n const client = getClient();\n const result = await client.mutate<CreateChannelMutation>({\n mutation: CreateChannelDocument,\n variables: { input },\n });\n const created = (result.data?.createChannel as Channel) ?? null;\n if (created) {\n emitShellEvent('channel.created', { id: created.id, platform: created.platform });\n }\n await fetchChannels();\n return created;\n } catch (err: unknown) {\n const message = err instanceof Error ? err.message : 'Failed to create channel';\n report(err, 'Failed to create channel');\n setError(message);\n return null;\n }\n },\n [getClient, fetchChannels]\n );\n\n // Update channel\n const updateChannel = useCallback(\n async (id: string, input: UpdateChannelInput): Promise<Channel | null> => {\n try {\n const client = getClient();\n const result = await client.mutate<UpdateChannelMutation>({\n mutation: UpdateChannelDocument,\n variables: { id, input },\n });\n emitShellEvent('channel.updated', { id });\n await fetchChannels();\n return (result.data?.updateChannel as Channel) ?? null;\n } catch (err: unknown) {\n const message = err instanceof Error ? err.message : 'Failed to update channel';\n report(err, 'Failed to update channel');\n setError(message);\n return null;\n }\n },\n [getClient, fetchChannels]\n );\n\n // Delete channel\n const deleteChannel = useCallback(\n async (id: string): Promise<boolean> => {\n try {\n const client = getClient();\n await client.mutate({\n mutation: DeleteChannelDocument,\n variables: { id },\n });\n emitShellEvent('channel.deleted', { id });\n await fetchChannels();\n return true;\n } catch (err: unknown) {\n const message = err instanceof Error ? err.message : 'Failed to delete channel';\n report(err, 'Failed to delete channel');\n setError(message);\n return false;\n }\n },\n [getClient, fetchChannels]\n );\n\n // Activate channel\n const activateChannel = useCallback(\n async (id: string): Promise<boolean> => {\n try {\n const client = getClient();\n await client.mutate({\n mutation: ActivateChannelDocument,\n variables: { id },\n });\n emitShellEvent('channel.updated', { id, action: 'activated' });\n await fetchChannels();\n return true;\n } catch (err: unknown) {\n const message = err instanceof Error ? err.message : 'Failed to activate channel';\n report(err, 'Failed to activate channel');\n setError(message);\n return false;\n }\n },\n [getClient, fetchChannels]\n );\n\n // Deactivate channel\n const deactivateChannel = useCallback(\n async (id: string): Promise<boolean> => {\n try {\n const client = getClient();\n await client.mutate({\n mutation: DeactivateChannelDocument,\n variables: { id },\n });\n emitShellEvent('channel.updated', { id, action: 'deactivated' });\n await fetchChannels();\n return true;\n } catch (err: unknown) {\n const message = err instanceof Error ? err.message : 'Failed to deactivate channel';\n report(err, 'Failed to deactivate channel');\n setError(message);\n return false;\n }\n },\n [getClient, fetchChannels]\n );\n\n // Run health check\n const runHealthCheck = useCallback(\n async (id: string): Promise<ChannelHealthCheck | null> => {\n try {\n const client = getClient();\n const result = await client.mutate<RunChannelHealthCheckMutation>({\n mutation: RunChannelHealthCheckDocument,\n variables: { id },\n });\n await fetchChannels();\n return (result.data?.runChannelHealthCheck as ChannelHealthCheck) ?? null;\n } catch (err: unknown) {\n const message = err instanceof Error ? err.message : 'Failed to run health check';\n report(err, 'Failed to run health check');\n setError(message);\n return null;\n }\n },\n [getClient, fetchChannels]\n );\n\n // Update filter\n const updateFilter = useCallback((newFilter: Partial<ChannelFilterInput>) => {\n setFilter((prev) => ({ ...prev, ...newFilter }));\n }, []);\n\n // Reset filter\n const resetFilter = useCallback(() => {\n setFilter({});\n }, []);\n\n // Deliver notification via channel\n const deliverNotification = useCallback(\n async (\n input: ChannelDeliveryInput\n ): Promise<{ success: boolean; results?: ChannelDeliveryResult[]; error?: string }> => {\n try {\n const client = getClient();\n const result = await client.mutate<DeliverNotificationMutation>({\n mutation: DeliverNotificationDocument,\n variables: { input },\n });\n\n const data = result.data?.deliverNotification;\n if (data) {\n emitShellEvent('delivery.completed', {\n success: data.success ?? false,\n messageId: data.messageId,\n platform: data.platform,\n status: data.status,\n });\n return {\n success: data.success ?? false,\n results: [data as ChannelDeliveryResult],\n };\n }\n return { success: false, error: 'No data returned' };\n } catch (err: unknown) {\n const message = err instanceof Error ? err.message : 'Failed to deliver notification';\n report(err, 'Failed to deliver notification');\n return { success: false, error: message };\n }\n },\n [getClient]\n );\n\n return {\n channels,\n isLoading,\n error,\n hasMore,\n total,\n filter,\n refetch: fetchChannels,\n createChannel,\n updateChannel,\n deleteChannel,\n activateChannel,\n deactivateChannel,\n runHealthCheck,\n updateFilter,\n resetFilter,\n deliverNotification,\n };\n}\n\n/**\n * Hook for managing a single channel\n */\nexport function useChannel(id: string | undefined) {\n const { authToken, apiGatewayUrl, organizationId } = useChannelContext();\n const [channel, setChannel] = useState<ChannelDetail | null>(null);\n const [isLoading, setIsLoading] = useState(true);\n const [error, setError] = useState<string | null>(null);\n\n // Get Apollo client with auth token and organization context\n const getClient = useCallback(() => {\n return getGlobalChannelClient(apiGatewayUrl, authToken, organizationId);\n }, [apiGatewayUrl, authToken, organizationId]);\n\n // Fetch channel\n const fetchChannel = useCallback(async () => {\n if (!id) {\n setChannel(null);\n setIsLoading(false);\n return;\n }\n\n setIsLoading(true);\n setError(null);\n\n try {\n const client = getClient();\n const result = await client.query<GetChannelQuery>({\n query: GetChannelDocument,\n variables: { id },\n fetchPolicy: 'network-only',\n });\n\n setChannel(result.data?.getChannel ?? null);\n } catch (err: unknown) {\n const message = err instanceof Error ? err.message : 'Failed to fetch channel';\n report(err, 'Failed to fetch channel');\n setError(message);\n } finally {\n setIsLoading(false);\n }\n }, [id, getClient]);\n\n useEffect(() => {\n void Promise.resolve().then(() => fetchChannel());\n }, [fetchChannel]);\n\n // Update channel\n const updateChannel = useCallback(\n async (input: UpdateChannelInput): Promise<ChannelDetail | null> => {\n if (!id) return null;\n\n try {\n const client = getClient();\n const result = await client.mutate<UpdateChannelMutation>({\n mutation: UpdateChannelDocument,\n variables: { id, input },\n });\n emitShellEvent('channel.updated', { id });\n await fetchChannel();\n return (result.data?.updateChannel as ChannelDetail) ?? null;\n } catch (err: unknown) {\n const message = err instanceof Error ? err.message : 'Failed to update channel';\n report(err, 'Failed to update channel');\n setError(message);\n return null;\n }\n },\n [id, getClient, fetchChannel]\n );\n\n // Run health check\n const runHealthCheck = useCallback(async (): Promise<ChannelHealthCheck | null> => {\n if (!id) return null;\n\n try {\n const client = getClient();\n const result = await client.mutate<RunChannelHealthCheckMutation>({\n mutation: RunChannelHealthCheckDocument,\n variables: { id },\n });\n await fetchChannel();\n return (result.data?.runChannelHealthCheck as ChannelHealthCheck) ?? null;\n } catch (err: unknown) {\n const message = err instanceof Error ? err.message : 'Failed to run health check';\n report(err, 'Failed to run health check');\n setError(message);\n return null;\n }\n }, [id, getClient, fetchChannel]);\n\n // Create connection\n const createConnection = useCallback(\n async (input: Omit<CreateConnectionInput, 'channelId'>): Promise<ChannelConnection | null> => {\n if (!id) return null;\n\n try {\n const client = getClient();\n const result = await client.mutate<CreateConnectionMutation>({\n mutation: CreateConnectionDocument,\n variables: { input: { ...input, channelId: id } },\n });\n const created = (result.data?.createConnection as ChannelConnection) ?? null;\n if (created) {\n emitShellEvent('connection.created', { id: created.id, channelId: id });\n }\n await fetchChannel();\n return created;\n } catch (err: unknown) {\n const message = err instanceof Error ? err.message : 'Failed to create connection';\n report(err, 'Failed to create connection');\n setError(message);\n return null;\n }\n },\n [id, getClient, fetchChannel]\n );\n\n // Update connection\n const updateConnection = useCallback(\n async (\n connectionId: string,\n input: UpdateConnectionInput\n ): Promise<ChannelConnection | null> => {\n try {\n const client = getClient();\n const result = await client.mutate<UpdateConnectionMutation>({\n mutation: UpdateConnectionDocument,\n variables: { id: connectionId, input },\n });\n emitShellEvent('connection.updated', { id: connectionId });\n await fetchChannel();\n return (result.data?.updateConnection as ChannelConnection) ?? null;\n } catch (err: unknown) {\n const message = err instanceof Error ? err.message : 'Failed to update connection';\n report(err, 'Failed to update connection');\n setError(message);\n return null;\n }\n },\n [getClient, fetchChannel]\n );\n\n // Delete connection\n // Returns void on success; throws on failure (never returns false).\n const deleteConnection = useCallback(\n async (connectionId: string): Promise<void> => {\n try {\n const client = getClient();\n await client.mutate({\n mutation: DeleteConnectionDocument,\n variables: { id: connectionId },\n update(cache) {\n cache.evict({ id: `ChannelConnection:${connectionId}` });\n cache.gc();\n },\n });\n emitShellEvent('connection.deleted', { id: connectionId });\n await fetchChannel();\n } catch (err: unknown) {\n report(err, 'Failed to delete connection');\n throw err;\n }\n },\n [getClient, fetchChannel]\n );\n\n // Test connection\n const testConnection = useCallback(\n async (connectionId: string): Promise<ConnectionTestResult | null> => {\n try {\n const client = getClient();\n const result = await client.mutate<TestConnectionHealthMutation>({\n mutation: TestConnectionHealthDocument,\n variables: { id: connectionId },\n });\n await fetchChannel();\n return (result.data?.testConnectionHealth as ConnectionTestResult) ?? null;\n } catch (err: unknown) {\n report(err, 'Failed to test connection');\n throw err;\n }\n },\n [getClient, fetchChannel]\n );\n\n // Send test message via channel using deliverNotification\n const sendTestNotification = useCallback(\n async (\n recipient: string,\n message: string,\n options?: { subject?: string; html?: string }\n ): Promise<ChannelDeliveryResult | null> => {\n if (!channel) return null;\n\n try {\n const client = getClient();\n\n // Build content based on platform\n const content: ChannelDeliveryContentInput = {\n text: message,\n };\n\n // Add platform-specific content\n if (channel.platform === 'EMAIL') {\n content.subject = options?.subject ?? 'Test Notification';\n if (options?.html) {\n content.html = options.html;\n }\n } else if (channel.platform === 'PUSH') {\n content.title = options?.subject ?? 'Test Notification';\n }\n\n const input: ChannelDeliveryInput = {\n platform: channel.platform,\n organizationId: channel.organizationId,\n recipient,\n content,\n connectionId: channel.connection?.id,\n };\n\n const result = await client.mutate<DeliverNotificationMutation>({\n mutation: DeliverNotificationDocument,\n variables: { input },\n });\n\n const out = (result.data?.deliverNotification as ChannelDeliveryResult) ?? null;\n if (out) {\n emitShellEvent('delivery.completed', {\n success: out.success ?? false,\n messageId: out.messageId,\n platform: out.platform,\n status: out.status,\n test: true,\n });\n }\n return out;\n } catch (err: unknown) {\n report(err, 'Failed to send test message');\n throw err;\n }\n },\n [channel, getClient]\n );\n\n // Fetch delivery attempts\n const fetchDeliveryAttempts = useCallback(\n async (\n limit: number = 25,\n cursor?: string\n ): Promise<{\n items: DeliveryAttempt[];\n nextCursor?: string;\n hasMore: boolean;\n total: number;\n }> => {\n if (!id) return { items: [], hasMore: false, total: 0 };\n\n try {\n const client = getClient();\n const result = await client.query<GetDeliveryAttemptsQuery>({\n query: GetDeliveryAttemptsDocument,\n variables: { channelId: id, limit, cursor },\n fetchPolicy: 'network-only',\n });\n const data = result.data?.getChannelDeliveryAttempts;\n return {\n items: data?.items ?? [],\n nextCursor: data?.nextCursor ?? undefined,\n hasMore: data?.hasMore ?? false,\n total: data?.total ?? 0,\n };\n } catch (err: unknown) {\n const message = err instanceof Error ? err.message : 'Failed to fetch delivery attempts';\n report(err, 'Failed to fetch delivery attempts');\n setError(message);\n return { items: [], hasMore: false, total: 0 };\n }\n },\n [id, getClient]\n );\n\n // Fetch webhook events\n const fetchWebhookEvents = useCallback(\n async (\n limit: number = 25,\n cursor?: string\n ): Promise<{ items: WebhookEvent[]; nextCursor?: string; hasMore: boolean; total: number }> => {\n if (!id) return { items: [], hasMore: false, total: 0 };\n\n try {\n const client = getClient();\n const result = await client.query<GetWebhookEventsQuery>({\n query: GetWebhookEventsDocument,\n variables: { channelId: id, limit, cursor },\n fetchPolicy: 'network-only',\n });\n const data = result.data?.getChannelWebhookEvents;\n return {\n items: data?.items ?? [],\n nextCursor: data?.nextCursor ?? undefined,\n hasMore: data?.hasMore ?? false,\n total: data?.total ?? 0,\n };\n } catch (err: unknown) {\n const message = err instanceof Error ? err.message : 'Failed to fetch webhook events';\n report(err, 'Failed to fetch webhook events');\n setError(message);\n return { items: [], hasMore: false, total: 0 };\n }\n },\n [id, getClient]\n );\n\n // Fetch user platform connections\n const fetchUserPlatformConnections = useCallback(\n async (\n limit: number = 25,\n offset: number = 0\n ): Promise<{ items: UserPlatformConnection[]; hasMore: boolean; total: number }> => {\n if (!id) return { items: [], hasMore: false, total: 0 };\n\n try {\n const client = getClient();\n const result = await client.query<GetUserPlatformConnectionsQuery>({\n query: GetUserPlatformConnectionsDocument,\n variables: { channelId: id, pagination: { limit, offset } },\n fetchPolicy: 'network-only',\n });\n const data = result.data?.listUserPlatformConnectionsByChannel;\n return {\n items: data?.items ?? [],\n hasMore: data?.hasMore ?? false,\n total: data?.total ?? 0,\n };\n } catch (err: unknown) {\n const message =\n err instanceof Error ? err.message : 'Failed to fetch user platform connections';\n report(err, 'Failed to fetch user platform connections');\n setError(message);\n return { items: [], hasMore: false, total: 0 };\n }\n },\n [id, getClient]\n );\n\n // Retry a failed delivery\n const retryDelivery = useCallback(\n async (attemptId: string): Promise<{ success: boolean; error?: string }> => {\n try {\n const client = getClient();\n const result = await client.mutate<RetryDeliveryMutation>({\n mutation: RetryDeliveryDocument,\n variables: { attemptId },\n });\n const data = result.data?.retryDelivery;\n if (data?.success) {\n emitShellEvent('delivery.completed', {\n success: true,\n attemptId,\n messageId: data.messageId,\n retried: true,\n });\n // Refresh the delivery attempts list\n await fetchDeliveryAttempts();\n return { success: true };\n } else {\n return { success: false, error: data?.error || 'Retry failed' };\n }\n } catch (err: unknown) {\n const message = err instanceof Error ? err.message : 'Failed to retry delivery';\n report(err, 'Failed to retry delivery');\n return { success: false, error: message };\n }\n },\n [getClient, fetchDeliveryAttempts]\n );\n\n // Fetch delivery statistics\n const fetchDeliveryStats = useCallback(\n async (startDate?: string, endDate?: string): Promise<DeliveryStats | null> => {\n if (!id) return null;\n\n try {\n const client = getClient();\n const result = await client.query<GetDeliveryStatsQuery>({\n query: GetDeliveryStatsDocument,\n variables: { channelId: id, startDate, endDate },\n fetchPolicy: 'network-only',\n });\n return result.data?.getDeliveryStats ?? null;\n } catch (err: unknown) {\n const message = err instanceof Error ? err.message : 'Failed to fetch delivery stats';\n report(err, 'Failed to fetch delivery stats');\n setError(message);\n return null;\n }\n },\n [id, getClient]\n );\n\n return {\n channel,\n isLoading,\n error,\n refetch: fetchChannel,\n updateChannel,\n runHealthCheck,\n createConnection,\n updateConnection,\n deleteConnection,\n testConnection,\n sendTestNotification,\n fetchDeliveryAttempts,\n fetchWebhookEvents,\n fetchUserPlatformConnections,\n retryDelivery,\n fetchDeliveryStats,\n };\n}\n"],"mappings":";;;;;;AAgDA,SAAS,EAAO,GAAgB,GAAgB,IAAmC,EAAE,EAAE;AACrF,GAAiB,GAAO;EAAE,QAAQ;EAAW,SAAS;GAAE;GAAQ,GAAG;GAAS;EAAE,CAAC;;AAsLjF,SAAgB,EAAY,GAAoC;CAC9D,IA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ChC;KAAE,SAAS;KAAO,OAAO;KAAS;;KAG7C,CAAC,GAAW,EAAsB,CACnC;EAyCC,oBAtCyB,EACzB,OAAO,GAAoB,MAAoD;AAC7E,OAAI,CAAC,EAAI,QAAO;AAEhB,OAAI;AAOF,YALe,MADA,GAAW,CACE,MAA6B;KACvD,OAAO;KACP,WAAW;MAAE,WAAW;MAAI;MAAW;MAAS;KAChD,aAAa;KACd,CAAC,EACY,MAAM,oBAAoB;YACjC,GAAc;IACrB,IAAM,IAAU,aAAe,QAAQ,EAAI,UAAU;AAGrD,WAFA,EAAO,GAAK,iCAAiC,EAC7C,EAAS,EAAQ,EACV;;KAGX,CAAC,GAAI,EAAU,CAChB;EAmBA"}
@@ -1 +1 @@
1
- {"version":3,"file":"ChannelDashboardPage.d.ts","sourceRoot":"","sources":["../../../../../src/channel/modules/channels/pages/ChannelDashboardPage.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AA+JH,wBAAgB,oBAAoB,4CA2nBnC"}
1
+ {"version":3,"file":"ChannelDashboardPage.d.ts","sourceRoot":"","sources":["../../../../../src/channel/modules/channels/pages/ChannelDashboardPage.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAmKH,wBAAgB,oBAAoB,4CAqpBnC"}