import {Fragment} from 'react'; import ExternalLink from 'sentry/components/links/externalLink'; import {StepType} from 'sentry/components/onboarding/gettingStartedDoc/step'; import type { Docs, DocsParams, OnboardingConfig, } from 'sentry/components/onboarding/gettingStartedDoc/types'; import { getCrashReportJavaScriptInstallStep, getCrashReportModalConfigDescription, getCrashReportModalIntroduction, } from 'sentry/components/onboarding/gettingStartedDoc/utils/feedbackOnboarding'; import {t, tct} from 'sentry/locale'; type Params = DocsParams; const getConfigureSnippet = (params: Params) => ` onDeviceReady: function() { var Sentry = cordova.require('sentry-cordova.Sentry'); Sentry.init({ dsn: '${params.dsn.public}' }); }`; const onboarding: OnboardingConfig = { install: () => [ { type: StepType.INSTALL, description: t('Install our SDK using the cordova command:'), configurations: [ { language: 'bash', code: 'cordova plugin add sentry-cordova', }, ], }, ], configure: params => [ { type: StepType.CONFIGURE, description: tct( 'You should [initCode:init] the SDK in the [deviceReadyCode:deviceReady] function, to make sure the native integrations runs. For more details about Cordova [link:click here]', { initCode: , deviceReadyCode: , link: ( ), } ), configurations: [ { language: 'javascript', code: getConfigureSnippet(params), }, ], }, ], verify: () => [ { type: StepType.VERIFY, description: ( {t( 'One way to verify your setup is by intentionally causing an error that breaks your application.' )}

{t('Calling an undefined function will throw an exception:')}

), configurations: [ { language: 'javascript', code: 'myUndefinedFunction();', }, ], }, ], }; const crashReportOnboarding: OnboardingConfig = { introduction: () => getCrashReportModalIntroduction(), install: (params: Params) => getCrashReportJavaScriptInstallStep(params), configure: () => [ { type: StepType.CONFIGURE, description: getCrashReportModalConfigDescription({ link: 'https://docs.sentry.io/platforms/javascript/guides/cordova/user-feedback/configuration/#crash-report-modal', }), }, ], verify: () => [], nextSteps: () => [], }; const docs: Docs = { onboarding, crashReportOnboarding, }; export default docs;