@sentry/react-native 3.4.2 → 4.0.0-beta.2

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.
Files changed (53) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/README.md +7 -3
  3. package/android/build.gradle +1 -1
  4. package/dist/js/client.d.ts +22 -5
  5. package/dist/js/client.d.ts.map +1 -1
  6. package/dist/js/client.js +69 -4
  7. package/dist/js/client.js.map +1 -1
  8. package/dist/js/index.d.ts +1 -2
  9. package/dist/js/index.d.ts.map +1 -1
  10. package/dist/js/index.js +0 -2
  11. package/dist/js/index.js.map +1 -1
  12. package/dist/js/integrations/reactnativeerrorhandlers.d.ts.map +1 -1
  13. package/dist/js/integrations/reactnativeerrorhandlers.js +4 -6
  14. package/dist/js/integrations/reactnativeerrorhandlers.js.map +1 -1
  15. package/dist/js/options.d.ts +19 -13
  16. package/dist/js/options.d.ts.map +1 -1
  17. package/dist/js/options.js.map +1 -1
  18. package/dist/js/sdk.d.ts.map +1 -1
  19. package/dist/js/sdk.js +13 -12
  20. package/dist/js/sdk.js.map +1 -1
  21. package/dist/js/touchevents.d.ts +1 -1
  22. package/dist/js/touchevents.d.ts.map +1 -1
  23. package/dist/js/touchevents.js +3 -3
  24. package/dist/js/touchevents.js.map +1 -1
  25. package/dist/js/tracing/nativeframes.d.ts.map +1 -1
  26. package/dist/js/tracing/nativeframes.js +3 -0
  27. package/dist/js/tracing/nativeframes.js.map +1 -1
  28. package/dist/js/tracing/reactnativetracing.d.ts.map +1 -1
  29. package/dist/js/tracing/reactnativetracing.js +7 -15
  30. package/dist/js/tracing/reactnativetracing.js.map +1 -1
  31. package/dist/js/tracing/stalltracking.d.ts +6 -3
  32. package/dist/js/tracing/stalltracking.d.ts.map +1 -1
  33. package/dist/js/tracing/stalltracking.js +8 -15
  34. package/dist/js/tracing/stalltracking.js.map +1 -1
  35. package/dist/js/tracing/utils.d.ts.map +1 -1
  36. package/dist/js/transports/native.d.ts +18 -6
  37. package/dist/js/transports/native.d.ts.map +1 -1
  38. package/dist/js/transports/native.js +16 -5
  39. package/dist/js/transports/native.js.map +1 -1
  40. package/dist/js/version.d.ts +1 -1
  41. package/dist/js/version.d.ts.map +1 -1
  42. package/dist/js/version.js +1 -1
  43. package/dist/js/version.js.map +1 -1
  44. package/dist/js/wrapper.d.ts +4 -3
  45. package/dist/js/wrapper.d.ts.map +1 -1
  46. package/dist/js/wrapper.js +70 -71
  47. package/dist/js/wrapper.js.map +1 -1
  48. package/ios/RNSentry.m +16 -4
  49. package/package.json +13 -13
  50. package/dist/js/backend.d.ts +0 -37
  51. package/dist/js/backend.d.ts.map +0 -1
  52. package/dist/js/backend.js +0 -92
  53. package/dist/js/backend.js.map +0 -1
@@ -1,3 +1,3 @@
1
1
  export const SDK_NAME = 'sentry.javascript.react-native';
2
- export const SDK_VERSION = '3.4.2';
2
+ export const SDK_VERSION = '4.0.0-beta.2';
3
3
  //# sourceMappingURL=version.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/js/version.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,QAAQ,GAAG,gCAAgC,CAAC;AACzD,MAAM,CAAC,MAAM,WAAW,GAAG,OAAO,CAAC","sourcesContent":["export const SDK_NAME = 'sentry.javascript.react-native';\nexport const SDK_VERSION = '3.4.2';\n"]}
1
+ {"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/js/version.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,QAAQ,GAAG,gCAAgC,CAAC;AACzD,MAAM,CAAC,MAAM,WAAW,GAAG,cAAc,CAAC","sourcesContent":["export const SDK_NAME = 'sentry.javascript.react-native';\nexport const SDK_VERSION = '4.0.0-beta.2';\n"]}
@@ -1,4 +1,4 @@
1
- import { Breadcrumb, Event, Package, Response, Severity, User } from '@sentry/types';
1
+ import { AttachmentItem, Breadcrumb, ClientReportItem, Envelope, Event, EventItem, Package, SessionItem, SeverityLevel, User, UserFeedbackItem } from '@sentry/types';
2
2
  import { Platform } from 'react-native';
3
3
  import { NativeAppStartResponse, NativeDeviceContextsResponse, NativeFramesResponse, NativeReleaseResponse, SentryNativeBridgeModule } from './definitions';
4
4
  import { ReactNativeOptions } from './options';
@@ -8,8 +8,9 @@ interface SentryNativeWrapper {
8
8
  platform: typeof Platform.OS;
9
9
  _NativeClientError: Error;
10
10
  _DisabledNativeError: Error;
11
+ _getEvent(envelopeItem: EventItem | AttachmentItem | UserFeedbackItem | SessionItem | ClientReportItem): Event | undefined;
11
12
  _processLevels(event: Event): Event;
12
- _processLevel(level: Severity): Severity;
13
+ _processLevel(level: SeverityLevel): SeverityLevel;
13
14
  _serializeObject(data: {
14
15
  [key: string]: unknown;
15
16
  }): {
@@ -19,7 +20,7 @@ interface SentryNativeWrapper {
19
20
  isNativeTransportAvailable(): boolean;
20
21
  initNativeSdk(options: ReactNativeOptions): PromiseLike<boolean>;
21
22
  closeNativeSdk(): PromiseLike<void>;
22
- sendEvent(event: Event): PromiseLike<Response>;
23
+ sendEnvelope(envelope: Envelope): Promise<void>;
23
24
  fetchNativeRelease(): PromiseLike<NativeReleaseResponse>;
24
25
  fetchNativeDeviceContexts(): PromiseLike<NativeDeviceContextsResponse>;
25
26
  fetchNativeAppStart(): PromiseLike<NativeAppStartResponse | null>;
@@ -1 +1 @@
1
- {"version":3,"file":"wrapper.d.ts","sourceRoot":"","sources":["../../src/js/wrapper.ts"],"names":[],"mappings":"AACA,OAAO,EACL,UAAU,EACV,KAAK,EACL,OAAO,EACP,QAAQ,EACR,QAAQ,EACR,IAAI,EACL,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAiB,QAAQ,EAAE,MAAM,cAAc,CAAC;AAEvD,OAAO,EACL,sBAAsB,EACtB,4BAA4B,EAC5B,oBAAoB,EACpB,qBAAqB,EACrB,wBAAwB,EACzB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAI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G,IAAI,GAAG,IAAI,CAAC;IACjC,MAAM,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAEzC,WAAW,IAAI,IAAI,CAAC;CACrB;AAED;;GAEG;AACH,eAAO,MAAM,MAAM,EAAE,mBA4dpB,CAAC"}
@@ -1,6 +1,4 @@
1
1
  import { __awaiter, __rest } from "tslib";
2
- /* eslint-disable max-lines */
3
- import { Severity, } from '@sentry/types';
4
2
  import { logger, SentryError } from '@sentry/utils';
5
3
  import { NativeModules, Platform } from 'react-native';
6
4
  const RNSentry = NativeModules.RNSentry;
@@ -9,85 +7,75 @@ const RNSentry = NativeModules.RNSentry;
9
7
  */
10
8
  export const NATIVE = {
11
9
  /**
12
- * Sending the event over the bridge to native
13
- * @param event Event
10
+ * Sending the envelope over the bridge to native
11
+ * @param envelope Envelope
14
12
  */
15
- sendEvent(_event) {
16
- var _a, _b, _c, _d, _e;
13
+ sendEnvelope(envelope) {
14
+ var _a, _b, _c, _d;
17
15
  return __awaiter(this, void 0, void 0, function* () {
18
16
  if (!this.enableNative) {
19
- return {
20
- reason: 'Event was skipped as native SDK is not enabled.',
21
- status: 'skipped',
22
- };
17
+ logger.warn('Event was skipped as native SDK is not enabled.');
18
+ return;
23
19
  }
24
20
  if (!this._isModuleLoaded(RNSentry)) {
25
21
  throw this._NativeClientError;
26
22
  }
27
- const event = this._processLevels(_event);
28
- // Delete this metadata as this should not be sent to Sentry.
29
- delete event.sdkProcessingMetadata;
30
- const header = {
31
- event_id: event.event_id,
32
- sdk: event.sdk,
33
- };
34
- let envelopeWasSent = false;
23
+ const header = envelope[0];
35
24
  if (NATIVE.platform === 'android') {
36
25
  // Android
37
26
  const headerString = JSON.stringify(header);
38
- /*
39
- We do this to avoid duplicate breadcrumbs on Android as sentry-android applies the breadcrumbs
40
- from the native scope onto every envelope sent through it. This scope will contain the breadcrumbs
41
- sent through the scope sync feature. This causes duplicate breadcrumbs.
42
- We then remove the breadcrumbs in all cases but if it is handled == false,
43
- this is a signal that the app would crash and android would lose the breadcrumbs by the time the app is restarted to read
44
- the envelope.
45
- */
46
- if (((_d = (_c = (_b = (_a = event.exception) === null || _a === void 0 ? void 0 : _a.values) === null || _b === void 0 ? void 0 : _b[0]) === null || _c === void 0 ? void 0 : _c.mechanism) === null || _d === void 0 ? void 0 : _d.handled) != false && event.breadcrumbs) {
47
- event.breadcrumbs = [];
48
- }
49
- const payload = Object.assign(Object.assign({}, event), { message: {
50
- message: event.message,
51
- } });
52
- const payloadString = JSON.stringify(payload);
53
- let length = payloadString.length;
54
- try {
55
- length = yield RNSentry.getStringBytesLength(payloadString);
56
- }
57
- catch (_f) {
58
- // The native call failed, we do nothing, we have payload.length as a fallback
27
+ let envelopeItemsBuilder = `${headerString}`;
28
+ for (const envelopeItems of envelope[1]) {
29
+ const event = this._getEvent(envelopeItems);
30
+ if (event != undefined) {
31
+ // @ts-ignore Android still uses the old message object, without this the serialization of events will break.
32
+ event.message = { message: event.message };
33
+ /*
34
+ We do this to avoid duplicate breadcrumbs on Android as sentry-android applies the breadcrumbs
35
+ from the native scope onto every envelope sent through it. This scope will contain the breadcrumbs
36
+ sent through the scope sync feature. This causes duplicate breadcrumbs.
37
+ We then remove the breadcrumbs in all cases but if it is handled == false,
38
+ this is a signal that the app would crash and android would lose the breadcrumbs by the time the app is restarted to read
39
+ the envelope.
40
+ */
41
+ if (((_d = (_c = (_b = (_a = event.exception) === null || _a === void 0 ? void 0 : _a.values) === null || _b === void 0 ? void 0 : _b[0]) === null || _c === void 0 ? void 0 : _c.mechanism) === null || _d === void 0 ? void 0 : _d.handled) != false && event.breadcrumbs) {
42
+ event.breadcrumbs = [];
43
+ }
44
+ envelopeItems[1] = event;
45
+ }
46
+ // Content type is not inside BaseEnvelopeItemHeaders.
47
+ envelopeItems[0].content_type = 'application/json';
48
+ const itemPayload = JSON.stringify(envelopeItems[1]);
49
+ let length = itemPayload.length;
50
+ try {
51
+ length = yield RNSentry.getStringBytesLength(itemPayload);
52
+ }
53
+ catch (_e) {
54
+ // The native call failed, we do nothing, we have payload.length as a fallback
55
+ }
56
+ envelopeItems[0].length = length;
57
+ const itemHeader = JSON.stringify(envelopeItems[0]);
58
+ envelopeItemsBuilder += `\n${itemHeader}\n${itemPayload}`;
59
59
  }
60
- const item = {
61
- content_type: 'application/json',
62
- length,
63
- type: (_e = payload.type) !== null && _e !== void 0 ? _e : 'event',
64
- };
65
- const itemString = JSON.stringify(item);
66
- const envelopeString = `${headerString}\n${itemString}\n${payloadString}`;
67
- envelopeWasSent = yield RNSentry.captureEnvelope(envelopeString);
60
+ yield RNSentry.captureEnvelope(envelopeItemsBuilder);
68
61
  }
69
62
  else {
70
63
  // iOS/Mac
71
- const payload = Object.assign(Object.assign({}, event), { message: {
72
- message: event.message,
73
- } });
74
- // Serialize and remove any instances that will crash the native bridge such as Spans
75
- const serializedPayload = JSON.parse(JSON.stringify(payload));
76
- // The envelope item is created (and its length determined) on the iOS side of the native bridge.
77
- // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
78
- envelopeWasSent = yield RNSentry.captureEnvelope({
79
- header,
80
- payload: serializedPayload,
81
- });
82
- }
83
- if (envelopeWasSent) {
84
- return {
85
- status: 'success',
86
- };
64
+ for (const envelopeItems of envelope[1]) {
65
+ const event = this._getEvent(envelopeItems);
66
+ if (event != undefined) {
67
+ envelopeItems[1] = event;
68
+ }
69
+ const itemPayload = JSON.parse(JSON.stringify(envelopeItems[1]));
70
+ // The envelope item is created (and its length determined) on the iOS side of the native bridge.
71
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
72
+ yield RNSentry.captureEnvelope({
73
+ header,
74
+ payload: itemPayload,
75
+ });
76
+ }
87
77
  }
88
- return {
89
- status: 'failed',
90
- };
78
+ ;
91
79
  });
92
80
  },
93
81
  /**
@@ -119,7 +107,7 @@ export const NATIVE = {
119
107
  }
120
108
  // filter out all the options that would crash native.
121
109
  /* eslint-disable @typescript-eslint/unbound-method,@typescript-eslint/no-unused-vars */
122
- const { beforeSend, beforeBreadcrumb, integrations, defaultIntegrations, transport } = options, filteredOptions = __rest(options, ["beforeSend", "beforeBreadcrumb", "integrations", "defaultIntegrations", "transport"]);
110
+ const { beforeSend, beforeBreadcrumb, integrations } = options, filteredOptions = __rest(options, ["beforeSend", "beforeBreadcrumb", "integrations"]);
123
111
  /* eslint-enable @typescript-eslint/unbound-method,@typescript-eslint/no-unused-vars */
124
112
  const nativeIsReady = yield RNSentry.initNativeSdk(filteredOptions);
125
113
  this.nativeIsReady = nativeIsReady;
@@ -342,6 +330,17 @@ export const NATIVE = {
342
330
  isNativeTransportAvailable() {
343
331
  return this.enableNative && this._isModuleLoaded(RNSentry);
344
332
  },
333
+ /**
334
+ * Gets the event from envelopeItem and applies the level filter to the selected event.
335
+ * @param data An envelope item containing the event.
336
+ * @returns The event from envelopeItem or undefined.
337
+ */
338
+ _getEvent(envelopeItem) {
339
+ if (envelopeItem[0].type == 'event' || envelopeItem[0].type == 'transaction') {
340
+ return this._processLevels(envelopeItem[1]);
341
+ }
342
+ return undefined;
343
+ },
345
344
  /**
346
345
  * Serializes all values of root-level keys into strings.
347
346
  * @param data key-value map.
@@ -374,11 +373,11 @@ export const NATIVE = {
374
373
  * @returns More widely supported Severity level strings
375
374
  */
376
375
  _processLevel(level) {
377
- if (level === Severity.Critical) {
378
- return Severity.Fatal;
376
+ if (level == 'log') {
377
+ return 'debug';
379
378
  }
380
- if (level === Severity.Log) {
381
- return Severity.Debug;
379
+ else if (level == 'critical') {
380
+ return 'fatal';
382
381
  }
383
382
  return level;
384
383
  },
@@ -1 +1 @@
1
- {"version":3,"file":"wrapper.js","sourceRoot":"","sources":["../../src/js/wrapper.ts"],"names":[],"mappings":";AAAA,8BAA8B;AAC9B,OAAO,EAKL,QAAQ,GAET,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,QAAQ,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,EAAE,QAAQ,CAAC,EAAE;CACtB,CAAC","sourcesContent":["/* eslint-disable max-lines */\nimport {\n Breadcrumb,\n Event,\n Package,\n Response,\n Severity,\n User,\n} from '@sentry/types';\nimport { logger, SentryError } from '@sentry/utils';\nimport { NativeModules, Platform } from 'react-native';\n\nimport {\n NativeAppStartResponse,\n NativeDeviceContextsResponse,\n NativeFramesResponse,\n NativeReleaseResponse,\n SentryNativeBridgeModule,\n} from './definitions';\nimport { ReactNativeOptions } from './options';\n\nconst RNSentry = NativeModules.RNSentry as SentryNativeBridgeModule | undefined;\n\ninterface SentryNativeWrapper {\n enableNative: boolean;\n nativeIsReady: boolean;\n platform: typeof Platform.OS;\n\n _NativeClientError: Error;\n _DisabledNativeError: Error;\n\n _processLevels(event: Event): Event;\n _processLevel(level: Severity): Severity;\n _serializeObject(data: { [key: string]: unknown }): { [key: string]: string };\n _isModuleLoaded(\n module: SentryNativeBridgeModule | undefined\n ): module is SentryNativeBridgeModule;\n\n isNativeTransportAvailable(): boolean;\n\n initNativeSdk(options: ReactNativeOptions): PromiseLike<boolean>;\n closeNativeSdk(): PromiseLike<void>;\n\n sendEvent(event: Event): PromiseLike<Response>;\n\n fetchNativeRelease(): PromiseLike<NativeReleaseResponse>;\n fetchNativeDeviceContexts(): PromiseLike<NativeDeviceContextsResponse>;\n fetchNativeAppStart(): PromiseLike<NativeAppStartResponse | null>;\n fetchNativeFrames(): PromiseLike<NativeFramesResponse | null>;\n fetchNativeSdkInfo(): PromiseLike<Package | null>;\n\n disableNativeFramesTracking(): void;\n\n addBreadcrumb(breadcrumb: Breadcrumb): void;\n setContext(key: string, context: { [key: string]: unknown } | null): void;\n clearBreadcrumbs(): void;\n setExtra(key: string, extra: unknown): void;\n setUser(user: User | null): void;\n setTag(key: string, value: string): void;\n\n nativeCrash(): void;\n}\n\n/**\n * Our internal interface for calling native functions\n */\nexport const NATIVE: SentryNativeWrapper = {\n /**\n * Sending the event over the bridge to native\n * @param event Event\n */\n async sendEvent(_event: Event): Promise<Response> {\n if (!this.enableNative) {\n return {\n reason: 'Event was skipped as native SDK is not enabled.',\n status: 'skipped',\n };\n }\n\n if (!this._isModuleLoaded(RNSentry)) {\n throw this._NativeClientError;\n }\n\n const event = this._processLevels(_event);\n\n // Delete this metadata as this should not be sent to Sentry.\n delete event.sdkProcessingMetadata;\n\n const header = {\n event_id: event.event_id,\n sdk: event.sdk,\n };\n\n let envelopeWasSent = false;\n if (NATIVE.platform === 'android') {\n // Android\n\n const headerString = JSON.stringify(header);\n\n /*\n We do this to avoid duplicate breadcrumbs on Android as sentry-android applies the breadcrumbs\n from the native scope onto every envelope sent through it. This scope will contain the breadcrumbs\n sent through the scope sync feature. This causes duplicate breadcrumbs.\n We then remove the breadcrumbs in all cases but if it is handled == false,\n this is a signal that the app would crash and android would lose the breadcrumbs by the time the app is restarted to read\n the envelope.\n */\n if (event.exception?.values?.[0]?.mechanism?.handled != false && event.breadcrumbs) {\n event.breadcrumbs = [];\n }\n\n const payload = {\n ...event,\n message: {\n message: event.message,\n },\n };\n\n const payloadString = JSON.stringify(payload);\n let length = payloadString.length;\n try {\n length = await RNSentry.getStringBytesLength(payloadString);\n } catch {\n // The native call failed, we do nothing, we have payload.length as a fallback\n }\n\n const item = {\n content_type: 'application/json',\n length,\n type: payload.type ?? 'event',\n };\n\n const itemString = JSON.stringify(item);\n\n const envelopeString = `${headerString}\\n${itemString}\\n${payloadString}`;\n\n envelopeWasSent = await RNSentry.captureEnvelope(envelopeString);\n } else {\n // iOS/Mac\n\n const payload = {\n ...event,\n message: {\n message: event.message,\n },\n };\n\n // Serialize and remove any instances that will crash the native bridge such as Spans\n const serializedPayload = JSON.parse(JSON.stringify(payload));\n\n // The envelope item is created (and its length determined) on the iOS side of the native bridge.\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n envelopeWasSent = await RNSentry.captureEnvelope({\n header,\n payload: serializedPayload,\n });\n }\n\n if (envelopeWasSent) {\n return {\n status: 'success',\n };\n }\n\n return {\n status: 'failed',\n };\n },\n\n /**\n * Starts native with the provided options.\n * @param options ReactNativeOptions\n */\n async initNativeSdk(originalOptions: ReactNativeOptions): Promise<boolean> {\n const options = {\n enableNative: true,\n autoInitializeNativeSdk: true,\n ...originalOptions,\n };\n\n if (!options.enableNative) {\n if (options.enableNativeNagger) {\n logger.warn('Note: Native Sentry SDK is disabled.');\n }\n this.enableNative = false;\n return false;\n }\n if (!options.autoInitializeNativeSdk) {\n if (options.enableNativeNagger) {\n logger.warn(\n 'Note: Native Sentry SDK was not initialized automatically, you will need to initialize it manually. If you wish to disable the native SDK and get rid of this warning, pass enableNative: false'\n );\n }\n return false;\n }\n\n if (!options.dsn) {\n logger.warn(\n 'Warning: No DSN was provided. The Sentry SDK will be disabled. Native SDK will also not be initalized.'\n );\n return false;\n }\n\n if (!this._isModuleLoaded(RNSentry)) {\n throw this._NativeClientError;\n }\n\n // filter out all the options that would crash native.\n /* eslint-disable @typescript-eslint/unbound-method,@typescript-eslint/no-unused-vars */\n const {\n beforeSend,\n beforeBreadcrumb,\n integrations,\n defaultIntegrations,\n transport,\n ...filteredOptions\n } = options;\n /* eslint-enable @typescript-eslint/unbound-method,@typescript-eslint/no-unused-vars */\n\n const nativeIsReady = await RNSentry.initNativeSdk(filteredOptions);\n\n this.nativeIsReady = nativeIsReady;\n\n return nativeIsReady;\n },\n\n /**\n * Fetches the release from native\n */\n async fetchNativeRelease(): Promise<NativeReleaseResponse> {\n if (!this.enableNative) {\n throw this._DisabledNativeError;\n }\n if (!this._isModuleLoaded(RNSentry)) {\n throw this._NativeClientError;\n }\n\n return RNSentry.fetchNativeRelease();\n },\n\n /**\n * Fetches the Sdk info for the native sdk.\n * NOTE: Only available on iOS.\n */\n async fetchNativeSdkInfo(): Promise<Package | null> {\n if (!this.enableNative) {\n throw this._DisabledNativeError;\n }\n if (!this._isModuleLoaded(RNSentry)) {\n throw this._NativeClientError;\n }\n\n if (this.platform !== 'ios') {\n return null;\n }\n\n return RNSentry.fetchNativeSdkInfo();\n },\n\n /**\n * Fetches the device contexts. Not used on Android.\n */\n async fetchNativeDeviceContexts(): Promise<NativeDeviceContextsResponse> {\n if (!this.enableNative) {\n throw this._DisabledNativeError;\n }\n if (!this._isModuleLoaded(RNSentry)) {\n throw this._NativeClientError;\n }\n\n if (this.platform !== 'ios') {\n // Only ios uses deviceContexts, return an empty object.\n return {};\n }\n\n return RNSentry.fetchNativeDeviceContexts();\n },\n\n async fetchNativeAppStart(): Promise<NativeAppStartResponse | null> {\n if (!this.enableNative) {\n throw this._DisabledNativeError;\n }\n if (!this._isModuleLoaded(RNSentry)) {\n throw this._NativeClientError;\n }\n\n return RNSentry.fetchNativeAppStart();\n },\n\n async fetchNativeFrames(): Promise<NativeFramesResponse | null> {\n if (!this.enableNative) {\n throw this._DisabledNativeError;\n }\n if (!this._isModuleLoaded(RNSentry)) {\n throw this._NativeClientError;\n }\n\n return RNSentry.fetchNativeFrames();\n },\n\n /**\n * Triggers a native crash.\n * Use this only for testing purposes.\n */\n nativeCrash(): void {\n if (!this.enableNative) {\n return;\n }\n if (!this._isModuleLoaded(RNSentry)) {\n throw this._NativeClientError;\n }\n\n RNSentry.crash();\n },\n\n /**\n * Sets the user in the native scope.\n * Passing null clears the user.\n */\n setUser(user: User | null): void {\n if (!this.enableNative) {\n return;\n }\n if (!this._isModuleLoaded(RNSentry)) {\n throw this._NativeClientError;\n }\n\n // separate and serialze all non-default user keys.\n let defaultUserKeys = null;\n let otherUserKeys = null;\n if (user) {\n const { id, ip_address, email, username, ...otherKeys } = user;\n defaultUserKeys = this._serializeObject({\n email,\n id,\n ip_address,\n username,\n });\n otherUserKeys = this._serializeObject(otherKeys);\n }\n\n RNSentry.setUser(defaultUserKeys, otherUserKeys);\n },\n\n /**\n * Sets a tag in the native module.\n * @param key string\n * @param value string\n */\n setTag(key: string, value: string): void {\n if (!this.enableNative) {\n return;\n }\n if (!this._isModuleLoaded(RNSentry)) {\n throw this._NativeClientError;\n }\n\n const stringifiedValue =\n typeof value === 'string' ? value : JSON.stringify(value);\n\n RNSentry.setTag(key, stringifiedValue);\n },\n\n /**\n * Sets an extra in the native scope, will stringify\n * extra value if it isn't already a string.\n * @param key string\n * @param extra any\n */\n setExtra(key: string, extra: unknown): void {\n if (!this.enableNative) {\n return;\n }\n if (!this._isModuleLoaded(RNSentry)) {\n throw this._NativeClientError;\n }\n\n // we stringify the extra as native only takes in strings.\n const stringifiedExtra =\n typeof extra === 'string' ? extra : JSON.stringify(extra);\n\n RNSentry.setExtra(key, stringifiedExtra);\n },\n\n /**\n * Adds breadcrumb to the native scope.\n * @param breadcrumb Breadcrumb\n */\n addBreadcrumb(breadcrumb: Breadcrumb): void {\n if (!this.enableNative) {\n return;\n }\n if (!this._isModuleLoaded(RNSentry)) {\n throw this._NativeClientError;\n }\n\n RNSentry.addBreadcrumb({\n ...breadcrumb,\n // Process and convert deprecated levels\n level: breadcrumb.level\n ? this._processLevel(breadcrumb.level)\n : undefined,\n data: breadcrumb.data\n ? this._serializeObject(breadcrumb.data)\n : undefined,\n });\n },\n\n /**\n * Clears breadcrumbs on the native scope.\n */\n clearBreadcrumbs(): void {\n if (!this.enableNative) {\n return;\n }\n if (!this._isModuleLoaded(RNSentry)) {\n throw this._NativeClientError;\n }\n\n RNSentry.clearBreadcrumbs();\n },\n\n /**\n * Sets context on the native scope. Not implemented in Android yet.\n * @param key string\n * @param context key-value map\n */\n setContext(key: string, context: { [key: string]: unknown } | null): void {\n if (!this.enableNative) {\n return;\n }\n if (!this._isModuleLoaded(RNSentry)) {\n throw this._NativeClientError;\n }\n\n RNSentry.setContext(\n key,\n context !== null ? this._serializeObject(context) : null\n );\n },\n\n /**\n * Closes the Native Layer SDK\n */\n async closeNativeSdk(): Promise<void> {\n if (!this.enableNative) {\n return;\n }\n if (!this._isModuleLoaded(RNSentry)) {\n return;\n }\n\n return RNSentry.closeNativeSdk().then(() => {\n this.enableNative = false;\n });\n },\n\n disableNativeFramesTracking(): void {\n if (!this.enableNative) {\n return;\n }\n if (!this._isModuleLoaded(RNSentry)) {\n return;\n }\n\n RNSentry.disableNativeFramesTracking();\n },\n\n isNativeTransportAvailable(): boolean {\n return this.enableNative && this._isModuleLoaded(RNSentry);\n },\n\n /**\n * Serializes all values of root-level keys into strings.\n * @param data key-value map.\n * @returns An object where all root-level values are strings.\n */\n _serializeObject(data: {\n [key: string]: unknown;\n }): { [key: string]: string } {\n const serialized: { [key: string]: string } = {};\n\n Object.keys(data).forEach((dataKey) => {\n const value = data[dataKey];\n serialized[dataKey] =\n typeof value === 'string' ? value : JSON.stringify(value);\n });\n\n return serialized;\n },\n\n /**\n * Convert js severity level in event.level and event.breadcrumbs to more widely supported levels.\n * @param event\n * @returns Event with more widely supported Severity level strings\n */\n _processLevels(event: Event): Event {\n const processed: Event = {\n ...event,\n level: event.level ? this._processLevel(event.level) : undefined,\n breadcrumbs: event.breadcrumbs?.map((breadcrumb) => ({\n ...breadcrumb,\n level: breadcrumb.level\n ? this._processLevel(breadcrumb.level)\n : undefined,\n })),\n };\n\n return processed;\n },\n\n /**\n * Convert js severity level which has critical and log to more widely supported levels.\n * @param level\n * @returns More widely supported Severity level strings\n */\n _processLevel(level: Severity): Severity {\n if (level === Severity.Critical) {\n return Severity.Fatal;\n }\n if (level === Severity.Log) {\n return Severity.Debug;\n }\n\n return level;\n },\n\n /**\n * Checks whether the RNSentry module is loaded.\n */\n _isModuleLoaded(\n module: SentryNativeBridgeModule | undefined\n ): module is SentryNativeBridgeModule {\n return !!module;\n },\n\n _DisabledNativeError: new SentryError('Native is disabled'),\n\n _NativeClientError: new SentryError(\n \"Native Client is not available, can't start on native.\"\n ),\n\n enableNative: true,\n nativeIsReady: false,\n platform: Platform.OS,\n};\n"]}
1
+ {"version":3,"file":"wrapper.js","sourceRoot":"","sources":["../../src/js/wrapper.ts"],"names":[],"mappings":";AAeA,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,QAAQ,EA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A4C;QAE5C,OAAO,CAAC,CAAC,MAAM,CAAC;IAClB,CAAC;IAED,oBAAoB,EAAE,IAAI,WAAW,CAAC,oBAAoB,CAAC;IAE3D,kBAAkB,EAAE,IAAI,WAAW,CACjC,wDAAwD,CACzD;IAED,YAAY,EAAE,IAAI;IAClB,aAAa,EAAE,KAAK;IACpB,QAAQ,EAAE,QAAQ,CAAC,EAAE;CACtB,CAAC","sourcesContent":["/* eslint-disable max-lines */\nimport {\n AttachmentItem,\n BaseEnvelopeItemHeaders,\n Breadcrumb,\n ClientReportItem,\n Envelope,\n Event,\n EventItem,\n Package,\n SessionItem,\n SeverityLevel,\n User,\n UserFeedbackItem,\n} from '@sentry/types';\nimport { logger, SentryError } from '@sentry/utils';\nimport { NativeModules, Platform } from 'react-native';\n\nimport {\n NativeAppStartResponse,\n NativeDeviceContextsResponse,\n NativeFramesResponse,\n NativeReleaseResponse,\n SentryNativeBridgeModule,\n} from './definitions';\nimport { ReactNativeOptions } from './options';\n\n\nconst RNSentry = NativeModules.RNSentry as SentryNativeBridgeModule | undefined;\n\ninterface SentryNativeWrapper {\n enableNative: boolean;\n nativeIsReady: boolean;\n platform: typeof Platform.OS;\n\n _NativeClientError: Error;\n _DisabledNativeError: Error;\n\n _getEvent(envelopeItem: EventItem | AttachmentItem | UserFeedbackItem | SessionItem | ClientReportItem): Event | undefined;\n _processLevels(event: Event): Event;\n _processLevel(level: SeverityLevel): SeverityLevel;\n _serializeObject(data: { [key: string]: unknown }): { [key: string]: string };\n _isModuleLoaded(\n module: SentryNativeBridgeModule | undefined\n ): module is SentryNativeBridgeModule;\n\n isNativeTransportAvailable(): boolean;\n\n initNativeSdk(options: ReactNativeOptions): PromiseLike<boolean>;\n closeNativeSdk(): PromiseLike<void>;\n\n sendEnvelope(envelope: Envelope): Promise<void>;\n\n fetchNativeRelease(): PromiseLike<NativeReleaseResponse>;\n fetchNativeDeviceContexts(): PromiseLike<NativeDeviceContextsResponse>;\n fetchNativeAppStart(): PromiseLike<NativeAppStartResponse | null>;\n fetchNativeFrames(): PromiseLike<NativeFramesResponse | null>;\n fetchNativeSdkInfo(): PromiseLike<Package | null>;\n\n disableNativeFramesTracking(): void;\n\n addBreadcrumb(breadcrumb: Breadcrumb): void;\n setContext(key: string, context: { [key: string]: unknown } | null): void;\n clearBreadcrumbs(): void;\n setExtra(key: string, extra: unknown): void;\n setUser(user: User | null): void;\n setTag(key: string, value: string): void;\n\n nativeCrash(): void;\n}\n\n/**\n * Our internal interface for calling native functions\n */\nexport const NATIVE: SentryNativeWrapper = {\n /**\n * Sending the envelope over the bridge to native\n * @param envelope Envelope\n */\n async sendEnvelope(envelope: Envelope): Promise<void> {\n if (!this.enableNative) {\n logger.warn('Event was skipped as native SDK is not enabled.');\n return;\n }\n\n if (!this._isModuleLoaded(RNSentry)) {\n throw this._NativeClientError;\n }\n\n const header = envelope[0];\n\n if (NATIVE.platform === 'android') {\n // Android\n\n const headerString = JSON.stringify(header);\n\n let envelopeItemsBuilder = `${headerString}`;\n\n for (const envelopeItems of envelope[1]) {\n\n const event = this._getEvent(envelopeItems);\n if (event != undefined) {\n\n // @ts-ignore Android still uses the old message object, without this the serialization of events will break.\n event.message = { message: event.message };\n\n /*\n We do this to avoid duplicate breadcrumbs on Android as sentry-android applies the breadcrumbs\n from the native scope onto every envelope sent through it. This scope will contain the breadcrumbs\n sent through the scope sync feature. This causes duplicate breadcrumbs.\n We then remove the breadcrumbs in all cases but if it is handled == false,\n this is a signal that the app would crash and android would lose the breadcrumbs by the time the app is restarted to read\n the envelope.\n */\n if (event.exception?.values?.[0]?.mechanism?.handled != false && event.breadcrumbs) {\n event.breadcrumbs = [];\n }\n envelopeItems[1] = event;\n }\n\n // Content type is not inside BaseEnvelopeItemHeaders.\n (envelopeItems[0] as BaseEnvelopeItemHeaders).content_type = 'application/json';\n\n const itemPayload = JSON.stringify(envelopeItems[1]);\n\n let length = itemPayload.length;\n try {\n length = await RNSentry.getStringBytesLength(itemPayload);\n } catch {\n // The native call failed, we do nothing, we have payload.length as a fallback\n }\n\n (envelopeItems[0] as BaseEnvelopeItemHeaders).length = length;\n const itemHeader = JSON.stringify(envelopeItems[0]);\n\n envelopeItemsBuilder += `\\n${itemHeader}\\n${itemPayload}`;\n }\n\n await RNSentry.captureEnvelope(envelopeItemsBuilder);\n } else {\n // iOS/Mac\n\n for (const envelopeItems of envelope[1]) {\n const event = this._getEvent(envelopeItems);\n if (event != undefined) {\n envelopeItems[1] = event;\n }\n\n const itemPayload = JSON.parse(JSON.stringify(envelopeItems[1]));\n\n // The envelope item is created (and its length determined) on the iOS side of the native bridge.\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n\n await RNSentry.captureEnvelope({\n header,\n payload: itemPayload,\n });\n }\n };\n\n },\n\n /**\n * Starts native with the provided options.\n * @param options ReactNativeOptions\n */\n async initNativeSdk(originalOptions: ReactNativeOptions): Promise<boolean> {\n const options = {\n enableNative: true,\n autoInitializeNativeSdk: true,\n ...originalOptions,\n };\n\n if (!options.enableNative) {\n if (options.enableNativeNagger) {\n logger.warn('Note: Native Sentry SDK is disabled.');\n }\n this.enableNative = false;\n return false;\n }\n if (!options.autoInitializeNativeSdk) {\n if (options.enableNativeNagger) {\n logger.warn(\n 'Note: Native Sentry SDK was not initialized automatically, you will need to initialize it manually. If you wish to disable the native SDK and get rid of this warning, pass enableNative: false'\n );\n }\n return false;\n }\n\n if (!options.dsn) {\n logger.warn(\n 'Warning: No DSN was provided. The Sentry SDK will be disabled. Native SDK will also not be initalized.'\n );\n return false;\n }\n\n if (!this._isModuleLoaded(RNSentry)) {\n throw this._NativeClientError;\n }\n\n // filter out all the options that would crash native.\n /* eslint-disable @typescript-eslint/unbound-method,@typescript-eslint/no-unused-vars */\n const {\n beforeSend,\n beforeBreadcrumb,\n integrations,\n ...filteredOptions\n } = options;\n /* eslint-enable @typescript-eslint/unbound-method,@typescript-eslint/no-unused-vars */\n const nativeIsReady = await RNSentry.initNativeSdk(filteredOptions);\n\n this.nativeIsReady = nativeIsReady;\n\n return nativeIsReady;\n },\n\n /**\n * Fetches the release from native\n */\n async fetchNativeRelease(): Promise<NativeReleaseResponse> {\n if (!this.enableNative) {\n throw this._DisabledNativeError;\n }\n if (!this._isModuleLoaded(RNSentry)) {\n throw this._NativeClientError;\n }\n\n return RNSentry.fetchNativeRelease();\n },\n\n /**\n * Fetches the Sdk info for the native sdk.\n * NOTE: Only available on iOS.\n */\n async fetchNativeSdkInfo(): Promise<Package | null> {\n if (!this.enableNative) {\n throw this._DisabledNativeError;\n }\n if (!this._isModuleLoaded(RNSentry)) {\n throw this._NativeClientError;\n }\n\n if (this.platform !== 'ios') {\n return null;\n }\n\n return RNSentry.fetchNativeSdkInfo();\n },\n\n /**\n * Fetches the device contexts. Not used on Android.\n */\n async fetchNativeDeviceContexts(): Promise<NativeDeviceContextsResponse> {\n if (!this.enableNative) {\n throw this._DisabledNativeError;\n }\n if (!this._isModuleLoaded(RNSentry)) {\n throw this._NativeClientError;\n }\n\n if (this.platform !== 'ios') {\n // Only ios uses deviceContexts, return an empty object.\n return {};\n }\n\n return RNSentry.fetchNativeDeviceContexts();\n },\n\n async fetchNativeAppStart(): Promise<NativeAppStartResponse | null> {\n if (!this.enableNative) {\n throw this._DisabledNativeError;\n }\n if (!this._isModuleLoaded(RNSentry)) {\n throw this._NativeClientError;\n }\n\n return RNSentry.fetchNativeAppStart();\n },\n\n async fetchNativeFrames(): Promise<NativeFramesResponse | null> {\n if (!this.enableNative) {\n throw this._DisabledNativeError;\n }\n if (!this._isModuleLoaded(RNSentry)) {\n throw this._NativeClientError;\n }\n\n return RNSentry.fetchNativeFrames();\n },\n\n /**\n * Triggers a native crash.\n * Use this only for testing purposes.\n */\n nativeCrash(): void {\n if (!this.enableNative) {\n return;\n }\n if (!this._isModuleLoaded(RNSentry)) {\n throw this._NativeClientError;\n }\n\n RNSentry.crash();\n },\n\n /**\n * Sets the user in the native scope.\n * Passing null clears the user.\n */\n setUser(user: User | null): void {\n if (!this.enableNative) {\n return;\n }\n if (!this._isModuleLoaded(RNSentry)) {\n throw this._NativeClientError;\n }\n\n // separate and serialze all non-default user keys.\n let defaultUserKeys = null;\n let otherUserKeys = null;\n if (user) {\n const { id, ip_address, email, username, ...otherKeys } = user;\n defaultUserKeys = this._serializeObject({\n email,\n id,\n ip_address,\n username,\n });\n otherUserKeys = this._serializeObject(otherKeys);\n }\n\n RNSentry.setUser(defaultUserKeys, otherUserKeys);\n },\n\n /**\n * Sets a tag in the native module.\n * @param key string\n * @param value string\n */\n setTag(key: string, value: string): void {\n if (!this.enableNative) {\n return;\n }\n if (!this._isModuleLoaded(RNSentry)) {\n throw this._NativeClientError;\n }\n\n const stringifiedValue =\n typeof value === 'string' ? value : JSON.stringify(value);\n\n RNSentry.setTag(key, stringifiedValue);\n },\n\n /**\n * Sets an extra in the native scope, will stringify\n * extra value if it isn't already a string.\n * @param key string\n * @param extra any\n */\n setExtra(key: string, extra: unknown): void {\n if (!this.enableNative) {\n return;\n }\n if (!this._isModuleLoaded(RNSentry)) {\n throw this._NativeClientError;\n }\n\n // we stringify the extra as native only takes in strings.\n const stringifiedExtra =\n typeof extra === 'string' ? extra : JSON.stringify(extra);\n\n RNSentry.setExtra(key, stringifiedExtra);\n },\n\n /**\n * Adds breadcrumb to the native scope.\n * @param breadcrumb Breadcrumb\n */\n addBreadcrumb(breadcrumb: Breadcrumb): void {\n if (!this.enableNative) {\n return;\n }\n if (!this._isModuleLoaded(RNSentry)) {\n throw this._NativeClientError;\n }\n\n RNSentry.addBreadcrumb({\n ...breadcrumb,\n // Process and convert deprecated levels\n level: breadcrumb.level\n ? this._processLevel(breadcrumb.level)\n : undefined,\n data: breadcrumb.data\n ? this._serializeObject(breadcrumb.data)\n : undefined,\n });\n },\n\n /**\n * Clears breadcrumbs on the native scope.\n */\n clearBreadcrumbs(): void {\n if (!this.enableNative) {\n return;\n }\n if (!this._isModuleLoaded(RNSentry)) {\n throw this._NativeClientError;\n }\n\n RNSentry.clearBreadcrumbs();\n },\n\n /**\n * Sets context on the native scope. Not implemented in Android yet.\n * @param key string\n * @param context key-value map\n */\n setContext(key: string, context: { [key: string]: unknown } | null): void {\n if (!this.enableNative) {\n return;\n }\n if (!this._isModuleLoaded(RNSentry)) {\n throw this._NativeClientError;\n }\n\n RNSentry.setContext(\n key,\n context !== null ? this._serializeObject(context) : null\n );\n },\n\n /**\n * Closes the Native Layer SDK\n */\n async closeNativeSdk(): Promise<void> {\n if (!this.enableNative) {\n return;\n }\n if (!this._isModuleLoaded(RNSentry)) {\n return;\n }\n\n return RNSentry.closeNativeSdk().then(() => {\n this.enableNative = false;\n });\n },\n\n disableNativeFramesTracking(): void {\n if (!this.enableNative) {\n return;\n }\n if (!this._isModuleLoaded(RNSentry)) {\n return;\n }\n\n RNSentry.disableNativeFramesTracking();\n },\n\n isNativeTransportAvailable(): boolean {\n return this.enableNative && this._isModuleLoaded(RNSentry);\n },\n\n /**\n * Gets the event from envelopeItem and applies the level filter to the selected event.\n * @param data An envelope item containing the event.\n * @returns The event from envelopeItem or undefined.\n */\n _getEvent(envelopeItem: EventItem | AttachmentItem | UserFeedbackItem | SessionItem | ClientReportItem): Event | undefined {\n if (envelopeItem[0].type == 'event' || envelopeItem[0].type == 'transaction') {\n return this._processLevels(envelopeItem[1] as Event);\n }\n return undefined;\n },\n\n /**\n * Serializes all values of root-level keys into strings.\n * @param data key-value map.\n * @returns An object where all root-level values are strings.\n */\n _serializeObject(data: {\n [key: string]: unknown;\n }): { [key: string]: string } {\n const serialized: { [key: string]: string } = {};\n\n Object.keys(data).forEach((dataKey) => {\n const value = data[dataKey];\n serialized[dataKey] =\n typeof value === 'string' ? value : JSON.stringify(value);\n });\n\n return serialized;\n },\n\n /**\n * Convert js severity level in event.level and event.breadcrumbs to more widely supported levels.\n * @param event\n * @returns Event with more widely supported Severity level strings\n */\n\n _processLevels(event: Event): Event {\n const processed: Event = {\n ...event,\n level: event.level ? this._processLevel(event.level) : undefined,\n breadcrumbs: event.breadcrumbs?.map((breadcrumb) => ({\n ...breadcrumb,\n level: breadcrumb.level\n ? this._processLevel(breadcrumb.level)\n : undefined,\n })),\n };\n\n return processed;\n },\n\n /**\n * Convert js severity level which has critical and log to more widely supported levels.\n * @param level\n * @returns More widely supported Severity level strings\n */\n\n _processLevel(level: SeverityLevel): SeverityLevel {\n if (level == 'log' as SeverityLevel) {\n return 'debug' as SeverityLevel;\n }\n else if (level == 'critical' as SeverityLevel) {\n return 'fatal' as SeverityLevel;\n }\n\n\n return level;\n },\n\n /**\n * Checks whether the RNSentry module is loaded.\n */\n _isModuleLoaded(\n module: SentryNativeBridgeModule | undefined\n ): module is SentryNativeBridgeModule {\n return !!module;\n },\n\n _DisabledNativeError: new SentryError('Native is disabled'),\n\n _NativeClientError: new SentryError(\n \"Native Client is not available, can't start on native.\"\n ),\n\n enableNative: true,\n nativeIsReady: false,\n platform: Platform.OS,\n};\n"]}
package/ios/RNSentry.m CHANGED
@@ -90,13 +90,21 @@ RCT_EXPORT_METHOD(initNativeSdk:(NSDictionary *_Nonnull)options
90
90
  BOOL enableAutoPerformanceTracking = (BOOL)[mutableOptions valueForKey:@"enableAutoPerformanceTracking"];
91
91
 
92
92
  PrivateSentrySDKOnly.appStartMeasurementHybridSDKMode = enableAutoPerformanceTracking;
93
+ #if TARGET_OS_IPHONE || TARGET_OS_MACCATALYST
93
94
  PrivateSentrySDKOnly.framesTrackingMeasurementHybridSDKMode = enableAutoPerformanceTracking;
95
+ #endif
94
96
  }
95
97
 
96
98
  [SentrySDK startWithOptionsObject:sentryOptions];
97
99
 
100
+ #if TARGET_OS_IPHONE || TARGET_OS_MACCATALYST
101
+ BOOL appIsActive = [[UIApplication sharedApplication] applicationState] == UIApplicationStateActive;
102
+ #else
103
+ BOOL appIsActive = [[NSApplication sharedApplication] isActive];
104
+ #endif
105
+
98
106
  // If the app is active/in foreground, and we have not sent the SentryHybridSdkDidBecomeActive notification, send it.
99
- if ([[UIApplication sharedApplication] applicationState] == UIApplicationStateActive && !sentHybridSdkDidBecomeActive && sentryOptions.enableAutoSessionTracking) {
107
+ if (appIsActive && !sentHybridSdkDidBecomeActive && sentryOptions.enableAutoSessionTracking) {
100
108
  [[NSNotificationCenter defaultCenter]
101
109
  postNotificationName:@"SentryHybridSdkDidBecomeActive"
102
110
  object:nil];
@@ -164,9 +172,9 @@ RCT_EXPORT_METHOD(fetchNativeDeviceContexts:(RCTPromiseResolveBlock)resolve
164
172
  NSDictionary<NSString *, id> *serializedScope = [scope serialize];
165
173
  // Scope serializes as 'context' instead of 'contexts' as it does for the event.
166
174
  NSDictionary<NSString *, id> *tempContexts = [serializedScope valueForKey:@"context"];
167
-
175
+
168
176
  NSMutableDictionary<NSString *, id> *user = [NSMutableDictionary new];
169
-
177
+
170
178
  NSDictionary<NSString *, id> *tempUser = [serializedScope valueForKey:@"user"];
171
179
  if (tempUser != nil) {
172
180
  [user addEntriesFromDictionary:[tempUser valueForKey:@"user"]];
@@ -174,7 +182,7 @@ RCT_EXPORT_METHOD(fetchNativeDeviceContexts:(RCTPromiseResolveBlock)resolve
174
182
  [user setValue:PrivateSentrySDKOnly.installationID forKey:@"id"];
175
183
  }
176
184
  [contexts setValue:user forKey:@"user"];
177
-
185
+
178
186
  if (tempContexts != nil) {
179
187
  [contexts setValue:tempContexts forKey:@"context"];
180
188
  }
@@ -215,6 +223,7 @@ RCT_EXPORT_METHOD(fetchNativeFrames:(RCTPromiseResolveBlock)resolve
215
223
  rejecter:(RCTPromiseRejectBlock)reject)
216
224
  {
217
225
 
226
+ #if TARGET_OS_IPHONE || TARGET_OS_MACCATALYST
218
227
  if (PrivateSentrySDKOnly.isFramesTrackingRunning) {
219
228
  SentryScreenFrames *frames = PrivateSentrySDKOnly.currentScreenFrames;
220
229
 
@@ -241,6 +250,9 @@ RCT_EXPORT_METHOD(fetchNativeFrames:(RCTPromiseResolveBlock)resolve
241
250
  } else {
242
251
  resolve(nil);
243
252
  }
253
+ #else
254
+ resolve(nil);
255
+ #endif
244
256
  }
245
257
 
246
258
  RCT_EXPORT_METHOD(fetchNativeRelease:(RCTPromiseResolveBlock)resolve
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@sentry/react-native",
3
3
  "homepage": "https://github.com/getsentry/sentry-react-native",
4
4
  "repository": "https://github.com/getsentry/sentry-react-native",
5
- "version": "3.4.2",
5
+ "version": "4.0.0-beta.2",
6
6
  "description": "Official Sentry SDK for react-native",
7
7
  "typings": "dist/js/index.d.ts",
8
8
  "types": "dist/js/index.d.ts",
@@ -40,20 +40,20 @@
40
40
  "react-native": ">=0.56.0"
41
41
  },
42
42
  "dependencies": {
43
- "@sentry/browser": "6.19.2",
44
- "@sentry/cli": "^1.74.2",
45
- "@sentry/core": "6.19.2",
46
- "@sentry/hub": "6.19.2",
47
- "@sentry/integrations": "6.19.2",
48
- "@sentry/react": "6.19.2",
49
- "@sentry/tracing": "6.19.2",
50
- "@sentry/types": "6.19.2",
51
- "@sentry/utils": "6.19.2",
43
+ "@sentry/browser": "7.1.1",
44
+ "@sentry/cli": "^1.74.4",
45
+ "@sentry/core": "7.1.1",
46
+ "@sentry/hub": "7.1.1",
47
+ "@sentry/integrations": "7.1.1",
48
+ "@sentry/react": "7.1.1",
49
+ "@sentry/tracing": "7.1.1",
50
+ "@sentry/types": "7.1.1",
51
+ "@sentry/utils": "7.1.1",
52
52
  "@sentry/wizard": "^1.2.17"
53
53
  },
54
54
  "devDependencies": {
55
- "@sentry-internal/eslint-config-sdk": "6.19.2",
56
- "@sentry-internal/eslint-plugin-sdk": "6.19.2",
55
+ "@sentry-internal/eslint-config-sdk": "7.1.1",
56
+ "@sentry-internal/eslint-plugin-sdk": "7.1.1",
57
57
  "@sentry/typescript": "^5.20.1",
58
58
  "@types/jest": "^26.0.15",
59
59
  "@types/react": "^16.9.49",
@@ -69,7 +69,7 @@
69
69
  "replace-in-file": "^6.0.0",
70
70
  "rimraf": "^3.0.0",
71
71
  "ts-jest": "^24.3.0",
72
- "typescript": "^3.4.5"
72
+ "typescript": "3.8.3"
73
73
  },
74
74
  "rnpm": {
75
75
  "commands": {
@@ -1,37 +0,0 @@
1
- import { BaseBackend } from '@sentry/core';
2
- import { BrowserOptions } from '@sentry/react';
3
- import { Event, EventHint, Severity, Transport } from '@sentry/types';
4
- import { ReactNativeOptions } from './options';
5
- /** The Sentry ReactNative SDK Backend. */
6
- export declare class ReactNativeBackend extends BaseBackend<BrowserOptions> {
7
- protected readonly _options: ReactNativeOptions;
8
- private readonly _browserBackend;
9
- /** Creates a new ReactNative backend instance. */
10
- constructor(_options: ReactNativeOptions);
11
- /**
12
- * If native client is available it will trigger a native crash.
13
- * Use this only for testing purposes.
14
- */
15
- nativeCrash(): void;
16
- /**
17
- * @inheritDoc
18
- */
19
- eventFromException(exception: unknown, hint?: EventHint): PromiseLike<Event>;
20
- /**
21
- * @inheritDoc
22
- */
23
- eventFromMessage(message: string, level?: Severity, hint?: EventHint): PromiseLike<Event>;
24
- /**
25
- * @inheritDoc
26
- */
27
- protected _setupTransport(): Transport;
28
- /**
29
- * Starts native client with dsn and options
30
- */
31
- private _initNativeSdk;
32
- /**
33
- * If the user is in development mode, and the native nagger is enabled then it will show an alert.
34
- */
35
- private _showCannotConnectDialog;
36
- }
37
- //# sourceMappingURL=backend.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"backend.d.ts","sourceRoot":"","sources":["../../src/js/backend.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAiB,MAAM,cAAc,CAAC;AAC1D,OAAO,EAAE,cAAc,EAAc,MAAM,eAAe,CAAC;AAC3D,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAItE,OAAO,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAI/C,0CAA0C;AAC1C,qBAAa,kBAAmB,SAAQ,WAAW,CAAC,cAAc,CAAC;IAI9C,SAAS,CAAC,QAAQ,CAAC,QAAQ,EAAE,kBAAkB;IAHlE,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAiB;IAEjD,kDAAkD;gBACZ,QAAQ,EAAE,kBAAkB;IAiBlE;;;OAGG;IACI,WAAW,IAAI,IAAI;IAI1B;;OAEG;IACI,kBAAkB,CACvB,SAAS,EAAE,OAAO,EAClB,IAAI,CAAC,EAAE,SAAS,GACf,WAAW,CAAC,KAAK,CAAC;IAIrB;;OAEG;IACI,gBAAgB,CACrB,OAAO,EAAE,MAAM,EACf,KAAK,GAAE,QAAwB,EAC/B,IAAI,CAAC,EAAE,SAAS,GACf,WAAW,CAAC,KAAK,CAAC;IAIrB;;OAEG;IACH,SAAS,CAAC,eAAe,IAAI,SAAS;IAsBtC;;OAEG;YACW,cAAc;IAgB5B;;OAEG;IACH,OAAO,CAAC,wBAAwB;CAQjC"}
@@ -1,92 +0,0 @@
1
- import { __awaiter } from "tslib";
2
- import { BrowserBackend } from '@sentry/browser/dist/backend';
3
- import { BaseBackend, NoopTransport } from '@sentry/core';
4
- import { Transports } from '@sentry/react';
5
- import { Severity } from '@sentry/types';
6
- // @ts-ignore LogBox introduced in RN 0.63
7
- import { Alert, LogBox, YellowBox } from 'react-native';
8
- import { NativeTransport } from './transports/native';
9
- import { NATIVE } from './wrapper';
10
- /** The Sentry ReactNative SDK Backend. */
11
- export class ReactNativeBackend extends BaseBackend {
12
- /** Creates a new ReactNative backend instance. */
13
- constructor(_options) {
14
- super(_options);
15
- this._options = _options;
16
- this._browserBackend = new BrowserBackend(_options);
17
- // This is a workaround for now using fetch on RN, this is a known issue in react-native and only generates a warning
18
- // YellowBox deprecated and replaced with with LogBox in RN 0.63
19
- if (LogBox) {
20
- // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
21
- LogBox.ignoreLogs(['Require cycle:']);
22
- }
23
- else {
24
- // eslint-disable-next-line deprecation/deprecation
25
- YellowBox.ignoreWarnings(['Require cycle:']);
26
- }
27
- void this._initNativeSdk();
28
- }
29
- /**
30
- * If native client is available it will trigger a native crash.
31
- * Use this only for testing purposes.
32
- */
33
- nativeCrash() {
34
- NATIVE.nativeCrash();
35
- }
36
- /**
37
- * @inheritDoc
38
- */
39
- eventFromException(exception, hint) {
40
- return this._browserBackend.eventFromException(exception, hint);
41
- }
42
- /**
43
- * @inheritDoc
44
- */
45
- eventFromMessage(message, level = Severity.Info, hint) {
46
- return this._browserBackend.eventFromMessage(message, level, hint);
47
- }
48
- /**
49
- * @inheritDoc
50
- */
51
- _setupTransport() {
52
- if (!this._options.dsn) {
53
- // We return the noop transport here in case there is no Dsn.
54
- return new NoopTransport();
55
- }
56
- const transportOptions = Object.assign(Object.assign({}, this._options.transportOptions), { dsn: this._options.dsn });
57
- if (this._options.transport) {
58
- return new this._options.transport(transportOptions);
59
- }
60
- if (NATIVE.isNativeTransportAvailable()) {
61
- return new NativeTransport();
62
- }
63
- return new Transports.FetchTransport(transportOptions);
64
- }
65
- /**
66
- * Starts native client with dsn and options
67
- */
68
- _initNativeSdk() {
69
- var _a, _b, _c, _d;
70
- return __awaiter(this, void 0, void 0, function* () {
71
- let didCallNativeInit = false;
72
- try {
73
- didCallNativeInit = yield NATIVE.initNativeSdk(this._options);
74
- }
75
- catch (_) {
76
- this._showCannotConnectDialog();
77
- (_b = (_a = this._options).onReady) === null || _b === void 0 ? void 0 : _b.call(_a, { didCallNativeInit: false });
78
- return;
79
- }
80
- (_d = (_c = this._options).onReady) === null || _d === void 0 ? void 0 : _d.call(_c, { didCallNativeInit });
81
- });
82
- }
83
- /**
84
- * If the user is in development mode, and the native nagger is enabled then it will show an alert.
85
- */
86
- _showCannotConnectDialog() {
87
- if (__DEV__ && this._options.enableNativeNagger) {
88
- Alert.alert('Sentry', '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/#linking for more details.');
89
- }
90
- }
91
- }
92
- //# sourceMappingURL=backend.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"backend.js","sourceRoot":"","sources":["../../src/js/backend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qO,CACtO,CAAC;SACH;IACH,CAAC;CACF","sourcesContent":["import { BrowserBackend } from '@sentry/browser/dist/backend';\nimport { BaseBackend, NoopTransport } from '@sentry/core';\nimport { BrowserOptions, Transports } from '@sentry/react';\nimport { Event, EventHint, Severity, Transport } from '@sentry/types';\n// @ts-ignore LogBox introduced in RN 0.63\nimport { Alert, LogBox, YellowBox } from 'react-native';\n\nimport { ReactNativeOptions } from './options';\nimport { NativeTransport } from './transports/native';\nimport { NATIVE } from './wrapper';\n\n/** The Sentry ReactNative SDK Backend. */\nexport class ReactNativeBackend extends BaseBackend<BrowserOptions> {\n private readonly _browserBackend: BrowserBackend;\n\n /** Creates a new ReactNative backend instance. */\n public constructor(protected readonly _options: ReactNativeOptions) {\n super(_options);\n this._browserBackend = new BrowserBackend(_options);\n\n // This is a workaround for now using fetch on RN, this is a known issue in react-native and only generates a warning\n // YellowBox deprecated and replaced with with LogBox in RN 0.63\n if (LogBox) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n LogBox.ignoreLogs(['Require cycle:']);\n } else {\n // eslint-disable-next-line deprecation/deprecation\n YellowBox.ignoreWarnings(['Require cycle:']);\n }\n\n void this._initNativeSdk();\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 eventFromException(\n exception: unknown,\n hint?: EventHint\n ): PromiseLike<Event> {\n return this._browserBackend.eventFromException(exception, hint);\n }\n\n /**\n * @inheritDoc\n */\n public eventFromMessage(\n message: string,\n level: Severity = Severity.Info,\n hint?: EventHint\n ): PromiseLike<Event> {\n return this._browserBackend.eventFromMessage(message, level, hint);\n }\n\n /**\n * @inheritDoc\n */\n protected _setupTransport(): Transport {\n if (!this._options.dsn) {\n // We return the noop transport here in case there is no Dsn.\n return new NoopTransport();\n }\n\n const transportOptions = {\n ...this._options.transportOptions,\n dsn: this._options.dsn,\n };\n\n if (this._options.transport) {\n return new this._options.transport(transportOptions);\n }\n\n if (NATIVE.isNativeTransportAvailable()) {\n return new NativeTransport();\n }\n\n return new Transports.FetchTransport(transportOptions);\n }\n\n /**\n * Starts native client with dsn and options\n */\n private async _initNativeSdk(): Promise<void> {\n let didCallNativeInit = false;\n\n try {\n didCallNativeInit = await NATIVE.initNativeSdk(this._options);\n } catch (_) {\n this._showCannotConnectDialog();\n\n this._options.onReady?.({ didCallNativeInit: false });\n\n return;\n }\n\n this._options.onReady?.({ didCallNativeInit });\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/#linking for more details.'\n );\n }\n }\n}\n"]}