@sentry/react-native 5.0.0-alpha.9 → 5.0.0-beta.1

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 (155) hide show
  1. package/CHANGELOG.md +134 -3
  2. package/README.md +1 -1
  3. package/RNSentry.podspec +5 -5
  4. package/android/build.gradle +1 -1
  5. package/android/src/main/java/io/sentry/react/RNSentryModuleImpl.java +100 -21
  6. package/android/src/newarch/java/io/sentry/react/RNSentryModule.java +5 -0
  7. package/android/src/oldarch/java/io/sentry/react/RNSentryModule.java +5 -0
  8. package/dist/js/NativeRNSentry.d.ts +36 -3
  9. package/dist/js/NativeRNSentry.d.ts.map +1 -1
  10. package/dist/js/NativeRNSentry.js.map +1 -1
  11. package/dist/js/breadcrumb.d.ts +11 -0
  12. package/dist/js/breadcrumb.d.ts.map +1 -0
  13. package/dist/js/breadcrumb.js +34 -0
  14. package/dist/js/breadcrumb.js.map +1 -0
  15. package/dist/js/client.d.ts +4 -5
  16. package/dist/js/client.d.ts.map +1 -1
  17. package/dist/js/client.js +22 -35
  18. package/dist/js/client.js.map +1 -1
  19. package/dist/js/index.d.ts +1 -0
  20. package/dist/js/index.d.ts.map +1 -1
  21. package/dist/js/index.js +1 -0
  22. package/dist/js/index.js.map +1 -1
  23. package/dist/js/integrations/debugsymbolicator.d.ts +1 -1
  24. package/dist/js/integrations/debugsymbolicator.d.ts.map +1 -1
  25. package/dist/js/integrations/debugsymbolicator.js.map +1 -1
  26. package/dist/js/integrations/devicecontext.d.ts +2 -2
  27. package/dist/js/integrations/devicecontext.d.ts.map +1 -1
  28. package/dist/js/integrations/devicecontext.js +45 -11
  29. package/dist/js/integrations/devicecontext.js.map +1 -1
  30. package/dist/js/integrations/eventorigin.d.ts +1 -1
  31. package/dist/js/integrations/eventorigin.d.ts.map +1 -1
  32. package/dist/js/integrations/eventorigin.js.map +1 -1
  33. package/dist/js/integrations/modulesloader.d.ts +1 -1
  34. package/dist/js/integrations/modulesloader.d.ts.map +1 -1
  35. package/dist/js/integrations/modulesloader.js +8 -2
  36. package/dist/js/integrations/modulesloader.js.map +1 -1
  37. package/dist/js/integrations/reactnativeerrorhandlers.d.ts +1 -1
  38. package/dist/js/integrations/reactnativeerrorhandlers.d.ts.map +1 -1
  39. package/dist/js/integrations/reactnativeerrorhandlers.js +4 -3
  40. package/dist/js/integrations/reactnativeerrorhandlers.js.map +1 -1
  41. package/dist/js/integrations/reactnativeinfo.d.ts +1 -1
  42. package/dist/js/integrations/reactnativeinfo.d.ts.map +1 -1
  43. package/dist/js/integrations/reactnativeinfo.js.map +1 -1
  44. package/dist/js/integrations/release.d.ts +1 -1
  45. package/dist/js/integrations/release.d.ts.map +1 -1
  46. package/dist/js/integrations/release.js.map +1 -1
  47. package/dist/js/integrations/screenshot.d.ts +23 -0
  48. package/dist/js/integrations/screenshot.d.ts.map +1 -0
  49. package/dist/js/integrations/screenshot.js +39 -0
  50. package/dist/js/integrations/screenshot.js.map +1 -0
  51. package/dist/js/integrations/sdkinfo.d.ts +1 -1
  52. package/dist/js/integrations/sdkinfo.d.ts.map +1 -1
  53. package/dist/js/integrations/sdkinfo.js.map +1 -1
  54. package/dist/js/measurements.d.ts +4 -0
  55. package/dist/js/measurements.d.ts.map +1 -1
  56. package/dist/js/measurements.js +11 -0
  57. package/dist/js/measurements.js.map +1 -1
  58. package/dist/js/misc.d.ts +1 -1
  59. package/dist/js/misc.d.ts.map +1 -1
  60. package/dist/js/misc.js.map +1 -1
  61. package/dist/js/options.d.ts +18 -11
  62. package/dist/js/options.d.ts.map +1 -1
  63. package/dist/js/options.js.map +1 -1
  64. package/dist/js/scope.d.ts +1 -1
  65. package/dist/js/scope.d.ts.map +1 -1
  66. package/dist/js/scope.js +4 -2
  67. package/dist/js/scope.js.map +1 -1
  68. package/dist/js/sdk.d.ts +4 -3
  69. package/dist/js/sdk.d.ts.map +1 -1
  70. package/dist/js/sdk.js +11 -6
  71. package/dist/js/sdk.js.map +1 -1
  72. package/dist/js/tools/ModulesCollector.d.ts +10 -1
  73. package/dist/js/tools/ModulesCollector.d.ts.map +1 -1
  74. package/dist/js/tools/ModulesCollector.js +51 -1
  75. package/dist/js/tools/ModulesCollector.js.map +1 -1
  76. package/dist/js/tools/collectModules.js +6 -27
  77. package/dist/js/tools/collectModules.js.map +1 -1
  78. package/dist/js/touchevents.d.ts +4 -0
  79. package/dist/js/touchevents.d.ts.map +1 -1
  80. package/dist/js/touchevents.js +10 -5
  81. package/dist/js/touchevents.js.map +1 -1
  82. package/dist/js/tracing/nativeframes.d.ts +2 -2
  83. package/dist/js/tracing/nativeframes.d.ts.map +1 -1
  84. package/dist/js/tracing/nativeframes.js.map +1 -1
  85. package/dist/js/tracing/reactnativenavigation.d.ts +4 -3
  86. package/dist/js/tracing/reactnativenavigation.d.ts.map +1 -1
  87. package/dist/js/tracing/reactnativenavigation.js +1 -1
  88. package/dist/js/tracing/reactnativenavigation.js.map +1 -1
  89. package/dist/js/tracing/reactnativetracing.d.ts +5 -5
  90. package/dist/js/tracing/reactnativetracing.d.ts.map +1 -1
  91. package/dist/js/tracing/reactnativetracing.js +1 -1
  92. package/dist/js/tracing/reactnativetracing.js.map +1 -1
  93. package/dist/js/tracing/reactnavigation.d.ts +3 -2
  94. package/dist/js/tracing/reactnavigation.d.ts.map +1 -1
  95. package/dist/js/tracing/reactnavigation.js +1 -1
  96. package/dist/js/tracing/reactnavigation.js.map +1 -1
  97. package/dist/js/tracing/reactnavigationv4.d.ts +4 -3
  98. package/dist/js/tracing/reactnavigationv4.d.ts.map +1 -1
  99. package/dist/js/tracing/reactnavigationv4.js +1 -1
  100. package/dist/js/tracing/reactnavigationv4.js.map +1 -1
  101. package/dist/js/tracing/routingInstrumentation.d.ts +3 -3
  102. package/dist/js/tracing/routingInstrumentation.d.ts.map +1 -1
  103. package/dist/js/tracing/routingInstrumentation.js.map +1 -1
  104. package/dist/js/tracing/stalltracking.d.ts +2 -2
  105. package/dist/js/tracing/stalltracking.d.ts.map +1 -1
  106. package/dist/js/tracing/stalltracking.js.map +1 -1
  107. package/dist/js/tracing/types.d.ts +1 -1
  108. package/dist/js/tracing/types.d.ts.map +1 -1
  109. package/dist/js/tracing/types.js.map +1 -1
  110. package/dist/js/tracing/utils.d.ts +2 -2
  111. package/dist/js/tracing/utils.d.ts.map +1 -1
  112. package/dist/js/tracing/utils.js.map +1 -1
  113. package/dist/js/transports/TextEncoder.d.ts +1 -1
  114. package/dist/js/transports/TextEncoder.d.ts.map +1 -1
  115. package/dist/js/transports/TextEncoder.js.map +1 -1
  116. package/dist/js/transports/native.d.ts +7 -3
  117. package/dist/js/transports/native.d.ts.map +1 -1
  118. package/dist/js/transports/native.js +10 -1
  119. package/dist/js/transports/native.js.map +1 -1
  120. package/dist/js/user.d.ts +1 -1
  121. package/dist/js/user.d.ts.map +1 -1
  122. package/dist/js/user.js.map +1 -1
  123. package/dist/js/utils/envelope.d.ts +1 -1
  124. package/dist/js/utils/envelope.d.ts.map +1 -1
  125. package/dist/js/utils/envelope.js.map +1 -1
  126. package/dist/js/utils/ignorerequirecyclelogs.d.ts +6 -0
  127. package/dist/js/utils/ignorerequirecyclelogs.d.ts.map +1 -0
  128. package/dist/js/utils/ignorerequirecyclelogs.js +15 -0
  129. package/dist/js/utils/ignorerequirecyclelogs.js.map +1 -0
  130. package/dist/js/utils/outcome.d.ts +1 -1
  131. package/dist/js/utils/outcome.d.ts.map +1 -1
  132. package/dist/js/utils/outcome.js.map +1 -1
  133. package/dist/js/utils/safe.d.ts +1 -1
  134. package/dist/js/utils/safe.d.ts.map +1 -1
  135. package/dist/js/utils/safe.js.map +1 -1
  136. package/dist/js/utils/worldwide.d.ts +1 -1
  137. package/dist/js/utils/worldwide.d.ts.map +1 -1
  138. package/dist/js/utils/worldwide.js.map +1 -1
  139. package/dist/js/version.d.ts +1 -1
  140. package/dist/js/version.d.ts.map +1 -1
  141. package/dist/js/version.js +1 -1
  142. package/dist/js/version.js.map +1 -1
  143. package/dist/js/wrapper.d.ts +9 -3
  144. package/dist/js/wrapper.d.ts.map +1 -1
  145. package/dist/js/wrapper.js +30 -6
  146. package/dist/js/wrapper.js.map +1 -1
  147. package/ios/RNSentry.h +5 -0
  148. package/ios/RNSentry.mm +80 -49
  149. package/package.json +24 -23
  150. package/scripts/collect-modules.sh +1 -1
  151. package/sentry.gradle +46 -15
  152. package/src/js/NativeRNSentry.ts +38 -3
  153. package/ios/RNSentry.xcodeproj/project.pbxproj +0 -472
  154. package/ios/RNSentry.xcodeproj/project.xcworkspace/contents.xcworkspacedata +0 -7
  155. package/ios/RNSentry.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +0 -8
@@ -3,6 +3,15 @@
3
3
  */
4
4
  export default class ModulesCollector {
5
5
  /** Collect method */
6
- static collect(sources: string[], modulesPaths: string[]): Record<string, string>;
6
+ static collect(sources: unknown[], modulesPaths: string[]): Record<string, string>;
7
+ /**
8
+ * Runs collection of modules.
9
+ */
10
+ static run({ sourceMapPath, outputModulesPath, modulesPaths, collect, }: Partial<{
11
+ sourceMapPath: string;
12
+ outputModulesPath: string;
13
+ modulesPaths: string[];
14
+ collect: (sources: unknown[], modulesPaths: string[]) => Record<string, string>;
15
+ }>): void;
7
16
  }
8
17
  //# sourceMappingURL=ModulesCollector.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ModulesCollector.d.ts","sourceRoot":"","sources":["../../../src/js/tools/ModulesCollector.ts"],"names":[],"mappings":"AAUA;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,gBAAgB;IAEnC,qBAAqB;WACP,OAAO,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,YAAY,EAAE,MAAM,EAAE,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;CA0DzF"}
1
+ {"version":3,"file":"ModulesCollector.d.ts","sourceRoot":"","sources":["../../../src/js/tools/ModulesCollector.ts"],"names":[],"mappings":"AAcA;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,gBAAgB;IAEnC,qBAAqB;WACP,OAAO,CAAC,OAAO,EAAE,OAAO,EAAE,EAAE,YAAY,EAAE,MAAM,EAAE,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;IA8DzF;;OAEG;WACW,GAAG,CAAC,EAChB,aAAa,EACb,iBAAiB,EACjB,YAAY,EACZ,OAAO,GACR,EAAE,OAAO,CAAC;QACT,aAAa,EAAE,MAAM,CAAC;QACtB,iBAAiB,EAAE,MAAM,CAAC;QAC1B,YAAY,EAAE,MAAM,EAAE,CAAC;QACvB,OAAO,EAAE,CAAC,OAAO,EAAE,OAAO,EAAE,EAAE,YAAY,EAAE,MAAM,EAAE,KAAK,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;KACjF,CAAC,GAAG,IAAI;CAgDV"}
@@ -2,6 +2,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
2
2
  const utils_1 = require("@sentry/utils");
3
3
  const fs_1 = require("fs");
4
4
  const path_1 = require("path");
5
+ utils_1.logger.enable();
6
+ // eslint-disable-next-line @typescript-eslint/unbound-method
5
7
  const { dirname, join, resolve, sep: posixSep } = path_1.posix;
6
8
  /**
7
9
  * Collects JS modules from source paths.
@@ -13,6 +15,9 @@ class ModulesCollector {
13
15
  const infos = {};
14
16
  const seen = {};
15
17
  sources.forEach((path) => {
18
+ if (typeof path !== 'string') {
19
+ return;
20
+ }
16
21
  let dir = path; // included source file path
17
22
  let candidate = null;
18
23
  /** Traverse directories upward in the search of all package.json files */
@@ -47,7 +52,7 @@ class ModulesCollector {
47
52
  };
48
53
  }
49
54
  catch (error) {
50
- utils_1.logger.warn(`Failed to read ${pkgPath}`);
55
+ utils_1.logger.error(`Failed to read ${pkgPath}`);
51
56
  }
52
57
  return upDirSearch(); // processed package.json file, continue up search
53
58
  };
@@ -55,6 +60,51 @@ class ModulesCollector {
55
60
  });
56
61
  return infos;
57
62
  }
63
+ /**
64
+ * Runs collection of modules.
65
+ */
66
+ static run({ sourceMapPath, outputModulesPath, modulesPaths, collect, }) {
67
+ if (!sourceMapPath) {
68
+ utils_1.logger.error('First argument `source-map-path` is missing!');
69
+ return;
70
+ }
71
+ if (!outputModulesPath) {
72
+ utils_1.logger.error('Second argument `modules-output-path` is missing!');
73
+ return;
74
+ }
75
+ if (!modulesPaths || modulesPaths.length === 0) {
76
+ utils_1.logger.error('Third argument `modules-paths` is missing!');
77
+ return;
78
+ }
79
+ utils_1.logger.info('Reading source map from', sourceMapPath);
80
+ utils_1.logger.info('Saving modules to', outputModulesPath);
81
+ utils_1.logger.info('Resolving modules from paths', outputModulesPath);
82
+ if (!fs_1.existsSync(sourceMapPath)) {
83
+ utils_1.logger.error(`Source map file does not exist at ${sourceMapPath}`);
84
+ return;
85
+ }
86
+ for (const modulesPath of modulesPaths) {
87
+ if (!fs_1.existsSync(modulesPath)) {
88
+ utils_1.logger.error(`Modules path does not exist at ${modulesPath}`);
89
+ return;
90
+ }
91
+ }
92
+ const map = JSON.parse(fs_1.readFileSync(sourceMapPath, 'utf8'));
93
+ if (!map.sources || !Array.isArray(map.sources)) {
94
+ utils_1.logger.error(`Modules not collected. No sources found in the source map (${sourceMapPath})!`);
95
+ return;
96
+ }
97
+ const sources = map.sources;
98
+ const modules = collect
99
+ ? collect(sources, modulesPaths)
100
+ : ModulesCollector.collect(sources, modulesPaths);
101
+ const outputModulesDirPath = dirname(outputModulesPath);
102
+ if (!fs_1.existsSync(outputModulesDirPath)) {
103
+ fs_1.mkdirSync(outputModulesDirPath, { recursive: true });
104
+ }
105
+ fs_1.writeFileSync(outputModulesPath, JSON.stringify(modules, null, 2));
106
+ utils_1.logger.info(`Modules collected and saved to: ${outputModulesPath}`);
107
+ }
58
108
  }
59
109
  exports.default = ModulesCollector;
60
110
  //# sourceMappingURL=ModulesCollector.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ModulesCollector.js","sourceRoot":"","sources":["../../../src/js/tools/ModulesCollector.ts"],"names":[],"mappings":";AAAA,yCAAuC;AACvC,2BAA8C;AAC9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BACjB,IAAI,CAAC,GAAG,CAAC,EACT;oBACA,OAAO;iBACR;gBACD,IAAI,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC;gBAEjB,MAAM,OAAO,GAAG,IAAI,CAAC,GAAG,EAAE,cAAc,CAAC,CAAC;gBAC1C,IAAI,CAAC,eAAU,CAAC,OAAO,CAAC,EAAE;oBACxB,iDAAiD;oBACjD,OAAO,WAAW,EAAE,CAAC;iBACtB;gBAED,IAAI;oBACF,MAAM,IAAI,GAAY,IAAI,CAAC,KAAK,CAAC,iBAAY,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC;oBAChE,SAAS,GAAG;wBACV,IAAI,EAAE,IAAI,CAAC,IAAI;wBACf,OAAO,EAAE,IAAI,CAAC,OAAO;qBACtB,CAAC;iBACH;gBAAC,OAAO,KAAK,EAAE;oBACd,cAAM,CAAC,IAAI,CAAC,kBAAkB,OAAO,EAAE,CAAC,CAAC;iBAC1C;gBAED,OAAO,WAAW,EAAE,CAAC,CAAC,kDAAkD;YAC1E,CAAC,CAAC;YAEF,WAAW,EAAE,CAAC;QAChB,CAAC,CAAC,CAAC;QAEH,OAAO,KAAK,CAAC;IACf,CAAC;CAEF;AA7DD,mCA6DC","sourcesContent":["import { logger } from '@sentry/utils';\nimport { existsSync, readFileSync } from 'fs';\nimport { posix, sep } from 'path';\nconst { dirname, join, resolve, sep: posixSep } = posix;\n\ninterface Package {\n name?: string,\n version?: string,\n}\n\n/**\n * Collects JS modules from source paths.\n */\nexport default class ModulesCollector {\n\n /** Collect method */\n public static collect(sources: string[], modulesPaths: string[]): Record<string, string> {\n const normalizedModulesPaths = modulesPaths.map((modulesPath) => resolve(modulesPath.split(sep).join(posixSep)));\n\n const infos: Record<string, string> = {};\n const seen: Record<string, true> = {};\n\n sources.forEach((path: string) => {\n let dir = path; // included source file path\n let candidate: Package | null = null;\n\n /** Traverse directories upward in the search of all package.json files */\n const upDirSearch = (): void => {\n const parentDir = dir;\n dir = dirname(parentDir);\n\n if (normalizedModulesPaths.includes(resolve(dir))) {\n if (candidate?.name && candidate?.version) {\n infos[candidate.name] = candidate.version;\n } else if (candidate?.name) {\n infos[candidate.name] = 'unknown';\n }\n return;\n }\n\n if (\n !dir ||\n parentDir === dir ||\n seen[dir]\n ) {\n return;\n }\n seen[dir] = true;\n\n const pkgPath = join(dir, 'package.json');\n if (!existsSync(pkgPath)) {\n // fast-forward if the package.json doesn't exist\n return upDirSearch();\n }\n\n try {\n const info: Package = JSON.parse(readFileSync(pkgPath, 'utf8'));\n candidate = {\n name: info.name,\n version: info.version,\n };\n } catch (error) {\n logger.warn(`Failed to read ${pkgPath}`);\n }\n\n return upDirSearch(); // processed package.json file, continue up search\n };\n\n upDirSearch();\n });\n\n return infos;\n }\n\n}\n"]}
1
+ {"version":3,"file":"ModulesCollector.js","sourceRoot":"","sources":["../../../src/js/tools/ModulesCollector.ts"],"names":[],"mappings":";AAAA,yCAAuC;AACvC,2BAAwE;AACxE,+BAAkC;AAElC,cAAM,CAAC,MAAM,EAAE,CAAC;AAEhB,6DAA6D;AAC7D,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,GAAG,YAAK,CAAC;AAOxD;;GAEG;AACH,MAAqB,gBAAgB;IAEnC,qBAAqB;IACd,MAAM,CAAC,OAAO,CAAC,OAAkB,EAAE,YAAsB;QAC9D,MAAM,sBAAsB,GAAG,YAAY,CAAC,GAAG,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC,OAAO,CAAC,WAAW,CAAC,KAAK,CAAC,UAAG,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;QAEjH,MAAM,KAAK,GAA2B,EAAE,CAAC;QACzC,MAAM,IAAI,GAAyB,EAAE,CAAC;QAEtC,OAAO,CAAC,OAAO,CAAC,CAAC,IAAa,EAAE,EAAE;YAChC,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE;gBAC5B,OAAO;aACR;Y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,CAAC;QACnF,IAAI,CAAC,GAAG,CAAC,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE;YAC/C,cAAM,CAAC,KAAK,CAAC,8DAA8D,aAAa,IAAI,CAAC,CAAC;YAC9F,OAAO;SACR;QAED,MAAM,OAAO,GAAc,GAAG,CAAC,OAAO,CAAC;QACvC,MAAM,OAAO,GAAG,OAAO;YACrB,CAAC,CAAC,OAAO,CAAC,OAAO,EAAE,YAAY,CAAC;YAChC,CAAC,CAAC,gBAAgB,CAAC,OAAO,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC;QAEpD,MAAM,oBAAoB,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;QACxD,IAAI,CAAC,eAAU,CAAC,oBAAoB,CAAC,EAAE;YACrC,cAAS,CAAC,oBAAoB,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;SACtD;QACD,kBAAa,CAAC,iBAAiB,EAAE,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;QACnE,cAAM,CAAC,IAAI,CAAC,mCAAmC,iBAAiB,EAAE,CAAC,CAAC;IACtE,CAAC;CAEF;AA9HD,mCA8HC","sourcesContent":["import { logger } from '@sentry/utils';\nimport { existsSync, mkdirSync, readFileSync, writeFileSync } from 'fs';\nimport { posix, sep } from 'path';\n\nlogger.enable();\n\n// eslint-disable-next-line @typescript-eslint/unbound-method\nconst { dirname, join, resolve, sep: posixSep } = posix;\n\ninterface Package {\n name?: string,\n version?: string,\n}\n\n/**\n * Collects JS modules from source paths.\n */\nexport default class ModulesCollector {\n\n /** Collect method */\n public static collect(sources: unknown[], modulesPaths: string[]): Record<string, string> {\n const normalizedModulesPaths = modulesPaths.map((modulesPath) => resolve(modulesPath.split(sep).join(posixSep)));\n\n const infos: Record<string, string> = {};\n const seen: Record<string, true> = {};\n\n sources.forEach((path: unknown) => {\n if (typeof path !== 'string') {\n return;\n }\n\n let dir = path; // included source file path\n let candidate: Package | null = null;\n\n /** Traverse directories upward in the search of all package.json files */\n const upDirSearch = (): void => {\n const parentDir = dir;\n dir = dirname(parentDir);\n\n if (normalizedModulesPaths.includes(resolve(dir))) {\n if (candidate?.name && candidate?.version) {\n infos[candidate.name] = candidate.version;\n } else if (candidate?.name) {\n infos[candidate.name] = 'unknown';\n }\n return;\n }\n\n if (\n !dir ||\n parentDir === dir ||\n seen[dir]\n ) {\n return;\n }\n seen[dir] = true;\n\n const pkgPath = join(dir, 'package.json');\n if (!existsSync(pkgPath)) {\n // fast-forward if the package.json doesn't exist\n return upDirSearch();\n }\n\n try {\n const info: Package = JSON.parse(readFileSync(pkgPath, 'utf8'));\n candidate = {\n name: info.name,\n version: info.version,\n };\n } catch (error) {\n logger.error(`Failed to read ${pkgPath}`);\n }\n\n return upDirSearch(); // processed package.json file, continue up search\n };\n\n upDirSearch();\n });\n\n return infos;\n }\n\n /**\n * Runs collection of modules.\n */\n public static run({\n sourceMapPath,\n outputModulesPath,\n modulesPaths,\n collect,\n }: Partial<{\n sourceMapPath: string,\n outputModulesPath: string,\n modulesPaths: string[],\n collect: (sources: unknown[], modulesPaths: string[]) => Record<string, string>,\n }>): void {\n if (!sourceMapPath) {\n logger.error('First argument `source-map-path` is missing!');\n return;\n }\n if (!outputModulesPath) {\n logger.error('Second argument `modules-output-path` is missing!');\n return;\n }\n if (!modulesPaths || modulesPaths.length === 0) {\n logger.error('Third argument `modules-paths` is missing!');\n return;\n }\n\n logger.info('Reading source map from', sourceMapPath);\n logger.info('Saving modules to', outputModulesPath);\n logger.info('Resolving modules from paths', outputModulesPath);\n\n if (!existsSync(sourceMapPath)) {\n logger.error(`Source map file does not exist at ${sourceMapPath}`);\n return;\n }\n for (const modulesPath of modulesPaths) {\n if (!existsSync(modulesPath)) {\n logger.error(`Modules path does not exist at ${modulesPath}`);\n return;\n }\n }\n\n const map: { sources?: unknown } = JSON.parse(readFileSync(sourceMapPath, 'utf8'));\n if (!map.sources || !Array.isArray(map.sources)) {\n logger.error(`Modules not collected. No sources found in the source map (${sourceMapPath})!`);\n return;\n }\n\n const sources: unknown[] = map.sources;\n const modules = collect\n ? collect(sources, modulesPaths)\n : ModulesCollector.collect(sources, modulesPaths);\n\n const outputModulesDirPath = dirname(outputModulesPath);\n if (!existsSync(outputModulesDirPath)) {\n mkdirSync(outputModulesDirPath, { recursive: true });\n }\n writeFileSync(outputModulesPath, JSON.stringify(modules, null, 2));\n logger.info(`Modules collected and saved to: ${outputModulesPath}`);\n }\n\n}\n"]}
@@ -1,32 +1,11 @@
1
1
  Object.defineProperty(exports, "__esModule", { value: true });
2
- const utils_1 = require("@sentry/utils");
3
- const fs_1 = require("fs");
2
+ /* eslint-disable @typescript-eslint/no-unsafe-member-access */
4
3
  const process_1 = require("process");
5
4
  const ModulesCollector_1 = require("./ModulesCollector");
6
- const sourceMapPath = process_1.argv[2]; // eslint-disable-line @typescript-eslint/no-unsafe-member-access
7
- const outputModulesPath = process_1.argv[3]; // eslint-disable-line @typescript-eslint/no-unsafe-member-access
8
- const modulesPaths = process_1.argv[4] // eslint-disable-line @typescript-eslint/no-unsafe-member-access
9
- ? process_1.argv[4].split(',') // eslint-disable-line @typescript-eslint/no-unsafe-member-access
5
+ const sourceMapPath = process_1.argv[2];
6
+ const outputModulesPath = process_1.argv[3];
7
+ const modulesPaths = process_1.argv[4]
8
+ ? process_1.argv[4].split(',')
10
9
  : [];
11
- if (!sourceMapPath) {
12
- exitGracefully('First argument `source-map-path` is missing!');
13
- }
14
- if (!outputModulesPath) {
15
- exitGracefully('Second argument `modules-output-path` is missing!');
16
- }
17
- if (modulesPaths.length === 0) {
18
- exitGracefully('Third argument `modules-paths` is missing!');
19
- }
20
- const map = JSON.parse(fs_1.readFileSync(sourceMapPath, 'utf8'));
21
- if (!map.sources) {
22
- exitGracefully(`Modules not collected. No sources found in the source map (${sourceMapPath})!`);
23
- }
24
- const sources = map.sources;
25
- const modules = ModulesCollector_1.default.collect(sources, modulesPaths);
26
- fs_1.writeFileSync(outputModulesPath, JSON.stringify(modules, null, 2));
27
- function exitGracefully(message) {
28
- utils_1.logger.error(message);
29
- process_1.exit(0);
30
- }
31
- ;
10
+ ModulesCollector_1.default.run({ sourceMapPath, outputModulesPath, modulesPaths });
32
11
  //# sourceMappingURL=collectModules.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"collectModules.js","sourceRoot":"","sources":["../../../src/js/tools/collectModules.ts"],"names":[],"mappings":";AAAA,yCAAuC;AACvC,2BAAiD;AACjD,qCAAqC;AAErC,yDAAkD;AAElD,MAAM,aAAa,GAAuB,cAAI,CAAC,CAAC,CAAC,CAAC,CAAC,iEAAiE;AACpH,MAAM,iBAAiB,GAAuB,cAAI,CAAC,CAAC,CAAC,CAAC,CAAC,iEAAiE;AACxH,MAAM,YAAY,GAAa,cAAI,CAAC,CAAC,CAAC,CAAC,iEAAiE;IACtG,CAAC,CAAC,cAAI,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,iEAAiE;IACtF,CAAC,CAAC,EAAE,CAAC;AAEP,IAAI,CAAC,aAAa,EAAE;IAClB,cAAc,CAAC,8CAA8C,CAAC,CAAC;CAChE;AACD,IAAI,CAAC,iBAAiB,EAAE;IACtB,cAAc,CAAC,mDAAmD,CAAC,CAAC;CACrE;AACD,IAAI,YAAY,CAAC,MAAM,KAAK,CAAC,EAAE;IAC7B,cAAc,CAAC,4CAA4C,CAAC,CAAC;CAC9D;AAED,MAAM,GAAG,GAA2B,IAAI,CAAC,KAAK,CAAC,iBAAY,CAAC,aAAa,EAAE,MAAM,CAAC,CAAC,CAAC;AACpF,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE;IAChB,cAAc,CAAC,8DAA8D,aAAa,IAAI,CAAC,CAAC;CACjG;AAED,MAAM,OAAO,GAAa,GAAG,CAAC,OAAO,CAAC;AACtC,MAAM,OAAO,GAAG,0BAAgB,CAAC,OAAO,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC;AAEhE,kBAAa,CAAC,iBAAiB,EAAE,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;AAEnE,SAAS,cAAc,CAAC,OAAe;IACrC,cAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IACtB,cAAI,CAAC,CAAC,CAAC,CAAC;AACV,CAAC;AAAA,CAAC","sourcesContent":["import { logger } from '@sentry/utils';\nimport { readFileSync, writeFileSync } from 'fs';\nimport { argv, exit } from 'process';\n\nimport ModulesCollector from './ModulesCollector';\n\nconst sourceMapPath: string | undefined = argv[2]; // eslint-disable-line @typescript-eslint/no-unsafe-member-access\nconst outputModulesPath: string | undefined = argv[3]; // eslint-disable-line @typescript-eslint/no-unsafe-member-access\nconst modulesPaths: string[] = argv[4] // eslint-disable-line @typescript-eslint/no-unsafe-member-access\n ? argv[4].split(',') // eslint-disable-line @typescript-eslint/no-unsafe-member-access\n : [];\n\nif (!sourceMapPath) {\n exitGracefully('First argument `source-map-path` is missing!');\n}\nif (!outputModulesPath) {\n exitGracefully('Second argument `modules-output-path` is missing!');\n}\nif (modulesPaths.length === 0) {\n exitGracefully('Third argument `modules-paths` is missing!');\n}\n\nconst map: { sources?: string[] } = JSON.parse(readFileSync(sourceMapPath, 'utf8'));\nif (!map.sources) {\n exitGracefully(`Modules not collected. No sources found in the source map (${sourceMapPath})!`);\n}\n\nconst sources: string[] = map.sources;\nconst modules = ModulesCollector.collect(sources, modulesPaths);\n\nwriteFileSync(outputModulesPath, JSON.stringify(modules, null, 2));\n\nfunction exitGracefully(message: string): never {\n logger.error(message);\n exit(0);\n};\n"]}
1
+ {"version":3,"file":"collectModules.js","sourceRoot":"","sources":["../../../src/js/tools/collectModules.ts"],"names":[],"mappings":";AAAA,+DAA+D;AAC/D,qCAA+B;AAE/B,yDAAkD;AAElD,MAAM,aAAa,GAAuB,cAAI,CAAC,CAAC,CAAC,CAAC;AAClD,MAAM,iBAAiB,GAAuB,cAAI,CAAC,CAAC,CAAC,CAAC;AACtD,MAAM,YAAY,GAAa,cAAI,CAAC,CAAC,CAAC;IACpC,CAAC,CAAC,cAAI,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC;IACpB,CAAC,CAAC,EAAE,CAAC;AAEP,0BAAgB,CAAC,GAAG,CAAC,EAAE,aAAa,EAAE,iBAAiB,EAAE,YAAY,EAAE,CAAC,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/no-unsafe-member-access */\nimport { argv } from 'process';\n\nimport ModulesCollector from './ModulesCollector';\n\nconst sourceMapPath: string | undefined = argv[2];\nconst outputModulesPath: string | undefined = argv[3];\nconst modulesPaths: string[] = argv[4]\n ? argv[4].split(',')\n : [];\n\nModulesCollector.run({ sourceMapPath, outputModulesPath, modulesPaths });\n"]}
@@ -26,6 +26,10 @@ export declare type TouchEventBoundaryProps = {
26
26
  * React Node wrapped by TouchEventBoundary.
27
27
  */
28
28
  children?: React.ReactNode;
29
+ /**
30
+ * Label Name used to identify the touched element.
31
+ */
32
+ labelName?: string;
29
33
  };
30
34
  /**
31
35
  * Boundary to log breadcrumbs for interaction events.
@@ -1 +1 @@
1
- {"version":3,"file":"touchevents.d.ts","sourceRoot":"","sources":["../../src/js/touchevents.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,oBAAY,uBAAuB,GAAG;IACpC;;OAEG;IACH,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B;;OAEG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB;;OAEG;IACH,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B;;;OAGG;IACH,WAAW,CAAC,EAAE,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC,CAAC;IACrC;;;OAGG;IACH,mBAAmB,CAAC,EAAE,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC,CAAC;IAC7C;;OAEG;IACH,QAA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AE,OAAO,CAAC,uBAAuB,CAAC,CAK1D;IAEF;;OAEG;IACI,MAAM,IAAI,KAAK,CAAC,SAAS;IAYhC;;OAEG;IACH,OAAO,CAAC,cAAc;IAmBtB;;OAEG;IACH,OAAO,CAAC,cAAc;IAoBtB;;;OAGG;IAEH,OAAO,CAAC,aAAa;CAyEtB;AAED;;;;GAIG;AACH,QAAA,MAAM,sBAAsB,gIAc3B,CAAC;AAEF,OAAO,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,CAAC"}
@@ -37,7 +37,7 @@ class TouchEventBoundary extends React.Component {
37
37
  message: activeLabel
38
38
  ? `Touch event within element: ${activeLabel}`
39
39
  : 'Touch event within component tree',
40
- type: this.props.breadcrumbType
40
+ type: this.props.breadcrumbType,
41
41
  };
42
42
  addBreadcrumb(crumb);
43
43
  logger.log(`[TouchEvents] ${crumb.message}`);
@@ -85,6 +85,11 @@ class TouchEventBoundary extends React.Component {
85
85
  const label = typeof (props === null || props === void 0 ? void 0 : props[PROP_KEY]) !== 'undefined'
86
86
  ? `${props[PROP_KEY]}`
87
87
  : undefined;
88
+ // For some reason type narrowing doesn't work as expected with indexing when checking it all in one go in
89
+ // the "check-label" if sentence, so we have to assign it to a variable here first
90
+ let labelValue;
91
+ if (typeof this.props.labelName === 'string')
92
+ labelValue = props === null || props === void 0 ? void 0 : props[this.props.labelName];
88
93
  // Check the label first
89
94
  if (label && !this._isNameIgnored(label)) {
90
95
  if (!activeLabel) {
@@ -92,12 +97,12 @@ class TouchEventBoundary extends React.Component {
92
97
  }
93
98
  componentTreeNames.push(label);
94
99
  }
95
- else if (typeof (props === null || props === void 0 ? void 0 : props.accessibilityLabel) === 'string' &&
96
- !this._isNameIgnored(props.accessibilityLabel)) {
100
+ else if (typeof labelValue === 'string' &&
101
+ !this._isNameIgnored(labelValue)) {
97
102
  if (!activeLabel) {
98
- activeLabel = props.accessibilityLabel;
103
+ activeLabel = labelValue;
99
104
  }
100
- componentTreeNames.push(props.accessibilityLabel);
105
+ componentTreeNames.push(labelValue);
101
106
  }
102
107
  else if (currentInst.elementType) {
103
108
  const { elementType } = currentInst;
@@ -1 +1 @@
1
- {"version":3,"file":"touchevents.js","sourceRoot":"","sources":["../../src/js/touchevents.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAE7C,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACvC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AA+BhD,MAAM,gBAAgB,GAAG,UAAU,CAAC,MAAM,CAAC;IACzC,WAAW,EAAE;QACX,IAAI,EAAE,CAAC;KACR;CACF,CAAC,CAAC;AAEH,MAAM,2BAA2B,GAAG,OAAO,CAAC;AAC5C,MAAM,uBAAuB,GAAG,MAAM,CAAC;AACvC,MAAM,+BAA+B,GAAG,EAAE,CAAC;AAE3C,MAAM,QAAQ,GAAG,cAAc,CAAC;AAWhC;;GAEG;AACH,MAAM,kBAAmB,SAAQ,KAAK,CAAC,SAAkC;IASvE;;OAEG;IACI,MAAM;QACX,OAAO,CACL,CAAC,IAAI,CACH,KAAK,CAAC,CAAC,gBAAgB,CAAC,WAAW,CAAC;QACpC,8DAA8D;QAC9D,YAAY,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAQ,CAAC,CAEnD;QAAA,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,CACtB;MAAA,EAAE,IAAI,CAAC,CACR,CAAC;IACJ,CAAC;IAED;;OAEG;IACK,cAAc,CACpB,kBAA4B,EAC5B,WAAoB;QAEpB,MAAM,KAAK,GAAG,MAAuB,CAAC;QACtC,MAAM,KAAK,GAAG;YACZ,QAAQ,EAAE,IAAI,CAAC,KAAK,CAAC,kBAAkB;YACvC,IAAI,EAAE,EAAE,aAAa,EAAE,kBAAkB,EAAE;YAC3C,KAAK,EAAE,KA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BAClD;iBACF;gBAED,WAAW,GAAG,WAAW,CAAC,MAAM,CAAC;aAClC;YAED,MAAM,UAAU,GAAG,WAAW,aAAX,WAAW,cAAX,WAAW,GAAI,iBAAiB,CAAC;YAEpD,IAAI,kBAAkB,CAAC,MAAM,GAAG,CAAC,IAAI,UAAU,EAAE;gBAC/C,IAAI,CAAC,cAAc,CAAC,kBAAkB,EAAE,UAAU,CAAC,CAAC;aACrD;SACF;IACH,CAAC;;AA3Ia,8BAAW,GAAW,6BAA6B,CAAC;AACpD,+BAAY,GAAqC;IAC7D,kBAAkB,EAAE,2BAA2B;IAC/C,cAAc,EAAE,uBAAuB;IACvC,WAAW,EAAE,EAAE;IACf,oBAAoB,EAAE,+BAA+B;CACtD,CAAC;AAwIJ;;;;GAIG;AACH,MAAM,sBAAsB,GAAG;AAC7B,8DAA8D;AAC9D,cAAwC,EACxC,aAAuC,EACd,EAAE;IAC3B,MAAM,gBAAgB,GAA4B,CAAC,KAAK,EAAE,EAAE,CAAC,CAC3D,CAAC,kBAAkB,CAAC,IAAI,CAAC,aAAa,aAAb,aAAa,cAAb,aAAa,GAAI,EAAE,CAAC,CAAC,CAC5C;MAAA,CAAC,cAAc,CAAC,IAAI,KAAK,CAAC,EAC5B;IAAA,EAAE,kBAAkB,CAAC,CACtB,CAAC;IAEF,gBAAgB,CAAC,WAAW,GAAG,wBAAwB,CAAC;IAExD,OAAO,gBAAgB,CAAC;AAC1B,CAAC,CAAC;AAEF,OAAO,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,CAAC","sourcesContent":["import { addBreadcrumb } from '@sentry/core';\nimport { SeverityLevel } from '@sentry/types';\nimport { logger } from '@sentry/utils';\nimport * as React from 'react';\nimport { StyleSheet, View } from 'react-native';\n\nexport type TouchEventBoundaryProps = {\n /**\n * The category assigned to the breadcrumb that is logged by the touch event.\n */\n breadcrumbCategory?: string;\n /**\n * The type assigned to the breadcrumb that is logged by the touch event.\n */\n breadcrumbType?: string;\n /**\n * The max number of components to display when logging a touch's component tree.\n */\n maxComponentTreeSize?: number;\n /**\n * Component name(s) to ignore when logging the touch event. This prevents unhelpful logs such as\n * \"Touch event within element: View\" where you still can't tell which View it occurred in.\n */\n ignoreNames?: Array<string | RegExp>;\n /**\n * Deprecated, use ignoreNames instead\n * @deprecated\n */\n ignoredDisplayNames?: Array<string | RegExp>;\n /**\n * React Node wrapped by TouchEventBoundary.\n */\n children?: React.ReactNode;\n};\n\nconst touchEventStyles = StyleSheet.create({\n wrapperView: {\n flex: 1,\n },\n});\n\nconst DEFAULT_BREADCRUMB_CATEGORY = 'touch';\nconst DEFAULT_BREADCRUMB_TYPE = 'user';\nconst DEFAULT_MAX_COMPONENT_TREE_SIZE = 20;\n\nconst PROP_KEY = 'sentry-label';\n\ninterface ElementInstance {\n elementType?: {\n displayName?: string;\n name?: string;\n };\n memoizedProps?: Record<string, unknown>;\n return?: ElementInstance;\n}\n\n/**\n * Boundary to log breadcrumbs for interaction events.\n */\nclass TouchEventBoundary extends React.Component<TouchEventBoundaryProps> {\n public static displayName: string = '__Sentry.TouchEventBoundary';\n public static defaultProps: Partial<TouchEventBoundaryProps> = {\n breadcrumbCategory: DEFAULT_BREADCRUMB_CATEGORY,\n breadcrumbType: DEFAULT_BREADCRUMB_TYPE,\n ignoreNames: [],\n maxComponentTreeSize: DEFAULT_MAX_COMPONENT_TREE_SIZE,\n };\n\n /**\n *\n */\n public render(): React.ReactNode {\n return (\n <View\n style={touchEventStyles.wrapperView}\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n onTouchStart={this._onTouchStart.bind(this) as any}\n >\n {this.props.children}\n </View>\n );\n }\n\n /**\n * Logs the touch event given the component tree names and a label.\n */\n private _logTouchEvent(\n componentTreeNames: string[],\n activeLabel?: string\n ): void {\n const level = 'info' as SeverityLevel;\n const crumb = {\n category: this.props.breadcrumbCategory,\n data: { componentTree: componentTreeNames },\n level: level,\n message: activeLabel\n ? `Touch event within element: ${activeLabel}`\n : 'Touch event within component tree',\n type: this.props.breadcrumbType\n }\n addBreadcrumb(crumb);\n\n logger.log(`[TouchEvents] ${crumb.message}`);\n }\n\n /**\n * Checks if the name is supposed to be ignored.\n */\n private _isNameIgnored(name: string): boolean {\n let ignoreNames = this.props.ignoreNames || [];\n // eslint-disable-next-line deprecation/deprecation\n if (this.props.ignoredDisplayNames) {\n // This is to make it compatible with prior version.\n // eslint-disable-next-line deprecation/deprecation\n ignoreNames = [...ignoreNames, ...this.props.ignoredDisplayNames];\n }\n\n return ignoreNames.some(\n (ignoreName: string | RegExp) =>\n (typeof ignoreName === 'string' && name === ignoreName) ||\n (ignoreName instanceof RegExp && name.match(ignoreName))\n );\n }\n\n // Originally was going to clean the names of any HOCs as well but decided that it might hinder debugging effectively. Will leave here in case\n // private readonly _cleanName = (name: string): string =>\n // name.replace(/.*\\(/g, \"\").replace(/\\)/g, \"\");\n\n /**\n * Traverses through the component tree when a touch happens and logs it.\n * @param e\n */\n // eslint-disable-next-line complexity\n private _onTouchStart(e: { _targetInst?: ElementInstance }): void {\n if (e._targetInst) {\n let currentInst: ElementInstance | undefined = e._targetInst;\n\n let activeLabel: string | undefined;\n let activeDisplayName: string | undefined;\n const componentTreeNames: string[] = [];\n\n while (\n currentInst &&\n // maxComponentTreeSize will always be defined as we have a defaultProps. But ts needs a check so this is here.\n this.props.maxComponentTreeSize &&\n componentTreeNames.length < this.props.maxComponentTreeSize\n ) {\n if (\n // If the loop gets to the boundary itself, break.\n currentInst.elementType?.displayName ===\n TouchEventBoundary.displayName\n ) {\n break;\n }\n\n const props = currentInst.memoizedProps;\n const label =\n typeof props?.[PROP_KEY] !== 'undefined'\n ? `${props[PROP_KEY]}`\n : undefined;\n\n // Check the label first\n if (label && !this._isNameIgnored(label)) {\n if (!activeLabel) {\n activeLabel = label;\n }\n componentTreeNames.push(label);\n } else if (\n typeof props?.accessibilityLabel === 'string' &&\n !this._isNameIgnored(props.accessibilityLabel)\n ) {\n if (!activeLabel) {\n activeLabel = props.accessibilityLabel;\n }\n componentTreeNames.push(props.accessibilityLabel);\n } else if (currentInst.elementType) {\n const { elementType } = currentInst;\n\n if (\n elementType.displayName &&\n !this._isNameIgnored(elementType.displayName)\n ) {\n // Check display name\n if (!activeDisplayName) {\n activeDisplayName = elementType.displayName;\n }\n componentTreeNames.push(elementType.displayName);\n }\n }\n\n currentInst = currentInst.return;\n }\n\n const finalLabel = activeLabel ?? activeDisplayName;\n\n if (componentTreeNames.length > 0 || finalLabel) {\n this._logTouchEvent(componentTreeNames, finalLabel);\n }\n }\n }\n}\n\n/**\n * Convenience Higher-Order-Component for TouchEventBoundary\n * @param WrappedComponent any React Component\n * @param boundaryProps TouchEventBoundaryProps\n */\nconst withTouchEventBoundary = (\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n InnerComponent: React.ComponentType<any>,\n boundaryProps?: TouchEventBoundaryProps\n): React.FunctionComponent => {\n const WrappedComponent: React.FunctionComponent = (props) => (\n <TouchEventBoundary {...(boundaryProps ?? {})}>\n <InnerComponent {...props} />\n </TouchEventBoundary>\n );\n\n WrappedComponent.displayName = 'WithTouchEventBoundary';\n\n return WrappedComponent;\n};\n\nexport { TouchEventBoundary, withTouchEventBoundary };\n"]}
1
+ {"version":3,"file":"touchevents.js","sourceRoot":"","sources":["../../src/js/touchevents.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAE7C,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACvC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAmChD,MAAM,gBAAgB,GAAG,UAAU,CAAC,MAAM,CAAC;IACzC,WAAW,EAAE;QACX,IAAI,EAAE,CAAC;KACR;CACF,CAAC,CAAC;AAEH,MAAM,2BAA2B,GAAG,OAAO,CAAC;AAC5C,MAAM,uBAAuB,GAAG,MAAM,CAAC;AACvC,MAAM,+BAA+B,GAAG,EAAE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AAC;AA8IJ;;;;GAIG;AACH,MAAM,sBAAsB,GAAG;AAC7B,8DAA8D;AAC9D,cAAwC,EACxC,aAAuC,EACd,EAAE;IAC3B,MAAM,gBAAgB,GAA4B,CAAC,KAAK,EAAE,EAAE,CAAC,CAC3D,CAAC,kBAAkB,CAAC,IAAI,CAAC,aAAa,aAAb,aAAa,cAAb,aAAa,GAAI,EAAE,CAAC,CAAC,CAC5C;MAAA,CAAC,cAAc,CAAC,IAAI,KAAK,CAAC,EAC5B;IAAA,EAAE,kBAAkB,CAAC,CACtB,CAAC;IAEF,gBAAgB,CAAC,WAAW,GAAG,wBAAwB,CAAC;IAExD,OAAO,gBAAgB,CAAC;AAC1B,CAAC,CAAC;AAEF,OAAO,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,CAAC","sourcesContent":["import { addBreadcrumb } from '@sentry/core';\nimport type { SeverityLevel } from '@sentry/types';\nimport { logger } from '@sentry/utils';\nimport * as React from 'react';\nimport { StyleSheet, View } from 'react-native';\n\nexport type TouchEventBoundaryProps = {\n /**\n * The category assigned to the breadcrumb that is logged by the touch event.\n */\n breadcrumbCategory?: string;\n /**\n * The type assigned to the breadcrumb that is logged by the touch event.\n */\n breadcrumbType?: string;\n /**\n * The max number of components to display when logging a touch's component tree.\n */\n maxComponentTreeSize?: number;\n /**\n * Component name(s) to ignore when logging the touch event. This prevents unhelpful logs such as\n * \"Touch event within element: View\" where you still can't tell which View it occurred in.\n */\n ignoreNames?: Array<string | RegExp>;\n /**\n * Deprecated, use ignoreNames instead\n * @deprecated\n */\n ignoredDisplayNames?: Array<string | RegExp>;\n /**\n * React Node wrapped by TouchEventBoundary.\n */\n children?: React.ReactNode;\n /**\n * Label Name used to identify the touched element.\n */\n labelName?: string;\n};\n\nconst touchEventStyles = StyleSheet.create({\n wrapperView: {\n flex: 1,\n },\n});\n\nconst DEFAULT_BREADCRUMB_CATEGORY = 'touch';\nconst DEFAULT_BREADCRUMB_TYPE = 'user';\nconst DEFAULT_MAX_COMPONENT_TREE_SIZE = 20;\n\nconst PROP_KEY = 'sentry-label';\n\ninterface ElementInstance {\n elementType?: {\n displayName?: string;\n name?: string;\n };\n memoizedProps?: Record<string, unknown>;\n return?: ElementInstance;\n}\n\n/**\n * Boundary to log breadcrumbs for interaction events.\n */\nclass TouchEventBoundary extends React.Component<TouchEventBoundaryProps> {\n public static displayName: string = '__Sentry.TouchEventBoundary';\n public static defaultProps: Partial<TouchEventBoundaryProps> = {\n breadcrumbCategory: DEFAULT_BREADCRUMB_CATEGORY,\n breadcrumbType: DEFAULT_BREADCRUMB_TYPE,\n ignoreNames: [],\n maxComponentTreeSize: DEFAULT_MAX_COMPONENT_TREE_SIZE,\n };\n\n /**\n *\n */\n public render(): React.ReactNode {\n return (\n <View\n style={touchEventStyles.wrapperView}\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n onTouchStart={this._onTouchStart.bind(this) as any}\n >\n {this.props.children}\n </View>\n );\n }\n\n /**\n * Logs the touch event given the component tree names and a label.\n */\n private _logTouchEvent(\n componentTreeNames: string[],\n activeLabel?: string\n ): void {\n const level = 'info' as SeverityLevel;\n const crumb = {\n category: this.props.breadcrumbCategory,\n data: { componentTree: componentTreeNames },\n level: level,\n message: activeLabel\n ? `Touch event within element: ${activeLabel}`\n : 'Touch event within component tree',\n type: this.props.breadcrumbType,\n };\n addBreadcrumb(crumb);\n\n logger.log(`[TouchEvents] ${crumb.message}`);\n }\n\n /**\n * Checks if the name is supposed to be ignored.\n */\n private _isNameIgnored(name: string): boolean {\n let ignoreNames = this.props.ignoreNames || [];\n // eslint-disable-next-line deprecation/deprecation\n if (this.props.ignoredDisplayNames) {\n // This is to make it compatible with prior version.\n // eslint-disable-next-line deprecation/deprecation\n ignoreNames = [...ignoreNames, ...this.props.ignoredDisplayNames];\n }\n\n return ignoreNames.some(\n (ignoreName: string | RegExp) =>\n (typeof ignoreName === 'string' && name === ignoreName) ||\n (ignoreName instanceof RegExp && name.match(ignoreName))\n );\n }\n\n // Originally was going to clean the names of any HOCs as well but decided that it might hinder debugging effectively. Will leave here in case\n // private readonly _cleanName = (name: string): string =>\n // name.replace(/.*\\(/g, \"\").replace(/\\)/g, \"\");\n\n /**\n * Traverses through the component tree when a touch happens and logs it.\n * @param e\n */\n // eslint-disable-next-line complexity\n private _onTouchStart(e: { _targetInst?: ElementInstance }): void {\n if (e._targetInst) {\n let currentInst: ElementInstance | undefined = e._targetInst;\n\n let activeLabel: string | undefined;\n let activeDisplayName: string | undefined;\n const componentTreeNames: string[] = [];\n\n while (\n currentInst &&\n // maxComponentTreeSize will always be defined as we have a defaultProps. But ts needs a check so this is here.\n this.props.maxComponentTreeSize &&\n componentTreeNames.length < this.props.maxComponentTreeSize\n ) {\n if (\n // If the loop gets to the boundary itself, break.\n currentInst.elementType?.displayName ===\n TouchEventBoundary.displayName\n ) {\n break;\n }\n\n const props = currentInst.memoizedProps;\n const label =\n typeof props?.[PROP_KEY] !== 'undefined'\n ? `${props[PROP_KEY]}`\n : undefined;\n\n // For some reason type narrowing doesn't work as expected with indexing when checking it all in one go in\n // the \"check-label\" if sentence, so we have to assign it to a variable here first\n let labelValue;\n if (typeof this.props.labelName === 'string')\n labelValue = props?.[this.props.labelName];\n\n // Check the label first\n if (label && !this._isNameIgnored(label)) {\n if (!activeLabel) {\n activeLabel = label;\n }\n componentTreeNames.push(label);\n } else if (\n typeof labelValue === 'string' &&\n !this._isNameIgnored(labelValue)\n ) {\n if (!activeLabel) {\n activeLabel = labelValue;\n }\n componentTreeNames.push(labelValue);\n } else if (currentInst.elementType) {\n const { elementType } = currentInst;\n\n if (\n elementType.displayName &&\n !this._isNameIgnored(elementType.displayName)\n ) {\n // Check display name\n if (!activeDisplayName) {\n activeDisplayName = elementType.displayName;\n }\n componentTreeNames.push(elementType.displayName);\n }\n }\n\n currentInst = currentInst.return;\n }\n\n const finalLabel = activeLabel ?? activeDisplayName;\n\n if (componentTreeNames.length > 0 || finalLabel) {\n this._logTouchEvent(componentTreeNames, finalLabel);\n }\n }\n }\n}\n\n/**\n * Convenience Higher-Order-Component for TouchEventBoundary\n * @param WrappedComponent any React Component\n * @param boundaryProps TouchEventBoundaryProps\n */\nconst withTouchEventBoundary = (\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n InnerComponent: React.ComponentType<any>,\n boundaryProps?: TouchEventBoundaryProps\n): React.FunctionComponent => {\n const WrappedComponent: React.FunctionComponent = (props) => (\n <TouchEventBoundary {...(boundaryProps ?? {})}>\n <InnerComponent {...props} />\n </TouchEventBoundary>\n );\n\n WrappedComponent.displayName = 'WithTouchEventBoundary';\n\n return WrappedComponent;\n};\n\nexport { TouchEventBoundary, withTouchEventBoundary };\n"]}
@@ -1,5 +1,5 @@
1
- import { Transaction } from '@sentry/tracing';
2
- import { EventProcessor, Measurements, MeasurementUnit } from '@sentry/types';
1
+ import type { Transaction } from '@sentry/tracing';
2
+ import type { EventProcessor, Measurements, MeasurementUnit } from '@sentry/types';
3
3
  export interface FramesMeasurements extends Measurements {
4
4
  'frames_total': {
5
5
  value: number;
@@ -1 +1 @@
1
- {"version":3,"file":"nativeframes.d.ts","sourceRoot":"","sources":["../../../src/js/tracing/nativeframes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,WAAW,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,EAAS,cAAc,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAOrF,MAAM,WAAW,kBAAmB,SAAQ,YAAY;IACpD,cAAc,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,eAAe,CAAA;KAAE,CAAC;IACzD,aAAa,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,eAAe,CAAA;KAAE,CAAC;IACxD,eAAe,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,eAAe,CAAA;KAAE,CAAC;CAC7D;AAQD;;GAEG;AACH,qBAAa,2BAA2B;IACtC,0EAA0E;IAC1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AC,QAAQ,CAAC,KAAK,EACpB;gBACA,MAAM,YAAY,GAAG,KAAK,CAAC,QAAQ,CAAC,KAKnC,CAAC;gBAEF,MAAM,OAAO,GAAG,YAAY,CAAC,QAAQ,CAAC;gBAEtC,IAAI,OAAO,WAAI,YAAY,CAAC,IAAI,0CAAE,aAAa,CAAA,IAAI,KAAK,CAAC,SAAS,EAAE;oBAClE,MAAM,YAAY,GAAG,MAAM,IAAI,CAAC,sBAAsB,CACpD,OAAO,EACP,KAAK,CAAC,SAAS,EACf,YAAY,CAAC,IAAI,CAAC,aAAqC,CACxD,CAAC;oBAEF,IAAI,CAAC,YAAY,EAAE;wBACjB,MAAM,CAAC,GAAG,CACR,oDAAoD,YAAY,CAAC,EAAE,gBAAgB,KAAK,CAAC,WAAW,0CAA0C,CAC/I,CAAC;qBACH;yBAAM;wBACL,MAAM,CAAC,GAAG,CACR,yCAAyC,YAAY,CAAC,EACtD,gBAAgB,KAAK,CAAC,WAAW,KAAK,IAAI,CAAC,SAAS,CAClD,YAAY,EACZ,SAAS,EACT,CAAC,CACF,EAAE,CACJ,CAAC;wBAEF,KAAK,CAAC,YAAY,mCACb,OAAC,KAAK,CAAC,YAAY,mCAAI,EAAE,CAAC,GAC1B,YAAY,CAChB,CAAC;wBAEF,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;qBACpC;oBAED,OAAO,YAAY,CAAC,IAAI,CAAC,aAAa,CAAC;iBACxC;aACF;YAED,OAAO,KAAK,CAAC;;KACd;CACF","sourcesContent":["import { Span, Transaction } from '@sentry/tracing';\nimport { Event, EventProcessor, Measurements, MeasurementUnit } from '@sentry/types';\nimport { logger, timestampInSeconds } from '@sentry/utils';\n\nimport { NativeFramesResponse } from '../NativeRNSentry';\nimport { NATIVE } from '../wrapper';\nimport { instrumentChildSpanFinish } from './utils';\n\nexport interface FramesMeasurements extends Measurements {\n 'frames_total': { value: number, unit: MeasurementUnit };\n 'frames_slow': { value: number, unit: MeasurementUnit };\n 'frames_frozen': { value: number, unit: MeasurementUnit };\n}\n\n/**\n * A margin of error of 50ms is allowed for the async native bridge call.\n * Anything larger would reduce the accuracy of our frames measurements.\n */\nconst MARGIN_OF_ERROR_SECONDS = 0.05;\n\n/**\n * Instrumentation to add native slow/frozen frames measurements onto transactions.\n */\nexport class NativeFramesInstrumentation {\n /** The native frames at the transaction finish time, keyed by traceId. */\n private _finishFrames: Map<\n string,\n { timestamp: number; nativeFrames: NativeFramesResponse | null }\n > = new Map();\n /** The listeners for each native frames response, keyed by traceId */\n private _framesListeners: Map<string, () => void> = new Map();\n /** The native frames at the finish time of the most recent span. */\n private _lastSpanFinishFrames?: {\n timestamp: number;\n nativeFrames: NativeFramesResponse;\n };\n\n public constructor(\n addGlobalEventProcessor: (e: EventProcessor) => void,\n doesExist: () => boolean\n ) {\n logger.log(\n '[ReactNativeTracing] Native frames instrumentation initialized.'\n );\n\n addGlobalEventProcessor((event) => this._processEvent(event, doesExist));\n }\n\n /**\n * To be called when a transaction is started.\n * Logs the native frames at this start point and instruments child span finishes.\n */\n public onTransactionStart(transaction: Transaction): void {\n void NATIVE.fetchNativeFrames().then((framesMetrics) => {\n if (framesMetrics) {\n transaction.setData('__startFrames', framesMetrics);\n }\n });\n\n instrumentChildSpanFinish(transaction, (_: Span, endTimestamp?: number) => {\n if (!endTimestamp) {\n this._onSpanFinish();\n }\n });\n }\n\n /**\n * To be called when a transaction is finished\n */\n public onTransactionFinish(transaction: Transaction): void {\n void this._fetchFramesForTransaction(transaction);\n }\n\n /**\n * Called on a span finish to fetch native frames to support transactions with trimEnd.\n * Only to be called when a span does not have an end timestamp.\n */\n private _onSpanFinish(): void {\n const timestamp = timestampInSeconds();\n\n void NATIVE.fetchNativeFrames().then((nativeFrames) => {\n if (nativeFrames) {\n this._lastSpanFinishFrames = {\n timestamp,\n nativeFrames,\n };\n }\n });\n }\n\n /**\n * Returns the computed frames measurements and awaits for them if they are not ready yet.\n */\n private async _getFramesMeasurements(\n traceId: string,\n finalEndTimestamp: number,\n startFrames: NativeFramesResponse\n ): Promise<FramesMeasurements | null> {\n if (this._finishFrames.has(traceId)) {\n return this._prepareMeasurements(traceId, finalEndTimestamp, startFrames);\n }\n\n return new Promise((resolve) => {\n const timeout = setTimeout(() => {\n this._framesListeners.delete(traceId);\n\n resolve(null);\n }, 2000);\n\n this._framesListeners.set(traceId, () => {\n resolve(\n this._prepareMeasurements(traceId, finalEndTimestamp, startFrames)\n );\n\n clearTimeout(timeout);\n this._framesListeners.delete(traceId);\n });\n });\n }\n\n /**\n * Returns the computed frames measurements given ready data\n */\n private _prepareMeasurements(\n traceId: string,\n finalEndTimestamp: number, // The actual transaction finish time.\n startFrames: NativeFramesResponse\n ): FramesMeasurements | null {\n let finalFinishFrames: NativeFramesResponse | undefined;\n\n const finish = this._finishFrames.get(traceId);\n if (\n finish &&\n finish.nativeFrames &&\n // Must be in the margin of error of the actual transaction finish time (finalEndTimestamp)\n Math.abs(finish.timestamp - finalEndTimestamp) < MARGIN_OF_ERROR_SECONDS\n ) {\n finalFinishFrames = finish.nativeFrames;\n } else if (\n this._lastSpanFinishFrames &&\n Math.abs(this._lastSpanFinishFrames.timestamp - finalEndTimestamp) <\n MARGIN_OF_ERROR_SECONDS\n ) {\n // Fallback to the last span finish if it is within the margin of error of the actual finish timestamp.\n // This should be the case for trimEnd.\n finalFinishFrames = this._lastSpanFinishFrames.nativeFrames;\n } else {\n return null;\n }\n\n const measurements = {\n frames_total: {\n value: finalFinishFrames.totalFrames - startFrames.totalFrames,\n unit: 'none'\n },\n frames_frozen: {\n value: finalFinishFrames.frozenFrames - startFrames.frozenFrames,\n unit: 'none'\n },\n frames_slow: {\n value: finalFinishFrames.slowFrames - startFrames.slowFrames,\n unit: 'none'\n },\n };\n\n\n return measurements;\n }\n\n /**\n * Fetch finish frames for a transaction at the current time. Calls any awaiting listeners.\n */\n private async _fetchFramesForTransaction(\n transaction: Transaction\n ): Promise<void> {\n const startFrames = transaction.data.__startFrames as\n | NativeFramesResponse\n | undefined;\n\n // This timestamp marks when the finish frames were retrieved. It should be pretty close to the transaction finish.\n const timestamp = timestampInSeconds();\n let finishFrames: NativeFramesResponse | null = null;\n if (startFrames) {\n finishFrames = await NATIVE.fetchNativeFrames();\n }\n\n this._finishFrames.set(transaction.traceId, {\n nativeFrames: finishFrames,\n timestamp,\n });\n\n this._framesListeners.get(transaction.traceId)?.();\n\n setTimeout(() => this._cancelFinishFrames(transaction), 2000);\n }\n\n /**\n * On a finish frames failure, we cancel the await.\n */\n private _cancelFinishFrames(transaction: Transaction): void {\n if (this._finishFrames.has(transaction.traceId)) {\n this._finishFrames.delete(transaction.traceId);\n\n logger.log(\n `[NativeFrames] Native frames timed out for ${transaction.op} transaction ${transaction.name}. Not adding native frames measurements.`\n );\n }\n }\n\n /**\n * Adds frames measurements to an event. Called from a valid event processor.\n * Awaits for finish frames if needed.\n */\n private async _processEvent(\n event: Event,\n doesExist: () => boolean\n ): Promise<Event> {\n if (!doesExist()) {\n return event;\n }\n\n if (\n event.type === 'transaction' &&\n event.transaction &&\n event.contexts &&\n event.contexts.trace\n ) {\n const traceContext = event.contexts.trace as {\n data?: { [key: string]: unknown };\n trace_id: string;\n name?: string;\n op?: string;\n };\n\n const traceId = traceContext.trace_id;\n\n if (traceId && traceContext.data?.__startFrames && event.timestamp) {\n const measurements = await this._getFramesMeasurements(\n traceId,\n event.timestamp,\n traceContext.data.__startFrames as NativeFramesResponse\n );\n\n if (!measurements) {\n logger.log(\n `[NativeFrames] Could not fetch native frames for ${traceContext.op} transaction ${event.transaction}. Not adding native frames measurements.`\n );\n } else {\n logger.log(\n `[Measurements] Adding measurements to ${traceContext.op\n } transaction ${event.transaction}: ${JSON.stringify(\n measurements,\n undefined,\n 2\n )}`\n );\n\n event.measurements = {\n ...(event.measurements ?? {}),\n ...measurements,\n };\n\n this._finishFrames.delete(traceId);\n }\n\n delete traceContext.data.__startFrames;\n }\n }\n\n return event;\n }\n}\n"]}
1
+ {"version":3,"file":"n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;qBACH;yBAAM;wBACL,MAAM,CAAC,GAAG,CACR,yCAAyC,YAAY,CAAC,EACtD,gBAAgB,KAAK,CAAC,WAAW,KAAK,IAAI,CAAC,SAAS,CAClD,YAAY,EACZ,SAAS,EACT,CAAC,CACF,EAAE,CACJ,CAAC;wBAEF,KAAK,CAAC,YAAY,mCACb,OAAC,KAAK,CAAC,YAAY,mCAAI,EAAE,CAAC,GAC1B,YAAY,CAChB,CAAC;wBAEF,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;qBACpC;oBAED,OAAO,YAAY,CAAC,IAAI,CAAC,aAAa,CAAC;iBACxC;aACF;YAED,OAAO,KAAK,CAAC;;KACd;CACF","sourcesContent":["import type { Span, Transaction } from '@sentry/tracing';\nimport type { Event, EventProcessor, Measurements, MeasurementUnit } from '@sentry/types';\nimport { logger, timestampInSeconds } from '@sentry/utils';\n\nimport type { NativeFramesResponse } from '../NativeRNSentry';\nimport { NATIVE } from '../wrapper';\nimport { instrumentChildSpanFinish } from './utils';\n\nexport interface FramesMeasurements extends Measurements {\n 'frames_total': { value: number, unit: MeasurementUnit };\n 'frames_slow': { value: number, unit: MeasurementUnit };\n 'frames_frozen': { value: number, unit: MeasurementUnit };\n}\n\n/**\n * A margin of error of 50ms is allowed for the async native bridge call.\n * Anything larger would reduce the accuracy of our frames measurements.\n */\nconst MARGIN_OF_ERROR_SECONDS = 0.05;\n\n/**\n * Instrumentation to add native slow/frozen frames measurements onto transactions.\n */\nexport class NativeFramesInstrumentation {\n /** The native frames at the transaction finish time, keyed by traceId. */\n private _finishFrames: Map<\n string,\n { timestamp: number; nativeFrames: NativeFramesResponse | null }\n > = new Map();\n /** The listeners for each native frames response, keyed by traceId */\n private _framesListeners: Map<string, () => void> = new Map();\n /** The native frames at the finish time of the most recent span. */\n private _lastSpanFinishFrames?: {\n timestamp: number;\n nativeFrames: NativeFramesResponse;\n };\n\n public constructor(\n addGlobalEventProcessor: (e: EventProcessor) => void,\n doesExist: () => boolean\n ) {\n logger.log(\n '[ReactNativeTracing] Native frames instrumentation initialized.'\n );\n\n addGlobalEventProcessor((event) => this._processEvent(event, doesExist));\n }\n\n /**\n * To be called when a transaction is started.\n * Logs the native frames at this start point and instruments child span finishes.\n */\n public onTransactionStart(transaction: Transaction): void {\n void NATIVE.fetchNativeFrames().then((framesMetrics) => {\n if (framesMetrics) {\n transaction.setData('__startFrames', framesMetrics);\n }\n });\n\n instrumentChildSpanFinish(transaction, (_: Span, endTimestamp?: number) => {\n if (!endTimestamp) {\n this._onSpanFinish();\n }\n });\n }\n\n /**\n * To be called when a transaction is finished\n */\n public onTransactionFinish(transaction: Transaction): void {\n void this._fetchFramesForTransaction(transaction);\n }\n\n /**\n * Called on a span finish to fetch native frames to support transactions with trimEnd.\n * Only to be called when a span does not have an end timestamp.\n */\n private _onSpanFinish(): void {\n const timestamp = timestampInSeconds();\n\n void NATIVE.fetchNativeFrames().then((nativeFrames) => {\n if (nativeFrames) {\n this._lastSpanFinishFrames = {\n timestamp,\n nativeFrames,\n };\n }\n });\n }\n\n /**\n * Returns the computed frames measurements and awaits for them if they are not ready yet.\n */\n private async _getFramesMeasurements(\n traceId: string,\n finalEndTimestamp: number,\n startFrames: NativeFramesResponse\n ): Promise<FramesMeasurements | null> {\n if (this._finishFrames.has(traceId)) {\n return this._prepareMeasurements(traceId, finalEndTimestamp, startFrames);\n }\n\n return new Promise((resolve) => {\n const timeout = setTimeout(() => {\n this._framesListeners.delete(traceId);\n\n resolve(null);\n }, 2000);\n\n this._framesListeners.set(traceId, () => {\n resolve(\n this._prepareMeasurements(traceId, finalEndTimestamp, startFrames)\n );\n\n clearTimeout(timeout);\n this._framesListeners.delete(traceId);\n });\n });\n }\n\n /**\n * Returns the computed frames measurements given ready data\n */\n private _prepareMeasurements(\n traceId: string,\n finalEndTimestamp: number, // The actual transaction finish time.\n startFrames: NativeFramesResponse\n ): FramesMeasurements | null {\n let finalFinishFrames: NativeFramesResponse | undefined;\n\n const finish = this._finishFrames.get(traceId);\n if (\n finish &&\n finish.nativeFrames &&\n // Must be in the margin of error of the actual transaction finish time (finalEndTimestamp)\n Math.abs(finish.timestamp - finalEndTimestamp) < MARGIN_OF_ERROR_SECONDS\n ) {\n finalFinishFrames = finish.nativeFrames;\n } else if (\n this._lastSpanFinishFrames &&\n Math.abs(this._lastSpanFinishFrames.timestamp - finalEndTimestamp) <\n MARGIN_OF_ERROR_SECONDS\n ) {\n // Fallback to the last span finish if it is within the margin of error of the actual finish timestamp.\n // This should be the case for trimEnd.\n finalFinishFrames = this._lastSpanFinishFrames.nativeFrames;\n } else {\n return null;\n }\n\n const measurements = {\n frames_total: {\n value: finalFinishFrames.totalFrames - startFrames.totalFrames,\n unit: 'none'\n },\n frames_frozen: {\n value: finalFinishFrames.frozenFrames - startFrames.frozenFrames,\n unit: 'none'\n },\n frames_slow: {\n value: finalFinishFrames.slowFrames - startFrames.slowFrames,\n unit: 'none'\n },\n };\n\n\n return measurements;\n }\n\n /**\n * Fetch finish frames for a transaction at the current time. Calls any awaiting listeners.\n */\n private async _fetchFramesForTransaction(\n transaction: Transaction\n ): Promise<void> {\n const startFrames = transaction.data.__startFrames as\n | NativeFramesResponse\n | undefined;\n\n // This timestamp marks when the finish frames were retrieved. It should be pretty close to the transaction finish.\n const timestamp = timestampInSeconds();\n let finishFrames: NativeFramesResponse | null = null;\n if (startFrames) {\n finishFrames = await NATIVE.fetchNativeFrames();\n }\n\n this._finishFrames.set(transaction.traceId, {\n nativeFrames: finishFrames,\n timestamp,\n });\n\n this._framesListeners.get(transaction.traceId)?.();\n\n setTimeout(() => this._cancelFinishFrames(transaction), 2000);\n }\n\n /**\n * On a finish frames failure, we cancel the await.\n */\n private _cancelFinishFrames(transaction: Transaction): void {\n if (this._finishFrames.has(transaction.traceId)) {\n this._finishFrames.delete(transaction.traceId);\n\n logger.log(\n `[NativeFrames] Native frames timed out for ${transaction.op} transaction ${transaction.name}. Not adding native frames measurements.`\n );\n }\n }\n\n /**\n * Adds frames measurements to an event. Called from a valid event processor.\n * Awaits for finish frames if needed.\n */\n private async _processEvent(\n event: Event,\n doesExist: () => boolean\n ): Promise<Event> {\n if (!doesExist()) {\n return event;\n }\n\n if (\n event.type === 'transaction' &&\n event.transaction &&\n event.contexts &&\n event.contexts.trace\n ) {\n const traceContext = event.contexts.trace as {\n data?: { [key: string]: unknown };\n trace_id: string;\n name?: string;\n op?: string;\n };\n\n const traceId = traceContext.trace_id;\n\n if (traceId && traceContext.data?.__startFrames && event.timestamp) {\n const measurements = await this._getFramesMeasurements(\n traceId,\n event.timestamp,\n traceContext.data.__startFrames as NativeFramesResponse\n );\n\n if (!measurements) {\n logger.log(\n `[NativeFrames] Could not fetch native frames for ${traceContext.op} transaction ${event.transaction}. Not adding native frames measurements.`\n );\n } else {\n logger.log(\n `[Measurements] Adding measurements to ${traceContext.op\n } transaction ${event.transaction}: ${JSON.stringify(\n measurements,\n undefined,\n 2\n )}`\n );\n\n event.measurements = {\n ...(event.measurements ?? {}),\n ...measurements,\n };\n\n this._finishFrames.delete(traceId);\n }\n\n delete traceContext.data.__startFrames;\n }\n }\n\n return event;\n }\n}\n"]}
@@ -1,6 +1,7 @@
1
- import { EmitterSubscription } from 'react-native';
2
- import { InternalRoutingInstrumentation, OnConfirmRoute, TransactionCreator } from './routingInstrumentation';
3
- import { BeforeNavigate } from './types';
1
+ import type { EmitterSubscription } from 'react-native';
2
+ import type { OnConfirmRoute, TransactionCreator } from './routingInstrumentation';
3
+ import { InternalRoutingInstrumentation } from './routingInstrumentation';
4
+ import type { BeforeNavigate } from './types';
4
5
  interface ReactNativeNavigationOptions {
5
6
  /**
6
7
  * How long the instrumentation will wait for the route to mount after a change has been initiated,
@@ -1 +1 @@
1
- {"version":3,"file":"reactnativenavigation.d.ts","sourceRoot":"","sources":["../../../src/js/tracing/reactnativenavigation.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAEnD,OAAO,EACL,8BAA8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AAO,GAAE,OAAO,CAAC,4BAA4B,CAAM;IAYrD;;OAEG;IACI,8BAA8B,CACnC,QAAQ,EAAE,kBAAkB,EAC5B,cAAc,EAAE,cAAc,EAC9B,cAAc,EAAE,cAAc,GAC7B,IAAI;IAkBP;;OAEG;IACH,OAAO,CAAC,UAAU;IAelB;;OAEG;IACH,OAAO,CAAC,sBAAsB;IA0D9B,4DAA4D;IAC5D,OAAO,CAAC,oBAAoB;IAwB5B,wEAAwE;IACxE,OAAO,CAAC,yBAAyB;IAUjC,wEAAwE;IACxE,OAAO,CAAC,wBAAwB;CAMjC"}
1
+ {"version":3,"file":"reactnativenavigation.d.ts","sourceRoot":"","sources":["../../../src/js/tracing/reactnativenavigation.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAExD,OAAO,KAAK,EACV,cAAc,EACd,kBAAkB,EAAC,MAAM,0BAA0B,CAAC;AACtD,OAAO,EACL,8BAA8B,EAC/B,MAAM,0BAA0B,CAAC;AAClC,OAAO,KAAK,EAAE,cAAc,EAA0B,MAAM,SAAS,CAAC;AAGtE,UAAU,4BAA4B;IACpC;;;;;;OAMG;IACH,oBAAoB,EAAE,MAAM,CAAC;CAC9B;AAMD,UAAU,cAAc;IACtB,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,aAAK,aAAa,GACd,WAAW,GACX,aAAa,GACb,kBAAkB,GAClB,cAAc,CAAC;AAEnB,MAAM,WAAW,wBAAyB,SAAQ,cAAc;IAC9D,aAAa,EAAE,MAAM,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,GAAG,MAAM,GAAG,MAAM,EAAE,OAAO,CAAC,CAAC;IACtD,aAAa,EAAE,aAAa,CAAC;CAC9B;AAED,MAAM,WAAW,iBAAiB;IAChC,MAAM,IAAI,IAAI,CAAC;CAChB;AAED,MAAM,WAAW,cAAc;IAC7B,mCAAmC,CACjC,QAAQ,EAAE,CAAC,KAAK,EAAE,wBAAwB,KAAK,IAAI,GAClD,mBAAmB,CAAC;IACvB,uBAAuB,CACrB,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,KAAK,IAAI,GAChD,iBAAiB,CAAC;CACtB;AAED,MAAM,WAAW,kBAAkB;IACjC,MAAM,EAAE,MAAM,cAAc,CAAC;CAC9B;AAED;;;;;;;GAOG;AACH,qBAAa,oCAAqC,SAAQ,8BAA8B;IACtF,OAAc,mBAAmB,EAAE,MAAM,CAA6B;IAEtE,OAAO,CAAC,WAAW,CAAqB;IACxC,OAAO,CAAC,QAAQ,CAA+B;IAE/C,OAAO,CAAC,mBAAmB,CAAyC;IAEpE,OAAO,CAAC,kBAAkB,CAAC,CAAkB;IAC7C,OAAO,CAAC,mBAAmB,CAAgB;IAC3C,OAAO,CAAC,mBAAmB,CAAC,CAAqB;;IAG/C,uGAAuG;IACvG,UAAU,EAAE,OAAO,EACnB,OAAO,GAAE,OAAO,CAAC,4BAA4B,CAAM;IAYrD;;OAEG;IACI,8BAA8B,CACnC,QAAQ,EAAE,kBAAkB,EAC5B,cAAc,EAAE,cAAc,EAC9B,cAAc,EAAE,cAAc,GAC7B,IAAI;IAkBP;;OAEG;IACH,OAAO,CAAC,UAAU;IAelB;;OAEG;IACH,OAAO,CAAC,sBAAsB;IA0D9B,4DAA4D;IAC5D,OAAO,CAAC,oBAAoB;IAwB5B,wEAAwE;IACxE,OAAO,CAAC,yBAAyB;IAUjC,wEAAwE;IACxE,OAAO,CAAC,wBAAwB;CAMjC"}
@@ -1,5 +1,5 @@
1
1
  import { logger } from '@sentry/utils';
2
- import { InternalRoutingInstrumentation, } from './routingInstrumentation';
2
+ import { InternalRoutingInstrumentation } from './routingInstrumentation';
3
3
  import { customTransactionSource, defaultTransactionSource, getBlankTransactionContext } from './utils';
4
4
  const defaultOptions = {
5
5
  routeChangeTimeoutMs: 1000,
@@ -1 +1 @@
1
- {"version":3,"file":"reactnativenavigation.js","sourceRoot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C,mBAAmB,KAAK,WAAW,EAAE;YACnD,YAAY,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAC;YACvC,IAAI,CAAC,mBAAmB,GAAG,SAAS,CAAC;SACtC;IACH,CAAC;;AA5Ka,wDAAmB,GAAW,yBAAyB,CAAC","sourcesContent":["import { Transaction as TransactionType, TransactionContext } from '@sentry/types';\nimport { logger } from '@sentry/utils';\nimport { EmitterSubscription } from 'react-native';\n\nimport {\n InternalRoutingInstrumentation,\n OnConfirmRoute,\n TransactionCreator,\n} from './routingInstrumentation';\nimport { BeforeNavigate, RouteChangeContextData } from './types';\nimport { customTransactionSource, defaultTransactionSource, getBlankTransactionContext } from './utils';\n\ninterface ReactNativeNavigationOptions {\n /**\n * How long the instrumentation will wait for the route to mount after a change has been initiated,\n * before the transaction is discarded.\n * Time is in ms.\n *\n * Default: 1000\n */\n routeChangeTimeoutMs: number;\n}\n\nconst defaultOptions: ReactNativeNavigationOptions = {\n routeChangeTimeoutMs: 1000,\n};\n\ninterface ComponentEvent {\n componentId: string;\n}\n\ntype ComponentType =\n | 'Component'\n | 'TopBarTitle'\n | 'TopBarBackground'\n | 'TopBarButton';\n\nexport interface ComponentWillAppearEvent extends ComponentEvent {\n componentName: string;\n passProps?: Record<string | number | symbol, unknown>;\n componentType: ComponentType;\n}\n\nexport interface EventSubscription {\n remove(): void;\n}\n\nexport interface EventsRegistry {\n registerComponentWillAppearListener(\n callback: (event: ComponentWillAppearEvent) => void\n ): EmitterSubscription;\n registerCommandListener(\n callback: (name: string, params: unknown) => void\n ): EventSubscription;\n}\n\nexport interface NavigationDelegate {\n events: () => EventsRegistry;\n}\n\n/**\n * Instrumentation for React Native Navigation. See docs or sample app for usage.\n *\n * How this works:\n * - `_onCommand` is called every time a commands happens and sets an IdleTransaction on the scope without any route context.\n * - `_onComponentWillAppear` is then called AFTER the state change happens due to a dispatch and sets the route context onto the active transaction.\n * - If `_onComponentWillAppear` isn't called within `options.routeChangeTimeoutMs` of the dispatch, then the transaction is not sampled and finished.\n */\nexport class ReactNativeNavigationInstrumentation extends InternalRoutingInstrumentation {\n public static instrumentationName: string = 'react-native-navigation';\n\n private _navigation: NavigationDelegate;\n private _options: ReactNativeNavigationOptions;\n\n private _prevComponentEvent: ComponentWillAppearEvent | null = null;\n\n private _latestTransaction?: TransactionType;\n private _recentComponentIds: string[] = [];\n private _stateChangeTimeout?: number | undefined;\n\n public constructor(\n /** The react native navigation `NavigationDelegate`. This is usually the import named `Navigation`. */\n navigation: unknown,\n options: Partial<ReactNativeNavigationOptions> = {}\n ) {\n super();\n\n this._navigation = navigation as NavigationDelegate;\n\n this._options = {\n ...defaultOptions,\n ...options,\n };\n }\n\n /**\n * Registers the event listeners for React Native Navigation\n */\n public registerRoutingInstrumentation(\n listener: TransactionCreator,\n beforeNavigate: BeforeNavigate,\n onConfirmRoute: OnConfirmRoute\n ): void {\n super.registerRoutingInstrumentation(\n listener,\n beforeNavigate,\n onConfirmRoute\n );\n\n this._navigation\n .events()\n .registerCommandListener(this._onCommand.bind(this));\n\n this._navigation\n .events()\n .registerComponentWillAppearListener(\n this._onComponentWillAppear.bind(this)\n );\n }\n\n /**\n * To be called when a navigation command is dispatched\n */\n private _onCommand(): void {\n if (this._latestTransaction) {\n this._discardLatestTransaction();\n }\n\n this._latestTransaction = this.onRouteWillChange(\n getBlankTransactionContext(ReactNativeNavigationInstrumentation.name)\n );\n\n this._stateChangeTimeout = setTimeout(\n this._discardLatestTransaction.bind(this),\n this._options.routeChangeTimeoutMs\n );\n }\n\n /**\n * To be called AFTER the state has been changed to populate the transaction with the current route.\n */\n private _onComponentWillAppear(event: ComponentWillAppearEvent): void {\n // If the route is a different key, this is so we ignore actions that pertain to the same screen.\n if (this._latestTransaction) {\n if (\n !this._prevComponentEvent ||\n event.componentId != this._prevComponentEvent.componentId\n ) {\n this._clearStateChangeTimeout();\n\n const originalContext = this._latestTransaction.toContext();\n const routeHasBeenSeen = this._recentComponentIds.includes(\n event.componentId\n );\n\n const data: RouteChangeContextData = {\n ...originalContext.data,\n route: {\n ...event,\n name: event.componentName,\n hasBeenSeen: routeHasBeenSeen,\n },\n previousRoute: this._prevComponentEvent\n ? {\n ...this._prevComponentEvent,\n name: this._prevComponentEvent?.componentName,\n }\n : null,\n };\n\n const updatedContext = {\n ...originalContext,\n name: event.componentName,\n tags: {\n ...originalContext.tags,\n 'routing.route.name': event.componentName,\n },\n data,\n };\n\n const finalContext = this._prepareFinalContext(updatedContext);\n this._latestTransaction.updateWithContext(finalContext);\n\n const isCustomName = updatedContext.name !== finalContext.name;\n this._latestTransaction.setName(\n finalContext.name,\n isCustomName ? customTransactionSource : defaultTransactionSource,\n );\n\n this._onConfirmRoute?.(finalContext);\n this._prevComponentEvent = event;\n } else {\n this._discardLatestTransaction();\n }\n\n this._latestTransaction = undefined;\n }\n }\n\n /** Creates final transaction context before confirmation */\n private _prepareFinalContext(updatedContext: TransactionContext): TransactionContext {\n let finalContext = this._beforeNavigate?.({ ...updatedContext });\n\n // This block is to catch users not returning a transaction context\n if (!finalContext) {\n logger.error(\n `[${ReactNativeNavigationInstrumentation.name}] beforeNavigate returned ${finalContext}, return context.sampled = false to not send transaction.`\n );\n\n finalContext = {\n ...updatedContext,\n sampled: false,\n };\n }\n\n if (finalContext.sampled === false) {\n logger.log(\n `[${ReactNativeNavigationInstrumentation.name}] Will not send transaction \"${finalContext.name}\" due to beforeNavigate.`\n );\n }\n\n return finalContext;\n }\n\n /** Cancels the latest transaction so it does not get sent to Sentry. */\n private _discardLatestTransaction(): void {\n if (this._latestTransaction) {\n this._latestTransaction.sampled = false;\n this._latestTransaction.finish();\n this._latestTransaction = undefined;\n }\n\n this._clearStateChangeTimeout();\n }\n\n /** Cancels the latest transaction so it does not get sent to Sentry. */\n private _clearStateChangeTimeout(): void {\n if (typeof this._stateChangeTimeout !== 'undefined') {\n clearTimeout(this._stateChangeTimeout);\n this._stateChangeTimeout = undefined;\n }\n }\n}\n"]}
1
+ {"version":3,"file":"reactnativenavigation.js","sour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,CAAC,mBAAmB,KAAK,WAAW,EAAE;YACnD,YAAY,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAC;YACvC,IAAI,CAAC,mBAAmB,GAAG,SAAS,CAAC;SACtC;IACH,CAAC;;AA5Ka,wDAAmB,GAAW,yBAAyB,CAAC","sourcesContent":["import type { Transaction as TransactionType, TransactionContext } from '@sentry/types';\nimport { logger } from '@sentry/utils';\nimport type { EmitterSubscription } from 'react-native';\n\nimport type {\n OnConfirmRoute,\n TransactionCreator} from './routingInstrumentation';\nimport {\n InternalRoutingInstrumentation\n} from './routingInstrumentation';\nimport type { BeforeNavigate, RouteChangeContextData } from './types';\nimport { customTransactionSource, defaultTransactionSource, getBlankTransactionContext } from './utils';\n\ninterface ReactNativeNavigationOptions {\n /**\n * How long the instrumentation will wait for the route to mount after a change has been initiated,\n * before the transaction is discarded.\n * Time is in ms.\n *\n * Default: 1000\n */\n routeChangeTimeoutMs: number;\n}\n\nconst defaultOptions: ReactNativeNavigationOptions = {\n routeChangeTimeoutMs: 1000,\n};\n\ninterface ComponentEvent {\n componentId: string;\n}\n\ntype ComponentType =\n | 'Component'\n | 'TopBarTitle'\n | 'TopBarBackground'\n | 'TopBarButton';\n\nexport interface ComponentWillAppearEvent extends ComponentEvent {\n componentName: string;\n passProps?: Record<string | number | symbol, unknown>;\n componentType: ComponentType;\n}\n\nexport interface EventSubscription {\n remove(): void;\n}\n\nexport interface EventsRegistry {\n registerComponentWillAppearListener(\n callback: (event: ComponentWillAppearEvent) => void\n ): EmitterSubscription;\n registerCommandListener(\n callback: (name: string, params: unknown) => void\n ): EventSubscription;\n}\n\nexport interface NavigationDelegate {\n events: () => EventsRegistry;\n}\n\n/**\n * Instrumentation for React Native Navigation. See docs or sample app for usage.\n *\n * How this works:\n * - `_onCommand` is called every time a commands happens and sets an IdleTransaction on the scope without any route context.\n * - `_onComponentWillAppear` is then called AFTER the state change happens due to a dispatch and sets the route context onto the active transaction.\n * - If `_onComponentWillAppear` isn't called within `options.routeChangeTimeoutMs` of the dispatch, then the transaction is not sampled and finished.\n */\nexport class ReactNativeNavigationInstrumentation extends InternalRoutingInstrumentation {\n public static instrumentationName: string = 'react-native-navigation';\n\n private _navigation: NavigationDelegate;\n private _options: ReactNativeNavigationOptions;\n\n private _prevComponentEvent: ComponentWillAppearEvent | null = null;\n\n private _latestTransaction?: TransactionType;\n private _recentComponentIds: string[] = [];\n private _stateChangeTimeout?: number | undefined;\n\n public constructor(\n /** The react native navigation `NavigationDelegate`. This is usually the import named `Navigation`. */\n navigation: unknown,\n options: Partial<ReactNativeNavigationOptions> = {}\n ) {\n super();\n\n this._navigation = navigation as NavigationDelegate;\n\n this._options = {\n ...defaultOptions,\n ...options,\n };\n }\n\n /**\n * Registers the event listeners for React Native Navigation\n */\n public registerRoutingInstrumentation(\n listener: TransactionCreator,\n beforeNavigate: BeforeNavigate,\n onConfirmRoute: OnConfirmRoute\n ): void {\n super.registerRoutingInstrumentation(\n listener,\n beforeNavigate,\n onConfirmRoute\n );\n\n this._navigation\n .events()\n .registerCommandListener(this._onCommand.bind(this));\n\n this._navigation\n .events()\n .registerComponentWillAppearListener(\n this._onComponentWillAppear.bind(this)\n );\n }\n\n /**\n * To be called when a navigation command is dispatched\n */\n private _onCommand(): void {\n if (this._latestTransaction) {\n this._discardLatestTransaction();\n }\n\n this._latestTransaction = this.onRouteWillChange(\n getBlankTransactionContext(ReactNativeNavigationInstrumentation.name)\n );\n\n this._stateChangeTimeout = setTimeout(\n this._discardLatestTransaction.bind(this),\n this._options.routeChangeTimeoutMs\n );\n }\n\n /**\n * To be called AFTER the state has been changed to populate the transaction with the current route.\n */\n private _onComponentWillAppear(event: ComponentWillAppearEvent): void {\n // If the route is a different key, this is so we ignore actions that pertain to the same screen.\n if (this._latestTransaction) {\n if (\n !this._prevComponentEvent ||\n event.componentId != this._prevComponentEvent.componentId\n ) {\n this._clearStateChangeTimeout();\n\n const originalContext = this._latestTransaction.toContext();\n const routeHasBeenSeen = this._recentComponentIds.includes(\n event.componentId\n );\n\n const data: RouteChangeContextData = {\n ...originalContext.data,\n route: {\n ...event,\n name: event.componentName,\n hasBeenSeen: routeHasBeenSeen,\n },\n previousRoute: this._prevComponentEvent\n ? {\n ...this._prevComponentEvent,\n name: this._prevComponentEvent?.componentName,\n }\n : null,\n };\n\n const updatedContext = {\n ...originalContext,\n name: event.componentName,\n tags: {\n ...originalContext.tags,\n 'routing.route.name': event.componentName,\n },\n data,\n };\n\n const finalContext = this._prepareFinalContext(updatedContext);\n this._latestTransaction.updateWithContext(finalContext);\n\n const isCustomName = updatedContext.name !== finalContext.name;\n this._latestTransaction.setName(\n finalContext.name,\n isCustomName ? customTransactionSource : defaultTransactionSource,\n );\n\n this._onConfirmRoute?.(finalContext);\n this._prevComponentEvent = event;\n } else {\n this._discardLatestTransaction();\n }\n\n this._latestTransaction = undefined;\n }\n }\n\n /** Creates final transaction context before confirmation */\n private _prepareFinalContext(updatedContext: TransactionContext): TransactionContext {\n let finalContext = this._beforeNavigate?.({ ...updatedContext });\n\n // This block is to catch users not returning a transaction context\n if (!finalContext) {\n logger.error(\n `[${ReactNativeNavigationInstrumentation.name}] beforeNavigate returned ${finalContext}, return context.sampled = false to not send transaction.`\n );\n\n finalContext = {\n ...updatedContext,\n sampled: false,\n };\n }\n\n if (finalContext.sampled === false) {\n logger.log(\n `[${ReactNativeNavigationInstrumentation.name}] Will not send transaction \"${finalContext.name}\" due to beforeNavigate.`\n );\n }\n\n return finalContext;\n }\n\n /** Cancels the latest transaction so it does not get sent to Sentry. */\n private _discardLatestTransaction(): void {\n if (this._latestTransaction) {\n this._latestTransaction.sampled = false;\n this._latestTransaction.finish();\n this._latestTransaction = undefined;\n }\n\n this._clearStateChangeTimeout();\n }\n\n /** Cancels the latest transaction so it does not get sent to Sentry. */\n private _clearStateChangeTimeout(): void {\n if (typeof this._stateChangeTimeout !== 'undefined') {\n clearTimeout(this._stateChangeTimeout);\n this._stateChangeTimeout = undefined;\n }\n }\n}\n"]}
@@ -1,10 +1,10 @@
1
- import { Hub } from '@sentry/core';
2
- import { RequestInstrumentationOptions, Transaction } from '@sentry/tracing';
3
- import { EventProcessor, Integration } from '@sentry/types';
4
- import { RoutingInstrumentationInstance } from '../tracing/routingInstrumentation';
1
+ import type { Hub } from '@sentry/core';
2
+ import type { RequestInstrumentationOptions, Transaction } from '@sentry/tracing';
3
+ import type { EventProcessor, Integration } from '@sentry/types';
4
+ import type { RoutingInstrumentationInstance } from '../tracing/routingInstrumentation';
5
5
  import { NativeFramesInstrumentation } from './nativeframes';
6
6
  import { StallTrackingInstrumentation } from './stalltracking';
7
- import { BeforeNavigate } from './types';
7
+ import type { BeforeNavigate } from './types';
8
8
  export interface ReactNativeTracingOptions extends RequestInstrumentationOptions {
9
9
  /**
10
10
  * @deprecated Replaced by idleTimeoutMs
@@ -1 +1 @@
1
- {"version":3,"file":"reactnativetracing.d.ts","sourceRoot":"","sources":["../../../src/js/tracing/reactnativetracing.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AACnC,OAAO,EAIL,6BAA6B,EAE7B,WAAW,EACZ,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,cAAc,EACd,WAAW,EAGZ,MAAM,eAAe,CAAC;AAIvB,OAAO,EAAE,8BAA8B,EAAE,MAAM,mCAAmC,CAAC;AAEnF,OAAO,EAAE,2BAA2B,EAAE,MAAM,gBAAgB,CAAC;AAC7D,OAAO,EAAE,4BAA4B,EAAE,MAAM,iBAAiB,CAAC;AAC/D,OAAO,EAAE,cAAc,EAA0B,MAAM,SAAS,CAAC;AAOjE,MAAM,WAAW,yBACf,SAAQ,6BAA6B;IACrC;;OAEG;IACH,WAAW,EAAE,MAAM,CAAC;IAEpB;;OAEG;IACH,sBAAsB,EAAE,MAAM,CAAC;IAE/B;;;;;;OAMG;IACH,aAAa,EAAE,MAAM,CAAC;IAEtB;;;;;;;OAOG;IACH,cAAc,EAAE,MAAM,CAAC;IAEvB;;;OAG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OAAc,EAAE,EAAE,MAAM,CAAwB;IAChD,6CAA6C;IAC7C,OAAO,CAAC,MAAM,CAAC,YAAY,CAAiB;IAC5C;;OAEG;IACI,IAAI,EAAE,MAAM,CAAyB;IAE5C,iCAAiC;IAC1B,OAAO,EAAE,yBAAyB,CAAC;IAEnC,2BAA2B,CAAC,EAAE,2BAA2B,CAAC;IAC1D,4BAA4B,CAAC,EAAE,4BAA4B,CAAC;IAC5D,uBAAuB,EAAE,OAAO,CAAS;IAEhD,OAAO,CAAC,cAAc,CAAC,CAAY;IACnC,OAAO,CAAC,qBAAqB,CAAC,CAAyB;IACvD,OAAO,CAAC,wBAAwB,CAAC,CAAS;gBAEvB,OAAO,GAAE,OAAO,CAAC,yBAAyB,CAAM;IAkBnE;;OAEG;IACI,SAAS,CAEd,uBAAuB,EAAE,CAAC,QAAQ,EAAE,cAAc,KAAK,IAAI,EAC3D,aAAa,EAAE,MAAM,GAAG,GACvB,IAAI;IAiEP;;OAEG;IACI,kBAAkB,CAAC,WAAW,EAAE,WAAW,GAAG,IAAI;IAQzD;;OAEG;IACI,mBAAmB,CACxB,WAAW,EAAE,WAAW,EACxB,YAAY,CAAC,EAAE,MAAM,GACpB,IAAI;IAQP;;OAEG;IACI,gBAAgB,CAAC,YAAY,EAAE,MAAM,GAAG,IAAI;IAInD;;;OAGG;YACW,mBAAmB;IAgCjC;;OAEG;IACH,OAAO,CAAC,gBAAgB;IAgCxB,6FAA6F;IAC7F,OAAO,CAAC,kBAAkB;IAM1B;;OAEG;IACH,OAAO,CAAC,eAAe;IAqBvB,uCAAuC;IACvC,OAAO,CAAC,uBAAuB;CAkFhC"}
@@ -1,5 +1,5 @@
1
1
  import { __awaiter } from "tslib";
2
- import { defaultRequestInstrumentationOptions, instrumentOutgoingRequests, startIdleTransaction, } from '@sentry/tracing';
2
+ import { defaultRequestInstrumentationOptions, instrumentOutgoingRequests, startIdleTransaction } from '@sentry/tracing';
3
3
  import { logger } from '@sentry/utils';
4
4
  import { NATIVE } from '../wrapper';
5
5
  import { NativeFramesInstrumentation } from './nativeframes';