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..81ca274c81b3 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 @@ -413,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 @@ -623,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 @@ -654,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/.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) { 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/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..b58efe858f25 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(); } @@ -39,7 +39,7 @@ sentryTest('should capture feedback (@sentry-internal/feedback import)', async ( 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 6868caf99545..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 @@ -1,107 +1,111 @@ import { expect } from '@playwright/test'; import { sentryTest } from '../../../../utils/fixtures'; -import { envelopeRequestParser, getEnvelopeType } from '../../../../utils/helpers'; -import { getCustomRecordingEvents, getReplayEvent, waitForReplayRequest } from '../../../../utils/replayHelpers'; - -sentryTest( - 'should capture feedback (@sentry-internal/feedback import)', - async ({ forceFlushReplay, getLocalTestPath, page }) => { - if (process.env.PW_BUNDLE) { - sentryTest.skip(); +import { envelopeRequestParser, getEnvelopeType, shouldSkipFeedbackTest } from '../../../../utils/helpers'; +import { + collectReplayRequests, + getReplayBreadcrumbs, + shouldSkipReplayTest, + waitForReplayRequest, +} from '../../../../utils/replayHelpers'; + +sentryTest('should capture feedback', async ({ forceFlushReplay, getLocalTestPath, page }) => { + if (shouldSkipFeedbackTest() || shouldSkipReplayTest()) { + sentryTest.skip(); + } + + const reqPromise0 = waitForReplayRequest(page, 0); + + const feedbackRequestPromise = page.waitForResponse(res => { + const req = res.request(); + + const postData = req.postData(); + if (!postData) { + return false; } - 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; - } - - 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 [, , 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'); - - // 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 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(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: { + const url = await getLocalTestPath({ testDir: __dirname }); + + 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'); + 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()]); + + const [, feedbackResp] = await Promise.all([ + page.locator('[data-sentry-feedback] .btn--primary').click(), + feedbackRequestPromise, + ]); + + const { replayEvents, replayRecordingSnapshots } = await replayRequestPromise; + const breadcrumbs = getReplayBreadcrumbs(replayRecordingSnapshots); + + const replayEvent = replayEvents[0]; + const feedbackEvent = envelopeRequestParser(feedbackResp.request()); + + 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'), - 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..9b967748208e 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', @@ -227,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`; 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 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..649011bd82ed 100644 --- a/packages/browser/src/index.bundle.feedback.ts +++ b/packages/browser/src/index.bundle.feedback.ts @@ -1,7 +1,4 @@ // 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, @@ -9,13 +6,16 @@ import { } from '@sentry-internal/integration-shims'; export * from './index.bundle.base'; + export { - browserTracingIntegrationShim as browserTracingIntegration, - addTracingExtensionsShim as addTracingExtensions, - replayIntegrationShim as replayIntegration, feedbackIntegration, feedbackModalIntegration, feedbackScreenshotIntegration, getFeedback, +} from '@sentry-internal/feedback'; + +export { + browserTracingIntegrationShim as browserTracingIntegration, + addTracingExtensionsShim as addTracingExtensions, + 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.bundle.replay.ts b/packages/browser/src/index.bundle.replay.ts index 0c0bb6ca40ef..bdc776374398 100644 --- a/packages/browser/src/index.bundle.replay.ts +++ b/packages/browser/src/index.bundle.replay.ts @@ -6,15 +6,15 @@ import { 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 d26ccf1ba230..7f178e87c789 100644 --- a/packages/browser/src/index.bundle.tracing.replay.feedback.ts +++ b/packages/browser/src/index.bundle.tracing.replay.feedback.ts @@ -1,17 +1,10 @@ -import { - browserTracingIntegration, - startBrowserTracingNavigationSpan, - 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'; // We are patching the global object with our hub extension methods addTracingExtensions(); +export * from './index.bundle.base'; + export { getActiveSpan, getRootSpan, @@ -21,18 +14,20 @@ export { withActiveSpan, getSpanDescendants, setMeasurement, + addTracingExtensions, } from '@sentry/core'; export { feedbackIntegration, feedbackModalIntegration, feedbackScreenshotIntegration, - replayIntegration, + 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 628ebeb19651..494932f6aef3 100644 --- a/packages/browser/src/index.bundle.tracing.replay.ts +++ b/packages/browser/src/index.bundle.tracing.replay.ts @@ -1,19 +1,15 @@ -import { - browserTracingIntegration, - startBrowserTracingNavigationSpan, - startBrowserTracingPageLoadSpan, -} from '@sentry-internal/browser-utils'; import { feedbackIntegrationShim, feedbackModalIntegrationShim, feedbackScreenshotIntegrationShim, } from '@sentry-internal/integration-shims'; -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, @@ -23,17 +19,19 @@ export { withActiveSpan, getSpanDescendants, setMeasurement, + addTracingExtensions, } from '@sentry/core'; export { - replayIntegration, - feedbackIntegrationShim as feedbackIntegration, - feedbackModalIntegrationShim as feedbackModalIntegration, - feedbackScreenshotIntegrationShim as feedbackScreenshotIntegration, 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 29c463fae586..b020549f6968 100644 --- a/packages/browser/src/index.bundle.tracing.ts +++ b/packages/browser/src/index.bundle.tracing.ts @@ -1,8 +1,3 @@ -import { - browserTracingIntegration, - startBrowserTracingNavigationSpan, - startBrowserTracingPageLoadSpan, -} from '@sentry-internal/browser-utils'; // This is exported so the loader does not fail when switching off Replay import { feedbackIntegrationShim, @@ -15,6 +10,8 @@ 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, @@ -24,17 +21,18 @@ export { withActiveSpan, getSpanDescendants, setMeasurement, + addTracingExtensions, } from '@sentry/core'; +export { + browserTracingIntegration, + startBrowserTracingNavigationSpan, + startBrowserTracingPageLoadSpan, +} from '@sentry-internal/browser-utils'; + export { feedbackIntegrationShim as feedbackIntegration, feedbackModalIntegrationShim as feedbackModalIntegration, feedbackScreenshotIntegrationShim as feedbackScreenshotIntegration, replayIntegrationShim as replayIntegration, - browserTracingIntegration, - addTracingExtensions, - startBrowserTracingPageLoadSpan, - startBrowserTracingNavigationSpan, }; - -export * from './index.bundle.base'; diff --git a/packages/browser/src/index.bundle.ts b/packages/browser/src/index.bundle.ts index 10482f8135cf..ce04413b4053 100644 --- a/packages/browser/src/index.bundle.ts +++ b/packages/browser/src/index.bundle.ts @@ -9,6 +9,7 @@ import { } from '@sentry-internal/integration-shims'; export * from './index.bundle.base'; + export { addTracingExtensionsShim as addTracingExtensions, browserTracingIntegrationShim as browserTracingIntegration, @@ -17,4 +18,3 @@ export { 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..bea2adda57ee 100644 --- a/packages/browser/src/index.ts +++ b/packages/browser/src/index.ts @@ -32,11 +32,11 @@ export { replayCanvasIntegration } from '@sentry-internal/replay-canvas'; export { feedbackIntegration, + feedbackModalIntegration, + feedbackScreenshotIntegration, 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/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', 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/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'; 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} diff --git a/packages/integration-shims/src/index.ts b/packages/integration-shims/src/index.ts index f3c0937ff9d4..457761f0778e 100644 --- a/packages/integration-shims/src/index.ts +++ b/packages/integration-shims/src/index.ts @@ -1,4 +1,8 @@ -export { feedbackIntegrationShim, feedbackModalIntegrationShim, feedbackScreenshotIntegrationShim } from './Feedback'; +export { + feedbackIntegrationShim, + feedbackModalIntegrationShim, + feedbackScreenshotIntegrationShim, +} 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",