Skip to content

Commit 90aa098

Browse files
Feat: V7 - JavaScript V9 Add browser session integration (#4732)
* bump SDKs * bump SDKs * fix build * fix tests * fix tests * fix lint errors * test ts 5.0 * rollback * fix merge conflict with yarn * fix new lint issue * sync yarn.lock with V7 branch and install new packages * ensure we are using the JS version from the default node resolution * update changelog with javascript version bump * fix check type (#4587) * add major changes to the SDK * fix lint * review check: fix changelog PR number / Fix wrapper incorrect null check / removed comment from rnerror handler / removed comment from span / fix test from userInteraction * fix incorrect cli version * fix lint * remove shutdowntimeout from android / use newer wizard version * rollback feedback test change, rollback jest version, fix safe test * return shutdowntimeout * explain tracing sample rate * fix tracing extension test * lint fix * update changelog * fix yarn lock merge/ fix ts-jest version no longer exists / fix core version on samples and e2e * fix lint on addTimeToInitialDisplay * fix issue with UIManager test * add browserSessionIntegration for web * moved major changes to the correct spot * merge father branch, update changelog about react native web changes * add PR number * Update CHANGELOG.md Co-authored-by: Antonis Lilis <[email protected]> * Update CHANGELOG.md Co-authored-by: Antonis Lilis <[email protected]> --------- Co-authored-by: Antonis Lilis <[email protected]>
1 parent 6eaf70f commit 90aa098

File tree

3 files changed

+36
-3
lines changed

3 files changed

+36
-3
lines changed

CHANGELOG.md

+1-3
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,7 @@ Version 7 of the SDK is compatible with Sentry self-hosted versions 24.4.2 or hi
4141

4242
- `autoSessionTracking` from options.
4343
To enable session tracking, ensure that `enableAutoSessionTracking` is enabled.
44-
4544
- `enableTracing`. Instead, set `tracesSampleRate` to a value greater than `zero` to `enable tracing`, `0` to keep tracing integrations active without sampling, or `undefined` to disable the performance integration.
46-
4745
- `getCurrentHub()`, `Hub`, and `getCurrentHubShim()`
4846
- `spanId` from propagation `context`
4947
- metrics API
@@ -54,7 +52,7 @@ Version 7 of the SDK is compatible with Sentry self-hosted versions 24.4.2 or hi
5452
## Other Changes
5553

5654
- Fork `scope` if custom scope is passed to `startSpanManual` or `startSpan`
57-
55+
- On React Native Web, `browserSessionIntegration` is added when `enableAutoSessionTracking` is set to `True` ([#4732](https://github.com/getsentry/sentry-react-native/pull/4732))
5856

5957
## 6.11.0-beta.0
6058

packages/core/src/js/integrations/default.ts

+5
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/* eslint-disable complexity */
2+
import { browserSessionIntegration } from '@sentry/browser';
23
import type { Integration } from '@sentry/core';
34

45
import type { ReactNativeClientOptions } from '../options';
@@ -59,6 +60,10 @@ export function getDefaultIntegrations(options: ReactNativeClientOptions): Integ
5960
integrations.push(browserApiErrorsIntegration());
6061
integrations.push(browserGlobalHandlersIntegration());
6162
integrations.push(browserLinkedErrorsIntegration());
63+
64+
if (options.enableAutoSessionTracking) {
65+
integrations.push(browserSessionIntegration());
66+
}
6267
}
6368

6469
// @sentry/react default integrations

packages/core/test/sdk.test.ts

+30
Original file line numberDiff line numberDiff line change
@@ -620,6 +620,36 @@ describe('Tests the SDK functionality', () => {
620620
expectIntegration('HermesProfiling');
621621
});
622622

623+
it('adds browserSessionIntegration on web when enableAutoSessionTracking is set true', () => {
624+
(NATIVE.isNativeAvailable as jest.Mock).mockImplementation(() => false);
625+
(notWeb as jest.Mock).mockImplementation(() => false);
626+
init({ enableAutoSessionTracking: true });
627+
628+
expectIntegration('BrowserSession');
629+
});
630+
631+
it('no browserSessionIntegration on web when enableAutoSessionTracking is set false', () => {
632+
(NATIVE.isNativeAvailable as jest.Mock).mockImplementation(() => false);
633+
(notWeb as jest.Mock).mockImplementation(() => false);
634+
init({ enableAutoSessionTracking: false });
635+
636+
expectNotIntegration('BrowserSession');
637+
});
638+
639+
it('no browserSessionIntegration on web when enableAutoSessionTracking is not set', () => {
640+
(NATIVE.isNativeAvailable as jest.Mock).mockImplementation(() => false);
641+
(notWeb as jest.Mock).mockImplementation(() => false);
642+
init({});
643+
644+
expectNotIntegration('BrowserSession');
645+
});
646+
647+
it('no browserSessionIntegration on mobile', () => {
648+
init({ enableAutoSessionTracking: true });
649+
650+
expectNotIntegration('BrowserSession');
651+
});
652+
623653
it('no spotlight integration by default', () => {
624654
init({});
625655

0 commit comments

Comments
 (0)