Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions docs/contributing/pages/placeholders.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
title: Placeholders
noindex: true
---


The following placeholders are available in code blocks and will be replaced at build time:

- `___JS_PACKAGE___`: The current JavaScript package. (e.g. `@sentry/react`)
- `___PUBLIC_DSN___`: The public DSN for a Sentry project. (will display a dropdown of available projects if the user is logged in)

All placeholders are wrapped with **three underscores**.
57 changes: 56 additions & 1 deletion docs/platforms/javascript/common/session-replay/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,62 @@ There is currently no PII scrubbing in canvas recordings!

If you want to record HTML canvas elements, you'll need to add an additional integration in your Sentry configuration. The canvas integration is exported from the browser SDK, so no additional package is required. Canvas recording is opt-in and will be tree-shaken from your bundle if it's not being used:

<PlatformContent includePath="session-replay/setup-canvas" />
<PlatformSection notSupported={["javascript"]}>
```javascript {13}
import * as Sentry from "___JS_PACKAGE___";

Sentry.init({
dsn: "___PUBLIC_DSN___",
replaysSessionSampleRate: 0.1,
replaysOnErrorSampleRate: 1.0,

integrations: [
// Keep the Replay integration as before
Sentry.replayIntegration(),

// The following is all you need to enable canvas recording with Replay
Sentry.replayCanvasIntegration(),
],
});
```
</PlatformSection>

<PlatformSection supported={["javascript"]}>
```javascript {tabTitle: npm} {13}
import * as Sentry from "___JS_PACKAGE___";

Sentry.init({
dsn: "___PUBLIC_DSN___",
replaysSessionSampleRate: 0.1,
replaysOnErrorSampleRate: 1.0,

integrations: [
// Keep the Replay integration as before
Sentry.replayIntegration(),

// The following is all you need to enable canvas recording with Replay
Sentry.replayCanvasIntegration(),
],
});
```

```html {tabTitle: CDN}
<!-- Existing script tag for bundle with replay, error, and tracing -->
<script
src="https://browser.sentry-cdn.com/{{@inject packages.version('sentry.javascript.browser') }}/bundle.tracing.replay.min.js"
integrity="sha384-{{@inject packages.checksum('sentry.javascript.browser', 'bundle.tracing.replay.min.js', 'sha384-base64') }}"
crossorigin="anonymous"
></script>

<!-- New script tag for the canvas replay integration -->
<script
src="https://browser.sentry-cdn.com/{{@inject packages.version('sentry.javascript.browser') }}/replay-canvas.min.js"
integrity="sha384-{{@inject packages.checksum('sentry.javascript.browser', 'replay-canvas.min.js', 'sha384-base64') }}"
crossorigin="anonymous"
></script>
```
</PlatformSection>


#### 3D and WebGL Canvases

Expand Down
2 changes: 1 addition & 1 deletion docs/platforms/javascript/guides/aws-lambda/index.mdx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: AWS Lambda
description: "Learn about Sentry's integration with AWS Lambda."
sdk: sentry.javascript.node
sdk: sentry.javascript.aws-serverless
fallbackGuide: javascript.node
categories:
- serverless
Expand Down
2 changes: 1 addition & 1 deletion docs/platforms/javascript/guides/gcp-functions/index.mdx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: Google Cloud Functions
description: "Learn how to use Sentry's Google Cloud Functions SDK."
sdk: sentry.javascript.node
sdk: sentry.javascript.google-cloud-serverless
fallbackGuide: javascript.node
categories:
- serverless
Expand Down

This file was deleted.

17 changes: 0 additions & 17 deletions platform-includes/session-replay/setup-canvas/javascript.astro.mdx

This file was deleted.

17 changes: 0 additions & 17 deletions platform-includes/session-replay/setup-canvas/javascript.ember.mdx

This file was deleted.

This file was deleted.

34 changes: 0 additions & 34 deletions platform-includes/session-replay/setup-canvas/javascript.mdx

This file was deleted.

This file was deleted.

17 changes: 0 additions & 17 deletions platform-includes/session-replay/setup-canvas/javascript.nuxt.mdx

This file was deleted.

17 changes: 0 additions & 17 deletions platform-includes/session-replay/setup-canvas/javascript.react.mdx

This file was deleted.

17 changes: 0 additions & 17 deletions platform-includes/session-replay/setup-canvas/javascript.remix.mdx

This file was deleted.

This file was deleted.

This file was deleted.

17 changes: 0 additions & 17 deletions platform-includes/session-replay/setup-canvas/javascript.vue.mdx

This file was deleted.

8 changes: 6 additions & 2 deletions src/components/codeBlock/index.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
'use client';

import {useEffect, useRef, useState} from 'react';
import {useContext, useEffect, useRef, useState} from 'react';
import {Clipboard} from 'react-feather';

import styles from './code-blocks.module.scss';

import {CodeContext} from '../codeContext';
import {makeKeywordsClickable} from '../codeKeywords';

export interface CodeBlockProps {
Expand All @@ -17,6 +18,7 @@ export interface CodeBlockProps {
export function CodeBlock({filename, language, children}: CodeBlockProps) {
const [showCopied, setShowCopied] = useState(false);
const codeRef = useRef<HTMLDivElement>(null);
const codeContext = useContext(CodeContext);

// Show the copy button after js has loaded
// otherwise the copy button will not work
Expand Down Expand Up @@ -57,7 +59,9 @@ export function CodeBlock({filename, language, children}: CodeBlockProps) {
<div className={styles.copied} style={{opacity: showCopied ? 1 : 0}}>
Copied
</div>
<div ref={codeRef}>{makeKeywordsClickable(children)}</div>
<div ref={codeRef}>
{makeKeywordsClickable(children, codeContext?.currentJsPackage)}
</div>
</div>
);
}
Loading
Loading