1- <?php /** @var \JustBetter\Sentry\Block\SentryScript $block */ ?>
2- if (typeof Sentry !== 'undefined') {
3- Sentry.init({
4- dsn: '<?= $ escaper ->escapeUrl (trim ($ block ->getDSN ())) ?> ',
5- release: '<?= $ escaper ->escapeHtml (trim ($ block ->getVersion ())) ?> ',
6- environment: '<?= $ escaper ->escapeHtml (trim ($ block ->getEnvironment ())) ?> ',
7- integrations: [
8- <?php if ($ block ->isTracingEnabled ()): ?>
9- Sentry.browserTracingIntegration({
10- enableInp: true,
11- }),
12- <?php endif ?>
13- <?php if ($ block ->useSessionReplay ()): ?>
14- Sentry.replayIntegration({
15- blockAllMedia: <?= $ escaper ->escapeHtml ($ block ->getReplayBlockMedia () ? 'true ' : 'false ' ) ?> ,
16- maskAllText: <?= $ escaper ->escapeHtml ($ block ->getReplayMaskText () ? 'true ' : 'false ' ) ?> ,
17- })
18- <?php endif ?>
19- ],
20- <?php if ($ block ->isTracingEnabled ()): ?>
21- tracesSampleRate: <?= $ escaper ->escapeHtml ($ block ->getTracingSampleRate ()) ?> ,
22- <?php endif ?>
23- <?php if ($ block ->useSessionReplay ()): ?>
24- replaysSessionSampleRate: <?= $ escaper ->escapeHtml ($ block ->getReplaySessionSampleRate ()) ?> ,
25- replaysOnErrorSampleRate: <?= $ escaper ->escapeHtml ($ block ->getReplayErrorSampleRate ()) ?> ,
26- <?php endif ?>
27- ignoreErrors: <?= /** @noEscape */ $ block ->getIgnoreJsErrors () ?> ,
28- <?php if ($ block ->stripStaticContentVersion () || $ block ->stripStoreCode ()): ?>
29- beforeSend: function(event) {
30- event.exception.values.map(function (value) {
31- if (value.stacktrace === undefined || ! value.stacktrace) {
32- return value;
33- }
1+ <?php
342
35- <?php if ($ block ->stripStaticContentVersion ()): ?>
36- value.stacktrace.frames.map(function (frame) {
37- frame.filename = frame.filename.replace(/version[0-9]{10}\//, '');
38- return frame;
39- });
40- <?php endif ; ?>
3+ /** @var \JustBetter\Sentry\Block\SentryScript $block */ ?>
4+ if (typeof Sentry !== 'undefined') {
5+ Sentry.init({
6+ dsn: '<?= $ escaper ->escapeUrl (trim ($ block ->getDSN ())) ?> ',
7+ release: '<?= $ escaper ->escapeHtml (trim ($ block ->getVersion ())) ?> ',
8+ environment: '<?= $ escaper ->escapeHtml (trim ($ block ->getEnvironment ())) ?> ',
9+ integrations: [
10+ <?php if ($ block ->isTracingEnabled ()): ?>
11+ Sentry.browserTracingIntegration({
12+ enableInp: true,
13+ }),
14+ <?php endif ?>
15+ <?php if ($ block ->useSessionReplay ()): ?>
16+ Sentry.replayIntegration({
17+ blockAllMedia: <?= $ escaper ->escapeHtml ($ block ->getReplayBlockMedia () ? 'true ' : 'false ' ) ?> ,
18+ maskAllText: <?= $ escaper ->escapeHtml ($ block ->getReplayMaskText () ? 'true ' : 'false ' ) ?> ,
19+ }),
20+ <?php endif ?>
21+ <?php if ($ block ->isFeedbackButtonEnabled ()): ?>
22+ Sentry.feedbackIntegration({}),
23+ <?php endif ?>
24+ ],
25+ <?php if ($ block ->isTracingEnabled ()): ?>
26+ tracesSampleRate: <?= $ escaper ->escapeHtml ($ block ->getTracingSampleRate ()) ?> ,
27+ <?php endif ?>
28+ <?php if ($ block ->useSessionReplay ()): ?>
29+ replaysSessionSampleRate: <?= $ escaper ->escapeHtml ($ block ->getReplaySessionSampleRate ()) ?> ,
30+ replaysOnErrorSampleRate: <?= $ escaper ->escapeHtml ($ block ->getReplayErrorSampleRate ()) ?> ,
31+ <?php endif ?>
32+ ignoreErrors: <?=
33+ /** @noEscape */
34+ $ block ->getIgnoreJsErrors () ?> ,
35+ <?php if ($ block ->stripStaticContentVersion () || $ block ->stripStoreCode ()): ?>
36+ beforeSend: function(event) {
37+ event.exception.values.map(function (value) {
38+ if (value.stacktrace === undefined || ! value.stacktrace) {
39+ return value;
40+ }
4141
42- <?php if ($ block ->stripStoreCode ()): ?>
43- value.stacktrace.frames.map(function (frame) {
44- <?php // phpcs:disable Generic.Files.LineLength ?>
45- frame.filename = frame.filename.replace('/<?= $ escaper ->escapeHtml ($ block ->getStoreCode ()); ?> /', '/');
46- <?php // phpcs:enable Generic.Files.LineLength ?>
47- return frame;
48- });
49- <?php endif ; ?>
42+ <?php if ($ block ->stripStaticContentVersion ()): ?>
43+ value.stacktrace.frames.map(function (frame) {
44+ frame.filename = frame.filename.replace(/version[0-9]{10}\//, '');
45+ return frame;
46+ });
47+ <?php endif ; ?>
5048
51- return value;
49+ <?php if ($ block ->stripStoreCode ()): ?>
50+ value.stacktrace.frames.map(function (frame) {
51+ <?php // phpcs:disable Generic.Files.LineLength
52+ ?>
53+ frame.filename = frame.filename.replace('/<?= $ escaper ->escapeHtml ($ block ->getStoreCode ()); ?> /', '/');
54+ <?php // phpcs:enable Generic.Files.LineLength
55+ ?>
56+ return frame;
5257 });
53- return event;
54- }
5558 <?php endif ; ?>
59+
60+ return value;
5661 });
57- }
62+ return event;
63+ }
64+ <?php endif ; ?>
65+ });
66+ }
0 commit comments