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

meta(changelog): Update changelog for 7.81.1 #9614

Merged
merged 21 commits into from
Nov 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
c682d2b
isNameRequired and isEmailRequired
c298lee Nov 16, 2023
9086e25
lint
c298lee Nov 16, 2023
f185df6
comments
c298lee Nov 17, 2023
dc524c2
typo
c298lee Nov 17, 2023
d64c9e6
empty field validation
c298lee Nov 17, 2023
cd5893c
remove returns
c298lee Nov 17, 2023
421e030
remove returns
c298lee Nov 17, 2023
ae07444
Merge pull request #9598 from getsentry/master
github-actions[bot] Nov 20, 2023
aed4bf0
Merge pull request #9587 from getsentry/feedback-name-and-email-required
c298lee Nov 20, 2023
332f8e7
fix(tracing-internal): Fix case when originalURL contain query params…
LubomirIgonda1 Nov 20, 2023
5fe5272
remove isAnonymous from feedback
c298lee Nov 20, 2023
205c1c9
fix(node): Improve error handling and shutdown handling for ANR (#9548)
joshkel Nov 20, 2023
76b136f
update README
c298lee Nov 20, 2023
dbce251
Merge pull request #9602 from getsentry/remove-isanonymous
c298lee Nov 20, 2023
f24ea88
ref(feedback): Refactor attaching replay id to feedback event to use …
billyvg Nov 20, 2023
b46a1bb
ref(feedback): Do not import window from browser pkg to avoid circula…
billyvg Nov 20, 2023
4b8d755
chore: Add @sentry/deno to issue template (#9610)
alexgleason Nov 21, 2023
48e2337
fix(deno): Make sure files get published (#9611)
AbhiPrasad Nov 21, 2023
2f17bb1
fix(astro): Remove method from span op (#9603)
AbhiPrasad Nov 21, 2023
b8c46ea
fix(nextjs): Use `globalThis` instead of `global` in edge runtime (#9…
powerfulyang Nov 21, 2023
aa459aa
meta(changelog): Update changelog for 7.81.1
lforst Nov 21, 2023
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
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/bug.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ body:
- '@sentry/angular'
- '@sentry/angular-ivy'
- '@sentry/bun'
- '@sentry/deno'
- '@sentry/ember'
- '@sentry/gatsby'
- '@sentry/nextjs'
Expand Down
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,16 @@

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

## 7.81.1

- fix(astro): Remove method from span op (#9603)
- fix(deno): Make sure files get published (#9611)
- fix(nextjs): Use `globalThis` instead of `global` in edge runtime (#9612)
- fix(node): Improve error handling and shutdown handling for ANR (#9548)
- fix(tracing-internal): Fix case when originalURL contain query params (#9531)

Work in this release contributed by @powerfulyang, @LubomirIgonda1, @joshkel, and @alexgleason. Thank you for your contributions!

## 7.81.0

### Important Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/astro/src/server/middleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ export const handleRequest: (options?: MiddlewareOptions) => MiddlewareResponseH
const res = await startSpan(
{
name: `${method} ${interpolateRouteFromUrlAndParams(ctx.url.pathname, ctx.params)}`,
op: `http.server.${method.toLowerCase()}`,
op: 'http.server',
origin: 'auto.http.astro',
status: 'ok',
...traceparentData,
Expand Down
2 changes: 1 addition & 1 deletion packages/astro/test/server/middleware.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ describe('sentryMiddleware', () => {
source: 'route',
},
name: 'GET /users/[id]/details',
op: 'http.server.get',
op: 'http.server',
origin: 'auto.http.astro',
status: 'ok',
},
Expand Down
10 changes: 10 additions & 0 deletions packages/core/src/baseclient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import type {
Transport,
TransportMakeRequestResponse,
} from '@sentry/types';
import type { FeedbackEvent } from '@sentry/types';
import {
addItemToEnvelope,
checkOrSetAlreadyCaught,
Expand Down Expand Up @@ -413,6 +414,12 @@ export abstract class BaseClient<O extends ClientOptions> implements Client<O> {
/** @inheritdoc */
public on(hook: 'otelSpanEnd', callback: (otelSpan: unknown, mutableOptions: { drop: boolean }) => void): void;

/** @inheritdoc */
public on(
hook: 'beforeSendFeedback',
callback: (feedback: FeedbackEvent, options?: { includeReplay: boolean }) => void,
): void;

/** @inheritdoc */
public on(hook: string, callback: unknown): void {
if (!this._hooks[hook]) {
Expand Down Expand Up @@ -450,6 +457,9 @@ export abstract class BaseClient<O extends ClientOptions> implements Client<O> {
/** @inheritdoc */
public emit(hook: 'otelSpanEnd', otelSpan: unknown, mutableOptions: { drop: boolean }): void;

/** @inheritdoc */
public emit(hook: 'beforeSendFeedback', feedback: FeedbackEvent, options?: { includeReplay: boolean }): void;

/** @inheritdoc */
public emit(hook: string, ...rest: unknown[]): void {
if (this._hooks[hook]) {
Expand Down
6 changes: 3 additions & 3 deletions packages/deno/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@
"homepage": "https://github.com/getsentry/sentry-javascript/tree/master/packages/deno",
"author": "Sentry",
"license": "MIT",
"module": "build/index.js",
"module": "build/index.mjs",
"types": "build/index.d.ts",
"publishConfig": {
"access": "public"
},
"files": [
"index.js",
"index.js.map",
"index.mjs",
"index.mjs.map",
"index.d.ts"
],
"dependencies": {
Expand Down
7 changes: 4 additions & 3 deletions packages/feedback/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ The following options can be configured as options to the integration, in `new F
| --------- | ------- | ------- | ----------- |
| `showName` | `boolean` | `true` | Displays the name field on the feedback form, however will still capture the name (if available) from Sentry SDK context. |
| `showEmail` | `boolean` | `true` | Displays the email field on the feedback form, however will still capture the email (if available) from Sentry SDK context. |
| `isAnonymous` | `boolean` | `false` | Hides both name and email fields and does not use Sentry SDK's user context. |
| `isNameRequired` | `boolean` | `false` | Requires the name field on the feedback form to be filled in. |
| `isEmailRequired` | `boolean` | `false` | Requires the email field on the feedback form to be filled in. |
| `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`. |

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.
Expand Down Expand Up @@ -133,7 +134,7 @@ Colors can be customized via the Feedback constructor or by defining CSS variabl
| `submitForegroundHover` | `--submit-foreground-hover` | `#ffffff` | `#ffffff` | Foreground color for the submit button when hovering |
| `cancelBackground` | `--cancel-background` | `transparent` | `transparent` | Background color for the cancel button |
| `cancelBackgroundHover` | `--cancel-background-hover` | `var(--background-hover)` | `var(--background-hover)` | Background color when hovering over the cancel button |
| `cancelBorder` | `--cancel-border` | `var(--border)` | `var(--border)` | Border style for the cancel button |
| `cancelBorder` | `--cancel-border` | `var(--border)` | `var(--border)` | Border style for the cancel button |
| `cancelOutlineFocus` | `--cancel-outline-focus` | `var(--input-outline-focus)` | `var(--input-outline-focus)` | Outline color for the cancel button, in the focused state |
| `cancelForeground` | `--cancel-foreground` | `var(--foreground)` | `var(--foreground)` | Foreground color for the cancel button |
| `cancelForegroundHover` | `--cancel-foreground-hover` | `var(--foreground)` | `var(--foreground)` | Foreground color for the cancel button when hovering |
Expand Down Expand Up @@ -270,7 +271,7 @@ document.getElementById('my-feedback-form').addEventListener('submit', (event) =

Note: The following instructions are to be followed in the Sentry product.

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.
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.

If you don't have Sentry's default issue alert turned on, follow these steps:

Expand Down
1 change: 0 additions & 1 deletion packages/feedback/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
"access": "public"
},
"dependencies": {
"@sentry/browser": "7.81.0",
"@sentry/core": "7.81.0",
"@sentry/types": "7.81.0",
"@sentry/utils": "7.81.0"
Expand Down
7 changes: 7 additions & 0 deletions packages/feedback/src/constants.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
import { GLOBAL_OBJ } from '@sentry/utils';

// exporting a separate copy of `WINDOW` rather than exporting the one from `@sentry/browser`
// prevents the browser package from being bundled in the CDN bundle, and avoids a
// circular dependency between the browser and feedback packages
export const WINDOW = GLOBAL_OBJ as typeof GLOBAL_OBJ & Window;

const LIGHT_BACKGROUND = '#ffffff';
const INHERIT = 'inherit';
const SUBMIT_COLOR = 'rgba(108, 95, 199, 1)';
Expand Down
4 changes: 1 addition & 3 deletions packages/feedback/src/integration.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { WINDOW } from '@sentry/browser';
import type { Integration } from '@sentry/types';
import { isBrowser, logger } from '@sentry/utils';

Expand All @@ -15,6 +14,7 @@ import {
NAME_PLACEHOLDER,
SUBMIT_BUTTON_LABEL,
SUCCESS_MESSAGE_TEXT,
WINDOW,
} from './constants';
import type { FeedbackInternalOptions, FeedbackWidget, OptionalFeedbackConfiguration } from './types';
import { mergeOptions } from './util/mergeOptions';
Expand Down Expand Up @@ -80,7 +80,6 @@ export class Feedback implements Integration {
email: 'email',
name: 'username',
},
isAnonymous = false,
isEmailRequired = false,
isNameRequired = false,

Expand Down Expand Up @@ -120,7 +119,6 @@ export class Feedback implements Integration {
id,
showBranding,
autoInject,
isAnonymous,
isEmailRequired,
isNameRequired,
showEmail,
Expand Down
31 changes: 12 additions & 19 deletions packages/feedback/src/sendFeedback.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import type { BrowserClient, Replay } from '@sentry/browser';
import { getCurrentHub } from '@sentry/core';
import { getLocationHref } from '@sentry/utils';

import { FEEDBACK_API_SOURCE } from './constants';
Expand All @@ -19,27 +17,22 @@ interface SendFeedbackParams {
*/
export function sendFeedback(
{ name, email, message, source = FEEDBACK_API_SOURCE, url = getLocationHref() }: SendFeedbackParams,
{ includeReplay = true }: SendFeedbackOptions = {},
options: SendFeedbackOptions = {},
): ReturnType<typeof sendFeedbackRequest> {
const client = getCurrentHub().getClient<BrowserClient>();
const replay = includeReplay && client ? (client.getIntegrationById('Replay') as Replay | undefined) : undefined;

// Prepare session replay
replay && replay.flush();
const replayId = replay && replay.getReplayId();

if (!message) {
throw new Error('Unable to submit feedback with empty message');
}

return sendFeedbackRequest({
feedback: {
name,
email,
message,
url,
replay_id: replayId,
source,
return sendFeedbackRequest(
{
feedback: {
name,
email,
message,
url,
source,
},
},
});
options,
);
}
5 changes: 0 additions & 5 deletions packages/feedback/src/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,6 @@ export interface FeedbackGeneralConfiguration {
*/
autoInject: boolean;

/**
* If true, will not collect user data (email/name).
*/
isAnonymous: boolean;

/**
* Should the email field be required?
*/
Expand Down
1 change: 1 addition & 0 deletions packages/feedback/src/util/prepareFeedbackEvent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export async function prepareFeedbackEvent({
scope,
client,
)) as FeedbackEvent | null;

if (preparedEvent === null) {
// Taken from baseclient's `_processEvent` method, where this is handled for errors/transactions
client.recordDroppedEvent('event_processor', 'feedback', event);
Expand Down
14 changes: 9 additions & 5 deletions packages/feedback/src/util/sendFeedbackRequest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,16 @@ import { createEventEnvelope, getCurrentHub } from '@sentry/core';
import type { FeedbackEvent, TransportMakeRequestResponse } from '@sentry/types';

import { FEEDBACK_API_SOURCE, FEEDBACK_WIDGET_SOURCE } from '../constants';
import type { SendFeedbackData } from '../types';
import type { SendFeedbackData, SendFeedbackOptions } from '../types';
import { prepareFeedbackEvent } from './prepareFeedbackEvent';

/**
* Send feedback using transport
*/
export async function sendFeedbackRequest({
feedback: { message, email, name, source, replay_id, url },
}: SendFeedbackData): Promise<void | TransportMakeRequestResponse> {
export async function sendFeedbackRequest(
{ feedback: { message, email, name, source, url } }: SendFeedbackData,
{ includeReplay = true }: SendFeedbackOptions = {},
): Promise<void | TransportMakeRequestResponse> {
const hub = getCurrentHub();
const client = hub.getClient();
const transport = client && client.getTransport();
Expand All @@ -26,7 +27,6 @@ export async function sendFeedbackRequest({
contact_email: email,
name,
message,
replay_id,
url,
source,
},
Expand Down Expand Up @@ -54,6 +54,10 @@ export async function sendFeedbackRequest({
return;
}

if (client && client.emit) {
client.emit('beforeSendFeedback', feedbackEvent, { includeReplay: Boolean(includeReplay) });
}

const envelope = createEventEnvelope(
feedbackEvent,
dsn,
Expand Down
6 changes: 4 additions & 2 deletions packages/feedback/src/widget/Dialog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,9 @@ export function Dialog({
showBranding,
showName,
showEmail,
isNameRequired,
isEmailRequired,
colorScheme,
isAnonymous,
defaultName,
defaultEmail,
onClosed,
Expand Down Expand Up @@ -101,7 +102,8 @@ export function Dialog({
} = Form({
showEmail,
showName,
isAnonymous,
isEmailRequired,
isNameRequired,

defaultName,
defaultEmail,
Expand Down
38 changes: 28 additions & 10 deletions packages/feedback/src/widget/Form.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ export interface FormComponentProps
FeedbackInternalOptions,
| 'showName'
| 'showEmail'
| 'isAnonymous'
| 'isNameRequired'
| 'isEmailRequired'
| Exclude<keyof FeedbackTextConfiguration, 'buttonLabel' | 'formTitle' | 'successMessageText'>
> {
/**
Expand Down Expand Up @@ -57,7 +58,8 @@ export function Form({

showName,
showEmail,
isAnonymous,
isNameRequired,
isEmailRequired,

defaultName,
defaultEmail,
Expand Down Expand Up @@ -113,6 +115,7 @@ export function Form({
type: showName ? 'text' : 'hidden',
['aria-hidden']: showName ? 'false' : 'true',
name: 'name',
required: isNameRequired,
className: 'form__input',
placeholder: namePlaceholder,
value: defaultName,
Expand All @@ -123,6 +126,7 @@ export function Form({
type: showEmail ? 'text' : 'hidden',
['aria-hidden']: showEmail ? 'false' : 'true',
name: 'email',
required: isEmailRequired,
className: 'form__input',
placeholder: emailPlaceholder,
value: defaultEmail,
Expand Down Expand Up @@ -160,29 +164,43 @@ export function Form({
[
errorEl,

!isAnonymous &&
showName &&
showName &&
createElement(
'label',
{
htmlFor: 'name',
className: 'form__label',
},
[nameLabel, nameEl],
[
createElement(
'span',
{ className: 'form__label__text' },
nameLabel,
isNameRequired && createElement('span', { className: 'form__label__text--required' }, ' (required)'),
),
nameEl,
],
),
!isAnonymous && !showName && nameEl,
!showName && nameEl,

!isAnonymous &&
showEmail &&
showEmail &&
createElement(
'label',
{
htmlFor: 'email',
className: 'form__label',
},
[emailLabel, emailEl],
[
createElement(
'span',
{ className: 'form__label__text' },
emailLabel,
isEmailRequired && createElement('span', { className: 'form__label__text--required' }, ' (required)'),
),
emailEl,
],
),
!isAnonymous && !showEmail && emailEl,
!showEmail && emailEl,

createElement(
'label',
Expand Down
3 changes: 1 addition & 2 deletions packages/feedback/src/widget/Icon.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { WINDOW } from '@sentry/browser';

import { WINDOW } from '../constants';
import { setAttributesNS } from '../util/setAttributesNS';

const SIZE = 20;
Expand Down
3 changes: 1 addition & 2 deletions packages/feedback/src/widget/Logo.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { WINDOW } from '@sentry/browser';

import { WINDOW } from '../constants';
import type { FeedbackInternalOptions } from '../types';
import { setAttributesNS } from '../util/setAttributesNS';

Expand Down
Loading
Loading