@seliseblocks/genesis-os 4.4.7 → 4.4.9

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 (100) hide show
  1. package/dist/{all-DOPVVJD5.js → all-O45OXFJ7.js} +43 -43
  2. package/dist/all-O45OXFJ7.js.map +1 -0
  3. package/dist/{all-U2EMOAAN.cjs → all-UJTAKIGL.cjs} +43 -43
  4. package/dist/{all-U2EMOAAN.cjs.map → all-UJTAKIGL.cjs.map} +1 -1
  5. package/dist/aspnet-4V2TYHQE.cjs +13 -0
  6. package/dist/{aspnet-7QL7EKM4.cjs.map → aspnet-4V2TYHQE.cjs.map} +1 -1
  7. package/dist/aspnet-R3X2H2AO.js +7 -0
  8. package/dist/{aspnet-I623QV26.js.map → aspnet-R3X2H2AO.js.map} +1 -1
  9. package/dist/{chunk-5L6BSYZR.cjs → chunk-45XWYZ67.cjs} +3 -3
  10. package/dist/{chunk-5L6BSYZR.cjs.map → chunk-45XWYZ67.cjs.map} +1 -1
  11. package/dist/{chunk-5JLLXRMI.cjs → chunk-A373J4BR.cjs} +44 -44
  12. package/dist/{chunk-5JLLXRMI.cjs.map → chunk-A373J4BR.cjs.map} +1 -1
  13. package/dist/{chunk-IPMRZNNS.cjs → chunk-A4MVNKXL.cjs} +20 -7
  14. package/dist/chunk-A4MVNKXL.cjs.map +1 -0
  15. package/dist/{chunk-4RZMYO3F.cjs → chunk-AIUUCMAI.cjs} +6 -6
  16. package/dist/{chunk-4RZMYO3F.cjs.map → chunk-AIUUCMAI.cjs.map} +1 -1
  17. package/dist/{chunk-X3GPJW7R.cjs → chunk-CTIGX76P.cjs} +4 -4
  18. package/dist/{chunk-X3GPJW7R.cjs.map → chunk-CTIGX76P.cjs.map} +1 -1
  19. package/dist/{chunk-KZOSD6FO.js → chunk-ECDNFX6H.js} +3 -3
  20. package/dist/{chunk-KZOSD6FO.js.map → chunk-ECDNFX6H.js.map} +1 -1
  21. package/dist/{chunk-ASX5UGE4.js → chunk-G24RPSJG.js} +42 -42
  22. package/dist/{chunk-ASX5UGE4.js.map → chunk-G24RPSJG.js.map} +1 -1
  23. package/dist/{chunk-VJAVGV6Z.js → chunk-GFUHF4DC.js} +3 -3
  24. package/dist/{chunk-VJAVGV6Z.js.map → chunk-GFUHF4DC.js.map} +1 -1
  25. package/dist/{chunk-F2IEUFPT.js → chunk-L4V72AAV.js} +217 -63
  26. package/dist/chunk-L4V72AAV.js.map +1 -0
  27. package/dist/{chunk-3OO2YVXW.js → chunk-LAWQOHY6.js} +3 -3
  28. package/dist/{chunk-3OO2YVXW.js.map → chunk-LAWQOHY6.js.map} +1 -1
  29. package/dist/{chunk-UDFH7SJI.js → chunk-OE5T43AS.js} +20 -7
  30. package/dist/chunk-OE5T43AS.js.map +1 -0
  31. package/dist/{chunk-KZ3NZCXZ.cjs → chunk-OPMWK5SY.cjs} +14 -2
  32. package/dist/chunk-OPMWK5SY.cjs.map +1 -0
  33. package/dist/{chunk-VLZJP6FH.cjs → chunk-P4SL4PTY.cjs} +40 -40
  34. package/dist/{chunk-VLZJP6FH.cjs.map → chunk-P4SL4PTY.cjs.map} +1 -1
  35. package/dist/{chunk-O7TJN754.js → chunk-QHNZOBXR.js} +3 -3
  36. package/dist/{chunk-O7TJN754.js.map → chunk-QHNZOBXR.js.map} +1 -1
  37. package/dist/{chunk-VGOVEFEP.cjs → chunk-SAK3QQCD.cjs} +3 -3
  38. package/dist/{chunk-VGOVEFEP.cjs.map → chunk-SAK3QQCD.cjs.map} +1 -1
  39. package/dist/{chunk-XL7EULGP.js → chunk-U6GTLTLO.js} +3 -3
  40. package/dist/{chunk-XL7EULGP.js.map → chunk-U6GTLTLO.js.map} +1 -1
  41. package/dist/{chunk-O2MGCS3O.js → chunk-XYPSBVXL.js} +14 -2
  42. package/dist/chunk-XYPSBVXL.js.map +1 -0
  43. package/dist/{chunk-CSFOG5YH.cjs → chunk-ZVYSSUHO.cjs} +451 -297
  44. package/dist/chunk-ZVYSSUHO.cjs.map +1 -0
  45. package/dist/components/index.cjs +394 -394
  46. package/dist/components/index.js +47 -47
  47. package/dist/cshtml-IPCDTLX7.cjs +13 -0
  48. package/dist/{cshtml-ETL7US3D.cjs.map → cshtml-IPCDTLX7.cjs.map} +1 -1
  49. package/dist/cshtml-XPUEHA6K.js +7 -0
  50. package/dist/{cshtml-TVLCSBKU.js.map → cshtml-XPUEHA6K.js.map} +1 -1
  51. package/dist/eslint/index.cjs +33 -0
  52. package/dist/eslint/index.cjs.map +1 -0
  53. package/dist/eslint/index.d.cts +12 -0
  54. package/dist/eslint/index.d.ts +12 -0
  55. package/dist/eslint/index.js +28 -0
  56. package/dist/eslint/index.js.map +1 -0
  57. package/dist/guards/index.cjs +53 -53
  58. package/dist/guards/index.js +47 -47
  59. package/dist/hooks/index.cjs +59 -59
  60. package/dist/hooks/index.js +2 -2
  61. package/dist/i18n/index.cjs +29 -29
  62. package/dist/i18n/index.d.cts +4 -4
  63. package/dist/i18n/index.d.ts +4 -4
  64. package/dist/i18n/index.js +1 -1
  65. package/dist/index.cjs +592 -592
  66. package/dist/index.d.cts +1 -1
  67. package/dist/index.d.ts +1 -1
  68. package/dist/index.js +47 -47
  69. package/dist/layouts/index.cjs +54 -54
  70. package/dist/layouts/index.js +47 -47
  71. package/dist/lib/index.cjs +24 -24
  72. package/dist/lib/index.d.cts +9 -2
  73. package/dist/lib/index.d.ts +9 -2
  74. package/dist/lib/index.js +1 -1
  75. package/dist/observability/index.cjs +27 -21
  76. package/dist/observability/index.cjs.map +1 -1
  77. package/dist/observability/index.d.cts +5 -1
  78. package/dist/observability/index.d.ts +5 -1
  79. package/dist/observability/index.js +27 -21
  80. package/dist/observability/index.js.map +1 -1
  81. package/dist/pages/index.cjs +52 -52
  82. package/dist/pages/index.js +47 -47
  83. package/dist/providers/index.cjs +6 -6
  84. package/dist/providers/index.js +2 -2
  85. package/dist/{types-D9odiLzd.d.ts → types-Dz0dH1XK.d.ts} +5 -1
  86. package/dist/{types-CQX9_ck-.d.cts → types-VNffHJ1_.d.cts} +5 -1
  87. package/dist/utils/index.cjs +71 -71
  88. package/dist/utils/index.js +3 -3
  89. package/package.json +6 -1
  90. package/dist/all-DOPVVJD5.js.map +0 -1
  91. package/dist/aspnet-7QL7EKM4.cjs +0 -13
  92. package/dist/aspnet-I623QV26.js +0 -7
  93. package/dist/chunk-CSFOG5YH.cjs.map +0 -1
  94. package/dist/chunk-F2IEUFPT.js.map +0 -1
  95. package/dist/chunk-IPMRZNNS.cjs.map +0 -1
  96. package/dist/chunk-KZ3NZCXZ.cjs.map +0 -1
  97. package/dist/chunk-O2MGCS3O.js.map +0 -1
  98. package/dist/chunk-UDFH7SJI.js.map +0 -1
  99. package/dist/cshtml-ETL7US3D.cjs +0 -13
  100. package/dist/cshtml-TVLCSBKU.js +0 -7
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/observability/noise-filter.ts","../../src/observability/rollbar.config.ts","../../src/observability/rollbar.instance.ts","../../src/observability/report-query-errors.ts","../../src/observability/rollbar.provider.tsx","../../src/observability/report-http-errors.ts"],"names":["getRuntimeEnv","Rollbar","HttpError","jsxs","jsx","useMemo","useEffect","getQueryClient","Provider","ErrorBoundary"],"mappings":";;;;;;;;;;;;;;;;AA8BA,IAAM,gBAAA,GAAmB;AAAA,EACvB,iDAAA;AAAA,EACA;AACF,CAAA;AAIA,IAAM,uBAAA,GAA0B;AAAA,EAC9B,mBAAA;AAAA,EACA,cAAA;AAAA,EACA;AACF,CAAA;AAEA,IAAM,sBAAA,GAAyB;AAAA,EAC7B,qBAAA;AAAA,EACA,kBAAA;AAAA,EACA,qBAAA;AAAA,EACA;AACF,CAAA;AAGA,IAAM,cAAA,GAAiB;AAAA,EACrB,gBAAA;AAAA,EACA,qBAAA;AAAA,EACA;AACF,CAAA;AAEA,IAAM,WAAW,CAAC,KAAA,KAChB,OAAO,KAAA,KAAU,WAAW,KAAA,GAAQ,MAAA;AAEtC,IAAM,aAAA,GAAgB,CAAC,KAAA,K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CAACI,gBAAA,EAAA,EAAS,QAAA,EAAU,OAAA,EAClB,QAAA,kBAAAJ,cAAA,CAACK,qBAAA,EAAA,EAAc,UAAA,EAAY,QAAA,EAAU,KAAA,EAAM,UAAA,EACxC,QAAA,EACH,CAAA,EACF,CAAA;AAEJ;;;AC9DO,IAAM,yBAAA,GACX,CAAC,OAAA,KACD,CAAC,OAAA,KAAsC;AACrC,EAAA,IAAI,CAAC,QAAQ,SAAA,EAAW;AACxB,EAAA,IAAI,gBAAA,CAAiB,OAAA,CAAQ,KAAK,CAAA,EAAG;AAErC,EAAA,MAAM,KAAA,GACJ,OAAA,CAAQ,KAAA,YAAiB,KAAA,GACrB,OAAA,CAAQ,KAAA,GACR,IAAI,KAAA,CAAM,MAAA,CAAO,OAAA,CAAQ,KAAK,CAAC,CAAA;AAErC,EAAA,OAAA,CAAQ,MAAM,KAAA,EAAO;AAAA,IACnB,MAAA,EAAQ,aAAA;AAAA,IACR,KAAK,OAAA,CAAQ,GAAA;AAAA,IACb,QAAQ,OAAA,CAAQ;AAAA,GACjB,CAAA;AACH","file":"index.cjs","sourcesContent":["/**\n * Errors the browser raises that say nothing about a Blocks fault, and that Rollbar should therefore\n * never receive.\n *\n * Each rule matches one exact signature seen in production. A broad rule would hide real bugs, so a\n * `TypeError` is noise only with a known network message, and an `InvalidStateError` only when it is\n * about a view transition.\n */\nexport type NoiseRule =\n | \"network\"\n | \"view-transition\"\n | \"extension\"\n | \"cancelation\"\n | \"stale-asset\"\n | \"recaptcha-timeout\";\n\ninterface RollbarTraceLike {\n frames?: unknown[] | null;\n exception?: { class?: unknown; message?: unknown } | null;\n}\n\n/** The parts of a Rollbar item (`item.data`) the rules read. */\nexport interface RollbarPayloadLike {\n body?: {\n trace?: RollbarTraceLike | null;\n trace_chain?: (RollbarTraceLike | null)[] | null;\n message?: { body?: unknown } | null;\n } | null;\n}\n\nconst NETWORK_MESSAGES = [\n \"NetworkError when attempting to fetch resource.\",\n \"Load failed\",\n];\n\n// `AbortError` is listed as the spec lists it, though the network rule, checked first, already\n// drops every `AbortError`.\nconst VIEW_TRANSITION_CLASSES = [\n \"InvalidStateError\",\n \"TimeoutError\",\n \"AbortError\",\n];\n\nconst EXTENSION_URL_PREFIXES = [\n \"chrome-extension://\",\n \"moz-extension://\",\n \"safari-extension://\",\n \"safari-web-extension://\",\n];\n\n// What a bare `Event` turns into once it has been stringified, by Rollbar or by the app.\nconst EVENT_MESSAGES = [\n \"[object Event]\",\n \"[object ErrorEvent]\",\n '{\"isTrusted\":true}',\n];\n\nconst asString = (value: unknown): string | undefined =>\n typeof value === \"string\" ? value : undefined;\n\nconst isPlainObject = (value: unknown): value is Record<string, unknown> => {\n if (typeof value !== \"object\" || value === null) return false;\n const prototype: unknown = Object.getPrototypeOf(value);\n return prototype === Object.prototype || prototype === null;\n};\n\nconst isEvent = (value: unknown): boolean =>\n typeof Event !== \"undefined\" && value instanceof Event;\n\nconst isExtensionFrame = (frame: unknown): boolean => {\n const filename = (frame as { filename?: unknown } | null)?.filename;\n return (\n typeof filename === \"string\" &&\n EXTENSION_URL_PREFIXES.some((prefix) => filename.startsWith(prefix))\n );\n};\n\nconst classify = (\n value: unknown,\n payload: RollbarPayloadLike | undefined,\n): NoiseRule | null => {\n const body = payload?.body;\n const trace = body?.trace ?? body?.trace_chain?.[0];\n const raw =\n typeof value === \"object\" && value !== null\n ? (value as { name?: unknown; message?: unknown })\n : undefined;\n\n const errorClass =\n asString(raw?.name) ?? asString(trace?.exception?.class) ?? \"\";\n const message =\n asString(raw?.message) ??\n asString(trace?.exception?.message) ??\n asString(body?.message?.body) ??\n \"\";\n const frames = trace?.frames ?? [];\n\n if (\n (errorClass === \"TypeError\" &&\n (message.startsWith(\"Failed to fetch\") ||\n NETWORK_MESSAGES.includes(message))) ||\n errorClass === \"AbortError\"\n )\n return \"network\";\n\n if (\n VIEW_TRANSITION_CLASSES.includes(errorClass) &&\n message.toLowerCase().includes(\"transition\")\n )\n return \"view-transition\";\n\n // Every frame, not any: an extension frame on top of app frames is still the app's stack.\n if (frames.length > 0 && frames.every(isExtensionFrame)) return \"extension\";\n\n if (\n (errorClass === \"Canceled\" && message === \"Canceled\") ||\n (isPlainObject(value) && value.type === \"cancelation\")\n )\n return \"cancelation\";\n\n if (\n message.startsWith(\n \"Failed to execute 'importScripts' on 'WorkerGlobalScope'\",\n ) ||\n message === \"Object.hasOwn is not a function\" ||\n isEvent(value) ||\n EVENT_MESSAGES.includes(message)\n )\n return \"stale-asset\";\n\n if (message.startsWith(\"reCAPTCHA Timeout\")) return \"recaptcha-timeout\";\n\n return null;\n};\n\n/**\n * Names the noise rule `value` matches, or `null` when it should be reported.\n *\n * `value` is the raw thrown value (an `Error`, a `DOMException`, an `Event`, a plain object). The\n * Rollbar payload, when given, fills in the class, message and stack frames the value does not\n * carry. Fails open: if reading either one throws, the item is reported.\n */\nexport const classifyReportingNoise = (\n value: unknown,\n payload?: RollbarPayloadLike,\n): NoiseRule | null => {\n try {\n return classify(value, payload);\n } catch {\n return null;\n }\n};\n\n/** True for a browser network failure or an aborted request: nothing the app can fix. */\nexport const isNetworkFailure = (error: unknown): boolean =>\n classifyReportingNoise(error) === \"network\";\n","import Rollbar from \"rollbar\";\nimport { getRuntimeEnv } from \"@/lib/runtime-env\";\nimport { classifyReportingNoise } from \"./noise-filter\";\n\n/**\n * Payload keys and header names that must never leave the browser.\n *\n * Rollbar scrubs a default set already; these are the platform-specific ones. Getting this wrong\n * ships a tenant's credentials to a third party, which is why it lives here rather than being\n * restated in every app.\n */\nconst DEFAULT_SCRUB_FIELDS = [\n \"x-blocks-key\",\n \"X-Blocks-Key\",\n \"Authorization\",\n \"authorization\",\n \"access_token\",\n \"refresh_token\",\n \"accessToken\",\n \"refreshToken\",\n \"password\",\n \"clientSecret\",\n \"client_secret\",\n \"connectionString\",\n \"secretValue\",\n];\n\n/**\n * Noise that reaches `window.onerror` but says nothing about the app: browser extensions,\n * cross-origin frames, and the ResizeObserver warning Chrome raises during ordinary layout.\n */\nconst DEFAULT_IGNORED_MESSAGES = [\n \"ResizeObserver loop limit exceeded\",\n \"ResizeObserver loop completed with undelivered notifications\",\n \"Script error.\",\n];\n\n/**\n * Stands in for a real token when none is seeded.\n *\n * `@rollbar/react`'s `Provider` rejects an instance whose `options.accessToken` is falsy -- it\n * throws \"`instance` must be a configured instance of Rollbar\" from its own constructor, which is\n * above the error boundary, so an unconfigured app renders nothing at all. Reporting is switched\n * off by `enabled`, not by the token: the notifier refuses to send before it reaches a transport\n * and telemetry instrumentation is never installed. A placeholder therefore costs nothing and\n * keeps reporting genuinely optional, which is the point -- no tier should go blank because a\n * secret has not been seeded yet.\n */\nexport const UNCONFIGURED_ACCESS_TOKEN = \"rollbar-reporting-disabled\";\n\n/**\n * Rollbar's `checkIgnore`: drops browser noise before it is sent (see `noise-filter.ts`).\n *\n * For uncaught errors and unhandled rejections Rollbar passes `[message, error, ...]`, so the raw\n * value is `args[1]`; for `rollbar.error(err, ...)` it is `args[0]`. Kept a single expression:\n * Rollbar copies the function's source into every item it does send.\n */\nconst ignoreNoise: NonNullable<Rollbar.Configuration[\"checkIgnore\"]> = (\n isUncaught,\n args,\n payload,\n) =>\n classifyReportingNoise(\n isUncaught ? (args?.[1] ?? args?.[0]) : args?.[0],\n payload,\n ) !== null;\n\nexport interface RollbarConfigOptions {\n /**\n * The app reporting, e.g. `\"blocks-os\"`. Pass the same name the app already gives\n * `BlocksAppLayout`, so items can be traced back to a service without a project-id lookup.\n */\n service: string;\n /** Appended to, not replacing, the platform scrub list. */\n extraScrubFields?: string[];\n /** Appended to, not replacing, the default ignore list. */\n extraIgnoredMessages?: string[];\n /** Identifies the build. Required for source-map deobfuscation once maps are uploaded. */\n codeVersion?: string;\n}\n\n/**\n * Builds the browser Rollbar configuration from runtime env.\n *\n * Separate from the provider so it can be asserted on directly: most of the risk in this module is\n * in the configuration -- scrubbing, and whether reporting is on at all -- not in Rollbar itself.\n */\nexport const createRollbarConfig = (\n options: RollbarConfigOptions,\n): Rollbar.Configuration => {\n const accessToken = getRuntimeEnv(\"BLOCKS_ROLLBAR_CLIENT_TOKEN\");\n\n return {\n accessToken: accessToken || UNCONFIGURED_ACCESS_TOKEN,\n // Reporting is opt-in on a seeded token. Unconfigured environments -- developer machines,\n // tests, any tier not yet seeded -- get an inert client rather than a broken one, so the error\n // boundary still behaves exactly as it does in production.\n enabled: accessToken.length > 0,\n environment: getRuntimeEnv(\"BLOCKS_ROLLBAR_ENV\") || \"unknown\",\n captureUncaught: true,\n captureUnhandledRejections: true,\n scrubFields: [...DEFAULT_SCRUB_FIELDS, ...(options.extraScrubFields ?? [])],\n ignoredMessages: [\n ...DEFAULT_IGNORED_MESSAGES,\n ...(options.extraIgnoredMessages ?? []),\n ],\n checkIgnore: ignoreNoise,\n payload: {\n // Under `custom`, not at the root of `data`. Rollbar recognises a fixed set of top-level\n // fields and gives unknown ones \"no special handling\" -- they are stored but not indexed as\n // custom metadata, so a root-level `service` is neither queryable nor in the same place the\n // .NET side puts it. Here both sides land at `data.custom.*`, which is also where a webhook\n // receiver finds them: `data.item.last_occurrence.custom.service`.\n //\n // `service` identifies the app and `component` which half of it, as two fields rather than\n // one `blocks-os-client` string, so either can be filtered on without parsing.\n custom: {\n service: options.service,\n component: \"client\",\n },\n client: {\n javascript: {\n source_map_enabled: Boolean(options.codeVersion),\n code_version: options.codeVersion,\n },\n },\n },\n };\n};\n","import Rollbar from \"rollbar\";\nimport {\n createRollbarConfig,\n type RollbarConfigOptions,\n} from \"./rollbar.config\";\n\nlet instance: Rollbar | undefined;\n\n/**\n * The one Rollbar instance for the app.\n *\n * Memoised on first call so that code outside the React tree -- an `HttpClient` built at module\n * scope, for instance -- reports through the same client the provider renders. A second instance\n * would install a second set of window handlers and split the telemetry buffer in two.\n *\n * First call wins: later calls return the existing instance and ignore their options. In practice\n * every call site passes the same service, and load order between a module-scope client and the\n * provider is not something an app should have to reason about.\n *\n * Created lazily, so merely importing this module installs nothing.\n */\nexport const getRollbar = (options: RollbarConfigOptions): Rollbar =>\n (instance ??= new Rollbar(createRollbarConfig(options)));\n","import type { QueryClient } from \"@tanstack/react-query\";\nimport type Rollbar from \"rollbar\";\nimport { HttpError } from \"@/lib/http/error\";\nimport { isNetworkFailure } from \"./noise-filter\";\n\n/**\n * Reports errors thrown inside query and mutation functions that are not request failures.\n *\n * Narrow on purpose. Every failure from `HttpClient` arrives as an `HttpError` and is skipped here:\n * transport failures are already handled by `createHttpFailureReporter`, and HTTP statuses are\n * either business outcomes or faults the server reported itself. What remains is a genuine bug in a\n * query function -- a bad mapping, a null dereference on a response -- which React Query catches\n * and stores as query state, so it never reaches `window.onerror` and would otherwise be invisible.\n *\n * Returns an unsubscribe function.\n */\nexport const attachQueryErrorReporting = (\n queryClient: QueryClient,\n rollbar: Rollbar,\n): (() => void) => {\n const report = (error: unknown, context: Record<string, unknown>) => {\n if (error instanceof HttpError) return;\n // Belt and braces: an HttpError that crossed a module boundary may fail `instanceof`.\n if (typeof (error as { status?: unknown })?.status === \"number\") return;\n // A raw `fetch` in a query function rejects with the browser's own network error.\n if (isNetworkFailure(error)) return;\n\n rollbar.error(error instanceof Error ? error : new Error(String(error)), {\n source: \"react-query\",\n ...context,\n });\n };\n\n const unsubscribeQueries = queryClient.getQueryCache().subscribe((event) => {\n if (event.type !== \"updated\" || event.action.type !== \"error\") return;\n\n report(event.action.error, {\n kind: \"query\",\n queryHash: event.query.queryHash,\n });\n });\n\n const unsubscribeMutations = queryClient\n .getMutationCache()\n .subscribe((event) => {\n if (event.type !== \"updated\" || event.action.type !== \"error\") return;\n\n report(event.action.error, {\n kind: \"mutation\",\n mutationKey: event.mutation.options.mutationKey,\n });\n });\n\n return () => {\n unsubscribeQueries();\n unsubscribeMutations();\n };\n};\n","import { ErrorBoundary, Provider } from \"@rollbar/react\";\nimport { useEffect, useMemo, type ComponentType, type ReactNode } from \"react\";\nimport { getQueryClient } from \"@/providers/query-client\";\nimport { attachQueryErrorReporting } from \"./report-query-errors\";\nimport { type RollbarConfigOptions } from \"./rollbar.config\";\nimport { getRollbar } from \"./rollbar.instance\";\n\nexport interface RollbarFallbackProps {\n error: Error | null;\n resetError: () => void;\n}\n\n/**\n * Shown instead of a blank page when a render throws. Deliberately plain: it has to render when the\n * app's own state is already known-bad, so it depends on nothing but theme tokens.\n */\nconst DefaultFallback = ({ resetError }: RollbarFallbackProps) => (\n <div\n className=\"flex min-h-screen flex-col items-center justify-center gap-4 bg-background px-6 text-center\"\n role=\"alert\"\n >\n <div className=\"space-y-1\">\n <p className=\"text-lg font-semibold text-foreground\">\n Something went wrong\n </p>\n <p className=\"text-sm text-medium-emphasis\">\n The error has been reported. Try again, or reload the page if it keeps\n happening.\n </p>\n </div>\n <button\n onClick={resetError}\n className=\"rounded-md bg-primary px-4 py-2 text-sm font-medium text-primary-foreground\"\n >\n Try again\n </button>\n </div>\n);\n\nexport interface RollbarProviderProps extends RollbarConfigOptions {\n children: ReactNode;\n /** Replaces the built-in crash screen. */\n fallback?: ComponentType<RollbarFallbackProps>;\n}\n\n/**\n * Puts Rollbar in front of the whole tree.\n *\n * Mount this outermost -- above the query, theme and router providers -- so a throw during their\n * own setup is still caught and reported rather than blanking the page.\n *\n * Reporting is inert until a client token is seeded (see `createRollbarConfig`), but the boundary is\n * always live, so the crash screen behaves identically in local development and in production.\n *\n * Covers uncaught errors, unhandled rejections, render crashes, and bugs thrown inside query\n * functions. Request failures are not covered here: pass `createHttpFailureReporter` to your\n * `HttpClient` as `onError` for those.\n */\nexport const RollbarProvider = ({\n children,\n fallback = DefaultFallback,\n ...configOptions\n}: RollbarProviderProps) => {\n // Shared with anything reporting from outside the tree, and stable for the life of the app:\n // reconstructing it on re-render would reinstall the window handlers and drop Rollbar's own\n // telemetry buffer.\n const rollbar = useMemo(\n () => getRollbar(configOptions),\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [],\n );\n\n useEffect(\n () => attachQueryErrorReporting(getQueryClient(), rollbar),\n [rollbar],\n );\n\n return (\n <Provider instance={rollbar}>\n <ErrorBoundary fallbackUI={fallback} level=\"critical\">\n {children}\n </ErrorBoundary>\n </Provider>\n );\n};\n","import type Rollbar from \"rollbar\";\nimport type { HttpRequestFailure } from \"@/lib/http/types\";\nimport { isNetworkFailure } from \"./noise-filter\";\n\n/**\n * Builds an `onError` handler for `HttpClientConfig` that reports only transport failures that are\n * not browser network failures.\n *\n * Failures that produced an HTTP response are skipped deliberately: a 4xx is a business outcome the\n * UI already surfaces, and a 5xx has already been reported by the server with a real stack trace,\n * so reporting it again from the browser only buries the better item.\n *\n * Browser network failures are skipped too (`isNetworkFailure`: offline, DNS, CORS, TLS and aborted\n * requests all surface as `TypeError: Failed to fetch` and its Firefox/Safari equivalents, or as an\n * `AbortError`). They come from the user's connection rather than from Blocks, and an outage shows\n * up in server-side 5xx items and uptime monitoring instead. What is left -- a body that fails to\n * parse, a throw inside the client itself -- is a client fault the server cannot see.\n *\n * `HttpClient` normalises every failure to an `HttpError` with status 500 before callers see it, so\n * this distinction only exists inside the `onError` hook. Reporting from a `catch` further out\n * cannot tell the two apart.\n */\nexport const createHttpFailureReporter =\n (rollbar: Rollbar) =>\n (failure: HttpRequestFailure): void => {\n if (!failure.transport) return;\n if (isNetworkFailure(failure.error)) return;\n\n const error =\n failure.error instanceof Error\n ? failure.error\n : new Error(String(failure.error));\n\n rollbar.error(error, {\n source: \"http-client\",\n url: failure.url,\n method: failure.method,\n });\n };\n"]}
1
+ {"version":3,"sources":["../../src/observability/noise-filter.ts","../../src/observability/rollbar.config.ts","../../src/observability/rollbar.instance.ts","../../src/observability/report-query-errors.ts","../../src/observability/rollbar.provider.tsx","../../src/observability/report-http-errors.ts"],"names":["getRuntimeEnv","Rollbar","HttpError","useT","jsxs","jsx","useMemo","useEffect","getQueryClient","Provider","ErrorBoundary"],"mappings":";;;;;;;;;;;;;;;;;;;AA8BA,IAAM,gBAAA,GAAmB;AAAA,EACvB,iDAAA;AAAA,EACA;AACF,CAAA;AAIA,IAAM,uBAAA,GAA0B;AAAA,EAC9B,mBAA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AA,EAAS,UAAA;AAAA,YACT,SAAA,EAAU,6EAAA;AAAA,YAET,YAAE,4BAA4B;AAAA;AAAA;AACjC;AAAA;AAAA,GACF;AAEJ,CAAA;AAqBO,IAAM,kBAAkB,CAAC;AAAA,EAC9B,QAAA;AAAA,EACA,QAAA,GAAW,eAAA;AAAA,EACX,GAAG;AACL,CAAA,KAA4B;AAI1B,EAAA,MAAM,OAAA,GAAUC,aAAA;AAAA,IACd,MAAM,WAAW,aAAa,CAAA;AAAA;AAAA,IAE9B;AAAC,GACH;AAEA,EAAAC,eAAA;AAAA,IACE,MAAM,yBAAA,CAA0BC,gCAAA,EAAe,EAAG,OAAO,CAAA;AAAA,IACzD,CAAC,OAAO;AAAA,GACV;AAEA,EAAA,uBACEH,cAAA,CAACI,gBAAA,EAAA,EAAS,QAAA,EAAU,OAAA,EAClB,QAAA,kBAAAJ,cAAA,CAACK,qBAAA,EAAA,EAAc,UAAA,EAAY,QAAA,EAAU,KAAA,EAAM,UAAA,EACxC,QAAA,EACH,CAAA,EACF,CAAA;AAEJ;;;AC9DO,IAAM,yBAAA,GACX,CAAC,OAAA,KACD,CAAC,OAAA,KAAsC;AACrC,EAAA,IAAI,CAAC,QAAQ,SAAA,EAAW;AACxB,EAAA,IAAI,gBAAA,CAAiB,OAAA,CAAQ,KAAK,CAAA,EAAG;AAErC,EAAA,MAAM,KAAA,GACJ,OAAA,CAAQ,KAAA,YAAiB,KAAA,GACrB,OAAA,CAAQ,KAAA,GACR,IAAI,KAAA,CAAM,MAAA,CAAO,OAAA,CAAQ,KAAK,CAAC,CAAA;AAErC,EAAA,OAAA,CAAQ,MAAM,KAAA,EAAO;AAAA,IACnB,MAAA,EAAQ,aAAA;AAAA,IACR,KAAK,OAAA,CAAQ,GAAA;AAAA,IACb,QAAQ,OAAA,CAAQ;AAAA,GACjB,CAAA;AACH","file":"index.cjs","sourcesContent":["/**\n * Errors the browser raises that say nothing about a Blocks fault, and that Rollbar should therefore\n * never receive.\n *\n * Each rule matches one exact signature seen in production. A broad rule would hide real bugs, so a\n * `TypeError` is noise only with a known network message, and an `InvalidStateError` only when it is\n * about a view transition.\n */\nexport type NoiseRule =\n | \"network\"\n | \"view-transition\"\n | \"extension\"\n | \"cancelation\"\n | \"stale-asset\"\n | \"recaptcha-timeout\";\n\ninterface RollbarTraceLike {\n frames?: unknown[] | null;\n exception?: { class?: unknown; message?: unknown } | null;\n}\n\n/** The parts of a Rollbar item (`item.data`) the rules read. */\nexport interface RollbarPayloadLike {\n body?: {\n trace?: RollbarTraceLike | null;\n trace_chain?: (RollbarTraceLike | null)[] | null;\n message?: { body?: unknown } | null;\n } | null;\n}\n\nconst NETWORK_MESSAGES = [\n \"NetworkError when attempting to fetch resource.\",\n \"Load failed\",\n];\n\n// `AbortError` is listed as the spec lists it, though the network rule, checked first, already\n// drops every `AbortError`.\nconst VIEW_TRANSITION_CLASSES = [\n \"InvalidStateError\",\n \"TimeoutError\",\n \"AbortError\",\n];\n\nconst EXTENSION_URL_PREFIXES = [\n \"chrome-extension://\",\n \"moz-extension://\",\n \"safari-extension://\",\n \"safari-web-extension://\",\n];\n\n// What a bare `Event` turns into once it has been stringified, by Rollbar or by the app.\nconst EVENT_MESSAGES = [\n \"[object Event]\",\n \"[object ErrorEvent]\",\n '{\"isTrusted\":true}',\n];\n\nconst asString = (value: unknown): string | undefined =>\n typeof value === \"string\" ? value : undefined;\n\nconst isPlainObject = (value: unknown): value is Record<string, unknown> => {\n if (typeof value !== \"object\" || value === null) return false;\n const prototype: unknown = Object.getPrototypeOf(value);\n return prototype === Object.prototype || prototype === null;\n};\n\nconst isEvent = (value: unknown): boolean =>\n typeof Event !== \"undefined\" && value instanceof Event;\n\nconst isExtensionFrame = (frame: unknown): boolean => {\n const filename = (frame as { filename?: unknown } | null)?.filename;\n return (\n typeof filename === \"string\" &&\n EXTENSION_URL_PREFIXES.some((prefix) => filename.startsWith(prefix))\n );\n};\n\nconst classify = (\n value: unknown,\n payload: RollbarPayloadLike | undefined,\n): NoiseRule | null => {\n const body = payload?.body;\n const trace = body?.trace ?? body?.trace_chain?.[0];\n const raw =\n typeof value === \"object\" && value !== null\n ? (value as { name?: unknown; message?: unknown })\n : undefined;\n\n const errorClass =\n asString(raw?.name) ?? asString(trace?.exception?.class) ?? \"\";\n const message =\n asString(raw?.message) ??\n asString(trace?.exception?.message) ??\n asString(body?.message?.body) ??\n \"\";\n const frames = trace?.frames ?? [];\n\n if (\n (errorClass === \"TypeError\" &&\n (message.startsWith(\"Failed to fetch\") ||\n NETWORK_MESSAGES.includes(message))) ||\n errorClass === \"AbortError\"\n )\n return \"network\";\n\n if (\n VIEW_TRANSITION_CLASSES.includes(errorClass) &&\n message.toLowerCase().includes(\"transition\")\n )\n return \"view-transition\";\n\n // Every frame, not any: an extension frame on top of app frames is still the app's stack.\n if (frames.length > 0 && frames.every(isExtensionFrame)) return \"extension\";\n\n if (\n (errorClass === \"Canceled\" && message === \"Canceled\") ||\n (isPlainObject(value) && value.type === \"cancelation\")\n )\n return \"cancelation\";\n\n if (\n message.startsWith(\n \"Failed to execute 'importScripts' on 'WorkerGlobalScope'\",\n ) ||\n message === \"Object.hasOwn is not a function\" ||\n isEvent(value) ||\n EVENT_MESSAGES.includes(message)\n )\n return \"stale-asset\";\n\n if (message.startsWith(\"reCAPTCHA Timeout\")) return \"recaptcha-timeout\";\n\n return null;\n};\n\n/**\n * Names the noise rule `value` matches, or `null` when it should be reported.\n *\n * `value` is the raw thrown value (an `Error`, a `DOMException`, an `Event`, a plain object). The\n * Rollbar payload, when given, fills in the class, message and stack frames the value does not\n * carry. Fails open: if reading either one throws, the item is reported.\n */\nexport const classifyReportingNoise = (\n value: unknown,\n payload?: RollbarPayloadLike,\n): NoiseRule | null => {\n try {\n return classify(value, payload);\n } catch {\n return null;\n }\n};\n\n/** True for a browser network failure or an aborted request: nothing the app can fix. */\nexport const isNetworkFailure = (error: unknown): boolean =>\n classifyReportingNoise(error) === \"network\";\n","import Rollbar from \"rollbar\";\nimport { getRuntimeEnv } from \"@/lib/runtime-env\";\nimport { classifyReportingNoise } from \"./noise-filter\";\n\n/**\n * Payload keys and header names that must never leave the browser.\n *\n * Rollbar scrubs a default set already; these are the platform-specific ones. Getting this wrong\n * ships a tenant's credentials to a third party, which is why it lives here rather than being\n * restated in every app.\n */\nconst DEFAULT_SCRUB_FIELDS = [\n \"x-blocks-key\",\n \"X-Blocks-Key\",\n \"Authorization\",\n \"authorization\",\n \"access_token\",\n \"refresh_token\",\n \"accessToken\",\n \"refreshToken\",\n \"password\",\n \"clientSecret\",\n \"client_secret\",\n \"connectionString\",\n \"secretValue\",\n];\n\n/**\n * Noise that reaches `window.onerror` but says nothing about the app: browser extensions,\n * cross-origin frames, and the ResizeObserver warning Chrome raises during ordinary layout.\n */\nconst DEFAULT_IGNORED_MESSAGES = [\n \"ResizeObserver loop limit exceeded\",\n \"ResizeObserver loop completed with undelivered notifications\",\n \"Script error.\",\n];\n\n/**\n * Stands in for a real token when none is seeded.\n *\n * `@rollbar/react`'s `Provider` rejects an instance whose `options.accessToken` is falsy -- it\n * throws \"`instance` must be a configured instance of Rollbar\" from its own constructor, which is\n * above the error boundary, so an unconfigured app renders nothing at all. Reporting is switched\n * off by `enabled`, not by the token: the notifier refuses to send before it reaches a transport\n * and telemetry instrumentation is never installed. A placeholder therefore costs nothing and\n * keeps reporting genuinely optional, which is the point -- no tier should go blank because a\n * secret has not been seeded yet.\n */\nexport const UNCONFIGURED_ACCESS_TOKEN = \"rollbar-reporting-disabled\";\n\n/**\n * Rollbar's `checkIgnore`: drops browser noise before it is sent (see `noise-filter.ts`).\n *\n * For uncaught errors and unhandled rejections Rollbar passes `[message, error, ...]`, so the raw\n * value is `args[1]`; for `rollbar.error(err, ...)` it is `args[0]`. Kept a single expression:\n * Rollbar copies the function's source into every item it does send.\n */\nconst ignoreNoise: NonNullable<Rollbar.Configuration[\"checkIgnore\"]> = (\n isUncaught,\n args,\n payload,\n) =>\n classifyReportingNoise(\n isUncaught ? (args?.[1] ?? args?.[0]) : args?.[0],\n payload,\n ) !== null;\n\nexport interface RollbarConfigOptions {\n /**\n * The app reporting, e.g. `\"blocks-os\"`. Pass the same name the app already gives\n * `BlocksAppLayout`, so items can be traced back to a service without a project-id lookup.\n */\n service: string;\n /** Appended to, not replacing, the platform scrub list. */\n extraScrubFields?: string[];\n /** Appended to, not replacing, the default ignore list. */\n extraIgnoredMessages?: string[];\n /** Identifies the build. Required for source-map deobfuscation once maps are uploaded. */\n codeVersion?: string;\n}\n\n/**\n * Builds the browser Rollbar configuration from runtime env.\n *\n * Separate from the provider so it can be asserted on directly: most of the risk in this module is\n * in the configuration -- scrubbing, and whether reporting is on at all -- not in Rollbar itself.\n */\nexport const createRollbarConfig = (\n options: RollbarConfigOptions,\n): Rollbar.Configuration => {\n const accessToken = getRuntimeEnv(\"BLOCKS_ROLLBAR_CLIENT_TOKEN\");\n\n return {\n accessToken: accessToken || UNCONFIGURED_ACCESS_TOKEN,\n // Reporting is opt-in on a seeded token. Unconfigured environments -- developer machines,\n // tests, any tier not yet seeded -- get an inert client rather than a broken one, so the error\n // boundary still behaves exactly as it does in production.\n enabled: accessToken.length > 0,\n environment: getRuntimeEnv(\"BLOCKS_ROLLBAR_ENV\") || \"unknown\",\n captureUncaught: true,\n captureUnhandledRejections: true,\n scrubFields: [...DEFAULT_SCRUB_FIELDS, ...(options.extraScrubFields ?? [])],\n ignoredMessages: [\n ...DEFAULT_IGNORED_MESSAGES,\n ...(options.extraIgnoredMessages ?? []),\n ],\n checkIgnore: ignoreNoise,\n payload: {\n // Under `custom`, not at the root of `data`. Rollbar recognises a fixed set of top-level\n // fields and gives unknown ones \"no special handling\" -- they are stored but not indexed as\n // custom metadata, so a root-level `service` is neither queryable nor in the same place the\n // .NET side puts it. Here both sides land at `data.custom.*`, which is also where a webhook\n // receiver finds them: `data.item.last_occurrence.custom.service`.\n //\n // `service` identifies the app and `component` which half of it, as two fields rather than\n // one `blocks-os-client` string, so either can be filtered on without parsing.\n custom: {\n service: options.service,\n component: \"client\",\n },\n client: {\n javascript: {\n source_map_enabled: Boolean(options.codeVersion),\n code_version: options.codeVersion,\n },\n },\n },\n };\n};\n","import Rollbar from \"rollbar\";\nimport {\n createRollbarConfig,\n type RollbarConfigOptions,\n} from \"./rollbar.config\";\n\nlet instance: Rollbar | undefined;\n\n/**\n * The one Rollbar instance for the app.\n *\n * Memoised on first call so that code outside the React tree -- an `HttpClient` built at module\n * scope, for instance -- reports through the same client the provider renders. A second instance\n * would install a second set of window handlers and split the telemetry buffer in two.\n *\n * First call wins: later calls return the existing instance and ignore their options. In practice\n * every call site passes the same service, and load order between a module-scope client and the\n * provider is not something an app should have to reason about.\n *\n * Created lazily, so merely importing this module installs nothing.\n */\nexport const getRollbar = (options: RollbarConfigOptions): Rollbar =>\n (instance ??= new Rollbar(createRollbarConfig(options)));\n","import type { QueryClient } from \"@tanstack/react-query\";\nimport type Rollbar from \"rollbar\";\nimport { HttpError } from \"@/lib/http/error\";\nimport { isNetworkFailure } from \"./noise-filter\";\n\n/**\n * Reports errors thrown inside query and mutation functions that are not request failures.\n *\n * Narrow on purpose. Every failure from `HttpClient` arrives as an `HttpError` and is skipped here:\n * transport failures are already handled by `createHttpFailureReporter`, and HTTP statuses are\n * either business outcomes or faults the server reported itself. What remains is a genuine bug in a\n * query function -- a bad mapping, a null dereference on a response -- which React Query catches\n * and stores as query state, so it never reaches `window.onerror` and would otherwise be invisible.\n *\n * Returns an unsubscribe function.\n */\nexport const attachQueryErrorReporting = (\n queryClient: QueryClient,\n rollbar: Rollbar,\n): (() => void) => {\n const report = (error: unknown, context: Record<string, unknown>) => {\n if (error instanceof HttpError) return;\n // Belt and braces: an HttpError that crossed a module boundary may fail `instanceof`.\n if (typeof (error as { status?: unknown })?.status === \"number\") return;\n // A raw `fetch` in a query function rejects with the browser's own network error.\n if (isNetworkFailure(error)) return;\n\n rollbar.error(error instanceof Error ? error : new Error(String(error)), {\n source: \"react-query\",\n ...context,\n });\n };\n\n const unsubscribeQueries = queryClient.getQueryCache().subscribe((event) => {\n if (event.type !== \"updated\" || event.action.type !== \"error\") return;\n\n report(event.action.error, {\n kind: \"query\",\n queryHash: event.query.queryHash,\n });\n });\n\n const unsubscribeMutations = queryClient\n .getMutationCache()\n .subscribe((event) => {\n if (event.type !== \"updated\" || event.action.type !== \"error\") return;\n\n report(event.action.error, {\n kind: \"mutation\",\n mutationKey: event.mutation.options.mutationKey,\n });\n });\n\n return () => {\n unsubscribeQueries();\n unsubscribeMutations();\n };\n};\n","import { ErrorBoundary, Provider } from \"@rollbar/react\";\nimport { useEffect, useMemo, type ComponentType, type ReactNode } from \"react\";\nimport { getQueryClient } from \"@/providers/query-client\";\nimport { attachQueryErrorReporting } from \"./report-query-errors\";\nimport { type RollbarConfigOptions } from \"./rollbar.config\";\nimport { getRollbar } from \"./rollbar.instance\";\nimport { useT } from \"@/i18n/use-t\";\n\nexport interface RollbarFallbackProps {\n error: Error | null;\n resetError: () => void;\n}\n\n/**\n * Shown instead of a blank page when a render throws. Deliberately plain: it has to render when the\n * app's own state is already known-bad, so it depends only on theme tokens and its i18n keys, which\n * fall back to the bundled English when nothing else loads.\n */\nconst DefaultFallback = ({ resetError }: RollbarFallbackProps) => {\n const { t } = useT(\"genesis.shared\");\n return (\n <div\n className=\"flex min-h-screen flex-col items-center justify-center gap-4 bg-background px-6 text-center\"\n role=\"alert\"\n >\n <div className=\"space-y-1\">\n <p className=\"text-lg font-semibold text-foreground\">\n {t(\"ROLLBAR_FALLBACK.TITLE\")}\n </p>\n <p className=\"text-sm text-medium-emphasis\">\n {t(\"ROLLBAR_FALLBACK.MESSAGE\")}\n </p>\n </div>\n <button\n onClick={resetError}\n className=\"rounded-md bg-primary px-4 py-2 text-sm font-medium text-primary-foreground\"\n >\n {t(\"ROLLBAR_FALLBACK.TRY_AGAIN\")}\n </button>\n </div>\n );\n};\n\nexport interface RollbarProviderProps extends RollbarConfigOptions {\n children: ReactNode;\n /** Replaces the built-in crash screen. */\n fallback?: ComponentType<RollbarFallbackProps>;\n}\n\n/**\n * Puts Rollbar in front of the whole tree.\n *\n * Mount this outermost -- above the query, theme and router providers -- so a throw during their\n * own setup is still caught and reported rather than blanking the page.\n *\n * Reporting is inert until a client token is seeded (see `createRollbarConfig`), but the boundary is\n * always live, so the crash screen behaves identically in local development and in production.\n *\n * Covers uncaught errors, unhandled rejections, render crashes, and bugs thrown inside query\n * functions. Request failures are not covered here: pass `createHttpFailureReporter` to your\n * `HttpClient` as `onError` for those.\n */\nexport const RollbarProvider = ({\n children,\n fallback = DefaultFallback,\n ...configOptions\n}: RollbarProviderProps) => {\n // Shared with anything reporting from outside the tree, and stable for the life of the app:\n // reconstructing it on re-render would reinstall the window handlers and drop Rollbar's own\n // telemetry buffer.\n const rollbar = useMemo(\n () => getRollbar(configOptions),\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [],\n );\n\n useEffect(\n () => attachQueryErrorReporting(getQueryClient(), rollbar),\n [rollbar],\n );\n\n return (\n <Provider instance={rollbar}>\n <ErrorBoundary fallbackUI={fallback} level=\"critical\">\n {children}\n </ErrorBoundary>\n </Provider>\n );\n};\n","import type Rollbar from \"rollbar\";\nimport type { HttpRequestFailure } from \"@/lib/http/types\";\nimport { isNetworkFailure } from \"./noise-filter\";\n\n/**\n * Builds an `onError` handler for `HttpClientConfig` that reports only transport failures that are\n * not browser network failures.\n *\n * Failures that produced an HTTP response are skipped deliberately: a 4xx is a business outcome the\n * UI already surfaces, and a 5xx has already been reported by the server with a real stack trace,\n * so reporting it again from the browser only buries the better item.\n *\n * Browser network failures are skipped too (`isNetworkFailure`: offline, DNS, CORS, TLS and aborted\n * requests all surface as `TypeError: Failed to fetch` and its Firefox/Safari equivalents, or as an\n * `AbortError`). They come from the user's connection rather than from Blocks, and an outage shows\n * up in server-side 5xx items and uptime monitoring instead. What is left -- a body that fails to\n * parse, a throw inside the client itself -- is a client fault the server cannot see.\n *\n * A success response without data never reaches this reporter: `HttpClient` resolves 204, 205,\n * `content-length: 0` and blank bodies to `{ success: true, status }`. A non-empty success body\n * that is not valid JSON is reported once, as a transport failure carrying the `SyntaxError`.\n *\n * `HttpClient` normalises every failure to an `HttpError` with status 500 before callers see it, so\n * this distinction only exists inside the `onError` hook. Reporting from a `catch` further out\n * cannot tell the two apart.\n */\nexport const createHttpFailureReporter =\n (rollbar: Rollbar) =>\n (failure: HttpRequestFailure): void => {\n if (!failure.transport) return;\n if (isNetworkFailure(failure.error)) return;\n\n const error =\n failure.error instanceof Error\n ? failure.error\n : new Error(String(failure.error));\n\n rollbar.error(error, {\n source: \"http-client\",\n url: failure.url,\n method: failure.method,\n });\n };\n"]}
@@ -1,7 +1,7 @@
1
1
  import Rollbar from 'rollbar';
2
2
  import * as React from 'react';
3
3
  import { ReactNode, ComponentType } from 'react';
4
- import { d as HttpRequestFailure } from '../types-CQX9_ck-.cjs';
4
+ import { d as HttpRequestFailure } from '../types-VNffHJ1_.cjs';
5
5
  import { QueryClient } from '@tanstack/react-query';
6
6
  import '../auth.model-BHLqtZG5.cjs';
7
7
  import '../user.model-D-yeFp-2.cjs';
@@ -130,6 +130,10 @@ declare const RollbarProvider: ({ children, fallback, ...configOptions }: Rollba
130
130
  * up in server-side 5xx items and uptime monitoring instead. What is left -- a body that fails to
131
131
  * parse, a throw inside the client itself -- is a client fault the server cannot see.
132
132
  *
133
+ * A success response without data never reaches this reporter: `HttpClient` resolves 204, 205,
134
+ * `content-length: 0` and blank bodies to `{ success: true, status }`. A non-empty success body
135
+ * that is not valid JSON is reported once, as a transport failure carrying the `SyntaxError`.
136
+ *
133
137
  * `HttpClient` normalises every failure to an `HttpError` with status 500 before callers see it, so
134
138
  * this distinction only exists inside the `onError` hook. Reporting from a `catch` further out
135
139
  * cannot tell the two apart.
@@ -1,7 +1,7 @@
1
1
  import Rollbar from 'rollbar';
2
2
  import * as React from 'react';
3
3
  import { ReactNode, ComponentType } from 'react';
4
- import { d as HttpRequestFailure } from '../types-D9odiLzd.js';
4
+ import { d as HttpRequestFailure } from '../types-Dz0dH1XK.js';
5
5
  import { QueryClient } from '@tanstack/react-query';
6
6
  import '../auth.model-6We_OkEZ.js';
7
7
  import '../user.model-jYC7Cd3G.js';
@@ -130,6 +130,10 @@ declare const RollbarProvider: ({ children, fallback, ...configOptions }: Rollba
130
130
  * up in server-side 5xx items and uptime monitoring instead. What is left -- a body that fails to
131
131
  * parse, a throw inside the client itself -- is a client fault the server cannot see.
132
132
  *
133
+ * A success response without data never reaches this reporter: `HttpClient` resolves 204, 205,
134
+ * `content-length: 0` and blank bodies to `{ success: true, status }`. A non-empty success body
135
+ * that is not valid JSON is reported once, as a transport failure carrying the `SyntaxError`.
136
+ *
133
137
  * `HttpClient` normalises every failure to an `HttpError` with status 500 before callers see it, so
134
138
  * this distinction only exists inside the `onError` hook. Reporting from a `catch` further out
135
139
  * cannot tell the two apart.
@@ -1,6 +1,9 @@
1
1
  import { HttpError } from '../chunk-7ZZ3KLZD.js';
2
+ import { useT } from '../chunk-XYPSBVXL.js';
2
3
  import { getQueryClient } from '../chunk-BRHE44FE.js';
3
4
  import { getRuntimeEnv } from '../chunk-POJIHGRY.js';
5
+ import '../chunk-SQG7DJNY.js';
6
+ import '../chunk-3V7O45KN.js';
4
7
  import '../chunk-PL4HS6R6.js';
5
8
  import Rollbar2 from 'rollbar';
6
9
  import { Provider, ErrorBoundary } from '@rollbar/react';
@@ -165,27 +168,30 @@ var attachQueryErrorReporting = (queryClient, rollbar) => {
165
168
  unsubscribeMutations();
166
169
  };
167
170
  };
168
- var DefaultFallback = ({ resetError }) => /* @__PURE__ */ jsxs(
169
- "div",
170
- {
171
- className: "flex min-h-screen flex-col items-center justify-center gap-4 bg-background px-6 text-center",
172
- role: "alert",
173
- children: [
174
- /* @__PURE__ */ jsxs("div", { className: "space-y-1", children: [
175
- /* @__PURE__ */ jsx("p", { className: "text-lg font-semibold text-foreground", children: "Something went wrong" }),
176
- /* @__PURE__ */ jsx("p", { className: "text-sm text-medium-emphasis", children: "The error has been reported. Try again, or reload the page if it keeps happening." })
177
- ] }),
178
- /* @__PURE__ */ jsx(
179
- "button",
180
- {
181
- onClick: resetError,
182
- className: "rounded-md bg-primary px-4 py-2 text-sm font-medium text-primary-foreground",
183
- children: "Try again"
184
- }
185
- )
186
- ]
187
- }
188
- );
171
+ var DefaultFallback = ({ resetError }) => {
172
+ const { t } = useT("genesis.shared");
173
+ return /* @__PURE__ */ jsxs(
174
+ "div",
175
+ {
176
+ className: "flex min-h-screen flex-col items-center justify-center gap-4 bg-background px-6 text-center",
177
+ role: "alert",
178
+ children: [
179
+ /* @__PURE__ */ jsxs("div", { className: "space-y-1", children: [
180
+ /* @__PURE__ */ jsx("p", { className: "text-lg font-semibold text-foreground", children: t("ROLLBAR_FALLBACK.TITLE") }),
181
+ /* @__PURE__ */ jsx("p", { className: "text-sm text-medium-emphasis", children: t("ROLLBAR_FALLBACK.MESSAGE") })
182
+ ] }),
183
+ /* @__PURE__ */ jsx(
184
+ "button",
185
+ {
186
+ onClick: resetError,
187
+ className: "rounded-md bg-primary px-4 py-2 text-sm font-medium text-primary-foreground",
188
+ children: t("ROLLBAR_FALLBACK.TRY_AGAIN")
189
+ }
190
+ )
191
+ ]
192
+ }
193
+ );
194
+ };
189
195
  var RollbarProvider = ({
190
196
  children,
191
197
  fallback = DefaultFallback,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/observability/noise-filter.ts","../../src/observability/rollbar.config.ts","../../src/observability/rollbar.instance.ts","../../src/observability/report-query-errors.ts","../../src/observability/rollbar.provider.tsx","../../src/observability/report-http-errors.ts"],"names":["Rollbar"],"mappings":";;;;;;;;;;AA8BA,IAAM,gBAAA,GAAmB;AAAA,EACvB,iDAAA;AAAA,EACA;AACF,CAAA;AAIA,IAAM,uBAAA,GAA0B;AAAA,EAC9B,mBAAA;AAAA,EACA,cAAA;AAAA,EACA;AACF,CAAA;AAEA,IAAM,sBAAA,GAAyB;AAAA,EAC7B,qBAAA;AAAA,EACA,kBAAA;AAAA,EACA,qBAAA;AAAA,E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IACd,MAAM,WAAW,aAAa,CAAA;AAAA;AAAA,IAE9B;AAAC,GACH;AAEA,EAAA,SAAA;AAAA,IACE,MAAM,yBAAA,CAA0B,cAAA,EAAe,EAAG,OAAO,CAAA;AAAA,IACzD,CAAC,OAAO;AAAA,GACV;AAEA,EAAA,uBACE,GAAA,CAAC,QAAA,EAAA,EAAS,QAAA,EAAU,OAAA,EAClB,QAAA,kBAAA,GAAA,CAAC,aAAA,EAAA,EAAc,UAAA,EAAY,QAAA,EAAU,KAAA,EAAM,UAAA,EACxC,QAAA,EACH,CAAA,EACF,CAAA;AAEJ;;;AC9DO,IAAM,yBAAA,GACX,CAAC,OAAA,KACD,CAAC,OAAA,KAAsC;AACrC,EAAA,IAAI,CAAC,QAAQ,SAAA,EAAW;AACxB,EAAA,IAAI,gBAAA,CAAiB,OAAA,CAAQ,KAAK,CAAA,EAAG;AAErC,EAAA,MAAM,KAAA,GACJ,OAAA,CAAQ,KAAA,YAAiB,KAAA,GACrB,OAAA,CAAQ,KAAA,GACR,IAAI,KAAA,CAAM,MAAA,CAAO,OAAA,CAAQ,KAAK,CAAC,CAAA;AAErC,EAAA,OAAA,CAAQ,MAAM,KAAA,EAAO;AAAA,IACnB,MAAA,EAAQ,aAAA;AAAA,IACR,KAAK,OAAA,CAAQ,GAAA;AAAA,IACb,QAAQ,OAAA,CAAQ;AAAA,GACjB,CAAA;AACH","file":"index.js","sourcesContent":["/**\n * Errors the browser raises that say nothing about a Blocks fault, and that Rollbar should therefore\n * never receive.\n *\n * Each rule matches one exact signature seen in production. A broad rule would hide real bugs, so a\n * `TypeError` is noise only with a known network message, and an `InvalidStateError` only when it is\n * about a view transition.\n */\nexport type NoiseRule =\n | \"network\"\n | \"view-transition\"\n | \"extension\"\n | \"cancelation\"\n | \"stale-asset\"\n | \"recaptcha-timeout\";\n\ninterface RollbarTraceLike {\n frames?: unknown[] | null;\n exception?: { class?: unknown; message?: unknown } | null;\n}\n\n/** The parts of a Rollbar item (`item.data`) the rules read. */\nexport interface RollbarPayloadLike {\n body?: {\n trace?: RollbarTraceLike | null;\n trace_chain?: (RollbarTraceLike | null)[] | null;\n message?: { body?: unknown } | null;\n } | null;\n}\n\nconst NETWORK_MESSAGES = [\n \"NetworkError when attempting to fetch resource.\",\n \"Load failed\",\n];\n\n// `AbortError` is listed as the spec lists it, though the network rule, checked first, already\n// drops every `AbortError`.\nconst VIEW_TRANSITION_CLASSES = [\n \"InvalidStateError\",\n \"TimeoutError\",\n \"AbortError\",\n];\n\nconst EXTENSION_URL_PREFIXES = [\n \"chrome-extension://\",\n \"moz-extension://\",\n \"safari-extension://\",\n \"safari-web-extension://\",\n];\n\n// What a bare `Event` turns into once it has been stringified, by Rollbar or by the app.\nconst EVENT_MESSAGES = [\n \"[object Event]\",\n \"[object ErrorEvent]\",\n '{\"isTrusted\":true}',\n];\n\nconst asString = (value: unknown): string | undefined =>\n typeof value === \"string\" ? value : undefined;\n\nconst isPlainObject = (value: unknown): value is Record<string, unknown> => {\n if (typeof value !== \"object\" || value === null) return false;\n const prototype: unknown = Object.getPrototypeOf(value);\n return prototype === Object.prototype || prototype === null;\n};\n\nconst isEvent = (value: unknown): boolean =>\n typeof Event !== \"undefined\" && value instanceof Event;\n\nconst isExtensionFrame = (frame: unknown): boolean => {\n const filename = (frame as { filename?: unknown } | null)?.filename;\n return (\n typeof filename === \"string\" &&\n EXTENSION_URL_PREFIXES.some((prefix) => filename.startsWith(prefix))\n );\n};\n\nconst classify = (\n value: unknown,\n payload: RollbarPayloadLike | undefined,\n): NoiseRule | null => {\n const body = payload?.body;\n const trace = body?.trace ?? body?.trace_chain?.[0];\n const raw =\n typeof value === \"object\" && value !== null\n ? (value as { name?: unknown; message?: unknown })\n : undefined;\n\n const errorClass =\n asString(raw?.name) ?? asString(trace?.exception?.class) ?? \"\";\n const message =\n asString(raw?.message) ??\n asString(trace?.exception?.message) ??\n asString(body?.message?.body) ??\n \"\";\n const frames = trace?.frames ?? [];\n\n if (\n (errorClass === \"TypeError\" &&\n (message.startsWith(\"Failed to fetch\") ||\n NETWORK_MESSAGES.includes(message))) ||\n errorClass === \"AbortError\"\n )\n return \"network\";\n\n if (\n VIEW_TRANSITION_CLASSES.includes(errorClass) &&\n message.toLowerCase().includes(\"transition\")\n )\n return \"view-transition\";\n\n // Every frame, not any: an extension frame on top of app frames is still the app's stack.\n if (frames.length > 0 && frames.every(isExtensionFrame)) return \"extension\";\n\n if (\n (errorClass === \"Canceled\" && message === \"Canceled\") ||\n (isPlainObject(value) && value.type === \"cancelation\")\n )\n return \"cancelation\";\n\n if (\n message.startsWith(\n \"Failed to execute 'importScripts' on 'WorkerGlobalScope'\",\n ) ||\n message === \"Object.hasOwn is not a function\" ||\n isEvent(value) ||\n EVENT_MESSAGES.includes(message)\n )\n return \"stale-asset\";\n\n if (message.startsWith(\"reCAPTCHA Timeout\")) return \"recaptcha-timeout\";\n\n return null;\n};\n\n/**\n * Names the noise rule `value` matches, or `null` when it should be reported.\n *\n * `value` is the raw thrown value (an `Error`, a `DOMException`, an `Event`, a plain object). The\n * Rollbar payload, when given, fills in the class, message and stack frames the value does not\n * carry. Fails open: if reading either one throws, the item is reported.\n */\nexport const classifyReportingNoise = (\n value: unknown,\n payload?: RollbarPayloadLike,\n): NoiseRule | null => {\n try {\n return classify(value, payload);\n } catch {\n return null;\n }\n};\n\n/** True for a browser network failure or an aborted request: nothing the app can fix. */\nexport const isNetworkFailure = (error: unknown): boolean =>\n classifyReportingNoise(error) === \"network\";\n","import Rollbar from \"rollbar\";\nimport { getRuntimeEnv } from \"@/lib/runtime-env\";\nimport { classifyReportingNoise } from \"./noise-filter\";\n\n/**\n * Payload keys and header names that must never leave the browser.\n *\n * Rollbar scrubs a default set already; these are the platform-specific ones. Getting this wrong\n * ships a tenant's credentials to a third party, which is why it lives here rather than being\n * restated in every app.\n */\nconst DEFAULT_SCRUB_FIELDS = [\n \"x-blocks-key\",\n \"X-Blocks-Key\",\n \"Authorization\",\n \"authorization\",\n \"access_token\",\n \"refresh_token\",\n \"accessToken\",\n \"refreshToken\",\n \"password\",\n \"clientSecret\",\n \"client_secret\",\n \"connectionString\",\n \"secretValue\",\n];\n\n/**\n * Noise that reaches `window.onerror` but says nothing about the app: browser extensions,\n * cross-origin frames, and the ResizeObserver warning Chrome raises during ordinary layout.\n */\nconst DEFAULT_IGNORED_MESSAGES = [\n \"ResizeObserver loop limit exceeded\",\n \"ResizeObserver loop completed with undelivered notifications\",\n \"Script error.\",\n];\n\n/**\n * Stands in for a real token when none is seeded.\n *\n * `@rollbar/react`'s `Provider` rejects an instance whose `options.accessToken` is falsy -- it\n * throws \"`instance` must be a configured instance of Rollbar\" from its own constructor, which is\n * above the error boundary, so an unconfigured app renders nothing at all. Reporting is switched\n * off by `enabled`, not by the token: the notifier refuses to send before it reaches a transport\n * and telemetry instrumentation is never installed. A placeholder therefore costs nothing and\n * keeps reporting genuinely optional, which is the point -- no tier should go blank because a\n * secret has not been seeded yet.\n */\nexport const UNCONFIGURED_ACCESS_TOKEN = \"rollbar-reporting-disabled\";\n\n/**\n * Rollbar's `checkIgnore`: drops browser noise before it is sent (see `noise-filter.ts`).\n *\n * For uncaught errors and unhandled rejections Rollbar passes `[message, error, ...]`, so the raw\n * value is `args[1]`; for `rollbar.error(err, ...)` it is `args[0]`. Kept a single expression:\n * Rollbar copies the function's source into every item it does send.\n */\nconst ignoreNoise: NonNullable<Rollbar.Configuration[\"checkIgnore\"]> = (\n isUncaught,\n args,\n payload,\n) =>\n classifyReportingNoise(\n isUncaught ? (args?.[1] ?? args?.[0]) : args?.[0],\n payload,\n ) !== null;\n\nexport interface RollbarConfigOptions {\n /**\n * The app reporting, e.g. `\"blocks-os\"`. Pass the same name the app already gives\n * `BlocksAppLayout`, so items can be traced back to a service without a project-id lookup.\n */\n service: string;\n /** Appended to, not replacing, the platform scrub list. */\n extraScrubFields?: string[];\n /** Appended to, not replacing, the default ignore list. */\n extraIgnoredMessages?: string[];\n /** Identifies the build. Required for source-map deobfuscation once maps are uploaded. */\n codeVersion?: string;\n}\n\n/**\n * Builds the browser Rollbar configuration from runtime env.\n *\n * Separate from the provider so it can be asserted on directly: most of the risk in this module is\n * in the configuration -- scrubbing, and whether reporting is on at all -- not in Rollbar itself.\n */\nexport const createRollbarConfig = (\n options: RollbarConfigOptions,\n): Rollbar.Configuration => {\n const accessToken = getRuntimeEnv(\"BLOCKS_ROLLBAR_CLIENT_TOKEN\");\n\n return {\n accessToken: accessToken || UNCONFIGURED_ACCESS_TOKEN,\n // Reporting is opt-in on a seeded token. Unconfigured environments -- developer machines,\n // tests, any tier not yet seeded -- get an inert client rather than a broken one, so the error\n // boundary still behaves exactly as it does in production.\n enabled: accessToken.length > 0,\n environment: getRuntimeEnv(\"BLOCKS_ROLLBAR_ENV\") || \"unknown\",\n captureUncaught: true,\n captureUnhandledRejections: true,\n scrubFields: [...DEFAULT_SCRUB_FIELDS, ...(options.extraScrubFields ?? [])],\n ignoredMessages: [\n ...DEFAULT_IGNORED_MESSAGES,\n ...(options.extraIgnoredMessages ?? []),\n ],\n checkIgnore: ignoreNoise,\n payload: {\n // Under `custom`, not at the root of `data`. Rollbar recognises a fixed set of top-level\n // fields and gives unknown ones \"no special handling\" -- they are stored but not indexed as\n // custom metadata, so a root-level `service` is neither queryable nor in the same place the\n // .NET side puts it. Here both sides land at `data.custom.*`, which is also where a webhook\n // receiver finds them: `data.item.last_occurrence.custom.service`.\n //\n // `service` identifies the app and `component` which half of it, as two fields rather than\n // one `blocks-os-client` string, so either can be filtered on without parsing.\n custom: {\n service: options.service,\n component: \"client\",\n },\n client: {\n javascript: {\n source_map_enabled: Boolean(options.codeVersion),\n code_version: options.codeVersion,\n },\n },\n },\n };\n};\n","import Rollbar from \"rollbar\";\nimport {\n createRollbarConfig,\n type RollbarConfigOptions,\n} from \"./rollbar.config\";\n\nlet instance: Rollbar | undefined;\n\n/**\n * The one Rollbar instance for the app.\n *\n * Memoised on first call so that code outside the React tree -- an `HttpClient` built at module\n * scope, for instance -- reports through the same client the provider renders. A second instance\n * would install a second set of window handlers and split the telemetry buffer in two.\n *\n * First call wins: later calls return the existing instance and ignore their options. In practice\n * every call site passes the same service, and load order between a module-scope client and the\n * provider is not something an app should have to reason about.\n *\n * Created lazily, so merely importing this module installs nothing.\n */\nexport const getRollbar = (options: RollbarConfigOptions): Rollbar =>\n (instance ??= new Rollbar(createRollbarConfig(options)));\n","import type { QueryClient } from \"@tanstack/react-query\";\nimport type Rollbar from \"rollbar\";\nimport { HttpError } from \"@/lib/http/error\";\nimport { isNetworkFailure } from \"./noise-filter\";\n\n/**\n * Reports errors thrown inside query and mutation functions that are not request failures.\n *\n * Narrow on purpose. Every failure from `HttpClient` arrives as an `HttpError` and is skipped here:\n * transport failures are already handled by `createHttpFailureReporter`, and HTTP statuses are\n * either business outcomes or faults the server reported itself. What remains is a genuine bug in a\n * query function -- a bad mapping, a null dereference on a response -- which React Query catches\n * and stores as query state, so it never reaches `window.onerror` and would otherwise be invisible.\n *\n * Returns an unsubscribe function.\n */\nexport const attachQueryErrorReporting = (\n queryClient: QueryClient,\n rollbar: Rollbar,\n): (() => void) => {\n const report = (error: unknown, context: Record<string, unknown>) => {\n if (error instanceof HttpError) return;\n // Belt and braces: an HttpError that crossed a module boundary may fail `instanceof`.\n if (typeof (error as { status?: unknown })?.status === \"number\") return;\n // A raw `fetch` in a query function rejects with the browser's own network error.\n if (isNetworkFailure(error)) return;\n\n rollbar.error(error instanceof Error ? error : new Error(String(error)), {\n source: \"react-query\",\n ...context,\n });\n };\n\n const unsubscribeQueries = queryClient.getQueryCache().subscribe((event) => {\n if (event.type !== \"updated\" || event.action.type !== \"error\") return;\n\n report(event.action.error, {\n kind: \"query\",\n queryHash: event.query.queryHash,\n });\n });\n\n const unsubscribeMutations = queryClient\n .getMutationCache()\n .subscribe((event) => {\n if (event.type !== \"updated\" || event.action.type !== \"error\") return;\n\n report(event.action.error, {\n kind: \"mutation\",\n mutationKey: event.mutation.options.mutationKey,\n });\n });\n\n return () => {\n unsubscribeQueries();\n unsubscribeMutations();\n };\n};\n","import { ErrorBoundary, Provider } from \"@rollbar/react\";\nimport { useEffect, useMemo, type ComponentType, type ReactNode } from \"react\";\nimport { getQueryClient } from \"@/providers/query-client\";\nimport { attachQueryErrorReporting } from \"./report-query-errors\";\nimport { type RollbarConfigOptions } from \"./rollbar.config\";\nimport { getRollbar } from \"./rollbar.instance\";\n\nexport interface RollbarFallbackProps {\n error: Error | null;\n resetError: () => void;\n}\n\n/**\n * Shown instead of a blank page when a render throws. Deliberately plain: it has to render when the\n * app's own state is already known-bad, so it depends on nothing but theme tokens.\n */\nconst DefaultFallback = ({ resetError }: RollbarFallbackProps) => (\n <div\n className=\"flex min-h-screen flex-col items-center justify-center gap-4 bg-background px-6 text-center\"\n role=\"alert\"\n >\n <div className=\"space-y-1\">\n <p className=\"text-lg font-semibold text-foreground\">\n Something went wrong\n </p>\n <p className=\"text-sm text-medium-emphasis\">\n The error has been reported. Try again, or reload the page if it keeps\n happening.\n </p>\n </div>\n <button\n onClick={resetError}\n className=\"rounded-md bg-primary px-4 py-2 text-sm font-medium text-primary-foreground\"\n >\n Try again\n </button>\n </div>\n);\n\nexport interface RollbarProviderProps extends RollbarConfigOptions {\n children: ReactNode;\n /** Replaces the built-in crash screen. */\n fallback?: ComponentType<RollbarFallbackProps>;\n}\n\n/**\n * Puts Rollbar in front of the whole tree.\n *\n * Mount this outermost -- above the query, theme and router providers -- so a throw during their\n * own setup is still caught and reported rather than blanking the page.\n *\n * Reporting is inert until a client token is seeded (see `createRollbarConfig`), but the boundary is\n * always live, so the crash screen behaves identically in local development and in production.\n *\n * Covers uncaught errors, unhandled rejections, render crashes, and bugs thrown inside query\n * functions. Request failures are not covered here: pass `createHttpFailureReporter` to your\n * `HttpClient` as `onError` for those.\n */\nexport const RollbarProvider = ({\n children,\n fallback = DefaultFallback,\n ...configOptions\n}: RollbarProviderProps) => {\n // Shared with anything reporting from outside the tree, and stable for the life of the app:\n // reconstructing it on re-render would reinstall the window handlers and drop Rollbar's own\n // telemetry buffer.\n const rollbar = useMemo(\n () => getRollbar(configOptions),\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [],\n );\n\n useEffect(\n () => attachQueryErrorReporting(getQueryClient(), rollbar),\n [rollbar],\n );\n\n return (\n <Provider instance={rollbar}>\n <ErrorBoundary fallbackUI={fallback} level=\"critical\">\n {children}\n </ErrorBoundary>\n </Provider>\n );\n};\n","import type Rollbar from \"rollbar\";\nimport type { HttpRequestFailure } from \"@/lib/http/types\";\nimport { isNetworkFailure } from \"./noise-filter\";\n\n/**\n * Builds an `onError` handler for `HttpClientConfig` that reports only transport failures that are\n * not browser network failures.\n *\n * Failures that produced an HTTP response are skipped deliberately: a 4xx is a business outcome the\n * UI already surfaces, and a 5xx has already been reported by the server with a real stack trace,\n * so reporting it again from the browser only buries the better item.\n *\n * Browser network failures are skipped too (`isNetworkFailure`: offline, DNS, CORS, TLS and aborted\n * requests all surface as `TypeError: Failed to fetch` and its Firefox/Safari equivalents, or as an\n * `AbortError`). They come from the user's connection rather than from Blocks, and an outage shows\n * up in server-side 5xx items and uptime monitoring instead. What is left -- a body that fails to\n * parse, a throw inside the client itself -- is a client fault the server cannot see.\n *\n * `HttpClient` normalises every failure to an `HttpError` with status 500 before callers see it, so\n * this distinction only exists inside the `onError` hook. Reporting from a `catch` further out\n * cannot tell the two apart.\n */\nexport const createHttpFailureReporter =\n (rollbar: Rollbar) =>\n (failure: HttpRequestFailure): void => {\n if (!failure.transport) return;\n if (isNetworkFailure(failure.error)) return;\n\n const error =\n failure.error instanceof Error\n ? failure.error\n : new Error(String(failure.error));\n\n rollbar.error(error, {\n source: \"http-client\",\n url: failure.url,\n method: failure.method,\n });\n };\n"]}
1
+ {"version":3,"sources":["../../src/observability/noise-filter.ts","../../src/observability/rollbar.config.ts","../../src/observability/rollbar.instance.ts","../../src/observability/report-query-errors.ts","../../src/observability/rollbar.provider.tsx","../../src/observability/report-http-errors.ts"],"names":["Rollbar"],"mappings":";;;;;;;;;;;;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","file":"index.js","sourcesContent":["/**\n * Errors the browser raises that say nothing about a Blocks fault, and that Rollbar should therefore\n * never receive.\n *\n * Each rule matches one exact signature seen in production. A broad rule would hide real bugs, so a\n * `TypeError` is noise only with a known network message, and an `InvalidStateError` only when it is\n * about a view transition.\n */\nexport type NoiseRule =\n | \"network\"\n | \"view-transition\"\n | \"extension\"\n | \"cancelation\"\n | \"stale-asset\"\n | \"recaptcha-timeout\";\n\ninterface RollbarTraceLike {\n frames?: unknown[] | null;\n exception?: { class?: unknown; message?: unknown } | null;\n}\n\n/** The parts of a Rollbar item (`item.data`) the rules read. */\nexport interface RollbarPayloadLike {\n body?: {\n trace?: RollbarTraceLike | null;\n trace_chain?: (RollbarTraceLike | null)[] | null;\n message?: { body?: unknown } | null;\n } | null;\n}\n\nconst NETWORK_MESSAGES = [\n \"NetworkError when attempting to fetch resource.\",\n \"Load failed\",\n];\n\n// `AbortError` is listed as the spec lists it, though the network rule, checked first, already\n// drops every `AbortError`.\nconst VIEW_TRANSITION_CLASSES = [\n \"InvalidStateError\",\n \"TimeoutError\",\n \"AbortError\",\n];\n\nconst EXTENSION_URL_PREFIXES = [\n \"chrome-extension://\",\n \"moz-extension://\",\n \"safari-extension://\",\n \"safari-web-extension://\",\n];\n\n// What a bare `Event` turns into once it has been stringified, by Rollbar or by the app.\nconst EVENT_MESSAGES = [\n \"[object Event]\",\n \"[object ErrorEvent]\",\n '{\"isTrusted\":true}',\n];\n\nconst asString = (value: unknown): string | undefined =>\n typeof value === \"string\" ? value : undefined;\n\nconst isPlainObject = (value: unknown): value is Record<string, unknown> => {\n if (typeof value !== \"object\" || value === null) return false;\n const prototype: unknown = Object.getPrototypeOf(value);\n return prototype === Object.prototype || prototype === null;\n};\n\nconst isEvent = (value: unknown): boolean =>\n typeof Event !== \"undefined\" && value instanceof Event;\n\nconst isExtensionFrame = (frame: unknown): boolean => {\n const filename = (frame as { filename?: unknown } | null)?.filename;\n return (\n typeof filename === \"string\" &&\n EXTENSION_URL_PREFIXES.some((prefix) => filename.startsWith(prefix))\n );\n};\n\nconst classify = (\n value: unknown,\n payload: RollbarPayloadLike | undefined,\n): NoiseRule | null => {\n const body = payload?.body;\n const trace = body?.trace ?? body?.trace_chain?.[0];\n const raw =\n typeof value === \"object\" && value !== null\n ? (value as { name?: unknown; message?: unknown })\n : undefined;\n\n const errorClass =\n asString(raw?.name) ?? asString(trace?.exception?.class) ?? \"\";\n const message =\n asString(raw?.message) ??\n asString(trace?.exception?.message) ??\n asString(body?.message?.body) ??\n \"\";\n const frames = trace?.frames ?? [];\n\n if (\n (errorClass === \"TypeError\" &&\n (message.startsWith(\"Failed to fetch\") ||\n NETWORK_MESSAGES.includes(message))) ||\n errorClass === \"AbortError\"\n )\n return \"network\";\n\n if (\n VIEW_TRANSITION_CLASSES.includes(errorClass) &&\n message.toLowerCase().includes(\"transition\")\n )\n return \"view-transition\";\n\n // Every frame, not any: an extension frame on top of app frames is still the app's stack.\n if (frames.length > 0 && frames.every(isExtensionFrame)) return \"extension\";\n\n if (\n (errorClass === \"Canceled\" && message === \"Canceled\") ||\n (isPlainObject(value) && value.type === \"cancelation\")\n )\n return \"cancelation\";\n\n if (\n message.startsWith(\n \"Failed to execute 'importScripts' on 'WorkerGlobalScope'\",\n ) ||\n message === \"Object.hasOwn is not a function\" ||\n isEvent(value) ||\n EVENT_MESSAGES.includes(message)\n )\n return \"stale-asset\";\n\n if (message.startsWith(\"reCAPTCHA Timeout\")) return \"recaptcha-timeout\";\n\n return null;\n};\n\n/**\n * Names the noise rule `value` matches, or `null` when it should be reported.\n *\n * `value` is the raw thrown value (an `Error`, a `DOMException`, an `Event`, a plain object). The\n * Rollbar payload, when given, fills in the class, message and stack frames the value does not\n * carry. Fails open: if reading either one throws, the item is reported.\n */\nexport const classifyReportingNoise = (\n value: unknown,\n payload?: RollbarPayloadLike,\n): NoiseRule | null => {\n try {\n return classify(value, payload);\n } catch {\n return null;\n }\n};\n\n/** True for a browser network failure or an aborted request: nothing the app can fix. */\nexport const isNetworkFailure = (error: unknown): boolean =>\n classifyReportingNoise(error) === \"network\";\n","import Rollbar from \"rollbar\";\nimport { getRuntimeEnv } from \"@/lib/runtime-env\";\nimport { classifyReportingNoise } from \"./noise-filter\";\n\n/**\n * Payload keys and header names that must never leave the browser.\n *\n * Rollbar scrubs a default set already; these are the platform-specific ones. Getting this wrong\n * ships a tenant's credentials to a third party, which is why it lives here rather than being\n * restated in every app.\n */\nconst DEFAULT_SCRUB_FIELDS = [\n \"x-blocks-key\",\n \"X-Blocks-Key\",\n \"Authorization\",\n \"authorization\",\n \"access_token\",\n \"refresh_token\",\n \"accessToken\",\n \"refreshToken\",\n \"password\",\n \"clientSecret\",\n \"client_secret\",\n \"connectionString\",\n \"secretValue\",\n];\n\n/**\n * Noise that reaches `window.onerror` but says nothing about the app: browser extensions,\n * cross-origin frames, and the ResizeObserver warning Chrome raises during ordinary layout.\n */\nconst DEFAULT_IGNORED_MESSAGES = [\n \"ResizeObserver loop limit exceeded\",\n \"ResizeObserver loop completed with undelivered notifications\",\n \"Script error.\",\n];\n\n/**\n * Stands in for a real token when none is seeded.\n *\n * `@rollbar/react`'s `Provider` rejects an instance whose `options.accessToken` is falsy -- it\n * throws \"`instance` must be a configured instance of Rollbar\" from its own constructor, which is\n * above the error boundary, so an unconfigured app renders nothing at all. Reporting is switched\n * off by `enabled`, not by the token: the notifier refuses to send before it reaches a transport\n * and telemetry instrumentation is never installed. A placeholder therefore costs nothing and\n * keeps reporting genuinely optional, which is the point -- no tier should go blank because a\n * secret has not been seeded yet.\n */\nexport const UNCONFIGURED_ACCESS_TOKEN = \"rollbar-reporting-disabled\";\n\n/**\n * Rollbar's `checkIgnore`: drops browser noise before it is sent (see `noise-filter.ts`).\n *\n * For uncaught errors and unhandled rejections Rollbar passes `[message, error, ...]`, so the raw\n * value is `args[1]`; for `rollbar.error(err, ...)` it is `args[0]`. Kept a single expression:\n * Rollbar copies the function's source into every item it does send.\n */\nconst ignoreNoise: NonNullable<Rollbar.Configuration[\"checkIgnore\"]> = (\n isUncaught,\n args,\n payload,\n) =>\n classifyReportingNoise(\n isUncaught ? (args?.[1] ?? args?.[0]) : args?.[0],\n payload,\n ) !== null;\n\nexport interface RollbarConfigOptions {\n /**\n * The app reporting, e.g. `\"blocks-os\"`. Pass the same name the app already gives\n * `BlocksAppLayout`, so items can be traced back to a service without a project-id lookup.\n */\n service: string;\n /** Appended to, not replacing, the platform scrub list. */\n extraScrubFields?: string[];\n /** Appended to, not replacing, the default ignore list. */\n extraIgnoredMessages?: string[];\n /** Identifies the build. Required for source-map deobfuscation once maps are uploaded. */\n codeVersion?: string;\n}\n\n/**\n * Builds the browser Rollbar configuration from runtime env.\n *\n * Separate from the provider so it can be asserted on directly: most of the risk in this module is\n * in the configuration -- scrubbing, and whether reporting is on at all -- not in Rollbar itself.\n */\nexport const createRollbarConfig = (\n options: RollbarConfigOptions,\n): Rollbar.Configuration => {\n const accessToken = getRuntimeEnv(\"BLOCKS_ROLLBAR_CLIENT_TOKEN\");\n\n return {\n accessToken: accessToken || UNCONFIGURED_ACCESS_TOKEN,\n // Reporting is opt-in on a seeded token. Unconfigured environments -- developer machines,\n // tests, any tier not yet seeded -- get an inert client rather than a broken one, so the error\n // boundary still behaves exactly as it does in production.\n enabled: accessToken.length > 0,\n environment: getRuntimeEnv(\"BLOCKS_ROLLBAR_ENV\") || \"unknown\",\n captureUncaught: true,\n captureUnhandledRejections: true,\n scrubFields: [...DEFAULT_SCRUB_FIELDS, ...(options.extraScrubFields ?? [])],\n ignoredMessages: [\n ...DEFAULT_IGNORED_MESSAGES,\n ...(options.extraIgnoredMessages ?? []),\n ],\n checkIgnore: ignoreNoise,\n payload: {\n // Under `custom`, not at the root of `data`. Rollbar recognises a fixed set of top-level\n // fields and gives unknown ones \"no special handling\" -- they are stored but not indexed as\n // custom metadata, so a root-level `service` is neither queryable nor in the same place the\n // .NET side puts it. Here both sides land at `data.custom.*`, which is also where a webhook\n // receiver finds them: `data.item.last_occurrence.custom.service`.\n //\n // `service` identifies the app and `component` which half of it, as two fields rather than\n // one `blocks-os-client` string, so either can be filtered on without parsing.\n custom: {\n service: options.service,\n component: \"client\",\n },\n client: {\n javascript: {\n source_map_enabled: Boolean(options.codeVersion),\n code_version: options.codeVersion,\n },\n },\n },\n };\n};\n","import Rollbar from \"rollbar\";\nimport {\n createRollbarConfig,\n type RollbarConfigOptions,\n} from \"./rollbar.config\";\n\nlet instance: Rollbar | undefined;\n\n/**\n * The one Rollbar instance for the app.\n *\n * Memoised on first call so that code outside the React tree -- an `HttpClient` built at module\n * scope, for instance -- reports through the same client the provider renders. A second instance\n * would install a second set of window handlers and split the telemetry buffer in two.\n *\n * First call wins: later calls return the existing instance and ignore their options. In practice\n * every call site passes the same service, and load order between a module-scope client and the\n * provider is not something an app should have to reason about.\n *\n * Created lazily, so merely importing this module installs nothing.\n */\nexport const getRollbar = (options: RollbarConfigOptions): Rollbar =>\n (instance ??= new Rollbar(createRollbarConfig(options)));\n","import type { QueryClient } from \"@tanstack/react-query\";\nimport type Rollbar from \"rollbar\";\nimport { HttpError } from \"@/lib/http/error\";\nimport { isNetworkFailure } from \"./noise-filter\";\n\n/**\n * Reports errors thrown inside query and mutation functions that are not request failures.\n *\n * Narrow on purpose. Every failure from `HttpClient` arrives as an `HttpError` and is skipped here:\n * transport failures are already handled by `createHttpFailureReporter`, and HTTP statuses are\n * either business outcomes or faults the server reported itself. What remains is a genuine bug in a\n * query function -- a bad mapping, a null dereference on a response -- which React Query catches\n * and stores as query state, so it never reaches `window.onerror` and would otherwise be invisible.\n *\n * Returns an unsubscribe function.\n */\nexport const attachQueryErrorReporting = (\n queryClient: QueryClient,\n rollbar: Rollbar,\n): (() => void) => {\n const report = (error: unknown, context: Record<string, unknown>) => {\n if (error instanceof HttpError) return;\n // Belt and braces: an HttpError that crossed a module boundary may fail `instanceof`.\n if (typeof (error as { status?: unknown })?.status === \"number\") return;\n // A raw `fetch` in a query function rejects with the browser's own network error.\n if (isNetworkFailure(error)) return;\n\n rollbar.error(error instanceof Error ? error : new Error(String(error)), {\n source: \"react-query\",\n ...context,\n });\n };\n\n const unsubscribeQueries = queryClient.getQueryCache().subscribe((event) => {\n if (event.type !== \"updated\" || event.action.type !== \"error\") return;\n\n report(event.action.error, {\n kind: \"query\",\n queryHash: event.query.queryHash,\n });\n });\n\n const unsubscribeMutations = queryClient\n .getMutationCache()\n .subscribe((event) => {\n if (event.type !== \"updated\" || event.action.type !== \"error\") return;\n\n report(event.action.error, {\n kind: \"mutation\",\n mutationKey: event.mutation.options.mutationKey,\n });\n });\n\n return () => {\n unsubscribeQueries();\n unsubscribeMutations();\n };\n};\n","import { ErrorBoundary, Provider } from \"@rollbar/react\";\nimport { useEffect, useMemo, type ComponentType, type ReactNode } from \"react\";\nimport { getQueryClient } from \"@/providers/query-client\";\nimport { attachQueryErrorReporting } from \"./report-query-errors\";\nimport { type RollbarConfigOptions } from \"./rollbar.config\";\nimport { getRollbar } from \"./rollbar.instance\";\nimport { useT } from \"@/i18n/use-t\";\n\nexport interface RollbarFallbackProps {\n error: Error | null;\n resetError: () => void;\n}\n\n/**\n * Shown instead of a blank page when a render throws. Deliberately plain: it has to render when the\n * app's own state is already known-bad, so it depends only on theme tokens and its i18n keys, which\n * fall back to the bundled English when nothing else loads.\n */\nconst DefaultFallback = ({ resetError }: RollbarFallbackProps) => {\n const { t } = useT(\"genesis.shared\");\n return (\n <div\n className=\"flex min-h-screen flex-col items-center justify-center gap-4 bg-background px-6 text-center\"\n role=\"alert\"\n >\n <div className=\"space-y-1\">\n <p className=\"text-lg font-semibold text-foreground\">\n {t(\"ROLLBAR_FALLBACK.TITLE\")}\n </p>\n <p className=\"text-sm text-medium-emphasis\">\n {t(\"ROLLBAR_FALLBACK.MESSAGE\")}\n </p>\n </div>\n <button\n onClick={resetError}\n className=\"rounded-md bg-primary px-4 py-2 text-sm font-medium text-primary-foreground\"\n >\n {t(\"ROLLBAR_FALLBACK.TRY_AGAIN\")}\n </button>\n </div>\n );\n};\n\nexport interface RollbarProviderProps extends RollbarConfigOptions {\n children: ReactNode;\n /** Replaces the built-in crash screen. */\n fallback?: ComponentType<RollbarFallbackProps>;\n}\n\n/**\n * Puts Rollbar in front of the whole tree.\n *\n * Mount this outermost -- above the query, theme and router providers -- so a throw during their\n * own setup is still caught and reported rather than blanking the page.\n *\n * Reporting is inert until a client token is seeded (see `createRollbarConfig`), but the boundary is\n * always live, so the crash screen behaves identically in local development and in production.\n *\n * Covers uncaught errors, unhandled rejections, render crashes, and bugs thrown inside query\n * functions. Request failures are not covered here: pass `createHttpFailureReporter` to your\n * `HttpClient` as `onError` for those.\n */\nexport const RollbarProvider = ({\n children,\n fallback = DefaultFallback,\n ...configOptions\n}: RollbarProviderProps) => {\n // Shared with anything reporting from outside the tree, and stable for the life of the app:\n // reconstructing it on re-render would reinstall the window handlers and drop Rollbar's own\n // telemetry buffer.\n const rollbar = useMemo(\n () => getRollbar(configOptions),\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [],\n );\n\n useEffect(\n () => attachQueryErrorReporting(getQueryClient(), rollbar),\n [rollbar],\n );\n\n return (\n <Provider instance={rollbar}>\n <ErrorBoundary fallbackUI={fallback} level=\"critical\">\n {children}\n </ErrorBoundary>\n </Provider>\n );\n};\n","import type Rollbar from \"rollbar\";\nimport type { HttpRequestFailure } from \"@/lib/http/types\";\nimport { isNetworkFailure } from \"./noise-filter\";\n\n/**\n * Builds an `onError` handler for `HttpClientConfig` that reports only transport failures that are\n * not browser network failures.\n *\n * Failures that produced an HTTP response are skipped deliberately: a 4xx is a business outcome the\n * UI already surfaces, and a 5xx has already been reported by the server with a real stack trace,\n * so reporting it again from the browser only buries the better item.\n *\n * Browser network failures are skipped too (`isNetworkFailure`: offline, DNS, CORS, TLS and aborted\n * requests all surface as `TypeError: Failed to fetch` and its Firefox/Safari equivalents, or as an\n * `AbortError`). They come from the user's connection rather than from Blocks, and an outage shows\n * up in server-side 5xx items and uptime monitoring instead. What is left -- a body that fails to\n * parse, a throw inside the client itself -- is a client fault the server cannot see.\n *\n * A success response without data never reaches this reporter: `HttpClient` resolves 204, 205,\n * `content-length: 0` and blank bodies to `{ success: true, status }`. A non-empty success body\n * that is not valid JSON is reported once, as a transport failure carrying the `SyntaxError`.\n *\n * `HttpClient` normalises every failure to an `HttpError` with status 500 before callers see it, so\n * this distinction only exists inside the `onError` hook. Reporting from a `catch` further out\n * cannot tell the two apart.\n */\nexport const createHttpFailureReporter =\n (rollbar: Rollbar) =>\n (failure: HttpRequestFailure): void => {\n if (!failure.transport) return;\n if (isNetworkFailure(failure.error)) return;\n\n const error =\n failure.error instanceof Error\n ? failure.error\n : new Error(String(failure.error));\n\n rollbar.error(error, {\n source: \"http-client\",\n url: failure.url,\n method: failure.method,\n });\n };\n"]}