{"version":3,"file":"index.d.ts","sources":["../../src/types.ts","../../src/integration.ts"],"sourcesContent":["type WebArgs = (now?: true) => string | null;\ntype ReactNativeArgs = () => Promise<string>;\n\ntype GetCurrentSessionURLType = WebArgs | ReactNativeArgs;\n\nexport type FullStoryClient = {\n  event(eventName: string, eventProperties: { [key: string]: any }): void;\n  getCurrentSessionURL?: GetCurrentSessionURLType;\n};\n","import type { Integration } from '@sentry/core';\nimport type { FullStoryClient } from './types';\nimport {\n  doesFullStoryExist,\n  getFullStoryUrl,\n  getOriginalExceptionProperties,\n  getSentryUrl,\n} from './util';\n\n/**\n * This integration creates a link from the Sentry Error to the FullStory replay.\n * It also creates a link from the FullStory event to the Sentry error.\n * Docs on Sentry SDK integrations are here: https://docs.sentry.io/platforms/javascript/guides/angular/troubleshooting/#dealing-with-integrations\n */\n\ntype Options = {\n  client: FullStoryClient;\n  baseSentryUrl?: string;\n};\n\nconst INTEGRATION_NAME = 'SentryFullStory';\n\nexport function fullStoryIntegration(\n  sentryOrg: string,\n  options: Options\n): Integration {\n  const fullStoryClient = options.client;\n  const baseSentryUrl = options.baseSentryUrl || 'https://sentry.io';\n  let fullStoryUrl: string | undefined;\n\n  return {\n    name: INTEGRATION_NAME,\n    async processEvent(event, hint, client) {\n      const self = client.getIntegrationByName(INTEGRATION_NAME);\n      // Run the integration ONLY when it was installed on the current Hub AND isn't a transaction\n      if (self && event.type === undefined && doesFullStoryExist()) {\n        if (!fullStoryUrl) {\n          try {\n            fullStoryUrl = await getFullStoryUrl(fullStoryClient);\n          } catch (e) {\n            const reason = e instanceof Error ? e.message : String(e);\n            console.error(`Unable to get FullStory session URL: ${reason}`);\n          }\n        }\n\n        if (fullStoryUrl) {\n          event.contexts = {\n            ...event.contexts,\n            fullStory: {\n              fullStoryUrl,\n            },\n          };\n        }\n\n        try {\n          fullStoryClient.event('Sentry Error', {\n            sentryUrl: getSentryUrl({\n              baseSentryUrl: baseSentryUrl,\n              sentryOrg,\n              hint,\n              client,\n            }),\n            ...getOriginalExceptionProperties(hint),\n          });\n        } catch (e) {\n          console.debug('Unable to report sentry error details to FullStory');\n        }\n      }\n\n      return event;\n    },\n  };\n}\n"],"names":[],"mappings":";;AAAA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;;ACNA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;;"}