@datadog/browser-rum-nextjs 7.15.0 → 7.16.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"file":"addNextjsError.js","names":["createHandlingStack","clocksNow"],"sources":["../../../src/domain/error/addNextjsError.ts"],"sourcesContent":["import { clocksNow } from '@datadog/js-core/time'\nimport { callMonitored } from '@datadog/js-core/monitor'\nimport { createHandlingStack } from '@datadog/browser-core'\nimport type { Context } from '@datadog/browser-core'\nimport type { ErrorInfo } from 'react'\nimport { onRumStart } from '../nextjsPlugin'\n\n/**\n * Add a Next.js error to the RUM session.\n *\n * @category Error\n * @example\n * ```ts\n * // app/error.tsx (or app/global-error.tsx)\n * 'use client'\n * import { useEffect } from 'react'\n * import { addNextjsError } from '@datadog/browser-rum-nextjs'\n *\n * export default function Error({ error }: { error: Error & { digest?: string } }) {\n * useEffect(() => {\n * addNextjsError(error)\n * }, [error])\n * return <div>Something went wrong</div>\n * }\n * ```\n */\nexport function addNextjsError(error: Error & { digest?: string }, errorInfo?: ErrorInfo) {\n const handlingStack = createHandlingStack('nextjs error')\n const startClocks = clocksNow()\n onRumStart((addError) => {\n callMonitored(() => {\n addError({\n error,\n handlingStack,\n componentStack: errorInfo?.componentStack ?? undefined,\n startClocks,\n context: {\n ...(error as Error & { dd_context?: Context }).dd_context,\n ...(error.digest && { nextjs: { digest: error.digest } }),\n framework: 'nextjs',\n },\n })\n })\n })\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AA0BA,SAAgB,eAAe,OAAoC,WAAuB;CACxF,MAAM,iBAAA,GAAgBA,sBAAAA,oBAAAA,CAAoB,cAAc;CACxD,MAAM,eAAA,GAAcC,sBAAAA,UAAAA,CAAU;CAC9B,qBAAA,YAAY,aAAa;EACvB,CAAA,GAAA,yBAAA,cAAA,OAAoB;GAClB,SAAS;IACP;IACA;IACA,gBAAgB,WAAW,kBAAkB,KAAA;IAC7C;IACA,SAAS;KACP,GAAI,MAA2C;KAC/C,GAAI,MAAM,UAAU,EAAE,QAAQ,EAAE,QAAQ,MAAM,OAAO,EAAE;KACvD,WAAW;IACb;GACF,CAAC;EACH,CAAC;CACH,CAAC;AACH"}
1
+ {"version":3,"file":"addNextjsError.js","names":["createHandlingStack","clocksNow"],"sources":["../../../src/domain/error/addNextjsError.ts"],"sourcesContent":["import { clocksNow } from '@datadog/js-core/time'\nimport { callMonitored } from '@datadog/js-core/monitor'\nimport { createHandlingStack } from '@datadog/browser-core'\nimport type { Context } from '@datadog/js-core/util'\nimport type { ErrorInfo } from 'react'\nimport { onRumStart } from '../nextjsPlugin'\n\n/**\n * Add a Next.js error to the RUM session.\n *\n * @category Error\n * @example\n * ```ts\n * // app/error.tsx (or app/global-error.tsx)\n * 'use client'\n * import { useEffect } from 'react'\n * import { addNextjsError } from '@datadog/browser-rum-nextjs'\n *\n * export default function Error({ error }: { error: Error & { digest?: string } }) {\n * useEffect(() => {\n * addNextjsError(error)\n * }, [error])\n * return <div>Something went wrong</div>\n * }\n * ```\n */\nexport function addNextjsError(error: Error & { digest?: string }, errorInfo?: ErrorInfo) {\n const handlingStack = createHandlingStack('nextjs error')\n const startClocks = clocksNow()\n onRumStart((addError) => {\n callMonitored(() => {\n addError({\n error,\n handlingStack,\n componentStack: errorInfo?.componentStack ?? undefined,\n startClocks,\n context: {\n ...(error as Error & { dd_context?: Context }).dd_context,\n ...(error.digest && { nextjs: { digest: error.digest } }),\n framework: 'nextjs',\n },\n })\n })\n })\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AA0BA,SAAgB,eAAe,OAAoC,WAAuB;CACxF,MAAM,iBAAA,GAAgBA,sBAAAA,oBAAAA,CAAoB,cAAc;CACxD,MAAM,eAAA,GAAcC,sBAAAA,UAAAA,CAAU;CAC9B,qBAAA,YAAY,aAAa;EACvB,CAAA,GAAA,yBAAA,cAAA,OAAoB;GAClB,SAAS;IACP;IACA;IACA,gBAAgB,WAAW,kBAAkB,KAAA;IAC7C;IACA,SAAS;KACP,GAAI,MAA2C;KAC/C,GAAI,MAAM,UAAU,EAAE,QAAQ,EAAE,QAAQ,MAAM,OAAO,EAAE;KACvD,WAAW;IACb;GACF,CAAC;EACH,CAAC;CACH,CAAC;AACH"}
@@ -1,14 +1,14 @@
1
1
  "use client";
2
2
  const require_nextjsPlugin = require("../nextjsPlugin.js");
3
3
  const require_computeViewNameFromParams = require("./computeViewNameFromParams.js");
4
- let _datadog_browser_core = require("@datadog/browser-core");
4
+ let _datadog_js_core_util = require("@datadog/js-core/util");
5
5
  let react = require("react");
6
6
  let next_navigation = require("next/navigation");
7
7
  //#region src/domain/nextJSRouter/datadogAppRouter.tsx
8
8
  function DatadogAppRouter() {
9
- const pathname = (0, _datadog_browser_core.mockable)(next_navigation.usePathname)();
10
- const params = (0, _datadog_browser_core.mockable)(next_navigation.useParams)();
11
- const previousPathname = (0, _datadog_browser_core.mockable)(react.useRef)(null);
9
+ const pathname = (0, _datadog_js_core_util.mockable)(next_navigation.usePathname)();
10
+ const params = (0, _datadog_js_core_util.mockable)(next_navigation.useParams)();
11
+ const previousPathname = (0, _datadog_js_core_util.mockable)(react.useRef)(null);
12
12
  if (previousPathname.current !== pathname) {
13
13
  previousPathname.current = pathname;
14
14
  require_nextjsPlugin.startNextjsView(require_computeViewNameFromParams.computeViewNameFromParams(pathname, params));
@@ -1 +1 @@
1
- {"version":3,"file":"datadogAppRouter.js","names":["mockable","usePathname","useParams","useRef","computeViewNameFromParams"],"sources":["../../../src/domain/nextJSRouter/datadogAppRouter.tsx"],"sourcesContent":["'use client'\n\nimport { useRef } from 'react'\nimport { usePathname, useParams } from 'next/navigation'\nimport { mockable } from '@datadog/browser-core'\nimport { startNextjsView } from '../nextjsPlugin'\nimport { computeViewNameFromParams } from './computeViewNameFromParams'\n\nexport function DatadogAppRouter() {\n const pathname = mockable(usePathname)()\n const params = mockable(useParams)()\n const previousPathname = mockable(useRef)<string | null>(null)\n\n if (previousPathname.current !== pathname) {\n previousPathname.current = pathname\n startNextjsView(computeViewNameFromParams(pathname, params))\n }\n\n return null\n}\n"],"mappings":";;;;;;;AAQA,SAAgB,mBAAmB;CACjC,MAAM,YAAA,GAAWA,sBAAAA,SAAAA,CAASC,gBAAAA,WAAW,CAAC,CAAC;CACvC,MAAM,UAAA,GAASD,sBAAAA,SAAAA,CAASE,gBAAAA,SAAS,CAAC,CAAC;CACnC,MAAM,oBAAA,GAAmBF,sBAAAA,SAAAA,CAASG,MAAAA,MAAM,CAAC,CAAgB,IAAI;CAE7D,IAAI,iBAAiB,YAAY,UAAU;EACzC,iBAAiB,UAAU;EAC3B,qBAAA,gBAAgBC,kCAAAA,0BAA0B,UAAU,MAAM,CAAC;CAC7D;CAEA,OAAO;AACT"}
1
+ {"version":3,"file":"datadogAppRouter.js","names":["mockable","usePathname","useParams","useRef","computeViewNameFromParams"],"sources":["../../../src/domain/nextJSRouter/datadogAppRouter.tsx"],"sourcesContent":["'use client'\n\nimport { useRef } from 'react'\nimport { usePathname, useParams } from 'next/navigation'\nimport { mockable } from '@datadog/js-core/util'\nimport { startNextjsView } from '../nextjsPlugin'\nimport { computeViewNameFromParams } from './computeViewNameFromParams'\n\nexport function DatadogAppRouter() {\n const pathname = mockable(usePathname)()\n const params = mockable(useParams)()\n const previousPathname = mockable(useRef)<string | null>(null)\n\n if (previousPathname.current !== pathname) {\n previousPathname.current = pathname\n startNextjsView(computeViewNameFromParams(pathname, params))\n }\n\n return null\n}\n"],"mappings":";;;;;;;AAQA,SAAgB,mBAAmB;CACjC,MAAM,YAAA,GAAWA,sBAAAA,SAAAA,CAASC,gBAAAA,WAAW,CAAC,CAAC;CACvC,MAAM,UAAA,GAASD,sBAAAA,SAAAA,CAASE,gBAAAA,SAAS,CAAC,CAAC;CACnC,MAAM,oBAAA,GAAmBF,sBAAAA,SAAAA,CAASG,MAAAA,MAAM,CAAC,CAAgB,IAAI;CAE7D,IAAI,iBAAiB,YAAY,UAAU;EACzC,iBAAiB,UAAU;EAC3B,qBAAA,gBAAgBC,kCAAAA,0BAA0B,UAAU,MAAM,CAAC;CAC7D;CAEA,OAAO;AACT"}
@@ -1,11 +1,11 @@
1
1
  const require_nextjsPlugin = require("../nextjsPlugin.js");
2
- let _datadog_browser_core = require("@datadog/browser-core");
2
+ let _datadog_js_core_util = require("@datadog/js-core/util");
3
3
  let react = require("react");
4
4
  let next_router = require("next/router");
5
5
  //#region src/domain/nextJSRouter/datadogPagesRouter.tsx
6
6
  function DatadogPagesRouter() {
7
- const router = (0, _datadog_browser_core.mockable)(next_router.useRouter)();
8
- const previousPath = (0, _datadog_browser_core.mockable)(react.useRef)(null);
7
+ const router = (0, _datadog_js_core_util.mockable)(next_router.useRouter)();
8
+ const previousPath = (0, _datadog_js_core_util.mockable)(react.useRef)(null);
9
9
  if (!router.isReady) return null;
10
10
  const path = router.asPath.split(/[?#]/)[0];
11
11
  if (previousPath.current !== path) {
@@ -1 +1 @@
1
- {"version":3,"file":"datadogPagesRouter.js","names":["mockable","useRouter","useRef"],"sources":["../../../src/domain/nextJSRouter/datadogPagesRouter.tsx"],"sourcesContent":["import { useRef } from 'react'\nimport { useRouter } from 'next/router'\nimport { mockable } from '@datadog/browser-core'\nimport { startNextjsView } from '../nextjsPlugin'\n\nexport function DatadogPagesRouter() {\n const router = mockable(useRouter)()\n const previousPath = mockable(useRef)<string | null>(null)\n\n if (!router.isReady) {\n return null\n }\n\n // Extract the path portion of asPath (without query params or hash) to detect navigations.\n const path = router.asPath.split(/[?#]/)[0]\n\n if (previousPath.current !== path) {\n // router.pathname is the route pattern (e.g., \"/user/[id]\") — used as the view name\n // router.asPath is the actual URL (e.g., \"/user/42\") — used to detect navigations between\n // different concrete URLs of the same dynamic route (e.g., /user/42 → /user/43)\n previousPath.current = path\n startNextjsView(router.pathname)\n }\n\n return null\n}\n"],"mappings":";;;;;AAKA,SAAgB,qBAAqB;CACnC,MAAM,UAAA,GAASA,sBAAAA,SAAAA,CAASC,YAAAA,SAAS,CAAC,CAAC;CACnC,MAAM,gBAAA,GAAeD,sBAAAA,SAAAA,CAASE,MAAAA,MAAM,CAAC,CAAgB,IAAI;CAEzD,IAAI,CAAC,OAAO,SACV,OAAO;CAIT,MAAM,OAAO,OAAO,OAAO,MAAM,MAAM,CAAC,CAAC;CAEzC,IAAI,aAAa,YAAY,MAAM;EAIjC,aAAa,UAAU;EACvB,qBAAA,gBAAgB,OAAO,QAAQ;CACjC;CAEA,OAAO;AACT"}
1
+ {"version":3,"file":"datadogPagesRouter.js","names":["mockable","useRouter","useRef"],"sources":["../../../src/domain/nextJSRouter/datadogPagesRouter.tsx"],"sourcesContent":["import { useRef } from 'react'\nimport { useRouter } from 'next/router'\nimport { mockable } from '@datadog/js-core/util'\nimport { startNextjsView } from '../nextjsPlugin'\n\nexport function DatadogPagesRouter() {\n const router = mockable(useRouter)()\n const previousPath = mockable(useRef)<string | null>(null)\n\n if (!router.isReady) {\n return null\n }\n\n // Extract the path portion of asPath (without query params or hash) to detect navigations.\n const path = router.asPath.split(/[?#]/)[0]\n\n if (previousPath.current !== path) {\n // router.pathname is the route pattern (e.g., \"/user/[id]\") — used as the view name\n // router.asPath is the actual URL (e.g., \"/user/42\") — used to detect navigations between\n // different concrete URLs of the same dynamic route (e.g., /user/42 → /user/43)\n previousPath.current = path\n startNextjsView(router.pathname)\n }\n\n return null\n}\n"],"mappings":";;;;;AAKA,SAAgB,qBAAqB;CACnC,MAAM,UAAA,GAASA,sBAAAA,SAAAA,CAASC,YAAAA,SAAS,CAAC,CAAC;CACnC,MAAM,gBAAA,GAAeD,sBAAAA,SAAAA,CAASE,MAAAA,MAAM,CAAC,CAAgB,IAAI;CAEzD,IAAI,CAAC,OAAO,SACV,OAAO;CAIT,MAAM,OAAO,OAAO,OAAO,MAAM,MAAM,CAAC,CAAC;CAEzC,IAAI,aAAa,YAAY,MAAM;EAIjC,aAAa,UAAU;EACvB,qBAAA,gBAAgB,OAAO,QAAQ;CACjC;CAEA,OAAO;AACT"}
@@ -13,7 +13,7 @@ function nextjsPlugin() {
13
13
  onInit({ publicApi, initConfiguration }) {
14
14
  globalPublicApi = publicApi;
15
15
  initConfiguration.trackViewsManually = true;
16
- routerType = (0, _datadog_browser_core.mockable)(detectNextjsRouterType)();
16
+ routerType = (0, _datadog_js_core_util.mockable)(detectNextjsRouterType)();
17
17
  for (const subscriber of onRumInitSubscribers) subscriber(publicApi);
18
18
  },
19
19
  onRumStart({ addError }) {
@@ -1 +1 @@
1
- {"version":3,"file":"nextjsPlugin.js","names":["mockable","globalObject","toIntegrations","toMajorVersionIntegration","buildUrl"],"sources":["../../src/domain/nextjsPlugin.ts"],"sourcesContent":["import { buildUrl, globalObject } from '@datadog/js-core/util'\nimport { mockable, toIntegrations, toMajorVersionIntegration } from '@datadog/browser-core'\nimport type { RumPlugin, RumPublicApi, StartRumResult } from '@datadog/browser-rum-core'\n\nexport type NextjsPlugin = Pick<Required<RumPlugin>, 'name' | 'onInit' | 'onRumStart' | 'getConfigurationTelemetry'>\n\ntype NextjsRouterType = 'app-router' | 'pages-router'\ninterface NextjsGlobalObject {\n next?: { version?: string }\n}\ntype InitSubscriber = (rumPublicApi: RumPublicApi) => void\ntype StartSubscriber = (addError: StartRumResult['addError']) => void\n\nlet globalPublicApi: RumPublicApi | undefined\nlet globalAddError: StartRumResult['addError'] | undefined\nlet lastNavigationUrl: string | undefined\nlet routerType: NextjsRouterType | undefined\n\nconst onRumInitSubscribers: InitSubscriber[] = []\nconst onRumStartSubscribers: StartSubscriber[] = []\n\nexport function nextjsPlugin(): NextjsPlugin {\n return {\n name: 'nextjs',\n onInit({ publicApi, initConfiguration }) {\n globalPublicApi = publicApi\n initConfiguration.trackViewsManually = true\n routerType = mockable(detectNextjsRouterType)()\n\n for (const subscriber of onRumInitSubscribers) {\n subscriber(publicApi)\n }\n },\n onRumStart({ addError }) {\n globalAddError = addError\n if (addError) {\n for (const subscriber of onRumStartSubscribers) {\n subscriber(addError)\n }\n }\n },\n getConfigurationTelemetry() {\n const nextjsVersion = (globalObject as NextjsGlobalObject).next?.version\n return {\n router: true,\n integrations: toIntegrations(nextjsVersion && toMajorVersionIntegration('nextjs', nextjsVersion), routerType),\n }\n },\n } satisfies RumPlugin\n}\n\n// The App Router doesn't hydrate from a `__NEXT_DATA__` payload (it streams RSC data instead),\n// so its absence is used as a best-effort signal that the app router is in use.\nfunction detectNextjsRouterType(): NextjsRouterType {\n return document.getElementById('__NEXT_DATA__') ? 'pages-router' : 'app-router'\n}\n\nexport function startNextjsView(viewName: string) {\n if (globalPublicApi) {\n // Use the URL captured by onRouterTransitionStart if available, since React renders before pushState updates window.location\n const url = lastNavigationUrl ? buildUrl(lastNavigationUrl, window.location.origin).href : undefined\n lastNavigationUrl = undefined\n globalPublicApi.startView({ name: viewName, url })\n }\n}\n\n// Must be re-exported from the user's instrumentation-client.ts so we can capture the URL before React renders\nexport function onRouterTransitionStart(url: string) {\n lastNavigationUrl = url\n}\n\nexport function onRumInit(callback: InitSubscriber) {\n if (globalPublicApi) {\n callback(globalPublicApi)\n } else {\n onRumInitSubscribers.push(callback)\n }\n}\n\nexport function onRumStart(callback: StartSubscriber) {\n if (globalAddError) {\n callback(globalAddError)\n } else {\n onRumStartSubscribers.push(callback)\n }\n}\n\nexport function resetNextjsPlugin() {\n globalPublicApi = undefined\n globalAddError = undefined\n onRumInitSubscribers.length = 0\n onRumStartSubscribers.length = 0\n lastNavigationUrl = undefined\n routerType = undefined\n}\n"],"mappings":";;;AAaA,IAAI;AACJ,IAAI;AACJ,IAAI;AACJ,IAAI;AAEJ,MAAM,uBAAyC,CAAC;AAChD,MAAM,wBAA2C,CAAC;AAElD,SAAgB,eAA6B;CAC3C,OAAO;EACL,MAAM;EACN,OAAO,EAAE,WAAW,qBAAqB;GACvC,kBAAkB;GAClB,kBAAkB,qBAAqB;GACvC,cAAA,GAAaA,sBAAAA,SAAAA,CAAS,sBAAsB,CAAC,CAAC;GAE9C,KAAK,MAAM,cAAc,sBACvB,WAAW,SAAS;EAExB;EACA,WAAW,EAAE,YAAY;GACvB,iBAAiB;GACjB,IAAI,UACF,KAAK,MAAM,cAAc,uBACvB,WAAW,QAAQ;EAGzB;EACA,4BAA4B;GAC1B,MAAM,gBAAiBC,sBAAAA,aAAoC,MAAM;GACjE,OAAO;IACL,QAAQ;IACR,eAAA,GAAcC,sBAAAA,eAAAA,CAAe,kBAAA,GAAiBC,sBAAAA,0BAAAA,CAA0B,UAAU,aAAa,GAAG,UAAU;GAC9G;EACF;CACF;AACF;AAIA,SAAS,yBAA2C;CAClD,OAAO,SAAS,eAAe,eAAe,IAAI,iBAAiB;AACrE;AAEA,SAAgB,gBAAgB,UAAkB;CAChD,IAAI,iBAAiB;EAEnB,MAAM,MAAM,qBAAA,GAAoBC,sBAAAA,SAAAA,CAAS,mBAAmB,OAAO,SAAS,MAAM,CAAC,CAAC,OAAO,KAAA;EAC3F,oBAAoB,KAAA;EACpB,gBAAgB,UAAU;GAAE,MAAM;GAAU;EAAI,CAAC;CACnD;AACF;AAGA,SAAgB,wBAAwB,KAAa;CACnD,oBAAoB;AACtB;AAUA,SAAgB,WAAW,UAA2B;CACpD,IAAI,gBACF,SAAS,cAAc;MAEvB,sBAAsB,KAAK,QAAQ;AAEvC"}
1
+ {"version":3,"file":"nextjsPlugin.js","names":["mockable","globalObject","toIntegrations","toMajorVersionIntegration","buildUrl"],"sources":["../../src/domain/nextjsPlugin.ts"],"sourcesContent":["import { buildUrl, globalObject, mockable } from '@datadog/js-core/util'\nimport { toIntegrations, toMajorVersionIntegration } from '@datadog/browser-core'\nimport type { RumPlugin, RumPublicApi, StartRumResult } from '@datadog/browser-rum-core'\n\nexport type NextjsPlugin = Pick<Required<RumPlugin>, 'name' | 'onInit' | 'onRumStart' | 'getConfigurationTelemetry'>\n\ntype NextjsRouterType = 'app-router' | 'pages-router'\ninterface NextjsGlobalObject {\n next?: { version?: string }\n}\ntype InitSubscriber = (rumPublicApi: RumPublicApi) => void\ntype StartSubscriber = (addError: StartRumResult['addError']) => void\n\nlet globalPublicApi: RumPublicApi | undefined\nlet globalAddError: StartRumResult['addError'] | undefined\nlet lastNavigationUrl: string | undefined\nlet routerType: NextjsRouterType | undefined\n\nconst onRumInitSubscribers: InitSubscriber[] = []\nconst onRumStartSubscribers: StartSubscriber[] = []\n\nexport function nextjsPlugin(): NextjsPlugin {\n return {\n name: 'nextjs',\n onInit({ publicApi, initConfiguration }) {\n globalPublicApi = publicApi\n initConfiguration.trackViewsManually = true\n routerType = mockable(detectNextjsRouterType)()\n\n for (const subscriber of onRumInitSubscribers) {\n subscriber(publicApi)\n }\n },\n onRumStart({ addError }) {\n globalAddError = addError\n if (addError) {\n for (const subscriber of onRumStartSubscribers) {\n subscriber(addError)\n }\n }\n },\n getConfigurationTelemetry() {\n const nextjsVersion = (globalObject as NextjsGlobalObject).next?.version\n return {\n router: true,\n integrations: toIntegrations(nextjsVersion && toMajorVersionIntegration('nextjs', nextjsVersion), routerType),\n }\n },\n } satisfies RumPlugin\n}\n\n// The App Router doesn't hydrate from a `__NEXT_DATA__` payload (it streams RSC data instead),\n// so its absence is used as a best-effort signal that the app router is in use.\nfunction detectNextjsRouterType(): NextjsRouterType {\n return document.getElementById('__NEXT_DATA__') ? 'pages-router' : 'app-router'\n}\n\nexport function startNextjsView(viewName: string) {\n if (globalPublicApi) {\n // Use the URL captured by onRouterTransitionStart if available, since React renders before pushState updates window.location\n const url = lastNavigationUrl ? buildUrl(lastNavigationUrl, window.location.origin).href : undefined\n lastNavigationUrl = undefined\n globalPublicApi.startView({ name: viewName, url })\n }\n}\n\n// Must be re-exported from the user's instrumentation-client.ts so we can capture the URL before React renders\nexport function onRouterTransitionStart(url: string) {\n lastNavigationUrl = url\n}\n\nexport function onRumInit(callback: InitSubscriber) {\n if (globalPublicApi) {\n callback(globalPublicApi)\n } else {\n onRumInitSubscribers.push(callback)\n }\n}\n\nexport function onRumStart(callback: StartSubscriber) {\n if (globalAddError) {\n callback(globalAddError)\n } else {\n onRumStartSubscribers.push(callback)\n }\n}\n\nexport function resetNextjsPlugin() {\n globalPublicApi = undefined\n globalAddError = undefined\n onRumInitSubscribers.length = 0\n onRumStartSubscribers.length = 0\n lastNavigationUrl = undefined\n routerType = undefined\n}\n"],"mappings":";;;AAaA,IAAI;AACJ,IAAI;AACJ,IAAI;AACJ,IAAI;AAEJ,MAAM,uBAAyC,CAAC;AAChD,MAAM,wBAA2C,CAAC;AAElD,SAAgB,eAA6B;CAC3C,OAAO;EACL,MAAM;EACN,OAAO,EAAE,WAAW,qBAAqB;GACvC,kBAAkB;GAClB,kBAAkB,qBAAqB;GACvC,cAAA,GAAaA,sBAAAA,SAAAA,CAAS,sBAAsB,CAAC,CAAC;GAE9C,KAAK,MAAM,cAAc,sBACvB,WAAW,SAAS;EAExB;EACA,WAAW,EAAE,YAAY;GACvB,iBAAiB;GACjB,IAAI,UACF,KAAK,MAAM,cAAc,uBACvB,WAAW,QAAQ;EAGzB;EACA,4BAA4B;GAC1B,MAAM,gBAAiBC,sBAAAA,aAAoC,MAAM;GACjE,OAAO;IACL,QAAQ;IACR,eAAA,GAAcC,sBAAAA,eAAAA,CAAe,kBAAA,GAAiBC,sBAAAA,0BAAAA,CAA0B,UAAU,aAAa,GAAG,UAAU;GAC9G;EACF;CACF;AACF;AAIA,SAAS,yBAA2C;CAClD,OAAO,SAAS,eAAe,eAAe,IAAI,iBAAiB;AACrE;AAEA,SAAgB,gBAAgB,UAAkB;CAChD,IAAI,iBAAiB;EAEnB,MAAM,MAAM,qBAAA,GAAoBC,sBAAAA,SAAAA,CAAS,mBAAmB,OAAO,SAAS,MAAM,CAAC,CAAC,OAAO,KAAA;EAC3F,oBAAoB,KAAA;EACpB,gBAAgB,UAAU;GAAE,MAAM;GAAU;EAAI,CAAC;CACnD;AACF;AAGA,SAAgB,wBAAwB,KAAa;CACnD,oBAAoB;AACtB;AAUA,SAAgB,WAAW,UAA2B;CACpD,IAAI,gBACF,SAAS,cAAc;MAEvB,sBAAsB,KAAK,QAAQ;AAEvC"}
@@ -1 +1 @@
1
- {"version":3,"file":"addNextjsError.mjs","names":[],"sources":["../../../src/domain/error/addNextjsError.ts"],"sourcesContent":["import { clocksNow } from '@datadog/js-core/time'\nimport { callMonitored } from '@datadog/js-core/monitor'\nimport { createHandlingStack } from '@datadog/browser-core'\nimport type { Context } from '@datadog/browser-core'\nimport type { ErrorInfo } from 'react'\nimport { onRumStart } from '../nextjsPlugin'\n\n/**\n * Add a Next.js error to the RUM session.\n *\n * @category Error\n * @example\n * ```ts\n * // app/error.tsx (or app/global-error.tsx)\n * 'use client'\n * import { useEffect } from 'react'\n * import { addNextjsError } from '@datadog/browser-rum-nextjs'\n *\n * export default function Error({ error }: { error: Error & { digest?: string } }) {\n * useEffect(() => {\n * addNextjsError(error)\n * }, [error])\n * return <div>Something went wrong</div>\n * }\n * ```\n */\nexport function addNextjsError(error: Error & { digest?: string }, errorInfo?: ErrorInfo) {\n const handlingStack = createHandlingStack('nextjs error')\n const startClocks = clocksNow()\n onRumStart((addError) => {\n callMonitored(() => {\n addError({\n error,\n handlingStack,\n componentStack: errorInfo?.componentStack ?? undefined,\n startClocks,\n context: {\n ...(error as Error & { dd_context?: Context }).dd_context,\n ...(error.digest && { nextjs: { digest: error.digest } }),\n framework: 'nextjs',\n },\n })\n })\n })\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AA0BA,SAAgB,eAAe,OAAoC,WAAuB;CACxF,MAAM,gBAAgB,oBAAoB,cAAc;CACxD,MAAM,cAAc,UAAU;CAC9B,YAAY,aAAa;EACvB,oBAAoB;GAClB,SAAS;IACP;IACA;IACA,gBAAgB,WAAW,kBAAkB,KAAA;IAC7C;IACA,SAAS;KACP,GAAI,MAA2C;KAC/C,GAAI,MAAM,UAAU,EAAE,QAAQ,EAAE,QAAQ,MAAM,OAAO,EAAE;KACvD,WAAW;IACb;GACF,CAAC;EACH,CAAC;CACH,CAAC;AACH"}
1
+ {"version":3,"file":"addNextjsError.mjs","names":[],"sources":["../../../src/domain/error/addNextjsError.ts"],"sourcesContent":["import { clocksNow } from '@datadog/js-core/time'\nimport { callMonitored } from '@datadog/js-core/monitor'\nimport { createHandlingStack } from '@datadog/browser-core'\nimport type { Context } from '@datadog/js-core/util'\nimport type { ErrorInfo } from 'react'\nimport { onRumStart } from '../nextjsPlugin'\n\n/**\n * Add a Next.js error to the RUM session.\n *\n * @category Error\n * @example\n * ```ts\n * // app/error.tsx (or app/global-error.tsx)\n * 'use client'\n * import { useEffect } from 'react'\n * import { addNextjsError } from '@datadog/browser-rum-nextjs'\n *\n * export default function Error({ error }: { error: Error & { digest?: string } }) {\n * useEffect(() => {\n * addNextjsError(error)\n * }, [error])\n * return <div>Something went wrong</div>\n * }\n * ```\n */\nexport function addNextjsError(error: Error & { digest?: string }, errorInfo?: ErrorInfo) {\n const handlingStack = createHandlingStack('nextjs error')\n const startClocks = clocksNow()\n onRumStart((addError) => {\n callMonitored(() => {\n addError({\n error,\n handlingStack,\n componentStack: errorInfo?.componentStack ?? undefined,\n startClocks,\n context: {\n ...(error as Error & { dd_context?: Context }).dd_context,\n ...(error.digest && { nextjs: { digest: error.digest } }),\n framework: 'nextjs',\n },\n })\n })\n })\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AA0BA,SAAgB,eAAe,OAAoC,WAAuB;CACxF,MAAM,gBAAgB,oBAAoB,cAAc;CACxD,MAAM,cAAc,UAAU;CAC9B,YAAY,aAAa;EACvB,oBAAoB;GAClB,SAAS;IACP;IACA;IACA,gBAAgB,WAAW,kBAAkB,KAAA;IAC7C;IACA,SAAS;KACP,GAAI,MAA2C;KAC/C,GAAI,MAAM,UAAU,EAAE,QAAQ,EAAE,QAAQ,MAAM,OAAO,EAAE;KACvD,WAAW;IACb;GACF,CAAC;EACH,CAAC;CACH,CAAC;AACH"}
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import { startNextjsView } from "../nextjsPlugin.mjs";
3
3
  import { computeViewNameFromParams } from "./computeViewNameFromParams.mjs";
4
- import { mockable } from "@datadog/browser-core";
4
+ import { mockable } from "@datadog/js-core/util";
5
5
  import { useRef } from "react";
6
6
  import { useParams, usePathname } from "next/navigation";
7
7
  //#region src/domain/nextJSRouter/datadogAppRouter.tsx
@@ -1 +1 @@
1
- {"version":3,"file":"datadogAppRouter.mjs","names":[],"sources":["../../../src/domain/nextJSRouter/datadogAppRouter.tsx"],"sourcesContent":["'use client'\n\nimport { useRef } from 'react'\nimport { usePathname, useParams } from 'next/navigation'\nimport { mockable } from '@datadog/browser-core'\nimport { startNextjsView } from '../nextjsPlugin'\nimport { computeViewNameFromParams } from './computeViewNameFromParams'\n\nexport function DatadogAppRouter() {\n const pathname = mockable(usePathname)()\n const params = mockable(useParams)()\n const previousPathname = mockable(useRef)<string | null>(null)\n\n if (previousPathname.current !== pathname) {\n previousPathname.current = pathname\n startNextjsView(computeViewNameFromParams(pathname, params))\n }\n\n return null\n}\n"],"mappings":";;;;;;;AAQA,SAAgB,mBAAmB;CACjC,MAAM,WAAW,SAAS,WAAW,CAAC,CAAC;CACvC,MAAM,SAAS,SAAS,SAAS,CAAC,CAAC;CACnC,MAAM,mBAAmB,SAAS,MAAM,CAAC,CAAgB,IAAI;CAE7D,IAAI,iBAAiB,YAAY,UAAU;EACzC,iBAAiB,UAAU;EAC3B,gBAAgB,0BAA0B,UAAU,MAAM,CAAC;CAC7D;CAEA,OAAO;AACT"}
1
+ {"version":3,"file":"datadogAppRouter.mjs","names":[],"sources":["../../../src/domain/nextJSRouter/datadogAppRouter.tsx"],"sourcesContent":["'use client'\n\nimport { useRef } from 'react'\nimport { usePathname, useParams } from 'next/navigation'\nimport { mockable } from '@datadog/js-core/util'\nimport { startNextjsView } from '../nextjsPlugin'\nimport { computeViewNameFromParams } from './computeViewNameFromParams'\n\nexport function DatadogAppRouter() {\n const pathname = mockable(usePathname)()\n const params = mockable(useParams)()\n const previousPathname = mockable(useRef)<string | null>(null)\n\n if (previousPathname.current !== pathname) {\n previousPathname.current = pathname\n startNextjsView(computeViewNameFromParams(pathname, params))\n }\n\n return null\n}\n"],"mappings":";;;;;;;AAQA,SAAgB,mBAAmB;CACjC,MAAM,WAAW,SAAS,WAAW,CAAC,CAAC;CACvC,MAAM,SAAS,SAAS,SAAS,CAAC,CAAC;CACnC,MAAM,mBAAmB,SAAS,MAAM,CAAC,CAAgB,IAAI;CAE7D,IAAI,iBAAiB,YAAY,UAAU;EACzC,iBAAiB,UAAU;EAC3B,gBAAgB,0BAA0B,UAAU,MAAM,CAAC;CAC7D;CAEA,OAAO;AACT"}
@@ -1,5 +1,5 @@
1
1
  import { startNextjsView } from "../nextjsPlugin.mjs";
2
- import { mockable } from "@datadog/browser-core";
2
+ import { mockable } from "@datadog/js-core/util";
3
3
  import { useRef } from "react";
4
4
  import { useRouter } from "next/router";
5
5
  //#region src/domain/nextJSRouter/datadogPagesRouter.tsx
@@ -1 +1 @@
1
- {"version":3,"file":"datadogPagesRouter.mjs","names":[],"sources":["../../../src/domain/nextJSRouter/datadogPagesRouter.tsx"],"sourcesContent":["import { useRef } from 'react'\nimport { useRouter } from 'next/router'\nimport { mockable } from '@datadog/browser-core'\nimport { startNextjsView } from '../nextjsPlugin'\n\nexport function DatadogPagesRouter() {\n const router = mockable(useRouter)()\n const previousPath = mockable(useRef)<string | null>(null)\n\n if (!router.isReady) {\n return null\n }\n\n // Extract the path portion of asPath (without query params or hash) to detect navigations.\n const path = router.asPath.split(/[?#]/)[0]\n\n if (previousPath.current !== path) {\n // router.pathname is the route pattern (e.g., \"/user/[id]\") — used as the view name\n // router.asPath is the actual URL (e.g., \"/user/42\") — used to detect navigations between\n // different concrete URLs of the same dynamic route (e.g., /user/42 → /user/43)\n previousPath.current = path\n startNextjsView(router.pathname)\n }\n\n return null\n}\n"],"mappings":";;;;;AAKA,SAAgB,qBAAqB;CACnC,MAAM,SAAS,SAAS,SAAS,CAAC,CAAC;CACnC,MAAM,eAAe,SAAS,MAAM,CAAC,CAAgB,IAAI;CAEzD,IAAI,CAAC,OAAO,SACV,OAAO;CAIT,MAAM,OAAO,OAAO,OAAO,MAAM,MAAM,CAAC,CAAC;CAEzC,IAAI,aAAa,YAAY,MAAM;EAIjC,aAAa,UAAU;EACvB,gBAAgB,OAAO,QAAQ;CACjC;CAEA,OAAO;AACT"}
1
+ {"version":3,"file":"datadogPagesRouter.mjs","names":[],"sources":["../../../src/domain/nextJSRouter/datadogPagesRouter.tsx"],"sourcesContent":["import { useRef } from 'react'\nimport { useRouter } from 'next/router'\nimport { mockable } from '@datadog/js-core/util'\nimport { startNextjsView } from '../nextjsPlugin'\n\nexport function DatadogPagesRouter() {\n const router = mockable(useRouter)()\n const previousPath = mockable(useRef)<string | null>(null)\n\n if (!router.isReady) {\n return null\n }\n\n // Extract the path portion of asPath (without query params or hash) to detect navigations.\n const path = router.asPath.split(/[?#]/)[0]\n\n if (previousPath.current !== path) {\n // router.pathname is the route pattern (e.g., \"/user/[id]\") — used as the view name\n // router.asPath is the actual URL (e.g., \"/user/42\") — used to detect navigations between\n // different concrete URLs of the same dynamic route (e.g., /user/42 → /user/43)\n previousPath.current = path\n startNextjsView(router.pathname)\n }\n\n return null\n}\n"],"mappings":";;;;;AAKA,SAAgB,qBAAqB;CACnC,MAAM,SAAS,SAAS,SAAS,CAAC,CAAC;CACnC,MAAM,eAAe,SAAS,MAAM,CAAC,CAAgB,IAAI;CAEzD,IAAI,CAAC,OAAO,SACV,OAAO;CAIT,MAAM,OAAO,OAAO,OAAO,MAAM,MAAM,CAAC,CAAC;CAEzC,IAAI,aAAa,YAAY,MAAM;EAIjC,aAAa,UAAU;EACvB,gBAAgB,OAAO,QAAQ;CACjC;CAEA,OAAO;AACT"}
@@ -1,5 +1,5 @@
1
- import { buildUrl, globalObject } from "@datadog/js-core/util";
2
- import { mockable, toIntegrations, toMajorVersionIntegration } from "@datadog/browser-core";
1
+ import { buildUrl, globalObject, mockable } from "@datadog/js-core/util";
2
+ import { toIntegrations, toMajorVersionIntegration } from "@datadog/browser-core";
3
3
  //#region src/domain/nextjsPlugin.ts
4
4
  let globalPublicApi;
5
5
  let globalAddError;
@@ -1 +1 @@
1
- {"version":3,"file":"nextjsPlugin.mjs","names":[],"sources":["../../src/domain/nextjsPlugin.ts"],"sourcesContent":["import { buildUrl, globalObject } from '@datadog/js-core/util'\nimport { mockable, toIntegrations, toMajorVersionIntegration } from '@datadog/browser-core'\nimport type { RumPlugin, RumPublicApi, StartRumResult } from '@datadog/browser-rum-core'\n\nexport type NextjsPlugin = Pick<Required<RumPlugin>, 'name' | 'onInit' | 'onRumStart' | 'getConfigurationTelemetry'>\n\ntype NextjsRouterType = 'app-router' | 'pages-router'\ninterface NextjsGlobalObject {\n next?: { version?: string }\n}\ntype InitSubscriber = (rumPublicApi: RumPublicApi) => void\ntype StartSubscriber = (addError: StartRumResult['addError']) => void\n\nlet globalPublicApi: RumPublicApi | undefined\nlet globalAddError: StartRumResult['addError'] | undefined\nlet lastNavigationUrl: string | undefined\nlet routerType: NextjsRouterType | undefined\n\nconst onRumInitSubscribers: InitSubscriber[] = []\nconst onRumStartSubscribers: StartSubscriber[] = []\n\nexport function nextjsPlugin(): NextjsPlugin {\n return {\n name: 'nextjs',\n onInit({ publicApi, initConfiguration }) {\n globalPublicApi = publicApi\n initConfiguration.trackViewsManually = true\n routerType = mockable(detectNextjsRouterType)()\n\n for (const subscriber of onRumInitSubscribers) {\n subscriber(publicApi)\n }\n },\n onRumStart({ addError }) {\n globalAddError = addError\n if (addError) {\n for (const subscriber of onRumStartSubscribers) {\n subscriber(addError)\n }\n }\n },\n getConfigurationTelemetry() {\n const nextjsVersion = (globalObject as NextjsGlobalObject).next?.version\n return {\n router: true,\n integrations: toIntegrations(nextjsVersion && toMajorVersionIntegration('nextjs', nextjsVersion), routerType),\n }\n },\n } satisfies RumPlugin\n}\n\n// The App Router doesn't hydrate from a `__NEXT_DATA__` payload (it streams RSC data instead),\n// so its absence is used as a best-effort signal that the app router is in use.\nfunction detectNextjsRouterType(): NextjsRouterType {\n return document.getElementById('__NEXT_DATA__') ? 'pages-router' : 'app-router'\n}\n\nexport function startNextjsView(viewName: string) {\n if (globalPublicApi) {\n // Use the URL captured by onRouterTransitionStart if available, since React renders before pushState updates window.location\n const url = lastNavigationUrl ? buildUrl(lastNavigationUrl, window.location.origin).href : undefined\n lastNavigationUrl = undefined\n globalPublicApi.startView({ name: viewName, url })\n }\n}\n\n// Must be re-exported from the user's instrumentation-client.ts so we can capture the URL before React renders\nexport function onRouterTransitionStart(url: string) {\n lastNavigationUrl = url\n}\n\nexport function onRumInit(callback: InitSubscriber) {\n if (globalPublicApi) {\n callback(globalPublicApi)\n } else {\n onRumInitSubscribers.push(callback)\n }\n}\n\nexport function onRumStart(callback: StartSubscriber) {\n if (globalAddError) {\n callback(globalAddError)\n } else {\n onRumStartSubscribers.push(callback)\n }\n}\n\nexport function resetNextjsPlugin() {\n globalPublicApi = undefined\n globalAddError = undefined\n onRumInitSubscribers.length = 0\n onRumStartSubscribers.length = 0\n lastNavigationUrl = undefined\n routerType = undefined\n}\n"],"mappings":";;;AAaA,IAAI;AACJ,IAAI;AACJ,IAAI;AACJ,IAAI;AAEJ,MAAM,uBAAyC,CAAC;AAChD,MAAM,wBAA2C,CAAC;AAElD,SAAgB,eAA6B;CAC3C,OAAO;EACL,MAAM;EACN,OAAO,EAAE,WAAW,qBAAqB;GACvC,kBAAkB;GAClB,kBAAkB,qBAAqB;GACvC,aAAa,SAAS,sBAAsB,CAAC,CAAC;GAE9C,KAAK,MAAM,cAAc,sBACvB,WAAW,SAAS;EAExB;EACA,WAAW,EAAE,YAAY;GACvB,iBAAiB;GACjB,IAAI,UACF,KAAK,MAAM,cAAc,uBACvB,WAAW,QAAQ;EAGzB;EACA,4BAA4B;GAC1B,MAAM,gBAAiB,aAAoC,MAAM;GACjE,OAAO;IACL,QAAQ;IACR,cAAc,eAAe,iBAAiB,0BAA0B,UAAU,aAAa,GAAG,UAAU;GAC9G;EACF;CACF;AACF;AAIA,SAAS,yBAA2C;CAClD,OAAO,SAAS,eAAe,eAAe,IAAI,iBAAiB;AACrE;AAEA,SAAgB,gBAAgB,UAAkB;CAChD,IAAI,iBAAiB;EAEnB,MAAM,MAAM,oBAAoB,SAAS,mBAAmB,OAAO,SAAS,MAAM,CAAC,CAAC,OAAO,KAAA;EAC3F,oBAAoB,KAAA;EACpB,gBAAgB,UAAU;GAAE,MAAM;GAAU;EAAI,CAAC;CACnD;AACF;AAGA,SAAgB,wBAAwB,KAAa;CACnD,oBAAoB;AACtB;AAUA,SAAgB,WAAW,UAA2B;CACpD,IAAI,gBACF,SAAS,cAAc;MAEvB,sBAAsB,KAAK,QAAQ;AAEvC"}
1
+ {"version":3,"file":"nextjsPlugin.mjs","names":[],"sources":["../../src/domain/nextjsPlugin.ts"],"sourcesContent":["import { buildUrl, globalObject, mockable } from '@datadog/js-core/util'\nimport { toIntegrations, toMajorVersionIntegration } from '@datadog/browser-core'\nimport type { RumPlugin, RumPublicApi, StartRumResult } from '@datadog/browser-rum-core'\n\nexport type NextjsPlugin = Pick<Required<RumPlugin>, 'name' | 'onInit' | 'onRumStart' | 'getConfigurationTelemetry'>\n\ntype NextjsRouterType = 'app-router' | 'pages-router'\ninterface NextjsGlobalObject {\n next?: { version?: string }\n}\ntype InitSubscriber = (rumPublicApi: RumPublicApi) => void\ntype StartSubscriber = (addError: StartRumResult['addError']) => void\n\nlet globalPublicApi: RumPublicApi | undefined\nlet globalAddError: StartRumResult['addError'] | undefined\nlet lastNavigationUrl: string | undefined\nlet routerType: NextjsRouterType | undefined\n\nconst onRumInitSubscribers: InitSubscriber[] = []\nconst onRumStartSubscribers: StartSubscriber[] = []\n\nexport function nextjsPlugin(): NextjsPlugin {\n return {\n name: 'nextjs',\n onInit({ publicApi, initConfiguration }) {\n globalPublicApi = publicApi\n initConfiguration.trackViewsManually = true\n routerType = mockable(detectNextjsRouterType)()\n\n for (const subscriber of onRumInitSubscribers) {\n subscriber(publicApi)\n }\n },\n onRumStart({ addError }) {\n globalAddError = addError\n if (addError) {\n for (const subscriber of onRumStartSubscribers) {\n subscriber(addError)\n }\n }\n },\n getConfigurationTelemetry() {\n const nextjsVersion = (globalObject as NextjsGlobalObject).next?.version\n return {\n router: true,\n integrations: toIntegrations(nextjsVersion && toMajorVersionIntegration('nextjs', nextjsVersion), routerType),\n }\n },\n } satisfies RumPlugin\n}\n\n// The App Router doesn't hydrate from a `__NEXT_DATA__` payload (it streams RSC data instead),\n// so its absence is used as a best-effort signal that the app router is in use.\nfunction detectNextjsRouterType(): NextjsRouterType {\n return document.getElementById('__NEXT_DATA__') ? 'pages-router' : 'app-router'\n}\n\nexport function startNextjsView(viewName: string) {\n if (globalPublicApi) {\n // Use the URL captured by onRouterTransitionStart if available, since React renders before pushState updates window.location\n const url = lastNavigationUrl ? buildUrl(lastNavigationUrl, window.location.origin).href : undefined\n lastNavigationUrl = undefined\n globalPublicApi.startView({ name: viewName, url })\n }\n}\n\n// Must be re-exported from the user's instrumentation-client.ts so we can capture the URL before React renders\nexport function onRouterTransitionStart(url: string) {\n lastNavigationUrl = url\n}\n\nexport function onRumInit(callback: InitSubscriber) {\n if (globalPublicApi) {\n callback(globalPublicApi)\n } else {\n onRumInitSubscribers.push(callback)\n }\n}\n\nexport function onRumStart(callback: StartSubscriber) {\n if (globalAddError) {\n callback(globalAddError)\n } else {\n onRumStartSubscribers.push(callback)\n }\n}\n\nexport function resetNextjsPlugin() {\n globalPublicApi = undefined\n globalAddError = undefined\n onRumInitSubscribers.length = 0\n onRumStartSubscribers.length = 0\n lastNavigationUrl = undefined\n routerType = undefined\n}\n"],"mappings":";;;AAaA,IAAI;AACJ,IAAI;AACJ,IAAI;AACJ,IAAI;AAEJ,MAAM,uBAAyC,CAAC;AAChD,MAAM,wBAA2C,CAAC;AAElD,SAAgB,eAA6B;CAC3C,OAAO;EACL,MAAM;EACN,OAAO,EAAE,WAAW,qBAAqB;GACvC,kBAAkB;GAClB,kBAAkB,qBAAqB;GACvC,aAAa,SAAS,sBAAsB,CAAC,CAAC;GAE9C,KAAK,MAAM,cAAc,sBACvB,WAAW,SAAS;EAExB;EACA,WAAW,EAAE,YAAY;GACvB,iBAAiB;GACjB,IAAI,UACF,KAAK,MAAM,cAAc,uBACvB,WAAW,QAAQ;EAGzB;EACA,4BAA4B;GAC1B,MAAM,gBAAiB,aAAoC,MAAM;GACjE,OAAO;IACL,QAAQ;IACR,cAAc,eAAe,iBAAiB,0BAA0B,UAAU,aAAa,GAAG,UAAU;GAC9G;EACF;CACF;AACF;AAIA,SAAS,yBAA2C;CAClD,OAAO,SAAS,eAAe,eAAe,IAAI,iBAAiB;AACrE;AAEA,SAAgB,gBAAgB,UAAkB;CAChD,IAAI,iBAAiB;EAEnB,MAAM,MAAM,oBAAoB,SAAS,mBAAmB,OAAO,SAAS,MAAM,CAAC,CAAC,OAAO,KAAA;EAC3F,oBAAoB,KAAA;EACpB,gBAAgB,UAAU;GAAE,MAAM;GAAU;EAAI,CAAC;CACnD;AACF;AAGA,SAAgB,wBAAwB,KAAa;CACnD,oBAAoB;AACtB;AAUA,SAAgB,WAAW,UAA2B;CACpD,IAAI,gBACF,SAAS,cAAc;MAEvB,sBAAsB,KAAK,QAAQ;AAEvC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@datadog/browser-rum-nextjs",
3
- "version": "7.15.0",
3
+ "version": "7.16.1",
4
4
  "license": "Apache-2.0",
5
5
  "main": "cjs/entries/main.js",
6
6
  "module": "esm/entries/main.mjs",
@@ -17,10 +17,10 @@
17
17
  "prepack": "yarn build"
18
18
  },
19
19
  "dependencies": {
20
- "@datadog/browser-core": "7.15.0",
21
- "@datadog/browser-rum-core": "7.15.0",
22
- "@datadog/browser-rum-react": "7.15.0",
23
- "@datadog/js-core": "0.0.16"
20
+ "@datadog/browser-core": "7.16.1",
21
+ "@datadog/browser-rum-core": "7.16.1",
22
+ "@datadog/browser-rum-react": "7.16.1",
23
+ "@datadog/js-core": "0.0.18"
24
24
  },
25
25
  "peerDependencies": {
26
26
  "next": ">=13.0.0",
@@ -44,7 +44,7 @@
44
44
  },
45
45
  "devDependencies": {
46
46
  "@types/react": "19.3.0",
47
- "next": "16.3.5",
47
+ "next": "16.3.8",
48
48
  "react": "19.3.0",
49
49
  "react-dom": "19.3.0"
50
50
  }
@@ -1,7 +1,7 @@
1
1
  import { clocksNow } from '@datadog/js-core/time'
2
2
  import { callMonitored } from '@datadog/js-core/monitor'
3
3
  import { createHandlingStack } from '@datadog/browser-core'
4
- import type { Context } from '@datadog/browser-core'
4
+ import type { Context } from '@datadog/js-core/util'
5
5
  import type { ErrorInfo } from 'react'
6
6
  import { onRumStart } from '../nextjsPlugin'
7
7
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  import { useRef } from 'react'
4
4
  import { usePathname, useParams } from 'next/navigation'
5
- import { mockable } from '@datadog/browser-core'
5
+ import { mockable } from '@datadog/js-core/util'
6
6
  import { startNextjsView } from '../nextjsPlugin'
7
7
  import { computeViewNameFromParams } from './computeViewNameFromParams'
8
8
 
@@ -1,6 +1,6 @@
1
1
  import { useRef } from 'react'
2
2
  import { useRouter } from 'next/router'
3
- import { mockable } from '@datadog/browser-core'
3
+ import { mockable } from '@datadog/js-core/util'
4
4
  import { startNextjsView } from '../nextjsPlugin'
5
5
 
6
6
  export function DatadogPagesRouter() {
@@ -1,5 +1,5 @@
1
- import { buildUrl, globalObject } from '@datadog/js-core/util'
2
- import { mockable, toIntegrations, toMajorVersionIntegration } from '@datadog/browser-core'
1
+ import { buildUrl, globalObject, mockable } from '@datadog/js-core/util'
2
+ import { toIntegrations, toMajorVersionIntegration } from '@datadog/browser-core'
3
3
  import type { RumPlugin, RumPublicApi, StartRumResult } from '@datadog/browser-rum-core'
4
4
 
5
5
  export type NextjsPlugin = Pick<Required<RumPlugin>, 'name' | 'onInit' | 'onRumStart' | 'getConfigurationTelemetry'>