@renown/sdk 5.1.0 → 5.2.0-staging.2

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 (117) hide show
  1. package/README.md +487 -1
  2. package/dist/e2e/fixtures/main.d.ts +2 -0
  3. package/dist/e2e/fixtures/main.d.ts.map +1 -0
  4. package/dist/e2e/fixtures/main.js +97 -0
  5. package/dist/e2e/fixtures/main.js.map +1 -0
  6. package/dist/e2e/fixtures/vite.config.d.ts +3 -0
  7. package/dist/e2e/fixtures/vite.config.d.ts.map +1 -0
  8. package/dist/e2e/fixtures/vite.config.js +10 -0
  9. package/dist/e2e/fixtures/vite.config.js.map +1 -0
  10. package/dist/e2e/renown-components.spec.d.ts +2 -0
  11. package/dist/e2e/renown-components.spec.d.ts.map +1 -0
  12. package/dist/e2e/renown-components.spec.js +155 -0
  13. package/dist/e2e/renown-components.spec.js.map +1 -0
  14. package/dist/playwright.config.d.ts +3 -0
  15. package/dist/playwright.config.d.ts.map +1 -0
  16. package/dist/playwright.config.js +25 -0
  17. package/dist/playwright.config.js.map +1 -0
  18. package/dist/src/assets/assets.d.ts +19 -0
  19. package/dist/src/assets/renown-hover.svg +17 -0
  20. package/dist/src/assets/renown-light.svg +15 -0
  21. package/dist/src/assets/renown-short-hover.png +0 -0
  22. package/dist/src/assets/renown-short.png +0 -0
  23. package/dist/src/assets/renown.svg +16 -0
  24. package/dist/src/common.d.ts +1 -1
  25. package/dist/src/common.d.ts.map +1 -1
  26. package/dist/src/components/RenownAuthButton.d.ts +62 -0
  27. package/dist/src/components/RenownAuthButton.d.ts.map +1 -0
  28. package/dist/src/components/RenownAuthButton.js +82 -0
  29. package/dist/src/components/RenownAuthButton.js.map +1 -0
  30. package/dist/src/components/RenownLoginButton.d.ts +48 -0
  31. package/dist/src/components/RenownLoginButton.d.ts.map +1 -0
  32. package/dist/src/components/RenownLoginButton.js +175 -0
  33. package/dist/src/components/RenownLoginButton.js.map +1 -0
  34. package/dist/src/components/RenownUserButton.d.ts +66 -0
  35. package/dist/src/components/RenownUserButton.d.ts.map +1 -0
  36. package/dist/src/components/RenownUserButton.js +216 -0
  37. package/dist/src/components/RenownUserButton.js.map +1 -0
  38. package/dist/src/components/icons.d.ts +25 -0
  39. package/dist/src/components/icons.d.ts.map +1 -0
  40. package/dist/src/components/icons.js +24 -0
  41. package/dist/src/components/icons.js.map +1 -0
  42. package/dist/src/components/image-data.d.ts +3 -0
  43. package/dist/src/components/image-data.d.ts.map +1 -0
  44. package/dist/src/components/image-data.js +4 -0
  45. package/dist/src/components/image-data.js.map +1 -0
  46. package/dist/src/components/index.d.ts +7 -3
  47. package/dist/src/components/index.d.ts.map +1 -1
  48. package/dist/src/components/index.js +4 -1
  49. package/dist/src/components/index.js.map +1 -1
  50. package/dist/src/constants.d.ts +1 -1
  51. package/dist/src/constants.d.ts.map +1 -1
  52. package/dist/src/constants.js +1 -1
  53. package/dist/src/constants.js.map +1 -1
  54. package/dist/src/hooks/index.d.ts +2 -0
  55. package/dist/src/hooks/index.d.ts.map +1 -0
  56. package/dist/src/hooks/index.js +2 -0
  57. package/dist/src/hooks/index.js.map +1 -0
  58. package/dist/src/hooks/use-user.d.ts +21 -0
  59. package/dist/src/hooks/use-user.d.ts.map +1 -0
  60. package/dist/src/hooks/use-user.js +30 -0
  61. package/dist/src/hooks/use-user.js.map +1 -0
  62. package/dist/src/index.d.ts +8 -1
  63. package/dist/src/index.d.ts.map +1 -1
  64. package/dist/src/index.js +8 -1
  65. package/dist/src/index.js.map +1 -1
  66. package/dist/src/lib/crypto/browser.d.ts +8 -0
  67. package/dist/src/lib/crypto/browser.d.ts.map +1 -0
  68. package/dist/src/lib/crypto/browser.js +73 -0
  69. package/dist/src/lib/crypto/browser.js.map +1 -0
  70. package/dist/src/lib/crypto/index.d.ts +36 -0
  71. package/dist/src/lib/crypto/index.d.ts.map +1 -0
  72. package/dist/src/lib/crypto/index.js +150 -0
  73. package/dist/src/lib/crypto/index.js.map +1 -0
  74. package/dist/src/lib/crypto/node.d.ts +8 -0
  75. package/dist/src/lib/crypto/node.d.ts.map +1 -0
  76. package/dist/src/lib/crypto/node.js +67 -0
  77. package/dist/src/lib/crypto/node.js.map +1 -0
  78. package/dist/src/lib/renown/constants.d.ts +130 -0
  79. package/dist/src/lib/renown/constants.d.ts.map +1 -0
  80. package/dist/src/lib/renown/constants.js +40 -0
  81. package/dist/src/lib/renown/constants.js.map +1 -0
  82. package/dist/src/lib/renown/did-parser.d.ts +28 -0
  83. package/dist/src/lib/renown/did-parser.d.ts.map +1 -0
  84. package/dist/src/lib/renown/did-parser.js +57 -0
  85. package/dist/src/lib/renown/did-parser.js.map +1 -0
  86. package/dist/src/lib/renown/index.d.ts +4 -0
  87. package/dist/src/lib/renown/index.d.ts.map +1 -0
  88. package/dist/src/lib/renown/index.js +4 -0
  89. package/dist/src/lib/renown/index.js.map +1 -0
  90. package/dist/src/lib/renown/utils.d.ts +33 -0
  91. package/dist/src/lib/renown/utils.d.ts.map +1 -0
  92. package/dist/src/lib/renown/utils.js +207 -0
  93. package/dist/src/lib/renown/utils.js.map +1 -0
  94. package/dist/src/lib/session-storage.d.ts +40 -0
  95. package/dist/src/lib/session-storage.d.ts.map +1 -0
  96. package/dist/src/lib/session-storage.js +107 -0
  97. package/dist/src/lib/session-storage.js.map +1 -0
  98. package/dist/src/providers/index.d.ts +3 -0
  99. package/dist/src/providers/index.d.ts.map +1 -0
  100. package/dist/src/providers/index.js +2 -0
  101. package/dist/src/providers/index.js.map +1 -0
  102. package/dist/src/providers/renown-user-provider.d.ts +72 -0
  103. package/dist/src/providers/renown-user-provider.d.ts.map +1 -0
  104. package/dist/src/providers/renown-user-provider.js +171 -0
  105. package/dist/src/providers/renown-user-provider.js.map +1 -0
  106. package/dist/src/types.d.ts +3 -2
  107. package/dist/src/types.d.ts.map +1 -1
  108. package/dist/tsconfig.tsbuildinfo +1 -1
  109. package/package.json +26 -6
  110. package/dist/src/components/RenownLoginAvatar.d.ts +0 -44
  111. package/dist/src/components/RenownLoginAvatar.d.ts.map +0 -1
  112. package/dist/src/components/RenownLoginAvatar.js +0 -50
  113. package/dist/src/components/RenownLoginAvatar.js.map +0 -1
  114. package/dist/src/components/types.d.ts +0 -12
  115. package/dist/src/components/types.d.ts.map +0 -1
  116. package/dist/src/components/types.js +0 -2
  117. package/dist/src/components/types.js.map +0 -1
package/README.md CHANGED
@@ -1,3 +1,489 @@
1
1
  # Renown SDK
2
2
 
3
- This package contains methods to interact with Renown and manage the user's session.
3
+ A comprehensive SDK for integrating Renown authentication and user profile management into your React applications.
4
+
5
+ ## Features
6
+
7
+ - 🔐 **Authentication** - Complete authentication flow with session management
8
+ - 👤 **User Profiles** - Fetch and manage user profile data
9
+ - ⚛️ **React Integration** - Provider and hooks for seamless React integration
10
+ - 🎨 **UI Components** - Ready-to-use login and auth components
11
+ - 🔄 **Session Persistence** - Automatic session restoration across page reloads
12
+ - 🌐 **Renown Portal** - Easy integration with Renown authentication portal
13
+ - 📦 **Type-Safe** - Full TypeScript support
14
+
15
+ ## Installation
16
+
17
+ ```bash
18
+ npm install @renown/sdk
19
+ # or
20
+ yarn add @renown/sdk
21
+ # or
22
+ pnpm add @renown/sdk
23
+ ```
24
+
25
+ ## Quick Start
26
+
27
+ ### 1. Wrap Your App with RenownUserProvider
28
+
29
+ The SDK automatically initializes - just wrap your app!
30
+
31
+ ```typescript
32
+ // app/layout.tsx or app.tsx
33
+ import { RenownUserProvider } from '@renown/sdk'
34
+
35
+ export default function RootLayout({ children }) {
36
+ return (
37
+ <html>
38
+ <body>
39
+ <RenownUserProvider>
40
+ {children}
41
+ </RenownUserProvider>
42
+ </body>
43
+ </html>
44
+ )
45
+ }
46
+ ```
47
+
48
+ ### 2. Use Authentication in Components
49
+
50
+ **Option A: Use the RenownAuthButton component**
51
+
52
+ ```typescript
53
+ import { RenownAuthButton } from '@renown/sdk'
54
+
55
+ export function Header() {
56
+ return (
57
+ <header>
58
+ <h1>My App</h1>
59
+ <RenownAuthButton showLogoutButton />
60
+ </header>
61
+ )
62
+ }
63
+ ```
64
+
65
+ **Option B: Build custom UI with useUser hook**
66
+
67
+ ```typescript
68
+ import { useUser } from '@renown/sdk'
69
+
70
+ export function CustomAuth() {
71
+ const { user, openRenown, logout } = useUser()
72
+
73
+ if (!user) return <button onClick={openRenown}>Login</button>
74
+ return <button onClick={logout}>Logout</button>
75
+ }
76
+ ```
77
+
78
+ ## UI Components
79
+
80
+ The SDK includes a ready-to-use React component for authentication:
81
+
82
+ ### RenownAuthButton
83
+
84
+ Smart button that adapts to auth state - shows login button when not authenticated, and user info when authenticated:
85
+
86
+ ```typescript
87
+ import { RenownAuthButton } from '@renown/sdk'
88
+
89
+ <RenownAuthButton showLogoutButton />
90
+ ```
91
+
92
+ For detailed component documentation and examples, see [COMPONENTS.md](./COMPONENTS.md).
93
+
94
+ ## API Reference
95
+
96
+ ### Components
97
+
98
+ #### `<RenownUserProvider>`
99
+
100
+ Central authentication provider that automatically initializes the SDK.
101
+
102
+ **Props:**
103
+ - `children`: React.ReactNode - **Required.** Your application components
104
+ - `renownUrl?`: string - Renown service URL (default: 'https://www.renown.id')
105
+ - `networkId?`: string - Network ID (default: 'eip155')
106
+ - `chainId?`: string - Chain ID (default: '1')
107
+ - `loadingComponent?`: React.ReactNode - Custom loading UI
108
+ - `errorComponent?`: (error, retry) => React.ReactNode - Custom error UI
109
+
110
+ **Example:**
111
+ ```typescript
112
+ <RenownUserProvider>
113
+ <App />
114
+ </RenownUserProvider>
115
+ ```
116
+
117
+ **Custom Configuration:**
118
+ ```typescript
119
+ <RenownUserProvider
120
+ renownUrl={process.env.NEXT_PUBLIC_RENOWN_URL}
121
+ loadingComponent={<Spinner />}
122
+ errorComponent={(error, retry) => <ErrorScreen error={error} onRetry={retry} />}
123
+ >
124
+ <App />
125
+ </RenownUserProvider>
126
+ ```
127
+
128
+ ### Hooks
129
+
130
+ #### `useUser()`
131
+
132
+ Access authentication state and methods throughout your application.
133
+
134
+ **Returns:**
135
+ ```typescript
136
+ {
137
+ user: User | null // Current authenticated user
138
+ loginStatus: LoginStatus // 'initial' | 'checking' | 'authorized' | 'not-authorized'
139
+ isLoading: boolean // Loading state for auth operations
140
+ isInitialized: boolean // Whether auth system is initialized
141
+ login: (userDid?: string) => Promise<void> // Login with optional DID
142
+ logout: () => Promise<void> // Logout current user
143
+ openRenown: () => void // Open Renown portal
144
+ }
145
+ ```
146
+
147
+ **Example:**
148
+ ```typescript
149
+ function UserProfile() {
150
+ const { user, loginStatus, openRenown, logout } = useUser()
151
+
152
+ switch (loginStatus) {
153
+ case 'authorized':
154
+ return (
155
+ <div>
156
+ <h1>{user?.name || 'User'}</h1>
157
+ <p>{user?.did}</p>
158
+ {user?.avatar && <img src={user.avatar} alt="Avatar" />}
159
+ <button onClick={logout}>Logout</button>
160
+ </div>
161
+ )
162
+ case 'not-authorized':
163
+ return <button onClick={openRenown}>Login</button>
164
+ default:
165
+ return <div>Checking auth...</div>
166
+ }
167
+ }
168
+ ```
169
+
170
+ ### Types
171
+
172
+ #### `User`
173
+
174
+ ```typescript
175
+ interface User {
176
+ did: string // Decentralized identifier
177
+ address: string // Ethereum address
178
+ name?: string // Display name from profile
179
+ email?: string // Email address
180
+ avatar?: string // Avatar image URL
181
+ ethAddress?: string // Ethereum address
182
+ }
183
+ ```
184
+
185
+ #### `LoginStatus`
186
+
187
+ ```typescript
188
+ type LoginStatus =
189
+ | 'initial' // Not yet checked
190
+ | 'checking' // Currently checking auth
191
+ | 'authorized' // User is authenticated
192
+ | 'not-authorized' // User is not authenticated
193
+ ```
194
+
195
+ ### Utility Functions
196
+
197
+ #### `fetchProfileDataForUser(user: User): Promise<User>`
198
+
199
+ Fetches additional profile data from the Renown API for a given user.
200
+
201
+ ```typescript
202
+ import { fetchProfileDataForUser } from '@renown/sdk'
203
+
204
+ const userWithProfile = await fetchProfileDataForUser(user)
205
+ ```
206
+
207
+ #### `login(userDid: string, renown: IRenown, connectCrypto: IConnectCrypto)`
208
+
209
+ Performs login and stores session data.
210
+
211
+ #### `logout()`
212
+
213
+ Logs out the current user and clears session data.
214
+
215
+ #### `openRenown()`
216
+
217
+ Opens the Renown authentication portal.
218
+
219
+ #### `handleRenownReturn()`
220
+
221
+ Handles return from Renown authentication flow.
222
+
223
+ ### Session Management
224
+
225
+ #### `SessionStorageManager`
226
+
227
+ Manages user session persistence in sessionStorage.
228
+
229
+ **Methods:**
230
+ - `setUserData(data)` - Store user data
231
+ - `getUserData()` - Retrieve stored user data
232
+ - `clearUserData()` - Clear session data
233
+ - `isUserDataValid(data)` - Check if session data is valid
234
+
235
+ ```typescript
236
+ import { SessionStorageManager } from '@renown/sdk'
237
+
238
+ // Store user session
239
+ SessionStorageManager.setUserData({
240
+ user: currentUser,
241
+ userDid: currentUser.did,
242
+ loginStatus: 'authorized',
243
+ timestamp: Date.now()
244
+ })
245
+
246
+ // Check session
247
+ const storedData = SessionStorageManager.getUserData()
248
+ if (storedData && SessionStorageManager.isUserDataValid(storedData)) {
249
+ // Session is valid
250
+ }
251
+ ```
252
+
253
+ ## Advanced Usage
254
+
255
+ ### Custom Authentication Flow
256
+
257
+ You can implement custom authentication flows by directly using the SDK functions:
258
+
259
+ ```typescript
260
+ import { login, logout, initRenown, ConnectCrypto, BrowserKeyStorage } from '@renown/sdk'
261
+
262
+ async function customLogin() {
263
+ // Initialize
264
+ const connectCrypto = new ConnectCrypto(new BrowserKeyStorage())
265
+ const renown = await initRenown(
266
+ await connectCrypto.did(),
267
+ 'eip155',
268
+ 'https://www.renown.id'
269
+ )
270
+
271
+ // Login
272
+ const userDid = await connectCrypto.did()
273
+ const user = await login(userDid, renown, connectCrypto)
274
+
275
+ return user
276
+ }
277
+ ```
278
+
279
+ ### Conditional Rendering Based on Auth
280
+
281
+ ```typescript
282
+ function ProtectedContent() {
283
+ const { user, loginStatus, openRenown } = useUser()
284
+
285
+ if (loginStatus !== 'authorized') {
286
+ return (
287
+ <div>
288
+ <h1>Please login to continue</h1>
289
+ <button onClick={openRenown}>Login</button>
290
+ </div>
291
+ )
292
+ }
293
+
294
+ return <div>Protected content for {user?.name}</div>
295
+ }
296
+ ```
297
+
298
+ ### Handling Authentication Events
299
+
300
+ ```typescript
301
+ function AuthListener() {
302
+ const { user, loginStatus } = useUser()
303
+
304
+ useEffect(() => {
305
+ if (loginStatus === 'authorized' && user) {
306
+ console.log('User logged in:', user)
307
+ // Analytics, notifications, etc.
308
+ }
309
+ }, [loginStatus, user])
310
+
311
+ return null
312
+ }
313
+ ```
314
+
315
+ ## Configuration
316
+
317
+ ### RenownUserProvider Configuration
318
+
319
+ The RenownUserProvider accepts optional configuration props:
320
+
321
+ ```typescript
322
+ <RenownUserProvider
323
+ renownUrl="https://www.renown.id" // Custom Renown URL
324
+ networkId="eip155" // Network ID (default)
325
+ chainId="1" // Chain ID (default)
326
+ >
327
+ <App />
328
+ </RenownUserProvider>
329
+ ```
330
+
331
+ ### Environment Variables
332
+
333
+ Use environment variables for dynamic configuration:
334
+
335
+ ```typescript
336
+ <RenownUserProvider
337
+ renownUrl={process.env.NEXT_PUBLIC_RENOWN_URL || 'https://www.renown.id'}
338
+ >
339
+ <App />
340
+ </RenownUserProvider>
341
+ ```
342
+
343
+ ```bash
344
+ # .env
345
+ NEXT_PUBLIC_RENOWN_URL=https://www.renown.id
346
+ ```
347
+
348
+ ## Examples
349
+
350
+ ### Next.js App Router
351
+
352
+ ```typescript
353
+ // app/layout.tsx
354
+ import { RenownUserProvider } from '@renown/sdk'
355
+
356
+ export default function RootLayout({ children }) {
357
+ return (
358
+ <html lang="en">
359
+ <body>
360
+ <RenownUserProvider>
361
+ {children}
362
+ </RenownUserProvider>
363
+ </body>
364
+ </html>
365
+ )
366
+ }
367
+
368
+ // components/Navbar.tsx - Using RenownAuthButton
369
+ 'use client'
370
+
371
+ import { RenownAuthButton } from '@renown/sdk'
372
+
373
+ export function Navbar() {
374
+ return (
375
+ <nav>
376
+ <h1>My App</h1>
377
+ <RenownAuthButton showLogoutButton />
378
+ </nav>
379
+ )
380
+ }
381
+
382
+ // app/profile/page.tsx - Using useUser hook
383
+ 'use client'
384
+
385
+ import { useUser } from '@renown/sdk'
386
+
387
+ export default function ProfilePage() {
388
+ const { user, openRenown, logout } = useUser()
389
+
390
+ if (!user) {
391
+ return (
392
+ <div>
393
+ <h1>Login Required</h1>
394
+ <button onClick={openRenown}>Login with Renown</button>
395
+ </div>
396
+ )
397
+ }
398
+
399
+ return (
400
+ <div>
401
+ <h1>Profile</h1>
402
+ <p>DID: {user.did}</p>
403
+ <p>Name: {user.name}</p>
404
+ <button onClick={logout}>Logout</button>
405
+ </div>
406
+ )
407
+ }
408
+ ```
409
+
410
+ ### React SPA
411
+
412
+ ```typescript
413
+ // main.tsx
414
+ import { RenownUserProvider } from '@renown/sdk'
415
+ import App from './App'
416
+
417
+ ReactDOM.createRoot(document.getElementById('root')!).render(
418
+ <React.StrictMode>
419
+ <RenownUserProvider>
420
+ <App />
421
+ </RenownUserProvider>
422
+ </React.StrictMode>
423
+ )
424
+
425
+ // App.tsx - Using RenownAuthButton
426
+ import { RenownAuthButton } from '@renown/sdk'
427
+
428
+ function App() {
429
+ return (
430
+ <div>
431
+ <h1>My App</h1>
432
+ <RenownAuthButton showLogoutButton />
433
+ </div>
434
+ )
435
+ }
436
+ ```
437
+
438
+ ## Troubleshooting
439
+
440
+ ### RenownUserProvider Context Error
441
+
442
+ **Error:** `useUser must be used within an RenownUserProvider`
443
+
444
+ **Solution:** Ensure your component is wrapped by `<RenownUserProvider>`:
445
+
446
+ ```typescript
447
+ <RenownUserProvider>
448
+ <YourComponent /> {/* ✅ Can use useUser */}
449
+ </RenownUserProvider>
450
+ ```
451
+
452
+ ### Custom Renown URL
453
+
454
+ To use a different Renown instance:
455
+
456
+ ```typescript
457
+ <RenownUserProvider renownUrl="https://your-renown-instance.com">
458
+ <App />
459
+ </RenownUserProvider>
460
+ ```
461
+
462
+ ### Session Not Persisting
463
+
464
+ If sessions aren't persisting across page reloads:
465
+
466
+ 1. Check that sessionStorage is available (not in incognito mode)
467
+ 2. Verify the session hasn't expired (24 hour timeout by default)
468
+ 3. Check browser console for any errors during initialization
469
+
470
+ ## Contributing
471
+
472
+ Contributions are welcome! Please read our contributing guidelines before submitting PRs.
473
+
474
+ ## License
475
+
476
+ AGPL-3.0-only
477
+
478
+ ## Documentation
479
+
480
+ Full documentation is available in the Powerhouse Academy:
481
+ - [Overview & Quick Start](../../apps/academy/docs/academy/04-APIReferences/renown-sdk/00-Overview.md)
482
+ - [Authentication Guide](../../apps/academy/docs/academy/04-APIReferences/renown-sdk/01-Authentication.md)
483
+ - [API Reference](../../apps/academy/docs/academy/04-APIReferences/renown-sdk/02-APIReference.md)
484
+
485
+ ## Support
486
+
487
+ For issues and questions:
488
+ - GitHub Issues: [powerhouse-inc/powerhouse](https://github.com/powerhouse-inc/powerhouse)
489
+ - Documentation: [Powerhouse Academy](https://docs.powerhouse.io)
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=main.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../../e2e/fixtures/main.tsx"],"names":[],"mappings":""}
@@ -0,0 +1,97 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useState } from "react";
3
+ import { createRoot } from "react-dom/client";
4
+ import { RenownAuthButton, RenownLoginButton, RenownLogo, RenownUserButton, } from "../../src/components/index.js";
5
+ import { RenownUserProvider } from "../../src/providers/renown-user-provider.js";
6
+ const styles = {
7
+ container: {
8
+ maxWidth: "800px",
9
+ margin: "0 auto",
10
+ padding: "40px 20px",
11
+ },
12
+ header: {
13
+ marginBottom: "40px",
14
+ textAlign: "center",
15
+ },
16
+ title: {
17
+ fontSize: "24px",
18
+ fontWeight: 600,
19
+ marginBottom: "8px",
20
+ color: "#111827",
21
+ },
22
+ subtitle: {
23
+ fontSize: "14px",
24
+ color: "#6b7280",
25
+ },
26
+ section: {
27
+ marginBottom: "40px",
28
+ padding: "24px",
29
+ backgroundColor: "white",
30
+ borderRadius: "12px",
31
+ boxShadow: "0 1px 3px rgba(0, 0, 0, 0.1)",
32
+ },
33
+ sectionTitle: {
34
+ fontSize: "16px",
35
+ fontWeight: 600,
36
+ marginBottom: "16px",
37
+ color: "#374151",
38
+ display: "flex",
39
+ alignItems: "center",
40
+ gap: "8px",
41
+ },
42
+ componentRow: {
43
+ display: "flex",
44
+ alignItems: "center",
45
+ gap: "16px",
46
+ padding: "16px",
47
+ backgroundColor: "#f9fafb",
48
+ borderRadius: "8px",
49
+ marginBottom: "12px",
50
+ },
51
+ label: {
52
+ fontSize: "14px",
53
+ color: "#4b5563",
54
+ minWidth: "160px",
55
+ },
56
+ code: {
57
+ fontFamily: "monospace",
58
+ fontSize: "12px",
59
+ backgroundColor: "#f3f4f6",
60
+ padding: "2px 6px",
61
+ borderRadius: "4px",
62
+ },
63
+ description: {
64
+ fontSize: "13px",
65
+ color: "#6b7280",
66
+ marginTop: "8px",
67
+ lineHeight: "1.5",
68
+ },
69
+ };
70
+ function App() {
71
+ const [mockUser] = useState({
72
+ address: "0x1234567890abcdef1234567890abcdef12345678",
73
+ username: "vitalik.eth",
74
+ avatarUrl: undefined,
75
+ });
76
+ return (_jsxs("div", { style: styles.container, children: [_jsxs("header", { style: styles.header, children: [_jsx("div", { style: {
77
+ display: "flex",
78
+ justifyContent: "center",
79
+ marginBottom: "16px",
80
+ }, children: _jsx(RenownLogo, { width: 142, height: 38, color: "#374151" }) }), _jsx("h1", { style: styles.title, children: "Renown SDK Components" }), _jsx("p", { style: styles.subtitle, children: "Visual test page for Renown authentication components" })] }), _jsxs("section", { style: styles.section, "data-testid": "login-button-section", children: [_jsx("h2", { style: styles.sectionTitle, children: _jsx("span", { style: styles.code, children: "RenownLoginButton" }) }), _jsxs("p", { style: styles.description, children: ["A login button with Renown branding. By default, clicking triggers login directly. Use ", _jsx("code", { style: styles.code, children: "showPopover" }), " to show a hover popover instead."] }), _jsxs("div", { style: styles.componentRow, children: [_jsx("span", { style: styles.label, children: "Default (direct login):" }), _jsx(RenownLoginButton, { onLogin: () => console.log("Login clicked!") })] }), _jsxs("div", { style: styles.componentRow, "data-testid": "popover-login", children: [_jsx("span", { style: styles.label, children: "With popover:" }), _jsx(RenownLoginButton, { onLogin: () => console.log("Login clicked!"), showPopover: true })] }), _jsxs("div", { style: styles.componentRow, children: [_jsx("span", { style: styles.label, children: "Custom trigger (with popover):" }), _jsx(RenownLoginButton, { onLogin: () => console.log("Login clicked!"), showPopover: true, renderTrigger: ({ onMouseEnter, onMouseLeave }) => (_jsx("button", { onMouseEnter: onMouseEnter, onMouseLeave: onMouseLeave, style: {
81
+ padding: "8px 16px",
82
+ borderRadius: "8px",
83
+ border: "1px solid #ccc",
84
+ cursor: "pointer",
85
+ }, children: "Sign In" })) })] }), _jsxs("div", { style: {
86
+ ...styles.componentRow,
87
+ backgroundColor: "#111827",
88
+ padding: "16px",
89
+ borderRadius: "8px",
90
+ }, "data-testid": "dark-mode-login", children: [_jsx("span", { style: { ...styles.label, color: "#f9fafb" }, children: "Dark mode (with popover):" }), _jsx(RenownLoginButton, { onLogin: () => console.log("Login clicked!"), darkMode: true, showPopover: true })] })] }), _jsxs("section", { style: styles.section, "data-testid": "user-button-section", children: [_jsx("h2", { style: styles.sectionTitle, children: _jsx("span", { style: styles.code, children: "RenownUserButton" }) }), _jsx("p", { style: styles.description, children: "A user avatar button that shows account info in a popover with options to copy address, view profile, and disconnect. Click the avatar to see the popover." }), _jsxs("div", { style: styles.componentRow, children: [_jsx("span", { style: styles.label, children: "Without avatar:" }), _jsx(RenownUserButton, { address: mockUser.address, username: mockUser.username, userId: "mock-document-id-1", onDisconnect: () => console.log("Disconnect clicked!") })] }), _jsxs("div", { style: styles.componentRow, children: [_jsx("span", { style: styles.label, children: "With avatar:" }), _jsx(RenownUserButton, { address: mockUser.address, username: mockUser.username, avatarUrl: "https://unavatar.io/github/vitalik", userId: "mock-document-id-2", onDisconnect: () => console.log("Disconnect clicked!") })] }), _jsxs("div", { style: styles.componentRow, children: [_jsx("span", { style: styles.label, children: "No username:" }), _jsx(RenownUserButton, { address: mockUser.address, userId: "mock-document-id-3", onDisconnect: () => console.log("Disconnect clicked!") })] })] }), _jsxs("section", { style: styles.section, "data-testid": "auth-button-section", children: [_jsx("h2", { style: styles.sectionTitle, children: _jsx("span", { style: styles.code, children: "RenownAuthButton" }) }), _jsx("p", { style: styles.description, children: "Smart authentication button that adapts based on auth state. Shows RenownLoginButton when not authenticated, and RenownUserButton when authenticated. This component requires the RenownUserProvider to be initialized." }), _jsxs("div", { style: styles.componentRow, children: [_jsx("span", { style: styles.label, children: "With RenownUserProvider:" }), _jsx(RenownUserProvider, { renownUrl: "https://www.renown.id", children: _jsx(RenownAuthButton, {}) })] })] })] }));
91
+ }
92
+ const container = document.getElementById("root");
93
+ if (container) {
94
+ const root = createRoot(container);
95
+ root.render(_jsx(App, {}));
96
+ }
97
+ //# sourceMappingURL=main.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"main.js","sourceRoot":"","sources":["../../../e2e/fixtures/main.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjC,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EACL,gBAAgB,EAChB,iBAAiB,EACjB,UAAU,EACV,gBAAgB,GACjB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,kBAAkB,EAAE,MAAM,6CAA6C,CAAC;AAEjF,MAAM,MAAM,GAAG;IACb,SAAS,EAAE;QACT,QAAQ,EAAE,OAAO;QACjB,MAAM,EAAE,QAAQ;QAChB,OAAO,EAAE,WAAW;KACrB;IACD,MAAM,EAAE;QACN,YAAY,EAAE,MAAM;QACpB,SAAS,EAAE,QAAiB;KAC7B;IACD,KAAK,EAAE;QACL,QAAQ,EAAE,MAAM;QAChB,UAAU,EAAE,GAAG;QACf,YAAY,EAAE,KAAK;QACnB,KAAK,EAAE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appingURL=vite.config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vite.config.d.ts","sourceRoot":"","sources":["../../../e2e/fixtures/vite.config.ts"],"names":[],"mappings":";AAGA,wBAMG"}
@@ -0,0 +1,10 @@
1
+ import react from "@vitejs/plugin-react";
2
+ import { defineConfig } from "vite";
3
+ export default defineConfig({
4
+ plugins: [react()],
5
+ root: __dirname,
6
+ server: {
7
+ port: 5173,
8
+ },
9
+ });
10
+ //# sourceMappingURL=vite.config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vite.config.js","sourceRoot":"","sources":["../../../e2e/fixtures/vite.config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,sBAAsB,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,MAAM,CAAC;AAEpC,eAAe,YAAY,CAAC;IAC1B,OAAO,EAAE,CAAC,KAAK,EAAE,CAAC;IAClB,IAAI,EAAE,SAAS;IACf,MAAM,EAAE;QACN,IAAI,EAAE,IAAI;KACX;CACF,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=renown-components.spec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"renown-components.spec.d.ts","sourceRoot":"","sources":["../../e2e/renown-components.spec.ts"],"names":[],"mappings":""}