@prosopo/procaptcha-bundle 1.0.2 → 2.0.0
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/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/index.d.ts +8 -8
- package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/index.d.ts.map +1 -1
- package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/index.js +128 -80
- package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/index.js.map +1 -1
- package/dist/bundle/Captcha-DmelpUdl.js +162 -0
- package/dist/bundle/ProcaptchaWidget-BJBQxbCd.js +783 -0
- package/dist/bundle/index-jr-ls0GZ.js +15023 -0
- package/dist/bundle/index.d.ts +8 -8
- package/dist/bundle/index.d.ts.map +1 -1
- package/dist/bundle/procaptcha.bundle.js +2 -2
- package/dist/bundle/utils-CHbJaqXT.js +12251 -0
- package/dist/cjs/index.cjs +81 -23
- package/dist/index.d.ts +8 -8
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +128 -80
- package/dist/index.js.map +1 -1
- package/package.json +57 -66
- package/stats.html +1 -1
- package/vite.cjs.config.ts +7 -3
- package/vite.config.ts +39 -37
- package/webpack.config.cjs +42 -0
- package/dist/bundle/Captcha-VFcjC-TM.js +0 -119
- package/dist/bundle/ProcaptchaWidget-YCG6trDR.js +0 -906
- package/dist/bundle/index-Bvarorfv.js +0 -11607
- package/dist/bundle/utils-o59wPRMZ.js +0 -35879
package/dist/cjs/index.cjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
3
3
|
const jsxRuntime = require("react/jsx-runtime");
|
|
4
|
-
const types = require("@prosopo/types");
|
|
5
|
-
const procaptchaReact = require("@prosopo/procaptcha-react");
|
|
6
4
|
const procaptchaFrictionless = require("@prosopo/procaptcha-frictionless");
|
|
7
5
|
const procaptchaPow = require("@prosopo/procaptcha-pow");
|
|
6
|
+
const procaptchaReact = require("@prosopo/procaptcha-react");
|
|
7
|
+
const types = require("@prosopo/types");
|
|
8
8
|
const util = require("@prosopo/util");
|
|
9
9
|
const client = require("react-dom/client");
|
|
10
10
|
const BUNDLE_NAME = "procaptcha.bundle.js";
|
|
@@ -40,11 +40,14 @@ const getParentForm = (element) => element.closest("form");
|
|
|
40
40
|
const getWindowCallback = (callbackName) => {
|
|
41
41
|
const fn = window[callbackName.replace("window.", "")];
|
|
42
42
|
if (typeof fn !== "function") {
|
|
43
|
-
throw new Error(
|
|
43
|
+
throw new Error(
|
|
44
|
+
`Callback ${callbackName} is not defined on the window object`
|
|
45
|
+
);
|
|
44
46
|
}
|
|
45
47
|
return fn;
|
|
46
48
|
};
|
|
47
49
|
const handleOnHuman = (element, token) => {
|
|
50
|
+
removeProcaptchaResponse();
|
|
48
51
|
const form = getParentForm(element);
|
|
49
52
|
if (!form) {
|
|
50
53
|
console.error("Parent form not found for the element:", element);
|
|
@@ -61,19 +64,32 @@ const validateTheme = (themeAttribute) => customThemeSet.has(themeAttribute) ? t
|
|
|
61
64
|
const setValidChallengeLength = (renderOptions, element, config) => {
|
|
62
65
|
const challengeValidLengthAttribute = renderOptions?.["challenge-valid-length"] || element.getAttribute("data-challenge-valid-length");
|
|
63
66
|
if (challengeValidLengthAttribute) {
|
|
64
|
-
config.captchas.image.solutionTimeout = parseInt(
|
|
65
|
-
|
|
67
|
+
config.captchas.image.solutionTimeout = Number.parseInt(
|
|
68
|
+
challengeValidLengthAttribute
|
|
69
|
+
);
|
|
70
|
+
config.captchas.pow.solutionTimeout = Number.parseInt(
|
|
71
|
+
challengeValidLengthAttribute
|
|
72
|
+
);
|
|
66
73
|
}
|
|
67
74
|
};
|
|
75
|
+
const removeProcaptchaResponse = () => {
|
|
76
|
+
const element = Array.from(
|
|
77
|
+
document.getElementsByName(types.ApiParams.procaptchaResponse)
|
|
78
|
+
);
|
|
79
|
+
element.map((el) => el.remove());
|
|
80
|
+
};
|
|
68
81
|
const getDefaultCallbacks = (element) => ({
|
|
69
82
|
onHuman: (token) => handleOnHuman(element, token),
|
|
70
83
|
onChallengeExpired: () => {
|
|
84
|
+
removeProcaptchaResponse();
|
|
71
85
|
console.log("Challenge expired");
|
|
72
86
|
},
|
|
73
87
|
onExpired: () => {
|
|
88
|
+
removeProcaptchaResponse();
|
|
74
89
|
alert("Completed challenge has expired, please try again");
|
|
75
90
|
},
|
|
76
91
|
onError: (error) => {
|
|
92
|
+
removeProcaptchaResponse();
|
|
77
93
|
console.error(error);
|
|
78
94
|
},
|
|
79
95
|
onClose: () => {
|
|
@@ -89,32 +105,64 @@ const setTheme = (renderOptions, element, config) => {
|
|
|
89
105
|
};
|
|
90
106
|
function setUserCallbacks(renderOptions, callbacks, element) {
|
|
91
107
|
if (typeof renderOptions?.callback === "function") {
|
|
92
|
-
|
|
108
|
+
const fn = renderOptions.callback;
|
|
109
|
+
callbacks.onHuman = (token) => {
|
|
110
|
+
handleOnHuman(element, token);
|
|
111
|
+
fn(token);
|
|
112
|
+
};
|
|
93
113
|
} else {
|
|
94
114
|
const callbackName = typeof renderOptions?.callback === "string" ? renderOptions?.callback : element.getAttribute("data-callback");
|
|
95
115
|
if (callbackName)
|
|
96
|
-
callbacks.onHuman =
|
|
116
|
+
callbacks.onHuman = (token) => {
|
|
117
|
+
handleOnHuman(element, token);
|
|
118
|
+
const fn = getWindowCallback(callbackName);
|
|
119
|
+
fn(token);
|
|
120
|
+
};
|
|
97
121
|
}
|
|
98
|
-
if (typeof renderOptions
|
|
99
|
-
|
|
122
|
+
if (renderOptions && renderOptions["chalexpired-callback"] && typeof renderOptions["chalexpired-callback"] === "function") {
|
|
123
|
+
const fn = renderOptions["chalexpired-callback"];
|
|
124
|
+
callbacks.onChallengeExpired = () => {
|
|
125
|
+
removeProcaptchaResponse();
|
|
126
|
+
fn();
|
|
127
|
+
};
|
|
100
128
|
} else {
|
|
101
129
|
const chalExpiredCallbackName = typeof renderOptions?.["chalexpired-callback"] === "string" ? renderOptions?.["chalexpired-callback"] : element.getAttribute("data-chalexpired-callback");
|
|
102
130
|
if (chalExpiredCallbackName)
|
|
103
|
-
callbacks.onChallengeExpired =
|
|
131
|
+
callbacks.onChallengeExpired = () => {
|
|
132
|
+
const fn = getWindowCallback(chalExpiredCallbackName);
|
|
133
|
+
removeProcaptchaResponse();
|
|
134
|
+
fn();
|
|
135
|
+
};
|
|
104
136
|
}
|
|
105
|
-
if (typeof renderOptions
|
|
106
|
-
|
|
137
|
+
if (renderOptions && renderOptions["expired-callback"] && typeof renderOptions["expired-callback"] === "function") {
|
|
138
|
+
const fn = renderOptions["expired-callback"];
|
|
139
|
+
callbacks.onExpired = () => {
|
|
140
|
+
removeProcaptchaResponse();
|
|
141
|
+
fn();
|
|
142
|
+
};
|
|
107
143
|
} else {
|
|
108
144
|
const onExpiredCallbackName = typeof renderOptions?.["expired-callback"] === "string" ? renderOptions?.["expired-callback"] : element.getAttribute("data-expired-callback");
|
|
109
145
|
if (onExpiredCallbackName)
|
|
110
|
-
callbacks.onExpired =
|
|
146
|
+
callbacks.onExpired = () => {
|
|
147
|
+
const fn = getWindowCallback(onExpiredCallbackName);
|
|
148
|
+
removeProcaptchaResponse();
|
|
149
|
+
fn();
|
|
150
|
+
};
|
|
111
151
|
}
|
|
112
|
-
if (
|
|
113
|
-
|
|
152
|
+
if (renderOptions && renderOptions?.["error-callback"] && typeof renderOptions["error-callback"] === "function") {
|
|
153
|
+
const fn = renderOptions["error-callback"];
|
|
154
|
+
callbacks.onError = () => {
|
|
155
|
+
removeProcaptchaResponse();
|
|
156
|
+
fn();
|
|
157
|
+
};
|
|
114
158
|
} else {
|
|
115
159
|
const errorCallbackName = typeof renderOptions?.["error-callback"] === "string" ? renderOptions?.["error-callback"] : element.getAttribute("data-error-callback");
|
|
116
160
|
if (errorCallbackName)
|
|
117
|
-
callbacks.onError =
|
|
161
|
+
callbacks.onError = () => {
|
|
162
|
+
const fn = getWindowCallback(errorCallbackName);
|
|
163
|
+
removeProcaptchaResponse();
|
|
164
|
+
fn();
|
|
165
|
+
};
|
|
118
166
|
}
|
|
119
167
|
if (typeof renderOptions?.["close-callback"] === "function") {
|
|
120
168
|
callbacks.onClose = renderOptions["close-callback"];
|
|
@@ -134,26 +182,34 @@ function setUserCallbacks(renderOptions, callbacks, element) {
|
|
|
134
182
|
}
|
|
135
183
|
}
|
|
136
184
|
const renderLogic = (elements, config, renderOptions) => {
|
|
137
|
-
|
|
185
|
+
for (const element of elements) {
|
|
138
186
|
const callbacks = getDefaultCallbacks(element);
|
|
139
187
|
setUserCallbacks(renderOptions, callbacks, element);
|
|
140
188
|
setTheme(renderOptions, element, config);
|
|
141
189
|
setValidChallengeLength(renderOptions, element, config);
|
|
142
190
|
switch (renderOptions?.captchaType) {
|
|
143
191
|
case "pow":
|
|
144
|
-
client.createRoot(element).render(
|
|
192
|
+
client.createRoot(element).render(
|
|
193
|
+
/* @__PURE__ */ jsxRuntime.jsx(procaptchaPow.ProcaptchaPow, { config, callbacks })
|
|
194
|
+
);
|
|
145
195
|
break;
|
|
146
196
|
case "frictionless":
|
|
147
|
-
client.createRoot(element).render(
|
|
197
|
+
client.createRoot(element).render(
|
|
198
|
+
/* @__PURE__ */ jsxRuntime.jsx(procaptchaFrictionless.ProcaptchaFrictionless, { config, callbacks })
|
|
199
|
+
);
|
|
148
200
|
break;
|
|
149
201
|
default:
|
|
150
|
-
client.createRoot(element).render(
|
|
202
|
+
client.createRoot(element).render(
|
|
203
|
+
/* @__PURE__ */ jsxRuntime.jsx(procaptchaReact.Procaptcha, { config, callbacks })
|
|
204
|
+
);
|
|
151
205
|
break;
|
|
152
206
|
}
|
|
153
|
-
}
|
|
207
|
+
}
|
|
154
208
|
};
|
|
155
209
|
const implicitRender = () => {
|
|
156
|
-
const elements = Array.from(
|
|
210
|
+
const elements = Array.from(
|
|
211
|
+
document.getElementsByClassName("procaptcha")
|
|
212
|
+
);
|
|
157
213
|
if (elements.length) {
|
|
158
214
|
const siteKey = util.at(elements, 0).getAttribute("data-sitekey");
|
|
159
215
|
if (!siteKey) {
|
|
@@ -161,7 +217,9 @@ const implicitRender = () => {
|
|
|
161
217
|
return;
|
|
162
218
|
}
|
|
163
219
|
const features = Object.values(types.FeaturesEnum);
|
|
164
|
-
const captchaType = features.find(
|
|
220
|
+
const captchaType = features.find(
|
|
221
|
+
(feature) => feature === util.at(elements, 0).getAttribute("data-captcha-type")
|
|
222
|
+
) || "frictionless";
|
|
165
223
|
renderLogic(elements, getConfig(siteKey), { captchaType, siteKey });
|
|
166
224
|
}
|
|
167
225
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { Features, ProcaptchaToken } from
|
|
1
|
+
import { type Features, type ProcaptchaToken } from "@prosopo/types";
|
|
2
2
|
interface ProcaptchaRenderOptions {
|
|
3
3
|
siteKey: string;
|
|
4
|
-
theme?:
|
|
4
|
+
theme?: "light" | "dark";
|
|
5
5
|
captchaType?: Features;
|
|
6
6
|
callback?: string | ((token: ProcaptchaToken) => void);
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
7
|
+
"challenge-valid-length"?: string;
|
|
8
|
+
"chalexpired-callback"?: string | (() => void);
|
|
9
|
+
"expired-callback"?: string | (() => void);
|
|
10
|
+
"open-callback"?: string | (() => void);
|
|
11
|
+
"close-callback"?: string | (() => void);
|
|
12
|
+
"error-callback"?: string | (() => void);
|
|
13
13
|
}
|
|
14
14
|
export declare const render: (element: Element, renderOptions: ProcaptchaRenderOptions) => void;
|
|
15
15
|
export default function ready(fn: () => void): void;
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AAgBA,OAAO,EAGL,KAAK,QAAQ,EAMb,KAAK,eAAe,EACrB,MAAM,gBAAgB,CAAC;AAIxB,UAAU,uBAAuB;IAC/B,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;IACzB,WAAW,CAAC,EAAE,QAAQ,CAAC;IACvB,QAAQ,CAAC,EAAE,MAAM,GAAG,CAAC,CAAC,KAAK,EAAE,eAAe,KAAK,IAAI,CAAC,CAAC;IACvD,wBAAwB,CAAC,EAAE,MAAM,CAAC;IAClC,sBAAsB,CAAC,EAAE,MAAM,GAAG,CAAC,MAAM,IAAI,CAAC,CAAC;IAC/C,kBAAkB,CAAC,EAAE,MAAM,GAAG,CAAC,MAAM,IAAI,CAAC,CAAC;IAC3C,eAAe,CAAC,EAAE,MAAM,GAAG,CAAC,MAAM,IAAI,CAAC,CAAC;IACxC,gBAAgB,CAAC,EAAE,MAAM,GAAG,CAAC,MAAM,IAAI,CAAC,CAAC;IACzC,gBAAgB,CAAC,EAAE,MAAM,GAAG,CAAC,MAAM,IAAI,CAAC,CAAC;CAC1C;AAoUD,eAAO,MAAM,MAAM,YACR,OAAO,iBACD,uBAAuB,SAKvC,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,KAAK,CAAC,EAAE,EAAE,MAAM,IAAI,QAQ3C;AAGD,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,MAAM;QACd,UAAU,EAAE;YAAE,KAAK,EAAE,OAAO,KAAK,CAAC;YAAC,MAAM,EAAE,OAAO,MAAM,CAAA;SAAE,CAAC;KAC5D;CACF"}
|
package/dist/index.js
CHANGED
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { at } from
|
|
7
|
-
import { createRoot } from
|
|
8
|
-
const BUNDLE_NAME =
|
|
2
|
+
import { ProcaptchaFrictionless } from "@prosopo/procaptcha-frictionless";
|
|
3
|
+
import { ProcaptchaPow } from "@prosopo/procaptcha-pow";
|
|
4
|
+
import { Procaptcha } from "@prosopo/procaptcha-react";
|
|
5
|
+
import { ApiParams, EnvironmentTypesSchema, FeaturesEnum, NetworkNamesSchema, ProcaptchaConfigSchema, } from "@prosopo/types";
|
|
6
|
+
import { at } from "@prosopo/util";
|
|
7
|
+
import { createRoot } from "react-dom/client";
|
|
8
|
+
const BUNDLE_NAME = "procaptcha.bundle.js";
|
|
9
9
|
const getProcaptchaScript = () => document.querySelector(`script[src*="${BUNDLE_NAME}"]`);
|
|
10
10
|
const extractParams = (name) => {
|
|
11
11
|
const script = getProcaptchaScript();
|
|
12
12
|
if (script && script.src.indexOf(`${name}`) !== -1) {
|
|
13
|
-
const params = new URLSearchParams(script.src.split(
|
|
13
|
+
const params = new URLSearchParams(script.src.split("?")[1]);
|
|
14
14
|
return {
|
|
15
|
-
onloadUrlCallback: params.get(
|
|
16
|
-
renderExplicit: params.get(
|
|
15
|
+
onloadUrlCallback: params.get("onload") || undefined,
|
|
16
|
+
renderExplicit: params.get("render") || undefined,
|
|
17
17
|
};
|
|
18
18
|
}
|
|
19
19
|
return { onloadUrlCallback: undefined, renderExplicit: undefined };
|
|
20
20
|
};
|
|
21
21
|
const getConfig = (siteKey) => {
|
|
22
22
|
if (!siteKey) {
|
|
23
|
-
siteKey = process.env.PROSOPO_SITE_KEY ||
|
|
23
|
+
siteKey = process.env.PROSOPO_SITE_KEY || "";
|
|
24
24
|
}
|
|
25
25
|
return ProcaptchaConfigSchema.parse({
|
|
26
26
|
defaultEnvironment: process.env.PROSOPO_DEFAULT_ENVIRONMENT
|
|
@@ -29,160 +29,208 @@ const getConfig = (siteKey) => {
|
|
|
29
29
|
defaultNetwork: process.env.PROSOPO_DEFAULT_NETWORK
|
|
30
30
|
? NetworkNamesSchema.parse(process.env.PROSOPO_DEFAULT_NETWORK)
|
|
31
31
|
: NetworkNamesSchema.enum.development,
|
|
32
|
-
userAccountAddress:
|
|
32
|
+
userAccountAddress: "",
|
|
33
33
|
account: {
|
|
34
34
|
address: siteKey,
|
|
35
35
|
},
|
|
36
|
-
serverUrl: process.env.PROSOPO_SERVER_URL ||
|
|
37
|
-
mongoAtlasUri: process.env.PROSOPO_MONGO_EVENTS_URI ||
|
|
38
|
-
devOnlyWatchEvents: process.env._DEV_ONLY_WATCH_EVENTS ===
|
|
36
|
+
serverUrl: process.env.PROSOPO_SERVER_URL || "",
|
|
37
|
+
mongoAtlasUri: process.env.PROSOPO_MONGO_EVENTS_URI || "",
|
|
38
|
+
devOnlyWatchEvents: process.env._DEV_ONLY_WATCH_EVENTS === "true" || false,
|
|
39
39
|
});
|
|
40
40
|
};
|
|
41
|
-
const getParentForm = (element) => element.closest(
|
|
41
|
+
const getParentForm = (element) => element.closest("form");
|
|
42
42
|
const getWindowCallback = (callbackName) => {
|
|
43
|
-
const fn = window[callbackName.replace(
|
|
44
|
-
if (typeof fn !==
|
|
43
|
+
const fn = window[callbackName.replace("window.", "")];
|
|
44
|
+
if (typeof fn !== "function") {
|
|
45
45
|
throw new Error(`Callback ${callbackName} is not defined on the window object`);
|
|
46
46
|
}
|
|
47
47
|
return fn;
|
|
48
48
|
};
|
|
49
49
|
const handleOnHuman = (element, token) => {
|
|
50
|
+
removeProcaptchaResponse();
|
|
50
51
|
const form = getParentForm(element);
|
|
51
52
|
if (!form) {
|
|
52
|
-
console.error(
|
|
53
|
+
console.error("Parent form not found for the element:", element);
|
|
53
54
|
return;
|
|
54
55
|
}
|
|
55
|
-
const input = document.createElement(
|
|
56
|
-
input.type =
|
|
56
|
+
const input = document.createElement("input");
|
|
57
|
+
input.type = "hidden";
|
|
57
58
|
input.name = ApiParams.procaptchaResponse;
|
|
58
59
|
input.value = token;
|
|
59
60
|
form.appendChild(input);
|
|
60
61
|
};
|
|
61
|
-
const customThemeSet = new Set([
|
|
62
|
-
const validateTheme = (themeAttribute) => customThemeSet.has(themeAttribute)
|
|
62
|
+
const customThemeSet = new Set(["light", "dark"]);
|
|
63
|
+
const validateTheme = (themeAttribute) => customThemeSet.has(themeAttribute)
|
|
64
|
+
? themeAttribute
|
|
65
|
+
: "light";
|
|
63
66
|
const setValidChallengeLength = (renderOptions, element, config) => {
|
|
64
|
-
const challengeValidLengthAttribute = renderOptions?.[
|
|
67
|
+
const challengeValidLengthAttribute = renderOptions?.["challenge-valid-length"] ||
|
|
68
|
+
element.getAttribute("data-challenge-valid-length");
|
|
65
69
|
if (challengeValidLengthAttribute) {
|
|
66
|
-
config.captchas.image.solutionTimeout = parseInt(challengeValidLengthAttribute);
|
|
67
|
-
config.captchas.pow.solutionTimeout = parseInt(challengeValidLengthAttribute);
|
|
70
|
+
config.captchas.image.solutionTimeout = Number.parseInt(challengeValidLengthAttribute);
|
|
71
|
+
config.captchas.pow.solutionTimeout = Number.parseInt(challengeValidLengthAttribute);
|
|
68
72
|
}
|
|
69
73
|
};
|
|
74
|
+
const removeProcaptchaResponse = () => {
|
|
75
|
+
const element = Array.from(document.getElementsByName(ApiParams.procaptchaResponse));
|
|
76
|
+
element.map((el) => el.remove());
|
|
77
|
+
};
|
|
70
78
|
const getDefaultCallbacks = (element) => ({
|
|
71
79
|
onHuman: (token) => handleOnHuman(element, token),
|
|
72
80
|
onChallengeExpired: () => {
|
|
73
|
-
|
|
81
|
+
removeProcaptchaResponse();
|
|
82
|
+
console.log("Challenge expired");
|
|
74
83
|
},
|
|
75
84
|
onExpired: () => {
|
|
76
|
-
|
|
85
|
+
removeProcaptchaResponse();
|
|
86
|
+
alert("Completed challenge has expired, please try again");
|
|
77
87
|
},
|
|
78
88
|
onError: (error) => {
|
|
89
|
+
removeProcaptchaResponse();
|
|
79
90
|
console.error(error);
|
|
80
91
|
},
|
|
81
92
|
onClose: () => {
|
|
82
|
-
console.log(
|
|
93
|
+
console.log("Challenge closed");
|
|
83
94
|
},
|
|
84
95
|
onOpen: () => {
|
|
85
|
-
console.log(
|
|
96
|
+
console.log("Challenge opened");
|
|
86
97
|
},
|
|
87
98
|
});
|
|
88
99
|
const setTheme = (renderOptions, element, config) => {
|
|
89
|
-
const themeAttribute = renderOptions?.theme || element.getAttribute(
|
|
100
|
+
const themeAttribute = renderOptions?.theme || element.getAttribute("data-theme") || "light";
|
|
90
101
|
config.theme = validateTheme(themeAttribute);
|
|
91
102
|
};
|
|
92
103
|
function setUserCallbacks(renderOptions, callbacks, element) {
|
|
93
|
-
if (typeof renderOptions?.callback ===
|
|
94
|
-
|
|
104
|
+
if (typeof renderOptions?.callback === "function") {
|
|
105
|
+
const fn = renderOptions.callback;
|
|
106
|
+
callbacks.onHuman = (token) => {
|
|
107
|
+
handleOnHuman(element, token);
|
|
108
|
+
fn(token);
|
|
109
|
+
};
|
|
95
110
|
}
|
|
96
111
|
else {
|
|
97
|
-
const callbackName = typeof renderOptions?.callback ===
|
|
112
|
+
const callbackName = typeof renderOptions?.callback === "string"
|
|
98
113
|
? renderOptions?.callback
|
|
99
|
-
: element.getAttribute(
|
|
114
|
+
: element.getAttribute("data-callback");
|
|
100
115
|
if (callbackName)
|
|
101
|
-
callbacks.onHuman =
|
|
116
|
+
callbacks.onHuman = (token) => {
|
|
117
|
+
handleOnHuman(element, token);
|
|
118
|
+
const fn = getWindowCallback(callbackName);
|
|
119
|
+
fn(token);
|
|
120
|
+
};
|
|
102
121
|
}
|
|
103
|
-
if (
|
|
104
|
-
|
|
122
|
+
if (renderOptions &&
|
|
123
|
+
renderOptions["chalexpired-callback"] &&
|
|
124
|
+
typeof renderOptions["chalexpired-callback"] === "function") {
|
|
125
|
+
const fn = renderOptions["chalexpired-callback"];
|
|
126
|
+
callbacks.onChallengeExpired = () => {
|
|
127
|
+
removeProcaptchaResponse();
|
|
128
|
+
fn();
|
|
129
|
+
};
|
|
105
130
|
}
|
|
106
131
|
else {
|
|
107
|
-
const chalExpiredCallbackName = typeof renderOptions?.[
|
|
108
|
-
? renderOptions?.[
|
|
109
|
-
: element.getAttribute(
|
|
132
|
+
const chalExpiredCallbackName = typeof renderOptions?.["chalexpired-callback"] === "string"
|
|
133
|
+
? renderOptions?.["chalexpired-callback"]
|
|
134
|
+
: element.getAttribute("data-chalexpired-callback");
|
|
110
135
|
if (chalExpiredCallbackName)
|
|
111
|
-
callbacks.onChallengeExpired =
|
|
136
|
+
callbacks.onChallengeExpired = () => {
|
|
137
|
+
const fn = getWindowCallback(chalExpiredCallbackName);
|
|
138
|
+
removeProcaptchaResponse();
|
|
139
|
+
fn();
|
|
140
|
+
};
|
|
112
141
|
}
|
|
113
|
-
if (
|
|
114
|
-
|
|
142
|
+
if (renderOptions &&
|
|
143
|
+
renderOptions["expired-callback"] &&
|
|
144
|
+
typeof renderOptions["expired-callback"] === "function") {
|
|
145
|
+
const fn = renderOptions["expired-callback"];
|
|
146
|
+
callbacks.onExpired = () => {
|
|
147
|
+
removeProcaptchaResponse();
|
|
148
|
+
fn();
|
|
149
|
+
};
|
|
115
150
|
}
|
|
116
151
|
else {
|
|
117
|
-
const onExpiredCallbackName = typeof renderOptions?.[
|
|
118
|
-
? renderOptions?.[
|
|
119
|
-
: element.getAttribute(
|
|
152
|
+
const onExpiredCallbackName = typeof renderOptions?.["expired-callback"] === "string"
|
|
153
|
+
? renderOptions?.["expired-callback"]
|
|
154
|
+
: element.getAttribute("data-expired-callback");
|
|
120
155
|
if (onExpiredCallbackName)
|
|
121
|
-
callbacks.onExpired =
|
|
156
|
+
callbacks.onExpired = () => {
|
|
157
|
+
const fn = getWindowCallback(onExpiredCallbackName);
|
|
158
|
+
removeProcaptchaResponse();
|
|
159
|
+
fn();
|
|
160
|
+
};
|
|
122
161
|
}
|
|
123
|
-
if (
|
|
124
|
-
|
|
162
|
+
if (renderOptions &&
|
|
163
|
+
renderOptions?.["error-callback"] &&
|
|
164
|
+
typeof renderOptions["error-callback"] === "function") {
|
|
165
|
+
const fn = renderOptions["error-callback"];
|
|
166
|
+
callbacks.onError = () => {
|
|
167
|
+
removeProcaptchaResponse();
|
|
168
|
+
fn();
|
|
169
|
+
};
|
|
125
170
|
}
|
|
126
171
|
else {
|
|
127
|
-
const errorCallbackName = typeof renderOptions?.[
|
|
128
|
-
? renderOptions?.[
|
|
129
|
-
: element.getAttribute(
|
|
172
|
+
const errorCallbackName = typeof renderOptions?.["error-callback"] === "string"
|
|
173
|
+
? renderOptions?.["error-callback"]
|
|
174
|
+
: element.getAttribute("data-error-callback");
|
|
130
175
|
if (errorCallbackName)
|
|
131
|
-
callbacks.onError =
|
|
176
|
+
callbacks.onError = () => {
|
|
177
|
+
const fn = getWindowCallback(errorCallbackName);
|
|
178
|
+
removeProcaptchaResponse();
|
|
179
|
+
fn();
|
|
180
|
+
};
|
|
132
181
|
}
|
|
133
|
-
if (typeof renderOptions?.[
|
|
134
|
-
callbacks.onClose = renderOptions[
|
|
182
|
+
if (typeof renderOptions?.["close-callback"] === "function") {
|
|
183
|
+
callbacks.onClose = renderOptions["close-callback"];
|
|
135
184
|
}
|
|
136
185
|
else {
|
|
137
|
-
const onCloseCallbackName = typeof renderOptions?.[
|
|
138
|
-
? renderOptions?.[
|
|
139
|
-
: element.getAttribute(
|
|
186
|
+
const onCloseCallbackName = typeof renderOptions?.["close-callback"] === "string"
|
|
187
|
+
? renderOptions?.["close-callback"]
|
|
188
|
+
: element.getAttribute("data-close-callback");
|
|
140
189
|
if (onCloseCallbackName)
|
|
141
190
|
callbacks.onClose = getWindowCallback(onCloseCallbackName);
|
|
142
191
|
}
|
|
143
|
-
if (renderOptions?.[
|
|
144
|
-
if (typeof renderOptions[
|
|
145
|
-
callbacks.onOpen = renderOptions[
|
|
192
|
+
if (renderOptions?.["open-callback"]) {
|
|
193
|
+
if (typeof renderOptions["open-callback"] === "function") {
|
|
194
|
+
callbacks.onOpen = renderOptions["open-callback"];
|
|
146
195
|
}
|
|
147
196
|
else {
|
|
148
|
-
const onOpenCallbackName = typeof renderOptions?.[
|
|
149
|
-
? renderOptions?.[
|
|
150
|
-
: element.getAttribute(
|
|
197
|
+
const onOpenCallbackName = typeof renderOptions?.["open-callback"] === "string"
|
|
198
|
+
? renderOptions?.["open-callback"]
|
|
199
|
+
: element.getAttribute("data-open-callback");
|
|
151
200
|
if (onOpenCallbackName)
|
|
152
201
|
callbacks.onOpen = getWindowCallback(onOpenCallbackName);
|
|
153
202
|
}
|
|
154
203
|
}
|
|
155
204
|
}
|
|
156
205
|
const renderLogic = (elements, config, renderOptions) => {
|
|
157
|
-
|
|
206
|
+
for (const element of elements) {
|
|
158
207
|
const callbacks = getDefaultCallbacks(element);
|
|
159
208
|
setUserCallbacks(renderOptions, callbacks, element);
|
|
160
209
|
setTheme(renderOptions, element, config);
|
|
161
210
|
setValidChallengeLength(renderOptions, element, config);
|
|
162
211
|
switch (renderOptions?.captchaType) {
|
|
163
|
-
case
|
|
212
|
+
case "pow":
|
|
164
213
|
createRoot(element).render(_jsx(ProcaptchaPow, { config: config, callbacks: callbacks }));
|
|
165
214
|
break;
|
|
166
|
-
case
|
|
215
|
+
case "frictionless":
|
|
167
216
|
createRoot(element).render(_jsx(ProcaptchaFrictionless, { config: config, callbacks: callbacks }));
|
|
168
217
|
break;
|
|
169
218
|
default:
|
|
170
219
|
createRoot(element).render(_jsx(Procaptcha, { config: config, callbacks: callbacks }));
|
|
171
220
|
break;
|
|
172
221
|
}
|
|
173
|
-
}
|
|
222
|
+
}
|
|
174
223
|
};
|
|
175
224
|
const implicitRender = () => {
|
|
176
|
-
const elements = Array.from(document.getElementsByClassName(
|
|
225
|
+
const elements = Array.from(document.getElementsByClassName("procaptcha"));
|
|
177
226
|
if (elements.length) {
|
|
178
|
-
const siteKey = at(elements, 0).getAttribute(
|
|
227
|
+
const siteKey = at(elements, 0).getAttribute("data-sitekey");
|
|
179
228
|
if (!siteKey) {
|
|
180
|
-
console.error(
|
|
229
|
+
console.error("No siteKey found");
|
|
181
230
|
return;
|
|
182
231
|
}
|
|
183
232
|
const features = Object.values(FeaturesEnum);
|
|
184
|
-
const captchaType = features.find((feature) => feature === at(elements, 0).getAttribute(
|
|
185
|
-
'frictionless';
|
|
233
|
+
const captchaType = features.find((feature) => feature === at(elements, 0).getAttribute("data-captcha-type")) || "frictionless";
|
|
186
234
|
renderLogic(elements, getConfig(siteKey), { captchaType, siteKey });
|
|
187
235
|
}
|
|
188
236
|
};
|
|
@@ -191,23 +239,23 @@ export const render = (element, renderOptions) => {
|
|
|
191
239
|
renderLogic([element], getConfig(siteKey), renderOptions);
|
|
192
240
|
};
|
|
193
241
|
export default function ready(fn) {
|
|
194
|
-
if (document && document.readyState !==
|
|
195
|
-
console.log(
|
|
242
|
+
if (document && document.readyState !== "loading") {
|
|
243
|
+
console.log("document.readyState ready!");
|
|
196
244
|
fn();
|
|
197
245
|
}
|
|
198
246
|
else {
|
|
199
|
-
console.log(
|
|
200
|
-
document.addEventListener(
|
|
247
|
+
console.log("DOMContentLoaded listener!");
|
|
248
|
+
document.addEventListener("DOMContentLoaded", fn);
|
|
201
249
|
}
|
|
202
250
|
}
|
|
203
251
|
window.procaptcha = { ready, render };
|
|
204
252
|
const { onloadUrlCallback, renderExplicit } = extractParams(BUNDLE_NAME);
|
|
205
|
-
if (renderExplicit !==
|
|
253
|
+
if (renderExplicit !== "explicit") {
|
|
206
254
|
ready(implicitRender);
|
|
207
255
|
}
|
|
208
256
|
if (onloadUrlCallback) {
|
|
209
257
|
const onloadCallback = getWindowCallback(onloadUrlCallback);
|
|
210
|
-
getProcaptchaScript()?.addEventListener(
|
|
258
|
+
getProcaptchaScript()?.addEventListener("load", () => {
|
|
211
259
|
ready(onloadCallback);
|
|
212
260
|
});
|
|
213
261
|
}
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.tsx"],"names":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