From 7ccb359d15fd5e1030b1c1a7120bc2e25cac8a25 Mon Sep 17 00:00:00 2001 From: evgeniydolgov Date: Sun, 5 Oct 2025 16:37:49 +0300 Subject: [PATCH 1/2] added providers arr to wrapper --- README.md | 14 ++++++++------ index.ts | 2 +- package.json | 4 ++-- src/DuckBugWrapper.tsx | 11 +++++------ 4 files changed, 16 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 119299f..0cd77a5 100644 --- a/README.md +++ b/README.md @@ -8,24 +8,26 @@ The official JavaScript SDK for [DuckBug.io](https://duckbug.io) - a flexible lo ```bash # npm -npm install @duckbug/react +npm install @duckbug/js-react # yarn -yarn add @duckbug/react +yarn add @duckbug/js-react # pnpm -pnpm add @duckbug/react +pnpm add @duckbug/js-react ``` ## Quick Start ### Basic Usage ```typescript -import { DuckBugWrapper } from '@duckbug/react'; +import { DuckBugWrapper, DuckBugProvider } from '@duckbug/js-react'; // Paste your dsn from DuckBug const dsn = 'your-duckbug-dsn-here' +const providers = [new DuckBugProvider({dsn: dsn})] + // Create SDK instance with optional configuration // You can configure the configuration as you want. // If you don't pass a configuration prop, the default configuration will be used @@ -38,7 +40,7 @@ logReports: { }; // Start logging - + @@ -49,7 +51,7 @@ logReports: { You can also catch errors them yourself and log them ```typescript -import { useDuckBug } from '@duckbug/react'; +import { useDuckBug } from '@duckbug/js-react'; //Get your DuckSDK const duck = useDuckBug() diff --git a/index.ts b/index.ts index 62005a0..8ed8dd1 100644 --- a/index.ts +++ b/index.ts @@ -1 +1 @@ -export { DuckBugWrapper, useDuckBug } from './src/DuckBugWrapper' \ No newline at end of file +export { DuckBugWrapper, DuckBugProvider, useDuckBug } from './src/DuckBugWrapper' \ No newline at end of file diff --git a/package.json b/package.json index d8b6974..907f19d 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "duckbug-react", + "name": "@duckbug/js-react", "version": "1.0.2", "description": "React SDK for DuckBug error tracking", "main": "./dist/index.umd.js", @@ -20,7 +20,7 @@ "sdk", "error-tracking" ], - "author": "Your Name", + "author": "Evgeniy Dolgov", "license": "MIT", "scripts": { "build": "vite build", diff --git a/src/DuckBugWrapper.tsx b/src/DuckBugWrapper.tsx index cd1a241..bc6fff7 100644 --- a/src/DuckBugWrapper.tsx +++ b/src/DuckBugWrapper.tsx @@ -3,15 +3,13 @@ import { DuckBugProvider, DuckSDK, LogProviderConfig } from '@duckbug/js'; type Props = { children: React.ReactNode - dsn: string + providers: DuckBugProvider[] config?: LogProviderConfig } let duck: DuckSDK | null = null; -export const DuckBugWrapper = ({children, dsn, config}: Props) => { - - const providers = [new DuckBugProvider({ dsn: dsn })]; +export const DuckBugWrapper = ({children, config, providers}: Props) => { duck = new DuckSDK(providers, config); window.onerror = (message, source, error) => { @@ -31,10 +29,11 @@ export const DuckBugWrapper = ({children, dsn, config}: Props) => { ) } - export const useDuckBug = () => { if (!duck) { throw new Error('DuckBug not initialized. Use DuckBugWrapper first.'); } return duck; -} \ No newline at end of file +} + +export { DuckBugProvider } \ No newline at end of file From 29b7d67bb5b120dba01784f2d611e98504c5791a Mon Sep 17 00:00:00 2001 From: evgeniydolgov Date: Sun, 5 Oct 2025 16:49:12 +0300 Subject: [PATCH 2/2] added providers arr to wrapper --- README.md | 12 ++++++------ package-lock.json | 4 ++-- package.json | 4 ++-- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 0cd77a5..d023a72 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# @duckbug/js-react +# duckbug-react [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) @@ -8,20 +8,20 @@ The official JavaScript SDK for [DuckBug.io](https://duckbug.io) - a flexible lo ```bash # npm -npm install @duckbug/js-react +npm install duckbug-react # yarn -yarn add @duckbug/js-react +yarn add duckbug-react # pnpm -pnpm add @duckbug/js-react +pnpm add duckbug-react ``` ## Quick Start ### Basic Usage ```typescript -import { DuckBugWrapper, DuckBugProvider } from '@duckbug/js-react'; +import { DuckBugWrapper, DuckBugProvider } from 'duckbug-react'; // Paste your dsn from DuckBug const dsn = 'your-duckbug-dsn-here' @@ -51,7 +51,7 @@ logReports: { You can also catch errors them yourself and log them ```typescript -import { useDuckBug } from '@duckbug/js-react'; +import { useDuckBug } from 'duckbug-react'; //Get your DuckSDK const duck = useDuckBug() diff --git a/package-lock.json b/package-lock.json index 0672f82..e862233 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@duckbug/react", - "version": "1.0.2", + "version": "1.0.3", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@duckbug/react", - "version": "1.0.2", + "version": "1.0.3", "license": "MIT", "dependencies": { "@duckbug/js": "^0.1.2", diff --git a/package.json b/package.json index 907f19d..b8c389f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { - "name": "@duckbug/js-react", - "version": "1.0.2", + "name": "duckbug-react", + "version": "1.0.3", "description": "React SDK for DuckBug error tracking", "main": "./dist/index.umd.js", "module": "./dist/index.es.js",