Skip to content

Commit 8536a29

Browse files
authored
meta(feedback): Remove README and point users to the official documentation (#10233)
1 parent 431f3b2 commit 8536a29

File tree

1 file changed

+2
-262
lines changed

1 file changed

+2
-262
lines changed

packages/feedback/README.md

Lines changed: 2 additions & 262 deletions
Original file line numberDiff line numberDiff line change
@@ -11,270 +11,10 @@ This SDK is **considered experimental and in a beta state**. It may experience b
1111

1212
To view Feedback in Sentry, your [Sentry organization must be an early adopter](https://docs.sentry.io/product/accounts/early-adopter-features/).
1313

14-
## Pre-requisites
15-
16-
`@sentry-internal/feedback` currently can only be used by browsers with [Shadow DOM](https://developer.mozilla.org/en-US/docs/Web/API/Web_components/Using_shadow_DOM) support.
17-
1814
## Installation
1915

20-
During the alpha phase, the feedback integration will need to be imported from `@sentry-internal/feedback`. This will be
21-
changed for the general release.
22-
23-
```shell
24-
npm add @sentry-internal/feedback
25-
```
26-
27-
## Setup
28-
29-
To set up the integration, add the following to your Sentry initialization. This will inject a feedback button to the bottom right corner of your application. Users can then click it to open up a feedback form where they can submit feedback.
30-
31-
Several options are supported and passable via the integration constructor. See the [configuration section](#configuration) below for more details.
32-
33-
```javascript
34-
import * as Sentry from '@sentry/browser';
35-
// or from a framework specific SDK, e.g.
36-
// import * as Sentry from '@sentry/react';
37-
import { Feedback } from '@sentry-internal/feedback';
38-
39-
Sentry.init({
40-
dsn: '__DSN__',
41-
integrations: [
42-
new Feedback({
43-
// Additional SDK configuration goes in here, for example:
44-
// See below for all available options
45-
})
46-
],
47-
// ...
48-
});
49-
```
16+
Please read the [offical integration documentation](https://docs.sentry.io/platforms/javascript/user-feedback/) for installation instructions.
5017

5118
## Configuration
5219

53-
### General Integration Configuration
54-
55-
The following options can be configured as options to the integration, in `new Feedback({})`:
56-
57-
| key | type | default | description |
58-
| --------- | ------- | ------- | ----------- |
59-
| `autoInject` | `boolean` | `true` | Injects the Feedback widget into the application when the integration is added. This is useful to turn off if you bring your own button, or only want to show the widget on certain views. |
60-
| `showBranding` | `boolean` | `true` | Displays the Sentry logo inside of the dialog |
61-
| `colorScheme` | `"system" \| "light" \| "dark"` | `"system"` | The color theme to use. `"system"` will follow your OS colorscheme. |
62-
63-
### User/form Related Configuration
64-
| key | type | default | description |
65-
| --------- | ------- | ------- | ----------- |
66-
| `showName` | `boolean` | `true` | Displays the name field on the feedback form, however will still capture the name (if available) from Sentry SDK context. |
67-
| `showEmail` | `boolean` | `true` | Displays the email field on the feedback form, however will still capture the email (if available) from Sentry SDK context. |
68-
| `isNameRequired` | `boolean` | `false` | Requires the name field on the feedback form to be filled in. |
69-
| `isEmailRequired` | `boolean` | `false` | Requires the email field on the feedback form to be filled in. |
70-
| `useSentryUser` | `Record<string, string>` | `{ email: 'email', name: 'username'}` | Map of the `email` and `name` fields to the corresponding Sentry SDK user fields that were called with `Sentry.setUser`. |
71-
72-
By default the Feedback integration will attempt to fill in the name/email fields if you have set a user context via [`Sentry.setUser`](https://docs.sentry.io/platforms/javascript/enriching-events/identify-user/). By default it expects the email and name fields to be `email` and `username`. Below is an example configuration with non-default user fields.
73-
74-
```javascript
75-
Sentry.setUser({
76-
userEmail: '[email protected]',
77-
fullName: 'Jane Doe',
78-
});
79-
80-
new Feedback({
81-
useSentryUser: {
82-
email: 'userEmail',
83-
name: 'fullName',
84-
},
85-
})
86-
```
87-
88-
### Text Customization
89-
Most text that you see in the default Feedback widget can be customized.
90-
91-
| key | default | description |
92-
| --------- | ------- | ----------- |
93-
| `buttonLabel` | `Report a Bug` | The label of the widget button. |
94-
| `submitButtonLabel` | `Send Bug Report` | The label of the submit button used in the feedback form dialog. |
95-
| `cancelButtonLabel` | `Cancel` | The label of the cancel button used in the feedback form dialog. |
96-
| `formTitle` | `Report a Bug` | The title at the top of the feedback form dialog. |
97-
| `nameLabel` | `Name` | The label of the name input field. |
98-
| `namePlaceholder` | `Your Name` | The placeholder for the name input field. |
99-
| `emailLabel` | `Email` | The label of the email input field. |
100-
| `emailPlaceholder` | `[email protected]` | The placeholder for the email input field. |
101-
| `messageLabel` | `Description` | The label for the feedback description input field. |
102-
| `messagePlaceholder` | `What's the bug? What did you expect?` | The placeholder for the feedback description input field. |
103-
| `successMessageText` | `Thank you for your report!` | The message to be displayed after a succesful feedback submission. |
104-
105-
106-
Example of customization
107-
108-
```javascript
109-
new Feedback({
110-
buttonLabel: 'Feedback',
111-
submitButtonLabel: 'Send Feedback',
112-
formTitle: 'Send Feedback',
113-
});
114-
```
115-
116-
### Theme Customization
117-
Colors can be customized via the Feedback constructor or by defining CSS variables on the widget button. If you use the default widget button, it will have an `id="sentry-feedback`, meaning you can use the `#sentry-feedback` selector to define CSS variables to override.
118-
119-
| key | css variable | light | dark | description |
120-
| --- | --- | --- | --- | --- |
121-
| `background` | `--background` | `#ffffff` | `#29232f` | Background color of the widget actor and dialog |
122-
| `backgroundHover` | `--background-hover` | `#f6f6f7` | `#352f3b` | Background color of widget actor when in a hover state |
123-
| `foreground` | `--foreground` | `#2b2233` | `#ebe6ef` | Foreground color, e.g. text color |
124-
| `error` | `--error` | `#df3338` | `#f55459` | Color used for error related components (e.g. text color when there was an error submitting feedback) |
125-
| `success` | `--success` | `#268d75` | `#2da98c` | Color used for success-related components (e.g. text color when feedback is submitted successfully) |
126-
| `border` | `--border` | `1.5px solid rgba(41, 35, 47, 0.13)` | `1.5px solid rgba(235, 230, 239, 0.15)` | The border style used for the widget actor and dialog |
127-
| `boxShadow` | `--box-shadow` | `0px 4px 24px 0px rgba(43, 34, 51, 0.12)` | `0px 4px 24px 0px rgba(43, 34, 51, 0.12)` | The box shadow style used for the widget actor and dialog |
128-
| `submitBackground` | `--submit-background` | `rgba(88, 74, 192, 1)` | `rgba(88, 74, 192, 1)` | Background color for the submit button |
129-
| `submitBackgroundHover` | `--submit-background-hover` | `rgba(108, 95, 199, 1)` | `rgba(108, 95, 199, 1)` | Background color when hovering over the submit button |
130-
| `submitBorder` | `--submit-border` | `rgba(108, 95, 199, 1)` | `rgba(108, 95, 199, 1)` | Border style for the submit button |
131-
| `submitOutlineFocus` | `--submit-outline-focus` | `rgba(108, 95, 199, 1)` | `rgba(108, 95, 199, 1)` | Outline color for the submit button, in the focused state |
132-
| `submitForeground` | `--submit-foreground` | `#ffffff` | `#ffffff` | Foreground color for the submit button |
133-
| `submitForegroundHover` | `--submit-foreground-hover` | `#ffffff` | `#ffffff` | Foreground color for the submit button when hovering |
134-
| `cancelBackground` | `--cancel-background` | `transparent` | `transparent` | Background color for the cancel button |
135-
| `cancelBackgroundHover` | `--cancel-background-hover` | `var(--background-hover)` | `var(--background-hover)` | Background color when hovering over the cancel button |
136-
| `cancelBorder` | `--cancel-border` | `var(--border)` | `var(--border)` | Border style for the cancel button |
137-
| `cancelOutlineFocus` | `--cancel-outline-focus` | `var(--input-outline-focus)` | `var(--input-outline-focus)` | Outline color for the cancel button, in the focused state |
138-
| `cancelForeground` | `--cancel-foreground` | `var(--foreground)` | `var(--foreground)` | Foreground color for the cancel button |
139-
| `cancelForegroundHover` | `--cancel-foreground-hover` | `var(--foreground)` | `var(--foreground)` | Foreground color for the cancel button when hovering |
140-
| `inputBackground` | `--input-background` | `inherit` | `inherit` | Background color for form inputs |
141-
| `inputForeground` | `--input-foreground` | `inherit` | `inherit` | Foreground color for form inputs |
142-
| `inputBorder` | `--input-border` | `var(--border)` | `var(--border)` | Border styles for form inputs |
143-
| `inputOutlineFocus` | `--input-outline-focus` | `rgba(108, 95, 199, 1)` | `rgba(108, 95, 199, 1)` | Outline color for form inputs when focused |
144-
145-
Here is an example of customizing only the background color for the light theme using the Feedback constructor configuration.
146-
```javascript
147-
new Feedback({
148-
themeLight: {
149-
background: "#cccccc",
150-
},
151-
})
152-
```
153-
154-
Or the same example above but using the CSS variables method:
155-
156-
```css
157-
#sentry-feedback {
158-
--background: #cccccc;
159-
}
160-
```
161-
162-
### Additional UI Customization
163-
Similar to theme customization above, these are additional CSS variables that can be overridden. Note these are not supported in the constructor.
164-
165-
| Variable | Default | Description |
166-
| --- | --- | --- |
167-
| `--bottom` | `1rem` | By default the widget has a position of fixed, and is in the bottom right corner. |
168-
| `--right` | `1rem` | By default the widget has a position of fixed, and is in the bottom right corner. |
169-
| `--top` | `auto` | By default the widget has a position of fixed, and is in the bottom right corner. |
170-
| `--left` | `auto` | By default the widget has a position of fixed, and is in the bottom right corner. |
171-
| `--z-index` | `100000` | The z-index of the widget |
172-
| `--font-family` | `"'Helvetica Neue', Arial, sans-serif"` | Default font-family to use|
173-
| `--font-size` | `14px` | Font size |
174-
175-
### Event Callbacks
176-
Sometimes it’s important to know when someone has started to interact with the feedback form, so you can add custom logging, or start/stop background timers on the page until the user is done.
177-
178-
Pass these callbacks when you initialize the Feedback integration:
179-
180-
```javascript
181-
new Feedback({
182-
onFormOpen: () => {},
183-
onFormClose: () => {},
184-
onSubmitSuccess: () => {},
185-
onSubmitError: () => {},
186-
});
187-
```
188-
189-
## Further Customization
190-
There are two more methods in the integration that can help customization.
191-
192-
### Bring Your Own Button
193-
194-
You can skip the default widget button and use your own button. Call `feedback.attachTo()` to have the SDK attach a click listener to your own button. You can additionally supply the same customization options that the constructor accepts (e.g. for text labels and colors).
195-
196-
```javascript
197-
const feedback = new Feedback({
198-
// Disable injecting the default widget
199-
autoInject: false,
200-
});
201-
202-
feedback.attachTo(document.querySelector('#your-button'), {
203-
formTitle: "Report a Bug!"
204-
});
205-
```
206-
207-
Alternatively you can call `feedback.openDialog()`:
208-
209-
```typescript
210-
import {BrowserClient, getCurrentHub} from '@sentry/react';
211-
import {Feedback} from '@sentry-internal/feedback';
212-
213-
function MyFeedbackButton() {
214-
const client = getCurrentHub().getClient<BrowserClient>();
215-
const feedback = client?.getIntegrationByName('Feedback');
216-
217-
// Don't render custom feedback button if Feedback integration not installed
218-
if (!feedback) {
219-
return null;
220-
}
221-
222-
return (
223-
<button type="button" onClick={() => feedback.openDialog()}>
224-
Give me feedback
225-
</button>
226-
)
227-
}
228-
```
229-
230-
### Bring Your Own Widget
231-
232-
You can also bring your own widget and UI and simply pass a feedback object to the `sendFeedback()` function. The `sendFeedback` function accepts two parameters:
233-
* a feedback object with a required `message` property, and additionally, optional `name` and `email` properties
234-
* an options object
235-
236-
```javascript
237-
sendFeedback({
238-
name: 'Jane Doe', // optional
239-
email: '[email protected]', // optional
240-
message: 'This is an example feedback', // required
241-
}, {
242-
includeReplay: true, // optional
243-
})
244-
```
245-
246-
Here is a simple example
247-
248-
```html
249-
<form id="my-feedback-form">
250-
<input name="name" />
251-
<input name="email" />
252-
<textarea name="message" placeholder="What's the issue?" />
253-
</form>
254-
```
255-
256-
```javascript
257-
import {BrowserClient, getCurrentHub} from '@sentry/react';
258-
import {Feedback} from '@sentry-internal/feedback';
259-
260-
document.getElementById('my-feedback-form').addEventListener('submit', (event) => {
261-
const feedback = getCurrentHub().getClient<BrowserClient>()?.getIntegrationByName('Feedback');
262-
const formData = new FormData(event.currentTarget);
263-
feedback.sendFeedback(formData);
264-
event.preventDefault();
265-
});
266-
```
267-
268-
## Alerting on User Feedback Reports
269-
270-
Note: The following instructions are to be followed in the Sentry product.
271-
272-
If you have Sentry's default issue alert ("Alert me on every new issue") turned on for the project you are setting up User Feedback on, no action is required to have alerting on each user feedback report.
273-
274-
If you don't have Sentry's default issue alert turned on, follow these steps:
275-
276-
1. Navigate to [Create New Alert Rule](https://sentry.io/alerts/new/issue/) in Sentry (Click "Alerts" in the left-nav menu, "Create Alert" in the top right corner, ensure the "Issues" radio button is selected under the "Errors" category, and then click "Set Conditions")
277-
2. In "Set conditions", add an "IF" filter for `The issue's category is equal to "Feedback"`
278-
3. Add any other alert rules
279-
280-
![Feedback Alert Rule Creation Screenshot](https://github.com/getsentry/sentry-javascript/assets/79684/1d941967-debb-4ad6-9458-3226c02ec08e)
20+
The Feedback integration is highly customizable, please read the [official integration documentation](https://docs.sentry.io/platforms/javascript/user-feedback/configuration/) for the most up-to-date configuration options.

0 commit comments

Comments
 (0)