@renown/sdk 5.1.0-dev.8 → 5.1.0-dev.9
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 +28 -28
- package/dist/e2e/fixtures/main.js +10 -5
- package/dist/e2e/fixtures/main.js.map +1 -1
- package/dist/e2e/renown-components.spec.js +40 -18
- package/dist/e2e/renown-components.spec.js.map +1 -1
- package/dist/src/components/RenownAuthButton.d.ts +1 -6
- package/dist/src/components/RenownAuthButton.d.ts.map +1 -1
- package/dist/src/components/RenownAuthButton.js +4 -7
- package/dist/src/components/RenownAuthButton.js.map +1 -1
- package/dist/src/components/RenownLoginButton.d.ts +11 -2
- package/dist/src/components/RenownLoginButton.d.ts.map +1 -1
- package/dist/src/components/RenownLoginButton.js +88 -27
- package/dist/src/components/RenownLoginButton.js.map +1 -1
- package/dist/src/components/RenownUserButton.d.ts +6 -5
- package/dist/src/components/RenownUserButton.d.ts.map +1 -1
- package/dist/src/components/RenownUserButton.js +44 -23
- package/dist/src/components/RenownUserButton.js.map +1 -1
- package/dist/src/hooks/use-user.d.ts +4 -4
- package/dist/src/hooks/use-user.d.ts.map +1 -1
- package/dist/src/hooks/use-user.js +6 -6
- package/dist/src/hooks/use-user.js.map +1 -1
- package/dist/src/lib/renown/utils.d.ts +2 -1
- package/dist/src/lib/renown/utils.d.ts.map +1 -1
- package/dist/src/lib/renown/utils.js +9 -1
- package/dist/src/lib/renown/utils.js.map +1 -1
- package/dist/src/providers/index.d.ts +2 -2
- package/dist/src/providers/index.d.ts.map +1 -1
- package/dist/src/providers/index.js +1 -1
- package/dist/src/providers/index.js.map +1 -1
- package/dist/src/providers/{user-provider.d.ts → renown-user-provider.d.ts} +14 -8
- package/dist/src/providers/renown-user-provider.d.ts.map +1 -0
- package/dist/src/providers/{user-provider.js → renown-user-provider.js} +23 -11
- package/dist/src/providers/renown-user-provider.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -3
- package/dist/src/providers/user-provider.d.ts.map +0 -1
- package/dist/src/providers/user-provider.js.map +0 -1
package/README.md
CHANGED
|
@@ -24,21 +24,21 @@ pnpm add @renown/sdk
|
|
|
24
24
|
|
|
25
25
|
## Quick Start
|
|
26
26
|
|
|
27
|
-
### 1. Wrap Your App with
|
|
27
|
+
### 1. Wrap Your App with RenownUserProvider
|
|
28
28
|
|
|
29
29
|
The SDK automatically initializes - just wrap your app!
|
|
30
30
|
|
|
31
31
|
```typescript
|
|
32
32
|
// app/layout.tsx or app.tsx
|
|
33
|
-
import {
|
|
33
|
+
import { RenownUserProvider } from '@renown/sdk'
|
|
34
34
|
|
|
35
35
|
export default function RootLayout({ children }) {
|
|
36
36
|
return (
|
|
37
37
|
<html>
|
|
38
38
|
<body>
|
|
39
|
-
<
|
|
39
|
+
<RenownUserProvider>
|
|
40
40
|
{children}
|
|
41
|
-
</
|
|
41
|
+
</RenownUserProvider>
|
|
42
42
|
</body>
|
|
43
43
|
</html>
|
|
44
44
|
)
|
|
@@ -95,7 +95,7 @@ For detailed component documentation and examples, see [COMPONENTS.md](./COMPONE
|
|
|
95
95
|
|
|
96
96
|
### Components
|
|
97
97
|
|
|
98
|
-
#### `<
|
|
98
|
+
#### `<RenownUserProvider>`
|
|
99
99
|
|
|
100
100
|
Central authentication provider that automatically initializes the SDK.
|
|
101
101
|
|
|
@@ -109,20 +109,20 @@ Central authentication provider that automatically initializes the SDK.
|
|
|
109
109
|
|
|
110
110
|
**Example:**
|
|
111
111
|
```typescript
|
|
112
|
-
<
|
|
112
|
+
<RenownUserProvider>
|
|
113
113
|
<App />
|
|
114
|
-
</
|
|
114
|
+
</RenownUserProvider>
|
|
115
115
|
```
|
|
116
116
|
|
|
117
117
|
**Custom Configuration:**
|
|
118
118
|
```typescript
|
|
119
|
-
<
|
|
119
|
+
<RenownUserProvider
|
|
120
120
|
renownUrl={process.env.NEXT_PUBLIC_RENOWN_URL}
|
|
121
121
|
loadingComponent={<Spinner />}
|
|
122
122
|
errorComponent={(error, retry) => <ErrorScreen error={error} onRetry={retry} />}
|
|
123
123
|
>
|
|
124
124
|
<App />
|
|
125
|
-
</
|
|
125
|
+
</RenownUserProvider>
|
|
126
126
|
```
|
|
127
127
|
|
|
128
128
|
### Hooks
|
|
@@ -314,18 +314,18 @@ function AuthListener() {
|
|
|
314
314
|
|
|
315
315
|
## Configuration
|
|
316
316
|
|
|
317
|
-
###
|
|
317
|
+
### RenownUserProvider Configuration
|
|
318
318
|
|
|
319
|
-
The
|
|
319
|
+
The RenownUserProvider accepts optional configuration props:
|
|
320
320
|
|
|
321
321
|
```typescript
|
|
322
|
-
<
|
|
322
|
+
<RenownUserProvider
|
|
323
323
|
renownUrl="https://www.renown.id" // Custom Renown URL
|
|
324
324
|
networkId="eip155" // Network ID (default)
|
|
325
325
|
chainId="1" // Chain ID (default)
|
|
326
326
|
>
|
|
327
327
|
<App />
|
|
328
|
-
</
|
|
328
|
+
</RenownUserProvider>
|
|
329
329
|
```
|
|
330
330
|
|
|
331
331
|
### Environment Variables
|
|
@@ -333,11 +333,11 @@ The UserProvider accepts optional configuration props:
|
|
|
333
333
|
Use environment variables for dynamic configuration:
|
|
334
334
|
|
|
335
335
|
```typescript
|
|
336
|
-
<
|
|
336
|
+
<RenownUserProvider
|
|
337
337
|
renownUrl={process.env.NEXT_PUBLIC_RENOWN_URL || 'https://www.renown.id'}
|
|
338
338
|
>
|
|
339
339
|
<App />
|
|
340
|
-
</
|
|
340
|
+
</RenownUserProvider>
|
|
341
341
|
```
|
|
342
342
|
|
|
343
343
|
```bash
|
|
@@ -351,15 +351,15 @@ NEXT_PUBLIC_RENOWN_URL=https://www.renown.id
|
|
|
351
351
|
|
|
352
352
|
```typescript
|
|
353
353
|
// app/layout.tsx
|
|
354
|
-
import {
|
|
354
|
+
import { RenownUserProvider } from '@renown/sdk'
|
|
355
355
|
|
|
356
356
|
export default function RootLayout({ children }) {
|
|
357
357
|
return (
|
|
358
358
|
<html lang="en">
|
|
359
359
|
<body>
|
|
360
|
-
<
|
|
360
|
+
<RenownUserProvider>
|
|
361
361
|
{children}
|
|
362
|
-
</
|
|
362
|
+
</RenownUserProvider>
|
|
363
363
|
</body>
|
|
364
364
|
</html>
|
|
365
365
|
)
|
|
@@ -411,14 +411,14 @@ export default function ProfilePage() {
|
|
|
411
411
|
|
|
412
412
|
```typescript
|
|
413
413
|
// main.tsx
|
|
414
|
-
import {
|
|
414
|
+
import { RenownUserProvider } from '@renown/sdk'
|
|
415
415
|
import App from './App'
|
|
416
416
|
|
|
417
417
|
ReactDOM.createRoot(document.getElementById('root')!).render(
|
|
418
418
|
<React.StrictMode>
|
|
419
|
-
<
|
|
419
|
+
<RenownUserProvider>
|
|
420
420
|
<App />
|
|
421
|
-
</
|
|
421
|
+
</RenownUserProvider>
|
|
422
422
|
</React.StrictMode>
|
|
423
423
|
)
|
|
424
424
|
|
|
@@ -437,16 +437,16 @@ function App() {
|
|
|
437
437
|
|
|
438
438
|
## Troubleshooting
|
|
439
439
|
|
|
440
|
-
###
|
|
440
|
+
### RenownUserProvider Context Error
|
|
441
441
|
|
|
442
|
-
**Error:** `useUser must be used within an
|
|
442
|
+
**Error:** `useUser must be used within an RenownUserProvider`
|
|
443
443
|
|
|
444
|
-
**Solution:** Ensure your component is wrapped by `<
|
|
444
|
+
**Solution:** Ensure your component is wrapped by `<RenownUserProvider>`:
|
|
445
445
|
|
|
446
446
|
```typescript
|
|
447
|
-
<
|
|
447
|
+
<RenownUserProvider>
|
|
448
448
|
<YourComponent /> {/* ✅ Can use useUser */}
|
|
449
|
-
</
|
|
449
|
+
</RenownUserProvider>
|
|
450
450
|
```
|
|
451
451
|
|
|
452
452
|
### Custom Renown URL
|
|
@@ -454,9 +454,9 @@ function App() {
|
|
|
454
454
|
To use a different Renown instance:
|
|
455
455
|
|
|
456
456
|
```typescript
|
|
457
|
-
<
|
|
457
|
+
<RenownUserProvider renownUrl="https://your-renown-instance.com">
|
|
458
458
|
<App />
|
|
459
|
-
</
|
|
459
|
+
</RenownUserProvider>
|
|
460
460
|
```
|
|
461
461
|
|
|
462
462
|
### Session Not Persisting
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import
|
|
2
|
+
import { useState } from "react";
|
|
3
3
|
import { createRoot } from "react-dom/client";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
4
|
+
import { RenownAuthButton, RenownLoginButton, RenownLogo, RenownUserButton, } from "../../src/components/index.js";
|
|
5
|
+
import { RenownUserProvider } from "../../src/providers/renown-user-provider.js";
|
|
6
6
|
const styles = {
|
|
7
7
|
container: {
|
|
8
8
|
maxWidth: "800px",
|
|
@@ -77,12 +77,17 @@ function App() {
|
|
|
77
77
|
display: "flex",
|
|
78
78
|
justifyContent: "center",
|
|
79
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" }) }),
|
|
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
81
|
padding: "8px 16px",
|
|
82
82
|
borderRadius: "8px",
|
|
83
83
|
border: "1px solid #ccc",
|
|
84
84
|
cursor: "pointer",
|
|
85
|
-
}, children: "Sign In" })) })] })
|
|
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, {}) })] })] })] }));
|
|
86
91
|
}
|
|
87
92
|
const container = document.getElementById("root");
|
|
88
93
|
if (container) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.js","sourceRoot":"","sources":["../../../e2e/fixtures/main.tsx"],"names":[],"mappings":";AAAA,OAAO,
|
|
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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CAAC"}
|
|
@@ -7,30 +7,33 @@ test.describe("Renown SDK Components", () => {
|
|
|
7
7
|
await expect(page.locator("h1")).toContainText("Renown SDK Components");
|
|
8
8
|
});
|
|
9
9
|
test.describe("RenownLoginButton", () => {
|
|
10
|
-
test("renders login button", async ({ page }) => {
|
|
10
|
+
test("renders login button with direct login (default)", async ({ page, }) => {
|
|
11
11
|
const section = page.locator('[data-testid="login-button-section"]');
|
|
12
12
|
await expect(section).toBeVisible();
|
|
13
|
-
//
|
|
14
|
-
const
|
|
15
|
-
await expect(
|
|
13
|
+
// Default button has "Login with Renown" aria-label (direct login mode)
|
|
14
|
+
const directLoginButton = section.locator('button[aria-label="Login with Renown"]');
|
|
15
|
+
await expect(directLoginButton.first()).toBeVisible();
|
|
16
16
|
});
|
|
17
|
-
test("
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
17
|
+
test("renders login button with popover option", async ({ page }) => {
|
|
18
|
+
const popoverContainer = page.locator('[data-testid="popover-login"]');
|
|
19
|
+
await expect(popoverContainer).toBeVisible();
|
|
20
|
+
// Popover button has "Open Renown Login" aria-label
|
|
21
|
+
const popoverButton = popoverContainer.locator('button[aria-label="Open Renown Login"]');
|
|
22
|
+
await expect(popoverButton).toBeVisible();
|
|
23
|
+
});
|
|
24
|
+
test("opens popover on hover when showPopover is true", async ({ page, }) => {
|
|
25
|
+
const popoverContainer = page.locator('[data-testid="popover-login"]');
|
|
26
|
+
const button = popoverContainer.locator('button[aria-label="Open Renown Login"]');
|
|
27
|
+
// Hover the button
|
|
28
|
+
await button.hover();
|
|
24
29
|
// Check that the popover is visible with "Connect" text
|
|
25
30
|
await expect(page.getByRole("button", { name: "Connect" })).toBeVisible();
|
|
26
31
|
});
|
|
27
32
|
test("closes popover when clicking outside", async ({ page }) => {
|
|
28
|
-
const
|
|
29
|
-
const button =
|
|
30
|
-
.locator('button[aria-label="Open Renown Login"]')
|
|
31
|
-
.first();
|
|
33
|
+
const popoverContainer = page.locator('[data-testid="popover-login"]');
|
|
34
|
+
const button = popoverContainer.locator('button[aria-label="Open Renown Login"]');
|
|
32
35
|
// Open popover
|
|
33
|
-
await button.
|
|
36
|
+
await button.hover();
|
|
34
37
|
await expect(page.getByRole("button", { name: "Connect" })).toBeVisible();
|
|
35
38
|
// Click outside
|
|
36
39
|
await page.locator("h1").click();
|
|
@@ -42,6 +45,24 @@ test.describe("Renown SDK Components", () => {
|
|
|
42
45
|
const signInButton = section.getByRole("button", { name: "Sign In" });
|
|
43
46
|
await expect(signInButton).toBeVisible();
|
|
44
47
|
});
|
|
48
|
+
test("renders dark mode with inverted image and dark popover", async ({ page, }) => {
|
|
49
|
+
const darkModeContainer = page.locator('[data-testid="dark-mode-login"]');
|
|
50
|
+
await expect(darkModeContainer).toBeVisible();
|
|
51
|
+
// Check that the trigger image has invert filter
|
|
52
|
+
const triggerImage = darkModeContainer.locator('img[alt="Renown Login"]');
|
|
53
|
+
await expect(triggerImage).toBeVisible();
|
|
54
|
+
await expect(triggerImage).toHaveCSS("filter", "invert(1)");
|
|
55
|
+
// Open the popover by hovering
|
|
56
|
+
const button = darkModeContainer.locator('button[aria-label="Open Renown Login"]');
|
|
57
|
+
await button.hover();
|
|
58
|
+
// Check that the popover has dark background
|
|
59
|
+
const connectButton = page
|
|
60
|
+
.getByRole("button", { name: "Connect" })
|
|
61
|
+
.last();
|
|
62
|
+
await expect(connectButton).toBeVisible();
|
|
63
|
+
// Check that the Connect button has light text color for dark mode
|
|
64
|
+
await expect(connectButton).toHaveCSS("color", "rgb(249, 250, 251)");
|
|
65
|
+
});
|
|
45
66
|
});
|
|
46
67
|
test.describe("RenownUserButton", () => {
|
|
47
68
|
test("renders user buttons", async ({ page }) => {
|
|
@@ -61,7 +82,7 @@ test.describe("Renown SDK Components", () => {
|
|
|
61
82
|
// Check that the popover is visible with user info
|
|
62
83
|
await expect(page.getByText("vitalik.eth")).toBeVisible();
|
|
63
84
|
await expect(page.getByRole("button", { name: "Disconnect" })).toBeVisible();
|
|
64
|
-
await expect(page.getByRole("
|
|
85
|
+
await expect(page.getByRole("button", { name: "View on Renown" })).toBeVisible();
|
|
65
86
|
});
|
|
66
87
|
test("shows truncated address in popover", async ({ page }) => {
|
|
67
88
|
const section = page.locator('[data-testid="user-button-section"]');
|
|
@@ -125,7 +146,8 @@ test.describe("Renown SDK Components", () => {
|
|
|
125
146
|
// Wait for initialization to complete
|
|
126
147
|
await page.waitForTimeout(2000);
|
|
127
148
|
// Should show a login button since we're not authenticated
|
|
128
|
-
|
|
149
|
+
// RenownAuthButton uses direct login mode (no popover) by default
|
|
150
|
+
const loginButton = section.locator('button[aria-label="Login with Renown"]');
|
|
129
151
|
await expect(loginButton).toBeVisible({ timeout: 10000 });
|
|
130
152
|
});
|
|
131
153
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"renown-components.spec.js","sourceRoot":"","sources":["../../e2e/renown-components.spec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAEhD,IAAI,CAAC,QAAQ,CAAC,uBAAuB,EAAE,GAAG,EAAE;IAC1C,IAAI,CAAC,UAAU,CAAC,KAAK,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE;QACjC,MAAM,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACvB,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC,sBAAsB,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE;QAC9C,MAAM,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,aAAa,CAAC,uBAAuB,CAAC,CAAC;IAC1E,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC,QAAQ,CAAC,mBAAmB,EAAE,GAAG,EAAE;QACtC,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"renown-components.spec.js","sourceRoot":"","sources":["../../e2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AAI,CAAC,QAAQ,CAAC,kBAAkB,EAAE,GAAG,EAAE;QACrC,IAAI,CAAC,6BAA6B,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE;YACrD,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,qCAAqC,CAAC,CAAC;YACpE,MAAM,MAAM,CAAC,OAAO,CAAC,CAAC,WAAW,EAAE,CAAC;QACtC,CAAC,CAAC,CAAC;QAEH,IAAI,CAAC,2CAA2C,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE;YACnE,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,qCAAqC,CAAC,CAAC;YAEpE,sCAAsC;YACtC,MAAM,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;YAEhC,2DAA2D;YAC3D,kEAAkE;YAClE,MAAM,WAAW,GAAG,OAAO,CAAC,OAAO,CACjC,wCAAwC,CACzC,CAAC;YACF,MAAM,MAAM,CAAC,WAAW,CAAC,CAAC,WAAW,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC,CAAC;QAC5D,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -10,11 +10,6 @@ export interface RenownAuthButtonProps {
|
|
|
10
10
|
* Custom class name for the container
|
|
11
11
|
*/
|
|
12
12
|
className?: string;
|
|
13
|
-
/**
|
|
14
|
-
* Base URL for the profile page
|
|
15
|
-
* @default "https://www.renown.id/profile"
|
|
16
|
-
*/
|
|
17
|
-
profileBaseUrl?: string;
|
|
18
13
|
/**
|
|
19
14
|
* Custom render function when user is authenticated
|
|
20
15
|
* Receives user data, logout function, and openProfile function
|
|
@@ -63,5 +58,5 @@ export interface RenownAuthButtonProps {
|
|
|
63
58
|
* />
|
|
64
59
|
* ```
|
|
65
60
|
*/
|
|
66
|
-
export declare function RenownAuthButton({ className,
|
|
61
|
+
export declare function RenownAuthButton({ className, renderAuthenticated, renderUnauthenticated, renderLoading, }: RenownAuthButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
67
62
|
//# sourceMappingURL=RenownAuthButton.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RenownAuthButton.d.ts","sourceRoot":"","sources":["../../../src/components/RenownAuthButton.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"RenownAuthButton.d.ts","sourceRoot":"","sources":["../../../src/components/RenownAuthButton.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAKnD,MAAM,WAAW,2BAA2B;IAC1C,IAAI,EAAE,IAAI,CAAC;IACX,MAAM,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAC5B,WAAW,EAAE,MAAM,IAAI,CAAC;CACzB;AAED,MAAM,WAAW,qBAAqB;IACpC;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,mBAAmB,CAAC,EAAE,CAAC,KAAK,EAAE,2BAA2B,KAAK,KAAK,CAAC,SAAS,CAAC;IAC9E;;;OAGG;IACH,qBAAqB,CAAC,EAAE,CAAC,KAAK,EAAE;QAC9B,UAAU,EAAE,MAAM,IAAI,CAAC;QACvB,SAAS,EAAE,OAAO,CAAC;KACpB,KAAK,KAAK,CAAC,SAAS,CAAC;IACtB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,KAAK,CAAC,SAAS,CAAC;CACvC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,wBAAgB,gBAAgB,CAAC,EAC/B,SAAc,EACd,mBAAmB,EACnB,qBAAqB,EACrB,aAAa,GACd,EAAE,qBAAqB,2CAyFvB"}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import React from "react";
|
|
4
4
|
import { useUser } from "../hooks/use-user.js";
|
|
5
|
+
import { openRenown as openRenownUtil } from "../lib/renown/utils.js";
|
|
5
6
|
import { RenownLoginButton } from "./RenownLoginButton.js";
|
|
6
7
|
import { RenownUserButton } from "./RenownUserButton.js";
|
|
7
8
|
/**
|
|
@@ -34,15 +35,12 @@ import { RenownUserButton } from "./RenownUserButton.js";
|
|
|
34
35
|
* />
|
|
35
36
|
* ```
|
|
36
37
|
*/
|
|
37
|
-
export function RenownAuthButton({ className = "",
|
|
38
|
+
export function RenownAuthButton({ className = "", renderAuthenticated, renderUnauthenticated, renderLoading, }) {
|
|
38
39
|
const { user, loginStatus, isLoading, openRenown, logout } = useUser();
|
|
39
40
|
const openProfile = () => {
|
|
40
41
|
if (!user)
|
|
41
42
|
return;
|
|
42
|
-
|
|
43
|
-
if (identifier) {
|
|
44
|
-
window.open(`${profileBaseUrl}/${identifier}`, "_blank");
|
|
45
|
-
}
|
|
43
|
+
openRenownUtil(user.documentId);
|
|
46
44
|
};
|
|
47
45
|
// Loading state
|
|
48
46
|
if (isLoading && loginStatus === "initial") {
|
|
@@ -73,8 +71,7 @@ export function RenownAuthButton({ className = "", profileBaseUrl = "https://www
|
|
|
73
71
|
cursor: "pointer",
|
|
74
72
|
}, children: [user.name || "Connected", " (Logout)"] }) }));
|
|
75
73
|
}
|
|
76
|
-
|
|
77
|
-
return (_jsx("div", { className: className, children: _jsx(RenownUserButton, { address: address, username: user.name, profileUrl: profileUrl, avatarUrl: user.avatar, onDisconnect: logout }) }));
|
|
74
|
+
return (_jsx("div", { className: className, children: _jsx(RenownUserButton, { address: address, username: user.name, userId: user.documentId, avatarUrl: user.avatar, onDisconnect: logout }) }));
|
|
78
75
|
}
|
|
79
76
|
// Unauthenticated state
|
|
80
77
|
if (renderUnauthenticated) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RenownAuthButton.js","sourceRoot":"","sources":["../../../src/components/RenownAuthButton.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAE/C,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"RenownAuthButton.js","sourceRoot":"","sources":["../../../src/components/RenownAuthButton.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAE/C,OAAO,EAAE,UAAU,IAAI,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACtE,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAgCzD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,MAAM,UAAU,gBAAgB,CAAC,EAC/B,SAAS,GAAG,EAAE,EACd,mBAAmB,EACnB,qBAAqB,EACrB,aAAa,GACS;IACtB,MAAM,EAAE,IAAI,EAAE,WAAW,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,EAAE,GAAG,OAAO,EAAE,CAAC;IAEvE,MAAM,WAAW,GAAG,GAAG,EAAE;QACvB,IAAI,CAAC,IAAI;YAAE,OAAO;QAClB,cAAc,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IAClC,CAAC,CAAC;IAEF,gBAAgB;IAChB,IAAI,SAAS,IAAI,WAAW,KAAK,SAAS,EAAE,CAAC;QAC3C,IAAI,aAAa,EAAE,CAAC;YAClB,OAAO,cAAK,SAAS,EAAE,SAAS,YAAG,aAAa,EAAE,GAAO,CAAC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;QAC1B,OAAO,CACL,cAAK,SAAS,EAAE,SAAS,YACtB,qBAAqB,CAAC,EAAE,UAAU,EAAE,SAAS,EAAE,CAAC,GAC7C,CACP,CAAC;IACJ,CAAC;IAED,OAAO,CACL,cAAK,SAAS,EAAE,SAAS,YACvB,KAAC,iBAAiB,IAAC,OAAO,EAAE,UAAU,GAAI,GACtC,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -4,6 +4,10 @@ export interface RenownLoginButtonProps {
|
|
|
4
4
|
* Callback when login is requested
|
|
5
5
|
*/
|
|
6
6
|
onLogin: (() => void) | undefined;
|
|
7
|
+
/**
|
|
8
|
+
* Enable dark mode styling
|
|
9
|
+
*/
|
|
10
|
+
darkMode?: boolean;
|
|
7
11
|
/**
|
|
8
12
|
* Custom styles for the button
|
|
9
13
|
*/
|
|
@@ -16,9 +20,14 @@ export interface RenownLoginButtonProps {
|
|
|
16
20
|
* Custom render function for the trigger button
|
|
17
21
|
*/
|
|
18
22
|
renderTrigger?: (props: {
|
|
19
|
-
|
|
23
|
+
onMouseEnter: () => void;
|
|
24
|
+
onMouseLeave: () => void;
|
|
20
25
|
isLoading: boolean;
|
|
21
26
|
}) => ReactNode;
|
|
27
|
+
/**
|
|
28
|
+
* Show a popover with connect option instead of triggering login directly
|
|
29
|
+
*/
|
|
30
|
+
showPopover?: boolean;
|
|
22
31
|
}
|
|
23
32
|
/**
|
|
24
33
|
* A login button with Renown branding that shows a popover with connect option.
|
|
@@ -35,5 +44,5 @@ export interface RenownLoginButtonProps {
|
|
|
35
44
|
* }
|
|
36
45
|
* ```
|
|
37
46
|
*/
|
|
38
|
-
export declare function RenownLoginButton({ onLogin, style, className, renderTrigger, }: RenownLoginButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
47
|
+
export declare function RenownLoginButton({ onLogin, darkMode, style, className, renderTrigger, showPopover, }: RenownLoginButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
39
48
|
//# sourceMappingURL=RenownLoginButton.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RenownLoginButton.d.ts","sourceRoot":"","sources":["../../../src/components/RenownLoginButton.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAKtD,MAAM,WAAW,sBAAsB;IACrC;;OAEG;IACH,OAAO,EAAE,CAAC,MAAM,IAAI,CAAC,GAAG,SAAS,CAAC;IAClC;;OAEG;IACH,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE;QACtB,
|
|
1
|
+
{"version":3,"file":"RenownLoginButton.d.ts","sourceRoot":"","sources":["../../../src/components/RenownLoginButton.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAKtD,MAAM,WAAW,sBAAsB;IACrC;;OAEG;IACH,OAAO,EAAE,CAAC,MAAM,IAAI,CAAC,GAAG,SAAS,CAAC;IAClC;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;OAEG;IACH,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE;QACtB,YAAY,EAAE,MAAM,IAAI,CAAC;QACzB,YAAY,EAAE,MAAM,IAAI,CAAC;QACzB,SAAS,EAAE,OAAO,CAAC;KACpB,KAAK,SAAS,CAAC;IAChB;;OAEG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AA+ED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,iBAAiB,CAAC,EAChC,OAAO,EACP,QAAgB,EAChB,KAAK,EACL,SAAS,EACT,aAAa,EACb,WAAmB,GACpB,EAAE,sBAAsB,2CA2IxB"}
|