remix.tsx 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257
  1. import {Fragment} from 'react';
  2. import ExternalLink from 'sentry/components/links/externalLink';
  3. import List from 'sentry/components/list';
  4. import ListItem from 'sentry/components/list/listItem';
  5. import crashReportCallout from 'sentry/components/onboarding/gettingStartedDoc/feedback/crashReportCallout';
  6. import widgetCallout from 'sentry/components/onboarding/gettingStartedDoc/feedback/widgetCallout';
  7. import TracePropagationMessage from 'sentry/components/onboarding/gettingStartedDoc/replay/tracePropagationMessage';
  8. import {StepType} from 'sentry/components/onboarding/gettingStartedDoc/step';
  9. import type {
  10. Docs,
  11. DocsParams,
  12. OnboardingConfig,
  13. } from 'sentry/components/onboarding/gettingStartedDoc/types';
  14. import {
  15. getCrashReportJavaScriptInstallStep,
  16. getCrashReportModalConfigDescription,
  17. getCrashReportModalIntroduction,
  18. getFeedbackConfigureDescription,
  19. getFeedbackSDKSetupSnippet,
  20. } from 'sentry/components/onboarding/gettingStartedDoc/utils/feedbackOnboarding';
  21. import {getJSMetricsOnboarding} from 'sentry/components/onboarding/gettingStartedDoc/utils/metricsOnboarding';
  22. import {
  23. getReplayConfigureDescription,
  24. getReplaySDKSetupSnippet,
  25. } from 'sentry/components/onboarding/gettingStartedDoc/utils/replayOnboarding';
  26. import {t, tct} from 'sentry/locale';
  27. type Params = DocsParams;
  28. const getConfigStep = () => [
  29. {
  30. description: tct(
  31. 'Configure your app automatically with the [wizardLink:Sentry wizard].',
  32. {
  33. wizardLink: (
  34. <ExternalLink href="https://docs.sentry.io/platforms/javascript/guides/remix/#install" />
  35. ),
  36. }
  37. ),
  38. language: 'bash',
  39. code: `npx @sentry/wizard@latest -i remix`,
  40. },
  41. ];
  42. const getInstallConfig = () => [
  43. {
  44. type: StepType.INSTALL,
  45. configurations: getConfigStep(),
  46. },
  47. ];
  48. const onboarding: OnboardingConfig = {
  49. introduction: () =>
  50. tct("Sentry's integration with [remixLink:Remix] supports Remix 1.0.0 and above.", {
  51. remixLink: <ExternalLink href="https://remix.run/" />,
  52. }),
  53. install: () => getInstallConfig(),
  54. configure: () => [
  55. {
  56. type: StepType.CONFIGURE,
  57. description: t(
  58. 'The Sentry wizard will automatically add code to your project to inialize and configure the Sentry SDK:'
  59. ),
  60. configurations: [
  61. {
  62. description: (
  63. <List symbol="bullet">
  64. <ListItem>
  65. {tct(
  66. "Create two files in the root directory of your project, [clientEntry:entry.client.tsx] and [serverEntry:entry.server.tsx] (if they don't already exist).",
  67. {
  68. clientEntry: <code />,
  69. serverEntry: <code />,
  70. }
  71. )}
  72. </ListItem>
  73. <ListItem>
  74. {tct(
  75. 'Add the default [sentryInitCode:Sentry.init] call to both, client and server entry files.',
  76. {
  77. sentryInitCode: <code />,
  78. }
  79. )}
  80. </ListItem>
  81. <ListItem>
  82. {tct(
  83. 'Create a [cliRc:.sentryclirc] with an auth token to upload source maps (this file is automatically added to your [gitignore:.gitignore]).',
  84. {
  85. cliRc: <code />,
  86. gitignore: <code />,
  87. }
  88. )}
  89. </ListItem>
  90. <ListItem>
  91. {tct(
  92. 'Adjust your [buildscript:build] script in your [pkgJson:package.json] to automatically upload source maps to Sentry when you build your application.',
  93. {
  94. buildscript: <code />,
  95. pkgJson: <code />,
  96. }
  97. )}
  98. </ListItem>
  99. </List>
  100. ),
  101. },
  102. {
  103. description: tct(
  104. 'You can also further [manualConfigure:configure your SDK] or [manualSetupLink:set it up manually], without the wizard.',
  105. {
  106. manualConfigure: (
  107. <ExternalLink href="https://docs.sentry.io/platforms/javascript/guides/remix/manual-setup/#configuration" />
  108. ),
  109. manualSetupLink: (
  110. <ExternalLink href="https://docs.sentry.io/platforms/javascript/guides/remix/manual-setup/" />
  111. ),
  112. }
  113. ),
  114. },
  115. ],
  116. },
  117. ],
  118. verify: () => [],
  119. nextSteps: () => [
  120. {
  121. id: 'performance-monitoring',
  122. name: t('Performance Monitoring'),
  123. description: t(
  124. 'Track down transactions to connect the dots between 10-second page loads and poor-performing API calls or slow database queries.'
  125. ),
  126. link: 'https://docs.sentry.io/platforms/javascript/guides/remix/tracing/',
  127. },
  128. {
  129. id: 'session-replay',
  130. name: t('Session Replay'),
  131. description: t(
  132. 'Get to the root cause of an error or latency issue faster by seeing all the technical details related to that issue in one visual replay on your web application.'
  133. ),
  134. link: 'https://docs.sentry.io/platforms/javascript/guides/remix/session-replay/',
  135. },
  136. ],
  137. };
  138. const replayOnboarding: OnboardingConfig = {
  139. install: () => getInstallConfig(),
  140. configure: (params: Params) => [
  141. {
  142. type: StepType.CONFIGURE,
  143. description: getReplayConfigureDescription({
  144. link: 'https://docs.sentry.io/platforms/javascript/guides/remix/session-replay/',
  145. }),
  146. configurations: [
  147. {
  148. code: [
  149. {
  150. label: 'JavaScript',
  151. value: 'javascript',
  152. language: 'javascript',
  153. code: getReplaySDKSetupSnippet({
  154. importStatement: `import * as Sentry from "@sentry/remix";`,
  155. dsn: params.dsn,
  156. mask: params.replayOptions?.mask,
  157. block: params.replayOptions?.block,
  158. }),
  159. },
  160. ],
  161. },
  162. ],
  163. additionalInfo: (
  164. <Fragment>
  165. <TracePropagationMessage />
  166. {tct(
  167. 'Note: The Replay integration only needs to be added to your [entryClient:entry.client.tsx] file. It will not run if it is added into [sentryServer:sentry.server.config.js].',
  168. {entryClient: <code />, sentryServer: <code />}
  169. )}
  170. </Fragment>
  171. ),
  172. },
  173. ],
  174. verify: () => [],
  175. nextSteps: () => [],
  176. };
  177. const feedbackOnboarding: OnboardingConfig = {
  178. install: () => [
  179. {
  180. type: StepType.INSTALL,
  181. description: tct(
  182. '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.',
  183. {
  184. code: <code />,
  185. }
  186. ),
  187. configurations: getConfigStep(),
  188. },
  189. ],
  190. configure: (params: Params) => [
  191. {
  192. type: StepType.CONFIGURE,
  193. description: getFeedbackConfigureDescription({
  194. linkConfig:
  195. 'https://docs.sentry.io/platforms/javascript/guides/remix/user-feedback/configuration/',
  196. linkButton:
  197. 'https://docs.sentry.io/platforms/javascript/guides/remix/user-feedback/configuration/#bring-your-own-button',
  198. }),
  199. configurations: [
  200. {
  201. code: [
  202. {
  203. label: 'JavaScript',
  204. value: 'javascript',
  205. language: 'javascript',
  206. code: getFeedbackSDKSetupSnippet({
  207. importStatement: `import * as Sentry from "@sentry/remix";`,
  208. dsn: params.dsn,
  209. feedbackOptions: params.feedbackOptions,
  210. }),
  211. },
  212. ],
  213. },
  214. ],
  215. additionalInfo: crashReportCallout({
  216. link: 'https://docs.sentry.io/platforms/javascript/guides/remix/user-feedback/#user-feedback-api',
  217. }),
  218. },
  219. ],
  220. verify: () => [],
  221. nextSteps: () => [],
  222. };
  223. const crashReportOnboarding: OnboardingConfig = {
  224. introduction: () => getCrashReportModalIntroduction(),
  225. install: (params: Params) => getCrashReportJavaScriptInstallStep(params),
  226. configure: () => [
  227. {
  228. type: StepType.CONFIGURE,
  229. description: getCrashReportModalConfigDescription({
  230. link: 'https://docs.sentry.io/platforms/javascript/guides/remix/user-feedback/configuration/#crash-report-modal',
  231. }),
  232. additionalInfo: widgetCallout({
  233. link: 'https://docs.sentry.io/platforms/javascript/guides/remix/user-feedback/#user-feedback-widget',
  234. }),
  235. },
  236. ],
  237. verify: () => [],
  238. nextSteps: () => [],
  239. };
  240. const docs: Docs = {
  241. onboarding,
  242. feedbackOnboardingNpm: feedbackOnboarding,
  243. replayOnboardingNpm: replayOnboarding,
  244. customMetricsOnboarding: getJSMetricsOnboarding({getInstallConfig}),
  245. crashReportOnboarding,
  246. };
  247. export default docs;