@renown/sdk 4.1.0-dev.72 → 4.1.0-dev.74
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/src/components/RenownLoginAvatar.d.ts +44 -0
- package/dist/src/components/RenownLoginAvatar.d.ts.map +1 -0
- package/dist/src/components/RenownLoginAvatar.js +50 -0
- package/dist/src/components/RenownLoginAvatar.js.map +1 -0
- package/dist/src/components/index.d.ts +4 -0
- package/dist/src/components/index.d.ts.map +1 -0
- package/dist/src/components/index.js +2 -0
- package/dist/src/components/index.js.map +1 -0
- package/dist/src/components/types.d.ts +12 -0
- package/dist/src/components/types.d.ts.map +1 -0
- package/dist/src/components/types.js +2 -0
- package/dist/src/components/types.js.map +1 -0
- package/dist/src/index.d.ts +1 -0
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +1 -0
- package/dist/src/index.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +11 -3
|
@@ -0,0 +1,44 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RenownLoginAvatar.d.ts","sourceRoot":"","sources":["../../../src/components/RenownLoginAvatar.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAElD;;;;;;;;;;;;;;;;;;;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,CAAA;QAC3C,OAAO,EAAE,MAAM,IAAI,CAAA;KACpB,KAAK,KAAK,CAAC,SAAS,CAAA;IAErB;;OAEG;IACH,YAAY,CAAC,EAAE,CAAC,KAAK,EAAE;QAAE,OAAO,EAAE,MAAM,IAAI,CAAA;KAAE,KAAK,KAAK,CAAC,SAAS,CAAA;IAElE;;;OAGG;IACH,cAAc,CAAC,EAAE,MAAM,CAAA;CACxB;AAED,wBAAgB,iBAAiB,CAAC,EAChC,UAAU,EACV,IAAI,EACJ,YAAY,EACZ,cAA4C,EAC5C,YAAY,EACZ,YAAY,GACb,EAAE,sBAAsB,2CA6ExB"}
|
|
@@ -0,0 +1,50 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RenownLoginAvatar.js","sourceRoot":"","sources":["../../../src/components/RenownLoginAvatar.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AA4CzB,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,CAAA;YACnD,MAAM,CAAC,IAAI,CAAC,GAAG,cAAc,IAAI,UAAU,EAAE,EAAE,QAAQ,CAAC,CAAA;QAC1D,CAAC,CAAA;QAED,IAAI,YAAY,EAAE,CAAC;YACjB,OAAO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;IAED,2BAA2B;IAC3B,OAAO,CACL,iBACE,OAAO,EAAE,YAAY,EACrB,KAAK,EAAE;YACL,OAAO,EAAE,aAAa;YACtB,MAAM,EAAE,mBAAmB;YAC3B,YAAY,EAAE,UAAU;YACxB,eAAe,EAAE,OAAO;YACxB,MAAM,EAAE,SAAS;YACjB,QAAQ,EAAE,UAAU;YACpB,UAAU,EAAE,KAAK;SAClB,uBAGM,CACV,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAA;AAC1D,YAAY,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAA;AACpE,YAAY,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAA"}
|
|
@@ -0,0 +1,12 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,UAAU;IACzB,QAAQ,EAAE,MAAM,CAAA;IAChB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB;AAED,MAAM,WAAW,gBAAgB;IAC/B,UAAU,EAAE,OAAO,CAAA;IACnB,IAAI,CAAC,EAAE,UAAU,CAAA;IACjB,YAAY,CAAC,EAAE,MAAM,IAAI,CAAA;IACzB,cAAc,CAAC,EAAE,MAAM,CAAA;CACxB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/components/types.ts"],"names":[],"mappings":""}
|
package/dist/src/index.d.ts
CHANGED
package/dist/src/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,uBAAuB,CAAC"}
|
package/dist/src/index.js
CHANGED
package/dist/src/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,uBAAuB,CAAC"}
|