@arantic/bugpin-widget 0.1.1 → 1.0.0

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Arantic Digital
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -15,34 +15,53 @@ 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
 
37
27
  BugPin.init({
38
28
  apiKey: 'your-project-api-key',
39
- serverUrl: 'https://your-bugpin-server.com'
29
+ serverUrl: 'https://your-bugpin-server.com',
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 portal.
44
36
 
45
- ### React / Next.js
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
+ ## Framework Examples
45
+
46
+ ### React / Vite
47
+
48
+ ```jsx
49
+ import { useEffect } from 'react';
50
+ import BugPin from '@arantic/bugpin-widget';
51
+
52
+ function App() {
53
+ useEffect(() => {
54
+ BugPin.init({
55
+ apiKey: import.meta.env.VITE_BUGPIN_API_KEY,
56
+ serverUrl: import.meta.env.VITE_BUGPIN_SERVER_URL,
57
+ });
58
+ }, []);
59
+
60
+ return <div>Your app</div>;
61
+ }
62
+ ```
63
+
64
+ ### Next.js
46
65
 
47
66
  ```jsx
48
67
  import { useEffect } from 'react';
@@ -52,7 +71,7 @@ function App() {
52
71
  useEffect(() => {
53
72
  BugPin.init({
54
73
  apiKey: process.env.NEXT_PUBLIC_BUGPIN_API_KEY,
55
- serverUrl: process.env.NEXT_PUBLIC_BUGPIN_SERVER_URL
74
+ serverUrl: process.env.NEXT_PUBLIC_BUGPIN_SERVER_URL,
56
75
  });
57
76
  }, []);
58
77
 
@@ -70,81 +89,12 @@ import BugPin from '@arantic/bugpin-widget';
70
89
  onMounted(() => {
71
90
  BugPin.init({
72
91
  apiKey: import.meta.env.VITE_BUGPIN_API_KEY,
73
- serverUrl: import.meta.env.VITE_BUGPIN_SERVER_URL
92
+ serverUrl: import.meta.env.VITE_BUGPIN_SERVER_URL,
74
93
  });
75
94
  });
76
95
  </script>
77
96
  ```
78
97
 
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
98
  ### Angular
149
99
 
150
100
  ```typescript
@@ -154,58 +104,103 @@ import BugPin from '@arantic/bugpin-widget';
154
104
 
155
105
  @Component({
156
106
  selector: 'app-root',
157
- templateUrl: './app.component.html'
107
+ templateUrl: './app.component.html',
158
108
  })
159
109
  export class AppComponent implements OnInit {
160
110
  ngOnInit() {
161
111
  BugPin.init({
162
112
  apiKey: environment.bugpinApiKey,
163
- serverUrl: environment.bugpinServerUrl
113
+ serverUrl: environment.bugpinServerUrl,
164
114
  });
165
115
  }
166
116
  }
167
117
  ```
168
118
 
169
- ### Svelte
119
+ ### TypeScript / Vanilla JavaScript
170
120
 
171
- ```svelte
172
- <script>
173
- import { onMount } from 'svelte';
174
- import BugPin from '@arantic/bugpin-widget';
121
+ ```typescript
122
+ import BugPin from '@arantic/bugpin-widget';
175
123
 
176
- onMount(() => {
177
- BugPin.init({
178
- apiKey: import.meta.env.VITE_BUGPIN_API_KEY,
179
- serverUrl: import.meta.env.VITE_BUGPIN_SERVER_URL
180
- });
124
+ // Initialize when DOM is ready
125
+ document.addEventListener('DOMContentLoaded', () => {
126
+ BugPin.init({
127
+ apiKey: 'your-api-key',
128
+ serverUrl: 'https://bugpin.example.com',
181
129
  });
182
- </script>
130
+ });
183
131
  ```
184
132
 
185
- ## Environment Variables
133
+ ### .NET / Blazor
186
134
 
187
- Store your API key securely using environment variables:
135
+ ```csharp
136
+ // Services/BugPinService.cs
137
+ public class BugPinService
138
+ {
139
+ private readonly IJSRuntime _js;
188
140
 
189
- ```bash
190
- # Next.js
191
- NEXT_PUBLIC_BUGPIN_API_KEY=bp_proj_abc123
192
- NEXT_PUBLIC_BUGPIN_SERVER_URL=https://bugs.example.com
141
+ public BugPinService(IJSRuntime js) => _js = js;
193
142
 
194
- # Vite
195
- VITE_BUGPIN_API_KEY=bp_proj_abc123
196
- VITE_BUGPIN_SERVER_URL=https://bugs.example.com
143
+ public async Task InitializeAsync(string apiKey, string serverUrl)
144
+ {
145
+ await _js.InvokeVoidAsync("eval",
146
+ $"import('@arantic/bugpin-widget').then(m => m.default.init({{apiKey: '{apiKey}', serverUrl: '{serverUrl}'}}))");
147
+ }
148
+ }
149
+ ```
197
150
 
198
- # Vue CLI
199
- VUE_APP_BUGPIN_API_KEY=bp_proj_abc123
200
- VUE_APP_BUGPIN_SERVER_URL=https://bugs.example.com
151
+ ```csharp
152
+ // Program.cs or Startup.cs
153
+ builder.Services.AddScoped<BugPinService>();
154
+ ```
155
+
156
+ ```razor
157
+ @inject BugPinService BugPin
158
+ @inject IConfiguration Config
159
+
160
+ @code {
161
+ protected override async Task OnAfterRenderAsync(bool firstRender)
162
+ {
163
+ if (firstRender)
164
+ {
165
+ await BugPin.InitializeAsync(
166
+ Config["BugPin:ApiKey"],
167
+ Config["BugPin:ServerUrl"]
168
+ );
169
+ }
170
+ }
171
+ }
172
+ ```
173
+
174
+ ## Environment Variables
175
+
176
+ Store your API key in environment variables (see framework examples above for usage):
177
+
178
+ ```bash
179
+ # Vite (React, Vue) - .env
180
+ VITE_BUGPIN_API_KEY=your-api-key
181
+ VITE_BUGPIN_SERVER_URL=https://bugpin.example.com
182
+
183
+ # Next.js - .env.local
184
+ NEXT_PUBLIC_BUGPIN_API_KEY=your-api-key
185
+ NEXT_PUBLIC_BUGPIN_SERVER_URL=https://bugpin.example.com
186
+
187
+ # .NET (appsettings.json)
188
+ {
189
+ "BugPin": {
190
+ "ApiKey": "your-project-api-key",
191
+ "ServerUrl": "https://bugpin.example.com"
192
+ }
193
+ }
201
194
  ```
202
195
 
203
196
  ## Getting Your API Key
204
197
 
205
- 1. Deploy BugPin server (self-hosted or use the official Docker image)
206
- 2. Log in to the BugPin admin panel
207
- 3. Create a new project or select an existing one
208
- 4. Copy the API key from the project settings
198
+ You need an API key from your BugPin server to initialize the widget.
199
+
200
+ 1. Deploy BugPin server on your infrastructure (e.g. using [Docker](https://docs.bugpin.io/installation/docker))
201
+ 2. Log in to the BugPin admin portal
202
+ 3. Open **Projects**, create a new project or select an existing one
203
+ 4. Copy the API key (shown in the project card or in **Project Settings**)
209
204
 
210
205
  ## Documentation
211
206
 
@@ -218,5 +213,5 @@ MIT
218
213
  ## Support
219
214
 
220
215
  - [Documentation](https://docs.bugpin.io)
221
- - [Report Issues](https://github.com/bugpin/bugpin-ce/issues)
222
- - [Discussions](https://github.com/bugpin/bugpin-ce/discussions)
216
+ - [Report Issues](https://github.com/bugpin/bugpin/issues)
217
+ - [Discussions](https://github.com/bugpin/bugpin/discussions)