()
| 64 | } |
| 65 | |
| 66 | function usePylonWidgetConfig(): PylonWidgetConfig | null { |
| 67 | const appId = process.env.NEXT_PUBLIC_PYLON_APP_ID; |
| 68 | const { data: user } = useUser(); |
| 69 | |
| 70 | const { data: identity } = useQuery({ |
| 71 | queryKey: ['pylon-identity', user?.id], |
| 72 | queryFn: fetchPylonIdentity, |
| 73 | enabled: Boolean(appId && user?.id), |
| 74 | staleTime: 5 * 60 * 1000, |
| 75 | }); |
| 76 | |
| 77 | return appId && identity ? { appId, identity } : null; |
| 78 | } |
| 79 | |
| 80 | function setPylonChatState(next: Partial<PylonChatState>) { |
| 81 | const updated = { ...pylonChatState, ...next }; |
no test coverage detected