From 24b830a15dc362592a4bffecc07461157cfc4ec1 Mon Sep 17 00:00:00 2001 From: Ryan Albrecht Date: Tue, 9 Apr 2024 09:12:43 -0700 Subject: [PATCH] feat(feedback): Maintain v7 compat in the @sentry-internal/feedback package (#11461) Proceeding along the [plan to get feedback screenshots async loading](https://github.com/getsentry/sentry-javascript/issues/11435#issuecomment-2038271957), this PR imports the feedback modal back into the main package, so we can maintain compatibility with the v7 version of the sdk, which did the same. --- .size-limit.js | 10 +++++----- packages/feedback/src/core/integration.ts | 6 ++++-- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/.size-limit.js b/.size-limit.js index 7fd6db3be736..d102cf8d63b0 100644 --- a/.size-limit.js +++ b/.size-limit.js @@ -52,28 +52,28 @@ module.exports = [ path: 'packages/browser/build/npm/esm/index.js', import: createImport('init', 'browserTracingIntegration', 'replayIntegration', 'feedbackIntegration'), gzip: true, - limit: '80 KB', + limit: '83 KB', }, { name: '@sentry/browser (incl. Feedback)', path: 'packages/browser/build/npm/esm/index.js', import: createImport('init', 'feedbackIntegration'), gzip: true, - limit: '35 KB', + limit: '37 KB', }, { name: '@sentry/browser (incl. Feedback, Feedback Modal)', path: 'packages/browser/build/npm/esm/index.js', import: createImport('init', 'feedbackIntegration', 'feedbackModalIntegration'), gzip: true, - limit: '35 KB', + limit: '37 KB', }, { name: '@sentry/browser (incl. Feedback, Feedback Modal, Feedback Screenshot)', path: 'packages/browser/build/npm/esm/index.js', import: createImport('init', 'feedbackIntegration', 'feedbackModalIntegration', 'feedbackScreenshotIntegration'), gzip: true, - limit: '35 KB', + limit: '37 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: '75 KB', + limit: '83 KB', }, // browser CDN bundles (non-gzipped) { diff --git a/packages/feedback/src/core/integration.ts b/packages/feedback/src/core/integration.ts index e39b032bbc85..b4a513ab3b9f 100644 --- a/packages/feedback/src/core/integration.ts +++ b/packages/feedback/src/core/integration.ts @@ -23,6 +23,7 @@ import { SUBMIT_BUTTON_LABEL, SUCCESS_MESSAGE_TEXT, } from '../constants'; +import { feedbackModalIntegration } from '../modal/integration'; import { DEBUG_BUILD } from '../util/debug-build'; import { isScreenshotSupported } from '../util/isScreenshotSupported'; import { mergeOptions } from '../util/mergeOptions'; @@ -43,7 +44,7 @@ export const feedbackIntegration = (({ autoInject = true, showEmail = true, showName = true, - showScreenshot = true, + showScreenshot = false, useSentryUser = { email: 'email', name: 'username', @@ -141,7 +142,8 @@ export const feedbackIntegration = (({ if (!client) { throw new Error('Sentry Client is not initialized correctly'); } - const modalIntegration = client.getIntegrationByName('FeedbackModal'); + const modalIntegration: FeedbackModalIntegration = feedbackModalIntegration(); + client.addIntegration(modalIntegration); const screenshotIntegration = client.getIntegrationByName('FeedbackScreenshot'); const screenshotIsSupported = isScreenshotSupported();