@prosopo/procaptcha-bundle 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/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/configCreator.d.ts +5 -0
- package/.rollup.cache/home/runner/work/{captcha-private/captcha-private → captcha}/captcha/packages/procaptcha-bundle/dist/bundle/util/configCreator.d.ts.map +1 -1
- package/.rollup.cache/home/runner/work/{captcha-private/captcha-private → captcha}/captcha/packages/procaptcha-bundle/dist/bundle/util/configCreator.js.map +1 -1
- package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/language.js.map +1 -0
- package/CHANGELOG.md +40 -0
- package/dist/bundle/{ProcaptchaWidget-CCSN3Dxj.js → ProcaptchaWidget---OaFVSu.js} +7 -7
- package/dist/bundle/ProcaptchaWidget-DfzlzDL_.js +360 -0
- package/dist/bundle/{asU8a-CAsEnbuP.js → asU8a-OYI2Rcme.js} +1 -1
- package/dist/bundle/bip39-CaW9jcCq.js +365 -0
- package/dist/bundle/captchaComponentProvider-CJMWWGqv.js +1242 -0
- package/dist/bundle/{captchaRenderer-BBodRhQu.js → captchaRenderer-BmSy0ym0.js} +3 -3
- package/dist/bundle/{emotion-element-5486c51c.browser.esm-CQHFV-dS.js → emotion-element-5486c51c.browser.esm-F-LKH1Q7.js} +287 -285
- package/dist/bundle/{hash-D-64Vz5z.js → hash-COecnuJ8.js} +796 -483
- package/dist/bundle/{i18nFrontend-C_RgmvGh.js → i18nFrontend-CsPT71ro.js} +1 -1
- package/dist/bundle/index-BjRdPnnE.js +1198 -0
- package/dist/bundle/{index-9I1Aae33.js → index-C30GRfJ0.js} +1 -1
- package/dist/bundle/{index-DkQ4njKa.js → index-D-5CyFkP.js} +7 -7
- package/dist/bundle/{index-DxswvPTy.js → index-DXEN8xWW.js} +170 -180
- package/dist/bundle/index-DcOF3IPl.js +4386 -0
- package/dist/bundle/locales/ar/translation.json +56 -0
- package/dist/bundle/locales/az/translation.json +56 -0
- package/dist/bundle/locales/cs/translation.json +56 -0
- package/dist/bundle/locales/el/translation.json +56 -0
- package/dist/bundle/locales/fi/translation.json +56 -0
- package/dist/bundle/locales/fr/translation.json +1 -1
- package/dist/bundle/locales/hi/translation.json +56 -0
- package/dist/bundle/locales/hu/translation.json +56 -0
- package/dist/bundle/locales/id/translation.json +56 -0
- package/dist/bundle/locales/ja/translation.json +56 -0
- package/dist/bundle/locales/jv/translation.json +56 -0
- package/dist/bundle/locales/ko/translation.json +56 -0
- package/dist/bundle/locales/ml/translation.json +56 -0
- package/dist/bundle/locales/ms/translation.json +56 -0
- package/dist/bundle/locales/nl/translation.json +56 -0
- package/dist/bundle/locales/no/translation.json +56 -0
- package/dist/bundle/locales/pl/translation.json +56 -0
- package/dist/bundle/locales/{pt-BR → pt-br}/translation.json +17 -17
- package/dist/bundle/locales/ro/translation.json +56 -0
- package/dist/bundle/locales/ru/translation.json +56 -0
- package/dist/bundle/locales/sr/translation.json +56 -0
- package/dist/bundle/locales/sv/translation.json +56 -0
- package/dist/bundle/locales/th/translation.json +56 -0
- package/dist/bundle/locales/tr/translation.json +56 -0
- package/dist/bundle/locales/uk/translation.json +56 -0
- package/dist/bundle/locales/vi/translation.json +56 -0
- package/dist/bundle/locales/zh-cn/translation.json +56 -0
- package/dist/bundle/procaptcha.bundle.js +1 -1
- package/dist/bundle/toU8a-C68WUzs_.js +24 -0
- package/dist/bundle/{translations-B0P9axY3.js → translations-DEL070wJ.js} +59 -26
- package/dist/bundle/{useTranslation-CEt2t9kE.js → useTranslation-DpuHI3Mv.js} +3 -3
- package/dist/bundle/util/configCreator.d.ts +2 -2
- package/dist/bundle/util/configCreator.d.ts.map +1 -1
- package/dist/cjs/index.cjs +163 -0
- package/dist/cjs/util/captcha/captchaComponentProvider.cjs +19 -0
- package/dist/cjs/util/captcha/captchaComponentsList.cjs +12 -0
- package/dist/cjs/util/captcha/captchaRenderer.cjs +65 -0
- package/dist/cjs/util/captcha/captchaType.cjs +12 -0
- package/dist/cjs/util/captcha/components/frictionlessCaptcha.cjs +24 -0
- package/dist/cjs/util/captcha/components/imageCaptcha.cjs +17 -0
- package/dist/cjs/util/captcha/components/powCaptcha.cjs +17 -0
- package/dist/cjs/util/config.cjs +16 -0
- package/dist/cjs/util/configCreator.cjs +23 -0
- package/dist/cjs/util/language.cjs +18 -0
- package/dist/cjs/util/timeout.cjs +14 -0
- package/dist/cjs/util/widgetFactory.cjs +84 -0
- package/dist/cjs/util/widgetThemeResolver.cjs +16 -0
- package/dist/util/configCreator.d.ts +2 -2
- package/dist/util/configCreator.d.ts.map +1 -1
- package/dist/util/configCreator.js.map +1 -1
- package/dist/util/language.js.map +1 -1
- package/package.json +16 -13
- package/stats.html +1 -1
- package/.rollup.cache/home/runner/work/captcha-private/captcha-private/captcha/packages/procaptcha-bundle/dist/bundle/util/configCreator.d.ts +0 -5
- package/.rollup.cache/home/runner/work/captcha-private/captcha-private/captcha/packages/procaptcha-bundle/dist/bundle/util/language.js.map +0 -1
- package/dist/bundle/ProcaptchaWidget-Dfex8hc8.js +0 -156
- package/dist/bundle/bip39-DCaMcFzo.js +0 -260
- package/dist/bundle/captchaComponentProvider-Dm44AMrY.js +0 -1018
- package/dist/bundle/index-DCHEbWAs.js +0 -1242
- package/dist/bundle/index-nNwZuute.js +0 -4373
- package/dist/bundle/sha256-Cxc9Hrlx.js +0 -171
- package/dist/bundle/toU8a-BWKf-2UU.js +0 -133
- /package/.rollup.cache/home/runner/work/{captcha-private/captcha-private → captcha}/captcha/packages/procaptcha-bundle/dist/bundle/components.d.ts +0 -0
- /package/.rollup.cache/home/runner/work/{captcha-private/captcha-private → captcha}/captcha/packages/procaptcha-bundle/dist/bundle/components.d.ts.map +0 -0
- /package/.rollup.cache/home/runner/work/{captcha-private/captcha-private → captcha}/captcha/packages/procaptcha-bundle/dist/bundle/components.js +0 -0
- /package/.rollup.cache/home/runner/work/{captcha-private/captcha-private → captcha}/captcha/packages/procaptcha-bundle/dist/bundle/components.js.map +0 -0
- /package/.rollup.cache/home/runner/work/{captcha-private/captcha-private → captcha}/captcha/packages/procaptcha-bundle/dist/bundle/index.d.ts +0 -0
- /package/.rollup.cache/home/runner/work/{captcha-private/captcha-private → captcha}/captcha/packages/procaptcha-bundle/dist/bundle/index.d.ts.map +0 -0
- /package/.rollup.cache/home/runner/work/{captcha-private/captcha-private → captcha}/captcha/packages/procaptcha-bundle/dist/bundle/index.js +0 -0
- /package/.rollup.cache/home/runner/work/{captcha-private/captcha-private → captcha}/captcha/packages/procaptcha-bundle/dist/bundle/index.js.map +0 -0
- /package/.rollup.cache/home/runner/work/{captcha-private/captcha-private → captcha}/captcha/packages/procaptcha-bundle/dist/bundle/tests/util/captchaType.test.d.ts +0 -0
- /package/.rollup.cache/home/runner/work/{captcha-private/captcha-private → captcha}/captcha/packages/procaptcha-bundle/dist/bundle/tests/util/captchaType.test.d.ts.map +0 -0
- /package/.rollup.cache/home/runner/work/{captcha-private/captcha-private → captcha}/captcha/packages/procaptcha-bundle/dist/bundle/tests/util/captchaType.test.js +0 -0
- /package/.rollup.cache/home/runner/work/{captcha-private/captcha-private → captcha}/captcha/packages/procaptcha-bundle/dist/bundle/tests/util/captchaType.test.js.map +0 -0
- /package/.rollup.cache/home/runner/work/{captcha-private/captcha-private → captcha}/captcha/packages/procaptcha-bundle/dist/bundle/tests/util/config.test.d.ts +0 -0
- /package/.rollup.cache/home/runner/work/{captcha-private/captcha-private → captcha}/captcha/packages/procaptcha-bundle/dist/bundle/tests/util/config.test.d.ts.map +0 -0
- /package/.rollup.cache/home/runner/work/{captcha-private/captcha-private → captcha}/captcha/packages/procaptcha-bundle/dist/bundle/tests/util/config.test.js +0 -0
- /package/.rollup.cache/home/runner/work/{captcha-private/captcha-private → captcha}/captcha/packages/procaptcha-bundle/dist/bundle/tests/util/config.test.js.map +0 -0
- /package/.rollup.cache/home/runner/work/{captcha-private/captcha-private → captcha}/captcha/packages/procaptcha-bundle/dist/bundle/tests/util/renderLogic.test.d.ts +0 -0
- /package/.rollup.cache/home/runner/work/{captcha-private/captcha-private → captcha}/captcha/packages/procaptcha-bundle/dist/bundle/tests/util/renderLogic.test.d.ts.map +0 -0
- /package/.rollup.cache/home/runner/work/{captcha-private/captcha-private → captcha}/captcha/packages/procaptcha-bundle/dist/bundle/tests/util/renderLogic.test.js +0 -0
- /package/.rollup.cache/home/runner/work/{captcha-private/captcha-private → captcha}/captcha/packages/procaptcha-bundle/dist/bundle/tests/util/renderLogic.test.js.map +0 -0
- /package/.rollup.cache/home/runner/work/{captcha-private/captcha-private → captcha}/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/captchaComponentProvider.d.ts +0 -0
- /package/.rollup.cache/home/runner/work/{captcha-private/captcha-private → captcha}/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/captchaComponentProvider.d.ts.map +0 -0
- /package/.rollup.cache/home/runner/work/{captcha-private/captcha-private → captcha}/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/captchaComponentProvider.js +0 -0
- /package/.rollup.cache/home/runner/work/{captcha-private/captcha-private → captcha}/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/captchaComponentProvider.js.map +0 -0
- /package/.rollup.cache/home/runner/work/{captcha-private/captcha-private → captcha}/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/captchaComponentsList.d.ts +0 -0
- /package/.rollup.cache/home/runner/work/{captcha-private/captcha-private → captcha}/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/captchaComponentsList.d.ts.map +0 -0
- /package/.rollup.cache/home/runner/work/{captcha-private/captcha-private → captcha}/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/captchaComponentsList.js +0 -0
- /package/.rollup.cache/home/runner/work/{captcha-private/captcha-private → captcha}/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/captchaComponentsList.js.map +0 -0
- /package/.rollup.cache/home/runner/work/{captcha-private/captcha-private → captcha}/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/captchaProps.d.ts +0 -0
- /package/.rollup.cache/home/runner/work/{captcha-private/captcha-private → captcha}/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/captchaProps.d.ts.map +0 -0
- /package/.rollup.cache/home/runner/work/{captcha-private/captcha-private → captcha}/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/captchaProps.js +0 -0
- /package/.rollup.cache/home/runner/work/{captcha-private/captcha-private → captcha}/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/captchaProps.js.map +0 -0
- /package/.rollup.cache/home/runner/work/{captcha-private/captcha-private → captcha}/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/captchaRenderer.d.ts +0 -0
- /package/.rollup.cache/home/runner/work/{captcha-private/captcha-private → captcha}/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/captchaRenderer.d.ts.map +0 -0
- /package/.rollup.cache/home/runner/work/{captcha-private/captcha-private → captcha}/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/captchaRenderer.js +0 -0
- /package/.rollup.cache/home/runner/work/{captcha-private/captcha-private → captcha}/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/captchaRenderer.js.map +0 -0
- /package/.rollup.cache/home/runner/work/{captcha-private/captcha-private → captcha}/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/captchaType.d.ts +0 -0
- /package/.rollup.cache/home/runner/work/{captcha-private/captcha-private → captcha}/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/captchaType.d.ts.map +0 -0
- /package/.rollup.cache/home/runner/work/{captcha-private/captcha-private → captcha}/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/captchaType.js +0 -0
- /package/.rollup.cache/home/runner/work/{captcha-private/captcha-private → captcha}/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/captchaType.js.map +0 -0
- /package/.rollup.cache/home/runner/work/{captcha-private/captcha-private → captcha}/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/components/frictionlessCaptcha.d.ts +0 -0
- /package/.rollup.cache/home/runner/work/{captcha-private/captcha-private → captcha}/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/components/frictionlessCaptcha.d.ts.map +0 -0
- /package/.rollup.cache/home/runner/work/{captcha-private/captcha-private → captcha}/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/components/frictionlessCaptcha.js +0 -0
- /package/.rollup.cache/home/runner/work/{captcha-private/captcha-private → captcha}/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/components/frictionlessCaptcha.js.map +0 -0
- /package/.rollup.cache/home/runner/work/{captcha-private/captcha-private → captcha}/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/components/imageCaptcha.d.ts +0 -0
- /package/.rollup.cache/home/runner/work/{captcha-private/captcha-private → captcha}/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/components/imageCaptcha.d.ts.map +0 -0
- /package/.rollup.cache/home/runner/work/{captcha-private/captcha-private → captcha}/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/components/imageCaptcha.js +0 -0
- /package/.rollup.cache/home/runner/work/{captcha-private/captcha-private → captcha}/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/components/imageCaptcha.js.map +0 -0
- /package/.rollup.cache/home/runner/work/{captcha-private/captcha-private → captcha}/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/components/powCaptcha.d.ts +0 -0
- /package/.rollup.cache/home/runner/work/{captcha-private/captcha-private → captcha}/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/components/powCaptcha.d.ts.map +0 -0
- /package/.rollup.cache/home/runner/work/{captcha-private/captcha-private → captcha}/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/components/powCaptcha.js +0 -0
- /package/.rollup.cache/home/runner/work/{captcha-private/captcha-private → captcha}/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/components/powCaptcha.js.map +0 -0
- /package/.rollup.cache/home/runner/work/{captcha-private/captcha-private → captcha}/captcha/packages/procaptcha-bundle/dist/bundle/util/config.d.ts +0 -0
- /package/.rollup.cache/home/runner/work/{captcha-private/captcha-private → captcha}/captcha/packages/procaptcha-bundle/dist/bundle/util/config.d.ts.map +0 -0
- /package/.rollup.cache/home/runner/work/{captcha-private/captcha-private → captcha}/captcha/packages/procaptcha-bundle/dist/bundle/util/config.js +0 -0
- /package/.rollup.cache/home/runner/work/{captcha-private/captcha-private → captcha}/captcha/packages/procaptcha-bundle/dist/bundle/util/config.js.map +0 -0
- /package/.rollup.cache/home/runner/work/{captcha-private/captcha-private → captcha}/captcha/packages/procaptcha-bundle/dist/bundle/util/configCreator.js +0 -0
- /package/.rollup.cache/home/runner/work/{captcha-private/captcha-private → captcha}/captcha/packages/procaptcha-bundle/dist/bundle/util/language.d.ts +0 -0
- /package/.rollup.cache/home/runner/work/{captcha-private/captcha-private → captcha}/captcha/packages/procaptcha-bundle/dist/bundle/util/language.d.ts.map +0 -0
- /package/.rollup.cache/home/runner/work/{captcha-private/captcha-private → captcha}/captcha/packages/procaptcha-bundle/dist/bundle/util/language.js +0 -0
- /package/.rollup.cache/home/runner/work/{captcha-private/captcha-private → captcha}/captcha/packages/procaptcha-bundle/dist/bundle/util/timeout.d.ts +0 -0
- /package/.rollup.cache/home/runner/work/{captcha-private/captcha-private → captcha}/captcha/packages/procaptcha-bundle/dist/bundle/util/timeout.d.ts.map +0 -0
- /package/.rollup.cache/home/runner/work/{captcha-private/captcha-private → captcha}/captcha/packages/procaptcha-bundle/dist/bundle/util/timeout.js +0 -0
- /package/.rollup.cache/home/runner/work/{captcha-private/captcha-private → captcha}/captcha/packages/procaptcha-bundle/dist/bundle/util/timeout.js.map +0 -0
- /package/.rollup.cache/home/runner/work/{captcha-private/captcha-private → captcha}/captcha/packages/procaptcha-bundle/dist/bundle/util/widgetFactory.d.ts +0 -0
- /package/.rollup.cache/home/runner/work/{captcha-private/captcha-private → captcha}/captcha/packages/procaptcha-bundle/dist/bundle/util/widgetFactory.d.ts.map +0 -0
- /package/.rollup.cache/home/runner/work/{captcha-private/captcha-private → captcha}/captcha/packages/procaptcha-bundle/dist/bundle/util/widgetFactory.js +0 -0
- /package/.rollup.cache/home/runner/work/{captcha-private/captcha-private → captcha}/captcha/packages/procaptcha-bundle/dist/bundle/util/widgetFactory.js.map +0 -0
- /package/.rollup.cache/home/runner/work/{captcha-private/captcha-private → captcha}/captcha/packages/procaptcha-bundle/dist/bundle/util/widgetThemeResolver.d.ts +0 -0
- /package/.rollup.cache/home/runner/work/{captcha-private/captcha-private → captcha}/captcha/packages/procaptcha-bundle/dist/bundle/util/widgetThemeResolver.d.ts.map +0 -0
- /package/.rollup.cache/home/runner/work/{captcha-private/captcha-private → captcha}/captcha/packages/procaptcha-bundle/dist/bundle/util/widgetThemeResolver.js +0 -0
- /package/.rollup.cache/home/runner/work/{captcha-private/captcha-private → captcha}/captcha/packages/procaptcha-bundle/dist/bundle/util/widgetThemeResolver.js.map +0 -0
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
3
|
+
const procaptchaCommon = require("@prosopo/procaptcha-common");
|
|
4
|
+
const util = require("@prosopo/util");
|
|
5
|
+
const captchaType = require("./util/captcha/captchaType.cjs");
|
|
6
|
+
const config = require("./util/config.cjs");
|
|
7
|
+
const widgetFactory$1 = require("./util/widgetFactory.cjs");
|
|
8
|
+
const widgetThemeResolver = require("./util/widgetThemeResolver.cjs");
|
|
9
|
+
const BUNDLE_NAME = "procaptcha.bundle.js";
|
|
10
|
+
let procaptchaRoots = [];
|
|
11
|
+
const widgetFactory = new widgetFactory$1.WidgetFactory(new widgetThemeResolver.WidgetThemeResolver());
|
|
12
|
+
const PROCAPTCHA_EXECUTE_EVENT = "procaptcha:execute";
|
|
13
|
+
const implicitRender = async () => {
|
|
14
|
+
const elements = Array.from(
|
|
15
|
+
document.getElementsByClassName("procaptcha")
|
|
16
|
+
).filter((element) => element.tagName.toLowerCase() !== "button");
|
|
17
|
+
if (elements.length) {
|
|
18
|
+
const siteKey = util.at(elements, 0).getAttribute("data-sitekey");
|
|
19
|
+
const web3 = util.at(elements, 0).getAttribute("data-web3");
|
|
20
|
+
if (!siteKey) {
|
|
21
|
+
console.error("No siteKey found");
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
const captchaType$1 = captchaType.getCaptchaType(elements);
|
|
25
|
+
const root = await widgetFactory.createWidgets(
|
|
26
|
+
elements,
|
|
27
|
+
{
|
|
28
|
+
captchaType: captchaType$1,
|
|
29
|
+
siteKey
|
|
30
|
+
},
|
|
31
|
+
!(web3 === "true")
|
|
32
|
+
);
|
|
33
|
+
procaptchaRoots.push(...root);
|
|
34
|
+
}
|
|
35
|
+
const invisibleButtons = Array.from(
|
|
36
|
+
document.getElementsByClassName("procaptcha")
|
|
37
|
+
).filter((button) => button.tagName.toLowerCase() === "button");
|
|
38
|
+
if (invisibleButtons.length) {
|
|
39
|
+
for (const button of invisibleButtons) {
|
|
40
|
+
const siteKey = button.getAttribute("data-sitekey") || "";
|
|
41
|
+
const callback = button.getAttribute("data-callback") || "";
|
|
42
|
+
const captchaType$1 = captchaType.getCaptchaType([button]);
|
|
43
|
+
const root = await widgetFactory.createWidgets(
|
|
44
|
+
[button],
|
|
45
|
+
{
|
|
46
|
+
captchaType: captchaType$1,
|
|
47
|
+
siteKey,
|
|
48
|
+
callback
|
|
49
|
+
},
|
|
50
|
+
true,
|
|
51
|
+
true
|
|
52
|
+
);
|
|
53
|
+
procaptchaRoots.push(...root);
|
|
54
|
+
button.addEventListener("click", async (event) => {
|
|
55
|
+
event.preventDefault();
|
|
56
|
+
execute();
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
const render = async (element, renderOptions) => {
|
|
62
|
+
const hasInvisibleSize = Object.prototype.hasOwnProperty.call(renderOptions, "size") && renderOptions.size === "invisible";
|
|
63
|
+
if (hasInvisibleSize || element.tagName.toLowerCase() === "button") {
|
|
64
|
+
const roots2 = await widgetFactory.createWidgets(
|
|
65
|
+
[element],
|
|
66
|
+
renderOptions,
|
|
67
|
+
true,
|
|
68
|
+
true
|
|
69
|
+
);
|
|
70
|
+
procaptchaRoots.push(...roots2);
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
const roots = await widgetFactory.createWidgets([element], renderOptions);
|
|
74
|
+
procaptchaRoots.push(...roots);
|
|
75
|
+
};
|
|
76
|
+
function ready(fn) {
|
|
77
|
+
if (document && document.readyState !== "loading") {
|
|
78
|
+
console.log("document.readyState ready!");
|
|
79
|
+
fn();
|
|
80
|
+
} else {
|
|
81
|
+
console.log("DOMContentLoaded listener!");
|
|
82
|
+
document.addEventListener("DOMContentLoaded", () => {
|
|
83
|
+
console.log("DOMContentLoaded fired");
|
|
84
|
+
console.log(window);
|
|
85
|
+
fn();
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
const execute = () => {
|
|
90
|
+
const containers = findProcaptchaContainers();
|
|
91
|
+
if (containers.length === 0) {
|
|
92
|
+
console.error("No Procaptcha containers found for execution");
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
const executeEvent = new CustomEvent(PROCAPTCHA_EXECUTE_EVENT, {
|
|
96
|
+
detail: {
|
|
97
|
+
containerId: containers[0]?.id || "procaptcha-container",
|
|
98
|
+
containerCount: containers.length,
|
|
99
|
+
timestamp: Date.now()
|
|
100
|
+
},
|
|
101
|
+
bubbles: true,
|
|
102
|
+
cancelable: true
|
|
103
|
+
});
|
|
104
|
+
document.dispatchEvent(executeEvent);
|
|
105
|
+
};
|
|
106
|
+
function findProcaptchaContainers() {
|
|
107
|
+
const containers = [];
|
|
108
|
+
const invisibleContainers = Array.from(
|
|
109
|
+
document.querySelectorAll('[data-size="invisible"]')
|
|
110
|
+
);
|
|
111
|
+
containers.push(...invisibleContainers);
|
|
112
|
+
const idContainers = Array.from(
|
|
113
|
+
document.querySelectorAll(
|
|
114
|
+
'#procaptcha-container, [id$="-procaptcha-container"]'
|
|
115
|
+
)
|
|
116
|
+
);
|
|
117
|
+
const classContainers = Array.from(
|
|
118
|
+
document.getElementsByClassName("p-procaptcha")
|
|
119
|
+
);
|
|
120
|
+
containers.push(...classContainers);
|
|
121
|
+
for (const container of idContainers) {
|
|
122
|
+
if (!containers.includes(container)) {
|
|
123
|
+
containers.push(container);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
return containers;
|
|
127
|
+
}
|
|
128
|
+
const start = () => {
|
|
129
|
+
const { onloadUrlCallback, renderExplicit } = config.extractParams(BUNDLE_NAME);
|
|
130
|
+
let readyCalled = false;
|
|
131
|
+
if (renderExplicit !== "explicit") {
|
|
132
|
+
config.getProcaptchaScript(BUNDLE_NAME)?.addEventListener("load", () => {
|
|
133
|
+
ready(implicitRender);
|
|
134
|
+
readyCalled = true;
|
|
135
|
+
});
|
|
136
|
+
if (document.readyState === "complete" && !readyCalled) {
|
|
137
|
+
ready(implicitRender);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
if (onloadUrlCallback) {
|
|
141
|
+
config.getProcaptchaScript(BUNDLE_NAME)?.addEventListener("load", () => {
|
|
142
|
+
const onloadCallback = procaptchaCommon.getWindowCallback(onloadUrlCallback);
|
|
143
|
+
ready(onloadCallback);
|
|
144
|
+
});
|
|
145
|
+
if (document.readyState === "complete" && !readyCalled) {
|
|
146
|
+
const onloadCallback = procaptchaCommon.getWindowCallback(onloadUrlCallback);
|
|
147
|
+
ready(onloadCallback);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
};
|
|
151
|
+
const reset = () => {
|
|
152
|
+
for (const root of procaptchaRoots) {
|
|
153
|
+
root.unmount();
|
|
154
|
+
}
|
|
155
|
+
procaptchaRoots = [];
|
|
156
|
+
start();
|
|
157
|
+
};
|
|
158
|
+
window.procaptcha = { ready, render, reset, execute };
|
|
159
|
+
start();
|
|
160
|
+
exports.default = ready;
|
|
161
|
+
exports.execute = execute;
|
|
162
|
+
exports.render = render;
|
|
163
|
+
exports.reset = reset;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const jsxRuntime = require("react/jsx-runtime");
|
|
4
|
+
const captchaComponentsList = require("./captchaComponentsList.cjs");
|
|
5
|
+
class CaptchaComponentProvider {
|
|
6
|
+
getCaptchaComponent(captchaType, captchaProps) {
|
|
7
|
+
const CaptchaComponent = captchaComponentsList.captchaComponentsList[captchaType];
|
|
8
|
+
console.log(`rendering ${captchaType}`);
|
|
9
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
10
|
+
CaptchaComponent,
|
|
11
|
+
{
|
|
12
|
+
config: captchaProps.config,
|
|
13
|
+
callbacks: captchaProps.callbacks,
|
|
14
|
+
i18n: captchaProps.i18n
|
|
15
|
+
}
|
|
16
|
+
);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
exports.CaptchaComponentProvider = CaptchaComponentProvider;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const types = require("@prosopo/types");
|
|
4
|
+
const frictionlessCaptcha = require("./components/frictionlessCaptcha.cjs");
|
|
5
|
+
const imageCaptcha = require("./components/imageCaptcha.cjs");
|
|
6
|
+
const powCaptcha = require("./components/powCaptcha.cjs");
|
|
7
|
+
const captchaComponentsList = {
|
|
8
|
+
[types.CaptchaType.image]: imageCaptcha.ImageCaptcha,
|
|
9
|
+
[types.CaptchaType.pow]: powCaptcha.PowCaptcha,
|
|
10
|
+
[types.CaptchaType.frictionless]: frictionlessCaptcha.FrictionlessCaptcha
|
|
11
|
+
};
|
|
12
|
+
exports.captchaComponentsList = captchaComponentsList;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const jsxRuntime = require("react/jsx-runtime");
|
|
4
|
+
const createCache = require("@emotion/cache");
|
|
5
|
+
const react = require("@emotion/react");
|
|
6
|
+
const client = require("react-dom/client");
|
|
7
|
+
const configCreator = require("../configCreator.cjs");
|
|
8
|
+
const language = require("../language.cjs");
|
|
9
|
+
const timeout = require("../timeout.cjs");
|
|
10
|
+
class CaptchaRenderer {
|
|
11
|
+
constructor(captchaComponentProvider) {
|
|
12
|
+
this.captchaComponentProvider = captchaComponentProvider;
|
|
13
|
+
}
|
|
14
|
+
renderCaptcha(settings, container, renderOptions, callbacks, isWeb2, i18n, invisible = false) {
|
|
15
|
+
const captchaType = renderOptions?.captchaType || settings.defaultCaptchaType;
|
|
16
|
+
const config = configCreator.createConfig(
|
|
17
|
+
renderOptions.siteKey,
|
|
18
|
+
renderOptions.theme,
|
|
19
|
+
renderOptions.language,
|
|
20
|
+
isWeb2,
|
|
21
|
+
invisible
|
|
22
|
+
);
|
|
23
|
+
this.readAndValidateSettings(container, config, renderOptions);
|
|
24
|
+
const reactRoot = this.createReactRoot(
|
|
25
|
+
container,
|
|
26
|
+
settings.identifierPrefix
|
|
27
|
+
);
|
|
28
|
+
const emotionCache = this.makeEmotionCache(
|
|
29
|
+
settings.emotionCacheKey,
|
|
30
|
+
container
|
|
31
|
+
);
|
|
32
|
+
const captchaComponent = this.captchaComponentProvider.getCaptchaComponent(
|
|
33
|
+
captchaType,
|
|
34
|
+
{
|
|
35
|
+
config,
|
|
36
|
+
i18n,
|
|
37
|
+
callbacks
|
|
38
|
+
}
|
|
39
|
+
);
|
|
40
|
+
this.renderCaptchaComponent(reactRoot, emotionCache, captchaComponent);
|
|
41
|
+
return reactRoot;
|
|
42
|
+
}
|
|
43
|
+
readAndValidateSettings(element, config, renderOptions) {
|
|
44
|
+
timeout.setValidChallengeLength(renderOptions, element, config);
|
|
45
|
+
language.setLanguage(renderOptions, element, config);
|
|
46
|
+
}
|
|
47
|
+
makeEmotionCache(cacheKey, container) {
|
|
48
|
+
return createCache({
|
|
49
|
+
key: cacheKey,
|
|
50
|
+
prepend: true,
|
|
51
|
+
container
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
createReactRoot(container, identifierPrefix) {
|
|
55
|
+
return client.createRoot(container, {
|
|
56
|
+
identifierPrefix
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
renderCaptchaComponent(reactRoot, emotionCache, captchaComponent) {
|
|
60
|
+
reactRoot.render(
|
|
61
|
+
/* @__PURE__ */ jsxRuntime.jsx(react.CacheProvider, { value: emotionCache, children: captchaComponent })
|
|
62
|
+
);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
exports.CaptchaRenderer = CaptchaRenderer;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const types = require("@prosopo/types");
|
|
4
|
+
const util = require("@prosopo/util");
|
|
5
|
+
function getCaptchaType(elements) {
|
|
6
|
+
const features = Object.values(types.CaptchaType);
|
|
7
|
+
const captchaType = features.find(
|
|
8
|
+
(feature) => feature === util.at(elements, 0).getAttribute("data-captcha-type")
|
|
9
|
+
) || "frictionless";
|
|
10
|
+
return captchaType;
|
|
11
|
+
}
|
|
12
|
+
exports.getCaptchaType = getCaptchaType;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const jsxRuntime = require("react/jsx-runtime");
|
|
4
|
+
const procaptchaCommon = require("@prosopo/procaptcha-common");
|
|
5
|
+
const procaptchaFrictionless = require("@prosopo/procaptcha-frictionless");
|
|
6
|
+
const react = require("react");
|
|
7
|
+
const FrictionlessCaptcha = (props) => {
|
|
8
|
+
const { config, callbacks, i18n } = props;
|
|
9
|
+
const [componentKey, setComponentKey] = react.useState(0);
|
|
10
|
+
const restart = () => {
|
|
11
|
+
setComponentKey((prevKey) => prevKey + 1);
|
|
12
|
+
};
|
|
13
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
14
|
+
procaptchaFrictionless.ProcaptchaFrictionless,
|
|
15
|
+
{
|
|
16
|
+
config,
|
|
17
|
+
callbacks: procaptchaCommon.getDefaultEvents(callbacks),
|
|
18
|
+
restart,
|
|
19
|
+
i18n
|
|
20
|
+
},
|
|
21
|
+
componentKey
|
|
22
|
+
);
|
|
23
|
+
};
|
|
24
|
+
exports.FrictionlessCaptcha = FrictionlessCaptcha;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const jsxRuntime = require("react/jsx-runtime");
|
|
4
|
+
const procaptchaCommon = require("@prosopo/procaptcha-common");
|
|
5
|
+
const procaptchaReact = require("@prosopo/procaptcha-react");
|
|
6
|
+
const ImageCaptcha = (props) => {
|
|
7
|
+
const { config, callbacks, i18n } = props;
|
|
8
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
9
|
+
procaptchaReact.Procaptcha,
|
|
10
|
+
{
|
|
11
|
+
config,
|
|
12
|
+
callbacks: procaptchaCommon.getDefaultEvents(callbacks),
|
|
13
|
+
i18n
|
|
14
|
+
}
|
|
15
|
+
);
|
|
16
|
+
};
|
|
17
|
+
exports.ImageCaptcha = ImageCaptcha;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const jsxRuntime = require("react/jsx-runtime");
|
|
4
|
+
const procaptchaCommon = require("@prosopo/procaptcha-common");
|
|
5
|
+
const procaptchaPow = require("@prosopo/procaptcha-pow");
|
|
6
|
+
const PowCaptcha = (props) => {
|
|
7
|
+
const { config, callbacks, i18n } = props;
|
|
8
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
9
|
+
procaptchaPow.ProcaptchaPow,
|
|
10
|
+
{
|
|
11
|
+
config,
|
|
12
|
+
callbacks: procaptchaCommon.getDefaultEvents(callbacks),
|
|
13
|
+
i18n
|
|
14
|
+
}
|
|
15
|
+
);
|
|
16
|
+
};
|
|
17
|
+
exports.PowCaptcha = PowCaptcha;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const getProcaptchaScript = (name) => document.querySelector(`script[src*="${name}"]`);
|
|
4
|
+
const extractParams = (name) => {
|
|
5
|
+
const script = getProcaptchaScript(name);
|
|
6
|
+
if (script && script.src.indexOf(`${name}`) !== -1) {
|
|
7
|
+
const params = new URLSearchParams(script.src.split("?")[1]);
|
|
8
|
+
return {
|
|
9
|
+
onloadUrlCallback: params.get("onload") || void 0,
|
|
10
|
+
renderExplicit: params.get("render") || void 0
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
return { onloadUrlCallback: void 0, renderExplicit: void 0 };
|
|
14
|
+
};
|
|
15
|
+
exports.extractParams = extractParams;
|
|
16
|
+
exports.getProcaptchaScript = getProcaptchaScript;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const types = require("@prosopo/types");
|
|
4
|
+
function createConfig(siteKey, theme = "light", language, web2 = true, invisible = false) {
|
|
5
|
+
if (!siteKey) {
|
|
6
|
+
siteKey = process.env.PROSOPO_SITE_KEY || "";
|
|
7
|
+
}
|
|
8
|
+
return types.ProcaptchaConfigSchema.parse({
|
|
9
|
+
defaultEnvironment: process.env.PROSOPO_DEFAULT_ENVIRONMENT ? types.EnvironmentTypesSchema.parse(process.env.PROSOPO_DEFAULT_ENVIRONMENT) : types.EnvironmentTypesSchema.enum.development,
|
|
10
|
+
userAccountAddress: "",
|
|
11
|
+
account: {
|
|
12
|
+
address: siteKey
|
|
13
|
+
},
|
|
14
|
+
serverUrl: process.env.PROSOPO_SERVER_URL || "",
|
|
15
|
+
mongoAtlasUri: process.env.PROSOPO_MONGO_EVENTS_URI || "",
|
|
16
|
+
devOnlyWatchEvents: process.env._DEV_ONLY_WATCH_EVENTS === "true" || false,
|
|
17
|
+
web2,
|
|
18
|
+
mode: invisible ? "invisible" : "visible",
|
|
19
|
+
theme,
|
|
20
|
+
language
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
exports.createConfig = createConfig;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const locale = require("@prosopo/locale");
|
|
4
|
+
const setLanguage = (renderOptions, element, config) => {
|
|
5
|
+
const languageAttribute = renderOptions?.language || element.getAttribute("data-language");
|
|
6
|
+
if (languageAttribute) {
|
|
7
|
+
config.language = validateLanguage(languageAttribute);
|
|
8
|
+
}
|
|
9
|
+
};
|
|
10
|
+
const validateLanguage = (languageAttribute) => {
|
|
11
|
+
try {
|
|
12
|
+
return locale.LanguageSchema.parse(languageAttribute);
|
|
13
|
+
} catch (error) {
|
|
14
|
+
console.error(`Invalid language attribute: ${languageAttribute}`);
|
|
15
|
+
return locale.LanguageSchema.parse("en");
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
exports.setLanguage = setLanguage;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const setValidChallengeLength = (renderOptions, element, config) => {
|
|
4
|
+
const challengeValidLengthAttribute = renderOptions?.["challenge-valid-length"] || element.getAttribute("data-challenge-valid-length");
|
|
5
|
+
if (challengeValidLengthAttribute) {
|
|
6
|
+
config.captchas.image.solutionTimeout = Number.parseInt(
|
|
7
|
+
challengeValidLengthAttribute
|
|
8
|
+
);
|
|
9
|
+
config.captchas.pow.solutionTimeout = Number.parseInt(
|
|
10
|
+
challengeValidLengthAttribute
|
|
11
|
+
);
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
exports.setValidChallengeLength = setValidChallengeLength;
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const locale = require("@prosopo/locale");
|
|
4
|
+
const procaptchaCommon = require("@prosopo/procaptcha-common");
|
|
5
|
+
const types = require("@prosopo/types");
|
|
6
|
+
const widgetSkeleton = require("@prosopo/widget-skeleton");
|
|
7
|
+
class WidgetFactory {
|
|
8
|
+
constructor(widgetThemeResolver) {
|
|
9
|
+
this.widgetThemeResolver = widgetThemeResolver;
|
|
10
|
+
this.captchaRenderer = null;
|
|
11
|
+
this._i18n = null;
|
|
12
|
+
}
|
|
13
|
+
get i18n() {
|
|
14
|
+
if (this._i18n === null) {
|
|
15
|
+
throw new Error("I18n is not initialized");
|
|
16
|
+
}
|
|
17
|
+
return this._i18n;
|
|
18
|
+
}
|
|
19
|
+
async createWidgets(containers, renderOptions, isWeb2 = true, invisible = false) {
|
|
20
|
+
return Promise.all(
|
|
21
|
+
containers.map((container) => {
|
|
22
|
+
const callbacks = procaptchaCommon.getDefaultCallbacks(container);
|
|
23
|
+
procaptchaCommon.setUserCallbacks(renderOptions, callbacks, container);
|
|
24
|
+
return this.createWidget(
|
|
25
|
+
container,
|
|
26
|
+
renderOptions,
|
|
27
|
+
callbacks,
|
|
28
|
+
isWeb2,
|
|
29
|
+
invisible
|
|
30
|
+
);
|
|
31
|
+
})
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
async createWidget(container, renderOptions, callbacks, isWeb2 = true, invisible = false) {
|
|
35
|
+
renderOptions.theme = this.widgetThemeResolver.resolveWidgetTheme(
|
|
36
|
+
container,
|
|
37
|
+
renderOptions
|
|
38
|
+
);
|
|
39
|
+
const widgetTheme = "light" === renderOptions.theme ? widgetSkeleton.lightTheme : widgetSkeleton.darkTheme;
|
|
40
|
+
let widgetInteractiveArea;
|
|
41
|
+
if (invisible) {
|
|
42
|
+
const newDiv = document.createElement("div");
|
|
43
|
+
container.appendChild(newDiv);
|
|
44
|
+
widgetInteractiveArea = newDiv;
|
|
45
|
+
} else {
|
|
46
|
+
widgetInteractiveArea = widgetSkeleton.createWidgetSkeleton(
|
|
47
|
+
container,
|
|
48
|
+
widgetTheme,
|
|
49
|
+
"prosopo-procaptcha"
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
const captchaRenderer = await this.getCaptchaRenderer();
|
|
53
|
+
const captchaRoot = captchaRenderer.renderCaptcha(
|
|
54
|
+
{
|
|
55
|
+
identifierPrefix: "procaptcha-",
|
|
56
|
+
emotionCacheKey: "procaptcha",
|
|
57
|
+
webComponentTag: "prosopo-procaptcha",
|
|
58
|
+
defaultCaptchaType: types.CaptchaType.frictionless
|
|
59
|
+
},
|
|
60
|
+
widgetInteractiveArea,
|
|
61
|
+
renderOptions,
|
|
62
|
+
callbacks,
|
|
63
|
+
isWeb2,
|
|
64
|
+
this.i18n,
|
|
65
|
+
invisible
|
|
66
|
+
);
|
|
67
|
+
return captchaRoot;
|
|
68
|
+
}
|
|
69
|
+
async getCaptchaRenderer() {
|
|
70
|
+
if (this._i18n === null) {
|
|
71
|
+
this._i18n = await locale.loadI18next(false);
|
|
72
|
+
}
|
|
73
|
+
if (this.captchaRenderer === null) {
|
|
74
|
+
this.captchaRenderer = await this.createCaptchaRenderer();
|
|
75
|
+
}
|
|
76
|
+
return this.captchaRenderer;
|
|
77
|
+
}
|
|
78
|
+
async createCaptchaRenderer() {
|
|
79
|
+
const CaptchaRenderer = (await Promise.resolve().then(() => require("./captcha/captchaRenderer.cjs"))).CaptchaRenderer;
|
|
80
|
+
const CaptchaComponentProvider = (await Promise.resolve().then(() => require("./captcha/captchaComponentProvider.cjs"))).CaptchaComponentProvider;
|
|
81
|
+
return new CaptchaRenderer(new CaptchaComponentProvider());
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
exports.WidgetFactory = WidgetFactory;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
class WidgetThemeResolver {
|
|
4
|
+
constructor() {
|
|
5
|
+
this.themesSet = /* @__PURE__ */ new Set(["light", "dark"]);
|
|
6
|
+
this.defaultTheme = "light";
|
|
7
|
+
}
|
|
8
|
+
resolveWidgetTheme(element, renderOptions) {
|
|
9
|
+
const themeAttribute = renderOptions.theme || element.getAttribute("data-theme") || this.defaultTheme;
|
|
10
|
+
return this.validateTheme(themeAttribute);
|
|
11
|
+
}
|
|
12
|
+
validateTheme(themeAttribute) {
|
|
13
|
+
return this.themesSet.has(themeAttribute) ? themeAttribute : this.defaultTheme;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
exports.WidgetThemeResolver = WidgetThemeResolver;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Languages } from "@prosopo/locale";
|
|
2
2
|
import { type ProcaptchaClientConfigOutput } from "@prosopo/types";
|
|
3
|
-
declare function createConfig(siteKey?: string, theme?: "light" | "dark", language?: typeof
|
|
3
|
+
declare function createConfig(siteKey?: string, theme?: "light" | "dark", language?: (typeof Languages)[keyof typeof Languages], web2?: boolean, invisible?: boolean): ProcaptchaClientConfigOutput;
|
|
4
4
|
export { createConfig };
|
|
5
5
|
//# sourceMappingURL=configCreator.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"configCreator.d.ts","sourceRoot":"","sources":["../../src/util/configCreator.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"configCreator.d.ts","sourceRoot":"","sources":["../../src/util/configCreator.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,EAEN,KAAK,4BAA4B,EAEjC,MAAM,gBAAgB,CAAC;AAExB,iBAAS,YAAY,CACpB,OAAO,CAAC,EAAE,MAAM,EAChB,KAAK,GAAE,OAAO,GAAG,MAAgB,EACjC,QAAQ,CAAC,EAAE,CAAC,OAAO,SAAS,CAAC,CAAC,MAAM,OAAO,SAAS,CAAC,EACrD,IAAI,UAAO,EACX,SAAS,UAAQ,GACf,4BAA4B,CAqB9B;AAED,OAAO,EAAE,YAAY,EAAE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"configCreator.js","sourceRoot":"","sources":["../../src/util/configCreator.ts"],"names":[],"mappings":"AAeA,OAAO,EACN,sBAAsB,EAEtB,sBAAsB,GACtB,MAAM,gBAAgB,CAAC;AAExB,SAAS,YAAY,CACpB,OAAgB,EAChB,QAA0B,OAAO,EACjC,
|
|
1
|
+
{"version":3,"file":"configCreator.js","sourceRoot":"","sources":["../../src/util/configCreator.ts"],"names":[],"mappings":"AAeA,OAAO,EACN,sBAAsB,EAEtB,sBAAsB,GACtB,MAAM,gBAAgB,CAAC;AAExB,SAAS,YAAY,CACpB,OAAgB,EAChB,QAA0B,OAAO,EACjC,QAAqD,EACrD,IAAI,GAAG,IAAI,EACX,SAAS,GAAG,KAAK;IAEjB,IAAI,CAAC,OAAO,EAAE,CAAC;QACd,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,gBAAgB,IAAI,EAAE,CAAC;IAC9C,CAAC;IAED,OAAO,sBAAsB,CAAC,KAAK,CAAC;QACnC,kBAAkB,EAAE,OAAO,CAAC,GAAG,CAAC,2BAA2B;YAC1D,CAAC,CAAC,sBAAsB,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,2BAA2B,CAAC;YACvE,CAAC,CAAC,sBAAsB,CAAC,IAAI,CAAC,WAAW;QAC1C,kBAAkB,EAAE,EAAE;QACtB,OAAO,EAAE;YACR,OAAO,EAAE,OAAO;SAChB;QACD,SAAS,EAAE,OAAO,CAAC,GAAG,CAAC,kBAAkB,IAAI,EAAE;QAC/C,aAAa,EAAE,OAAO,CAAC,GAAG,CAAC,wBAAwB,IAAI,EAAE;QACzD,kBAAkB,EAAE,OAAO,CAAC,GAAG,CAAC,sBAAsB,KAAK,MAAM,IAAI,KAAK;QAC1E,IAAI;QACJ,IAAI,EAAE,SAAS,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,SAAS;QACzC,KAAK;QACL,QAAQ;KACR,CAAC,CAAC;AACJ,CAAC;AAED,OAAO,EAAE,YAAY,EAAE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"language.js","sourceRoot":"","sources":["../../src/util/language.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,cAAc,
|
|
1
|
+
{"version":3,"file":"language.js","sourceRoot":"","sources":["../../src/util/language.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,cAAc,EAAkB,MAAM,iBAAiB,CAAC;AAkBjE,MAAM,CAAC,MAAM,WAAW,GAAG,CAC1B,aAAkD,EAClD,OAAgB,EAChB,MAAmC,EAClC,EAAE;IACH,MAAM,iBAAiB,GACtB,aAAa,EAAE,QAAQ,IAAI,OAAO,CAAC,YAAY,CAAC,eAAe,CAAC,CAAC;IAElE,IAAI,iBAAiB,EAAE,CAAC;QACvB,MAAM,CAAC,QAAQ,GAAG,gBAAgB,CAAC,iBAAiB,CAAC,CAAC;IACvD,CAAC;AACF,CAAC,CAAC;AAEF,MAAM,gBAAgB,GAAG,CAAC,iBAA4C,EAAE,EAAE;IACzE,IAAI,CAAC;QACJ,OAAO,cAAc,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC;IAChD,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QAChB,OAAO,CAAC,KAAK,CAAC,+BAA+B,iBAAiB,EAAE,CAAC,CAAC;QAClE,OAAO,cAAc,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IACnC,CAAC;AACF,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prosopo/procaptcha-bundle",
|
|
3
|
-
"version": "2.
|
|
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",
|
|
@@ -32,23 +32,26 @@
|
|
|
32
32
|
"bundle:webpack": "NODE_ENV=${NODE_ENV:-production}; webpack build --config webpack.config.cjs --mode $NODE_ENV",
|
|
33
33
|
"serve": "NODE_ENV=${NODE_ENV:-development}; vite serve --config vite.serve.config.ts --mode $NODE_ENV --host"
|
|
34
34
|
},
|
|
35
|
-
"browserslist": [
|
|
35
|
+
"browserslist": [
|
|
36
|
+
"> 0.5%, last 2 versions, not dead"
|
|
37
|
+
],
|
|
36
38
|
"dependencies": {
|
|
37
|
-
"@prosopo/dotenv": "2.
|
|
38
|
-
"@prosopo/locale": "2.
|
|
39
|
-
"@prosopo/procaptcha-frictionless": "2.
|
|
40
|
-
"@prosopo/procaptcha-pow": "2.
|
|
41
|
-
"@prosopo/procaptcha-react": "2.
|
|
42
|
-
"@prosopo/
|
|
43
|
-
"@prosopo/
|
|
44
|
-
"@prosopo/
|
|
39
|
+
"@prosopo/dotenv": "2.6.0",
|
|
40
|
+
"@prosopo/locale": "2.6.0",
|
|
41
|
+
"@prosopo/procaptcha-frictionless": "2.6.2",
|
|
42
|
+
"@prosopo/procaptcha-pow": "2.6.2",
|
|
43
|
+
"@prosopo/procaptcha-react": "2.6.2",
|
|
44
|
+
"@prosopo/types": "2.6.2",
|
|
45
|
+
"@prosopo/util": "2.6.0",
|
|
46
|
+
"@prosopo/widget-skeleton": "2.6.0",
|
|
45
47
|
"express": "4.21.2",
|
|
46
48
|
"react": "18.3.1",
|
|
47
49
|
"react-dom": "18.3.1"
|
|
48
50
|
},
|
|
49
51
|
"repository": {
|
|
50
52
|
"type": "git",
|
|
51
|
-
"url": "git+https://github.com/prosopo/captcha.git"
|
|
53
|
+
"url": "git+https://github.com/prosopo/captcha.git",
|
|
54
|
+
"directory": "packages/procaptcha-bundle"
|
|
52
55
|
},
|
|
53
56
|
"bugs": {
|
|
54
57
|
"url": "https://github.com/prosopo/captcha/issues"
|
|
@@ -59,10 +62,10 @@
|
|
|
59
62
|
"registry": "https://registry.npmjs.org"
|
|
60
63
|
},
|
|
61
64
|
"devDependencies": {
|
|
62
|
-
"@prosopo/config": "2.
|
|
65
|
+
"@prosopo/config": "2.6.0",
|
|
63
66
|
"@types/jsdom": "21.1.7",
|
|
64
|
-
"@types/react-dom": "18.3.1",
|
|
65
67
|
"@types/react": "18.3.1",
|
|
68
|
+
"@types/react-dom": "18.3.1",
|
|
66
69
|
"@vitest/coverage-v8": "3.0.9",
|
|
67
70
|
"concurrently": "9.0.1",
|
|
68
71
|
"del-cli": "6.0.0",
|