@prosopo/procaptcha-bundle 3.3.0 → 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 +33 -36
- package/.turbo/turbo-build.log +29 -36
- package/CHANGELOG.md +481 -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 +1 -4
- package/dist/components.d.ts.map +1 -1
- package/dist/components.js +1 -4
- package/dist/components.js.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -9
- package/dist/index.js.map +1 -1
- package/dist/tests/util/config.test.js +6 -6
- package/dist/tests/util/config.test.js.map +1 -1
- package/dist/tests/util/renderLogic.test.js +22 -14
- package/dist/tests/util/renderLogic.test.js.map +1 -1
- package/dist/util/captcha/captchaRenderer.d.ts +1 -6
- package/dist/util/captcha/captchaRenderer.d.ts.map +1 -1
- package/dist/util/captcha/captchaRenderer.js +10 -9
- package/dist/util/captcha/captchaRenderer.js.map +1 -1
- package/dist/util/captcha/{captchaProps.d.ts → components/bundleCaptcha.d.ts} +4 -3
- 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 +2 -2
- package/dist/util/config.d.ts.map +1 -1
- package/dist/util/config.js +14 -4
- package/dist/util/config.js.map +1 -1
- package/dist/util/widgetFactory.d.ts +1 -1
- package/dist/util/widgetFactory.d.ts.map +1 -1
- package/dist/util/widgetFactory.js +4 -6
- package/dist/util/widgetFactory.js.map +1 -1
- package/package.json +12 -12
- 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.config.ts +18 -1
- package/vite.iife.config.ts +119 -0
- package/vite.serve.config.ts +17 -0
- package/dist/cjs/util/captcha/captchaComponentProvider.cjs +0 -20
- 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/tests/util/captchaType.test.d.ts +0 -2
- package/dist/tests/util/captchaType.test.d.ts.map +0 -1
- package/dist/tests/util/captchaType.test.js +0 -36
- package/dist/tests/util/captchaType.test.js.map +0 -1
- package/dist/util/captcha/captchaComponentProvider.d.ts +0 -8
- package/dist/util/captcha/captchaComponentProvider.d.ts.map +0 -1
- package/dist/util/captcha/captchaComponentProvider.js +0 -20
- package/dist/util/captcha/captchaComponentProvider.js.map +0 -1
- package/dist/util/captcha/captchaComponentsList.d.ts +0 -6
- package/dist/util/captcha/captchaComponentsList.d.ts.map +0 -1
- package/dist/util/captcha/captchaComponentsList.js +0 -12
- package/dist/util/captcha/captchaComponentsList.js.map +0 -1
- package/dist/util/captcha/captchaProps.d.ts.map +0 -1
- package/dist/util/captcha/captchaProps.js +0 -2
- package/dist/util/captcha/captchaProps.js.map +0 -1
- package/dist/util/captcha/captchaType.d.ts +0 -3
- package/dist/util/captcha/captchaType.d.ts.map +0 -1
- package/dist/util/captcha/captchaType.js +0 -12
- package/dist/util/captcha/captchaType.js.map +0 -1
- package/dist/util/captcha/components/frictionlessCaptcha.d.ts +0 -4
- package/dist/util/captcha/components/frictionlessCaptcha.d.ts.map +0 -1
- package/dist/util/captcha/components/frictionlessCaptcha.js.map +0 -1
- package/dist/util/captcha/components/imageCaptcha.d.ts +0 -4
- package/dist/util/captcha/components/imageCaptcha.d.ts.map +0 -1
- package/dist/util/captcha/components/imageCaptcha.js +0 -17
- package/dist/util/captcha/components/imageCaptcha.js.map +0 -1
- package/dist/util/captcha/components/powCaptcha.d.ts +0 -4
- package/dist/util/captcha/components/powCaptcha.d.ts.map +0 -1
- package/dist/util/captcha/components/powCaptcha.js +0 -17
- package/dist/util/captcha/components/powCaptcha.js.map +0 -1
package/vite.config.ts
CHANGED
|
@@ -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
|
|
|
@@ -92,6 +99,13 @@ export default defineConfig(async ({ command, mode }) => {
|
|
|
92
99
|
output: {
|
|
93
100
|
...frontendConfig.build?.rollupOptions?.output,
|
|
94
101
|
manualChunks(id: string) {
|
|
102
|
+
if (
|
|
103
|
+
id.includes(
|
|
104
|
+
"packages/procaptcha-common/dist/reactComponents/Honeypot",
|
|
105
|
+
)
|
|
106
|
+
) {
|
|
107
|
+
return honeypotChunkName;
|
|
108
|
+
}
|
|
95
109
|
if (id.includes("wasm-crypto-wasm")) {
|
|
96
110
|
return "web3Chunk";
|
|
97
111
|
}
|
|
@@ -102,7 +116,10 @@ export default defineConfig(async ({ command, mode }) => {
|
|
|
102
116
|
}
|
|
103
117
|
return "web2Chunk";
|
|
104
118
|
}
|
|
105
|
-
if (
|
|
119
|
+
if (
|
|
120
|
+
id.includes("packages/common/dist") ||
|
|
121
|
+
id.includes("packages/logger/dist")
|
|
122
|
+
) {
|
|
106
123
|
return "commonChunk";
|
|
107
124
|
}
|
|
108
125
|
if (id.includes("zod")) {
|
|
@@ -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
|
@@ -13,13 +13,30 @@
|
|
|
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,
|
|
23
40
|
watch: {
|
|
24
41
|
// Ensure the dev server watches the `dist/bundle` public directory so
|
|
25
42
|
// changes there trigger a full reload.
|
|
@@ -1,20 +0,0 @@
|
|
|
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
|
-
container: captchaProps.container
|
|
16
|
-
}
|
|
17
|
-
);
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
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 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"captchaType.test.d.ts","sourceRoot":"","sources":["../../../src/tests/util/captchaType.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { CaptchaType } from "@prosopo/types";
|
|
2
|
-
import { JSDOM } from "jsdom";
|
|
3
|
-
import { beforeEach, describe, expect, it } from "vitest";
|
|
4
|
-
import { getCaptchaType } from "../../util/captcha/captchaType.js";
|
|
5
|
-
describe("getCaptchaType", () => {
|
|
6
|
-
beforeEach(() => {
|
|
7
|
-
const dom = new JSDOM("<!DOCTYPE html><html><body></body></html>");
|
|
8
|
-
global.document = dom.window.document;
|
|
9
|
-
});
|
|
10
|
-
it("should return the correct captcha type when a valid type is set", () => {
|
|
11
|
-
const element = document.createElement("div");
|
|
12
|
-
element.setAttribute("data-captcha-type", CaptchaType.pow);
|
|
13
|
-
const result = getCaptchaType([element]);
|
|
14
|
-
expect(result).toBe(CaptchaType.pow);
|
|
15
|
-
});
|
|
16
|
-
it('should return "frictionless" when no captcha type is set', () => {
|
|
17
|
-
const element = document.createElement("div");
|
|
18
|
-
const result = getCaptchaType([element]);
|
|
19
|
-
expect(result).toBe("frictionless");
|
|
20
|
-
});
|
|
21
|
-
it('should return "frictionless" when an invalid captcha type is set', () => {
|
|
22
|
-
const element = document.createElement("div");
|
|
23
|
-
element.setAttribute("data-captcha-type", "invalid-type");
|
|
24
|
-
const result = getCaptchaType([element]);
|
|
25
|
-
expect(result).toBe("frictionless");
|
|
26
|
-
});
|
|
27
|
-
it("should work with all valid FeaturesEnum values", () => {
|
|
28
|
-
const element = document.createElement("div");
|
|
29
|
-
for (const feature of Object.values(CaptchaType)) {
|
|
30
|
-
element.setAttribute("data-captcha-type", feature);
|
|
31
|
-
const result = getCaptchaType([element]);
|
|
32
|
-
expect(result).toBe(feature);
|
|
33
|
-
}
|
|
34
|
-
});
|
|
35
|
-
});
|
|
36
|
-
//# sourceMappingURL=captchaType.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"captchaType.test.js","sourceRoot":"","sources":["../../../src/tests/util/captchaType.test.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,KAAK,EAAE,MAAM,OAAO,CAAC;AAC9B,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAC1D,OAAO,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AAEnE,QAAQ,CAAC,gBAAgB,EAAE,GAAG,EAAE;IAC/B,UAAU,CAAC,GAAG,EAAE;QACf,MAAM,GAAG,GAAG,IAAI,KAAK,CAAC,2CAA2C,CAAC,CAAC;QACnE,MAAM,CAAC,QAAQ,GAAG,GAAG,CAAC,MAAM,CAAC,QAAQ,CAAC;IACvC,CAAC,CAAC,CAAC;IACH,EAAE,CAAC,iEAAiE,EAAE,GAAG,EAAE;QAC1E,MAAM,OAAO,GAAG,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;QAC9C,OAAO,CAAC,YAAY,CAAC,mBAAmB,EAAE,WAAW,CAAC,GAAG,CAAC,CAAC;QAE3D,MAAM,MAAM,GAAG,cAAc,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC;QAEzC,MAAM,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;IACtC,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,0DAA0D,EAAE,GAAG,EAAE;QACnE,MAAM,OAAO,GAAG,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;QAE9C,MAAM,MAAM,GAAG,cAAc,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC;QAEzC,MAAM,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;IACrC,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,kEAAkE,EAAE,GAAG,EAAE;QAC3E,MAAM,OAAO,GAAG,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;QAC9C,OAAO,CAAC,YAAY,CAAC,mBAAmB,EAAE,cAAc,CAAC,CAAC;QAE1D,MAAM,MAAM,GAAG,cAAc,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC;QAEzC,MAAM,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;IACrC,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,gDAAgD,EAAE,GAAG,EAAE;QACzD,MAAM,OAAO,GAAG,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;QAE9C,KAAK,MAAM,OAAO,IAAI,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC,EAAE,CAAC;YAClD,OAAO,CAAC,YAAY,CAAC,mBAAmB,EAAE,OAAO,CAAC,CAAC;YACnD,MAAM,MAAM,GAAG,cAAc,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC;YACzC,MAAM,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAC9B,CAAC;IACF,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { CaptchaType } from "@prosopo/types";
|
|
2
|
-
import type { ReactNode } from "react";
|
|
3
|
-
import type { CaptchaProps } from "./captchaProps.js";
|
|
4
|
-
declare class CaptchaComponentProvider {
|
|
5
|
-
getCaptchaComponent(captchaType: CaptchaType, captchaProps: CaptchaProps): ReactNode;
|
|
6
|
-
}
|
|
7
|
-
export { CaptchaComponentProvider };
|
|
8
|
-
//# sourceMappingURL=captchaComponentProvider.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"captchaComponentProvider.d.ts","sourceRoot":"","sources":["../../../src/util/captcha/captchaComponentProvider.tsx"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEtD,cAAM,wBAAwB;IACtB,mBAAmB,CACzB,WAAW,EAAE,WAAW,EACxB,YAAY,EAAE,YAAY,GACxB,SAAS;CAcZ;AAED,OAAO,EAAE,wBAAwB,EAAE,CAAC"}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import { captchaComponentsList } from "./captchaComponentsList.js";
|
|
3
|
-
class CaptchaComponentProvider {
|
|
4
|
-
getCaptchaComponent(captchaType, captchaProps) {
|
|
5
|
-
const CaptchaComponent = captchaComponentsList[captchaType];
|
|
6
|
-
console.log(`rendering ${captchaType}`);
|
|
7
|
-
return /* @__PURE__ */ jsx(
|
|
8
|
-
CaptchaComponent,
|
|
9
|
-
{
|
|
10
|
-
config: captchaProps.config,
|
|
11
|
-
callbacks: captchaProps.callbacks,
|
|
12
|
-
i18n: captchaProps.i18n,
|
|
13
|
-
container: captchaProps.container
|
|
14
|
-
}
|
|
15
|
-
);
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
export {
|
|
19
|
-
CaptchaComponentProvider
|
|
20
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"captchaComponentProvider.js","sourceRoot":"","sources":["../../../src/util/captcha/captchaComponentProvider.tsx"],"names":[],"mappings":";AAgBA,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAGnE,MAAM,wBAAwB;IACtB,mBAAmB,CACzB,WAAwB,EACxB,YAA0B;QAE1B,MAAM,gBAAgB,GAAG,qBAAqB,CAAC,WAAW,CAAC,CAAC;QAE5D,OAAO,CAAC,GAAG,CAAC,aAAa,WAAW,EAAE,CAAC,CAAC;QAExC,OAAO,CACN,KAAC,gBAAgB,IAChB,MAAM,EAAE,YAAY,CAAC,MAAM,EAC3B,SAAS,EAAE,YAAY,CAAC,SAAS,EACjC,IAAI,EAAE,YAAY,CAAC,IAAI,EACvB,SAAS,EAAE,YAAY,CAAC,SAAS,GAChC,CACF,CAAC;IACH,CAAC;CACD;AAED,OAAO,EAAE,wBAAwB,EAAE,CAAC"}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { CaptchaType } from "@prosopo/types";
|
|
2
|
-
import type React from "react";
|
|
3
|
-
import type { CaptchaProps } from "./captchaProps.js";
|
|
4
|
-
declare const captchaComponentsList: Pick<Record<CaptchaType, React.ComponentType<CaptchaProps>>, CaptchaType.image | CaptchaType.pow | CaptchaType.frictionless>;
|
|
5
|
-
export { captchaComponentsList };
|
|
6
|
-
//# sourceMappingURL=captchaComponentsList.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"captchaComponentsList.d.ts","sourceRoot":"","sources":["../../../src/util/captcha/captchaComponentsList.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAKtD,QAAA,MAAM,qBAAqB,EAAE,IAAI,CAChC,MAAM,CAAC,WAAW,EAAE,KAAK,CAAC,aAAa,CAAC,YAAY,CAAC,CAAC,EACtD,WAAW,CAAC,KAAK,GAAG,WAAW,CAAC,GAAG,GAAG,WAAW,CAAC,YAAY,CAK9D,CAAC;AAEF,OAAO,EAAE,qBAAqB,EAAE,CAAC"}
|
|
@@ -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 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"captchaComponentsList.js","sourceRoot":"","sources":["../../../src/util/captcha/captchaComponentsList.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAG7C,OAAO,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAC;AAC1E,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAC5D,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAExD,MAAM,qBAAqB,GAGvB;IACH,CAAC,WAAW,CAAC,KAAK,CAAC,EAAE,YAAY;IACjC,CAAC,WAAW,CAAC,GAAG,CAAC,EAAE,UAAU;IAC7B,CAAC,WAAW,CAAC,YAAY,CAAC,EAAE,mBAAmB;CAC/C,CAAC;AAEF,OAAO,EAAE,qBAAqB,EAAE,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"captchaProps.d.ts","sourceRoot":"","sources":["../../../src/util/captcha/captchaProps.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,KAAK,EACX,mBAAmB,EACnB,2BAA2B,EAC3B,MAAM,gBAAgB,CAAC;AAExB,UAAU,YAAY;IACrB,MAAM,EAAE,2BAA2B,CAAC;IACpC,SAAS,EAAE,mBAAmB,CAAC;IAC/B,IAAI,EAAE,KAAK,CAAC;IACZ,SAAS,EAAE,WAAW,CAAC;CACvB;AAED,YAAY,EAAE,YAAY,EAAE,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"captchaProps.js","sourceRoot":"","sources":["../../../src/util/captcha/captchaProps.ts"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"captchaType.d.ts","sourceRoot":"","sources":["../../../src/util/captcha/captchaType.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAS7C,wBAAgB,cAAc,CAAC,QAAQ,EAAE,OAAO,EAAE,eAQjD"}
|
|
@@ -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 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"captchaType.js","sourceRoot":"","sources":["../../../src/util/captcha/captchaType.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,EAAE,EAAE,MAAM,eAAe,CAAC;AAQnC,MAAM,UAAU,cAAc,CAAC,QAAmB;IACjD,MAAM,QAAQ,GAAG,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;IAC5C,MAAM,WAAW,GAChB,QAAQ,CAAC,IAAI,CACZ,CAAC,OAAO,EAAE,EAAE,CACX,OAAO,KAAK,EAAE,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,YAAY,CAAC,mBAAmB,CAAC,CAC9D,IAAK,cAA8B,CAAC;IACtC,OAAO,WAAW,CAAC;AACpB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"frictionlessCaptcha.d.ts","sourceRoot":"","sources":["../../../../src/util/captcha/components/frictionlessCaptcha.tsx"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAEvD,QAAA,MAAM,mBAAmB,UAAW,YAAY,4CAmB/C,CAAC;AAEF,OAAO,EAAE,mBAAmB,EAAE,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"frictionlessCaptcha.js","sourceRoot":"","sources":["../../../../src/util/captcha/components/frictionlessCaptcha.tsx"],"names":[],"mappings":";AAcA,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,EAAE,sBAAsB,EAAE,MAAM,kCAAkC,CAAC;AAC1E,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAGjC,MAAM,mBAAmB,GAAG,CAAC,KAAmB,EAAE,EAAE;IACnD,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,KAAK,CAAC;IAErD,MAAM,CAAC,YAAY,EAAE,eAAe,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;IAEpD,MAAM,OAAO,GAAG,GAAG,EAAE;QACpB,eAAe,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,GAAG,CAAC,CAAC,CAAC;IAC3C,CAAC,CAAC;IAEF,OAAO,CACN,KAAC,sBAAsB,IAEtB,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,gBAAgB,CAAC,SAAS,CAAC,EACtC,OAAO,EAAE,OAAO,EAChB,IAAI,EAAE,IAAI,EACV,SAAS,EAAE,SAAS,IALf,YAAY,CAMhB,CACF,CAAC;AACH,CAAC,CAAC;AAEF,OAAO,EAAE,mBAAmB,EAAE,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"imageCaptcha.d.ts","sourceRoot":"","sources":["../../../../src/util/captcha/components/imageCaptcha.tsx"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAEvD,QAAA,MAAM,YAAY,UAAW,YAAY,4CAUxC,CAAC;AAEF,OAAO,EAAE,YAAY,EAAE,CAAC"}
|
|
@@ -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 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"imageCaptcha.js","sourceRoot":"","sources":["../../../../src/util/captcha/components/imageCaptcha.tsx"],"names":[],"mappings":";AAcA,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAGvD,MAAM,YAAY,GAAG,CAAC,KAAmB,EAAE,EAAE;IAC5C,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,IAAI,EAAE,GAAG,KAAK,CAAC;IAE1C,OAAO,CACN,KAAC,UAAU,IACV,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,gBAAgB,CAAC,SAAS,CAAC,EACtC,IAAI,EAAE,IAAI,GACT,CACF,CAAC;AACH,CAAC,CAAC;AAEF,OAAO,EAAE,YAAY,EAAE,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"powCaptcha.d.ts","sourceRoot":"","sources":["../../../../src/util/captcha/components/powCaptcha.tsx"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAEvD,QAAA,MAAM,UAAU,UAAW,YAAY,4CAUtC,CAAC;AAEF,OAAO,EAAE,UAAU,EAAE,CAAC"}
|
|
@@ -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
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"powCaptcha.js","sourceRoot":"","sources":["../../../../src/util/captcha/components/powCaptcha.tsx"],"names":[],"mappings":";AAcA,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAGxD,MAAM,UAAU,GAAG,CAAC,KAAmB,EAAE,EAAE;IAC1C,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,IAAI,EAAE,GAAG,KAAK,CAAC;IAE1C,OAAO,CACN,KAAC,aAAa,IACb,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,gBAAgB,CAAC,SAAS,CAAC,EACtC,IAAI,EAAE,IAAI,GACT,CACF,CAAC;AACH,CAAC,CAAC;AAEF,OAAO,EAAE,UAAU,EAAE,CAAC"}
|