You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: packages/feedback/README.md
+2-262Lines changed: 2 additions & 262 deletions
Original file line number
Diff line number
Diff line change
@@ -11,270 +11,10 @@ This SDK is **considered experimental and in a beta state**. It may experience b
11
11
12
12
To view Feedback in Sentry, your [Sentry organization must be an early adopter](https://docs.sentry.io/product/accounts/early-adopter-features/).
13
13
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
-
18
14
## Installation
19
15
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.
// 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.
50
17
51
18
## Configuration
52
19
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.
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
-
newFeedback({
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.
|`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
-
newFeedback({
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
-
newFeedback({
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).
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
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"`
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