replayReaderParams.js 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  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. activity: 0,
  64. browser: {
  65. name: 'Other',
  66. version: '',
  67. },
  68. count_errors: 1,
  69. count_segments: 14,
  70. count_urls: 1,
  71. device: {
  72. name: '',
  73. brand: '',
  74. model_id: '',
  75. family: 'Other',
  76. },
  77. dist: '',
  78. duration: 84,
  79. environment: 'demo',
  80. error_ids: ['5c83aaccfffb4a708ae893bad9be3a1c'],
  81. finished_at: new Date('Sep 22, 2022 5:00:03 PM UTC'),
  82. id: '761104e184c64d439ee1014b72b4d83b',
  83. longest_transaction: 0,
  84. os: {
  85. name: 'Other',
  86. version: '',
  87. },
  88. platform: 'javascript',
  89. project_id: '6273278',
  90. releases: ['1.0.0', '2.0.0'],
  91. sdk: {
  92. name: 'sentry.javascript.browser',
  93. version: '7.1.1',
  94. },
  95. started_at: new Date('Sep 22, 2022 4:58:39 PM UTC'),
  96. tags: {},
  97. trace_ids: [],
  98. urls: ['http://localhost:3000/'],
  99. user: {
  100. id: '',
  101. name: '',
  102. email: '',
  103. ip: '127.0.0.1',
  104. display_name: '127.0.0.1',
  105. },
  106. ...replayRecord,
  107. },
  108. attachments,
  109. errors,
  110. };
  111. }