replayReaderParams.js 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. const defaultRRWebEvents = [
  2. {
  3. type: 0,
  4. data: {},
  5. timestamp: 1663865919000,
  6. delay: -198487,
  7. },
  8. {
  9. type: 1,
  10. data: {},
  11. timestamp: 1663865920587,
  12. delay: -135199,
  13. },
  14. {
  15. type: 4,
  16. data: {
  17. href: 'http://localhost:3000/',
  18. width: 1536,
  19. height: 722,
  20. },
  21. timestamp: 1663865920587,
  22. delay: -135199,
  23. },
  24. ];
  25. const defaultBreadcrumbs = [
  26. {
  27. timestamp: 1663865920851,
  28. type: 5,
  29. data: {
  30. payload: {
  31. timestamp: 1663865920.851,
  32. type: 'default',
  33. level: 'info',
  34. category: 'ui.focus',
  35. },
  36. },
  37. },
  38. {
  39. timestamp: 1663865922024,
  40. type: 5,
  41. data: {
  42. payload: {
  43. timestamp: 1663865922.024,
  44. type: 'default',
  45. level: 'info',
  46. category: 'ui.click',
  47. message:
  48. 'input.form-control[type="text"][name="url"][title="Fully qualified URL prefixed with http or https"]',
  49. data: {
  50. nodeId: 37,
  51. },
  52. },
  53. },
  54. },
  55. ];
  56. export function ReplayReaderParams({
  57. attachments = [...defaultRRWebEvents, ...defaultBreadcrumbs],
  58. replayRecord = {},
  59. errors = [],
  60. } = {}) {
  61. return {
  62. replayRecord: {
  63. userAgent:
  64. 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.114 Safari/537.36',
  65. title: '',
  66. projectId: '6273278',
  67. platform: 'javascript',
  68. releases: ['1.0.0', '2.0.0'],
  69. dist: '',
  70. traceIds: [],
  71. errorIds: ['5c83aaccfffb4a708ae893bad9be3a1c'],
  72. startedAt: new Date('Sep 22, 2022 4:58:39 PM UTC'),
  73. finishedAt: new Date('Sep 22, 2022 5:00:03 PM UTC'),
  74. duration: 84,
  75. countSegments: 14,
  76. countErrors: 1,
  77. id: '761104e184c64d439ee1014b72b4d83b',
  78. longestTransaction: 0,
  79. environment: 'demo',
  80. tags: {},
  81. user: {
  82. id: '',
  83. name: '',
  84. email: '',
  85. ip_address: '127.0.0.1',
  86. displayName: '127.0.0.1',
  87. },
  88. sdk: {
  89. name: 'sentry.javascript.browser',
  90. version: '7.1.1',
  91. },
  92. os: {
  93. name: 'Other',
  94. version: '',
  95. },
  96. browser: {
  97. name: 'Other',
  98. version: '',
  99. },
  100. device: {
  101. name: '',
  102. brand: '',
  103. model: '',
  104. family: 'Other',
  105. },
  106. urls: ['http://localhost:3000/'],
  107. countUrls: 1,
  108. ...replayRecord,
  109. },
  110. attachments,
  111. errors,
  112. };
  113. }