MCPcopy Index your code
hub / github.com/getsentry/sentry / useAddIntegration

Function useAddIntegration

static/app/utils/integrations/useAddIntegration.tsx:47–89  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

45 * flows are surfaced by `openPipelineModal`/the registry.
46 */
47export 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}

Callers 6

ScmProviderPillsFunction · 0.90
ConnectProviderDropdownFunction · 0.90
AddIntegrationButtonFunction · 0.90

Calls 4

isScmProviderFunction · 0.90
openPipelineModalFunction · 0.90
addSuccessMessageFunction · 0.90
tFunction · 0.50

Tested by

no test coverage detected