Skip to content

Commit

Permalink
feat(feedback): add gatsby, nextjs, react, remix docs (#65672)
Browse files Browse the repository at this point in the history
npm/yarn done:
- [x] JS
- [x] Angular
- [x] Astro
- [x] Ember
- [x] Gatsby
- [x] Next.js
- [x] React
- [x] Remix

todo:
- [ ] Svelte
- [ ] SvelteKit
- [ ] Vue
- [ ] Capacitor
- [ ] Electron

relates to #62792
  • Loading branch information
michellewzhang authored Feb 23, 2024
1 parent b399327 commit 6c4bdb0
Show file tree
Hide file tree
Showing 4 changed files with 196 additions and 14 deletions.
47 changes: 47 additions & 0 deletions static/app/gettingStartedDocs/javascript/gatsby.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import type {
OnboardingConfig,
} from 'sentry/components/onboarding/gettingStartedDoc/types';
import {
getFeedbackConfigureDescription,
getReplayConfigOptions,
getReplayConfigureDescription,
getUploadSourceMapsStep,
Expand All @@ -27,6 +28,14 @@ Sentry.init({
? `
Sentry.browserTracingIntegration(),`
: ''
}${
params.isFeedbackSelected
? `
Sentry.feedbackIntegration({
// Additional SDK configuration goes in here, for example:
colorScheme: "light",
}),`
: ''
}${
params.isReplaySelected
? `
Expand Down Expand Up @@ -218,8 +227,46 @@ const replayOnboarding: OnboardingConfig = {
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/gatsby]) installed, minimum version 7.85.0.',
{
code: <code />,
}
),
configurations: getInstallConfig(),
},
],
configure: (params: Params) => [
{
type: StepType.CONFIGURE,
description: getFeedbackConfigureDescription({
link: 'https://docs.sentry.io/platforms/javascript/guides/gatsby/user-feedback/',
}),
configurations: [
{
code: [
{
label: 'JavaScript',
value: 'javascript',
language: 'javascript',
code: getSdkSetupSnippet(params),
},
],
},
],
},
],
verify: () => [],
nextSteps: () => [],
};

const docs: Docs = {
onboarding,
feedbackOnboardingNpm: feedbackOnboarding,
replayOnboardingNpm: replayOnboarding,
customMetricsOnboarding: getJSMetricsOnboarding({getInstallConfig}),
};
Expand Down
43 changes: 43 additions & 0 deletions static/app/gettingStartedDocs/javascript/nextjs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ import type {
OnboardingConfig,
} from 'sentry/components/onboarding/gettingStartedDoc/types';
import {
getFeedbackConfigureDescription,
getFeedbackSDKSetupSnippet,
getReplayConfigureDescription,
getReplaySDKSetupSnippet,
} from 'sentry/components/onboarding/gettingStartedDoc/utils';
Expand Down Expand Up @@ -184,8 +186,49 @@ const replayOnboarding: OnboardingConfig = {
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/nextjs]) installed, minimum version 7.85.0.',
{
code: <code />,
}
),
configurations: getInstallConfig(),
},
],
configure: (params: Params) => [
{
type: StepType.CONFIGURE,
description: getFeedbackConfigureDescription({
link: 'https://docs.sentry.io/platforms/javascript/guides/nextjs/user-feedback/',
}),
configurations: [
{
code: [
{
label: 'JavaScript',
value: 'javascript',
language: 'javascript',
code: getFeedbackSDKSetupSnippet({
importStatement: `import * as Sentry from "@sentry/nextjs";`,
dsn: params.dsn,
}),
},
],
},
],
},
],
verify: () => [],
nextSteps: () => [],
};

const docs: Docs = {
onboarding,
feedbackOnboardingNpm: feedbackOnboarding,
replayOnboardingNpm: replayOnboarding,
customMetricsOnboarding: getJSMetricsOnboarding({
getInstallConfig: getManualInstallConfig,
Expand Down
47 changes: 47 additions & 0 deletions static/app/gettingStartedDocs/javascript/react.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import type {
OnboardingConfig,
} from 'sentry/components/onboarding/gettingStartedDoc/types';
import {
getFeedbackConfigureDescription,
getReplayConfigOptions,
getReplayConfigureDescription,
getUploadSourceMapsStep,
Expand All @@ -26,6 +27,14 @@ Sentry.init({
? `
Sentry.browserTracingIntegration(),`
: ''
}${
params.isFeedbackSelected
? `
Sentry.feedbackIntegration({
// Additional SDK configuration goes in here, for example:
colorScheme: "light",
}),`
: ''
}${
params.isReplaySelected
? `
Expand Down Expand Up @@ -210,8 +219,46 @@ const replayOnboarding: OnboardingConfig = {
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/react]) installed, minimum version 7.85.0.',
{
code: <code />,
}
),
configurations: getInstallConfig(),
},
],
configure: (params: Params) => [
{
type: StepType.CONFIGURE,
description: getFeedbackConfigureDescription({
link: 'https://docs.sentry.io/platforms/javascript/guides/react/user-feedback/',
}),
configurations: [
{
code: [
{
label: 'JavaScript',
value: 'javascript',
language: 'javascript',
code: getSdkSetupSnippet(params),
},
],
},
],
},
],
verify: () => [],
nextSteps: () => [],
};

const docs: Docs = {
onboarding,
feedbackOnboardingNpm: feedbackOnboarding,
replayOnboardingNpm: replayOnboarding,
customMetricsOnboarding: getJSMetricsOnboarding({getInstallConfig}),
};
Expand Down
73 changes: 59 additions & 14 deletions static/app/gettingStartedDocs/javascript/remix.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import type {
OnboardingConfig,
} from 'sentry/components/onboarding/gettingStartedDoc/types';
import {
getFeedbackConfigureDescription,
getFeedbackSDKSetupSnippet,
getReplayConfigureDescription,
getReplaySDKSetupSnippet,
} from 'sentry/components/onboarding/gettingStartedDoc/utils';
Expand All @@ -19,23 +21,25 @@ import {t, tct} from 'sentry/locale';

type Params = DocsParams;

const getInstallConfig = () => [
const getConfigStep = () => [
{
type: StepType.INSTALL,
configurations: [
description: tct(
'Configure your app automatically with the [wizardLink:Sentry wizard].',
{
description: tct(
'Configure your app automatically with the [wizardLink:Sentry wizard].',
{
wizardLink: (
<ExternalLink href="https://docs.sentry.io/platforms/javascript/guides/remix/#install" />
),
}
wizardLink: (
<ExternalLink href="https://docs.sentry.io/platforms/javascript/guides/remix/#install" />
),
language: 'bash',
code: `npx @sentry/wizard@latest -i remix`,
},
],
}
),
language: 'bash',
code: `npx @sentry/wizard@latest -i remix`,
},
];

const getInstallConfig = () => [
{
type: StepType.INSTALL,
configurations: getConfigStep(),
},
];

Expand Down Expand Up @@ -170,8 +174,49 @@ const replayOnboarding: OnboardingConfig = {
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/remix]) installed, minimum version 7.85.0.',
{
code: <code />,
}
),
configurations: getConfigStep(),
},
],
configure: (params: Params) => [
{
type: StepType.CONFIGURE,
description: getFeedbackConfigureDescription({
link: 'https://docs.sentry.io/platforms/javascript/guides/remix/user-feedback/',
}),
configurations: [
{
code: [
{
label: 'JavaScript',
value: 'javascript',
language: 'javascript',
code: getFeedbackSDKSetupSnippet({
importStatement: `import * as Sentry from "@sentry/remix";`,
dsn: params.dsn,
}),
},
],
},
],
},
],
verify: () => [],
nextSteps: () => [],
};

const docs: Docs = {
onboarding,
feedbackOnboardingNpm: feedbackOnboarding,
replayOnboardingNpm: replayOnboarding,
customMetricsOnboarding: getJSMetricsOnboarding({getInstallConfig}),
};
Expand Down

0 comments on commit 6c4bdb0

Please sign in to comment.