123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216 |
- import {Fragment} from 'react';
- import ExternalLink from 'sentry/components/links/externalLink';
- import List from 'sentry/components/list/';
- import ListItem from 'sentry/components/list/listItem';
- import crashReportCallout from 'sentry/components/onboarding/gettingStartedDoc/feedback/crashReportCallout';
- import widgetCallout from 'sentry/components/onboarding/gettingStartedDoc/feedback/widgetCallout';
- import TracePropagationMessage from 'sentry/components/onboarding/gettingStartedDoc/replay/tracePropagationMessage';
- import {StepType} from 'sentry/components/onboarding/gettingStartedDoc/step';
- import type {
- Docs,
- DocsParams,
- OnboardingConfig,
- } from 'sentry/components/onboarding/gettingStartedDoc/types';
- import {
- getCrashReportJavaScriptInstallStep,
- getCrashReportModalConfigDescription,
- getCrashReportModalIntroduction,
- getFeedbackConfigureDescription,
- getFeedbackSDKSetupSnippet,
- } from 'sentry/components/onboarding/gettingStartedDoc/utils/feedbackOnboarding';
- import {getJSMetricsOnboarding} from 'sentry/components/onboarding/gettingStartedDoc/utils/metricsOnboarding';
- import {
- getReplayConfigureDescription,
- getReplaySDKSetupSnippet,
- } from 'sentry/components/onboarding/gettingStartedDoc/utils/replayOnboarding';
- import {t, tct} from 'sentry/locale';
- type Params = DocsParams;
- const getInstallConfig = () => [
- {
- type: StepType.INSTALL,
- description: tct(
- 'Configure your app automatically with the [wizardLink:Sentry wizard].',
- {
- wizardLink: (
- <ExternalLink href="https://docs.sentry.io/platforms/javascript/guides/sveltekit/#install" />
- ),
- }
- ),
- configurations: [
- {
- language: 'bash',
- code: `npx @sentry/wizard@latest -i sveltekit`,
- },
- ],
- },
- ];
- const onboarding: OnboardingConfig = {
- install: () => getInstallConfig(),
- configure: () => [
- {
- type: StepType.CONFIGURE,
- configurations: [
- {
- description: (
- <Fragment>
- {t(
- 'The Sentry wizard will automatically patch your application to configure the Sentry SDK:'
- )}
- <List symbol="bullet">
- <ListItem>
- {tct(
- 'Create or update [hookClientCode:src/hooks.client.js] and [hookServerCode:src/hooks.server.js] with the default [sentryInitCode:Sentry.init] call and SvelteKit hooks handlers.',
- {
- hookClientCode: <code />,
- hookServerCode: <code />,
- sentryInitCode: <code />,
- }
- )}
- </ListItem>
- <ListItem>
- {tct(
- 'Update [code:vite.config.js] to add source maps upload and auto-instrumentation via Vite plugins.',
- {
- code: <code />,
- }
- )}
- </ListItem>
- <ListItem>
- {tct(
- 'Create [sentryClircCode:.sentryclirc] and [sentryPropertiesCode:sentry.properties] files with configuration for sentry-cli (which is used when automatically uploading source maps).',
- {
- sentryClircCode: <code />,
- sentryPropertiesCode: <code />,
- }
- )}
- </ListItem>
- </List>
- <p>
- {tct(
- 'Alternatively, you can also [manualSetupLink:set up the SDK manually].',
- {
- manualSetupLink: (
- <ExternalLink href="https://docs.sentry.io/platforms/javascript/guides/sveltekit/manual-setup/" />
- ),
- }
- )}
- </p>
- </Fragment>
- ),
- },
- ],
- },
- ],
- verify: () => [],
- };
- const replayOnboarding: OnboardingConfig = {
- install: () => getInstallConfig(),
- configure: (params: Params) => [
- {
- type: StepType.CONFIGURE,
- description: getReplayConfigureDescription({
- link: 'https://docs.sentry.io/platforms/javascript/guides/sveltekit/session-replay/',
- }),
- configurations: [
- {
- code: [
- {
- label: 'JavaScript',
- value: 'javascript',
- language: 'javascript',
- code: getReplaySDKSetupSnippet({
- importStatement: `import * as Sentry from "@sentry/sveltekit";`,
- dsn: params.dsn,
- mask: params.replayOptions?.mask,
- block: params.replayOptions?.block,
- }),
- },
- ],
- additionalInfo: <TracePropagationMessage />,
- },
- ],
- },
- ],
- verify: () => [],
- nextSteps: () => [],
- };
- const feedbackOnboarding: OnboardingConfig = {
- install: () => [
- {
- type: StepType.INSTALL,
- description: tct(
- 'For the User Feedback integration to work, you must have the Sentry browser SDK package, or an equivalent framework SDK (e.g. [code:@sentry/sveltekit]) installed, minimum version 7.85.0.',
- {
- code: <code />,
- }
- ),
- configurations: getInstallConfig(),
- },
- ],
- configure: (params: Params) => [
- {
- type: StepType.CONFIGURE,
- description: getFeedbackConfigureDescription({
- linkConfig:
- 'https://docs.sentry.io/platforms/javascript/guides/sveltekit/user-feedback/configuration/',
- linkButton:
- 'https://docs.sentry.io/platforms/javascript/guides/sveltekit/user-feedback/configuration/#bring-your-own-button',
- }),
- configurations: [
- {
- code: [
- {
- label: 'JavaScript',
- value: 'javascript',
- language: 'javascript',
- code: getFeedbackSDKSetupSnippet({
- importStatement: `import * as Sentry from "@sentry/sveltekit";`,
- dsn: params.dsn,
- feedbackOptions: params.feedbackOptions,
- }),
- },
- ],
- },
- ],
- additionalInfo: crashReportCallout({
- link: 'https://docs.sentry.io/platforms/javascript/guides/sveltekit/user-feedback/#crash-report-modal',
- }),
- },
- ],
- verify: () => [],
- nextSteps: () => [],
- };
- const crashReportOnboarding: OnboardingConfig = {
- introduction: () => getCrashReportModalIntroduction(),
- install: (params: Params) => getCrashReportJavaScriptInstallStep(params),
- configure: () => [
- {
- type: StepType.CONFIGURE,
- description: getCrashReportModalConfigDescription({
- link: 'https://docs.sentry.io/platforms/javascript/guides/sveltekit/user-feedback/configuration/#crash-report-modal',
- }),
- additionalInfo: widgetCallout({
- link: 'https://docs.sentry.io/platforms/javascript/guides/sveltekit/user-feedback/#user-feedback-widget',
- }),
- },
- ],
- verify: () => [],
- nextSteps: () => [],
- };
- const docs: Docs = {
- onboarding,
- feedbackOnboardingNpm: feedbackOnboarding,
- replayOnboardingNpm: replayOnboarding,
- customMetricsOnboarding: getJSMetricsOnboarding({getInstallConfig}),
- crashReportOnboarding,
- };
- export default docs;
|