From 92142c5184bc0e9dc87f1364689101cde50c3611 Mon Sep 17 00:00:00 2001 From: Francesco Novy Date: Thu, 11 Apr 2024 08:50:20 +0200 Subject: [PATCH 01/10] Revert "ref(feedback): Create stub integrations for feedback modal & screenshot integrations (#11342)" This reverts commit 5542127d21e533ae694263d50291857ad08d6f15. --- .craft.yml | 10 +-- .github/workflows/build.yml | 2 - CODEOWNERS | 2 - package.json | 2 - packages/browser/package.json | 2 - packages/browser/src/index.bundle.feedback.ts | 4 - packages/browser/src/index.bundle.replay.ts | 4 - .../index.bundle.tracing.replay.feedback.ts | 4 - .../src/index.bundle.tracing.replay.ts | 8 +- packages/browser/src/index.bundle.tracing.ts | 9 +-- packages/browser/src/index.bundle.ts | 4 - packages/browser/src/index.ts | 2 - .../test/unit/index.bundle.feedback.test.ts | 10 +-- .../test/unit/index.bundle.replay.test.ts | 14 +--- .../browser/test/unit/index.bundle.test.ts | 15 +--- ...dex.bundle.tracing.replay.feedback.test.ts | 9 +-- .../unit/index.bundle.tracing.replay.test.ts | 8 +- .../test/unit/index.bundle.tracing.test.ts | 9 +-- packages/feedback-modal/.eslintignore | 2 - packages/feedback-modal/.eslintrc.js | 16 ---- packages/feedback-modal/.gitignore | 4 - packages/feedback-modal/LICENSE | 14 ---- packages/feedback-modal/README.md | 14 ---- packages/feedback-modal/jest.config.js | 6 -- packages/feedback-modal/package.json | 76 ------------------- .../feedback-modal/rollup.bundle.config.mjs | 15 ---- packages/feedback-modal/rollup.npm.config.mjs | 20 ----- .../scripts/shim-preact-export.js | 75 ------------------ packages/feedback-modal/src/index.ts | 1 - .../src/modal/integration.test.ts | 8 -- .../feedback-modal/src/modal/integration.ts | 15 ---- packages/feedback-modal/tsconfig.json | 17 ----- packages/feedback-modal/tsconfig.test.json | 15 ---- packages/feedback-modal/tsconfig.types.json | 10 --- packages/feedback-screenshot/.eslintignore | 2 - packages/feedback-screenshot/.eslintrc.js | 16 ---- packages/feedback-screenshot/.gitignore | 4 - packages/feedback-screenshot/LICENSE | 14 ---- packages/feedback-screenshot/README.md | 14 ---- packages/feedback-screenshot/jest.config.js | 6 -- packages/feedback-screenshot/package.json | 76 ------------------- .../rollup.bundle.config.mjs | 15 ---- .../feedback-screenshot/rollup.npm.config.mjs | 20 ----- .../scripts/shim-preact-export.js | 75 ------------------ packages/feedback-screenshot/src/index.ts | 1 - .../src/screenshot/integration.test.ts | 8 -- .../src/screenshot/integration.ts | 15 ---- packages/feedback-screenshot/tsconfig.json | 17 ----- .../feedback-screenshot/tsconfig.test.json | 15 ---- .../feedback-screenshot/tsconfig.types.json | 10 --- packages/integration-shims/src/Feedback.ts | 28 ------- packages/integration-shims/src/index.ts | 2 +- packages/nextjs/test/integration/package.json | 2 - packages/remix/test/integration/package.json | 2 - 54 files changed, 19 insertions(+), 749 deletions(-) delete mode 100644 packages/feedback-modal/.eslintignore delete mode 100644 packages/feedback-modal/.eslintrc.js delete mode 100644 packages/feedback-modal/.gitignore delete mode 100644 packages/feedback-modal/LICENSE delete mode 100644 packages/feedback-modal/README.md delete mode 100644 packages/feedback-modal/jest.config.js delete mode 100644 packages/feedback-modal/package.json delete mode 100644 packages/feedback-modal/rollup.bundle.config.mjs delete mode 100644 packages/feedback-modal/rollup.npm.config.mjs delete mode 100644 packages/feedback-modal/scripts/shim-preact-export.js delete mode 100644 packages/feedback-modal/src/index.ts delete mode 100644 packages/feedback-modal/src/modal/integration.test.ts delete mode 100644 packages/feedback-modal/src/modal/integration.ts delete mode 100644 packages/feedback-modal/tsconfig.json delete mode 100644 packages/feedback-modal/tsconfig.test.json delete mode 100644 packages/feedback-modal/tsconfig.types.json delete mode 100644 packages/feedback-screenshot/.eslintignore delete mode 100644 packages/feedback-screenshot/.eslintrc.js delete mode 100644 packages/feedback-screenshot/.gitignore delete mode 100644 packages/feedback-screenshot/LICENSE delete mode 100644 packages/feedback-screenshot/README.md delete mode 100644 packages/feedback-screenshot/jest.config.js delete mode 100644 packages/feedback-screenshot/package.json delete mode 100644 packages/feedback-screenshot/rollup.bundle.config.mjs delete mode 100644 packages/feedback-screenshot/rollup.npm.config.mjs delete mode 100644 packages/feedback-screenshot/scripts/shim-preact-export.js delete mode 100644 packages/feedback-screenshot/src/index.ts delete mode 100644 packages/feedback-screenshot/src/screenshot/integration.test.ts delete mode 100644 packages/feedback-screenshot/src/screenshot/integration.ts delete mode 100644 packages/feedback-screenshot/tsconfig.json delete mode 100644 packages/feedback-screenshot/tsconfig.test.json delete mode 100644 packages/feedback-screenshot/tsconfig.types.json diff --git a/.craft.yml b/.craft.yml index 820c50f199fd..bc1446711d2c 100644 --- a/.craft.yml +++ b/.craft.yml @@ -32,15 +32,7 @@ targets: - name: npm id: '@sentry-internal/feedback' includeNames: /^sentry-internal-feedback-\d.*\.tgz$/ - ## 1.8 Feedback Modal package (browser only) - - name: npm - id: '@sentry-internal/feedback-modal' - includeNames: /^sentry-internal-feedback-modal-\d.*\.tgz$/ - ## 1.9 Feedback Screenshot package (browser only) - - name: npm - id: '@sentry-internal/feedback-screenshot' - includeNames: /^sentry-internal-feedback-screenshot-\d.*\.tgz$/ - ## 1.10 ReplayCanvas package (browser only) + ## 1.8 ReplayCanvas package (browser only) - name: npm id: '@sentry-internal/replay-canvas' includeNames: /^sentry-internal-replay-canvas-\d.*\.tgz$/ diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ddaeed70dab9..b131d8cb2717 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -105,8 +105,6 @@ jobs: - 'packages/replay/**' - 'packages/replay-canvas/**' - 'packages/feedback/**' - - 'packages/feedback-modal/**' - - 'packages/feedback-screenshot/**' - 'packages/wasm/**' browser_integration: - *shared diff --git a/CODEOWNERS b/CODEOWNERS index 0cbff3b53444..6ae2679deafa 100644 --- a/CODEOWNERS +++ b/CODEOWNERS @@ -2,6 +2,4 @@ packages/replay @getsentry/replay-sdk-web packages/replay-worker @getsentry/replay-sdk-web packages/replay-canvas @getsentry/replay-sdk-web packages/feedback @getsentry/replay-sdk-web -packages/feedback-modal @getsentry/replay-sdk-web -packages/feedback-screenshot @getsentry/replay-sdk-web dev-packages/browser-integration-tests/suites/replay @getsentry/replay-sdk-web diff --git a/package.json b/package.json index 91351e047d3a..00945d179e72 100644 --- a/package.json +++ b/package.json @@ -56,8 +56,6 @@ "packages/eslint-config-sdk", "packages/eslint-plugin-sdk", "packages/feedback", - "packages/feedback-modal", - "packages/feedback-screenshot", "packages/gatsby", "packages/google-cloud-serverless", "packages/integration-shims", diff --git a/packages/browser/package.json b/packages/browser/package.json index 927cbd41a045..d748c97dff02 100644 --- a/packages/browser/package.json +++ b/packages/browser/package.json @@ -43,8 +43,6 @@ }, "dependencies": { "@sentry-internal/browser-utils": "8.0.0-alpha.9", - "@sentry-internal/feedback-modal": "8.0.0-alpha.9", - "@sentry-internal/feedback-screenshot": "8.0.0-alpha.9", "@sentry-internal/feedback": "8.0.0-alpha.9", "@sentry-internal/replay": "8.0.0-alpha.9", "@sentry-internal/replay-canvas": "8.0.0-alpha.9", diff --git a/packages/browser/src/index.bundle.feedback.ts b/packages/browser/src/index.bundle.feedback.ts index 193cac1a5f06..de24e36e2a60 100644 --- a/packages/browser/src/index.bundle.feedback.ts +++ b/packages/browser/src/index.bundle.feedback.ts @@ -1,7 +1,5 @@ // This is exported so the loader does not fail when switching off Replay/Tracing import { feedbackIntegration, getFeedback } from '@sentry-internal/feedback'; -import { feedbackModalIntegration } from '@sentry-internal/feedback-modal'; -import { feedbackScreenshotIntegration } from '@sentry-internal/feedback-screenshot'; import { addTracingExtensionsShim, browserTracingIntegrationShim, @@ -14,8 +12,6 @@ export { addTracingExtensionsShim as addTracingExtensions, replayIntegrationShim as replayIntegration, feedbackIntegration, - feedbackModalIntegration, - feedbackScreenshotIntegration, getFeedback, }; // Note: We do not export a shim for `Span` here, as that is quite complex and would blow up the bundle diff --git a/packages/browser/src/index.bundle.replay.ts b/packages/browser/src/index.bundle.replay.ts index 0c0bb6ca40ef..ec0a50c92905 100644 --- a/packages/browser/src/index.bundle.replay.ts +++ b/packages/browser/src/index.bundle.replay.ts @@ -3,8 +3,6 @@ import { addTracingExtensionsShim, browserTracingIntegrationShim, feedbackIntegrationShim, - feedbackModalIntegrationShim, - feedbackScreenshotIntegrationShim, } from '@sentry-internal/integration-shims'; import { replayIntegration } from '@sentry-internal/replay'; @@ -14,7 +12,5 @@ export { addTracingExtensionsShim as addTracingExtensions, replayIntegration, feedbackIntegrationShim as feedbackIntegration, - feedbackModalIntegrationShim as feedbackModalIntegration, - feedbackScreenshotIntegrationShim as feedbackScreenshotIntegration, }; // Note: We do not export a shim for `Span` here, as that is quite complex and would blow up the bundle diff --git a/packages/browser/src/index.bundle.tracing.replay.feedback.ts b/packages/browser/src/index.bundle.tracing.replay.feedback.ts index d26ccf1ba230..6133fc2870f5 100644 --- a/packages/browser/src/index.bundle.tracing.replay.feedback.ts +++ b/packages/browser/src/index.bundle.tracing.replay.feedback.ts @@ -4,8 +4,6 @@ import { startBrowserTracingPageLoadSpan, } from '@sentry-internal/browser-utils'; import { feedbackIntegration, getFeedback } from '@sentry-internal/feedback'; -import { feedbackModalIntegration } from '@sentry-internal/feedback-modal'; -import { feedbackScreenshotIntegration } from '@sentry-internal/feedback-screenshot'; import { replayIntegration } from '@sentry-internal/replay'; import { addTracingExtensions } from '@sentry/core'; @@ -25,8 +23,6 @@ export { export { feedbackIntegration, - feedbackModalIntegration, - feedbackScreenshotIntegration, replayIntegration, browserTracingIntegration, addTracingExtensions, diff --git a/packages/browser/src/index.bundle.tracing.replay.ts b/packages/browser/src/index.bundle.tracing.replay.ts index 628ebeb19651..f949ea43541a 100644 --- a/packages/browser/src/index.bundle.tracing.replay.ts +++ b/packages/browser/src/index.bundle.tracing.replay.ts @@ -3,11 +3,7 @@ import { startBrowserTracingNavigationSpan, startBrowserTracingPageLoadSpan, } from '@sentry-internal/browser-utils'; -import { - feedbackIntegrationShim, - feedbackModalIntegrationShim, - feedbackScreenshotIntegrationShim, -} from '@sentry-internal/integration-shims'; +import { feedbackIntegrationShim } from '@sentry-internal/integration-shims'; import { replayIntegration } from '@sentry-internal/replay'; import { addTracingExtensions } from '@sentry/core'; @@ -28,8 +24,6 @@ export { export { replayIntegration, feedbackIntegrationShim as feedbackIntegration, - feedbackModalIntegrationShim as feedbackModalIntegration, - feedbackScreenshotIntegrationShim as feedbackScreenshotIntegration, browserTracingIntegration, addTracingExtensions, startBrowserTracingNavigationSpan, diff --git a/packages/browser/src/index.bundle.tracing.ts b/packages/browser/src/index.bundle.tracing.ts index 29c463fae586..1b4f89f935df 100644 --- a/packages/browser/src/index.bundle.tracing.ts +++ b/packages/browser/src/index.bundle.tracing.ts @@ -4,12 +4,7 @@ import { startBrowserTracingPageLoadSpan, } from '@sentry-internal/browser-utils'; // This is exported so the loader does not fail when switching off Replay -import { - feedbackIntegrationShim, - feedbackModalIntegrationShim, - feedbackScreenshotIntegrationShim, - replayIntegrationShim, -} from '@sentry-internal/integration-shims'; +import { feedbackIntegrationShim, replayIntegrationShim } from '@sentry-internal/integration-shims'; import { addTracingExtensions } from '@sentry/core'; // We are patching the global object with our hub extension methods @@ -28,8 +23,6 @@ export { export { feedbackIntegrationShim as feedbackIntegration, - feedbackModalIntegrationShim as feedbackModalIntegration, - feedbackScreenshotIntegrationShim as feedbackScreenshotIntegration, replayIntegrationShim as replayIntegration, browserTracingIntegration, addTracingExtensions, diff --git a/packages/browser/src/index.bundle.ts b/packages/browser/src/index.bundle.ts index 10482f8135cf..b27672414b20 100644 --- a/packages/browser/src/index.bundle.ts +++ b/packages/browser/src/index.bundle.ts @@ -3,8 +3,6 @@ import { addTracingExtensionsShim, browserTracingIntegrationShim, feedbackIntegrationShim, - feedbackModalIntegrationShim, - feedbackScreenshotIntegrationShim, replayIntegrationShim, } from '@sentry-internal/integration-shims'; @@ -13,8 +11,6 @@ export { addTracingExtensionsShim as addTracingExtensions, browserTracingIntegrationShim as browserTracingIntegration, feedbackIntegrationShim as feedbackIntegration, - feedbackModalIntegrationShim as feedbackModalIntegration, - feedbackScreenshotIntegrationShim as feedbackScreenshotIntegration, replayIntegrationShim as replayIntegration, }; // Note: We do not export a shim for `Span` here, as that is quite complex and would blow up the bundle diff --git a/packages/browser/src/index.ts b/packages/browser/src/index.ts index 8d8069d2460c..54dd27f8b8b5 100644 --- a/packages/browser/src/index.ts +++ b/packages/browser/src/index.ts @@ -35,8 +35,6 @@ export { getFeedback, sendFeedback, } from '@sentry-internal/feedback'; -export { feedbackModalIntegration } from '@sentry-internal/feedback-modal'; -export { feedbackScreenshotIntegration } from '@sentry-internal/feedback-screenshot'; export { defaultRequestInstrumentationOptions, diff --git a/packages/browser/test/unit/index.bundle.feedback.test.ts b/packages/browser/test/unit/index.bundle.feedback.test.ts index c403144d4306..5a3451cb3ef0 100644 --- a/packages/browser/test/unit/index.bundle.feedback.test.ts +++ b/packages/browser/test/unit/index.bundle.feedback.test.ts @@ -1,13 +1,11 @@ import { replayIntegrationShim } from '@sentry-internal/integration-shims'; -import { feedbackIntegration, feedbackModalIntegration, feedbackScreenshotIntegration } from '@sentry/browser'; +import { feedbackIntegration } from '@sentry/browser'; -import * as FeedbackBundle from '../../src/index.bundle.feedback'; +import * as TracingReplayBundle from '../../src/index.bundle.feedback'; describe('index.bundle.feedback', () => { it('has correct exports', () => { - expect(FeedbackBundle.replayIntegration).toBe(replayIntegrationShim); - expect(FeedbackBundle.feedbackIntegration).toBe(feedbackIntegration); - expect(FeedbackBundle.feedbackModalIntegration).toBe(feedbackModalIntegration); - expect(FeedbackBundle.feedbackScreenshotIntegration).toBe(feedbackScreenshotIntegration); + expect(TracingReplayBundle.replayIntegration).toBe(replayIntegrationShim); + expect(TracingReplayBundle.feedbackIntegration).toBe(feedbackIntegration); }); }); diff --git a/packages/browser/test/unit/index.bundle.replay.test.ts b/packages/browser/test/unit/index.bundle.replay.test.ts index 4e3d4e344734..479e6b23393b 100644 --- a/packages/browser/test/unit/index.bundle.replay.test.ts +++ b/packages/browser/test/unit/index.bundle.replay.test.ts @@ -1,17 +1,11 @@ -import { - feedbackIntegrationShim, - feedbackModalIntegrationShim, - feedbackScreenshotIntegrationShim, -} from '@sentry-internal/integration-shims'; +import { feedbackIntegrationShim } from '@sentry-internal/integration-shims'; import { replayIntegration } from '@sentry/browser'; -import * as ReplayBundle from '../../src/index.bundle.replay'; +import * as TracingReplayBundle from '../../src/index.bundle.replay'; describe('index.bundle.replay', () => { it('has correct exports', () => { - expect(ReplayBundle.replayIntegration).toBe(replayIntegration); - expect(ReplayBundle.feedbackIntegration).toBe(feedbackIntegrationShim); - expect(ReplayBundle.feedbackModalIntegration).toBe(feedbackModalIntegrationShim); - expect(ReplayBundle.feedbackScreenshotIntegration).toBe(feedbackScreenshotIntegrationShim); + expect(TracingReplayBundle.replayIntegration).toBe(replayIntegration); + expect(TracingReplayBundle.feedbackIntegration).toBe(feedbackIntegrationShim); }); }); diff --git a/packages/browser/test/unit/index.bundle.test.ts b/packages/browser/test/unit/index.bundle.test.ts index f02e2528f802..9ef9f38d8db5 100644 --- a/packages/browser/test/unit/index.bundle.test.ts +++ b/packages/browser/test/unit/index.bundle.test.ts @@ -1,17 +1,10 @@ -import { - feedbackIntegrationShim, - feedbackModalIntegrationShim, - feedbackScreenshotIntegrationShim, - replayIntegrationShim, -} from '@sentry-internal/integration-shims'; +import { feedbackIntegrationShim, replayIntegrationShim } from '@sentry-internal/integration-shims'; -import * as Bundle from '../../src/index.bundle'; +import * as TracingBundle from '../../src/index.bundle'; describe('index.bundle', () => { it('has correct exports', () => { - expect(Bundle.replayIntegration).toBe(replayIntegrationShim); - expect(Bundle.feedbackIntegration).toBe(feedbackIntegrationShim); - expect(Bundle.feedbackModalIntegration).toBe(feedbackModalIntegrationShim); - expect(Bundle.feedbackScreenshotIntegration).toBe(feedbackScreenshotIntegrationShim); + expect(TracingBundle.replayIntegration).toBe(replayIntegrationShim); + expect(TracingBundle.feedbackIntegration).toBe(feedbackIntegrationShim); }); }); diff --git a/packages/browser/test/unit/index.bundle.tracing.replay.feedback.test.ts b/packages/browser/test/unit/index.bundle.tracing.replay.feedback.test.ts index 873c41bfc769..a8440d160e2b 100644 --- a/packages/browser/test/unit/index.bundle.tracing.replay.feedback.test.ts +++ b/packages/browser/test/unit/index.bundle.tracing.replay.feedback.test.ts @@ -1,10 +1,5 @@ import { browserTracingIntegration } from '@sentry-internal/browser-utils'; -import { - feedbackIntegration, - feedbackModalIntegration, - feedbackScreenshotIntegration, - replayIntegration, -} from '@sentry/browser'; +import { feedbackIntegration, replayIntegration } from '@sentry/browser'; import * as TracingReplayFeedbackBundle from '../../src/index.bundle.tracing.replay.feedback'; @@ -13,7 +8,5 @@ describe('index.bundle.tracing.replay.feedback', () => { expect(TracingReplayFeedbackBundle.replayIntegration).toBe(replayIntegration); expect(TracingReplayFeedbackBundle.browserTracingIntegration).toBe(browserTracingIntegration); expect(TracingReplayFeedbackBundle.feedbackIntegration).toBe(feedbackIntegration); - expect(TracingReplayFeedbackBundle.feedbackModalIntegration).toBe(feedbackModalIntegration); - expect(TracingReplayFeedbackBundle.feedbackScreenshotIntegration).toBe(feedbackScreenshotIntegration); }); }); diff --git a/packages/browser/test/unit/index.bundle.tracing.replay.test.ts b/packages/browser/test/unit/index.bundle.tracing.replay.test.ts index 3e2a79e081a9..18c286edffc9 100644 --- a/packages/browser/test/unit/index.bundle.tracing.replay.test.ts +++ b/packages/browser/test/unit/index.bundle.tracing.replay.test.ts @@ -1,9 +1,5 @@ import { browserTracingIntegration } from '@sentry-internal/browser-utils'; -import { - feedbackIntegrationShim, - feedbackModalIntegrationShim, - feedbackScreenshotIntegrationShim, -} from '@sentry-internal/integration-shims'; +import { feedbackIntegrationShim } from '@sentry-internal/integration-shims'; import { replayIntegration } from '@sentry/browser'; import * as TracingReplayBundle from '../../src/index.bundle.tracing.replay'; @@ -15,7 +11,5 @@ describe('index.bundle.tracing.replay', () => { expect(TracingReplayBundle.browserTracingIntegration).toBe(browserTracingIntegration); expect(TracingReplayBundle.feedbackIntegration).toBe(feedbackIntegrationShim); - expect(TracingReplayBundle.feedbackModalIntegration).toBe(feedbackModalIntegrationShim); - expect(TracingReplayBundle.feedbackScreenshotIntegration).toBe(feedbackScreenshotIntegrationShim); }); }); diff --git a/packages/browser/test/unit/index.bundle.tracing.test.ts b/packages/browser/test/unit/index.bundle.tracing.test.ts index 10ec0c6f0fd2..1bb1ca19eec1 100644 --- a/packages/browser/test/unit/index.bundle.tracing.test.ts +++ b/packages/browser/test/unit/index.bundle.tracing.test.ts @@ -1,10 +1,5 @@ import { browserTracingIntegration } from '@sentry-internal/browser-utils'; -import { - feedbackIntegrationShim, - feedbackModalIntegrationShim, - feedbackScreenshotIntegrationShim, - replayIntegrationShim, -} from '@sentry-internal/integration-shims'; +import { feedbackIntegrationShim, replayIntegrationShim } from '@sentry-internal/integration-shims'; import * as TracingBundle from '../../src/index.bundle.tracing'; @@ -13,7 +8,5 @@ describe('index.bundle.tracing', () => { expect(TracingBundle.replayIntegration).toBe(replayIntegrationShim); expect(TracingBundle.browserTracingIntegration).toBe(browserTracingIntegration); expect(TracingBundle.feedbackIntegration).toBe(feedbackIntegrationShim); - expect(TracingBundle.feedbackModalIntegration).toBe(feedbackModalIntegrationShim); - expect(TracingBundle.feedbackScreenshotIntegration).toBe(feedbackScreenshotIntegrationShim); }); }); diff --git a/packages/feedback-modal/.eslintignore b/packages/feedback-modal/.eslintignore deleted file mode 100644 index b38db2f296ff..000000000000 --- a/packages/feedback-modal/.eslintignore +++ /dev/null @@ -1,2 +0,0 @@ -node_modules/ -build/ diff --git a/packages/feedback-modal/.eslintrc.js b/packages/feedback-modal/.eslintrc.js deleted file mode 100644 index 0b547ffc828c..000000000000 --- a/packages/feedback-modal/.eslintrc.js +++ /dev/null @@ -1,16 +0,0 @@ -// Note: All paths are relative to the directory in which eslint is being run, rather than the directory where this file -// lives - -// ESLint config docs: https://eslint.org/docs/user-guide/configuring/ - -module.exports = { - extends: ['../../.eslintrc.js'], - overrides: [ - { - files: ['jest.setup.ts', 'jest.config.ts'], - parserOptions: { - project: ['tsconfig.test.json'], - }, - }, - ], -}; diff --git a/packages/feedback-modal/.gitignore b/packages/feedback-modal/.gitignore deleted file mode 100644 index 363d3467c6fa..000000000000 --- a/packages/feedback-modal/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -node_modules -/*.tgz -.eslintcache -build diff --git a/packages/feedback-modal/LICENSE b/packages/feedback-modal/LICENSE deleted file mode 100644 index ea5e82344f87..000000000000 --- a/packages/feedback-modal/LICENSE +++ /dev/null @@ -1,14 +0,0 @@ -Copyright (c) 2024 Sentry (https://sentry.io) and individual contributors. All rights reserved. - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated -documentation files (the "Software"), to deal in the Software without restriction, including without limitation the -rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit -persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the -Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE -WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR -COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/packages/feedback-modal/README.md b/packages/feedback-modal/README.md deleted file mode 100644 index f4949a12b0d1..000000000000 --- a/packages/feedback-modal/README.md +++ /dev/null @@ -1,14 +0,0 @@ -

- - Sentry - -

- -# Sentry Integration for Feedback - -This integration supports our browser feedback SDK allowing us to code-split heavy UI components as needed. - -For the primary Feedback Integration see -[Sentry Feedback SDK](https://github.com/getsentry/sentry-javascript/tree/develop/packages/feedback) - -Note: This package is only meant to be used internally. diff --git a/packages/feedback-modal/jest.config.js b/packages/feedback-modal/jest.config.js deleted file mode 100644 index cd02790794a7..000000000000 --- a/packages/feedback-modal/jest.config.js +++ /dev/null @@ -1,6 +0,0 @@ -const baseConfig = require('../../jest/jest.config.js'); - -module.exports = { - ...baseConfig, - testEnvironment: 'jsdom', -}; diff --git a/packages/feedback-modal/package.json b/packages/feedback-modal/package.json deleted file mode 100644 index 831e6a29c266..000000000000 --- a/packages/feedback-modal/package.json +++ /dev/null @@ -1,76 +0,0 @@ -{ - "name": "@sentry-internal/feedback-modal", - "version": "8.0.0-alpha.9", - "description": "Sentry SDK integration for user feedback", - "repository": "git://github.com/getsentry/sentry-javascript.git", - "homepage": "https://github.com/getsentry/sentry-javascript/tree/master/packages/feedback-modal", - "author": "Sentry", - "license": "MIT", - "engines": { - "node": ">=14.18" - }, - "files": [ - "cjs", - "esm", - "types", - "types-ts3.8" - ], - "main": "build/npm/cjs/index.js", - "module": "build/npm/esm/index.js", - "types": "build/npm/types/index.d.ts", - "exports": { - "./package.json": "./package.json", - ".": { - "import": { - "types": "./build/npm/types/index.d.ts", - "default": "./build/npm/esm/index.js" - }, - "require": { - "types": "./build/npm/types/index.d.ts", - "default": "./build/npm/cjs/index.js" - } - } - }, - "typesVersions": { - "<4.9": { - "build/npm/types/index.d.ts": [ - "build/npm/types-ts3.8/index.d.ts" - ] - } - }, - "publishConfig": { - "access": "public" - }, - "dependencies": { - "@sentry/core": "8.0.0-alpha.9", - "@sentry/types": "8.0.0-alpha.9", - "@sentry/utils": "8.0.0-alpha.9", - "preact": "^10.19.4" - }, - "scripts": { - "build": "run-p build:transpile build:types build:bundle", - "build:transpile": "rollup -c rollup.npm.config.mjs", - "build:bundle": "rollup -c rollup.bundle.config.mjs", - "build:dev": "run-p build:transpile build:types", - "build:types": "run-s build:types:core build:types:downlevel", - "build:types:core": "tsc -p tsconfig.types.json", - "build:types:downlevel": "yarn downlevel-dts build/npm/types build/npm/types-ts3.8 --to ts3.8 && yarn node ./scripts/shim-preact-export.js", - "build:watch": "run-p build:transpile:watch build:bundle:watch build:types:watch", - "build:dev:watch": "run-p build:transpile:watch build:types:watch", - "build:transpile:watch": "yarn build:transpile --watch", - "build:bundle:watch": "yarn build:bundle --watch", - "build:types:watch": "tsc -p tsconfig.types.json --watch", - "build:tarball": "ts-node ../../scripts/prepack.ts --bundles && npm pack ./build/npm", - "circularDepCheck": "madge --circular src/index.ts", - "clean": "rimraf build sentry-feedback-modal-*.tgz", - "fix": "eslint . --format stylish --fix", - "lint": "eslint . --format stylish", - "test": "jest", - "test:watch": "jest --watch", - "yalc:publish": "ts-node ../../scripts/prepack.ts --bundles && yalc publish ./build/npm --push --sig" - }, - "volta": { - "extends": "../../package.json" - }, - "sideEffects": false -} diff --git a/packages/feedback-modal/rollup.bundle.config.mjs b/packages/feedback-modal/rollup.bundle.config.mjs deleted file mode 100644 index 9fc71b68bc9d..000000000000 --- a/packages/feedback-modal/rollup.bundle.config.mjs +++ /dev/null @@ -1,15 +0,0 @@ -import { makeBaseBundleConfig, makeBundleConfigVariants } from '@sentry-internal/rollup-utils'; - -export default makeBundleConfigVariants( - makeBaseBundleConfig({ - bundleType: 'addon', - entrypoints: ['src/index.ts'], - jsVersion: 'es6', - licenseTitle: '@sentry-internal/feedback-modal', - outputFileBase: () => 'bundles/feedback-modal', - sucrase: { - jsxPragma: 'h', - jsxFragmentPragma: 'Fragment', - }, - }), -); diff --git a/packages/feedback-modal/rollup.npm.config.mjs b/packages/feedback-modal/rollup.npm.config.mjs deleted file mode 100644 index 3dc031c5ff82..000000000000 --- a/packages/feedback-modal/rollup.npm.config.mjs +++ /dev/null @@ -1,20 +0,0 @@ -import { makeBaseNPMConfig, makeNPMConfigVariants } from '@sentry-internal/rollup-utils'; - -export default makeNPMConfigVariants( - makeBaseNPMConfig({ - hasBundles: true, - packageSpecificConfig: { - output: { - // set exports to 'named' or 'auto' so that rollup doesn't warn - exports: 'named', - // set preserveModules to false because for feedback we actually want - // to bundle everything into one file. - preserveModules: false, - }, - }, - sucrase: { - jsxPragma: 'h', - jsxFragmentPragma: 'Fragment', - }, - }), -); diff --git a/packages/feedback-modal/scripts/shim-preact-export.js b/packages/feedback-modal/scripts/shim-preact-export.js deleted file mode 100644 index bd74e4da0a05..000000000000 --- a/packages/feedback-modal/scripts/shim-preact-export.js +++ /dev/null @@ -1,75 +0,0 @@ -// preact does not support more modern TypeScript versions, which breaks our users that depend on older -// TypeScript versions. To fix this, we shim the types from preact to be any and remove the dependency on preact -// for types directly. This script is meant to be run after the build/npm/types-ts3.8 directory is created. - -// Path: build/npm/types-ts3.8/global.d.ts - -const fs = require('fs'); -const path = require('path'); - -/** - * This regex looks for preact imports we can replace and shim out. - * - * Example: - * import { ComponentChildren, VNode } from 'preact'; - */ -const preactImportRegex = /import\s*{\s*([\w\s,]+)\s*}\s*from\s*'preact'\s*;?/; - -function walk(dir) { - const files = fs.readdirSync(dir); - files.forEach(file => { - const filePath = path.join(dir, file); - const stat = fs.lstatSync(filePath); - if (stat.isDirectory()) { - walk(filePath); - } else { - if (filePath.endsWith('.d.ts')) { - const content = fs.readFileSync(filePath, 'utf8'); - const capture = preactImportRegex.exec(content); - if (capture) { - const groups = capture[1].split(',').map(s => s.trim()); - - // This generates a shim snippet to replace the type imports from preact - // It generates a snippet based on the capture groups of preactImportRegex. - // - // Example: - // - // import type { ComponentChildren, VNode } from 'preact'; - // becomes - // type ComponentChildren: any; - // type VNode: any; - const snippet = groups.reduce((acc, curr) => { - const searchableValue = curr.includes(' as ') ? curr.split(' as ')[1] : curr; - - // look to see if imported as value, then we have to use declare const - if (content.includes(`typeof ${searchableValue}`)) { - return `${acc}declare const ${searchableValue}: any;\n`; - } - - // look to see if generic type like Foo - if (content.includes(`${searchableValue}<`)) { - return `${acc}type ${searchableValue} = any;\n`; - } - - // otherwise we can just leave as type - return `${acc}type ${searchableValue} = any;\n`; - }, ''); - - // we then can remove the import from preact - const newContent = content.replace(preactImportRegex, '// replaced import from preact'); - - // and write the new content to the file - fs.writeFileSync(filePath, snippet + newContent, 'utf8'); - } - } - } - }); -} - -function run() { - // recurse through build/npm/types-ts3.8 directory - const dir = path.join('build', 'npm', 'types-ts3.8'); - walk(dir); -} - -run(); diff --git a/packages/feedback-modal/src/index.ts b/packages/feedback-modal/src/index.ts deleted file mode 100644 index eff7430a6050..000000000000 --- a/packages/feedback-modal/src/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { feedbackModalIntegration } from './modal/integration'; diff --git a/packages/feedback-modal/src/modal/integration.test.ts b/packages/feedback-modal/src/modal/integration.test.ts deleted file mode 100644 index d9eedd59c0f3..000000000000 --- a/packages/feedback-modal/src/modal/integration.test.ts +++ /dev/null @@ -1,8 +0,0 @@ -import { feedbackModalIntegration } from './integration'; - -describe('feedbackModalIntegration', () => { - it('should have createDialog', () => { - const instance = feedbackModalIntegration(); - expect(instance).toHaveProperty('createDialog'); - }); -}); diff --git a/packages/feedback-modal/src/modal/integration.ts b/packages/feedback-modal/src/modal/integration.ts deleted file mode 100644 index f9e8a9ad64be..000000000000 --- a/packages/feedback-modal/src/modal/integration.ts +++ /dev/null @@ -1,15 +0,0 @@ -import type { Integration, IntegrationFn } from '@sentry/types'; - -export interface FeedbackModalIntegration extends Integration { - createDialog: unknown; -} - -export const feedbackModalIntegration = ((): FeedbackModalIntegration => { - return { - name: 'FeedbackModal', - // eslint-disable-next-line @typescript-eslint/no-empty-function - setupOnce() {}, - // eslint-disable-next-line @typescript-eslint/no-empty-function - createDialog: () => {}, // TODO(ryan953): port this over from packages/feedback/src/modal - }; -}) satisfies IntegrationFn; diff --git a/packages/feedback-modal/tsconfig.json b/packages/feedback-modal/tsconfig.json deleted file mode 100644 index c1fc08578508..000000000000 --- a/packages/feedback-modal/tsconfig.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "extends": "../../tsconfig.json", - "compilerOptions": { - "module": "esnext", - - /* Preact Config */ - "jsx": "react-jsx", - "jsxImportSource": "preact", - "skipLibCheck": true, - "baseUrl": "./", - "paths": { - "react": ["./node_modules/preact/compat/"], - "react-dom": ["./node_modules/preact/compat/"] - } - }, - "include": ["src/**/*.ts","src/**/*.tsx"] -} diff --git a/packages/feedback-modal/tsconfig.test.json b/packages/feedback-modal/tsconfig.test.json deleted file mode 100644 index ad87caa06c48..000000000000 --- a/packages/feedback-modal/tsconfig.test.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "extends": "./tsconfig.json", - - "include": ["test/**/*.ts", "jest.config.ts", "jest.setup.ts"], - - "compilerOptions": { - "types": ["node", "jest"], - "esModuleInterop": true, - "allowJs": true, - "noImplicitAny": true, - "noImplicitThis": false, - "strictNullChecks": true, - "strictPropertyInitialization": false - } -} diff --git a/packages/feedback-modal/tsconfig.types.json b/packages/feedback-modal/tsconfig.types.json deleted file mode 100644 index 374fd9bc9364..000000000000 --- a/packages/feedback-modal/tsconfig.types.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "extends": "./tsconfig.json", - - "compilerOptions": { - "declaration": true, - "declarationMap": true, - "emitDeclarationOnly": true, - "outDir": "build/npm/types" - } -} diff --git a/packages/feedback-screenshot/.eslintignore b/packages/feedback-screenshot/.eslintignore deleted file mode 100644 index b38db2f296ff..000000000000 --- a/packages/feedback-screenshot/.eslintignore +++ /dev/null @@ -1,2 +0,0 @@ -node_modules/ -build/ diff --git a/packages/feedback-screenshot/.eslintrc.js b/packages/feedback-screenshot/.eslintrc.js deleted file mode 100644 index 0b547ffc828c..000000000000 --- a/packages/feedback-screenshot/.eslintrc.js +++ /dev/null @@ -1,16 +0,0 @@ -// Note: All paths are relative to the directory in which eslint is being run, rather than the directory where this file -// lives - -// ESLint config docs: https://eslint.org/docs/user-guide/configuring/ - -module.exports = { - extends: ['../../.eslintrc.js'], - overrides: [ - { - files: ['jest.setup.ts', 'jest.config.ts'], - parserOptions: { - project: ['tsconfig.test.json'], - }, - }, - ], -}; diff --git a/packages/feedback-screenshot/.gitignore b/packages/feedback-screenshot/.gitignore deleted file mode 100644 index 363d3467c6fa..000000000000 --- a/packages/feedback-screenshot/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -node_modules -/*.tgz -.eslintcache -build diff --git a/packages/feedback-screenshot/LICENSE b/packages/feedback-screenshot/LICENSE deleted file mode 100644 index ea5e82344f87..000000000000 --- a/packages/feedback-screenshot/LICENSE +++ /dev/null @@ -1,14 +0,0 @@ -Copyright (c) 2024 Sentry (https://sentry.io) and individual contributors. All rights reserved. - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated -documentation files (the "Software"), to deal in the Software without restriction, including without limitation the -rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit -persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the -Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE -WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR -COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/packages/feedback-screenshot/README.md b/packages/feedback-screenshot/README.md deleted file mode 100644 index f4949a12b0d1..000000000000 --- a/packages/feedback-screenshot/README.md +++ /dev/null @@ -1,14 +0,0 @@ -

- - Sentry - -

- -# Sentry Integration for Feedback - -This integration supports our browser feedback SDK allowing us to code-split heavy UI components as needed. - -For the primary Feedback Integration see -[Sentry Feedback SDK](https://github.com/getsentry/sentry-javascript/tree/develop/packages/feedback) - -Note: This package is only meant to be used internally. diff --git a/packages/feedback-screenshot/jest.config.js b/packages/feedback-screenshot/jest.config.js deleted file mode 100644 index cd02790794a7..000000000000 --- a/packages/feedback-screenshot/jest.config.js +++ /dev/null @@ -1,6 +0,0 @@ -const baseConfig = require('../../jest/jest.config.js'); - -module.exports = { - ...baseConfig, - testEnvironment: 'jsdom', -}; diff --git a/packages/feedback-screenshot/package.json b/packages/feedback-screenshot/package.json deleted file mode 100644 index e29be49cb539..000000000000 --- a/packages/feedback-screenshot/package.json +++ /dev/null @@ -1,76 +0,0 @@ -{ - "name": "@sentry-internal/feedback-screenshot", - "version": "8.0.0-alpha.9", - "description": "Sentry SDK integration for user feedback", - "repository": "git://github.com/getsentry/sentry-javascript.git", - "homepage": "https://github.com/getsentry/sentry-javascript/tree/master/packages/feedback-screenshot", - "author": "Sentry", - "license": "MIT", - "engines": { - "node": ">=14.18" - }, - "files": [ - "cjs", - "esm", - "types", - "types-ts3.8" - ], - "main": "build/npm/cjs/index.js", - "module": "build/npm/esm/index.js", - "types": "build/npm/types/index.d.ts", - "exports": { - "./package.json": "./package.json", - ".": { - "import": { - "types": "./build/npm/types/index.d.ts", - "default": "./build/npm/esm/index.js" - }, - "require": { - "types": "./build/npm/types/index.d.ts", - "default": "./build/npm/cjs/index.js" - } - } - }, - "typesVersions": { - "<4.9": { - "build/npm/types/index.d.ts": [ - "build/npm/types-ts3.8/index.d.ts" - ] - } - }, - "publishConfig": { - "access": "public" - }, - "dependencies": { - "@sentry/core": "8.0.0-alpha.9", - "@sentry/types": "8.0.0-alpha.9", - "@sentry/utils": "8.0.0-alpha.9", - "preact": "^10.19.4" - }, - "scripts": { - "build": "run-p build:transpile build:types build:bundle", - "build:transpile": "rollup -c rollup.npm.config.mjs", - "build:bundle": "rollup -c rollup.bundle.config.mjs", - "build:dev": "run-p build:transpile build:types", - "build:types": "run-s build:types:core build:types:downlevel", - "build:types:core": "tsc -p tsconfig.types.json", - "build:types:downlevel": "yarn downlevel-dts build/npm/types build/npm/types-ts3.8 --to ts3.8 && yarn node ./scripts/shim-preact-export.js", - "build:watch": "run-p build:transpile:watch build:bundle:watch build:types:watch", - "build:dev:watch": "run-p build:transpile:watch build:types:watch", - "build:transpile:watch": "yarn build:transpile --watch", - "build:bundle:watch": "yarn build:bundle --watch", - "build:types:watch": "tsc -p tsconfig.types.json --watch", - "build:tarball": "ts-node ../../scripts/prepack.ts --bundles && npm pack ./build/npm", - "circularDepCheck": "madge --circular src/index.ts", - "clean": "rimraf build sentry-feedback-screenshot-*.tgz", - "fix": "eslint . --format stylish --fix", - "lint": "eslint . --format stylish", - "test": "jest", - "test:watch": "jest --watch", - "yalc:publish": "ts-node ../../scripts/prepack.ts --bundles && yalc publish ./build/npm --push --sig" - }, - "volta": { - "extends": "../../package.json" - }, - "sideEffects": false -} diff --git a/packages/feedback-screenshot/rollup.bundle.config.mjs b/packages/feedback-screenshot/rollup.bundle.config.mjs deleted file mode 100644 index 5e2422f0bcd0..000000000000 --- a/packages/feedback-screenshot/rollup.bundle.config.mjs +++ /dev/null @@ -1,15 +0,0 @@ -import { makeBaseBundleConfig, makeBundleConfigVariants } from '@sentry-internal/rollup-utils'; - -export default makeBundleConfigVariants( - makeBaseBundleConfig({ - bundleType: 'addon', - entrypoints: ['src/index.ts'], - jsVersion: 'es6', - licenseTitle: '@sentry-internal/feedback-screenshot', - outputFileBase: () => 'bundles/feedback-screenshot', - sucrase: { - jsxPragma: 'h', - jsxFragmentPragma: 'Fragment', - }, - }), -); diff --git a/packages/feedback-screenshot/rollup.npm.config.mjs b/packages/feedback-screenshot/rollup.npm.config.mjs deleted file mode 100644 index 3dc031c5ff82..000000000000 --- a/packages/feedback-screenshot/rollup.npm.config.mjs +++ /dev/null @@ -1,20 +0,0 @@ -import { makeBaseNPMConfig, makeNPMConfigVariants } from '@sentry-internal/rollup-utils'; - -export default makeNPMConfigVariants( - makeBaseNPMConfig({ - hasBundles: true, - packageSpecificConfig: { - output: { - // set exports to 'named' or 'auto' so that rollup doesn't warn - exports: 'named', - // set preserveModules to false because for feedback we actually want - // to bundle everything into one file. - preserveModules: false, - }, - }, - sucrase: { - jsxPragma: 'h', - jsxFragmentPragma: 'Fragment', - }, - }), -); diff --git a/packages/feedback-screenshot/scripts/shim-preact-export.js b/packages/feedback-screenshot/scripts/shim-preact-export.js deleted file mode 100644 index bd74e4da0a05..000000000000 --- a/packages/feedback-screenshot/scripts/shim-preact-export.js +++ /dev/null @@ -1,75 +0,0 @@ -// preact does not support more modern TypeScript versions, which breaks our users that depend on older -// TypeScript versions. To fix this, we shim the types from preact to be any and remove the dependency on preact -// for types directly. This script is meant to be run after the build/npm/types-ts3.8 directory is created. - -// Path: build/npm/types-ts3.8/global.d.ts - -const fs = require('fs'); -const path = require('path'); - -/** - * This regex looks for preact imports we can replace and shim out. - * - * Example: - * import { ComponentChildren, VNode } from 'preact'; - */ -const preactImportRegex = /import\s*{\s*([\w\s,]+)\s*}\s*from\s*'preact'\s*;?/; - -function walk(dir) { - const files = fs.readdirSync(dir); - files.forEach(file => { - const filePath = path.join(dir, file); - const stat = fs.lstatSync(filePath); - if (stat.isDirectory()) { - walk(filePath); - } else { - if (filePath.endsWith('.d.ts')) { - const content = fs.readFileSync(filePath, 'utf8'); - const capture = preactImportRegex.exec(content); - if (capture) { - const groups = capture[1].split(',').map(s => s.trim()); - - // This generates a shim snippet to replace the type imports from preact - // It generates a snippet based on the capture groups of preactImportRegex. - // - // Example: - // - // import type { ComponentChildren, VNode } from 'preact'; - // becomes - // type ComponentChildren: any; - // type VNode: any; - const snippet = groups.reduce((acc, curr) => { - const searchableValue = curr.includes(' as ') ? curr.split(' as ')[1] : curr; - - // look to see if imported as value, then we have to use declare const - if (content.includes(`typeof ${searchableValue}`)) { - return `${acc}declare const ${searchableValue}: any;\n`; - } - - // look to see if generic type like Foo - if (content.includes(`${searchableValue}<`)) { - return `${acc}type ${searchableValue} = any;\n`; - } - - // otherwise we can just leave as type - return `${acc}type ${searchableValue} = any;\n`; - }, ''); - - // we then can remove the import from preact - const newContent = content.replace(preactImportRegex, '// replaced import from preact'); - - // and write the new content to the file - fs.writeFileSync(filePath, snippet + newContent, 'utf8'); - } - } - } - }); -} - -function run() { - // recurse through build/npm/types-ts3.8 directory - const dir = path.join('build', 'npm', 'types-ts3.8'); - walk(dir); -} - -run(); diff --git a/packages/feedback-screenshot/src/index.ts b/packages/feedback-screenshot/src/index.ts deleted file mode 100644 index 2582220645d1..000000000000 --- a/packages/feedback-screenshot/src/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { feedbackScreenshotIntegration } from './screenshot/integration'; diff --git a/packages/feedback-screenshot/src/screenshot/integration.test.ts b/packages/feedback-screenshot/src/screenshot/integration.test.ts deleted file mode 100644 index 43acdd770670..000000000000 --- a/packages/feedback-screenshot/src/screenshot/integration.test.ts +++ /dev/null @@ -1,8 +0,0 @@ -import { feedbackScreenshotIntegration } from './integration'; - -describe('feedbackScreenshotIntegration', () => { - it('should have createInput', () => { - const instance = feedbackScreenshotIntegration(); - expect(instance).toHaveProperty('createInput'); - }); -}); diff --git a/packages/feedback-screenshot/src/screenshot/integration.ts b/packages/feedback-screenshot/src/screenshot/integration.ts deleted file mode 100644 index ada4e7ec8b65..000000000000 --- a/packages/feedback-screenshot/src/screenshot/integration.ts +++ /dev/null @@ -1,15 +0,0 @@ -import type { Integration, IntegrationFn } from '@sentry/types'; - -export interface FeedbackScreenshotIntegration extends Integration { - createInput: unknown; -} - -export const feedbackScreenshotIntegration = (() => { - return { - name: 'FeedbackScreenshot', - // eslint-disable-next-line @typescript-eslint/no-empty-function - setupOnce() {}, - // eslint-disable-next-line @typescript-eslint/no-empty-function - createInput: () => {}, // TODO(ryan953): port this over from packages/feedback/src/screenshot - }; -}) satisfies IntegrationFn; diff --git a/packages/feedback-screenshot/tsconfig.json b/packages/feedback-screenshot/tsconfig.json deleted file mode 100644 index c1fc08578508..000000000000 --- a/packages/feedback-screenshot/tsconfig.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "extends": "../../tsconfig.json", - "compilerOptions": { - "module": "esnext", - - /* Preact Config */ - "jsx": "react-jsx", - "jsxImportSource": "preact", - "skipLibCheck": true, - "baseUrl": "./", - "paths": { - "react": ["./node_modules/preact/compat/"], - "react-dom": ["./node_modules/preact/compat/"] - } - }, - "include": ["src/**/*.ts","src/**/*.tsx"] -} diff --git a/packages/feedback-screenshot/tsconfig.test.json b/packages/feedback-screenshot/tsconfig.test.json deleted file mode 100644 index ad87caa06c48..000000000000 --- a/packages/feedback-screenshot/tsconfig.test.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "extends": "./tsconfig.json", - - "include": ["test/**/*.ts", "jest.config.ts", "jest.setup.ts"], - - "compilerOptions": { - "types": ["node", "jest"], - "esModuleInterop": true, - "allowJs": true, - "noImplicitAny": true, - "noImplicitThis": false, - "strictNullChecks": true, - "strictPropertyInitialization": false - } -} diff --git a/packages/feedback-screenshot/tsconfig.types.json b/packages/feedback-screenshot/tsconfig.types.json deleted file mode 100644 index 374fd9bc9364..000000000000 --- a/packages/feedback-screenshot/tsconfig.types.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "extends": "./tsconfig.json", - - "compilerOptions": { - "declaration": true, - "declarationMap": true, - "emitDeclarationOnly": true, - "outDir": "build/npm/types" - } -} diff --git a/packages/integration-shims/src/Feedback.ts b/packages/integration-shims/src/Feedback.ts index b0bb3f564779..e6bf1607927b 100644 --- a/packages/integration-shims/src/Feedback.ts +++ b/packages/integration-shims/src/Feedback.ts @@ -13,12 +13,8 @@ const FEEDBACK_INTEGRATION_METHODS = [ ] as const; type FeedbackSpecificMethods = Record<(typeof FEEDBACK_INTEGRATION_METHODS)[number], () => void>; -type FeedbackModalSpecificMethods = { createDialog: () => void }; -type FeedbackScreenshotSpecificMethods = { createInput: () => void }; interface FeedbackIntegration extends Integration, FeedbackSpecificMethods {} -interface FeedbackModalIntegration extends Integration, FeedbackModalSpecificMethods {} -interface FeedbackScreenshotIntegration extends Integration, FeedbackScreenshotSpecificMethods {} /** * This is a shim for the Feedback integration. @@ -39,27 +35,3 @@ export function feedbackIntegrationShim(_options: unknown): FeedbackIntegration }, {} as FeedbackSpecificMethods) as FeedbackSpecificMethods), }; } - -/** - * This is a shim for the FeedbackModal integration. - * It is needed in order for the CDN bundles to continue working when users add/remove feedback - * from it, without changing their config. This is necessary for the loader mechanism. - */ -export function feedbackModalIntegrationShim(): FeedbackModalIntegration { - return { - name: 'FeedbackModal', - createDialog: FAKE_FUNCTION, - }; -} - -/** - * This is a shim for the FeedbackScreenshot integration. - * It is needed in order for the CDN bundles to continue working when users add/remove feedback - * from it, without changing their config. This is necessary for the loader mechanism. - */ -export function feedbackScreenshotIntegrationShim(): FeedbackScreenshotIntegration { - return { - name: 'FeedbackScreenshot', - createInput: FAKE_FUNCTION, - }; -} diff --git a/packages/integration-shims/src/index.ts b/packages/integration-shims/src/index.ts index f3c0937ff9d4..5dfb2caabea1 100644 --- a/packages/integration-shims/src/index.ts +++ b/packages/integration-shims/src/index.ts @@ -1,4 +1,4 @@ -export { feedbackIntegrationShim, feedbackModalIntegrationShim, feedbackScreenshotIntegrationShim } from './Feedback'; +export { feedbackIntegrationShim } from './Feedback'; export { replayIntegrationShim } from './Replay'; export { browserTracingIntegrationShim, diff --git a/packages/nextjs/test/integration/package.json b/packages/nextjs/test/integration/package.json index 0d17d6a049dc..f4c547b5b687 100644 --- a/packages/nextjs/test/integration/package.json +++ b/packages/nextjs/test/integration/package.json @@ -34,8 +34,6 @@ "@sentry-internal/replay": "file:../../../replay-internal", "@sentry-internal/replay-canvas": "file:../../../replay-canvas", "@sentry-internal/feedback": "file:../../../feedback", - "@sentry-internal/feedback-modal": "file:../../../feedback-modal", - "@sentry-internal/feedback-screenshot": "file:../../../feedback-screenshot", "@sentry/types": "file:../../../types", "@sentry/utils": "file:../../../utils", "@sentry/vercel-edge": "file:../../../vercel-edge" diff --git a/packages/remix/test/integration/package.json b/packages/remix/test/integration/package.json index f0f2bb631553..63560ec64e8b 100644 --- a/packages/remix/test/integration/package.json +++ b/packages/remix/test/integration/package.json @@ -32,8 +32,6 @@ "@sentry-internal/replay": "file:../../../replay-internal", "@sentry-internal/replay-canvas": "file:../../../replay-canvas", "@sentry-internal/feedback": "file:../../../feedback", - "@sentry-internal/feedback-modal": "file:../../../feedback-modal", - "@sentry-internal/feedback-screenshot": "file:../../../feedback-screenshot", "@sentry/types": "file:../../../types", "@sentry/utils": "file:../../../utils", "@vanilla-extract/css": "1.13.0", From a71249dcfdce1ede197ff911bbc36ff6a6a08f1c Mon Sep 17 00:00:00 2001 From: Francesco Novy Date: Thu, 11 Apr 2024 08:56:39 +0200 Subject: [PATCH 02/10] Add to bundles --- packages/browser/src/index.bundle.feedback.ts | 12 +++++--- packages/browser/src/index.bundle.replay.ts | 10 +++++-- .../index.bundle.tracing.replay.feedback.ts | 23 +++++++-------- .../src/index.bundle.tracing.replay.ts | 24 ++++++++------- packages/browser/src/index.bundle.tracing.ts | 29 +++++++++++-------- packages/browser/src/index.bundle.ts | 6 +++- packages/browser/src/index.ts | 2 ++ packages/integration-shims/src/Feedback.ts | 28 ++++++++++++++++++ packages/integration-shims/src/index.ts | 6 +++- 9 files changed, 97 insertions(+), 43 deletions(-) diff --git a/packages/browser/src/index.bundle.feedback.ts b/packages/browser/src/index.bundle.feedback.ts index de24e36e2a60..649011bd82ed 100644 --- a/packages/browser/src/index.bundle.feedback.ts +++ b/packages/browser/src/index.bundle.feedback.ts @@ -1,5 +1,4 @@ // This is exported so the loader does not fail when switching off Replay/Tracing -import { feedbackIntegration, getFeedback } from '@sentry-internal/feedback'; import { addTracingExtensionsShim, browserTracingIntegrationShim, @@ -7,11 +6,16 @@ import { } from '@sentry-internal/integration-shims'; export * from './index.bundle.base'; + +export { + feedbackIntegration, + feedbackModalIntegration, + feedbackScreenshotIntegration, + getFeedback, +} from '@sentry-internal/feedback'; + export { browserTracingIntegrationShim as browserTracingIntegration, addTracingExtensionsShim as addTracingExtensions, replayIntegrationShim as replayIntegration, - feedbackIntegration, - getFeedback, }; -// Note: We do not export a shim for `Span` here, as that is quite complex and would blow up the bundle diff --git a/packages/browser/src/index.bundle.replay.ts b/packages/browser/src/index.bundle.replay.ts index ec0a50c92905..bdc776374398 100644 --- a/packages/browser/src/index.bundle.replay.ts +++ b/packages/browser/src/index.bundle.replay.ts @@ -3,14 +3,18 @@ import { addTracingExtensionsShim, browserTracingIntegrationShim, feedbackIntegrationShim, + feedbackModalIntegrationShim, + feedbackScreenshotIntegrationShim, } from '@sentry-internal/integration-shims'; -import { replayIntegration } from '@sentry-internal/replay'; export * from './index.bundle.base'; + +export { replayIntegration } from '@sentry-internal/replay'; + export { browserTracingIntegrationShim as browserTracingIntegration, addTracingExtensionsShim as addTracingExtensions, - replayIntegration, feedbackIntegrationShim as feedbackIntegration, + feedbackModalIntegrationShim as feedbackModalIntegration, + feedbackScreenshotIntegrationShim as feedbackScreenshotIntegration, }; -// Note: We do not export a shim for `Span` here, as that is quite complex and would blow up the bundle diff --git a/packages/browser/src/index.bundle.tracing.replay.feedback.ts b/packages/browser/src/index.bundle.tracing.replay.feedback.ts index 6133fc2870f5..7f178e87c789 100644 --- a/packages/browser/src/index.bundle.tracing.replay.feedback.ts +++ b/packages/browser/src/index.bundle.tracing.replay.feedback.ts @@ -1,15 +1,10 @@ -import { - browserTracingIntegration, - startBrowserTracingNavigationSpan, - startBrowserTracingPageLoadSpan, -} from '@sentry-internal/browser-utils'; -import { feedbackIntegration, getFeedback } from '@sentry-internal/feedback'; -import { replayIntegration } from '@sentry-internal/replay'; import { addTracingExtensions } from '@sentry/core'; // We are patching the global object with our hub extension methods addTracingExtensions(); +export * from './index.bundle.base'; + export { getActiveSpan, getRootSpan, @@ -19,16 +14,20 @@ export { withActiveSpan, getSpanDescendants, setMeasurement, + addTracingExtensions, } from '@sentry/core'; export { feedbackIntegration, - replayIntegration, + feedbackModalIntegration, + feedbackScreenshotIntegration, + getFeedback, +} from '@sentry-internal/feedback'; + +export { browserTracingIntegration, - addTracingExtensions, startBrowserTracingNavigationSpan, startBrowserTracingPageLoadSpan, - getFeedback, -}; +} from '@sentry-internal/browser-utils'; -export * from './index.bundle.base'; +export { replayIntegration } from '@sentry-internal/replay'; diff --git a/packages/browser/src/index.bundle.tracing.replay.ts b/packages/browser/src/index.bundle.tracing.replay.ts index f949ea43541a..494932f6aef3 100644 --- a/packages/browser/src/index.bundle.tracing.replay.ts +++ b/packages/browser/src/index.bundle.tracing.replay.ts @@ -1,15 +1,15 @@ import { - browserTracingIntegration, - startBrowserTracingNavigationSpan, - startBrowserTracingPageLoadSpan, -} from '@sentry-internal/browser-utils'; -import { feedbackIntegrationShim } from '@sentry-internal/integration-shims'; -import { replayIntegration } from '@sentry-internal/replay'; + feedbackIntegrationShim, + feedbackModalIntegrationShim, + feedbackScreenshotIntegrationShim, +} from '@sentry-internal/integration-shims'; import { addTracingExtensions } from '@sentry/core'; // We are patching the global object with our hub extension methods addTracingExtensions(); +export * from './index.bundle.base'; + export { getActiveSpan, getRootSpan, @@ -19,15 +19,19 @@ export { withActiveSpan, getSpanDescendants, setMeasurement, + addTracingExtensions, } from '@sentry/core'; export { - replayIntegration, - feedbackIntegrationShim as feedbackIntegration, browserTracingIntegration, - addTracingExtensions, startBrowserTracingNavigationSpan, startBrowserTracingPageLoadSpan, +} from '@sentry-internal/browser-utils'; + +export { + feedbackIntegrationShim as feedbackIntegration, + feedbackModalIntegrationShim as feedbackModalIntegration, + feedbackScreenshotIntegrationShim as feedbackScreenshotIntegration, }; -export * from './index.bundle.base'; +export { replayIntegration } from '@sentry-internal/replay'; diff --git a/packages/browser/src/index.bundle.tracing.ts b/packages/browser/src/index.bundle.tracing.ts index 1b4f89f935df..b020549f6968 100644 --- a/packages/browser/src/index.bundle.tracing.ts +++ b/packages/browser/src/index.bundle.tracing.ts @@ -1,15 +1,17 @@ -import { - browserTracingIntegration, - startBrowserTracingNavigationSpan, - startBrowserTracingPageLoadSpan, -} from '@sentry-internal/browser-utils'; // This is exported so the loader does not fail when switching off Replay -import { feedbackIntegrationShim, replayIntegrationShim } from '@sentry-internal/integration-shims'; +import { + feedbackIntegrationShim, + feedbackModalIntegrationShim, + feedbackScreenshotIntegrationShim, + replayIntegrationShim, +} from '@sentry-internal/integration-shims'; import { addTracingExtensions } from '@sentry/core'; // We are patching the global object with our hub extension methods addTracingExtensions(); +export * from './index.bundle.base'; + export { getActiveSpan, getRootSpan, @@ -19,15 +21,18 @@ export { withActiveSpan, getSpanDescendants, setMeasurement, + addTracingExtensions, } from '@sentry/core'; export { - feedbackIntegrationShim as feedbackIntegration, - replayIntegrationShim as replayIntegration, browserTracingIntegration, - addTracingExtensions, - startBrowserTracingPageLoadSpan, startBrowserTracingNavigationSpan, -}; + startBrowserTracingPageLoadSpan, +} from '@sentry-internal/browser-utils'; -export * from './index.bundle.base'; +export { + feedbackIntegrationShim as feedbackIntegration, + feedbackModalIntegrationShim as feedbackModalIntegration, + feedbackScreenshotIntegrationShim as feedbackScreenshotIntegration, + replayIntegrationShim as replayIntegration, +}; diff --git a/packages/browser/src/index.bundle.ts b/packages/browser/src/index.bundle.ts index b27672414b20..ce04413b4053 100644 --- a/packages/browser/src/index.bundle.ts +++ b/packages/browser/src/index.bundle.ts @@ -3,14 +3,18 @@ import { addTracingExtensionsShim, browserTracingIntegrationShim, feedbackIntegrationShim, + feedbackModalIntegrationShim, + feedbackScreenshotIntegrationShim, replayIntegrationShim, } from '@sentry-internal/integration-shims'; export * from './index.bundle.base'; + export { addTracingExtensionsShim as addTracingExtensions, browserTracingIntegrationShim as browserTracingIntegration, feedbackIntegrationShim as feedbackIntegration, + feedbackModalIntegrationShim as feedbackModalIntegration, + feedbackScreenshotIntegrationShim as feedbackScreenshotIntegration, replayIntegrationShim as replayIntegration, }; -// Note: We do not export a shim for `Span` here, as that is quite complex and would blow up the bundle diff --git a/packages/browser/src/index.ts b/packages/browser/src/index.ts index 54dd27f8b8b5..bea2adda57ee 100644 --- a/packages/browser/src/index.ts +++ b/packages/browser/src/index.ts @@ -32,6 +32,8 @@ export { replayCanvasIntegration } from '@sentry-internal/replay-canvas'; export { feedbackIntegration, + feedbackModalIntegration, + feedbackScreenshotIntegration, getFeedback, sendFeedback, } from '@sentry-internal/feedback'; diff --git a/packages/integration-shims/src/Feedback.ts b/packages/integration-shims/src/Feedback.ts index e6bf1607927b..b0bb3f564779 100644 --- a/packages/integration-shims/src/Feedback.ts +++ b/packages/integration-shims/src/Feedback.ts @@ -13,8 +13,12 @@ const FEEDBACK_INTEGRATION_METHODS = [ ] as const; type FeedbackSpecificMethods = Record<(typeof FEEDBACK_INTEGRATION_METHODS)[number], () => void>; +type FeedbackModalSpecificMethods = { createDialog: () => void }; +type FeedbackScreenshotSpecificMethods = { createInput: () => void }; interface FeedbackIntegration extends Integration, FeedbackSpecificMethods {} +interface FeedbackModalIntegration extends Integration, FeedbackModalSpecificMethods {} +interface FeedbackScreenshotIntegration extends Integration, FeedbackScreenshotSpecificMethods {} /** * This is a shim for the Feedback integration. @@ -35,3 +39,27 @@ export function feedbackIntegrationShim(_options: unknown): FeedbackIntegration }, {} as FeedbackSpecificMethods) as FeedbackSpecificMethods), }; } + +/** + * This is a shim for the FeedbackModal integration. + * It is needed in order for the CDN bundles to continue working when users add/remove feedback + * from it, without changing their config. This is necessary for the loader mechanism. + */ +export function feedbackModalIntegrationShim(): FeedbackModalIntegration { + return { + name: 'FeedbackModal', + createDialog: FAKE_FUNCTION, + }; +} + +/** + * This is a shim for the FeedbackScreenshot integration. + * It is needed in order for the CDN bundles to continue working when users add/remove feedback + * from it, without changing their config. This is necessary for the loader mechanism. + */ +export function feedbackScreenshotIntegrationShim(): FeedbackScreenshotIntegration { + return { + name: 'FeedbackScreenshot', + createInput: FAKE_FUNCTION, + }; +} diff --git a/packages/integration-shims/src/index.ts b/packages/integration-shims/src/index.ts index 5dfb2caabea1..457761f0778e 100644 --- a/packages/integration-shims/src/index.ts +++ b/packages/integration-shims/src/index.ts @@ -1,4 +1,8 @@ -export { feedbackIntegrationShim } from './Feedback'; +export { + feedbackIntegrationShim, + feedbackModalIntegrationShim, + feedbackScreenshotIntegrationShim, +} from './Feedback'; export { replayIntegrationShim } from './Replay'; export { browserTracingIntegrationShim, From 1134eb05eb2cac65985cfdf00c58581d2670d5e2 Mon Sep 17 00:00:00 2001 From: Francesco Novy Date: Thu, 11 Apr 2024 09:04:34 +0200 Subject: [PATCH 03/10] generate CDN bundles --- .github/workflows/build.yml | 1 + packages/feedback/package.json | 2 +- packages/feedback/rollup.bundle.config.mjs | 54 ++++++++++++++++------ packages/feedback/src/index.bundle.ts | 6 +++ 4 files changed, 49 insertions(+), 14 deletions(-) create mode 100644 packages/feedback/src/index.bundle.ts diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b131d8cb2717..b471b8e10703 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -411,6 +411,7 @@ jobs: ${{ github.workspace }}/packages/browser/build/bundles/** ${{ github.workspace }}/packages/replay/build/bundles/** ${{ github.workspace }}/packages/replay-canvas/build/bundles/** + ${{ github.workspace }}/packages/feedback/build/bundles/** ${{ github.workspace }}/packages/**/*.tgz ${{ github.workspace }}/packages/aws-serverless/build/aws/dist-serverless/*.zip diff --git a/packages/feedback/package.json b/packages/feedback/package.json index 5173a0b636b0..acb921f97324 100644 --- a/packages/feedback/package.json +++ b/packages/feedback/package.json @@ -62,7 +62,7 @@ "build:types:watch": "tsc -p tsconfig.types.json --watch", "build:tarball": "ts-node ../../scripts/prepack.ts --bundles && npm pack ./build/npm", "circularDepCheck": "madge --circular src/index.ts", - "clean": "rimraf build sentry-feedback-*.tgz", + "clean": "rimraf build sentry-internal-feedback-*.tgz", "fix": "eslint . --format stylish --fix", "lint": "eslint . --format stylish", "test": "jest", diff --git a/packages/feedback/rollup.bundle.config.mjs b/packages/feedback/rollup.bundle.config.mjs index f5794d328409..6bdaefed8748 100644 --- a/packages/feedback/rollup.bundle.config.mjs +++ b/packages/feedback/rollup.bundle.config.mjs @@ -1,15 +1,43 @@ import { makeBaseBundleConfig, makeBundleConfigVariants } from '@sentry-internal/rollup-utils'; -export default makeBundleConfigVariants( - makeBaseBundleConfig({ - bundleType: 'addon', - entrypoints: ['src/index.ts'], - jsVersion: 'es6', - licenseTitle: '@sentry-internal/feedback', - outputFileBase: () => 'bundles/feedback', - sucrase: { - jsxPragma: 'h', - jsxFragmentPragma: 'Fragment', - }, - }), -); +export default [ + ...makeBundleConfigVariants( + makeBaseBundleConfig({ + bundleType: 'addon', + entrypoints: ['src/index.bundle.ts'], + jsVersion: 'es6', + licenseTitle: '@sentry-internal/feedback', + outputFileBase: () => 'bundles/feedback', + sucrase: { + jsxPragma: 'h', + jsxFragmentPragma: 'Fragment', + }, + }), + ), + ...makeBundleConfigVariants( + makeBaseBundleConfig({ + bundleType: 'addon', + entrypoints: ['src/screenshot/integration.ts'], + jsVersion: 'es6', + licenseTitle: '@sentry-internal/feedback', + outputFileBase: () => 'bundles/feedback-screenshot', + sucrase: { + jsxPragma: 'h', + jsxFragmentPragma: 'Fragment', + }, + }), + ), + ...makeBundleConfigVariants( + makeBaseBundleConfig({ + bundleType: 'addon', + entrypoints: ['src/modal/integration.tsx'], + jsVersion: 'es6', + licenseTitle: '@sentry-internal/feedback', + outputFileBase: () => 'bundles/feedback-modal', + sucrase: { + jsxPragma: 'h', + jsxFragmentPragma: 'Fragment', + }, + }), + ), +]; diff --git a/packages/feedback/src/index.bundle.ts b/packages/feedback/src/index.bundle.ts new file mode 100644 index 000000000000..a384487e935b --- /dev/null +++ b/packages/feedback/src/index.bundle.ts @@ -0,0 +1,6 @@ +// This file is used as entry point to generate the integration CDN bundle for the core feedback integration +// For now this includes the modal as well, but not feedback +export { sendFeedback } from './core/sendFeedback'; +export { feedbackIntegration } from './core/integration'; +export { feedbackModalIntegration } from './modal/integration'; +export { getFeedback } from './core/getFeedback'; From 7f84d3be0f5401ecdbd5811b98dca3fc7eca043d Mon Sep 17 00:00:00 2001 From: Francesco Novy Date: Thu, 11 Apr 2024 09:10:22 +0200 Subject: [PATCH 04/10] fix size limit --- .size-limit.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.size-limit.js b/.size-limit.js index d102cf8d63b0..6e005fd7c3e7 100644 --- a/.size-limit.js +++ b/.size-limit.js @@ -73,7 +73,7 @@ module.exports = [ path: 'packages/browser/build/npm/esm/index.js', import: createImport('init', 'feedbackIntegration', 'feedbackModalIntegration', 'feedbackScreenshotIntegration'), gzip: true, - limit: '37 KB', + limit: '40 KB', }, { name: '@sentry/browser (incl. sendFeedback)', @@ -143,7 +143,7 @@ module.exports = [ name: 'CDN Bundle (incl. Tracing, Replay, Feedback)', path: createCDNPath('bundle.tracing.replay.feedback.min.js'), gzip: true, - limit: '83 KB', + limit: '86 KB', }, // browser CDN bundles (non-gzipped) { From 67ebd917fd48f086bd1543fd23fc398293227bb1 Mon Sep 17 00:00:00 2001 From: Francesco Novy Date: Thu, 11 Apr 2024 09:12:08 +0200 Subject: [PATCH 05/10] add to lazy load list --- packages/browser/src/utils/lazyLoadIntegration.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/browser/src/utils/lazyLoadIntegration.ts b/packages/browser/src/utils/lazyLoadIntegration.ts index 19cf28f1af52..aaa5987a183c 100644 --- a/packages/browser/src/utils/lazyLoadIntegration.ts +++ b/packages/browser/src/utils/lazyLoadIntegration.ts @@ -8,6 +8,8 @@ const LazyLoadableIntegrations = { replayIntegration: 'replay', replayCanvasIntegration: 'replay-canvas', feedbackIntegration: 'feedback', + feedbackModalIntegration: 'feedback-modal', + feedbackScreenshotIntegration: 'feedback-screenshot', captureConsoleIntegration: 'captureconsole', contextLinesIntegration: 'contextlines', linkedErrorsIntegration: 'linkederrors', From 7fcb281593b0cc3589dd503490d876c05048bdda Mon Sep 17 00:00:00 2001 From: Francesco Novy Date: Thu, 11 Apr 2024 09:15:21 +0200 Subject: [PATCH 06/10] keep tests --- .../test/unit/index.bundle.feedback.test.ts | 10 ++++++---- .../browser/test/unit/index.bundle.replay.test.ts | 14 ++++++++++---- packages/browser/test/unit/index.bundle.test.ts | 15 +++++++++++---- .../index.bundle.tracing.replay.feedback.test.ts | 9 ++++++++- .../test/unit/index.bundle.tracing.replay.test.ts | 8 +++++++- .../test/unit/index.bundle.tracing.test.ts | 9 ++++++++- 6 files changed, 50 insertions(+), 15 deletions(-) diff --git a/packages/browser/test/unit/index.bundle.feedback.test.ts b/packages/browser/test/unit/index.bundle.feedback.test.ts index 5a3451cb3ef0..c403144d4306 100644 --- a/packages/browser/test/unit/index.bundle.feedback.test.ts +++ b/packages/browser/test/unit/index.bundle.feedback.test.ts @@ -1,11 +1,13 @@ import { replayIntegrationShim } from '@sentry-internal/integration-shims'; -import { feedbackIntegration } from '@sentry/browser'; +import { feedbackIntegration, feedbackModalIntegration, feedbackScreenshotIntegration } from '@sentry/browser'; -import * as TracingReplayBundle from '../../src/index.bundle.feedback'; +import * as FeedbackBundle from '../../src/index.bundle.feedback'; describe('index.bundle.feedback', () => { it('has correct exports', () => { - expect(TracingReplayBundle.replayIntegration).toBe(replayIntegrationShim); - expect(TracingReplayBundle.feedbackIntegration).toBe(feedbackIntegration); + expect(FeedbackBundle.replayIntegration).toBe(replayIntegrationShim); + expect(FeedbackBundle.feedbackIntegration).toBe(feedbackIntegration); + expect(FeedbackBundle.feedbackModalIntegration).toBe(feedbackModalIntegration); + expect(FeedbackBundle.feedbackScreenshotIntegration).toBe(feedbackScreenshotIntegration); }); }); diff --git a/packages/browser/test/unit/index.bundle.replay.test.ts b/packages/browser/test/unit/index.bundle.replay.test.ts index 479e6b23393b..4e3d4e344734 100644 --- a/packages/browser/test/unit/index.bundle.replay.test.ts +++ b/packages/browser/test/unit/index.bundle.replay.test.ts @@ -1,11 +1,17 @@ -import { feedbackIntegrationShim } from '@sentry-internal/integration-shims'; +import { + feedbackIntegrationShim, + feedbackModalIntegrationShim, + feedbackScreenshotIntegrationShim, +} from '@sentry-internal/integration-shims'; import { replayIntegration } from '@sentry/browser'; -import * as TracingReplayBundle from '../../src/index.bundle.replay'; +import * as ReplayBundle from '../../src/index.bundle.replay'; describe('index.bundle.replay', () => { it('has correct exports', () => { - expect(TracingReplayBundle.replayIntegration).toBe(replayIntegration); - expect(TracingReplayBundle.feedbackIntegration).toBe(feedbackIntegrationShim); + expect(ReplayBundle.replayIntegration).toBe(replayIntegration); + expect(ReplayBundle.feedbackIntegration).toBe(feedbackIntegrationShim); + expect(ReplayBundle.feedbackModalIntegration).toBe(feedbackModalIntegrationShim); + expect(ReplayBundle.feedbackScreenshotIntegration).toBe(feedbackScreenshotIntegrationShim); }); }); diff --git a/packages/browser/test/unit/index.bundle.test.ts b/packages/browser/test/unit/index.bundle.test.ts index 9ef9f38d8db5..f02e2528f802 100644 --- a/packages/browser/test/unit/index.bundle.test.ts +++ b/packages/browser/test/unit/index.bundle.test.ts @@ -1,10 +1,17 @@ -import { feedbackIntegrationShim, replayIntegrationShim } from '@sentry-internal/integration-shims'; +import { + feedbackIntegrationShim, + feedbackModalIntegrationShim, + feedbackScreenshotIntegrationShim, + replayIntegrationShim, +} from '@sentry-internal/integration-shims'; -import * as TracingBundle from '../../src/index.bundle'; +import * as Bundle from '../../src/index.bundle'; describe('index.bundle', () => { it('has correct exports', () => { - expect(TracingBundle.replayIntegration).toBe(replayIntegrationShim); - expect(TracingBundle.feedbackIntegration).toBe(feedbackIntegrationShim); + expect(Bundle.replayIntegration).toBe(replayIntegrationShim); + expect(Bundle.feedbackIntegration).toBe(feedbackIntegrationShim); + expect(Bundle.feedbackModalIntegration).toBe(feedbackModalIntegrationShim); + expect(Bundle.feedbackScreenshotIntegration).toBe(feedbackScreenshotIntegrationShim); }); }); diff --git a/packages/browser/test/unit/index.bundle.tracing.replay.feedback.test.ts b/packages/browser/test/unit/index.bundle.tracing.replay.feedback.test.ts index a8440d160e2b..873c41bfc769 100644 --- a/packages/browser/test/unit/index.bundle.tracing.replay.feedback.test.ts +++ b/packages/browser/test/unit/index.bundle.tracing.replay.feedback.test.ts @@ -1,5 +1,10 @@ import { browserTracingIntegration } from '@sentry-internal/browser-utils'; -import { feedbackIntegration, replayIntegration } from '@sentry/browser'; +import { + feedbackIntegration, + feedbackModalIntegration, + feedbackScreenshotIntegration, + replayIntegration, +} from '@sentry/browser'; import * as TracingReplayFeedbackBundle from '../../src/index.bundle.tracing.replay.feedback'; @@ -8,5 +13,7 @@ describe('index.bundle.tracing.replay.feedback', () => { expect(TracingReplayFeedbackBundle.replayIntegration).toBe(replayIntegration); expect(TracingReplayFeedbackBundle.browserTracingIntegration).toBe(browserTracingIntegration); expect(TracingReplayFeedbackBundle.feedbackIntegration).toBe(feedbackIntegration); + expect(TracingReplayFeedbackBundle.feedbackModalIntegration).toBe(feedbackModalIntegration); + expect(TracingReplayFeedbackBundle.feedbackScreenshotIntegration).toBe(feedbackScreenshotIntegration); }); }); diff --git a/packages/browser/test/unit/index.bundle.tracing.replay.test.ts b/packages/browser/test/unit/index.bundle.tracing.replay.test.ts index 18c286edffc9..3e2a79e081a9 100644 --- a/packages/browser/test/unit/index.bundle.tracing.replay.test.ts +++ b/packages/browser/test/unit/index.bundle.tracing.replay.test.ts @@ -1,5 +1,9 @@ import { browserTracingIntegration } from '@sentry-internal/browser-utils'; -import { feedbackIntegrationShim } from '@sentry-internal/integration-shims'; +import { + feedbackIntegrationShim, + feedbackModalIntegrationShim, + feedbackScreenshotIntegrationShim, +} from '@sentry-internal/integration-shims'; import { replayIntegration } from '@sentry/browser'; import * as TracingReplayBundle from '../../src/index.bundle.tracing.replay'; @@ -11,5 +15,7 @@ describe('index.bundle.tracing.replay', () => { expect(TracingReplayBundle.browserTracingIntegration).toBe(browserTracingIntegration); expect(TracingReplayBundle.feedbackIntegration).toBe(feedbackIntegrationShim); + expect(TracingReplayBundle.feedbackModalIntegration).toBe(feedbackModalIntegrationShim); + expect(TracingReplayBundle.feedbackScreenshotIntegration).toBe(feedbackScreenshotIntegrationShim); }); }); diff --git a/packages/browser/test/unit/index.bundle.tracing.test.ts b/packages/browser/test/unit/index.bundle.tracing.test.ts index 1bb1ca19eec1..10ec0c6f0fd2 100644 --- a/packages/browser/test/unit/index.bundle.tracing.test.ts +++ b/packages/browser/test/unit/index.bundle.tracing.test.ts @@ -1,5 +1,10 @@ import { browserTracingIntegration } from '@sentry-internal/browser-utils'; -import { feedbackIntegrationShim, replayIntegrationShim } from '@sentry-internal/integration-shims'; +import { + feedbackIntegrationShim, + feedbackModalIntegrationShim, + feedbackScreenshotIntegrationShim, + replayIntegrationShim, +} from '@sentry-internal/integration-shims'; import * as TracingBundle from '../../src/index.bundle.tracing'; @@ -8,5 +13,7 @@ describe('index.bundle.tracing', () => { expect(TracingBundle.replayIntegration).toBe(replayIntegrationShim); expect(TracingBundle.browserTracingIntegration).toBe(browserTracingIntegration); expect(TracingBundle.feedbackIntegration).toBe(feedbackIntegrationShim); + expect(TracingBundle.feedbackModalIntegration).toBe(feedbackModalIntegrationShim); + expect(TracingBundle.feedbackScreenshotIntegration).toBe(feedbackScreenshotIntegrationShim); }); }); From 6740b5deb283837928a5769d58e5299a97c488b7 Mon Sep 17 00:00:00 2001 From: Francesco Novy Date: Thu, 11 Apr 2024 10:01:54 +0200 Subject: [PATCH 07/10] better tests for bundle etc. --- .github/workflows/build.yml | 11 +- .../browser-integration-tests/package.json | 2 + .../suites/feedback/captureFeedback/test.ts | 6 +- .../hasSampling/test.ts | 178 +++++++++--------- .../utils/generatePlugin.ts | 9 +- .../utils/helpers.ts | 12 ++ 6 files changed, 114 insertions(+), 104 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b471b8e10703..81ca274c81b3 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -622,21 +622,20 @@ jobs: - bundle - bundle_min - bundle_replay - - bundle_replay_min - bundle_tracing - - bundle_tracing_min - bundle_tracing_replay - - bundle_tracing_replay_min + - bundle_tracing_replay_feedback + - bundle_tracing_replay_feedback_min project: - chromium include: # Only check all projects for esm & full bundle # We also shard the tests as they take the longest - - bundle: bundle_tracing_replay_min + - bundle: bundle_tracing_replay_feedback_min project: '' shard: 1 shards: 2 - - bundle: bundle_tracing_replay_min + - bundle: bundle_tracing_replay_feedback_min project: '' shard: 2 shards: 2 @@ -653,7 +652,7 @@ jobs: shards: 3 exclude: # Do not run the default chromium-only tests - - bundle: bundle_tracing_replay_min + - bundle: bundle_tracing_replay_feedback_min project: 'chromium' - bundle: esm project: 'chromium' diff --git a/dev-packages/browser-integration-tests/package.json b/dev-packages/browser-integration-tests/package.json index 4224af55ffc7..9a7e99ccb3a9 100644 --- a/dev-packages/browser-integration-tests/package.json +++ b/dev-packages/browser-integration-tests/package.json @@ -23,6 +23,8 @@ "test:bundle:replay:min": "PW_BUNDLE=bundle_replay_min yarn test", "test:bundle:tracing": "PW_BUNDLE=bundle_tracing yarn test", "test:bundle:tracing:min": "PW_BUNDLE=bundle_tracing_min yarn test", + "test:bundle:full": "PW_BUNDLE=bundle_tracing_replay_feedback yarn test", + "test:bundle:full:min": "PW_BUNDLE=bundle_tracing_replay_feedback_min yarn test", "test:cjs": "PW_BUNDLE=cjs yarn test", "test:esm": "PW_BUNDLE=esm yarn test", "test:loader": "npx playwright test -c playwright.loader.config.ts --project='chromium'", diff --git a/dev-packages/browser-integration-tests/suites/feedback/captureFeedback/test.ts b/dev-packages/browser-integration-tests/suites/feedback/captureFeedback/test.ts index 5d4ebe233c4d..21b72e9c4d15 100644 --- a/dev-packages/browser-integration-tests/suites/feedback/captureFeedback/test.ts +++ b/dev-packages/browser-integration-tests/suites/feedback/captureFeedback/test.ts @@ -1,10 +1,10 @@ import { expect } from '@playwright/test'; import { sentryTest } from '../../../utils/fixtures'; -import { envelopeRequestParser, getEnvelopeType } from '../../../utils/helpers'; +import { envelopeRequestParser, getEnvelopeType, shouldSkipFeedbackTest } from '../../../utils/helpers'; -sentryTest('should capture feedback (@sentry-internal/feedback import)', async ({ getLocalTestPath, page }) => { - if (process.env.PW_BUNDLE) { +sentryTest('should capture feedback', async ({ getLocalTestPath, page }) => { + if (shouldSkipFeedbackTest()) { sentryTest.skip(); } diff --git a/dev-packages/browser-integration-tests/suites/feedback/captureFeedbackAndReplay/hasSampling/test.ts b/dev-packages/browser-integration-tests/suites/feedback/captureFeedbackAndReplay/hasSampling/test.ts index 6868caf99545..3323fab23ba4 100644 --- a/dev-packages/browser-integration-tests/suites/feedback/captureFeedbackAndReplay/hasSampling/test.ts +++ b/dev-packages/browser-integration-tests/suites/feedback/captureFeedbackAndReplay/hasSampling/test.ts @@ -1,107 +1,109 @@ import { expect } from '@playwright/test'; import { sentryTest } from '../../../../utils/fixtures'; -import { envelopeRequestParser, getEnvelopeType } from '../../../../utils/helpers'; -import { getCustomRecordingEvents, getReplayEvent, waitForReplayRequest } from '../../../../utils/replayHelpers'; +import { envelopeRequestParser, getEnvelopeType, shouldSkipFeedbackTest } from '../../../../utils/helpers'; +import { + getCustomRecordingEvents, + getReplayEvent, + shouldSkipReplayTest, + waitForReplayRequest, +} from '../../../../utils/replayHelpers'; -sentryTest( - 'should capture feedback (@sentry-internal/feedback import)', - async ({ forceFlushReplay, getLocalTestPath, page }) => { - if (process.env.PW_BUNDLE) { - sentryTest.skip(); - } +sentryTest('should capture feedback', async ({ forceFlushReplay, getLocalTestPath, page }) => { + if (shouldSkipFeedbackTest() || shouldSkipReplayTest()) { + sentryTest.skip(); + } - const reqPromise0 = waitForReplayRequest(page, 0); - const reqPromise1 = waitForReplayRequest(page, 1); - const reqPromise2 = waitForReplayRequest(page, 2); - const feedbackRequestPromise = page.waitForResponse(res => { - const req = res.request(); + const reqPromise0 = waitForReplayRequest(page, 0); + const reqPromise1 = waitForReplayRequest(page, 1); + const reqPromise2 = waitForReplayRequest(page, 2); + const feedbackRequestPromise = page.waitForResponse(res => { + const req = res.request(); - const postData = req.postData(); - if (!postData) { - return false; - } + const postData = req.postData(); + if (!postData) { + return false; + } - try { - return getEnvelopeType(req) === 'feedback'; - } catch (err) { - return false; - } - }); + try { + return getEnvelopeType(req) === 'feedback'; + } catch (err) { + return false; + } + }); - await page.route('https://dsn.ingest.sentry.io/**/*', route => { - return route.fulfill({ - status: 200, - contentType: 'application/json', - body: JSON.stringify({ id: 'test-id' }), - }); + await page.route('https://dsn.ingest.sentry.io/**/*', route => { + return route.fulfill({ + status: 200, + contentType: 'application/json', + body: JSON.stringify({ id: 'test-id' }), }); + }); - const url = await getLocalTestPath({ testDir: __dirname }); + const url = await getLocalTestPath({ testDir: __dirname }); - const [, , replayReq0] = await Promise.all([page.goto(url), page.getByText('Report a Bug').click(), reqPromise0]); + const [, , replayReq0] = await Promise.all([page.goto(url), page.getByText('Report a Bug').click(), reqPromise0]); - // Inputs are slow, these need to be serial - await page.locator('[name="name"]').fill('Jane Doe'); - await page.locator('[name="email"]').fill('janedoe@example.org'); - await page.locator('[name="message"]').fill('my example feedback'); + // Inputs are slow, these need to be serial + await page.locator('[name="name"]').fill('Jane Doe'); + await page.locator('[name="email"]').fill('janedoe@example.org'); + await page.locator('[name="message"]').fill('my example feedback'); - // Force flush here, as inputs are slow and can cause click event to be in unpredictable segments - await Promise.all([forceFlushReplay(), reqPromise1]); + // Force flush here, as inputs are slow and can cause click event to be in unpredictable segments + await Promise.all([forceFlushReplay(), reqPromise1]); - const [, feedbackResp, replayReq2] = await Promise.all([ - page.getByLabel('Send Bug Report').click(), - feedbackRequestPromise, - reqPromise2, - ]); + const [, feedbackResp, replayReq2] = await Promise.all([ + page.getByLabel('Send Bug Report').click(), + feedbackRequestPromise, + reqPromise2, + ]); - const feedbackEvent = envelopeRequestParser(feedbackResp.request()); - const replayEvent = getReplayEvent(replayReq0); - // Feedback breadcrumb is on second segment because we flush when "Report a Bug" is clicked - // And then the breadcrumb is sent when feedback form is submitted - const { breadcrumbs } = getCustomRecordingEvents(replayReq2); + const feedbackEvent = envelopeRequestParser(feedbackResp.request()); + const replayEvent = getReplayEvent(replayReq0); + // Feedback breadcrumb is on second segment because we flush when "Report a Bug" is clicked + // And then the breadcrumb is sent when feedback form is submitted + const { breadcrumbs } = getCustomRecordingEvents(replayReq2); - expect(breadcrumbs).toEqual( - expect.arrayContaining([ - expect.objectContaining({ - category: 'sentry.feedback', - data: { feedbackId: expect.any(String) }, - timestamp: expect.any(Number), - type: 'default', - }), - ]), - ); + expect(breadcrumbs).toEqual( + expect.arrayContaining([ + expect.objectContaining({ + category: 'sentry.feedback', + data: { feedbackId: expect.any(String) }, + timestamp: expect.any(Number), + type: 'default', + }), + ]), + ); - expect(feedbackEvent).toEqual({ - type: 'feedback', - breadcrumbs: expect.any(Array), - contexts: { - feedback: { - contact_email: 'janedoe@example.org', - message: 'my example feedback', - name: 'Jane Doe', - replay_id: replayEvent.event_id, - source: 'widget', - url: expect.stringContaining('/dist/index.html'), - }, - }, - level: 'info', - timestamp: expect.any(Number), - event_id: expect.stringMatching(/\w{32}/), - environment: 'production', - sdk: { - integrations: expect.arrayContaining(['Feedback']), - version: expect.any(String), - name: 'sentry.javascript.browser', - packages: expect.anything(), - }, - request: { + expect(feedbackEvent).toEqual({ + type: 'feedback', + breadcrumbs: expect.any(Array), + contexts: { + feedback: { + contact_email: 'janedoe@example.org', + message: 'my example feedback', + name: 'Jane Doe', + replay_id: replayEvent.event_id, + source: 'widget', url: expect.stringContaining('/dist/index.html'), - headers: { - 'User-Agent': expect.stringContaining(''), - }, }, - platform: 'javascript', - }); - }, -); + }, + level: 'info', + timestamp: expect.any(Number), + event_id: expect.stringMatching(/\w{32}/), + environment: 'production', + sdk: { + integrations: expect.arrayContaining(['Feedback']), + version: expect.any(String), + name: 'sentry.javascript.browser', + packages: expect.anything(), + }, + request: { + url: expect.stringContaining('/dist/index.html'), + headers: { + 'User-Agent': expect.stringContaining(''), + }, + }, + platform: 'javascript', + }); +}); diff --git a/dev-packages/browser-integration-tests/utils/generatePlugin.ts b/dev-packages/browser-integration-tests/utils/generatePlugin.ts index d2907ae47af1..b2536b158a8f 100644 --- a/dev-packages/browser-integration-tests/utils/generatePlugin.ts +++ b/dev-packages/browser-integration-tests/utils/generatePlugin.ts @@ -26,21 +26,14 @@ const useLoader = bundleKey.startsWith('loader'); // In this case, if we encounter this import, we want to add this CDN bundle file instead const IMPORTED_INTEGRATION_CDN_BUNDLE_PATHS: Record = { httpClientIntegration: 'httpclient', - HttpClient: 'httpclient', captureConsoleIntegration: 'captureconsole', CaptureConsole: 'captureconsole', debugIntegration: 'debug', - Debug: 'debug', rewriteFramesIntegration: 'rewriteframes', - RewriteFrames: 'rewriteframes', contextLinesIntegration: 'contextlines', - ContextLines: 'contextlines', extraErrorDataIntegration: 'extraerrordata', - ExtraErrorData: 'extraerrordata', reportingObserverIntegration: 'reportingobserver', - ReportingObserver: 'reportingobserver', sessionTimingIntegration: 'sessiontiming', - SessionTiming: 'sessiontiming', }; const BUNDLE_PATHS: Record> = { @@ -55,6 +48,8 @@ const BUNDLE_PATHS: Record> = { bundle_tracing_min: 'build/bundles/bundle.tracing.min.js', bundle_tracing_replay: 'build/bundles/bundle.tracing.replay.js', bundle_tracing_replay_min: 'build/bundles/bundle.tracing.replay.min.js', + bundle_tracing_replay_feedback: 'build/bundles/bundle.tracing.replay.feedback.js', + bundle_tracing_replay_feedback_min: 'build/bundles/bundle.tracing.replay.feedback.min.js', loader_base: 'build/bundles/bundle.min.js', loader_eager: 'build/bundles/bundle.min.js', loader_debug: 'build/bundles/bundle.debug.min.js', diff --git a/dev-packages/browser-integration-tests/utils/helpers.ts b/dev-packages/browser-integration-tests/utils/helpers.ts index 0e54eea0fb31..2fc55acd51c7 100644 --- a/dev-packages/browser-integration-tests/utils/helpers.ts +++ b/dev-packages/browser-integration-tests/utils/helpers.ts @@ -189,6 +189,18 @@ export function shouldSkipTracingTest(): boolean { return bundle != null && !bundle.includes('tracing') && !bundle.includes('esm') && !bundle.includes('cjs'); } +/** + * We can only test replay tests in certain bundles/packages: + * - NPM (ESM, CJS) + * - CDN bundles that contain the Replay integration + * + * @returns `true` if we should skip the feedback test + */ +export function shouldSkipFeedbackTest(): boolean { + const bundle = process.env.PW_BUNDLE as string | undefined; + return bundle != null && !bundle.includes('feedback') && !bundle.includes('esm') && !bundle.includes('cjs'); +} + /** * Waits until a number of requests matching urlRgx at the given URL arrive. * If the timout option is configured, this function will abort waiting, even if it hasn't reveived the configured From 31e742e22e13a97d095a957a40be9b5fdcb6e0f9 Mon Sep 17 00:00:00 2001 From: Francesco Novy Date: Thu, 11 Apr 2024 10:25:04 +0200 Subject: [PATCH 08/10] fix for feedback bundle --- dev-packages/browser-integration-tests/utils/generatePlugin.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dev-packages/browser-integration-tests/utils/generatePlugin.ts b/dev-packages/browser-integration-tests/utils/generatePlugin.ts index b2536b158a8f..9b967748208e 100644 --- a/dev-packages/browser-integration-tests/utils/generatePlugin.ts +++ b/dev-packages/browser-integration-tests/utils/generatePlugin.ts @@ -222,7 +222,8 @@ class SentryScenarioGenerationPlugin { const integrationBundleKey = bundleKey .replace('loader_', 'bundle_') .replace('_replay', '') - .replace('_tracing', ''); + .replace('_tracing', '') + .replace('_feedback', ''); this.requiredIntegrations.forEach(integration => { const fileName = `${integration}.bundle.js`; From 7cd982a6e918d552e1b5c9e0052951ed4de54ac9 Mon Sep 17 00:00:00 2001 From: Francesco Novy Date: Thu, 11 Apr 2024 12:59:48 +0200 Subject: [PATCH 09/10] update selector somehow the text based is not working... --- .../suites/feedback/captureFeedback/test.ts | 2 +- .../feedback/captureFeedbackAndReplay/hasSampling/init.js | 2 +- .../feedback/captureFeedbackAndReplay/hasSampling/test.ts | 2 +- packages/feedback/src/modal/components/Form.tsx | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/dev-packages/browser-integration-tests/suites/feedback/captureFeedback/test.ts b/dev-packages/browser-integration-tests/suites/feedback/captureFeedback/test.ts index 21b72e9c4d15..b58efe858f25 100644 --- a/dev-packages/browser-integration-tests/suites/feedback/captureFeedback/test.ts +++ b/dev-packages/browser-integration-tests/suites/feedback/captureFeedback/test.ts @@ -39,7 +39,7 @@ sentryTest('should capture feedback', async ({ getLocalTestPath, page }) => { await page.locator('[name="name"]').fill('Jane Doe'); await page.locator('[name="email"]').fill('janedoe@example.org'); await page.locator('[name="message"]').fill('my example feedback'); - await page.getByLabel('Send Bug Report').click(); + await page.locator('[data-sentry-feedback] .btn--primary').click(); const feedbackEvent = envelopeRequestParser((await feedbackRequestPromise).request()); expect(feedbackEvent).toEqual({ diff --git a/dev-packages/browser-integration-tests/suites/feedback/captureFeedbackAndReplay/hasSampling/init.js b/dev-packages/browser-integration-tests/suites/feedback/captureFeedbackAndReplay/hasSampling/init.js index 46441bdf2538..020e045c780d 100644 --- a/dev-packages/browser-integration-tests/suites/feedback/captureFeedbackAndReplay/hasSampling/init.js +++ b/dev-packages/browser-integration-tests/suites/feedback/captureFeedbackAndReplay/hasSampling/init.js @@ -5,7 +5,7 @@ window.Sentry = Sentry; Sentry.init({ dsn: 'https://public@dsn.ingest.sentry.io/1337', replaysOnErrorSampleRate: 1.0, - replaysSessionSampleRate: 0, + replaysSessionSampleRate: 1.0, integrations: [ Sentry.replayIntegration({ flushMinDelay: 200, diff --git a/dev-packages/browser-integration-tests/suites/feedback/captureFeedbackAndReplay/hasSampling/test.ts b/dev-packages/browser-integration-tests/suites/feedback/captureFeedbackAndReplay/hasSampling/test.ts index 3323fab23ba4..86c7e9f25b38 100644 --- a/dev-packages/browser-integration-tests/suites/feedback/captureFeedbackAndReplay/hasSampling/test.ts +++ b/dev-packages/browser-integration-tests/suites/feedback/captureFeedbackAndReplay/hasSampling/test.ts @@ -53,7 +53,7 @@ sentryTest('should capture feedback', async ({ forceFlushReplay, getLocalTestPat await Promise.all([forceFlushReplay(), reqPromise1]); const [, feedbackResp, replayReq2] = await Promise.all([ - page.getByLabel('Send Bug Report').click(), + page.locator('[data-sentry-feedback] .btn--primary').click(), feedbackRequestPromise, reqPromise2, ]); diff --git a/packages/feedback/src/modal/components/Form.tsx b/packages/feedback/src/modal/components/Form.tsx index 5b5c5aa80dd4..f40693d8f2af 100644 --- a/packages/feedback/src/modal/components/Form.tsx +++ b/packages/feedback/src/modal/components/Form.tsx @@ -142,7 +142,7 @@ export function Form({ ) : null} -
+
{error ?
{error}
: null} From 4bc8457a70d369a507316e4986f09118126a5c55 Mon Sep 17 00:00:00 2001 From: Francesco Novy Date: Thu, 11 Apr 2024 16:09:51 +0200 Subject: [PATCH 10/10] make test less flaky --- .../hasSampling/test.ts | 26 ++++++++++--------- 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/dev-packages/browser-integration-tests/suites/feedback/captureFeedbackAndReplay/hasSampling/test.ts b/dev-packages/browser-integration-tests/suites/feedback/captureFeedbackAndReplay/hasSampling/test.ts index 86c7e9f25b38..6768bf838e75 100644 --- a/dev-packages/browser-integration-tests/suites/feedback/captureFeedbackAndReplay/hasSampling/test.ts +++ b/dev-packages/browser-integration-tests/suites/feedback/captureFeedbackAndReplay/hasSampling/test.ts @@ -3,8 +3,8 @@ import { expect } from '@playwright/test'; import { sentryTest } from '../../../../utils/fixtures'; import { envelopeRequestParser, getEnvelopeType, shouldSkipFeedbackTest } from '../../../../utils/helpers'; import { - getCustomRecordingEvents, - getReplayEvent, + collectReplayRequests, + getReplayBreadcrumbs, shouldSkipReplayTest, waitForReplayRequest, } from '../../../../utils/replayHelpers'; @@ -15,8 +15,7 @@ sentryTest('should capture feedback', async ({ forceFlushReplay, getLocalTestPat } const reqPromise0 = waitForReplayRequest(page, 0); - const reqPromise1 = waitForReplayRequest(page, 1); - const reqPromise2 = waitForReplayRequest(page, 2); + const feedbackRequestPromise = page.waitForResponse(res => { const req = res.request(); @@ -42,7 +41,11 @@ sentryTest('should capture feedback', async ({ forceFlushReplay, getLocalTestPat const url = await getLocalTestPath({ testDir: __dirname }); - const [, , replayReq0] = await Promise.all([page.goto(url), page.getByText('Report a Bug').click(), reqPromise0]); + await Promise.all([page.goto(url), page.getByText('Report a Bug').click(), reqPromise0]); + + const replayRequestPromise = collectReplayRequests(page, recordingEvents => { + return getReplayBreadcrumbs(recordingEvents).some(breadcrumb => breadcrumb.category === 'sentry.feedback'); + }); // Inputs are slow, these need to be serial await page.locator('[name="name"]').fill('Jane Doe'); @@ -50,19 +53,18 @@ sentryTest('should capture feedback', async ({ forceFlushReplay, getLocalTestPat await page.locator('[name="message"]').fill('my example feedback'); // Force flush here, as inputs are slow and can cause click event to be in unpredictable segments - await Promise.all([forceFlushReplay(), reqPromise1]); + await Promise.all([forceFlushReplay()]); - const [, feedbackResp, replayReq2] = await Promise.all([ + const [, feedbackResp] = await Promise.all([ page.locator('[data-sentry-feedback] .btn--primary').click(), feedbackRequestPromise, - reqPromise2, ]); + const { replayEvents, replayRecordingSnapshots } = await replayRequestPromise; + const breadcrumbs = getReplayBreadcrumbs(replayRecordingSnapshots); + + const replayEvent = replayEvents[0]; const feedbackEvent = envelopeRequestParser(feedbackResp.request()); - const replayEvent = getReplayEvent(replayReq0); - // Feedback breadcrumb is on second segment because we flush when "Report a Bug" is clicked - // And then the breadcrumb is sent when feedback form is submitted - const { breadcrumbs } = getCustomRecordingEvents(replayReq2); expect(breadcrumbs).toEqual( expect.arrayContaining([