@welshare/react 0.2.0 → 0.2.2

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.
Files changed (53) hide show
  1. package/dist/esm/components/connect-button.d.ts +1 -1
  2. package/dist/esm/components/connect-button.d.ts.map +1 -1
  3. package/dist/esm/components/connect-button.js +39 -35
  4. package/dist/esm/components/welshare-logo.d.ts +9 -0
  5. package/dist/esm/components/welshare-logo.d.ts.map +1 -0
  6. package/dist/esm/components/welshare-logo.js +4 -0
  7. package/dist/esm/index.d.ts +4 -2
  8. package/dist/esm/index.d.ts.map +1 -1
  9. package/dist/esm/index.js +5 -3
  10. package/dist/esm/lib/encryption.d.ts +1 -11
  11. package/dist/esm/lib/encryption.d.ts.map +1 -1
  12. package/dist/esm/lib/encryption.js +2 -9
  13. package/dist/esm/lib/uploads.d.ts +2 -1
  14. package/dist/esm/lib/uploads.d.ts.map +1 -1
  15. package/dist/esm/lib/uploads.js +10 -0
  16. package/dist/esm/types.d.ts +1 -1
  17. package/dist/esm/types.d.ts.map +1 -1
  18. package/dist/esm/utils.d.ts +12 -0
  19. package/dist/esm/utils.d.ts.map +1 -0
  20. package/dist/esm/utils.js +8 -0
  21. package/dist/node_modules/@welshare/react/.DS_Store +0 -0
  22. package/dist/node_modules/@welshare/react/dist/esm/components/connect-button.d.ts +1 -1
  23. package/dist/node_modules/@welshare/react/dist/esm/components/connect-button.d.ts.map +1 -1
  24. package/dist/node_modules/@welshare/react/dist/esm/components/connect-button.js +39 -35
  25. package/dist/node_modules/@welshare/react/dist/esm/components/welshare-logo.d.ts +9 -0
  26. package/dist/node_modules/@welshare/react/dist/esm/components/welshare-logo.d.ts.map +1 -0
  27. package/dist/node_modules/@welshare/react/dist/esm/components/welshare-logo.js +4 -0
  28. package/dist/node_modules/@welshare/react/dist/esm/index.d.ts +4 -2
  29. package/dist/node_modules/@welshare/react/dist/esm/index.d.ts.map +1 -1
  30. package/dist/node_modules/@welshare/react/dist/esm/index.js +5 -3
  31. package/dist/node_modules/@welshare/react/dist/esm/lib/encryption.d.ts +1 -11
  32. package/dist/node_modules/@welshare/react/dist/esm/lib/encryption.d.ts.map +1 -1
  33. package/dist/node_modules/@welshare/react/dist/esm/lib/encryption.js +2 -9
  34. package/dist/node_modules/@welshare/react/dist/esm/lib/uploads.d.ts +2 -1
  35. package/dist/node_modules/@welshare/react/dist/esm/lib/uploads.d.ts.map +1 -1
  36. package/dist/node_modules/@welshare/react/dist/esm/lib/uploads.js +10 -0
  37. package/dist/node_modules/@welshare/react/dist/esm/types.d.ts +1 -1
  38. package/dist/node_modules/@welshare/react/dist/esm/types.d.ts.map +1 -1
  39. package/dist/node_modules/@welshare/react/dist/esm/utils.d.ts +12 -0
  40. package/dist/node_modules/@welshare/react/dist/esm/utils.d.ts.map +1 -0
  41. package/dist/node_modules/@welshare/react/dist/esm/utils.js +8 -0
  42. package/dist/node_modules/@welshare/react/package.json +8 -1
  43. package/dist/node_modules/@welshare/react/src/assets/logo_black.svg +20 -0
  44. package/dist/node_modules/@welshare/react/src/assets/logo_color.svg +51 -0
  45. package/dist/node_modules/@welshare/react/src/assets/logo_white.svg +20 -0
  46. package/dist/node_modules/@welshare/react/src/components/connect-button.tsx +60 -42
  47. package/dist/node_modules/@welshare/react/src/components/welshare-logo.tsx +56 -0
  48. package/dist/node_modules/@welshare/react/src/index.ts +6 -5
  49. package/dist/node_modules/@welshare/react/src/lib/encryption.ts +3 -24
  50. package/dist/node_modules/@welshare/react/src/lib/uploads.ts +12 -1
  51. package/dist/node_modules/@welshare/react/src/types.ts +1 -1
  52. package/dist/node_modules/@welshare/react/src/utils.ts +22 -0
  53. package/package.json +8 -1
@@ -1,4 +1,4 @@
1
- import React from 'react';
1
+ import React from "react";
2
2
  export declare const ConnectWelshareButton: (props: {
3
3
  openWallet: () => void;
4
4
  children?: React.ReactNode;
@@ -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;AAE1B,eAAO,MAAM,qBAAqB,UAAW;IAC3C,UAAU,EAAE,MAAM,IAAI,CAAC;IACvB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B,4CAgFA,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: 'unset',
7
- boxSizing: 'border-box',
7
+ all: "unset",
8
+ boxSizing: "border-box",
8
9
  // Layout
9
- display: 'inline-flex',
10
- alignItems: 'center',
11
- justifyContent: 'center',
12
- width: '100%',
13
- minHeight: '44px',
14
- padding: '12px 24px',
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: '16px',
18
- fontWeight: '600',
19
- lineHeight: '1.5',
20
- textAlign: 'center',
21
- textDecoration: 'none',
22
- whiteSpace: 'nowrap',
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: '#0198ff',
25
- background: 'linear-gradient(135deg, #0198ff 0%, #16ffef 100%)',
26
- color: '#ffffff',
27
- border: 'none',
28
- borderRadius: '8px',
29
- cursor: 'pointer',
30
- transition: 'all 0.2s ease-in-out',
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: 'none',
33
- WebkitUserSelect: 'none',
34
- MozUserSelect: 'none',
33
+ userSelect: "none",
34
+ WebkitUserSelect: "none",
35
+ MozUserSelect: "none",
35
36
  // Focus states
36
- outline: 'none',
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 = 'translateY(-1px)';
41
- e.currentTarget.style.boxShadow = '0 4px 12px rgba(1, 152, 255, 0.3)';
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 = 'translateY(0)';
45
- e.currentTarget.style.boxShadow = '0 2px 6px rgba(1, 152, 255, 0.2)';
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 = 'translateY(0)';
49
- e.currentTarget.style.boxShadow = '0 2px 6px rgba(1, 152, 255, 0.2)';
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 = '0 0 0 3px rgba(1, 152, 255, 0.3)';
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 = '0 2px 6px rgba(1, 152, 255, 0.2)';
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 || "Connect Welshare Profile" }));
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,7 +1,9 @@
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
- export { decodeEncryptionKey, decrypt, encodeEncryptionKey, encryptFile, generateRandomAESKey, type EncryptionKey } from "./lib/encryption.js";
4
- export { encryptAndUploadFile } from "./lib/uploads.js";
4
+ export { decrypt, encodeEncryptionKey, encryptFile, generateRandomAESKey } from "./lib/encryption.js";
5
+ export { decodeEncryptionKey, type EncryptionKey } from "./utils.js";
6
+ export { browserDownload, encryptAndUploadFile } from "./lib/uploads.js";
5
7
  export declare const Schemas: {
6
8
  QuestionnaireResponse: string;
7
9
  ReflexSubmission: string;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;AAEvE,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
+ {"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,OAAO,EACP,mBAAmB,EACnB,WAAW,EACX,oBAAoB,EACrB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,mBAAmB,EAAE,KAAK,aAAa,EAAE,MAAM,YAAY,CAAC;AAErE,OAAO,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAEzE,eAAO,MAAM,OAAO;;;;CAInB,CAAC"}
package/dist/esm/index.js CHANGED
@@ -1,13 +1,15 @@
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
- export { decodeEncryptionKey, decrypt, encodeEncryptionKey, encryptFile, generateRandomAESKey } from "./lib/encryption.js";
7
- export { encryptAndUploadFile } from "./lib/uploads.js";
7
+ export { decrypt, encodeEncryptionKey, encryptFile, generateRandomAESKey } from "./lib/encryption.js";
8
+ export { decodeEncryptionKey } from "./utils.js";
9
+ export { browserDownload, encryptAndUploadFile } from "./lib/uploads.js";
8
10
  //todo: import them from the SDK or a dedicated SDK constants export
9
11
  export const Schemas = {
10
12
  QuestionnaireResponse: "b14b538f-7de3-4767-ad77-464d755d78bd", //QuestionnaireResponseSchema.schemaUid,
11
13
  ReflexSubmission: "f5cf2d8a-1f78-4f21-b4bd-082e983b830c", //ReflexSubmissionSchema.schemaUid,
12
- BinaryFile: "9d696baf-483f-4cc0-b748-23a22c1705f5" //BinaryFilesSchema.schemaUid,
14
+ BinaryFile: "9d696baf-483f-4cc0-b748-23a22c1705f5", //BinaryFilesSchema.schemaUid,
13
15
  };
@@ -1,19 +1,9 @@
1
- export declare const ALGORITHM = "AES-GCM";
2
- export type Algorithm = "AES-GCM";
1
+ import { EncryptionKey } from "../utils.js";
3
2
  export declare const generateRandomAESKey: () => Promise<CryptoKey>;
4
3
  export declare const encryptFile: (file: File, key: CryptoKey) => Promise<{
5
4
  encryptedData: ArrayBuffer;
6
5
  iv: Uint8Array;
7
6
  }>;
8
- export type EncryptionKey = {
9
- algorithm: Algorithm;
10
- key: string;
11
- iv: string;
12
- };
13
7
  export declare const encodeEncryptionKey: (key: CryptoKey, iv: Uint8Array) => Promise<EncryptionKey>;
14
- export declare const decodeEncryptionKey: (encryptionKey: EncryptionKey) => {
15
- key: Uint8Array<ArrayBuffer>;
16
- iv: Uint8Array<ArrayBuffer>;
17
- };
18
8
  export declare const decrypt: (encryptedData: ArrayBuffer, encryptionKey: EncryptionKey) => Promise<ArrayBuffer | null>;
19
9
  //# sourceMappingURL=encryption.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"encryption.d.ts","sourceRoot":"","sources":["../../../src/lib/encryption.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,SAAS,YAAY,CAAC;AACnC,MAAM,MAAM,SAAS,GAAG,SAAS,CAAC;AAElC,eAAO,MAAM,oBAAoB,QAAa,OAAO,CAAC,SAAS,CAU9D,CAAC;AAIF,eAAO,MAAM,WAAW,SAChB,IAAI,OACL,SAAS,KACb,OAAO,CAAC;IAAE,aAAa,EAAE,WAAW,CAAC;IAAC,EAAE,EAAE,UAAU,CAAA;CAAE,CAgBxD,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IAC1B,SAAS,EAAE,SAAS,CAAC;IACrB,GAAG,EAAE,MAAM,CAAC;IACZ,EAAE,EAAE,MAAM,CAAC;CACZ,CAAC;AAEF,eAAO,MAAM,mBAAmB,QACzB,SAAS,MACV,UAAU,KACb,OAAO,CAAC,aAAa,CAgBvB,CAAC;AAEF,eAAO,MAAM,mBAAmB,kBACf,aAAa,KAC3B;IAAE,GAAG,EAAE,UAAU,CAAC,WAAW,CAAC,CAAC;IAAC,EAAE,EAAE,UAAU,CAAC,WAAW,CAAC,CAAA;CAU7D,CAAC;AAGF,eAAO,MAAM,OAAO,kBACH,WAAW,iBACX,aAAa,KAC3B,OAAO,CAAC,WAAW,GAAG,IAAI,CA0B5B,CAAC"}
1
+ {"version":3,"file":"encryption.d.ts","sourceRoot":"","sources":["../../../src/lib/encryption.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,aAAa,EAAuB,MAAM,aAAa,CAAC;AAE5E,eAAO,MAAM,oBAAoB,QAAa,OAAO,CAAC,SAAS,CAU9D,CAAC;AAIF,eAAO,MAAM,WAAW,SAChB,IAAI,OACL,SAAS,KACb,OAAO,CAAC;IAAE,aAAa,EAAE,WAAW,CAAC;IAAC,EAAE,EAAE,UAAU,CAAA;CAAE,CAgBxD,CAAC;AAEF,eAAO,MAAM,mBAAmB,QACzB,SAAS,MACV,UAAU,KACb,OAAO,CAAC,aAAa,CAgBvB,CAAC;AAGF,eAAO,MAAM,OAAO,kBACH,WAAW,iBACX,aAAa,KAC3B,OAAO,CAAC,WAAW,GAAG,IAAI,CA0B5B,CAAC"}
@@ -1,4 +1,4 @@
1
- export const ALGORITHM = "AES-GCM";
1
+ import { ALGORITHM, decodeEncryptionKey } from "../utils.js";
2
2
  export const generateRandomAESKey = async () => {
3
3
  // Generate a 256-bit AES-GCM key for file encryption
4
4
  return window.crypto.subtle.generateKey({
@@ -36,13 +36,6 @@ export const encodeEncryptionKey = async (key, iv) => {
36
36
  iv: ivHex,
37
37
  };
38
38
  };
39
- export const decodeEncryptionKey = (encryptionKey) => {
40
- const keyBytes = new Uint8Array(encryptionKey.key
41
- .match(/.{1,2}/g)
42
- .map((byte) => parseInt(byte, 16)));
43
- const ivBytes = new Uint8Array(encryptionKey.iv.match(/.{1,2}/g).map((byte) => parseInt(byte, 16)));
44
- return { key: keyBytes, iv: ivBytes };
45
- };
46
39
  // Helper function to decrypt a file using encoded encryption key
47
40
  export const decrypt = async (encryptedData, encryptionKey) => {
48
41
  try {
@@ -50,7 +43,7 @@ export const decrypt = async (encryptedData, encryptionKey) => {
50
43
  const key = await window.crypto.subtle.importKey("raw", keyBytes, { name: ALGORITHM }, false, ["decrypt"]);
51
44
  const decryptedData = await window.crypto.subtle.decrypt({
52
45
  name: ALGORITHM,
53
- iv,
46
+ iv: iv,
54
47
  }, key, encryptedData);
55
48
  return decryptedData;
56
49
  }
@@ -1,3 +1,4 @@
1
- import { EncryptionKey } from "./encryption.js";
1
+ import { EncryptionKey } from "@/utils.js";
2
2
  export declare const encryptAndUploadFile: (file: File, presignedUrl: string) => Promise<EncryptionKey>;
3
+ export declare const browserDownload: (decryptedFile: File) => void;
3
4
  //# sourceMappingURL=uploads.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"uploads.d.ts","sourceRoot":"","sources":["../../../src/lib/uploads.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,aAAa,EAEd,MAAM,iBAAiB,CAAC;AAEzB,eAAO,MAAM,oBAAoB,SACzB,IAAI,gBACI,MAAM,KACnB,OAAO,CAAC,aAAa,CAkBvB,CAAC"}
1
+ {"version":3,"file":"uploads.d.ts","sourceRoot":"","sources":["../../../src/lib/uploads.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAO3C,eAAO,MAAM,oBAAoB,SACzB,IAAI,gBACI,MAAM,KACnB,OAAO,CAAC,aAAa,CAkBvB,CAAC;AAEF,eAAO,MAAM,eAAe,kBAAmB,IAAI,SASlD,CAAA"}
@@ -15,3 +15,13 @@ export const encryptAndUploadFile = async (file, presignedUrl) => {
15
15
  }
16
16
  return encodeEncryptionKey(encryptionKey, iv);
17
17
  };
18
+ export const browserDownload = (decryptedFile) => {
19
+ const downloadUrl = window.URL.createObjectURL(decryptedFile);
20
+ const a = document.createElement("a");
21
+ a.href = downloadUrl;
22
+ a.download = decryptedFile.name;
23
+ document.body.appendChild(a);
24
+ a.click();
25
+ document.body.removeChild(a);
26
+ window.URL.revokeObjectURL(downloadUrl);
27
+ };
@@ -1,4 +1,4 @@
1
- import { EncryptionKey } from "./lib/encryption.js";
1
+ import { EncryptionKey } from "./utils.js";
2
2
  export interface DialogMessage {
3
3
  type: string;
4
4
  payload?: any;
@@ -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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AK,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"}
@@ -0,0 +1,12 @@
1
+ export declare const ALGORITHM = "AES-GCM";
2
+ export type Algorithm = "AES-GCM";
3
+ export type EncryptionKey = {
4
+ algorithm: Algorithm;
5
+ key: string;
6
+ iv: string;
7
+ };
8
+ export declare const decodeEncryptionKey: (encryptionKey: EncryptionKey) => {
9
+ key: BufferSource;
10
+ iv: BufferSource;
11
+ };
12
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,SAAS,YAAY,CAAC;AACnC,MAAM,MAAM,SAAS,GAAG,SAAS,CAAC;AAElC,MAAM,MAAM,aAAa,GAAG;IAC1B,SAAS,EAAE,SAAS,CAAC;IACrB,GAAG,EAAE,MAAM,CAAC;IACZ,EAAE,EAAE,MAAM,CAAC;CACZ,CAAC;AAEF,eAAO,MAAM,mBAAmB,kBACf,aAAa,KAC3B;IAAE,GAAG,EAAE,YAAY,CAAC;IAAC,EAAE,EAAE,YAAY,CAAA;CAUvC,CAAC"}
@@ -0,0 +1,8 @@
1
+ export const ALGORITHM = "AES-GCM";
2
+ export const decodeEncryptionKey = (encryptionKey) => {
3
+ const keyBytes = new Uint8Array(encryptionKey.key
4
+ .match(/.{1,2}/g)
5
+ .map((byte) => parseInt(byte, 16)));
6
+ const ivBytes = new Uint8Array(encryptionKey.iv.match(/.{1,2}/g).map((byte) => parseInt(byte, 16)));
7
+ return { key: keyBytes, iv: ivBytes };
8
+ };
@@ -1,4 +1,4 @@
1
- import React from 'react';
1
+ import React from "react";
2
2
  export declare const ConnectWelshareButton: (props: {
3
3
  openWallet: () => void;
4
4
  children?: React.ReactNode;
@@ -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;AAE1B,eAAO,MAAM,qBAAqB,UAAW;IAC3C,UAAU,EAAE,MAAM,IAAI,CAAC;IACvB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B,4CAgFA,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: 'unset',
7
- boxSizing: 'border-box',
7
+ all: "unset",
8
+ boxSizing: "border-box",
8
9
  // Layout
9
- display: 'inline-flex',
10
- alignItems: 'center',
11
- justifyContent: 'center',
12
- width: '100%',
13
- minHeight: '44px',
14
- padding: '12px 24px',
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: '16px',
18
- fontWeight: '600',
19
- lineHeight: '1.5',
20
- textAlign: 'center',
21
- textDecoration: 'none',
22
- whiteSpace: 'nowrap',
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: '#0198ff',
25
- background: 'linear-gradient(135deg, #0198ff 0%, #16ffef 100%)',
26
- color: '#ffffff',
27
- border: 'none',
28
- borderRadius: '8px',
29
- cursor: 'pointer',
30
- transition: 'all 0.2s ease-in-out',
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: 'none',
33
- WebkitUserSelect: 'none',
34
- MozUserSelect: 'none',
33
+ userSelect: "none",
34
+ WebkitUserSelect: "none",
35
+ MozUserSelect: "none",
35
36
  // Focus states
36
- outline: 'none',
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 = 'translateY(-1px)';
41
- e.currentTarget.style.boxShadow = '0 4px 12px rgba(1, 152, 255, 0.3)';
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 = 'translateY(0)';
45
- e.currentTarget.style.boxShadow = '0 2px 6px rgba(1, 152, 255, 0.2)';
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 = 'translateY(0)';
49
- e.currentTarget.style.boxShadow = '0 2px 6px rgba(1, 152, 255, 0.2)';
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 = '0 0 0 3px rgba(1, 152, 255, 0.3)';
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 = '0 2px 6px rgba(1, 152, 255, 0.2)';
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 || "Connect Welshare Profile" }));
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,7 +1,9 @@
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
- export { decodeEncryptionKey, decrypt, encodeEncryptionKey, encryptFile, generateRandomAESKey, type EncryptionKey } from "./lib/encryption.js";
4
- export { encryptAndUploadFile } from "./lib/uploads.js";
4
+ export { decrypt, encodeEncryptionKey, encryptFile, generateRandomAESKey } from "./lib/encryption.js";
5
+ export { decodeEncryptionKey, type EncryptionKey } from "./utils.js";
6
+ export { browserDownload, encryptAndUploadFile } from "./lib/uploads.js";
5
7
  export declare const Schemas: {
6
8
  QuestionnaireResponse: string;
7
9
  ReflexSubmission: string;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;AAEvE,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
+ {"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,OAAO,EACP,mBAAmB,EACnB,WAAW,EACX,oBAAoB,EACrB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,mBAAmB,EAAE,KAAK,aAAa,EAAE,MAAM,YAAY,CAAC;AAErE,OAAO,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAEzE,eAAO,MAAM,OAAO;;;;CAInB,CAAC"}
@@ -1,13 +1,15 @@
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
- export { decodeEncryptionKey, decrypt, encodeEncryptionKey, encryptFile, generateRandomAESKey } from "./lib/encryption.js";
7
- export { encryptAndUploadFile } from "./lib/uploads.js";
7
+ export { decrypt, encodeEncryptionKey, encryptFile, generateRandomAESKey } from "./lib/encryption.js";
8
+ export { decodeEncryptionKey } from "./utils.js";
9
+ export { browserDownload, encryptAndUploadFile } from "./lib/uploads.js";
8
10
  //todo: import them from the SDK or a dedicated SDK constants export
9
11
  export const Schemas = {
10
12
  QuestionnaireResponse: "b14b538f-7de3-4767-ad77-464d755d78bd", //QuestionnaireResponseSchema.schemaUid,
11
13
  ReflexSubmission: "f5cf2d8a-1f78-4f21-b4bd-082e983b830c", //ReflexSubmissionSchema.schemaUid,
12
- BinaryFile: "9d696baf-483f-4cc0-b748-23a22c1705f5" //BinaryFilesSchema.schemaUid,
14
+ BinaryFile: "9d696baf-483f-4cc0-b748-23a22c1705f5", //BinaryFilesSchema.schemaUid,
13
15
  };
@@ -1,19 +1,9 @@
1
- export declare const ALGORITHM = "AES-GCM";
2
- export type Algorithm = "AES-GCM";
1
+ import { EncryptionKey } from "../utils.js";
3
2
  export declare const generateRandomAESKey: () => Promise<CryptoKey>;
4
3
  export declare const encryptFile: (file: File, key: CryptoKey) => Promise<{
5
4
  encryptedData: ArrayBuffer;
6
5
  iv: Uint8Array;
7
6
  }>;
8
- export type EncryptionKey = {
9
- algorithm: Algorithm;
10
- key: string;
11
- iv: string;
12
- };
13
7
  export declare const encodeEncryptionKey: (key: CryptoKey, iv: Uint8Array) => Promise<EncryptionKey>;
14
- export declare const decodeEncryptionKey: (encryptionKey: EncryptionKey) => {
15
- key: Uint8Array<ArrayBuffer>;
16
- iv: Uint8Array<ArrayBuffer>;
17
- };
18
8
  export declare const decrypt: (encryptedData: ArrayBuffer, encryptionKey: EncryptionKey) => Promise<ArrayBuffer | null>;
19
9
  //# sourceMappingURL=encryption.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"encryption.d.ts","sourceRoot":"","sources":["../../../src/lib/encryption.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,SAAS,YAAY,CAAC;AACnC,MAAM,MAAM,SAAS,GAAG,SAAS,CAAC;AAElC,eAAO,MAAM,oBAAoB,QAAa,OAAO,CAAC,SAAS,CAU9D,CAAC;AAIF,eAAO,MAAM,WAAW,SAChB,IAAI,OACL,SAAS,KACb,OAAO,CAAC;IAAE,aAAa,EAAE,WAAW,CAAC;IAAC,EAAE,EAAE,UAAU,CAAA;CAAE,CAgBxD,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IAC1B,SAAS,EAAE,SAAS,CAAC;IACrB,GAAG,EAAE,MAAM,CAAC;IACZ,EAAE,EAAE,MAAM,CAAC;CACZ,CAAC;AAEF,eAAO,MAAM,mBAAmB,QACzB,SAAS,MACV,UAAU,KACb,OAAO,CAAC,aAAa,CAgBvB,CAAC;AAEF,eAAO,MAAM,mBAAmB,kBACf,aAAa,KAC3B;IAAE,GAAG,EAAE,UAAU,CAAC,WAAW,CAAC,CAAC;IAAC,EAAE,EAAE,UAAU,CAAC,WAAW,CAAC,CAAA;CAU7D,CAAC;AAGF,eAAO,MAAM,OAAO,kBACH,WAAW,iBACX,aAAa,KAC3B,OAAO,CAAC,WAAW,GAAG,IAAI,CA0B5B,CAAC"}
1
+ {"version":3,"file":"encryption.d.ts","sourceRoot":"","sources":["../../../src/lib/encryption.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,aAAa,EAAuB,MAAM,aAAa,CAAC;AAE5E,eAAO,MAAM,oBAAoB,QAAa,OAAO,CAAC,SAAS,CAU9D,CAAC;AAIF,eAAO,MAAM,WAAW,SAChB,IAAI,OACL,SAAS,KACb,OAAO,CAAC;IAAE,aAAa,EAAE,WAAW,CAAC;IAAC,EAAE,EAAE,UAAU,CAAA;CAAE,CAgBxD,CAAC;AAEF,eAAO,MAAM,mBAAmB,QACzB,SAAS,MACV,UAAU,KACb,OAAO,CAAC,aAAa,CAgBvB,CAAC;AAGF,eAAO,MAAM,OAAO,kBACH,WAAW,iBACX,aAAa,KAC3B,OAAO,CAAC,WAAW,GAAG,IAAI,CA0B5B,CAAC"}
@@ -1,4 +1,4 @@
1
- export const ALGORITHM = "AES-GCM";
1
+ import { ALGORITHM, decodeEncryptionKey } from "../utils.js";
2
2
  export const generateRandomAESKey = async () => {
3
3
  // Generate a 256-bit AES-GCM key for file encryption
4
4
  return window.crypto.subtle.generateKey({
@@ -36,13 +36,6 @@ export const encodeEncryptionKey = async (key, iv) => {
36
36
  iv: ivHex,
37
37
  };
38
38
  };
39
- export const decodeEncryptionKey = (encryptionKey) => {
40
- const keyBytes = new Uint8Array(encryptionKey.key
41
- .match(/.{1,2}/g)
42
- .map((byte) => parseInt(byte, 16)));
43
- const ivBytes = new Uint8Array(encryptionKey.iv.match(/.{1,2}/g).map((byte) => parseInt(byte, 16)));
44
- return { key: keyBytes, iv: ivBytes };
45
- };
46
39
  // Helper function to decrypt a file using encoded encryption key
47
40
  export const decrypt = async (encryptedData, encryptionKey) => {
48
41
  try {
@@ -50,7 +43,7 @@ export const decrypt = async (encryptedData, encryptionKey) => {
50
43
  const key = await window.crypto.subtle.importKey("raw", keyBytes, { name: ALGORITHM }, false, ["decrypt"]);
51
44
  const decryptedData = await window.crypto.subtle.decrypt({
52
45
  name: ALGORITHM,
53
- iv,
46
+ iv: iv,
54
47
  }, key, encryptedData);
55
48
  return decryptedData;
56
49
  }
@@ -1,3 +1,4 @@
1
- import { EncryptionKey } from "./encryption.js";
1
+ import { EncryptionKey } from "@/utils.js";
2
2
  export declare const encryptAndUploadFile: (file: File, presignedUrl: string) => Promise<EncryptionKey>;
3
+ export declare const browserDownload: (decryptedFile: File) => void;
3
4
  //# sourceMappingURL=uploads.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"uploads.d.ts","sourceRoot":"","sources":["../../../src/lib/uploads.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,aAAa,EAEd,MAAM,iBAAiB,CAAC;AAEzB,eAAO,MAAM,oBAAoB,SACzB,IAAI,gBACI,MAAM,KACnB,OAAO,CAAC,aAAa,CAkBvB,CAAC"}
1
+ {"version":3,"file":"uploads.d.ts","sourceRoot":"","sources":["../../../src/lib/uploads.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAO3C,eAAO,MAAM,oBAAoB,SACzB,IAAI,gBACI,MAAM,KACnB,OAAO,CAAC,aAAa,CAkBvB,CAAC;AAEF,eAAO,MAAM,eAAe,kBAAmB,IAAI,SASlD,CAAA"}
@@ -15,3 +15,13 @@ export const encryptAndUploadFile = async (file, presignedUrl) => {
15
15
  }
16
16
  return encodeEncryptionKey(encryptionKey, iv);
17
17
  };
18
+ export const browserDownload = (decryptedFile) => {
19
+ const downloadUrl = window.URL.createObjectURL(decryptedFile);
20
+ const a = document.createElement("a");
21
+ a.href = downloadUrl;
22
+ a.download = decryptedFile.name;
23
+ document.body.appendChild(a);
24
+ a.click();
25
+ document.body.removeChild(a);
26
+ window.URL.revokeObjectURL(downloadUrl);
27
+ };
@@ -1,4 +1,4 @@
1
- import { EncryptionKey } from "./lib/encryption.js";
1
+ import { EncryptionKey } from "./utils.js";
2
2
  export interface DialogMessage {
3
3
  type: string;
4
4
  payload?: any;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,OAAO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,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"}
@@ -0,0 +1,12 @@
1
+ export declare const ALGORITHM = "AES-GCM";
2
+ export type Algorithm = "AES-GCM";
3
+ export type EncryptionKey = {
4
+ algorithm: Algorithm;
5
+ key: string;
6
+ iv: string;
7
+ };
8
+ export declare const decodeEncryptionKey: (encryptionKey: EncryptionKey) => {
9
+ key: BufferSource;
10
+ iv: BufferSource;
11
+ };
12
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,SAAS,YAAY,CAAC;AACnC,MAAM,MAAM,SAAS,GAAG,SAAS,CAAC;AAElC,MAAM,MAAM,aAAa,GAAG;IAC1B,SAAS,EAAE,SAAS,CAAC;IACrB,GAAG,EAAE,MAAM,CAAC;IACZ,EAAE,EAAE,MAAM,CAAC;CACZ,CAAC;AAEF,eAAO,MAAM,mBAAmB,kBACf,aAAa,KAC3B;IAAE,GAAG,EAAE,YAAY,CAAC;IAAC,EAAE,EAAE,YAAY,CAAA;CAUvC,CAAC"}
@@ -0,0 +1,8 @@
1
+ export const ALGORITHM = "AES-GCM";
2
+ export const decodeEncryptionKey = (encryptionKey) => {
3
+ const keyBytes = new Uint8Array(encryptionKey.key
4
+ .match(/.{1,2}/g)
5
+ .map((byte) => parseInt(byte, 16)));
6
+ const ivBytes = new Uint8Array(encryptionKey.iv.match(/.{1,2}/g).map((byte) => parseInt(byte, 16)));
7
+ return { key: keyBytes, iv: ivBytes };
8
+ };
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@welshare/react",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
4
4
  "description": "React library for integrating with Welshare's sovereign data sharing platform",
5
5
  "keywords": [
6
6
  "react",
@@ -58,6 +58,7 @@
58
58
  "exports": {
59
59
  "./package.json": "./package.json",
60
60
  "./types": "./src/types.ts",
61
+ "./utils": "./src/utils.ts",
61
62
  ".": "./src/index.ts"
62
63
  }
63
64
  },
@@ -69,6 +70,12 @@
69
70
  "default": "./dist/esm/types.js"
70
71
  }
71
72
  },
73
+ "./utils": {
74
+ "import": {
75
+ "types": "./dist/esm/utils.d.ts",
76
+ "default": "./dist/esm/utils.js"
77
+ }
78
+ },
72
79
  ".": {
73
80
  "import": {
74
81
  "types": "./dist/esm/index.d.ts",
@@ -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 'react';
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: 'unset',
11
- boxSizing: 'border-box',
12
-
11
+ all: "unset",
12
+ boxSizing: "border-box",
13
+
13
14
  // Layout
14
- display: 'inline-flex',
15
- alignItems: 'center',
16
- justifyContent: 'center',
17
- width: '100%',
18
- minHeight: '44px',
19
- padding: '12px 24px',
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: '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif',
23
- fontSize: '16px',
24
- fontWeight: '600',
25
- lineHeight: '1.5',
26
- textAlign: 'center',
27
- textDecoration: 'none',
28
- whiteSpace: 'nowrap',
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: '#0198ff',
32
- background: 'linear-gradient(135deg, #0198ff 0%, #16ffef 100%)',
33
- color: '#ffffff',
34
- border: 'none',
35
- borderRadius: '8px',
36
- cursor: 'pointer',
37
- transition: 'all 0.2s ease-in-out',
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: 'none',
41
- WebkitUserSelect: 'none',
42
- MozUserSelect: 'none',
43
-
42
+ userSelect: "none",
43
+ WebkitUserSelect: "none",
44
+ MozUserSelect: "none",
45
+
44
46
  // Focus states
45
- outline: 'none',
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 = 'translateY(-1px)';
51
- e.currentTarget.style.boxShadow = '0 4px 12px rgba(1, 152, 255, 0.3)';
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 = 'translateY(0)';
56
- e.currentTarget.style.boxShadow = '0 2px 6px rgba(1, 152, 255, 0.2)';
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 = 'translateY(0)';
61
- e.currentTarget.style.boxShadow = '0 2px 6px rgba(1, 152, 255, 0.2)';
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 = '0 0 0 3px rgba(1, 152, 255, 0.3)';
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 = '0 2px 6px rgba(1, 152, 255, 0.2)';
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
- {props.children || "Connect Welshare Profile"}
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
+ };
@@ -1,21 +1,22 @@
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
 
7
8
  export {
8
- decodeEncryptionKey,
9
9
  decrypt,
10
10
  encodeEncryptionKey,
11
11
  encryptFile,
12
- generateRandomAESKey,
13
- type EncryptionKey
12
+ generateRandomAESKey
14
13
  } from "./lib/encryption.js";
15
- export { encryptAndUploadFile } from "./lib/uploads.js";
14
+ export { decodeEncryptionKey, type EncryptionKey } from "./utils.js";
15
+
16
+ export { browserDownload, encryptAndUploadFile } from "./lib/uploads.js";
16
17
  //todo: import them from the SDK or a dedicated SDK constants export
17
18
  export const Schemas = {
18
19
  QuestionnaireResponse: "b14b538f-7de3-4767-ad77-464d755d78bd", //QuestionnaireResponseSchema.schemaUid,
19
20
  ReflexSubmission: "f5cf2d8a-1f78-4f21-b4bd-082e983b830c", //ReflexSubmissionSchema.schemaUid,
20
- BinaryFile: "9d696baf-483f-4cc0-b748-23a22c1705f5" //BinaryFilesSchema.schemaUid,
21
+ BinaryFile: "9d696baf-483f-4cc0-b748-23a22c1705f5", //BinaryFilesSchema.schemaUid,
21
22
  };
@@ -1,5 +1,4 @@
1
- export const ALGORITHM = "AES-GCM";
2
- export type Algorithm = "AES-GCM";
1
+ import { ALGORITHM, EncryptionKey, decodeEncryptionKey } from "../utils.js";
3
2
 
4
3
  export const generateRandomAESKey = async (): Promise<CryptoKey> => {
5
4
  // Generate a 256-bit AES-GCM key for file encryption
@@ -36,12 +35,6 @@ export const encryptFile = async (
36
35
  return { encryptedData, iv };
37
36
  };
38
37
 
39
- export type EncryptionKey = {
40
- algorithm: Algorithm;
41
- key: string;
42
- iv: string;
43
- };
44
-
45
38
  export const encodeEncryptionKey = async (
46
39
  key: CryptoKey,
47
40
  iv: Uint8Array
@@ -63,20 +56,6 @@ export const encodeEncryptionKey = async (
63
56
  };
64
57
  };
65
58
 
66
- export const decodeEncryptionKey = (
67
- encryptionKey: EncryptionKey
68
- ): { key: Uint8Array<ArrayBuffer>; iv: Uint8Array<ArrayBuffer> } => {
69
- const keyBytes = new Uint8Array(
70
- encryptionKey.key
71
- .match(/.{1,2}/g)!
72
- .map((byte: string) => parseInt(byte, 16))
73
- );
74
- const ivBytes = new Uint8Array(
75
- encryptionKey.iv.match(/.{1,2}/g)!.map((byte: string) => parseInt(byte, 16))
76
- );
77
- return { key: keyBytes, iv: ivBytes };
78
- };
79
-
80
59
  // Helper function to decrypt a file using encoded encryption key
81
60
  export const decrypt = async (
82
61
  encryptedData: ArrayBuffer,
@@ -87,7 +66,7 @@ export const decrypt = async (
87
66
 
88
67
  const key = await window.crypto.subtle.importKey(
89
68
  "raw",
90
- keyBytes,
69
+ keyBytes as BufferSource,
91
70
  { name: ALGORITHM },
92
71
  false,
93
72
  ["decrypt"]
@@ -96,7 +75,7 @@ export const decrypt = async (
96
75
  const decryptedData = await window.crypto.subtle.decrypt(
97
76
  {
98
77
  name: ALGORITHM,
99
- iv,
78
+ iv: iv as BufferSource,
100
79
  },
101
80
  key,
102
81
  encryptedData
@@ -1,7 +1,7 @@
1
+ import { EncryptionKey } from "@/utils.js";
1
2
  import {
2
3
  encodeEncryptionKey,
3
4
  encryptFile,
4
- EncryptionKey,
5
5
  generateRandomAESKey,
6
6
  } from "./encryption.js";
7
7
 
@@ -27,3 +27,14 @@ export const encryptAndUploadFile = async (
27
27
 
28
28
  return encodeEncryptionKey(encryptionKey, iv);
29
29
  };
30
+
31
+ export const browserDownload = (decryptedFile: File) => {
32
+ const downloadUrl = window.URL.createObjectURL(decryptedFile);
33
+ const a = document.createElement("a");
34
+ a.href = downloadUrl;
35
+ a.download = decryptedFile.name;
36
+ document.body.appendChild(a);
37
+ a.click();
38
+ document.body.removeChild(a);
39
+ window.URL.revokeObjectURL(downloadUrl);
40
+ }
@@ -1,4 +1,4 @@
1
- import { EncryptionKey } from "./lib/encryption.js";
1
+ import { EncryptionKey } from "./utils.js";
2
2
 
3
3
  export interface DialogMessage {
4
4
  type: string;
@@ -0,0 +1,22 @@
1
+ export const ALGORITHM = "AES-GCM";
2
+ export type Algorithm = "AES-GCM";
3
+
4
+ export type EncryptionKey = {
5
+ algorithm: Algorithm;
6
+ key: string;
7
+ iv: string;
8
+ };
9
+
10
+ export const decodeEncryptionKey = (
11
+ encryptionKey: EncryptionKey
12
+ ): { key: BufferSource; iv: BufferSource } => {
13
+ const keyBytes = new Uint8Array(
14
+ encryptionKey.key
15
+ .match(/.{1,2}/g)!
16
+ .map((byte: string) => parseInt(byte, 16))
17
+ );
18
+ const ivBytes = new Uint8Array(
19
+ encryptionKey.iv.match(/.{1,2}/g)!.map((byte: string) => parseInt(byte, 16))
20
+ );
21
+ return { key: keyBytes, iv: ivBytes };
22
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@welshare/react",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
4
4
  "description": "React library for integrating with Welshare's sovereign data sharing platform",
5
5
  "keywords": [
6
6
  "react",
@@ -49,6 +49,7 @@
49
49
  "exports": {
50
50
  "./package.json": "./package.json",
51
51
  "./types": "./src/types.ts",
52
+ "./utils": "./src/utils.ts",
52
53
  ".": "./src/index.ts"
53
54
  }
54
55
  },
@@ -60,6 +61,12 @@
60
61
  "default": "./dist/esm/types.js"
61
62
  }
62
63
  },
64
+ "./utils": {
65
+ "import": {
66
+ "types": "./dist/esm/utils.d.ts",
67
+ "default": "./dist/esm/utils.js"
68
+ }
69
+ },
63
70
  ".": {
64
71
  "import": {
65
72
  "types": "./dist/esm/index.d.ts",