()
| 45 | * flows are surfaced by `openPipelineModal`/the registry. |
| 46 | */ |
| 47 | export function useAddIntegration() { |
| 48 | const startFlow = useCallback((params: AddIntegrationParams) => { |
| 49 | const { |
| 50 | organization, |
| 51 | provider, |
| 52 | onInstall, |
| 53 | analyticsParams, |
| 54 | suppressSuccessMessage, |
| 55 | urlParams, |
| 56 | } = params; |
| 57 | |
| 58 | const is_scm = isScmProvider(provider); |
| 59 | |
| 60 | trackIntegrationAnalytics('integrations.installation_start', { |
| 61 | integration: provider.key, |
| 62 | integration_type: 'first_party', |
| 63 | is_scm, |
| 64 | organization, |
| 65 | ...analyticsParams, |
| 66 | }); |
| 67 | |
| 68 | openPipelineModal({ |
| 69 | type: 'integration', |
| 70 | provider: provider.key as ProvidersByType['integration'], |
| 71 | initialData: urlParams, |
| 72 | onComplete: data => { |
| 73 | trackIntegrationAnalytics('integrations.installation_complete', { |
| 74 | integration: provider.key, |
| 75 | integration_type: 'first_party', |
| 76 | is_scm, |
| 77 | organization, |
| 78 | ...analyticsParams, |
| 79 | }); |
| 80 | if (!suppressSuccessMessage) { |
| 81 | addSuccessMessage(t('%s added', provider.name)); |
| 82 | } |
| 83 | onInstall(data as IntegrationWithConfig); |
| 84 | }, |
| 85 | }); |
| 86 | }, []); |
| 87 | |
| 88 | return {startFlow}; |
| 89 | } |
no test coverage detected