123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270 |
- 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 {MaybeBrowserProfilingBetaWarning} from 'sentry/components/onboarding/gettingStartedDoc/utils/profilingOnboarding';
- import {
- getReplayConfigureDescription,
- getReplaySDKSetupSnippet,
- getReplayVerifyStep,
- } from 'sentry/components/onboarding/gettingStartedDoc/utils/replayOnboarding';
- import {featureFlagOnboarding} from 'sentry/gettingStartedDocs/javascript/javascript';
- import {t, tct, tctCode} from 'sentry/locale';
- type Params = DocsParams;
- const getConfigStep = ({isSelfHosted, organization, projectSlug}: Params) => {
- const urlParam = isSelfHosted ? '--saas' : '--saas';
- return [
- {
- type: StepType.INSTALL,
- description: tct(
- 'Configure your app automatically by running the [wizardLink:Sentry wizard] in the root of your project.',
- {
- wizardLink: (
- <ExternalLink href="https://docs.sentry.io/platforms/javascript/guides/nuxt/#install" />
- ),
- }
- ),
- configurations: [
- {
- language: 'bash',
- code: `npx @sentry/wizard@latest -i nuxt ${urlParam} --org ${organization.slug} --project ${projectSlug}`,
- },
- ],
- },
- ];
- };
- const getInstallConfig = (params: Params) => [
- {
- type: StepType.INSTALL,
- configurations: getConfigStep(params),
- },
- ];
- const getVerifyNuxtSnippet = () => `
- <script setup>
- const triggerError = () => {
- throw new Error("Nuxt Button Error");
- };
- </script>
- <template>
- <button id="errorBtn" @click="triggerError">Trigger Error</button>
- </template>`;
- const onboarding: OnboardingConfig = {
- install: (params: Params) => [
- {
- title: t('Automatic Configuration (Recommended)'),
- configurations: getConfigStep(params),
- },
- ],
- configure: () => [
- {
- title: t('Manual Configuration'),
- collapsible: true,
- description: tct(
- 'Alternatively, you can also [manualSetupLink:set up the SDK manually], by following these steps:',
- {
- manualSetupLink: (
- <ExternalLink href="https://docs.sentry.io/platforms/javascript/guides/nuxt/manual-setup/" />
- ),
- }
- ),
- configurations: [
- {
- description: (
- <List symbol="bullet">
- <ListItem>
- {tctCode('Add [code:@sentry/nuxt/module] to your [code:nuxt.config.ts].')}
- </ListItem>
- <ListItem>
- {tctCode(
- 'Create or update [code:sentry.client.config.ts] and [code:sentry.server.config.ts] with the default [code:Sentry.init] call.'
- )}
- </ListItem>
- <ListItem>
- {tctCode(
- 'Configure source maps upload options in your [code:nuxt.config.ts].'
- )}
- </ListItem>
- </List>
- ),
- },
- ],
- },
- ],
- verify: () => [
- {
- type: StepType.VERIFY,
- description: (
- <Fragment>
- <p>
- {tctCode(
- 'Build and run your application and visit [code:/sentry-example-page] if you have set it up. Click the button to trigger a test error.'
- )}
- </p>
- <p>{t('Or, throw an error in a simple vue component.')}</p>
- </Fragment>
- ),
- configurations: [
- {
- code: [
- {
- label: 'Vue',
- value: 'vue',
- language: 'html',
- code: getVerifyNuxtSnippet(),
- },
- ],
- },
- ],
- additionalInfo: t(
- 'If you see an issue in your Sentry dashboard, you have successfully set up Sentry.'
- ),
- },
- ],
- nextSteps: () => [
- {
- id: 'nuxt-features',
- name: t('Nuxt Features'),
- description: t('Learn about our first class integration with the Nuxt framework.'),
- link: 'https://docs.sentry.io/platforms/javascript/guides/nuxt/features/',
- },
- ],
- };
- const replayOnboarding: OnboardingConfig = {
- install: (params: Params) => getInstallConfig(params),
- configure: (params: Params) => [
- {
- type: StepType.INSTALL,
- description: getReplayConfigureDescription({
- link: 'https://docs.sentry.io/platforms/javascript/guides/nuxt/session-replay/',
- }),
- configurations: [
- {
- code: [
- {
- label: 'JavaScript',
- value: 'javascript',
- language: 'javascript',
- code: getReplaySDKSetupSnippet({
- importStatement: `import * as Sentry from "@sentry/nuxt";`,
- dsn: params.dsn.public,
- mask: params.replayOptions?.mask,
- block: params.replayOptions?.block,
- }),
- },
- ],
- },
- ],
- additionalInfo: <TracePropagationMessage />,
- },
- ],
- verify: getReplayVerifyStep(),
- nextSteps: () => [],
- };
- const feedbackOnboarding: OnboardingConfig = {
- install: (params: Params) => [
- {
- 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/nuxt]) installed, minimum version 7.85.0.',
- {
- code: <code />,
- }
- ),
- configurations: getInstallConfig(params),
- },
- ],
- configure: (params: Params) => [
- {
- type: StepType.CONFIGURE,
- description: getFeedbackConfigureDescription({
- linkConfig:
- 'https://docs.sentry.io/platforms/javascript/guides/nuxt/user-feedback/configuration/',
- linkButton:
- 'https://docs.sentry.io/platforms/javascript/guides/nuxt/user-feedback/configuration/#bring-your-own-button',
- }),
- configurations: [
- {
- code: [
- {
- label: 'JavaScript',
- value: 'javascript',
- language: 'javascript',
- code: getFeedbackSDKSetupSnippet({
- importStatement: `import * as Sentry from "@sentry/nuxt";`,
- dsn: params.dsn.public,
- feedbackOptions: params.feedbackOptions,
- }),
- },
- ],
- },
- ],
- additionalInfo: crashReportCallout({
- link: 'https://docs.sentry.io/platforms/javascript/guides/nuxt/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/nuxt/user-feedback/configuration/#crash-report-modal',
- }),
- additionalInfo: widgetCallout({
- link: 'https://docs.sentry.io/platforms/javascript/guides/nuxt/user-feedback/#user-feedback-widget',
- }),
- },
- ],
- verify: () => [],
- nextSteps: () => [],
- };
- const profilingOnboarding: OnboardingConfig = {
- ...onboarding,
- introduction: params => <MaybeBrowserProfilingBetaWarning {...params} />,
- };
- const docs: Docs = {
- onboarding,
- feedbackOnboardingNpm: feedbackOnboarding,
- replayOnboarding,
- customMetricsOnboarding: getJSMetricsOnboarding({getInstallConfig}),
- crashReportOnboarding,
- profilingOnboarding,
- featureFlagOnboarding: featureFlagOnboarding,
- };
- export default docs;
|