jat-feedback 1.1.1 → 1.3.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/README.md CHANGED
@@ -11,25 +11,11 @@ User clicks "Report Bug" → Widget captures context → POST /api/feedback/repo
11
11
 
12
12
  ## Install
13
13
 
14
- ### Option 1: CDN (recommended)
15
-
16
- ```html
17
- <script src="https://unpkg.com/jat-feedback@^1/dist/jat-feedback.js"></script>
18
- <jat-feedback project="my-app"></jat-feedback>
19
- <script>
20
- document.querySelector('jat-feedback').setAttribute('endpoint', location.origin);
21
- </script>
22
- ```
23
-
24
- ### Option 2: npm
25
-
26
14
  ```bash
27
15
  npm install jat-feedback
28
16
  ```
29
17
 
30
- ```js
31
- import 'jat-feedback';
32
- ```
18
+ The package includes the widget bundle, Supabase migration, and edge function — all three are needed for the full pipeline.
33
19
 
34
20
  ## Widget Attributes
35
21
 
@@ -82,9 +68,32 @@ Full setup for any SvelteKit app with Supabase. Creates the feedback pipeline fr
82
68
 
83
69
  ### Step 1: Add Widget to app.html
84
70
 
71
+ The widget is a web component bundled at `dist/jat-feedback.js`. Use `vite-plugin-static-copy` to copy it into your build output, then load it from your own server.
72
+
73
+ **vite.config.ts:**
74
+ ```typescript
75
+ import { sveltekit } from '@sveltejs/vite-plugin-svelte';
76
+ import { viteStaticCopy } from 'vite-plugin-static-copy';
77
+
78
+ export default {
79
+ plugins: [
80
+ sveltekit(),
81
+ viteStaticCopy({
82
+ targets: [
83
+ {
84
+ src: 'node_modules/jat-feedback/dist/jat-feedback.js',
85
+ dest: '.'
86
+ }
87
+ ]
88
+ })
89
+ ]
90
+ };
91
+ ```
92
+
93
+ **src/app.html:**
85
94
  ```html
86
- <!-- src/app.html — before closing </body> tag -->
87
- <script src="https://unpkg.com/jat-feedback@^1/dist/jat-feedback.js"></script>
95
+ <!-- before closing </body> tag -->
96
+ <script src="/jat-feedback.js"></script>
88
97
  <jat-feedback project="YOUR_PROJECT"></jat-feedback>
89
98
  <script>
90
99
  (function() {
@@ -441,19 +450,66 @@ The `feedback_reports` table columns used by the pipeline:
441
450
 
442
451
  ## Upgrading
443
452
 
444
- When a new version adds schema changes, a new versioned migration file will appear in `node_modules/jat-feedback/supabase/migrations/`. Check for new files after upgrading and apply any you haven't run:
453
+ npm never auto-updates you need to explicitly upgrade and then handle each type of change manually.
454
+
455
+ ```bash
456
+ # 1. Update the package
457
+ npm install jat-feedback@latest
458
+ ```
459
+
460
+ Then handle whatever changed in the release notes:
445
461
 
462
+ **Widget JS changes** (UI, behavior, new attributes):
446
463
  ```bash
447
- # See what migration files the package ships
464
+ # Nothing extra the updated bundle is copied to your build output automatically
465
+ # Just redeploy your app
466
+ ```
467
+
468
+ **Schema changes** (new columns, indexes):
469
+ ```bash
470
+ # Check for new migration files
448
471
  ls node_modules/jat-feedback/supabase/migrations/
449
472
 
450
- # Copy new ones into your project
473
+ # Copy any new ones into your project and run them
451
474
  cp node_modules/jat-feedback/supabase/migrations/1.1.0_*.sql \
452
- supabase/migrations/$(date +%Y%m%d%H%M%S)_feedback_reports_1_1_0.sql
475
+ supabase/migrations/$(date +%Y%m%d%H%M%S)_feedback_1_1_0.sql
453
476
 
454
477
  supabase db push
455
478
  ```
456
479
 
480
+ **Edge function changes** (webhook behavior):
481
+ ```bash
482
+ # Re-copy and redeploy
483
+ cp node_modules/jat-feedback/supabase/functions/jat-webhook/index.ts \
484
+ supabase/functions/jat-webhook/index.ts
485
+
486
+ supabase functions deploy jat-webhook
487
+ ```
488
+
489
+ ## Versioning
490
+
491
+ This package follows semver. The `^` range in consuming projects (`"jat-feedback": "^1.1.0"`) means:
492
+
493
+ - **Patch and minor** (1.1.x, 1.2.0) — auto-accepted by `npm install`
494
+ - **Major** (2.0.0) — requires manual version bump in `package.json`
495
+
496
+ ### What triggers a major version
497
+
498
+ | Change | Version |
499
+ |--------|---------|
500
+ | New nullable column (additive) | patch/minor |
501
+ | New widget attribute (optional) | minor |
502
+ | Removing or renaming a column | **major** |
503
+ | Changing a column's type | **major** |
504
+ | Renaming `status` values (e.g. `submitted` → `new`) | **major** |
505
+ | Required integrations.json config field added/renamed | **major** |
506
+
507
+ ### Rule for additive schema changes
508
+
509
+ Any column added in a `1.x` release **must** be nullable with no required default. This ensures consuming projects don't break even if they haven't run the migration yet — the insert just omits the column and it lands as `NULL`.
510
+
511
+ If a new column is required (non-nullable, no default), that's a breaking change and belongs in a major version.
512
+
457
513
  ## License
458
514
 
459
515
  MIT