@welshare/react 0.1.0 → 0.2.1
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/esm/components/connect-button.d.ts +1 -1
- package/dist/esm/components/connect-button.d.ts.map +1 -1
- package/dist/esm/components/connect-button.js +39 -35
- package/dist/esm/components/welshare-logo.d.ts +9 -0
- package/dist/esm/components/welshare-logo.d.ts.map +1 -0
- package/dist/esm/components/welshare-logo.js +4 -0
- package/dist/esm/hooks/use-welshare.d.ts.map +1 -1
- package/dist/esm/hooks/use-welshare.js +12 -3
- package/dist/esm/index.d.ts +1 -0
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +1 -0
- package/dist/esm/types.d.ts +4 -2
- package/dist/esm/types.d.ts.map +1 -1
- package/dist/node_modules/@welshare/react/.DS_Store +0 -0
- package/dist/node_modules/@welshare/react/dist/esm/components/connect-button.d.ts +1 -1
- package/dist/node_modules/@welshare/react/dist/esm/components/connect-button.d.ts.map +1 -1
- package/dist/node_modules/@welshare/react/dist/esm/components/connect-button.js +39 -35
- package/dist/node_modules/@welshare/react/dist/esm/components/welshare-logo.d.ts +9 -0
- package/dist/node_modules/@welshare/react/dist/esm/components/welshare-logo.d.ts.map +1 -0
- package/dist/node_modules/@welshare/react/dist/esm/components/welshare-logo.js +4 -0
- package/dist/node_modules/@welshare/react/dist/esm/hooks/use-welshare.d.ts.map +1 -1
- package/dist/node_modules/@welshare/react/dist/esm/hooks/use-welshare.js +12 -3
- package/dist/node_modules/@welshare/react/dist/esm/index.d.ts +1 -0
- package/dist/node_modules/@welshare/react/dist/esm/index.d.ts.map +1 -1
- package/dist/node_modules/@welshare/react/dist/esm/index.js +1 -0
- package/dist/node_modules/@welshare/react/dist/esm/types.d.ts +4 -2
- package/dist/node_modules/@welshare/react/dist/esm/types.d.ts.map +1 -1
- package/dist/node_modules/@welshare/react/package.json +2 -2
- package/dist/node_modules/@welshare/react/src/assets/logo_black.svg +20 -0
- package/dist/node_modules/@welshare/react/src/assets/logo_color.svg +51 -0
- package/dist/node_modules/@welshare/react/src/assets/logo_white.svg +20 -0
- package/dist/node_modules/@welshare/react/src/components/connect-button.tsx +60 -42
- package/dist/node_modules/@welshare/react/src/components/welshare-logo.tsx +56 -0
- package/dist/node_modules/@welshare/react/src/hooks/use-welshare.ts +14 -3
- package/dist/node_modules/@welshare/react/src/index.ts +1 -0
- package/dist/node_modules/@welshare/react/src/types.ts +4 -3
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connect-button.d.ts","sourceRoot":"","sources":["../../../src/components/connect-button.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"connect-button.d.ts","sourceRoot":"","sources":["../../../src/components/connect-button.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,eAAO,MAAM,qBAAqB,UAAW;IAC3C,UAAU,EAAE,MAAM,IAAI,CAAC;IACvB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B,4CAiGA,CAAC"}
|
|
@@ -1,58 +1,62 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { WelshareLogo } from "./welshare-logo.js";
|
|
2
3
|
export const ConnectWelshareButton = (props) => {
|
|
3
4
|
// Self-contained styles that won't conflict with external applications
|
|
4
5
|
const buttonStyles = {
|
|
5
6
|
// Reset any inherited styles
|
|
6
|
-
all:
|
|
7
|
-
boxSizing:
|
|
7
|
+
all: "unset",
|
|
8
|
+
boxSizing: "border-box",
|
|
8
9
|
// Layout
|
|
9
|
-
display:
|
|
10
|
-
alignItems:
|
|
11
|
-
justifyContent:
|
|
12
|
-
width:
|
|
13
|
-
minHeight:
|
|
14
|
-
padding:
|
|
10
|
+
display: "inline-flex",
|
|
11
|
+
alignItems: "center",
|
|
12
|
+
justifyContent: "center",
|
|
13
|
+
width: "100%",
|
|
14
|
+
minHeight: "44px",
|
|
15
|
+
padding: "12px 24px",
|
|
15
16
|
// Typography
|
|
16
17
|
fontFamily: '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif',
|
|
17
|
-
fontSize:
|
|
18
|
-
fontWeight:
|
|
19
|
-
lineHeight:
|
|
20
|
-
textAlign:
|
|
21
|
-
textDecoration:
|
|
22
|
-
whiteSpace:
|
|
18
|
+
fontSize: "16px",
|
|
19
|
+
fontWeight: "600",
|
|
20
|
+
lineHeight: "1.5",
|
|
21
|
+
textAlign: "center",
|
|
22
|
+
textDecoration: "none",
|
|
23
|
+
whiteSpace: "nowrap",
|
|
23
24
|
// Visual styling
|
|
24
|
-
backgroundColor:
|
|
25
|
-
background:
|
|
26
|
-
color:
|
|
27
|
-
border:
|
|
28
|
-
borderRadius:
|
|
29
|
-
cursor:
|
|
30
|
-
transition:
|
|
25
|
+
backgroundColor: "#0198ff",
|
|
26
|
+
background: "linear-gradient(135deg, #0198ff 0%, #16ffef 100%)",
|
|
27
|
+
color: "#ffffff",
|
|
28
|
+
border: "none",
|
|
29
|
+
borderRadius: "8px",
|
|
30
|
+
cursor: "pointer",
|
|
31
|
+
transition: "all 0.2s ease-in-out",
|
|
31
32
|
// Accessibility
|
|
32
|
-
userSelect:
|
|
33
|
-
WebkitUserSelect:
|
|
34
|
-
MozUserSelect:
|
|
33
|
+
userSelect: "none",
|
|
34
|
+
WebkitUserSelect: "none",
|
|
35
|
+
MozUserSelect: "none",
|
|
35
36
|
// Focus states
|
|
36
|
-
outline:
|
|
37
|
+
outline: "none",
|
|
37
38
|
};
|
|
38
39
|
// Handle hover and focus states since inline styles don't support pseudo-selectors
|
|
39
40
|
const handleMouseEnter = (e) => {
|
|
40
|
-
e.currentTarget.style.transform =
|
|
41
|
-
e.currentTarget.style.boxShadow =
|
|
41
|
+
e.currentTarget.style.transform = "translateY(-1px)";
|
|
42
|
+
e.currentTarget.style.boxShadow = "0 4px 12px rgba(1, 152, 255, 0.3)";
|
|
42
43
|
};
|
|
43
44
|
const handleMouseLeave = (e) => {
|
|
44
|
-
e.currentTarget.style.transform =
|
|
45
|
-
e.currentTarget.style.boxShadow =
|
|
45
|
+
e.currentTarget.style.transform = "translateY(0)";
|
|
46
|
+
e.currentTarget.style.boxShadow = "0 2px 6px rgba(1, 152, 255, 0.2)";
|
|
46
47
|
};
|
|
47
48
|
const handleMouseDown = (e) => {
|
|
48
|
-
e.currentTarget.style.transform =
|
|
49
|
-
e.currentTarget.style.boxShadow =
|
|
49
|
+
e.currentTarget.style.transform = "translateY(0)";
|
|
50
|
+
e.currentTarget.style.boxShadow = "0 2px 6px rgba(1, 152, 255, 0.2)";
|
|
50
51
|
};
|
|
51
52
|
const handleFocus = (e) => {
|
|
52
|
-
e.currentTarget.style.boxShadow =
|
|
53
|
+
e.currentTarget.style.boxShadow = "0 0 0 3px rgba(1, 152, 255, 0.3)";
|
|
53
54
|
};
|
|
54
55
|
const handleBlur = (e) => {
|
|
55
|
-
e.currentTarget.style.boxShadow =
|
|
56
|
+
e.currentTarget.style.boxShadow = "0 2px 6px rgba(1, 152, 255, 0.2)";
|
|
56
57
|
};
|
|
57
|
-
return (_jsx("button", { onClick: props.openWallet, style: buttonStyles, onMouseEnter: handleMouseEnter, onMouseLeave: handleMouseLeave, onMouseDown: handleMouseDown, onFocus: handleFocus, onBlur: handleBlur, type: "button", children: props.children || "
|
|
58
|
+
return (_jsx("button", { onClick: props.openWallet, style: buttonStyles, onMouseEnter: handleMouseEnter, onMouseLeave: handleMouseLeave, onMouseDown: handleMouseDown, onFocus: handleFocus, onBlur: handleBlur, type: "button", children: _jsx(_Fragment, { children: props.children || (_jsxs(_Fragment, { children: [_jsx("span", { className: "", children: _jsx(WelshareLogo, { width: 24, height: 18, style: {
|
|
59
|
+
"marginRight": "4px",
|
|
60
|
+
color: "#ffffff",
|
|
61
|
+
} }) }), _jsx("span", { children: "Connect Welshare Profile" })] })) }) }));
|
|
58
62
|
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface WelshareLogoProps {
|
|
3
|
+
className?: string;
|
|
4
|
+
style?: React.CSSProperties;
|
|
5
|
+
width?: number | string;
|
|
6
|
+
height?: number | string;
|
|
7
|
+
}
|
|
8
|
+
export declare const WelshareLogo: React.FC<WelshareLogoProps>;
|
|
9
|
+
//# sourceMappingURL=welshare-logo.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"welshare-logo.d.ts","sourceRoot":"","sources":["../../../src/components/welshare-logo.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,MAAM,WAAW,iBAAiB;IAChC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IAC5B,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACxB,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CAC1B;AAED,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,iBAAiB,CA8CpD,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
export const WelshareLogo = ({ className, style, width = 24, height = 16, ...props }) => {
|
|
3
|
+
return (_jsx("svg", { className: className, style: style, width: width, height: height, viewBox: "0 0 636.19 428.76", xmlns: "http://www.w3.org/2000/svg", ...props, children: _jsxs("g", { children: [_jsx("path", { fill: "currentColor", strokeWidth: "0", d: "m589.26,220.57l-32.72,56.69-11.4,19.77-65.87-91.19c11.14,3.87,23.84,3.29,34.36-2.65.31-.18.62-.36.93-.55,13.09-7.43,20.77-21.35,21.19-35.75l53.51,53.67Z" }), _jsx("path", { fill: "currentColor", strokeWidth: "0", d: "m125.97,72.79c-.45-.2-.91-.38-1.37-.55h-.08c-3.63-1.46-7.5-2.26-11.35-2.58-5.51-.46-10.74.21-15.53,1.77-14.41,4.7-24.91,17.47-27.62,31.93L28.16,37.52c4.04-4.64,8.47-8.96,13.2-12.9,6.52-5.4,13.63-10.05,21.25-13.79,3.53-1.72,7.16-3.27,10.91-4.58,5.12-1.82,10.44-3.25,15.92-4.26l36.53,70.8Z" }), _jsx("path", { fill: "currentColor", strokeWidth: "0", d: "m621.17,165.31l-64.62,111.95-42.91-74.07c.31-.18.62-.36.93-.55,19.99-11.33,27.38-37.86,15.55-58.02-10.99-19.02-28.48-49.36-44.46-77.03C468.75,38.32,488.86.96,522.66.04c77.49-2.1,144.44,82.96,98.5,165.27Z" }), _jsx("path", { fill: "currentColor", strokeWidth: "0", d: "m513.64,203.19c-18.27,10.32-43.13,4.47-54.96-12.8l-.07-.1c-1.68-2.3-11.65-19.85-13.06-22.27l.08-.13-1.01-1.75-.08.14-39-67.52-5.2-9.03-22.91-39.68C357.2,19.22,322.48.31,285.37.31c-.81-.03-1.63-.03-2.44-.03-12.07.06-23.51,2.17-34.13,5.96-11.85,4.22-22.67,10.5-32.14,18.36-7.01,5.8-13.22,12.53-18.66,19.84C177.39,17.04,144.88.29,110.09.29h-2.41c-4.57.03-9.06.35-13.44.94-7.19.97-14.12,2.66-20.72,5.02-3.74,1.32-7.37,2.86-10.91,4.58l35.02,60.6c4.79-1.56,10.02-2.23,15.53-1.77,3.85.32,7.72,1.12,11.35,2.58h.08c8.69,3.22,16.19,9.59,20.79,17.72h.06v.03s1.79,3.11,1.79,3.11l2.12,3.66.42.73,1.89,3.27.57,1.01,5.87,10.13.56.94.56,1.02,6.66,11.52.34.57,4.37,7.58,1.09,1.89,2.44,4.23,3.95,6.85,2.75,4.75.88,1.53,1.61,2.82,2.44,4.23.86,1.47,1.46,2.52.79,1.36,1.26,2.2,1.6,2.78,2.92,5.06,1.54,2.65,2.13,3.67.46.78,1.67,2.89.06.1,3.14,5.45,1.47,2.55,5.78,9.99,4.89,8.48.9,1.56,1.56,2.69.18.31,1.01,1.75.1.17,2.3,3.98,1.65,2.85,3.28,5.68,2.65,4.58c1.74,3,3.46,5.99,5.12,8.9l1.11,1.91c1,1.68,2,3.38,2.96,5.07.64,1.12,1.29,2.26,1.92,3.38l.95,1.67,1.35,2.31c.31.49.59,1,.87,1.5l1.26,2.17c1.26,2.17,2.52,4.33,3.73,6.45.71,1.23,1.44,2.47,2.12,3.7l1.71,2.97,5.8,10.04.06.1c.18.31.36.62.55.91.31.53.6,1.07.9,1.58l3.49,6.06c.85,1.44,1.67,2.85,2.45,4.21l.49.88.08.17,50.41,87.32c.45-.55.88-1.11,1.3-1.67,14.73,19.44,35.96,33.78,59.56,40.01,9.08,2.51,18.39,3.71,27.64,3.71.8,0,1.6-.01,2.4-.03,13.6-.29,27.04-3.18,39.6-8.33,0,0,.01-.01.04-.01,10.19-4.19,19.81-9.9,28.37-16.91,9.56-7.81,17.84-17.26,24.22-28.11.35-.56.69-1.11,1-1.67l1.68-2.89,30.28-52.44,23.72-41.1-42.91-74.07Zm-103.26,155.98c-3.31.36-6.66.36-9.97-.06-11.17-1.26-21.92-8.03-28.33-17.2-1.22-1.72-2.27-3.55-3.14-5.41-.01-.03-.01-.06-.04-.07l-1.14-1.98-3.55-6.11v-.04c-.86-1.44-1.71-2.96-2.62-4.51-2.27-3.9-4.71-8.12-7.3-12.64-.52-.9-1.05-1.79-1.58-2.73-.85-1.49-1.74-3.03-2.64-4.57-.91-1.56-1.82-3.14-2.75-4.75-2.79-4.79-5.68-9.81-8.68-15.01-2.99-5.19-6.08-10.54-9.24-16.02-2.59-4.5-5.23-9.07-7.91-13.68-15.99-27.73-33.04-57.28-47.66-82.59l-3.6-6.25c-2.34-4.02-4.6-7.96-6.77-11.72-3.95-6.83-7.61-13.15-10.86-18.8-.87-1.49-1.7-2.92-2.51-4.32-.29-.5-.59-1.02-.87-1.53-14.7-27.38,7.42-62.18,39.15-59.46,3.9.28,7.74,1.11,11.4,2.51.01.01.04.01.06.01,8.72,3.28,16.22,9.62,20.84,17.72l.04.04c.03.1.11.24.25.46.17.32.48.78.81,1.42l.73,1.25c.78,1.35,1.78,3.1,2.97,5.16l1.44,2.5c1.51,2.64,3.24,5.61,5.09,8.83l1.91,3.29,1.98,3.42,2.03,3.52c.34.59.69,1.19,1.04,1.81l1.93,3.34c.08.17.2.34.28.46l1.98,3.45c2.1,3.66,4.22,7.3,6.25,10.82l2,3.49,1.93,3.35c.95,1.65,1.88,3.24,2.76,4.77.29.5.56,1.01.85,1.5l1.65,2.85,1.5,2.62c3.38,5.83,5.52,9.56,5.52,9.56,2.38,4.12,5.05,8.72,7.93,13.71,1.44,2.48,2.93,5.07,4.47,7.74.38.66.77,1.33,1.15,2,1.57,2.71,3.18,5.48,4.81,8.31,2.87,4.96,5.83,10.11,8.85,15.34.87,1.49,1.74,2.99,2.59,4.5,2.19,3.77,4.39,7.58,6.59,11.4.88,1.51,1.77,3.04,2.64,4.57,1.75,3.04,3.53,6.1,5.26,9.13,1.32,2.27,2.62,4.51,3.91,6.77,1.3,2.23,2.58,4.44,3.85,6.64.42.74.84,1.47,1.26,2.2,1.67,2.92,3.34,5.76,4.95,8.56.81,1.42,1.61,2.79,2.4,4.15,1.96,3.42,3.87,6.73,5.71,9.91.73,1.26,1.46,2.51,2.14,3.71,2.47,4.26,4.75,8.24,6.83,11.83l.53.91c13.85,24.74-2.73,56.98-31.13,59.94Z" }), _jsx("path", { fill: "currentColor", strokeWidth: "0", d: "m316.73,386.68c-4.84,6.2-10.32,11.83-16.33,16.78-8.62,7.01-18.21,12.73-28.36,16.92h-.08c-12.57,5.16-26.02,8.06-39.56,8.3-.81.08-1.61.08-2.41.08-9.27,0-18.62-1.22-27.64-3.71-26.34-7.01-49.79-23.93-64.45-46.97-1.53-2.17-3.14-5.23-4.51-7.57L14.87,165.3c-21.43-35.61-18.29-77.27.48-109.82,6.77-11.76,15.63-22.23,26.02-30.85,6.52-5.4,13.63-10.05,21.25-13.79l35.02,60.6c-22.81,7.43-35.82,35.11-23.63,57.68.24.57.56,1.05.81,1.54.8,1.44,1.68,2.89,2.5,4.35,3.31,5.64,6.92,12,10.88,18.77,2.17,3.78,4.43,7.74,6.77,11.76l3.62,6.21c14.66,25.37,31.67,54.87,47.7,82.58,2.65,4.67,5.23,9.27,7.89,13.7,3.14,5.48,6.21,10.88,9.18,16.04,3.07,5.24,5.97,10.23,8.71,15.07.97,1.61,1.85,3.14,2.73,4.67.9,1.61,1.78,3.14,2.66,4.6.49.97,1.05,1.85,1.61,2.73,2.58,4.51,4.99,8.79,7.25,12.64.9,1.54,1.78,3.07,2.66,4.51v.08l3.55,6.04,1.12,2.02v.08c.9,1.85,1.93,3.7,3.15,5.4,6.43,9.18,17.16,15.95,28.36,17.24,3.29.39,6.69.39,9.98,0,28.29-2.99,44.9-35.07,31.19-59.79l50.41,87.32Z" })] }) }));
|
|
4
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-welshare.d.ts","sourceRoot":"","sources":["../../../src/hooks/use-welshare.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,iBAAiB,EACjB,kBAAkB,EAElB,yBAAyB,EAC1B,MAAM,YAAY,CAAC;AAIpB,eAAO,MAAM,WAAW,UAAW,yBAAyB;;;;;
|
|
1
|
+
{"version":3,"file":"use-welshare.d.ts","sourceRoot":"","sources":["../../../src/hooks/use-welshare.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,iBAAiB,EACjB,kBAAkB,EAElB,yBAAyB,EAC1B,MAAM,YAAY,CAAC;AAIpB,eAAO,MAAM,WAAW,UAAW,yBAAyB;;;;;uBAmLlD,IAAI,aACC,MAAM,KAChB,OAAO,CAAC;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,aAAa,EAAE,MAAM,CAAA;KAAE,CAAC;iBA0C9B,CAAC,YACT,kBAAkB,cAChB,iBAAiB,CAAC,CAAC,CAAC;;;CAqEnC,CAAC"}
|
|
@@ -10,7 +10,6 @@ export const useWelshare = (props) => {
|
|
|
10
10
|
// (claude opus) Use ref to control current upload in effect without triggering re-renders
|
|
11
11
|
const currentUploadRef = useRef(null);
|
|
12
12
|
const options = {
|
|
13
|
-
environment: "development",
|
|
14
13
|
apiBaseUrl: "https://wallet.welshare.app",
|
|
15
14
|
...props,
|
|
16
15
|
};
|
|
@@ -199,10 +198,20 @@ export const useWelshare = (props) => {
|
|
|
199
198
|
};
|
|
200
199
|
const openWallet = () => {
|
|
201
200
|
const width = 800;
|
|
202
|
-
const height =
|
|
201
|
+
const height = 700;
|
|
203
202
|
const left = window.screenX + (window.outerWidth - width) / 2;
|
|
204
203
|
const top = window.screenY + (window.outerHeight - height) / 2;
|
|
205
|
-
|
|
204
|
+
let socialParams = "";
|
|
205
|
+
if (options.interpolateSocials) {
|
|
206
|
+
const socialEntries = Object.entries(options.interpolateSocials)
|
|
207
|
+
.filter(([_, value]) => value !== undefined && value !== null)
|
|
208
|
+
.map(([key, value]) => `social.${key}=${encodeURIComponent(String(value))}`);
|
|
209
|
+
if (socialEntries.length > 0) {
|
|
210
|
+
socialParams = `&${socialEntries.join('&')}`;
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
const walletUrl = `${WELSHARE_WALLET_URL}?applicationId=${options.applicationId}${socialParams}`;
|
|
214
|
+
const newWindow = window.open(walletUrl, "Welshare Wallet", `width=${width},height=${height},left=${left},top=${top}`);
|
|
206
215
|
if (newWindow) {
|
|
207
216
|
setDialogWindow(newWindow);
|
|
208
217
|
}
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { ConnectWelshareButton } from "./components/connect-button.js";
|
|
2
|
+
export { WelshareLogo } from "./components/welshare-logo.js";
|
|
2
3
|
export { useWelshare } from "./hooks/use-welshare.js";
|
|
3
4
|
export { decodeEncryptionKey, decrypt, encodeEncryptionKey, encryptFile, generateRandomAESKey, type EncryptionKey } from "./lib/encryption.js";
|
|
4
5
|
export { encryptAndUploadFile } from "./lib/uploads.js";
|
package/dist/esm/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;AACvE,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAE7D,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAEtD,OAAO,EACL,mBAAmB,EACnB,OAAO,EACP,mBAAmB,EACnB,WAAW,EACX,oBAAoB,EACpB,KAAK,aAAa,EACnB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAExD,eAAO,MAAM,OAAO;;;;CAInB,CAAC"}
|
package/dist/esm/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
//todo: this is not tree shaken and leaks nillion dependencies transitively. Consider pulling it up
|
|
2
2
|
//import { QuestionnaireResponseSchema, ReflexSubmissionSchema } from "@welshare/sdk";
|
|
3
3
|
export { ConnectWelshareButton } from "./components/connect-button.js";
|
|
4
|
+
export { WelshareLogo } from "./components/welshare-logo.js";
|
|
4
5
|
// ---- hooks ----
|
|
5
6
|
export { useWelshare } from "./hooks/use-welshare.js";
|
|
6
7
|
export { decodeEncryptionKey, decrypt, encodeEncryptionKey, encryptFile, generateRandomAESKey } from "./lib/encryption.js";
|
package/dist/esm/types.d.ts
CHANGED
|
@@ -4,7 +4,6 @@ export interface DialogMessage {
|
|
|
4
4
|
payload?: any;
|
|
5
5
|
id?: string;
|
|
6
6
|
}
|
|
7
|
-
export type WelshareEnvironment = "development" | "production";
|
|
8
7
|
/**
|
|
9
8
|
* a welshare schema type uid
|
|
10
9
|
*/
|
|
@@ -48,8 +47,11 @@ export interface DataSubmissionDialogMessage extends DialogMessage {
|
|
|
48
47
|
}
|
|
49
48
|
export interface WelshareConnectionOptions {
|
|
50
49
|
applicationId: string;
|
|
50
|
+
interpolateSocials?: {
|
|
51
|
+
emailAddress?: string;
|
|
52
|
+
privy?: string;
|
|
53
|
+
};
|
|
51
54
|
apiBaseUrl?: string;
|
|
52
|
-
environment?: WelshareEnvironment;
|
|
53
55
|
callbacks: {
|
|
54
56
|
onFileUploaded?: (insertedUid: string, url: string) => void;
|
|
55
57
|
onUploaded?: (payload: SubmissionPayload<unknown>) => void;
|
package/dist/esm/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,GAAG,CAAC;IACd,EAAE,CAAC,EAAE,MAAM,CAAC;CACb;AAED
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,GAAG,CAAC;IACd,EAAE,CAAC,EAAE,MAAM,CAAC;CACb;AAED;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAAG,MAAM,CAAA;AAEvC,MAAM,WAAW,iBAAiB,CAAC,CAAC;IAClC,aAAa,EAAE,MAAM,CAAC;IACtB,SAAS,EAAE,IAAI,CAAC;IAChB,QAAQ,EAAE,kBAAkB,CAAC;IAC7B,UAAU,EAAE,CAAC,CAAC;CACf;AAED,MAAM,MAAM,iBAAiB,GAAG;IAC9B,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;CACnB,CAAA;AAED,MAAM,WAAW,+BAA+B;IAC9C,SAAS,CAAC,EAAE,IAAI,CAAC;IACjB,aAAa,EAAE,MAAM,CAAC;IACtB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,2BAA4B,SAAQ,+BAA+B;IAClF,aAAa,EAAE,aAAa,CAAC;IAE7B,QAAQ,EAAE,MAAM,CAAC;IACjB,GAAG,EAAE,MAAM,CAAC;CACb;AAED,MAAM,WAAW,iBAAkB,SAAQ,+BAA+B;IACxE,WAAW,CAAC,EAAE,iBAAiB,CAAC;IAChC,IAAI,EAAE,IAAI,CAAC;IACX,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE;QACb,OAAO,EAAE,CAAC,MAAM,EAAE;YAAE,GAAG,EAAE,MAAM,CAAC;YAAC,aAAa,EAAE,MAAM,CAAA;SAAE,KAAK,IAAI,CAAC;QAClE,MAAM,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;KAChC,CAAC;CACH;AAED,MAAM,WAAW,2BAA4B,SAAQ,aAAa;IAChE,OAAO,EACH,iBAAiB,CAAC,OAAO,CAAC,GAC1B,2BAA2B,GAC3B,+BAA+B,CAAC;CACrC;AAED,MAAM,WAAW,yBAAyB;IACxC,aAAa,EAAE,MAAM,CAAC;IACtB,kBAAkB,CAAC,EAAE;QACnB,YAAY,CAAC,EAAE,MAAM,CAAC;QACtB,KAAK,CAAC,EAAE,MAAM,CAAC;KAChB,CAAA;IAED,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE;QACT,cAAc,CAAC,EAAE,CAAC,WAAW,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;QAC5D,UAAU,CAAC,EAAE,CAAC,OAAO,EAAE,iBAAiB,CAAC,OAAO,CAAC,KAAK,IAAI,CAAC;QAC3D,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;QAClC,cAAc,CAAC,EAAE,CAAC,aAAa,EAAE,MAAM,KAAK,IAAI,CAAC;QACjD,eAAe,CAAC,EAAE,MAAM,IAAI,CAAC;QAC7B,aAAa,CAAC,EAAE,MAAM,IAAI,CAAC;KAC5B,CAAC;CACH"}
|
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connect-button.d.ts","sourceRoot":"","sources":["../../../src/components/connect-button.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"connect-button.d.ts","sourceRoot":"","sources":["../../../src/components/connect-button.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,eAAO,MAAM,qBAAqB,UAAW;IAC3C,UAAU,EAAE,MAAM,IAAI,CAAC;IACvB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B,4CAiGA,CAAC"}
|
|
@@ -1,58 +1,62 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { WelshareLogo } from "./welshare-logo.js";
|
|
2
3
|
export const ConnectWelshareButton = (props) => {
|
|
3
4
|
// Self-contained styles that won't conflict with external applications
|
|
4
5
|
const buttonStyles = {
|
|
5
6
|
// Reset any inherited styles
|
|
6
|
-
all:
|
|
7
|
-
boxSizing:
|
|
7
|
+
all: "unset",
|
|
8
|
+
boxSizing: "border-box",
|
|
8
9
|
// Layout
|
|
9
|
-
display:
|
|
10
|
-
alignItems:
|
|
11
|
-
justifyContent:
|
|
12
|
-
width:
|
|
13
|
-
minHeight:
|
|
14
|
-
padding:
|
|
10
|
+
display: "inline-flex",
|
|
11
|
+
alignItems: "center",
|
|
12
|
+
justifyContent: "center",
|
|
13
|
+
width: "100%",
|
|
14
|
+
minHeight: "44px",
|
|
15
|
+
padding: "12px 24px",
|
|
15
16
|
// Typography
|
|
16
17
|
fontFamily: '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif',
|
|
17
|
-
fontSize:
|
|
18
|
-
fontWeight:
|
|
19
|
-
lineHeight:
|
|
20
|
-
textAlign:
|
|
21
|
-
textDecoration:
|
|
22
|
-
whiteSpace:
|
|
18
|
+
fontSize: "16px",
|
|
19
|
+
fontWeight: "600",
|
|
20
|
+
lineHeight: "1.5",
|
|
21
|
+
textAlign: "center",
|
|
22
|
+
textDecoration: "none",
|
|
23
|
+
whiteSpace: "nowrap",
|
|
23
24
|
// Visual styling
|
|
24
|
-
backgroundColor:
|
|
25
|
-
background:
|
|
26
|
-
color:
|
|
27
|
-
border:
|
|
28
|
-
borderRadius:
|
|
29
|
-
cursor:
|
|
30
|
-
transition:
|
|
25
|
+
backgroundColor: "#0198ff",
|
|
26
|
+
background: "linear-gradient(135deg, #0198ff 0%, #16ffef 100%)",
|
|
27
|
+
color: "#ffffff",
|
|
28
|
+
border: "none",
|
|
29
|
+
borderRadius: "8px",
|
|
30
|
+
cursor: "pointer",
|
|
31
|
+
transition: "all 0.2s ease-in-out",
|
|
31
32
|
// Accessibility
|
|
32
|
-
userSelect:
|
|
33
|
-
WebkitUserSelect:
|
|
34
|
-
MozUserSelect:
|
|
33
|
+
userSelect: "none",
|
|
34
|
+
WebkitUserSelect: "none",
|
|
35
|
+
MozUserSelect: "none",
|
|
35
36
|
// Focus states
|
|
36
|
-
outline:
|
|
37
|
+
outline: "none",
|
|
37
38
|
};
|
|
38
39
|
// Handle hover and focus states since inline styles don't support pseudo-selectors
|
|
39
40
|
const handleMouseEnter = (e) => {
|
|
40
|
-
e.currentTarget.style.transform =
|
|
41
|
-
e.currentTarget.style.boxShadow =
|
|
41
|
+
e.currentTarget.style.transform = "translateY(-1px)";
|
|
42
|
+
e.currentTarget.style.boxShadow = "0 4px 12px rgba(1, 152, 255, 0.3)";
|
|
42
43
|
};
|
|
43
44
|
const handleMouseLeave = (e) => {
|
|
44
|
-
e.currentTarget.style.transform =
|
|
45
|
-
e.currentTarget.style.boxShadow =
|
|
45
|
+
e.currentTarget.style.transform = "translateY(0)";
|
|
46
|
+
e.currentTarget.style.boxShadow = "0 2px 6px rgba(1, 152, 255, 0.2)";
|
|
46
47
|
};
|
|
47
48
|
const handleMouseDown = (e) => {
|
|
48
|
-
e.currentTarget.style.transform =
|
|
49
|
-
e.currentTarget.style.boxShadow =
|
|
49
|
+
e.currentTarget.style.transform = "translateY(0)";
|
|
50
|
+
e.currentTarget.style.boxShadow = "0 2px 6px rgba(1, 152, 255, 0.2)";
|
|
50
51
|
};
|
|
51
52
|
const handleFocus = (e) => {
|
|
52
|
-
e.currentTarget.style.boxShadow =
|
|
53
|
+
e.currentTarget.style.boxShadow = "0 0 0 3px rgba(1, 152, 255, 0.3)";
|
|
53
54
|
};
|
|
54
55
|
const handleBlur = (e) => {
|
|
55
|
-
e.currentTarget.style.boxShadow =
|
|
56
|
+
e.currentTarget.style.boxShadow = "0 2px 6px rgba(1, 152, 255, 0.2)";
|
|
56
57
|
};
|
|
57
|
-
return (_jsx("button", { onClick: props.openWallet, style: buttonStyles, onMouseEnter: handleMouseEnter, onMouseLeave: handleMouseLeave, onMouseDown: handleMouseDown, onFocus: handleFocus, onBlur: handleBlur, type: "button", children: props.children || "
|
|
58
|
+
return (_jsx("button", { onClick: props.openWallet, style: buttonStyles, onMouseEnter: handleMouseEnter, onMouseLeave: handleMouseLeave, onMouseDown: handleMouseDown, onFocus: handleFocus, onBlur: handleBlur, type: "button", children: _jsx(_Fragment, { children: props.children || (_jsxs(_Fragment, { children: [_jsx("span", { className: "", children: _jsx(WelshareLogo, { width: 24, height: 18, style: {
|
|
59
|
+
"marginRight": "4px",
|
|
60
|
+
color: "#ffffff",
|
|
61
|
+
} }) }), _jsx("span", { children: "Connect Welshare Profile" })] })) }) }));
|
|
58
62
|
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface WelshareLogoProps {
|
|
3
|
+
className?: string;
|
|
4
|
+
style?: React.CSSProperties;
|
|
5
|
+
width?: number | string;
|
|
6
|
+
height?: number | string;
|
|
7
|
+
}
|
|
8
|
+
export declare const WelshareLogo: React.FC<WelshareLogoProps>;
|
|
9
|
+
//# sourceMappingURL=welshare-logo.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"welshare-logo.d.ts","sourceRoot":"","sources":["../../../src/components/welshare-logo.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,MAAM,WAAW,iBAAiB;IAChC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IAC5B,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACxB,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CAC1B;AAED,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,iBAAiB,CA8CpD,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
export const WelshareLogo = ({ className, style, width = 24, height = 16, ...props }) => {
|
|
3
|
+
return (_jsx("svg", { className: className, style: style, width: width, height: height, viewBox: "0 0 636.19 428.76", xmlns: "http://www.w3.org/2000/svg", ...props, children: _jsxs("g", { children: [_jsx("path", { fill: "currentColor", strokeWidth: "0", d: "m589.26,220.57l-32.72,56.69-11.4,19.77-65.87-91.19c11.14,3.87,23.84,3.29,34.36-2.65.31-.18.62-.36.93-.55,13.09-7.43,20.77-21.35,21.19-35.75l53.51,53.67Z" }), _jsx("path", { fill: "currentColor", strokeWidth: "0", d: "m125.97,72.79c-.45-.2-.91-.38-1.37-.55h-.08c-3.63-1.46-7.5-2.26-11.35-2.58-5.51-.46-10.74.21-15.53,1.77-14.41,4.7-24.91,17.47-27.62,31.93L28.16,37.52c4.04-4.64,8.47-8.96,13.2-12.9,6.52-5.4,13.63-10.05,21.25-13.79,3.53-1.72,7.16-3.27,10.91-4.58,5.12-1.82,10.44-3.25,15.92-4.26l36.53,70.8Z" }), _jsx("path", { fill: "currentColor", strokeWidth: "0", d: "m621.17,165.31l-64.62,111.95-42.91-74.07c.31-.18.62-.36.93-.55,19.99-11.33,27.38-37.86,15.55-58.02-10.99-19.02-28.48-49.36-44.46-77.03C468.75,38.32,488.86.96,522.66.04c77.49-2.1,144.44,82.96,98.5,165.27Z" }), _jsx("path", { fill: "currentColor", strokeWidth: "0", d: "m513.64,203.19c-18.27,10.32-43.13,4.47-54.96-12.8l-.07-.1c-1.68-2.3-11.65-19.85-13.06-22.27l.08-.13-1.01-1.75-.08.14-39-67.52-5.2-9.03-22.91-39.68C357.2,19.22,322.48.31,285.37.31c-.81-.03-1.63-.03-2.44-.03-12.07.06-23.51,2.17-34.13,5.96-11.85,4.22-22.67,10.5-32.14,18.36-7.01,5.8-13.22,12.53-18.66,19.84C177.39,17.04,144.88.29,110.09.29h-2.41c-4.57.03-9.06.35-13.44.94-7.19.97-14.12,2.66-20.72,5.02-3.74,1.32-7.37,2.86-10.91,4.58l35.02,60.6c4.79-1.56,10.02-2.23,15.53-1.77,3.85.32,7.72,1.12,11.35,2.58h.08c8.69,3.22,16.19,9.59,20.79,17.72h.06v.03s1.79,3.11,1.79,3.11l2.12,3.66.42.73,1.89,3.27.57,1.01,5.87,10.13.56.94.56,1.02,6.66,11.52.34.57,4.37,7.58,1.09,1.89,2.44,4.23,3.95,6.85,2.75,4.75.88,1.53,1.61,2.82,2.44,4.23.86,1.47,1.46,2.52.79,1.36,1.26,2.2,1.6,2.78,2.92,5.06,1.54,2.65,2.13,3.67.46.78,1.67,2.89.06.1,3.14,5.45,1.47,2.55,5.78,9.99,4.89,8.48.9,1.56,1.56,2.69.18.31,1.01,1.75.1.17,2.3,3.98,1.65,2.85,3.28,5.68,2.65,4.58c1.74,3,3.46,5.99,5.12,8.9l1.11,1.91c1,1.68,2,3.38,2.96,5.07.64,1.12,1.29,2.26,1.92,3.38l.95,1.67,1.35,2.31c.31.49.59,1,.87,1.5l1.26,2.17c1.26,2.17,2.52,4.33,3.73,6.45.71,1.23,1.44,2.47,2.12,3.7l1.71,2.97,5.8,10.04.06.1c.18.31.36.62.55.91.31.53.6,1.07.9,1.58l3.49,6.06c.85,1.44,1.67,2.85,2.45,4.21l.49.88.08.17,50.41,87.32c.45-.55.88-1.11,1.3-1.67,14.73,19.44,35.96,33.78,59.56,40.01,9.08,2.51,18.39,3.71,27.64,3.71.8,0,1.6-.01,2.4-.03,13.6-.29,27.04-3.18,39.6-8.33,0,0,.01-.01.04-.01,10.19-4.19,19.81-9.9,28.37-16.91,9.56-7.81,17.84-17.26,24.22-28.11.35-.56.69-1.11,1-1.67l1.68-2.89,30.28-52.44,23.72-41.1-42.91-74.07Zm-103.26,155.98c-3.31.36-6.66.36-9.97-.06-11.17-1.26-21.92-8.03-28.33-17.2-1.22-1.72-2.27-3.55-3.14-5.41-.01-.03-.01-.06-.04-.07l-1.14-1.98-3.55-6.11v-.04c-.86-1.44-1.71-2.96-2.62-4.51-2.27-3.9-4.71-8.12-7.3-12.64-.52-.9-1.05-1.79-1.58-2.73-.85-1.49-1.74-3.03-2.64-4.57-.91-1.56-1.82-3.14-2.75-4.75-2.79-4.79-5.68-9.81-8.68-15.01-2.99-5.19-6.08-10.54-9.24-16.02-2.59-4.5-5.23-9.07-7.91-13.68-15.99-27.73-33.04-57.28-47.66-82.59l-3.6-6.25c-2.34-4.02-4.6-7.96-6.77-11.72-3.95-6.83-7.61-13.15-10.86-18.8-.87-1.49-1.7-2.92-2.51-4.32-.29-.5-.59-1.02-.87-1.53-14.7-27.38,7.42-62.18,39.15-59.46,3.9.28,7.74,1.11,11.4,2.51.01.01.04.01.06.01,8.72,3.28,16.22,9.62,20.84,17.72l.04.04c.03.1.11.24.25.46.17.32.48.78.81,1.42l.73,1.25c.78,1.35,1.78,3.1,2.97,5.16l1.44,2.5c1.51,2.64,3.24,5.61,5.09,8.83l1.91,3.29,1.98,3.42,2.03,3.52c.34.59.69,1.19,1.04,1.81l1.93,3.34c.08.17.2.34.28.46l1.98,3.45c2.1,3.66,4.22,7.3,6.25,10.82l2,3.49,1.93,3.35c.95,1.65,1.88,3.24,2.76,4.77.29.5.56,1.01.85,1.5l1.65,2.85,1.5,2.62c3.38,5.83,5.52,9.56,5.52,9.56,2.38,4.12,5.05,8.72,7.93,13.71,1.44,2.48,2.93,5.07,4.47,7.74.38.66.77,1.33,1.15,2,1.57,2.71,3.18,5.48,4.81,8.31,2.87,4.96,5.83,10.11,8.85,15.34.87,1.49,1.74,2.99,2.59,4.5,2.19,3.77,4.39,7.58,6.59,11.4.88,1.51,1.77,3.04,2.64,4.57,1.75,3.04,3.53,6.1,5.26,9.13,1.32,2.27,2.62,4.51,3.91,6.77,1.3,2.23,2.58,4.44,3.85,6.64.42.74.84,1.47,1.26,2.2,1.67,2.92,3.34,5.76,4.95,8.56.81,1.42,1.61,2.79,2.4,4.15,1.96,3.42,3.87,6.73,5.71,9.91.73,1.26,1.46,2.51,2.14,3.71,2.47,4.26,4.75,8.24,6.83,11.83l.53.91c13.85,24.74-2.73,56.98-31.13,59.94Z" }), _jsx("path", { fill: "currentColor", strokeWidth: "0", d: "m316.73,386.68c-4.84,6.2-10.32,11.83-16.33,16.78-8.62,7.01-18.21,12.73-28.36,16.92h-.08c-12.57,5.16-26.02,8.06-39.56,8.3-.81.08-1.61.08-2.41.08-9.27,0-18.62-1.22-27.64-3.71-26.34-7.01-49.79-23.93-64.45-46.97-1.53-2.17-3.14-5.23-4.51-7.57L14.87,165.3c-21.43-35.61-18.29-77.27.48-109.82,6.77-11.76,15.63-22.23,26.02-30.85,6.52-5.4,13.63-10.05,21.25-13.79l35.02,60.6c-22.81,7.43-35.82,35.11-23.63,57.68.24.57.56,1.05.81,1.54.8,1.44,1.68,2.89,2.5,4.35,3.31,5.64,6.92,12,10.88,18.77,2.17,3.78,4.43,7.74,6.77,11.76l3.62,6.21c14.66,25.37,31.67,54.87,47.7,82.58,2.65,4.67,5.23,9.27,7.89,13.7,3.14,5.48,6.21,10.88,9.18,16.04,3.07,5.24,5.97,10.23,8.71,15.07.97,1.61,1.85,3.14,2.73,4.67.9,1.61,1.78,3.14,2.66,4.6.49.97,1.05,1.85,1.61,2.73,2.58,4.51,4.99,8.79,7.25,12.64.9,1.54,1.78,3.07,2.66,4.51v.08l3.55,6.04,1.12,2.02v.08c.9,1.85,1.93,3.7,3.15,5.4,6.43,9.18,17.16,15.95,28.36,17.24,3.29.39,6.69.39,9.98,0,28.29-2.99,44.9-35.07,31.19-59.79l50.41,87.32Z" })] }) }));
|
|
4
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-welshare.d.ts","sourceRoot":"","sources":["../../../src/hooks/use-welshare.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,iBAAiB,EACjB,kBAAkB,EAElB,yBAAyB,EAC1B,MAAM,YAAY,CAAC;AAIpB,eAAO,MAAM,WAAW,UAAW,yBAAyB;;;;;
|
|
1
|
+
{"version":3,"file":"use-welshare.d.ts","sourceRoot":"","sources":["../../../src/hooks/use-welshare.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,iBAAiB,EACjB,kBAAkB,EAElB,yBAAyB,EAC1B,MAAM,YAAY,CAAC;AAIpB,eAAO,MAAM,WAAW,UAAW,yBAAyB;;;;;uBAmLlD,IAAI,aACC,MAAM,KAChB,OAAO,CAAC;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,aAAa,EAAE,MAAM,CAAA;KAAE,CAAC;iBA0C9B,CAAC,YACT,kBAAkB,cAChB,iBAAiB,CAAC,CAAC,CAAC;;;CAqEnC,CAAC"}
|
|
@@ -10,7 +10,6 @@ export const useWelshare = (props) => {
|
|
|
10
10
|
// (claude opus) Use ref to control current upload in effect without triggering re-renders
|
|
11
11
|
const currentUploadRef = useRef(null);
|
|
12
12
|
const options = {
|
|
13
|
-
environment: "development",
|
|
14
13
|
apiBaseUrl: "https://wallet.welshare.app",
|
|
15
14
|
...props,
|
|
16
15
|
};
|
|
@@ -199,10 +198,20 @@ export const useWelshare = (props) => {
|
|
|
199
198
|
};
|
|
200
199
|
const openWallet = () => {
|
|
201
200
|
const width = 800;
|
|
202
|
-
const height =
|
|
201
|
+
const height = 700;
|
|
203
202
|
const left = window.screenX + (window.outerWidth - width) / 2;
|
|
204
203
|
const top = window.screenY + (window.outerHeight - height) / 2;
|
|
205
|
-
|
|
204
|
+
let socialParams = "";
|
|
205
|
+
if (options.interpolateSocials) {
|
|
206
|
+
const socialEntries = Object.entries(options.interpolateSocials)
|
|
207
|
+
.filter(([_, value]) => value !== undefined && value !== null)
|
|
208
|
+
.map(([key, value]) => `social.${key}=${encodeURIComponent(String(value))}`);
|
|
209
|
+
if (socialEntries.length > 0) {
|
|
210
|
+
socialParams = `&${socialEntries.join('&')}`;
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
const walletUrl = `${WELSHARE_WALLET_URL}?applicationId=${options.applicationId}${socialParams}`;
|
|
214
|
+
const newWindow = window.open(walletUrl, "Welshare Wallet", `width=${width},height=${height},left=${left},top=${top}`);
|
|
206
215
|
if (newWindow) {
|
|
207
216
|
setDialogWindow(newWindow);
|
|
208
217
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { ConnectWelshareButton } from "./components/connect-button.js";
|
|
2
|
+
export { WelshareLogo } from "./components/welshare-logo.js";
|
|
2
3
|
export { useWelshare } from "./hooks/use-welshare.js";
|
|
3
4
|
export { decodeEncryptionKey, decrypt, encodeEncryptionKey, encryptFile, generateRandomAESKey, type EncryptionKey } from "./lib/encryption.js";
|
|
4
5
|
export { encryptAndUploadFile } from "./lib/uploads.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;AACvE,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAE7D,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAEtD,OAAO,EACL,mBAAmB,EACnB,OAAO,EACP,mBAAmB,EACnB,WAAW,EACX,oBAAoB,EACpB,KAAK,aAAa,EACnB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAExD,eAAO,MAAM,OAAO;;;;CAInB,CAAC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
//todo: this is not tree shaken and leaks nillion dependencies transitively. Consider pulling it up
|
|
2
2
|
//import { QuestionnaireResponseSchema, ReflexSubmissionSchema } from "@welshare/sdk";
|
|
3
3
|
export { ConnectWelshareButton } from "./components/connect-button.js";
|
|
4
|
+
export { WelshareLogo } from "./components/welshare-logo.js";
|
|
4
5
|
// ---- hooks ----
|
|
5
6
|
export { useWelshare } from "./hooks/use-welshare.js";
|
|
6
7
|
export { decodeEncryptionKey, decrypt, encodeEncryptionKey, encryptFile, generateRandomAESKey } from "./lib/encryption.js";
|
|
@@ -4,7 +4,6 @@ export interface DialogMessage {
|
|
|
4
4
|
payload?: any;
|
|
5
5
|
id?: string;
|
|
6
6
|
}
|
|
7
|
-
export type WelshareEnvironment = "development" | "production";
|
|
8
7
|
/**
|
|
9
8
|
* a welshare schema type uid
|
|
10
9
|
*/
|
|
@@ -48,8 +47,11 @@ export interface DataSubmissionDialogMessage extends DialogMessage {
|
|
|
48
47
|
}
|
|
49
48
|
export interface WelshareConnectionOptions {
|
|
50
49
|
applicationId: string;
|
|
50
|
+
interpolateSocials?: {
|
|
51
|
+
emailAddress?: string;
|
|
52
|
+
privy?: string;
|
|
53
|
+
};
|
|
51
54
|
apiBaseUrl?: string;
|
|
52
|
-
environment?: WelshareEnvironment;
|
|
53
55
|
callbacks: {
|
|
54
56
|
onFileUploaded?: (insertedUid: string, url: string) => void;
|
|
55
57
|
onUploaded?: (payload: SubmissionPayload<unknown>) => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,GAAG,CAAC;IACd,EAAE,CAAC,EAAE,MAAM,CAAC;CACb;AAED
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,GAAG,CAAC;IACd,EAAE,CAAC,EAAE,MAAM,CAAC;CACb;AAED;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAAG,MAAM,CAAA;AAEvC,MAAM,WAAW,iBAAiB,CAAC,CAAC;IAClC,aAAa,EAAE,MAAM,CAAC;IACtB,SAAS,EAAE,IAAI,CAAC;IAChB,QAAQ,EAAE,kBAAkB,CAAC;IAC7B,UAAU,EAAE,CAAC,CAAC;CACf;AAED,MAAM,MAAM,iBAAiB,GAAG;IAC9B,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;CACnB,CAAA;AAED,MAAM,WAAW,+BAA+B;IAC9C,SAAS,CAAC,EAAE,IAAI,CAAC;IACjB,aAAa,EAAE,MAAM,CAAC;IACtB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,2BAA4B,SAAQ,+BAA+B;IAClF,aAAa,EAAE,aAAa,CAAC;IAE7B,QAAQ,EAAE,MAAM,CAAC;IACjB,GAAG,EAAE,MAAM,CAAC;CACb;AAED,MAAM,WAAW,iBAAkB,SAAQ,+BAA+B;IACxE,WAAW,CAAC,EAAE,iBAAiB,CAAC;IAChC,IAAI,EAAE,IAAI,CAAC;IACX,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE;QACb,OAAO,EAAE,CAAC,MAAM,EAAE;YAAE,GAAG,EAAE,MAAM,CAAC;YAAC,aAAa,EAAE,MAAM,CAAA;SAAE,KAAK,IAAI,CAAC;QAClE,MAAM,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;KAChC,CAAC;CACH;AAED,MAAM,WAAW,2BAA4B,SAAQ,aAAa;IAChE,OAAO,EACH,iBAAiB,CAAC,OAAO,CAAC,GAC1B,2BAA2B,GAC3B,+BAA+B,CAAC;CACrC;AAED,MAAM,WAAW,yBAAyB;IACxC,aAAa,EAAE,MAAM,CAAC;IACtB,kBAAkB,CAAC,EAAE;QACnB,YAAY,CAAC,EAAE,MAAM,CAAC;QACtB,KAAK,CAAC,EAAE,MAAM,CAAC;KAChB,CAAA;IAED,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE;QACT,cAAc,CAAC,EAAE,CAAC,WAAW,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;QAC5D,UAAU,CAAC,EAAE,CAAC,OAAO,EAAE,iBAAiB,CAAC,OAAO,CAAC,KAAK,IAAI,CAAC;QAC3D,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;QAClC,cAAc,CAAC,EAAE,CAAC,aAAa,EAAE,MAAM,KAAK,IAAI,CAAC;QACjD,eAAe,CAAC,EAAE,MAAM,IAAI,CAAC;QAC7B,aAAa,CAAC,EAAE,MAAM,IAAI,CAAC;KAC5B,CAAC;CACH"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@welshare/react",
|
|
3
|
-
"version": "0.1
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"description": "React library for integrating with Welshare's sovereign data sharing platform",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"homepage": "https://welshare.health",
|
|
24
24
|
"type": "module",
|
|
25
25
|
"scripts": {
|
|
26
|
-
"lint": "eslint . --max-warnings
|
|
26
|
+
"lint": "eslint . --max-warnings 25",
|
|
27
27
|
"build": "tshy",
|
|
28
28
|
"build:clean": "rm -rf ./dist",
|
|
29
29
|
"test": "vitest",
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<svg id="Layer_2" data-name="Layer 2" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 636.19 428.76">
|
|
3
|
+
<defs>
|
|
4
|
+
<style>
|
|
5
|
+
.cls-1 {
|
|
6
|
+
fill: #000000;
|
|
7
|
+
stroke-width: 0px;
|
|
8
|
+
}
|
|
9
|
+
</style>
|
|
10
|
+
</defs>
|
|
11
|
+
<g id="welshare-logo" data-name="welshare-logo">
|
|
12
|
+
<g>
|
|
13
|
+
<path class="cls-1" d="m589.26,220.57l-32.72,56.69-11.4,19.77-65.87-91.19c11.14,3.87,23.84,3.29,34.36-2.65.31-.18.62-.36.93-.55,13.09-7.43,20.77-21.35,21.19-35.75l53.51,53.67Z"/>
|
|
14
|
+
<path class="cls-1" d="m125.97,72.79c-.45-.2-.91-.38-1.37-.55h-.08c-3.63-1.46-7.5-2.26-11.35-2.58-5.51-.46-10.74.21-15.53,1.77-14.41,4.7-24.91,17.47-27.62,31.93L28.16,37.52c4.04-4.64,8.47-8.96,13.2-12.9,6.52-5.4,13.63-10.05,21.25-13.79,3.53-1.72,7.16-3.27,10.91-4.58,5.12-1.82,10.44-3.25,15.92-4.26l36.53,70.8Z"/>
|
|
15
|
+
<path class="cls-1" d="m621.17,165.31l-64.62,111.95-42.91-74.07c.31-.18.62-.36.93-.55,19.99-11.33,27.38-37.86,15.55-58.02-10.99-19.02-28.48-49.36-44.46-77.03C468.75,38.32,488.86.96,522.66.04c77.49-2.1,144.44,82.96,98.5,165.27Z"/>
|
|
16
|
+
<path class="cls-1" d="m513.64,203.19c-18.27,10.32-43.13,4.47-54.96-12.8l-.07-.1c-1.68-2.3-11.65-19.85-13.06-22.27l.08-.13-1.01-1.75-.08.14-39-67.52-5.2-9.03-22.91-39.68C357.2,19.22,322.48.31,285.37.31c-.81-.03-1.63-.03-2.44-.03-12.07.06-23.51,2.17-34.13,5.96-11.85,4.22-22.67,10.5-32.14,18.36-7.01,5.8-13.22,12.53-18.66,19.84C177.39,17.04,144.88.29,110.09.29h-2.41c-4.57.03-9.06.35-13.44.94-7.19.97-14.12,2.66-20.72,5.02-3.74,1.32-7.37,2.86-10.91,4.58l35.02,60.6c4.79-1.56,10.02-2.23,15.53-1.77,3.85.32,7.72,1.12,11.35,2.58h.08c8.69,3.22,16.19,9.59,20.79,17.72h.06v.03s1.79,3.11,1.79,3.11l2.12,3.66.42.73,1.89,3.27.57,1.01,5.87,10.13.56.94.56,1.02,6.66,11.52.34.57,4.37,7.58,1.09,1.89,2.44,4.23,3.95,6.85,2.75,4.75.88,1.53,1.61,2.82,2.44,4.23.86,1.47,1.46,2.52.79,1.36,1.26,2.2,1.6,2.78,2.92,5.06,1.54,2.65,2.13,3.67.46.78,1.67,2.89.06.1,3.14,5.45,1.47,2.55,5.78,9.99,4.89,8.48.9,1.56,1.56,2.69.18.31,1.01,1.75.1.17,2.3,3.98,1.65,2.85,3.28,5.68,2.65,4.58c1.74,3,3.46,5.99,5.12,8.9l1.11,1.91c1,1.68,2,3.38,2.96,5.07.64,1.12,1.29,2.26,1.92,3.38l.95,1.67,1.35,2.31c.31.49.59,1,.87,1.5l1.26,2.17c1.26,2.17,2.52,4.33,3.73,6.45.71,1.23,1.44,2.47,2.12,3.7l1.71,2.97,5.8,10.04.06.1c.18.31.36.62.55.91.31.53.6,1.07.9,1.58l3.49,6.06c.85,1.44,1.67,2.85,2.45,4.21l.49.88.08.17,50.41,87.32c.45-.55.88-1.11,1.3-1.67,14.73,19.44,35.96,33.78,59.56,40.01,9.08,2.51,18.39,3.71,27.64,3.71.8,0,1.6-.01,2.4-.03,13.6-.29,27.04-3.18,39.6-8.33,0,0,.01-.01.04-.01,10.19-4.19,19.81-9.9,28.37-16.91,9.56-7.81,17.84-17.26,24.22-28.11.35-.56.69-1.11,1-1.67l1.68-2.89,30.28-52.44,23.72-41.1-42.91-74.07Zm-103.26,155.98c-3.31.36-6.66.36-9.97-.06-11.17-1.26-21.92-8.03-28.33-17.2-1.22-1.72-2.27-3.55-3.14-5.41-.01-.03-.01-.06-.04-.07l-1.14-1.98-3.55-6.11v-.04c-.86-1.44-1.71-2.96-2.62-4.51-2.27-3.9-4.71-8.12-7.3-12.64-.52-.9-1.05-1.79-1.58-2.73-.85-1.49-1.74-3.03-2.64-4.57-.91-1.56-1.82-3.14-2.75-4.75-2.79-4.79-5.68-9.81-8.68-15.01-2.99-5.19-6.08-10.54-9.24-16.02-2.59-4.5-5.23-9.07-7.91-13.68-15.99-27.73-33.04-57.28-47.66-82.59l-3.6-6.25c-2.34-4.02-4.6-7.96-6.77-11.72-3.95-6.83-7.61-13.15-10.86-18.8-.87-1.49-1.7-2.92-2.51-4.32-.29-.5-.59-1.02-.87-1.53-14.7-27.38,7.42-62.18,39.15-59.46,3.9.28,7.74,1.11,11.4,2.51.01.01.04.01.06.01,8.72,3.28,16.22,9.62,20.84,17.72l.04.04c.03.1.11.24.25.46.17.32.48.78.81,1.42l.73,1.25c.78,1.35,1.78,3.1,2.97,5.16l1.44,2.5c1.51,2.64,3.24,5.61,5.09,8.83l1.91,3.29,1.98,3.42,2.03,3.52c.34.59.69,1.19,1.04,1.81l1.93,3.34c.08.17.2.34.28.46l1.98,3.45c2.1,3.66,4.22,7.3,6.25,10.82l2,3.49,1.93,3.35c.95,1.65,1.88,3.24,2.76,4.77.29.5.56,1.01.85,1.5l1.65,2.85,1.5,2.62c3.38,5.83,5.52,9.56,5.52,9.56,2.38,4.12,5.05,8.72,7.93,13.71,1.44,2.48,2.93,5.07,4.47,7.74.38.66.77,1.33,1.15,2,1.57,2.71,3.18,5.48,4.81,8.31,2.87,4.96,5.83,10.11,8.85,15.34.87,1.49,1.74,2.99,2.59,4.5,2.19,3.77,4.39,7.58,6.59,11.4.88,1.51,1.77,3.04,2.64,4.57,1.75,3.04,3.53,6.1,5.26,9.13,1.32,2.27,2.62,4.51,3.91,6.77,1.3,2.23,2.58,4.44,3.85,6.64.42.74.84,1.47,1.26,2.2,1.67,2.92,3.34,5.76,4.95,8.56.81,1.42,1.61,2.79,2.4,4.15,1.96,3.42,3.87,6.73,5.71,9.91.73,1.26,1.46,2.51,2.14,3.71,2.47,4.26,4.75,8.24,6.83,11.83l.53.91c13.85,24.74-2.73,56.98-31.13,59.94Z"/>
|
|
17
|
+
<path class="cls-1" d="m316.73,386.68c-4.84,6.2-10.32,11.83-16.33,16.78-8.62,7.01-18.21,12.73-28.36,16.92h-.08c-12.57,5.16-26.02,8.06-39.56,8.3-.81.08-1.61.08-2.41.08-9.27,0-18.62-1.22-27.64-3.71-26.34-7.01-49.79-23.93-64.45-46.97-1.53-2.17-3.14-5.23-4.51-7.57L14.87,165.3c-21.43-35.61-18.29-77.27.48-109.82,6.77-11.76,15.63-22.23,26.02-30.85,6.52-5.4,13.63-10.05,21.25-13.79l35.02,60.6c-22.81,7.43-35.82,35.11-23.63,57.68.24.57.56,1.05.81,1.54.8,1.44,1.68,2.89,2.5,4.35,3.31,5.64,6.92,12,10.88,18.77,2.17,3.78,4.43,7.74,6.77,11.76l3.62,6.21c14.66,25.37,31.67,54.87,47.7,82.58,2.65,4.67,5.23,9.27,7.89,13.7,3.14,5.48,6.21,10.88,9.18,16.04,3.07,5.24,5.97,10.23,8.71,15.07.97,1.61,1.85,3.14,2.73,4.67.9,1.61,1.78,3.14,2.66,4.6.49.97,1.05,1.85,1.61,2.73,2.58,4.51,4.99,8.79,7.25,12.64.9,1.54,1.78,3.07,2.66,4.51v.08l3.55,6.04,1.12,2.02v.08c.9,1.85,1.93,3.7,3.15,5.4,6.43,9.18,17.16,15.95,28.36,17.24,3.29.39,6.69.39,9.98,0,28.29-2.99,44.9-35.07,31.19-59.79l50.41,87.32Z"/>
|
|
18
|
+
</g>
|
|
19
|
+
</g>
|
|
20
|
+
</svg>
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<svg id="Layer_2" data-name="Layer 2" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 636.19 428.76">
|
|
3
|
+
<defs>
|
|
4
|
+
<style>
|
|
5
|
+
.cls-1 {
|
|
6
|
+
fill: url(#_Безымянный_градиент_12);
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.cls-1, .cls-2, .cls-3, .cls-4, .cls-5 {
|
|
10
|
+
stroke-width: 0px;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.cls-2 {
|
|
14
|
+
fill: #2c81fb;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.cls-3 {
|
|
18
|
+
fill: #2de1fd;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.cls-4 {
|
|
22
|
+
fill: url(#_Безымянный_градиент_5);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.cls-5 {
|
|
26
|
+
fill: url(#_Безымянный_градиент_11);
|
|
27
|
+
}
|
|
28
|
+
</style>
|
|
29
|
+
<linearGradient id="_Безымянный_градиент_11" data-name="Безымянный градиент 11" x1="474.52" y1="195.23" x2="620.09" y2="49.65" gradientUnits="userSpaceOnUse">
|
|
30
|
+
<stop offset=".2" stop-color="#2c82f9"/>
|
|
31
|
+
<stop offset="1" stop-color="#24f8dc"/>
|
|
32
|
+
</linearGradient>
|
|
33
|
+
<linearGradient id="_Безымянный_градиент_12" data-name="Безымянный градиент 12" x1="62.61" y1="214.51" x2="556.55" y2="214.51" gradientUnits="userSpaceOnUse">
|
|
34
|
+
<stop offset=".14" stop-color="#2de1fd"/>
|
|
35
|
+
<stop offset=".89" stop-color="#2c81fb"/>
|
|
36
|
+
</linearGradient>
|
|
37
|
+
<linearGradient id="_Безымянный_градиент_5" data-name="Безымянный градиент 5" x1="158.36" y1="428.76" x2="158.36" y2="10.83" gradientUnits="userSpaceOnUse">
|
|
38
|
+
<stop offset="0" stop-color="#26f9dd"/>
|
|
39
|
+
<stop offset=".8" stop-color="#2de1fd"/>
|
|
40
|
+
</linearGradient>
|
|
41
|
+
</defs>
|
|
42
|
+
<g id="_Слой_1" data-name="Слой 1">
|
|
43
|
+
<g>
|
|
44
|
+
<path class="cls-2" d="m589.26,220.57l-32.72,56.69-11.4,19.77-65.87-91.19c11.14,3.87,23.84,3.29,34.36-2.65.31-.18.62-.36.93-.55,13.09-7.43,20.77-21.35,21.19-35.75l53.51,53.67Z"/>
|
|
45
|
+
<path class="cls-3" d="m125.97,72.79c-.45-.2-.91-.38-1.37-.55h-.08c-3.63-1.46-7.5-2.26-11.35-2.58-5.51-.46-10.74.21-15.53,1.77-14.41,4.7-24.91,17.47-27.62,31.93L28.16,37.52c4.04-4.64,8.47-8.96,13.2-12.9,6.52-5.4,13.63-10.05,21.25-13.79,3.53-1.72,7.16-3.27,10.91-4.58,5.12-1.82,10.44-3.25,15.92-4.26l36.53,70.8Z"/>
|
|
46
|
+
<path class="cls-5" d="m621.17,165.31l-64.62,111.95-42.91-74.07c.31-.18.62-.36.93-.55,19.99-11.33,27.38-37.86,15.55-58.02-10.99-19.02-28.48-49.36-44.46-77.03C468.75,38.32,488.86.96,522.66.04c77.49-2.1,144.44,82.96,98.5,165.27Z"/>
|
|
47
|
+
<path class="cls-1" d="m513.64,203.19c-18.27,10.32-43.13,4.47-54.96-12.8l-.07-.1c-1.68-2.3-11.65-19.85-13.06-22.27l.08-.13-1.01-1.75-.08.14-39-67.52-5.2-9.03-22.91-39.68C357.2,19.22,322.48.31,285.37.31c-.81-.03-1.63-.03-2.44-.03-12.07.06-23.51,2.17-34.13,5.96-11.85,4.22-22.67,10.5-32.14,18.36-7.01,5.8-13.22,12.53-18.66,19.84C177.39,17.04,144.88.29,110.09.29h-2.41c-4.57.03-9.06.35-13.44.94-7.19.97-14.12,2.66-20.72,5.02-3.74,1.32-7.37,2.86-10.91,4.58l35.02,60.6c4.79-1.56,10.02-2.23,15.53-1.77,3.85.32,7.72,1.12,11.35,2.58h.08c8.69,3.22,16.19,9.59,20.79,17.72h.06v.03s1.79,3.11,1.79,3.11l2.12,3.66.42.73,1.89,3.27.57,1.01,5.87,10.13.56.94.56,1.02,6.66,11.52.34.57,4.37,7.58,1.09,1.89,2.44,4.23,3.95,6.85,2.75,4.75.88,1.53,1.61,2.82,2.44,4.23.86,1.47,1.46,2.52.79,1.36,1.26,2.2,1.6,2.78,2.92,5.06,1.54,2.65,2.13,3.67.46.78,1.67,2.89.06.1,3.14,5.45,1.47,2.55,5.78,9.99,4.89,8.48.9,1.56,1.56,2.69.18.31,1.01,1.75.1.17,2.3,3.98,1.65,2.85,3.28,5.68,2.65,4.58c1.74,3,3.46,5.99,5.12,8.9l1.11,1.91c1,1.68,2,3.38,2.96,5.07.64,1.12,1.29,2.26,1.92,3.38l.95,1.67,1.35,2.31c.31.49.59,1,.87,1.5l1.26,2.17c1.26,2.17,2.52,4.33,3.73,6.45.71,1.23,1.44,2.47,2.12,3.7l1.71,2.97,5.8,10.04.06.1c.18.31.36.62.55.91.31.53.6,1.07.9,1.58l3.49,6.06c.85,1.44,1.67,2.85,2.45,4.21l.49.88.08.17,50.41,87.32c.45-.55.88-1.11,1.3-1.67,14.73,19.44,35.96,33.78,59.56,40.01,9.08,2.51,18.39,3.71,27.64,3.71.8,0,1.6-.01,2.4-.03,13.6-.29,27.04-3.18,39.6-8.33,0,0,.01-.01.04-.01,10.19-4.19,19.81-9.9,28.37-16.91,9.56-7.81,17.84-17.26,24.22-28.11.35-.56.69-1.11,1-1.67l1.68-2.89,30.28-52.44,23.72-41.1-42.91-74.07Zm-103.26,155.98c-3.31.36-6.66.36-9.97-.06-11.17-1.26-21.92-8.03-28.33-17.2-1.22-1.72-2.27-3.55-3.14-5.41-.01-.03-.01-.06-.04-.07l-1.14-1.98-3.55-6.11v-.04c-.86-1.44-1.71-2.96-2.62-4.51-2.27-3.9-4.71-8.12-7.3-12.64-.52-.9-1.05-1.79-1.58-2.73-.85-1.49-1.74-3.03-2.64-4.57-.91-1.56-1.82-3.14-2.75-4.75-2.79-4.79-5.68-9.81-8.68-15.01-2.99-5.19-6.08-10.54-9.24-16.02-2.59-4.5-5.23-9.07-7.91-13.68-15.99-27.73-33.04-57.28-47.66-82.59l-3.6-6.25c-2.34-4.02-4.6-7.96-6.77-11.72-3.95-6.83-7.61-13.15-10.86-18.8-.87-1.49-1.7-2.92-2.51-4.32-.29-.5-.59-1.02-.87-1.53-14.7-27.38,7.42-62.18,39.15-59.46,3.9.28,7.74,1.11,11.4,2.51.01.01.04.01.06.01,8.72,3.28,16.22,9.62,20.84,17.72l.04.04c.03.1.11.24.25.46.17.32.48.78.81,1.42l.73,1.25c.78,1.35,1.78,3.1,2.97,5.16l1.44,2.5c1.51,2.64,3.24,5.61,5.09,8.83l1.91,3.29,1.98,3.42,2.03,3.52c.34.59.69,1.19,1.04,1.81l1.93,3.34c.08.17.2.34.28.46l1.98,3.45c2.1,3.66,4.22,7.3,6.25,10.82l2,3.49,1.93,3.35c.95,1.65,1.88,3.24,2.76,4.77.29.5.56,1.01.85,1.5l1.65,2.85,1.5,2.62c3.38,5.83,5.52,9.56,5.52,9.56,2.38,4.12,5.05,8.72,7.93,13.71,1.44,2.48,2.93,5.07,4.47,7.74.38.66.77,1.33,1.15,2,1.57,2.71,3.18,5.48,4.81,8.31,2.87,4.96,5.83,10.11,8.85,15.34.87,1.49,1.74,2.99,2.59,4.5,2.19,3.77,4.39,7.58,6.59,11.4.88,1.51,1.77,3.04,2.64,4.57,1.75,3.04,3.53,6.1,5.26,9.13,1.32,2.27,2.62,4.51,3.91,6.77,1.3,2.23,2.58,4.44,3.85,6.64.42.74.84,1.47,1.26,2.2,1.67,2.92,3.34,5.76,4.95,8.56.81,1.42,1.61,2.79,2.4,4.15,1.96,3.42,3.87,6.73,5.71,9.91.73,1.26,1.46,2.51,2.14,3.71,2.47,4.26,4.75,8.24,6.83,11.83l.53.91c13.85,24.74-2.73,56.98-31.13,59.94Z"/>
|
|
48
|
+
<path class="cls-4" d="m316.73,386.68c-4.84,6.2-10.32,11.83-16.33,16.78-8.62,7.01-18.21,12.73-28.36,16.92h-.08c-12.57,5.16-26.02,8.06-39.56,8.3-.81.08-1.61.08-2.41.08-9.27,0-18.62-1.22-27.64-3.71-26.34-7.01-49.79-23.93-64.45-46.97-1.53-2.17-3.14-5.23-4.51-7.57L14.87,165.3c-21.43-35.61-18.29-77.27.48-109.82,6.77-11.76,15.63-22.23,26.02-30.85,6.52-5.4,13.63-10.05,21.25-13.79l35.02,60.6c-22.81,7.43-35.82,35.11-23.63,57.68.24.57.56,1.05.81,1.54.8,1.44,1.68,2.89,2.5,4.35,3.31,5.64,6.92,12,10.88,18.77,2.17,3.78,4.43,7.74,6.77,11.76l3.62,6.21c14.66,25.37,31.67,54.87,47.7,82.58,2.65,4.67,5.23,9.27,7.89,13.7,3.14,5.48,6.21,10.88,9.18,16.04,3.07,5.24,5.97,10.23,8.71,15.07.97,1.61,1.85,3.14,2.73,4.67.9,1.61,1.78,3.14,2.66,4.6.49.97,1.05,1.85,1.61,2.73,2.58,4.51,4.99,8.79,7.25,12.64.9,1.54,1.78,3.07,2.66,4.51v.08l3.55,6.04,1.12,2.02v.08c.9,1.85,1.93,3.7,3.15,5.4,6.43,9.18,17.16,15.95,28.36,17.24,3.29.39,6.69.39,9.98,0,28.29-2.99,44.9-35.07,31.19-59.79l50.41,87.32Z"/>
|
|
49
|
+
</g>
|
|
50
|
+
</g>
|
|
51
|
+
</svg>
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<svg id="Layer_2" data-name="Layer 2" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 636.19 428.76">
|
|
3
|
+
<defs>
|
|
4
|
+
<style>
|
|
5
|
+
.cls-1 {
|
|
6
|
+
fill: #ffffff;
|
|
7
|
+
stroke-width: 0px;
|
|
8
|
+
}
|
|
9
|
+
</style>
|
|
10
|
+
</defs>
|
|
11
|
+
<g id="welshare-logo" data-name="welshare-logo">
|
|
12
|
+
<g>
|
|
13
|
+
<path class="cls-1" d="m589.26,220.57l-32.72,56.69-11.4,19.77-65.87-91.19c11.14,3.87,23.84,3.29,34.36-2.65.31-.18.62-.36.93-.55,13.09-7.43,20.77-21.35,21.19-35.75l53.51,53.67Z"/>
|
|
14
|
+
<path class="cls-1" d="m125.97,72.79c-.45-.2-.91-.38-1.37-.55h-.08c-3.63-1.46-7.5-2.26-11.35-2.58-5.51-.46-10.74.21-15.53,1.77-14.41,4.7-24.91,17.47-27.62,31.93L28.16,37.52c4.04-4.64,8.47-8.96,13.2-12.9,6.52-5.4,13.63-10.05,21.25-13.79,3.53-1.72,7.16-3.27,10.91-4.58,5.12-1.82,10.44-3.25,15.92-4.26l36.53,70.8Z"/>
|
|
15
|
+
<path class="cls-1" d="m621.17,165.31l-64.62,111.95-42.91-74.07c.31-.18.62-.36.93-.55,19.99-11.33,27.38-37.86,15.55-58.02-10.99-19.02-28.48-49.36-44.46-77.03C468.75,38.32,488.86.96,522.66.04c77.49-2.1,144.44,82.96,98.5,165.27Z"/>
|
|
16
|
+
<path class="cls-1" d="m513.64,203.19c-18.27,10.32-43.13,4.47-54.96-12.8l-.07-.1c-1.68-2.3-11.65-19.85-13.06-22.27l.08-.13-1.01-1.75-.08.14-39-67.52-5.2-9.03-22.91-39.68C357.2,19.22,322.48.31,285.37.31c-.81-.03-1.63-.03-2.44-.03-12.07.06-23.51,2.17-34.13,5.96-11.85,4.22-22.67,10.5-32.14,18.36-7.01,5.8-13.22,12.53-18.66,19.84C177.39,17.04,144.88.29,110.09.29h-2.41c-4.57.03-9.06.35-13.44.94-7.19.97-14.12,2.66-20.72,5.02-3.74,1.32-7.37,2.86-10.91,4.58l35.02,60.6c4.79-1.56,10.02-2.23,15.53-1.77,3.85.32,7.72,1.12,11.35,2.58h.08c8.69,3.22,16.19,9.59,20.79,17.72h.06v.03s1.79,3.11,1.79,3.11l2.12,3.66.42.73,1.89,3.27.57,1.01,5.87,10.13.56.94.56,1.02,6.66,11.52.34.57,4.37,7.58,1.09,1.89,2.44,4.23,3.95,6.85,2.75,4.75.88,1.53,1.61,2.82,2.44,4.23.86,1.47,1.46,2.52.79,1.36,1.26,2.2,1.6,2.78,2.92,5.06,1.54,2.65,2.13,3.67.46.78,1.67,2.89.06.1,3.14,5.45,1.47,2.55,5.78,9.99,4.89,8.48.9,1.56,1.56,2.69.18.31,1.01,1.75.1.17,2.3,3.98,1.65,2.85,3.28,5.68,2.65,4.58c1.74,3,3.46,5.99,5.12,8.9l1.11,1.91c1,1.68,2,3.38,2.96,5.07.64,1.12,1.29,2.26,1.92,3.38l.95,1.67,1.35,2.31c.31.49.59,1,.87,1.5l1.26,2.17c1.26,2.17,2.52,4.33,3.73,6.45.71,1.23,1.44,2.47,2.12,3.7l1.71,2.97,5.8,10.04.06.1c.18.31.36.62.55.91.31.53.6,1.07.9,1.58l3.49,6.06c.85,1.44,1.67,2.85,2.45,4.21l.49.88.08.17,50.41,87.32c.45-.55.88-1.11,1.3-1.67,14.73,19.44,35.96,33.78,59.56,40.01,9.08,2.51,18.39,3.71,27.64,3.71.8,0,1.6-.01,2.4-.03,13.6-.29,27.04-3.18,39.6-8.33,0,0,.01-.01.04-.01,10.19-4.19,19.81-9.9,28.37-16.91,9.56-7.81,17.84-17.26,24.22-28.11.35-.56.69-1.11,1-1.67l1.68-2.89,30.28-52.44,23.72-41.1-42.91-74.07Zm-103.26,155.98c-3.31.36-6.66.36-9.97-.06-11.17-1.26-21.92-8.03-28.33-17.2-1.22-1.72-2.27-3.55-3.14-5.41-.01-.03-.01-.06-.04-.07l-1.14-1.98-3.55-6.11v-.04c-.86-1.44-1.71-2.96-2.62-4.51-2.27-3.9-4.71-8.12-7.3-12.64-.52-.9-1.05-1.79-1.58-2.73-.85-1.49-1.74-3.03-2.64-4.57-.91-1.56-1.82-3.14-2.75-4.75-2.79-4.79-5.68-9.81-8.68-15.01-2.99-5.19-6.08-10.54-9.24-16.02-2.59-4.5-5.23-9.07-7.91-13.68-15.99-27.73-33.04-57.28-47.66-82.59l-3.6-6.25c-2.34-4.02-4.6-7.96-6.77-11.72-3.95-6.83-7.61-13.15-10.86-18.8-.87-1.49-1.7-2.92-2.51-4.32-.29-.5-.59-1.02-.87-1.53-14.7-27.38,7.42-62.18,39.15-59.46,3.9.28,7.74,1.11,11.4,2.51.01.01.04.01.06.01,8.72,3.28,16.22,9.62,20.84,17.72l.04.04c.03.1.11.24.25.46.17.32.48.78.81,1.42l.73,1.25c.78,1.35,1.78,3.1,2.97,5.16l1.44,2.5c1.51,2.64,3.24,5.61,5.09,8.83l1.91,3.29,1.98,3.42,2.03,3.52c.34.59.69,1.19,1.04,1.81l1.93,3.34c.08.17.2.34.28.46l1.98,3.45c2.1,3.66,4.22,7.3,6.25,10.82l2,3.49,1.93,3.35c.95,1.65,1.88,3.24,2.76,4.77.29.5.56,1.01.85,1.5l1.65,2.85,1.5,2.62c3.38,5.83,5.52,9.56,5.52,9.56,2.38,4.12,5.05,8.72,7.93,13.71,1.44,2.48,2.93,5.07,4.47,7.74.38.66.77,1.33,1.15,2,1.57,2.71,3.18,5.48,4.81,8.31,2.87,4.96,5.83,10.11,8.85,15.34.87,1.49,1.74,2.99,2.59,4.5,2.19,3.77,4.39,7.58,6.59,11.4.88,1.51,1.77,3.04,2.64,4.57,1.75,3.04,3.53,6.1,5.26,9.13,1.32,2.27,2.62,4.51,3.91,6.77,1.3,2.23,2.58,4.44,3.85,6.64.42.74.84,1.47,1.26,2.2,1.67,2.92,3.34,5.76,4.95,8.56.81,1.42,1.61,2.79,2.4,4.15,1.96,3.42,3.87,6.73,5.71,9.91.73,1.26,1.46,2.51,2.14,3.71,2.47,4.26,4.75,8.24,6.83,11.83l.53.91c13.85,24.74-2.73,56.98-31.13,59.94Z"/>
|
|
17
|
+
<path class="cls-1" d="m316.73,386.68c-4.84,6.2-10.32,11.83-16.33,16.78-8.62,7.01-18.21,12.73-28.36,16.92h-.08c-12.57,5.16-26.02,8.06-39.56,8.3-.81.08-1.61.08-2.41.08-9.27,0-18.62-1.22-27.64-3.71-26.34-7.01-49.79-23.93-64.45-46.97-1.53-2.17-3.14-5.23-4.51-7.57L14.87,165.3c-21.43-35.61-18.29-77.27.48-109.82,6.77-11.76,15.63-22.23,26.02-30.85,6.52-5.4,13.63-10.05,21.25-13.79l35.02,60.6c-22.81,7.43-35.82,35.11-23.63,57.68.24.57.56,1.05.81,1.54.8,1.44,1.68,2.89,2.5,4.35,3.31,5.64,6.92,12,10.88,18.77,2.17,3.78,4.43,7.74,6.77,11.76l3.62,6.21c14.66,25.37,31.67,54.87,47.7,82.58,2.65,4.67,5.23,9.27,7.89,13.7,3.14,5.48,6.21,10.88,9.18,16.04,3.07,5.24,5.97,10.23,8.71,15.07.97,1.61,1.85,3.14,2.73,4.67.9,1.61,1.78,3.14,2.66,4.6.49.97,1.05,1.85,1.61,2.73,2.58,4.51,4.99,8.79,7.25,12.64.9,1.54,1.78,3.07,2.66,4.51v.08l3.55,6.04,1.12,2.02v.08c.9,1.85,1.93,3.7,3.15,5.4,6.43,9.18,17.16,15.95,28.36,17.24,3.29.39,6.69.39,9.98,0,28.29-2.99,44.9-35.07,31.19-59.79l50.41,87.32Z"/>
|
|
18
|
+
</g>
|
|
19
|
+
</g>
|
|
20
|
+
</svg>
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import React from
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { WelshareLogo } from "./welshare-logo.js";
|
|
2
3
|
|
|
3
4
|
export const ConnectWelshareButton = (props: {
|
|
4
5
|
openWallet: () => void;
|
|
@@ -7,66 +8,67 @@ export const ConnectWelshareButton = (props: {
|
|
|
7
8
|
// Self-contained styles that won't conflict with external applications
|
|
8
9
|
const buttonStyles: React.CSSProperties = {
|
|
9
10
|
// Reset any inherited styles
|
|
10
|
-
all:
|
|
11
|
-
boxSizing:
|
|
12
|
-
|
|
11
|
+
all: "unset",
|
|
12
|
+
boxSizing: "border-box",
|
|
13
|
+
|
|
13
14
|
// Layout
|
|
14
|
-
display:
|
|
15
|
-
alignItems:
|
|
16
|
-
justifyContent:
|
|
17
|
-
width:
|
|
18
|
-
minHeight:
|
|
19
|
-
padding:
|
|
20
|
-
|
|
15
|
+
display: "inline-flex",
|
|
16
|
+
alignItems: "center",
|
|
17
|
+
justifyContent: "center",
|
|
18
|
+
width: "100%",
|
|
19
|
+
minHeight: "44px",
|
|
20
|
+
padding: "12px 24px",
|
|
21
|
+
|
|
21
22
|
// Typography
|
|
22
|
-
fontFamily:
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
23
|
+
fontFamily:
|
|
24
|
+
'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif',
|
|
25
|
+
fontSize: "16px",
|
|
26
|
+
fontWeight: "600",
|
|
27
|
+
lineHeight: "1.5",
|
|
28
|
+
textAlign: "center",
|
|
29
|
+
textDecoration: "none",
|
|
30
|
+
whiteSpace: "nowrap",
|
|
31
|
+
|
|
30
32
|
// Visual styling
|
|
31
|
-
backgroundColor:
|
|
32
|
-
background:
|
|
33
|
-
color:
|
|
34
|
-
border:
|
|
35
|
-
borderRadius:
|
|
36
|
-
cursor:
|
|
37
|
-
transition:
|
|
38
|
-
|
|
33
|
+
backgroundColor: "#0198ff",
|
|
34
|
+
background: "linear-gradient(135deg, #0198ff 0%, #16ffef 100%)",
|
|
35
|
+
color: "#ffffff",
|
|
36
|
+
border: "none",
|
|
37
|
+
borderRadius: "8px",
|
|
38
|
+
cursor: "pointer",
|
|
39
|
+
transition: "all 0.2s ease-in-out",
|
|
40
|
+
|
|
39
41
|
// Accessibility
|
|
40
|
-
userSelect:
|
|
41
|
-
WebkitUserSelect:
|
|
42
|
-
MozUserSelect:
|
|
43
|
-
|
|
42
|
+
userSelect: "none",
|
|
43
|
+
WebkitUserSelect: "none",
|
|
44
|
+
MozUserSelect: "none",
|
|
45
|
+
|
|
44
46
|
// Focus states
|
|
45
|
-
outline:
|
|
47
|
+
outline: "none",
|
|
46
48
|
};
|
|
47
49
|
|
|
48
50
|
// Handle hover and focus states since inline styles don't support pseudo-selectors
|
|
49
51
|
const handleMouseEnter = (e: React.MouseEvent<HTMLButtonElement>) => {
|
|
50
|
-
e.currentTarget.style.transform =
|
|
51
|
-
e.currentTarget.style.boxShadow =
|
|
52
|
+
e.currentTarget.style.transform = "translateY(-1px)";
|
|
53
|
+
e.currentTarget.style.boxShadow = "0 4px 12px rgba(1, 152, 255, 0.3)";
|
|
52
54
|
};
|
|
53
55
|
|
|
54
56
|
const handleMouseLeave = (e: React.MouseEvent<HTMLButtonElement>) => {
|
|
55
|
-
e.currentTarget.style.transform =
|
|
56
|
-
e.currentTarget.style.boxShadow =
|
|
57
|
+
e.currentTarget.style.transform = "translateY(0)";
|
|
58
|
+
e.currentTarget.style.boxShadow = "0 2px 6px rgba(1, 152, 255, 0.2)";
|
|
57
59
|
};
|
|
58
60
|
|
|
59
61
|
const handleMouseDown = (e: React.MouseEvent<HTMLButtonElement>) => {
|
|
60
|
-
e.currentTarget.style.transform =
|
|
61
|
-
e.currentTarget.style.boxShadow =
|
|
62
|
+
e.currentTarget.style.transform = "translateY(0)";
|
|
63
|
+
e.currentTarget.style.boxShadow = "0 2px 6px rgba(1, 152, 255, 0.2)";
|
|
62
64
|
};
|
|
63
65
|
|
|
64
66
|
const handleFocus = (e: React.FocusEvent<HTMLButtonElement>) => {
|
|
65
|
-
e.currentTarget.style.boxShadow =
|
|
67
|
+
e.currentTarget.style.boxShadow = "0 0 0 3px rgba(1, 152, 255, 0.3)";
|
|
66
68
|
};
|
|
67
69
|
|
|
68
70
|
const handleBlur = (e: React.FocusEvent<HTMLButtonElement>) => {
|
|
69
|
-
e.currentTarget.style.boxShadow =
|
|
71
|
+
e.currentTarget.style.boxShadow = "0 2px 6px rgba(1, 152, 255, 0.2)";
|
|
70
72
|
};
|
|
71
73
|
|
|
72
74
|
return (
|
|
@@ -80,7 +82,23 @@ export const ConnectWelshareButton = (props: {
|
|
|
80
82
|
onBlur={handleBlur}
|
|
81
83
|
type="button"
|
|
82
84
|
>
|
|
83
|
-
|
|
85
|
+
<>
|
|
86
|
+
{props.children || (
|
|
87
|
+
<>
|
|
88
|
+
<span className="">
|
|
89
|
+
<WelshareLogo
|
|
90
|
+
width={24}
|
|
91
|
+
height={18}
|
|
92
|
+
style={{
|
|
93
|
+
"marginRight": "4px",
|
|
94
|
+
color: "#ffffff",
|
|
95
|
+
}}
|
|
96
|
+
/>
|
|
97
|
+
</span>
|
|
98
|
+
<span>Connect Welshare Profile</span>
|
|
99
|
+
</>
|
|
100
|
+
)}
|
|
101
|
+
</>
|
|
84
102
|
</button>
|
|
85
103
|
);
|
|
86
104
|
};
|
|
@@ -96,4 +114,4 @@ export const ConnectWelshareButton = (props: {
|
|
|
96
114
|
</button>
|
|
97
115
|
</div>
|
|
98
116
|
*
|
|
99
|
-
*/
|
|
117
|
+
*/
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
export interface WelshareLogoProps {
|
|
4
|
+
className?: string;
|
|
5
|
+
style?: React.CSSProperties;
|
|
6
|
+
width?: number | string;
|
|
7
|
+
height?: number | string;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export const WelshareLogo: React.FC<WelshareLogoProps> = ({
|
|
11
|
+
className,
|
|
12
|
+
style,
|
|
13
|
+
width = 24,
|
|
14
|
+
height = 16,
|
|
15
|
+
...props
|
|
16
|
+
}) => {
|
|
17
|
+
return (
|
|
18
|
+
<svg
|
|
19
|
+
className={className}
|
|
20
|
+
style={style}
|
|
21
|
+
width={width}
|
|
22
|
+
height={height}
|
|
23
|
+
viewBox="0 0 636.19 428.76"
|
|
24
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
25
|
+
{...props}
|
|
26
|
+
>
|
|
27
|
+
<g>
|
|
28
|
+
<path
|
|
29
|
+
fill="currentColor"
|
|
30
|
+
strokeWidth="0"
|
|
31
|
+
d="m589.26,220.57l-32.72,56.69-11.4,19.77-65.87-91.19c11.14,3.87,23.84,3.29,34.36-2.65.31-.18.62-.36.93-.55,13.09-7.43,20.77-21.35,21.19-35.75l53.51,53.67Z"
|
|
32
|
+
/>
|
|
33
|
+
<path
|
|
34
|
+
fill="currentColor"
|
|
35
|
+
strokeWidth="0"
|
|
36
|
+
d="m125.97,72.79c-.45-.2-.91-.38-1.37-.55h-.08c-3.63-1.46-7.5-2.26-11.35-2.58-5.51-.46-10.74.21-15.53,1.77-14.41,4.7-24.91,17.47-27.62,31.93L28.16,37.52c4.04-4.64,8.47-8.96,13.2-12.9,6.52-5.4,13.63-10.05,21.25-13.79,3.53-1.72,7.16-3.27,10.91-4.58,5.12-1.82,10.44-3.25,15.92-4.26l36.53,70.8Z"
|
|
37
|
+
/>
|
|
38
|
+
<path
|
|
39
|
+
fill="currentColor"
|
|
40
|
+
strokeWidth="0"
|
|
41
|
+
d="m621.17,165.31l-64.62,111.95-42.91-74.07c.31-.18.62-.36.93-.55,19.99-11.33,27.38-37.86,15.55-58.02-10.99-19.02-28.48-49.36-44.46-77.03C468.75,38.32,488.86.96,522.66.04c77.49-2.1,144.44,82.96,98.5,165.27Z"
|
|
42
|
+
/>
|
|
43
|
+
<path
|
|
44
|
+
fill="currentColor"
|
|
45
|
+
strokeWidth="0"
|
|
46
|
+
d="m513.64,203.19c-18.27,10.32-43.13,4.47-54.96-12.8l-.07-.1c-1.68-2.3-11.65-19.85-13.06-22.27l.08-.13-1.01-1.75-.08.14-39-67.52-5.2-9.03-22.91-39.68C357.2,19.22,322.48.31,285.37.31c-.81-.03-1.63-.03-2.44-.03-12.07.06-23.51,2.17-34.13,5.96-11.85,4.22-22.67,10.5-32.14,18.36-7.01,5.8-13.22,12.53-18.66,19.84C177.39,17.04,144.88.29,110.09.29h-2.41c-4.57.03-9.06.35-13.44.94-7.19.97-14.12,2.66-20.72,5.02-3.74,1.32-7.37,2.86-10.91,4.58l35.02,60.6c4.79-1.56,10.02-2.23,15.53-1.77,3.85.32,7.72,1.12,11.35,2.58h.08c8.69,3.22,16.19,9.59,20.79,17.72h.06v.03s1.79,3.11,1.79,3.11l2.12,3.66.42.73,1.89,3.27.57,1.01,5.87,10.13.56.94.56,1.02,6.66,11.52.34.57,4.37,7.58,1.09,1.89,2.44,4.23,3.95,6.85,2.75,4.75.88,1.53,1.61,2.82,2.44,4.23.86,1.47,1.46,2.52.79,1.36,1.26,2.2,1.6,2.78,2.92,5.06,1.54,2.65,2.13,3.67.46.78,1.67,2.89.06.1,3.14,5.45,1.47,2.55,5.78,9.99,4.89,8.48.9,1.56,1.56,2.69.18.31,1.01,1.75.1.17,2.3,3.98,1.65,2.85,3.28,5.68,2.65,4.58c1.74,3,3.46,5.99,5.12,8.9l1.11,1.91c1,1.68,2,3.38,2.96,5.07.64,1.12,1.29,2.26,1.92,3.38l.95,1.67,1.35,2.31c.31.49.59,1,.87,1.5l1.26,2.17c1.26,2.17,2.52,4.33,3.73,6.45.71,1.23,1.44,2.47,2.12,3.7l1.71,2.97,5.8,10.04.06.1c.18.31.36.62.55.91.31.53.6,1.07.9,1.58l3.49,6.06c.85,1.44,1.67,2.85,2.45,4.21l.49.88.08.17,50.41,87.32c.45-.55.88-1.11,1.3-1.67,14.73,19.44,35.96,33.78,59.56,40.01,9.08,2.51,18.39,3.71,27.64,3.71.8,0,1.6-.01,2.4-.03,13.6-.29,27.04-3.18,39.6-8.33,0,0,.01-.01.04-.01,10.19-4.19,19.81-9.9,28.37-16.91,9.56-7.81,17.84-17.26,24.22-28.11.35-.56.69-1.11,1-1.67l1.68-2.89,30.28-52.44,23.72-41.1-42.91-74.07Zm-103.26,155.98c-3.31.36-6.66.36-9.97-.06-11.17-1.26-21.92-8.03-28.33-17.2-1.22-1.72-2.27-3.55-3.14-5.41-.01-.03-.01-.06-.04-.07l-1.14-1.98-3.55-6.11v-.04c-.86-1.44-1.71-2.96-2.62-4.51-2.27-3.9-4.71-8.12-7.3-12.64-.52-.9-1.05-1.79-1.58-2.73-.85-1.49-1.74-3.03-2.64-4.57-.91-1.56-1.82-3.14-2.75-4.75-2.79-4.79-5.68-9.81-8.68-15.01-2.99-5.19-6.08-10.54-9.24-16.02-2.59-4.5-5.23-9.07-7.91-13.68-15.99-27.73-33.04-57.28-47.66-82.59l-3.6-6.25c-2.34-4.02-4.6-7.96-6.77-11.72-3.95-6.83-7.61-13.15-10.86-18.8-.87-1.49-1.7-2.92-2.51-4.32-.29-.5-.59-1.02-.87-1.53-14.7-27.38,7.42-62.18,39.15-59.46,3.9.28,7.74,1.11,11.4,2.51.01.01.04.01.06.01,8.72,3.28,16.22,9.62,20.84,17.72l.04.04c.03.1.11.24.25.46.17.32.48.78.81,1.42l.73,1.25c.78,1.35,1.78,3.1,2.97,5.16l1.44,2.5c1.51,2.64,3.24,5.61,5.09,8.83l1.91,3.29,1.98,3.42,2.03,3.52c.34.59.69,1.19,1.04,1.81l1.93,3.34c.08.17.2.34.28.46l1.98,3.45c2.1,3.66,4.22,7.3,6.25,10.82l2,3.49,1.93,3.35c.95,1.65,1.88,3.24,2.76,4.77.29.5.56,1.01.85,1.5l1.65,2.85,1.5,2.62c3.38,5.83,5.52,9.56,5.52,9.56,2.38,4.12,5.05,8.72,7.93,13.71,1.44,2.48,2.93,5.07,4.47,7.74.38.66.77,1.33,1.15,2,1.57,2.71,3.18,5.48,4.81,8.31,2.87,4.96,5.83,10.11,8.85,15.34.87,1.49,1.74,2.99,2.59,4.5,2.19,3.77,4.39,7.58,6.59,11.4.88,1.51,1.77,3.04,2.64,4.57,1.75,3.04,3.53,6.1,5.26,9.13,1.32,2.27,2.62,4.51,3.91,6.77,1.3,2.23,2.58,4.44,3.85,6.64.42.74.84,1.47,1.26,2.2,1.67,2.92,3.34,5.76,4.95,8.56.81,1.42,1.61,2.79,2.4,4.15,1.96,3.42,3.87,6.73,5.71,9.91.73,1.26,1.46,2.51,2.14,3.71,2.47,4.26,4.75,8.24,6.83,11.83l.53.91c13.85,24.74-2.73,56.98-31.13,59.94Z"
|
|
47
|
+
/>
|
|
48
|
+
<path
|
|
49
|
+
fill="currentColor"
|
|
50
|
+
strokeWidth="0"
|
|
51
|
+
d="m316.73,386.68c-4.84,6.2-10.32,11.83-16.33,16.78-8.62,7.01-18.21,12.73-28.36,16.92h-.08c-12.57,5.16-26.02,8.06-39.56,8.3-.81.08-1.61.08-2.41.08-9.27,0-18.62-1.22-27.64-3.71-26.34-7.01-49.79-23.93-64.45-46.97-1.53-2.17-3.14-5.23-4.51-7.57L14.87,165.3c-21.43-35.61-18.29-77.27.48-109.82,6.77-11.76,15.63-22.23,26.02-30.85,6.52-5.4,13.63-10.05,21.25-13.79l35.02,60.6c-22.81,7.43-35.82,35.11-23.63,57.68.24.57.56,1.05.81,1.54.8,1.44,1.68,2.89,2.5,4.35,3.31,5.64,6.92,12,10.88,18.77,2.17,3.78,4.43,7.74,6.77,11.76l3.62,6.21c14.66,25.37,31.67,54.87,47.7,82.58,2.65,4.67,5.23,9.27,7.89,13.7,3.14,5.48,6.21,10.88,9.18,16.04,3.07,5.24,5.97,10.23,8.71,15.07.97,1.61,1.85,3.14,2.73,4.67.9,1.61,1.78,3.14,2.66,4.6.49.97,1.05,1.85,1.61,2.73,2.58,4.51,4.99,8.79,7.25,12.64.9,1.54,1.78,3.07,2.66,4.51v.08l3.55,6.04,1.12,2.02v.08c.9,1.85,1.93,3.7,3.15,5.4,6.43,9.18,17.16,15.95,28.36,17.24,3.29.39,6.69.39,9.98,0,28.29-2.99,44.9-35.07,31.19-59.79l50.41,87.32Z"
|
|
52
|
+
/>
|
|
53
|
+
</g>
|
|
54
|
+
</svg>
|
|
55
|
+
);
|
|
56
|
+
};
|
|
@@ -25,7 +25,6 @@ export const useWelshare = (props: WelshareConnectionOptions) => {
|
|
|
25
25
|
const currentUploadRef = useRef<RunningFileUpload>(null);
|
|
26
26
|
|
|
27
27
|
const options: WelshareConnectionOptions = {
|
|
28
|
-
environment: "development",
|
|
29
28
|
apiBaseUrl: "https://wallet.welshare.app",
|
|
30
29
|
...props,
|
|
31
30
|
};
|
|
@@ -269,12 +268,24 @@ export const useWelshare = (props: WelshareConnectionOptions) => {
|
|
|
269
268
|
|
|
270
269
|
const openWallet = () => {
|
|
271
270
|
const width = 800;
|
|
272
|
-
const height =
|
|
271
|
+
const height = 700;
|
|
273
272
|
const left = window.screenX + (window.outerWidth - width) / 2;
|
|
274
273
|
const top = window.screenY + (window.outerHeight - height) / 2;
|
|
275
274
|
|
|
275
|
+
let socialParams = "";
|
|
276
|
+
if (options.interpolateSocials) {
|
|
277
|
+
const socialEntries = Object.entries(options.interpolateSocials)
|
|
278
|
+
.filter(([_, value]) => value !== undefined && value !== null)
|
|
279
|
+
.map(([key, value]) => `social.${key}=${encodeURIComponent(String(value))}`);
|
|
280
|
+
|
|
281
|
+
if (socialEntries.length > 0) {
|
|
282
|
+
socialParams = `&${socialEntries.join('&')}`;
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
const walletUrl = `${WELSHARE_WALLET_URL}?applicationId=${options.applicationId}${socialParams}`;
|
|
276
287
|
const newWindow = window.open(
|
|
277
|
-
|
|
288
|
+
walletUrl,
|
|
278
289
|
"Welshare Wallet",
|
|
279
290
|
`width=${width},height=${height},left=${left},top=${top}`
|
|
280
291
|
);
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
//todo: this is not tree shaken and leaks nillion dependencies transitively. Consider pulling it up
|
|
2
2
|
//import { QuestionnaireResponseSchema, ReflexSubmissionSchema } from "@welshare/sdk";
|
|
3
3
|
export { ConnectWelshareButton } from "./components/connect-button.js";
|
|
4
|
+
export { WelshareLogo } from "./components/welshare-logo.js";
|
|
4
5
|
// ---- hooks ----
|
|
5
6
|
export { useWelshare } from "./hooks/use-welshare.js";
|
|
6
7
|
|
|
@@ -6,8 +6,6 @@ export interface DialogMessage {
|
|
|
6
6
|
id?: string;
|
|
7
7
|
}
|
|
8
8
|
|
|
9
|
-
export type WelshareEnvironment = "development" | "production";
|
|
10
|
-
|
|
11
9
|
/**
|
|
12
10
|
* a welshare schema type uid
|
|
13
11
|
*/
|
|
@@ -59,9 +57,12 @@ export interface DataSubmissionDialogMessage extends DialogMessage {
|
|
|
59
57
|
|
|
60
58
|
export interface WelshareConnectionOptions {
|
|
61
59
|
applicationId: string;
|
|
60
|
+
interpolateSocials?: {
|
|
61
|
+
emailAddress?: string;
|
|
62
|
+
privy?: string;
|
|
63
|
+
}
|
|
62
64
|
//todo: must go into build config, not supposed to be used by users
|
|
63
65
|
apiBaseUrl?: string;
|
|
64
|
-
environment?: WelshareEnvironment;
|
|
65
66
|
callbacks: {
|
|
66
67
|
onFileUploaded?: (insertedUid: string, url: string) => void;
|
|
67
68
|
onUploaded?: (payload: SubmissionPayload<unknown>) => void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@welshare/react",
|
|
3
|
-
"version": "0.1
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"description": "React library for integrating with Welshare's sovereign data sharing platform",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -77,7 +77,7 @@
|
|
|
77
77
|
"node": ">=20.0.0"
|
|
78
78
|
},
|
|
79
79
|
"scripts": {
|
|
80
|
-
"lint": "eslint . --max-warnings
|
|
80
|
+
"lint": "eslint . --max-warnings 25",
|
|
81
81
|
"build": "tshy",
|
|
82
82
|
"build:clean": "rm -rf ./dist",
|
|
83
83
|
"test": "vitest",
|