Skip to content

Commit 88ceab4

Browse files
author
Luca Forstner
authored
Merge pull request #9614 from getsentry/prepare-release/7.81.1
2 parents 7dad213 + aa459aa commit 88ceab4

File tree

31 files changed

+284
-141
lines changed

31 files changed

+284
-141
lines changed

.github/ISSUE_TEMPLATE/bug.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ body:
3535
- '@sentry/angular'
3636
- '@sentry/angular-ivy'
3737
- '@sentry/bun'
38+
- '@sentry/deno'
3839
- '@sentry/ember'
3940
- '@sentry/gatsby'
4041
- '@sentry/nextjs'

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,16 @@
44

55
- "You miss 100 percent of the chances you don't take. — Wayne Gretzky" — Michael Scott
66

7+
## 7.81.1
8+
9+
- fix(astro): Remove method from span op (#9603)
10+
- fix(deno): Make sure files get published (#9611)
11+
- fix(nextjs): Use `globalThis` instead of `global` in edge runtime (#9612)
12+
- fix(node): Improve error handling and shutdown handling for ANR (#9548)
13+
- fix(tracing-internal): Fix case when originalURL contain query params (#9531)
14+
15+
Work in this release contributed by @powerfulyang, @LubomirIgonda1, @joshkel, and @alexgleason. Thank you for your contributions!
16+
717
## 7.81.0
818

919
### Important Changes

packages/astro/src/server/middleware.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ export const handleRequest: (options?: MiddlewareOptions) => MiddlewareResponseH
8383
const res = await startSpan(
8484
{
8585
name: `${method} ${interpolateRouteFromUrlAndParams(ctx.url.pathname, ctx.params)}`,
86-
op: `http.server.${method.toLowerCase()}`,
86+
op: 'http.server',
8787
origin: 'auto.http.astro',
8888
status: 'ok',
8989
...traceparentData,

packages/astro/test/server/middleware.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ describe('sentryMiddleware', () => {
4747
source: 'route',
4848
},
4949
name: 'GET /users/[id]/details',
50-
op: 'http.server.get',
50+
op: 'http.server',
5151
origin: 'auto.http.astro',
5252
status: 'ok',
5353
},

packages/core/src/baseclient.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import type {
2727
Transport,
2828
TransportMakeRequestResponse,
2929
} from '@sentry/types';
30+
import type { FeedbackEvent } from '@sentry/types';
3031
import {
3132
addItemToEnvelope,
3233
checkOrSetAlreadyCaught,
@@ -413,6 +414,12 @@ export abstract class BaseClient<O extends ClientOptions> implements Client<O> {
413414
/** @inheritdoc */
414415
public on(hook: 'otelSpanEnd', callback: (otelSpan: unknown, mutableOptions: { drop: boolean }) => void): void;
415416

417+
/** @inheritdoc */
418+
public on(
419+
hook: 'beforeSendFeedback',
420+
callback: (feedback: FeedbackEvent, options?: { includeReplay: boolean }) => void,
421+
): void;
422+
416423
/** @inheritdoc */
417424
public on(hook: string, callback: unknown): void {
418425
if (!this._hooks[hook]) {
@@ -450,6 +457,9 @@ export abstract class BaseClient<O extends ClientOptions> implements Client<O> {
450457
/** @inheritdoc */
451458
public emit(hook: 'otelSpanEnd', otelSpan: unknown, mutableOptions: { drop: boolean }): void;
452459

460+
/** @inheritdoc */
461+
public emit(hook: 'beforeSendFeedback', feedback: FeedbackEvent, options?: { includeReplay: boolean }): void;
462+
453463
/** @inheritdoc */
454464
public emit(hook: string, ...rest: unknown[]): void {
455465
if (this._hooks[hook]) {

packages/deno/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@
66
"homepage": "https://github.com/getsentry/sentry-javascript/tree/master/packages/deno",
77
"author": "Sentry",
88
"license": "MIT",
9-
"module": "build/index.js",
9+
"module": "build/index.mjs",
1010
"types": "build/index.d.ts",
1111
"publishConfig": {
1212
"access": "public"
1313
},
1414
"files": [
15-
"index.js",
16-
"index.js.map",
15+
"index.mjs",
16+
"index.mjs.map",
1717
"index.d.ts"
1818
],
1919
"dependencies": {

packages/feedback/README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,8 @@ The following options can be configured as options to the integration, in `new F
6565
| --------- | ------- | ------- | ----------- |
6666
| `showName` | `boolean` | `true` | Displays the name field on the feedback form, however will still capture the name (if available) from Sentry SDK context. |
6767
| `showEmail` | `boolean` | `true` | Displays the email field on the feedback form, however will still capture the email (if available) from Sentry SDK context. |
68-
| `isAnonymous` | `boolean` | `false` | Hides both name and email fields and does not use Sentry SDK's user context. |
68+
| `isNameRequired` | `boolean` | `false` | Requires the name field on the feedback form to be filled in. |
69+
| `isEmailRequired` | `boolean` | `false` | Requires the email field on the feedback form to be filled in. |
6970
| `useSentryUser` | `Record<string, string>` | `{ email: 'email', name: 'username'}` | Map of the `email` and `name` fields to the corresponding Sentry SDK user fields that were called with `Sentry.setUser`. |
7071

7172
By default the Feedback integration will attempt to fill in the name/email fields if you have set a user context via [`Sentry.setUser`](https://docs.sentry.io/platforms/javascript/enriching-events/identify-user/). By default it expects the email and name fields to be `email` and `username`. Below is an example configuration with non-default user fields.
@@ -133,7 +134,7 @@ Colors can be customized via the Feedback constructor or by defining CSS variabl
133134
| `submitForegroundHover` | `--submit-foreground-hover` | `#ffffff` | `#ffffff` | Foreground color for the submit button when hovering |
134135
| `cancelBackground` | `--cancel-background` | `transparent` | `transparent` | Background color for the cancel button |
135136
| `cancelBackgroundHover` | `--cancel-background-hover` | `var(--background-hover)` | `var(--background-hover)` | Background color when hovering over the cancel button |
136-
| `cancelBorder` | `--cancel-border` | `var(--border)` | `var(--border)` | Border style for the cancel button |
137+
| `cancelBorder` | `--cancel-border` | `var(--border)` | `var(--border)` | Border style for the cancel button |
137138
| `cancelOutlineFocus` | `--cancel-outline-focus` | `var(--input-outline-focus)` | `var(--input-outline-focus)` | Outline color for the cancel button, in the focused state |
138139
| `cancelForeground` | `--cancel-foreground` | `var(--foreground)` | `var(--foreground)` | Foreground color for the cancel button |
139140
| `cancelForegroundHover` | `--cancel-foreground-hover` | `var(--foreground)` | `var(--foreground)` | Foreground color for the cancel button when hovering |
@@ -270,7 +271,7 @@ document.getElementById('my-feedback-form').addEventListener('submit', (event) =
270271
271272
Note: The following instructions are to be followed in the Sentry product.
272273
273-
If you have Sentry's default issue alert ("Alert me on every new issue") turned on for the project you are setting up User Feedback on, no action is required to have alerting on each user feedback report.
274+
If you have Sentry's default issue alert ("Alert me on every new issue") turned on for the project you are setting up User Feedback on, no action is required to have alerting on each user feedback report.
274275
275276
If you don't have Sentry's default issue alert turned on, follow these steps:
276277

packages/feedback/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
"access": "public"
2424
},
2525
"dependencies": {
26-
"@sentry/browser": "7.81.0",
2726
"@sentry/core": "7.81.0",
2827
"@sentry/types": "7.81.0",
2928
"@sentry/utils": "7.81.0"

packages/feedback/src/constants.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
import { GLOBAL_OBJ } from '@sentry/utils';
2+
3+
// exporting a separate copy of `WINDOW` rather than exporting the one from `@sentry/browser`
4+
// prevents the browser package from being bundled in the CDN bundle, and avoids a
5+
// circular dependency between the browser and feedback packages
6+
export const WINDOW = GLOBAL_OBJ as typeof GLOBAL_OBJ & Window;
7+
18
const LIGHT_BACKGROUND = '#ffffff';
29
const INHERIT = 'inherit';
310
const SUBMIT_COLOR = 'rgba(108, 95, 199, 1)';

packages/feedback/src/integration.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { WINDOW } from '@sentry/browser';
21
import type { Integration } from '@sentry/types';
32
import { isBrowser, logger } from '@sentry/utils';
43

@@ -15,6 +14,7 @@ import {
1514
NAME_PLACEHOLDER,
1615
SUBMIT_BUTTON_LABEL,
1716
SUCCESS_MESSAGE_TEXT,
17+
WINDOW,
1818
} from './constants';
1919
import type { FeedbackInternalOptions, FeedbackWidget, OptionalFeedbackConfiguration } from './types';
2020
import { mergeOptions } from './util/mergeOptions';
@@ -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/sendFeedback.ts

Lines changed: 12 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import type { BrowserClient, Replay } from '@sentry/browser';
2-
import { getCurrentHub } from '@sentry/core';
31
import { getLocationHref } from '@sentry/utils';
42

53
import { FEEDBACK_API_SOURCE } from './constants';
@@ -19,27 +17,22 @@ interface SendFeedbackParams {
1917
*/
2018
export function sendFeedback(
2119
{ name, email, message, source = FEEDBACK_API_SOURCE, url = getLocationHref() }: SendFeedbackParams,
22-
{ includeReplay = true }: SendFeedbackOptions = {},
20+
options: SendFeedbackOptions = {},
2321
): ReturnType<typeof sendFeedbackRequest> {
24-
const client = getCurrentHub().getClient<BrowserClient>();
25-
const replay = includeReplay && client ? (client.getIntegrationById('Replay') as Replay | undefined) : undefined;
26-
27-
// Prepare session replay
28-
replay && replay.flush();
29-
const replayId = replay && replay.getReplayId();
30-
3122
if (!message) {
3223
throw new Error('Unable to submit feedback with empty message');
3324
}
3425

35-
return sendFeedbackRequest({
36-
feedback: {
37-
name,
38-
email,
39-
message,
40-
url,
41-
replay_id: replayId,
42-
source,
26+
return sendFeedbackRequest(
27+
{
28+
feedback: {
29+
name,
30+
email,
31+
message,
32+
url,
33+
source,
34+
},
4335
},
44-
});
36+
options,
37+
);
4538
}

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/util/prepareFeedbackEvent.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ export async function prepareFeedbackEvent({
2727
scope,
2828
client,
2929
)) as FeedbackEvent | null;
30+
3031
if (preparedEvent === null) {
3132
// Taken from baseclient's `_processEvent` method, where this is handled for errors/transactions
3233
client.recordDroppedEvent('event_processor', 'feedback', event);

packages/feedback/src/util/sendFeedbackRequest.ts

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,16 @@ import { createEventEnvelope, getCurrentHub } from '@sentry/core';
22
import type { FeedbackEvent, TransportMakeRequestResponse } from '@sentry/types';
33

44
import { FEEDBACK_API_SOURCE, FEEDBACK_WIDGET_SOURCE } from '../constants';
5-
import type { SendFeedbackData } from '../types';
5+
import type { SendFeedbackData, SendFeedbackOptions } from '../types';
66
import { prepareFeedbackEvent } from './prepareFeedbackEvent';
77

88
/**
99
* Send feedback using transport
1010
*/
11-
export async function sendFeedbackRequest({
12-
feedback: { message, email, name, source, replay_id, url },
13-
}: SendFeedbackData): Promise<void | TransportMakeRequestResponse> {
11+
export async function sendFeedbackRequest(
12+
{ feedback: { message, email, name, source, url } }: SendFeedbackData,
13+
{ includeReplay = true }: SendFeedbackOptions = {},
14+
): Promise<void | TransportMakeRequestResponse> {
1415
const hub = getCurrentHub();
1516
const client = hub.getClient();
1617
const transport = client && client.getTransport();
@@ -26,7 +27,6 @@ export async function sendFeedbackRequest({
2627
contact_email: email,
2728
name,
2829
message,
29-
replay_id,
3030
url,
3131
source,
3232
},
@@ -54,6 +54,10 @@ export async function sendFeedbackRequest({
5454
return;
5555
}
5656

57+
if (client && client.emit) {
58+
client.emit('beforeSendFeedback', feedbackEvent, { includeReplay: Boolean(includeReplay) });
59+
}
60+
5761
const envelope = createEventEnvelope(
5862
feedbackEvent,
5963
dsn,

packages/feedback/src/widget/Dialog.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,9 @@ export function Dialog({
4545
showBranding,
4646
showName,
4747
showEmail,
48+
isNameRequired,
49+
isEmailRequired,
4850
colorScheme,
49-
isAnonymous,
5051
defaultName,
5152
defaultEmail,
5253
onClosed,
@@ -101,7 +102,8 @@ export function Dialog({
101102
} = Form({
102103
showEmail,
103104
showName,
104-
isAnonymous,
105+
isEmailRequired,
106+
isNameRequired,
105107

106108
defaultName,
107109
defaultEmail,

packages/feedback/src/widget/Form.ts

Lines changed: 28 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ export interface FormComponentProps
77
FeedbackInternalOptions,
88
| 'showName'
99
| 'showEmail'
10-
| 'isAnonymous'
10+
| 'isNameRequired'
11+
| 'isEmailRequired'
1112
| Exclude<keyof FeedbackTextConfiguration, 'buttonLabel' | 'formTitle' | 'successMessageText'>
1213
> {
1314
/**
@@ -57,7 +58,8 @@ export function Form({
5758

5859
showName,
5960
showEmail,
60-
isAnonymous,
61+
isNameRequired,
62+
isEmailRequired,
6163

6264
defaultName,
6365
defaultEmail,
@@ -113,6 +115,7 @@ export function Form({
113115
type: showName ? 'text' : 'hidden',
114116
['aria-hidden']: showName ? 'false' : 'true',
115117
name: 'name',
118+
required: isNameRequired,
116119
className: 'form__input',
117120
placeholder: namePlaceholder,
118121
value: defaultName,
@@ -123,6 +126,7 @@ export function Form({
123126
type: showEmail ? 'text' : 'hidden',
124127
['aria-hidden']: showEmail ? 'false' : 'true',
125128
name: 'email',
129+
required: isEmailRequired,
126130
className: 'form__input',
127131
placeholder: emailPlaceholder,
128132
value: defaultEmail,
@@ -160,29 +164,43 @@ export function Form({
160164
[
161165
errorEl,
162166

163-
!isAnonymous &&
164-
showName &&
167+
showName &&
165168
createElement(
166169
'label',
167170
{
168171
htmlFor: 'name',
169172
className: 'form__label',
170173
},
171-
[nameLabel, nameEl],
174+
[
175+
createElement(
176+
'span',
177+
{ className: 'form__label__text' },
178+
nameLabel,
179+
isNameRequired && createElement('span', { className: 'form__label__text--required' }, ' (required)'),
180+
),
181+
nameEl,
182+
],
172183
),
173-
!isAnonymous && !showName && nameEl,
184+
!showName && nameEl,
174185

175-
!isAnonymous &&
176-
showEmail &&
186+
showEmail &&
177187
createElement(
178188
'label',
179189
{
180190
htmlFor: 'email',
181191
className: 'form__label',
182192
},
183-
[emailLabel, emailEl],
193+
[
194+
createElement(
195+
'span',
196+
{ className: 'form__label__text' },
197+
emailLabel,
198+
isEmailRequired && createElement('span', { className: 'form__label__text--required' }, ' (required)'),
199+
),
200+
emailEl,
201+
],
184202
),
185-
!isAnonymous && !showEmail && emailEl,
203+
!showEmail && emailEl,
186204

187205
createElement(
188206
'label',

packages/feedback/src/widget/Icon.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
import { WINDOW } from '@sentry/browser';
2-
1+
import { WINDOW } from '../constants';
32
import { setAttributesNS } from '../util/setAttributesNS';
43

54
const SIZE = 20;

packages/feedback/src/widget/Logo.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
import { WINDOW } from '@sentry/browser';
2-
1+
import { WINDOW } from '../constants';
32
import type { FeedbackInternalOptions } from '../types';
43
import { setAttributesNS } from '../util/setAttributesNS';
54

0 commit comments

Comments
 (0)