Skip to content

Commit 5fe5272

Browse files
committed
remove isAnonymous from feedback
1 parent 332f8e7 commit 5fe5272

File tree

8 files changed

+6
-54
lines changed

8 files changed

+6
-54
lines changed

packages/feedback/src/integration.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,6 @@ export class Feedback implements Integration {
8080
email: 'email',
8181
name: 'username',
8282
},
83-
isAnonymous = false,
8483
isEmailRequired = false,
8584
isNameRequired = false,
8685

@@ -120,7 +119,6 @@ export class Feedback implements Integration {
120119
id,
121120
showBranding,
122121
autoInject,
123-
isAnonymous,
124122
isEmailRequired,
125123
isNameRequired,
126124
showEmail,

packages/feedback/src/types/index.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,6 @@ export interface FeedbackGeneralConfiguration {
5252
*/
5353
autoInject: boolean;
5454

55-
/**
56-
* If true, will not collect user data (email/name).
57-
*/
58-
isAnonymous: boolean;
59-
6055
/**
6156
* Should the email field be required?
6257
*/

packages/feedback/src/widget/Dialog.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ export function Dialog({
4848
isNameRequired,
4949
isEmailRequired,
5050
colorScheme,
51-
isAnonymous,
5251
defaultName,
5352
defaultEmail,
5453
onClosed,
@@ -103,7 +102,6 @@ export function Dialog({
103102
} = Form({
104103
showEmail,
105104
showName,
106-
isAnonymous,
107105
isEmailRequired,
108106
isNameRequired,
109107

packages/feedback/src/widget/Form.ts

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ export interface FormComponentProps
77
FeedbackInternalOptions,
88
| 'showName'
99
| 'showEmail'
10-
| 'isAnonymous'
1110
| 'isNameRequired'
1211
| 'isEmailRequired'
1312
| Exclude<keyof FeedbackTextConfiguration, 'buttonLabel' | 'formTitle' | 'successMessageText'>
@@ -59,7 +58,6 @@ export function Form({
5958

6059
showName,
6160
showEmail,
62-
isAnonymous,
6361
isNameRequired,
6462
isEmailRequired,
6563

@@ -166,8 +164,7 @@ export function Form({
166164
[
167165
errorEl,
168166

169-
!isAnonymous &&
170-
showName &&
167+
showName &&
171168
createElement(
172169
'label',
173170
{
@@ -184,10 +181,9 @@ export function Form({
184181
nameEl,
185182
],
186183
),
187-
!isAnonymous && !showName && nameEl,
184+
!showName && nameEl,
188185

189-
!isAnonymous &&
190-
showEmail &&
186+
showEmail &&
191187
createElement(
192188
'label',
193189
{
@@ -204,7 +200,7 @@ export function Form({
204200
emailEl,
205201
],
206202
),
207-
!isAnonymous && !showEmail && emailEl,
203+
!showEmail && emailEl,
208204

209205
createElement(
210206
'label',

packages/feedback/src/widget/createWidget.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ export function createWidget({
9999
if (!feedback.message) {
100100
emptyField.push(options.messageLabel);
101101
}
102-
if (emptyField.length != 0) {
102+
if (emptyField.length > 0) {
103103
dialog.showError(`Please enter in the following required fields: ${emptyField.join(', ')}`);
104104
return;
105105
}
@@ -159,7 +159,7 @@ export function createWidget({
159159
return;
160160
}
161161

162-
const userKey = !options.isAnonymous && options.useSentryUser;
162+
const userKey = options.useSentryUser;
163163
const scope = getCurrentHub().getScope();
164164
const user = scope && scope.getUser();
165165

@@ -168,7 +168,6 @@ export function createWidget({
168168
showBranding: options.showBranding,
169169
showName: options.showName || options.isNameRequired,
170170
showEmail: options.showEmail || options.isEmailRequired,
171-
isAnonymous: options.isAnonymous,
172171
isNameRequired: options.isNameRequired,
173172
isEmailRequired: options.isEmailRequired,
174173
formTitle: options.formTitle,

packages/feedback/test/widget/Dialog.test.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ function renderDialog({
99
showName = true,
1010
showEmail = true,
1111
showBranding = false,
12-
isAnonymous = false,
1312
isNameRequired = false,
1413
isEmailRequired = false,
1514
formTitle = 'Feedback',
@@ -29,7 +28,6 @@ function renderDialog({
2928
return Dialog({
3029
formTitle,
3130

32-
isAnonymous,
3331
showName,
3432
showEmail,
3533
isNameRequired,

packages/feedback/test/widget/Form.test.ts

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ type NonNullableFields<T> = {
88
function renderForm({
99
showName = true,
1010
showEmail = true,
11-
isAnonymous = false,
1211
isNameRequired = false,
1312
isEmailRequired = false,
1413
defaultName = 'Foo Bar',
@@ -24,7 +23,6 @@ function renderForm({
2423
...rest
2524
}: Partial<FormComponentProps> = {}) {
2625
return Form({
27-
isAnonymous,
2826
showName,
2927
showEmail,
3028
isNameRequired,
@@ -138,33 +136,4 @@ describe('Form', () => {
138136
name: 'Foo Bar',
139137
});
140138
});
141-
142-
it('does not show name or email inputs for anonymous mode', () => {
143-
const onSubmit = jest.fn();
144-
const formComponent = renderForm({
145-
isNameRequired: true,
146-
isEmailRequired: true,
147-
isAnonymous: true,
148-
onSubmit,
149-
});
150-
const submitEvent = new Event('submit');
151-
152-
expect(formComponent.el).toBeInstanceOf(HTMLFormElement);
153-
const nameInput = formComponent.el.querySelector('[name="name"][type="text"]') as HTMLInputElement;
154-
const emailInput = formComponent.el.querySelector('[name="email"][type="text"]') as HTMLInputElement;
155-
expect(nameInput).toBeNull();
156-
expect(emailInput).toBeNull();
157-
expect(formComponent.el.querySelector('[name="message"]')).not.toBeNull();
158-
159-
const message = formComponent.el.querySelector('[name="message"]') as HTMLTextAreaElement;
160-
message.value = 'Foo (message)';
161-
message.dispatchEvent(new KeyboardEvent('keyup'));
162-
163-
formComponent.el.dispatchEvent(submitEvent);
164-
expect(onSubmit).toHaveBeenCalledWith({
165-
email: '',
166-
message: 'Foo (message)',
167-
name: '',
168-
});
169-
});
170139
});

packages/feedback/test/widget/createWidget.test.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ const DEFAULT_OPTIONS = {
3030
email: 'email',
3131
name: 'username',
3232
},
33-
isAnonymous: false,
3433
isEmailRequired: false,
3534
isNameRequired: false,
3635

0 commit comments

Comments
 (0)