@renown/sdk 5.1.0-dev.4 → 5.1.0-dev.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/e2e/fixtures/main.d.ts +2 -0
- package/dist/e2e/fixtures/main.d.ts.map +1 -0
- package/dist/e2e/fixtures/main.js +83 -0
- package/dist/e2e/fixtures/main.js.map +1 -0
- package/dist/e2e/fixtures/vite.config.d.ts +3 -0
- package/dist/e2e/fixtures/vite.config.d.ts.map +1 -0
- package/dist/e2e/fixtures/vite.config.js +10 -0
- package/dist/e2e/fixtures/vite.config.js.map +1 -0
- package/dist/e2e/renown-components.spec.d.ts +2 -0
- package/dist/e2e/renown-components.spec.d.ts.map +1 -0
- package/dist/e2e/renown-components.spec.js +121 -0
- package/dist/e2e/renown-components.spec.js.map +1 -0
- package/dist/playwright.config.d.ts +3 -0
- package/dist/playwright.config.d.ts.map +1 -0
- package/dist/playwright.config.js +25 -0
- package/dist/playwright.config.js.map +1 -0
- package/dist/src/assets/assets.d.ts +19 -0
- package/dist/src/assets/renown-hover.svg +17 -0
- package/dist/src/assets/renown-light.svg +15 -0
- package/dist/src/assets/renown-short-hover.png +0 -0
- package/dist/src/assets/renown-short.png +0 -0
- package/dist/src/assets/renown.svg +16 -0
- package/dist/src/components/RenownAuthButton.d.ts +3 -28
- package/dist/src/components/RenownAuthButton.d.ts.map +1 -1
- package/dist/src/components/RenownAuthButton.js +24 -61
- package/dist/src/components/RenownAuthButton.js.map +1 -1
- package/dist/src/components/RenownLoginButton.d.ts +39 -0
- package/dist/src/components/RenownLoginButton.d.ts.map +1 -0
- package/dist/src/components/RenownLoginButton.js +114 -0
- package/dist/src/components/RenownLoginButton.js.map +1 -0
- package/dist/src/components/RenownUserButton.d.ts +65 -0
- package/dist/src/components/RenownUserButton.d.ts.map +1 -0
- package/dist/src/components/RenownUserButton.js +195 -0
- package/dist/src/components/RenownUserButton.js.map +1 -0
- package/dist/src/components/icons.d.ts +25 -0
- package/dist/src/components/icons.d.ts.map +1 -0
- package/dist/src/components/icons.js +24 -0
- package/dist/src/components/icons.js.map +1 -0
- package/dist/src/components/image-data.d.ts +3 -0
- package/dist/src/components/image-data.d.ts.map +1 -0
- package/dist/src/components/image-data.js +4 -0
- package/dist/src/components/image-data.js.map +1 -0
- package/dist/src/components/index.d.ts +5 -0
- package/dist/src/components/index.d.ts.map +1 -1
- package/dist/src/components/index.js +3 -0
- package/dist/src/components/index.js.map +1 -1
- package/dist/src/index.d.ts +5 -5
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +5 -5
- package/dist/src/index.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +16 -4
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../../e2e/fixtures/main.tsx"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import React, { useState } from "react";
|
|
3
|
+
import { createRoot } from "react-dom/client";
|
|
4
|
+
import { RenownLoginButton, RenownUserButton, RenownAuthButton, RenownLogo, } from "../../src/components/index.js";
|
|
5
|
+
import { UserProvider } from "../../src/providers/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: { display: "flex", justifyContent: "center", marginBottom: "16px" }, 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" }) }), _jsx("p", { style: styles.description, children: "A button that opens a popover with the Renown login option. Click the button to see the popover with the \"Connect\" option." }), _jsxs("div", { style: styles.componentRow, children: [_jsx("span", { style: styles.label, children: "Default:" }), _jsx(RenownLoginButton, { onLogin: () => console.log("Login clicked!") })] }), _jsxs("div", { style: styles.componentRow, children: [_jsx("span", { style: styles.label, children: "With custom trigger:" }), _jsx(RenownLoginButton, { onLogin: () => console.log("Login clicked!"), renderTrigger: ({ onClick }) => (_jsx("button", { onClick: onClick, style: { padding: "8px 16px", borderRadius: "8px", border: "1px solid #ccc", cursor: "pointer" }, children: "Sign In" })) })] })] }), _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, profileUrl: `https://renown.id/profile/${mockUser.address}`, 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", profileUrl: `https://renown.id/profile/${mockUser.address}`, onDisconnect: () => console.log("Disconnect clicked!") })] }), _jsxs("div", { style: styles.componentRow, children: [_jsx("span", { style: styles.label, children: "No username:" }), _jsx(RenownUserButton, { address: mockUser.address, profileUrl: `https://renown.id/profile/${mockUser.address}`, 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 UserProvider to be initialized." }), _jsxs("div", { style: styles.componentRow, children: [_jsx("span", { style: styles.label, children: "With UserProvider:" }), _jsx(UserProvider, { renownUrl: "https://www.renown.id", children: _jsx(RenownAuthButton, {}) })] })] })] }));
|
|
77
|
+
}
|
|
78
|
+
const container = document.getElementById("root");
|
|
79
|
+
if (container) {
|
|
80
|
+
const root = createRoot(container);
|
|
81
|
+
root.render(_jsx(App, {}));
|
|
82
|
+
}
|
|
83
|
+
//# sourceMappingURL=main.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"main.js","sourceRoot":"","sources":["../../../e2e/fixtures/main.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACxC,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EACL,iBAAiB,EACjB,gBAAgB,EAChB,gBAAgB,EAChB,UAAU,GACX,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,YAAY,EAAE,MAAM,sCAAsC,CAAC;AAEpE,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,SAAS;K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,eAAM,KAAK,EAAE,MAAM,CAAC,IAAI,iCAAyB,GAC9C,EACL,YAAG,KAAK,EAAE,MAAM,CAAC,WAAW,kOAIxB,EACJ,eAAK,KAAK,EAAE,MAAM,CAAC,YAAY,aAC7B,eAAM,KAAK,EAAE,MAAM,CAAC,KAAK,mCAA2B,EACpD,KAAC,YAAY,IAAC,SAAS,EAAC,uBAAuB,YAC7C,KAAC,gBAAgB,KAAG,GACP,IACX,IACE,IACN,CACP,CAAC;AACJ,CAAC;AAED,MAAM,SAAS,GAAG,QAAQ,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;AAClD,IAAI,SAAS,EAAE,CAAC;IACd,MAAM,IAAI,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC;IACnC,IAAI,CAAC,MAAM,CAAC,KAAC,GAAG,KAAG,CAAC,CAAC;AACvB,CAAC"}
|
|
@@ -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 @@
|
|
|
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 @@
|
|
|
1
|
+
{"version":3,"file":"renown-components.spec.d.ts","sourceRoot":"","sources":["../../e2e/renown-components.spec.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import { expect, test } from "@playwright/test";
|
|
2
|
+
test.describe("Renown SDK Components", () => {
|
|
3
|
+
test.beforeEach(async ({ page }) => {
|
|
4
|
+
await page.goto("/");
|
|
5
|
+
});
|
|
6
|
+
test("page loads correctly", async ({ page }) => {
|
|
7
|
+
await expect(page.locator("h1")).toContainText("Renown SDK Components");
|
|
8
|
+
});
|
|
9
|
+
test.describe("RenownLoginButton", () => {
|
|
10
|
+
test("renders login button", async ({ page }) => {
|
|
11
|
+
const section = page.locator('[data-testid="login-button-section"]');
|
|
12
|
+
await expect(section).toBeVisible();
|
|
13
|
+
// Check that buttons are visible (aria-label is "Open Renown Login")
|
|
14
|
+
const buttons = section.locator('button[aria-label="Open Renown Login"]');
|
|
15
|
+
await expect(buttons.first()).toBeVisible();
|
|
16
|
+
});
|
|
17
|
+
test("opens popover on click", async ({ page }) => {
|
|
18
|
+
const section = page.locator('[data-testid="login-button-section"]');
|
|
19
|
+
const button = section.locator('button[aria-label="Open Renown Login"]').first();
|
|
20
|
+
// Click the button
|
|
21
|
+
await button.click();
|
|
22
|
+
// Check that the popover is visible with "Connect" text
|
|
23
|
+
await expect(page.getByRole("button", { name: "Connect" })).toBeVisible();
|
|
24
|
+
});
|
|
25
|
+
test("closes popover when clicking outside", async ({ page }) => {
|
|
26
|
+
const section = page.locator('[data-testid="login-button-section"]');
|
|
27
|
+
const button = section.locator('button[aria-label="Open Renown Login"]').first();
|
|
28
|
+
// Open popover
|
|
29
|
+
await button.click();
|
|
30
|
+
await expect(page.getByRole("button", { name: "Connect" })).toBeVisible();
|
|
31
|
+
// Click outside
|
|
32
|
+
await page.locator("h1").click();
|
|
33
|
+
// Popover should be hidden
|
|
34
|
+
await expect(page.getByRole("button", { name: "Connect" })).not.toBeVisible();
|
|
35
|
+
});
|
|
36
|
+
test("renders with custom trigger", async ({ page }) => {
|
|
37
|
+
const section = page.locator('[data-testid="login-button-section"]');
|
|
38
|
+
const signInButton = section.getByRole("button", { name: "Sign In" });
|
|
39
|
+
await expect(signInButton).toBeVisible();
|
|
40
|
+
});
|
|
41
|
+
});
|
|
42
|
+
test.describe("RenownUserButton", () => {
|
|
43
|
+
test("renders user buttons", async ({ page }) => {
|
|
44
|
+
const section = page.locator('[data-testid="user-button-section"]');
|
|
45
|
+
await expect(section).toBeVisible();
|
|
46
|
+
// Check that user buttons are visible (they have "Open account menu" aria-label)
|
|
47
|
+
const buttons = section.locator('button[aria-label="Open account menu"]');
|
|
48
|
+
await expect(buttons).toHaveCount(3);
|
|
49
|
+
});
|
|
50
|
+
test("opens popover with user info on click", async ({ page }) => {
|
|
51
|
+
const section = page.locator('[data-testid="user-button-section"]');
|
|
52
|
+
const button = section.locator('button[aria-label="Open account menu"]').first();
|
|
53
|
+
// Click the button
|
|
54
|
+
await button.click();
|
|
55
|
+
// Check that the popover is visible with user info
|
|
56
|
+
await expect(page.getByText("vitalik.eth")).toBeVisible();
|
|
57
|
+
await expect(page.getByRole("button", { name: "Disconnect" })).toBeVisible();
|
|
58
|
+
await expect(page.getByRole("link", { name: "View on Etherscan" })).toBeVisible();
|
|
59
|
+
});
|
|
60
|
+
test("shows truncated address in popover", async ({ page }) => {
|
|
61
|
+
const section = page.locator('[data-testid="user-button-section"]');
|
|
62
|
+
const button = section.locator('button[aria-label="Open account menu"]').first();
|
|
63
|
+
await button.click();
|
|
64
|
+
// Address should be truncated (0x12345...45678)
|
|
65
|
+
await expect(page.getByText("0x12345...45678")).toBeVisible();
|
|
66
|
+
});
|
|
67
|
+
test("can copy address to clipboard", async ({ page, context }) => {
|
|
68
|
+
// Grant clipboard permissions
|
|
69
|
+
await context.grantPermissions(["clipboard-read", "clipboard-write"]);
|
|
70
|
+
const section = page.locator('[data-testid="user-button-section"]');
|
|
71
|
+
const button = section.locator('button[aria-label="Open account menu"]').first();
|
|
72
|
+
await button.click();
|
|
73
|
+
// Click the address button to copy
|
|
74
|
+
const addressButton = page.getByText("0x12345...45678");
|
|
75
|
+
await addressButton.click();
|
|
76
|
+
// Check that "Copied to clipboard!" text appears (with opacity transition)
|
|
77
|
+
await expect(page.getByText("Copied to clipboard!")).toBeVisible();
|
|
78
|
+
// After 2 seconds, the address should be visible again
|
|
79
|
+
await page.waitForTimeout(2100);
|
|
80
|
+
await expect(page.getByText("0x12345...45678")).toBeVisible();
|
|
81
|
+
});
|
|
82
|
+
test("closes popover when clicking outside", async ({ page }) => {
|
|
83
|
+
const section = page.locator('[data-testid="user-button-section"]');
|
|
84
|
+
const button = section.locator('button[aria-label="Open account menu"]').first();
|
|
85
|
+
// Open popover
|
|
86
|
+
await button.click();
|
|
87
|
+
await expect(page.getByRole("button", { name: "Disconnect" })).toBeVisible();
|
|
88
|
+
// Click outside
|
|
89
|
+
await page.locator("h1").click();
|
|
90
|
+
// Popover should be hidden
|
|
91
|
+
await expect(page.getByRole("button", { name: "Disconnect" })).not.toBeVisible();
|
|
92
|
+
});
|
|
93
|
+
test("shows placeholder avatar when no avatarUrl provided", async ({ page }) => {
|
|
94
|
+
const section = page.locator('[data-testid="user-button-section"]');
|
|
95
|
+
// First button has no avatar - check for placeholder
|
|
96
|
+
const firstRow = section.locator('[style*="background"]').first();
|
|
97
|
+
await expect(firstRow).toBeVisible();
|
|
98
|
+
});
|
|
99
|
+
test("shows image avatar when avatarUrl provided", async ({ page }) => {
|
|
100
|
+
const section = page.locator('[data-testid="user-button-section"]');
|
|
101
|
+
// Second button has an avatar image
|
|
102
|
+
const avatarImg = section.locator('img[alt="Avatar"]');
|
|
103
|
+
await expect(avatarImg).toHaveCount(1);
|
|
104
|
+
});
|
|
105
|
+
});
|
|
106
|
+
test.describe("RenownAuthButton", () => {
|
|
107
|
+
test("renders auth button section", async ({ page }) => {
|
|
108
|
+
const section = page.locator('[data-testid="auth-button-section"]');
|
|
109
|
+
await expect(section).toBeVisible();
|
|
110
|
+
});
|
|
111
|
+
test("shows login button when not authenticated", async ({ page }) => {
|
|
112
|
+
const section = page.locator('[data-testid="auth-button-section"]');
|
|
113
|
+
// Wait for initialization to complete
|
|
114
|
+
await page.waitForTimeout(2000);
|
|
115
|
+
// Should show a login button since we're not authenticated
|
|
116
|
+
const loginButton = section.locator('button[aria-label="Open Renown Login"]');
|
|
117
|
+
await expect(loginButton).toBeVisible({ timeout: 10000 });
|
|
118
|
+
});
|
|
119
|
+
});
|
|
120
|
+
});
|
|
121
|
+
//# sourceMappingURL=renown-components.spec.js.map
|
|
@@ -0,0 +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,sBAAsB,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE;YAC9C,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,sCAAsC,CAAC,CAAC;YACrE,MAAM,MAAM,CAAC,OAAO,CAAC,CAAC,WAAW,EAAE,CAAC;YAEpC,qEAAqE;YACrE,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,wCAAwC,CAAC,CAAC;YAC1E,MAAM,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC,CAAC,WAAW,EAAE,CAAC;QAC9C,CAAC,CAAC,CAAC;QAEH,IAAI,CAAC,wBA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OAAO,CAAC,qCAAqC,CAAC,CAAC;YAEpE,oCAAoC;YACpC,MAAM,SAAS,GAAG,OAAO,CAAC,OAAO,CAAC,mBAAmB,CAAC,CAAC;YACvD,MAAM,MAAM,CAAC,SAAS,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;QACzC,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,IAAI,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,MAAM,WAAW,GAAG,OAAO,CAAC,OAAO,CAAC,wCAAwC,CAAC,CAAC;YAC9E,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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"playwright.config.d.ts","sourceRoot":"","sources":["../playwright.config.ts"],"names":[],"mappings":";AAEA,wBAsBG"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { defineConfig, devices } from "@playwright/test";
|
|
2
|
+
export default defineConfig({
|
|
3
|
+
testDir: "./e2e",
|
|
4
|
+
fullyParallel: true,
|
|
5
|
+
forbidOnly: !!process.env.CI,
|
|
6
|
+
retries: process.env.CI ? 2 : 0,
|
|
7
|
+
workers: process.env.CI ? 1 : undefined,
|
|
8
|
+
reporter: "html",
|
|
9
|
+
use: {
|
|
10
|
+
baseURL: "http://localhost:5173",
|
|
11
|
+
trace: "on-first-retry",
|
|
12
|
+
},
|
|
13
|
+
projects: [
|
|
14
|
+
{
|
|
15
|
+
name: "chromium",
|
|
16
|
+
use: { ...devices["Desktop Chrome"] },
|
|
17
|
+
},
|
|
18
|
+
],
|
|
19
|
+
webServer: {
|
|
20
|
+
command: "pnpm run dev:e2e",
|
|
21
|
+
url: "http://localhost:5173",
|
|
22
|
+
reuseExistingServer: !process.env.CI,
|
|
23
|
+
},
|
|
24
|
+
});
|
|
25
|
+
//# sourceMappingURL=playwright.config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"playwright.config.js","sourceRoot":"","sources":["../playwright.config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAEzD,eAAe,YAAY,CAAC;IAC1B,OAAO,EAAE,OAAO;IAChB,aAAa,EAAE,IAAI;IACnB,UAAU,EAAE,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE;IAC5B,OAAO,EAAE,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAC/B,OAAO,EAAE,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS;IACvC,QAAQ,EAAE,MAAM;IAChB,GAAG,EAAE;QACH,OAAO,EAAE,uBAAuB;QAChC,KAAK,EAAE,gBAAgB;KACxB;IACD,QAAQ,EAAE;QACR;YACE,IAAI,EAAE,UAAU;YAChB,GAAG,EAAE,EAAE,GAAG,OAAO,CAAC,gBAAgB,CAAC,EAAE;SACtC;KACF;IACD,SAAS,EAAE;QACT,OAAO,EAAE,kBAAkB;QAC3B,GAAG,EAAE,uBAAuB;QAC5B,mBAAmB,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE;KACrC;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
declare module "*.png" {
|
|
2
|
+
const value: string;
|
|
3
|
+
export default value;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
declare module "*.svg" {
|
|
7
|
+
const value: string;
|
|
8
|
+
export default value;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
declare module "*.jpg" {
|
|
12
|
+
const value: string;
|
|
13
|
+
export default value;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
declare module "*.jpeg" {
|
|
17
|
+
const value: string;
|
|
18
|
+
export default value;
|
|
19
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
<svg viewBox="0 0 71 19" fill="currentcolor">
|
|
2
|
+
<path
|
|
3
|
+
d="M53.6211 18.4887V9.0342H56.435V10.8096H56.4923C56.7377 10.181 57.1085 9.70244 57.6047 9.37398C58.101 9.03986 58.6981 8.8728 59.3962 8.8728C60.4105 8.8728 61.2039 9.1871 61.7765 9.8157C62.3546 10.4443 62.6436 11.3164 62.6436 12.432V18.4887H59.7397V13.0776C59.7397 12.5283 59.6007 12.1007 59.3225 11.7949C59.0499 11.4835 58.6654 11.3277 58.1692 11.3277C57.6784 11.3277 57.2803 11.4976 56.9749 11.8374C56.6695 12.1772 56.5168 12.6161 56.5168 13.1541V18.4887H53.6211Z" />
|
|
4
|
+
<path
|
|
5
|
+
d="M53.097 9.03394L50.7412 18.4884H47.6164L46.1522 12.075H46.0949L44.6389 18.4884H41.5632L39.1992 9.03394H42.1195L43.3056 15.7532H43.3628L44.7861 9.03394H47.551L48.9906 15.7532H49.0479L50.234 9.03394H53.097Z" />
|
|
6
|
+
<path
|
|
7
|
+
d="M37.8661 17.3926C37.0427 18.2591 35.9084 18.6923 34.4632 18.6923C33.0181 18.6923 31.8838 18.2591 31.0604 17.3926C30.2369 16.5205 29.8252 15.3086 29.8252 13.7569C29.8252 12.2336 30.2424 11.033 31.0767 10.1552C31.9111 9.2718 33.0399 8.83008 34.4632 8.83008C35.892 8.83008 37.0208 9.26896 37.8497 10.1467C38.6841 11.0188 39.1013 12.2222 39.1013 13.7569C39.1013 15.3143 38.6896 16.5262 37.8661 17.3926ZM33.2117 15.7702C33.5116 16.2402 33.9288 16.4752 34.4632 16.4752C34.9977 16.4752 35.4148 16.2402 35.7148 15.7702C36.0147 15.2945 36.1647 14.6234 36.1647 13.7569C36.1647 12.9131 36.012 12.2506 35.7066 11.7692C35.4012 11.2878 34.9868 11.0472 34.4632 11.0472C33.9343 11.0472 33.5171 11.2878 33.2117 11.7692C32.9118 12.2449 32.7618 12.9075 32.7618 13.7569C32.7618 14.6234 32.9118 15.2945 33.2117 15.7702Z" />
|
|
8
|
+
<path
|
|
9
|
+
d="M20.0088 18.4887V9.0342H22.8227V10.8096H22.88C23.1254 10.181 23.4962 9.70244 23.9924 9.37398C24.4887 9.03986 25.0858 8.8728 25.7838 8.8728C26.7982 8.8728 27.5916 9.1871 28.1642 9.8157C28.7423 10.4443 29.0313 11.3164 29.0313 12.432V18.4887H26.1274V13.0776C26.1274 12.5283 25.9883 12.1007 25.7102 11.7949C25.4376 11.4835 25.0531 11.3277 24.5569 11.3277C24.0661 11.3277 23.668 11.4976 23.3626 11.8374C23.0572 12.1772 22.9045 12.6161 22.9045 13.1541V18.4887H20.0088Z" />
|
|
10
|
+
<path
|
|
11
|
+
d="M14.7486 10.9707C14.2851 10.9707 13.8952 11.1321 13.5789 11.4549C13.2626 11.7777 13.0854 12.1911 13.0472 12.6951H16.4337C16.4064 12.1741 16.2374 11.7579 15.9265 11.4464C15.6212 11.1293 15.2285 10.9707 14.7486 10.9707ZM16.4991 15.5153H19.1167C18.9749 16.4837 18.5141 17.2567 17.7343 17.8343C16.9599 18.4063 15.9838 18.6923 14.8059 18.6923C13.3662 18.6923 12.2374 18.2591 11.4194 17.3926C10.6014 16.5262 10.1924 15.3313 10.1924 13.8079C10.1924 12.2845 10.5987 11.0755 11.4112 10.1807C12.2237 9.28029 13.3226 8.83008 14.7077 8.83008C16.0656 8.83008 17.1481 9.26047 17.9552 10.1213C18.7677 10.9764 19.174 12.1231 19.174 13.5616V14.4195H13.0145V14.6064C13.0145 15.184 13.1835 15.6541 13.5216 16.0165C13.8597 16.3733 14.3015 16.5517 14.8468 16.5517C15.2503 16.5517 15.5993 16.461 15.8938 16.2798C16.1883 16.0929 16.3901 15.8381 16.4991 15.5153Z" />
|
|
12
|
+
<path
|
|
13
|
+
d="M3.00205 8.58396V12.0667H4.7771C5.32789 12.0667 5.7587 11.911 6.06954 11.5995C6.38038 11.2881 6.5358 10.8662 6.5358 10.3338C6.5358 9.80718 6.37492 9.38528 6.05318 9.06815C5.73143 8.74535 5.30335 8.58396 4.76892 8.58396H3.00205ZM3.00205 14.1989V18.4886H0V6.23096H5.07158C6.53307 6.23096 7.65373 6.5849 8.43355 7.29278C9.21337 8.00066 9.60328 8.99453 9.60328 10.2744C9.60328 11.0446 9.42605 11.7439 9.07159 12.3725C8.71712 12.9955 8.2236 13.4514 7.59101 13.7402L9.94684 18.4886H6.5767L4.55624 14.1989H3.00205Z" />
|
|
14
|
+
<path
|
|
15
|
+
d="M65.7255 0.211478C65.0841 2.46724 63.3737 4.2455 61.2041 4.90969C60.932 4.99366 60.932 5.39096 61.2041 5.47492C63.3725 6.13912 65.0841 7.91738 65.7255 10.1731C65.8056 10.4551 66.1932 10.4551 66.2745 10.1731C66.9159 7.91738 68.6263 6.13912 70.7959 5.47492C71.068 5.39096 71.068 4.99366 70.7959 4.90969C68.6276 4.2455 66.9159 2.46724 66.2745 0.211478C66.1944 -0.0704925 65.8068 -0.0704925 65.7255 0.211478Z"
|
|
16
|
+
fill="#21FFB4" />
|
|
17
|
+
</svg>
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<svg width="83" height="22" viewBox="0 0 83 22" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path d="M62.6841 21.7601V10.6326H65.9736V12.7221H66.0405C66.3274 11.9823 66.7609 11.4191 67.341 11.0325C67.9212 10.6393 68.6192 10.4426 69.4352 10.4426C70.621 10.4426 71.5486 10.8125 72.2179 11.5524C72.8937 12.2922 73.2316 13.3187 73.2316 14.6317V21.7601H69.8369V15.3915C69.8369 14.745 69.6743 14.2418 69.3492 13.8819C69.0304 13.5153 68.581 13.332 68.0009 13.332C67.4271 13.332 66.9617 13.5319 66.6047 13.9319C66.2477 14.3318 66.0692 14.8483 66.0692 15.4815V21.7601H62.6841Z" fill="currentcolor"/>
|
|
3
|
+
<path d="M62.0713 10.6328L59.3173 21.7603H55.6644L53.9527 14.212H53.8858L52.1837 21.7603H48.5882L45.8246 10.6328H49.2384L50.625 18.5411H50.6919L52.3558 10.6328H55.5879L57.2709 18.5411H57.3379L58.7245 10.6328H62.0713Z" fill="currentcolor"/>
|
|
4
|
+
<path d="M44.2662 20.4703C43.3036 21.4901 41.9775 22 40.2882 22C38.5988 22 37.2728 21.4901 36.3102 20.4703C35.3475 19.4439 34.8662 18.0176 34.8662 16.1913C34.8662 14.3984 35.3539 12.9853 36.3293 11.9522C37.3047 10.9125 38.6243 10.3926 40.2882 10.3926C41.9584 10.3926 43.2781 10.9091 44.2471 11.9422C45.2224 12.9687 45.7101 14.385 45.7101 16.1913C45.7101 18.0242 45.2288 19.4506 44.2662 20.4703ZM38.8251 18.5608C39.1757 19.114 39.6634 19.3906 40.2882 19.3906C40.9129 19.3906 41.4006 19.114 41.7512 18.5608C42.1019 18.0009 42.2772 17.2111 42.2772 16.1913C42.2772 15.1982 42.0987 14.4184 41.7417 13.8518C41.3847 13.2853 40.9002 13.002 40.2882 13.002C39.6698 13.002 39.1821 13.2853 38.8251 13.8518C38.4745 14.4117 38.2992 15.1915 38.2992 16.1913C38.2992 17.2111 38.4745 18.0009 38.8251 18.5608Z" fill="currentcolor"/>
|
|
5
|
+
<path d="M23.3906 21.7601V10.6326H26.6801V12.7221H26.7471C27.034 11.9823 27.4675 11.4191 28.0476 11.0325C28.6277 10.6393 29.3258 10.4426 30.1418 10.4426C31.3275 10.4426 32.2551 10.8125 32.9245 11.5524C33.6002 12.2922 33.9381 13.3187 33.9381 14.6317V21.7601H30.5434V15.3915C30.5434 14.745 30.3808 14.2418 30.0557 13.8819C29.737 13.5153 29.2875 13.332 28.7074 13.332C28.1336 13.332 27.6683 13.5319 27.3113 13.9319C26.9543 14.3318 26.7758 14.8483 26.7758 15.4815V21.7601H23.3906Z" fill="currentcolor"/>
|
|
6
|
+
<path d="M17.2414 12.912C16.6995 12.912 16.2437 13.102 15.8739 13.4819C15.5042 13.8618 15.297 14.3484 15.2524 14.9416H19.2113C19.1794 14.3284 18.9818 13.8385 18.6184 13.4719C18.2614 13.0986 17.8024 12.912 17.2414 12.912ZM19.2878 18.2608H22.3478C22.182 19.4006 21.6433 20.3104 20.7317 20.9902C19.8264 21.6634 18.6853 22 17.3083 22C15.6253 22 14.3057 21.4901 13.3494 20.4703C12.3932 19.4506 11.915 18.0442 11.915 16.2513C11.915 14.4583 12.39 13.0353 13.3399 11.9822C14.2897 10.9225 15.5743 10.3926 17.1936 10.3926C18.7809 10.3926 20.0464 10.8991 20.9899 11.9122C21.9398 12.9187 22.4147 14.2684 22.4147 15.9613V16.9711H15.2141V17.1911C15.2141 17.8709 15.4117 18.4241 15.807 18.8507C16.2022 19.2706 16.7186 19.4806 17.3561 19.4806C17.8279 19.4806 18.2359 19.3739 18.5801 19.1606C18.9244 18.9407 19.1603 18.6408 19.2878 18.2608Z" fill="currentcolor"/>
|
|
7
|
+
<path d="M3.50945 10.1029V14.202H5.58452C6.2284 14.202 6.73202 14.0187 7.0954 13.6521C7.45878 13.2855 7.64047 12.789 7.64047 12.1624C7.64047 11.5426 7.4524 11.046 7.07628 10.6728C6.70015 10.2928 6.19971 10.1029 5.57496 10.1029H3.50945ZM3.50945 16.7114V21.7603H0V7.3335H5.92877C7.63728 7.3335 8.94735 7.75007 9.85897 8.58322C10.7706 9.41637 11.2264 10.5861 11.2264 12.0924C11.2264 12.9989 11.0192 13.8221 10.6049 14.5619C10.1905 15.2951 9.61354 15.8316 8.87403 16.1715L11.628 21.7603H7.68828L5.32633 16.7114H3.50945Z" fill="currentcolor"/>
|
|
8
|
+
<path d="M76.834 0.248901C76.0842 2.90384 74.0847 4.99678 71.5484 5.77851C71.2303 5.87734 71.2303 6.34494 71.5484 6.44376C74.0833 7.22549 76.0842 9.31844 76.834 11.9734C76.9277 12.3052 77.3807 12.3052 77.4758 11.9734C78.2257 9.31844 80.2251 7.22549 82.7614 6.44376C83.0795 6.34494 83.0795 5.87734 82.7614 5.77851C80.2266 4.99678 78.2257 2.90384 77.4758 0.248901C77.3821 -0.0829669 76.9291 -0.0829669 76.834 0.248901Z" fill="url(#paint0_linear_2120_7894)"/>
|
|
9
|
+
<defs>
|
|
10
|
+
<linearGradient id="paint0_linear_2120_7894" x1="77.1549" y1="-0.768932" x2="72.2552" y2="11.3783" gradientUnits="userSpaceOnUse">
|
|
11
|
+
<stop stop-color="#21FFB4"/>
|
|
12
|
+
<stop offset="1" stop-color="#0080FF"/>
|
|
13
|
+
</linearGradient>
|
|
14
|
+
</defs>
|
|
15
|
+
</svg>
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
<svg viewBox="0 0 71 19" fill="currentcolor">
|
|
2
|
+
<path
|
|
3
|
+
d="M53.6211 18.4887V9.0342H56.435V10.8096H56.4923C56.7377 10.181 57.1085 9.70244 57.6047 9.37398C58.101 9.03986 58.6981 8.8728 59.3962 8.8728C60.4105 8.8728 61.2039 9.1871 61.7765 9.8157C62.3546 10.4443 62.6436 11.3164 62.6436 12.432V18.4887H59.7397V13.0776C59.7397 12.5283 59.6007 12.1007 59.3225 11.7949C59.0499 11.4835 58.6654 11.3277 58.1692 11.3277C57.6784 11.3277 57.2803 11.4976 56.9749 11.8374C56.6695 12.1772 56.5168 12.6161 56.5168 13.1541V18.4887H53.6211Z" />
|
|
4
|
+
<path
|
|
5
|
+
d="M53.097 9.03394L50.7412 18.4884H47.6164L46.1522 12.075H46.0949L44.6389 18.4884H41.5632L39.1992 9.03394H42.1195L43.3056 15.7532H43.3628L44.7861 9.03394H47.551L48.9906 15.7532H49.0479L50.234 9.03394H53.097Z" />
|
|
6
|
+
<path
|
|
7
|
+
d="M37.8661 17.3926C37.0427 18.2591 35.9084 18.6923 34.4632 18.6923C33.0181 18.6923 31.8838 18.2591 31.0604 17.3926C30.2369 16.5205 29.8252 15.3086 29.8252 13.7569C29.8252 12.2336 30.2424 11.033 31.0767 10.1552C31.9111 9.2718 33.0399 8.83008 34.4632 8.83008C35.892 8.83008 37.0208 9.26896 37.8497 10.1467C38.6841 11.0188 39.1013 12.2222 39.1013 13.7569C39.1013 15.3143 38.6896 16.5262 37.8661 17.3926ZM33.2117 15.7702C33.5116 16.2402 33.9288 16.4752 34.4632 16.4752C34.9977 16.4752 35.4148 16.2402 35.7148 15.7702C36.0147 15.2945 36.1647 14.6234 36.1647 13.7569C36.1647 12.9131 36.012 12.2506 35.7066 11.7692C35.4012 11.2878 34.9868 11.0472 34.4632 11.0472C33.9343 11.0472 33.5171 11.2878 33.2117 11.7692C32.9118 12.2449 32.7618 12.9075 32.7618 13.7569C32.7618 14.6234 32.9118 15.2945 33.2117 15.7702Z" />
|
|
8
|
+
<path
|
|
9
|
+
d="M20.0088 18.4887V9.0342H22.8227V10.8096H22.88C23.1254 10.181 23.4962 9.70244 23.9924 9.37398C24.4887 9.03986 25.0858 8.8728 25.7838 8.8728C26.7982 8.8728 27.5916 9.1871 28.1642 9.8157C28.7423 10.4443 29.0313 11.3164 29.0313 12.432V18.4887H26.1274V13.0776C26.1274 12.5283 25.9883 12.1007 25.7102 11.7949C25.4376 11.4835 25.0531 11.3277 24.5569 11.3277C24.0661 11.3277 23.668 11.4976 23.3626 11.8374C23.0572 12.1772 22.9045 12.6161 22.9045 13.1541V18.4887H20.0088Z" />
|
|
10
|
+
<path
|
|
11
|
+
d="M14.7486 10.9707C14.2851 10.9707 13.8952 11.1321 13.5789 11.4549C13.2626 11.7777 13.0854 12.1911 13.0472 12.6951H16.4337C16.4064 12.1741 16.2374 11.7579 15.9265 11.4464C15.6212 11.1293 15.2285 10.9707 14.7486 10.9707ZM16.4991 15.5153H19.1167C18.9749 16.4837 18.5141 17.2567 17.7343 17.8343C16.9599 18.4063 15.9838 18.6923 14.8059 18.6923C13.3662 18.6923 12.2374 18.2591 11.4194 17.3926C10.6014 16.5262 10.1924 15.3313 10.1924 13.8079C10.1924 12.2845 10.5987 11.0755 11.4112 10.1807C12.2237 9.28029 13.3226 8.83008 14.7077 8.83008C16.0656 8.83008 17.1481 9.26047 17.9552 10.1213C18.7677 10.9764 19.174 12.1231 19.174 13.5616V14.4195H13.0145V14.6064C13.0145 15.184 13.1835 15.6541 13.5216 16.0165C13.8597 16.3733 14.3015 16.5517 14.8468 16.5517C15.2503 16.5517 15.5993 16.461 15.8938 16.2798C16.1883 16.0929 16.3901 15.8381 16.4991 15.5153Z" />
|
|
12
|
+
<path
|
|
13
|
+
d="M3.00205 8.58396V12.0667H4.7771C5.32789 12.0667 5.7587 11.911 6.06954 11.5995C6.38038 11.2881 6.5358 10.8662 6.5358 10.3338C6.5358 9.80718 6.37492 9.38528 6.05318 9.06815C5.73143 8.74535 5.30335 8.58396 4.76892 8.58396H3.00205ZM3.00205 14.1989V18.4886H0V6.23096H5.07158C6.53307 6.23096 7.65373 6.5849 8.43355 7.29278C9.21337 8.00066 9.60328 8.99453 9.60328 10.2744C9.60328 11.0446 9.42605 11.7439 9.07159 12.3725C8.71712 12.9955 8.2236 13.4514 7.59101 13.7402L9.94684 18.4886H6.5767L4.55624 14.1989H3.00205Z" />
|
|
14
|
+
<path
|
|
15
|
+
d="M65.7255 0.211478C65.0841 2.46724 63.3737 4.2455 61.2041 4.90969C60.932 4.99366 60.932 5.39096 61.2041 5.47492C63.3725 6.13912 65.0841 7.91738 65.7255 10.1731C65.8056 10.4551 66.1932 10.4551 66.2745 10.1731C66.9159 7.91738 68.6263 6.13912 70.7959 5.47492C71.068 5.39096 71.068 4.99366 70.7959 4.90969C68.6276 4.2455 66.9159 2.46724 66.2745 0.211478C66.1944 -0.0704925 65.8068 -0.0704925 65.7255 0.211478Z" />
|
|
16
|
+
</svg>
|
|
@@ -32,25 +32,10 @@ export interface RenownAuthButtonProps {
|
|
|
32
32
|
* Custom render function for loading state
|
|
33
33
|
*/
|
|
34
34
|
renderLoading?: () => React.ReactNode;
|
|
35
|
-
/**
|
|
36
|
-
* Show username next to avatar
|
|
37
|
-
* @default true
|
|
38
|
-
*/
|
|
39
|
-
showUsername?: boolean;
|
|
40
|
-
/**
|
|
41
|
-
* Show logout button
|
|
42
|
-
* @default false
|
|
43
|
-
*/
|
|
44
|
-
showLogoutButton?: boolean;
|
|
45
|
-
/**
|
|
46
|
-
* Custom logout button text
|
|
47
|
-
* @default "Logout"
|
|
48
|
-
*/
|
|
49
|
-
logoutButtonText?: string;
|
|
50
35
|
}
|
|
51
36
|
/**
|
|
52
|
-
* Smart authentication button that adapts based on auth state
|
|
53
|
-
* Shows
|
|
37
|
+
* Smart authentication button that adapts based on auth state.
|
|
38
|
+
* Shows RenownLoginButton when not authenticated, and RenownUserButton when authenticated.
|
|
54
39
|
*
|
|
55
40
|
* @example
|
|
56
41
|
* Basic usage:
|
|
@@ -77,16 +62,6 @@ export interface RenownAuthButtonProps {
|
|
|
77
62
|
* )}
|
|
78
63
|
* />
|
|
79
64
|
* ```
|
|
80
|
-
*
|
|
81
|
-
* @example
|
|
82
|
-
* With logout button:
|
|
83
|
-
* ```tsx
|
|
84
|
-
* <RenownAuthButton
|
|
85
|
-
* showLogoutButton
|
|
86
|
-
* logoutButtonText="Sign Out"
|
|
87
|
-
* profileBaseUrl="https://myapp.com/profile"
|
|
88
|
-
* />
|
|
89
|
-
* ```
|
|
90
65
|
*/
|
|
91
|
-
export declare function RenownAuthButton({ className, profileBaseUrl, renderAuthenticated, renderUnauthenticated, renderLoading,
|
|
66
|
+
export declare function RenownAuthButton({ className, profileBaseUrl, renderAuthenticated, renderUnauthenticated, renderLoading, }: RenownAuthButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
92
67
|
//# 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;AAInD,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,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB;;;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,cAAgD,EAChD,mBAAmB,EACnB,qBAAqB,EACrB,aAAa,GACd,EAAE,qBAAqB,2CA8FvB"}
|
|
@@ -2,9 +2,11 @@
|
|
|
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 { RenownLoginButton } from "./RenownLoginButton.js";
|
|
6
|
+
import { RenownUserButton } from "./RenownUserButton.js";
|
|
5
7
|
/**
|
|
6
|
-
* Smart authentication button that adapts based on auth state
|
|
7
|
-
* Shows
|
|
8
|
+
* Smart authentication button that adapts based on auth state.
|
|
9
|
+
* Shows RenownLoginButton when not authenticated, and RenownUserButton when authenticated.
|
|
8
10
|
*
|
|
9
11
|
* @example
|
|
10
12
|
* Basic usage:
|
|
@@ -31,18 +33,8 @@ import { useUser } from "../hooks/use-user.js";
|
|
|
31
33
|
* )}
|
|
32
34
|
* />
|
|
33
35
|
* ```
|
|
34
|
-
*
|
|
35
|
-
* @example
|
|
36
|
-
* With logout button:
|
|
37
|
-
* ```tsx
|
|
38
|
-
* <RenownAuthButton
|
|
39
|
-
* showLogoutButton
|
|
40
|
-
* logoutButtonText="Sign Out"
|
|
41
|
-
* profileBaseUrl="https://myapp.com/profile"
|
|
42
|
-
* />
|
|
43
|
-
* ```
|
|
44
36
|
*/
|
|
45
|
-
export function RenownAuthButton({ className = "", profileBaseUrl = "https://www.renown.id/profile", renderAuthenticated, renderUnauthenticated, renderLoading,
|
|
37
|
+
export function RenownAuthButton({ className = "", profileBaseUrl = "https://www.renown.id/profile", renderAuthenticated, renderUnauthenticated, renderLoading, }) {
|
|
46
38
|
const { user, loginStatus, isLoading, openRenown, logout } = useUser();
|
|
47
39
|
const openProfile = () => {
|
|
48
40
|
if (!user)
|
|
@@ -57,66 +49,37 @@ export function RenownAuthButton({ className = "", profileBaseUrl = "https://www
|
|
|
57
49
|
if (renderLoading) {
|
|
58
50
|
return _jsx("div", { className: className, children: renderLoading() });
|
|
59
51
|
}
|
|
60
|
-
return (_jsxs("div", { className: className,
|
|
61
|
-
width: "
|
|
62
|
-
height: "
|
|
63
|
-
border: "2px solid #e5e7eb",
|
|
64
|
-
borderTopColor: "#6366f1",
|
|
52
|
+
return (_jsxs("div", { className: className, children: [_jsx("div", { style: {
|
|
53
|
+
width: "40px",
|
|
54
|
+
height: "40px",
|
|
65
55
|
borderRadius: "50%",
|
|
66
|
-
|
|
67
|
-
|
|
56
|
+
backgroundColor: "#e5e7eb",
|
|
57
|
+
animation: "pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite",
|
|
58
|
+
} }), _jsx("style", { children: `@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }` })] }));
|
|
68
59
|
}
|
|
69
60
|
// Authenticated state
|
|
70
61
|
if (loginStatus === "authorized" && user) {
|
|
71
62
|
if (renderAuthenticated) {
|
|
72
63
|
return (_jsx("div", { className: className, children: renderAuthenticated({ user, logout, openProfile }) }));
|
|
73
64
|
}
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
65
|
+
const address = (user.ethAddress || user.address);
|
|
66
|
+
if (!address) {
|
|
67
|
+
// Fallback if no address available
|
|
68
|
+
return (_jsx("div", { className: className, children: _jsxs("button", { onClick: logout, style: {
|
|
69
|
+
fontSize: "14px",
|
|
70
|
+
color: "#4b5563",
|
|
71
|
+
background: "none",
|
|
72
|
+
border: "none",
|
|
79
73
|
cursor: "pointer",
|
|
80
|
-
}, children: [user.
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
objectFit: "cover",
|
|
85
|
-
} })) : (_jsx("div", { style: {
|
|
86
|
-
width: "2rem",
|
|
87
|
-
height: "2rem",
|
|
88
|
-
borderRadius: "50%",
|
|
89
|
-
backgroundColor: "#6366f1",
|
|
90
|
-
color: "white",
|
|
91
|
-
display: "flex",
|
|
92
|
-
alignItems: "center",
|
|
93
|
-
justifyContent: "center",
|
|
94
|
-
fontWeight: "bold",
|
|
95
|
-
fontSize: "0.75rem",
|
|
96
|
-
}, children: (user.name || user.did).substring(0, 2).toUpperCase() })), showUsername && (_jsx("span", { style: { fontSize: "0.875rem", fontWeight: "500" }, children: user.name || user.did.slice(0, 15) + "..." }))] }), showLogoutButton && (_jsx("button", { onClick: logout, style: {
|
|
97
|
-
padding: "0.25rem 0.75rem",
|
|
98
|
-
border: "1px solid #d1d5db",
|
|
99
|
-
borderRadius: "0.375rem",
|
|
100
|
-
backgroundColor: "white",
|
|
101
|
-
cursor: "pointer",
|
|
102
|
-
fontSize: "0.75rem",
|
|
103
|
-
fontWeight: "500",
|
|
104
|
-
}, children: logoutButtonText }))] }));
|
|
74
|
+
}, children: [user.name || "Connected", " (Logout)"] }) }));
|
|
75
|
+
}
|
|
76
|
+
const profileUrl = `${profileBaseUrl}/${address}`;
|
|
77
|
+
return (_jsx("div", { className: className, children: _jsx(RenownUserButton, { address: address, username: user.name, profileUrl: profileUrl, avatarUrl: user.avatar, onDisconnect: logout }) }));
|
|
105
78
|
}
|
|
106
79
|
// Unauthenticated state
|
|
107
80
|
if (renderUnauthenticated) {
|
|
108
81
|
return (_jsx("div", { className: className, children: renderUnauthenticated({ openRenown, isLoading }) }));
|
|
109
82
|
}
|
|
110
|
-
|
|
111
|
-
return (_jsx("button", { onClick: openRenown, disabled: isLoading, className: className, style: {
|
|
112
|
-
padding: "0.5rem 1rem",
|
|
113
|
-
border: "1px solid #d1d5db",
|
|
114
|
-
borderRadius: "0.375rem",
|
|
115
|
-
backgroundColor: "white",
|
|
116
|
-
cursor: isLoading ? "not-allowed" : "pointer",
|
|
117
|
-
fontSize: "0.875rem",
|
|
118
|
-
fontWeight: "500",
|
|
119
|
-
opacity: isLoading ? 0.6 : 1,
|
|
120
|
-
}, children: isLoading ? "Loading..." : "Login with Renown" }));
|
|
83
|
+
return (_jsx("div", { className: className, children: _jsx(RenownLoginButton, { onLogin: openRenown }) }));
|
|
121
84
|
}
|
|
122
85
|
//# sourceMappingURL=RenownAuthButton.js.map
|
|
@@ -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;
|
|
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;AAqCzD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,MAAM,UAAU,gBAAgB,CAAC,EAC/B,SAAS,GAAG,EAAE,EACd,cAAc,GAAG,+BAA+B,EAChD,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,MAAM,UAAU,GAAG,IAAI,CAAC,UAAU,IAAI,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC,IAAI,CAAC;QAChE,IAAI,UAAU,EAAE,CAAC;YACf,MAAM,CAAC,IAAI,CAAC,GAAG,cAAc,IAAI,UAAU,EAAE,E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