@prosopo/procaptcha-common 2.11.17 → 2.11.19
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/.turbo/turbo-build$colon$cjs.log +22 -20
- package/.turbo/turbo-build$colon$tsc.log +18 -18
- package/.turbo/turbo-build.log +23 -19
- package/CHANGELOG.md +33 -0
- package/dist/_virtual/_rolldown/runtime.js +3 -0
- package/dist/callbacks/defaultCallbacks.js +100 -152
- package/dist/callbacks/defaultEvents.js +6 -6
- package/dist/cjs/_virtual/_rolldown/runtime.cjs +23 -0
- package/dist/cjs/callbacks/defaultCallbacks.cjs +100 -151
- package/dist/cjs/callbacks/defaultEvents.cjs +6 -6
- package/dist/cjs/elements/form.cjs +10 -17
- package/dist/cjs/elements/window.cjs +17 -15
- package/dist/cjs/extensionLoader.cjs +3 -25
- package/dist/cjs/index.cjs +29 -27
- package/dist/cjs/providers.cjs +29 -42
- package/dist/cjs/reactComponents/Checkbox.cjs +102 -121
- package/dist/cjs/reactComponents/Honeypot.cjs +54 -62
- package/dist/cjs/reactComponents/Reload.cjs +59 -80
- package/dist/cjs/reactComponents/TestModeBanner.cjs +31 -44
- package/dist/cjs/simdReadings.cjs +24 -0
- package/dist/cjs/state/builder.cjs +70 -83
- package/dist/elements/form.js +10 -18
- package/dist/elements/window.js +18 -17
- package/dist/extensionLoader.js +4 -4
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -19
- package/dist/index.js.map +1 -1
- package/dist/providers.js +29 -45
- package/dist/reactComponents/Checkbox.js +99 -121
- package/dist/reactComponents/Honeypot.js +53 -61
- package/dist/reactComponents/Reload.js +58 -80
- package/dist/reactComponents/TestModeBanner.js +30 -45
- package/dist/simdReadings.d.ts +6 -0
- package/dist/simdReadings.d.ts.map +1 -0
- package/dist/simdReadings.js +23 -0
- package/dist/simdReadings.js.map +1 -0
- package/dist/state/builder.js +71 -85
- package/dist/tests/simdReadings.test.d.ts +2 -0
- package/dist/tests/simdReadings.test.d.ts.map +1 -0
- package/dist/tests/simdReadings.test.js +76 -0
- package/dist/tests/simdReadings.test.js.map +1 -0
- package/package.json +8 -8
- package/src/index.ts +1 -0
- package/src/simdReadings.ts +45 -0
- package/src/tests/simdReadings.test.ts +149 -0
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
const require_runtime = require("../_virtual/_rolldown/runtime.cjs");
|
|
2
|
+
let _prosopo_widget_skeleton = require("@prosopo/widget-skeleton");
|
|
3
|
+
let react = require("react");
|
|
4
|
+
let _emotion_react_jsx_runtime = require("@emotion/react/jsx-runtime");
|
|
5
|
+
let _emotion_react = require("@emotion/react");
|
|
6
|
+
let _emotion_styled = require("@emotion/styled");
|
|
7
|
+
_emotion_styled = require_runtime.__toESM(_emotion_styled, 1);
|
|
8
|
+
//#region src/reactComponents/Checkbox.tsx
|
|
9
|
+
var checkboxBefore = _emotion_react.css`{
|
|
9
10
|
&:before {
|
|
10
11
|
content: '""';
|
|
11
12
|
position: absolute;
|
|
@@ -13,43 +14,33 @@ const checkboxBefore = react.css`{
|
|
|
13
14
|
width: 100%;
|
|
14
15
|
}
|
|
15
16
|
}`;
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
17
|
+
var baseStyle = {
|
|
18
|
+
width: "28px",
|
|
19
|
+
height: "28px",
|
|
20
|
+
minWidth: "14px",
|
|
21
|
+
minHeight: "14px",
|
|
22
|
+
top: "auto",
|
|
23
|
+
left: "auto",
|
|
24
|
+
opacity: "1",
|
|
25
|
+
borderRadius: "12.5%",
|
|
26
|
+
appearance: "none",
|
|
27
|
+
cursor: "pointer",
|
|
28
|
+
margin: "0",
|
|
29
|
+
borderStyle: "solid",
|
|
30
|
+
borderWidth: "1px"
|
|
30
31
|
};
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
{ length: 8 },
|
|
36
|
-
() => ID_LETTERS[Math.floor(Math.random() * ID_LETTERS.length)]
|
|
37
|
-
).join("");
|
|
32
|
+
var ID_LETTERS = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
|
33
|
+
var FAQ_LINK = process.env.PROSOPO_DOCS_URL ? `${new URL(`${process.env.PROSOPO_DOCS_URL}/en/basics/faq/`).href}/` : "https://docs.prosopo.io/en/basics/faq/";
|
|
34
|
+
var generateRandomId = () => {
|
|
35
|
+
return Array.from({ length: 8 }, () => ID_LETTERS[Math.floor(Math.random() * ID_LETTERS.length)]).join("");
|
|
38
36
|
};
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
}) => {
|
|
47
|
-
const checkboxStyleBase = {
|
|
48
|
-
...baseStyle,
|
|
49
|
-
border: `1px solid ${theme.palette.background.contrastText}`
|
|
50
|
-
};
|
|
51
|
-
const [hover, setHover] = react$1.useState(false);
|
|
52
|
-
const ResponsiveLabel = styled.label`
|
|
37
|
+
var Checkbox = ({ theme, onChange, checked, labelText, error, loading }) => {
|
|
38
|
+
const checkboxStyleBase = {
|
|
39
|
+
...baseStyle,
|
|
40
|
+
border: `1px solid ${theme.palette.background.contrastText}`
|
|
41
|
+
};
|
|
42
|
+
const [hover, setHover] = (0, react.useState)(false);
|
|
43
|
+
const ResponsiveLabel = _emotion_styled.default.label`
|
|
53
44
|
color: ${theme.palette.background.contrastText};
|
|
54
45
|
position: relative;
|
|
55
46
|
display: flex !important;
|
|
@@ -73,84 +64,74 @@ const Checkbox = ({
|
|
|
73
64
|
font-size: 16px;
|
|
74
65
|
}
|
|
75
66
|
`;
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
{
|
|
144
|
-
css: {
|
|
145
|
-
color: theme.palette.error.main
|
|
146
|
-
},
|
|
147
|
-
href: FAQ_LINK,
|
|
148
|
-
children: error
|
|
149
|
-
}
|
|
150
|
-
) }) : /* @__PURE__ */ jsxRuntime.jsx(ResponsiveLabel, { htmFor: id, children: labelText })
|
|
151
|
-
]
|
|
152
|
-
}
|
|
153
|
-
);
|
|
67
|
+
const checkboxStyle = (0, react.useMemo)(() => {
|
|
68
|
+
return {
|
|
69
|
+
...checkboxStyleBase,
|
|
70
|
+
borderColor: hover ? theme.palette.background.contrastText : theme.palette.border,
|
|
71
|
+
appearance: checked ? "auto" : "none",
|
|
72
|
+
flex: 1,
|
|
73
|
+
margin: "15px",
|
|
74
|
+
minWidth: "28px",
|
|
75
|
+
minHeight: "28px"
|
|
76
|
+
};
|
|
77
|
+
}, [
|
|
78
|
+
hover,
|
|
79
|
+
theme,
|
|
80
|
+
checked
|
|
81
|
+
]);
|
|
82
|
+
const id = generateRandomId();
|
|
83
|
+
return /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsxs)("span", {
|
|
84
|
+
style: {
|
|
85
|
+
display: "inline-flex",
|
|
86
|
+
alignItems: "center",
|
|
87
|
+
minHeight: "58px"
|
|
88
|
+
},
|
|
89
|
+
children: [loading ? /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)("div", {
|
|
90
|
+
className: _prosopo_widget_skeleton.WIDGET_CHECKBOX_SPINNER_CSS_CLASS,
|
|
91
|
+
"aria-label": "Loading spinner"
|
|
92
|
+
}) : /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)("input", {
|
|
93
|
+
name: id,
|
|
94
|
+
id,
|
|
95
|
+
onMouseEnter: () => setHover(true),
|
|
96
|
+
onMouseLeave: () => setHover(false),
|
|
97
|
+
css: checkboxBefore,
|
|
98
|
+
type: "checkbox",
|
|
99
|
+
"aria-live": "assertive",
|
|
100
|
+
"aria-label": labelText,
|
|
101
|
+
onKeyDown: (e) => {
|
|
102
|
+
if (!e.isTrusted) return;
|
|
103
|
+
if (e.key === "Enter") {
|
|
104
|
+
e.preventDefault();
|
|
105
|
+
e.stopPropagation();
|
|
106
|
+
setHover(false);
|
|
107
|
+
onChange(e);
|
|
108
|
+
}
|
|
109
|
+
},
|
|
110
|
+
onChange: (e) => {
|
|
111
|
+
if (!e.isTrusted) return;
|
|
112
|
+
e.preventDefault();
|
|
113
|
+
e.stopPropagation();
|
|
114
|
+
setHover(false);
|
|
115
|
+
onChange(e);
|
|
116
|
+
},
|
|
117
|
+
checked,
|
|
118
|
+
style: checkboxStyle,
|
|
119
|
+
disabled: error !== void 0,
|
|
120
|
+
className: loading ? "prosopo-checkbox__loading-spinner" : "",
|
|
121
|
+
"data-cy": "captcha-checkbox"
|
|
122
|
+
}), error ? /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)(ResponsiveLabel, {
|
|
123
|
+
htmFor: id,
|
|
124
|
+
children: /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)("a", {
|
|
125
|
+
css: { color: theme.palette.error.main },
|
|
126
|
+
href: FAQ_LINK,
|
|
127
|
+
children: error
|
|
128
|
+
})
|
|
129
|
+
}) : /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)(ResponsiveLabel, {
|
|
130
|
+
htmFor: id,
|
|
131
|
+
children: labelText
|
|
132
|
+
})]
|
|
133
|
+
});
|
|
154
134
|
};
|
|
135
|
+
//#endregion
|
|
155
136
|
exports.Checkbox = Checkbox;
|
|
156
137
|
exports.default = Checkbox;
|
|
@@ -1,67 +1,59 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
opacity: 0
|
|
1
|
+
let react = require("react");
|
|
2
|
+
let _emotion_react_jsx_runtime = require("@emotion/react/jsx-runtime");
|
|
3
|
+
let react_dom = require("react-dom");
|
|
4
|
+
//#region src/reactComponents/Honeypot.tsx
|
|
5
|
+
var offscreenStyle = {
|
|
6
|
+
position: "absolute",
|
|
7
|
+
left: "-9999px",
|
|
8
|
+
top: "-9999px",
|
|
9
|
+
width: "1px",
|
|
10
|
+
height: "1px",
|
|
11
|
+
overflow: "hidden",
|
|
12
|
+
opacity: 0
|
|
14
13
|
};
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
14
|
+
var decodeBase64Utf8 = (b64) => {
|
|
15
|
+
const binary = atob(b64);
|
|
16
|
+
const bytes = Uint8Array.from(binary, (c) => c.charCodeAt(0));
|
|
17
|
+
return new TextDecoder().decode(bytes);
|
|
19
18
|
};
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
19
|
+
var findAncestorForm = (anchor) => {
|
|
20
|
+
const root = anchor.getRootNode();
|
|
21
|
+
const lightDomEntry = root instanceof ShadowRoot ? root.host : anchor;
|
|
22
|
+
return lightDomEntry instanceof Element ? lightDomEntry.closest("form") : null;
|
|
24
23
|
};
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
"aria-hidden": "true"
|
|
59
|
-
}
|
|
60
|
-
)
|
|
61
|
-
] }) }),
|
|
62
|
-
portalTarget
|
|
63
|
-
);
|
|
64
|
-
}
|
|
65
|
-
);
|
|
24
|
+
var Honeypot = (0, react.forwardRef)(({ encodedQuestion }, ref) => {
|
|
25
|
+
const id = (0, react.useId)();
|
|
26
|
+
const detachedFormId = `${id}-d`;
|
|
27
|
+
const question = (0, react.useMemo)(() => decodeBase64Utf8(encodedQuestion), [encodedQuestion]);
|
|
28
|
+
const anchorRef = (0, react.useRef)(null);
|
|
29
|
+
const [portalTarget, setPortalTarget] = (0, react.useState)(null);
|
|
30
|
+
(0, react.useEffect)(() => {
|
|
31
|
+
const anchor = anchorRef.current;
|
|
32
|
+
if (!anchor) return;
|
|
33
|
+
setPortalTarget(findAncestorForm(anchor) ?? document.body);
|
|
34
|
+
}, []);
|
|
35
|
+
if (typeof document === "undefined") return null;
|
|
36
|
+
if (!portalTarget) return /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)("span", {
|
|
37
|
+
ref: anchorRef,
|
|
38
|
+
"aria-hidden": "true",
|
|
39
|
+
style: { display: "none" }
|
|
40
|
+
});
|
|
41
|
+
return (0, react_dom.createPortal)(/* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)("div", {
|
|
42
|
+
"aria-hidden": "true",
|
|
43
|
+
style: offscreenStyle,
|
|
44
|
+
children: /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsxs)("label", { children: [question, /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)("input", {
|
|
45
|
+
ref,
|
|
46
|
+
id,
|
|
47
|
+
form: detachedFormId,
|
|
48
|
+
type: "text",
|
|
49
|
+
name: "email_confirm",
|
|
50
|
+
defaultValue: "",
|
|
51
|
+
tabIndex: -1,
|
|
52
|
+
autoComplete: "off",
|
|
53
|
+
"aria-hidden": "true"
|
|
54
|
+
})] })
|
|
55
|
+
}), portalTarget);
|
|
56
|
+
});
|
|
66
57
|
Honeypot.displayName = "Honeypot";
|
|
58
|
+
//#endregion
|
|
67
59
|
exports.Honeypot = Honeypot;
|
|
@@ -1,83 +1,62 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
display: "flex"
|
|
1
|
+
let _prosopo_widget_skeleton = require("@prosopo/widget-skeleton");
|
|
2
|
+
let react = require("react");
|
|
3
|
+
let _emotion_react_jsx_runtime = require("@emotion/react/jsx-runtime");
|
|
4
|
+
//#region src/reactComponents/Reload.tsx
|
|
5
|
+
var buttonStyleBase = {
|
|
6
|
+
border: "none",
|
|
7
|
+
paddingTop: "6px",
|
|
8
|
+
paddingBottom: "6px",
|
|
9
|
+
cursor: "pointer",
|
|
10
|
+
height: "39px",
|
|
11
|
+
width: "39px",
|
|
12
|
+
borderRadius: "50%",
|
|
13
|
+
display: "flex"
|
|
15
14
|
};
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
viewBox: "0 0 16 16",
|
|
62
|
-
version: "1.1",
|
|
63
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
64
|
-
xmlnsXlink: "http://www.w3.org/1999/xlink",
|
|
65
|
-
style: { display: "flex" },
|
|
66
|
-
children: [
|
|
67
|
-
/* @__PURE__ */ jsxRuntime.jsx("title", { children: "reload" }),
|
|
68
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
69
|
-
"path",
|
|
70
|
-
{
|
|
71
|
-
shapeRendering: "optimizeQuality",
|
|
72
|
-
fill: hover ? theme.palette.primary.contrastText : theme.palette.grey[700],
|
|
73
|
-
transform: "scale(0.0416)",
|
|
74
|
-
d: "M234.666667,149.333333 L234.666667,106.666667 L314.564847,106.664112 C287.579138,67.9778918 242.745446,42.6666667 192,42.6666667 C109.525477,42.6666667 42.6666667,109.525477 42.6666667,192 C42.6666667,274.474523 109.525477,341.333333 192,341.333333 C268.201293,341.333333 331.072074,284.258623 340.195444,210.526102 L382.537159,215.817985 C370.807686,310.617565 289.973536,384 192,384 C85.961328,384 1.42108547e-14,298.038672 1.42108547e-14,192 C1.42108547e-14,85.961328 85.961328,1.42108547e-14 192,1.42108547e-14 C252.316171,1.42108547e-14 306.136355,27.8126321 341.335366,71.3127128 L341.333333,1.42108547e-14 L384,1.42108547e-14 L384,149.333333 L234.666667,149.333333 Z"
|
|
75
|
-
}
|
|
76
|
-
)
|
|
77
|
-
]
|
|
78
|
-
}
|
|
79
|
-
)
|
|
80
|
-
}
|
|
81
|
-
);
|
|
15
|
+
var ReloadButton = ({ themeColor, onReload }) => {
|
|
16
|
+
const theme = (0, react.useMemo)(() => themeColor === "light" ? _prosopo_widget_skeleton.lightTheme : _prosopo_widget_skeleton.darkTheme, [themeColor]);
|
|
17
|
+
const [hover, setHover] = (0, react.useState)(false);
|
|
18
|
+
const buttonStyle = (0, react.useMemo)(() => {
|
|
19
|
+
return {
|
|
20
|
+
...buttonStyleBase,
|
|
21
|
+
backgroundColor: theme.palette.background.default,
|
|
22
|
+
color: hover ? theme.palette.primary.contrastText : theme.palette.background.contrastText,
|
|
23
|
+
border: `1px solid ${theme.palette.grey[500]}`,
|
|
24
|
+
borderRadius: "50%",
|
|
25
|
+
transition: "background-color 0.3s",
|
|
26
|
+
boxShadow: `0px 1px 3px 0px ${theme.palette.grey[500]}`,
|
|
27
|
+
justifyContent: "center",
|
|
28
|
+
alignItems: "center",
|
|
29
|
+
margin: "0 auto",
|
|
30
|
+
backgroundColor: hover ? theme.palette.grey[700] : theme.palette.background.default
|
|
31
|
+
};
|
|
32
|
+
}, [hover, theme]);
|
|
33
|
+
return /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)("button", {
|
|
34
|
+
className: "reload-button",
|
|
35
|
+
"aria-label": "Reload",
|
|
36
|
+
type: "button",
|
|
37
|
+
style: buttonStyle,
|
|
38
|
+
onMouseEnter: () => setHover(true),
|
|
39
|
+
onMouseLeave: () => setHover(false),
|
|
40
|
+
onClick: (e) => {
|
|
41
|
+
e.preventDefault();
|
|
42
|
+
onReload();
|
|
43
|
+
},
|
|
44
|
+
children: /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsxs)("svg", {
|
|
45
|
+
width: "16px",
|
|
46
|
+
height: "16px",
|
|
47
|
+
viewBox: "0 0 16 16",
|
|
48
|
+
version: "1.1",
|
|
49
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
50
|
+
xmlnsXlink: "http://www.w3.org/1999/xlink",
|
|
51
|
+
style: { display: "flex" },
|
|
52
|
+
children: [/* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)("title", { children: "reload" }), /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)("path", {
|
|
53
|
+
shapeRendering: "optimizeQuality",
|
|
54
|
+
fill: hover ? theme.palette.primary.contrastText : theme.palette.grey[700],
|
|
55
|
+
transform: "scale(0.0416)",
|
|
56
|
+
d: "M234.666667,149.333333 L234.666667,106.666667 L314.564847,106.664112 C287.579138,67.9778918 242.745446,42.6666667 192,42.6666667 C109.525477,42.6666667 42.6666667,109.525477 42.6666667,192 C42.6666667,274.474523 109.525477,341.333333 192,341.333333 C268.201293,341.333333 331.072074,284.258623 340.195444,210.526102 L382.537159,215.817985 C370.807686,310.617565 289.973536,384 192,384 C85.961328,384 1.42108547e-14,298.038672 1.42108547e-14,192 C1.42108547e-14,85.961328 85.961328,1.42108547e-14 192,1.42108547e-14 C252.316171,1.42108547e-14 306.136355,27.8126321 341.335366,71.3127128 L341.333333,1.42108547e-14 L384,1.42108547e-14 L384,149.333333 L234.666667,149.333333 Z"
|
|
57
|
+
})]
|
|
58
|
+
})
|
|
59
|
+
});
|
|
82
60
|
};
|
|
61
|
+
//#endregion
|
|
83
62
|
exports.ReloadButton = ReloadButton;
|
|
@@ -1,47 +1,34 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
padding: "6px 10px",
|
|
32
|
-
backgroundColor: "#fff3cd",
|
|
33
|
-
color: "#664d03",
|
|
34
|
-
border: "1px solid #ffe69c",
|
|
35
|
-
borderRadius: "4px",
|
|
36
|
-
fontSize: "11px",
|
|
37
|
-
lineHeight: "1.3",
|
|
38
|
-
fontFamily: "-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif",
|
|
39
|
-
textAlign: "center"
|
|
40
|
-
},
|
|
41
|
-
children: `⚠ Test mode: this site key ${action}. Do not use in production.`
|
|
42
|
-
}
|
|
43
|
-
)
|
|
44
|
-
);
|
|
1
|
+
let _prosopo_types = require("@prosopo/types");
|
|
2
|
+
let react = require("react");
|
|
3
|
+
let _emotion_react_jsx_runtime = require("@emotion/react/jsx-runtime");
|
|
4
|
+
//#region src/reactComponents/TestModeBanner.tsx
|
|
5
|
+
/** @jsxImportSource @emotion/react */
|
|
6
|
+
var TestModeBanner = ({ siteKey }) => {
|
|
7
|
+
const mode = (0, _prosopo_types.getTestSiteKeyMode)(siteKey);
|
|
8
|
+
(0, react.useEffect)(() => {
|
|
9
|
+
if (mode !== null) console.warn(`[Procaptcha] WARNING: site key "${siteKey}" is a TEST key that ALWAYS ${mode === _prosopo_types.TestSiteKeyMode.Pass ? "PASSES" : "FAILS"}. Never use it in production.`);
|
|
10
|
+
}, [mode, siteKey]);
|
|
11
|
+
if (mode === null) return null;
|
|
12
|
+
const action = mode === _prosopo_types.TestSiteKeyMode.Pass ? "ALWAYS PASSES" : "ALWAYS FAILS";
|
|
13
|
+
return /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)("div", {
|
|
14
|
+
role: "alert",
|
|
15
|
+
"data-cy": "test-mode-banner",
|
|
16
|
+
css: {
|
|
17
|
+
width: "100%",
|
|
18
|
+
boxSizing: "border-box",
|
|
19
|
+
padding: "6px 10px",
|
|
20
|
+
backgroundColor: "#fff3cd",
|
|
21
|
+
color: "#664d03",
|
|
22
|
+
border: "1px solid #ffe69c",
|
|
23
|
+
borderRadius: "4px",
|
|
24
|
+
fontSize: "11px",
|
|
25
|
+
lineHeight: "1.3",
|
|
26
|
+
fontFamily: "-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif",
|
|
27
|
+
textAlign: "center"
|
|
28
|
+
},
|
|
29
|
+
children: `⚠ Test mode: this site key ${action}. Do not use in production.`
|
|
30
|
+
});
|
|
45
31
|
};
|
|
32
|
+
//#endregion
|
|
46
33
|
exports.TestModeBanner = TestModeBanner;
|
|
47
34
|
exports.default = TestModeBanner;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
//#region src/simdReadings.ts
|
|
2
|
+
var SIMD_READINGS_SUBMIT_TIMEOUT_MS = 5e3;
|
|
3
|
+
var getSimdReadingsForSubmit = async (source, timeoutMs = SIMD_READINGS_SUBMIT_TIMEOUT_MS) => {
|
|
4
|
+
if (!source?.getSimdReadings) return void 0;
|
|
5
|
+
const { getSimdReadings } = source;
|
|
6
|
+
let readings;
|
|
7
|
+
try {
|
|
8
|
+
readings = Promise.resolve(getSimdReadings.call(source, timeoutMs));
|
|
9
|
+
} catch {
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
12
|
+
let timeoutId;
|
|
13
|
+
const timeout = new Promise((resolve) => {
|
|
14
|
+
timeoutId = setTimeout(() => resolve(void 0), timeoutMs);
|
|
15
|
+
});
|
|
16
|
+
try {
|
|
17
|
+
return await Promise.race([readings.catch(() => void 0), timeout]);
|
|
18
|
+
} finally {
|
|
19
|
+
if (timeoutId !== void 0) clearTimeout(timeoutId);
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
//#endregion
|
|
23
|
+
exports.SIMD_READINGS_SUBMIT_TIMEOUT_MS = SIMD_READINGS_SUBMIT_TIMEOUT_MS;
|
|
24
|
+
exports.getSimdReadingsForSubmit = getSimdReadingsForSubmit;
|