@prosopo/procaptcha-bundle 3.2.10 → 4.1.7
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/.turbo/turbo-build$colon$cjs.log +28 -35
- package/.turbo/turbo-build$colon$tsc.log +80 -0
- package/.turbo/turbo-build.log +33 -36
- package/CHANGELOG.md +575 -0
- package/dist/cjs/index.cjs +4 -9
- package/dist/cjs/util/captcha/captchaRenderer.cjs +10 -9
- package/dist/cjs/util/captcha/components/{frictionlessCaptcha.cjs → bundleCaptcha.cjs} +2 -2
- package/dist/cjs/util/config.cjs +14 -4
- package/dist/cjs/util/widgetFactory.cjs +4 -6
- package/dist/components.d.ts +2 -0
- package/dist/components.d.ts.map +1 -0
- package/dist/components.js +2 -0
- package/dist/components.js.map +1 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +4 -9
- package/dist/index.js.map +1 -0
- package/dist/tests/procaptchaReady.unit.test.d.ts +2 -0
- package/dist/tests/procaptchaReady.unit.test.d.ts.map +1 -0
- package/dist/tests/procaptchaReady.unit.test.js +32 -0
- package/dist/tests/procaptchaReady.unit.test.js.map +1 -0
- package/dist/tests/util/config.test.d.ts +2 -0
- package/dist/tests/util/config.test.d.ts.map +1 -0
- package/dist/tests/util/config.test.js +69 -0
- package/dist/tests/util/config.test.js.map +1 -0
- package/dist/tests/util/renderLogic.test.d.ts +2 -0
- package/dist/tests/util/renderLogic.test.d.ts.map +1 -0
- package/dist/tests/util/renderLogic.test.js +144 -0
- package/dist/tests/util/renderLogic.test.js.map +1 -0
- package/dist/util/captcha/captchaRenderer.d.ts +19 -0
- package/dist/util/captcha/captchaRenderer.d.ts.map +1 -0
- package/dist/util/captcha/captchaRenderer.js +10 -9
- package/dist/util/captcha/captchaRenderer.js.map +1 -0
- package/dist/util/captcha/components/bundleCaptcha.d.ts +11 -0
- package/dist/util/captcha/components/bundleCaptcha.d.ts.map +1 -0
- package/dist/util/captcha/components/{frictionlessCaptcha.js → bundleCaptcha.js} +2 -2
- package/dist/util/captcha/components/bundleCaptcha.js.map +1 -0
- package/dist/util/config.d.ts +6 -0
- package/dist/util/config.d.ts.map +1 -0
- package/dist/util/config.js +14 -4
- package/dist/util/config.js.map +1 -0
- package/dist/util/configCreator.d.ts +5 -0
- package/dist/util/configCreator.d.ts.map +1 -0
- package/dist/util/configCreator.js.map +1 -0
- package/dist/util/language.d.ts +3 -0
- package/dist/util/language.d.ts.map +1 -0
- package/dist/util/language.js.map +1 -0
- package/dist/util/timeout.d.ts +3 -0
- package/dist/util/timeout.d.ts.map +1 -0
- package/dist/util/timeout.js.map +1 -0
- package/dist/util/widgetFactory.d.ts +18 -0
- package/dist/util/widgetFactory.d.ts.map +1 -0
- package/dist/util/widgetFactory.js +4 -6
- package/dist/util/widgetFactory.js.map +1 -0
- package/dist/util/widgetThemeResolver.d.ts +9 -0
- package/dist/util/widgetThemeResolver.d.ts.map +1 -0
- package/dist/util/widgetThemeResolver.js.map +1 -0
- package/package.json +14 -13
- package/src/components.ts +15 -0
- package/src/index.html +11 -0
- package/src/index.ts +259 -0
- package/src/tests/procaptchaReady.unit.test.ts +58 -0
- package/src/tests/util/config.test.ts +97 -0
- package/src/tests/util/renderLogic.test.tsx +221 -0
- package/src/util/captcha/captchaRenderer.tsx +126 -0
- package/src/util/captcha/components/bundleCaptcha.tsx +57 -0
- package/src/util/config.ts +40 -0
- package/src/util/configCreator.ts +51 -0
- package/src/util/language.ts +53 -0
- package/src/util/timeout.ts +43 -0
- package/src/util/widgetFactory.ts +145 -0
- package/src/util/widgetThemeResolver.ts +40 -0
- package/tsconfig.cjs.json +35 -0
- package/tsconfig.json +42 -0
- package/tsconfig.tsbuildinfo +1 -0
- package/tsconfig.types.json +9 -0
- package/vite.cjs.config.ts +1 -1
- package/vite.config.ts +23 -2
- package/vite.esm.config.ts +1 -1
- package/vite.iife.config.ts +119 -0
- package/vite.serve.config.ts +23 -1
- package/vite.test.config.ts +1 -1
- package/webpack.config.cjs +1 -1
- package/dist/cjs/util/captcha/captchaComponentProvider.cjs +0 -24
- package/dist/cjs/util/captcha/captchaComponentsList.cjs +0 -12
- package/dist/cjs/util/captcha/captchaType.cjs +0 -12
- package/dist/cjs/util/captcha/components/imageCaptcha.cjs +0 -17
- package/dist/cjs/util/captcha/components/powCaptcha.cjs +0 -17
- package/dist/util/captcha/captchaComponentProvider.js +0 -24
- package/dist/util/captcha/captchaComponentsList.js +0 -12
- package/dist/util/captcha/captchaType.js +0 -12
- package/dist/util/captcha/components/imageCaptcha.js +0 -17
- package/dist/util/captcha/components/powCaptcha.js +0 -17
package/vite.cjs.config.ts
CHANGED
package/vite.config.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright 2021-
|
|
1
|
+
// Copyright 2021-2026 Prosopo (UK) Ltd.
|
|
2
2
|
//
|
|
3
3
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
4
|
// you may not use this file except in compliance with the License.
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
// See the License for the specific language governing permissions and
|
|
13
13
|
// limitations under the License.
|
|
14
14
|
|
|
15
|
+
import { randomBytes } from "node:crypto";
|
|
15
16
|
import * as fs from "node:fs";
|
|
16
17
|
import * as path from "node:path";
|
|
17
18
|
import {
|
|
@@ -23,6 +24,12 @@ import { at, flatten } from "@prosopo/util";
|
|
|
23
24
|
import fg from "fast-glob";
|
|
24
25
|
import { defineConfig } from "vite";
|
|
25
26
|
|
|
27
|
+
// Per-build opaque chunk name for the honeypot module. Re-rolled on every
|
|
28
|
+
// build so the emitted URL (e.g. `c8f2a1b0-<hash>.js`) doesn't leak the
|
|
29
|
+
// component's purpose and can't be fingerprinted by scrapers that maintain
|
|
30
|
+
// static URL blocklists.
|
|
31
|
+
const honeypotChunkName = `c${randomBytes(4).toString("hex")}`;
|
|
32
|
+
|
|
26
33
|
// load env using our util because vite loadEnv is not working for .env.development
|
|
27
34
|
loadEnv();
|
|
28
35
|
|
|
@@ -81,13 +88,24 @@ export default defineConfig(async ({ command, mode }) => {
|
|
|
81
88
|
|
|
82
89
|
return {
|
|
83
90
|
...frontendConfig,
|
|
91
|
+
worker: {
|
|
92
|
+
format: "es",
|
|
93
|
+
},
|
|
84
94
|
build: {
|
|
95
|
+
assetsDir: "",
|
|
85
96
|
...frontendConfig.build,
|
|
86
97
|
rollupOptions: {
|
|
87
98
|
...frontendConfig.build?.rollupOptions,
|
|
88
99
|
output: {
|
|
89
100
|
...frontendConfig.build?.rollupOptions?.output,
|
|
90
101
|
manualChunks(id: string) {
|
|
102
|
+
if (
|
|
103
|
+
id.includes(
|
|
104
|
+
"packages/procaptcha-common/dist/reactComponents/Honeypot",
|
|
105
|
+
)
|
|
106
|
+
) {
|
|
107
|
+
return honeypotChunkName;
|
|
108
|
+
}
|
|
91
109
|
if (id.includes("wasm-crypto-wasm")) {
|
|
92
110
|
return "web3Chunk";
|
|
93
111
|
}
|
|
@@ -98,7 +116,10 @@ export default defineConfig(async ({ command, mode }) => {
|
|
|
98
116
|
}
|
|
99
117
|
return "web2Chunk";
|
|
100
118
|
}
|
|
101
|
-
if (
|
|
119
|
+
if (
|
|
120
|
+
id.includes("packages/common/dist") ||
|
|
121
|
+
id.includes("packages/logger/dist")
|
|
122
|
+
) {
|
|
102
123
|
return "commonChunk";
|
|
103
124
|
}
|
|
104
125
|
if (id.includes("zod")) {
|
package/vite.esm.config.ts
CHANGED
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
// Copyright 2021-2026 Prosopo (UK) Ltd.
|
|
2
|
+
//
|
|
3
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
// you may not use this file except in compliance with the License.
|
|
5
|
+
// You may obtain a copy of the License at
|
|
6
|
+
//
|
|
7
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
//
|
|
9
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
// See the License for the specific language governing permissions and
|
|
13
|
+
// limitations under the License.
|
|
14
|
+
|
|
15
|
+
import * as fs from "node:fs";
|
|
16
|
+
import * as path from "node:path";
|
|
17
|
+
import {
|
|
18
|
+
ViteFrontendConfig,
|
|
19
|
+
VitePluginRemoveUnusedTranslations,
|
|
20
|
+
} from "@prosopo/config";
|
|
21
|
+
import { loadEnv } from "@prosopo/dotenv";
|
|
22
|
+
import { at, flatten } from "@prosopo/util";
|
|
23
|
+
import fg from "fast-glob";
|
|
24
|
+
import { defineConfig } from "vite";
|
|
25
|
+
|
|
26
|
+
// IIFE / classic-script build of the procaptcha bundle.
|
|
27
|
+
// Used as a `<script nomodule>` fallback so crawlers and runtimes that do not
|
|
28
|
+
// execute `type="module"` scripts (notably Ahrefs' renderer) still mount the
|
|
29
|
+
// widget and expose the outbound link in the rendered DOM.
|
|
30
|
+
|
|
31
|
+
loadEnv();
|
|
32
|
+
process.env.TS_NODE_PROJECT = path.resolve("./tsconfig.json");
|
|
33
|
+
|
|
34
|
+
const bundleName = "procaptcha";
|
|
35
|
+
const packageName = "@prosopo/procaptcha-bundle";
|
|
36
|
+
const entry = "./src/index.ts";
|
|
37
|
+
const tsConfigPaths = [path.resolve("./tsconfig.json")];
|
|
38
|
+
const packagesDir = path.resolve("..");
|
|
39
|
+
const workspaceRoot = path.resolve("../../");
|
|
40
|
+
const packages = fs
|
|
41
|
+
.readdirSync(packagesDir)
|
|
42
|
+
.filter((f) => fs.statSync(path.join(packagesDir, f)).isDirectory());
|
|
43
|
+
for (const p of packages) {
|
|
44
|
+
tsConfigPaths.push(path.resolve(`../${p}/tsconfig.json`));
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
const copyDir = {
|
|
48
|
+
srcDir: `${workspaceRoot}/packages/locale/src/locales`,
|
|
49
|
+
destDir: `${workspaceRoot}/packages/procaptcha-bundle/dist/bundle/locales`,
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
const localeFiles = await fg.glob(
|
|
53
|
+
`${workspaceRoot}/packages/locale/src/locales/**/*.json`,
|
|
54
|
+
);
|
|
55
|
+
|
|
56
|
+
const translationKeys = Object.keys(
|
|
57
|
+
flatten(JSON.parse(fs.readFileSync(at(localeFiles, 0), "utf-8"))),
|
|
58
|
+
);
|
|
59
|
+
|
|
60
|
+
export default defineConfig(async ({ command, mode }) => {
|
|
61
|
+
const frontendConfig = await ViteFrontendConfig(
|
|
62
|
+
packageName,
|
|
63
|
+
bundleName,
|
|
64
|
+
path.resolve(),
|
|
65
|
+
entry,
|
|
66
|
+
command,
|
|
67
|
+
mode,
|
|
68
|
+
undefined,
|
|
69
|
+
tsConfigPaths,
|
|
70
|
+
workspaceRoot,
|
|
71
|
+
);
|
|
72
|
+
|
|
73
|
+
return {
|
|
74
|
+
...frontendConfig,
|
|
75
|
+
worker: {
|
|
76
|
+
format: "es",
|
|
77
|
+
},
|
|
78
|
+
build: {
|
|
79
|
+
...frontendConfig.build,
|
|
80
|
+
assetsDir: "",
|
|
81
|
+
emptyOutDir: false,
|
|
82
|
+
lib: {
|
|
83
|
+
...frontendConfig.build?.lib,
|
|
84
|
+
entry: path.resolve(entry),
|
|
85
|
+
name: bundleName,
|
|
86
|
+
fileName: () => "procaptcha.bundle.iife.js",
|
|
87
|
+
formats: ["iife"],
|
|
88
|
+
},
|
|
89
|
+
rollupOptions: {
|
|
90
|
+
...frontendConfig.build?.rollupOptions,
|
|
91
|
+
output: {
|
|
92
|
+
...frontendConfig.build?.rollupOptions?.output,
|
|
93
|
+
entryFileNames: "procaptcha.bundle.iife.js",
|
|
94
|
+
inlineDynamicImports: true,
|
|
95
|
+
manualChunks: undefined,
|
|
96
|
+
},
|
|
97
|
+
},
|
|
98
|
+
},
|
|
99
|
+
plugins: [
|
|
100
|
+
{
|
|
101
|
+
name: "copy-locales-iife",
|
|
102
|
+
async writeBundle() {
|
|
103
|
+
const containingFolder = path.dirname(copyDir.destDir);
|
|
104
|
+
if (!fs.existsSync(containingFolder)) {
|
|
105
|
+
fs.mkdirSync(containingFolder, { recursive: true });
|
|
106
|
+
}
|
|
107
|
+
if (!fs.existsSync(copyDir.destDir)) {
|
|
108
|
+
fs.cpSync(copyDir.srcDir, copyDir.destDir, { recursive: true });
|
|
109
|
+
}
|
|
110
|
+
},
|
|
111
|
+
},
|
|
112
|
+
VitePluginRemoveUnusedTranslations(
|
|
113
|
+
translationKeys,
|
|
114
|
+
`${copyDir.destDir}/**/*.json`,
|
|
115
|
+
),
|
|
116
|
+
...(frontendConfig.plugins ? frontendConfig.plugins : []),
|
|
117
|
+
],
|
|
118
|
+
};
|
|
119
|
+
});
|
package/vite.serve.config.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright 2021-
|
|
1
|
+
// Copyright 2021-2026 Prosopo (UK) Ltd.
|
|
2
2
|
//
|
|
3
3
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
4
|
// you may not use this file except in compliance with the License.
|
|
@@ -13,13 +13,35 @@
|
|
|
13
13
|
// limitations under the License.
|
|
14
14
|
|
|
15
15
|
// vite.config.js
|
|
16
|
+
import fs from "node:fs";
|
|
17
|
+
import path from "node:path";
|
|
18
|
+
import { fileURLToPath } from "node:url";
|
|
16
19
|
import { defineConfig } from "vite";
|
|
17
20
|
|
|
21
|
+
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
22
|
+
const certPath = path.resolve(__dirname, "../../certs");
|
|
23
|
+
const keyPath = path.join(certPath, "server.key");
|
|
24
|
+
const crtPath = path.join(certPath, "server.crt");
|
|
25
|
+
|
|
26
|
+
// Check if certificates exist
|
|
27
|
+
const useTls = fs.existsSync(keyPath) && fs.existsSync(crtPath);
|
|
28
|
+
|
|
18
29
|
export default defineConfig({
|
|
19
30
|
server: {
|
|
20
31
|
port: 9269,
|
|
21
32
|
host: true,
|
|
22
33
|
cors: true,
|
|
34
|
+
https: useTls
|
|
35
|
+
? {
|
|
36
|
+
key: fs.readFileSync(keyPath),
|
|
37
|
+
cert: fs.readFileSync(crtPath),
|
|
38
|
+
}
|
|
39
|
+
: undefined,
|
|
40
|
+
watch: {
|
|
41
|
+
// Ensure the dev server watches the `dist/bundle` public directory so
|
|
42
|
+
// changes there trigger a full reload.
|
|
43
|
+
ignored: ["**/node_modules/**", "**/.git/**"],
|
|
44
|
+
},
|
|
23
45
|
},
|
|
24
46
|
// Change the default public directory if needed
|
|
25
47
|
publicDir: "dist/bundle", // assets in the "assets" folder at the project root will be served
|
package/vite.test.config.ts
CHANGED
package/webpack.config.cjs
CHANGED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const jsxRuntime = require("react/jsx-runtime");
|
|
4
|
-
const types = require("@prosopo/types");
|
|
5
|
-
const captchaComponentsList = require("./captchaComponentsList.cjs");
|
|
6
|
-
class CaptchaComponentProvider {
|
|
7
|
-
getCaptchaComponent(captchaType, captchaProps) {
|
|
8
|
-
if (captchaType === types.CaptchaType.invisible) {
|
|
9
|
-
throw new Error("Not Implemented");
|
|
10
|
-
}
|
|
11
|
-
const CaptchaComponent = captchaComponentsList.captchaComponentsList[captchaType];
|
|
12
|
-
console.log(`rendering ${captchaType}`);
|
|
13
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
14
|
-
CaptchaComponent,
|
|
15
|
-
{
|
|
16
|
-
config: captchaProps.config,
|
|
17
|
-
callbacks: captchaProps.callbacks,
|
|
18
|
-
i18n: captchaProps.i18n,
|
|
19
|
-
container: captchaProps.container
|
|
20
|
-
}
|
|
21
|
-
);
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
exports.CaptchaComponentProvider = CaptchaComponentProvider;
|
|
@@ -1,12 +0,0 @@
|
|
|
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;
|
|
@@ -1,12 +0,0 @@
|
|
|
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;
|
|
@@ -1,17 +0,0 @@
|
|
|
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;
|
|
@@ -1,17 +0,0 @@
|
|
|
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;
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import { CaptchaType } from "@prosopo/types";
|
|
3
|
-
import { captchaComponentsList } from "./captchaComponentsList.js";
|
|
4
|
-
class CaptchaComponentProvider {
|
|
5
|
-
getCaptchaComponent(captchaType, captchaProps) {
|
|
6
|
-
if (captchaType === CaptchaType.invisible) {
|
|
7
|
-
throw new Error("Not Implemented");
|
|
8
|
-
}
|
|
9
|
-
const CaptchaComponent = captchaComponentsList[captchaType];
|
|
10
|
-
console.log(`rendering ${captchaType}`);
|
|
11
|
-
return /* @__PURE__ */ jsx(
|
|
12
|
-
CaptchaComponent,
|
|
13
|
-
{
|
|
14
|
-
config: captchaProps.config,
|
|
15
|
-
callbacks: captchaProps.callbacks,
|
|
16
|
-
i18n: captchaProps.i18n,
|
|
17
|
-
container: captchaProps.container
|
|
18
|
-
}
|
|
19
|
-
);
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
export {
|
|
23
|
-
CaptchaComponentProvider
|
|
24
|
-
};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { CaptchaType } from "@prosopo/types";
|
|
2
|
-
import { FrictionlessCaptcha } from "./components/frictionlessCaptcha.js";
|
|
3
|
-
import { ImageCaptcha } from "./components/imageCaptcha.js";
|
|
4
|
-
import { PowCaptcha } from "./components/powCaptcha.js";
|
|
5
|
-
const captchaComponentsList = {
|
|
6
|
-
[CaptchaType.image]: ImageCaptcha,
|
|
7
|
-
[CaptchaType.pow]: PowCaptcha,
|
|
8
|
-
[CaptchaType.frictionless]: FrictionlessCaptcha
|
|
9
|
-
};
|
|
10
|
-
export {
|
|
11
|
-
captchaComponentsList
|
|
12
|
-
};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { CaptchaType } from "@prosopo/types";
|
|
2
|
-
import { at } from "@prosopo/util";
|
|
3
|
-
function getCaptchaType(elements) {
|
|
4
|
-
const features = Object.values(CaptchaType);
|
|
5
|
-
const captchaType = features.find(
|
|
6
|
-
(feature) => feature === at(elements, 0).getAttribute("data-captcha-type")
|
|
7
|
-
) || "frictionless";
|
|
8
|
-
return captchaType;
|
|
9
|
-
}
|
|
10
|
-
export {
|
|
11
|
-
getCaptchaType
|
|
12
|
-
};
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import { getDefaultEvents } from "@prosopo/procaptcha-common";
|
|
3
|
-
import { Procaptcha } from "@prosopo/procaptcha-react";
|
|
4
|
-
const ImageCaptcha = (props) => {
|
|
5
|
-
const { config, callbacks, i18n } = props;
|
|
6
|
-
return /* @__PURE__ */ jsx(
|
|
7
|
-
Procaptcha,
|
|
8
|
-
{
|
|
9
|
-
config,
|
|
10
|
-
callbacks: getDefaultEvents(callbacks),
|
|
11
|
-
i18n
|
|
12
|
-
}
|
|
13
|
-
);
|
|
14
|
-
};
|
|
15
|
-
export {
|
|
16
|
-
ImageCaptcha
|
|
17
|
-
};
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import { getDefaultEvents } from "@prosopo/procaptcha-common";
|
|
3
|
-
import { ProcaptchaPow } from "@prosopo/procaptcha-pow";
|
|
4
|
-
const PowCaptcha = (props) => {
|
|
5
|
-
const { config, callbacks, i18n } = props;
|
|
6
|
-
return /* @__PURE__ */ jsx(
|
|
7
|
-
ProcaptchaPow,
|
|
8
|
-
{
|
|
9
|
-
config,
|
|
10
|
-
callbacks: getDefaultEvents(callbacks),
|
|
11
|
-
i18n
|
|
12
|
-
}
|
|
13
|
-
);
|
|
14
|
-
};
|
|
15
|
-
export {
|
|
16
|
-
PowCaptcha
|
|
17
|
-
};
|