(workflowId: string)
| 111 | * Consumes the return context and shows a workflow-scoped notification. |
| 112 | */ |
| 113 | export function useOAuthReturnForWorkflow(workflowId: string) { |
| 114 | useEffect(() => { |
| 115 | const ctx = readOAuthReturnContext() |
| 116 | if (!ctx || ctx.origin !== 'workflow') return |
| 117 | if (ctx.workflowId !== workflowId) return |
| 118 | consumeOAuthReturnContext() |
| 119 | if (Date.now() - ctx.requestedAt > CONTEXT_MAX_AGE_MS) return |
| 120 | |
| 121 | void (async () => { |
| 122 | const message = await resolveOAuthMessage(ctx) |
| 123 | toast.success(message) |
| 124 | dispatchCredentialUpdate(ctx) |
| 125 | })() |
| 126 | }, [workflowId]) |
| 127 | } |
| 128 | |
| 129 | /** |
| 130 | * Post-OAuth handler for KB connectors pages. |
no test coverage detected