@arantic/bugpin-widget 0.1.1 → 0.1.2

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.
Files changed (2) hide show
  1. package/README.md +102 -108
  2. package/package.json +3 -3
package/README.md CHANGED
@@ -15,22 +15,12 @@ Embeddable visual bug reporting widget for web applications. Capture screenshots
15
15
 
16
16
  ## Installation
17
17
 
18
- ### Script Tag (Recommended)
19
-
20
- ```html
21
- <script
22
- src="https://your-bugpin-server.com/widget.js"
23
- data-api-key="your-project-api-key"
24
- async
25
- ></script>
26
- ```
27
-
28
- ### npm Package
29
-
30
18
  ```bash
31
19
  npm install @arantic/bugpin-widget
32
20
  ```
33
21
 
22
+ ## Usage
23
+
34
24
  ```javascript
35
25
  import BugPin from '@arantic/bugpin-widget';
36
26
 
@@ -40,9 +30,39 @@ BugPin.init({
40
30
  });
41
31
  ```
42
32
 
43
- ## Quick Start
33
+ ## Configuration
34
+
35
+ The widget automatically fetches its configuration from the BugPin server based on your API key. All visual settings (theme, position, colors, button text) are managed in the BugPin admin UI.
36
+
37
+ ### Required Options
38
+
39
+ | Option | Type | Description |
40
+ |--------|------|-------------|
41
+ | `apiKey` | `string` | Your project API key (from BugPin admin) |
42
+ | `serverUrl` | `string` | Your BugPin server URL |
43
+
44
+
45
+ ## Framework Examples
46
+
47
+ ### React / Vite
48
+
49
+ ```jsx
50
+ import { useEffect } from 'react';
51
+ import BugPin from '@arantic/bugpin-widget';
52
+
53
+ function App() {
54
+ useEffect(() => {
55
+ BugPin.init({
56
+ apiKey: import.meta.env.VITE_BUGPIN_API_KEY,
57
+ serverUrl: import.meta.env.VITE_BUGPIN_SERVER_URL
58
+ });
59
+ }, []);
60
+
61
+ return <div>Your app</div>;
62
+ }
63
+ ```
44
64
 
45
- ### React / Next.js
65
+ ### Next.js
46
66
 
47
67
  ```jsx
48
68
  import { useEffect } from 'react';
@@ -76,75 +96,6 @@ onMounted(() => {
76
96
  </script>
77
97
  ```
78
98
 
79
- ### TypeScript
80
-
81
- ```typescript
82
- import BugPin, { type WidgetConfig } from '@arantic/bugpin-widget';
83
-
84
- const config: Partial<WidgetConfig> & { apiKey: string } = {
85
- apiKey: 'your-api-key',
86
- serverUrl: 'https://bugs.example.com',
87
- position: 'bottom-right',
88
- theme: 'auto'
89
- };
90
-
91
- BugPin.init(config);
92
- ```
93
-
94
- ## Configuration
95
-
96
- | Option | Type | Default | Description |
97
- |--------|------|---------|-------------|
98
- | `apiKey` | `string` | **Required** | Your project API key |
99
- | `serverUrl` | `string` | **Required** | BugPin server URL |
100
- | `position` | `string` | `'bottom-right'` | Widget position: `'bottom-right'`, `'bottom-left'`, `'top-right'`, `'top-left'` |
101
- | `theme` | `string` | `'auto'` | Theme: `'light'`, `'dark'`, or `'auto'` |
102
- | `buttonText` | `string` | `'Found a bug?'` | Button text |
103
-
104
- ## API Methods
105
-
106
- ### `BugPin.init(config)`
107
-
108
- Initialize the widget with your configuration.
109
-
110
- ```javascript
111
- BugPin.init({
112
- apiKey: 'bp_proj_abc123',
113
- serverUrl: 'https://bugs.example.com'
114
- });
115
- ```
116
-
117
- ### `BugPin.open()`
118
-
119
- Programmatically open the bug report dialog.
120
-
121
- ```javascript
122
- document.getElementById('report-bug').addEventListener('click', () => {
123
- BugPin.open();
124
- });
125
- ```
126
-
127
- ### `BugPin.close()`
128
-
129
- Programmatically close the bug report dialog.
130
-
131
- ```javascript
132
- BugPin.close();
133
- ```
134
-
135
- ## Framework Examples
136
-
137
- ### .NET / Blazor
138
-
139
- ```html
140
- <!-- In _Layout.cshtml or wwwroot/index.html -->
141
- <script
142
- src="@Configuration["BugPin:ServerUrl"]/widget.js"
143
- data-api-key="@Configuration["BugPin:ApiKey"]"
144
- async
145
- ></script>
146
- ```
147
-
148
99
  ### Angular
149
100
 
150
101
  ```typescript
@@ -166,38 +117,81 @@ export class AppComponent implements OnInit {
166
117
  }
167
118
  ```
168
119
 
169
- ### Svelte
120
+ ### TypeScript / Vanilla JavaScript
170
121
 
171
- ```svelte
172
- <script>
173
- import { onMount } from 'svelte';
174
- import BugPin from '@arantic/bugpin-widget';
122
+ ```typescript
123
+ import BugPin from '@arantic/bugpin-widget';
175
124
 
176
- onMount(() => {
177
- BugPin.init({
178
- apiKey: import.meta.env.VITE_BUGPIN_API_KEY,
179
- serverUrl: import.meta.env.VITE_BUGPIN_SERVER_URL
180
- });
125
+ // Initialize when DOM is ready
126
+ document.addEventListener('DOMContentLoaded', () => {
127
+ BugPin.init({
128
+ apiKey: 'your-api-key',
129
+ serverUrl: 'https://bugpin.example.com'
181
130
  });
182
- </script>
131
+ });
183
132
  ```
184
133
 
185
- ## Environment Variables
134
+ ### .NET / Blazor
186
135
 
187
- Store your API key securely using environment variables:
136
+ ```csharp
137
+ // Services/BugPinService.cs
138
+ public class BugPinService
139
+ {
140
+ private readonly IJSRuntime _js;
188
141
 
189
- ```bash
190
- # Next.js
191
- NEXT_PUBLIC_BUGPIN_API_KEY=bp_proj_abc123
192
- NEXT_PUBLIC_BUGPIN_SERVER_URL=https://bugs.example.com
142
+ public BugPinService(IJSRuntime js) => _js = js;
193
143
 
194
- # Vite
195
- VITE_BUGPIN_API_KEY=bp_proj_abc123
196
- VITE_BUGPIN_SERVER_URL=https://bugs.example.com
144
+ public async Task InitializeAsync(string apiKey, string serverUrl)
145
+ {
146
+ await _js.InvokeVoidAsync("eval",
147
+ $"import('@arantic/bugpin-widget').then(m => m.default.init({{apiKey: '{apiKey}', serverUrl: '{serverUrl}'}}))");
148
+ }
149
+ }
150
+ ```
197
151
 
198
- # Vue CLI
199
- VUE_APP_BUGPIN_API_KEY=bp_proj_abc123
200
- VUE_APP_BUGPIN_SERVER_URL=https://bugs.example.com
152
+ ```csharp
153
+ // Program.cs or Startup.cs
154
+ builder.Services.AddScoped<BugPinService>();
155
+ ```
156
+
157
+ ```razor
158
+ @inject BugPinService BugPin
159
+ @inject IConfiguration Config
160
+
161
+ @code {
162
+ protected override async Task OnAfterRenderAsync(bool firstRender)
163
+ {
164
+ if (firstRender)
165
+ {
166
+ await BugPin.InitializeAsync(
167
+ Config["BugPin:ApiKey"],
168
+ Config["BugPin:ServerUrl"]
169
+ );
170
+ }
171
+ }
172
+ }
173
+ ```
174
+
175
+ ## Environment Variables
176
+
177
+ Store your API key in environment variables (see framework examples above for usage):
178
+
179
+ ```bash
180
+ # Vite (React, Vue) - .env
181
+ VITE_BUGPIN_API_KEY=your-api-key
182
+ VITE_BUGPIN_SERVER_URL=https://bugpin.example.com
183
+
184
+ # Next.js - .env.local
185
+ NEXT_PUBLIC_BUGPIN_API_KEY=your-api-key
186
+ NEXT_PUBLIC_BUGPIN_SERVER_URL=https://bugpin.example.com
187
+
188
+ # .NET (appsettings.json)
189
+ {
190
+ "BugPin": {
191
+ "ApiKey": "your-api-key",
192
+ "ServerUrl": "https://bugpin.example.com"
193
+ }
194
+ }
201
195
  ```
202
196
 
203
197
  ## Getting Your API Key
@@ -218,5 +212,5 @@ MIT
218
212
  ## Support
219
213
 
220
214
  - [Documentation](https://docs.bugpin.io)
221
- - [Report Issues](https://github.com/bugpin/bugpin-ce/issues)
222
- - [Discussions](https://github.com/bugpin/bugpin-ce/discussions)
215
+ - [Report Issues](https://github.com/bugpin/bugpin/issues)
216
+ - [Discussions](https://github.com/bugpin/bugpin/discussions)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arantic/bugpin-widget",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "Embeddable visual bug reporting widget - Capture screenshots, annotate issues, and submit bug reports",
5
5
  "type": "module",
6
6
  "main": "dist/widget.cjs.js",
@@ -31,12 +31,12 @@
31
31
  "license": "MIT",
32
32
  "repository": {
33
33
  "type": "git",
34
- "url": "https://github.com/bugpin/bugpin-ce.git",
34
+ "url": "https://github.com/aranticlabs/bugpin.git",
35
35
  "directory": "src/widget"
36
36
  },
37
37
  "homepage": "https://bugpin.io",
38
38
  "bugs": {
39
- "url": "https://github.com/bugpin/bugpin-ce/issues"
39
+ "url": "https://github.com/aranticlabs/bugpin/issues"
40
40
  },
41
41
  "publishConfig": {
42
42
  "access": "public"