@error-explorer/vue 1.1.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.
- package/README.md +312 -0
- package/dist/index.cjs +658 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +433 -0
- package/dist/index.d.ts +433 -0
- package/dist/index.js +639 -0
- package/dist/index.js.map +1 -0
- package/dist/router.cjs +143 -0
- package/dist/router.cjs.map +1 -0
- package/dist/router.d.cts +56 -0
- package/dist/router.d.ts +56 -0
- package/dist/router.js +140 -0
- package/dist/router.js.map +1 -0
- package/package.json +82 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/plugin.ts","../src/router.ts","../src/ErrorBoundary.ts","../src/composables.ts","../src/index.ts"],"names":["error","ErrorExplorer","defineComponent","ref","onErrorCaptured","h","inject","getCurrentInstance","onMounted","onUnmounted"],"mappings":";;;;;;;;AAWA,SAAS,iBAAiB,QAAA,EAA8D;AACtF,EAAA,IAAI,CAAC,UAAU,OAAO,MAAA;AAEtB,EAAA,MAAM,OAAA,GAAU,SAAS,CAAA,CAAE,IAAA;AAE3B,EAAA,OAAO,QAAQ,IAAA,IAAQ,OAAA,CAAQ,MAAA,IAAU,mBAAA,CAAoB,QAAQ,MAAM,CAAA;AAC7E;AAKA,SAAS,oBAAoB,IAAA,EAAmC;AAC9D,EAAA,IAAI,CAAC,MAAM,OAAO,MAAA;AAElB,EAAA,MAAM,KAAA,GAAQ,IAAA,CAAK,KAAA,CAAM,iBAAiB,CAAA;AAC1C,EAAA,OAAO,KAAA,GAAQ,KAAA,CAAM,CAAC,CAAA,GAAI,MAAA;AAC5B;AAKA,SAAS,kBAAkB,QAAA,EAAoD;AAC7E,EAAA,MAAM,QAAkB,EAAC;AACzB,EAAA,IAAI,OAAA,GAAU,QAAA;AAEd,EAAA,OAAO,OAAA,EAAS;AACd,IAAA,MAAM,IAAA,GAAO,iBAAiB,OAAO,CAAA;AACrC,IAAA,I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CAAA;AAKA,EAAA,MAAM,QAAA,GAAW,CAAI,EAAA,EAAa,OAAA,KAA4C;AAC5E,IAAA,IAAI;AACF,MAAA,OAAO,EAAA,EAAG;AAAA,IACZ,SAAS,KAAA,EAAO;AACd,MAAA,WAAA,CAAY,OAAO,OAAO,CAAA;AAC1B,MAAA,OAAO,MAAA;AAAA,IACT;AAAA,EACF,CAAA;AAEA,EAAA,OAAO;AAAA,IACL,WAAA;AAAA,IACA,SAAA;AAAA,IACA;AAAA,GACF;AACF;AAWO,SAAS,eAAe,IAAA,EAA0D;AACvF,EAAA,MAAM,gBAAA,GAAmB,CAAC,KAAA,KAA8B;AACtD,IAAA,IAAI,KAAA,EAAO;AACT,MAAAA,qBAAAA,CAAc,QAAQ,KAAK,CAAA;AAAA,IAC7B,CAAA,MAAO;AACL,MAAAA,sBAAc,SAAA,EAAU;AAAA,IAC1B;AAAA,EACF,CAAA;AAGA,EAAA,IAAI,IAAA,IAAQ,OAAO,IAAA,KAAS,QAAA,IAAY,WAAW,IAAA,EAAM;AAEvD,IAAA,MAAM,WAAY,IAAA,CAAuC,KAAA;AACzD,IAAA,gBAAA,CAAiB,QAAQ,CAAA;AAAA,EAK3B,CAAA,MAAO;AACL,IAAA,gBAAA,CAAiB,IAA0B,CAAA;AAAA,EAC7C;AAEA,EAAA,OAAO;AAAA,IACL,OAAA,EAAS,CAAC,OAAA,KAAyBA,qBAAAA,CAAc,QAAQ,OAAO,CAAA;AAAA,IAChE,SAAA,EAAW,MAAMA,qBAAAA,CAAc,SAAA;AAAU,GAC3C;AACF;AC3QA,IAAO,WAAA,GAAQ","file":"index.cjs","sourcesContent":["/**\n * Vue Plugin for Error Explorer\n */\n\nimport type { App, ComponentPublicInstance, Plugin } from 'vue';\nimport { ErrorExplorer } from '@error-explorer/browser';\nimport type { VueErrorExplorerOptions, VueComponentContext } from './types';\n\n/**\n * Get component name from instance\n */\nfunction getComponentName(instance: ComponentPublicInstance | null): string | undefined {\n if (!instance) return undefined;\n\n const options = instance.$.type as { name?: string; __name?: string; __file?: string };\n\n return options.name || options.__name || extractNameFromFile(options.__file);\n}\n\n/**\n * Extract component name from file path\n */\nfunction extractNameFromFile(file?: string): string | undefined {\n if (!file) return undefined;\n\n const match = file.match(/([^/\\\\]+)\\.vue$/);\n return match ? match[1] : undefined;\n}\n\n/**\n * Get component trace (parent hierarchy)\n */\nfunction getComponentTrace(instance: ComponentPublicInstance | null): string[] {\n const trace: string[] = [];\n let current = instance;\n\n while (current) {\n const name = getComponentName(current);\n if (name) {\n trace.push(name);\n }\n current = current.$.parent?.proxy ?? null;\n }\n\n return trace;\n}\n\n/**\n * Serialize component props with depth limit\n */\nfunction serializeProps(\n props: Record<string, unknown>,\n maxDepth: number\n): Record<string, unknown> {\n const serialize = (value: unknown, depth: number): unknown => {\n if (depth > maxDepth) {\n return '[Max depth reached]';\n }\n\n if (value === null || value === undefined) {\n return value;\n }\n\n if (typeof value === 'function') {\n return '[Function]';\n }\n\n if (typeof value === 'symbol') {\n return value.toString();\n }\n\n if (value instanceof Date) {\n return value.toISOString();\n }\n\n if (value instanceof Error) {\n return { name: value.name, message: value.message };\n }\n\n if (Array.isArray(value)) {\n return value.slice(0, 10).map(item => serialize(item, depth + 1));\n }\n\n if (typeof value === 'object') {\n const serialized: Record<string, unknown> = {};\n const keys = Object.keys(value as Record<string, unknown>).slice(0, 20);\n\n for (const key of keys) {\n serialized[key] = serialize((value as Record<string, unknown>)[key], depth + 1);\n }\n\n return serialized;\n }\n\n return value;\n };\n\n return serialize(props, 0) as Record<string, unknown>;\n}\n\n/**\n * Build Vue component context\n */\nfunction buildVueContext(\n instance: ComponentPublicInstance | null,\n info: string,\n options: VueErrorExplorerOptions\n): VueComponentContext {\n const context: VueComponentContext = {\n info,\n };\n\n if (options.captureComponentName !== false && instance) {\n context.name = getComponentName(instance);\n\n const type = instance.$.type as { __file?: string };\n if (type.__file) {\n context.file = type.__file;\n }\n\n context.trace = getComponentTrace(instance);\n }\n\n if (options.captureComponentProps && instance) {\n const props = instance.$.props;\n if (props && Object.keys(props).length > 0) {\n context.props = serializeProps(props, options.propsDepth ?? 2);\n }\n }\n\n return context;\n}\n\n/**\n * Original handlers storage\n */\nlet originalErrorHandler: ((err: unknown, instance: ComponentPublicInstance | null, info: string) => void) | undefined;\nlet originalWarnHandler: ((msg: string, instance: ComponentPublicInstance | null, trace: string) => void) | undefined;\n\n/**\n * Setup Vue error handler\n */\nfunction setupErrorHandler(app: App, options: VueErrorExplorerOptions): void {\n if (options.vueErrorHandler === false) {\n return;\n }\n\n // Save original handler\n originalErrorHandler = app.config.errorHandler;\n\n app.config.errorHandler = (err: unknown, instance: ComponentPublicInstance | null, info: string) => {\n // Check if we should capture\n if (options.beforeVueCapture) {\n const error = err instanceof Error ? err : new Error(String(err));\n if (!options.beforeVueCapture(error, instance, info)) {\n // Call original handler if exists\n if (originalErrorHandler) {\n originalErrorHandler(err, instance, info);\n }\n return;\n }\n }\n\n // Build Vue context\n const vueContext = buildVueContext(instance, info, options);\n\n // Add breadcrumb for the error\n ErrorExplorer.addBreadcrumb({\n type: 'error',\n category: 'vue.error',\n message: err instanceof Error ? err.message : String(err),\n level: 'error',\n data: {\n component: vueContext.name,\n info: vueContext.info,\n },\n });\n\n // Capture the error\n const error = err instanceof Error ? err : new Error(String(err));\n ErrorExplorer.captureException(error, {\n tags: {\n 'vue.component': vueContext.name || 'unknown',\n 'vue.info': info,\n },\n extra: {\n vue: vueContext,\n },\n });\n\n // Call original handler if exists\n if (originalErrorHandler) {\n originalErrorHandler(err, instance, info);\n }\n\n // Re-throw in development for better DX\n if (options.environment === 'development' || import.meta.env?.DEV) {\n console.error('[Vue Error]', err);\n }\n };\n}\n\n/**\n * Setup Vue warning handler\n */\nfunction setupWarnHandler(app: App, options: VueErrorExplorerOptions): void {\n // Default: only in development\n const enableWarn = options.vueWarnHandler ?? (\n options.environment === 'development' || import.meta.env?.DEV\n );\n\n if (!enableWarn) {\n return;\n }\n\n // Save original handler\n originalWarnHandler = app.config.warnHandler;\n\n app.config.warnHandler = (msg: string, instance: ComponentPublicInstance | null, trace: string) => {\n const componentName = getComponentName(instance);\n\n // Add breadcrumb for the warning\n ErrorExplorer.addBreadcrumb({\n type: 'debug',\n category: 'vue.warn',\n message: msg,\n level: 'warning',\n data: {\n component: componentName,\n trace: trace.split('\\n').slice(0, 5),\n },\n });\n\n // Call original handler if exists\n if (originalWarnHandler) {\n originalWarnHandler(msg, instance, trace);\n }\n\n // Log to console in development\n if (import.meta.env?.DEV) {\n console.warn('[Vue Warn]', msg);\n if (trace) {\n console.warn(trace);\n }\n }\n };\n}\n\n/**\n * Restore original handlers\n */\nexport function restoreHandlers(app: App): void {\n if (originalErrorHandler !== undefined) {\n app.config.errorHandler = originalErrorHandler;\n originalErrorHandler = undefined;\n }\n\n if (originalWarnHandler !== undefined) {\n app.config.warnHandler = originalWarnHandler;\n originalWarnHandler = undefined;\n }\n}\n\n/**\n * Create Vue plugin for Error Explorer\n */\nexport function createErrorExplorerPlugin(options: VueErrorExplorerOptions = {} as VueErrorExplorerOptions): Plugin {\n return {\n install(app: App) {\n // Initialize Error Explorer if not already done\n if (!ErrorExplorer.isInitialized()) {\n ErrorExplorer.init(options);\n }\n\n // Setup handlers\n setupErrorHandler(app, options);\n setupWarnHandler(app, options);\n\n // Provide Error Explorer instance globally\n app.provide('errorExplorer', ErrorExplorer);\n\n // Add global property for Options API access\n app.config.globalProperties.$errorExplorer = ErrorExplorer;\n\n // Add breadcrumb for app mount\n ErrorExplorer.addBreadcrumb({\n type: 'navigation',\n category: 'vue.lifecycle',\n message: 'Vue app mounted',\n level: 'info',\n });\n },\n };\n}\n\n// Declare module augmentation for global properties\ndeclare module 'vue' {\n interface ComponentCustomProperties {\n $errorExplorer: typeof ErrorExplorer;\n }\n}\n","/**\n * Vue Router integration for Error Explorer\n * Adds navigation breadcrumbs automatically\n */\n\nimport type { Router, RouteLocationNormalized } from 'vue-router';\nimport { ErrorExplorer } from '@error-explorer/browser';\n\n/**\n * Router integration options\n */\nexport interface RouterIntegrationOptions {\n /**\n * Track route changes as breadcrumbs\n * @default true\n */\n trackNavigation?: boolean;\n\n /**\n * Track route params in breadcrumbs\n * @default false (may contain sensitive data)\n */\n trackParams?: boolean;\n\n /**\n * Track query parameters in breadcrumbs\n * @default false (may contain sensitive data)\n */\n trackQuery?: boolean;\n\n /**\n * Custom function to extract route name for breadcrumb\n */\n getRouteName?: (route: RouteLocationNormalized) => string;\n\n /**\n * Hook called before adding navigation breadcrumb\n * Return false to skip the breadcrumb\n */\n beforeNavigationBreadcrumb?: (\n from: RouteLocationNormalized,\n to: RouteLocationNormalized\n ) => boolean;\n}\n\n/**\n * Default route name extractor\n */\nfunction defaultGetRouteName(route: RouteLocationNormalized): string {\n if (route.name && typeof route.name === 'string') {\n return route.name;\n }\n\n // Use path as fallback\n return route.path || '/';\n}\n\n/**\n * Build route data for breadcrumb\n */\nfunction buildRouteData(\n route: RouteLocationNormalized,\n options: RouterIntegrationOptions\n): Record<string, unknown> {\n const data: Record<string, unknown> = {\n path: route.path,\n name: route.name,\n fullPath: route.fullPath,\n };\n\n if (options.trackParams && Object.keys(route.params).length > 0) {\n data.params = { ...route.params };\n }\n\n if (options.trackQuery && Object.keys(route.query).length > 0) {\n data.query = { ...route.query };\n }\n\n if (route.meta && Object.keys(route.meta).length > 0) {\n // Only include safe meta properties\n const safeMeta: Record<string, unknown> = {};\n for (const [key, value] of Object.entries(route.meta)) {\n if (typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean') {\n safeMeta[key] = value;\n }\n }\n if (Object.keys(safeMeta).length > 0) {\n data.meta = safeMeta;\n }\n }\n\n return data;\n}\n\n/**\n * Setup Vue Router integration\n */\nexport function setupRouterIntegration(\n router: Router,\n options: RouterIntegrationOptions = {}\n): () => void {\n if (options.trackNavigation === false) {\n return () => {};\n }\n\n const getRouteName = options.getRouteName || defaultGetRouteName;\n\n // Track navigation start time\n let navigationStartTime: number | null = null;\n\n // Before each navigation\n const beforeEachGuard = router.beforeEach((to, from) => {\n navigationStartTime = performance.now();\n\n // Add breadcrumb for navigation start\n if (from.name || from.path !== '/') {\n const shouldAdd = options.beforeNavigationBreadcrumb\n ? options.beforeNavigationBreadcrumb(from, to)\n : true;\n\n if (shouldAdd) {\n ErrorExplorer.addBreadcrumb({\n type: 'navigation',\n category: 'router',\n message: `Navigating from ${getRouteName(from)} to ${getRouteName(to)}`,\n level: 'info',\n data: {\n from: buildRouteData(from, options),\n to: buildRouteData(to, options),\n },\n });\n }\n }\n\n return true;\n });\n\n // After each navigation\n const afterEachGuard = router.afterEach((to, from, failure) => {\n const duration = navigationStartTime ? performance.now() - navigationStartTime : undefined;\n navigationStartTime = null;\n\n if (failure) {\n // Navigation failed\n ErrorExplorer.addBreadcrumb({\n type: 'navigation',\n category: 'router.error',\n message: `Navigation failed to ${getRouteName(to)}`,\n level: 'error',\n data: {\n to: buildRouteData(to, options),\n error: failure.message,\n type: failure.type,\n duration,\n },\n });\n\n // Capture as exception if it's a real error\n if (failure.type !== 4) { // Not aborted\n ErrorExplorer.captureException(failure, {\n tags: {\n 'router.error': 'navigation_failure',\n 'router.to': getRouteName(to),\n },\n });\n }\n } else {\n // Navigation succeeded\n ErrorExplorer.addBreadcrumb({\n type: 'navigation',\n category: 'router',\n message: `Navigated to ${getRouteName(to)}`,\n level: 'info',\n data: {\n route: buildRouteData(to, options),\n duration,\n },\n });\n }\n });\n\n // Handle router errors\n const errorHandler = router.onError((error) => {\n ErrorExplorer.addBreadcrumb({\n type: 'error',\n category: 'router.error',\n message: error.message,\n level: 'error',\n });\n\n ErrorExplorer.captureException(error, {\n tags: {\n 'router.error': 'unhandled',\n },\n });\n });\n\n // Return cleanup function\n return () => {\n beforeEachGuard();\n afterEachGuard();\n errorHandler();\n };\n}\n\n/**\n * Create a Vue Router plugin that integrates with Error Explorer\n */\nexport function createRouterIntegration(options: RouterIntegrationOptions = {}) {\n let cleanup: (() => void) | null = null;\n\n return {\n /**\n * Install the router integration\n */\n install(router: Router): void {\n cleanup = setupRouterIntegration(router, options);\n },\n\n /**\n * Uninstall the router integration\n */\n uninstall(): void {\n if (cleanup) {\n cleanup();\n cleanup = null;\n }\n },\n };\n}\n\nexport type { Router, RouteLocationNormalized };\n","/**\n * ErrorBoundary component for Vue 3\n * Catches errors in child components and reports them to Error Explorer\n */\n\nimport {\n defineComponent,\n h,\n ref,\n onErrorCaptured,\n type PropType,\n type VNode,\n type Slot,\n} from 'vue';\nimport { ErrorExplorer } from '@error-explorer/browser';\n\n/**\n * ErrorBoundary component\n *\n * Usage:\n * ```vue\n * <ErrorBoundary @error=\"handleError\" :fallback=\"ErrorFallback\">\n * <MyComponent />\n * </ErrorBoundary>\n * ```\n *\n * Or with scoped slot for fallback:\n * ```vue\n * <ErrorBoundary>\n * <template #default>\n * <MyComponent />\n * </template>\n * <template #fallback=\"{ error, reset }\">\n * <div>\n * <p>Error: {{ error.message }}</p>\n * <button @click=\"reset\">Retry</button>\n * </div>\n * </template>\n * </ErrorBoundary>\n * ```\n */\nexport const ErrorBoundary = defineComponent({\n name: 'ErrorBoundary',\n\n props: {\n /**\n * Whether to capture the error to Error Explorer\n */\n capture: {\n type: Boolean,\n default: true,\n },\n\n /**\n * Additional tags to add when capturing\n */\n tags: {\n type: Object as PropType<Record<string, string>>,\n default: () => ({}),\n },\n\n /**\n * Additional context to add when capturing\n */\n context: {\n type: Object as PropType<Record<string, unknown>>,\n default: () => ({}),\n },\n\n /**\n * Fallback component to render when an error occurs\n */\n fallback: {\n type: [Object, Function, null] as PropType<VNode | (() => VNode) | null>,\n default: null,\n },\n\n /**\n * Whether to stop error propagation\n */\n stopPropagation: {\n type: Boolean,\n default: true,\n },\n },\n\n emits: {\n /**\n * Emitted when an error is caught\n */\n error: (error: Error, info: string) => true,\n\n /**\n * Emitted when the error state is reset\n */\n reset: () => true,\n },\n\n setup(props, { slots, emit, expose }) {\n const error = ref<Error | null>(null);\n const errorInfo = ref<string>('');\n\n /**\n * Reset the error state\n */\n const reset = () => {\n error.value = null;\n errorInfo.value = '';\n emit('reset');\n };\n\n // Capture errors from child components\n onErrorCaptured((err: unknown, instance, info: string) => {\n const capturedError = err instanceof Error ? err : new Error(String(err));\n\n error.value = capturedError;\n errorInfo.value = info;\n\n // Emit error event\n emit('error', capturedError, info);\n\n // Add breadcrumb\n ErrorExplorer.addBreadcrumb({\n type: 'error',\n category: 'vue.errorBoundary',\n message: capturedError.message,\n level: 'error',\n data: {\n info,\n component: instance?.$.type\n ? (instance.$.type as { name?: string }).name\n : undefined,\n },\n });\n\n // Capture to Error Explorer if enabled\n if (props.capture) {\n ErrorExplorer.captureException(capturedError, {\n tags: {\n 'errorBoundary': 'true',\n 'vue.info': info,\n ...props.tags,\n },\n extra: {\n errorBoundary: {\n info,\n context: props.context,\n },\n },\n });\n }\n\n // Return true to stop propagation, false to continue\n return props.stopPropagation;\n });\n\n // Expose methods and state\n expose({\n reset,\n error,\n });\n\n return () => {\n // If there's an error, render fallback\n if (error.value) {\n // Check for fallback slot\n if (slots.fallback) {\n return slots.fallback({\n error: error.value,\n info: errorInfo.value,\n reset,\n });\n }\n\n // Check for fallback prop\n if (props.fallback) {\n if (typeof props.fallback === 'function') {\n return props.fallback();\n }\n return props.fallback;\n }\n\n // Default fallback\n return h('div', { class: 'error-boundary-fallback' }, [\n h('p', { style: 'color: red;' }, `Error: ${error.value.message}`),\n h(\n 'button',\n {\n onClick: reset,\n style: 'margin-top: 8px; padding: 4px 12px; cursor: pointer;',\n },\n 'Try Again'\n ),\n ]);\n }\n\n // No error, render default slot\n return slots.default?.();\n };\n },\n});\n\n/**\n * Higher-order component to wrap a component with ErrorBoundary\n */\nexport function withErrorBoundary<T extends { new (): any }>(\n Component: T,\n options: {\n capture?: boolean;\n tags?: Record<string, string>;\n context?: Record<string, unknown>;\n fallback?: VNode | (() => VNode);\n onError?: (error: Error, info: string) => void;\n } = {}\n) {\n return defineComponent({\n name: `WithErrorBoundary(${(Component as any).name || 'Component'})`,\n\n setup(_, { attrs, slots }) {\n return () =>\n h(\n ErrorBoundary,\n {\n capture: options.capture ?? true,\n tags: options.tags ?? {},\n context: options.context ?? {},\n fallback: options.fallback ?? null,\n onError: options.onError,\n },\n {\n default: () => h(Component as any, attrs, slots),\n }\n );\n },\n });\n}\n\nexport type ErrorBoundaryInstance = InstanceType<typeof ErrorBoundary>;\n","/**\n * Vue 3 Composables for Error Explorer\n */\n\nimport { inject, onMounted, onUnmounted, getCurrentInstance } from 'vue';\nimport { ErrorExplorer } from '@error-explorer/browser';\nimport type { Breadcrumb, CaptureContext, UserContext } from '@error-explorer/browser';\n\n/**\n * Injection key for Error Explorer\n */\nexport const ErrorExplorerKey = Symbol('errorExplorer');\n\n/**\n * Use Error Explorer instance\n *\n * @example\n * ```ts\n * const { captureException, addBreadcrumb } = useErrorExplorer();\n *\n * try {\n * await riskyOperation();\n * } catch (error) {\n * captureException(error);\n * }\n * ```\n */\nexport function useErrorExplorer() {\n // Try to get from injection (if using plugin)\n const injected = inject<typeof ErrorExplorer | null>(ErrorExplorerKey, null) ||\n inject<typeof ErrorExplorer | null>('errorExplorer', null);\n\n // Fall back to singleton\n const errorExplorer = injected || ErrorExplorer;\n\n return {\n /**\n * Check if Error Explorer is initialized\n */\n isInitialized: () => errorExplorer.isInitialized(),\n\n /**\n * Capture an exception\n */\n captureException: (error: Error, context?: CaptureContext) =>\n errorExplorer.captureException(error, context),\n\n /**\n * Capture a message\n */\n captureMessage: (message: string, level?: 'debug' | 'info' | 'warning' | 'error' | 'critical') =>\n errorExplorer.captureMessage(message, level),\n\n /**\n * Add a breadcrumb\n */\n addBreadcrumb: (breadcrumb: Breadcrumb) =>\n errorExplorer.addBreadcrumb(breadcrumb),\n\n /**\n * Set user context\n */\n setUser: (user: UserContext) => errorExplorer.setUser(user),\n\n /**\n * Clear user context\n */\n clearUser: () => errorExplorer.clearUser(),\n\n /**\n * Set a tag\n */\n setTag: (key: string, value: string) => errorExplorer.setTag(key, value),\n\n /**\n * Set multiple tags\n */\n setTags: (tags: Record<string, string>) => errorExplorer.setTags(tags),\n\n /**\n * Set extra context\n */\n setExtra: (extra: Record<string, unknown>) => errorExplorer.setExtra(extra),\n\n /**\n * Set named context\n */\n setContext: (name: string, context: Record<string, unknown>) =>\n errorExplorer.setContext(name, context),\n\n /**\n * Flush pending events\n */\n flush: (timeout?: number) => errorExplorer.flush(timeout),\n\n /**\n * Close the SDK\n */\n close: (timeout?: number) => errorExplorer.close(timeout),\n };\n}\n\n/**\n * Track component lifecycle for debugging\n *\n * @example\n * ```ts\n * // In setup()\n * useComponentBreadcrumbs();\n * ```\n */\nexport function useComponentBreadcrumbs() {\n const instance = getCurrentInstance();\n const componentName = instance?.type\n ? (instance.type as { name?: string; __name?: string }).name ||\n (instance.type as { __name?: string }).__name ||\n 'Unknown'\n : 'Unknown';\n\n onMounted(() => {\n ErrorExplorer.addBreadcrumb({\n type: 'debug',\n category: 'vue.lifecycle',\n message: `${componentName} mounted`,\n level: 'debug',\n });\n });\n\n onUnmounted(() => {\n ErrorExplorer.addBreadcrumb({\n type: 'debug',\n category: 'vue.lifecycle',\n message: `${componentName} unmounted`,\n level: 'debug',\n });\n });\n}\n\n/**\n * Create a breadcrumb tracker for user actions\n *\n * @example\n * ```ts\n * const { trackAction } = useActionTracker();\n *\n * const handleClick = () => {\n * trackAction('button_clicked', { buttonId: 'submit' });\n * // ... actual handler\n * };\n * ```\n */\nexport function useActionTracker() {\n const instance = getCurrentInstance();\n const componentName = instance?.type\n ? (instance.type as { name?: string; __name?: string }).name ||\n (instance.type as { __name?: string }).__name ||\n 'Unknown'\n : 'Unknown';\n\n return {\n /**\n * Track a user action\n */\n trackAction: (action: string, data?: Record<string, unknown>) => {\n ErrorExplorer.addBreadcrumb({\n type: 'user-action',\n category: 'action',\n message: action,\n level: 'info',\n data: {\n component: componentName,\n ...data,\n },\n });\n },\n\n /**\n * Track a UI interaction\n */\n trackInteraction: (element: string, action: 'click' | 'input' | 'focus' | 'blur' | 'submit', data?: Record<string, unknown>) => {\n ErrorExplorer.addBreadcrumb({\n type: 'user-action',\n category: `ui.${action}`,\n message: `${action} on ${element}`,\n level: 'info',\n data: {\n component: componentName,\n element,\n ...data,\n },\n });\n },\n };\n}\n\n/**\n * Create an error handler for async operations\n *\n * @example\n * ```ts\n * const { wrapAsync, handleError } = useErrorHandler();\n *\n * // Option 1: Wrap async function\n * const safeSubmit = wrapAsync(async () => {\n * await api.submit(data);\n * });\n *\n * // Option 2: Manual handling\n * try {\n * await riskyOperation();\n * } catch (error) {\n * handleError(error, { tags: { operation: 'risky' } });\n * }\n * ```\n */\nexport function useErrorHandler(defaultContext?: CaptureContext) {\n const instance = getCurrentInstance();\n const componentName = instance?.type\n ? (instance.type as { name?: string; __name?: string }).name ||\n (instance.type as { __name?: string }).__name ||\n 'Unknown'\n : 'Unknown';\n\n /**\n * Handle an error with context\n */\n const handleError = (error: unknown, context?: CaptureContext) => {\n const err = error instanceof Error ? error : new Error(String(error));\n\n ErrorExplorer.captureException(err, {\n ...defaultContext,\n ...context,\n tags: {\n 'vue.component': componentName,\n ...defaultContext?.tags,\n ...context?.tags,\n },\n });\n\n return err;\n };\n\n /**\n * Wrap an async function with error handling\n */\n const wrapAsync = <T extends (...args: any[]) => Promise<any>>(\n fn: T,\n context?: CaptureContext\n ): ((...args: Parameters<T>) => Promise<Awaited<ReturnType<T>> | undefined>) => {\n return async (...args: Parameters<T>) => {\n try {\n return await fn(...args);\n } catch (error) {\n handleError(error, context);\n return undefined;\n }\n };\n };\n\n /**\n * Create a try-catch wrapper that captures errors\n */\n const tryCatch = <T>(fn: () => T, context?: CaptureContext): T | undefined => {\n try {\n return fn();\n } catch (error) {\n handleError(error, context);\n return undefined;\n }\n };\n\n return {\n handleError,\n wrapAsync,\n tryCatch,\n };\n}\n\n/**\n * Set user context from a reactive source\n *\n * @example\n * ```ts\n * const user = ref({ id: '123', email: 'user@example.com' });\n * useUserContext(user);\n * ```\n */\nexport function useUserContext(user: { value: UserContext | null } | UserContext | null) {\n const setUserFromValue = (value: UserContext | null) => {\n if (value) {\n ErrorExplorer.setUser(value);\n } else {\n ErrorExplorer.clearUser();\n }\n };\n\n // Handle both refs and plain objects\n if (user && typeof user === 'object' && 'value' in user) {\n // It's a ref - cast to the expected type\n const refValue = (user as { value: UserContext | null }).value;\n setUserFromValue(refValue);\n\n // Note: We don't set up a watcher here because that would require\n // importing watch from vue, which adds complexity.\n // Users should manually call setUser when the user changes.\n } else {\n setUserFromValue(user as UserContext | null);\n }\n\n return {\n setUser: (newUser: UserContext) => ErrorExplorer.setUser(newUser),\n clearUser: () => ErrorExplorer.clearUser(),\n };\n}\n","/**\n * @error-explorer/vue\n * Error Explorer SDK for Vue.js 3 - Automatic error tracking with Vue integration\n */\n\n// Plugin\nexport { createErrorExplorerPlugin, restoreHandlers } from './plugin';\n\n// Router Integration\nexport {\n setupRouterIntegration,\n createRouterIntegration,\n type RouterIntegrationOptions,\n} from './router';\n\n// Components\nexport { ErrorBoundary, withErrorBoundary, type ErrorBoundaryInstance } from './ErrorBoundary';\n\n// Composables\nexport {\n useErrorExplorer,\n useComponentBreadcrumbs,\n useActionTracker,\n useErrorHandler,\n useUserContext,\n ErrorExplorerKey,\n} from './composables';\n\n// Types\nexport type {\n VueErrorExplorerOptions,\n VueComponentContext,\n VuePluginInstall,\n ErrorBoundaryProps,\n ErrorBoundaryExposed,\n InitOptions,\n UserContext,\n Breadcrumb,\n CaptureContext,\n} from './types';\n\n// Re-export ErrorExplorer for direct access\nexport { ErrorExplorer } from '@error-explorer/browser';\n\n// Default export is the plugin creator for convenience\nimport { createErrorExplorerPlugin } from './plugin';\nexport default createErrorExplorerPlugin;\n"]}
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,433 @@
|
|
|
1
|
+
import * as vue from 'vue';
|
|
2
|
+
import { App, ComponentPublicInstance, Plugin, PropType, VNode } from 'vue';
|
|
3
|
+
import { InitOptions, ErrorExplorer, CaptureContext, Breadcrumb, UserContext } from '@error-explorer/browser';
|
|
4
|
+
export { Breadcrumb, CaptureContext, ErrorExplorer, InitOptions, UserContext } from '@error-explorer/browser';
|
|
5
|
+
export { RouterIntegrationOptions, createRouterIntegration, setupRouterIntegration } from './router.cjs';
|
|
6
|
+
import 'vue-router';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Types for @error-explorer/vue
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Vue-specific initialization options
|
|
14
|
+
*/
|
|
15
|
+
interface VueErrorExplorerOptions extends InitOptions {
|
|
16
|
+
/**
|
|
17
|
+
* Vue application instance (optional - can be set via plugin install)
|
|
18
|
+
*/
|
|
19
|
+
app?: App;
|
|
20
|
+
/**
|
|
21
|
+
* Enable Vue error handler integration
|
|
22
|
+
* @default true
|
|
23
|
+
*/
|
|
24
|
+
vueErrorHandler?: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Enable Vue warning handler integration
|
|
27
|
+
* @default true in development, false in production
|
|
28
|
+
*/
|
|
29
|
+
vueWarnHandler?: boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Enable Vue Router integration for navigation breadcrumbs
|
|
32
|
+
* @default true
|
|
33
|
+
*/
|
|
34
|
+
router?: boolean;
|
|
35
|
+
/**
|
|
36
|
+
* Capture component name in error context
|
|
37
|
+
* @default true
|
|
38
|
+
*/
|
|
39
|
+
captureComponentName?: boolean;
|
|
40
|
+
/**
|
|
41
|
+
* Capture component props in error context (be careful with sensitive data)
|
|
42
|
+
* @default false
|
|
43
|
+
*/
|
|
44
|
+
captureComponentProps?: boolean;
|
|
45
|
+
/**
|
|
46
|
+
* Maximum depth for serializing component props
|
|
47
|
+
* @default 2
|
|
48
|
+
*/
|
|
49
|
+
propsDepth?: number;
|
|
50
|
+
/**
|
|
51
|
+
* Hook called before capturing a Vue error
|
|
52
|
+
* Return false to skip capturing
|
|
53
|
+
*/
|
|
54
|
+
beforeVueCapture?: (error: Error, instance: ComponentPublicInstance | null, info: string) => boolean;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Vue component context captured with errors
|
|
58
|
+
*/
|
|
59
|
+
interface VueComponentContext {
|
|
60
|
+
/**
|
|
61
|
+
* Component name
|
|
62
|
+
*/
|
|
63
|
+
name?: string;
|
|
64
|
+
/**
|
|
65
|
+
* Component file path (if available)
|
|
66
|
+
*/
|
|
67
|
+
file?: string;
|
|
68
|
+
/**
|
|
69
|
+
* Component props (if enabled)
|
|
70
|
+
*/
|
|
71
|
+
props?: Record<string, unknown>;
|
|
72
|
+
/**
|
|
73
|
+
* Vue error info string (e.g., "render function", "watcher callback")
|
|
74
|
+
*/
|
|
75
|
+
info?: string;
|
|
76
|
+
/**
|
|
77
|
+
* Component trace (parent hierarchy)
|
|
78
|
+
*/
|
|
79
|
+
trace?: string[];
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Vue plugin install function type
|
|
83
|
+
*/
|
|
84
|
+
type VuePluginInstall = (app: App, options?: VueErrorExplorerOptions) => void;
|
|
85
|
+
/**
|
|
86
|
+
* ErrorBoundary component props
|
|
87
|
+
*/
|
|
88
|
+
interface ErrorBoundaryProps {
|
|
89
|
+
/**
|
|
90
|
+
* Callback when an error is caught
|
|
91
|
+
*/
|
|
92
|
+
onError?: (error: Error, info: string) => void;
|
|
93
|
+
/**
|
|
94
|
+
* Whether to capture the error to Error Explorer
|
|
95
|
+
* @default true
|
|
96
|
+
*/
|
|
97
|
+
capture?: boolean;
|
|
98
|
+
/**
|
|
99
|
+
* Additional tags to add when capturing
|
|
100
|
+
*/
|
|
101
|
+
tags?: Record<string, string>;
|
|
102
|
+
/**
|
|
103
|
+
* Additional context to add when capturing
|
|
104
|
+
*/
|
|
105
|
+
context?: Record<string, unknown>;
|
|
106
|
+
/**
|
|
107
|
+
* Fallback content to render when an error occurs
|
|
108
|
+
* Can be a VNode or a render function receiving error and reset callback
|
|
109
|
+
*/
|
|
110
|
+
fallback?: unknown;
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* ErrorBoundary exposed methods
|
|
114
|
+
*/
|
|
115
|
+
interface ErrorBoundaryExposed {
|
|
116
|
+
/**
|
|
117
|
+
* Reset the error state
|
|
118
|
+
*/
|
|
119
|
+
reset: () => void;
|
|
120
|
+
/**
|
|
121
|
+
* Current error (if any)
|
|
122
|
+
*/
|
|
123
|
+
error: Error | null;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* Vue Plugin for Error Explorer
|
|
128
|
+
*/
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* Restore original handlers
|
|
132
|
+
*/
|
|
133
|
+
declare function restoreHandlers(app: App): void;
|
|
134
|
+
/**
|
|
135
|
+
* Create Vue plugin for Error Explorer
|
|
136
|
+
*/
|
|
137
|
+
declare function createErrorExplorerPlugin(options?: VueErrorExplorerOptions): Plugin;
|
|
138
|
+
declare module 'vue' {
|
|
139
|
+
interface ComponentCustomProperties {
|
|
140
|
+
$errorExplorer: typeof ErrorExplorer;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* ErrorBoundary component
|
|
146
|
+
*
|
|
147
|
+
* Usage:
|
|
148
|
+
* ```vue
|
|
149
|
+
* <ErrorBoundary @error="handleError" :fallback="ErrorFallback">
|
|
150
|
+
* <MyComponent />
|
|
151
|
+
* </ErrorBoundary>
|
|
152
|
+
* ```
|
|
153
|
+
*
|
|
154
|
+
* Or with scoped slot for fallback:
|
|
155
|
+
* ```vue
|
|
156
|
+
* <ErrorBoundary>
|
|
157
|
+
* <template #default>
|
|
158
|
+
* <MyComponent />
|
|
159
|
+
* </template>
|
|
160
|
+
* <template #fallback="{ error, reset }">
|
|
161
|
+
* <div>
|
|
162
|
+
* <p>Error: {{ error.message }}</p>
|
|
163
|
+
* <button @click="reset">Retry</button>
|
|
164
|
+
* </div>
|
|
165
|
+
* </template>
|
|
166
|
+
* </ErrorBoundary>
|
|
167
|
+
* ```
|
|
168
|
+
*/
|
|
169
|
+
declare const ErrorBoundary: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
170
|
+
/**
|
|
171
|
+
* Whether to capture the error to Error Explorer
|
|
172
|
+
*/
|
|
173
|
+
capture: {
|
|
174
|
+
type: BooleanConstructor;
|
|
175
|
+
default: boolean;
|
|
176
|
+
};
|
|
177
|
+
/**
|
|
178
|
+
* Additional tags to add when capturing
|
|
179
|
+
*/
|
|
180
|
+
tags: {
|
|
181
|
+
type: PropType<Record<string, string>>;
|
|
182
|
+
default: () => {};
|
|
183
|
+
};
|
|
184
|
+
/**
|
|
185
|
+
* Additional context to add when capturing
|
|
186
|
+
*/
|
|
187
|
+
context: {
|
|
188
|
+
type: PropType<Record<string, unknown>>;
|
|
189
|
+
default: () => {};
|
|
190
|
+
};
|
|
191
|
+
/**
|
|
192
|
+
* Fallback component to render when an error occurs
|
|
193
|
+
*/
|
|
194
|
+
fallback: {
|
|
195
|
+
type: PropType<VNode | (() => VNode) | null>;
|
|
196
|
+
default: null;
|
|
197
|
+
};
|
|
198
|
+
/**
|
|
199
|
+
* Whether to stop error propagation
|
|
200
|
+
*/
|
|
201
|
+
stopPropagation: {
|
|
202
|
+
type: BooleanConstructor;
|
|
203
|
+
default: boolean;
|
|
204
|
+
};
|
|
205
|
+
}>, () => VNode<vue.RendererNode, vue.RendererElement, {
|
|
206
|
+
[key: string]: any;
|
|
207
|
+
}> | VNode<vue.RendererNode, vue.RendererElement, {
|
|
208
|
+
[key: string]: any;
|
|
209
|
+
}>[] | undefined, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {
|
|
210
|
+
/**
|
|
211
|
+
* Emitted when an error is caught
|
|
212
|
+
*/
|
|
213
|
+
error: (error: Error, info: string) => true;
|
|
214
|
+
/**
|
|
215
|
+
* Emitted when the error state is reset
|
|
216
|
+
*/
|
|
217
|
+
reset: () => true;
|
|
218
|
+
}, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{
|
|
219
|
+
/**
|
|
220
|
+
* Whether to capture the error to Error Explorer
|
|
221
|
+
*/
|
|
222
|
+
capture: {
|
|
223
|
+
type: BooleanConstructor;
|
|
224
|
+
default: boolean;
|
|
225
|
+
};
|
|
226
|
+
/**
|
|
227
|
+
* Additional tags to add when capturing
|
|
228
|
+
*/
|
|
229
|
+
tags: {
|
|
230
|
+
type: PropType<Record<string, string>>;
|
|
231
|
+
default: () => {};
|
|
232
|
+
};
|
|
233
|
+
/**
|
|
234
|
+
* Additional context to add when capturing
|
|
235
|
+
*/
|
|
236
|
+
context: {
|
|
237
|
+
type: PropType<Record<string, unknown>>;
|
|
238
|
+
default: () => {};
|
|
239
|
+
};
|
|
240
|
+
/**
|
|
241
|
+
* Fallback component to render when an error occurs
|
|
242
|
+
*/
|
|
243
|
+
fallback: {
|
|
244
|
+
type: PropType<VNode | (() => VNode) | null>;
|
|
245
|
+
default: null;
|
|
246
|
+
};
|
|
247
|
+
/**
|
|
248
|
+
* Whether to stop error propagation
|
|
249
|
+
*/
|
|
250
|
+
stopPropagation: {
|
|
251
|
+
type: BooleanConstructor;
|
|
252
|
+
default: boolean;
|
|
253
|
+
};
|
|
254
|
+
}>> & Readonly<{
|
|
255
|
+
onError?: ((error: Error, info: string) => any) | undefined;
|
|
256
|
+
onReset?: (() => any) | undefined;
|
|
257
|
+
}>, {
|
|
258
|
+
capture: boolean;
|
|
259
|
+
tags: Record<string, string>;
|
|
260
|
+
context: Record<string, unknown>;
|
|
261
|
+
fallback: VNode<vue.RendererNode, vue.RendererElement, {
|
|
262
|
+
[key: string]: any;
|
|
263
|
+
}> | (() => VNode) | null;
|
|
264
|
+
stopPropagation: boolean;
|
|
265
|
+
}, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
|
|
266
|
+
/**
|
|
267
|
+
* Higher-order component to wrap a component with ErrorBoundary
|
|
268
|
+
*/
|
|
269
|
+
declare function withErrorBoundary<T extends {
|
|
270
|
+
new (): any;
|
|
271
|
+
}>(Component: T, options?: {
|
|
272
|
+
capture?: boolean;
|
|
273
|
+
tags?: Record<string, string>;
|
|
274
|
+
context?: Record<string, unknown>;
|
|
275
|
+
fallback?: VNode | (() => VNode);
|
|
276
|
+
onError?: (error: Error, info: string) => void;
|
|
277
|
+
}): vue.DefineComponent<{}, () => VNode<vue.RendererNode, vue.RendererElement, {
|
|
278
|
+
[key: string]: any;
|
|
279
|
+
}>, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
|
|
280
|
+
type ErrorBoundaryInstance = InstanceType<typeof ErrorBoundary>;
|
|
281
|
+
|
|
282
|
+
/**
|
|
283
|
+
* Vue 3 Composables for Error Explorer
|
|
284
|
+
*/
|
|
285
|
+
|
|
286
|
+
/**
|
|
287
|
+
* Injection key for Error Explorer
|
|
288
|
+
*/
|
|
289
|
+
declare const ErrorExplorerKey: unique symbol;
|
|
290
|
+
/**
|
|
291
|
+
* Use Error Explorer instance
|
|
292
|
+
*
|
|
293
|
+
* @example
|
|
294
|
+
* ```ts
|
|
295
|
+
* const { captureException, addBreadcrumb } = useErrorExplorer();
|
|
296
|
+
*
|
|
297
|
+
* try {
|
|
298
|
+
* await riskyOperation();
|
|
299
|
+
* } catch (error) {
|
|
300
|
+
* captureException(error);
|
|
301
|
+
* }
|
|
302
|
+
* ```
|
|
303
|
+
*/
|
|
304
|
+
declare function useErrorExplorer(): {
|
|
305
|
+
/**
|
|
306
|
+
* Check if Error Explorer is initialized
|
|
307
|
+
*/
|
|
308
|
+
isInitialized: () => boolean;
|
|
309
|
+
/**
|
|
310
|
+
* Capture an exception
|
|
311
|
+
*/
|
|
312
|
+
captureException: (error: Error, context?: CaptureContext) => string;
|
|
313
|
+
/**
|
|
314
|
+
* Capture a message
|
|
315
|
+
*/
|
|
316
|
+
captureMessage: (message: string, level?: "debug" | "info" | "warning" | "error" | "critical") => string;
|
|
317
|
+
/**
|
|
318
|
+
* Add a breadcrumb
|
|
319
|
+
*/
|
|
320
|
+
addBreadcrumb: (breadcrumb: Breadcrumb) => void;
|
|
321
|
+
/**
|
|
322
|
+
* Set user context
|
|
323
|
+
*/
|
|
324
|
+
setUser: (user: UserContext) => void;
|
|
325
|
+
/**
|
|
326
|
+
* Clear user context
|
|
327
|
+
*/
|
|
328
|
+
clearUser: () => void;
|
|
329
|
+
/**
|
|
330
|
+
* Set a tag
|
|
331
|
+
*/
|
|
332
|
+
setTag: (key: string, value: string) => void;
|
|
333
|
+
/**
|
|
334
|
+
* Set multiple tags
|
|
335
|
+
*/
|
|
336
|
+
setTags: (tags: Record<string, string>) => void;
|
|
337
|
+
/**
|
|
338
|
+
* Set extra context
|
|
339
|
+
*/
|
|
340
|
+
setExtra: (extra: Record<string, unknown>) => void;
|
|
341
|
+
/**
|
|
342
|
+
* Set named context
|
|
343
|
+
*/
|
|
344
|
+
setContext: (name: string, context: Record<string, unknown>) => void;
|
|
345
|
+
/**
|
|
346
|
+
* Flush pending events
|
|
347
|
+
*/
|
|
348
|
+
flush: (timeout?: number) => Promise<boolean>;
|
|
349
|
+
/**
|
|
350
|
+
* Close the SDK
|
|
351
|
+
*/
|
|
352
|
+
close: (timeout?: number) => Promise<boolean>;
|
|
353
|
+
};
|
|
354
|
+
/**
|
|
355
|
+
* Track component lifecycle for debugging
|
|
356
|
+
*
|
|
357
|
+
* @example
|
|
358
|
+
* ```ts
|
|
359
|
+
* // In setup()
|
|
360
|
+
* useComponentBreadcrumbs();
|
|
361
|
+
* ```
|
|
362
|
+
*/
|
|
363
|
+
declare function useComponentBreadcrumbs(): void;
|
|
364
|
+
/**
|
|
365
|
+
* Create a breadcrumb tracker for user actions
|
|
366
|
+
*
|
|
367
|
+
* @example
|
|
368
|
+
* ```ts
|
|
369
|
+
* const { trackAction } = useActionTracker();
|
|
370
|
+
*
|
|
371
|
+
* const handleClick = () => {
|
|
372
|
+
* trackAction('button_clicked', { buttonId: 'submit' });
|
|
373
|
+
* // ... actual handler
|
|
374
|
+
* };
|
|
375
|
+
* ```
|
|
376
|
+
*/
|
|
377
|
+
declare function useActionTracker(): {
|
|
378
|
+
/**
|
|
379
|
+
* Track a user action
|
|
380
|
+
*/
|
|
381
|
+
trackAction: (action: string, data?: Record<string, unknown>) => void;
|
|
382
|
+
/**
|
|
383
|
+
* Track a UI interaction
|
|
384
|
+
*/
|
|
385
|
+
trackInteraction: (element: string, action: "click" | "input" | "focus" | "blur" | "submit", data?: Record<string, unknown>) => void;
|
|
386
|
+
};
|
|
387
|
+
/**
|
|
388
|
+
* Create an error handler for async operations
|
|
389
|
+
*
|
|
390
|
+
* @example
|
|
391
|
+
* ```ts
|
|
392
|
+
* const { wrapAsync, handleError } = useErrorHandler();
|
|
393
|
+
*
|
|
394
|
+
* // Option 1: Wrap async function
|
|
395
|
+
* const safeSubmit = wrapAsync(async () => {
|
|
396
|
+
* await api.submit(data);
|
|
397
|
+
* });
|
|
398
|
+
*
|
|
399
|
+
* // Option 2: Manual handling
|
|
400
|
+
* try {
|
|
401
|
+
* await riskyOperation();
|
|
402
|
+
* } catch (error) {
|
|
403
|
+
* handleError(error, { tags: { operation: 'risky' } });
|
|
404
|
+
* }
|
|
405
|
+
* ```
|
|
406
|
+
*/
|
|
407
|
+
declare function useErrorHandler(defaultContext?: CaptureContext): {
|
|
408
|
+
handleError: (error: unknown, context?: CaptureContext) => Error;
|
|
409
|
+
wrapAsync: <T extends (...args: any[]) => Promise<any>>(fn: T, context?: CaptureContext) => ((...args: Parameters<T>) => Promise<Awaited<ReturnType<T>> | undefined>);
|
|
410
|
+
tryCatch: <T>(fn: () => T, context?: CaptureContext) => T | undefined;
|
|
411
|
+
};
|
|
412
|
+
/**
|
|
413
|
+
* Set user context from a reactive source
|
|
414
|
+
*
|
|
415
|
+
* @example
|
|
416
|
+
* ```ts
|
|
417
|
+
* const user = ref({ id: '123', email: 'user@example.com' });
|
|
418
|
+
* useUserContext(user);
|
|
419
|
+
* ```
|
|
420
|
+
*/
|
|
421
|
+
declare function useUserContext(user: {
|
|
422
|
+
value: UserContext | null;
|
|
423
|
+
} | UserContext | null): {
|
|
424
|
+
setUser: (newUser: UserContext) => void;
|
|
425
|
+
clearUser: () => void;
|
|
426
|
+
};
|
|
427
|
+
|
|
428
|
+
/**
|
|
429
|
+
* @error-explorer/vue
|
|
430
|
+
* Error Explorer SDK for Vue.js 3 - Automatic error tracking with Vue integration
|
|
431
|
+
*/
|
|
432
|
+
|
|
433
|
+
export { ErrorBoundary, type ErrorBoundaryExposed, type ErrorBoundaryInstance, type ErrorBoundaryProps, ErrorExplorerKey, type VueComponentContext, type VueErrorExplorerOptions, type VuePluginInstall, createErrorExplorerPlugin, createErrorExplorerPlugin as default, restoreHandlers, useActionTracker, useComponentBreadcrumbs, useErrorExplorer, useErrorHandler, useUserContext, withErrorBoundary };
|