posthog-js 1.167.1 → 1.169.0

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 (57) hide show
  1. package/dist/all-external-dependencies.js +2 -2
  2. package/dist/all-external-dependencies.js.map +1 -1
  3. package/dist/array.full.js +2 -2
  4. package/dist/array.full.js.map +1 -1
  5. package/dist/array.full.no-external.js +2 -2
  6. package/dist/array.full.no-external.js.map +1 -1
  7. package/dist/array.js +1 -1
  8. package/dist/array.js.map +1 -1
  9. package/dist/array.no-external.js +1 -1
  10. package/dist/array.no-external.js.map +1 -1
  11. package/dist/exception-autocapture.js +1 -1
  12. package/dist/exception-autocapture.js.map +1 -1
  13. package/dist/external-scripts-loader.js.map +1 -1
  14. package/dist/lib/src/extensions/exception-autocapture/error-conversion.d.ts +46 -2
  15. package/dist/lib/src/extensions/exception-autocapture/stack-trace.d.ts +5 -5
  16. package/dist/lib/src/extensions/replay/sessionrecording.d.ts +11 -1
  17. package/dist/lib/src/types.d.ts +8 -17
  18. package/dist/lib/src/utils/globals.d.ts +3 -2
  19. package/dist/main.js +1 -1
  20. package/dist/main.js.map +1 -1
  21. package/dist/module.d.ts +20 -19
  22. package/dist/module.full.d.ts +20 -19
  23. package/dist/module.full.js +2 -2
  24. package/dist/module.full.js.map +1 -1
  25. package/dist/module.full.no-external.d.ts +20 -19
  26. package/dist/module.full.no-external.js +2 -2
  27. package/dist/module.full.no-external.js.map +1 -1
  28. package/dist/module.js +1 -1
  29. package/dist/module.js.map +1 -1
  30. package/dist/module.no-external.d.ts +20 -19
  31. package/dist/module.no-external.js +1 -1
  32. package/dist/module.no-external.js.map +1 -1
  33. package/dist/recorder-v2.js.map +1 -1
  34. package/dist/recorder.js.map +1 -1
  35. package/dist/surveys-preview.js.map +1 -1
  36. package/dist/surveys.js.map +1 -1
  37. package/dist/tracing-headers.js.map +1 -1
  38. package/dist/web-vitals.js.map +1 -1
  39. package/lib/package.json +1 -1
  40. package/lib/src/extensions/exception-autocapture/error-conversion.d.ts +46 -2
  41. package/lib/src/extensions/exception-autocapture/error-conversion.js +146 -89
  42. package/lib/src/extensions/exception-autocapture/error-conversion.js.map +1 -1
  43. package/lib/src/extensions/exception-autocapture/stack-trace.d.ts +5 -5
  44. package/lib/src/extensions/exception-autocapture/stack-trace.js +46 -23
  45. package/lib/src/extensions/exception-autocapture/stack-trace.js.map +1 -1
  46. package/lib/src/extensions/replay/sessionrecording.d.ts +11 -1
  47. package/lib/src/extensions/replay/sessionrecording.js +46 -14
  48. package/lib/src/extensions/replay/sessionrecording.js.map +1 -1
  49. package/lib/src/extensions/sentry-integration.js +1 -0
  50. package/lib/src/extensions/sentry-integration.js.map +1 -1
  51. package/lib/src/posthog-core.js +23 -16
  52. package/lib/src/posthog-core.js.map +1 -1
  53. package/lib/src/types.d.ts +8 -17
  54. package/lib/src/types.js.map +1 -1
  55. package/lib/src/utils/globals.d.ts +3 -2
  56. package/lib/src/utils/globals.js.map +1 -1
  57. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"sentry-integration.js","sourceRoot":"","sources":["../../../src/extensions/sentry-integration.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAwDH,IAAM,IAAI,GAAG,YAAY,CAAA;AAEzB,MAAM,UAAU,oBAAoB,CAChC,QAAiB,EACjB,EAAiG;QAAjG,qBAA+F,EAAE,KAAA,EAA/F,YAAY,kBAAA,EAAE,SAAS,eAAA,EAAE,MAAM,YAAA,EAAE,yBAA6B,EAA7B,iBAAiB,mBAAG,CAAC,OAAO,CAAC,KAAA;IAEhE,OAAO,UAAC,KAAK;;QACT,IAAM,kBAAkB,GAAG,iBAAiB,KAAK,GAAG,IAAI,iBAAiB,CAAC,QAAQ,CAAC,KAAK,CAAC,KAAsB,CAAC,CAAA;QAChH,IAAI,CAAC,kBAAkB,IAAI,CAAC,QAAQ,CAAC,QAAQ;YAAE,OAAO,KAAK,CAAA;QAC3D,IAAI,CAAC,K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AAC,MAAM,IAAI,kCAAkC,CAAC;oBAC9C,YAAY;oBACZ,mBAAmB;oBACnB,SAAS;oBACT,SAAS;oBACT,KAAK,CAAC,QAAQ,CAAA;QACtB,CAAC;QAED,QAAQ,CAAC,UAAU,CAAC,kBAAkB,CAAC,IAAI,CAAC,CAAA;QAE5C,OAAO,KAAK,CAAA;IAChB,CAAC,CAAA;AACL,CAAC;AAED,kCAAkC;AAClC,MAAM,UAAU,iBAAiB,CAAC,QAAiB,EAAE,OAAkC;IACnF,IAAM,SAAS,GAAG,oBAAoB,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAA;IACzD,OAAO;QACH,IAAI,EAAE,IAAI;QACV,YAAY,YAAC,KAAK;YACd,OAAO,SAAS,CAAC,KAAK,CAAC,CAAA;QAC3B,CAAC;KACJ,CAAA;AACL,CAAC;AACD,+BAA+B;AAC/B;IAQI,2BACI,QAAiB,EACjB,YAAqB,EACrB,SAAkB,EAClB,MAAe;IACf;;;;;;OAMG;IACH,iBAAyC;QAEzC,gEAAgE;QAChE,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;QAChB,IAAI,CAAC,SAAS,GAAG,UAAU,uBAAkE;YACzF,uBAAuB,CACnB,oBAAoB,CAAC,QAAQ,EAAE,EAAE,YAAY,cAAA,EAAE,SAAS,WAAA,EAAE,MAAM,QAAA,EAAE,iBAAiB,mBAAA,EAAE,CAAC,CACzF,CAAA;QACL,CAAC,CAAA;IACL,CAAC;IACL,wBAAC;AAAD,CAAC,AA9BD,IA8BC","sourcesContent":["/**\n * Integrate Sentry with PostHog. This will add a direct link to the person in Sentry, and an $exception event in PostHog\n *\n * ### Usage\n *\n * Sentry.init({\n * dsn: 'https://example',\n * integrations: [\n * new posthog.SentryIntegration(posthog)\n * ]\n * })\n *\n * @param {Object} [posthog] The posthog object\n * @param {string} [organization] Optional: The Sentry organization, used to send a direct link from PostHog to Sentry\n * @param {Number} [projectId] Optional: The Sentry project id, used to send a direct link from PostHog to Sentry\n * @param {string} [prefix] Optional: Url of a self-hosted sentry instance (default: https://sentry.io/organizations/)\n */\n\nimport { PostHog } from '../posthog-core'\nimport { SeverityLevel } from '../types'\n\n// NOTE - we can't import from @sentry/types because it changes frequently and causes clashes\n// We only use a small subset of the types, so we can just define the integration overall and use any for the rest\n\n// import {\n// Event as _SentryEvent,\n// EventProcessor as _SentryEventProcessor,\n// Hub as _SentryHub,\n// Integration as _SentryIntegration,\n// SeverityLevel as _SeverityLevel,\n// IntegrationClass as _SentryIntegrationClass,\n// } from '@sentry/types'\n\n// Uncomment the above and comment the below to get type checking for development\n\ntype _SentryEvent = any\ntype _SentryEventProcessor = any\ntype _SentryHub = any\n\ninterface _SentryIntegrationClass {\n name: string\n setupOnce(addGlobalEventProcessor: (callback: _SentryEventProcessor) => void, getCurrentHub: () => _SentryHub): void\n}\n\ninterface _SentryIntegration {\n name: string\n processEvent(event: _SentryEvent): _SentryEvent\n}\n\ninterface SentryExceptionProperties {\n $sentry_event_id: any\n $sentry_exception: any\n $sentry_exception_message: any\n $sentry_exception_type: any\n $sentry_tags: any\n $sentry_url?: string\n}\n\nexport type SentryIntegrationOptions = {\n organization?: string\n projectId?: number\n prefix?: string\n /**\n * By default, only errors are sent to PostHog. You can set this to '*' to send all events.\n * Or to an error of SeverityLevel to only send events matching the provided levels.\n * e.g. ['error', 'fatal'] to send only errors and fatals\n * e.g. ['error'] to send only errors -- the default when omitted\n * e.g. '*' to send all events\n */\n severityAllowList?: SeverityLevel[] | '*'\n}\n\nconst NAME = 'posthog-js'\n\nexport function createEventProcessor(\n _posthog: PostHog,\n { organization, projectId, prefix, severityAllowList = ['error'] }: SentryIntegrationOptions = {}\n): (event: _SentryEvent) => _SentryEvent {\n return (event) => {\n const shouldProcessLevel = severityAllowList === '*' || severityAllowList.includes(event.level as SeverityLevel)\n if (!shouldProcessLevel || !_posthog.__loaded) return event\n if (!event.tags) event.tags = {}\n\n const personUrl = _posthog.requestRouter.endpointFor(\n 'ui',\n `/project/${_posthog.config.token}/person/${_posthog.get_distinct_id()}`\n )\n event.tags['PostHog Person URL'] = personUrl\n if (_posthog.sessionRecordingStarted()) {\n event.tags['PostHog Recording URL'] = _posthog.get_session_replay_url({ withTimestamp: true })\n }\n\n const exceptions = event.exception?.values || []\n\n const data: SentryExceptionProperties & {\n // two properties added to match any exception auto-capture\n // added manually to avoid any dependency on the lazily loaded content\n $exception_message: any\n $exception_type: any\n $exception_personURL: string\n $exception_level: SeverityLevel\n $level: SeverityLevel\n } = {\n // PostHog Exception Properties,\n $exception_message: exceptions[0]?.value || event.message,\n $exception_type: exceptions[0]?.type,\n $exception_personURL: personUrl,\n $exception_level: event.level,\n // Sentry Exception Properties\n $sentry_event_id: event.event_id,\n $sentry_exception: event.exception,\n $sentry_exception_message: exceptions[0]?.value || event.message,\n $sentry_exception_type: exceptions[0]?.type,\n $sentry_tags: event.tags,\n $level: event.level,\n }\n\n if (organization && projectId) {\n data['$sentry_url'] =\n (prefix || 'https://sentry.io/organizations/') +\n organization +\n '/issues/?project=' +\n projectId +\n '&query=' +\n event.event_id\n }\n\n _posthog.exceptions.sendExceptionEvent(data)\n\n return event\n }\n}\n\n// V8 integration - function based\nexport function sentryIntegration(_posthog: PostHog, options?: SentryIntegrationOptions): _SentryIntegration {\n const processor = createEventProcessor(_posthog, options)\n return {\n name: NAME,\n processEvent(event) {\n return processor(event)\n },\n }\n}\n// V7 integration - class based\nexport class SentryIntegration implements _SentryIntegrationClass {\n name: string\n\n setupOnce: (\n addGlobalEventProcessor: (callback: _SentryEventProcessor) => void,\n getCurrentHub: () => _SentryHub\n ) => void\n\n constructor(\n _posthog: PostHog,\n organization?: string,\n projectId?: number,\n prefix?: string,\n /**\n * By default, only errors are sent to PostHog. You can set this to '*' to send all events.\n * Or to an error of SeverityLevel to only send events matching the provided levels.\n * e.g. ['error', 'fatal'] to send only errors and fatals\n * e.g. ['error'] to send only errors -- the default when omitted\n * e.g. '*' to send all events\n */\n severityAllowList?: SeverityLevel[] | '*'\n ) {\n // setupOnce gets called by Sentry when it intializes the plugin\n this.name = NAME\n this.setupOnce = function (addGlobalEventProcessor: (callback: _SentryEventProcessor) => void) {\n addGlobalEventProcessor(\n createEventProcessor(_posthog, { organization, projectId, prefix, severityAllowList })\n )\n }\n }\n}\n"]}
1
+ {"version":3,"file":"sentry-integration.js","sourceRoot":"","sources":["../../../src/extensions/sentry-integration.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAwDH,IAAM,IAAI,GAAG,YAAY,CAAA;AAEzB,MAAM,UAAU,oBAAoB,CAChC,QAAiB,EACjB,EAAiG;QAAjG,qBAA+F,EAAE,KAAA,EAA/F,YAAY,kBAAA,EAAE,SAAS,eAAA,EAAE,MAAM,YAAA,EAAE,yBAA6B,EAA7B,iBAAiB,mBAAG,CAAC,OAAO,CAAC,KAAA;IAEhE,OAAO,UAAC,KAAK;;QACT,IAAM,kBAAkB,GAAG,iBAAiB,KAAK,GAAG,IAAI,iBAAiB,CAAC,QAAQ,CAAC,KAAK,CAAC,KAAsB,CAAC,CAAA;QAChH,IAAI,CAAC,kBAAkB,IAAI,CAAC,QAAQ,CAAC,QAAQ;YAAE,OAAO,KAAK,CAAA;QAC3D,IAAI,CAAC,KAAK,CAAC,IAAI;YAAE,KAAK,CAAC,IAAI,GAAG,EAAE,CAAA;QAEhC,IAAM,SAAS,GAAG,QAAQ,CAAC,aAAa,CAAC,WAAW,CAChD,IAAI,EACJ,mBAAY,QAAQ,CAAC,MAAM,CAAC,KAAK,qBAAW,QAAQ,CAAC,eAAe,EAAE,CAAE,CAC3E,CAAA;QACD,KAAK,CAAC,IAAI,CAAC,oBAAoB,CAAC,GAAG,SAAS,CAAA;QAC5C,IAAI,QAAQ,CAAC,uBAAuB,EAAE,EAAE,CAAC;YACrC,KAAK,CAAC,IAAI,CAAC,uBAAuB,CAAC,GAAG,QAAQ,CAAC,sBAAsB,CAAC,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC,CAAA;QAClG,CAAC;QAED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,SAAS,CAAC,KAAK,CAAC,CAAA;QAC3B,CAAC;KACJ,CAAA;AACL,CAAC;AACD,+BAA+B;AAC/B;IAQI,2BACI,QAAiB,EACjB,YAAqB,EACrB,SAAkB,EAClB,MAAe;IACf;;;;;;OAMG;IACH,iBAAyC;QAEzC,gEAAgE;QAChE,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;QAChB,IAAI,CAAC,SAAS,GAAG,UAAU,uBAAkE;YACzF,uBAAuB,CACnB,oBAAoB,CAAC,QAAQ,EAAE,EAAE,YAAY,cAAA,EAAE,SAAS,WAAA,EAAE,MAAM,QAAA,EAAE,iBAAiB,mBAAA,EAAE,CAAC,CACzF,CAAA;QACL,CAAC,CAAA;IACL,CAAC;IACL,wBAAC;AAAD,CAAC,AA9BD,IA8BC","sourcesContent":["/**\n * Integrate Sentry with PostHog. This will add a direct link to the person in Sentry, and an $exception event in PostHog\n *\n * ### Usage\n *\n * Sentry.init({\n * dsn: 'https://example',\n * integrations: [\n * new posthog.SentryIntegration(posthog)\n * ]\n * })\n *\n * @param {Object} [posthog] The posthog object\n * @param {string} [organization] Optional: The Sentry organization, used to send a direct link from PostHog to Sentry\n * @param {Number} [projectId] Optional: The Sentry project id, used to send a direct link from PostHog to Sentry\n * @param {string} [prefix] Optional: Url of a self-hosted sentry instance (default: https://sentry.io/organizations/)\n */\n\nimport { PostHog } from '../posthog-core'\nimport { SeverityLevel } from '../types'\n\n// NOTE - we can't import from @sentry/types because it changes frequently and causes clashes\n// We only use a small subset of the types, so we can just define the integration overall and use any for the rest\n\n// import {\n// Event as _SentryEvent,\n// EventProcessor as _SentryEventProcessor,\n// Hub as _SentryHub,\n// Integration as _SentryIntegration,\n// SeverityLevel as _SeverityLevel,\n// IntegrationClass as _SentryIntegrationClass,\n// } from '@sentry/types'\n\n// Uncomment the above and comment the below to get type checking for development\n\ntype _SentryEvent = any\ntype _SentryEventProcessor = any\ntype _SentryHub = any\n\ninterface _SentryIntegrationClass {\n name: string\n setupOnce(addGlobalEventProcessor: (callback: _SentryEventProcessor) => void, getCurrentHub: () => _SentryHub): void\n}\n\ninterface _SentryIntegration {\n name: string\n processEvent(event: _SentryEvent): _SentryEvent\n}\n\ninterface SentryExceptionProperties {\n $sentry_event_id: any\n $sentry_exception: any\n $sentry_exception_message: any\n $sentry_exception_type: any\n $sentry_tags: any\n $sentry_url?: string\n}\n\nexport type SentryIntegrationOptions = {\n organization?: string\n projectId?: number\n prefix?: string\n /**\n * By default, only errors are sent to PostHog. You can set this to '*' to send all events.\n * Or to an error of SeverityLevel to only send events matching the provided levels.\n * e.g. ['error', 'fatal'] to send only errors and fatals\n * e.g. ['error'] to send only errors -- the default when omitted\n * e.g. '*' to send all events\n */\n severityAllowList?: SeverityLevel[] | '*'\n}\n\nconst NAME = 'posthog-js'\n\nexport function createEventProcessor(\n _posthog: PostHog,\n { organization, projectId, prefix, severityAllowList = ['error'] }: SentryIntegrationOptions = {}\n): (event: _SentryEvent) => _SentryEvent {\n return (event) => {\n const shouldProcessLevel = severityAllowList === '*' || severityAllowList.includes(event.level as SeverityLevel)\n if (!shouldProcessLevel || !_posthog.__loaded) return event\n if (!event.tags) event.tags = {}\n\n const personUrl = _posthog.requestRouter.endpointFor(\n 'ui',\n `/project/${_posthog.config.token}/person/${_posthog.get_distinct_id()}`\n )\n event.tags['PostHog Person URL'] = personUrl\n if (_posthog.sessionRecordingStarted()) {\n event.tags['PostHog Recording URL'] = _posthog.get_session_replay_url({ withTimestamp: true })\n }\n\n const exceptions = event.exception?.values || []\n\n const data: SentryExceptionProperties & {\n // two properties added to match any exception auto-capture\n // added manually to avoid any dependency on the lazily loaded content\n $exception_message: any\n $exception_type: any\n $exception_list: any\n $exception_personURL: string\n $exception_level: SeverityLevel\n $level: SeverityLevel\n } = {\n // PostHog Exception Properties,\n $exception_message: exceptions[0]?.value || event.message,\n $exception_type: exceptions[0]?.type,\n $exception_personURL: personUrl,\n $exception_level: event.level,\n $exception_list: exceptions,\n // Sentry Exception Properties\n $sentry_event_id: event.event_id,\n $sentry_exception: event.exception,\n $sentry_exception_message: exceptions[0]?.value || event.message,\n $sentry_exception_type: exceptions[0]?.type,\n $sentry_tags: event.tags,\n $level: event.level,\n }\n\n if (organization && projectId) {\n data['$sentry_url'] =\n (prefix || 'https://sentry.io/organizations/') +\n organization +\n '/issues/?project=' +\n projectId +\n '&query=' +\n event.event_id\n }\n\n _posthog.exceptions.sendExceptionEvent(data)\n\n return event\n }\n}\n\n// V8 integration - function based\nexport function sentryIntegration(_posthog: PostHog, options?: SentryIntegrationOptions): _SentryIntegration {\n const processor = createEventProcessor(_posthog, options)\n return {\n name: NAME,\n processEvent(event) {\n return processor(event)\n },\n }\n}\n// V7 integration - class based\nexport class SentryIntegration implements _SentryIntegrationClass {\n name: string\n\n setupOnce: (\n addGlobalEventProcessor: (callback: _SentryEventProcessor) => void,\n getCurrentHub: () => _SentryHub\n ) => void\n\n constructor(\n _posthog: PostHog,\n organization?: string,\n projectId?: number,\n prefix?: string,\n /**\n * By default, only errors are sent to PostHog. You can set this to '*' to send all events.\n * Or to an error of SeverityLevel to only send events matching the provided levels.\n * e.g. ['error', 'fatal'] to send only errors and fatals\n * e.g. ['error'] to send only errors -- the default when omitted\n * e.g. '*' to send all events\n */\n severityAllowList?: SeverityLevel[] | '*'\n ) {\n // setupOnce gets called by Sentry when it intializes the plugin\n this.name = NAME\n this.setupOnce = function (addGlobalEventProcessor: (callback: _SentryEventProcessor) => void) {\n addGlobalEventProcessor(\n createEventProcessor(_posthog, { organization, projectId, prefix, severityAllowList })\n )\n }\n }\n}\n"]}
@@ -39,7 +39,7 @@ import { _copyAndTruncateStrings, each, eachArray, extend, includes, registerEve
39
39
  import { assignableWindow, document, location, navigator, userAgent, window } from './utils/globals';
40
40
  import { PostHogFeatureFlags } from './posthog-featureflags';
41
41
  import { PostHogPersistence } from './posthog-persistence';
42
- import { ALIAS_ID_KEY, FLAG_CALL_REPORTED, PEOPLE_DISTINCT_ID_KEY, SESSION_RECORDING_IS_SAMPLED, USER_STATE, ENABLE_PERSON_PROCESSING, } from './constants';
42
+ import { ALIAS_ID_KEY, FLAG_CALL_REPORTED, PEOPLE_DISTINCT_ID_KEY, USER_STATE, ENABLE_PERSON_PROCESSING, } from './constants';
43
43
  import { SessionRecording } from './extensions/replay/sessionrecording';
44
44
  import { Decide } from './decide';
45
45
  import { Toolbar } from './extensions/toolbar';
@@ -242,7 +242,7 @@ var PostHog = /** @class */ (function () {
242
242
  callback === null || callback === void 0 ? void 0 : callback({});
243
243
  },
244
244
  };
245
- this.on('eventCaptured', function (data) { return logger.info('send', data); });
245
+ this.on('eventCaptured', function (data) { return logger.info("send \"".concat(data === null || data === void 0 ? void 0 : data.event, "\""), data); });
246
246
  }
247
247
  // Initialization methods
248
248
  /**
@@ -1544,21 +1544,19 @@ var PostHog = /** @class */ (function () {
1544
1544
  * @param override - optional boolean to override the default sampling behavior - ensures the next session recording to start will not be skipped by sampling or linked_flag config. `true` is shorthand for { sampling: true, linked_flag: true }
1545
1545
  */
1546
1546
  PostHog.prototype.startSessionRecording = function (override) {
1547
- var _a;
1548
- var _b, _c, _d;
1547
+ var _a, _b, _c;
1549
1548
  var overrideAll = isBoolean(override) && override;
1550
- if (overrideAll || (override === null || override === void 0 ? void 0 : override.sampling)) {
1549
+ if (overrideAll || (override === null || override === void 0 ? void 0 : override.sampling) || (override === null || override === void 0 ? void 0 : override.linked_flag)) {
1551
1550
  // allow the session id check to rotate session id if necessary
1552
- var ids = (_b = this.sessionManager) === null || _b === void 0 ? void 0 : _b.checkAndGetSessionAndWindowId();
1553
- (_c = this.persistence) === null || _c === void 0 ? void 0 : _c.register((_a = {},
1554
- // short-circuits the `makeSamplingDecision` function in the session recording module
1555
- _a[SESSION_RECORDING_IS_SAMPLED] = true,
1556
- _a));
1557
- logger.info('Session recording started with sampling override for session: ', ids === null || ids === void 0 ? void 0 : ids.sessionId);
1558
- }
1559
- if (overrideAll || (override === null || override === void 0 ? void 0 : override.linked_flag)) {
1560
- (_d = this.sessionRecording) === null || _d === void 0 ? void 0 : _d.overrideLinkedFlag();
1561
- logger.info('Session recording started with linked_flags override');
1551
+ var ids = (_a = this.sessionManager) === null || _a === void 0 ? void 0 : _a.checkAndGetSessionAndWindowId();
1552
+ if (overrideAll || (override === null || override === void 0 ? void 0 : override.sampling)) {
1553
+ (_b = this.sessionRecording) === null || _b === void 0 ? void 0 : _b.overrideSampling();
1554
+ logger.info('Session recording started with sampling override for session: ', ids === null || ids === void 0 ? void 0 : ids.sessionId);
1555
+ }
1556
+ if (overrideAll || (override === null || override === void 0 ? void 0 : override.linked_flag)) {
1557
+ (_c = this.sessionRecording) === null || _c === void 0 ? void 0 : _c.overrideLinkedFlag();
1558
+ logger.info('Session recording started with linked_flags override');
1559
+ }
1562
1560
  }
1563
1561
  this.set_config({ disable_session_recording: false });
1564
1562
  };
@@ -1588,7 +1586,16 @@ var PostHog = /** @class */ (function () {
1588
1586
  undefined,
1589
1587
  error,
1590
1588
  ])
1591
- : __assign({ $exception_type: error.name, $exception_message: error.message, $exception_level: 'error' }, additionalProperties);
1589
+ : __assign({ $exception_level: 'error', $exception_list: [
1590
+ {
1591
+ type: error.name,
1592
+ value: error.message,
1593
+ mechanism: {
1594
+ handled: true,
1595
+ synthetic: false,
1596
+ },
1597
+ },
1598
+ ] }, additionalProperties);
1592
1599
  this.exceptions.sendExceptionEvent(properties);
1593
1600
  };
1594
1601
  /**