The only tool you need to know what is happening and how to fix it.
Go alertingexception-trackerissue-trackinglogsmetricsmonitoringobservability-platformopen-telemetryotelsession-replaytelemetrytraces
frontend docs updated progress
ddux060d10bf5068
diff --git a/docs/components/FrameworkPicker.jsx b/docs/components/FrameworkPicker.jsxindex 0f749552..80413d4a 100644--- a/docs/components/FrameworkPicker.jsx+++ b/docs/components/FrameworkPicker.jsx@@ -44,6 +44,34 @@ const FRAMEWORKS = [icon: '/custom.png',href: '/client/sdk',},+ {+ value: 'js-react',+ label: 'React',+ description: 'React applications with error boundaries and hooks.',+ icon: '/react.svg',+ href: '/client/react',+ },+ {+ value: 'js-vue',+ label: 'Vue.js',+ description: 'Vue 3 applications with plugin and composables.',+ icon: '/vue.svg',+ href: '/client/vue',+ },+ {+ value: 'js-svelte',+ label: 'Svelte',+ description: 'Svelte/SvelteKit applications with context API.',+ icon: '/svelte.png',+ href: '/client/svelte',+ },+ {+ value: 'js-generic',+ label: 'JS Generic',+ description: 'Framework-agnostic JavaScript SDK for browsers.',+ icon: '/javascript.svg',+ href: '/client/js-sdk',+ },]export default function FrameworkPicker() {diff --git a/docs/components/SdkContext.jsx b/docs/components/SdkContext.jsxindex 5e32b827..cd17b5cc 100644--- a/docs/components/SdkContext.jsx+++ b/docs/components/SdkContext.jsx@@ -8,6 +8,10 @@ export const SDK_OPTIONS = [{ value: 'go-fasthttp', label: 'Go FastHTTP' },{ value: 'go-http', label: 'Go Http' },{ value: 'go-generic', label: 'Go Generic' },+ { value: 'js-react', label: 'React' },+ { value: 'js-vue', label: 'Vue.js' },+ { value: 'js-svelte', label: 'Svelte' },+ { value: 'js-generic', label: 'JS Generic' },]const STORAGE_KEY = 'traceway-docs-sdk'@@ -19,6 +23,10 @@ const PATH_SDK_MAP = {'fiber-middleware': 'go-fiber','fasthttp-middleware': 'go-fasthttp','http-middleware': 'go-http',+ 'react': 'js-react',+ 'vue': 'js-vue',+ 'svelte': 'js-svelte',+ 'js-sdk': 'js-generic',}const SdkContext = createContext({diff --git a/docs/components/SdkSelector.jsx b/docs/components/SdkSelector.jsxindex e0fb8d5d..c180128c 100644--- a/docs/components/SdkSelector.jsx+++ b/docs/components/SdkSelector.jsx@@ -9,6 +9,10 @@ const SDK_QUICK_START = {'go-fasthttp': '/client/fasthttp-middleware','go-http': '/client/http-middleware','go-generic': '/client/sdk',+ 'js-react': '/client/react',+ 'js-vue': '/client/vue',+ 'js-svelte': '/client/svelte',+ 'js-generic': '/client/js-sdk',}export default function SdkSelector() {diff --git a/docs/pages/client/_meta.json b/docs/pages/client/_meta.jsonindex 0f3661d5..3fb3e26b 100644--- a/docs/pages/client/_meta.json+++ b/docs/pages/client/_meta.json@@ -10,5 +10,9 @@"fiber-middleware": "Fiber Middleware","fasthttp-middleware": "FastHTTP Middleware","http-middleware": "HTTP Middleware",- "sdk": "SDK Reference"+ "sdk": "SDK Reference",+ "react": "React",+ "vue": "Vue.js",+ "svelte": "Svelte",+ "js-sdk": "JS SDK Reference"}diff --git a/docs/pages/client/js-sdk/_meta.json b/docs/pages/client/js-sdk/_meta.jsonnew file mode 100644index 00000000..6f6689ff--- /dev/null+++ b/docs/pages/client/js-sdk/_meta.json@@ -0,0 +1,7 @@+{+ "index": "Overview",+ "initialization": "Initialization",+ "exceptions": "Exceptions",+ "messages": "Messages",+ "flush": "Flush & Lifecycle"+}diff --git a/docs/pages/client/js-sdk/exceptions.mdx b/docs/pages/client/js-sdk/exceptions.mdxnew file mode 100644index 00000000..622d252a--- /dev/null+++ b/docs/pages/client/js-sdk/exceptions.mdx@@ -0,0 +1,89 @@+# Exceptions++Capture JavaScript errors and exceptions with full stack traces.++## captureException++Capture an error with its stack trace:++```javascript+import { captureException } from "@traceway/frontend";++try {+ riskyOperation();+} catch (error) {+ captureException(error);+}+```++The SDK extracts the error type, message, and stack trace automatically.++## captureExceptionWithAttributes++Capture an error with additional metadata:++```javascript+import { captureExceptionWithAttributes } from "@traceway/frontend";++try {+ processOrder(orderId);+} catch (error) {+ captureExceptionWithAttributes(error, {+ orderId: orderId,+ userId: currentUser.id,+ action: "checkout",+ });+}+```++Attributes appear as tags in the Traceway dashboard, making it easier to filter and debug issues.++## Attribute Best Practices++**Do include:**+- User identifiers (anonymized if needed)+- Request/transaction IDs+- Feature flags or A/B test variants+- Relevant business context (order ID, product ID, etc.)++**Avoid including:**+- Sensitive data (passwords, tokens, PII)+- Large objects or arrays+- Circular references++## Error Types++The SDK handles various JavaScript error types:++```javascript+// Standard Error+captureException(new Error("Something went wrong"));++// TypeError+captureException(new TypeError("Cannot read property 'x' of undefined"));++// Custom errors+class ValidationError extends Error {+ constructor(message) {+ super(message);+ this.name = "ValidationError";+ }+}+captureException(new ValidationError("Invalid email format"));+```++## Non-Error Values++If you capture a non-Error value, the SDK wraps it:++```javascript+// These work, but Error objects are preferred+captureException("Something went wrong");+captureException({ code: 500, message: "Server error" });+```++For best stack traces, always throw and catch actual `Error` objects.++## React Error Boundaries++For React applications, use the `@traceway/react` package which provides a `TracewayErrorBoundary` component that automatically captures React component errors. See the [React documentation](/client/react/error-boundary) for details.diff --git a/docs/pages/client/js-sdk/flush.mdx b/docs/pages/client/js-sdk/flush.mdxnew file mode 100644index 00000000..962d1e06--- /dev/null+++ b/docs/pages/client/js-sdk/flush.mdx@@ -0,0 +1,114 @@+# Flush & Lifecycle++Understanding the SDK's batching behavior and how to control it.++## Batching Behavior++The Traceway SDK batches events to reduce network overhead:++1. Events are collected in memory+2. After `debounceMs` (default: 1500ms) of no new events, the batch is sent+3. If an upload fails, it retries after `retryDelayMs` (default: 10000ms)++This means events are not sent immediately. For most applications, this is the desired behavior.++## flush()++Force-send all pending events immediately:++```javascript+import { flush } from "@traceway/frontend";++// Send all pending events now+await flush();+```++## When to Use flush()++### Before Page Unload++```javascript+window.addEventListener("beforeunload", () => {+ flush();+});+```++Note: Due to browser limitations, `flush()` during `beforeunload` may not always complete. Use the [Beacon API](https://developer.mozilla.org/en-US/docs/Web/API/Beacon_API) pattern if critical events must be sent.++### After Critical Errors++```javascript+try {+ criticalOperation();+} catch (error) {+ captureException(error);+ await flush(); // Ensure this error is sent immediately+ showErrorPage();+}+```++### Before Redirects++```javascript+async function handleLogout() {+ captureMessage("User logged out");+ await flush(); // Send before redirect+ window.location.href = "/login";+}+```++### In Tests++```javascript+it("should capture errors", async () => {+ captureException(new Error("Test error"));+ await flush(); // Ensure event is sent before assertions+ // ... verify event was received+});+```++## Lifecycle Considerations++### Single Page Applications (SPAs)++For SPAs, initialize once at app startup. The SDK handles batching across route changes automatically.++```javascript+// main.js or index.js+import { init } from "@traceway/frontend";++init("your-token@https://traceway.example.com/api/report");+```++### Server-Side Rendering (SSR)++The SDK is browser-only. For SSR frameworks:++```javascript+// Only initialize on client+if (typeof window !== "undefined") {+ init("your-token@https://traceway.example.com/api/report");+}+```++Or use framework-specific packages that handle this automatically.++## Tuning Batching++Adjust timing based on your needs:++```javascript+init("your-token@...", {+ // Faster batching for critical apps+ debounceMs: 500,+ retryDelayMs: 5000,+});+```++```javascript+init("your-token@...", {+ // More aggressive batching for high-traffic apps+ debounceMs: 3000,+ retryDelayMs: 15000,+});+```diff --git a/docs/pages/client/js-sdk/index.mdx b/docs/pages/client/js-sdk/index.mdxnew file mode 100644index 00000000..b93b2a0a--- /dev/null+++ b/docs/pages/client/js-sdk/index.mdx@@ -0,0 +1,79 @@+# JS SDK Overview++The Traceway JavaScript SDK provides error tracking for browser-based applications. It captures exceptions, messages, and sends them to your Traceway backend.++## Packages++| Package | Description |+|---------|-------------|+| `@traceway/frontend` | Core browser SDK (framework-agnostic) |+| `@traceway/react` | React bindings with Provider, Error Boundary, and hooks |+| `@traceway/vue` | Vue 3 plugin and composables |+| `@traceway/svelte` | Svelte context-based integration |++## Installation++```bash+npm install @traceway/frontend+```++Or use a framework-specific package:++```bash+npm install @traceway/react+npm install @traceway/vue+npm install @traceway/svelte+```++## Connection String Format++All Traceway SDKs use a connection string to identify your project and endpoint:++```+<project_token>@<server_url>/api/report+```++Example:+```+abc123def456@https://traceway.example.com/api/report+```++You can find your connection string in the Traceway dashboard under **Project Settings**.++## When to Use++Use the generic `@traceway/frontend` package when:++- You're using a framework without official bindings+- You need direct control over initialization+- You're building a vanilla JavaScript application+- You want to integrate with a custom framework++For React, Vue, or Svelte applications, use the framework-specific packages for better integration and developer experience.++## Basic Usage++```javascript+import { init, captureException, captureMessage } from "@traceway/frontend";++// Initialize once at app startup+init("your-token@https://traceway.example.com/api/report");++// Capture errors+try {+ riskyOperation();+} catch (error) {+ captureException(error);+}++// Capture custom messages+captureMessage("User completed checkout");+```++## Features++- **Automatic batching**: Events are batched and sent periodically to reduce network overhead+- **Retry with backoff**: Failed uploads are automatically retried+- **Stack trace capture**: Full stack traces are captured for exceptions+- **Custom attributes**: Attach metadata to exceptions for better debugging+- **Lightweight**: Minimal bundle size impactdiff --git a/docs/pages/client/js-sdk/initialization.mdx b/docs/pages/client/js-sdk/initialization.mdxnew file mode 100644index 00000000..101d3a82--- /dev/null+++ b/docs/pages/client/js-sdk/initialization.mdx@@ -0,0 +1,77 @@+# Initialization++Initialize the Traceway SDK once at application startup, before capturing any events.++## Basic Initialization++```javascript+import { init } from "@traceway/frontend";++init("your-token@https://traceway.example.com/api/report");+```++## With Options++```javascript+import { init } from "@traceway/frontend";++init("your-token@https://traceway.example.com/api/report", {+ debug: true,+ version: "1.2.3",+ debounceMs: 2000,+});+```++## Options Reference++| Option | Type | Default | Description |+|--------|------|---------|-------------|+| `debug` | `boolean` | `false` | Log captured events to the browser console |+| `debounceMs` | `number` | `1500` | Milliseconds to wait before sending batched events |+| `retryDelayMs` | `number` | `10000` | Milliseconds to wait before retrying failed uploads |+| `version` | `string` | `undefined` | Your application version (shown in Traceway dashboard) |++## Auto-Capture Behavior++By default, the SDK does **not** automatically capture unhandled errors. You need to either:++1. Use a framework integration (React, Vue, Svelte) that provides automatic capture+2. Set up your own global error handler:++```javascript+import { init, captureException } from "@traceway/frontend";++init("your-token@https://traceway.example.com/api/report");++// Capture unhandled errors+window.addEventListener("error", (event) => {+ captureException(event.error);+});++// Capture unhandled promise rejections+window.addEventListener("unhandledrejection", (event) => {+ captureException(event.reason);+});+```++## Debug Mode++When `debug: true` is set, the SDK logs all captured events to the browser console. This is useful during development to verify events are being captured correctly.++```javascript+init("your-token@https://traceway.example.com/api/report", {+ debug: process.env.NODE_ENV === "development",+});+```++## Multiple Environments++For different environments, use separate project tokens:++```javascript+const connectionString = process.env.NODE_ENV === "production"+ ? "prod-token@https://traceway.example.com/api/report"+ : "dev-token@https://traceway.example.com/api/report";++init(connectionString);+```diff --git a/docs/pages/client/js-sdk/messages.mdx b/docs/pages/client/js-sdk/messages.mdxnew file mode 100644index 00000000..e3a3f584--- /dev/null+++ b/docs/pages/client/js-sdk/messages.mdx@@ -0,0 +1,71 @@+# Messages++Send custom log messages to Traceway for tracking non-error events.++## captureMessage++Send a simple text message:++```javascript+import { captureMessage } from "@traceway/frontend";++// Track important events+captureMessage("User completed onboarding");++// Track business metrics+captureMessage("Payment processed successfully");++// Track navigation+captureMessage("User visited pricing page");+```++## Use Cases++### User Actions++```javascript+function handlePurchase(product) {+ captureMessage(`Purchase: ${product.name}`);+ // ... process purchase+}+```++### Feature Usage++```javascript+function enableBetaFeature(featureName) {+ captureMessage(`Beta feature enabled: ${featureName}`);+ // ... enable feature+}+```++### Debugging Production Issues++```javascript+function processData(data) {+ if (data.items.length > 1000) {+ captureMessage(`Large dataset processed: ${data.items.length} items`);+ }+ // ... process data+}+```++## Messages vs Exceptions++| Use `captureMessage` when | Use `captureException` when |+|---------------------------|----------------------------|+| Tracking user actions | An error occurred |+| Logging business events | Catching exceptions |+| Debugging production flows | Something unexpected happened |+| Monitoring feature usage | Operation failed |++## Best Practices++1. **Be concise**: Messages should be short and descriptive+2. **Include context**: Add relevant identifiers when helpful+3. **Avoid sensitive data**: Never include passwords, tokens, or PII+4. **Use sparingly**: Messages add overhead; don't log every action++## Viewing Messages++Messages appear in the Traceway dashboard alongside exceptions. You can filter by message type to see only messages or only exceptions.diff --git a/docs/pages/client/react/_meta.json b/docs/pages/client/react/_meta.jsonnew file mode 100644index 00000000..77409708--- /dev/null+++ b/docs/pages/client/react/_meta.json@@ -0,0 +1,6 @@+{+ "index": "Quick Start",+ "provider": "TracewayProvider",+ "error-boundary": "Error Boundary",+ "hooks": "Hooks"+}diff --git a/docs/pages/client/react/error-boundary.mdx b/docs/pages/client/react/error-boundary.mdxnew file mode 100644index 00000000..66708801--- /dev/null+++ b/docs/pages/client/react/error-boundary.mdx@@ -0,0 +1,159 @@+# Error Boundary++The `TracewayErrorBoundary` component catches React errors and reports them to Traceway.++## Basic Usage++```jsx+import { TracewayErrorBoundary } from "@traceway/react";++function App() {+ return (+ <TracewayErrorBoundary fallback={<ErrorPage />}>+ <YourApp />+ </TracewayErrorBoundary>+ );+}++function ErrorPage() {+ return (+ <div>+ <h1>Something went wrong</h1>+ <p>Please refresh the page or try again later.</p>+ </div>+ );+}+```++## Props++| Prop | Type | Required | Description |+|------|------|----------|-------------|+| `children` | `ReactNode` | Yes | Components to wrap |+| `fallback` | `ReactNode` | Yes | UI to show when an error occurs |+| `onError` | `function` | No | Callback when error is caught |++## With onError Callback++```jsx+<TracewayErrorBoundary+ fallback={<ErrorPage />}+ onError={(error, errorInfo) => {+ console.error("Error caught:", error);+ console.error("Component stack:", errorInfo.componentStack);+ }}+>+ <YourApp />+</TracewayErrorBoundary>+```++## Nested Error Boundaries++Use multiple error boundaries to isolate failures:++```jsx+function App() {+ return (+ <TracewayErrorBoundary fallback={<FullPageError />}>+ <Header />+ <main>+ <TracewayErrorBoundary fallback={<SidebarError />}>+ <Sidebar />+ </TracewayErrorBoundary>+ <TracewayErrorBoundary fallback={<ContentError />}>+ <MainContent />+ </TracewayErrorBoundary>+ </main>+ </TracewayErrorBoundary>+ );+}+```++If `Sidebar` throws, only the sidebar shows an error; the rest of the app continues working.++## Fallback with Error Details++```jsx+function ErrorFallback({ error }) {+ return (+ <div className="error-container">+ <h2>Oops! Something went wrong</h2>+ {process.env.NODE_ENV === "development" && (+ <pre>{error.message}</pre>+ )}+ <button onClick={() => window.location.reload()}>+ Reload Page+ </button>+ </div>+ );+}++// Note: To receive error in fallback, use a custom error boundary+// that passes error to the fallback component+```++## What Gets Caught++Error boundaries catch:+- Errors in render methods+- Errors in lifecycle methods+- Errors in constructors of child components++Error boundaries do **not** catch:+- Event handlers (use try/catch and `captureException`)+- Async code (use try/catch and `captureException`)+- Server-side rendering errors+- Errors in the error boundary itself++## Event Handler Errors++For event handlers, use `useTraceway`:++```jsx+import { useTraceway } from "@traceway/react";++function Button() {+ const { captureException } = useTraceway();++ function handleClick() {+ try {+ doSomethingRisky();+ } catch (error) {+ captureException(error);+ // Show user-friendly error+ }+ }++ return <button onClick={handleClick}>Click me</button>;+}+```++## Reset Error Boundary++To allow users to retry after an error:++```jsx+import { useState } from "react";++function App() {+ const [key, setKey] = useState(0);++ return (+ <TracewayErrorBoundary+ key={key}+ fallback={+ <div>+ <p>Something went wrong</p>+ <button onClick={() => setKey(k => k + 1)}>+ Try Again+ </button>+ </div>+ }+ >+ <YourApp />+ </TracewayErrorBoundary>+ );+}+```++Changing the `key` remounts the error boundary, clearing its error state.diff --git a/docs/pages/client/react/hooks.mdx b/docs/pages/client/react/hooks.mdxnew file mode 100644index 00000000..c1f20a1f--- /dev/null+++ b/docs/pages/client/react/hooks.mdx@@ -0,0 +1,168 @@+# Hooks++Use the `useTraceway` hook to capture errors and messages in your React components.++## useTraceway++```jsx+import { useTraceway } from "@traceway/react";++function MyComponent() {+ const { captureException, captureExceptionWithAttributes, captureMessage } = useTraceway();++ // Use these functions as needed+}+```++## Return Value++| Function | Description |+|----------|-------------|+| `captureException(error)` | Capture an error with stack trace |+| `captureExceptionWithAttributes(error, attributes)` | Capture an error with metadata |+| `captureMessage(message)` | Send a custom message |++## captureException++Capture errors in event handlers or async code:++```jsx+function SubmitButton() {+ const { captureException } = useTraceway();++ async function handleSubmit() {+ try {+ await submitForm();+ } catch (error) {+ captureException(error);+ showErrorToast("Submission failed");+ }+ }++ return <button onClick={handleSubmit}>Submit</button>;+}+```++## captureExceptionWithAttributes++Add context to errors for easier debugging:++```jsx+function UserProfile({ userId }) {+ const { captureExceptionWithAttributes } = useTraceway();++ async function loadProfile() {+ try {+ const profile = await fetchProfile(userId);+ setProfile(profile);+ } catch (error) {+ captureExceptionWithAttributes(error, {+ userId,+ action: "loadProfile",+ timestamp: Date.now(),+ });+ }+ }++ // ...+}+```++## captureMessage++Track non-error events:++```jsx+function CheckoutButton({ cart }) {+ const { captureMessage } = useTraceway();++ function handleCheckout() {+ captureMessage(`Checkout started: ${cart.items.length} items`);+ startCheckout(cart);+ }++ return <button onClick={handleCheckout}>Checkout</button>;+}+```++## Custom Hook Example++Create a wrapper hook for common patterns:++```jsx+// hooks/useTrackedAsync.js+import { useTraceway } from "@traceway/react";+import { useState, useCallback } from "react";++export function useTrackedAsync(asyncFn, context = {}) {+ const { captureExceptionWithAttributes } = useTraceway();+ const [loading, setLoading] = useState(false);+ const [error, setError] = useState(null);++ const execute = useCallback(async (...args) => {+ setLoading(true);+ setError(null);+ try {+ const result = await asyncFn(...args);+ return result;+ } catch (err) {+ setError(err);+ captureExceptionWithAttributes(err, context);+ throw err;+ } finally {+ setLoading(false);+ }+ }, [asyncFn, context, captureExceptionWithAttributes]);++ return { execute, loading, error };+}++// Usage+function MyComponent() {+ const { execute, loading, error } = useTrackedAsync(+ () => fetch("/api/data").then(r => r.json()),+ { component: "MyComponent" }+ );++ // ...+}+```++## Without Hook (Class Components)++For class components, use `TracewayContext`:++```jsx+import { TracewayContext } from "@traceway/react";++class MyClassComponent extends React.Component {+ static contextType = TracewayContext;++ handleError = (error) => {+ this.context.captureException(error);+ };++ render() {+ // ...+ }+}+```++## Best Practices++1. **Don't over-capture**: Only capture meaningful errors, not validation failures+2. **Add context**: Use `captureExceptionWithAttributes` when debugging info would help+3. **Handle gracefully**: Always show users a friendly message when errors occur+4. **Combine with error boundaries**: Use hooks for event handlers, boundaries for render errors++```jsx+// Good pattern: graceful error handling+async function handleAction() {+ try {+ await riskyAction();+ } catch (error) {+ captureException(error);+ setErrorMessage("Action failed. Please try again.");+ }+}+```diff --git a/docs/pages/client/react/index.mdx b/docs/pages/client/react/index.mdxnew file mode 100644index 00000000..88801b49--- /dev/null+++ b/docs/pages/client/react/index.mdx@@ -0,0 +1,105 @@+# React Quick Start++Integrate Traceway into your React application with the `@traceway/react` package.++## Installation++```bash+npm install @traceway/react+```++## Setup++Wrap your application with `TracewayProvider`:++```jsx+import { TracewayProvider } from "@traceway/react";++function App() {+ return (+ <TracewayProvider connectionString="your-token@https://traceway.example.com/api/report">+ <YourApp />+ </TracewayProvider>+ );+}++export default App;+```++## Add Error Boundary++Wrap components that might throw errors:++```jsx+import { TracewayProvider, TracewayErrorBoundary } from "@traceway/react";++function App() {+ return (+ <TracewayProvider connectionString="your-token@https://traceway.example.com/api/report">+ <TracewayErrorBoundary fallback={<ErrorPage />}>+ <YourApp />+ </TracewayErrorBoundary>+ </TracewayProvider>+ );+}+```++## Capture Errors Manually++Use the `useTraceway` hook in components:++```jsx+import { useTraceway } from "@traceway/react";++function MyComponent() {+ const { captureException } = useTraceway();++ async function handleSubmit() {+ try {+ await submitForm();+ } catch (error) {+ captureException(error);+ }+ }++ return <button onClick={handleSubmit}>Submit</button>;+}+```++## With Options++```jsx+<TracewayProvider+ connectionString="your-token@https://traceway.example.com/api/report"+ options={{+ debug: true,+ version: "1.0.0",+ }}+>+ <YourApp />+</TracewayProvider>+```++## Test Your Integration++```jsx+import { useTraceway } from "@traceway/react";++function TestButton() {+ const { captureException } = useTraceway();++ return (+ <button onClick={() => captureException(new Error("Test error"))}>+ Send Test Error+ </button>+ );+}+```++Click the button and check your Traceway dashboard to verify the error appears.++## Next Steps++- [TracewayProvider](/client/react/provider) - Configuration options+- [Error Boundary](/client/react/error-boundary) - Automatic error capture+- [Hooks](/client/react/hooks) - Manual error capturediff --git a/docs/pages/client/react/provider.mdx b/docs/pages/client/react/provider.mdxnew file mode 100644index 00000000..075a92b0--- /dev/null+++ b/docs/pages/client/react/provider.mdx@@ -0,0 +1,102 @@+# TracewayProvider++The `TracewayProvider` component initializes Traceway and provides context to child components.++## Basic Usage++```jsx+import { TracewayProvider } from "@traceway/react";++function App() {+ return (+ <TracewayProvider connectionString="your-token@https://traceway.example.com/api/report">+ <YourApp />+ </TracewayProvider>+ );+}+```++## Props++| Prop | Type | Required | Description |+|------|------|----------|-------------|+| `connectionString` | `string` | Yes | Your Traceway connection string |+| `options` | `object` | No | Configuration options |+| `children` | `ReactNode` | Yes | Child components |++## Options++| Option | Type | Default | Description |+|--------|------|---------|-------------|+| `debug` | `boolean` | `false` | Log events to console |+| `debounceMs` | `number` | `1500` | Batch delay in milliseconds |+| `retryDelayMs` | `number` | `10000` | Retry delay for failed uploads |+| `version` | `string` | `undefined` | Your application version |++## Example with Options++```jsx+<TracewayProvider+ connectionString="your-token@https://traceway.example.com/api/report"+ options={{+ debug: process.env.NODE_ENV === "development",+ version: process.env.REACT_APP_VERSION,+ debounceMs: 1000,+ }}+>+ <YourApp />+</TracewayProvider>+```++## Environment-Specific Setup++```jsx+function App() {+ const connectionString = process.env.NODE_ENV === "production"+ ? process.env.REACT_APP_TRACEWAY_PROD+ : process.env.REACT_APP_TRACEWAY_DEV;++ return (+ <TracewayProvider connectionString={connectionString}>+ <YourApp />+ </TracewayProvider>+ );+}+```++## Placement++Place `TracewayProvider` as high as possible in your component tree, typically in your root `App` component or `index.js`:++```jsx+// index.js+import React from "react";+import ReactDOM from "react-dom/client";+import { TracewayProvider } from "@traceway/react";+import App from "./App";++const root = ReactDOM.createRoot(document.getElementById("root"));+root.render(+ <React.StrictMode>+ <TracewayProvider connectionString="your-token@...">+ <App />+ </TracewayProvider>+ </React.StrictMode>+);+```++## TracewayContext++For advanced use cases, you can access the context directly:++```jsx+import { TracewayContext } from "@traceway/react";+import { useContext } from "react";++function MyComponent() {+ const traceway = useContext(TracewayContext);+ // Use traceway.captureException, etc.+}+```++However, the `useTraceway` hook is preferred for most use cases.diff --git a/docs/pages/client/svelte/_meta.json b/docs/pages/client/svelte/_meta.jsonnew file mode 100644index 00000000..7f444763--- /dev/null+++ b/docs/pages/client/svelte/_meta.json@@ -0,0 +1,4 @@+{+ "index": "Quick Start",+ "context": "Context Setup"+}diff --git a/docs/pages/client/svelte/context.mdx b/docs/pages/client/svelte/context.mdxnew file mode 100644index 00000000..ff0c22b5--- /dev/null+++ b/docs/pages/client/svelte/context.mdx@@ -0,0 +1,218 @@+# Context Setup++Understanding Traceway's Svelte context integration.++## How It Works++Traceway uses Svelte's context API to provide error capture functions to your component tree:++1. `setupTraceway()` initializes the SDK and sets context+2. `getTraceway()` retrieves the context in child components++## setupTraceway++Must be called during component initialization (not in an event handler):++```svelte+<script>+ import { setupTraceway } from "@traceway/svelte";++ // Correct: called at component initialization+ setupTraceway({+ connectionString: "your-token@https://traceway.example.com/api/report",+ });+</script>+```++### Options++| Option | Type | Required | Description |+|--------|------|----------|-------------|+| `connectionString` | `string` | Yes | Your Traceway connection string |+| `options` | `object` | No | SDK configuration |++### SDK Options++| Option | Type | Default | Description |+|--------|------|---------|-------------|+| `debug` | `boolean` | `false` | Log events to console |+| `debounceMs` | `number` | `1500` | Batch delay in milliseconds |+| `retryDelayMs` | `number` | `10000` | Retry delay for failed uploads |+| `version` | `string` | `undefined` | Your application version |++## getTraceway++Retrieve capture functions in any child component:++```svelte+<script>+ import { getTraceway } from "@traceway/svelte";++ const { captureException, captureExceptionWithAttributes, captureMessage } = getTraceway();+</script>+```++### Return Value++| Function | Description |+|----------|-------------|+| `captureException(error)` | Capture an error with stack trace |+| `captureExceptionWithAttributes(error, attributes)` | Capture error with metadata |+| `captureMessage(message)` | Send a custom message |++## Complete Example++Root layout:++```svelte+<!-- src/routes/+layout.svelte -->+<script>+ import { setupTraceway } from "@traceway/svelte";+ import { browser } from "$app/environment";+ import { PUBLIC_TRACEWAY_CONNECTION } from "$env/static/public";++ if (browser) {+ setupTraceway({+ connectionString: PUBLIC_TRACEWAY_CONNECTION,+ options: {+ debug: import.meta.env.DEV,+ },+ });+ }+</script>++<slot />+```++Child component:++```svelte+<!-- src/lib/components/Form.svelte -->+<script>+ import { getTraceway } from "@traceway/svelte";++ const { captureException, captureExceptionWithAttributes } = getTraceway();++ let formData = { email: "", name: "" };++ async function handleSubmit() {+ try {+ const response = await fetch("/api/submit", {+ method: "POST",+ body: JSON.stringify(formData),+ });+ if (!response.ok) throw new Error("Submission failed");+ } catch (error) {+ captureExceptionWithAttributes(error, {+ email: formData.email,+ action: "form_submit",+ });+ }+ }+</script>++<form on:submit|preventDefault={handleSubmit}>+ <input bind:value={formData.name} placeholder="Name" />+ <input bind:value={formData.email} placeholder="Email" />+ <button type="submit">Submit</button>+</form>+```++## TRACEWAY_KEY++For advanced use cases, you can access the context key directly:++```svelte+<script>+ import { getContext } from "svelte";+ import { TRACEWAY_KEY } from "@traceway/svelte";++ const traceway = getContext(TRACEWAY_KEY);+</script>+```++## SvelteKit Error Handling++For SvelteKit's error handling, create a custom error hook:++```javascript+// src/hooks.client.js+import { getTraceway } from "@traceway/svelte";++export function handleError({ error, event }) {+ // Note: Context may not be available in hooks+ // Consider using the core SDK directly here+ console.error("Unhandled error:", error);+}+```++For client-side errors, use `+error.svelte`:++```svelte+<!-- src/routes/+error.svelte -->+<script>+ import { page } from "$app/stores";+ import { getTraceway } from "@traceway/svelte";+ import { onMount } from "svelte";++ const { captureException } = getTraceway();++ onMount(() => {+ if ($page.error) {+ captureException($page.error);+ }+ });+</script>++<h1>Error: {$page.status}</h1>+<p>{$page.error?.message}</p>+```++## Environment Variables++For SvelteKit, use public environment variables:++```+# .env+PUBLIC_TRACEWAY_CONNECTION=your-token@https://traceway.example.com/api/report+```++```svelte+<script>+ import { PUBLIC_TRACEWAY_CONNECTION } from "$env/static/public";++ setupTraceway({+ connectionString: PUBLIC_TRACEWAY_CONNECTION,+ });+</script>+```++## Best Practices++1. **Initialize early**: Call `setupTraceway` in your root layout+2. **Check for browser**: In SvelteKit, only initialize on the client+3. **Use attributes**: Add context with `captureExceptionWithAttributes`+4. **Handle gracefully**: Show user-friendly errors while capturing details++```svelte+<script>+ import { getTraceway } from "@traceway/svelte";++ const { captureException } = getTraceway();+ let error = null;++ async function loadData() {+ try {+ const data = await fetchData();+ // use data+ } catch (e) {+ captureException(e);+ error = "Failed to load data. Please try again.";+ }+ }+</script>++{#if error}+ <p class="error">{error}</p>+{/if}+```diff --git a/docs/pages/client/svelte/index.mdx b/docs/pages/client/svelte/index.mdxnew file mode 100644index 00000000..0b9ac8fe--- /dev/null+++ b/docs/pages/client/svelte/index.mdx@@ -0,0 +1,108 @@+# Svelte Quick Start++Integrate Traceway into your Svelte or SvelteKit application with the `@traceway/svelte` package.++## Installation++```bash+npm install @traceway/svelte+```++## Setup++Call `setupTraceway` in your root component (e.g., `+layout.svelte` for SvelteKit):++```svelte+<script>+ import { setupTraceway } from "@traceway/svelte";++ setupTraceway({+ connectionString: "your-token@https://traceway.example.com/api/report",+ });+</script>++<slot />+```++## Capture Errors in Components++Use `getTraceway` in child components:++```svelte+<script>+ import { getTraceway } from "@traceway/svelte";++ const { captureException } = getTraceway();++ async function handleSubmit() {+ try {+ await submitForm();+ } catch (error) {+ captureException(error);+ }+ }+</script>++<button on:click={handleSubmit}>Submit</button>+```++## With Options++```svelte+<script>+ import { setupTraceway } from "@traceway/svelte";++ setupTraceway({+ connectionString: "your-token@https://traceway.example.com/api/report",+ options: {+ debug: true,+ version: "1.0.0",+ },+ });+</script>++<slot />+```++## Test Your Integration++```svelte+<script>+ import { getTraceway } from "@traceway/svelte";++ const { captureException } = getTraceway();++ function sendTestError() {+ captureException(new Error("Test error from Svelte"));+ }+</script>++<button on:click={sendTestError}>Send Test Error</button>+```++Click the button and check your Traceway dashboard to verify the error appears.++## SvelteKit Setup++For SvelteKit, set up Traceway in your root layout:++```svelte+<!-- src/routes/+layout.svelte -->+<script>+ import { setupTraceway } from "@traceway/svelte";+ import { browser } from "$app/environment";++ // Only initialize on client+ if (browser) {+ setupTraceway({+ connectionString: "your-token@https://traceway.example.com/api/report",+ });+ }+</script>++<slot />+```++## Next Steps++- [Context Setup](/client/svelte/context) - Configuration and advanced usagediff --git a/docs/pages/client/vue/_meta.json b/docs/pages/client/vue/_meta.jsonnew file mode 100644index 00000000..25838a64--- /dev/null+++ b/docs/pages/client/vue/_meta.json@@ -0,0 +1,5 @@+{+ "index": "Quick Start",+ "plugin": "Plugin Setup",+ "composables": "Composables"+}diff --git a/docs/pages/client/vue/composables.mdx b/docs/pages/client/vue/composables.mdxnew file mode 100644index 00000000..7ce9a056--- /dev/null+++ b/docs/pages/client/vue/composables.mdx@@ -0,0 +1,199 @@+# Composables++Use the `useTraceway` composable to capture errors and messages in Vue components.++## useTraceway++```vue+<script setup>+import { useTraceway } from "@traceway/vue";++const { captureException, captureExceptionWithAttributes, captureMessage } = useTraceway();+</script>+```++## Return Value++| Function | Description |+|----------|-------------|+| `captureException(error)` | Capture an error with stack trace |+| `captureExceptionWithAttributes(error, attributes)` | Capture an error with metadata |+| `captureMessage(message)` | Send a custom message |++## captureException++Capture errors in event handlers or async functions:++```vue+<script setup>+import { useTraceway } from "@traceway/vue";++const { captureException } = useTraceway();++async function handleSubmit() {+ try {+ await submitForm();+ } catch (error) {+ captureException(error);+ showErrorNotification("Submission failed");+ }+}+</script>++<template>+ <button @click="handleSubmit">Submit</button>+</template>+```++## captureExceptionWithAttributes++Add context to errors:++```vue+<script setup>+import { useTraceway } from "@traceway/vue";++const props = defineProps(['userId']);+const { captureExceptionWithAttributes } = useTraceway();++async function loadData() {+ try {+ const data = await fetchUserData(props.userId);+ // ...+ } catch (error) {+ captureExceptionWithAttributes(error, {+ userId: props.userId,+ action: "loadUserData",+ });+ }+}+</script>+```++## captureMessage++Track non-error events:++```vue+<script setup>+import { useTraceway } from "@traceway/vue";++const { captureMessage } = useTraceway();++function handleCheckout() {+ captureMessage("User started checkout");+ router.push("/checkout");+}+</script>++<template>+ <button @click="handleCheckout">Proceed to Checkout</button>+</template>+```++## Composable Pattern++Create reusable async handlers:++```javascript+// composables/useTrackedFetch.js+import { ref } from "vue";+import { useTraceway } from "@traceway/vue";++export function useTrackedFetch(url, context = {}) {+ const { captureExceptionWithAttributes } = useTraceway();+ const data = ref(null);+ const error = ref(null);+ const loading = ref(false);++ async function execute() {+ loading.value = true;+ error.value = null;+ try {+ const response = await fetch(url);+ data.value = await response.json();+ } catch (err) {+ error.value = err;+ captureExceptionWithAttributes(err, {+ url,+ ...context,+ });+ } finally {+ loading.value = false;+ }+ }++ return { data, error, loading, execute };+}+```++Usage:++```vue+<script setup>+import { useTrackedFetch } from "@/composables/useTrackedFetch";++const { data, error, loading, execute } = useTrackedFetch(+ "/api/users",+ { component: "UserList" }+);++onMounted(execute);+</script>+```++## Options API++For Options API components, use `inject`:++```vue+<script>+import { TracewayKey } from "@traceway/vue";++export default {+ inject: {+ traceway: { from: TracewayKey },+ },+ methods: {+ handleError(error) {+ this.traceway.captureException(error);+ },+ },+};+</script>+```++## Error Handling Best Practices++```vue+<script setup>+import { useTraceway } from "@traceway/vue";+import { ref } from "vue";++const { captureException } = useTraceway();+const errorMessage = ref("");++async function handleAction() {+ errorMessage.value = "";+ try {+ await performAction();+ } catch (error) {+ // 1. Capture for monitoring+ captureException(error);++ // 2. Show user-friendly message+ errorMessage.value = "Action failed. Please try again.";++ // 3. Optionally rethrow for error boundaries+ // throw error;+ }+}+</script>++<template>+ <div>+ <button @click="handleAction">Perform Action</button>+ <p v-if="errorMessage" class="error">{{ errorMessage }}</p>+ </div>+</template>+```diff --git a/docs/pages/client/vue/index.mdx b/docs/pages/client/vue/index.mdxnew file mode 100644index 00000000..04737624--- /dev/null+++ b/docs/pages/client/vue/index.mdx@@ -0,0 +1,90 @@+# Vue Quick Start++Integrate Traceway into your Vue 3 application with the `@traceway/vue` package.++## Installation++```bash+npm install @traceway/vue+```++## Setup++Install the Traceway plugin in your Vue application:++```javascript+import { createApp } from "vue";+import { createTracewayPlugin } from "@traceway/vue";+import App from "./App.vue";++const app = createApp(App);++app.use(createTracewayPlugin({+ connectionString: "your-token@https://traceway.example.com/api/report",+}));++app.mount("#app");+```++The plugin automatically installs a global error handler that captures uncaught errors.++## Capture Errors in Components++Use the `useTraceway` composable:++```vue+<script setup>+import { useTraceway } from "@traceway/vue";++const { captureException } = useTraceway();++async function handleSubmit() {+ try {+ await submitForm();+ } catch (error) {+ captureException(error);+ }+}+</script>++<template>+ <button @click="handleSubmit">Submit</button>+</template>+```++## With Options++```javascript+app.use(createTracewayPlugin({+ connectionString: "your-token@https://traceway.example.com/api/report",+ options: {+ debug: true,+ version: "1.0.0",+ },+}));+```++## Test Your Integration++```vue+<script setup>+import { useTraceway } from "@traceway/vue";++const { captureException } = useTraceway();++function sendTestError() {+ captureException(new Error("Test error from Vue"));+}+</script>++<template>+ <button @click="sendTestError">Send Test Error</button>+</template>+```++Click the button and check your Traceway dashboard to verify the error appears.++## Next Steps++- [Plugin Setup](/client/vue/plugin) - Configuration options+- [Composables](/client/vue/composables) - Using useTracewaydiff --git a/docs/pages/client/vue/plugin.mdx b/docs/pages/client/vue/plugin.mdxnew file mode 100644index 00000000..1255a859--- /dev/null+++ b/docs/pages/client/vue/plugin.mdx@@ -0,0 +1,145 @@+# Plugin Setup++Configure the Traceway Vue plugin with `createTracewayPlugin`.++## Basic Setup++```javascript+import { createApp } from "vue";+import { createTracewayPlugin } from "@traceway/vue";+import App from "./App.vue";++const app = createApp(App);++app.use(createTracewayPlugin({+ connectionString: "your-token@https://traceway.example.com/api/report",+}));++app.mount("#app");+```++## Plugin Options++| Option | Type | Required | Description |+|--------|------|----------|-------------|+| `connectionString` | `string` | Yes | Your Traceway connection string |+| `options` | `object` | No | SDK configuration options |++## SDK Options++| Option | Type | Default | Description |+|--------|------|---------|-------------|+| `debug` | `boolean` | `false` | Log events to console |+| `debounceMs` | `number` | `1500` | Batch delay in milliseconds |+| `retryDelayMs` | `number` | `10000` | Retry delay for failed uploads |+| `version` | `string` | `undefined` | Your application version |++## Full Example++```javascript+import { createApp } from "vue";+import { createTracewayPlugin } from "@traceway/vue";+import App from "./App.vue";++const app = createApp(App);++app.use(createTracewayPlugin({+ connectionString: "your-token@https://traceway.example.com/api/report",+ options: {+ debug: import.meta.env.DEV,+ version: import.meta.env.VITE_APP_VERSION,+ debounceMs: 1000,+ },+}));++app.mount("#app");+```++## Automatic Error Handling++The plugin automatically installs `app.config.errorHandler` to capture:++- Component rendering errors+- Watcher errors+- Lifecycle hook errors++```javascript+// This is handled automatically by the plugin:+app.config.errorHandler = (err, instance, info) => {+ // Error is captured and sent to Traceway+};+```++## Environment-Specific Configuration++```javascript+const connectionString = import.meta.env.PROD+ ? import.meta.env.VITE_TRACEWAY_PROD+ : import.meta.env.VITE_TRACEWAY_DEV;++app.use(createTracewayPlugin({+ connectionString,+ options: {+ debug: import.meta.env.DEV,+ },+}));+```++## Manual Injection++For advanced use cases, you can use the injection key directly:++```vue+<script setup>+import { inject } from "vue";+import { TracewayKey } from "@traceway/vue";++const traceway = inject(TracewayKey);+traceway.captureException(new Error("Manual capture"));+</script>+```++However, the `useTraceway` composable is preferred for most use cases.++## Vite Configuration++Add your connection string to `.env`:++```+VITE_TRACEWAY_CONNECTION=your-token@https://traceway.example.com/api/report+```++Use in your app:++```javascript+app.use(createTracewayPlugin({+ connectionString: import.meta.env.VITE_TRACEWAY_CONNECTION,+}));+```++## Nuxt Integration++For Nuxt 3, create a plugin:++```javascript+// plugins/traceway.client.ts+import { createTracewayPlugin } from "@traceway/vue";++export default defineNuxtPlugin((nuxtApp) => {+ nuxtApp.vueApp.use(createTracewayPlugin({+ connectionString: useRuntimeConfig().public.tracewayConnection,+ }));+});+```++Add to `nuxt.config.ts`:++```typescript+export default defineNuxtConfig({+ runtimeConfig: {+ public: {+ tracewayConnection: process.env.TRACEWAY_CONNECTION,+ },+ },+});+```diff --git a/docs/public/javascript.svg b/docs/public/javascript.svgnew file mode 100644index 00000000..f5e4e19e--- /dev/null+++ b/docs/public/javascript.svg@@ -0,0 +1,5 @@+<svg viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">+ <rect width="16" height="16" fill="#F7DF1E"/>+ <path d="M4.5 12.5C4.5 11.2 5.3 10.7 6.5 10.7C7.3 10.7 7.8 11.1 8.1 11.7L7 12.4C6.9 12.1 6.7 11.9 6.4 11.9C6.1 11.9 5.9 12.1 5.9 12.5V14.5H4.5V12.5Z" fill="#323330"/>+ <path d="M9 14.3C9.4 14.7 10 15 10.7 15C11.8 15 12.5 14.3 12.5 13.3C12.5 12.3 11.9 11.9 10.9 11.5L10.5 11.3C10 11.1 9.8 10.9 9.8 10.6C9.8 10.3 10 10.1 10.4 10.1C10.7 10.1 10.9 10.2 11.1 10.6L12.1 9.9C11.7 9.2 11.1 8.9 10.4 8.9C9.3 8.9 8.5 9.6 8.5 10.6C8.5 11.5 9 12 9.9 12.4L10.3 12.6C10.8 12.8 11.1 13 11.1 13.4C11.1 13.7 10.8 13.9 10.4 13.9C9.9 13.9 9.5 13.6 9.3 13.2L8.2 13.9C8.5 14.5 9.2 15 10.1 15" fill="#323330"/>+</svg>diff --git a/docs/public/react.svg b/docs/public/react.svgnew file mode 100644index 00000000..335534b8--- /dev/null+++ b/docs/public/react.svg@@ -0,0 +1,6 @@+<svg viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">+ <circle cx="8" cy="8" r="1.5" fill="#61DAFB"/>+ <ellipse cx="8" cy="8" rx="6.5" ry="2.5" stroke="#61DAFB" stroke-width="0.8" fill="none"/>+ <ellipse cx="8" cy="8" rx="6.5" ry="2.5" stroke="#61DAFB" stroke-width="0.8" fill="none" transform="rotate(60 8 8)"/>+ <ellipse cx="8" cy="8" rx="6.5" ry="2.5" stroke="#61DAFB" stroke-width="0.8" fill="none" transform="rotate(120 8 8)"/>+</svg>diff --git a/docs/public/svelte.png b/docs/public/svelte.pngnew file mode 100644index 00000000..7f61eb01Binary files /dev/null and b/docs/public/svelte.png differdiff --git a/docs/public/vue.svg b/docs/public/vue.svgnew file mode 100644index 00000000..c437fd04--- /dev/null+++ b/docs/public/vue.svg@@ -0,0 +1,5 @@+<svg viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">+ <path d="M12.8 1H10.4L8 5L5.6 1H3.2L8 9.5L12.8 1Z" fill="#41B883"/>+ <path d="M15 1H12.8L8 9.5L3.2 1H1L8 13L15 1Z" fill="#41B883" opacity="0.6"/>+ <path d="M12.8 1H10.4L8 5L5.6 1H3.2L8 9.5L12.8 1Z" fill="#35495E"/>+</svg>diff --git a/docs/theme.config.jsx b/docs/theme.config.jsxindex 8be622d0..1e18568e 100644--- a/docs/theme.config.jsx+++ b/docs/theme.config.jsx@@ -10,6 +10,9 @@ const SDK_VISIBILITY = {"fiber-middleware": "go-fiber","fasthttp-middleware": "go-fasthttp","http-middleware": "go-http",+ "react": "js-react",+ "vue": "js-vue",+ "svelte": "js-svelte",};export default {diff --git a/frontend/src/lib/utils/framework-code.ts b/frontend/src/lib/utils/framework-code.tsindex daa0d99a..d8b472a2 100644--- a/frontend/src/lib/utils/framework-code.ts+++ b/frontend/src/lib/utils/framework-code.ts@@ -15,19 +15,19 @@ export function getInstallCommand(framework: Framework): string {case 'stdlib':return `${base} && go get go.tracewayapp.com/tracewayhttp`;case 'react':- return 'npm install @tracewayapp/react';+ return 'npm install @traceway/react';case 'svelte':- return 'npm install @tracewayapp/svelte';+ return 'npm install @traceway/svelte';case 'vuejs':- return 'npm install @tracewayapp/vue';+ return 'npm install @traceway/vue';case 'nextjs':- return 'npm install @tracewayapp/next';+ return 'npm install @traceway/next';case 'nestjs':- return 'npm install @tracewayapp/nest';+ return 'npm install @traceway/nest';case 'express':- return 'npm install @tracewayapp/express';+ return 'npm install @traceway/express';case 'remix':- return 'npm install @tracewayapp/remix';+ return 'npm install @traceway/remix';case 'custom':default:return base;@@ -124,32 +124,44 @@ func main() {}`;case 'react':- return `import { init, captureException } from "@tracewayapp/react";--init("${connectionString}");+ return `import { TracewayProvider } from "@traceway/react";function App() {- return <div>My App</div>;+ return (+ <TracewayProvider connectionString="${connectionString}">+ <YourApp />+ </TracewayProvider>+ );}export default App;`;case 'svelte':- return `import { init, captureException } from "@tracewayapp/svelte";+ return `<script>+ import { setupTraceway } from "@traceway/svelte";++ setupTraceway({+ connectionString: "${connectionString}",+ });+</script>-init("${connectionString}");`;+<slot />`;case 'vuejs':return `import { createApp } from "vue";-import { init, captureException } from "@tracewayapp/vue";--init("${connectionString}");+import { createTracewayPlugin } from "@traceway/vue";+import App from "./App.vue";const app = createApp(App);++app.use(createTracewayPlugin({+ connectionString: "${connectionString}",+}));+app.mount("#app");`;case 'nextjs':- return `import { withTraceway } from "@tracewayapp/next";+ return `import { withTraceway } from "@traceway/next";export default withTraceway({connectionString: "${connectionString}",@@ -157,7 +169,7 @@ export default withTraceway({case 'nestjs':return `import { Module } from "@nestjs/common";-import { TracewayModule } from "@tracewayapp/nest";+import { TracewayModule } from "@traceway/nest";@Module({imports: [@@ -170,7 +182,7 @@ export class AppModule {}`;case 'express':return `import express from "express";-import { traceway } from "@tracewayapp/express";+import { traceway } from "@traceway/express";const app = express();app.use(traceway("${connectionString}"));@@ -182,7 +194,7 @@ app.get("/api/users", (req, res) => {app.listen(8080);`;case 'remix':- return `import { withTraceway } from "@tracewayapp/remix";+ return `import { withTraceway } from "@traceway/remix";export default withTraceway({connectionString: "${connectionString}",@@ -218,9 +230,28 @@ throw new Error("Test error from Traceway integration");`;export function getTestingRouteCode2(framework?: Framework): string {if (framework && isJsFramework(framework)) {- return `import { captureException } from "@tracewayapp/${getPackageName(framework)}";--captureException(new Error("Test error from Traceway integration"));`;+ switch (framework) {+ case 'react':+ return `import { useTraceway } from "@traceway/react";++// In a component using the hook+const { captureException } = useTraceway();+captureException(new Error("Test error"));`;+ case 'svelte':+ return `import { getTraceway } from "@traceway/svelte";++const { captureException } = getTraceway();+captureException(new Error("Test error"));`;+ case 'vuejs':+ return `import { useTraceway } from "@traceway/vue";++const { captureException } = useTraceway();+captureException(new Error("Test error"));`;+ default:+ return `import { captureException } from "@traceway/${getPackageName(framework)}";++captureException(new Error("Test error"));`;+ }}return `r.GET("/testing", func(c *gin.Context) {c.AbortWithError(500, traceway.NewStackTraceErrorf("testing"))