diff --git a/src/www/shared/error_reporter.ts b/src/www/shared/error_reporter.ts index 60b84cf4a2..ffbb44c9e0 100644 --- a/src/www/shared/error_reporter.ts +++ b/src/www/shared/error_reporter.ts @@ -15,7 +15,7 @@ import * as Sentry from '@sentry/browser'; import {Integration as SentryIntegration} from '@sentry/types'; -export type Tags = {[id: string]: string}; +export type Tags = {[id: string]: string | boolean | number}; export interface OutlineErrorReporter { report(userFeedback: string, feedbackCategory: string, userEmail?: string, tags?: Tags): Promise; diff --git a/src/www/views/contact_view/index.spec.ts b/src/www/views/contact_view/index.spec.ts index 70bacf3098..6ad33017c8 100644 --- a/src/www/views/contact_view/index.spec.ts +++ b/src/www/views/contact_view/index.spec.ts @@ -145,6 +145,23 @@ describe('ContactView client variant', () => { expect(supportForm).not.toBeNull(); }); + it('reports correct values to error reporter on completion of support form', async () => { + const supportForm: SupportForm = el.shadowRoot!.querySelector('support-form')!; + supportForm.values.email = 'foo@bar.com'; + supportForm.values.subject = 'Test Subject'; + supportForm.values.accessKeySource = 'a friend'; + supportForm.values.description = 'Test Description'; + supportForm.valid = true; + supportForm.dispatchEvent(new CustomEvent('submit')); + await nextFrame(); + + expect(mockErrorReporter.report).toHaveBeenCalledWith('Test Description', 'general', 'foo@bar.com', { + subject: 'Test Subject', + accessKeySource: 'a friend', + formVersion: 2, + }); + }); + it('emits success event on completion of support form', async () => { const listener = oneEvent(el, 'success'); diff --git a/src/www/views/contact_view/index.ts b/src/www/views/contact_view/index.ts index 02e3037772..3298492557 100644 --- a/src/www/views/contact_view/index.ts +++ b/src/www/views/contact_view/index.ts @@ -177,7 +177,10 @@ export class ContactView extends LitElement { const {description, email, ...tags} = this.formValues as ValidFormValues; try { - await this.errorReporter.report(description, this.selectedIssueType?.toString() ?? 'unknown', email, {...tags}); + await this.errorReporter.report(description, this.selectedIssueType?.toString() ?? 'unknown', email, { + ...tags, + formVersion: 2, + }); } catch (e) { console.error(`Failed to send feedback report: ${e.message}`); this.isFormSubmitting = false;