@buoy-gg/impersonate 7.0.40 → 7.0.42
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 +12 -76
- package/lib/commonjs/impersonate/components/DataNukeSettings.js +8 -675
- package/lib/commonjs/impersonate/components/ImpersonateBanner.js +1 -221
- package/lib/commonjs/impersonate/components/ImpersonateHistoryList.js +1 -181
- package/lib/commonjs/impersonate/components/ImpersonateModal.js +1 -319
- package/lib/commonjs/impersonate/components/ImpersonateOverlay.js +1 -26
- package/lib/commonjs/impersonate/components/ImpersonateStatusBar.js +1 -130
- package/lib/commonjs/impersonate/components/UserAvatar.js +1 -146
- package/lib/commonjs/impersonate/components/UserCard.js +1 -201
- package/lib/commonjs/impersonate/components/UserSearchView.js +1 -227
- package/lib/commonjs/impersonate/hooks/asyncStoragePeer.js +1 -0
- package/lib/commonjs/impersonate/hooks/asyncStoragePeer.web.js +1 -0
- package/lib/commonjs/impersonate/hooks/useAutoClearAsyncStorage.js +1 -144
- package/lib/commonjs/impersonate/hooks/useAutoClearReactQuery.js +1 -155
- package/lib/commonjs/impersonate/hooks/useAutoClearReactQuery.web.js +1 -0
- package/lib/commonjs/impersonate/hooks/useAutoClearRedux.js +1 -188
- package/lib/commonjs/impersonate/hooks/useAutoClearRedux.web.js +1 -0
- package/lib/commonjs/impersonate/hooks/useImpersonate.js +1 -215
- package/lib/commonjs/impersonate/hooks/useImpersonateHistory.js +1 -56
- package/lib/commonjs/impersonate/types/index.js +1 -16
- package/lib/commonjs/impersonate/types/types.js +1 -1
- package/lib/commonjs/impersonate/utils/impersonateListener.js +1 -335
- package/lib/commonjs/impersonate/utils/impersonateStore.js +1 -675
- package/lib/commonjs/index.js +1 -150
- package/lib/commonjs/preset.js +1 -232
- package/lib/commonjs/sync/impersonateSyncAdapter.js +1 -161
- package/lib/module/impersonate/components/DataNukeSettings.js +8 -670
- package/lib/module/impersonate/components/ImpersonateBanner.js +1 -215
- package/lib/module/impersonate/components/ImpersonateHistoryList.js +1 -176
- package/lib/module/impersonate/components/ImpersonateModal.js +1 -314
- package/lib/module/impersonate/components/ImpersonateOverlay.js +1 -21
- package/lib/module/impersonate/components/ImpersonateStatusBar.js +1 -125
- package/lib/module/impersonate/components/UserAvatar.js +1 -140
- package/lib/module/impersonate/components/UserCard.js +1 -196
- package/lib/module/impersonate/components/UserSearchView.js +1 -222
- package/lib/module/impersonate/hooks/asyncStoragePeer.js +1 -0
- package/lib/module/impersonate/hooks/asyncStoragePeer.web.js +1 -0
- package/lib/module/impersonate/hooks/useAutoClearAsyncStorage.js +1 -140
- package/lib/module/impersonate/hooks/useAutoClearReactQuery.js +1 -151
- package/lib/module/impersonate/hooks/useAutoClearReactQuery.web.js +1 -0
- package/lib/module/impersonate/hooks/useAutoClearRedux.js +1 -183
- package/lib/module/impersonate/hooks/useAutoClearRedux.web.js +1 -0
- package/lib/module/impersonate/hooks/useImpersonate.js +1 -212
- package/lib/module/impersonate/hooks/useImpersonateHistory.js +1 -52
- package/lib/module/impersonate/types/index.js +1 -3
- package/lib/module/impersonate/types/types.js +1 -1
- package/lib/module/impersonate/utils/impersonateListener.js +1 -326
- package/lib/module/impersonate/utils/impersonateStore.js +1 -672
- package/lib/module/index.js +1 -117
- package/lib/module/preset.js +1 -216
- package/lib/module/sync/impersonateSyncAdapter.js +1 -153
- package/lib/typescript/impersonate/hooks/asyncStoragePeer.d.ts +7 -0
- package/lib/typescript/impersonate/hooks/asyncStoragePeer.web.d.ts +2 -0
- package/lib/typescript/impersonate/hooks/useAutoClearAsyncStorage.d.ts +3 -12
- package/lib/typescript/impersonate/hooks/useAutoClearReactQuery.web.d.ts +3 -0
- package/lib/typescript/impersonate/hooks/useAutoClearRedux.web.d.ts +4 -0
- package/lib/typescript/impersonate/types/types.d.ts +6 -0
- package/lib/typescript/impersonate/utils/impersonateListener.d.ts +1 -0
- package/lib/web/index.mjs +10 -0
- package/package.json +32 -10
- package/lib/typescript/impersonate/components/DataNukeSettings.d.ts.map +0 -1
- package/lib/typescript/impersonate/components/ImpersonateBanner.d.ts.map +0 -1
- package/lib/typescript/impersonate/components/ImpersonateHistoryList.d.ts.map +0 -1
- package/lib/typescript/impersonate/components/ImpersonateModal.d.ts.map +0 -1
- package/lib/typescript/impersonate/components/ImpersonateOverlay.d.ts.map +0 -1
- package/lib/typescript/impersonate/components/ImpersonateStatusBar.d.ts.map +0 -1
- package/lib/typescript/impersonate/components/UserAvatar.d.ts.map +0 -1
- package/lib/typescript/impersonate/components/UserCard.d.ts.map +0 -1
- package/lib/typescript/impersonate/components/UserSearchView.d.ts.map +0 -1
- package/lib/typescript/impersonate/hooks/useAutoClearAsyncStorage.d.ts.map +0 -1
- package/lib/typescript/impersonate/hooks/useAutoClearReactQuery.d.ts.map +0 -1
- package/lib/typescript/impersonate/hooks/useAutoClearRedux.d.ts.map +0 -1
- package/lib/typescript/impersonate/hooks/useImpersonate.d.ts.map +0 -1
- package/lib/typescript/impersonate/hooks/useImpersonateHistory.d.ts.map +0 -1
- package/lib/typescript/impersonate/types/index.d.ts.map +0 -1
- package/lib/typescript/impersonate/types/types.d.ts.map +0 -1
- package/lib/typescript/impersonate/utils/impersonateListener.d.ts.map +0 -1
- package/lib/typescript/impersonate/utils/impersonateStore.d.ts.map +0 -1
- package/lib/typescript/index.d.ts.map +0 -1
- package/lib/typescript/preset.d.ts.map +0 -1
- package/lib/typescript/sync/impersonateSyncAdapter.d.ts.map +0 -1
package/README.md
CHANGED
|
@@ -1,91 +1,27 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
|
|
1
3
|
# @buoy-gg/impersonate
|
|
2
4
|
|
|
3
|
-
|
|
5
|
+
Connect your app's user-switching flow to Buoy so testers can switch test accounts, roles or flags without rebuilding.
|
|
4
6
|
|
|
5
|
-
|
|
7
|
+
<a href="https://buoy.gg/buoy/latest/docs/tools/impersonate"><b>Impersonate guide</b></a> · <a href="https://buoy.gg">buoy.gg</a> · <a href="https://github.com/Buoy-gg/buoy">All tools</a>
|
|
6
8
|
|
|
7
|
-
|
|
9
|
+
[](https://www.npmjs.com/package/@buoy-gg/impersonate) [](https://www.npmjs.com/package/@buoy-gg/impersonate)
|
|
8
10
|
|
|
9
|
-
|
|
11
|
+
<a href="https://buoy.gg/buoy/latest/docs/tools/impersonate"><img src="https://raw.githubusercontent.com/Buoy-gg/buoy/main/.github/readme/tools/impersonate.png" alt="Watch the Impersonate film on buoy.gg" width="640" /></a>
|
|
10
12
|
|
|
11
|
-
|
|
12
|
-
npm install @buoy-gg/core @buoy-gg/impersonate
|
|
13
|
-
```
|
|
14
|
-
|
|
15
|
-
## Before you start
|
|
13
|
+
</div>
|
|
16
14
|
|
|
17
|
-
|
|
15
|
+
## Install
|
|
18
16
|
|
|
19
17
|
```bash
|
|
20
|
-
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
For Expo, initialize Buoy before rendering the menu:
|
|
24
|
-
|
|
25
|
-
```tsx
|
|
26
|
-
import { Buoy } from "@buoy-gg/core";
|
|
27
|
-
|
|
28
|
-
Buoy.init({ licenseKey: process.env.EXPO_PUBLIC_BUOY_KEY });
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
The login command writes the Expo key to `.env.local`. For React Native CLI, pass the key from your app’s environment configuration; React Native does not load `.env.local` automatically. Mount `FloatingDevTools` inside the same providers as your screens and restart the development server after installation. The [Quick Start](https://buoy.gg/buoy/latest/docs/quick-start) shows the complete root component setup.
|
|
32
|
-
|
|
33
|
-
## Quick start
|
|
34
|
-
|
|
35
|
-
Unlike most Buoy tools, this one needs a little config — it has to know how to search *your* users:
|
|
36
|
-
|
|
37
|
-
```tsx
|
|
38
|
-
import { FloatingDevTools } from "@buoy-gg/core";
|
|
39
|
-
import { createImpersonateTool } from "@buoy-gg/impersonate";
|
|
40
|
-
|
|
41
|
-
const impersonateTool = createImpersonateTool({
|
|
42
|
-
onSearchUsers: async (query) => {
|
|
43
|
-
const { users } = await api.searchUsers({ email: query });
|
|
44
|
-
return users.map((u) => ({
|
|
45
|
-
id: u.id, // sent in the impersonation header
|
|
46
|
-
displayName: u.name,
|
|
47
|
-
email: u.email,
|
|
48
|
-
metadata: { role: u.role },
|
|
49
|
-
}));
|
|
50
|
-
},
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
export default function App() {
|
|
54
|
-
return (
|
|
55
|
-
<>
|
|
56
|
-
<YourApp />
|
|
57
|
-
<FloatingDevTools apps={[impersonateTool]} />
|
|
58
|
-
</>
|
|
59
|
-
);
|
|
60
|
-
}
|
|
18
|
+
npm install @buoy-gg/core @buoy-gg/impersonate
|
|
61
19
|
```
|
|
62
20
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
## Check the integration
|
|
66
|
-
|
|
67
|
-
Switch between two test accounts and confirm both the visible identity and subsequent authenticated requests. Your backend must authorize the switch. Redux clearing requires a reducer that handles `@@RESET` or your own reset callback; Buoy cannot infer your app’s reset behavior.
|
|
21
|
+
This tool needs a little config: build it with `createImpersonateTool` and an `onSearchUsers` function that searches your users.
|
|
68
22
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
- **Header injection** — adds the configured header through patched global fetch and XHR paths while impersonation is active
|
|
72
|
-
- **Data clearing** — supports query-cache clearing and Redux reset integration. Your reducer must handle `@@RESET`, or provide a reset callback. Storage clearing uses optional callbacks
|
|
73
|
-
- **Floating banner** — identifies the active impersonation when the banner is enabled
|
|
74
|
-
- **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
|
|
75
|
-
- **History** — quick-switch between your last 10 impersonated users, persisted across app restarts
|
|
76
|
-
- **Developer defaults** — ship team-wide defaults for header name, banner, and clearing behavior; the Settings tab exports your current config as paste-ready code
|
|
77
|
-
- **`showSettingsTab: false`** — lock it down to just Search and History for simpler setups
|
|
78
|
-
|
|
79
|
-
## Desktop & AI
|
|
80
|
-
|
|
81
|
-
To connect a React Native app to [Buoy Desktop](https://github.com/Buoy-gg/Buoy-Desktop) or MCP, install `@buoy-gg/external-sync` and follow the [Desktop connection guide](https://buoy.gg/buoy/latest/docs/desktop). Sign in to Desktop separately. [MCP setup](https://buoy.gg/buoy/latest/docs/mcp) also requires a process account and Pro access. Available remote actions depend on the tool and app integration.
|
|
82
|
-
|
|
83
|
-
## Account and plan requirements
|
|
84
|
-
|
|
85
|
-
Use a Free or Pro Buoy account. History limits and paid features vary by tool; see [pricing](https://buoy.gg/pricing). Production access requires Pro where supported. Development-only hooks and actions remain unavailable in release builds.
|
|
23
|
+
The [Impersonate guide](https://buoy.gg/buoy/latest/docs/tools/impersonate) covers setup, what it captures and its limits. New to Buoy? Start with the [Quick start](https://buoy.gg/buoy/latest/docs/quick-start).
|
|
86
24
|
|
|
87
25
|
---
|
|
88
26
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
Proprietary software. © Buoy LLC. [Terms](https://buoy.gg/terms)
|
|
27
|
+
<sub>Part of <a href="https://buoy.gg">Buoy</a>, developer tools that live inside your app. Proprietary software. © Buoy LLC. <a href="https://buoy.gg/terms">Terms</a></sub>
|