Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(www): add a form field to distinguish new style form submissions in salesforce #1748

Merged
merged 4 commits into from
Oct 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/www/shared/error_reporter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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};

Check warning on line 18 in src/www/shared/error_reporter.ts

View check run for this annotation

Codecov / codecov/patch

src/www/shared/error_reporter.ts#L18

Added line #L18 was not covered by tests

export interface OutlineErrorReporter {
report(userFeedback: string, feedbackCategory: string, userEmail?: string, tags?: Tags): Promise<void>;
Expand Down
17 changes: 17 additions & 0 deletions src/www/views/contact_view/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 = '[email protected]';
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', '[email protected]', {
subject: 'Test Subject',
accessKeySource: 'a friend',
formVersion: 2,
});
});

it('emits success event on completion of support form', async () => {
const listener = oneEvent(el, 'success');

Expand Down
5 changes: 4 additions & 1 deletion src/www/views/contact_view/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Loading