yaver-feedback-react-native 0.8.4 → 0.8.6
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/dist/AuthOverlay.js +45 -18
- package/dist/FeedbackModal.js +281 -0
- package/dist/P2PClient.d.ts +23 -2
- package/dist/P2PClient.js +53 -4
- package/dist/QuickActionIcon.js +27 -2
- package/dist/YaverFeedback.d.ts +13 -0
- package/dist/YaverFeedback.js +78 -34
- package/dist/__tests__/AuthDevices.test.d.ts +1 -0
- package/dist/__tests__/AuthDevices.test.js +82 -0
- package/dist/types.d.ts +21 -0
- package/package.json +2 -2
- package/src/AuthOverlay.tsx +48 -19
- package/src/FeedbackModal.tsx +320 -0
- package/src/P2PClient.ts +61 -5
- package/src/QuickActionIcon.tsx +37 -2
- package/src/YaverFeedback.ts +83 -34
- package/src/__tests__/AuthDevices.test.ts +93 -0
- package/src/types.ts +22 -0
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { listReachableDevices } from '../auth';
|
|
2
|
+
|
|
3
|
+
const mockFetch = jest.fn();
|
|
4
|
+
global.fetch = mockFetch as any;
|
|
5
|
+
|
|
6
|
+
describe('auth device listing', () => {
|
|
7
|
+
beforeEach(() => {
|
|
8
|
+
jest.clearAllMocks();
|
|
9
|
+
mockFetch.mockReset();
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
it('keeps guest-shared devices in the shared bucket', async () => {
|
|
13
|
+
mockFetch.mockResolvedValue({
|
|
14
|
+
ok: true,
|
|
15
|
+
json: () =>
|
|
16
|
+
Promise.resolve({
|
|
17
|
+
devices: [
|
|
18
|
+
{
|
|
19
|
+
deviceId: 'own-1',
|
|
20
|
+
name: 'My Mac',
|
|
21
|
+
platform: 'macos',
|
|
22
|
+
isOnline: true,
|
|
23
|
+
isGuest: false,
|
|
24
|
+
quicHost: '10.0.0.10',
|
|
25
|
+
quicPort: 18080,
|
|
26
|
+
lastHeartbeat: 123,
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
deviceId: 'guest-1',
|
|
30
|
+
name: 'yaver-test-ephemeral',
|
|
31
|
+
platform: 'linux',
|
|
32
|
+
isOnline: true,
|
|
33
|
+
isGuest: true,
|
|
34
|
+
hostName: 'Kivanc Cakmak',
|
|
35
|
+
hostEmail: 'kivanc.cakmak@icloud.com',
|
|
36
|
+
accessScope: 'shared-scoped',
|
|
37
|
+
quicHost: '157.180.114.179',
|
|
38
|
+
quicPort: 18080,
|
|
39
|
+
lastHeartbeat: 456,
|
|
40
|
+
},
|
|
41
|
+
],
|
|
42
|
+
}),
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
const result = await listReachableDevices('sdk-user-token');
|
|
46
|
+
|
|
47
|
+
expect(mockFetch).toHaveBeenCalledWith(
|
|
48
|
+
expect.stringContaining('/devices/list'),
|
|
49
|
+
expect.objectContaining({
|
|
50
|
+
headers: { Authorization: 'Bearer sdk-user-token' },
|
|
51
|
+
}),
|
|
52
|
+
);
|
|
53
|
+
expect(result.owned).toHaveLength(1);
|
|
54
|
+
expect(result.shared).toHaveLength(1);
|
|
55
|
+
expect(result.owned[0].deviceId).toBe('own-1');
|
|
56
|
+
expect(result.shared[0]).toMatchObject({
|
|
57
|
+
deviceId: 'guest-1',
|
|
58
|
+
isGuest: true,
|
|
59
|
+
hostEmail: 'kivanc.cakmak@icloud.com',
|
|
60
|
+
accessScope: 'shared-scoped',
|
|
61
|
+
});
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
it('shows shared devices even when the guest owns no machines', async () => {
|
|
65
|
+
mockFetch.mockResolvedValue({
|
|
66
|
+
ok: true,
|
|
67
|
+
json: () =>
|
|
68
|
+
Promise.resolve({
|
|
69
|
+
devices: [
|
|
70
|
+
{
|
|
71
|
+
deviceId: 'guest-only',
|
|
72
|
+
name: 'yaver-test-ephemeral',
|
|
73
|
+
platform: 'linux',
|
|
74
|
+
isOnline: true,
|
|
75
|
+
isGuest: true,
|
|
76
|
+
hostName: 'Kivanc Cakmak',
|
|
77
|
+
hostEmail: 'kivanc.cakmak@icloud.com',
|
|
78
|
+
accessScope: 'shared-scoped',
|
|
79
|
+
quicHost: '157.180.114.179',
|
|
80
|
+
quicPort: 18080,
|
|
81
|
+
lastHeartbeat: 789,
|
|
82
|
+
},
|
|
83
|
+
],
|
|
84
|
+
}),
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
const result = await listReachableDevices('guest-only-token');
|
|
88
|
+
|
|
89
|
+
expect(result.owned).toEqual([]);
|
|
90
|
+
expect(result.shared).toHaveLength(1);
|
|
91
|
+
expect(result.shared[0].deviceId).toBe('guest-only');
|
|
92
|
+
});
|
|
93
|
+
});
|
package/src/types.ts
CHANGED
|
@@ -1,3 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Remote browser-style sign-in session for a coding-agent CLI on the
|
|
3
|
+
* connected yaver host. Mirrors runnerBrowserAuthSession on the agent
|
|
4
|
+
* Go side. Progression: starting → awaiting_browser (openUrl + code
|
|
5
|
+
* filled) → completed | failed | cancelled.
|
|
6
|
+
*/
|
|
7
|
+
export interface RunnerBrowserAuthSession {
|
|
8
|
+
id: string;
|
|
9
|
+
runner: string;
|
|
10
|
+
method: string;
|
|
11
|
+
status: 'starting' | 'awaiting_browser' | 'completed' | 'failed' | 'cancelled';
|
|
12
|
+
openUrl?: string;
|
|
13
|
+
code?: string;
|
|
14
|
+
detail?: string;
|
|
15
|
+
authConfigured?: boolean;
|
|
16
|
+
authSource?: string;
|
|
17
|
+
error?: string;
|
|
18
|
+
startedAt: number;
|
|
19
|
+
updatedAt: number;
|
|
20
|
+
completedAt?: number;
|
|
21
|
+
}
|
|
22
|
+
|
|
1
23
|
export interface FeedbackConfig {
|
|
2
24
|
/** URL of the Yaver agent (e.g. "http://192.168.1.10:18080"). If omitted, auto-discovery is used. */
|
|
3
25
|
agentUrl?: string;
|