feat(feedback): add option to show sentry user feedback button
Summary
Create the ability to use the sentry customer feedback button
Checklist
- [x] I've ran
composer run codestyle - [x] I've ran
composer run analyse
Resolves #228
I remember when I used the feedback form I'd to translate everything with:
Sentry.showReportDialog({
eventId: '{{ Sentry::getLastEventID() }}',
user: {
name: '{{ $name }}',
email: '{{ $email }}',
},
lang: '{{ App::getLocale() }}',
title: '@lang('It looks like we’re having issues.')',
subtitle: '@lang('Our team has been notified.')',
subtitle2: '@lang('If you’d like to help, tell us what happened below.')',
labelName: '@lang('Name')',
labelEmail: '@lang('Email')',
labelComments: '@lang('What happened?')',
labelClose: '@lang('Close')',
labelSubmit: '@lang('Submit')',
errorGeneric: '@lang('An unknown error occurred while submitting your report. Please try again.')',
errorFormEntry: '@lang('Some fields were invalid. Please correct the errors and try again.')',
successMessage: '@lang('Your feedback has been sent. Thank you!')',
});
(code taken from a Laravel Blade view)
Is that still the case?
@royduin I must say I have been doubting about all these settings if they should be included in the settings, WDYT each setting an admin field or one text area with a reference to the setting page?
A textarea injected feels a bit hacky but a field for every settings feels bloated. Maybe an additional template partial so it's possible to extend the settings from your own theme? Or maybe make them translatable as in my example? I don't know... @indykoning?
showReportDialog is for reporting feedback after a crash, which can manually be added to the pub/errors/default/report.phtml.
But it is possible to configure this as well
https://docs.sentry.io/platforms/javascript/user-feedback/configuration/#text-customization
I agree that a template partial, or layout xml arguments https://developer.adobe.com/commerce/frontend-core/guide/layouts/xml-instructions/#argument may be the best way to work with this since it would be so much to add configurable.
By the looks of it, sentry does already provide defaults. And for instance already adds the known user information as well. Do we need the ability? Or are the default labels fine?