@prosopo/procaptcha-bundle 2.5.3 → 2.6.1
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-private/captcha-private → captcha}/captcha/packages/procaptcha-bundle/dist/bundle/index.d.ts.map +1 -1
- package/.rollup.cache/home/runner/work/{captcha-private/captcha-private → captcha}/captcha/packages/procaptcha-bundle/dist/bundle/index.js +15 -17
- package/.rollup.cache/home/runner/work/{captcha-private/captcha-private → captcha}/captcha/packages/procaptcha-bundle/dist/bundle/index.js.map +1 -1
- package/.rollup.cache/home/runner/work/{captcha-private/captcha-private → captcha}/captcha/packages/procaptcha-bundle/dist/bundle/tests/util/renderLogic.test.js +23 -27
- package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/tests/util/renderLogic.test.js.map +1 -0
- package/.rollup.cache/home/runner/work/{captcha-private/captcha-private → captcha}/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/captchaRenderer.d.ts +2 -2
- package/.rollup.cache/home/runner/work/{captcha-private/captcha-private → captcha}/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/captchaRenderer.d.ts.map +1 -1
- package/.rollup.cache/home/runner/work/{captcha-private/captcha-private → captcha}/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/captchaRenderer.js +4 -7
- package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/captchaRenderer.js.map +1 -0
- 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/.rollup.cache/home/runner/work/{captcha-private/captcha-private → captcha}/captcha/packages/procaptcha-bundle/dist/bundle/util/widgetFactory.d.ts +2 -2
- package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/widgetFactory.d.ts.map +1 -0
- package/.rollup.cache/home/runner/work/{captcha-private/captcha-private → captcha}/captcha/packages/procaptcha-bundle/dist/bundle/util/widgetFactory.js +9 -4
- package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/widgetFactory.js.map +1 -0
- package/CHANGELOG.md +29 -0
- package/dist/bundle/ProcaptchaWidget-3gKvjeiH.js +636 -0
- package/dist/bundle/ProcaptchaWidget-D6-M7iAv.js +360 -0
- package/dist/bundle/{asU8a-JliaME7-.js → asU8a-DCECA0Qe.js} +1 -1
- package/dist/bundle/bip39-BQoZog_M.js +365 -0
- package/dist/bundle/captchaComponentProvider-BW2eXmc3.js +1242 -0
- package/dist/bundle/captchaRenderer-B_MgGzr9.js +70 -0
- package/dist/bundle/{emotion-element-5486c51c.browser.esm-Bywq83R5.js → emotion-element-5486c51c.browser.esm-CCAJ8JId.js} +713 -746
- package/dist/bundle/{fp.esm-C0kLYOiJ.js → fp.esm-DYWeNGcH.js} +17 -0
- package/dist/bundle/{hash-CtL1HOjf.js → hash-BR0YLxPF.js} +796 -483
- package/dist/bundle/{i18nFrontend-C_RgmvGh.js → i18nFrontend-CsPT71ro.js} +1 -1
- package/dist/bundle/index-2or4-1WF.js +596 -0
- package/dist/bundle/{captchaRenderer-D-du50M4.js → index-BCjHZ8o6.js} +1293 -1355
- package/dist/bundle/{index-DcG_c-Na.js → index-BYUYvvuq.js} +11 -11
- package/dist/bundle/index-BjRdPnnE.js +1198 -0
- package/dist/bundle/index-WqEmiYQ_.js +4386 -0
- package/dist/bundle/index.d.ts.map +1 -1
- 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/de/translation.json +55 -405
- package/dist/bundle/locales/el/translation.json +56 -0
- package/dist/bundle/locales/en/translation.json +55 -405
- package/dist/bundle/locales/es/translation.json +55 -405
- package/dist/bundle/locales/fi/translation.json +56 -0
- package/dist/bundle/locales/fr/translation.json +55 -405
- 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/it/translation.json +55 -405
- 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/translation.json +55 -405
- package/dist/bundle/locales/pt-br/translation.json +56 -0
- 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-7b6JJ18N.js → useTranslation-BPbGzrhj.js} +3 -3
- package/dist/bundle/util/captcha/captchaRenderer.d.ts +2 -2
- package/dist/bundle/util/captcha/captchaRenderer.d.ts.map +1 -1
- package/dist/bundle/util/configCreator.d.ts +2 -2
- package/dist/bundle/util/configCreator.d.ts.map +1 -1
- package/dist/bundle/util/widgetFactory.d.ts +2 -2
- package/dist/bundle/util/widgetFactory.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/index.d.ts.map +1 -1
- package/dist/index.js +15 -17
- package/dist/index.js.map +1 -1
- package/dist/tests/util/renderLogic.test.js +23 -27
- package/dist/tests/util/renderLogic.test.js.map +1 -1
- package/dist/util/captcha/captchaRenderer.d.ts +2 -2
- package/dist/util/captcha/captchaRenderer.d.ts.map +1 -1
- package/dist/util/captcha/captchaRenderer.js +4 -7
- package/dist/util/captcha/captchaRenderer.js.map +1 -1
- 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/dist/util/widgetFactory.d.ts +2 -2
- package/dist/util/widgetFactory.d.ts.map +1 -1
- package/dist/util/widgetFactory.js +9 -4
- package/dist/util/widgetFactory.js.map +1 -1
- package/package.json +25 -16
- package/stats.html +1 -1
- package/vite.config.ts +18 -3
- package/vite.serve.config.ts +24 -0
- package/.rollup.cache/home/runner/work/captcha-private/captcha-private/captcha/packages/procaptcha-bundle/dist/bundle/tests/util/renderLogic.test.js.map +0 -1
- package/.rollup.cache/home/runner/work/captcha-private/captcha-private/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/captchaRenderer.js.map +0 -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/.rollup.cache/home/runner/work/captcha-private/captcha-private/captcha/packages/procaptcha-bundle/dist/bundle/util/widgetFactory.d.ts.map +0 -1
- package/.rollup.cache/home/runner/work/captcha-private/captcha-private/captcha/packages/procaptcha-bundle/dist/bundle/util/widgetFactory.js.map +0 -1
- package/dist/bundle/ProcaptchaWidget-BlWWnPeB.js +0 -615
- package/dist/bundle/ProcaptchaWidget-Dnwno-4N.js +0 -156
- package/dist/bundle/bip39-CFjno8fK.js +0 -260
- package/dist/bundle/captchaComponentProvider-dcMua0p9.js +0 -1013
- package/dist/bundle/index-B8oMghZ3.js +0 -1120
- package/dist/bundle/index-BMjJnq60.js +0 -4373
- package/dist/bundle/index-BTlHNFX8.js +0 -504
- package/dist/bundle/locales/pt-BR/translation.json +0 -406
- 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/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/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/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/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
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { s as Y } from "./toU8a-
|
|
3
|
-
import { g as q, a as B, i as K } from "./i18nFrontend-
|
|
1
|
+
import { n as X, r as p } from "./emotion-element-5486c51c.browser.esm-CCAJ8JId.js";
|
|
2
|
+
import { s as Y } from "./toU8a-C68WUzs_.js";
|
|
3
|
+
import { g as q, a as B, i as K } from "./i18nFrontend-CsPT71ro.js";
|
|
4
4
|
function re(e) {
|
|
5
5
|
return X(Y(e));
|
|
6
6
|
}
|
|
@@ -14,8 +14,8 @@ interface RenderSettings {
|
|
|
14
14
|
declare class CaptchaRenderer {
|
|
15
15
|
private readonly captchaComponentProvider;
|
|
16
16
|
constructor(captchaComponentProvider: CaptchaComponentProvider);
|
|
17
|
-
renderCaptcha(settings: RenderSettings, container: HTMLElement, renderOptions: ProcaptchaRenderOptions, isWeb2: boolean, i18n: Ti18n, invisible?: boolean): Root;
|
|
18
|
-
protected readAndValidateSettings(element: Element,
|
|
17
|
+
renderCaptcha(settings: RenderSettings, container: HTMLElement, renderOptions: ProcaptchaRenderOptions, callbacks: Callbacks, isWeb2: boolean, i18n: Ti18n, invisible?: boolean): Root;
|
|
18
|
+
protected readAndValidateSettings(element: Element, config: ProcaptchaClientConfigOutput, renderOptions: ProcaptchaRenderOptions): void;
|
|
19
19
|
protected makeEmotionCache(cacheKey: string, container: HTMLElement): EmotionCache;
|
|
20
20
|
protected createReactRoot(container: HTMLElement, identifierPrefix: string): Root;
|
|
21
21
|
protected renderCaptchaComponent(reactRoot: Root, emotionCache: EmotionCache, captchaComponent: ReactNode): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"captchaRenderer.d.ts","sourceRoot":"","sources":["../../../../src/util/captcha/captchaRenderer.tsx"],"names":[],"mappings":"AAcA,OAAoB,EAAE,KAAK,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAEhE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"captchaRenderer.d.ts","sourceRoot":"","sources":["../../../../src/util/captcha/captchaRenderer.tsx"],"names":[],"mappings":"AAcA,OAAoB,EAAE,KAAK,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAEhE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,KAAK,EACX,SAAS,EACT,4BAA4B,EAC5B,uBAAuB,EACvB,MAAM,gBAAgB,CAAC;AACxB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,EAAE,KAAK,IAAI,EAAc,MAAM,kBAAkB,CAAC;AAIzD,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AAE9E,UAAU,cAAc;IACvB,gBAAgB,EAAE,MAAM,CAAC;IACzB,eAAe,EAAE,MAAM,CAAC;IACxB,eAAe,EAAE,MAAM,CAAC;IACxB,kBAAkB,EAAE,WAAW,CAAC;CAChC;AAED,cAAM,eAAe;IACpB,OAAO,CAAC,QAAQ,CAAC,wBAAwB,CAA2B;gBAExD,wBAAwB,EAAE,wBAAwB;IAIvD,aAAa,CACnB,QAAQ,EAAE,cAAc,EACxB,SAAS,EAAE,WAAW,EACtB,aAAa,EAAE,uBAAuB,EACtC,SAAS,EAAE,SAAS,EACpB,MAAM,EAAE,OAAO,EACf,IAAI,EAAE,KAAK,EACX,SAAS,UAAQ,GACf,IAAI;IAsCP,SAAS,CAAC,uBAAuB,CAChC,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,4BAA4B,EACpC,aAAa,EAAE,uBAAuB,GACpC,IAAI;IAKP,SAAS,CAAC,gBAAgB,CACzB,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,WAAW,GACpB,YAAY;IAQf,SAAS,CAAC,eAAe,CACxB,SAAS,EAAE,WAAW,EACtB,gBAAgB,EAAE,MAAM,GACtB,IAAI;IAMP,SAAS,CAAC,sBAAsB,CAC/B,SAAS,EAAE,IAAI,EACf,YAAY,EAAE,YAAY,EAC1B,gBAAgB,EAAE,SAAS,GACzB,IAAI;CAKP;AAED,OAAO,EAAE,eAAe,EAAE,CAAC"}
|
|
@@ -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,5 +1,5 @@
|
|
|
1
1
|
import type { Ti18n } from "@prosopo/locale";
|
|
2
|
-
import { type ProcaptchaRenderOptions } from "@prosopo/types";
|
|
2
|
+
import { type Callbacks, type ProcaptchaRenderOptions } from "@prosopo/types";
|
|
3
3
|
import type { Root } from "react-dom/client";
|
|
4
4
|
import type { CaptchaRenderer } from "./captcha/captchaRenderer.js";
|
|
5
5
|
import type { WidgetThemeResolver } from "./widgetThemeResolver.js";
|
|
@@ -10,7 +10,7 @@ declare class WidgetFactory {
|
|
|
10
10
|
constructor(widgetThemeResolver: WidgetThemeResolver);
|
|
11
11
|
get i18n(): Ti18n;
|
|
12
12
|
createWidgets(containers: Element[], renderOptions: ProcaptchaRenderOptions, isWeb2?: boolean, invisible?: boolean): Promise<Root[]>;
|
|
13
|
-
createWidget(container: Element, renderOptions: ProcaptchaRenderOptions, isWeb2?: boolean, invisible?: boolean): Promise<Root>;
|
|
13
|
+
createWidget(container: Element, renderOptions: ProcaptchaRenderOptions, callbacks: Callbacks, isWeb2?: boolean, invisible?: boolean): Promise<Root>;
|
|
14
14
|
protected getCaptchaRenderer(): Promise<CaptchaRenderer>;
|
|
15
15
|
protected createCaptchaRenderer(): Promise<CaptchaRenderer>;
|
|
16
16
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"widgetFactory.d.ts","sourceRoot":"","sources":["../../../src/util/widgetFactory.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"widgetFactory.d.ts","sourceRoot":"","sources":["../../../src/util/widgetFactory.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAK7C,OAAO,EACN,KAAK,SAAS,EAGd,KAAK,uBAAuB,EAC5B,MAAM,gBAAgB,CAAC;AAMxB,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AACpE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAEpE,cAAM,aAAa;IAKjB,OAAO,CAAC,QAAQ,CAAC,mBAAmB;IAJrC,OAAO,CAAC,eAAe,CAAgC;IACvD,OAAO,CAAC,KAAK,CAAsB;gBAGjB,mBAAmB,EAAE,mBAAmB;IAG1D,IAAI,IAAI,IAAI,KAAK,CAKhB;IAEY,aAAa,CACzB,UAAU,EAAE,OAAO,EAAE,EACrB,aAAa,EAAE,uBAAuB,EACtC,MAAM,UAAO,EACb,SAAS,UAAQ,GACf,OAAO,CAAC,IAAI,EAAE,CAAC;IAgBL,YAAY,CACxB,SAAS,EAAE,OAAO,EAClB,aAAa,EAAE,uBAAuB,EACtC,SAAS,EAAE,SAAS,EACpB,MAAM,UAAO,EACb,SAAS,UAAQ,GACf,OAAO,CAAC,IAAI,CAAC;cA+CA,kBAAkB,IAAI,OAAO,CAAC,eAAe,CAAC;cAY9C,qBAAqB,IAAI,OAAO,CAAC,eAAe,CAAC;CAUjE;AAED,OAAO,EAAE,aAAa,EAAE,CAAC"}
|
|
@@ -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;
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAC;AAiF9D,eAAO,MAAM,MAAM,YACT,OAAO,iBACD,uBAAuB,kBAoBtC,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,KAAK,CAAC,EAAE,EAAE,MAAM,IAAI,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAC;AAiF9D,eAAO,MAAM,MAAM,YACT,OAAO,iBACD,uBAAuB,kBAoBtC,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,KAAK,CAAC,EAAE,EAAE,MAAM,IAAI,QAY3C;AAED,eAAO,MAAM,OAAO,YAqBnB,CAAC;AAkCF,OAAO,CAAC,MAAM,CAAC;IACd,UAAU,MAAM;QACf,UAAU,EAAE;YACX,KAAK,EAAE,OAAO,KAAK,CAAC;YACpB,MAAM,EAAE,OAAO,MAAM,CAAC;YACtB,KAAK,EAAE,OAAO,KAAK,CAAC;YACpB,OAAO,EAAE,OAAO,OAAO,CAAC;SACxB,CAAC;KACF;CACD;AAmCD,eAAO,MAAM,KAAK,YAOjB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -61,7 +61,11 @@ export default function ready(fn) {
|
|
|
61
61
|
}
|
|
62
62
|
else {
|
|
63
63
|
console.log("DOMContentLoaded listener!");
|
|
64
|
-
document.addEventListener("DOMContentLoaded",
|
|
64
|
+
document.addEventListener("DOMContentLoaded", () => {
|
|
65
|
+
console.log("DOMContentLoaded fired");
|
|
66
|
+
console.log(window);
|
|
67
|
+
fn();
|
|
68
|
+
});
|
|
65
69
|
}
|
|
66
70
|
}
|
|
67
71
|
export const execute = () => {
|
|
@@ -95,31 +99,25 @@ function findProcaptchaContainers() {
|
|
|
95
99
|
}
|
|
96
100
|
return containers;
|
|
97
101
|
}
|
|
98
|
-
function getElementAttributes(element) {
|
|
99
|
-
const attributes = {};
|
|
100
|
-
if (element?.attributes) {
|
|
101
|
-
for (let i = 0; i < element.attributes.length; i++) {
|
|
102
|
-
const attr = element.attributes[i];
|
|
103
|
-
if (attr?.name && attr.value !== undefined) {
|
|
104
|
-
attributes[attr.name] = attr.value;
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
return attributes;
|
|
109
|
-
}
|
|
110
102
|
const start = () => {
|
|
111
103
|
const { onloadUrlCallback, renderExplicit } = extractParams(BUNDLE_NAME);
|
|
104
|
+
let readyCalled = false;
|
|
112
105
|
if (renderExplicit !== "explicit") {
|
|
113
|
-
|
|
106
|
+
getProcaptchaScript(BUNDLE_NAME)?.addEventListener("load", () => {
|
|
107
|
+
ready(implicitRender);
|
|
108
|
+
readyCalled = true;
|
|
109
|
+
});
|
|
110
|
+
if (document.readyState === "complete" && !readyCalled) {
|
|
111
|
+
ready(implicitRender);
|
|
112
|
+
}
|
|
114
113
|
}
|
|
115
114
|
if (onloadUrlCallback) {
|
|
116
|
-
const onloadCallback = getWindowCallback(onloadUrlCallback);
|
|
117
|
-
let readyCalled = false;
|
|
118
115
|
getProcaptchaScript(BUNDLE_NAME)?.addEventListener("load", () => {
|
|
116
|
+
const onloadCallback = getWindowCallback(onloadUrlCallback);
|
|
119
117
|
ready(onloadCallback);
|
|
120
|
-
readyCalled = true;
|
|
121
118
|
});
|
|
122
119
|
if (document.readyState === "complete" && !readyCalled) {
|
|
120
|
+
const onloadCallback = getWindowCallback(onloadUrlCallback);
|
|
123
121
|
ready(onloadCallback);
|
|
124
122
|
}
|
|
125
123
|
}
|