@renown/sdk 5.1.0-dev.2 → 5.1.0-dev.21
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 +487 -1
- 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 +97 -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 +155 -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/common.d.ts +1 -1
- package/dist/src/common.d.ts.map +1 -1
- package/dist/src/components/RenownAuthButton.d.ts +62 -0
- package/dist/src/components/RenownAuthButton.d.ts.map +1 -0
- package/dist/src/components/RenownAuthButton.js +82 -0
- package/dist/src/components/RenownAuthButton.js.map +1 -0
- package/dist/src/components/RenownLoginButton.d.ts +48 -0
- package/dist/src/components/RenownLoginButton.d.ts.map +1 -0
- package/dist/src/components/RenownLoginButton.js +175 -0
- package/dist/src/components/RenownLoginButton.js.map +1 -0
- package/dist/src/components/RenownUserButton.d.ts +66 -0
- package/dist/src/components/RenownUserButton.d.ts.map +1 -0
- package/dist/src/components/RenownUserButton.js +216 -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 +7 -3
- package/dist/src/components/index.d.ts.map +1 -1
- package/dist/src/components/index.js +4 -1
- package/dist/src/components/index.js.map +1 -1
- package/dist/src/constants.d.ts +1 -1
- package/dist/src/constants.d.ts.map +1 -1
- package/dist/src/constants.js +1 -1
- package/dist/src/constants.js.map +1 -1
- package/dist/src/hooks/index.d.ts +2 -0
- package/dist/src/hooks/index.d.ts.map +1 -0
- package/dist/src/hooks/index.js +2 -0
- package/dist/src/hooks/index.js.map +1 -0
- package/dist/src/hooks/use-user.d.ts +21 -0
- package/dist/src/hooks/use-user.d.ts.map +1 -0
- package/dist/src/hooks/use-user.js +30 -0
- package/dist/src/hooks/use-user.js.map +1 -0
- package/dist/src/index.d.ts +8 -1
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +8 -1
- package/dist/src/index.js.map +1 -1
- package/dist/src/lib/crypto/browser.d.ts +8 -0
- package/dist/src/lib/crypto/browser.d.ts.map +1 -0
- package/dist/src/lib/crypto/browser.js +73 -0
- package/dist/src/lib/crypto/browser.js.map +1 -0
- package/dist/src/lib/crypto/index.d.ts +36 -0
- package/dist/src/lib/crypto/index.d.ts.map +1 -0
- package/dist/src/lib/crypto/index.js +150 -0
- package/dist/src/lib/crypto/index.js.map +1 -0
- package/dist/src/lib/crypto/node.d.ts +8 -0
- package/dist/src/lib/crypto/node.d.ts.map +1 -0
- package/dist/src/lib/crypto/node.js +67 -0
- package/dist/src/lib/crypto/node.js.map +1 -0
- package/dist/src/lib/renown/constants.d.ts +130 -0
- package/dist/src/lib/renown/constants.d.ts.map +1 -0
- package/dist/src/lib/renown/constants.js +40 -0
- package/dist/src/lib/renown/constants.js.map +1 -0
- package/dist/src/lib/renown/did-parser.d.ts +28 -0
- package/dist/src/lib/renown/did-parser.d.ts.map +1 -0
- package/dist/src/lib/renown/did-parser.js +57 -0
- package/dist/src/lib/renown/did-parser.js.map +1 -0
- package/dist/src/lib/renown/index.d.ts +4 -0
- package/dist/src/lib/renown/index.d.ts.map +1 -0
- package/dist/src/lib/renown/index.js +4 -0
- package/dist/src/lib/renown/index.js.map +1 -0
- package/dist/src/lib/renown/utils.d.ts +33 -0
- package/dist/src/lib/renown/utils.d.ts.map +1 -0
- package/dist/src/lib/renown/utils.js +207 -0
- package/dist/src/lib/renown/utils.js.map +1 -0
- package/dist/src/lib/session-storage.d.ts +40 -0
- package/dist/src/lib/session-storage.d.ts.map +1 -0
- package/dist/src/lib/session-storage.js +107 -0
- package/dist/src/lib/session-storage.js.map +1 -0
- package/dist/src/providers/index.d.ts +3 -0
- package/dist/src/providers/index.d.ts.map +1 -0
- package/dist/src/providers/index.js +2 -0
- package/dist/src/providers/index.js.map +1 -0
- package/dist/src/providers/renown-user-provider.d.ts +72 -0
- package/dist/src/providers/renown-user-provider.d.ts.map +1 -0
- package/dist/src/providers/renown-user-provider.js +171 -0
- package/dist/src/providers/renown-user-provider.js.map +1 -0
- package/dist/src/types.d.ts +3 -2
- package/dist/src/types.d.ts.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +26 -6
- package/dist/src/components/RenownLoginAvatar.d.ts +0 -44
- package/dist/src/components/RenownLoginAvatar.d.ts.map +0 -1
- package/dist/src/components/RenownLoginAvatar.js +0 -50
- package/dist/src/components/RenownLoginAvatar.js.map +0 -1
- package/dist/src/components/types.d.ts +0 -12
- package/dist/src/components/types.d.ts.map +0 -1
- package/dist/src/components/types.js +0 -2
- package/dist/src/components/types.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@renown/sdk",
|
|
3
|
-
"version": "5.1.0-dev.
|
|
3
|
+
"version": "5.1.0-dev.21",
|
|
4
4
|
"description": "",
|
|
5
5
|
"license": "AGPL-3.0-only",
|
|
6
6
|
"private": false,
|
|
@@ -13,8 +13,16 @@
|
|
|
13
13
|
"access": "public"
|
|
14
14
|
},
|
|
15
15
|
"exports": {
|
|
16
|
-
".":
|
|
17
|
-
|
|
16
|
+
".": {
|
|
17
|
+
"types": "./dist/src/index.d.ts",
|
|
18
|
+
"import": "./dist/src/index.js",
|
|
19
|
+
"default": "./dist/src/index.js"
|
|
20
|
+
},
|
|
21
|
+
"./node": {
|
|
22
|
+
"types": "./dist/src/node.d.ts",
|
|
23
|
+
"import": "./dist/src/node.js",
|
|
24
|
+
"default": "./dist/src/node.js"
|
|
25
|
+
}
|
|
18
26
|
},
|
|
19
27
|
"types": "./dist/src/index.d.ts",
|
|
20
28
|
"sideEffects": false,
|
|
@@ -30,7 +38,7 @@
|
|
|
30
38
|
],
|
|
31
39
|
"peerDependencies": {
|
|
32
40
|
"react": "^18.0.0 || ^19.0.0",
|
|
33
|
-
"document-model": "5.1.0-dev.
|
|
41
|
+
"document-model": "5.1.0-dev.21"
|
|
34
42
|
},
|
|
35
43
|
"peerDependenciesMeta": {
|
|
36
44
|
"react": {
|
|
@@ -38,10 +46,16 @@
|
|
|
38
46
|
}
|
|
39
47
|
},
|
|
40
48
|
"devDependencies": {
|
|
49
|
+
"@playwright/test": "^1.57.0",
|
|
50
|
+
"copyfiles": "^2.4.1",
|
|
41
51
|
"@types/react": "^18.0.0",
|
|
52
|
+
"@types/react-dom": "^18.0.0",
|
|
53
|
+
"@vitejs/plugin-react": "^5.1.1",
|
|
42
54
|
"react": "^18.0.0",
|
|
55
|
+
"react-dom": "^18.0.0",
|
|
56
|
+
"vite": "^7.2.6",
|
|
43
57
|
"vitest": "^3.2.4",
|
|
44
|
-
"document-model": "5.1.0-dev.
|
|
58
|
+
"document-model": "5.1.0-dev.21"
|
|
45
59
|
},
|
|
46
60
|
"dependencies": {
|
|
47
61
|
"@didtools/key-did": "^1.0.0",
|
|
@@ -54,6 +68,12 @@
|
|
|
54
68
|
},
|
|
55
69
|
"scripts": {
|
|
56
70
|
"tsc": "tsc",
|
|
57
|
-
"
|
|
71
|
+
"build": "pnpm run copy-assets",
|
|
72
|
+
"copy-assets": "copyfiles 'src/assets/*' dist/",
|
|
73
|
+
"lint": "eslint",
|
|
74
|
+
"dev:e2e": "vite --config e2e/fixtures/vite.config.ts",
|
|
75
|
+
"test:e2e": "playwright test",
|
|
76
|
+
"test:e2e:ui": "playwright test --ui",
|
|
77
|
+
"test:e2e:headed": "playwright test --headed"
|
|
58
78
|
}
|
|
59
79
|
}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import type { LoginAvatarProps } from "./types.js";
|
|
3
|
-
/**
|
|
4
|
-
* Headless Renown Login Avatar component
|
|
5
|
-
* Provides login button when not authenticated, and user avatar when authenticated
|
|
6
|
-
*
|
|
7
|
-
* @example
|
|
8
|
-
* ```tsx
|
|
9
|
-
* <RenownLoginAvatar
|
|
10
|
-
* isLoggedIn={true}
|
|
11
|
-
* user={{ username: 'alice', avatar: 'https://...', ethAddress: '0x...' }}
|
|
12
|
-
* onLoginClick={() => console.log('Login')}
|
|
13
|
-
* profileBaseUrl="https://renown.io"
|
|
14
|
-
* renderAvatar={({ user, onClick }) => (
|
|
15
|
-
* <img src={user.avatar} alt={user.username} onClick={onClick} />
|
|
16
|
-
* )}
|
|
17
|
-
* renderButton={({ onClick }) => (
|
|
18
|
-
* <button onClick={onClick}>Log in</button>
|
|
19
|
-
* )}
|
|
20
|
-
* />
|
|
21
|
-
* ```
|
|
22
|
-
*/
|
|
23
|
-
export interface RenownLoginAvatarProps extends LoginAvatarProps {
|
|
24
|
-
/**
|
|
25
|
-
* Custom render function for the avatar when logged in
|
|
26
|
-
*/
|
|
27
|
-
renderAvatar?: (props: {
|
|
28
|
-
user: NonNullable<LoginAvatarProps["user"]>;
|
|
29
|
-
onClick: () => void;
|
|
30
|
-
}) => React.ReactNode;
|
|
31
|
-
/**
|
|
32
|
-
* Custom render function for the login button when not logged in
|
|
33
|
-
*/
|
|
34
|
-
renderButton?: (props: {
|
|
35
|
-
onClick: () => void;
|
|
36
|
-
}) => React.ReactNode;
|
|
37
|
-
/**
|
|
38
|
-
* Base URL for the profile page (e.g., "https://renown.io/profile")
|
|
39
|
-
* Defaults to "https://renown.io/profile"
|
|
40
|
-
*/
|
|
41
|
-
profileBaseUrl?: string;
|
|
42
|
-
}
|
|
43
|
-
export declare function RenownLoginAvatar({ isLoggedIn, user, onLoginClick, profileBaseUrl, renderAvatar, renderButton, }: RenownLoginAvatarProps): import("react/jsx-runtime").JSX.Element;
|
|
44
|
-
//# sourceMappingURL=RenownLoginAvatar.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"RenownLoginAvatar.d.ts","sourceRoot":"","sources":["../../../src/components/RenownLoginAvatar.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAEnD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,WAAW,sBAAuB,SAAQ,gBAAgB;IAC9D;;OAEG;IACH,YAAY,CAAC,EAAE,CAAC,KAAK,EAAE;QACrB,IAAI,EAAE,WAAW,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAC,CAAC;QAC5C,OAAO,EAAE,MAAM,IAAI,CAAC;KACrB,KAAK,KAAK,CAAC,SAAS,CAAC;IAEtB;;OAEG;IACH,YAAY,CAAC,EAAE,CAAC,KAAK,EAAE;QAAE,OAAO,EAAE,MAAM,IAAI,CAAA;KAAE,KAAK,KAAK,CAAC,SAAS,CAAC;IAEnE;;;OAGG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,wBAAgB,iBAAiB,CAAC,EAChC,UAAU,EACV,IAAI,EACJ,YAAY,EACZ,cAA4C,EAC5C,YAAY,EACZ,YAAY,GACb,EAAE,sBAAsB,2CA+ExB"}
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import React from "react";
|
|
3
|
-
export function RenownLoginAvatar({ isLoggedIn, user, onLoginClick, profileBaseUrl = "https://renown.io/profile", renderAvatar, renderButton, }) {
|
|
4
|
-
if (isLoggedIn && user) {
|
|
5
|
-
const handleProfileClick = () => {
|
|
6
|
-
const identifier = user.ethAddress || user.username;
|
|
7
|
-
window.open(`${profileBaseUrl}/${identifier}`, "_blank");
|
|
8
|
-
};
|
|
9
|
-
if (renderAvatar) {
|
|
10
|
-
return _jsx(_Fragment, { children: renderAvatar({ user, onClick: handleProfileClick }) });
|
|
11
|
-
}
|
|
12
|
-
// Default avatar rendering
|
|
13
|
-
return (_jsxs("div", { onClick: handleProfileClick, style: {
|
|
14
|
-
display: "inline-flex",
|
|
15
|
-
alignItems: "center",
|
|
16
|
-
gap: "0.5rem",
|
|
17
|
-
cursor: "pointer",
|
|
18
|
-
}, children: [user.avatar ? (_jsx("img", { src: user.avatar, alt: user.username, style: {
|
|
19
|
-
width: "2.5rem",
|
|
20
|
-
height: "2.5rem",
|
|
21
|
-
borderRadius: "50%",
|
|
22
|
-
objectFit: "cover",
|
|
23
|
-
} })) : (_jsx("div", { style: {
|
|
24
|
-
width: "2.5rem",
|
|
25
|
-
height: "2.5rem",
|
|
26
|
-
borderRadius: "50%",
|
|
27
|
-
backgroundColor: "#9333ea",
|
|
28
|
-
color: "white",
|
|
29
|
-
display: "flex",
|
|
30
|
-
alignItems: "center",
|
|
31
|
-
justifyContent: "center",
|
|
32
|
-
fontWeight: "bold",
|
|
33
|
-
fontSize: "0.875rem",
|
|
34
|
-
}, children: user.username.substring(0, 2).toUpperCase() })), _jsx("span", { style: { fontSize: "0.875rem", fontWeight: "500" }, children: user.username })] }));
|
|
35
|
-
}
|
|
36
|
-
if (renderButton) {
|
|
37
|
-
return _jsx(_Fragment, { children: renderButton({ onClick: onLoginClick || (() => { }) }) });
|
|
38
|
-
}
|
|
39
|
-
// Default button rendering
|
|
40
|
-
return (_jsx("button", { onClick: onLoginClick, style: {
|
|
41
|
-
padding: "0.5rem 1rem",
|
|
42
|
-
border: "1px solid #d1d5db",
|
|
43
|
-
borderRadius: "0.375rem",
|
|
44
|
-
backgroundColor: "white",
|
|
45
|
-
cursor: "pointer",
|
|
46
|
-
fontSize: "0.875rem",
|
|
47
|
-
fontWeight: "500",
|
|
48
|
-
}, children: "Log in" }));
|
|
49
|
-
}
|
|
50
|
-
//# sourceMappingURL=RenownLoginAvatar.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"RenownLoginAvatar.js","sourceRoot":"","sources":["../../../src/components/RenownLoginAvatar.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AA4C1B,MAAM,UAAU,iBAAiB,CAAC,EAChC,UAAU,EACV,IAAI,EACJ,YAAY,EACZ,cAAc,GAAG,2BAA2B,EAC5C,YAAY,EACZ,YAAY,GACW;IACvB,IAAI,UAAU,IAAI,IAAI,EAAE,CAAC;QACvB,MAAM,kBAAkB,GAAG,GAAG,EAAE;YAC9B,MAAM,UAAU,GAAG,IAAI,CAAC,UAAU,IAAI,IAAI,CAAC,QAAQ,CAAC;YACpD,MAAM,CAAC,IAAI,CAAC,GAAG,cAAc,IAAI,UAAU,EAAE,EAAE,QAAQ,CAAC,CAAC;QAC3D,CAAC,CAAC;QAEF,IAAI,YAAY,EAAE,CAAC;YACjB,OAAO,4BAAG,YAAY,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,kBAAkB,EAAE,CAAC,GAAI,CAAC;QACpE,CAAC;QAED,2BAA2B;QAC3B,OAAO,CACL,eACE,OAAO,EAAE,kBAAkB,EAC3B,KA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E,OAAO;YACxB,MAAM,EAAE,SAAS;YACjB,QAAQ,EAAE,UAAU;YACpB,UAAU,EAAE,KAAK;SAClB,uBAGM,CACV,CAAC;AACJ,CAAC"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
export interface RenownUser {
|
|
2
|
-
username: string;
|
|
3
|
-
avatar?: string;
|
|
4
|
-
ethAddress?: string;
|
|
5
|
-
}
|
|
6
|
-
export interface LoginAvatarProps {
|
|
7
|
-
isLoggedIn: boolean;
|
|
8
|
-
user?: RenownUser;
|
|
9
|
-
onLoginClick?: () => void;
|
|
10
|
-
profileBaseUrl?: string;
|
|
11
|
-
}
|
|
12
|
-
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,UAAU;IACzB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,gBAAgB;IAC/B,UAAU,EAAE,OAAO,CAAC;IACpB,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;IAC1B,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/components/types.ts"],"names":[],"mappings":""}
|