@sentry/react-native 5.23.0-alpha.1 → 5.23.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 (154) hide show
  1. package/CHANGELOG.md +50 -48
  2. package/RNSentry.podspec +1 -1
  3. package/android/build.gradle +1 -1
  4. package/android/src/main/java/io/sentry/react/RNSentryModuleImpl.java +1 -54
  5. package/android/src/newarch/java/io/sentry/react/RNSentryModule.java +0 -10
  6. package/android/src/oldarch/java/io/sentry/react/RNSentryModule.java +0 -10
  7. package/dist/js/NativeRNSentry.d.ts +0 -2
  8. package/dist/js/NativeRNSentry.d.ts.map +1 -1
  9. package/dist/js/NativeRNSentry.js.map +1 -1
  10. package/dist/js/client.d.ts +0 -8
  11. package/dist/js/client.d.ts.map +1 -1
  12. package/dist/js/client.js +3 -19
  13. package/dist/js/client.js.map +1 -1
  14. package/dist/js/index.d.ts +5 -3
  15. package/dist/js/index.d.ts.map +1 -1
  16. package/dist/js/index.js +5 -3
  17. package/dist/js/index.js.map +1 -1
  18. package/dist/js/integrations/debugsymbolicator.d.ts +8 -60
  19. package/dist/js/integrations/debugsymbolicator.d.ts.map +1 -1
  20. package/dist/js/integrations/debugsymbolicator.js +137 -209
  21. package/dist/js/integrations/debugsymbolicator.js.map +1 -1
  22. package/dist/js/integrations/debugsymbolicatorutils.d.ts +18 -0
  23. package/dist/js/integrations/debugsymbolicatorutils.d.ts.map +1 -0
  24. package/dist/js/integrations/debugsymbolicatorutils.js +70 -0
  25. package/dist/js/integrations/debugsymbolicatorutils.js.map +1 -0
  26. package/dist/js/integrations/default.d.ts.map +1 -1
  27. package/dist/js/integrations/default.js +24 -49
  28. package/dist/js/integrations/default.js.map +1 -1
  29. package/dist/js/integrations/devicecontext.d.ts +8 -15
  30. package/dist/js/integrations/devicecontext.d.ts.map +1 -1
  31. package/dist/js/integrations/devicecontext.js +74 -74
  32. package/dist/js/integrations/devicecontext.js.map +1 -1
  33. package/dist/js/integrations/eventorigin.d.ts +8 -15
  34. package/dist/js/integrations/eventorigin.d.ts.map +1 -1
  35. package/dist/js/integrations/eventorigin.js +17 -17
  36. package/dist/js/integrations/eventorigin.js.map +1 -1
  37. package/dist/js/integrations/expocontext.d.ts +8 -15
  38. package/dist/js/integrations/expocontext.d.ts.map +1 -1
  39. package/dist/js/integrations/expocontext.js +28 -32
  40. package/dist/js/integrations/expocontext.js.map +1 -1
  41. package/dist/js/integrations/exports.d.ts +16 -0
  42. package/dist/js/integrations/exports.d.ts.map +1 -0
  43. package/dist/js/integrations/exports.js +16 -0
  44. package/dist/js/integrations/exports.js.map +1 -0
  45. package/dist/js/integrations/index.d.ts +4 -1
  46. package/dist/js/integrations/index.d.ts.map +1 -1
  47. package/dist/js/integrations/index.js +5 -1
  48. package/dist/js/integrations/index.js.map +1 -1
  49. package/dist/js/integrations/modulesloader.d.ts +8 -15
  50. package/dist/js/integrations/modulesloader.d.ts.map +1 -1
  51. package/dist/js/integrations/modulesloader.js +34 -31
  52. package/dist/js/integrations/modulesloader.js.map +1 -1
  53. package/dist/js/integrations/nativelinkederrors.d.ts +8 -51
  54. package/dist/js/integrations/nativelinkederrors.d.ts.map +1 -1
  55. package/dist/js/integrations/nativelinkederrors.js +112 -124
  56. package/dist/js/integrations/nativelinkederrors.js.map +1 -1
  57. package/dist/js/integrations/reactnativeerrorhandlers.d.ts +8 -54
  58. package/dist/js/integrations/reactnativeerrorhandlers.d.ts.map +1 -1
  59. package/dist/js/integrations/reactnativeerrorhandlers.js +109 -199
  60. package/dist/js/integrations/reactnativeerrorhandlers.js.map +1 -1
  61. package/dist/js/integrations/reactnativeerrorhandlersutils.d.ts +27 -0
  62. package/dist/js/integrations/reactnativeerrorhandlersutils.d.ts.map +1 -0
  63. package/dist/js/integrations/reactnativeerrorhandlersutils.js +77 -0
  64. package/dist/js/integrations/reactnativeerrorhandlersutils.js.map +1 -0
  65. package/dist/js/integrations/reactnativeinfo.d.ts +8 -15
  66. package/dist/js/integrations/reactnativeinfo.d.ts.map +1 -1
  67. package/dist/js/integrations/reactnativeinfo.js +51 -51
  68. package/dist/js/integrations/reactnativeinfo.js.map +1 -1
  69. package/dist/js/integrations/release.d.ts +8 -15
  70. package/dist/js/integrations/release.d.ts.map +1 -1
  71. package/dist/js/integrations/release.js +55 -57
  72. package/dist/js/integrations/release.js.map +1 -1
  73. package/dist/js/integrations/rewriteframes.js +2 -2
  74. package/dist/js/integrations/rewriteframes.js.map +1 -1
  75. package/dist/js/integrations/screenshot.d.ts +8 -23
  76. package/dist/js/integrations/screenshot.d.ts.map +1 -1
  77. package/dist/js/integrations/screenshot.js +31 -47
  78. package/dist/js/integrations/screenshot.js.map +1 -1
  79. package/dist/js/integrations/sdkinfo.d.ts +8 -16
  80. package/dist/js/integrations/sdkinfo.d.ts.map +1 -1
  81. package/dist/js/integrations/sdkinfo.js +54 -41
  82. package/dist/js/integrations/sdkinfo.js.map +1 -1
  83. package/dist/js/integrations/spotlight.d.ts +10 -2
  84. package/dist/js/integrations/spotlight.d.ts.map +1 -1
  85. package/dist/js/integrations/spotlight.js +14 -9
  86. package/dist/js/integrations/spotlight.js.map +1 -1
  87. package/dist/js/integrations/viewhierarchy.d.ts +8 -18
  88. package/dist/js/integrations/viewhierarchy.d.ts.map +1 -1
  89. package/dist/js/integrations/viewhierarchy.js +46 -43
  90. package/dist/js/integrations/viewhierarchy.js.map +1 -1
  91. package/dist/js/options.d.ts +2 -24
  92. package/dist/js/options.d.ts.map +1 -1
  93. package/dist/js/options.js.map +1 -1
  94. package/dist/js/profiling/integration.d.ts +8 -32
  95. package/dist/js/profiling/integration.d.ts.map +1 -1
  96. package/dist/js/profiling/integration.js +120 -119
  97. package/dist/js/profiling/integration.js.map +1 -1
  98. package/dist/js/tracing/nativeframes.d.ts +0 -4
  99. package/dist/js/tracing/nativeframes.d.ts.map +1 -1
  100. package/dist/js/tracing/nativeframes.js +14 -14
  101. package/dist/js/tracing/nativeframes.js.map +1 -1
  102. package/dist/js/utils/environment.d.ts +0 -4
  103. package/dist/js/utils/environment.d.ts.map +1 -1
  104. package/dist/js/utils/environment.js +0 -8
  105. package/dist/js/utils/environment.js.map +1 -1
  106. package/dist/js/version.d.ts +1 -1
  107. package/dist/js/version.d.ts.map +1 -1
  108. package/dist/js/version.js +1 -1
  109. package/dist/js/version.js.map +1 -1
  110. package/dist/js/wrapper.d.ts +1 -7
  111. package/dist/js/wrapper.d.ts.map +1 -1
  112. package/dist/js/wrapper.js +0 -24
  113. package/dist/js/wrapper.js.map +1 -1
  114. package/ios/RNSentry.mm +1 -47
  115. package/ios/RNSentryOnDrawReporter.h +23 -0
  116. package/ios/RNSentryOnDrawReporter.m +2 -17
  117. package/package.json +1 -9
  118. package/src/js/NativeRNSentry.ts +0 -2
  119. package/ts3.8/dist/js/NativeRNSentry.d.ts +0 -2
  120. package/ts3.8/dist/js/client.d.ts +0 -8
  121. package/ts3.8/dist/js/index.d.ts +5 -3
  122. package/ts3.8/dist/js/integrations/debugsymbolicator.d.ts +8 -60
  123. package/ts3.8/dist/js/integrations/debugsymbolicatorutils.d.ts +18 -0
  124. package/ts3.8/dist/js/integrations/devicecontext.d.ts +8 -15
  125. package/ts3.8/dist/js/integrations/eventorigin.d.ts +8 -15
  126. package/ts3.8/dist/js/integrations/expocontext.d.ts +8 -15
  127. package/ts3.8/dist/js/integrations/exports.d.ts +16 -0
  128. package/ts3.8/dist/js/integrations/index.d.ts +4 -1
  129. package/ts3.8/dist/js/integrations/modulesloader.d.ts +8 -15
  130. package/ts3.8/dist/js/integrations/nativelinkederrors.d.ts +8 -51
  131. package/ts3.8/dist/js/integrations/reactnativeerrorhandlers.d.ts +8 -54
  132. package/ts3.8/dist/js/integrations/reactnativeerrorhandlersutils.d.ts +27 -0
  133. package/ts3.8/dist/js/integrations/reactnativeinfo.d.ts +8 -15
  134. package/ts3.8/dist/js/integrations/release.d.ts +8 -15
  135. package/ts3.8/dist/js/integrations/screenshot.d.ts +8 -23
  136. package/ts3.8/dist/js/integrations/sdkinfo.d.ts +8 -16
  137. package/ts3.8/dist/js/integrations/spotlight.d.ts +10 -2
  138. package/ts3.8/dist/js/integrations/viewhierarchy.d.ts +8 -18
  139. package/ts3.8/dist/js/options.d.ts +2 -24
  140. package/ts3.8/dist/js/profiling/integration.d.ts +8 -32
  141. package/ts3.8/dist/js/tracing/nativeframes.d.ts +0 -4
  142. package/ts3.8/dist/js/utils/environment.d.ts +0 -4
  143. package/ts3.8/dist/js/version.d.ts +1 -1
  144. package/ts3.8/dist/js/wrapper.d.ts +1 -7
  145. package/dist/js/integrations/mobilereplay.d.ts +0 -36
  146. package/dist/js/integrations/mobilereplay.d.ts.map +0 -1
  147. package/dist/js/integrations/mobilereplay.js +0 -97
  148. package/dist/js/integrations/mobilereplay.js.map +0 -1
  149. package/dist/js/utils/clientutils.d.ts +0 -8
  150. package/dist/js/utils/clientutils.d.ts.map +0 -1
  151. package/dist/js/utils/clientutils.js +0 -7
  152. package/dist/js/utils/clientutils.js.map +0 -1
  153. package/ts3.8/dist/js/integrations/mobilereplay.d.ts +0 -36
  154. package/ts3.8/dist/js/utils/clientutils.d.ts +0 -8
@@ -1,59 +1,59 @@
1
- import { __awaiter } from "tslib";
1
+ import { convertIntegrationFnToClass } from '@sentry/core';
2
2
  import { getExpoGoVersion, getExpoSdkVersion, getHermesVersion, getReactNativeVersion, isExpo, isFabricEnabled, isHermesEnabled, isTurboModuleEnabled, } from '../utils/environment';
3
+ const INTEGRATION_NAME = 'ReactNativeInfo';
3
4
  /** Loads React Native context at runtime */
4
- export class ReactNativeInfo {
5
- constructor() {
6
- /**
7
- * @inheritDoc
8
- */
9
- this.name = ReactNativeInfo.id;
5
+ export const reactNativeInfoIntegration = () => {
6
+ return {
7
+ name: INTEGRATION_NAME,
8
+ setupOnce: () => {
9
+ // noop
10
+ },
11
+ processEvent,
12
+ };
13
+ };
14
+ /**
15
+ * Loads React Native context at runtime
16
+ *
17
+ * @deprecated Use `reactNativeInfoIntegration()` instead.
18
+ */
19
+ // eslint-disable-next-line deprecation/deprecation
20
+ export const ReactNativeInfo = convertIntegrationFnToClass(INTEGRATION_NAME, reactNativeInfoIntegration);
21
+ function processEvent(event, hint) {
22
+ const reactNativeError = (hint === null || hint === void 0 ? void 0 : hint.originalException) ? hint === null || hint === void 0 ? void 0 : hint.originalException : undefined;
23
+ const reactNativeContext = {
24
+ turbo_module: isTurboModuleEnabled(),
25
+ fabric: isFabricEnabled(),
26
+ react_native_version: getReactNativeVersion(),
27
+ expo: isExpo(),
28
+ };
29
+ if (isHermesEnabled()) {
30
+ reactNativeContext.js_engine = 'hermes';
31
+ const hermesVersion = getHermesVersion();
32
+ if (hermesVersion) {
33
+ reactNativeContext.hermes_version = hermesVersion;
34
+ }
35
+ reactNativeContext.hermes_debug_info = !isEventWithHermesBytecodeFrames(event);
10
36
  }
11
- /**
12
- * @inheritDoc
13
- */
14
- setupOnce(addGlobalEventProcessor) {
15
- addGlobalEventProcessor((event, hint) => __awaiter(this, void 0, void 0, function* () {
16
- const reactNativeError = (hint === null || hint === void 0 ? void 0 : hint.originalException) ? hint === null || hint === void 0 ? void 0 : hint.originalException : undefined;
17
- const reactNativeContext = {
18
- turbo_module: isTurboModuleEnabled(),
19
- fabric: isFabricEnabled(),
20
- react_native_version: getReactNativeVersion(),
21
- expo: isExpo(),
22
- };
23
- if (isHermesEnabled()) {
24
- reactNativeContext.js_engine = 'hermes';
25
- const hermesVersion = getHermesVersion();
26
- if (hermesVersion) {
27
- reactNativeContext.hermes_version = hermesVersion;
28
- }
29
- reactNativeContext.hermes_debug_info = !isEventWithHermesBytecodeFrames(event);
30
- }
31
- else if (reactNativeError === null || reactNativeError === void 0 ? void 0 : reactNativeError.jsEngine) {
32
- reactNativeContext.js_engine = reactNativeError.jsEngine;
33
- }
34
- if (reactNativeContext.js_engine === 'hermes') {
35
- event.tags = Object.assign({ hermes: 'true' }, event.tags);
36
- }
37
- if (reactNativeError === null || reactNativeError === void 0 ? void 0 : reactNativeError.componentStack) {
38
- reactNativeContext.component_stack = reactNativeError.componentStack;
39
- }
40
- const expoGoVersion = getExpoGoVersion();
41
- if (expoGoVersion) {
42
- reactNativeContext.expo_go_version = expoGoVersion;
43
- }
44
- const expoSdkVersion = getExpoSdkVersion();
45
- if (expoSdkVersion) {
46
- reactNativeContext.expo_sdk_version = expoSdkVersion;
47
- }
48
- event.contexts = Object.assign({ react_native_context: reactNativeContext }, event.contexts);
49
- return event;
50
- }));
37
+ else if (reactNativeError === null || reactNativeError === void 0 ? void 0 : reactNativeError.jsEngine) {
38
+ reactNativeContext.js_engine = reactNativeError.jsEngine;
39
+ }
40
+ if (reactNativeContext.js_engine === 'hermes') {
41
+ event.tags = Object.assign({ hermes: 'true' }, event.tags);
42
+ }
43
+ if (reactNativeError === null || reactNativeError === void 0 ? void 0 : reactNativeError.componentStack) {
44
+ reactNativeContext.component_stack = reactNativeError.componentStack;
51
45
  }
46
+ const expoGoVersion = getExpoGoVersion();
47
+ if (expoGoVersion) {
48
+ reactNativeContext.expo_go_version = expoGoVersion;
49
+ }
50
+ const expoSdkVersion = getExpoSdkVersion();
51
+ if (expoSdkVersion) {
52
+ reactNativeContext.expo_sdk_version = expoSdkVersion;
53
+ }
54
+ event.contexts = Object.assign({ react_native_context: reactNativeContext }, event.contexts);
55
+ return event;
52
56
  }
53
- /**
54
- * @inheritDoc
55
- */
56
- ReactNativeInfo.id = 'ReactNativeInfo';
57
57
  /**
58
58
  * Guess if the event contains frames with Hermes bytecode
59
59
  * (thus Hermes bundle doesn't contain debug info)
@@ -1 +1 @@
1
- {"version":3,"file":"reactnativeinfo.js","sourceRoot":"","sources":["../../../src/js/integrations/reactnativeinfo.ts"],"names":[],"mappings":";AAEA,OAAO,EACL,gBAAgB,EAChB,iBAAiB,EACjB,gBAAgB,EAChB,qBAAqB,EACrB,MAAM,EACN,eAAe,EACf,eAAe,EACf,oBAAoB,GACrB,MAAM,sBAAsB,CAAC;AAgB9B,4CAA4C;AAC5C,MAAM,OAAO,eAAe;IAA5B;QAME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AG,gBAAgB,EAAE,CAAC;YACzC,IAAI,aAAa,EAAE;gBACjB,kBAAkB,CAAC,eAAe,GAAG,aAAa,CAAC;aACpD;YAED,MAAM,cAAc,GAAG,iBAAiB,EAAE,CAAC;YAC3C,IAAI,cAAc,EAAE;gBAClB,kBAAkB,CAAC,gBAAgB,GAAG,cAAc,CAAC;aACtD;YAED,KAAK,CAAC,QAAQ,mBACZ,oBAAoB,EAAE,kBAAkB,IACrC,KAAK,CAAC,QAAQ,CAClB,CAAC;YAEF,OAAO,KAAK,CAAC;QACf,CAAC,CAAA,CAAC,CAAC;IACL,CAAC;;AA/DD;;GAEG;AACW,kBAAE,GAAW,iBAAiB,CAAC;AA+D/C;;;;;;;;;;;;;;;;GAgBG;AACH,SAAS,+BAA+B,CAAC,KAAY;;IACnD,KAAK,MAAM,KAAK,IAAI,CAAA,MAAA,KAAK,CAAC,SAAS,0CAAE,MAAM,MAAI,MAAA,KAAK,CAAC,OAAO,0CAAE,MAAM,CAAA,IAAI,EAAE,EAAE;QAC1E,KAAK,MAAM,KAAK,IAAI,CAAA,MAAA,KAAK,CAAC,UAAU,0CAAE,MAAM,KAAI,EAAE,EAAE;YAClD,mGAAmG;YACnG,IAAI,KAAK,CAAC,QAAQ,KAAK,SAAS,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE;gBACtD,OAAO,IAAI,CAAC;aACb;SACF;KACF;IACD,OAAO,KAAK,CAAC;AACf,CAAC","sourcesContent":["import type { Context, Event, EventHint, EventProcessor, Integration } from '@sentry/types';\n\nimport {\n getExpoGoVersion,\n getExpoSdkVersion,\n getHermesVersion,\n getReactNativeVersion,\n isExpo,\n isFabricEnabled,\n isHermesEnabled,\n isTurboModuleEnabled,\n} from '../utils/environment';\nimport type { ReactNativeError } from './debugsymbolicator';\n\nexport interface ReactNativeContext extends Context {\n js_engine?: string;\n turbo_module: boolean;\n fabric: boolean;\n expo: boolean;\n hermes_version?: string;\n react_native_version?: string;\n component_stack?: string;\n hermes_debug_info?: boolean;\n expo_go_version?: string;\n expo_sdk_version?: string;\n}\n\n/** Loads React Native context at runtime */\nexport class ReactNativeInfo implements Integration {\n /**\n * @inheritDoc\n */\n public static id: string = 'ReactNativeInfo';\n\n /**\n * @inheritDoc\n */\n public name: string = ReactNativeInfo.id;\n\n /**\n * @inheritDoc\n */\n public setupOnce(addGlobalEventProcessor: (callback: EventProcessor) => void): void {\n addGlobalEventProcessor(async (event: Event, hint?: EventHint) => {\n const reactNativeError = hint?.originalException ? (hint?.originalException as ReactNativeError) : undefined;\n\n const reactNativeContext: ReactNativeContext = {\n turbo_module: isTurboModuleEnabled(),\n fabric: isFabricEnabled(),\n react_native_version: getReactNativeVersion(),\n expo: isExpo(),\n };\n\n if (isHermesEnabled()) {\n reactNativeContext.js_engine = 'hermes';\n const hermesVersion = getHermesVersion();\n if (hermesVersion) {\n reactNativeContext.hermes_version = hermesVersion;\n }\n reactNativeContext.hermes_debug_info = !isEventWithHermesBytecodeFrames(event);\n } else if (reactNativeError?.jsEngine) {\n reactNativeContext.js_engine = reactNativeError.jsEngine;\n }\n\n if (reactNativeContext.js_engine === 'hermes') {\n event.tags = {\n hermes: 'true',\n ...event.tags,\n };\n }\n\n if (reactNativeError?.componentStack) {\n reactNativeContext.component_stack = reactNativeError.componentStack;\n }\n\n const expoGoVersion = getExpoGoVersion();\n if (expoGoVersion) {\n reactNativeContext.expo_go_version = expoGoVersion;\n }\n\n const expoSdkVersion = getExpoSdkVersion();\n if (expoSdkVersion) {\n reactNativeContext.expo_sdk_version = expoSdkVersion;\n }\n\n event.contexts = {\n react_native_context: reactNativeContext,\n ...event.contexts,\n };\n\n return event;\n });\n }\n}\n\n/**\n * Guess if the event contains frames with Hermes bytecode\n * (thus Hermes bundle doesn't contain debug info)\n * based on the event exception/threads frames.\n *\n * This function can be relied on only if Hermes is enabled!\n *\n * Hermes bytecode position is always line 1 and column 0-based number.\n * If Hermes bundle has debug info, the bytecode frames pos are calculated\n * back to the plain bundle source code positions and line will be > 1.\n *\n * Line 1 contains start time var, it's safe to assume it won't crash.\n * The above only applies when Hermes is enabled.\n *\n * Javascript/Hermes bytecode frames have platform === undefined.\n * Native (Java, ObjC, C++) frames have platform === 'android'/'ios'/'native'.\n */\nfunction isEventWithHermesBytecodeFrames(event: Event): boolean {\n for (const value of event.exception?.values || event.threads?.values || []) {\n for (const frame of value.stacktrace?.frames || []) {\n // platform === undefined we assume it's javascript (only native frames use the platform attribute)\n if (frame.platform === undefined && frame.lineno === 1) {\n return true;\n }\n }\n }\n return false;\n}\n"]}
1
+ {"version":3,"file":"reactnativeinfo.js","sourceRoot":"","sources":["../../../src/js/integrations/reactnativeinfo.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,2BAA2B,EAAE,MAAM,cAAc,CAAC;AAG3D,OAAO,EACL,gBAAgB,EAChB,iBAAiB,EACjB,gBAAgB,EAChB,qBAAqB,EACrB,MAAM,EACN,eAAe,EACf,eAAe,EACf,oBAAoB,GACrB,MAAM,sBAAsB,CAAC;AAG9B,MAAM,gBAAgB,GAAG,iBAAiB,CAAC;AAe3C,4CAA4C;AAC5C,MAAM,CAAC,MAAM,0BAA0B,GAAG,GAAwB,EAAE;IAClE,OAAO;QACL,IAAI,EAAE,gBAAgB;QACtB,SAAS,EAAE,GAAG,EAAE;YACd,OAAO;QACT,CAAC;QACD,YAAY;KACb,CAAC;AACJ,CAAC,CAAC;AAEF;;;;GAIG;AACH,mDAAmD;AACnD,MAAM,CAAC,MAAM,eAAe,GAAG,2BAA2B,CACxD,gBAAgB,EAChB,0BAA0B,CACM,CAAC;AAEnC,SAAS,YAAY,CAAC,KAAY,EAAE,IAAe;IACjD,MAAM,gBAAgB,GAAG,CAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,iBAAiB,EAAC,CAAC,CAAE,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,iBAAsC,CAAC,CAAC,CAAC,SAAS,CAAC;IAE7G,MAAM,kBAAkB,GAAuB;QAC7C,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B,CAAC,KAAY;;IACnD,KAAK,MAAM,KAAK,IAAI,CAAA,MAAA,KAAK,CAAC,SAAS,0CAAE,MAAM,MAAI,MAAA,KAAK,CAAC,OAAO,0CAAE,MAAM,CAAA,IAAI,EAAE,EAAE;QAC1E,KAAK,MAAM,KAAK,IAAI,CAAA,MAAA,KAAK,CAAC,UAAU,0CAAE,MAAM,KAAI,EAAE,EAAE;YAClD,mGAAmG;YACnG,IAAI,KAAK,CAAC,QAAQ,KAAK,SAAS,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE;gBACtD,OAAO,IAAI,CAAC;aACb;SACF;KACF;IACD,OAAO,KAAK,CAAC;AACf,CAAC","sourcesContent":["import { convertIntegrationFnToClass } from '@sentry/core';\nimport type { Context, Event, EventHint, Integration, IntegrationClass, IntegrationFnResult } from '@sentry/types';\n\nimport {\n getExpoGoVersion,\n getExpoSdkVersion,\n getHermesVersion,\n getReactNativeVersion,\n isExpo,\n isFabricEnabled,\n isHermesEnabled,\n isTurboModuleEnabled,\n} from '../utils/environment';\nimport type { ReactNativeError } from './debugsymbolicator';\n\nconst INTEGRATION_NAME = 'ReactNativeInfo';\n\nexport interface ReactNativeContext extends Context {\n js_engine?: string;\n turbo_module: boolean;\n fabric: boolean;\n expo: boolean;\n hermes_version?: string;\n react_native_version?: string;\n component_stack?: string;\n hermes_debug_info?: boolean;\n expo_go_version?: string;\n expo_sdk_version?: string;\n}\n\n/** Loads React Native context at runtime */\nexport const reactNativeInfoIntegration = (): IntegrationFnResult => {\n return {\n name: INTEGRATION_NAME,\n setupOnce: () => {\n // noop\n },\n processEvent,\n };\n};\n\n/**\n * Loads React Native context at runtime\n *\n * @deprecated Use `reactNativeInfoIntegration()` instead.\n */\n// eslint-disable-next-line deprecation/deprecation\nexport const ReactNativeInfo = convertIntegrationFnToClass(\n INTEGRATION_NAME,\n reactNativeInfoIntegration,\n) as IntegrationClass<Integration>;\n\nfunction processEvent(event: Event, hint: EventHint): Event {\n const reactNativeError = hint?.originalException ? (hint?.originalException as ReactNativeError) : undefined;\n\n const reactNativeContext: ReactNativeContext = {\n turbo_module: isTurboModuleEnabled(),\n fabric: isFabricEnabled(),\n react_native_version: getReactNativeVersion(),\n expo: isExpo(),\n };\n\n if (isHermesEnabled()) {\n reactNativeContext.js_engine = 'hermes';\n const hermesVersion = getHermesVersion();\n if (hermesVersion) {\n reactNativeContext.hermes_version = hermesVersion;\n }\n reactNativeContext.hermes_debug_info = !isEventWithHermesBytecodeFrames(event);\n } else if (reactNativeError?.jsEngine) {\n reactNativeContext.js_engine = reactNativeError.jsEngine;\n }\n\n if (reactNativeContext.js_engine === 'hermes') {\n event.tags = {\n hermes: 'true',\n ...event.tags,\n };\n }\n\n if (reactNativeError?.componentStack) {\n reactNativeContext.component_stack = reactNativeError.componentStack;\n }\n\n const expoGoVersion = getExpoGoVersion();\n if (expoGoVersion) {\n reactNativeContext.expo_go_version = expoGoVersion;\n }\n\n const expoSdkVersion = getExpoSdkVersion();\n if (expoSdkVersion) {\n reactNativeContext.expo_sdk_version = expoSdkVersion;\n }\n\n event.contexts = {\n react_native_context: reactNativeContext,\n ...event.contexts,\n };\n\n return event;\n}\n\n/**\n * Guess if the event contains frames with Hermes bytecode\n * (thus Hermes bundle doesn't contain debug info)\n * based on the event exception/threads frames.\n *\n * This function can be relied on only if Hermes is enabled!\n *\n * Hermes bytecode position is always line 1 and column 0-based number.\n * If Hermes bundle has debug info, the bytecode frames pos are calculated\n * back to the plain bundle source code positions and line will be > 1.\n *\n * Line 1 contains start time var, it's safe to assume it won't crash.\n * The above only applies when Hermes is enabled.\n *\n * Javascript/Hermes bytecode frames have platform === undefined.\n * Native (Java, ObjC, C++) frames have platform === 'android'/'ios'/'native'.\n */\nfunction isEventWithHermesBytecodeFrames(event: Event): boolean {\n for (const value of event.exception?.values || event.threads?.values || []) {\n for (const frame of value.stacktrace?.frames || []) {\n // platform === undefined we assume it's javascript (only native frames use the platform attribute)\n if (frame.platform === undefined && frame.lineno === 1) {\n return true;\n }\n }\n }\n return false;\n}\n"]}
@@ -1,17 +1,10 @@
1
- import type { Integration } from '@sentry/types';
1
+ import type { Integration, IntegrationClass, IntegrationFnResult } from '@sentry/types';
2
2
  /** Release integration responsible to load release from file. */
3
- export declare class Release implements Integration {
4
- /**
5
- * @inheritDoc
6
- */
7
- static id: string;
8
- /**
9
- * @inheritDoc
10
- */
11
- name: string;
12
- /**
13
- * @inheritDoc
14
- */
15
- setupOnce(): void;
16
- }
3
+ export declare const nativeReleaseIntegration: () => IntegrationFnResult;
4
+ /**
5
+ * Release integration responsible to load release from file.
6
+ *
7
+ * @deprecated Use `nativeReleaseIntegration()` instead.
8
+ */
9
+ export declare const Release: IntegrationClass<Integration>;
17
10
  //# sourceMappingURL=release.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"release.d.ts","sourceRoot":"","sources":["../../../src/js/integrations/release.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAS,WAAW,EAAE,MAAM,eAAe,CAAC;AAIxD,iEAAiE;AACjE,qBAAa,OAAQ,YAAW,WAAW;IACzC;;OAEG;IACH,OAAc,EAAE,EAAE,MAAM,CAAa;IACrC;;OAEG;IACI,IAAI,EAAE,MAAM,CAAc;IAEjC;;OAEG;IACI,SAAS,IAAI,IAAI;CA8CzB"}
1
+ {"version":3,"file":"release.d.ts","sourceRoot":"","sources":["../../../src/js/integrations/release.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAMV,WAAW,EACX,gBAAgB,EAChB,mBAAmB,EACpB,MAAM,eAAe,CAAC;AAMvB,iEAAiE;AACjE,eAAO,MAAM,wBAAwB,QAAO,mBAQ3C,CAAC;AAEF;;;;GAIG;AAEH,eAAO,MAAM,OAAO,+BAGc,CAAC"}
@@ -1,64 +1,62 @@
1
1
  import { __awaiter } from "tslib";
2
- import { addGlobalEventProcessor, getCurrentHub } from '@sentry/core';
2
+ import { convertIntegrationFnToClass } from '@sentry/core';
3
3
  import { NATIVE } from '../wrapper';
4
+ const INTEGRATION_NAME = 'Release';
4
5
  /** Release integration responsible to load release from file. */
5
- export class Release {
6
- constructor() {
7
- /**
8
- * @inheritDoc
9
- */
10
- this.name = Release.id;
11
- }
12
- /**
13
- * @inheritDoc
14
- */
15
- setupOnce() {
16
- addGlobalEventProcessor((event) => __awaiter(this, void 0, void 0, function* () {
17
- var _a, _b, _c;
18
- const self = getCurrentHub().getIntegration(Release);
19
- if (!self) {
20
- return event;
21
- }
22
- const options = (_a = getCurrentHub().getClient()) === null || _a === void 0 ? void 0 : _a.getOptions();
23
- /*
24
- __sentry_release and __sentry_dist is set by the user with setRelease and setDist. If this is used then this is the strongest.
25
- Otherwise we check for the release and dist in the options passed on init, as this is stronger than the release/dist from the native build.
26
- */
27
- if (typeof ((_b = event.extra) === null || _b === void 0 ? void 0 : _b.__sentry_release) === 'string') {
28
- event.release = `${event.extra.__sentry_release}`;
29
- }
30
- else if (typeof (options === null || options === void 0 ? void 0 : options.release) === 'string') {
31
- event.release = options.release;
32
- }
33
- if (typeof ((_c = event.extra) === null || _c === void 0 ? void 0 : _c.__sentry_dist) === 'string') {
34
- event.dist = `${event.extra.__sentry_dist}`;
35
- }
36
- else if (typeof (options === null || options === void 0 ? void 0 : options.dist) === 'string') {
37
- event.dist = options.dist;
38
- }
39
- if (event.release && event.dist) {
40
- return event;
41
- }
42
- try {
43
- const nativeRelease = yield NATIVE.fetchNativeRelease();
44
- if (nativeRelease) {
45
- if (!event.release) {
46
- event.release = `${nativeRelease.id}@${nativeRelease.version}+${nativeRelease.build}`;
47
- }
48
- if (!event.dist) {
49
- event.dist = `${nativeRelease.build}`;
50
- }
6
+ export const nativeReleaseIntegration = () => {
7
+ return {
8
+ name: INTEGRATION_NAME,
9
+ setupOnce: () => {
10
+ // noop
11
+ },
12
+ processEvent,
13
+ };
14
+ };
15
+ /**
16
+ * Release integration responsible to load release from file.
17
+ *
18
+ * @deprecated Use `nativeReleaseIntegration()` instead.
19
+ */
20
+ // eslint-disable-next-line deprecation/deprecation
21
+ export const Release = convertIntegrationFnToClass(INTEGRATION_NAME, nativeReleaseIntegration);
22
+ function processEvent(event, _, client) {
23
+ var _a, _b;
24
+ return __awaiter(this, void 0, void 0, function* () {
25
+ const options = client.getOptions();
26
+ /*
27
+ __sentry_release and __sentry_dist is set by the user with setRelease and setDist. If this is used then this is the strongest.
28
+ Otherwise we check for the release and dist in the options passed on init, as this is stronger than the release/dist from the native build.
29
+ */
30
+ if (typeof ((_a = event.extra) === null || _a === void 0 ? void 0 : _a.__sentry_release) === 'string') {
31
+ event.release = `${event.extra.__sentry_release}`;
32
+ }
33
+ else if (typeof (options === null || options === void 0 ? void 0 : options.release) === 'string') {
34
+ event.release = options.release;
35
+ }
36
+ if (typeof ((_b = event.extra) === null || _b === void 0 ? void 0 : _b.__sentry_dist) === 'string') {
37
+ event.dist = `${event.extra.__sentry_dist}`;
38
+ }
39
+ else if (typeof (options === null || options === void 0 ? void 0 : options.dist) === 'string') {
40
+ event.dist = options.dist;
41
+ }
42
+ if (event.release && event.dist) {
43
+ return event;
44
+ }
45
+ try {
46
+ const nativeRelease = yield NATIVE.fetchNativeRelease();
47
+ if (nativeRelease) {
48
+ if (!event.release) {
49
+ event.release = `${nativeRelease.id}@${nativeRelease.version}+${nativeRelease.build}`;
50
+ }
51
+ if (!event.dist) {
52
+ event.dist = `${nativeRelease.build}`;
51
53
  }
52
54
  }
53
- catch (_Oo) {
54
- // Something went wrong, we just continue
55
- }
56
- return event;
57
- }));
58
- }
55
+ }
56
+ catch (_Oo) {
57
+ // Something went wrong, we just continue
58
+ }
59
+ return event;
60
+ });
59
61
  }
60
- /**
61
- * @inheritDoc
62
- */
63
- Release.id = 'Release';
64
62
  //# sourceMappingURL=release.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"release.js","sourceRoot":"","sources":["../../../src/js/integrations/release.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,uBAAuB,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAGtE,OAAO,EAAE,MA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AAM,MAAM,CAAC,kBAAkB,EAAE,CAAC;gBACxD,IAAI,aAAa,EAAE;oBACjB,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE;wBAClB,KAAK,CAAC,OAAO,GAAG,GAAG,aAAa,CAAC,EAAE,IAAI,aAAa,CAAC,OAAO,IAAI,aAAa,CAAC,KAAK,EAAE,CAAC;qBACvF;oBACD,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE;wBACf,KAAK,CAAC,IAAI,GAAG,GAAG,aAAa,CAAC,KAAK,EAAE,CAAC;qBACvC;iBACF;aACF;YAAC,OAAO,GAAG,EAAE;gBACZ,yCAAyC;aAC1C;YAED,OAAO,KAAK,CAAC;QACf,CAAC,CAAA,CAAC,CAAC;IACL,CAAC;;AAzDD;;GAEG;AACW,UAAE,GAAW,SAAS,CAAC","sourcesContent":["import { addGlobalEventProcessor, getCurrentHub } from '@sentry/core';\nimport type { Event, Integration } from '@sentry/types';\n\nimport { NATIVE } from '../wrapper';\n\n/** Release integration responsible to load release from file. */\nexport class Release implements Integration {\n /**\n * @inheritDoc\n */\n public static id: string = 'Release';\n /**\n * @inheritDoc\n */\n public name: string = Release.id;\n\n /**\n * @inheritDoc\n */\n public setupOnce(): void {\n addGlobalEventProcessor(async (event: Event) => {\n const self = getCurrentHub().getIntegration(Release);\n if (!self) {\n return event;\n }\n\n const options = getCurrentHub().getClient()?.getOptions();\n\n /*\n __sentry_release and __sentry_dist is set by the user with setRelease and setDist. If this is used then this is the strongest.\n Otherwise we check for the release and dist in the options passed on init, as this is stronger than the release/dist from the native build.\n */\n if (typeof event.extra?.__sentry_release === 'string') {\n event.release = `${event.extra.__sentry_release}`;\n } else if (typeof options?.release === 'string') {\n event.release = options.release;\n }\n\n if (typeof event.extra?.__sentry_dist === 'string') {\n event.dist = `${event.extra.__sentry_dist}`;\n } else if (typeof options?.dist === 'string') {\n event.dist = options.dist;\n }\n\n if (event.release && event.dist) {\n return event;\n }\n\n try {\n const nativeRelease = await NATIVE.fetchNativeRelease();\n if (nativeRelease) {\n if (!event.release) {\n event.release = `${nativeRelease.id}@${nativeRelease.version}+${nativeRelease.build}`;\n }\n if (!event.dist) {\n event.dist = `${nativeRelease.build}`;\n }\n }\n } catch (_Oo) {\n // Something went wrong, we just continue\n }\n\n return event;\n });\n }\n}\n"]}
1
+ {"version":3,"file":"release.js","sourceRoot":"","sources":["../../../src/js/integrations/release.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,2BAA2B,EAAE,MAAM,cAAc,CAAC;AAY3D,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAEpC,MAAM,gBAAgB,GAAG,SAAS,CAAC;AAEnC,iEAAiE;AACjE,MAAM,CAAC,MAAM,wBAAwB,GAAG,GAAwB,EAAE;IAChE,OAAO;QACL,IAAI,EAAE,gBAAgB;QACtB,SAAS,EAAE,GAAG,EAAE;YACd,OAAO;QACT,CAAC;QACD,YAAY;KACb,CAAC;AACJ,CAAC,CAAC;AAEF;;;;GAIG;AACH,mDAAmD;AACnD,MAAM,CAAC,MAAM,OAAO,GAAG,2BAA2B,CAChD,gBAAgB,EAChB,wBAAwB,CACQ,CAAC;AAEnC,SAAe,YAAY,CACzB,KAAY,EACZ,CAAY,EACZ,MAAmD;;;QAEnD,MAAM,OAAO,GAAG,MAAM,CAAC,UAAU,EAAE,CAAC;QAEpC;;;UAGE;QACF,IAAI,OAAO,CAAA,MAAA,KAAK,CAAC,KAAK,0CAAE,gBAAgB,CAAA,KAAK,QAAQ,EAAE;YACrD,KAAK,CAAC,OAAO,GAAG,GAAG,KAAK,CAAC,KAAK,CAAC,gBAAgB,EAAE,CAAC;SACnD;aAAM,IAAI,OAAO,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,OAAO,CAAA,KAAK,QAAQ,EAAE;YAC/C,KAAK,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;SACjC;QAED,IAAI,OAAO,CAAA,MAAA,KAAK,CAAC,KAAK,0CAAE,aAAa,CAAA,KAAK,QAAQ,EAAE;YAClD,KAAK,CAAC,IAAI,GAAG,GAAG,KAAK,CAAC,KAAK,CAAC,aAAa,EAAE,CAAC;SAC7C;aAAM,IAAI,OAAO,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,IAAI,CAAA,KAAK,QAAQ,EAAE;YAC5C,KAAK,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;SAC3B;QAED,IAAI,KAAK,CAAC,OAAO,IAAI,KAAK,CAAC,IAAI,EAAE;YAC/B,OAAO,KAAK,CAAC;SACd;QAED,IAAI;YACF,MAAM,aAAa,GAAG,MAAM,MAAM,CAAC,kBAAkB,EAAE,CAAC;YACxD,IAAI,aAAa,EAAE;gBACjB,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE;oBAClB,KAAK,CAAC,OAAO,GAAG,GAAG,aAAa,CAAC,EAAE,IAAI,aAAa,CAAC,OAAO,IAAI,aAAa,CAAC,KAAK,EAAE,CAAC;iBACvF;gBACD,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE;oBACf,KAAK,CAAC,IAAI,GAAG,GAAG,aAAa,CAAC,KAAK,EAAE,CAAC;iBACvC;aACF;SACF;QAAC,OAAO,GAAG,EAAE;YACZ,yCAAyC;SAC1C;QAED,OAAO,KAAK,CAAC;;CACd","sourcesContent":["import { convertIntegrationFnToClass } from '@sentry/core';\nimport type {\n BaseTransportOptions,\n Client,\n ClientOptions,\n Event,\n EventHint,\n Integration,\n IntegrationClass,\n IntegrationFnResult,\n} from '@sentry/types';\n\nimport { NATIVE } from '../wrapper';\n\nconst INTEGRATION_NAME = 'Release';\n\n/** Release integration responsible to load release from file. */\nexport const nativeReleaseIntegration = (): IntegrationFnResult => {\n return {\n name: INTEGRATION_NAME,\n setupOnce: () => {\n // noop\n },\n processEvent,\n };\n};\n\n/**\n * Release integration responsible to load release from file.\n *\n * @deprecated Use `nativeReleaseIntegration()` instead.\n */\n// eslint-disable-next-line deprecation/deprecation\nexport const Release = convertIntegrationFnToClass(\n INTEGRATION_NAME,\n nativeReleaseIntegration,\n) as IntegrationClass<Integration>;\n\nasync function processEvent(\n event: Event,\n _: EventHint,\n client: Client<ClientOptions<BaseTransportOptions>>,\n): Promise<Event> {\n const options = client.getOptions();\n\n /*\n __sentry_release and __sentry_dist is set by the user with setRelease and setDist. If this is used then this is the strongest.\n Otherwise we check for the release and dist in the options passed on init, as this is stronger than the release/dist from the native build.\n */\n if (typeof event.extra?.__sentry_release === 'string') {\n event.release = `${event.extra.__sentry_release}`;\n } else if (typeof options?.release === 'string') {\n event.release = options.release;\n }\n\n if (typeof event.extra?.__sentry_dist === 'string') {\n event.dist = `${event.extra.__sentry_dist}`;\n } else if (typeof options?.dist === 'string') {\n event.dist = options.dist;\n }\n\n if (event.release && event.dist) {\n return event;\n }\n\n try {\n const nativeRelease = await NATIVE.fetchNativeRelease();\n if (nativeRelease) {\n if (!event.release) {\n event.release = `${nativeRelease.id}@${nativeRelease.version}+${nativeRelease.build}`;\n }\n if (!event.dist) {\n event.dist = `${nativeRelease.build}`;\n }\n }\n } catch (_Oo) {\n // Something went wrong, we just continue\n }\n\n return event;\n}\n"]}
@@ -1,4 +1,4 @@
1
- import { RewriteFrames } from '@sentry/integrations';
1
+ import { rewriteFramesIntegration } from '@sentry/integrations';
2
2
  import { Platform } from 'react-native';
3
3
  import { isExpo, isHermesEnabled } from '../utils/environment';
4
4
  export const ANDROID_DEFAULT_BUNDLE_NAME = 'app:///index.android.bundle';
@@ -10,7 +10,7 @@ export const IOS_DEFAULT_BUNDLE_NAME = 'app:///main.jsbundle';
10
10
  * and Expo bundle postfix.
11
11
  */
12
12
  export function createReactNativeRewriteFrames() {
13
- return new RewriteFrames({
13
+ return rewriteFramesIntegration({
14
14
  iteratee: (frame) => {
15
15
  if (frame.platform === 'java' || frame.platform === 'cocoa') {
16
16
  // Because platform is not required in StackFrame type
@@ -1 +1 @@
1
- {"version":3,"file":"rewriteframes.js","sourceRoot":"","sources":["../../../src/js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;YAC5C,IAAI,MAAM,EAAE,IAAI,QAAQ,CAAC,EAAE,KAAK,SAAS,EAAE;gBACzC,KAAK,CAAC,QAAQ,GAAG,2BAA2B,CAAC;gBAC7C,OAAO,KAAK,CAAC;aACd;YAED,IAAI,MAAM,EAAE,IAAI,QAAQ,CAAC,EAAE,KAAK,KAAK,EAAE;gBACrC,KAAK,CAAC,QAAQ,GAAG,uBAAuB,CAAC;gBACzC,OAAO,KAAK,CAAC;aACd;YAED,MAAM,SAAS,GAAG,QAAQ,CAAC;YAC3B,+DAA+D;YAC/D,IAAI,KAAK,CAAC,QAAQ,KAAK,sBAAsB,EAAE;gBAC7C,KAAK,CAAC,MAAM,GAAG,KAAK,CAAC;aACtB;YACD,wCAAwC;YACxC,KAAK,CAAC,QAAQ;gBACZ,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,SAAS,GAAG,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,GAAG,SAAS,IAAI,KAAK,CAAC,QAAQ,EAAE,CAAC;YACzG,OAAO,KAAK,CAAC;QACf,CAAC;KACF,CAAC,CAAC;AACL,CAAC","sourcesContent":["import { RewriteFrames } from '@sentry/integrations';\nimport type { Integration, StackFrame } from '@sentry/types';\nimport { Platform } from 'react-native';\n\nimport { isExpo, isHermesEnabled } from '../utils/environment';\n\nexport const ANDROID_DEFAULT_BUNDLE_NAME = 'app:///index.android.bundle';\nexport const IOS_DEFAULT_BUNDLE_NAME = 'app:///main.jsbundle';\n\n/**\n * Creates React Native default rewrite frames integration\n * which appends app:// to the beginning of the filename\n * and removes file://, 'address at' prefixes, CodePush postfix,\n * and Expo bundle postfix.\n */\nexport function createReactNativeRewriteFrames(): Integration {\n return new RewriteFrames({\n iteratee: (frame: StackFrame) => {\n if (frame.platform === 'java' || frame.platform === 'cocoa') {\n // Because platform is not required in StackFrame type\n // we assume that if not set it's javascript\n return frame;\n }\n\n if (!frame.filename) {\n return frame;\n }\n delete frame.abs_path;\n\n frame.filename = frame.filename\n .replace(/^file:\\/\\//, '')\n .replace(/^address at /, '')\n .replace(/^.*\\/[^.]+(\\.app|CodePush|.*(?=\\/))/, '');\n\n if (frame.filename === '[native code]' || frame.filename === 'native') {\n return frame;\n }\n // Is React Native frame\n\n // Check Hermes Bytecode Frame and convert to 1-based column\n if (isHermesEnabled() && frame.lineno === 1 && frame.colno !== undefined) {\n // hermes bytecode columns are 0-based, while v8 and jsc are 1-based\n // Hermes frames without debug info have always line = 1 and col points to a bytecode pos\n // https://github.com/facebook/react/issues/21792#issuecomment-873171991\n frame.colno += 1;\n }\n\n // Expo adds hash to the end of bundle names\n if (isExpo() && Platform.OS === 'android') {\n frame.filename = ANDROID_DEFAULT_BUNDLE_NAME;\n return frame;\n }\n\n if (isExpo() && Platform.OS === 'ios') {\n frame.filename = IOS_DEFAULT_BUNDLE_NAME;\n return frame;\n }\n\n const appPrefix = 'app://';\n // https://github.com/getsentry/sentry-react-native/issues/3348\n if (frame.filename === '/InternalBytecode.js') {\n frame.in_app = false;\n }\n // We always want to have a triple slash\n frame.filename =\n frame.filename.indexOf('/') === 0 ? `${appPrefix}${frame.filename}` : `${appPrefix}/${frame.filename}`;\n return frame;\n },\n });\n}\n"]}
1
+ {"version":3,"file":"rewriteframes.js","sourceRoot":"","sources":["../../../src/js/integrations/rewriteframes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AAEhE,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAExC,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAE/D,MAAM,CAAC,MAAM,2BAA2B,GAAG,6BAA6B,CAAC;AACzE,MAAM,CAAC,MAAM,uBAAuB,GAAG,sBAAsB,CAAC;AAE9D;;;;;GAKG;AACH,MAAM,UAAU,8BAA8B;IAC5C,OAAO,wBAAwB,CAAC;QAC9B,QAA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sB,EAAE;gBAC7C,KAAK,CAAC,MAAM,GAAG,KAAK,CAAC;aACtB;YACD,wCAAwC;YACxC,KAAK,CAAC,QAAQ;gBACZ,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,SAAS,GAAG,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,GAAG,SAAS,IAAI,KAAK,CAAC,QAAQ,EAAE,CAAC;YACzG,OAAO,KAAK,CAAC;QACf,CAAC;KACF,CAAC,CAAC;AACL,CAAC","sourcesContent":["import { rewriteFramesIntegration } from '@sentry/integrations';\nimport type { Integration, StackFrame } from '@sentry/types';\nimport { Platform } from 'react-native';\n\nimport { isExpo, isHermesEnabled } from '../utils/environment';\n\nexport const ANDROID_DEFAULT_BUNDLE_NAME = 'app:///index.android.bundle';\nexport const IOS_DEFAULT_BUNDLE_NAME = 'app:///main.jsbundle';\n\n/**\n * Creates React Native default rewrite frames integration\n * which appends app:// to the beginning of the filename\n * and removes file://, 'address at' prefixes, CodePush postfix,\n * and Expo bundle postfix.\n */\nexport function createReactNativeRewriteFrames(): Integration {\n return rewriteFramesIntegration({\n iteratee: (frame: StackFrame) => {\n if (frame.platform === 'java' || frame.platform === 'cocoa') {\n // Because platform is not required in StackFrame type\n // we assume that if not set it's javascript\n return frame;\n }\n\n if (!frame.filename) {\n return frame;\n }\n delete frame.abs_path;\n\n frame.filename = frame.filename\n .replace(/^file:\\/\\//, '')\n .replace(/^address at /, '')\n .replace(/^.*\\/[^.]+(\\.app|CodePush|.*(?=\\/))/, '');\n\n if (frame.filename === '[native code]' || frame.filename === 'native') {\n return frame;\n }\n // Is React Native frame\n\n // Check Hermes Bytecode Frame and convert to 1-based column\n if (isHermesEnabled() && frame.lineno === 1 && frame.colno !== undefined) {\n // hermes bytecode columns are 0-based, while v8 and jsc are 1-based\n // Hermes frames without debug info have always line = 1 and col points to a bytecode pos\n // https://github.com/facebook/react/issues/21792#issuecomment-873171991\n frame.colno += 1;\n }\n\n // Expo adds hash to the end of bundle names\n if (isExpo() && Platform.OS === 'android') {\n frame.filename = ANDROID_DEFAULT_BUNDLE_NAME;\n return frame;\n }\n\n if (isExpo() && Platform.OS === 'ios') {\n frame.filename = IOS_DEFAULT_BUNDLE_NAME;\n return frame;\n }\n\n const appPrefix = 'app://';\n // https://github.com/getsentry/sentry-react-native/issues/3348\n if (frame.filename === '/InternalBytecode.js') {\n frame.in_app = false;\n }\n // We always want to have a triple slash\n frame.filename =\n frame.filename.indexOf('/') === 0 ? `${appPrefix}${frame.filename}` : `${appPrefix}/${frame.filename}`;\n return frame;\n },\n });\n}\n"]}
@@ -1,25 +1,10 @@
1
- import type { EventHint, EventProcessor, Integration } from '@sentry/types';
1
+ import type { Integration, IntegrationClass, IntegrationFnResult } from '@sentry/types';
2
2
  /** Adds screenshots to error events */
3
- export declare class Screenshot implements Integration {
4
- /**
5
- * @inheritDoc
6
- */
7
- static id: string;
8
- /**
9
- * @inheritDoc
10
- */
11
- name: string;
12
- /**
13
- * If enabled attaches a screenshot to the event hint.
14
- *
15
- * @deprecated Screenshots are now added in global event processor.
16
- */
17
- static attachScreenshotToEventHint(hint: EventHint, { attachScreenshot }: {
18
- attachScreenshot?: boolean;
19
- }): PromiseLike<EventHint>;
20
- /**
21
- * @inheritDoc
22
- */
23
- setupOnce(addGlobalEventProcessor: (e: EventProcessor) => void): void;
24
- }
3
+ export declare const screenshotIntegration: () => IntegrationFnResult;
4
+ /**
5
+ * Adds screenshots to error events
6
+ *
7
+ * @deprecated Use `screenshotIntegration()` instead.
8
+ */
9
+ export declare const Screenshot: IntegrationClass<Integration>;
25
10
  //# sourceMappingURL=screenshot.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"screenshot.d.ts","sourceRoot":"","sources":["../../../src/js/integrations/screenshot.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAS,SAAS,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAOnF,uCAAuC;AACvC,qBAAa,UAAW,YAAW,WAAW;IAC5C;;OAEG;IACH,OAAc,EAAE,EAAE,MAAM,CAAgB;IAExC;;OAEG;IACI,IAAI,EAAE,MAAM,CAAiB;IAEpC;;;;OAIG;WACW,2BAA2B,CACvC,IAAI,EAAE,SAAS,EACf,EAAE,gBAAgB,EAAE,EAAE;QAAE,gBAAgB,CAAC,EAAE,OAAO,CAAA;KAAE,GACnD,WAAW,CAAC,SAAS,CAAC;IAazB;;OAEG;IACI,SAAS,CAAC,uBAAuB,EAAE,CAAC,CAAC,EAAE,cAAc,KAAK,IAAI,GAAG,IAAI;CAiB7E"}
1
+ {"version":3,"file":"screenshot.d.ts","sourceRoot":"","sources":["../../../src/js/integrations/screenshot.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAoB,WAAW,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAQ1G,uCAAuC;AACvC,eAAO,MAAM,qBAAqB,QAAO,mBAQxC,CAAC;AAEF;;;;GAIG;AAEH,eAAO,MAAM,UAAU,+BAGW,CAAC"}
@@ -1,53 +1,37 @@
1
1
  import { __awaiter } from "tslib";
2
- import { getClient } from '@sentry/core';
3
- import { resolvedSyncPromise } from '@sentry/utils';
2
+ import { convertIntegrationFnToClass } from '@sentry/core';
4
3
  import { NATIVE } from '../wrapper';
4
+ const INTEGRATION_NAME = 'Screenshot';
5
5
  /** Adds screenshots to error events */
6
- export class Screenshot {
7
- constructor() {
8
- /**
9
- * @inheritDoc
10
- */
11
- this.name = Screenshot.id;
12
- }
13
- /**
14
- * If enabled attaches a screenshot to the event hint.
15
- *
16
- * @deprecated Screenshots are now added in global event processor.
17
- */
18
- static attachScreenshotToEventHint(hint, { attachScreenshot }) {
19
- if (!attachScreenshot) {
20
- return resolvedSyncPromise(hint);
21
- }
22
- return NATIVE.captureScreenshot().then(screenshots => {
23
- if (screenshots !== null && screenshots.length > 0) {
24
- hint.attachments = [...screenshots, ...((hint === null || hint === void 0 ? void 0 : hint.attachments) || [])];
25
- }
26
- return hint;
27
- });
28
- }
29
- /**
30
- * @inheritDoc
31
- */
32
- setupOnce(addGlobalEventProcessor) {
33
- var _a;
34
- const options = (_a = getClient()) === null || _a === void 0 ? void 0 : _a.getOptions();
35
- addGlobalEventProcessor((event, hint) => __awaiter(this, void 0, void 0, function* () {
36
- var _b;
37
- const hasException = event.exception && event.exception.values && event.exception.values.length > 0;
38
- if (!hasException || ((_b = options === null || options === void 0 ? void 0 : options.beforeScreenshot) === null || _b === void 0 ? void 0 : _b.call(options, event, hint)) === false) {
39
- return event;
40
- }
41
- const screenshots = yield NATIVE.captureScreenshot();
42
- if (screenshots && screenshots.length > 0) {
43
- hint.attachments = [...screenshots, ...((hint === null || hint === void 0 ? void 0 : hint.attachments) || [])];
44
- }
45
- return event;
46
- }));
47
- }
48
- }
6
+ export const screenshotIntegration = () => {
7
+ return {
8
+ name: INTEGRATION_NAME,
9
+ setupOnce: () => {
10
+ // noop
11
+ },
12
+ processEvent,
13
+ };
14
+ };
49
15
  /**
50
- * @inheritDoc
16
+ * Adds screenshots to error events
17
+ *
18
+ * @deprecated Use `screenshotIntegration()` instead.
51
19
  */
52
- Screenshot.id = 'Screenshot';
20
+ // eslint-disable-next-line deprecation/deprecation
21
+ export const Screenshot = convertIntegrationFnToClass(INTEGRATION_NAME, screenshotIntegration);
22
+ function processEvent(event, hint, client) {
23
+ var _a;
24
+ return __awaiter(this, void 0, void 0, function* () {
25
+ const options = client.getOptions();
26
+ const hasException = event.exception && event.exception.values && event.exception.values.length > 0;
27
+ if (!hasException || ((_a = options === null || options === void 0 ? void 0 : options.beforeScreenshot) === null || _a === void 0 ? void 0 : _a.call(options, event, hint)) === false) {
28
+ return event;
29
+ }
30
+ const screenshots = yield NATIVE.captureScreenshot();
31
+ if (screenshots && screenshots.length > 0) {
32
+ hint.attachments = [...screenshots, ...((hint === null || hint === void 0 ? void 0 : hint.attachments) || [])];
33
+ }
34
+ return event;
35
+ });
36
+ }
53
37
  //# sourceMappingURL=screenshot.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"screenshot.js","sourceRoot":"","sources":["../../../src/js/integrations/screenshot.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAIpD,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAEpC,uCAAuC;AACvC,MAAM,OAAO,UAAU;IAAvB;QAME;;WAEG;QACI,SAAI,GAAW,UAAU,CAAC,EAAE,CAAC;IA2CtC,CAAC;IAzCC;;;;OAIG;IACI,MAAM,CAAC,2BAA2B,CACvC,IAAe,EACf,EAAE,gBAAgB,EAAkC;QAEpD,IAAI,CAAC,gBAAgB,EAAE;YACrB,OAAO,mBAAmB,CAAC,IAAI,CAAC,CAAC;SAClC;QAED,OAAO,MAAM,CAAC,iBAAiB,EAAE,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE;YACnD,IAAI,WAAW,KAAK,IAAI,IAAI,WAAW,CAAC,MAAM,GAAG,CAAC,EAAE;gBAClD,IAAI,CAAC,WAAW,GAAG,CAAC,GAAG,WAAW,EAAE,GAAG,CAAC,CAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,WAAW,KAAI,EAAE,CAAC,CAAC,CAAC;aACnE;YACD,OAAO,IAAI,CAAC;QACd,CAAC,CAAC,CAAC;IACL,CAAC;IAED;;OAEG;IACI,SAAS,CAAC,uBAAoD;;QACnE,MAAM,OAAO,GAAG,MAAA,SAAS,EAAqB,0CAAE,UAAU,EAAE,CAAC;QAE7D,uBAAuB,CAAC,CAAO,KAAY,EAAE,IAAe,EAAE,EAAE;;YAC9D,MAAM,YAAY,GAAG,KAAK,CAAC,SAAS,IAAI,KAAK,CAAC,SAAS,CAAC,MAAM,IAAI,KAAK,CAAC,SAAS,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC;YACpG,IAAI,CAAC,YAAY,IAAI,CAAA,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,gBAAgB,wDAAG,KAAK,EAAE,IAAI,CAAC,MAAK,KAAK,EAAE;gBACvE,OAAO,KAAK,CAAC;aACd;YAED,MAAM,WAAW,GAAkC,MAAM,MAAM,CAAC,iBAAiB,EAAE,CAAC;YACpF,IAAI,WAAW,IAAI,WAAW,CAAC,MAAM,GAAG,CAAC,EAAE;gBACzC,IAAI,CAAC,WAAW,GAAG,CAAC,GAAG,WAAW,EAAE,GAAG,CAAC,CAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,WAAW,KAAI,EAAE,CAAC,CAAC,CAAC;aACnE;YAED,OAAO,KAAK,CAAC;QACf,CAAC,CAAA,CAAC,CAAC;IACL,CAAC;;AAlDD;;GAEG;AACW,aAAE,GAAW,YAAY,CAAC","sourcesContent":["import { getClient } from '@sentry/core';\nimport type { Event, EventHint, EventProcessor, Integration } from '@sentry/types';\nimport { resolvedSyncPromise } from '@sentry/utils';\n\nimport type { ReactNativeClient } from '../client';\nimport type { Screenshot as ScreenshotAttachment } from '../wrapper';\nimport { NATIVE } from '../wrapper';\n\n/** Adds screenshots to error events */\nexport class Screenshot implements Integration {\n /**\n * @inheritDoc\n */\n public static id: string = 'Screenshot';\n\n /**\n * @inheritDoc\n */\n public name: string = Screenshot.id;\n\n /**\n * If enabled attaches a screenshot to the event hint.\n *\n * @deprecated Screenshots are now added in global event processor.\n */\n public static attachScreenshotToEventHint(\n hint: EventHint,\n { attachScreenshot }: { attachScreenshot?: boolean },\n ): PromiseLike<EventHint> {\n if (!attachScreenshot) {\n return resolvedSyncPromise(hint);\n }\n\n return NATIVE.captureScreenshot().then(screenshots => {\n if (screenshots !== null && screenshots.length > 0) {\n hint.attachments = [...screenshots, ...(hint?.attachments || [])];\n }\n return hint;\n });\n }\n\n /**\n * @inheritDoc\n */\n public setupOnce(addGlobalEventProcessor: (e: EventProcessor) => void): void {\n const options = getClient<ReactNativeClient>()?.getOptions();\n\n addGlobalEventProcessor(async (event: Event, hint: EventHint) => {\n const hasException = event.exception && event.exception.values && event.exception.values.length > 0;\n if (!hasException || options?.beforeScreenshot?.(event, hint) === false) {\n return event;\n }\n\n const screenshots: ScreenshotAttachment[] | null = await NATIVE.captureScreenshot();\n if (screenshots && screenshots.length > 0) {\n hint.attachments = [...screenshots, ...(hint?.attachments || [])];\n }\n\n return event;\n });\n }\n}\n"]}
1
+ {"version":3,"file":"screenshot.js","sourceRoot":"","sources":["../../../src/js/integrations/screenshot.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,2BAA2B,EAAE,MAAM,cAAc,CAAC;AAK3D,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAEpC,MAAM,gBAAgB,GAAG,YAAY,CAAC;AAEtC,uCAAuC;AACvC,MAAM,CAAC,MAAM,qBAAqB,GAAG,GAAwB,EAAE;IAC7D,OAAO;QACL,IAAI,EAAE,gBAAgB;QACtB,SAAS,EAAE,GAAG,EAAE;YACd,OAAO;QACT,CAAC;QACD,YAAY;KACb,CAAC;AACJ,CAAC,CAAC;AAEF;;;;GAIG;AACH,mDAAmD;AACnD,MAAM,CAAC,MAAM,UAAU,GAAG,2BAA2B,CACnD,gBAAgB,EAChB,qBAAqB,CACW,CAAC;AAEnC,SAAe,YAAY,CAAC,KAAY,EAAE,IAAe,EAAE,MAAyB;;;QAClF,MAAM,OAAO,GAAG,MAAM,CAAC,UAAU,EAAE,CAAC;QAEpC,MAAM,YAAY,GAAG,KAAK,CAAC,SAAS,IAAI,KAAK,CAAC,SAAS,CAAC,MAAM,IAAI,KAAK,CAAC,SAAS,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC;QACpG,IAAI,CAAC,YAAY,IAAI,CAAA,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,gBAAgB,wDAAG,KAAK,EAAE,IAAI,CAAC,MAAK,KAAK,EAAE;YACvE,OAAO,KAAK,CAAC;SACd;QAED,MAAM,WAAW,GAAkC,MAAM,MAAM,CAAC,iBAAiB,EAAE,CAAC;QACpF,IAAI,WAAW,IAAI,WAAW,CAAC,MAAM,GAAG,CAAC,EAAE;YACzC,IAAI,CAAC,WAAW,GAAG,CAAC,GAAG,WAAW,EAAE,GAAG,CAAC,CAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,WAAW,KAAI,EAAE,CAAC,CAAC,CAAC;SACnE;QAED,OAAO,KAAK,CAAC;;CACd","sourcesContent":["import { convertIntegrationFnToClass } from '@sentry/core';\nimport type { Event, EventHint, Integration, IntegrationClass, IntegrationFnResult } from '@sentry/types';\n\nimport type { ReactNativeClient } from '../client';\nimport type { Screenshot as ScreenshotAttachment } from '../wrapper';\nimport { NATIVE } from '../wrapper';\n\nconst INTEGRATION_NAME = 'Screenshot';\n\n/** Adds screenshots to error events */\nexport const screenshotIntegration = (): IntegrationFnResult => {\n return {\n name: INTEGRATION_NAME,\n setupOnce: () => {\n // noop\n },\n processEvent,\n };\n};\n\n/**\n * Adds screenshots to error events\n *\n * @deprecated Use `screenshotIntegration()` instead.\n */\n// eslint-disable-next-line deprecation/deprecation\nexport const Screenshot = convertIntegrationFnToClass(\n INTEGRATION_NAME,\n screenshotIntegration,\n) as IntegrationClass<Integration>;\n\nasync function processEvent(event: Event, hint: EventHint, client: ReactNativeClient): Promise<Event> {\n const options = client.getOptions();\n\n const hasException = event.exception && event.exception.values && event.exception.values.length > 0;\n if (!hasException || options?.beforeScreenshot?.(event, hint) === false) {\n return event;\n }\n\n const screenshots: ScreenshotAttachment[] | null = await NATIVE.captureScreenshot();\n if (screenshots && screenshots.length > 0) {\n hint.attachments = [...screenshots, ...(hint?.attachments || [])];\n }\n\n return event;\n}\n"]}
@@ -1,21 +1,13 @@
1
- import type { EventProcessor, Integration, SdkInfo as SdkInfoType } from '@sentry/types';
1
+ import type { Integration, IntegrationClass, IntegrationFnResult, SdkInfo as SdkInfoType } from '@sentry/types';
2
2
  type DefaultSdkInfo = Pick<Required<SdkInfoType>, 'name' | 'packages' | 'version'>;
3
3
  export declare const defaultSdkInfo: DefaultSdkInfo;
4
4
  /** Default SdkInfo instrumentation */
5
- export declare class SdkInfo implements Integration {
6
- /**
7
- * @inheritDoc
8
- */
9
- static id: string;
10
- /**
11
- * @inheritDoc
12
- */
13
- name: string;
14
- private _nativeSdkPackage;
15
- /**
16
- * @inheritDoc
17
- */
18
- setupOnce(addGlobalEventProcessor: (e: EventProcessor) => void): void;
19
- }
5
+ export declare const sdkInfoIntegration: () => IntegrationFnResult;
6
+ /**
7
+ * Default SdkInfo instrumentation
8
+ *
9
+ * @deprecated Use `sdkInfoIntegration()` instead.
10
+ */
11
+ export declare const SdkInfo: IntegrationClass<Integration>;
20
12
  export {};
21
13
  //# sourceMappingURL=sdkinfo.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"sdkinfo.d.ts","sourceRoot":"","sources":["../../../src/js/integrations/sdkinfo.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAW,OAAO,IAAI,WAAW,EAAE,MAAM,eAAe,CAAC;AAOlG,KAAK,cAAc,GAAG,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,GAAG,UAAU,GAAG,SAAS,CAAC,CAAC;AAEnF,eAAO,MAAM,cAAc,EAAE,cAS5B,CAAC;AAEF,sCAAsC;AACtC,qBAAa,OAAQ,YAAW,WAAW;IACzC;;OAEG;IACH,OAAc,EAAE,EAAE,MAAM,CAAa;IAErC;;OAEG;IACI,IAAI,EAAE,MAAM,CAAc;IAEjC,OAAO,CAAC,iBAAiB,CAAwB;IAEjD;;OAEG;IACI,SAAS,CAAC,uBAAuB,EAAE,CAAC,CAAC,EAAE,cAAc,KAAK,IAAI,GAAG,IAAI;CA8B7E"}
1
+ {"version":3,"file":"sdkinfo.d.ts","sourceRoot":"","sources":["../../../src/js/integrations/sdkinfo.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAEV,WAAW,EACX,gBAAgB,EAChB,mBAAmB,EAEnB,OAAO,IAAI,WAAW,EACvB,MAAM,eAAe,CAAC;AASvB,KAAK,cAAc,GAAG,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,GAAG,UAAU,GAAG,SAAS,CAAC,CAAC;AAEnF,eAAO,MAAM,cAAc,EAAE,cAS5B,CAAC;AAEF,sCAAsC;AACtC,eAAO,MAAM,kBAAkB,QAAO,mBAUrC,CAAC;AAEF;;;;GAIG;AAEH,eAAO,MAAM,OAAO,+BAGc,CAAC"}