@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.
Files changed (47) hide show
  1. package/.turbo/turbo-build$colon$cjs.log +22 -20
  2. package/.turbo/turbo-build$colon$tsc.log +18 -18
  3. package/.turbo/turbo-build.log +23 -19
  4. package/CHANGELOG.md +33 -0
  5. package/dist/_virtual/_rolldown/runtime.js +3 -0
  6. package/dist/callbacks/defaultCallbacks.js +100 -152
  7. package/dist/callbacks/defaultEvents.js +6 -6
  8. package/dist/cjs/_virtual/_rolldown/runtime.cjs +23 -0
  9. package/dist/cjs/callbacks/defaultCallbacks.cjs +100 -151
  10. package/dist/cjs/callbacks/defaultEvents.cjs +6 -6
  11. package/dist/cjs/elements/form.cjs +10 -17
  12. package/dist/cjs/elements/window.cjs +17 -15
  13. package/dist/cjs/extensionLoader.cjs +3 -25
  14. package/dist/cjs/index.cjs +29 -27
  15. package/dist/cjs/providers.cjs +29 -42
  16. package/dist/cjs/reactComponents/Checkbox.cjs +102 -121
  17. package/dist/cjs/reactComponents/Honeypot.cjs +54 -62
  18. package/dist/cjs/reactComponents/Reload.cjs +59 -80
  19. package/dist/cjs/reactComponents/TestModeBanner.cjs +31 -44
  20. package/dist/cjs/simdReadings.cjs +24 -0
  21. package/dist/cjs/state/builder.cjs +70 -83
  22. package/dist/elements/form.js +10 -18
  23. package/dist/elements/window.js +18 -17
  24. package/dist/extensionLoader.js +4 -4
  25. package/dist/index.d.ts +1 -0
  26. package/dist/index.d.ts.map +1 -1
  27. package/dist/index.js +4 -19
  28. package/dist/index.js.map +1 -1
  29. package/dist/providers.js +29 -45
  30. package/dist/reactComponents/Checkbox.js +99 -121
  31. package/dist/reactComponents/Honeypot.js +53 -61
  32. package/dist/reactComponents/Reload.js +58 -80
  33. package/dist/reactComponents/TestModeBanner.js +30 -45
  34. package/dist/simdReadings.d.ts +6 -0
  35. package/dist/simdReadings.d.ts.map +1 -0
  36. package/dist/simdReadings.js +23 -0
  37. package/dist/simdReadings.js.map +1 -0
  38. package/dist/state/builder.js +71 -85
  39. package/dist/tests/simdReadings.test.d.ts +2 -0
  40. package/dist/tests/simdReadings.test.d.ts.map +1 -0
  41. package/dist/tests/simdReadings.test.js +76 -0
  42. package/dist/tests/simdReadings.test.js.map +1 -0
  43. package/package.json +8 -8
  44. package/src/index.ts +1 -0
  45. package/src/simdReadings.ts +45 -0
  46. package/src/tests/simdReadings.test.ts +149 -0
  47. package/tsconfig.tsbuildinfo +1 -1
@@ -1,11 +1,12 @@
1
- "use strict";
2
- Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
3
- const jsxRuntime = require("@emotion/react/jsx-runtime");
4
- const react = require("@emotion/react");
5
- const styled = require("@emotion/styled");
6
- const widgetSkeleton = require("@prosopo/widget-skeleton");
7
- const react$1 = require("react");
8
- const checkboxBefore = react.css`{
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
- const baseStyle = {
17
- width: "28px",
18
- height: "28px",
19
- minWidth: "14px",
20
- minHeight: "14px",
21
- top: "auto",
22
- left: "auto",
23
- opacity: "1",
24
- borderRadius: "12.5%",
25
- appearance: "none",
26
- cursor: "pointer",
27
- margin: "0",
28
- borderStyle: "solid",
29
- borderWidth: "1px"
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
- const ID_LETTERS = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
32
- const 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/";
33
- const generateRandomId = () => {
34
- return Array.from(
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
- const Checkbox = ({
40
- theme,
41
- onChange,
42
- checked,
43
- labelText,
44
- error,
45
- loading
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
- const checkboxStyle = react$1.useMemo(() => {
77
- return {
78
- ...checkboxStyleBase,
79
- borderColor: hover ? theme.palette.background.contrastText : theme.palette.border,
80
- appearance: checked ? "auto" : "none",
81
- flex: 1,
82
- margin: "15px",
83
- minWidth: "28px",
84
- minHeight: "28px"
85
- };
86
- }, [hover, theme, checked]);
87
- const id = generateRandomId();
88
- return /* @__PURE__ */ jsxRuntime.jsxs(
89
- "span",
90
- {
91
- style: {
92
- display: "inline-flex",
93
- alignItems: "center",
94
- minHeight: "58px"
95
- },
96
- children: [
97
- loading ? /* @__PURE__ */ jsxRuntime.jsx(
98
- "div",
99
- {
100
- className: widgetSkeleton.WIDGET_CHECKBOX_SPINNER_CSS_CLASS,
101
- "aria-label": "Loading spinner"
102
- }
103
- ) : /* @__PURE__ */ jsxRuntime.jsx(
104
- "input",
105
- {
106
- name: id,
107
- id,
108
- onMouseEnter: () => setHover(true),
109
- onMouseLeave: () => setHover(false),
110
- css: checkboxBefore,
111
- type: "checkbox",
112
- "aria-live": "assertive",
113
- "aria-label": labelText,
114
- onKeyDown: (e) => {
115
- if (!e.isTrusted) {
116
- return;
117
- }
118
- if (e.key === "Enter") {
119
- e.preventDefault();
120
- e.stopPropagation();
121
- setHover(false);
122
- onChange(e);
123
- }
124
- },
125
- onChange: (e) => {
126
- if (!e.isTrusted) {
127
- return;
128
- }
129
- e.preventDefault();
130
- e.stopPropagation();
131
- setHover(false);
132
- onChange(e);
133
- },
134
- checked,
135
- style: checkboxStyle,
136
- disabled: error !== void 0,
137
- className: loading ? "prosopo-checkbox__loading-spinner" : "",
138
- "data-cy": "captcha-checkbox"
139
- }
140
- ),
141
- error ? /* @__PURE__ */ jsxRuntime.jsx(ResponsiveLabel, { htmFor: id, children: /* @__PURE__ */ jsxRuntime.jsx(
142
- "a",
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
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const jsxRuntime = require("@emotion/react/jsx-runtime");
4
- const react = require("react");
5
- const reactDom = require("react-dom");
6
- const offscreenStyle = {
7
- position: "absolute",
8
- left: "-9999px",
9
- top: "-9999px",
10
- width: "1px",
11
- height: "1px",
12
- overflow: "hidden",
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
- const decodeBase64Utf8 = (b64) => {
16
- const binary = atob(b64);
17
- const bytes = Uint8Array.from(binary, (c) => c.charCodeAt(0));
18
- return new TextDecoder().decode(bytes);
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
- const findAncestorForm = (anchor) => {
21
- const root = anchor.getRootNode();
22
- const lightDomEntry = root instanceof ShadowRoot ? root.host : anchor;
23
- return lightDomEntry instanceof Element ? lightDomEntry.closest("form") : null;
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
- const Honeypot = react.forwardRef(
26
- ({ encodedQuestion }, ref) => {
27
- const id = react.useId();
28
- const detachedFormId = `${id}-d`;
29
- const question = react.useMemo(
30
- () => decodeBase64Utf8(encodedQuestion),
31
- [encodedQuestion]
32
- );
33
- const anchorRef = react.useRef(null);
34
- const [portalTarget, setPortalTarget] = react.useState(null);
35
- react.useEffect(() => {
36
- const anchor = anchorRef.current;
37
- if (!anchor) return;
38
- setPortalTarget(findAncestorForm(anchor) ?? document.body);
39
- }, []);
40
- if (typeof document === "undefined") return null;
41
- if (!portalTarget) {
42
- return /* @__PURE__ */ jsxRuntime.jsx("span", { ref: anchorRef, "aria-hidden": "true", style: { display: "none" } });
43
- }
44
- return reactDom.createPortal(
45
- /* @__PURE__ */ jsxRuntime.jsx("div", { "aria-hidden": "true", style: offscreenStyle, children: /* @__PURE__ */ jsxRuntime.jsxs("label", { children: [
46
- question,
47
- /* @__PURE__ */ jsxRuntime.jsx(
48
- "input",
49
- {
50
- ref,
51
- id,
52
- form: detachedFormId,
53
- type: "text",
54
- name: "email_confirm",
55
- defaultValue: "",
56
- tabIndex: -1,
57
- autoComplete: "off",
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
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const jsxRuntime = require("@emotion/react/jsx-runtime");
4
- const widgetSkeleton = require("@prosopo/widget-skeleton");
5
- const react = require("react");
6
- const buttonStyleBase = {
7
- border: "none",
8
- paddingTop: "6px",
9
- paddingBottom: "6px",
10
- cursor: "pointer",
11
- height: "39px",
12
- width: "39px",
13
- borderRadius: "50%",
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
- const ReloadButton = ({
17
- themeColor,
18
- onReload
19
- }) => {
20
- const theme = react.useMemo(
21
- () => themeColor === "light" ? widgetSkeleton.lightTheme : widgetSkeleton.darkTheme,
22
- [themeColor]
23
- );
24
- const [hover, setHover] = react.useState(false);
25
- const buttonStyle = react.useMemo(() => {
26
- const baseStyle = {
27
- ...buttonStyleBase,
28
- backgroundColor: theme.palette.background.default,
29
- color: hover ? theme.palette.primary.contrastText : theme.palette.background.contrastText,
30
- border: `1px solid ${theme.palette.grey[500]}`,
31
- borderRadius: "50%",
32
- transition: "background-color 0.3s",
33
- boxShadow: `0px 1px 3px 0px ${theme.palette.grey[500]}`,
34
- justifyContent: "center",
35
- alignItems: "center",
36
- margin: "0 auto"
37
- };
38
- return {
39
- ...baseStyle,
40
- backgroundColor: hover ? theme.palette.grey[700] : theme.palette.background.default
41
- };
42
- }, [hover, theme]);
43
- return /* @__PURE__ */ jsxRuntime.jsx(
44
- "button",
45
- {
46
- className: "reload-button",
47
- "aria-label": "Reload",
48
- type: "button",
49
- style: buttonStyle,
50
- onMouseEnter: () => setHover(true),
51
- onMouseLeave: () => setHover(false),
52
- onClick: (e) => {
53
- e.preventDefault();
54
- onReload();
55
- },
56
- children: /* @__PURE__ */ jsxRuntime.jsxs(
57
- "svg",
58
- {
59
- width: "16px",
60
- height: "16px",
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
- "use strict";
2
- Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
3
- const jsxRuntime = require("@emotion/react/jsx-runtime");
4
- const types = require("@prosopo/types");
5
- const react = require("react");
6
- const TestModeBanner = ({
7
- siteKey
8
- }) => {
9
- const mode = types.getTestSiteKeyMode(siteKey);
10
- react.useEffect(() => {
11
- if (mode !== null) {
12
- console.warn(
13
- `[Procaptcha] WARNING: site key "${siteKey}" is a TEST key that ALWAYS ${mode === types.TestSiteKeyMode.Pass ? "PASSES" : "FAILS"}. Never use it in production.`
14
- );
15
- }
16
- }, [mode, siteKey]);
17
- if (mode === null) {
18
- return null;
19
- }
20
- const action = mode === types.TestSiteKeyMode.Pass ? "ALWAYS PASSES" : "ALWAYS FAILS";
21
- return (
22
- // biome-ignore lint/a11y/useSemanticElements: the "alert" role has no native HTML element equivalent
23
- /* @__PURE__ */ jsxRuntime.jsx(
24
- "div",
25
- {
26
- role: "alert",
27
- "data-cy": "test-mode-banner",
28
- css: {
29
- width: "100%",
30
- boxSizing: "border-box",
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;