@sentry/react-native 7.7.0 → 7.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/RNSentry.podspec +1 -1
- package/android/build.gradle +1 -1
- package/android/libs/replay-stubs.jar +0 -0
- package/android/replay-stubs/build.gradle +1 -1
- package/android/src/main/java/io/sentry/react/RNSentryModuleImpl.java +65 -5
- package/android/src/main/java/io/sentry/react/RNSentryVersion.java +1 -1
- package/dist/js/client.d.ts.map +1 -1
- package/dist/js/client.js +2 -2
- package/dist/js/client.js.map +1 -1
- package/dist/js/feedback/FeedbackWidgetProvider.d.ts.map +1 -1
- package/dist/js/feedback/FeedbackWidgetProvider.js.map +1 -1
- package/dist/js/feedback/integration.d.ts.map +1 -1
- package/dist/js/feedback/integration.js.map +1 -1
- package/dist/js/index.d.ts +2 -2
- package/dist/js/index.d.ts.map +1 -1
- package/dist/js/index.js +1 -1
- package/dist/js/index.js.map +1 -1
- package/dist/js/integrations/expocontext.d.ts.map +1 -1
- package/dist/js/integrations/expocontext.js.map +1 -1
- package/dist/js/integrations/nativelinkederrors.js +3 -2
- package/dist/js/integrations/nativelinkederrors.js.map +1 -1
- package/dist/js/options.d.ts +49 -1
- package/dist/js/options.d.ts.map +1 -1
- package/dist/js/options.js.map +1 -1
- package/dist/js/replay/mobilereplay.d.ts +26 -0
- package/dist/js/replay/mobilereplay.d.ts.map +1 -1
- package/dist/js/replay/mobilereplay.js +43 -7
- package/dist/js/replay/mobilereplay.js.map +1 -1
- package/dist/js/tools/metroMiddleware.d.ts +1 -1
- package/dist/js/tools/metroMiddleware.d.ts.map +1 -1
- package/dist/js/tools/metroMiddleware.js +2 -2
- package/dist/js/tools/metroMiddleware.js.map +1 -1
- package/dist/js/tracing/integrations/appStart.d.ts.map +1 -1
- package/dist/js/tracing/integrations/appStart.js +12 -7
- package/dist/js/tracing/integrations/appStart.js.map +1 -1
- package/dist/js/tracing/integrations/nativeFrames.d.ts +2 -1
- package/dist/js/tracing/integrations/nativeFrames.d.ts.map +1 -1
- package/dist/js/tracing/integrations/nativeFrames.js +68 -25
- package/dist/js/tracing/integrations/nativeFrames.js.map +1 -1
- package/dist/js/tracing/reactnavigation.d.ts +12 -1
- package/dist/js/tracing/reactnavigation.d.ts.map +1 -1
- package/dist/js/tracing/reactnavigation.js +41 -8
- package/dist/js/tracing/reactnavigation.js.map +1 -1
- package/dist/js/tracing/timetodisplay.d.ts.map +1 -1
- package/dist/js/tracing/timetodisplay.js +206 -21
- package/dist/js/tracing/timetodisplay.js.map +1 -1
- package/dist/js/version.d.ts +1 -1
- package/dist/js/version.js +1 -1
- package/dist/js/version.js.map +1 -1
- package/dist/js/wrapper.d.ts +2 -1
- package/dist/js/wrapper.d.ts.map +1 -1
- package/dist/js/wrapper.js +6 -2
- package/dist/js/wrapper.js.map +1 -1
- package/ios/RNSentry.mm +13 -0
- package/ios/RNSentryReplay.mm +5 -0
- package/ios/RNSentryVersion.m +1 -1
- package/package.json +13 -13
- package/ts3.8/dist/js/index.d.ts +2 -2
- package/ts3.8/dist/js/options.d.ts +49 -1
- package/ts3.8/dist/js/replay/mobilereplay.d.ts +26 -0
- package/ts3.8/dist/js/tracing/integrations/nativeFrames.d.ts +2 -1
- package/ts3.8/dist/js/tracing/reactnavigation.d.ts +12 -1
- package/ts3.8/dist/js/version.d.ts +1 -1
- package/ts3.8/dist/js/wrapper.d.ts +2 -1
package/RNSentry.podspec
CHANGED
|
@@ -46,7 +46,7 @@ Pod::Spec.new do |s|
|
|
|
46
46
|
|
|
47
47
|
s.compiler_flags = other_cflags
|
|
48
48
|
|
|
49
|
-
s.dependency 'Sentry/HybridSDK', '8.
|
|
49
|
+
s.dependency 'Sentry/HybridSDK', '8.58.0'
|
|
50
50
|
|
|
51
51
|
if defined? install_modules_dependencies
|
|
52
52
|
# Default React Native dependencies for 0.71 and above (new and legacy architecture)
|
package/android/build.gradle
CHANGED
|
Binary file
|
|
@@ -36,6 +36,7 @@ import io.sentry.IScope;
|
|
|
36
36
|
import io.sentry.ISentryExecutorService;
|
|
37
37
|
import io.sentry.ISerializer;
|
|
38
38
|
import io.sentry.Integration;
|
|
39
|
+
import io.sentry.ProfileLifecycle;
|
|
39
40
|
import io.sentry.ScopesAdapter;
|
|
40
41
|
import io.sentry.ScreenshotStrategyType;
|
|
41
42
|
import io.sentry.Sentry;
|
|
@@ -324,7 +325,8 @@ public class RNSentryModuleImpl {
|
|
|
324
325
|
|
|
325
326
|
SentryReplayOptions replayOptions = getReplayOptions(rnOptions);
|
|
326
327
|
options.setSessionReplay(replayOptions);
|
|
327
|
-
// Check if the replay integration is available on the classpath. It's already
|
|
328
|
+
// Check if the replay integration is available on the classpath. It's already
|
|
329
|
+
// kept from R8
|
|
328
330
|
// shrinking by sentry-android-core
|
|
329
331
|
final boolean isReplayAvailable =
|
|
330
332
|
loadClass.isClassAvailable("io.sentry.android.replay.ReplayIntegration", logger);
|
|
@@ -333,6 +335,9 @@ public class RNSentryModuleImpl {
|
|
|
333
335
|
initFragmentReplayTracking();
|
|
334
336
|
}
|
|
335
337
|
|
|
338
|
+
// Configure Android UI Profiling
|
|
339
|
+
configureAndroidProfiling(options, rnOptions);
|
|
340
|
+
|
|
336
341
|
// Exclude Dev Server and Sentry Dsn request from Breadcrumbs
|
|
337
342
|
String dsn = getURLFromDSN(rnOptions.getString("dsn"));
|
|
338
343
|
String devServerUrl = rnOptions.getString("devServerUrl");
|
|
@@ -482,17 +487,70 @@ public class RNSentryModuleImpl {
|
|
|
482
487
|
}
|
|
483
488
|
}
|
|
484
489
|
|
|
490
|
+
private void configureAndroidProfiling(
|
|
491
|
+
@NotNull SentryAndroidOptions options, @NotNull ReadableMap rnOptions) {
|
|
492
|
+
if (!rnOptions.hasKey("_experiments")) {
|
|
493
|
+
return;
|
|
494
|
+
}
|
|
495
|
+
|
|
496
|
+
@Nullable final ReadableMap experiments = rnOptions.getMap("_experiments");
|
|
497
|
+
if (experiments == null || !experiments.hasKey("androidProfilingOptions")) {
|
|
498
|
+
return;
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
@Nullable
|
|
502
|
+
final ReadableMap androidProfilingOptions = experiments.getMap("androidProfilingOptions");
|
|
503
|
+
if (androidProfilingOptions == null) {
|
|
504
|
+
return;
|
|
505
|
+
}
|
|
506
|
+
|
|
507
|
+
// Set profile session sample rate
|
|
508
|
+
if (androidProfilingOptions.hasKey("profileSessionSampleRate")) {
|
|
509
|
+
final double profileSessionSampleRate =
|
|
510
|
+
androidProfilingOptions.getDouble("profileSessionSampleRate");
|
|
511
|
+
options.setProfileSessionSampleRate(profileSessionSampleRate);
|
|
512
|
+
logger.log(
|
|
513
|
+
SentryLevel.INFO,
|
|
514
|
+
String.format(
|
|
515
|
+
"Android UI Profiling profileSessionSampleRate set to: %.2f",
|
|
516
|
+
profileSessionSampleRate));
|
|
517
|
+
}
|
|
518
|
+
|
|
519
|
+
// Set profiling lifecycle mode
|
|
520
|
+
if (androidProfilingOptions.hasKey("lifecycle")) {
|
|
521
|
+
final String lifecycle = androidProfilingOptions.getString("lifecycle");
|
|
522
|
+
if ("manual".equalsIgnoreCase(lifecycle)) {
|
|
523
|
+
options.setProfileLifecycle(ProfileLifecycle.MANUAL);
|
|
524
|
+
logger.log(SentryLevel.INFO, "Android UI Profile Lifecycle set to MANUAL");
|
|
525
|
+
} else if ("trace".equalsIgnoreCase(lifecycle)) {
|
|
526
|
+
options.setProfileLifecycle(ProfileLifecycle.TRACE);
|
|
527
|
+
logger.log(SentryLevel.INFO, "Android UI Profile Lifecycle set to TRACE");
|
|
528
|
+
}
|
|
529
|
+
}
|
|
530
|
+
|
|
531
|
+
// Set start on app start
|
|
532
|
+
if (androidProfilingOptions.hasKey("startOnAppStart")) {
|
|
533
|
+
final boolean startOnAppStart = androidProfilingOptions.getBoolean("startOnAppStart");
|
|
534
|
+
options.setStartProfilerOnAppStart(startOnAppStart);
|
|
535
|
+
logger.log(
|
|
536
|
+
SentryLevel.INFO,
|
|
537
|
+
String.format("Android UI Profiling startOnAppStart set to %b", startOnAppStart));
|
|
538
|
+
}
|
|
539
|
+
}
|
|
540
|
+
|
|
485
541
|
public void crash() {
|
|
486
542
|
throw new RuntimeException("TEST - Sentry Client Crash (only works in release mode)");
|
|
487
543
|
}
|
|
488
544
|
|
|
489
545
|
public void addListener(String eventType) {
|
|
490
|
-
// Is must be defined otherwise the generated interface from TS won't be
|
|
546
|
+
// Is must be defined otherwise the generated interface from TS won't be
|
|
547
|
+
// fulfilled
|
|
491
548
|
logger.log(SentryLevel.ERROR, "addListener of NativeEventEmitter can't be used on Android!");
|
|
492
549
|
}
|
|
493
550
|
|
|
494
551
|
public void removeListeners(double id) {
|
|
495
|
-
// Is must be defined otherwise the generated interface from TS won't be
|
|
552
|
+
// Is must be defined otherwise the generated interface from TS won't be
|
|
553
|
+
// fulfilled
|
|
496
554
|
logger.log(
|
|
497
555
|
SentryLevel.ERROR, "removeListeners of NativeEventEmitter can't be used on Android!");
|
|
498
556
|
}
|
|
@@ -557,7 +615,8 @@ public class RNSentryModuleImpl {
|
|
|
557
615
|
// When activity is destroyed but the application process is kept alive
|
|
558
616
|
// the next activity creation is considered warm start.
|
|
559
617
|
// The app start metrics will be updated by the the Android SDK.
|
|
560
|
-
// To let the RN JS layer know these are new start data we compare the start
|
|
618
|
+
// To let the RN JS layer know these are new start data we compare the start
|
|
619
|
+
// timestamps.
|
|
561
620
|
lastStartTimestampMs = currentStartTimestampMs;
|
|
562
621
|
|
|
563
622
|
// Clears start metrics, making them ready for recording warm app start
|
|
@@ -1292,7 +1351,8 @@ public class RNSentryModuleImpl {
|
|
|
1292
1351
|
}
|
|
1293
1352
|
}
|
|
1294
1353
|
if (strErrors != null) {
|
|
1295
|
-
// Use the same behaviour of JavaScript instead of Android when dealing with
|
|
1354
|
+
// Use the same behaviour of JavaScript instead of Android when dealing with
|
|
1355
|
+
// strings.
|
|
1296
1356
|
for (int i = 0; i < strErrors.size(); i++) {
|
|
1297
1357
|
String pattern = ".*" + Pattern.quote(strErrors.getString(i)) + ".*";
|
|
1298
1358
|
list.add(pattern);
|
|
@@ -2,7 +2,7 @@ package io.sentry.react;
|
|
|
2
2
|
|
|
3
3
|
class RNSentryVersion {
|
|
4
4
|
static final String REACT_NATIVE_SDK_PACKAGE_NAME = "npm:@sentry/react-native";
|
|
5
|
-
static final String REACT_NATIVE_SDK_PACKAGE_VERSION = "7.
|
|
5
|
+
static final String REACT_NATIVE_SDK_PACKAGE_VERSION = "7.9.0";
|
|
6
6
|
static final String NATIVE_SDK_NAME = "sentry.native.android.react-native";
|
|
7
7
|
static final String ANDROID_SDK_NAME = "sentry.java.android.react-native";
|
|
8
8
|
static final String REACT_NATIVE_SDK_NAME = "sentry.javascript.react-native";
|
package/dist/js/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/js/client.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAGV,QAAQ,EACR,KAAK,EACL,SAAS,EAET,aAAa,EACb,4BAA4B,EAC5B,YAAY,EACb,MAAM,cAAc,CAAC;AACtB,OAAO,EAGL,MAAM,EAIP,MAAM,cAAc,CAAC;AAKtB,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,WAAW,CAAC;AAW1D;;;;;GAKG;AACH,qBAAa,iBAAkB,SAAQ,MAAM,CAAC,wBAAwB,CAAC;IACrE,OAAO,CAAC,eAAe,CAAY;IACnC,OAAO,CAAC,oBAAoB,CAA4C;IAExE;;;OAGG;gBACgB,OAAO,EAAE,wBAAwB;IAsDpD;;OAEG;IACI,kBAAkB,CAAC,SAAS,EAAE,OAAO,EAAE,IAAI,GAAE,SAAc,GAAG,WAAW,CAAC,KAAK,CAAC;IAIvF;;OAEG;IACI,gBAAgB,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,aAAa,EAAE,IAAI,CAAC,EAAE,SAAS,GAAG,WAAW,CAAC,KAAK,CAAC;IAIrG;;;O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;;OAGG;IACI,WAAW,IAAI,IAAI;IAI1B;;OAEG;IACI,KAAK,IAAI,WAAW,CAAC,OAAO,CAAC;IAOpC;;;OAGG;IACI,mBAAmB,CAAC,QAAQ,EAAE,YAAY,GAAG,IAAI;IAUxD;;OAEG;IACI,YAAY,CAAC,QAAQ,EAAE,QAAQ,GAAG,WAAW,CAAC,4BAA4B,CAAC;IAiClF;;OAEG;IACI,IAAI,IAAI,IAAI;IAKnB;;;;OAIG;IACI,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,GAAG,MAAM,IAAI;IAKtD;;;;OAIG;IACI,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI;IAKnD;;OAEG;IACH,OAAO,CAAC,cAAc;IA8BtB;;OAEG;IACH,OAAO,CAAC,wBAAwB;IAShC;;OAEG;IACH,OAAO,CAAC,qBAAqB;CAa9B"}
|
package/dist/js/client.js
CHANGED
|
@@ -161,11 +161,11 @@ export class ReactNativeClient extends Client {
|
|
|
161
161
|
* Starts native client with dsn and options
|
|
162
162
|
*/
|
|
163
163
|
_initNativeSdk() {
|
|
164
|
-
var _a;
|
|
164
|
+
var _a, _b;
|
|
165
165
|
NATIVE.initNativeSdk(Object.assign(Object.assign({}, this._options), { defaultSidecarUrl: getDefaultSidecarUrl(), devServerUrl: ((_a = getDevServer()) === null || _a === void 0 ? void 0 : _a.url) || '', mobileReplayOptions: this._integrations[MOBILE_REPLAY_INTEGRATION_NAME] &&
|
|
166
166
|
'options' in this._integrations[MOBILE_REPLAY_INTEGRATION_NAME]
|
|
167
167
|
? this._integrations[MOBILE_REPLAY_INTEGRATION_NAME].options
|
|
168
|
-
: undefined }))
|
|
168
|
+
: undefined, androidProfilingOptions: (_b = this._options._experiments) === null || _b === void 0 ? void 0 : _b.androidProfilingOptions }))
|
|
169
169
|
.then((result) => {
|
|
170
170
|
return result;
|
|
171
171
|
}, () => {
|
package/dist/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CAAC,QAAmB,EAAE,QAA8B;QAC/E,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE;YACvB,MAAM,gBAAgB,GAAqB;gBACzC,EAAE,IAAI,EAAE,eAAe,EAAE;gBACzB;oBACE,SAAS,EAAE,sBAAsB,EAAE;oBACnC,gBAAgB,EAAE,QAAQ;iBAC3B;aACF,CAAC;YAEF,QAAQ,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;SACxC;IACH,CAAC;CACF","sourcesContent":["import { eventFromException, eventFromMessage } from '@sentry/browser';\nimport type {\n ClientReportEnvelope,\n ClientReportItem,\n Envelope,\n Event,\n EventHint,\n Outcome,\n SeverityLevel,\n TransportMakeRequestResponse,\n UserFeedback,\n} from '@sentry/core';\nimport {\n _INTERNAL_flushLogsBuffer,\n addAutoIpAddressToSession,\n Client,\n dateTimestampInSeconds,\n debug,\n SentryError,\n} from '@sentry/core';\nimport { Alert } from 'react-native';\nimport { getDevServer } from './integrations/debugsymbolicatorutils';\nimport { defaultSdkInfo } from './integrations/sdkinfo';\nimport { getDefaultSidecarUrl } from './integrations/spotlight';\nimport type { ReactNativeClientOptions } from './options';\nimport type { mobileReplayIntegration } from './replay/mobilereplay';\nimport { MOBILE_REPLAY_INTEGRATION_NAME } from './replay/mobilereplay';\nimport { createUserFeedbackEnvelope, items } from './utils/envelope';\nimport { ignoreRequireCycleLogs } from './utils/ignorerequirecyclelogs';\nimport { mergeOutcomes } from './utils/outcome';\nimport { ReactNativeLibraries } from './utils/rnlibraries';\nimport { NATIVE } from './wrapper';\n\nconst DEFAULT_FLUSH_INTERVAL = 5000;\n\n/**\n * The Sentry React Native SDK Client.\n *\n * @see ReactNativeClientOptions for documentation on configuration options.\n * @see SentryClient for usage documentation.\n */\nexport class ReactNativeClient extends Client<ReactNativeClientOptions> {\n private _outcomesBuffer: Outcome[];\n private _logFlushIdleTimeout: ReturnType<typeof setTimeout> | undefined;\n\n /**\n * Creates a new React Native SDK instance.\n * @param options Configuration options for this SDK.\n */\n public constructor(options: ReactNativeClientOptions) {\n ignoreRequireCycleLogs(ReactNativeLibraries.ReactNativeVersion?.version);\n options._metadata = {\n ...options._metadata,\n sdk: {\n ...(options._metadata?.sdk || defaultSdkInfo),\n settings: {\n // Only allow IP inferral by Relay if sendDefaultPii is true\n infer_ip: options.sendDefaultPii ? 'auto' : 'never',\n ...options._metadata?.sdk?.settings,\n },\n },\n };\n\n // We default this to true, as it is the safer scenario\n options.parentSpanIsAlwaysRootSpan =\n options.parentSpanIsAlwaysRootSpan === undefined ? true : options.parentSpanIsAlwaysRootSpan;\n\n // enableLogs must be disabled before calling super() to avoid logs being captured.\n // This makes a copy of the user defined value, so we can restore it later for the native usaege.\n const originalEnableLogs = options.enableLogs;\n if (options.enableLogs && options.logsOrigin === 'native') {\n debug.log('disabling Sentry logs on JavaScript due to rule set by logsOrigin');\n options.enableLogs = false;\n }\n\n super(options);\n\n this._outcomesBuffer = [];\n\n if (options.sendDefaultPii === true) {\n this.on('beforeSendSession', addAutoIpAddressToSession);\n }\n\n if (options.enableLogs) {\n this.on('flush', () => {\n _INTERNAL_flushLogsBuffer(this);\n });\n\n this.on('afterCaptureLog', () => {\n if (this._logFlushIdleTimeout) {\n clearTimeout(this._logFlushIdleTimeout);\n }\n\n this._logFlushIdleTimeout = setTimeout(() => {\n _INTERNAL_flushLogsBuffer(this);\n }, DEFAULT_FLUSH_INTERVAL);\n });\n }\n\n // Restore original settings for enabling Native options.\n options.enableLogs = originalEnableLogs;\n }\n\n /**\n * @inheritDoc\n */\n public eventFromException(exception: unknown, hint: EventHint = {}): PromiseLike<Event> {\n return eventFromException(this._options.stackParser, exception, hint, this._options.attachStacktrace);\n }\n\n /**\n * @inheritDoc\n */\n public eventFromMessage(message: string, level?: SeverityLevel, hint?: EventHint): PromiseLike<Event> {\n return eventFromMessage(this._options.stackParser, message, level, hint, this._options.attachStacktrace);\n }\n\n /**\n * If native client is available it will trigger a native crash.\n * Use this only for testing purposes.\n */\n public nativeCrash(): void {\n NATIVE.nativeCrash();\n }\n\n /**\n * @inheritDoc\n */\n public close(): PromiseLike<boolean> {\n // As super.close() flushes queued events, we wait for that to finish before closing the native SDK.\n return super.close().then((result: boolean) => {\n return NATIVE.closeNativeSdk().then(() => result);\n });\n }\n\n /**\n * Sends user feedback to Sentry.\n * @deprecated Use `Sentry.captureFeedback` instead.\n */\n public captureUserFeedback(feedback: UserFeedback): void {\n const envelope = createUserFeedbackEnvelope(feedback, {\n metadata: this._options._metadata,\n dsn: this.getDsn(),\n tunnel: undefined,\n });\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n this.sendEnvelope(envelope);\n }\n\n /**\n * @inheritdoc\n */\n public sendEnvelope(envelope: Envelope): PromiseLike<TransportMakeRequestResponse> {\n const outcomes = this._clearOutcomes();\n this._outcomesBuffer = mergeOutcomes(this._outcomesBuffer, outcomes);\n\n if (this._options.sendClientReports) {\n this._attachClientReportTo(this._outcomesBuffer, envelope as ClientReportEnvelope);\n }\n\n let shouldClearOutcomesBuffer = true;\n if (this._isEnabled() && this._transport && this._dsn) {\n this.emit('beforeEnvelope', envelope);\n\n this._transport.send(envelope).then(null, reason => {\n if (reason instanceof SentryError) {\n // SentryError is thrown by SyncPromise\n shouldClearOutcomesBuffer = false;\n // If this is called asynchronously we want the _outcomesBuffer to be cleared\n debug.error('SentryError while sending event, keeping outcomes buffer:', reason);\n } else {\n debug.error('Error while sending event:', reason);\n }\n });\n } else {\n debug.error('Transport disabled');\n }\n\n if (shouldClearOutcomesBuffer) {\n this._outcomesBuffer = []; // if send fails synchronously the _outcomesBuffer will stay intact\n }\n\n return Promise.resolve({});\n }\n\n /**\n * @inheritDoc\n */\n public init(): void {\n super.init();\n this._initNativeSdk();\n }\n\n /**\n * Register a hook on this client.\n *\n * (Generic method signature to allow for custom React Native Client events.)\n */\n public on(hook: string, callback: unknown): () => void {\n // @ts-expect-error on from the base class doesn't support generic types\n return super.on(hook, callback);\n }\n\n /**\n * Emit a hook that was previously registered via `on()`.\n *\n * (Generic method signature to allow for custom React Native Client events.)\n */\n public emit(hook: string, ...rest: unknown[]): void {\n // @ts-expect-error emit from the base class doesn't support generic types\n super.emit(hook, ...rest);\n }\n\n /**\n * Starts native client with dsn and options\n */\n private _initNativeSdk(): void {\n NATIVE.initNativeSdk({\n ...this._options,\n defaultSidecarUrl: getDefaultSidecarUrl(),\n devServerUrl: getDevServer()?.url || '',\n mobileReplayOptions:\n this._integrations[MOBILE_REPLAY_INTEGRATION_NAME] &&\n 'options' in this._integrations[MOBILE_REPLAY_INTEGRATION_NAME]\n ? (this._integrations[MOBILE_REPLAY_INTEGRATION_NAME] as ReturnType<typeof mobileReplayIntegration>).options\n : undefined,\n })\n .then(\n (result: boolean) => {\n return result;\n },\n () => {\n this._showCannotConnectDialog();\n return false;\n },\n )\n .then((didCallNativeInit: boolean) => {\n this._options.onReady?.({ didCallNativeInit });\n this.emit('afterInit');\n })\n .then(undefined, error => {\n debug.error('The OnReady callback threw an error: ', error);\n });\n }\n\n /**\n * If the user is in development mode, and the native nagger is enabled then it will show an alert.\n */\n private _showCannotConnectDialog(): void {\n if (__DEV__ && this._options.enableNativeNagger) {\n Alert.alert(\n 'Sentry',\n 'Warning, could not connect to Sentry native SDK.\\nIf you do not want to use the native component please pass `enableNative: false` in the options.\\nVisit: https://docs.sentry.io/platforms/react-native/ for more details.',\n );\n }\n }\n\n /**\n * Attaches a client report from outcomes to the envelope.\n */\n private _attachClientReportTo(outcomes: Outcome[], envelope: ClientReportEnvelope): void {\n if (outcomes.length > 0) {\n const clientReportItem: ClientReportItem = [\n { type: 'client_report' },\n {\n timestamp: dateTimestampInSeconds(),\n discarded_events: outcomes,\n },\n ];\n\n envelope[items].push(clientReportItem);\n }\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/js/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,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B,GAAqB;gBACzC,EAAE,IAAI,EAAE,eAAe,EAAE;gBACzB;oBACE,SAAS,EAAE,sBAAsB,EAAE;oBACnC,gBAAgB,EAAE,QAAQ;iBAC3B;aACF,CAAC;YAEF,QAAQ,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;SACxC;IACH,CAAC;CACF","sourcesContent":["import { eventFromException, eventFromMessage } from '@sentry/browser';\nimport type {\n ClientReportEnvelope,\n ClientReportItem,\n Envelope,\n Event,\n EventHint,\n Outcome,\n SeverityLevel,\n TransportMakeRequestResponse,\n UserFeedback,\n} from '@sentry/core';\nimport {\n _INTERNAL_flushLogsBuffer,\n addAutoIpAddressToSession,\n Client,\n dateTimestampInSeconds,\n debug,\n SentryError,\n} from '@sentry/core';\nimport { Alert } from 'react-native';\nimport { getDevServer } from './integrations/debugsymbolicatorutils';\nimport { defaultSdkInfo } from './integrations/sdkinfo';\nimport { getDefaultSidecarUrl } from './integrations/spotlight';\nimport type { ReactNativeClientOptions } from './options';\nimport type { mobileReplayIntegration } from './replay/mobilereplay';\nimport { MOBILE_REPLAY_INTEGRATION_NAME } from './replay/mobilereplay';\nimport { createUserFeedbackEnvelope, items } from './utils/envelope';\nimport { ignoreRequireCycleLogs } from './utils/ignorerequirecyclelogs';\nimport { mergeOutcomes } from './utils/outcome';\nimport { ReactNativeLibraries } from './utils/rnlibraries';\nimport { NATIVE } from './wrapper';\n\nconst DEFAULT_FLUSH_INTERVAL = 5000;\n\n/**\n * The Sentry React Native SDK Client.\n *\n * @see ReactNativeClientOptions for documentation on configuration options.\n * @see SentryClient for usage documentation.\n */\nexport class ReactNativeClient extends Client<ReactNativeClientOptions> {\n private _outcomesBuffer: Outcome[];\n private _logFlushIdleTimeout: ReturnType<typeof setTimeout> | undefined;\n\n /**\n * Creates a new React Native SDK instance.\n * @param options Configuration options for this SDK.\n */\n public constructor(options: ReactNativeClientOptions) {\n ignoreRequireCycleLogs(ReactNativeLibraries.ReactNativeVersion?.version);\n options._metadata = {\n ...options._metadata,\n sdk: {\n ...(options._metadata?.sdk || defaultSdkInfo),\n settings: {\n // Only allow IP inferral by Relay if sendDefaultPii is true\n infer_ip: options.sendDefaultPii ? 'auto' : 'never',\n ...options._metadata?.sdk?.settings,\n },\n },\n };\n\n // We default this to true, as it is the safer scenario\n options.parentSpanIsAlwaysRootSpan =\n options.parentSpanIsAlwaysRootSpan === undefined ? true : options.parentSpanIsAlwaysRootSpan;\n\n // enableLogs must be disabled before calling super() to avoid logs being captured.\n // This makes a copy of the user defined value, so we can restore it later for the native usaege.\n const originalEnableLogs = options.enableLogs;\n if (options.enableLogs && options.logsOrigin === 'native') {\n debug.log('disabling Sentry logs on JavaScript due to rule set by logsOrigin');\n options.enableLogs = false;\n }\n\n super(options);\n\n this._outcomesBuffer = [];\n\n if (options.sendDefaultPii === true) {\n this.on('beforeSendSession', addAutoIpAddressToSession);\n }\n\n if (options.enableLogs) {\n this.on('flush', () => {\n _INTERNAL_flushLogsBuffer(this);\n });\n\n this.on('afterCaptureLog', () => {\n if (this._logFlushIdleTimeout) {\n clearTimeout(this._logFlushIdleTimeout);\n }\n\n this._logFlushIdleTimeout = setTimeout(() => {\n _INTERNAL_flushLogsBuffer(this);\n }, DEFAULT_FLUSH_INTERVAL);\n });\n }\n\n // Restore original settings for enabling Native options.\n options.enableLogs = originalEnableLogs;\n }\n\n /**\n * @inheritDoc\n */\n public eventFromException(exception: unknown, hint: EventHint = {}): PromiseLike<Event> {\n return eventFromException(this._options.stackParser, exception, hint, this._options.attachStacktrace);\n }\n\n /**\n * @inheritDoc\n */\n public eventFromMessage(message: string, level?: SeverityLevel, hint?: EventHint): PromiseLike<Event> {\n return eventFromMessage(this._options.stackParser, message, level, hint, this._options.attachStacktrace);\n }\n\n /**\n * If native client is available it will trigger a native crash.\n * Use this only for testing purposes.\n */\n public nativeCrash(): void {\n NATIVE.nativeCrash();\n }\n\n /**\n * @inheritDoc\n */\n public close(): PromiseLike<boolean> {\n // As super.close() flushes queued events, we wait for that to finish before closing the native SDK.\n return super.close().then((result: boolean) => {\n return NATIVE.closeNativeSdk().then(() => result);\n });\n }\n\n /**\n * Sends user feedback to Sentry.\n * @deprecated Use `Sentry.captureFeedback` instead.\n */\n public captureUserFeedback(feedback: UserFeedback): void {\n const envelope = createUserFeedbackEnvelope(feedback, {\n metadata: this._options._metadata,\n dsn: this.getDsn(),\n tunnel: undefined,\n });\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n this.sendEnvelope(envelope);\n }\n\n /**\n * @inheritdoc\n */\n public sendEnvelope(envelope: Envelope): PromiseLike<TransportMakeRequestResponse> {\n const outcomes = this._clearOutcomes();\n this._outcomesBuffer = mergeOutcomes(this._outcomesBuffer, outcomes);\n\n if (this._options.sendClientReports) {\n this._attachClientReportTo(this._outcomesBuffer, envelope as ClientReportEnvelope);\n }\n\n let shouldClearOutcomesBuffer = true;\n if (this._isEnabled() && this._transport && this._dsn) {\n this.emit('beforeEnvelope', envelope);\n\n this._transport.send(envelope).then(null, reason => {\n if (reason instanceof SentryError) {\n // SentryError is thrown by SyncPromise\n shouldClearOutcomesBuffer = false;\n // If this is called asynchronously we want the _outcomesBuffer to be cleared\n debug.error('SentryError while sending event, keeping outcomes buffer:', reason);\n } else {\n debug.error('Error while sending event:', reason);\n }\n });\n } else {\n debug.error('Transport disabled');\n }\n\n if (shouldClearOutcomesBuffer) {\n this._outcomesBuffer = []; // if send fails synchronously the _outcomesBuffer will stay intact\n }\n\n return Promise.resolve({});\n }\n\n /**\n * @inheritDoc\n */\n public init(): void {\n super.init();\n this._initNativeSdk();\n }\n\n /**\n * Register a hook on this client.\n *\n * (Generic method signature to allow for custom React Native Client events.)\n */\n public on(hook: string, callback: unknown): () => void {\n // @ts-expect-error on from the base class doesn't support generic types\n return super.on(hook, callback);\n }\n\n /**\n * Emit a hook that was previously registered via `on()`.\n *\n * (Generic method signature to allow for custom React Native Client events.)\n */\n public emit(hook: string, ...rest: unknown[]): void {\n // @ts-expect-error emit from the base class doesn't support generic types\n super.emit(hook, ...rest);\n }\n\n /**\n * Starts native client with dsn and options\n */\n private _initNativeSdk(): void {\n NATIVE.initNativeSdk({\n ...this._options,\n defaultSidecarUrl: getDefaultSidecarUrl(),\n devServerUrl: getDevServer()?.url || '',\n mobileReplayOptions:\n this._integrations[MOBILE_REPLAY_INTEGRATION_NAME] &&\n 'options' in this._integrations[MOBILE_REPLAY_INTEGRATION_NAME]\n ? (this._integrations[MOBILE_REPLAY_INTEGRATION_NAME] as ReturnType<typeof mobileReplayIntegration>).options\n : undefined,\n androidProfilingOptions: this._options._experiments?.androidProfilingOptions,\n })\n .then(\n (result: boolean) => {\n return result;\n },\n () => {\n this._showCannotConnectDialog();\n return false;\n },\n )\n .then((didCallNativeInit: boolean) => {\n this._options.onReady?.({ didCallNativeInit });\n this.emit('afterInit');\n })\n .then(undefined, error => {\n debug.error('The OnReady callback threw an error: ', error);\n });\n }\n\n /**\n * If the user is in development mode, and the native nagger is enabled then it will show an alert.\n */\n private _showCannotConnectDialog(): void {\n if (__DEV__ && this._options.enableNativeNagger) {\n Alert.alert(\n 'Sentry',\n 'Warning, could not connect to Sentry native SDK.\\nIf you do not want to use the native component please pass `enableNative: false` in the options.\\nVisit: https://docs.sentry.io/platforms/react-native/ for more details.',\n );\n }\n }\n\n /**\n * Attaches a client report from outcomes to the envelope.\n */\n private _attachClientReportTo(outcomes: Outcome[], envelope: ClientReportEnvelope): void {\n if (outcomes.length > 0) {\n const clientReportItem: ClientReportItem = [\n { type: 'client_report' },\n {\n timestamp: dateTimestampInSeconds(),\n discarded_events: outcomes,\n },\n ];\n\n envelope[items].push(clientReportItem);\n }\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FeedbackWidgetProvider.d.ts","sourceRoot":"","sources":["../../../src/js/feedback/FeedbackWidgetProvider.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,
|
|
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C,QAAQ;YACnB,eAAe,IAAI,oBAAC,cAAc,oBAAK,wBAAwB,EAAE,EAAI;YACrE,yBAAyB,IAAI,oBAAC,gBAAgB,oBAAK,0BAA0B,EAAE,EAAI;YACnF,SAAS,IAAI,CACZ,oBAAC,QAAQ,CAAC,IAAI,IAAC,KAAK,EAAE,CAAC,YAAY,EAAE,EAAE,eAAe,EAAE,CAAC;gBACvD,oBAAC,KAAK,IACJ,OAAO,EAAE,SAAS,EAClB,WAAW,QACX,aAAa,EAAC,MAAM,EACpB,cAAc,EAAE,IAAI,CAAC,YAAY,EACjC,MAAM,EAAC,qBAAqB;oBAE5B,oBAAC,IAAI,IAAC,KAAK,EAAE,SAAS,GAAI;oBAC1B,oBAAC,QAAQ,CAAC,IAAI,kBACZ,KAAK,EAAE,CAAC,mBAAmB,CAAC,KAAK,CAAC,EAAE,EAAE,SAAS,EAAE,CAAC,EAAE,UAAU,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,EAAE,CAAC,IACjF,IAAI,CAAC,aAAa,CAAC,WAAW;wBAElC,oBAAC,UAAU,IACT,OAAO,EAAE,KAAK,EACd,yBAAyB,EAAC,SAAS,EACnC,iCAAiC,EAAE,QAAQ,CAAC,EAAE,KAAK,KAAK,EACxD,QAAQ,EAAE,IAAI,CAAC,aAAa;4BAE5B,oBAAC,cAAc,oBACT,kBAAkB,EAAE,IACxB,WAAW,EAAE,IAAI,CAAC,YAAY,EAC9B,eAAe,EAAE,IAAI,CAAC,YAAY,IAClC,CACS,CACC,CACV,CACM,CACjB,CACA,CACJ,CAAC;IACJ,CAAC;CA6CF","sourcesContent":["import { debug } from '@sentry/core';\nimport * as React from 'react';\nimport { type NativeEventSubscription, type NativeScrollEvent,type NativeSyntheticEvent, Animated, Appearance, Dimensions, Easing, Modal, PanResponder, Platform, ScrollView, View } from 'react-native';\nimport { notWeb } from '../utils/environment';\nimport { FeedbackButton } from './FeedbackButton';\nimport { FeedbackWidget } from './FeedbackWidget';\nimport { modalSheetContainer,modalWrapper, topSpacer } from './FeedbackWidget.styles';\nimport { getTheme } from './FeedbackWidget.theme';\nimport type { FeedbackWidgetStyles } from './FeedbackWidget.types';\nimport {\n BACKGROUND_ANIMATION_DURATION,\n FeedbackButtonManager,\n FeedbackWidgetManager,\n PULL_DOWN_CLOSE_THRESHOLD,\n ScreenshotButtonManager,\n SLIDE_ANIMATION_DURATION,\n} from './FeedbackWidgetManager';\nimport { getFeedbackButtonOptions, getFeedbackOptions, getScreenshotButtonOptions } from './integration';\nimport { ScreenshotButton } from './ScreenshotButton';\nimport { isModalSupported, isNativeDriverSupportedForColorAnimations } from './utils';\n\nconst useNativeDriverForColorAnimations = isNativeDriverSupportedForColorAnimations();\n\nexport interface FeedbackWidgetProviderProps {\n children: React.ReactNode;\n styles?: FeedbackWidgetStyles;\n}\n\nexport interface FeedbackWidgetProviderState {\n isButtonVisible: boolean;\n isScreenshotButtonVisible: boolean;\n isVisible: boolean;\n backgroundOpacity: Animated.Value;\n panY: Animated.Value;\n isScrollAtTop: boolean;\n}\n\n/**\n * FeedbackWidgetProvider is a component that wraps the feedback widget and provides\n * functionality to show and hide the widget. It also manages the visibility of the\n * feedback button and screenshot button.\n */\nexport class FeedbackWidgetProvider extends React.Component<FeedbackWidgetProviderProps> {\n public state: FeedbackWidgetProviderState = {\n isButtonVisible: false,\n isScreenshotButtonVisible: false,\n isVisible: false,\n backgroundOpacity: new Animated.Value(0),\n panY: new Animated.Value(Dimensions.get('screen').height),\n isScrollAtTop: true,\n };\n\n private _themeListener: NativeEventSubscription | undefined;\n\n private _panResponder = PanResponder.create({\n onStartShouldSetPanResponder: (_, gestureState) => {\n return notWeb() && this.state.isScrollAtTop && gestureState.dy > 0;\n },\n onMoveShouldSetPanResponder: (_, gestureState) => {\n return notWeb() && this.state.isScrollAtTop && gestureState.dy > 0;\n },\n onPanResponderMove: (_, gestureState) => {\n if (gestureState.dy > 0) {\n this.state.panY.setValue(gestureState.dy);\n }\n },\n onPanResponderRelease: (_, gestureState) => {\n if (gestureState.dy > PULL_DOWN_CLOSE_THRESHOLD) {\n // Close on swipe below a certain threshold\n Animated.timing(this.state.panY, {\n toValue: Dimensions.get('screen').height,\n duration: SLIDE_ANIMATION_DURATION,\n useNativeDriver: true,\n }).start(() => {\n this._handleClose();\n });\n } else {\n // Animate it back to the original position\n Animated.spring(this.state.panY, {\n toValue: 0,\n useNativeDriver: true,\n }).start();\n }\n },\n });\n\n public constructor(props: FeedbackWidgetProviderProps) {\n super(props);\n FeedbackButtonManager.initialize(this._setButtonVisibilityFunction);\n ScreenshotButtonManager.initialize(this._setScreenshotButtonVisibilityFunction);\n FeedbackWidgetManager.initialize(this._setVisibilityFunction);\n }\n\n /**\n * Add a listener to the theme change event.\n */\n public componentDidMount(): void {\n this._themeListener = Appearance.addChangeListener(() => {\n this.forceUpdate();\n });\n }\n\n /**\n * Clean up the theme listener.\n */\n public componentWillUnmount(): void {\n if (this._themeListener) {\n this._themeListener.remove();\n }\n }\n\n /**\n * Animates the background opacity when the modal is shown.\n */\n public componentDidUpdate(_prevProps: any, prevState: FeedbackWidgetProviderState): void {\n if (!prevState.isVisible && this.state.isVisible) {\n Animated.parallel([\n Animated.timing(this.state.backgroundOpacity, {\n toValue: 1,\n duration: BACKGROUND_ANIMATION_DURATION,\n useNativeDriver: useNativeDriverForColorAnimations,\n easing: Easing.in(Easing.quad),\n }),\n Animated.timing(this.state.panY, {\n toValue: 0,\n duration: SLIDE_ANIMATION_DURATION,\n useNativeDriver: true,\n easing: Easing.in(Easing.quad),\n }),\n ]).start(() => {\n debug.log('FeedbackWidgetProvider componentDidUpdate');\n });\n } else if (prevState.isVisible && !this.state.isVisible) {\n this.state.backgroundOpacity.setValue(0);\n }\n }\n\n /**\n * Renders the feedback form modal.\n */\n public render(): React.ReactNode {\n if (!isModalSupported()) {\n debug.error('FeedbackWidget Modal is not supported in React Native < 0.71 with Fabric renderer.');\n return <>{this.props.children}</>;\n }\n\n const theme = getTheme();\n\n const { isButtonVisible, isScreenshotButtonVisible, isVisible, backgroundOpacity } = this.state;\n\n const backgroundColor = backgroundOpacity.interpolate({\n inputRange: [0, 1],\n outputRange: ['rgba(0, 0, 0, 0)', 'rgba(0, 0, 0, 0.9)'],\n });\n\n // Wrapping the `Modal` component in a `View` component is necessary to avoid\n // issues like https://github.com/software-mansion/react-native-reanimated/issues/6035\n return (\n <>\n {this.props.children}\n {isButtonVisible && <FeedbackButton {...getFeedbackButtonOptions()} />}\n {isScreenshotButtonVisible && <ScreenshotButton {...getScreenshotButtonOptions()} />}\n {isVisible && (\n <Animated.View style={[modalWrapper, { backgroundColor }]}>\n <Modal\n visible={isVisible}\n transparent\n animationType=\"none\"\n onRequestClose={this._handleClose}\n testID=\"feedback-form-modal\"\n >\n <View style={topSpacer} />\n <Animated.View\n style={[modalSheetContainer(theme), { transform: [{ translateY: this.state.panY }] }]}\n {...this._panResponder.panHandlers}\n >\n <ScrollView\n bounces={false}\n keyboardShouldPersistTaps=\"handled\"\n automaticallyAdjustKeyboardInsets={Platform.OS === 'ios'}\n onScroll={this._handleScroll}\n >\n <FeedbackWidget\n {...getFeedbackOptions()}\n onFormClose={this._handleClose}\n onFormSubmitted={this._handleClose}\n />\n </ScrollView>\n </Animated.View>\n </Modal>\n </Animated.View>\n )}\n </>\n );\n }\n\n private _handleScroll = (event: NativeSyntheticEvent<NativeScrollEvent>): void => {\n this.setState({ isScrollAtTop: event.nativeEvent.contentOffset.y <= 0 });\n };\n\n private _setVisibilityFunction = (visible: boolean): void => {\n const updateState = (): void => {\n this.setState({ isVisible: visible });\n };\n if (!visible) {\n Animated.parallel([\n Animated.timing(this.state.panY, {\n toValue: Dimensions.get('screen').height,\n duration: SLIDE_ANIMATION_DURATION,\n useNativeDriver: true,\n easing: Easing.out(Easing.quad),\n }),\n Animated.timing(this.state.backgroundOpacity, {\n toValue: 0,\n duration: BACKGROUND_ANIMATION_DURATION,\n useNativeDriver: useNativeDriverForColorAnimations,\n easing: Easing.out(Easing.quad),\n }),\n ]).start(() => {\n // Change of the state unmount the component\n // which would cancel the animation\n updateState();\n });\n } else {\n updateState();\n }\n };\n\n private _setButtonVisibilityFunction = (visible: boolean): void => {\n this.setState({ isButtonVisible: visible });\n };\n\n private _setScreenshotButtonVisibilityFunction = (visible: boolean): void => {\n this.setState({ isScreenshotButtonVisible: visible });\n };\n\n private _handleClose = (): void => {\n FeedbackWidgetManager.hide();\n };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"FeedbackWidgetProvider.js","sourceRoot":"","sources":["../../../src/js/feedback/FeedbackWidgetProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AACrC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,EAAE,KAAK,EAAkF,YAAY,EAAE,QAAQ,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AACzM,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,mBAAmB,EAAC,YAAY,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACtF,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAElD,OAAO,EACL,6BAA6B,EAC7B,qBAAqB,EACrB,qBAAqB,EACrB,yBAAyB,EACzB,uBAAuB,EACvB,wBAAwB,GACzB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,wBAAwB,EAAE,kBAAkB,EAAE,0BAA0B,EAAE,MAAM,eAAe,CAAC;AACzG,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,gBAAgB,EAAE,yCAAyC,EAAE,MAAM,SAAS,CAAC;AAEtF,MAAM,i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,CAAC;IACJ,CAAC;CA6CF","sourcesContent":["import { debug } from '@sentry/core';\nimport * as React from 'react';\nimport { Animated, Appearance, Dimensions, Easing, Modal, type NativeEventSubscription, type NativeScrollEvent,type NativeSyntheticEvent, PanResponder, Platform, ScrollView, View } from 'react-native';\nimport { notWeb } from '../utils/environment';\nimport { FeedbackButton } from './FeedbackButton';\nimport { FeedbackWidget } from './FeedbackWidget';\nimport { modalSheetContainer,modalWrapper, topSpacer } from './FeedbackWidget.styles';\nimport { getTheme } from './FeedbackWidget.theme';\nimport type { FeedbackWidgetStyles } from './FeedbackWidget.types';\nimport {\n BACKGROUND_ANIMATION_DURATION,\n FeedbackButtonManager,\n FeedbackWidgetManager,\n PULL_DOWN_CLOSE_THRESHOLD,\n ScreenshotButtonManager,\n SLIDE_ANIMATION_DURATION,\n} from './FeedbackWidgetManager';\nimport { getFeedbackButtonOptions, getFeedbackOptions, getScreenshotButtonOptions } from './integration';\nimport { ScreenshotButton } from './ScreenshotButton';\nimport { isModalSupported, isNativeDriverSupportedForColorAnimations } from './utils';\n\nconst useNativeDriverForColorAnimations = isNativeDriverSupportedForColorAnimations();\n\nexport interface FeedbackWidgetProviderProps {\n children: React.ReactNode;\n styles?: FeedbackWidgetStyles;\n}\n\nexport interface FeedbackWidgetProviderState {\n isButtonVisible: boolean;\n isScreenshotButtonVisible: boolean;\n isVisible: boolean;\n backgroundOpacity: Animated.Value;\n panY: Animated.Value;\n isScrollAtTop: boolean;\n}\n\n/**\n * FeedbackWidgetProvider is a component that wraps the feedback widget and provides\n * functionality to show and hide the widget. It also manages the visibility of the\n * feedback button and screenshot button.\n */\nexport class FeedbackWidgetProvider extends React.Component<FeedbackWidgetProviderProps> {\n public state: FeedbackWidgetProviderState = {\n isButtonVisible: false,\n isScreenshotButtonVisible: false,\n isVisible: false,\n backgroundOpacity: new Animated.Value(0),\n panY: new Animated.Value(Dimensions.get('screen').height),\n isScrollAtTop: true,\n };\n\n private _themeListener: NativeEventSubscription | undefined;\n\n private _panResponder = PanResponder.create({\n onStartShouldSetPanResponder: (_, gestureState) => {\n return notWeb() && this.state.isScrollAtTop && gestureState.dy > 0;\n },\n onMoveShouldSetPanResponder: (_, gestureState) => {\n return notWeb() && this.state.isScrollAtTop && gestureState.dy > 0;\n },\n onPanResponderMove: (_, gestureState) => {\n if (gestureState.dy > 0) {\n this.state.panY.setValue(gestureState.dy);\n }\n },\n onPanResponderRelease: (_, gestureState) => {\n if (gestureState.dy > PULL_DOWN_CLOSE_THRESHOLD) {\n // Close on swipe below a certain threshold\n Animated.timing(this.state.panY, {\n toValue: Dimensions.get('screen').height,\n duration: SLIDE_ANIMATION_DURATION,\n useNativeDriver: true,\n }).start(() => {\n this._handleClose();\n });\n } else {\n // Animate it back to the original position\n Animated.spring(this.state.panY, {\n toValue: 0,\n useNativeDriver: true,\n }).start();\n }\n },\n });\n\n public constructor(props: FeedbackWidgetProviderProps) {\n super(props);\n FeedbackButtonManager.initialize(this._setButtonVisibilityFunction);\n ScreenshotButtonManager.initialize(this._setScreenshotButtonVisibilityFunction);\n FeedbackWidgetManager.initialize(this._setVisibilityFunction);\n }\n\n /**\n * Add a listener to the theme change event.\n */\n public componentDidMount(): void {\n this._themeListener = Appearance.addChangeListener(() => {\n this.forceUpdate();\n });\n }\n\n /**\n * Clean up the theme listener.\n */\n public componentWillUnmount(): void {\n if (this._themeListener) {\n this._themeListener.remove();\n }\n }\n\n /**\n * Animates the background opacity when the modal is shown.\n */\n public componentDidUpdate(_prevProps: any, prevState: FeedbackWidgetProviderState): void {\n if (!prevState.isVisible && this.state.isVisible) {\n Animated.parallel([\n Animated.timing(this.state.backgroundOpacity, {\n toValue: 1,\n duration: BACKGROUND_ANIMATION_DURATION,\n useNativeDriver: useNativeDriverForColorAnimations,\n easing: Easing.in(Easing.quad),\n }),\n Animated.timing(this.state.panY, {\n toValue: 0,\n duration: SLIDE_ANIMATION_DURATION,\n useNativeDriver: true,\n easing: Easing.in(Easing.quad),\n }),\n ]).start(() => {\n debug.log('FeedbackWidgetProvider componentDidUpdate');\n });\n } else if (prevState.isVisible && !this.state.isVisible) {\n this.state.backgroundOpacity.setValue(0);\n }\n }\n\n /**\n * Renders the feedback form modal.\n */\n public render(): React.ReactNode {\n if (!isModalSupported()) {\n debug.error('FeedbackWidget Modal is not supported in React Native < 0.71 with Fabric renderer.');\n return <>{this.props.children}</>;\n }\n\n const theme = getTheme();\n\n const { isButtonVisible, isScreenshotButtonVisible, isVisible, backgroundOpacity } = this.state;\n\n const backgroundColor = backgroundOpacity.interpolate({\n inputRange: [0, 1],\n outputRange: ['rgba(0, 0, 0, 0)', 'rgba(0, 0, 0, 0.9)'],\n });\n\n // Wrapping the `Modal` component in a `View` component is necessary to avoid\n // issues like https://github.com/software-mansion/react-native-reanimated/issues/6035\n return (\n <>\n {this.props.children}\n {isButtonVisible && <FeedbackButton {...getFeedbackButtonOptions()} />}\n {isScreenshotButtonVisible && <ScreenshotButton {...getScreenshotButtonOptions()} />}\n {isVisible && (\n <Animated.View style={[modalWrapper, { backgroundColor }]}>\n <Modal\n visible={isVisible}\n transparent\n animationType=\"none\"\n onRequestClose={this._handleClose}\n testID=\"feedback-form-modal\"\n >\n <View style={topSpacer} />\n <Animated.View\n style={[modalSheetContainer(theme), { transform: [{ translateY: this.state.panY }] }]}\n {...this._panResponder.panHandlers}\n >\n <ScrollView\n bounces={false}\n keyboardShouldPersistTaps=\"handled\"\n automaticallyAdjustKeyboardInsets={Platform.OS === 'ios'}\n onScroll={this._handleScroll}\n >\n <FeedbackWidget\n {...getFeedbackOptions()}\n onFormClose={this._handleClose}\n onFormSubmitted={this._handleClose}\n />\n </ScrollView>\n </Animated.View>\n </Modal>\n </Animated.View>\n )}\n </>\n );\n }\n\n private _handleScroll = (event: NativeSyntheticEvent<NativeScrollEvent>): void => {\n this.setState({ isScrollAtTop: event.nativeEvent.contentOffset.y <= 0 });\n };\n\n private _setVisibilityFunction = (visible: boolean): void => {\n const updateState = (): void => {\n this.setState({ isVisible: visible });\n };\n if (!visible) {\n Animated.parallel([\n Animated.timing(this.state.panY, {\n toValue: Dimensions.get('screen').height,\n duration: SLIDE_ANIMATION_DURATION,\n useNativeDriver: true,\n easing: Easing.out(Easing.quad),\n }),\n Animated.timing(this.state.backgroundOpacity, {\n toValue: 0,\n duration: BACKGROUND_ANIMATION_DURATION,\n useNativeDriver: useNativeDriverForColorAnimations,\n easing: Easing.out(Easing.quad),\n }),\n ]).start(() => {\n // Change of the state unmount the component\n // which would cancel the animation\n updateState();\n });\n } else {\n updateState();\n }\n };\n\n private _setButtonVisibilityFunction = (visible: boolean): void => {\n this.setState({ isButtonVisible: visible });\n };\n\n private _setScreenshotButtonVisibilityFunction = (visible: boolean): void => {\n this.setState({ isScreenshotButtonVisible: visible });\n };\n\n private _handleClose = (): void => {\n FeedbackWidgetManager.hide();\n };\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"integration.d.ts","sourceRoot":"","sources":["../../../src/js/feedback/integration.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"integration.d.ts","sourceRoot":"","sources":["../../../src/js/feedback/integration.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,KAAK,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAClE,OAAO,KAAK,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAE9G,eAAO,MAAM,gCAAgC,mBAAmB,CAAC;AAEjE,KAAK,mBAAmB,GAAG,WAAW,GAAG;IACvC,OAAO,EAAE,OAAO,CAAC,mBAAmB,CAAC,CAAC;IACtC,aAAa,EAAE,OAAO,CAAC,mBAAmB,CAAC,CAAC;IAC5C,uBAAuB,EAAE,OAAO,CAAC,qBAAqB,CAAC,CAAC;IACxD,WAAW,CAAC,EAAE,QAAQ,GAAG,OAAO,GAAG,MAAM,CAAC;IAC1C,UAAU,EAAE,OAAO,CAAC,mBAAmB,CAAC,CAAC;IACzC,SAAS,EAAE,OAAO,CAAC,mBAAmB,CAAC,CAAC;CACzC,CAAC;AAEF,eAAO,MAAM,mBAAmB,iBACjB,QAAQ,mBAAmB,CAAC,GAAG;IAC1C,aAAa,CAAC,EAAE,mBAAmB,CAAC;IACpC,uBAAuB,CAAC,EAAE,qBAAqB,CAAC;IAChD,WAAW,CAAC,EAAE,QAAQ,GAAG,OAAO,GAAG,MAAM,CAAC;IAC1C,UAAU,CAAC,EAAE,QAAQ,mBAAmB,CAAC,CAAC;IAC1C,SAAS,CAAC,EAAE,QAAQ,mBAAmB,CAAC,CAAC;CAC1C,KACA,mBAmBF,CAAC;AAMF,eAAO,MAAM,kBAAkB,QAAO,QAAQ,mBAAmB,CAOhE,CAAC;AAEF,eAAO,MAAM,wBAAwB,QAAO,QAAQ,mBAAmB,CAOtE,CAAC;AAEF,eAAO,MAAM,0BAA0B,QAAO,QAAQ,qBAAqB,CAO1E,CAAC;AAEF,eAAO,MAAM,cAAc,QAAO,QAAQ,GAAG,OAAO,GAAG,MAOtD,CAAC;AAEF,eAAO,MAAM,qBAAqB,QAAO,QAAQ,mBAAmB,CAOnE,CAAC;AAEF,eAAO,MAAM,oBAAoB,QAAO,QAAQ,mBAAmB,CAOlE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"integration.js","sourceRoot":"","sources":["../../../src/js/feedback/integration.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"integration.js","sourceRoot":"","sources":["../../../src/js/feedback/integration.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,EAAE,SAAS,EAAoB,MAAM,cAAc,CAAC;AAI3D,MAAM,CAAC,MAAM,gCAAgC,GAAG,gBAAgB,CAAC;AAWjE,MAAM,CAAC,MAAM,mBAAmB,GAAG,CACjC,cAMI,EAAE,EACe,EAAE;IACvB,MAAM,EAC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EAAE;IAC9D,MAAM,WAAW,GAAG,qBAAqB,EAAE,CAAC;IAC5C,IAAI,CAAC,CAAA,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,WAAW,CAAA,EAAE;QAC7B,OAAO,QAAQ,CAAC;KACjB;IAED,OAAO,WAAW,CAAC,WAAW,CAAC;AACjC,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,qBAAqB,GAAG,GAAiC,EAAE;IACtE,MAAM,WAAW,GAAG,qBAAqB,EAAE,CAAC;IAC5C,IAAI,CAAC,WAAW,EAAE;QAChB,OAAO,EAAE,CAAC;KACX;IAED,OAAO,WAAW,CAAC,UAAU,CAAC;AAChC,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,oBAAoB,GAAG,GAAiC,EAAE;IACrE,MAAM,WAAW,GAAG,qBAAqB,EAAE,CAAC;IAC5C,IAAI,CAAC,WAAW,EAAE;QAChB,OAAO,EAAE,CAAC;KACX;IAED,OAAO,WAAW,CAAC,SAAS,CAAC;AAC/B,CAAC,CAAC","sourcesContent":["import { getClient, type Integration } from '@sentry/core';\nimport type { FeedbackWidgetTheme } from './FeedbackWidget.theme';\nimport type { FeedbackButtonProps, FeedbackWidgetProps, ScreenshotButtonProps } from './FeedbackWidget.types';\n\nexport const MOBILE_FEEDBACK_INTEGRATION_NAME = 'MobileFeedback';\n\ntype FeedbackIntegration = Integration & {\n options: Partial<FeedbackWidgetProps>;\n buttonOptions: Partial<FeedbackButtonProps>;\n screenshotButtonOptions: Partial<ScreenshotButtonProps>;\n colorScheme?: 'system' | 'light' | 'dark';\n themeLight: Partial<FeedbackWidgetTheme>;\n themeDark: Partial<FeedbackWidgetTheme>;\n};\n\nexport const feedbackIntegration = (\n initOptions: Partial<FeedbackWidgetProps> & {\n buttonOptions?: FeedbackButtonProps;\n screenshotButtonOptions?: ScreenshotButtonProps;\n colorScheme?: 'system' | 'light' | 'dark';\n themeLight?: Partial<FeedbackWidgetTheme>;\n themeDark?: Partial<FeedbackWidgetTheme>;\n } = {},\n): FeedbackIntegration => {\n const {\n buttonOptions,\n screenshotButtonOptions,\n colorScheme,\n themeLight: lightTheme,\n themeDark: darkTheme,\n ...widgetOptions\n } = initOptions;\n\n return {\n name: MOBILE_FEEDBACK_INTEGRATION_NAME,\n options: widgetOptions,\n buttonOptions: buttonOptions || {},\n screenshotButtonOptions: screenshotButtonOptions || {},\n colorScheme: colorScheme || 'system',\n themeLight: lightTheme || {},\n themeDark: darkTheme || {},\n };\n};\n\nconst _getClientIntegration = (): FeedbackIntegration | undefined => {\n return getClient()?.getIntegrationByName<ReturnType<typeof feedbackIntegration>>(MOBILE_FEEDBACK_INTEGRATION_NAME);\n};\n\nexport const getFeedbackOptions = (): Partial<FeedbackWidgetProps> => {\n const integration = _getClientIntegration();\n if (!integration) {\n return {};\n }\n\n return integration.options;\n};\n\nexport const getFeedbackButtonOptions = (): Partial<FeedbackButtonProps> => {\n const integration = _getClientIntegration();\n if (!integration) {\n return {};\n }\n\n return integration.buttonOptions;\n};\n\nexport const getScreenshotButtonOptions = (): Partial<ScreenshotButtonProps> => {\n const integration = _getClientIntegration();\n if (!integration) {\n return {};\n }\n\n return integration.screenshotButtonOptions;\n};\n\nexport const getColorScheme = (): 'system' | 'light' | 'dark' => {\n const integration = _getClientIntegration();\n if (!integration?.colorScheme) {\n return 'system';\n }\n\n return integration.colorScheme;\n};\n\nexport const getFeedbackLightTheme = (): Partial<FeedbackWidgetTheme> => {\n const integration = _getClientIntegration();\n if (!integration) {\n return {};\n }\n\n return integration.themeLight;\n};\n\nexport const getFeedbackDarkTheme = (): Partial<FeedbackWidgetTheme> => {\n const integration = _getClientIntegration();\n if (!integration) {\n return {};\n }\n\n return integration.themeDark;\n};\n"]}
|
package/dist/js/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export type { Breadcrumb, SdkInfo, Event, Exception, SendFeedbackParams, SeverityLevel, Span, StackFrame, Stacktrace, Thread, User, UserFeedback, ErrorEvent, TransactionEvent, } from '@sentry/core';
|
|
1
|
+
export type { Breadcrumb, SdkInfo, Event, Exception, SendFeedbackParams, SeverityLevel, Span, StackFrame, Stacktrace, Thread, User, UserFeedback, ErrorEvent, TransactionEvent, Metric, } from '@sentry/core';
|
|
2
2
|
export { addBreadcrumb, addIntegration, captureException, captureEvent, captureFeedback, captureMessage, Scope, setContext, setExtra, setExtras, setTag, setTags, setUser, startInactiveSpan, startSpan, startSpanManual, getActiveSpan, getRootSpan, withActiveSpan, suppressTracing, spanToJSON, spanIsSampled, setMeasurement, getCurrentScope, getGlobalScope, getIsolationScope, getClient, setCurrentClient, addEventProcessor, lastEventId, } from '@sentry/core';
|
|
3
3
|
export { ErrorBoundary, withErrorBoundary, createReduxEnhancer, Profiler, useProfiler, withProfiler, } from '@sentry/react';
|
|
4
|
-
export { logger, consoleLoggingIntegration, featureFlagsIntegration, type FeatureFlagsIntegration, } from '@sentry/browser';
|
|
4
|
+
export { logger, consoleLoggingIntegration, featureFlagsIntegration, type FeatureFlagsIntegration, metrics, } from '@sentry/browser';
|
|
5
5
|
export * from './integrations/exports';
|
|
6
6
|
export { SDK_NAME, SDK_VERSION } from './version';
|
|
7
7
|
export type { ReactNativeOptions } from './options';
|
package/dist/js/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/js/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,UAAU,EACV,OAAO,EACP,KAAK,EACL,SAAS,EACT,kBAAkB,EAClB,aAAa,EACb,IAAI,EACJ,UAAU,EACV,UAAU,EACV,MAAM,EACN,IAAI,EACJ,YAAY,EACZ,UAAU,EACV,gBAAgB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/js/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,UAAU,EACV,OAAO,EACP,KAAK,EACL,SAAS,EACT,kBAAkB,EAClB,aAAa,EACb,IAAI,EACJ,UAAU,EACV,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0BAA0B,EAC1B,uBAAuB,EACvB,aAAa,EACb,mCAAmC,EACnC,uBAAuB,EACvB,0BAA0B,GAC3B,MAAM,WAAW,CAAC;AAEnB,YAAY,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAEpD,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAEnD,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AAE9G,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC"}
|
package/dist/js/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { addBreadcrumb, addIntegration, captureException, captureEvent, captureFeedback, captureMessage, Scope, setContext, setExtra, setExtras, setTag, setTags, setUser, startInactiveSpan, startSpan, startSpanManual, getActiveSpan, getRootSpan, withActiveSpan, suppressTracing, spanToJSON, spanIsSampled, setMeasurement, getCurrentScope, getGlobalScope, getIsolationScope, getClient, setCurrentClient, addEventProcessor, lastEventId, } from '@sentry/core';
|
|
2
2
|
export { ErrorBoundary, withErrorBoundary, createReduxEnhancer, Profiler, useProfiler, withProfiler, } from '@sentry/react';
|
|
3
|
-
export { logger, consoleLoggingIntegration, featureFlagsIntegration, } from '@sentry/browser';
|
|
3
|
+
export { logger, consoleLoggingIntegration, featureFlagsIntegration, metrics, } from '@sentry/browser';
|
|
4
4
|
export * from './integrations/exports';
|
|
5
5
|
export { SDK_NAME, SDK_VERSION } from './version';
|
|
6
6
|
export { ReactNativeClient } from './client';
|
package/dist/js/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/js/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../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MAAM,qBAAqB,CAAC;AAEnD,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AAE9G,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC","sourcesContent":["export type {\n Breadcrumb,\n SdkInfo,\n Event,\n Exception,\n SendFeedbackParams,\n SeverityLevel,\n Span,\n StackFrame,\n Stacktrace,\n Thread,\n User,\n UserFeedback,\n ErrorEvent,\n TransactionEvent,\n Metric,\n} from '@sentry/core';\n\nexport {\n addBreadcrumb,\n addIntegration,\n captureException,\n captureEvent,\n captureFeedback,\n captureMessage,\n Scope,\n setContext,\n setExtra,\n setExtras,\n setTag,\n setTags,\n setUser,\n startInactiveSpan,\n startSpan,\n startSpanManual,\n getActiveSpan,\n getRootSpan,\n withActiveSpan,\n suppressTracing,\n spanToJSON,\n spanIsSampled,\n setMeasurement,\n getCurrentScope,\n getGlobalScope,\n getIsolationScope,\n getClient,\n setCurrentClient,\n addEventProcessor,\n lastEventId,\n} from '@sentry/core';\n\nexport {\n ErrorBoundary,\n withErrorBoundary,\n createReduxEnhancer,\n Profiler,\n useProfiler,\n withProfiler,\n} from '@sentry/react';\n\nexport {\n logger,\n consoleLoggingIntegration,\n featureFlagsIntegration,\n type FeatureFlagsIntegration,\n metrics,\n} from '@sentry/browser';\n\nexport * from './integrations/exports';\n\nexport { SDK_NAME, SDK_VERSION } from './version';\nexport type { ReactNativeOptions } from './options';\nexport { ReactNativeClient } from './client';\n\nexport { init, wrap, nativeCrash, flush, close, withScope, crashedLastRun } from './sdk';\nexport { TouchEventBoundary, withTouchEventBoundary } from './touchevents';\n\nexport {\n reactNativeTracingIntegration,\n getCurrentReactNativeTracingIntegration,\n getReactNativeTracingIntegration,\n reactNavigationIntegration,\n reactNativeNavigationIntegration,\n sentryTraceGesture,\n TimeToInitialDisplay,\n TimeToFullDisplay,\n startTimeToInitialDisplaySpan,\n startTimeToFullDisplaySpan,\n startIdleNavigationSpan,\n startIdleSpan,\n getDefaultIdleNavigationSpanOptions,\n createTimeToFullDisplay,\n createTimeToInitialDisplay,\n} from './tracing';\n\nexport type { TimeToDisplayProps } from './tracing';\n\nexport { Mask, Unmask } from './replay/CustomMask';\n\nexport { FeedbackButton } from './feedback/FeedbackButton';\nexport { FeedbackWidget } from './feedback/FeedbackWidget';\nexport { showFeedbackWidget, showFeedbackButton, hideFeedbackButton } from './feedback/FeedbackWidgetManager';\n\nexport { getDataFromUri } from './wrapper';\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"expocontext.d.ts","sourceRoot":"","sources":["../../../src/js/integrations/expocontext.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"expocontext.d.ts","sourceRoot":"","sources":["../../../src/js/integrations/expocontext.ts"],"names":[],"mappings":"AAAA,OAAO,EAAyC,KAAK,WAAW,EAAkB,MAAM,cAAc,CAAC;AAQvG,eAAO,MAAM,uBAAuB,gBAAgB,CAAC;AAErD,6CAA6C;AAC7C,eAAO,MAAM,sBAAsB,QAAO,WA0DzC,CAAC;AAEF;;GAEG;AACH,wBAAgB,qBAAqB,IAAI,kBAAkB,CAqC1D;AAwDD,KAAK,kBAAkB,GAAG,OAAO,CAAC;IAChC,UAAU,EAAE,OAAO,CAAC;IACpB,kBAAkB,EAAE,OAAO,CAAC;IAC5B,mBAAmB,EAAE,OAAO,CAAC;IAC7B,wBAAwB,EAAE,OAAO,CAAC;IAClC,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,eAAe,EAAE,MAAM,CAAC;IACxB,mBAAmB,EAAE,MAAM,CAAC;IAC5B,uBAAuB,EAAE,MAAM,CAAC;IAChC,eAAe,EAAE,MAAM,CAAC;IACxB,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"expocontext.js","sourceRoot":"","sources":["../../../src/js/integrations/expocontext.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"expocontext.js","sourceRoot":"","sources":["../../../src/js/integrations/expocontext.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAoE,MAAM,cAAc,CAAC;AAEvG,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACrE,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAEpC,MAAM,gBAAgB,GAAG,aAAa,CAAC;AAEvC,MAAM,CAAC,MAAM,uBAAuB,GAAG,aAAa,CAAC;AAErD,6CAA6C;AAC7C,MAAM,CAAC,MAAM,sBAAsB,GAAG,GAAgB,EAAE;IACtD,IAAI,yBAAyD,CAAC;IAE9D,SAAS,KAAK,CAAC,MAAyB;QACtC,MAAM,CAAC,EAAE,CAAC,WAAW,EAAE,GAAG,EAAE;YAC1B,IAAI,CAAC,MAAM,CAAC,UAAU,EAAE,CAAC,YAAY,EAAE;gBACrC,OAAO;aACR;YAED,2BAA2B,EAAE,CAAC;QAChC,CAAC,CAAC,CAAC;IACL,CAAC;IAED,SAAS,2BAA2B;QAClC,IAAI,CAAC,MAAM,EAAE,IAAI,QAAQ,EAAE,EAAE;YAC3B,OAAO;SACR;QAED,MAAM,WAAW,GAAG,2BAA2B,EAAE,CAAC;QAElD,IAAI;YACF,uEAAuE;YACvE,MAAM,CAAC,UAAU,CAAC,uBAAuB,EAAE,WAAW,CAAC,CAAC;SACzD;QAAC,OAAO,KAAK,EAAE;YACd,KAAK,CAAC,KAAK,CAAC,qCAAqC,EAAE,KAAK,CAAC,CAAC;SAC3D;IACH,CAAC;IAED,SAAS,YAAY,CAAC,KAAY;QAChC,IA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aAAa,EAAE;QACjB,KAAK,CAAC,QAAQ,GAAG,KAAK,CAAC,QAAQ,IAAI,EAAE,CAAC;QACtC,KAAK,CAAC,QAAQ,CAAC,EAAE,mCAAQ,aAAa,GAAK,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAE,CAAC;KAChE;AACH,CAAC;AAED;;GAEG;AACH,SAAS,oBAAoB;IAC3B,MAAM,UAAU,GAAG,aAAa,EAAE,CAAC;IAEnC,IAAI,CAAC,UAAU,EAAE;QACf,OAAO,SAAS,CAAC;KAClB;IAED,OAAO;QACL,IAAI,EAAE,UAAU,CAAC,UAAU;QAC3B,SAAS,EAAE,CAAC,CAAA,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,QAAQ,CAAA;QAChC,KAAK,EAAE,UAAU,CAAC,SAAS;QAC3B,YAAY,EAAE,UAAU,CAAC,YAAY;QACrC,WAAW,EAAE,UAAU,CAAC,WAAW;KACpC,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,SAAS,gBAAgB;IACvB,MAAM,UAAU,GAAG,aAAa,EAAE,CAAC;IAEnC,IAAI,CAAC,UAAU,EAAE;QACf,OAAO,SAAS,CAAC;KAClB;IAED,OAAO;QACL,KAAK,EAAE,UAAU,CAAC,SAAS;QAC3B,OAAO,EAAE,UAAU,CAAC,SAAS;QAC7B,IAAI,EAAE,UAAU,CAAC,MAAM;KACxB,CAAC;AACJ,CAAC","sourcesContent":["import { debug, type DeviceContext, type Event, type Integration, type OsContext } from '@sentry/core';\nimport type { ReactNativeClient } from '../client';\nimport { isExpo, isExpoGo } from '../utils/environment';\nimport { getExpoDevice, getExpoUpdates } from '../utils/expomodules';\nimport { NATIVE } from '../wrapper';\n\nconst INTEGRATION_NAME = 'ExpoContext';\n\nexport const OTA_UPDATES_CONTEXT_KEY = 'ota_updates';\n\n/** Load device context from expo modules. */\nexport const expoContextIntegration = (): Integration => {\n let _expoUpdatesContextCached: ExpoUpdatesContext | undefined;\n\n function setup(client: ReactNativeClient): void {\n client.on('afterInit', () => {\n if (!client.getOptions().enableNative) {\n return;\n }\n\n setExpoUpdatesNativeContext();\n });\n }\n\n function setExpoUpdatesNativeContext(): void {\n if (!isExpo() || isExpoGo()) {\n return;\n }\n\n const expoUpdates = getExpoUpdatesContextCached();\n\n try {\n // Ensures native errors and crashes have the same context as JS errors\n NATIVE.setContext(OTA_UPDATES_CONTEXT_KEY, expoUpdates);\n } catch (error) {\n debug.error('Error setting Expo updates context:', error);\n }\n }\n\n function processEvent(event: Event): Event {\n if (!isExpo()) {\n return event;\n }\n\n addExpoGoContext(event);\n addExpoUpdatesContext(event);\n return event;\n }\n\n function addExpoUpdatesContext(event: Event): void {\n event.contexts = event.contexts || {};\n event.contexts[OTA_UPDATES_CONTEXT_KEY] = {\n ...getExpoUpdatesContextCached(),\n };\n }\n\n function getExpoUpdatesContextCached(): ExpoUpdatesContext {\n if (_expoUpdatesContextCached) {\n return _expoUpdatesContextCached;\n }\n\n return (_expoUpdatesContextCached = getExpoUpdatesContext());\n }\n\n return {\n name: INTEGRATION_NAME,\n setup,\n processEvent,\n };\n};\n\n/**\n * @internal Exposed for testing purposes\n */\nexport function getExpoUpdatesContext(): ExpoUpdatesContext {\n const expoUpdates = getExpoUpdates();\n if (!expoUpdates) {\n return {\n is_enabled: false,\n };\n }\n\n const updatesContext: ExpoUpdatesContext = {\n is_enabled: !!expoUpdates.isEnabled,\n is_embedded_launch: !!expoUpdates.isEmbeddedLaunch,\n is_emergency_launch: !!expoUpdates.isEmergencyLaunch,\n is_using_embedded_assets: !!expoUpdates.isUsingEmbeddedAssets,\n };\n\n if (typeof expoUpdates.updateId === 'string' && expoUpdates.updateId) {\n updatesContext.update_id = expoUpdates.updateId.toLowerCase();\n }\n if (typeof expoUpdates.channel === 'string' && expoUpdates.channel) {\n updatesContext.channel = expoUpdates.channel.toLowerCase();\n }\n if (typeof expoUpdates.runtimeVersion === 'string' && expoUpdates.runtimeVersion) {\n updatesContext.runtime_version = expoUpdates.runtimeVersion.toLowerCase();\n }\n if (typeof expoUpdates.checkAutomatically === 'string' && expoUpdates.checkAutomatically) {\n updatesContext.check_automatically = expoUpdates.checkAutomatically.toLowerCase();\n }\n if (typeof expoUpdates.emergencyLaunchReason === 'string' && expoUpdates.emergencyLaunchReason) {\n updatesContext.emergency_launch_reason = expoUpdates.emergencyLaunchReason;\n }\n if (typeof expoUpdates.launchDuration === 'number') {\n updatesContext.launch_duration = expoUpdates.launchDuration;\n }\n if (expoUpdates.createdAt instanceof Date) {\n updatesContext.created_at = expoUpdates.createdAt.toISOString();\n }\n return updatesContext;\n}\n\nfunction addExpoGoContext(event: Event): void {\n if (!isExpoGo()) {\n return;\n }\n\n const expoDeviceContext = getExpoDeviceContext();\n if (expoDeviceContext) {\n event.contexts = event.contexts || {};\n event.contexts.device = { ...expoDeviceContext, ...event.contexts.device };\n }\n\n const expoOsContext = getExpoOsContext();\n if (expoOsContext) {\n event.contexts = event.contexts || {};\n event.contexts.os = { ...expoOsContext, ...event.contexts.os };\n }\n}\n\n/**\n * Returns the Expo Device context if present\n */\nfunction getExpoDeviceContext(): DeviceContext | undefined {\n const expoDevice = getExpoDevice();\n\n if (!expoDevice) {\n return undefined;\n }\n\n return {\n name: expoDevice.deviceName,\n simulator: !expoDevice?.isDevice,\n model: expoDevice.modelName,\n manufacturer: expoDevice.manufacturer,\n memory_size: expoDevice.totalMemory,\n };\n}\n\n/**\n * Returns the Expo OS context if present\n */\nfunction getExpoOsContext(): OsContext | undefined {\n const expoDevice = getExpoDevice();\n\n if (!expoDevice) {\n return undefined;\n }\n\n return {\n build: expoDevice.osBuildId,\n version: expoDevice.osVersion,\n name: expoDevice.osName,\n };\n}\n\ntype ExpoUpdatesContext = Partial<{\n is_enabled: boolean;\n is_embedded_launch: boolean;\n is_emergency_launch: boolean;\n is_using_embedded_assets: boolean;\n update_id: string;\n channel: string;\n runtime_version: string;\n check_automatically: string;\n emergency_launch_reason: string;\n launch_duration: number;\n created_at: string;\n}>;\n"]}
|
|
@@ -63,9 +63,10 @@ function walkErrorTree(parser, limit, error, key, exceptions = [], debugImages =
|
|
|
63
63
|
exception = exceptionFromError(parser, error[key]);
|
|
64
64
|
}
|
|
65
65
|
else if (isPlainObject(linkedError)) {
|
|
66
|
+
const plainError = linkedError;
|
|
66
67
|
exception = {
|
|
67
|
-
type: typeof
|
|
68
|
-
value: typeof
|
|
68
|
+
type: typeof plainError.name === 'string' ? plainError.name : undefined,
|
|
69
|
+
value: typeof plainError.message === 'string' ? plainError.message : undefined,
|
|
69
70
|
};
|
|
70
71
|
}
|
|
71
72
|
else {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nativelinkederrors.js","sourceRoot":"","sources":["../../../src/js/integrations/nativelinkederrors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAYrD,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAErE,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAEpC,MAAM,gBAAgB,GAAG,oBAAoB,CAAC;AAE9C,MAAM,WAAW,GAAG,OAAO,CAAC;AAC5B,MAAM,aAAa,GAAG,CAAC,CAAC;AAOxB;;GAEG;AACH,MAAM,CAAC,MAAM,6BAA6B,GAAG,CAAC,UAAwC,EAAE,EAAe,EAAE;IACvG,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,IAAI,WAAW,CAAC;IACvC,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,IAAI,aAAa,CAAC;IAE7C,OAAO;QACL,IAAI,EAAE,gBAAgB;QACtB,SAAS,EAAE,GAAS,EAAE;YACpB,OAAO;QACT,CAAC;QACD,eAAe,EAAE,CAAC,KAAY,EAAE,IAAe,EAAE,MAAc,EAAQ,EAAE,CACvE,eAAe,CAAC,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,CAAC;KACnD,CAAC;AACJ,CAAC,CAA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AE,CAAC,iBAAiB,aAAjB,iBAAiB,uBAAjB,iBAAiB,CAAE,eAAgC,KAAI,EAAE;KAC7E,CAAC;AACJ,CAAC;AAED,IAAI,aAAa,GAAkB,IAAI,CAAC;AACxC;;GAEG;AACH,SAAS,kBAAkB;IACzB,IAAI,aAAa,KAAK,IAAI,EAAE;QAC1B,aAAa,GAAG,MAAM,CAAC,sBAAsB,EAAE,CAAC;KACjD;IACD,OAAO,aAAa,CAAC;AACvB,CAAC;AAED;;GAEG;AACH,SAAS,sBAAsB,CAAC,gBAA0B;IACxD,OAAO,MAAM,CAAC,wBAAwB,CAAC,gBAAgB,CAAC,CAAC;AAC3D,CAAC","sourcesContent":["import { exceptionFromError } from '@sentry/browser';\nimport type {\n Client,\n DebugImage,\n Event,\n EventHint,\n Exception,\n ExtendedError,\n Integration,\n StackFrame,\n StackParser,\n} from '@sentry/core';\nimport { isInstanceOf, isPlainObject, isString } from '@sentry/core';\nimport type { NativeStackFrames } from '../NativeRNSentry';\nimport { NATIVE } from '../wrapper';\n\nconst INTEGRATION_NAME = 'NativeLinkedErrors';\n\nconst DEFAULT_KEY = 'cause';\nconst DEFAULT_LIMIT = 5;\n\ninterface LinkedErrorsOptions {\n key: string;\n limit: number;\n}\n\n/**\n * Processes JS and RN native linked errors.\n */\nexport const nativeLinkedErrorsIntegration = (options: Partial<LinkedErrorsOptions> = {}): Integration => {\n const key = options.key || DEFAULT_KEY;\n const limit = options.limit || DEFAULT_LIMIT;\n\n return {\n name: INTEGRATION_NAME,\n setupOnce: (): void => {\n // noop\n },\n preprocessEvent: (event: Event, hint: EventHint, client: Client): void =>\n preprocessEvent(event, hint, client, limit, key),\n };\n};\n\nfunction preprocessEvent(event: Event, hint: EventHint | undefined, client: Client, limit: number, key: string): void {\n if (!event.exception?.values || !hint || !isInstanceOf(hint.originalException, Error)) {\n return;\n }\n\n const parser = client.getOptions().stackParser;\n\n const { exceptions: linkedErrors, debugImages } = walkErrorTree(\n parser,\n limit,\n hint.originalException as ExtendedError,\n key,\n );\n event.exception.values = [...event.exception.values, ...linkedErrors];\n\n event.debug_meta = event.debug_meta || {};\n event.debug_meta.images = event.debug_meta.images || [];\n event.debug_meta.images.push(...(debugImages || []));\n}\n\n/**\n * Walks linked errors and created Sentry exceptions chain.\n * Collects debug images from native errors stack frames.\n */\nfunction walkErrorTree(\n parser: StackParser,\n limit: number,\n error: ExtendedError,\n key: string,\n exceptions: Exception[] = [],\n debugImages: DebugImage[] = [],\n): {\n exceptions: Exception[];\n debugImages?: DebugImage[];\n} {\n const linkedError = error[key];\n if (!linkedError || exceptions.length + 1 >= limit) {\n return {\n exceptions,\n debugImages,\n };\n }\n\n let exception: Exception;\n let exceptionDebugImages: DebugImage[] | undefined;\n if (isString(linkedError)) {\n exception = {\n value: linkedError,\n };\n } else if ('stackElements' in linkedError) {\n // isJavaException\n exception = exceptionFromJavaStackElements(linkedError);\n } else if ('stackReturnAddresses' in linkedError) {\n // isObjCException\n const { appleException, appleDebugImages } = exceptionFromAppleStackReturnAddresses(linkedError);\n exception = appleException;\n exceptionDebugImages = appleDebugImages;\n } else if (isInstanceOf(linkedError, Error)) {\n exception = exceptionFromError(parser, error[key]);\n } else if (isPlainObject(linkedError)) {\n const plainError = linkedError as Record<string, unknown>;\n exception = {\n type: typeof plainError.name === 'string' ? plainError.name : undefined,\n value: typeof plainError.message === 'string' ? plainError.message : undefined,\n };\n } else {\n return {\n exceptions,\n debugImages,\n };\n }\n\n return walkErrorTree(\n parser,\n limit,\n linkedError,\n key,\n [...exceptions, exception],\n [...debugImages, ...(exceptionDebugImages || [])],\n );\n}\n\n/**\n * Converts a Java Throwable to an SentryException\n */\nfunction exceptionFromJavaStackElements(javaThrowable: {\n name: string;\n message: string;\n stackElements: {\n className: string;\n fileName: string;\n methodName: string;\n lineNumber: number;\n }[];\n}): Exception {\n const nativePackage = fetchNativePackage();\n return {\n type: javaThrowable.name,\n value: javaThrowable.message,\n stacktrace: {\n frames: javaThrowable.stackElements\n .map(\n stackElement =>\n <StackFrame>{\n platform: 'java',\n module: stackElement.className,\n filename: stackElement.fileName,\n lineno: stackElement.lineNumber >= 0 ? stackElement.lineNumber : undefined,\n function: stackElement.methodName,\n in_app: nativePackage !== null && stackElement.className.startsWith(nativePackage) ? true : undefined,\n },\n )\n .reverse(),\n },\n };\n}\n\n/**\n * Converts StackAddresses to a SentryException with DebugMetaImages\n */\nfunction exceptionFromAppleStackReturnAddresses(objCException: {\n name: string;\n message: string;\n stackReturnAddresses: number[];\n}): {\n appleException: Exception;\n appleDebugImages: DebugImage[];\n} {\n const nativeStackFrames = fetchNativeStackFrames(objCException.stackReturnAddresses);\n\n return {\n appleException: {\n type: objCException.name,\n value: objCException.message,\n stacktrace: {\n frames: nativeStackFrames?.frames.reverse() || [],\n },\n },\n appleDebugImages: (nativeStackFrames?.debugMetaImages as DebugImage[]) || [],\n };\n}\n\nlet nativePackage: string | null = null;\n/**\n * Fetches the native package/image name from the native layer\n */\nfunction fetchNativePackage(): string | null {\n if (nativePackage === null) {\n nativePackage = NATIVE.fetchNativePackageName();\n }\n return nativePackage;\n}\n\n/**\n * Fetches native debug image information on iOS\n */\nfunction fetchNativeStackFrames(instructionsAddr: number[]): NativeStackFrames | null {\n return NATIVE.fetchNativeStackFramesBy(instructionsAddr);\n}\n"]}
|