javascript.tsx 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. import beautify from 'js-beautify';
  2. import {StepType} from 'sentry/components/onboarding/gettingStartedDoc/step';
  3. import {
  4. DocsParams,
  5. OnboardingConfig,
  6. } from 'sentry/components/onboarding/gettingStartedDoc/types';
  7. import {
  8. getReplayConfigureDescription,
  9. getReplayJsLoaderSdkSetupSnippet,
  10. } from 'sentry/components/onboarding/gettingStartedDoc/utils';
  11. import {t} from 'sentry/locale';
  12. type Params = DocsParams;
  13. const getInstallConfig = (params: Params) => [
  14. {
  15. type: StepType.INSTALL,
  16. configurations: [
  17. {
  18. description: t('Add this script tag to the top of the page:'),
  19. language: 'html',
  20. code: beautify.html(
  21. `<script src="${params.cdn}" crossorigin="anonymous"></script>`,
  22. {indent_size: 2, wrap_attributes: 'force-expand-multiline'}
  23. ),
  24. },
  25. ],
  26. },
  27. ];
  28. const replayOnboardingJsLoaderJavascript: OnboardingConfig = {
  29. install: (params: Params) => getInstallConfig(params),
  30. configure: () => [
  31. {
  32. type: StepType.CONFIGURE,
  33. description: getReplayConfigureDescription({
  34. link: 'https://docs.sentry.io/platforms/javascript/session-replay/',
  35. }),
  36. configurations: [
  37. {
  38. language: 'html',
  39. code: getReplayJsLoaderSdkSetupSnippet(),
  40. },
  41. ],
  42. isOptional: true,
  43. },
  44. ],
  45. verify: () => [],
  46. nextSteps: () => [],
  47. };
  48. export default replayOnboardingJsLoaderJavascript;