@buoy-gg/impersonate 6.0.0 → 7.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.
Files changed (2) hide show
  1. package/README.md +69 -0
  2. package/package.json +16 -5
package/README.md ADDED
@@ -0,0 +1,69 @@
1
+ # @buoy-gg/impersonate
2
+
3
+ [![npm version](https://img.shields.io/npm/v/@buoy-gg/impersonate?style=flat-square&labelColor=1c1c1c&color=10B981)](https://www.npmjs.com/package/@buoy-gg/impersonate) [![npm downloads](https://img.shields.io/npm/dm/@buoy-gg/impersonate?style=flat-square&labelColor=1c1c1c&color=10B981)](https://www.npmjs.com/package/@buoy-gg/impersonate)
4
+
5
+ **Test your app as any user, role, or flag combination — without logging out, switching accounts, or rebuilding.**
6
+
7
+ Part of [Buoy](https://github.com/Buoy-gg/buoy) — devtools that live inside your React Native app. Install it and it auto-appears in the floating menu from [`@buoy-gg/core`](https://www.npmjs.com/package/@buoy-gg/core).
8
+
9
+ ## Install
10
+
11
+ ```bash
12
+ npm install @buoy-gg/core @buoy-gg/impersonate
13
+ ```
14
+
15
+ ## Quick start
16
+
17
+ Unlike most Buoy tools, this one needs a little config — it has to know how to search *your* users:
18
+
19
+ ```tsx
20
+ import { FloatingDevTools } from "@buoy-gg/core";
21
+ import { createImpersonateTool } from "@buoy-gg/impersonate";
22
+
23
+ const impersonateTool = createImpersonateTool({
24
+ onSearchUsers: async (query) => {
25
+ const { users } = await api.searchUsers({ email: query });
26
+ return users.map((u) => ({
27
+ id: u.id, // sent in the impersonation header
28
+ displayName: u.name,
29
+ email: u.email,
30
+ metadata: { role: u.role },
31
+ }));
32
+ },
33
+ });
34
+
35
+ export default function App() {
36
+ return (
37
+ <>
38
+ <YourApp />
39
+ <FloatingDevTools apps={[impersonateTool]} />
40
+ </>
41
+ );
42
+ }
43
+ ```
44
+
45
+ While impersonating, every outgoing `fetch` and `XMLHttpRequest` carries `x-impersonate-user-id: <id>` (header name configurable via `defaults.headerKey`). Your backend checks the header — after verifying the caller is an admin — and returns data for that user instead.
46
+
47
+ ## What you get
48
+
49
+ - **Header injection everywhere** — patches `fetch` and XHR at startup, so even requests fired during app boot carry the impersonation header
50
+ - **Auto data clearing** — detects `@tanstack/react-query` and `react-redux` and clears the query cache / resets the store on every user switch, no callbacks needed (AsyncStorage/MMKV clearing via optional callbacks)
51
+ - **Floating banner** — appears automatically whenever impersonation is active, so you can never forget whose eyes you're looking through
52
+ - **Pause vs stop** — the banner's power button pauses header injection for instant A/B against your real account; X stops the session and triggers data clearing
53
+ - **History** — quick-switch between your last 10 impersonated users, persisted across app restarts
54
+ - **Developer defaults** — ship team-wide defaults for header name, banner, and clearing behavior; the Settings tab exports your current config as paste-ready code
55
+ - **`showSettingsTab: false`** — lock it down to just Search and History for simpler setups
56
+
57
+ ## Desktop & AI
58
+
59
+ The same live session streams to [Buoy Desktop](https://github.com/Buoy-gg/Buoy-Desktop) (free, macOS/Windows/Linux) and to Claude Code or Cursor via the [Buoy MCP server](https://buoy.gg/buoy/latest/docs/mcp).
60
+
61
+ ## Free vs Pro
62
+
63
+ Every tool is free. [Pro](https://buoy.gg/pricing) unlocks production builds, the MCP server, and unlimited capture. Every weekend, Pro features unlock free for everyone.
64
+
65
+ ---
66
+
67
+ 📚 [Full docs](https://buoy.gg/buoy/latest/docs/tools/impersonate) · [All Buoy tools](https://github.com/Buoy-gg/buoy)
68
+
69
+ Proprietary software. © Buoy LLC. [Terms](https://buoy.gg/terms)
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@buoy-gg/impersonate",
3
- "version": "6.0.0",
4
- "description": "User impersonation tool for Buoy DevTools - inject custom headers for admin testing",
3
+ "version": "7.0.0",
4
+ "description": "Test your React Native app as any user, role, or flag combo — without logging out or rebuilding. Part of Buoy devtools.",
5
5
  "main": "lib/commonjs/index.js",
6
6
  "module": "lib/module/index.js",
7
7
  "types": "lib/typescript/index.d.ts",
@@ -26,7 +26,7 @@
26
26
  ],
27
27
  "sideEffects": false,
28
28
  "dependencies": {
29
- "@buoy-gg/shared-ui": "6.0.0"
29
+ "@buoy-gg/shared-ui": "7.0.0"
30
30
  },
31
31
  "peerDependencies": {
32
32
  "react": "*",
@@ -58,17 +58,28 @@
58
58
  },
59
59
  "repository": {
60
60
  "type": "git",
61
- "url": "https://github.com/LovesWorking/react-native-buoy.git",
61
+ "url": "https://github.com/Buoy-gg/buoy.git",
62
62
  "directory": "packages/impersonate"
63
63
  },
64
64
  "bugs": {
65
65
  "url": "https://github.com/LovesWorking/react-native-buoy/issues"
66
66
  },
67
- "homepage": "https://github.com/LovesWorking/react-native-buoy/tree/main/packages/impersonate#readme",
67
+ "homepage": "https://buoy.gg/tools/impersonate",
68
68
  "publishConfig": {
69
69
  "access": "public",
70
70
  "tag": "latest"
71
71
  },
72
+ "keywords": [
73
+ "react-native",
74
+ "expo",
75
+ "devtools",
76
+ "debugging",
77
+ "react-native-devtools",
78
+ "flipper-alternative",
79
+ "user-impersonation",
80
+ "auth-testing",
81
+ "qa"
82
+ ],
72
83
  "scripts": {
73
84
  "build": "bob build",
74
85
  "typecheck": "tsc --noEmit",