Skip to content

Commit 5542127

Browse files
authored
ref(feedback): Create stub integrations for feedback modal & screenshot integrations (#11342)
We're planning to split up the modal and screenshot functionality of the feedback widget into their own integrations, so they can be loaded async if folks want to do that. Loading async would have the benefit that the code is only needed when the user interacts with the feedback widget, and we're actually going to render the modal whether that be with or without the screenshot input/editor. This PR sets up some stubs for where the code will live. There's a bunch of boilerplate for the new integrations inside packages/* and also lots of exports to setup so that the stubs are available to be imported into apps. Currently if someone wanted to setup feedback with screenshots they would be doing: ```javascript import * as Sentry from "@sentry/browser"; import {feedbackIntegration, feedbackModalIntegration, feedbackScreenshotIntegration} from '@sentry-internal/feedback'; ... integrations: [ feedbackIntegration(), feedbackModalIntegration(), feedbackScreenshotIntegration(), ] ``` **After this PR people will keep doing that.** In a followup PR we'll move the implementation from `@sentry-internal/feedback` into the new `@sentry-internal/feedback-modal` and `@sentry-internal/feedback-screenshot`, so people will be able to do this instead: ```diff import * as Sentry from "@sentry/browser"; - import {feedbackIntegration, feedbackModalIntegration, feedbackScreenshotIntegration} from '@sentry-internal/feedback'; + import {feedbackIntegration} from '@sentry-internal/feedback'; + import {feedbackModalIntegration} from '@sentry-internal/feedback-modal'; + import {feedbackScreenshotIntegration} from '@sentry-internal/feedback-screenshot'; ... integrations: [ feedbackIntegration(), feedbackModalIntegration(), feedbackScreenshotIntegration(), ] ``` Equally valid, is people will be able to import everything from `@sentry/browser` too, ie `import * as Sentry from "@sentry/browser";` with `Sentry.feedbackScreenshotIntegration()` Related to #11435
1 parent db18496 commit 5542127

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+749
-19
lines changed

.craft.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,15 @@ targets:
3232
- name: npm
3333
id: '@sentry-internal/feedback'
3434
includeNames: /^sentry-internal-feedback-\d.*\.tgz$/
35-
## 1.8 ReplayCanvas package (browser only)
35+
## 1.8 Feedback Modal package (browser only)
36+
- name: npm
37+
id: '@sentry-internal/feedback-modal'
38+
includeNames: /^sentry-internal-feedback-modal-\d.*\.tgz$/
39+
## 1.9 Feedback Screenshot package (browser only)
40+
- name: npm
41+
id: '@sentry-internal/feedback-screenshot'
42+
includeNames: /^sentry-internal-feedback-screenshot-\d.*\.tgz$/
43+
## 1.10 ReplayCanvas package (browser only)
3644
- name: npm
3745
id: '@sentry-internal/replay-canvas'
3846
includeNames: /^sentry-internal-replay-canvas-\d.*\.tgz$/

.github/workflows/build.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,8 @@ jobs:
105105
- 'packages/replay/**'
106106
- 'packages/replay-canvas/**'
107107
- 'packages/feedback/**'
108+
- 'packages/feedback-modal/**'
109+
- 'packages/feedback-screenshot/**'
108110
- 'packages/wasm/**'
109111
browser_integration:
110112
- *shared

CODEOWNERS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,6 @@ packages/replay @getsentry/replay-sdk-web
22
packages/replay-worker @getsentry/replay-sdk-web
33
packages/replay-canvas @getsentry/replay-sdk-web
44
packages/feedback @getsentry/replay-sdk-web
5+
packages/feedback-modal @getsentry/replay-sdk-web
6+
packages/feedback-screenshot @getsentry/replay-sdk-web
57
dev-packages/browser-integration-tests/suites/replay @getsentry/replay-sdk-web

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@
5656
"packages/eslint-config-sdk",
5757
"packages/eslint-plugin-sdk",
5858
"packages/feedback",
59+
"packages/feedback-modal",
60+
"packages/feedback-screenshot",
5961
"packages/gatsby",
6062
"packages/google-cloud-serverless",
6163
"packages/integration-shims",

packages/browser/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@
4343
},
4444
"dependencies": {
4545
"@sentry-internal/browser-utils": "8.0.0-alpha.9",
46+
"@sentry-internal/feedback-modal": "8.0.0-alpha.9",
47+
"@sentry-internal/feedback-screenshot": "8.0.0-alpha.9",
4648
"@sentry-internal/feedback": "8.0.0-alpha.9",
4749
"@sentry-internal/replay": "8.0.0-alpha.9",
4850
"@sentry-internal/replay-canvas": "8.0.0-alpha.9",

packages/browser/src/index.bundle.feedback.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
// This is exported so the loader does not fail when switching off Replay/Tracing
22
import { feedbackIntegration, getFeedback } from '@sentry-internal/feedback';
3+
import { feedbackModalIntegration } from '@sentry-internal/feedback-modal';
4+
import { feedbackScreenshotIntegration } from '@sentry-internal/feedback-screenshot';
35
import {
46
addTracingExtensionsShim,
57
browserTracingIntegrationShim,
@@ -12,6 +14,8 @@ export {
1214
addTracingExtensionsShim as addTracingExtensions,
1315
replayIntegrationShim as replayIntegration,
1416
feedbackIntegration,
17+
feedbackModalIntegration,
18+
feedbackScreenshotIntegration,
1519
getFeedback,
1620
};
1721
// Note: We do not export a shim for `Span` here, as that is quite complex and would blow up the bundle

packages/browser/src/index.bundle.replay.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ import {
33
addTracingExtensionsShim,
44
browserTracingIntegrationShim,
55
feedbackIntegrationShim,
6+
feedbackModalIntegrationShim,
7+
feedbackScreenshotIntegrationShim,
68
} from '@sentry-internal/integration-shims';
79
import { replayIntegration } from '@sentry-internal/replay';
810

@@ -12,5 +14,7 @@ export {
1214
addTracingExtensionsShim as addTracingExtensions,
1315
replayIntegration,
1416
feedbackIntegrationShim as feedbackIntegration,
17+
feedbackModalIntegrationShim as feedbackModalIntegration,
18+
feedbackScreenshotIntegrationShim as feedbackScreenshotIntegration,
1519
};
1620
// Note: We do not export a shim for `Span` here, as that is quite complex and would blow up the bundle

packages/browser/src/index.bundle.tracing.replay.feedback.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ import {
44
startBrowserTracingPageLoadSpan,
55
} from '@sentry-internal/browser-utils';
66
import { feedbackIntegration, getFeedback } from '@sentry-internal/feedback';
7+
import { feedbackModalIntegration } from '@sentry-internal/feedback-modal';
8+
import { feedbackScreenshotIntegration } from '@sentry-internal/feedback-screenshot';
79
import { replayIntegration } from '@sentry-internal/replay';
810
import { addTracingExtensions } from '@sentry/core';
911

@@ -23,6 +25,8 @@ export {
2325

2426
export {
2527
feedbackIntegration,
28+
feedbackModalIntegration,
29+
feedbackScreenshotIntegration,
2630
replayIntegration,
2731
browserTracingIntegration,
2832
addTracingExtensions,

packages/browser/src/index.bundle.tracing.replay.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,11 @@ import {
33
startBrowserTracingNavigationSpan,
44
startBrowserTracingPageLoadSpan,
55
} from '@sentry-internal/browser-utils';
6-
import { feedbackIntegrationShim } from '@sentry-internal/integration-shims';
6+
import {
7+
feedbackIntegrationShim,
8+
feedbackModalIntegrationShim,
9+
feedbackScreenshotIntegrationShim,
10+
} from '@sentry-internal/integration-shims';
711
import { replayIntegration } from '@sentry-internal/replay';
812
import { addTracingExtensions } from '@sentry/core';
913

@@ -24,6 +28,8 @@ export {
2428
export {
2529
replayIntegration,
2630
feedbackIntegrationShim as feedbackIntegration,
31+
feedbackModalIntegrationShim as feedbackModalIntegration,
32+
feedbackScreenshotIntegrationShim as feedbackScreenshotIntegration,
2733
browserTracingIntegration,
2834
addTracingExtensions,
2935
startBrowserTracingNavigationSpan,

packages/browser/src/index.bundle.tracing.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,12 @@ import {
44
startBrowserTracingPageLoadSpan,
55
} from '@sentry-internal/browser-utils';
66
// This is exported so the loader does not fail when switching off Replay
7-
import { feedbackIntegrationShim, replayIntegrationShim } from '@sentry-internal/integration-shims';
7+
import {
8+
feedbackIntegrationShim,
9+
feedbackModalIntegrationShim,
10+
feedbackScreenshotIntegrationShim,
11+
replayIntegrationShim,
12+
} from '@sentry-internal/integration-shims';
813
import { addTracingExtensions } from '@sentry/core';
914

1015
// We are patching the global object with our hub extension methods
@@ -23,6 +28,8 @@ export {
2328

2429
export {
2530
feedbackIntegrationShim as feedbackIntegration,
31+
feedbackModalIntegrationShim as feedbackModalIntegration,
32+
feedbackScreenshotIntegrationShim as feedbackScreenshotIntegration,
2633
replayIntegrationShim as replayIntegration,
2734
browserTracingIntegration,
2835
addTracingExtensions,

0 commit comments

Comments
 (0)