Skip to content

Commit b360ead

Browse files
committed
ref(feedback): Create stub integrations for feedback modal & screenshot code ot be broken out of the main integration
1 parent ae84d1a commit b360ead

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

+778
-25
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
@@ -106,6 +106,8 @@ jobs:
106106
- 'packages/replay/**'
107107
- 'packages/replay-canvas/**'
108108
- 'packages/feedback/**'
109+
- 'packages/feedback-modal/**'
110+
- 'packages/feedback-screenshot/**'
109111
- 'packages/wasm/**'
110112
browser_integration:
111113
- *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
@@ -55,6 +55,8 @@
5555
"packages/eslint-config-sdk",
5656
"packages/eslint-plugin-sdk",
5757
"packages/feedback",
58+
"packages/feedback-modal",
59+
"packages/feedback-screenshot",
5860
"packages/gatsby",
5961
"packages/google-cloud-serverless",
6062
"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/feedback": "8.0.0-alpha.7",
46+
"@sentry-internal/feedback-modal": "8.0.0-alpha.7",
47+
"@sentry-internal/feedback-screenshot": "8.0.0-alpha.7",
4648
"@sentry-internal/replay": "8.0.0-alpha.7",
4749
"@sentry-internal/replay-canvas": "8.0.0-alpha.7",
4850
"@sentry-internal/tracing": "8.0.0-alpha.7",

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
// This is exported so the loader does not fail when switching off Replay/Tracing
2+
23
import { feedbackIntegration, getFeedback } from '@sentry-internal/feedback';
4+
import { feedbackModalIntegration } from '@sentry-internal/feedback-modal';
5+
import { feedbackScreenshotIntegration } from '@sentry-internal/feedback-screenshot';
36
import {
47
addTracingExtensionsShim,
58
browserTracingIntegrationShim,
@@ -12,6 +15,8 @@ export {
1215
addTracingExtensionsShim as addTracingExtensions,
1316
replayIntegrationShim as replayIntegration,
1417
feedbackIntegration,
18+
feedbackModalIntegration,
19+
feedbackScreenshotIntegration,
1520
getFeedback,
1621
};
1722
// 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
@@ -1,4 +1,6 @@
11
import { feedbackIntegration, getFeedback } from '@sentry-internal/feedback';
2+
import { feedbackModalIntegration } from '@sentry-internal/feedback-modal';
3+
import { feedbackScreenshotIntegration } from '@sentry-internal/feedback-screenshot';
24
import { replayIntegration } from '@sentry-internal/replay';
35
import {
46
browserTracingIntegration,
@@ -22,6 +24,8 @@ export {
2224

2325
export {
2426
feedbackIntegration,
27+
feedbackModalIntegration,
28+
feedbackScreenshotIntegration,
2529
replayIntegration,
2630
browserTracingIntegration,
2731
addTracingExtensions,

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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
import { feedbackIntegrationShim } from '@sentry-internal/integration-shims';
1+
import {
2+
feedbackIntegrationShim,
3+
feedbackModalIntegrationShim,
4+
feedbackScreenshotIntegrationShim,
5+
} from '@sentry-internal/integration-shims';
26
import { replayIntegration } from '@sentry-internal/replay';
37
import {
48
browserTracingIntegration,
@@ -23,6 +27,8 @@ export {
2327
export {
2428
replayIntegration,
2529
feedbackIntegrationShim as feedbackIntegration,
30+
feedbackModalIntegrationShim as feedbackModalIntegration,
31+
feedbackScreenshotIntegrationShim as feedbackScreenshotIntegration,
2632
browserTracingIntegration,
2733
addTracingExtensions,
2834
startBrowserTracingNavigationSpan,

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

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
// This is exported so the loader does not fail when switching off Replay
2-
import { feedbackIntegrationShim, replayIntegrationShim } from '@sentry-internal/integration-shims';
2+
import {
3+
feedbackIntegrationShim,
4+
feedbackModalIntegrationShim,
5+
feedbackScreenshotIntegrationShim,
6+
replayIntegrationShim,
7+
} from '@sentry-internal/integration-shims';
38
import {
49
browserTracingIntegration,
510
startBrowserTracingNavigationSpan,
@@ -22,6 +27,8 @@ export {
2227

2328
export {
2429
feedbackIntegrationShim as feedbackIntegration,
30+
feedbackModalIntegrationShim as feedbackModalIntegration,
31+
feedbackScreenshotIntegrationShim as feedbackScreenshotIntegration,
2532
replayIntegrationShim as replayIntegration,
2633
browserTracingIntegration,
2734
addTracingExtensions,

packages/browser/src/index.bundle.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
replayIntegrationShim,
79
} from '@sentry-internal/integration-shims';
810

@@ -11,6 +13,8 @@ export {
1113
addTracingExtensionsShim as addTracingExtensions,
1214
browserTracingIntegrationShim as browserTracingIntegration,
1315
feedbackIntegrationShim as feedbackIntegration,
16+
feedbackModalIntegrationShim as feedbackModalIntegration,
17+
feedbackScreenshotIntegrationShim as feedbackScreenshotIntegration,
1418
replayIntegrationShim as replayIntegration,
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.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ export {
5252
getFeedback,
5353
sendFeedback,
5454
} from '@sentry-internal/feedback';
55+
export { feedbackModalIntegration } from '@sentry-internal/feedback-modal';
56+
export { feedbackScreenshotIntegration } from '@sentry-internal/feedback-screenshot';
5557

5658
export {
5759
defaultRequestInstrumentationOptions,
Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
11
import { replayIntegrationShim } from '@sentry-internal/integration-shims';
2-
import { feedbackIntegration } from '@sentry/browser';
2+
import { feedbackIntegration, feedbackModalIntegration, feedbackScreenshotIntegration } from '@sentry/browser';
33

4-
import * as TracingReplayBundle from '../../src/index.bundle.feedback';
4+
import * as FeedbackBundle from '../../src/index.bundle.feedback';
55

66
describe('index.bundle.feedback', () => {
77
it('has correct exports', () => {
8-
Object.keys(TracingReplayBundle.Integrations).forEach(key => {
9-
expect((TracingReplayBundle.Integrations[key] as any).id).toStrictEqual(expect.any(String));
8+
Object.keys(FeedbackBundle.Integrations).forEach(key => {
9+
expect((FeedbackBundle.Integrations[key] as any).id).toStrictEqual(expect.any(String));
1010
});
1111

12-
expect(TracingReplayBundle.replayIntegration).toBe(replayIntegrationShim);
13-
expect(TracingReplayBundle.feedbackIntegration).toBe(feedbackIntegration);
12+
expect(FeedbackBundle.replayIntegration).toBe(replayIntegrationShim);
13+
expect(FeedbackBundle.feedbackIntegration).toBe(feedbackIntegration);
14+
expect(FeedbackBundle.feedbackModalIntegration).toBe(feedbackModalIntegration);
15+
expect(FeedbackBundle.feedbackScreenshotIntegration).toBe(feedbackScreenshotIntegration);
1416
});
1517
});
Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,21 @@
1-
import { feedbackIntegrationShim } from '@sentry-internal/integration-shims';
1+
import {
2+
feedbackIntegrationShim,
3+
feedbackModalIntegrationShim,
4+
feedbackScreenshotIntegrationShim,
5+
} from '@sentry-internal/integration-shims';
26
import { replayIntegration } from '@sentry/browser';
37

4-
import * as TracingReplayBundle from '../../src/index.bundle.replay';
8+
import * as ReplayBundle from '../../src/index.bundle.replay';
59

610
describe('index.bundle.replay', () => {
711
it('has correct exports', () => {
8-
Object.keys(TracingReplayBundle.Integrations).forEach(key => {
9-
expect((TracingReplayBundle.Integrations[key] as any).id).toStrictEqual(expect.any(String));
12+
Object.keys(ReplayBundle.Integrations).forEach(key => {
13+
expect((ReplayBundle.Integrations[key] as any).id).toStrictEqual(expect.any(String));
1014
});
1115

12-
expect(TracingReplayBundle.replayIntegration).toBe(replayIntegration);
13-
expect(TracingReplayBundle.feedbackIntegration).toBe(feedbackIntegrationShim);
16+
expect(ReplayBundle.replayIntegration).toBe(replayIntegration);
17+
expect(ReplayBundle.feedbackIntegration).toBe(feedbackIntegrationShim);
18+
expect(ReplayBundle.feedbackModalIntegration).toBe(feedbackModalIntegrationShim);
19+
expect(ReplayBundle.feedbackScreenshotIntegration).toBe(feedbackScreenshotIntegrationShim);
1420
});
1521
});
Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,21 @@
1-
import { feedbackIntegrationShim, replayIntegrationShim } from '@sentry-internal/integration-shims';
1+
import {
2+
feedbackIntegrationShim,
3+
feedbackModalIntegrationShim,
4+
feedbackScreenshotIntegrationShim,
5+
replayIntegrationShim,
6+
} from '@sentry-internal/integration-shims';
27

3-
import * as TracingBundle from '../../src/index.bundle';
8+
import * as Bundle from '../../src/index.bundle';
49

510
describe('index.bundle', () => {
611
it('has correct exports', () => {
7-
Object.keys(TracingBundle.Integrations).forEach(key => {
8-
expect((TracingBundle.Integrations[key] as any).name).toStrictEqual(expect.any(String));
12+
Object.keys(Bundle.Integrations).forEach(key => {
13+
expect((Bundle.Integrations[key] as any).name).toStrictEqual(expect.any(String));
914
});
1015

11-
expect(TracingBundle.replayIntegration).toBe(replayIntegrationShim);
12-
expect(TracingBundle.feedbackIntegration).toBe(feedbackIntegrationShim);
16+
expect(Bundle.replayIntegration).toBe(replayIntegrationShim);
17+
expect(Bundle.feedbackIntegration).toBe(feedbackIntegrationShim);
18+
expect(Bundle.feedbackModalIntegration).toBe(feedbackModalIntegrationShim);
19+
expect(Bundle.feedbackScreenshotIntegration).toBe(feedbackScreenshotIntegrationShim);
1320
});
1421
});

packages/browser/test/unit/index.bundle.tracing.replay.feedback.test.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
import { browserTracingIntegration } from '@sentry-internal/tracing';
2-
import { feedbackIntegration, replayIntegration } from '@sentry/browser';
2+
import {
3+
feedbackIntegration,
4+
feedbackModalIntegration,
5+
feedbackScreenshotIntegration,
6+
replayIntegration,
7+
} from '@sentry/browser';
38

49
import * as TracingReplayFeedbackBundle from '../../src/index.bundle.tracing.replay.feedback';
510

@@ -12,5 +17,7 @@ describe('index.bundle.tracing.replay.feedback', () => {
1217
expect(TracingReplayFeedbackBundle.replayIntegration).toBe(replayIntegration);
1318
expect(TracingReplayFeedbackBundle.browserTracingIntegration).toBe(browserTracingIntegration);
1419
expect(TracingReplayFeedbackBundle.feedbackIntegration).toBe(feedbackIntegration);
20+
expect(TracingReplayFeedbackBundle.feedbackModalIntegration).toBe(feedbackModalIntegration);
21+
expect(TracingReplayFeedbackBundle.feedbackScreenshotIntegration).toBe(feedbackScreenshotIntegration);
1522
});
1623
});

packages/browser/test/unit/index.bundle.tracing.replay.test.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
import { feedbackIntegrationShim } from '@sentry-internal/integration-shims';
1+
import {
2+
feedbackIntegrationShim,
3+
feedbackModalIntegrationShim,
4+
feedbackScreenshotIntegrationShim,
5+
} from '@sentry-internal/integration-shims';
26
import { browserTracingIntegration } from '@sentry-internal/tracing';
37
import { replayIntegration } from '@sentry/browser';
48

@@ -15,5 +19,7 @@ describe('index.bundle.tracing.replay', () => {
1519
expect(TracingReplayBundle.browserTracingIntegration).toBe(browserTracingIntegration);
1620

1721
expect(TracingReplayBundle.feedbackIntegration).toBe(feedbackIntegrationShim);
22+
expect(TracingReplayBundle.feedbackModalIntegration).toBe(feedbackModalIntegrationShim);
23+
expect(TracingReplayBundle.feedbackScreenshotIntegration).toBe(feedbackScreenshotIntegrationShim);
1824
});
1925
});

packages/browser/test/unit/index.bundle.tracing.test.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
1-
import { feedbackIntegrationShim, replayIntegrationShim } from '@sentry-internal/integration-shims';
1+
import {
2+
feedbackIntegrationShim,
3+
feedbackModalIntegrationShim,
4+
feedbackScreenshotIntegrationShim,
5+
replayIntegrationShim,
6+
} from '@sentry-internal/integration-shims';
27
import { browserTracingIntegration } from '@sentry-internal/tracing';
38

49
import * as TracingBundle from '../../src/index.bundle.tracing';
@@ -12,5 +17,7 @@ describe('index.bundle.tracing', () => {
1217
expect(TracingBundle.replayIntegration).toBe(replayIntegrationShim);
1318
expect(TracingBundle.browserTracingIntegration).toBe(browserTracingIntegration);
1419
expect(TracingBundle.feedbackIntegration).toBe(feedbackIntegrationShim);
20+
expect(TracingBundle.feedbackModalIntegration).toBe(feedbackModalIntegrationShim);
21+
expect(TracingBundle.feedbackScreenshotIntegration).toBe(feedbackScreenshotIntegrationShim);
1522
});
1623
});

packages/feedback-modal/.eslintignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
node_modules/
2+
build/

packages/feedback-modal/.eslintrc.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// Note: All paths are relative to the directory in which eslint is being run, rather than the directory where this file
2+
// lives
3+
4+
// ESLint config docs: https://eslint.org/docs/user-guide/configuring/
5+
6+
module.exports = {
7+
extends: ['../../.eslintrc.js'],
8+
overrides: [
9+
{
10+
files: ['jest.setup.ts', 'jest.config.ts'],
11+
parserOptions: {
12+
project: ['tsconfig.test.json'],
13+
},
14+
},
15+
],
16+
};

packages/feedback-modal/.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
node_modules
2+
/*.tgz
3+
.eslintcache
4+
build

packages/feedback-modal/LICENSE

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
Copyright (c) 2023 Sentry (https://sentry.io) and individual contributors. All rights reserved.
2+
3+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
4+
documentation files (the "Software"), to deal in the Software without restriction, including without limitation the
5+
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit
6+
persons to whom the Software is furnished to do so, subject to the following conditions:
7+
8+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the
9+
Software.
10+
11+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
12+
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
13+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
14+
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

packages/feedback-modal/README.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<p align="center">
2+
<a href="https://sentry.io/?utm_source=github&utm_medium=logo" target="_blank">
3+
<img src="https://sentry-brand.storage.googleapis.com/sentry-wordmark-dark-280x84.png" alt="Sentry" width="280" height="84">
4+
</a>
5+
</p>
6+
7+
# Sentry Integration for Feedback
8+
9+
This SDK is **considered experimental and in a beta state**. It may experience breaking changes, and may be discontinued
10+
at any time. Please reach out on [GitHub](https://github.com/getsentry/sentry-javascript/issues/new/choose) if you have
11+
any feedback/concerns.
12+
13+
To view Feedback in Sentry, your
14+
[Sentry organization must be an early adopter](https://docs.sentry.io/product/accounts/early-adopter-features/).
15+
16+
## Installation
17+
18+
Please read the [offical integration documentation](https://docs.sentry.io/platforms/javascript/user-feedback/) for
19+
installation instructions.
20+
21+
## Configuration
22+
23+
The Feedback integration is highly customizable, please read the
24+
[official integration documentation](https://docs.sentry.io/platforms/javascript/user-feedback/configuration/) for the
25+
most up-to-date configuration options.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
const baseConfig = require('../../jest/jest.config.js');
2+
3+
module.exports = {
4+
...baseConfig,
5+
testEnvironment: 'jsdom',
6+
};

0 commit comments

Comments
 (0)