@sentry/react-native 7.10.0 → 8.0.0-alpha.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.
Files changed (98) hide show
  1. package/RNSentry.podspec +8 -4
  2. package/android/libs/replay-stubs.jar +0 -0
  3. package/android/src/main/java/io/sentry/react/RNSentryCompositeOptionsConfiguration.java +25 -0
  4. package/android/src/main/java/io/sentry/react/RNSentryJsonConverter.java +76 -0
  5. package/android/src/main/java/io/sentry/react/RNSentryJsonUtils.java +41 -0
  6. package/android/src/main/java/io/sentry/react/RNSentryModuleImpl.java +22 -398
  7. package/android/src/main/java/io/sentry/react/RNSentrySDK.java +68 -0
  8. package/android/src/main/java/io/sentry/react/RNSentryStart.java +417 -0
  9. package/android/src/main/java/io/sentry/react/RNSentryVersion.java +1 -1
  10. package/android/src/newarch/java/io/sentry/react/RNSentryModule.java +10 -0
  11. package/android/src/oldarch/java/io/sentry/react/RNSentryModule.java +15 -0
  12. package/dist/js/NativeRNSentry.d.ts +2 -0
  13. package/dist/js/NativeRNSentry.d.ts.map +1 -1
  14. package/dist/js/NativeRNSentry.js.map +1 -1
  15. package/dist/js/integrations/logEnricherIntegration.js +43 -3
  16. package/dist/js/integrations/logEnricherIntegration.js.map +1 -1
  17. package/dist/js/replay/mobilereplay.d.ts +0 -26
  18. package/dist/js/replay/mobilereplay.d.ts.map +1 -1
  19. package/dist/js/replay/mobilereplay.js.map +1 -1
  20. package/dist/js/scopeSync.d.ts.map +1 -1
  21. package/dist/js/scopeSync.js +21 -0
  22. package/dist/js/scopeSync.js.map +1 -1
  23. package/dist/js/sdk.d.ts.map +1 -1
  24. package/dist/js/sdk.js +21 -10
  25. package/dist/js/sdk.js.map +1 -1
  26. package/dist/js/tools/metroconfig.d.ts +9 -1
  27. package/dist/js/tools/metroconfig.d.ts.map +1 -1
  28. package/dist/js/tools/metroconfig.js +9 -2
  29. package/dist/js/tools/metroconfig.js.map +1 -1
  30. package/dist/js/tools/sentryMetroSerializer.d.ts.map +1 -1
  31. package/dist/js/tools/sentryMetroSerializer.js +1 -0
  32. package/dist/js/tools/sentryMetroSerializer.js.map +1 -1
  33. package/dist/js/tools/sentryOptionsSerializer.d.ts +6 -0
  34. package/dist/js/tools/sentryOptionsSerializer.d.ts.map +1 -0
  35. package/dist/js/tools/sentryOptionsSerializer.js +92 -0
  36. package/dist/js/tools/sentryOptionsSerializer.js.map +1 -0
  37. package/dist/js/tools/utils.d.ts +2 -1
  38. package/dist/js/tools/utils.d.ts.map +1 -1
  39. package/dist/js/tools/utils.js.map +1 -1
  40. package/dist/js/touchevents.d.ts +8 -0
  41. package/dist/js/touchevents.d.ts.map +1 -1
  42. package/dist/js/touchevents.js +33 -1
  43. package/dist/js/touchevents.js.map +1 -1
  44. package/dist/js/utils/worldwide.d.ts +2 -0
  45. package/dist/js/utils/worldwide.d.ts.map +1 -1
  46. package/dist/js/utils/worldwide.js.map +1 -1
  47. package/dist/js/version.d.ts +1 -1
  48. package/dist/js/version.d.ts.map +1 -1
  49. package/dist/js/version.js +1 -1
  50. package/dist/js/version.js.map +1 -1
  51. package/dist/js/wrapper.d.ts +2 -0
  52. package/dist/js/wrapper.d.ts.map +1 -1
  53. package/dist/js/wrapper.js +32 -0
  54. package/dist/js/wrapper.js.map +1 -1
  55. package/ios/RNSentry.h +3 -0
  56. package/ios/RNSentry.mm +28 -44
  57. package/ios/RNSentryDependencyContainer.h +2 -1
  58. package/ios/RNSentryDependencyContainer.m +1 -0
  59. package/ios/RNSentryEmitNewFrameEvent.h +3 -0
  60. package/ios/RNSentryExperimentalOptions.m +1 -1
  61. package/ios/RNSentryFramesTrackerListener.h +2 -2
  62. package/ios/RNSentryFramesTrackerListener.m +2 -0
  63. package/ios/RNSentryOnDrawReporter.h +2 -1
  64. package/ios/RNSentryOnDrawReporter.m +2 -0
  65. package/ios/RNSentryRNSScreen.m +3 -4
  66. package/ios/RNSentryReplay.mm +0 -5
  67. package/ios/RNSentryReplayBreadcrumbConverter.m +12 -12
  68. package/ios/RNSentrySDK.h +31 -0
  69. package/ios/RNSentrySDK.m +78 -0
  70. package/ios/RNSentryStart.h +25 -0
  71. package/ios/RNSentryStart.m +228 -0
  72. package/ios/RNSentryVersion.m +1 -1
  73. package/ios/SentryScreenFramesWrapper.h +14 -0
  74. package/ios/SentryScreenFramesWrapper.m +39 -0
  75. package/package.json +10 -10
  76. package/plugin/build/logger.d.ts +24 -0
  77. package/plugin/build/logger.js +44 -0
  78. package/plugin/build/utils.d.ts +0 -18
  79. package/plugin/build/utils.js +1 -34
  80. package/plugin/build/version.d.ts +2 -0
  81. package/plugin/build/version.js +6 -0
  82. package/plugin/build/withSentry.d.ts +1 -0
  83. package/plugin/build/withSentry.js +11 -10
  84. package/plugin/build/withSentryAndroid.d.ts +6 -1
  85. package/plugin/build/withSentryAndroid.js +52 -8
  86. package/plugin/build/withSentryAndroidGradlePlugin.d.ts +1 -1
  87. package/plugin/build/withSentryAndroidGradlePlugin.js +8 -8
  88. package/plugin/build/withSentryIOS.d.ts +6 -1
  89. package/plugin/build/withSentryIOS.js +55 -7
  90. package/scripts/sentry-xcode.sh +20 -0
  91. package/sentry.gradle +51 -0
  92. package/src/js/NativeRNSentry.ts +2 -0
  93. package/ts3.8/dist/js/NativeRNSentry.d.ts +2 -0
  94. package/ts3.8/dist/js/replay/mobilereplay.d.ts +0 -26
  95. package/ts3.8/dist/js/touchevents.d.ts +8 -0
  96. package/ts3.8/dist/js/utils/worldwide.d.ts +2 -0
  97. package/ts3.8/dist/js/version.d.ts +1 -1
  98. package/ts3.8/dist/js/wrapper.d.ts +2 -0
@@ -7,7 +7,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
7
7
  step((generator = generator.apply(thisArg, _arguments || [])).next());
8
8
  });
9
9
  };
10
- import { debug } from '@sentry/core';
10
+ import { debug, getCurrentScope, getGlobalScope, getIsolationScope } from '@sentry/core';
11
11
  import { NATIVE } from '../wrapper';
12
12
  const INTEGRATION_NAME = 'LogEnricher';
13
13
  export const logEnricherIntegration = () => {
@@ -32,11 +32,11 @@ let NativeCache = undefined;
32
32
  *
33
33
  * @param logAttributes - The log attributes object to modify.
34
34
  * @param key - The attribute key to set.
35
- * @param value - The value to set (only sets if truthy and key not present).
35
+ * @param value - The value to set (only sets if not null/undefined and key not present).
36
36
  * @param setEvenIfPresent - Whether to set the attribute if it is present. Defaults to true.
37
37
  */
38
38
  function setLogAttribute(logAttributes, key, value, setEvenIfPresent = true) {
39
- if (value && (!logAttributes[key] || setEvenIfPresent)) {
39
+ if (value != null && (!logAttributes[key] || setEvenIfPresent)) {
40
40
  logAttributes[key] = value;
41
41
  }
42
42
  }
@@ -69,6 +69,12 @@ function processLog(log, client) {
69
69
  }
70
70
  // Save log.attributes to a new variable
71
71
  const logAttributes = (_a = log.attributes) !== null && _a !== void 0 ? _a : {};
72
+ // Apply scope attributes from all active scopes (global, isolation, and current)
73
+ // These are applied first so they can be overridden by more specific attributes
74
+ const scopeAttributes = collectScopeAttributes();
75
+ Object.keys(scopeAttributes).forEach((key) => {
76
+ setLogAttribute(logAttributes, key, scopeAttributes[key], false);
77
+ });
72
78
  // Use setLogAttribute with the variable instead of direct assignment
73
79
  setLogAttribute(logAttributes, 'device.brand', NativeCache.brand);
74
80
  setLogAttribute(logAttributes, 'device.model', NativeCache.model);
@@ -81,4 +87,38 @@ function processLog(log, client) {
81
87
  // Set log.attributes to the variable
82
88
  log.attributes = logAttributes;
83
89
  }
90
+ /**
91
+ * Extracts primitive attributes from a scope and merges them into the target object.
92
+ * Only string, number, and boolean attribute values are included.
93
+ *
94
+ * @param scope - The scope to extract attributes from
95
+ * @param target - The target object to merge attributes into
96
+ */
97
+ function extractScopeAttributes(scope, target) {
98
+ var _a;
99
+ if (scope && typeof scope.getScopeData === 'function') {
100
+ const scopeAttrs = ((_a = scope === null || scope === void 0 ? void 0 : scope.getScopeData) === null || _a === void 0 ? void 0 : _a.call(scope).attributes) || {};
101
+ Object.keys(scopeAttrs).forEach(key => {
102
+ const value = scopeAttrs[key];
103
+ if (typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean') {
104
+ target[key] = value;
105
+ }
106
+ });
107
+ }
108
+ }
109
+ /**
110
+ * Collects attributes from all active scopes (global, isolation, and current).
111
+ * Only string, number, and boolean attribute values are supported.
112
+ * Attributes are merged in order of precedence: global < isolation < current.
113
+ *
114
+ * @returns A merged object containing all scope attributes.
115
+ */
116
+ function collectScopeAttributes() {
117
+ const attributes = {};
118
+ // Collect attributes from all scopes in order of precedence
119
+ extractScopeAttributes(getGlobalScope(), attributes);
120
+ extractScopeAttributes(getIsolationScope(), attributes);
121
+ extractScopeAttributes(getCurrentScope(), attributes);
122
+ return attributes;
123
+ }
84
124
  //# sourceMappingURL=logEnricherIntegration.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"logEnricherIntegration.js","sourceRoot":"","sources":["../../../src/js/integrations/logEnricherIntegration.ts"],"names":[],"mappings":";;;;;;;;;AAEA,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAErC,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAEpC,MAAM,gBAAgB,GAAG,aAAa,CAAC;AAEvC,MAAM,CAAC,MAAM,sBAAsB,GAAG,GAAgB,EAAE;IACtD,OAAO;QACL,IAAI,EAAE,gBAAgB;QACtB,KAAK,CAAC,MAAyB;YAC7B,MAAM,CAAC,EAAE,CAAC,WAAW,EAAE,GAAG,EAAE;gBAC1B,eAAe,EAAE,CAAC,IAAI,CACpB,GAAG,EAAE;oBACH,MAAM,CAAC,EAAE,CAAC,kBAAkB,EAAE,CAAC,GAAQ,EAAE,EAAE;wBACzC,UAAU,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;oBAC1B,CAAC,CAAC,CAAC;gBACL,CAAC,EACD,MAAM,CAAC,EAAE;oBACP,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;gBACpB,CAAC,CACF,CAAC;YACJ,CAAC,CAAC,C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C,EAAE,CAAC,CAAC;SACvF;QACD,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;;CAC1B;AAED,SAAS,UAAU,CAAC,GAAQ,EAAE,MAAyB;;IACrD,IAAI,WAAW,KAAK,SAAS,EAAE;QAC7B,OAAO;KACR;IAED,wCAAwC;IACxC,MAAM,aAAa,GAAG,MAAA,GAAG,CAAC,UAAU,mCAAI,EAAE,CAAC;IAE3C,qEAAqE;IACrE,eAAe,CAAC,aAAa,EAAE,cAAc,EAAE,WAAW,CAAC,KAAK,CAAC,CAAC;IAClE,eAAe,CAAC,aAAa,EAAE,cAAc,EAAE,WAAW,CAAC,KAAK,CAAC,CAAC;IAClE,eAAe,CAAC,aAAa,EAAE,eAAe,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IACpE,eAAe,CAAC,aAAa,EAAE,SAAS,EAAE,WAAW,CAAC,EAAE,CAAC,CAAC;IAC1D,eAAe,CAAC,aAAa,EAAE,YAAY,EAAE,WAAW,CAAC,OAAO,CAAC,CAAC;IAClE,eAAe,CAAC,aAAa,EAAE,gBAAgB,EAAE,WAAW,CAAC,OAAO,CAAC,CAAC;IAEtE,MAAM,MAAM,GAAG,MAAM,CAAC,oBAAoB,CAAqD,cAAc,CAAC,CAAC;IAC/G,eAAe,CAAC,aAAa,EAAE,kBAAkB,EAAE,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,WAAW,EAAE,CAAC,CAAC;IAE1E,qCAAqC;IACrC,GAAG,CAAC,UAAU,GAAG,aAAa,CAAC;AACjC,CAAC","sourcesContent":["/* eslint-disable complexity */\nimport type { Integration, Log } from '@sentry/core';\nimport { debug } from '@sentry/core';\nimport type { ReactNativeClient } from '../client';\nimport { NATIVE } from '../wrapper';\n\nconst INTEGRATION_NAME = 'LogEnricher';\n\nexport const logEnricherIntegration = (): Integration => {\n return {\n name: INTEGRATION_NAME,\n setup(client: ReactNativeClient) {\n client.on('afterInit', () => {\n cacheLogContext().then(\n () => {\n client.on('beforeCaptureLog', (log: Log) => {\n processLog(log, client);\n });\n },\n reason => {\n debug.log(reason);\n },\n );\n });\n },\n };\n};\n\nlet NativeCache: Record<string, unknown> | undefined = undefined;\n\n/**\n * Sets a log attribute if the value exists and the attribute key is not already present.\n *\n * @param logAttributes - The log attributes object to modify.\n * @param key - The attribute key to set.\n * @param value - The value to set (only sets if truthy and key not present).\n * @param setEvenIfPresent - Whether to set the attribute if it is present. Defaults to true.\n */\nfunction setLogAttribute(\n logAttributes: Record<string, unknown>,\n key: string,\n value: unknown,\n setEvenIfPresent = true,\n): void {\n if (value && (!logAttributes[key] || setEvenIfPresent)) {\n logAttributes[key] = value;\n }\n}\n\nasync function cacheLogContext(): Promise<void> {\n try {\n const response = await NATIVE.fetchNativeLogAttributes();\n\n NativeCache = {\n ...(response?.contexts?.device && {\n brand: response.contexts.device?.brand,\n model: response.contexts.device?.model,\n family: response.contexts.device?.family,\n }),\n ...(response?.contexts?.os && {\n os: response.contexts.os.name,\n version: response.contexts.os.version,\n }),\n ...(response?.contexts?.release && {\n release: response.contexts.release,\n }),\n };\n } catch (e) {\n return Promise.reject(`[LOGS]: Failed to prepare attributes from Native Layer: ${e}`);\n }\n return Promise.resolve();\n}\n\nfunction processLog(log: Log, client: ReactNativeClient): void {\n if (NativeCache === undefined) {\n return;\n }\n\n // Save log.attributes to a new variable\n const logAttributes = log.attributes ?? {};\n\n // Use setLogAttribute with the variable instead of direct assignment\n setLogAttribute(logAttributes, 'device.brand', NativeCache.brand);\n setLogAttribute(logAttributes, 'device.model', NativeCache.model);\n setLogAttribute(logAttributes, 'device.family', NativeCache.family);\n setLogAttribute(logAttributes, 'os.name', NativeCache.os);\n setLogAttribute(logAttributes, 'os.version', NativeCache.version);\n setLogAttribute(logAttributes, 'sentry.release', NativeCache.release);\n\n const replay = client.getIntegrationByName<Integration & { getReplayId: () => string | null }>('MobileReplay');\n setLogAttribute(logAttributes, 'sentry.replay_id', replay?.getReplayId());\n\n // Set log.attributes to the variable\n log.attributes = logAttributes;\n}\n"]}
1
+ {"version":3,"file":"logEnricherIntegration.js","sourceRoot":"","sources":["../../../src/js/integrations/logEnricherIntegration.ts"],"names":[],"mappings":";;;;;;;;;AAEA,OAAO,EAAE,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAEzF,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAEpC,MAAM,gBAAgB,GAAG,aAAa,CAAC;AAEvC,MAAM,CAAC,MAAM,sBAAsB,GAAG,GAAgB,EAAE;IACtD,OAAO;QACL,IAAI,EAAE,gBAAgB;QACtB,KAAK,CAAC,MAAyB;YAC7B,MAAM,CAAC,EAAE,CAAC,WAAW,EAAE,GAAG,EAAE;gBAC1B,eAAe,EAAE,CAAC,IAAI,CACpB,GAAG,EAAE;oBACH,MAAM,CAAC,EAAE,CAAC,kBAAkB,EAAE,CAAC,GAAQ,EAAE,EAAE;wBACzC,UAAU,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;oBAC1B,CAAC,CAAC,CAAC;gBACL,CAAC,EACD,MAAM,CAAC,EAAE;oBACP,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;gBACpB,CAAC,CACF,CAAC;YACJ,CAAC,CAAC,CAAC;QACL,CAAC;KACF,CAAC;AACJ,CAAC,CAAC;AAEF,IAAI,WAAW,GAAwC,SAAS,CAAC;AAEjE;;;;;;;GAOG;AACH,SAAS,eAAe,CACtB,aAAsC,EACtC,GAAW,EACX,KAAc,EACd,gBAAgB,GAAG,IAAI;IAEvB,IAAI,KAAK,IAAI,IAAI,IAAI,CAAC,CAAC,aAAa,CAAC,GAAG,CAAC,IAAI,gBAAgB,CAAC,EAAE;QAC9D,aAAa,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;KAC5B;AACH,CAAC;AAED,SAAe,eAAe;;;QAC5B,IAAI;YACF,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,wBAAwB,EAAE,CAAC;YAEzD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AAQ,IAAI,OAAO,KAAK,KAAK,SAAS,EAAE;gBACxF,MAAM,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;aACrB;QACH,CAAC,CAAC,CAAC;KACJ;AACH,CAAC;AAED;;;;;;GAMG;AACH,SAAS,sBAAsB;IAC7B,MAAM,UAAU,GAA8C,EAAE,CAAC;IAEjE,4DAA4D;IAC5D,sBAAsB,CAAC,cAAc,EAAE,EAAE,UAAU,CAAC,CAAC;IACrD,sBAAsB,CAAC,iBAAiB,EAAE,EAAE,UAAU,CAAC,CAAC;IACxD,sBAAsB,CAAC,eAAe,EAAE,EAAE,UAAU,CAAC,CAAC;IAEtD,OAAO,UAAU,CAAC;AACpB,CAAC","sourcesContent":["/* eslint-disable complexity */\nimport type { Integration, Log } from '@sentry/core';\nimport { debug, getCurrentScope, getGlobalScope, getIsolationScope } from '@sentry/core';\nimport type { ReactNativeClient } from '../client';\nimport { NATIVE } from '../wrapper';\n\nconst INTEGRATION_NAME = 'LogEnricher';\n\nexport const logEnricherIntegration = (): Integration => {\n return {\n name: INTEGRATION_NAME,\n setup(client: ReactNativeClient) {\n client.on('afterInit', () => {\n cacheLogContext().then(\n () => {\n client.on('beforeCaptureLog', (log: Log) => {\n processLog(log, client);\n });\n },\n reason => {\n debug.log(reason);\n },\n );\n });\n },\n };\n};\n\nlet NativeCache: Record<string, unknown> | undefined = undefined;\n\n/**\n * Sets a log attribute if the value exists and the attribute key is not already present.\n *\n * @param logAttributes - The log attributes object to modify.\n * @param key - The attribute key to set.\n * @param value - The value to set (only sets if not null/undefined and key not present).\n * @param setEvenIfPresent - Whether to set the attribute if it is present. Defaults to true.\n */\nfunction setLogAttribute(\n logAttributes: Record<string, unknown>,\n key: string,\n value: unknown,\n setEvenIfPresent = true,\n): void {\n if (value != null && (!logAttributes[key] || setEvenIfPresent)) {\n logAttributes[key] = value;\n }\n}\n\nasync function cacheLogContext(): Promise<void> {\n try {\n const response = await NATIVE.fetchNativeLogAttributes();\n\n NativeCache = {\n ...(response?.contexts?.device && {\n brand: response.contexts.device?.brand,\n model: response.contexts.device?.model,\n family: response.contexts.device?.family,\n }),\n ...(response?.contexts?.os && {\n os: response.contexts.os.name,\n version: response.contexts.os.version,\n }),\n ...(response?.contexts?.release && {\n release: response.contexts.release,\n }),\n };\n } catch (e) {\n return Promise.reject(`[LOGS]: Failed to prepare attributes from Native Layer: ${e}`);\n }\n return Promise.resolve();\n}\n\nfunction processLog(log: Log, client: ReactNativeClient): void {\n if (NativeCache === undefined) {\n return;\n }\n\n // Save log.attributes to a new variable\n const logAttributes = log.attributes ?? {};\n\n // Apply scope attributes from all active scopes (global, isolation, and current)\n // These are applied first so they can be overridden by more specific attributes\n const scopeAttributes = collectScopeAttributes();\n Object.keys(scopeAttributes).forEach((key: string) => {\n setLogAttribute(logAttributes, key, scopeAttributes[key], false);\n });\n\n // Use setLogAttribute with the variable instead of direct assignment\n setLogAttribute(logAttributes, 'device.brand', NativeCache.brand);\n setLogAttribute(logAttributes, 'device.model', NativeCache.model);\n setLogAttribute(logAttributes, 'device.family', NativeCache.family);\n setLogAttribute(logAttributes, 'os.name', NativeCache.os);\n setLogAttribute(logAttributes, 'os.version', NativeCache.version);\n setLogAttribute(logAttributes, 'sentry.release', NativeCache.release);\n\n const replay = client.getIntegrationByName<Integration & { getReplayId: () => string | null }>('MobileReplay');\n setLogAttribute(logAttributes, 'sentry.replay_id', replay?.getReplayId());\n\n // Set log.attributes to the variable\n log.attributes = logAttributes;\n}\n\n/**\n * Extracts primitive attributes from a scope and merges them into the target object.\n * Only string, number, and boolean attribute values are included.\n *\n * @param scope - The scope to extract attributes from\n * @param target - The target object to merge attributes into\n */\nfunction extractScopeAttributes(\n scope: ReturnType<typeof getCurrentScope>,\n target: Record<string, string | number | boolean>,\n): void {\n if (scope && typeof scope.getScopeData === 'function') {\n const scopeAttrs = scope?.getScopeData?.().attributes || {};\n Object.keys(scopeAttrs).forEach(key => {\n const value = scopeAttrs[key];\n if (typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean') {\n target[key] = value;\n }\n });\n }\n}\n\n/**\n * Collects attributes from all active scopes (global, isolation, and current).\n * Only string, number, and boolean attribute values are supported.\n * Attributes are merged in order of precedence: global < isolation < current.\n *\n * @returns A merged object containing all scope attributes.\n */\nfunction collectScopeAttributes(): Record<string, string | number | boolean> {\n const attributes: Record<string, string | number | boolean> = {};\n\n // Collect attributes from all scopes in order of precedence\n extractScopeAttributes(getGlobalScope(), attributes);\n extractScopeAttributes(getIsolationScope(), attributes);\n extractScopeAttributes(getCurrentScope(), attributes);\n\n return attributes;\n}\n"]}
@@ -66,32 +66,6 @@ export interface MobileReplayOptions {
66
66
  * @platform ios
67
67
  */
68
68
  enableFastViewRendering?: boolean;
69
- /**
70
- * Array of view class names to include in subtree traversal during session replay and screenshot capture on iOS.
71
- *
72
- * Only views that are instances of these classes (or subclasses) will be traversed.
73
- * This helps prevent crashes when traversing problematic view hierarchies by allowing you to explicitly include only safe view classes.
74
- *
75
- * If both `includedViewClasses` and `excludedViewClasses` are set, `excludedViewClasses` takes precedence:
76
- * views matching excluded classes won't be traversed even if they match an included class.
77
- *
78
- * @default undefined
79
- * @platform ios
80
- */
81
- includedViewClasses?: string[];
82
- /**
83
- * Array of view class names to exclude from subtree traversal during session replay and screenshot capture on iOS.
84
- *
85
- * Views of these classes (or subclasses) will be skipped entirely, including all their children.
86
- * This helps prevent crashes when traversing problematic view hierarchies by allowing you to explicitly exclude problematic view classes.
87
- *
88
- * If both `includedViewClasses` and `excludedViewClasses` are set, `excludedViewClasses` takes precedence:
89
- * views matching excluded classes won't be traversed even if they match an included class.
90
- *
91
- * @default undefined
92
- * @platform ios
93
- */
94
- excludedViewClasses?: string[];
95
69
  /**
96
70
  * Sets the screenshot strategy used by the Session Replay integration on Android.
97
71
  *
@@ -1 +1 @@
1
- {"version":3,"file":"mobilereplay.d.ts","sourceRoot":"","sources":["../../../src/js/replay/mobilereplay.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAk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C,EAAE,CAAC,eAAe,EAAE,CAAC,MAAc,EAAE,EAAE;YAC5C,gEAAgE;YAChE,MAAM,eAAe,GAAG,iBAAiB,EAAE,CAAC;YAC5C,IAAI,eAAe,EAAE;gBACnB,MAAM,CAAC,UAAU,GAAG,MAAM,CAAC,UAAU,IAAI,EAAE,CAAC;gBAC5C,MAAM,CAAC,UAAU,CAAC,SAAS,GAAG,eAAe,CAAC;aAC/C;QACH,CAAC,CAAC,CAAC;QAEH,MAAM,CAAC,EAAE,CAAC,qBAAqB,EAAE,mCAAmC,CAAC,CAAC;IACxE,CAAC;IAED,SAAS,WAAW;QAClB,OAAO,iBAAiB,EAAE,CAAC;IAC7B,CAAC;IAED,iHAAiH;IACjH,8GAA8G;IAC9G,OAAO;QACL,IAAI,EAAE,8BAA8B;QACpC,KAAK;QACL,YAAY;QACZ,OAAO,EAAE,OAAO;QAChB,WAAW,EAAE,WAAW;KACzB,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,2BAA2B,GAAG,GAA4B,EAAE;IAChE,OAAO;QACL,IAAI,EAAE,8BAA8B;QACpC,OAAO,EAAE,cAAc;QACvB,WAAW,EAAE,GAAG,EAAE,CAAC,IAAI,EAAE,uCAAuC;KACjE,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import type { Client, DynamicSamplingContext, Event, EventHint, Integration, Metric } from '@sentry/core';\nimport { debug } from '@sentry/core';\nimport { isHardCrash } from '../misc';\nimport { hasHooks } from '../utils/clientutils';\nimport { isExpoGo, notMobileOs } from '../utils/environment';\nimport { NATIVE } from '../wrapper';\nimport { enrichXhrBreadcrumbsForMobileReplay } from './xhrUtils';\n\nexport const MOBILE_REPLAY_INTEGRATION_NAME = 'MobileReplay';\n\n/**\n * Screenshot strategy type for Android Session Replay.\n *\n * - `'canvas'`: Canvas-based screenshot strategy. This strategy does **not** support any masking options, it always masks text and images. Use this if your application has strict PII requirements.\n * - `'pixelCopy'`: Pixel copy screenshot strategy (default). Supports all masking options.\n */\nexport type ScreenshotStrategy = 'canvas' | 'pixelCopy';\n\nexport interface MobileReplayOptions {\n /**\n * Mask all text in recordings\n *\n * @default true\n */\n maskAllText?: boolean;\n\n /**\n * Mask all images in recordings\n *\n * @default true\n */\n maskAllImages?: boolean;\n\n /**\n * Mask all vector graphics in recordings\n * Supports `react-native-svg`\n *\n * @default true\n */\n maskAllVectors?: boolean;\n\n /**\n * Enables the up to 5x faster experimental view renderer used by the Session Replay integration on iOS.\n *\n * Enabling this flag will reduce the amount of time it takes to render each frame of the session replay on the main thread, therefore reducing\n * interruptions and visual lag.\n *\n * - Experiment: This is an experimental feature and is therefore disabled by default.\n *\n * @deprecated Use `enableViewRendererV2` instead.\n * @platform ios\n */\n enableExperimentalViewRenderer?: boolean;\n\n /**\n * Enables up to 5x faster new view renderer used by the Session Replay integration on iOS.\n *\n * Enabling this flag will reduce the amount of time it takes to render each frame of the session replay on the main thread, therefore reducing\n * interruptions and visual lag. [Our benchmarks](https://github.com/getsentry/sentry-cocoa/pull/4940) have shown a significant improvement of\n * **up to 4-5x faster rendering** (reducing `~160ms` to `~36ms` per frame) on older devices.\n *\n * - Experiment: In case you are noticing issues with the new view renderer, please report the issue on [GitHub](https://github.com/getsentry/sentry-cocoa).\n * Eventually, we will remove this feature flag and use the new view renderer by default.\n *\n * @default true\n * @platform ios\n */\n enableViewRendererV2?: boolean;\n\n /**\n * Enables up to 5x faster but incomplete view rendering used by the Session Replay integration on iOS.\n *\n * Enabling this flag will reduce the amount of time it takes to render each frame of the session replay on the main thread, therefore reducing\n * interruptions and visual lag.\n *\n * - Note: This flag can only be used together with `enableExperimentalViewRenderer` with up to 20% faster render times.\n * - Experiment: This is an experimental feature and is therefore disabled by default.\n *\n * @default false\n * @platform ios\n */\n enableFastViewRendering?: boolean;\n\n /**\n * Array of view class names to include in subtree traversal during session replay and screenshot capture on iOS.\n *\n * Only views that are instances of these classes (or subclasses) will be traversed.\n * This helps prevent crashes when traversing problematic view hierarchies by allowing you to explicitly include only safe view classes.\n *\n * If both `includedViewClasses` and `excludedViewClasses` are set, `excludedViewClasses` takes precedence:\n * views matching excluded classes won't be traversed even if they match an included class.\n *\n * @default undefined\n * @platform ios\n */\n includedViewClasses?: string[];\n\n /**\n * Array of view class names to exclude from subtree traversal during session replay and screenshot capture on iOS.\n *\n * Views of these classes (or subclasses) will be skipped entirely, including all their children.\n * This helps prevent crashes when traversing problematic view hierarchies by allowing you to explicitly exclude problematic view classes.\n *\n * If both `includedViewClasses` and `excludedViewClasses` are set, `excludedViewClasses` takes precedence:\n * views matching excluded classes won't be traversed even if they match an included class.\n *\n * @default undefined\n * @platform ios\n */\n excludedViewClasses?: string[];\n\n /**\n * Sets the screenshot strategy used by the Session Replay integration on Android.\n *\n * If your application has strict PII requirements we recommend using `'canvas'`.\n * This strategy does **not** support any masking options, it always masks text and images.\n *\n * - Experiment: In case you are noticing issues with the canvas screenshot strategy, please report the issue on [GitHub](https://github.com/getsentry/sentry-java).\n *\n * @default 'pixelCopy'\n * @platform android\n */\n screenshotStrategy?: ScreenshotStrategy;\n\n /**\n * Callback to determine if a replay should be captured for a specific error.\n * When this callback returns `false`, no replay will be captured for the error.\n * This callback is only called when an error occurs and `replaysOnErrorSampleRate` is set.\n *\n * @param event The error event\n * @param hint Additional event information\n * @returns `false` to skip capturing a replay for this error, `true` or `undefined` to proceed with sampling\n */\n beforeErrorSampling?: (event: Event, hint: EventHint) => boolean;\n}\n\nconst defaultOptions: MobileReplayOptions = {\n maskAllText: true,\n maskAllImages: true,\n maskAllVectors: true,\n enableExperimentalViewRenderer: false,\n enableViewRendererV2: true,\n enableFastViewRendering: false,\n screenshotStrategy: 'pixelCopy',\n};\n\nfunction mergeOptions(initOptions: Partial<MobileReplayOptions>): MobileReplayOptions {\n const merged = {\n ...defaultOptions,\n ...initOptions,\n };\n\n if (initOptions.enableViewRendererV2 === undefined && initOptions.enableExperimentalViewRenderer !== undefined) {\n merged.enableViewRendererV2 = initOptions.enableExperimentalViewRenderer;\n }\n\n return merged;\n}\n\ntype MobileReplayIntegration = Integration & {\n options: MobileReplayOptions;\n getReplayId: () => string | null;\n};\n\n/**\n * The Mobile Replay Integration, let's you adjust the default mobile replay options.\n * To be passed to `Sentry.init` with `replaysOnErrorSampleRate` or `replaysSessionSampleRate`.\n *\n * ```javascript\n * Sentry.init({\n * replaysOnErrorSampleRate: 1.0,\n * replaysSessionSampleRate: 1.0,\n * integrations: [mobileReplayIntegration({\n * // Adjust the default options\n * })],\n * });\n * ```\n *\n * @experimental\n */\nexport const mobileReplayIntegration = (initOptions: MobileReplayOptions = defaultOptions): MobileReplayIntegration => {\n if (isExpoGo()) {\n debug.warn(\n `[Sentry] ${MOBILE_REPLAY_INTEGRATION_NAME} is not supported in Expo Go. Use EAS Build or \\`expo prebuild\\` to enable it.`,\n );\n }\n if (notMobileOs()) {\n debug.warn(`[Sentry] ${MOBILE_REPLAY_INTEGRATION_NAME} is not supported on this platform.`);\n }\n\n if (isExpoGo() || notMobileOs()) {\n return mobileReplayIntegrationNoop();\n }\n\n const options = mergeOptions(initOptions);\n\n // Cache the replay ID in JavaScript to avoid excessive bridge calls\n // This will be updated when we know the replay ID changes (e.g., after captureReplay)\n let cachedReplayId: string | null = null;\n\n function updateCachedReplayId(replayId: string | null): void {\n cachedReplayId = replayId;\n }\n\n function getCachedReplayId(): string | null {\n if (cachedReplayId !== null) {\n return cachedReplayId;\n }\n const nativeReplayId = NATIVE.getCurrentReplayId();\n if (nativeReplayId) {\n cachedReplayId = nativeReplayId;\n }\n return nativeReplayId;\n }\n\n async function processEvent(event: Event, hint: EventHint): Promise<Event> {\n const hasException = event.exception?.values && event.exception.values.length > 0;\n if (!hasException) {\n // Event is not an error, will not capture replay\n return event;\n }\n\n // Check if beforeErrorSampling callback filters out this error\n if (initOptions.beforeErrorSampling) {\n try {\n if (initOptions.beforeErrorSampling(event, hint) === false) {\n debug.log(\n `[Sentry] ${MOBILE_REPLAY_INTEGRATION_NAME} not sent; beforeErrorSampling conditions not met for event ${event.event_id}.`,\n );\n return event;\n }\n } catch (error) {\n debug.error(\n `[Sentry] ${MOBILE_REPLAY_INTEGRATION_NAME} beforeErrorSampling callback threw an error, proceeding with replay capture`,\n error,\n );\n // Continue with replay capture if callback throws\n }\n }\n\n const replayId = await NATIVE.captureReplay(isHardCrash(event));\n if (replayId) {\n updateCachedReplayId(replayId);\n debug.log(\n `[Sentry] ${MOBILE_REPLAY_INTEGRATION_NAME} Captured recording replay ${replayId} for event ${event.event_id}.`,\n );\n // Add replay_id to error event contexts to link replays to events/traces\n event.contexts = event.contexts || {};\n event.contexts.replay = {\n ...event.contexts.replay,\n replay_id: replayId,\n };\n } else {\n // Check if there's an ongoing recording and update cache if found\n const recordingReplayId = NATIVE.getCurrentReplayId();\n if (recordingReplayId) {\n updateCachedReplayId(recordingReplayId);\n debug.log(\n `[Sentry] ${MOBILE_REPLAY_INTEGRATION_NAME} assign already recording replay ${recordingReplayId} for event ${event.event_id}.`,\n );\n // Add replay_id to error event contexts to link replays to events/traces\n event.contexts = event.contexts || {};\n event.contexts.replay = {\n ...event.contexts.replay,\n replay_id: recordingReplayId,\n };\n } else {\n updateCachedReplayId(null);\n debug.log(`[Sentry] ${MOBILE_REPLAY_INTEGRATION_NAME} not sampled for event ${event.event_id}.`);\n }\n }\n\n return event;\n }\n\n function setup(client: Client): void {\n if (!hasHooks(client)) {\n return;\n }\n\n // Initialize the cached replay ID on setup\n cachedReplayId = NATIVE.getCurrentReplayId();\n\n client.on('createDsc', (dsc: DynamicSamplingContext) => {\n if (dsc.replay_id) {\n return;\n }\n\n // Use cached replay ID to avoid bridge calls\n const currentReplayId = getCachedReplayId();\n if (currentReplayId) {\n dsc.replay_id = currentReplayId;\n }\n });\n\n client.on('processMetric', (metric: Metric) => {\n // Add replay_id to metric attributes to link metrics to replays\n const currentReplayId = getCachedReplayId();\n if (currentReplayId) {\n metric.attributes = metric.attributes || {};\n metric.attributes.replay_id = currentReplayId;\n }\n });\n\n client.on('beforeAddBreadcrumb', enrichXhrBreadcrumbsForMobileReplay);\n }\n\n function getReplayId(): string | null {\n return getCachedReplayId();\n }\n\n // TODO: When adding manual API, ensure overlap with the web replay so users can use the same API interchangeably\n // https://github.com/getsentry/sentry-javascript/blob/develop/packages/replay-internal/src/integration.ts#L45\n return {\n name: MOBILE_REPLAY_INTEGRATION_NAME,\n setup,\n processEvent,\n options: options,\n getReplayId: getReplayId,\n };\n};\n\nconst mobileReplayIntegrationNoop = (): MobileReplayIntegration => {\n return {\n name: MOBILE_REPLAY_INTEGRATION_NAME,\n options: defaultOptions,\n getReplayId: () => null, // Mock implementation for noop version\n };\n};\n"]}
1
+ {"version":3,"file":"mobilereplay.js","sourceRoot":"","sources":["../../../src/js/replay/mobilereplay.ts"],"names":[],"mappings":";;;;;;;;;AACA,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AACrC,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AACtC,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,mCAAmC,EAAE,MAAM,YAAY,CAAC;AAEjE,MAAM,CAAC,MAAM,8BAA8B,GAAG,cAAc,CAAC;AAoG7D,MAAM,cAAc,GAAwB;IAC1C,WAAW,EAAE,IAAI;IACjB,aAAa,EAAE,IAAI;IACnB,cAAc,EAAE,IAAI;IACpB,8BAA8B,EAAE,KAAK;IACrC,oBAAoB,EAAE,IAAI;IAC1B,uBAAuB,EAAE,KAAK;IAC9B,kBAAkB,EAAE,WAAW;CAChC,CAAC;AAEF,SAAS,YAAY,CAAC,WAAyC;IAC7D,MAAM,MAAM,mCACP,cAAc,GACd,WAAW,CACf,CAAC;IAEF,IAAI,WAAW,CAAC,oBAAoB,KAAK,SAAS,IAAI,WAAW,CAAC,8BAA8B,KAAK,SAAS,EAAE;QAC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EAAE,WAAW;KACzB,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,2BAA2B,GAAG,GAA4B,EAAE;IAChE,OAAO;QACL,IAAI,EAAE,8BAA8B;QACpC,OAAO,EAAE,cAAc;QACvB,WAAW,EAAE,GAAG,EAAE,CAAC,IAAI,EAAE,uCAAuC;KACjE,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import type { Client, DynamicSamplingContext, Event, EventHint, Integration, Metric } from '@sentry/core';\nimport { debug } from '@sentry/core';\nimport { isHardCrash } from '../misc';\nimport { hasHooks } from '../utils/clientutils';\nimport { isExpoGo, notMobileOs } from '../utils/environment';\nimport { NATIVE } from '../wrapper';\nimport { enrichXhrBreadcrumbsForMobileReplay } from './xhrUtils';\n\nexport const MOBILE_REPLAY_INTEGRATION_NAME = 'MobileReplay';\n\n/**\n * Screenshot strategy type for Android Session Replay.\n *\n * - `'canvas'`: Canvas-based screenshot strategy. This strategy does **not** support any masking options, it always masks text and images. Use this if your application has strict PII requirements.\n * - `'pixelCopy'`: Pixel copy screenshot strategy (default). Supports all masking options.\n */\nexport type ScreenshotStrategy = 'canvas' | 'pixelCopy';\n\nexport interface MobileReplayOptions {\n /**\n * Mask all text in recordings\n *\n * @default true\n */\n maskAllText?: boolean;\n\n /**\n * Mask all images in recordings\n *\n * @default true\n */\n maskAllImages?: boolean;\n\n /**\n * Mask all vector graphics in recordings\n * Supports `react-native-svg`\n *\n * @default true\n */\n maskAllVectors?: boolean;\n\n /**\n * Enables the up to 5x faster experimental view renderer used by the Session Replay integration on iOS.\n *\n * Enabling this flag will reduce the amount of time it takes to render each frame of the session replay on the main thread, therefore reducing\n * interruptions and visual lag.\n *\n * - Experiment: This is an experimental feature and is therefore disabled by default.\n *\n * @deprecated Use `enableViewRendererV2` instead.\n * @platform ios\n */\n enableExperimentalViewRenderer?: boolean;\n\n /**\n * Enables up to 5x faster new view renderer used by the Session Replay integration on iOS.\n *\n * Enabling this flag will reduce the amount of time it takes to render each frame of the session replay on the main thread, therefore reducing\n * interruptions and visual lag. [Our benchmarks](https://github.com/getsentry/sentry-cocoa/pull/4940) have shown a significant improvement of\n * **up to 4-5x faster rendering** (reducing `~160ms` to `~36ms` per frame) on older devices.\n *\n * - Experiment: In case you are noticing issues with the new view renderer, please report the issue on [GitHub](https://github.com/getsentry/sentry-cocoa).\n * Eventually, we will remove this feature flag and use the new view renderer by default.\n *\n * @default true\n * @platform ios\n */\n enableViewRendererV2?: boolean;\n\n /**\n * Enables up to 5x faster but incomplete view rendering used by the Session Replay integration on iOS.\n *\n * Enabling this flag will reduce the amount of time it takes to render each frame of the session replay on the main thread, therefore reducing\n * interruptions and visual lag.\n *\n * - Note: This flag can only be used together with `enableExperimentalViewRenderer` with up to 20% faster render times.\n * - Experiment: This is an experimental feature and is therefore disabled by default.\n *\n * @default false\n * @platform ios\n */\n enableFastViewRendering?: boolean;\n\n /**\n * Sets the screenshot strategy used by the Session Replay integration on Android.\n *\n * If your application has strict PII requirements we recommend using `'canvas'`.\n * This strategy does **not** support any masking options, it always masks text and images.\n *\n * - Experiment: In case you are noticing issues with the canvas screenshot strategy, please report the issue on [GitHub](https://github.com/getsentry/sentry-java).\n *\n * @default 'pixelCopy'\n * @platform android\n */\n screenshotStrategy?: ScreenshotStrategy;\n\n /**\n * Callback to determine if a replay should be captured for a specific error.\n * When this callback returns `false`, no replay will be captured for the error.\n * This callback is only called when an error occurs and `replaysOnErrorSampleRate` is set.\n *\n * @param event The error event\n * @param hint Additional event information\n * @returns `false` to skip capturing a replay for this error, `true` or `undefined` to proceed with sampling\n */\n beforeErrorSampling?: (event: Event, hint: EventHint) => boolean;\n}\n\nconst defaultOptions: MobileReplayOptions = {\n maskAllText: true,\n maskAllImages: true,\n maskAllVectors: true,\n enableExperimentalViewRenderer: false,\n enableViewRendererV2: true,\n enableFastViewRendering: false,\n screenshotStrategy: 'pixelCopy',\n};\n\nfunction mergeOptions(initOptions: Partial<MobileReplayOptions>): MobileReplayOptions {\n const merged = {\n ...defaultOptions,\n ...initOptions,\n };\n\n if (initOptions.enableViewRendererV2 === undefined && initOptions.enableExperimentalViewRenderer !== undefined) {\n merged.enableViewRendererV2 = initOptions.enableExperimentalViewRenderer;\n }\n\n return merged;\n}\n\ntype MobileReplayIntegration = Integration & {\n options: MobileReplayOptions;\n getReplayId: () => string | null;\n};\n\n/**\n * The Mobile Replay Integration, let's you adjust the default mobile replay options.\n * To be passed to `Sentry.init` with `replaysOnErrorSampleRate` or `replaysSessionSampleRate`.\n *\n * ```javascript\n * Sentry.init({\n * replaysOnErrorSampleRate: 1.0,\n * replaysSessionSampleRate: 1.0,\n * integrations: [mobileReplayIntegration({\n * // Adjust the default options\n * })],\n * });\n * ```\n *\n * @experimental\n */\nexport const mobileReplayIntegration = (initOptions: MobileReplayOptions = defaultOptions): MobileReplayIntegration => {\n if (isExpoGo()) {\n debug.warn(\n `[Sentry] ${MOBILE_REPLAY_INTEGRATION_NAME} is not supported in Expo Go. Use EAS Build or \\`expo prebuild\\` to enable it.`,\n );\n }\n if (notMobileOs()) {\n debug.warn(`[Sentry] ${MOBILE_REPLAY_INTEGRATION_NAME} is not supported on this platform.`);\n }\n\n if (isExpoGo() || notMobileOs()) {\n return mobileReplayIntegrationNoop();\n }\n\n const options = mergeOptions(initOptions);\n\n // Cache the replay ID in JavaScript to avoid excessive bridge calls\n // This will be updated when we know the replay ID changes (e.g., after captureReplay)\n let cachedReplayId: string | null = null;\n\n function updateCachedReplayId(replayId: string | null): void {\n cachedReplayId = replayId;\n }\n\n function getCachedReplayId(): string | null {\n if (cachedReplayId !== null) {\n return cachedReplayId;\n }\n const nativeReplayId = NATIVE.getCurrentReplayId();\n if (nativeReplayId) {\n cachedReplayId = nativeReplayId;\n }\n return nativeReplayId;\n }\n\n async function processEvent(event: Event, hint: EventHint): Promise<Event> {\n const hasException = event.exception?.values && event.exception.values.length > 0;\n if (!hasException) {\n // Event is not an error, will not capture replay\n return event;\n }\n\n // Check if beforeErrorSampling callback filters out this error\n if (initOptions.beforeErrorSampling) {\n try {\n if (initOptions.beforeErrorSampling(event, hint) === false) {\n debug.log(\n `[Sentry] ${MOBILE_REPLAY_INTEGRATION_NAME} not sent; beforeErrorSampling conditions not met for event ${event.event_id}.`,\n );\n return event;\n }\n } catch (error) {\n debug.error(\n `[Sentry] ${MOBILE_REPLAY_INTEGRATION_NAME} beforeErrorSampling callback threw an error, proceeding with replay capture`,\n error,\n );\n // Continue with replay capture if callback throws\n }\n }\n\n const replayId = await NATIVE.captureReplay(isHardCrash(event));\n if (replayId) {\n updateCachedReplayId(replayId);\n debug.log(\n `[Sentry] ${MOBILE_REPLAY_INTEGRATION_NAME} Captured recording replay ${replayId} for event ${event.event_id}.`,\n );\n // Add replay_id to error event contexts to link replays to events/traces\n event.contexts = event.contexts || {};\n event.contexts.replay = {\n ...event.contexts.replay,\n replay_id: replayId,\n };\n } else {\n // Check if there's an ongoing recording and update cache if found\n const recordingReplayId = NATIVE.getCurrentReplayId();\n if (recordingReplayId) {\n updateCachedReplayId(recordingReplayId);\n debug.log(\n `[Sentry] ${MOBILE_REPLAY_INTEGRATION_NAME} assign already recording replay ${recordingReplayId} for event ${event.event_id}.`,\n );\n // Add replay_id to error event contexts to link replays to events/traces\n event.contexts = event.contexts || {};\n event.contexts.replay = {\n ...event.contexts.replay,\n replay_id: recordingReplayId,\n };\n } else {\n updateCachedReplayId(null);\n debug.log(`[Sentry] ${MOBILE_REPLAY_INTEGRATION_NAME} not sampled for event ${event.event_id}.`);\n }\n }\n\n return event;\n }\n\n function setup(client: Client): void {\n if (!hasHooks(client)) {\n return;\n }\n\n // Initialize the cached replay ID on setup\n cachedReplayId = NATIVE.getCurrentReplayId();\n\n client.on('createDsc', (dsc: DynamicSamplingContext) => {\n if (dsc.replay_id) {\n return;\n }\n\n // Use cached replay ID to avoid bridge calls\n const currentReplayId = getCachedReplayId();\n if (currentReplayId) {\n dsc.replay_id = currentReplayId;\n }\n });\n\n client.on('processMetric', (metric: Metric) => {\n // Add replay_id to metric attributes to link metrics to replays\n const currentReplayId = getCachedReplayId();\n if (currentReplayId) {\n metric.attributes = metric.attributes || {};\n metric.attributes.replay_id = currentReplayId;\n }\n });\n\n client.on('beforeAddBreadcrumb', enrichXhrBreadcrumbsForMobileReplay);\n }\n\n function getReplayId(): string | null {\n return getCachedReplayId();\n }\n\n // TODO: When adding manual API, ensure overlap with the web replay so users can use the same API interchangeably\n // https://github.com/getsentry/sentry-javascript/blob/develop/packages/replay-internal/src/integration.ts#L45\n return {\n name: MOBILE_REPLAY_INTEGRATION_NAME,\n setup,\n processEvent,\n options: options,\n getReplayId: getReplayId,\n };\n};\n\nconst mobileReplayIntegrationNoop = (): MobileReplayIntegration => {\n return {\n name: MOBILE_REPLAY_INTEGRATION_NAME,\n options: defaultOptions,\n getReplayId: () => null, // Mock implementation for noop version\n };\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"scopeSync.d.ts","sourceRoot":"","sources":["../../src/js/scopeSync.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAc,KAAK,EAAE,MAAM,cAAc,CAAC;AAatD;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI,CAiErD"}
1
+ {"version":3,"file":"scopeSync.d.ts","sourceRoot":"","sources":["../../src/js/scopeSync.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAc,KAAK,EAAE,MAAM,cAAc,CAAC;AAatD;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI,CAyFrD"}
@@ -62,5 +62,26 @@ export function enableSyncToNative(scope) {
62
62
  NATIVE.setContext(key, context);
63
63
  return original.call(scope, key, context);
64
64
  });
65
+ fillTyped(scope, 'setAttribute', original => (key, value) => {
66
+ // Only sync primitive types
67
+ if (typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean') {
68
+ NATIVE.setAttribute(key, value);
69
+ }
70
+ return original.call(scope, key, value);
71
+ });
72
+ fillTyped(scope, 'setAttributes', original => (attributes) => {
73
+ // Filter to only primitive types
74
+ const primitiveAttrs = {};
75
+ Object.keys(attributes).forEach(key => {
76
+ const value = attributes[key];
77
+ if (typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean') {
78
+ primitiveAttrs[key] = value;
79
+ }
80
+ });
81
+ if (Object.keys(primitiveAttrs).length > 0) {
82
+ NATIVE.setAttributes(primitiveAttrs);
83
+ }
84
+ return original.call(scope, attributes);
85
+ });
65
86
  }
66
87
  //# sourceMappingURL=scopeSync.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"scopeSync.js","sourceRoot":"","sources":["../../src/js/scopeSync.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACvC,OAAO,EAAE,wBAAwB,EAAE,MAAM,cAAc,CAAC;AACxD,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,yBAAyB,EAAE,MAAM,mBAAmB,CAAC;AAC9D,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAEnC;;;GAGG;AACH,MAAM,iBAAiB,GAAG,IAAI,OAAO,EAAe,CAAC;AAErD;;GAEG;AACH,MAAM,UAAU,kBAAkB,CAAC,KAAY;IAC7C,IAAI,iBAAiB,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE;QAChC,OAAO;KACR;IACD,iBAAiB,CAAC,GAAG,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;IAEnC,SAAS,CAAC,KAAK,EAAE,SAAS,EAAE,QAAQ,CAAC,EAAE,CAAC,CAAC,IAAI,EAAS,EAAE;QACtD,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QACrB,OAAO,QAAQ,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;IACpC,CAAC,CAAC,CAAC;IAEH,SAAS,CAAC,KAAK,EAAE,QAAQ,EAAE,QAAQ,CAAC,EAAE,CAAC,CAAC,GAAG,EAAE,KAAK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AULT_BREADCRUMB_LEVEL } from './breadcrumb';\nimport { fillTyped } from './utils/fill';\nimport { convertToNormalizedObject } from './utils/normalize';\nimport { NATIVE } from './wrapper';\n\n/**\n * This WeakMap is used to keep track of which scopes have been synced to the native SDKs.\n * This ensures that we don't double sync the same scope.\n */\nconst syncedToNativeMap = new WeakMap<Scope, true>();\n\n/**\n * Hooks into the scope set methods and sync new data added to the given scope with the native SDKs.\n */\nexport function enableSyncToNative(scope: Scope): void {\n if (syncedToNativeMap.has(scope)) {\n return;\n }\n syncedToNativeMap.set(scope, true);\n\n fillTyped(scope, 'setUser', original => (user): Scope => {\n NATIVE.setUser(user);\n return original.call(scope, user);\n });\n\n fillTyped(scope, 'setTag', original => (key, value): Scope => {\n NATIVE.setTag(key, NATIVE.primitiveProcessor(value));\n return original.call(scope, key, value);\n });\n\n fillTyped(scope, 'setTags', original => (tags): Scope => {\n // As native only has setTag, we just loop through each tag key.\n Object.keys(tags).forEach(key => {\n NATIVE.setTag(key, NATIVE.primitiveProcessor(tags[key]));\n });\n return original.call(scope, tags);\n });\n\n fillTyped(scope, 'setExtras', original => (extras): Scope => {\n Object.keys(extras).forEach(key => {\n NATIVE.setExtra(key, extras[key]);\n });\n return original.call(scope, extras);\n });\n\n fillTyped(scope, 'setExtra', original => (key, value): Scope => {\n NATIVE.setExtra(key, value);\n return original.call(scope, key, value);\n });\n\n fillTyped(scope, 'addBreadcrumb', original => (breadcrumb, maxBreadcrumbs): Scope => {\n const mergedBreadcrumb: Breadcrumb = {\n ...breadcrumb,\n level: breadcrumb.level || DEFAULT_BREADCRUMB_LEVEL,\n data: breadcrumb.data ? convertToNormalizedObject(breadcrumb.data) : undefined,\n };\n\n original.call(scope, mergedBreadcrumb, maxBreadcrumbs);\n\n const finalBreadcrumb = scope.getLastBreadcrumb();\n if (finalBreadcrumb) {\n NATIVE.addBreadcrumb(finalBreadcrumb);\n } else {\n logger.warn('[ScopeSync] Last created breadcrumb is undefined. Skipping sync to native.');\n }\n\n return scope;\n });\n\n fillTyped(scope, 'clearBreadcrumbs', original => (): Scope => {\n NATIVE.clearBreadcrumbs();\n return original.call(scope);\n });\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n fillTyped(scope, 'setContext', original => (key: string, context: { [key: string]: any } | null): Scope => {\n NATIVE.setContext(key, context);\n return original.call(scope, key, context);\n });\n}\n"]}
1
+ {"version":3,"file":"scopeSync.js","sourceRoot":"","sources":["../../src/js/scopeSync.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACvC,OAAO,EAAE,wBAAwB,EAAE,MAAM,cAAc,CAAC;AACxD,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,yBAAyB,EAAE,MAAM,mBAAmB,CAAC;AAC9D,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAEnC;;;GAGG;AACH,MAAM,iBAAiB,GAAG,IAAI,OAAO,EAAe,CAAC;AAErD;;GAEG;AACH,MAAM,UAAU,kBAAkB,CAAC,KAAY;IAC7C,IAAI,iBAAiB,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE;QAChC,OAAO;KACR;IACD,iBAAiB,CAAC,GAAG,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;IAEnC,SAAS,CAAC,KAAK,EAAE,SAAS,EAAE,QAAQ,CAAC,EAAE,CAAC,CAAC,IAAI,EAAS,EAAE;QACtD,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QACrB,OAAO,QAAQ,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;IACpC,CAAC,CAAC,CAAC;IAEH,SAAS,CAAC,KAAK,EAAE,QAAQ,EAAE,QAAQ,CAAC,EAAE,CAAC,CAAC,GAAG,EAAE,KAAK,EAAS,EAAE;QAC3D,MAAM,CAAC,MAAM,CAAC,GAAG,EAAE,MAAM,CAAC,kBAAkB,CAAC,KAAK,CAAC,CAAC,CAAC;Q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IAAI,OAAO,KAAK,KAAK,SAAS,EAAE;YACxF,MAAM,CAAC,YAAY,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;SACjC;QACD,OAAO,QAAQ,CAAC,IAAI,CAAC,KAAK,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC;IAC1C,CAAC,CAAC,CAAC;IAEH,SAAS,CAAC,KAAK,EAAE,eAAe,EAAE,QAAQ,CAAC,EAAE,CAAC,CAAC,UAAmC,EAAS,EAAE;QAC3F,iCAAiC;QACjC,MAAM,cAAc,GAA8C,EAAE,CAAC;QACrE,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE;YACpC,MAAM,KAAK,GAAG,UAAU,CAAC,GAAG,CAAC,CAAC;YAC9B,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,OAAO,KAAK,KAAK,SAAS,EAAE;gBACxF,cAAc,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;aAC7B;QACH,CAAC,CAAC,CAAC;QAEH,IAAI,MAAM,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC,MAAM,GAAG,CAAC,EAAE;YAC1C,MAAM,CAAC,aAAa,CAAC,cAAc,CAAC,CAAC;SACtC;QACD,OAAO,QAAQ,CAAC,IAAI,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC;IAC1C,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["import type { Breadcrumb, Scope } from '@sentry/core';\nimport { logger } from '@sentry/react';\nimport { DEFAULT_BREADCRUMB_LEVEL } from './breadcrumb';\nimport { fillTyped } from './utils/fill';\nimport { convertToNormalizedObject } from './utils/normalize';\nimport { NATIVE } from './wrapper';\n\n/**\n * This WeakMap is used to keep track of which scopes have been synced to the native SDKs.\n * This ensures that we don't double sync the same scope.\n */\nconst syncedToNativeMap = new WeakMap<Scope, true>();\n\n/**\n * Hooks into the scope set methods and sync new data added to the given scope with the native SDKs.\n */\nexport function enableSyncToNative(scope: Scope): void {\n if (syncedToNativeMap.has(scope)) {\n return;\n }\n syncedToNativeMap.set(scope, true);\n\n fillTyped(scope, 'setUser', original => (user): Scope => {\n NATIVE.setUser(user);\n return original.call(scope, user);\n });\n\n fillTyped(scope, 'setTag', original => (key, value): Scope => {\n NATIVE.setTag(key, NATIVE.primitiveProcessor(value));\n return original.call(scope, key, value);\n });\n\n fillTyped(scope, 'setTags', original => (tags): Scope => {\n // As native only has setTag, we just loop through each tag key.\n Object.keys(tags).forEach(key => {\n NATIVE.setTag(key, NATIVE.primitiveProcessor(tags[key]));\n });\n return original.call(scope, tags);\n });\n\n fillTyped(scope, 'setExtras', original => (extras): Scope => {\n Object.keys(extras).forEach(key => {\n NATIVE.setExtra(key, extras[key]);\n });\n return original.call(scope, extras);\n });\n\n fillTyped(scope, 'setExtra', original => (key, value): Scope => {\n NATIVE.setExtra(key, value);\n return original.call(scope, key, value);\n });\n\n fillTyped(scope, 'addBreadcrumb', original => (breadcrumb, maxBreadcrumbs): Scope => {\n const mergedBreadcrumb: Breadcrumb = {\n ...breadcrumb,\n level: breadcrumb.level || DEFAULT_BREADCRUMB_LEVEL,\n data: breadcrumb.data ? convertToNormalizedObject(breadcrumb.data) : undefined,\n };\n\n original.call(scope, mergedBreadcrumb, maxBreadcrumbs);\n\n const finalBreadcrumb = scope.getLastBreadcrumb();\n if (finalBreadcrumb) {\n NATIVE.addBreadcrumb(finalBreadcrumb);\n } else {\n logger.warn('[ScopeSync] Last created breadcrumb is undefined. Skipping sync to native.');\n }\n\n return scope;\n });\n\n fillTyped(scope, 'clearBreadcrumbs', original => (): Scope => {\n NATIVE.clearBreadcrumbs();\n return original.call(scope);\n });\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n fillTyped(scope, 'setContext', original => (key: string, context: { [key: string]: any } | null): Scope => {\n NATIVE.setContext(key, context);\n return original.call(scope, key, context);\n });\n\n fillTyped(scope, 'setAttribute', original => (key: string, value: unknown): Scope => {\n // Only sync primitive types\n if (typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean') {\n NATIVE.setAttribute(key, value);\n }\n return original.call(scope, key, value);\n });\n\n fillTyped(scope, 'setAttributes', original => (attributes: Record<string, unknown>): Scope => {\n // Filter to only primitive types\n const primitiveAttrs: Record<string, string | number | boolean> = {};\n Object.keys(attributes).forEach(key => {\n const value = attributes[key];\n if (typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean') {\n primitiveAttrs[key] = value;\n }\n });\n\n if (Object.keys(primitiveAttrs).length > 0) {\n NATIVE.setAttributes(primitiveAttrs);\n }\n return original.call(scope, attributes);\n });\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"sdk.d.ts","sourceRoot":"","sources":["../../src/js/sdk.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAA2C,KAAK,EAAE,MAAM,cAAc,CAAC;AAanF,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAK/B,OAAO,KAAK,EAA4B,kBAAkB,EAAE,yBAAyB,EAAE,MAAM,WAAW,CAAC;AA+BzG;;GAEG;AACH,wBAAgB,IAAI,CAAC,aAAa,EAAE,kBAAkB,GAAG,IAAI,CAwG5D;AAED;;GAEG;AACH,wBAAgB,IAAI,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACpD,aAAa,EAAE,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,EACrC,OAAO,CAAC,EAAE,yBAAyB,GAClC,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,CAsBxB;AAED;;;GAGG;AACH,wBAAgB,WAAW,IAAI,IAAI,CAElC;AAED;;;GAGG;AACH,wBAAsB,KAAK,IAAI,OAAO,CAAC,OAAO,CAAC,CAe9C;AAED;;GAEG;AACH,wBAAsB,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAU3C;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,SAAS,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,CAAC,GAAG,CAAC,GAAG,SAAS,CAUzE;AAED;;GAEG;AACH,wBAAsB,cAAc,IAAI,OAAO,CAAC,OAAO,GAAG,IAAI,CAAC,CAE9D"}
1
+ {"version":3,"file":"sdk.d.ts","sourceRoot":"","sources":["../../src/js/sdk.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAA2C,KAAK,EAAE,MAAM,cAAc,CAAC;AAanF,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAK/B,OAAO,KAAK,EAA4B,kBAAkB,EAAE,yBAAyB,EAAE,MAAM,WAAW,CAAC;AAgCzG;;GAEG;AACH,wBAAgB,IAAI,CAAC,aAAa,EAAE,kBAAkB,GAAG,IAAI,CAyH5D;AAED;;GAEG;AACH,wBAAgB,IAAI,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACpD,aAAa,EAAE,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,EACrC,OAAO,CAAC,EAAE,yBAAyB,GAClC,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,CAsBxB;AAED;;;GAGG;AACH,wBAAgB,WAAW,IAAI,IAAI,CAElC;AAED;;;GAGG;AACH,wBAAsB,KAAK,IAAI,OAAO,CAAC,OAAO,CAAC,CAe9C;AAED;;GAEG;AACH,wBAAsB,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAU3C;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,SAAS,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,CAAC,GAAG,CAAC,GAAG,SAAS,CAUzE;AAED;;GAEG;AACH,wBAAsB,cAAc,IAAI,OAAO,CAAC,OAAO,GAAG,IAAI,CAAC,CAE9D"}
package/dist/js/sdk.js CHANGED
@@ -23,6 +23,7 @@ import { DEFAULT_BUFFER_SIZE, makeNativeTransportFactory } from './transports/na
23
23
  import { getDefaultEnvironment, isExpoGo, isRunningInMetroDevServer, isWeb } from './utils/environment';
24
24
  import { getDefaultRelease } from './utils/release';
25
25
  import { safeFactory, safeTracesSampler } from './utils/safe';
26
+ import { RN_GLOBAL_OBJ } from './utils/worldwide';
26
27
  import { NATIVE } from './wrapper';
27
28
  const DEFAULT_OPTIONS = {
28
29
  enableNativeCrashHandling: true,
@@ -50,8 +51,9 @@ export function init(passedOptions) {
50
51
  if (isRunningInMetroDevServer()) {
51
52
  return;
52
53
  }
53
- const maxQueueSize = (_c = (_a = passedOptions.maxQueueSize) !== null && _a !== void 0 ? _a : (_b = passedOptions.transportOptions) === null || _b === void 0 ? void 0 : _b.bufferSize) !== null && _c !== void 0 ? _c : DEFAULT_OPTIONS.maxQueueSize;
54
- const enableNative = passedOptions.enableNative === undefined || passedOptions.enableNative
54
+ const userOptions = Object.assign(Object.assign({}, RN_GLOBAL_OBJ.__SENTRY_OPTIONS__), passedOptions);
55
+ const maxQueueSize = (_c = (_a = userOptions.maxQueueSize) !== null && _a !== void 0 ? _a : (_b = userOptions.transportOptions) === null || _b === void 0 ? void 0 : _b.bufferSize) !== null && _c !== void 0 ? _c : DEFAULT_OPTIONS.maxQueueSize;
56
+ const enableNative = userOptions.enableNative === undefined || userOptions.enableNative
55
57
  ? NATIVE.isNativeAvailable()
56
58
  : false;
57
59
  useEncodePolyfill();
@@ -71,10 +73,10 @@ export function init(passedOptions) {
71
73
  const port = dsnComponents.port ? `:${dsnComponents.port}` : '';
72
74
  return `${dsnComponents.protocol}://${dsnComponents.host}${port}`;
73
75
  };
74
- const userBeforeBreadcrumb = safeFactory(passedOptions.beforeBreadcrumb, { loggerMessage: 'The beforeBreadcrumb threw an error' });
76
+ const userBeforeBreadcrumb = safeFactory(userOptions.beforeBreadcrumb, { loggerMessage: 'The beforeBreadcrumb threw an error' });
75
77
  // Exclude Dev Server and Sentry Dsn request from Breadcrumbs
76
78
  const devServerUrl = (_d = getDevServer()) === null || _d === void 0 ? void 0 : _d.url;
77
- const dsn = getURLFromDSN(passedOptions.dsn);
79
+ const dsn = getURLFromDSN(userOptions.dsn);
78
80
  const defaultBeforeBreadcrumb = (breadcrumb, _hint) => {
79
81
  var _a;
80
82
  const type = breadcrumb.type || '';
@@ -95,24 +97,30 @@ export function init(passedOptions) {
95
97
  }
96
98
  return defaultBeforeBreadcrumb(modifiedBreadcrumb, hint);
97
99
  };
98
- const options = Object.assign(Object.assign(Object.assign({}, DEFAULT_OPTIONS), passedOptions), { release: (_e = passedOptions.release) !== null && _e !== void 0 ? _e : getDefaultRelease(), enableNative, enableNativeNagger: shouldEnableNativeNagger(passedOptions.enableNativeNagger),
100
+ const options = Object.assign(Object.assign(Object.assign({}, DEFAULT_OPTIONS), userOptions), { release: (_e = userOptions.release) !== null && _e !== void 0 ? _e : getDefaultRelease(), enableNative, enableNativeNagger: shouldEnableNativeNagger(userOptions.enableNativeNagger),
99
101
  // If custom transport factory fails the SDK won't initialize
100
- transport: passedOptions.transport
102
+ transport: userOptions.transport
101
103
  || makeNativeTransportFactory({
102
104
  enableNative,
103
105
  })
104
- || makeFetchTransport, transportOptions: Object.assign(Object.assign(Object.assign({}, DEFAULT_OPTIONS.transportOptions), ((_f = passedOptions.transportOptions) !== null && _f !== void 0 ? _f : {})), { bufferSize: maxQueueSize }), maxQueueSize, integrations: [], stackParser: stackParserFromStackParserOptions(passedOptions.stackParser || defaultStackParser), beforeBreadcrumb: chainedBeforeBreadcrumb, initialScope: safeFactory(passedOptions.initialScope, { loggerMessage: 'The initialScope threw an error' }) });
106
+ || makeFetchTransport, transportOptions: Object.assign(Object.assign(Object.assign({}, DEFAULT_OPTIONS.transportOptions), ((_f = userOptions.transportOptions) !== null && _f !== void 0 ? _f : {})), { bufferSize: maxQueueSize }), maxQueueSize, integrations: [], stackParser: stackParserFromStackParserOptions(userOptions.stackParser || defaultStackParser), beforeBreadcrumb: chainedBeforeBreadcrumb, initialScope: safeFactory(userOptions.initialScope, { loggerMessage: 'The initialScope threw an error' }) });
107
+ if (!('autoInitializeNativeSdk' in userOptions) && RN_GLOBAL_OBJ.__SENTRY_OPTIONS__) {
108
+ // We expect users to use the file options only in combination with manual native initialization
109
+ // eslint-disable-next-line no-console
110
+ console.info('Initializing Sentry JS with the options file. Expecting manual native initialization before JS. Native will not be initialized automatically.');
111
+ options.autoInitializeNativeSdk = false;
112
+ }
105
113
  if ('tracesSampler' in options) {
106
114
  options.tracesSampler = safeTracesSampler(options.tracesSampler);
107
115
  }
108
116
  if (!('environment' in options)) {
109
117
  options.environment = getDefaultEnvironment();
110
118
  }
111
- const defaultIntegrations = passedOptions.defaultIntegrations === undefined
119
+ const defaultIntegrations = userOptions.defaultIntegrations === undefined
112
120
  ? getDefaultIntegrations(options)
113
- : passedOptions.defaultIntegrations;
121
+ : userOptions.defaultIntegrations;
114
122
  options.integrations = getIntegrationsToSetup({
115
- integrations: safeFactory(passedOptions.integrations, { loggerMessage: 'The integrations threw an error' }),
123
+ integrations: safeFactory(userOptions.integrations, { loggerMessage: 'The integrations threw an error' }),
116
124
  defaultIntegrations,
117
125
  });
118
126
  initAndBind(ReactNativeClient, options);
@@ -120,6 +128,9 @@ export function init(passedOptions) {
120
128
  debug.log('Offline caching, native errors features are not available in Expo Go.');
121
129
  debug.log('Use EAS Build / Native Release Build to test these features.');
122
130
  }
131
+ if (RN_GLOBAL_OBJ.__SENTRY_OPTIONS__) {
132
+ debug.log('Sentry JS initialized with options from the options file.');
133
+ }
123
134
  }
124
135
  /**
125
136
  * Inits the Sentry React Native SDK with automatic instrumentation and wrapped features.
@@ -1 +1 @@
1
- {"version":3,"file":"sdk.js","sourceRoot":"","sources":["../../src/js/sdk.tsx"],"names":[],"mappings":";;;;;;;;;AAEA,OAAO,EACL,KAAK,EACL,SAAS,EACT,cAAc,EACd,sBAAsB,EACtB,iBAAiB,EACjB,WAAW,EACX,OAAO,EACP,iCAAiC,EACjC,SAAS,IAAI,aAAa,GAC3B,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,E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AE,CAAC;YAE3B,IAAI,MAAM,EAAE;gBACV,MAAM,MAAM,CAAC,KAAK,EAAE,CAAC;aACtB;SACF;QAAC,OAAO,CAAC,EAAE;YACV,KAAK,CAAC,KAAK,CAAC,yBAAyB,CAAC,CAAC;SACxC;IACH,CAAC;CAAA;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,SAAS,CAAI,QAA6B;IACxD,MAAM,YAAY,GAAG,CAAC,KAAY,EAAiB,EAAE;QACnD,IAAI;YACF,OAAO,QAAQ,CAAC,KAAK,CAAC,CAAC;SACxB;QAAC,OAAO,CAAC,EAAE;YACV,KAAK,CAAC,KAAK,CAAC,wCAAwC,EAAE,CAAC,CAAC,CAAC;YACzD,OAAO,SAAS,CAAC;SAClB;IACH,CAAC,CAAC;IACF,OAAO,aAAa,CAAC,YAAY,CAAC,CAAC;AACrC,CAAC;AAED;;GAEG;AACH,MAAM,UAAgB,cAAc;;QAClC,OAAO,MAAM,CAAC,cAAc,EAAE,CAAC;IACjC,CAAC;CAAA","sourcesContent":["/* eslint-disable complexity */\nimport type { Breadcrumb, BreadcrumbHint, Integration, Scope } from '@sentry/core';\nimport {\n debug,\n getClient,\n getGlobalScope,\n getIntegrationsToSetup,\n getIsolationScope,\n initAndBind,\n makeDsn,\n stackParserFromStackParserOptions,\n withScope as coreWithScope,\n} from '@sentry/core';\nimport { defaultStackParser, makeFetchTransport, Profiler } from '@sentry/react';\nimport * as React from 'react';\nimport { ReactNativeClient } from './client';\nimport { FeedbackWidgetProvider } from './feedback/FeedbackWidgetProvider';\nimport { getDevServer } from './integrations/debugsymbolicatorutils';\nimport { getDefaultIntegrations } from './integrations/default';\nimport type { ReactNativeClientOptions, ReactNativeOptions, ReactNativeWrapperOptions } from './options';\nimport { shouldEnableNativeNagger } from './options';\nimport { enableSyncToNative } from './scopeSync';\nimport { TouchEventBoundary } from './touchevents';\nimport { ReactNativeProfiler } from './tracing';\nimport { useEncodePolyfill } from './transports/encodePolyfill';\nimport { DEFAULT_BUFFER_SIZE, makeNativeTransportFactory } from './transports/native';\nimport { getDefaultEnvironment, isExpoGo, isRunningInMetroDevServer, isWeb } from './utils/environment';\nimport { getDefaultRelease } from './utils/release';\nimport { safeFactory, safeTracesSampler } from './utils/safe';\nimport { NATIVE } from './wrapper';\n\nconst DEFAULT_OPTIONS: ReactNativeOptions = {\n enableNativeCrashHandling: true,\n enableNativeNagger: true,\n autoInitializeNativeSdk: true,\n enableAutoPerformanceTracing: true,\n enableWatchdogTerminationTracking: true,\n patchGlobalPromise: true,\n sendClientReports: true,\n maxQueueSize: DEFAULT_BUFFER_SIZE,\n attachStacktrace: true,\n enableCaptureFailedRequests: false,\n enableNdk: true,\n enableAppStartTracking: true,\n enableNativeFramesTracking: true,\n enableStallTracking: true,\n enableUserInteractionTracing: false,\n propagateTraceparent: false,\n};\n\n/**\n * Inits the SDK and returns the final options.\n */\nexport function init(passedOptions: ReactNativeOptions): void {\n if (isRunningInMetroDevServer()) {\n return;\n }\n\n const maxQueueSize = passedOptions.maxQueueSize\n // eslint-disable-next-line deprecation/deprecation\n ?? passedOptions.transportOptions?.bufferSize\n ?? DEFAULT_OPTIONS.maxQueueSize;\n\n const enableNative = passedOptions.enableNative === undefined || passedOptions.enableNative\n ? NATIVE.isNativeAvailable()\n : false;\n\n useEncodePolyfill();\n if (enableNative) {\n enableSyncToNative(getGlobalScope());\n enableSyncToNative(getIsolationScope());\n }\n\n const getURLFromDSN = (dsn: string | undefined): string | undefined => {\n if (!dsn) {\n return undefined;\n }\n const dsnComponents = makeDsn(dsn);\n if (!dsnComponents) {\n debug.error('Failed to extract url from DSN: ', dsn);\n return undefined;\n }\n const port = dsnComponents.port ? `:${dsnComponents.port}` : '';\n return `${dsnComponents.protocol}://${dsnComponents.host}${port}`;\n };\n\n const userBeforeBreadcrumb = safeFactory(passedOptions.beforeBreadcrumb, { loggerMessage: 'The beforeBreadcrumb threw an error' });\n\n // Exclude Dev Server and Sentry Dsn request from Breadcrumbs\n const devServerUrl = getDevServer()?.url;\n const dsn = getURLFromDSN(passedOptions.dsn);\n const defaultBeforeBreadcrumb = (breadcrumb: Breadcrumb, _hint?: BreadcrumbHint): Breadcrumb | null => {\n const type = breadcrumb.type || '';\n const url = typeof breadcrumb.data?.url === 'string' ? breadcrumb.data.url : '';\n if (type === 'http' && ((devServerUrl && url.startsWith(devServerUrl)) || (dsn && url.startsWith(dsn)))) {\n return null;\n }\n return breadcrumb;\n };\n\n const chainedBeforeBreadcrumb = (breadcrumb: Breadcrumb, hint?: BreadcrumbHint): Breadcrumb | null => {\n let modifiedBreadcrumb = breadcrumb;\n if (userBeforeBreadcrumb) {\n const result = userBeforeBreadcrumb(breadcrumb, hint);\n if (result === null) {\n return null;\n }\n modifiedBreadcrumb = result;\n }\n return defaultBeforeBreadcrumb(modifiedBreadcrumb, hint);\n };\n\n const options: ReactNativeClientOptions = {\n ...DEFAULT_OPTIONS,\n ...passedOptions,\n release: passedOptions.release ?? getDefaultRelease(),\n enableNative,\n enableNativeNagger: shouldEnableNativeNagger(passedOptions.enableNativeNagger),\n // If custom transport factory fails the SDK won't initialize\n transport: passedOptions.transport\n || makeNativeTransportFactory({\n enableNative,\n })\n || makeFetchTransport,\n transportOptions: {\n ...DEFAULT_OPTIONS.transportOptions,\n ...(passedOptions.transportOptions ?? {}),\n bufferSize: maxQueueSize,\n },\n maxQueueSize,\n integrations: [],\n stackParser: stackParserFromStackParserOptions(passedOptions.stackParser || defaultStackParser),\n beforeBreadcrumb: chainedBeforeBreadcrumb,\n initialScope: safeFactory(passedOptions.initialScope, { loggerMessage: 'The initialScope threw an error' }),\n };\n if ('tracesSampler' in options) {\n options.tracesSampler = safeTracesSampler(options.tracesSampler);\n }\n\n if (!('environment' in options)) {\n options.environment = getDefaultEnvironment();\n }\n\n const defaultIntegrations: false | Integration[] = passedOptions.defaultIntegrations === undefined\n ? getDefaultIntegrations(options)\n : passedOptions.defaultIntegrations;\n\n options.integrations = getIntegrationsToSetup({\n integrations: safeFactory(passedOptions.integrations, { loggerMessage: 'The integrations threw an error' }),\n defaultIntegrations,\n });\n initAndBind(ReactNativeClient, options);\n\n if (isExpoGo()) {\n debug.log('Offline caching, native errors features are not available in Expo Go.');\n debug.log('Use EAS Build / Native Release Build to test these features.');\n }\n}\n\n/**\n * Inits the Sentry React Native SDK with automatic instrumentation and wrapped features.\n */\nexport function wrap<P extends Record<string, unknown>>(\n RootComponent: React.ComponentType<P>,\n options?: ReactNativeWrapperOptions\n): React.ComponentType<P> {\n const profilerProps = {\n ...(options?.profilerProps),\n name: RootComponent.displayName ?? 'Root',\n updateProps: {}\n };\n\n const ProfilerComponent = isWeb() ? Profiler : ReactNativeProfiler;\n\n const RootApp: React.FC<P> = appProps => {\n return (\n <TouchEventBoundary {...(options?.touchEventBoundaryProps ?? {})}>\n <ProfilerComponent {...profilerProps}>\n <FeedbackWidgetProvider>\n <RootComponent {...appProps} />\n </FeedbackWidgetProvider>\n </ProfilerComponent>\n </TouchEventBoundary>\n );\n };\n\n return RootApp;\n}\n\n/**\n * If native client is available it will trigger a native crash.\n * Use this only for testing purposes.\n */\nexport function nativeCrash(): void {\n NATIVE.nativeCrash();\n}\n\n/**\n * Flushes all pending events in the queue to disk.\n * Use this before applying any realtime updates such as code-push or expo updates.\n */\nexport async function flush(): Promise<boolean> {\n try {\n const client = getClient();\n\n if (client) {\n const result = await client.flush();\n\n return result;\n }\n // eslint-disable-next-line no-empty\n } catch (_) { }\n\n debug.error('Failed to flush the event queue.');\n\n return false;\n}\n\n/**\n * Closes the SDK, stops sending events.\n */\nexport async function close(): Promise<void> {\n try {\n const client = getClient();\n\n if (client) {\n await client.close();\n }\n } catch (e) {\n debug.error('Failed to close the SDK');\n }\n}\n\n/**\n * Creates a new scope with and executes the given operation within.\n * The scope is automatically removed once the operation\n * finishes or throws.\n *\n * This is essentially a convenience function for:\n *\n * pushScope();\n * callback();\n * popScope();\n *\n * @param callback that will be enclosed into push/popScope.\n */\nexport function withScope<T>(callback: (scope: Scope) => T): T | undefined {\n const safeCallback = (scope: Scope): T | undefined => {\n try {\n return callback(scope);\n } catch (e) {\n debug.error('Error while running withScope callback', e);\n return undefined;\n }\n };\n return coreWithScope(safeCallback);\n}\n\n/**\n * Returns if the app crashed in the last run.\n */\nexport async function crashedLastRun(): Promise<boolean | null> {\n return NATIVE.crashedLastRun();\n}\n"]}
1
+ {"version":3,"file":"sdk.js","sourceRoot":"","sources":["../../src/js/sdk.tsx"],"names":[],"mappings":";;;;;;;;;AAEA,OAAO,EACL,KAAK,EACL,SAAS,EACT,cAAc,EACd,sBAAsB,EACtB,iBAAiB,EACjB,WAAW,EACX,OAAO,EACP,iCAAiC,EACjC,SAAS,IAAI,aAAa,GAC3B,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACjF,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,EAAE,sBAAsB,EAAE,MAAM,mCAAmC,CAAC;AAC3E,OAAO,EAAE,YAAY,EAAE,MAAM,uCAAuC,CAAC;AACrE,OAAO,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAEhE,OAAO,EAAE,wBAAwB,EAAE,MAAM,WAAW,CAAC;AACrD,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAChD,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,EAAE,mBAAmB,EAAE,0BAA0B,EAAE,MAAM,qBAAqB,CAAC;AACtF,OAAO,EAAE,qBAAqB,EAAE,QAAQ,EAAE,yBAAyB,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AACxG,OAAO,EAAE,iBAAiB,EAAE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AAO,QAAQ,CAAC,KAAK,CAAC,CAAC;SACxB;QAAC,OAAO,CAAC,EAAE;YACV,KAAK,CAAC,KAAK,CAAC,wCAAwC,EAAE,CAAC,CAAC,CAAC;YACzD,OAAO,SAAS,CAAC;SAClB;IACH,CAAC,CAAC;IACF,OAAO,aAAa,CAAC,YAAY,CAAC,CAAC;AACrC,CAAC;AAED;;GAEG;AACH,MAAM,UAAgB,cAAc;;QAClC,OAAO,MAAM,CAAC,cAAc,EAAE,CAAC;IACjC,CAAC;CAAA","sourcesContent":["/* eslint-disable complexity */\nimport type { Breadcrumb, BreadcrumbHint, Integration, Scope } from '@sentry/core';\nimport {\n debug,\n getClient,\n getGlobalScope,\n getIntegrationsToSetup,\n getIsolationScope,\n initAndBind,\n makeDsn,\n stackParserFromStackParserOptions,\n withScope as coreWithScope,\n} from '@sentry/core';\nimport { defaultStackParser, makeFetchTransport, Profiler } from '@sentry/react';\nimport * as React from 'react';\nimport { ReactNativeClient } from './client';\nimport { FeedbackWidgetProvider } from './feedback/FeedbackWidgetProvider';\nimport { getDevServer } from './integrations/debugsymbolicatorutils';\nimport { getDefaultIntegrations } from './integrations/default';\nimport type { ReactNativeClientOptions, ReactNativeOptions, ReactNativeWrapperOptions } from './options';\nimport { shouldEnableNativeNagger } from './options';\nimport { enableSyncToNative } from './scopeSync';\nimport { TouchEventBoundary } from './touchevents';\nimport { ReactNativeProfiler } from './tracing';\nimport { useEncodePolyfill } from './transports/encodePolyfill';\nimport { DEFAULT_BUFFER_SIZE, makeNativeTransportFactory } from './transports/native';\nimport { getDefaultEnvironment, isExpoGo, isRunningInMetroDevServer, isWeb } from './utils/environment';\nimport { getDefaultRelease } from './utils/release';\nimport { safeFactory, safeTracesSampler } from './utils/safe';\nimport { RN_GLOBAL_OBJ } from './utils/worldwide';\nimport { NATIVE } from './wrapper';\n\nconst DEFAULT_OPTIONS: ReactNativeOptions = {\n enableNativeCrashHandling: true,\n enableNativeNagger: true,\n autoInitializeNativeSdk: true,\n enableAutoPerformanceTracing: true,\n enableWatchdogTerminationTracking: true,\n patchGlobalPromise: true,\n sendClientReports: true,\n maxQueueSize: DEFAULT_BUFFER_SIZE,\n attachStacktrace: true,\n enableCaptureFailedRequests: false,\n enableNdk: true,\n enableAppStartTracking: true,\n enableNativeFramesTracking: true,\n enableStallTracking: true,\n enableUserInteractionTracing: false,\n propagateTraceparent: false,\n};\n\n/**\n * Inits the SDK and returns the final options.\n */\nexport function init(passedOptions: ReactNativeOptions): void {\n if (isRunningInMetroDevServer()) {\n return;\n }\n\n const userOptions = {\n ...RN_GLOBAL_OBJ.__SENTRY_OPTIONS__,\n ...passedOptions,\n };\n\n const maxQueueSize = userOptions.maxQueueSize\n // eslint-disable-next-line deprecation/deprecation\n ?? userOptions.transportOptions?.bufferSize\n ?? DEFAULT_OPTIONS.maxQueueSize;\n\n const enableNative = userOptions.enableNative === undefined || userOptions.enableNative\n ? NATIVE.isNativeAvailable()\n : false;\n\n useEncodePolyfill();\n if (enableNative) {\n enableSyncToNative(getGlobalScope());\n enableSyncToNative(getIsolationScope());\n }\n\n const getURLFromDSN = (dsn: string | undefined): string | undefined => {\n if (!dsn) {\n return undefined;\n }\n const dsnComponents = makeDsn(dsn);\n if (!dsnComponents) {\n debug.error('Failed to extract url from DSN: ', dsn);\n return undefined;\n }\n const port = dsnComponents.port ? `:${dsnComponents.port}` : '';\n return `${dsnComponents.protocol}://${dsnComponents.host}${port}`;\n };\n\n const userBeforeBreadcrumb = safeFactory(userOptions.beforeBreadcrumb, { loggerMessage: 'The beforeBreadcrumb threw an error' });\n\n // Exclude Dev Server and Sentry Dsn request from Breadcrumbs\n const devServerUrl = getDevServer()?.url;\n const dsn = getURLFromDSN(userOptions.dsn);\n const defaultBeforeBreadcrumb = (breadcrumb: Breadcrumb, _hint?: BreadcrumbHint): Breadcrumb | null => {\n const type = breadcrumb.type || '';\n const url = typeof breadcrumb.data?.url === 'string' ? breadcrumb.data.url : '';\n if (type === 'http' && ((devServerUrl && url.startsWith(devServerUrl)) || (dsn && url.startsWith(dsn)))) {\n return null;\n }\n return breadcrumb;\n };\n\n const chainedBeforeBreadcrumb = (breadcrumb: Breadcrumb, hint?: BreadcrumbHint): Breadcrumb | null => {\n let modifiedBreadcrumb = breadcrumb;\n if (userBeforeBreadcrumb) {\n const result = userBeforeBreadcrumb(breadcrumb, hint);\n if (result === null) {\n return null;\n }\n modifiedBreadcrumb = result;\n }\n return defaultBeforeBreadcrumb(modifiedBreadcrumb, hint);\n };\n\n const options: ReactNativeClientOptions = {\n ...DEFAULT_OPTIONS,\n ...userOptions,\n release: userOptions.release ?? getDefaultRelease(),\n enableNative,\n enableNativeNagger: shouldEnableNativeNagger(userOptions.enableNativeNagger),\n // If custom transport factory fails the SDK won't initialize\n transport: userOptions.transport\n || makeNativeTransportFactory({\n enableNative,\n })\n || makeFetchTransport,\n transportOptions: {\n ...DEFAULT_OPTIONS.transportOptions,\n ...(userOptions.transportOptions ?? {}),\n bufferSize: maxQueueSize,\n },\n maxQueueSize,\n integrations: [],\n stackParser: stackParserFromStackParserOptions(userOptions.stackParser || defaultStackParser),\n beforeBreadcrumb: chainedBeforeBreadcrumb,\n initialScope: safeFactory(userOptions.initialScope, { loggerMessage: 'The initialScope threw an error' }),\n };\n\n if (!('autoInitializeNativeSdk' in userOptions) && RN_GLOBAL_OBJ.__SENTRY_OPTIONS__) {\n // We expect users to use the file options only in combination with manual native initialization\n // eslint-disable-next-line no-console\n console.info('Initializing Sentry JS with the options file. Expecting manual native initialization before JS. Native will not be initialized automatically.');\n options.autoInitializeNativeSdk = false;\n }\n\n if ('tracesSampler' in options) {\n options.tracesSampler = safeTracesSampler(options.tracesSampler);\n }\n\n if (!('environment' in options)) {\n options.environment = getDefaultEnvironment();\n }\n\n const defaultIntegrations: false | Integration[] = userOptions.defaultIntegrations === undefined\n ? getDefaultIntegrations(options)\n : userOptions.defaultIntegrations;\n\n options.integrations = getIntegrationsToSetup({\n integrations: safeFactory(userOptions.integrations, { loggerMessage: 'The integrations threw an error' }),\n defaultIntegrations,\n });\n initAndBind(ReactNativeClient, options);\n\n if (isExpoGo()) {\n debug.log('Offline caching, native errors features are not available in Expo Go.');\n debug.log('Use EAS Build / Native Release Build to test these features.');\n }\n\n if (RN_GLOBAL_OBJ.__SENTRY_OPTIONS__) {\n debug.log('Sentry JS initialized with options from the options file.');\n }\n}\n\n/**\n * Inits the Sentry React Native SDK with automatic instrumentation and wrapped features.\n */\nexport function wrap<P extends Record<string, unknown>>(\n RootComponent: React.ComponentType<P>,\n options?: ReactNativeWrapperOptions\n): React.ComponentType<P> {\n const profilerProps = {\n ...(options?.profilerProps),\n name: RootComponent.displayName ?? 'Root',\n updateProps: {}\n };\n\n const ProfilerComponent = isWeb() ? Profiler : ReactNativeProfiler;\n\n const RootApp: React.FC<P> = appProps => {\n return (\n <TouchEventBoundary {...(options?.touchEventBoundaryProps ?? {})}>\n <ProfilerComponent {...profilerProps}>\n <FeedbackWidgetProvider>\n <RootComponent {...appProps} />\n </FeedbackWidgetProvider>\n </ProfilerComponent>\n </TouchEventBoundary>\n );\n };\n\n return RootApp;\n}\n\n/**\n * If native client is available it will trigger a native crash.\n * Use this only for testing purposes.\n */\nexport function nativeCrash(): void {\n NATIVE.nativeCrash();\n}\n\n/**\n * Flushes all pending events in the queue to disk.\n * Use this before applying any realtime updates such as code-push or expo updates.\n */\nexport async function flush(): Promise<boolean> {\n try {\n const client = getClient();\n\n if (client) {\n const result = await client.flush();\n\n return result;\n }\n // eslint-disable-next-line no-empty\n } catch (_) { }\n\n debug.error('Failed to flush the event queue.');\n\n return false;\n}\n\n/**\n * Closes the SDK, stops sending events.\n */\nexport async function close(): Promise<void> {\n try {\n const client = getClient();\n\n if (client) {\n await client.close();\n }\n } catch (e) {\n debug.error('Failed to close the SDK');\n }\n}\n\n/**\n * Creates a new scope with and executes the given operation within.\n * The scope is automatically removed once the operation\n * finishes or throws.\n *\n * This is essentially a convenience function for:\n *\n * pushScope();\n * callback();\n * popScope();\n *\n * @param callback that will be enclosed into push/popScope.\n */\nexport function withScope<T>(callback: (scope: Scope) => T): T | undefined {\n const safeCallback = (scope: Scope): T | undefined => {\n try {\n return callback(scope);\n } catch (e) {\n debug.error('Error while running withScope callback', e);\n return undefined;\n }\n };\n return coreWithScope(safeCallback);\n}\n\n/**\n * Returns if the app crashed in the last run.\n */\nexport async function crashedLastRun(): Promise<boolean | null> {\n return NATIVE.crashedLastRun();\n}\n"]}
@@ -20,6 +20,14 @@ export interface SentryMetroConfigOptions {
20
20
  * @default true
21
21
  */
22
22
  enableSourceContextInDevelopment?: boolean;
23
+ /**
24
+ * Load Sentry Options from a file. If `true` it will use the default path.
25
+ * If `false` it will not load any options from a file. Only options provided in the code will be used.
26
+ * If `string` it will use the provided path.
27
+ *
28
+ * @default '{projectRoot}/sentry.options.json'
29
+ */
30
+ optionsFile?: string | boolean;
23
31
  }
24
32
  export interface SentryExpoConfigOptions {
25
33
  /**
@@ -39,7 +47,7 @@ export interface SentryExpoConfigOptions {
39
47
  * Adds Debug ID to the output bundle and source maps.
40
48
  * Collapses Sentry frames from the stack trace view in LogBox.
41
49
  */
42
- export declare function withSentryConfig(config: MetroConfig, { annotateReactComponents, includeWebReplay, enableSourceContextInDevelopment, }?: SentryMetroConfigOptions): MetroConfig;
50
+ export declare function withSentryConfig(config: MetroConfig, { annotateReactComponents, includeWebReplay, enableSourceContextInDevelopment, optionsFile, }?: SentryMetroConfigOptions): MetroConfig;
43
51
  /**
44
52
  * This function returns Default Expo configuration with Sentry plugins.
45
53
  */
@@ -1 +1 @@
1
- {"version":3,"file":"metroconfig.d.ts","sourceRoot":"","sources":["../../../src/js/tools/metroconfig.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAsC,MAAM,OAAO,CAAC;AAY7E,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAErE,cAAc,yBAAyB,CAAC;AAIxC,MAAM,WAAW,wBAAwB;IACvC;;;OAGG;IACH,uBA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AG,WAAW,CA+C1G;AAQD;;GAEG;AACH,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,WAAW,GAAG,WAAW,CAiC1E"}
@@ -22,6 +22,7 @@ const enableLogger_1 = require("./enableLogger");
22
22
  const metroMiddleware_1 = require("./metroMiddleware");
23
23
  const sentryBabelTransformerUtils_1 = require("./sentryBabelTransformerUtils");
24
24
  const sentryMetroSerializer_1 = require("./sentryMetroSerializer");
25
+ const sentryOptionsSerializer_1 = require("./sentryOptionsSerializer");
25
26
  const sentryReleaseInjector_1 = require("./sentryReleaseInjector");
26
27
  __exportStar(require("./sentryMetroSerializer"), exports);
27
28
  (0, enableLogger_1.enableLogger)();
@@ -31,7 +32,7 @@ __exportStar(require("./sentryMetroSerializer"), exports);
31
32
  * Adds Debug ID to the output bundle and source maps.
32
33
  * Collapses Sentry frames from the stack trace view in LogBox.
33
34
  */
34
- function withSentryConfig(config, { annotateReactComponents = false, includeWebReplay = true, enableSourceContextInDevelopment = true, } = {}) {
35
+ function withSentryConfig(config, { annotateReactComponents = false, includeWebReplay = true, enableSourceContextInDevelopment = true, optionsFile = true, } = {}) {
35
36
  setSentryMetroDevServerEnvFlag();
36
37
  let newConfig = config;
37
38
  newConfig = withSentryDebugId(newConfig);
@@ -45,6 +46,9 @@ function withSentryConfig(config, { annotateReactComponents = false, includeWebR
45
46
  if (enableSourceContextInDevelopment) {
46
47
  newConfig = (0, metroMiddleware_1.withSentryMiddleware)(newConfig);
47
48
  }
49
+ if (optionsFile) {
50
+ newConfig = (0, sentryOptionsSerializer_1.withSentryOptionsFromFile)(newConfig, optionsFile);
51
+ }
48
52
  return newConfig;
49
53
  }
50
54
  exports.withSentryConfig = withSentryConfig;
@@ -52,7 +56,7 @@ exports.withSentryConfig = withSentryConfig;
52
56
  * This function returns Default Expo configuration with Sentry plugins.
53
57
  */
54
58
  function getSentryExpoConfig(projectRoot, options = {}) {
55
- var _a, _b;
59
+ var _a, _b, _c, _d;
56
60
  setSentryMetroDevServerEnvFlag();
57
61
  const getDefaultConfig = options.getDefaultConfig || loadExpoMetroConfigModule().getDefaultConfig;
58
62
  const config = getDefaultConfig(projectRoot, Object.assign(Object.assign({}, options), { unstable_beforeAssetSerializationPlugins: [
@@ -70,6 +74,9 @@ function getSentryExpoConfig(projectRoot, options = {}) {
70
74
  if ((_b = options.enableSourceContextInDevelopment) !== null && _b !== void 0 ? _b : true) {
71
75
  newConfig = (0, metroMiddleware_1.withSentryMiddleware)(newConfig);
72
76
  }
77
+ if ((_c = options.optionsFile) !== null && _c !== void 0 ? _c : true) {
78
+ newConfig = (0, sentryOptionsSerializer_1.withSentryOptionsFromFile)(newConfig, (_d = options.optionsFile) !== null && _d !== void 0 ? _d : true);
79
+ }
73
80
  return newConfig;
74
81
  }
75
82
  exports.getSentryExpoConfig = getSentryExpoConfig;