Skip to content

How to get the typed Feedback integration? #10941

Closed
@AdrienFromToulouse

Description

@AdrienFromToulouse

Is there an existing issue for this?

How do you use Sentry?

Sentry Saas (sentry.io)

Which SDK are you using?

@sentry/browser

SDK Version

@sentry/nextjs 7.105.0

Framework Version

18.2.0

Link to Sentry event

No response

SDK Setup

import * as Sentry from '@sentry/nextjs';

const feedback = Sentry.feedbackIntegration({
  autoInject: false,
  colorScheme: 'light',
  buttonLabel: 'Give Feedback',
  messagePlaceholder: '',
  submitButtonLabel: 'Send Feedback',
  formTitle: 'Give Feedback',
  showBranding: false,
  isEmailRequired: false,
  submitBackground: 'rgba(72, 16, 193, 1)',
  submitBackgroundHover: 'rgb(172, 152, 254, 1)',
  submitBorder: 'rgb(172, 152, 254, 1)',
  fontFamily: 'Inter',
  showEmail: false,
  showName: false,
});

Sentry.init({
  dsn: process.env.NEXT_PUBLIC_SENTRY_DSN,
  ignoreErrors: ['ResizeObserver loop completed with undelivered notifications'],
  integrations: [feedback],
});

### Steps to Reproduce

Create a custom component as per the documentation (doc is not up to date with latest change of interface from the SDK)

```jsx
import { BrowserClient, getClient } from '@sentry/react';

const SentryFeedbackButton = () => {
  const client = getClient<BrowserClient>();
  const feedback = client?.getIntegrationByName('Feedback');

  if (!feedback) {
    return null;
  }
 return(
    <button type="button" onClick={() => feedback.openDialog()}>
      Give me feedback
    </button>,
  );
};

export default SentryFeedbackButton;

Expected Result

  • The documentation should be up to date.
  • The method getIntegrationByName should return the appropriate Integration type with its own methods defined.

Actual Result

Not sure how to import the type FeedbackWidget.

The error are:

Property 'return' does not exist on type 'Integration'.
Property 'openDialog' does not exist on type 'Integration'.

Metadata

Metadata

Assignees

Labels

Package: nextjsIssues related to the Sentry Nextjs SDK

Type

Projects

Status

No status

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions