@prosopo/procaptcha-react 0.2.29 → 0.2.32
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/cjs/components/CaptchaComponent.cjs +41 -64
- package/dist/cjs/components/CaptchaWidget.cjs +37 -43
- package/dist/cjs/components/ExtensionAccountSelect.cjs +26 -26
- package/dist/cjs/components/Procaptcha.cjs +134 -140
- package/dist/cjs/components/theme.cjs +12 -27
- package/dist/components/CaptchaComponent.d.ts.map +1 -1
- package/dist/components/CaptchaComponent.js +43 -43
- package/dist/components/CaptchaComponent.js.map +1 -1
- package/dist/components/CaptchaPlaceholder.d.ts +6 -0
- package/dist/components/CaptchaPlaceholder.d.ts.map +1 -0
- package/dist/components/CaptchaPlaceholder.js +77 -0
- package/dist/components/CaptchaPlaceholder.js.map +1 -0
- package/dist/components/Procaptcha.d.ts +5 -6
- package/dist/components/Procaptcha.d.ts.map +1 -1
- package/dist/components/Procaptcha.js +6 -168
- package/dist/components/Procaptcha.js.map +1 -1
- package/dist/components/ProcaptchaWidget.d.ts +8 -0
- package/dist/components/ProcaptchaWidget.d.ts.map +1 -0
- package/dist/components/ProcaptchaWidget.js +170 -0
- package/dist/components/ProcaptchaWidget.js.map +1 -0
- package/dist/components/index.d.ts +2 -0
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +2 -0
- package/dist/components/index.js.map +1 -1
- package/package.json +7 -9
- package/dist/cjs/components/Button.cjs +0 -68
- package/dist/cjs/components/Checkbox.cjs +0 -56
- package/dist/cjs/components/LoadingSpinner.cjs +0 -30
- package/dist/cjs/components/Modal.cjs +0 -35
- package/dist/cjs/components/collector.cjs +0 -25
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prosopo/procaptcha-react",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.32",
|
|
4
4
|
"author": "PROSOPO LIMITED <info@prosopo.io>",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -35,17 +35,15 @@
|
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"@emotion/react": "^11.11.1",
|
|
37
37
|
"@emotion/styled": "^11.11.0",
|
|
38
|
-
"@mui/icons-material": "^5.14.3",
|
|
39
|
-
"@mui/material": "^5.14.5",
|
|
40
38
|
"@polkadot/extension-dapp": "0.46.6",
|
|
41
39
|
"@polkadot/extension-inject": "0.46.6",
|
|
42
|
-
"@
|
|
43
|
-
"@prosopo/common": "0.2.
|
|
44
|
-
"@prosopo/procaptcha": "0.2.
|
|
45
|
-
"
|
|
40
|
+
"@prosopo/api": "0.2.32",
|
|
41
|
+
"@prosopo/common": "0.2.32",
|
|
42
|
+
"@prosopo/procaptcha": "0.2.32",
|
|
43
|
+
"@prosopo/types": "0.2.32",
|
|
44
|
+
"@prosopo/util": "0.2.32",
|
|
46
45
|
"react": "^18.2.0",
|
|
47
|
-
"react-dom": "^18.2.0"
|
|
48
|
-
"zod": "^3.22.3"
|
|
46
|
+
"react-dom": "^18.2.0"
|
|
49
47
|
},
|
|
50
48
|
"devDependencies": {
|
|
51
49
|
"tslib": "2.6.2",
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
const jsxRuntime = require("@emotion/react/jsx-runtime");
|
|
3
|
-
const theme = require("./theme.cjs");
|
|
4
|
-
const React = require("react");
|
|
5
|
-
const index = require("../util/index.cjs");
|
|
6
|
-
const buttonStyleBase = {
|
|
7
|
-
display: "inline-flex",
|
|
8
|
-
alignItems: "center",
|
|
9
|
-
justifyContent: "center",
|
|
10
|
-
position: "relative",
|
|
11
|
-
boxSizing: "border-box",
|
|
12
|
-
outline: "0px",
|
|
13
|
-
border: "0px",
|
|
14
|
-
margin: "0px",
|
|
15
|
-
cursor: "pointer",
|
|
16
|
-
userSelect: "none",
|
|
17
|
-
verticalAlign: "middle",
|
|
18
|
-
appearance: void 0,
|
|
19
|
-
textDecoration: "none",
|
|
20
|
-
fontWeight: "500",
|
|
21
|
-
fontSize: "0.875rem",
|
|
22
|
-
lineHeight: "1.75",
|
|
23
|
-
letterSpacing: "0.02857em",
|
|
24
|
-
textTransform: "uppercase",
|
|
25
|
-
minWidth: "64px",
|
|
26
|
-
padding: "6px 16px",
|
|
27
|
-
borderRadius: "4px",
|
|
28
|
-
transition: "background-color 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms, box-shadow 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms, border-color 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms, color 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms",
|
|
29
|
-
color: "rgb(0, 0, 0)",
|
|
30
|
-
backgroundColor: "#ffffff",
|
|
31
|
-
boxShadow: "rgba(0, 0, 0, 0.2) 0px 3px 1px -2px, rgba(0, 0, 0, 0.14) 0px 2px 2px 0px, rgba(0, 0, 0, 0.12) 0px 1px 5px 0px"
|
|
32
|
-
};
|
|
33
|
-
const Button = ({ themeColor, buttonType, text, onClick }) => {
|
|
34
|
-
const theme$1 = React.useMemo(() => themeColor === "light" ? theme.lightTheme : theme.darkTheme, [themeColor]);
|
|
35
|
-
const [hover, setHover] = React.useState(false);
|
|
36
|
-
const buttonStyle = React.useMemo(() => {
|
|
37
|
-
const baseStyle = {
|
|
38
|
-
...buttonStyleBase,
|
|
39
|
-
color: hover ? theme$1.palette.primary.contrastText : theme$1.palette.background.contrastText
|
|
40
|
-
};
|
|
41
|
-
if (buttonType === "cancel") {
|
|
42
|
-
return {
|
|
43
|
-
...baseStyle,
|
|
44
|
-
backgroundColor: hover ? theme$1.palette.grey[600] : "transparent"
|
|
45
|
-
};
|
|
46
|
-
} else {
|
|
47
|
-
return {
|
|
48
|
-
...baseStyle,
|
|
49
|
-
backgroundColor: hover ? theme$1.palette.primary.main : theme$1.palette.background.default
|
|
50
|
-
};
|
|
51
|
-
}
|
|
52
|
-
}, [buttonType, hover, theme$1]);
|
|
53
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
54
|
-
"button",
|
|
55
|
-
{
|
|
56
|
-
...index({ dev: { cy: `button-${buttonType}` } }),
|
|
57
|
-
onMouseEnter: () => setHover(true),
|
|
58
|
-
onMouseLeave: () => setHover(false),
|
|
59
|
-
style: buttonStyle,
|
|
60
|
-
onClick: (e) => {
|
|
61
|
-
e.preventDefault();
|
|
62
|
-
onClick();
|
|
63
|
-
},
|
|
64
|
-
children: text
|
|
65
|
-
}
|
|
66
|
-
);
|
|
67
|
-
};
|
|
68
|
-
module.exports = Button;
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
const jsxRuntime = require("@emotion/react/jsx-runtime");
|
|
3
|
-
const react = require("@emotion/react");
|
|
4
|
-
const theme = require("./theme.cjs");
|
|
5
|
-
const React = require("react");
|
|
6
|
-
const checkboxBefore = react.css`{
|
|
7
|
-
&:before {
|
|
8
|
-
content: '""';
|
|
9
|
-
position: absolute;
|
|
10
|
-
height: 100%;
|
|
11
|
-
width: 100%;
|
|
12
|
-
}
|
|
13
|
-
}`;
|
|
14
|
-
const baseStyle = {
|
|
15
|
-
width: "2.2em",
|
|
16
|
-
height: "2.2em",
|
|
17
|
-
top: "auto",
|
|
18
|
-
left: "auto",
|
|
19
|
-
opacity: "1",
|
|
20
|
-
borderRadius: "12.5%",
|
|
21
|
-
appearance: "none",
|
|
22
|
-
cursor: "pointer",
|
|
23
|
-
margin: "0",
|
|
24
|
-
borderStyle: "solid",
|
|
25
|
-
borderWidth: "1px"
|
|
26
|
-
};
|
|
27
|
-
const Checkbox = ({ themeColor, onChange, checked }) => {
|
|
28
|
-
const theme$1 = React.useMemo(() => themeColor === "light" ? theme.lightTheme : theme.darkTheme, [themeColor]);
|
|
29
|
-
const checkboxStyleBase = {
|
|
30
|
-
...baseStyle,
|
|
31
|
-
border: `1px solid ${theme$1.palette.background.contrastText}`
|
|
32
|
-
};
|
|
33
|
-
const [hover, setHover] = React.useState(false);
|
|
34
|
-
const checkboxStyle = React.useMemo(() => {
|
|
35
|
-
return {
|
|
36
|
-
...checkboxStyleBase,
|
|
37
|
-
borderColor: hover ? theme$1.palette.background.contrastText : theme$1.palette.grey[400],
|
|
38
|
-
appearance: checked ? "auto" : "none"
|
|
39
|
-
};
|
|
40
|
-
}, [hover, theme$1, checked]);
|
|
41
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
42
|
-
"input",
|
|
43
|
-
{
|
|
44
|
-
onMouseEnter: () => setHover(true),
|
|
45
|
-
onMouseLeave: () => setHover(false),
|
|
46
|
-
css: checkboxBefore,
|
|
47
|
-
type: "checkbox",
|
|
48
|
-
"aria-live": "assertive",
|
|
49
|
-
"aria-haspopup": "true",
|
|
50
|
-
onChange,
|
|
51
|
-
checked,
|
|
52
|
-
style: checkboxStyle
|
|
53
|
-
}
|
|
54
|
-
);
|
|
55
|
-
};
|
|
56
|
-
module.exports = Checkbox;
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
3
|
-
const jsxRuntime = require("@emotion/react/jsx-runtime");
|
|
4
|
-
const theme = require("./theme.cjs");
|
|
5
|
-
const React = require("react");
|
|
6
|
-
const styled = require("@emotion/styled");
|
|
7
|
-
const LoadingSpinner = ({ themeColor }) => {
|
|
8
|
-
const theme$1 = React.useMemo(() => themeColor === "light" ? theme.lightTheme : theme.darkTheme, [themeColor]);
|
|
9
|
-
const StyledDiv = styled.div`
|
|
10
|
-
width: 2em;
|
|
11
|
-
height: 2em;
|
|
12
|
-
border: 4px solid ${theme$1.palette.background.contrastText};
|
|
13
|
-
border-bottom-color: transparent;
|
|
14
|
-
border-radius: 50%;
|
|
15
|
-
display: inherit;
|
|
16
|
-
box-sizing: border-box;
|
|
17
|
-
animation: rotation 1s linear infinite;
|
|
18
|
-
@keyframes rotation {
|
|
19
|
-
0% {
|
|
20
|
-
transform: rotate(0deg);
|
|
21
|
-
}
|
|
22
|
-
100% {
|
|
23
|
-
transform: rotate(360deg);
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
`;
|
|
27
|
-
return /* @__PURE__ */ jsxRuntime.jsx(StyledDiv, {});
|
|
28
|
-
};
|
|
29
|
-
exports.LoadingSpinner = LoadingSpinner;
|
|
30
|
-
exports.default = LoadingSpinner;
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
const jsxRuntime = require("@emotion/react/jsx-runtime");
|
|
3
|
-
const React = require("react");
|
|
4
|
-
const ModalComponent = React.memo((props, nextProps) => {
|
|
5
|
-
const { show, children } = props;
|
|
6
|
-
console.log("rendering modal with show: ", show);
|
|
7
|
-
const display = show ? "flex" : "none";
|
|
8
|
-
const ModalOuterDivCss = {
|
|
9
|
-
overflow: "auto",
|
|
10
|
-
width: "100%",
|
|
11
|
-
maxHeight: "100%",
|
|
12
|
-
position: "fixed",
|
|
13
|
-
top: "0",
|
|
14
|
-
left: "0",
|
|
15
|
-
height: "100%",
|
|
16
|
-
background: "rgba(0, 0, 0, 0.6)",
|
|
17
|
-
zIndex: "2147483646",
|
|
18
|
-
transition: "all 0.5s",
|
|
19
|
-
display
|
|
20
|
-
};
|
|
21
|
-
const ModalInnerDivCSS = {
|
|
22
|
-
maxWidth: "500px",
|
|
23
|
-
margin: "auto",
|
|
24
|
-
position: "fixed",
|
|
25
|
-
background: "white",
|
|
26
|
-
height: "auto",
|
|
27
|
-
top: "50%",
|
|
28
|
-
left: "50%",
|
|
29
|
-
transform: "translate(-50%, -50%)",
|
|
30
|
-
zIndex: "2147483647",
|
|
31
|
-
transition: "all 0.5s"
|
|
32
|
-
};
|
|
33
|
-
return /* @__PURE__ */ jsxRuntime.jsx("div", { style: ModalOuterDivCss, children: /* @__PURE__ */ jsxRuntime.jsx("div", { style: ModalInnerDivCSS, children }) });
|
|
34
|
-
});
|
|
35
|
-
module.exports = ModalComponent;
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
const jsxRuntime = require("@emotion/react/jsx-runtime");
|
|
3
|
-
const React = require("react");
|
|
4
|
-
const procaptcha = require("@prosopo/procaptcha");
|
|
5
|
-
const Collector = ({ onProcessData, sendData }) => {
|
|
6
|
-
const [mouseEvents, setStoredMouseEvents] = React.useState([]);
|
|
7
|
-
const [touchEvents, setStoredTouchEvents] = React.useState([]);
|
|
8
|
-
const [keyboardEvents, setStoredKeyboardEvents] = React.useState([]);
|
|
9
|
-
const ref = React.useRef(null);
|
|
10
|
-
React.useEffect(() => {
|
|
11
|
-
if (ref && ref.current) {
|
|
12
|
-
procaptcha.startCollector(setStoredMouseEvents, setStoredTouchEvents, setStoredKeyboardEvents, ref.current);
|
|
13
|
-
}
|
|
14
|
-
}, []);
|
|
15
|
-
React.useEffect(() => {
|
|
16
|
-
const userEvents = {
|
|
17
|
-
mouseEvents,
|
|
18
|
-
touchEvents,
|
|
19
|
-
keyboardEvents
|
|
20
|
-
};
|
|
21
|
-
onProcessData(userEvents);
|
|
22
|
-
}, [sendData]);
|
|
23
|
-
return /* @__PURE__ */ jsxRuntime.jsx("div", { ref });
|
|
24
|
-
};
|
|
25
|
-
module.exports = Collector;
|