flagsmith-toolbar 0.0.0-stage → 0.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Yash Soni
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
@@ -1,3 +1,99 @@
1
- # Temporary Holding Version
1
+ # flagsmith-toolbar
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ A developer toolbar for [Flagsmith](https://flagsmith.com), the open-source feature flag platform. It shows every flag your app reads, page by page, and why each one has its value. You can flip flags just for you, see your app as any user, and compare two users side by side. It checks that your experiments record their exposures and catches setup mistakes.
4
+
5
+ ![Flagsmith Toolbar in a demo app: viewing the app as Kabir, then comparing him with Priya to see why only he has AI Insights](https://raw.githubusercontent.com/YashSoni998265/flagsmith-toolbar/main/docs/images/demo.gif)
6
+
7
+ ## Install
8
+
9
+ ```sh
10
+ npm install flagsmith-toolbar
11
+ ```
12
+
13
+ ```ts
14
+ import flagsmith from '@flagsmith/flagsmith';
15
+ import FlagsmithToolbar from 'flagsmith-toolbar';
16
+
17
+ FlagsmithToolbar.init(flagsmith, {
18
+ enabled: import.meta.env.DEV, // keep it out of production
19
+ personas: [
20
+ { name: 'A real customer', identifier: 'priya@example.com' },
21
+ { name: 'Any Pro user in India', traits: { plan: 'pro', country: 'IN' } },
22
+ ],
23
+ });
24
+ ```
25
+
26
+ Press <kbd>Shift</kbd>+<kbd>F</kbd> to open it. Call `init` before or after `flagsmith.init()`. It works with React (`FlagsmithProvider`), plain JavaScript, and any framework that uses the Flagsmith JS SDK.
27
+
28
+ To leave it out of your production bundle entirely, load it only in development:
29
+
30
+ ```ts
31
+ if (import.meta.env.DEV) {
32
+ const { default: FlagsmithToolbar } = await import('flagsmith-toolbar');
33
+ FlagsmithToolbar.init(flagsmith);
34
+ }
35
+ ```
36
+
37
+ ### With a script tag
38
+
39
+ No build step needed. The script-tag build puts `window.FlagsmithToolbar` on the page:
40
+
41
+ ```html
42
+ <script src="https://cdn.jsdelivr.net/npm/@flagsmith/flagsmith@12.6.0/index.js"></script>
43
+ <script src="https://cdn.jsdelivr.net/npm/flagsmith-toolbar@0.3.0/dist/index.global.js"></script>
44
+ <script>
45
+ FlagsmithToolbar.init(flagsmith);
46
+ flagsmith.init({ environmentID: 'YOUR_CLIENT_SIDE_KEY' });
47
+ </script>
48
+ ```
49
+
50
+ ## What it does
51
+
52
+ - **Every flag your app reads, page by page.** It follows single-page apps from page to page, and labels each flag On/off, Text, Number, JSON or Variant.
53
+ - **Why each flag has its value**, in plain words: "Segment: Pro plan", "Set for this user", "Split test: 50% bucket", "No rule matched".
54
+ - **Try the other side.** Flip any flag, or change its value, just for you. Nothing changes in Flagsmith.
55
+ - **View as anyone.** Pick a real customer, a ready-made persona, or type any traits. Flagsmith evaluates them live, and saves nothing for made-up users.
56
+ - **Compare two users.** See only the flags that differ, with each user's value and reason side by side.
57
+ - **Experiments.** See each user's variant, and whether the page recorded the exposure. While you preview, Experimentation events are held back, so test visits never count.
58
+ - **Setup check.** It catches:
59
+ - a flag that doesn't exist (with a "did you mean");
60
+ - a server-side key in the browser;
61
+ - cached flags;
62
+ - missing reasons;
63
+ - events tracked while events are off;
64
+ - experiment variants without a key.
65
+ - **Share and report.** Copy a link that opens the app in exactly your state, or the page's flags as a Markdown table for a bug report.
66
+
67
+ ## Options
68
+
69
+ | Option | Default | What it does |
70
+ | --- | --- | --- |
71
+ | `enabled` | `true` | Set to `false` to turn the toolbar off, for example in production |
72
+ | `personas` | `[]` | Users for "View as". Use `identifier` for a real identity, or `traits` alone for a made-up user that's never saved |
73
+ | `dashboardUrl`, `projectId` | | Turn on "Open in Flagsmith" links |
74
+ | `layout` | `'overlay'` | `'push'` makes room for the panel on wide screens |
75
+ | `position` | `'right'` | `'left'` or `'right'` |
76
+ | `hotkey` | `'shift+f'` | The shortcut that opens and closes the panel |
77
+ | `open` | `false` | Open the panel straight away |
78
+ | `storageKey` | `'flagsmith-toolbar'` | Where your changes are saved in `localStorage` |
79
+
80
+ `FlagsmithToolbar.show()` and `FlagsmithToolbar.hide()` open and close it from code. While it's open, `<html data-flagsmith-toolbar="open">` lets your app react.
81
+
82
+ ## Requirements
83
+
84
+ - `@flagsmith/flagsmith` 12.6 or newer.
85
+ - Flagsmith 2.295 or newer, self-hosted or cloud, for the evaluation reasons.
86
+
87
+ It only uses the client-side environment key your app already has. It never takes your app down: bad saved state is ignored, and if it can't start, it logs and steps aside.
88
+
89
+ ## More
90
+
91
+ The [GitHub repo](https://github.com/YashSoni998265/flagsmith-toolbar) has:
92
+ - the full docs;
93
+ - a SaaS demo app with 29 flags on self-hosted Flagsmith;
94
+ - a step-by-step testing guide;
95
+ - a plain HTML example.
96
+
97
+ [Issues](https://github.com/YashSoni998265/flagsmith-toolbar/issues) are welcome.
98
+
99
+ MIT © 2026 Yash Soni