@prosopo/procaptcha-common 2.5.5 → 2.6.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.
package/CHANGELOG.md ADDED
@@ -0,0 +1,36 @@
1
+ # @prosopo/procaptcha-common
2
+
3
+ ## 2.6.2
4
+
5
+ ### Patch Changes
6
+
7
+ - 6ff193a: Change settings type
8
+ - Updated dependencies [6ff193a]
9
+ - @prosopo/types@2.6.2
10
+ - @prosopo/account@2.6.2
11
+ - @prosopo/load-balancer@2.6.2
12
+
13
+ ## 2.6.1
14
+
15
+ ### Patch Changes
16
+
17
+ - Updated dependencies [52feffc]
18
+ - @prosopo/types@2.6.1
19
+ - @prosopo/account@2.6.1
20
+ - @prosopo/load-balancer@2.6.1
21
+
22
+ ## 2.6.0
23
+
24
+ ### Minor Changes
25
+
26
+ - a0bfc8a: bump all pkg versions since independent versioning applied
27
+
28
+ ### Patch Changes
29
+
30
+ - Updated dependencies [a0bfc8a]
31
+ - @prosopo/account@2.6.0
32
+ - @prosopo/common@2.6.0
33
+ - @prosopo/load-balancer@2.6.0
34
+ - @prosopo/types@2.6.0
35
+ - @prosopo/util@2.6.0
36
+ - @prosopo/widget-skeleton@2.6.0
@@ -0,0 +1,158 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const types = require("@prosopo/types");
4
+ const form = require("../elements/form.cjs");
5
+ const window = require("../elements/window.cjs");
6
+ const getDefaultCallbacks = (element) => ({
7
+ onHuman: (token) => handleOnHuman(token, element),
8
+ onChallengeExpired: () => {
9
+ form.removeProcaptchaResponse();
10
+ console.log("Challenge expired");
11
+ },
12
+ onExtensionNotFound: () => {
13
+ console.error("Extension not found");
14
+ },
15
+ onExpired: () => {
16
+ form.removeProcaptchaResponse();
17
+ },
18
+ onError: (error) => {
19
+ form.removeProcaptchaResponse();
20
+ console.error(error);
21
+ },
22
+ onClose: () => {
23
+ console.log("Challenge closed");
24
+ },
25
+ onOpen: () => {
26
+ console.log("Challenge opened");
27
+ },
28
+ onFailed: () => {
29
+ alert("Captcha challenge failed. Please try again");
30
+ console.log("Challenge failed");
31
+ },
32
+ onReset: () => {
33
+ form.removeProcaptchaResponse();
34
+ console.log("Captcha widget reset");
35
+ },
36
+ onReload: () => {
37
+ console.log("Challenge reloaded");
38
+ }
39
+ });
40
+ const getUserCallback = (callback, element, callbackFnOrName) => {
41
+ const callbackFnName = element.getAttribute(`data-${callback}`);
42
+ if (callbackFnName) {
43
+ const callbackFn = window.getWindowCallback(callbackFnName);
44
+ if (callbackFn) {
45
+ return callbackFn;
46
+ }
47
+ }
48
+ if (typeof callbackFnOrName === "function") {
49
+ return callbackFnOrName;
50
+ }
51
+ if (typeof callbackFnOrName === "string") {
52
+ return window.getWindowCallback(callbackFnOrName);
53
+ }
54
+ };
55
+ function setUserCallbacks(renderOptions, callbacks, element) {
56
+ const humanCallback = getUserCallback(
57
+ "callback",
58
+ element,
59
+ renderOptions?.callback
60
+ );
61
+ if (humanCallback) {
62
+ callbacks.onHuman = (token) => {
63
+ handleOnHuman(token, element);
64
+ humanCallback(token);
65
+ };
66
+ }
67
+ const chalExpiredCallback = getUserCallback(
68
+ "chalexpired-callback",
69
+ element,
70
+ renderOptions?.["chalexpired-callback"]
71
+ );
72
+ if (chalExpiredCallback) {
73
+ callbacks.onChallengeExpired = () => {
74
+ form.removeProcaptchaResponse();
75
+ chalExpiredCallback();
76
+ };
77
+ }
78
+ const expiredCallback = getUserCallback(
79
+ "expired-callback",
80
+ element,
81
+ renderOptions?.["expired-callback"]
82
+ );
83
+ if (expiredCallback) {
84
+ callbacks.onExpired = () => {
85
+ form.removeProcaptchaResponse();
86
+ expiredCallback();
87
+ };
88
+ }
89
+ const errorCallback = getUserCallback(
90
+ "error-callback",
91
+ element,
92
+ renderOptions?.["error-callback"]
93
+ );
94
+ if (errorCallback) {
95
+ callbacks.onError = (error) => {
96
+ form.removeProcaptchaResponse();
97
+ errorCallback(error);
98
+ };
99
+ }
100
+ const closeCallback = getUserCallback(
101
+ "close-callback",
102
+ element,
103
+ renderOptions?.["close-callback"]
104
+ );
105
+ if (closeCallback) {
106
+ callbacks.onClose = () => {
107
+ closeCallback();
108
+ };
109
+ }
110
+ const openCallback = getUserCallback(
111
+ "open-callback",
112
+ element,
113
+ renderOptions?.["open-callback"]
114
+ );
115
+ if (openCallback) {
116
+ callbacks.onOpen = () => {
117
+ openCallback();
118
+ };
119
+ }
120
+ const failedCallback = getUserCallback(
121
+ "failed-callback",
122
+ element,
123
+ renderOptions?.["failed-callback"]
124
+ );
125
+ if (failedCallback) {
126
+ callbacks.onFailed = () => {
127
+ failedCallback();
128
+ };
129
+ }
130
+ const resetCallback = getUserCallback(
131
+ "reset-callback",
132
+ element,
133
+ renderOptions?.["reset-callback"]
134
+ );
135
+ if (resetCallback) {
136
+ callbacks.onReset = () => {
137
+ form.removeProcaptchaResponse();
138
+ resetCallback();
139
+ };
140
+ }
141
+ }
142
+ const handleOnHuman = (token, element) => {
143
+ form.removeProcaptchaResponse();
144
+ if (element) {
145
+ const form$1 = form.getParentForm(element);
146
+ if (!form$1) {
147
+ console.error("Parent form not found for the element:", element);
148
+ return;
149
+ }
150
+ const input = document.createElement("input");
151
+ input.type = "hidden";
152
+ input.name = types.ApiParams.procaptchaResponse;
153
+ input.value = token;
154
+ form$1.appendChild(input);
155
+ }
156
+ };
157
+ exports.getDefaultCallbacks = getDefaultCallbacks;
158
+ exports.setUserCallbacks = setUserCallbacks;
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const defaultCallbacks = require("./defaultCallbacks.cjs");
4
+ const getDefaultEvents = (callbacks) => ({
5
+ ...defaultCallbacks.getDefaultCallbacks(void 0),
6
+ ...callbacks
7
+ });
8
+ exports.getDefaultEvents = getDefaultEvents;
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const types = require("@prosopo/types");
4
+ function getParentForm(widgetElement) {
5
+ const rootWidgetNode = widgetElement.getRootNode();
6
+ const topWidgetElement = rootWidgetNode instanceof ShadowRoot ? rootWidgetNode.host : widgetElement;
7
+ return topWidgetElement.closest("form");
8
+ }
9
+ const removeProcaptchaResponse = () => {
10
+ const element = Array.from(
11
+ document.getElementsByName(types.ApiParams.procaptchaResponse)
12
+ );
13
+ element.map((el) => el.remove());
14
+ };
15
+ exports.getParentForm = getParentForm;
16
+ exports.removeProcaptchaResponse = removeProcaptchaResponse;
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const getWindowCallback = (callbackName) => {
4
+ const fn = window[callbackName.replace("window.", "")];
5
+ if (typeof fn !== "function") {
6
+ throw new Error(
7
+ `Callback ${callbackName} is not defined on the window object`
8
+ );
9
+ }
10
+ return fn;
11
+ };
12
+ exports.getWindowCallback = getWindowCallback;
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __copyProps = (to, from, except, desc) => {
9
+ if (from && typeof from === "object" || typeof from === "function") {
10
+ for (let key of __getOwnPropNames(from))
11
+ if (!__hasOwnProp.call(to, key) && key !== except)
12
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
13
+ }
14
+ return to;
15
+ };
16
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
17
+ // If the importer is in node compatibility mode or this is not an ESM
18
+ // file that has been converted to a CommonJS file using a Babel-
19
+ // compatible transform (i.e. "__esModule" has not been set), then set
20
+ // "default" to the CommonJS "module.exports" for node compatibility.
21
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
22
+ mod
23
+ ));
24
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
25
+ const ExtensionLoader = async (web2) => web2 ? (await import("@prosopo/account")).ExtensionWeb2 : (await import("@prosopo/account")).ExtensionWeb3;
26
+ exports.ExtensionLoader = ExtensionLoader;
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const providers = require("./providers.cjs");
4
+ const builder = require("./state/builder.cjs");
5
+ const defaultCallbacks = require("./callbacks/defaultCallbacks.cjs");
6
+ const defaultEvents = require("./callbacks/defaultEvents.cjs");
7
+ const extensionLoader = require("./extensionLoader.cjs");
8
+ const window = require("./elements/window.cjs");
9
+ const Reload = require("./reactComponents/Reload.cjs");
10
+ const Checkbox = require("./reactComponents/Checkbox.cjs");
11
+ exports.getRandomActiveProvider = providers.getRandomActiveProvider;
12
+ exports.providerRetry = providers.providerRetry;
13
+ exports.buildUpdateState = builder.buildUpdateState;
14
+ exports.useProcaptcha = builder.useProcaptcha;
15
+ exports.getDefaultCallbacks = defaultCallbacks.getDefaultCallbacks;
16
+ exports.setUserCallbacks = defaultCallbacks.setUserCallbacks;
17
+ exports.getDefaultEvents = defaultEvents.getDefaultEvents;
18
+ exports.ExtensionLoader = extensionLoader.ExtensionLoader;
19
+ exports.getWindowCallback = window.getWindowCallback;
20
+ exports.ReloadButton = Reload.ReloadButton;
21
+ exports.Checkbox = Checkbox.Checkbox;
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const loadBalancer = require("@prosopo/load-balancer");
4
+ const util = require("@prosopo/util");
5
+ let providers = [];
6
+ const getRandomActiveProvider = async (config) => {
7
+ const randomIntBetween = (min, max) => Math.floor(Math.random() * (max - min + 1) + min);
8
+ if (providers.length === 0) {
9
+ providers = await loadBalancer.loadBalancer(config.defaultEnvironment);
10
+ }
11
+ const randomProvderObj = util.at(
12
+ providers,
13
+ randomIntBetween(0, providers.length - 1)
14
+ );
15
+ return {
16
+ providerAccount: randomProvderObj.address,
17
+ provider: {
18
+ url: randomProvderObj.url,
19
+ datasetId: randomProvderObj.datasetId
20
+ }
21
+ };
22
+ };
23
+ const providerRetry = async (currentFn, retryFn, stateReset, attemptCount, retryMax) => {
24
+ try {
25
+ await currentFn();
26
+ } catch (err) {
27
+ if (attemptCount >= retryMax) {
28
+ console.error(err);
29
+ console.error(
30
+ `Max retries (${attemptCount} of ${retryMax}) reached, aborting`
31
+ );
32
+ return stateReset();
33
+ }
34
+ console.error(err);
35
+ stateReset();
36
+ await retryFn();
37
+ }
38
+ };
39
+ exports.getRandomActiveProvider = getRandomActiveProvider;
40
+ exports.providerRetry = providerRetry;
@@ -0,0 +1,138 @@
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`{
9
+ &:before {
10
+ content: '""';
11
+ position: absolute;
12
+ height: 100%;
13
+ width: 100%;
14
+ }
15
+ }`;
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"
30
+ };
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("");
38
+ };
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`
53
+ color: ${theme.palette.background.contrastText};
54
+ position: relative;
55
+ display: flex;
56
+ cursor: pointer;
57
+ user-select: none;
58
+
59
+ @container widget (max-width: 219px) {
60
+ display: none;
61
+ }
62
+ @container widget (min-width: 220px) {
63
+ font-size: 12px;
64
+ }
65
+ @container widget (min-width: 250px) {
66
+ font-size: 14px;
67
+ }
68
+ @container widget (min-width: 270px) {
69
+ font-size: 16px;
70
+ }
71
+ `;
72
+ const checkboxStyle = react$1.useMemo(() => {
73
+ return {
74
+ ...checkboxStyleBase,
75
+ borderColor: hover ? theme.palette.background.contrastText : theme.palette.border,
76
+ appearance: checked ? "auto" : "none",
77
+ flex: 1,
78
+ margin: "15px",
79
+ minWidth: "28px",
80
+ minHeight: "28px"
81
+ };
82
+ }, [hover, theme, checked]);
83
+ const id = generateRandomId();
84
+ return /* @__PURE__ */ jsxRuntime.jsxs(
85
+ "span",
86
+ {
87
+ style: {
88
+ display: "inline-flex",
89
+ alignItems: "center",
90
+ minHeight: "58px"
91
+ },
92
+ children: [
93
+ loading ? /* @__PURE__ */ jsxRuntime.jsx(
94
+ "div",
95
+ {
96
+ className: widgetSkeleton.WIDGET_CHECKBOX_SPINNER_CSS_CLASS,
97
+ "aria-label": "Loading spinner"
98
+ }
99
+ ) : /* @__PURE__ */ jsxRuntime.jsx(
100
+ "input",
101
+ {
102
+ name: id,
103
+ id,
104
+ onMouseEnter: () => setHover(true),
105
+ onMouseLeave: () => setHover(false),
106
+ css: checkboxBefore,
107
+ type: "checkbox",
108
+ "aria-live": "assertive",
109
+ "aria-label": labelText,
110
+ onChange: (e) => {
111
+ e.preventDefault();
112
+ e.stopPropagation();
113
+ setHover(false);
114
+ onChange();
115
+ },
116
+ checked,
117
+ style: checkboxStyle,
118
+ disabled: error !== void 0,
119
+ className: loading ? "checkbox__loading-spinner" : "",
120
+ "data-cy": "captcha-checkbox"
121
+ }
122
+ ),
123
+ error ? /* @__PURE__ */ jsxRuntime.jsx(ResponsiveLabel, { htmFor: id, children: /* @__PURE__ */ jsxRuntime.jsx(
124
+ "a",
125
+ {
126
+ css: {
127
+ color: theme.palette.error.main
128
+ },
129
+ href: FAQ_LINK,
130
+ children: error
131
+ }
132
+ ) }) : /* @__PURE__ */ jsxRuntime.jsx(ResponsiveLabel, { htmFor: id, children: labelText })
133
+ ]
134
+ }
135
+ );
136
+ };
137
+ exports.Checkbox = Checkbox;
138
+ exports.default = Checkbox;
@@ -0,0 +1,83 @@
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"
15
+ };
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
+ );
82
+ };
83
+ exports.ReloadButton = ReloadButton;
@@ -0,0 +1,86 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const buildUpdateState = (state, onStateUpdate) => (nextState) => {
4
+ Object.assign(state, nextState);
5
+ onStateUpdate(nextState);
6
+ };
7
+ const useRefAsState = (useRef, defaultValue) => {
8
+ const ref = useRef(defaultValue);
9
+ const setter = (value2) => {
10
+ ref.current = value2;
11
+ };
12
+ const value = ref.current;
13
+ return [value, setter];
14
+ };
15
+ const useProcaptcha = (useState, useRef) => {
16
+ const [isHuman, setIsHuman] = useState(false);
17
+ const [index, setIndex] = useState(0);
18
+ const [solutions, setSolutions] = useState([]);
19
+ const [captchaApi, setCaptchaApi] = useRefAsState(useRef, void 0);
20
+ const [showModal, setShowModal] = useState(false);
21
+ const [challenge, setChallenge] = useState(
22
+ void 0
23
+ );
24
+ const [loading, setLoading] = useState(false);
25
+ const [account, setAccount] = useState(void 0);
26
+ const [dappAccount, setDappAccount] = useState(void 0);
27
+ const [submission, setSubmission] = useRefAsState(useRef, void 0);
28
+ const [timeout, setTimeout] = useRefAsState(
29
+ useRef,
30
+ void 0
31
+ );
32
+ const [successfullChallengeTimeout, setSuccessfullChallengeTimeout] = useRefAsState(useRef, void 0);
33
+ const [sendData, setSendData] = useState(false);
34
+ const [attemptCount, setAttemptCount] = useState(0);
35
+ const [error, setError] = useState(void 0);
36
+ const [sessionId, setSessionId] = useState(void 0);
37
+ return [
38
+ // the state
39
+ {
40
+ isHuman,
41
+ index,
42
+ solutions,
43
+ captchaApi,
44
+ showModal,
45
+ challenge,
46
+ loading,
47
+ account,
48
+ dappAccount,
49
+ submission,
50
+ timeout,
51
+ successfullChallengeTimeout,
52
+ sendData,
53
+ attemptCount,
54
+ error,
55
+ sessionId
56
+ },
57
+ // and method to update the state
58
+ (nextState) => {
59
+ if (nextState.account !== void 0) setAccount(nextState.account);
60
+ if (nextState.isHuman !== void 0) setIsHuman(nextState.isHuman);
61
+ if (nextState.index !== void 0) setIndex(nextState.index);
62
+ if (nextState.solutions !== void 0)
63
+ setSolutions(nextState.solutions.slice());
64
+ if (nextState.captchaApi !== void 0)
65
+ setCaptchaApi(nextState.captchaApi);
66
+ if (nextState.showModal !== void 0) setShowModal(nextState.showModal);
67
+ if (nextState.challenge !== void 0) setChallenge(nextState.challenge);
68
+ if (nextState.loading !== void 0) setLoading(nextState.loading);
69
+ if (nextState.showModal !== void 0) setShowModal(nextState.showModal);
70
+ if (nextState.dappAccount !== void 0)
71
+ setDappAccount(nextState.dappAccount);
72
+ if (nextState.submission !== void 0)
73
+ setSubmission(nextState.submission);
74
+ if (nextState.timeout !== void 0) setTimeout(nextState.timeout);
75
+ if (nextState.successfullChallengeTimeout !== void 0)
76
+ setSuccessfullChallengeTimeout(nextState.timeout);
77
+ if (nextState.sendData !== void 0) setSendData(nextState.sendData);
78
+ if (nextState.attemptCount !== void 0)
79
+ setAttemptCount(nextState.attemptCount);
80
+ if (nextState.error !== void 0) setError(nextState.error);
81
+ if (nextState.sessionId !== void 0) setSessionId(nextState.sessionId);
82
+ }
83
+ ];
84
+ };
85
+ exports.buildUpdateState = buildUpdateState;
86
+ exports.useProcaptcha = useProcaptcha;
@@ -1 +1 @@
1
- {"version":3,"file":"providers.d.ts","sourceRoot":"","sources":["../src/providers.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EACX,4BAA4B,EAC5B,cAAc,EACd,MAAM,gBAAgB,CAAC;AAGxB,eAAO,MAAM,uBAAuB,WAC3B,4BAA4B,KAClC,OAAO,CAAC,cAAc,CAoBxB,CAAC;AAEF,eAAO,MAAM,aAAa,cACd,MAAM,OAAO,CAAC,IAAI,CAAC,WACrB,MAAM,OAAO,CAAC,IAAI,CAAC,cAChB,MAAM,IAAI,gBACR,MAAM,YACV,MAAM,kBAkBhB,CAAC"}
1
+ {"version":3,"file":"providers.d.ts","sourceRoot":"","sources":["../src/providers.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EACX,4BAA4B,EAC5B,cAAc,EACd,MAAM,gBAAgB,CAAC;AAKxB,eAAO,MAAM,uBAAuB,WAC3B,4BAA4B,KAClC,OAAO,CAAC,cAAc,CAuBxB,CAAC;AAEF,eAAO,MAAM,aAAa,cACd,MAAM,OAAO,CAAC,IAAI,CAAC,WACrB,MAAM,OAAO,CAAC,IAAI,CAAC,cAChB,MAAM,IAAI,gBACR,MAAM,YACV,MAAM,kBAkBhB,CAAC"}
package/dist/providers.js CHANGED
@@ -1,9 +1,12 @@
1
1
  import { loadBalancer } from "@prosopo/load-balancer";
2
2
  import { at } from "@prosopo/util";
3
+ let providers = [];
3
4
  export const getRandomActiveProvider = async (config) => {
4
5
  const randomIntBetween = (min, max) => Math.floor(Math.random() * (max - min + 1) + min);
5
- const PROVIDERS = await loadBalancer(config.defaultEnvironment);
6
- const randomProvderObj = at(PROVIDERS, randomIntBetween(0, PROVIDERS.length - 1));
6
+ if (providers.length === 0) {
7
+ providers = await loadBalancer(config.defaultEnvironment);
8
+ }
9
+ const randomProvderObj = at(providers, randomIntBetween(0, providers.length - 1));
7
10
  return {
8
11
  providerAccount: randomProvderObj.address,
9
12
  provider: {
@@ -1 +1 @@
1
- {"version":3,"file":"providers.js","sourceRoot":"","sources":["../src/providers.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAKtD,OAAO,EAAE,EAAE,EAAE,MAAM,eAAe,CAAC;AAEnC,MAAM,CAAC,MAAM,uBAAuB,GAAG,KAAK,EAC3C,MAAoC,EACV,EAAE;IAC5B,MAAM,gBAAgB,GAAG,CAAC,GAAW,EAAE,GAAW,EAAE,EAAE,CACrD,IAAI,CAAC,KAAK,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jB,CAAC;AACF,CAAC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"Checkbox.d.ts","sourceRoot":"","sources":["../../src/reactComponents/Checkbox.tsx"],"names":[],"mappings":"AAeA,OAAO,EACN,KAAK,KAAK,EAEV,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACN,KAAK,oBAAoB,EAEzB,KAAK,EAAE,EAGP,MAAM,OAAO,CAAC;AAEf,UAAU,aAAc,SAAQ,oBAAoB,CAAC,iBAAiB,CAAC;IACtE,KAAK,EAAE,KAAK,CAAC;IACb,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAC9B,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,OAAO,CAAC;CACjB;AAwDD,eAAO,MAAM,QAAQ,EAAE,EAAE,CAAC,aAAa,CAgHtC,CAAC;AACF,eAAe,QAAQ,CAAC"}
1
+ {"version":3,"file":"Checkbox.d.ts","sourceRoot":"","sources":["../../src/reactComponents/Checkbox.tsx"],"names":[],"mappings":"AAgBA,OAAO,EACN,KAAK,KAAK,EAEV,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACN,KAAK,oBAAoB,EAEzB,KAAK,EAAE,EAGP,MAAM,OAAO,CAAC;AAEf,UAAU,aAAc,SAAQ,oBAAoB,CAAC,iBAAiB,CAAC;IACtE,KAAK,EAAE,KAAK,CAAC;IACb,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAC9B,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,OAAO,CAAC;CACjB;AA4CD,eAAO,MAAM,QAAQ,EAAE,EAAE,CAAC,aAAa,CAuGtC,CAAC;AACF,eAAe,QAAQ,CAAC"}
@@ -1,5 +1,6 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
2
2
  import { css } from "@emotion/react";
3
+ import styled from "@emotion/styled";
3
4
  import { WIDGET_CHECKBOX_SPINNER_CSS_CLASS, } from "@prosopo/widget-skeleton";
4
5
  import { useMemo, useState, } from "react";
5
6
  const checkboxBefore = css `{
@@ -32,27 +33,32 @@ const FAQ_LINK = process.env.PROSOPO_DOCS_URL
32
33
  const generateRandomId = () => {
33
34
  return Array.from({ length: 8 }, () => ID_LETTERS[Math.floor(Math.random() * ID_LETTERS.length)]).join("");
34
35
  };
35
- const responsiveFont = css `
36
- display: none;
37
- @media (min-width: 275px) {
38
- display: flex;
39
- font-size: 12px;
40
- }
41
- @media (min-width: 300px) {
42
- display: flex;
43
- font-size: 14px;
44
- }
45
- @media (min-width: 320px) {
46
- display: flex;
47
- font-size: 16px;
48
- }
49
- `;
50
36
  export const Checkbox = ({ theme, onChange, checked, labelText, error, loading, }) => {
51
37
  const checkboxStyleBase = {
52
38
  ...baseStyle,
53
39
  border: `1px solid ${theme.palette.background.contrastText}`,
54
40
  };
55
41
  const [hover, setHover] = useState(false);
42
+ const ResponsiveLabel = styled.label `
43
+ color: ${theme.palette.background.contrastText};
44
+ position: relative;
45
+ display: flex;
46
+ cursor: pointer;
47
+ user-select: none;
48
+
49
+ @container widget (max-width: 219px) {
50
+ display: none;
51
+ }
52
+ @container widget (min-width: 220px) {
53
+ font-size: 12px;
54
+ }
55
+ @container widget (min-width: 250px) {
56
+ font-size: 14px;
57
+ }
58
+ @container widget (min-width: 270px) {
59
+ font-size: 16px;
60
+ }
61
+ `;
56
62
  const checkboxStyle = useMemo(() => {
57
63
  return {
58
64
  ...checkboxStyleBase,
@@ -62,8 +68,8 @@ export const Checkbox = ({ theme, onChange, checked, labelText, error, loading,
62
68
  appearance: checked ? "auto" : "none",
63
69
  flex: 1,
64
70
  margin: "15px",
65
- minWidth: "14px",
66
- minHeight: "14px",
71
+ minWidth: "28px",
72
+ minHeight: "28px",
67
73
  };
68
74
  }, [hover, theme, checked]);
69
75
  const id = generateRandomId();
@@ -71,28 +77,14 @@ export const Checkbox = ({ theme, onChange, checked, labelText, error, loading,
71
77
  display: "inline-flex",
72
78
  alignItems: "center",
73
79
  minHeight: "58px",
74
- }, children: [loading ? (_jsx("div", { className: "checkbox__outer", children: _jsx("div", { className: "checkbox__wrapper", children: _jsx("div", { className: "checkbox__inner", children: _jsx("div", { className: "checkbox__content", children: _jsx("div", { className: WIDGET_CHECKBOX_SPINNER_CSS_CLASS, "aria-label": "Loading spinner" }) }) }) }) })) : (_jsx("input", { name: id, id: id, onMouseEnter: () => setHover(true), onMouseLeave: () => setHover(false), css: checkboxBefore, type: "checkbox", "aria-live": "assertive", "aria-label": labelText, onChange: (e) => {
80
+ }, children: [loading ? (_jsx("div", { className: WIDGET_CHECKBOX_SPINNER_CSS_CLASS, "aria-label": "Loading spinner" })) : (_jsx("input", { name: id, id: id, onMouseEnter: () => setHover(true), onMouseLeave: () => setHover(false), css: checkboxBefore, type: "checkbox", "aria-live": "assertive", "aria-label": labelText, onChange: (e) => {
75
81
  e.preventDefault();
76
82
  e.stopPropagation();
77
83
  setHover(false);
78
84
  onChange();
79
- }, checked: checked, style: checkboxStyle, disabled: error !== undefined, className: loading ? "checkbox__loading-spinner" : "", "data-cy": "captcha-checkbox" })), error ? (_jsx("label", { css: {
80
- color: theme.palette.error.main,
81
- position: "relative",
82
- display: "flex",
83
- cursor: "pointer",
84
- userSelect: "none",
85
- ...responsiveFont,
86
- }, htmlFor: id, children: _jsx("a", { css: {
85
+ }, checked: checked, style: checkboxStyle, disabled: error !== undefined, className: loading ? "checkbox__loading-spinner" : "", "data-cy": "captcha-checkbox" })), error ? (_jsx(ResponsiveLabel, { htmFor: id, children: _jsx("a", { css: {
87
86
  color: theme.palette.error.main,
88
- }, href: FAQ_LINK, children: error }) })) : (_jsx("label", { css: {
89
- color: theme.palette.background.contrastText,
90
- position: "relative",
91
- display: "flex",
92
- cursor: "pointer",
93
- userSelect: "none",
94
- ...responsiveFont,
95
- }, htmlFor: id, children: labelText }))] }));
87
+ }, href: FAQ_LINK, children: error }) })) : (_jsx(ResponsiveLabel, { htmFor: id, children: labelText }))] }));
96
88
  };
97
89
  export default Checkbox;
98
90
  //# sourceMappingURL=Checkbox.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Checkbox.js","sourceRoot":"","sources":["../../src/reactComponents/Checkbox.tsx"],"names":[],"mappings":";AAcA,OAAO,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AACrC,OAAO,EAEN,iCAAiC,GACjC,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAIN,OAAO,EACP,QAAQ,GACR,MAAM,OAAO,CAAC;AAWf,MAAM,cAAc,GAAG,GAAG,CAAA;;;;;;;EAOxB,CAAC;AAEH,MAAM,SAAS,GAAkB;IAChC,KAAK,EAAE,MAAM;IACb,MAAM,EAAE,MAAM;IACd,QAAQ,EAAE,MAAM;IAChB,SAAS,EAAE,MAAM;IACjB,GAAG,EAAE,MAAM;IACX,IAAI,EAAE,MAAM;IACZ,OAAO,EAAE,GAAG;IACZ,YAAY,EAAE,OAAO;IACrB,UAAU,EAAE,MAAM;IAClB,MAAM,EAAE,SAAS;IACjB,MAAM,EAAE,GAAG;IACX,WAAW,EAAE,OAAO;IACpB,WAAW,EAAE,KAAK;CAClB,CAAC;AAEF,MAAM,UAAU,GAAG,sDAAsD,CAAC;AAE1E,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,gBAAgB;IAC5C,CAAC,CAAC,GAAG,IAAI,GAAG,CAAC,GAAG,OAAO,CAAC,GAAG,CAAC,gBAAgB,iBAAiB,CAAC,CAAC,IAAI,GAAG;IACtE,CAAC,CAAC,wCAAwC,CAAC;AAE5C,MAAM,gBAAgB,GAAG,GAAG,EAAE;IAC7B,OAAO,KAAK,CAAC,IAAI,CAChB,EAAE,MAAM,EAAE,CAAC,EAAE,EACb,GAAG,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC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AACH,CAAC,CAAC;AACF,eAAe,QAAQ,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prosopo/procaptcha-common",
3
- "version": "2.5.5",
3
+ "version": "2.6.2",
4
4
  "author": "PROSOPO LIMITED <info@prosopo.io>",
5
5
  "license": "Apache-2.0",
6
6
  "main": "./dist/index.js",
@@ -24,17 +24,20 @@
24
24
  "build": "tsc --build --verbose",
25
25
  "build:cjs": "npx vite --config vite.cjs.config.ts build"
26
26
  },
27
- "browserslist": ["> 0.5%, last 2 versions, not dead"],
27
+ "browserslist": [
28
+ "> 0.5%, last 2 versions, not dead"
29
+ ],
28
30
  "dependencies": {
29
- "@prosopo/common": "2.5.5",
30
- "@prosopo/load-balancer": "2.5.5",
31
- "@prosopo/types": "2.5.5",
32
- "@prosopo/util": "2.5.5",
33
- "@prosopo/widget-skeleton": "2.5.5",
31
+ "@prosopo/account": "2.6.2",
32
+ "@prosopo/common": "2.6.0",
33
+ "@prosopo/load-balancer": "2.6.2",
34
+ "@prosopo/types": "2.6.2",
35
+ "@prosopo/util": "2.6.0",
36
+ "@prosopo/widget-skeleton": "2.6.0",
34
37
  "express": "4.21.2"
35
38
  },
36
39
  "devDependencies": {
37
- "@prosopo/config": "2.5.5",
40
+ "@prosopo/config": "2.6.0",
38
41
  "@types/react": "18.3.1",
39
42
  "@vitest/coverage-v8": "3.0.9",
40
43
  "concurrently": "9.0.1",
@@ -48,7 +51,8 @@
48
51
  },
49
52
  "repository": {
50
53
  "type": "git",
51
- "url": "git+https://github.com/prosopo/captcha.git"
54
+ "url": "git+https://github.com/prosopo/captcha.git",
55
+ "directory": "packages/procaptcha-common"
52
56
  },
53
57
  "bugs": {
54
58
  "url": "https://github.com/prosopo/captcha/issues"