{"version":3,"file":"integration.js","sources":["../../src/integration.ts"],"sourcesContent":["import { consoleSandbox, defineIntegration, GLOBAL_OBJ, hasSpansEnabled } from '@sentry/core';\nimport { DEFAULT_HOOKS } from './constants';\nimport { DEBUG_BUILD } from './debug-build';\nimport { attachErrorHandler } from './errorhandler';\nimport { createTracingMixins } from './tracing';\nimport type { Options, Vue, VueOptions } from './types';\n\nconst globalWithVue = GLOBAL_OBJ as typeof GLOBAL_OBJ & { Vue: Vue };\n\nconst DEFAULT_CONFIG: VueOptions = {\n Vue: globalWithVue.Vue,\n attachProps: true,\n attachErrorHandler: true,\n tracingOptions: {\n hooks: DEFAULT_HOOKS,\n timeout: 2000,\n trackComponents: false,\n },\n};\n\nconst INTEGRATION_NAME = 'Vue';\n\nexport type VueIntegrationOptions = Partial;\n\nexport const vueIntegration = defineIntegration((integrationOptions: Partial = {}) => {\n return {\n name: INTEGRATION_NAME,\n setup(client) {\n const options: Options = { ...DEFAULT_CONFIG, ...client.getOptions(), ...integrationOptions };\n if (!options.Vue && !options.app) {\n consoleSandbox(() => {\n // eslint-disable-next-line no-console\n console.warn(\n '[@sentry/vue]: Misconfigured SDK. Vue specific errors will not be captured. Update your `Sentry.init` call with an appropriate config option: `app` (Application Instance - Vue 3) or `Vue` (Vue Constructor - Vue 2).',\n );\n });\n return;\n }\n\n if (options.app) {\n const apps = Array.isArray(options.app) ? options.app : [options.app];\n apps.forEach(app => vueInit(app, options));\n } else if (options.Vue) {\n vueInit(options.Vue, options);\n }\n },\n };\n});\n\nconst vueInit = (app: Vue, options: Options): void => {\n if (DEBUG_BUILD) {\n // Check app is not mounted yet - should be mounted _after_ init()!\n // This is _somewhat_ private, but in the case that this doesn't exist we simply ignore it\n // See: https://github.com/vuejs/core/blob/eb2a83283caa9de0a45881d860a3cbd9d0bdd279/packages/runtime-core/src/component.ts#L394\n const appWithInstance = app as Vue & {\n _instance?: {\n isMounted?: boolean;\n };\n };\n\n const isMounted = appWithInstance._instance?.isMounted;\n if (isMounted === true) {\n consoleSandbox(() => {\n // eslint-disable-next-line no-console\n console.warn(\n '[@sentry/vue]: Misconfigured SDK. Vue app is already mounted. Make sure to call `app.mount()` after `Sentry.init()`.',\n );\n });\n }\n }\n\n if (options.attachErrorHandler) {\n attachErrorHandler(app, options);\n }\n\n if (hasSpansEnabled(options)) {\n app.mixin(createTracingMixins(options.tracingOptions));\n }\n};\n"],"names":[],"mappings":";;;;;;AAOA,MAAM,aAAA,GAAgB,UAAA;AAEtB,MAAM,cAAA,GAA6B;AAAA,EACjC,KAAK,aAAA,CAAc,GAAA;AAAA,EACnB,WAAA,EAAa,IAAA;AAAA,EACb,kBAAA,EAAoB,IAAA;AAAA,EACpB,cAAA,EAAgB;AAAA,IACd,KAAA,EAAO,aAAA;AAAA,IACP,OAAA,EAAS,GAAA;AAAA,IACT,eAAA,EAAiB;AAAA;AAErB,CAAA;AAEA,MAAM,gBAAA,GAAmB,KAAA;AAIlB,MAAM,cAAA,GAAiB,iBAAA,CAAkB,CAAC,kBAAA,GAA0C,EAAC,KAAM;AAChG,EAAA,OAAO;AAAA,IACL,IAAA,EAAM,gBAAA;AAAA,IACN,MAAM,MAAA,EAAQ;AACZ,MAAA,MAAM,OAAA,GAAmB,EAAE,GAAG,cAAA,EAAgB,GAAG,MAAA,CAAO,UAAA,EAAW,EAAG,GAAG,kBAAA,EAAmB;AAC5F,MAAA,IAAI,CAAC,OAAA,CAAQ,GAAA,IAAO,CAAC,QAAQ,GAAA,EAAK;AAChC,QAAA,cAAA,CAAe,MAAM;AAEnB,UAAA,OAAA,CAAQ,IAAA;AAAA,YACN;AAAA,WACF;AAAA,QACF,CAAC,CAAA;AACD,QAAA;AAAA,MACF;AAEA,MAAA,IAAI,QAAQ,GAAA,EAAK;AACf,QAAA,MAAM,IAAA,GAAO,KAAA,CAAM,OAAA,CAAQ,OAAA,CAAQ,GAAG,IAAI,OAAA,CAAQ,GAAA,GAAM,CAAC,OAAA,CAAQ,GAAG,CAAA;AACpE,QAAA,I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