@prosopo/procaptcha-frictionless 0.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (31) hide show
  1. package/dist/ProcaptchaFrictionless.d.ts +3 -0
  2. package/dist/ProcaptchaFrictionless.d.ts.map +1 -0
  3. package/dist/ProcaptchaFrictionless.js +24 -0
  4. package/dist/ProcaptchaFrictionless.js.map +1 -0
  5. package/dist/cjs/ProcaptchaFrictionless.cjs +27 -0
  6. package/dist/cjs/account/dist/extension/Extension.cjs +5 -0
  7. package/dist/cjs/account/dist/extension/ExtensionWeb2.cjs +100 -0
  8. package/dist/cjs/account/dist/extension/ExtensionWeb3.cjs +28 -0
  9. package/dist/cjs/account/dist/index.cjs +8 -0
  10. package/dist/cjs/index.cjs +4 -0
  11. package/dist/cjs/procaptcha-pow/dist/Services/Manager.cjs +59 -0
  12. package/dist/cjs/procaptcha-pow/dist/Services/SolverService.cjs +17 -0
  13. package/dist/cjs/procaptcha-pow/dist/components/Captcha.cjs +55 -0
  14. package/dist/cjs/procaptcha-pow/dist/components/ProcaptchaPoW.cjs +10 -0
  15. package/dist/cjs/procaptcha-pow/dist/index.cjs +5 -0
  16. package/dist/cjs/web-components/dist/CaptchaPlaceholder.cjs +39 -0
  17. package/dist/cjs/web-components/dist/Checkbox.cjs +55 -0
  18. package/dist/cjs/web-components/dist/Containers.cjs +42 -0
  19. package/dist/cjs/web-components/dist/LoadingSpinner.cjs +34 -0
  20. package/dist/cjs/web-components/dist/Logo.cjs +16 -0
  21. package/dist/cjs/web-components/dist/LogoWithText.cjs +10 -0
  22. package/dist/cjs/web-components/dist/LogoWithoutText.cjs +10 -0
  23. package/dist/cjs/web-components/dist/WidgetConstants.cjs +12 -0
  24. package/dist/cjs/web-components/dist/index.cjs +22 -0
  25. package/dist/cjs/web-components/dist/theme.cjs +44 -0
  26. package/dist/index.d.ts +2 -0
  27. package/dist/index.d.ts.map +1 -0
  28. package/dist/index.js +2 -0
  29. package/dist/index.js.map +1 -0
  30. package/package.json +58 -0
  31. package/vite.cjs.config.ts +19 -0
@@ -0,0 +1,3 @@
1
+ import { ProcaptchaProps } from '@prosopo/procaptcha-pow';
2
+ export declare const ProcaptchaFrictionless: ({ config, callbacks }: ProcaptchaProps) => import("react/jsx-runtime").JSX.Element;
3
+ //# sourceMappingURL=ProcaptchaFrictionless.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ProcaptchaFrictionless.d.ts","sourceRoot":"","sources":["../src/ProcaptchaFrictionless.tsx"],"names":[],"mappings":"AAeA,OAAO,EAAiB,eAAe,EAAE,MAAM,yBAAyB,CAAA;AAIxE,eAAO,MAAM,sBAAsB,0BAA2B,eAAe,4CAmB5E,CAAA"}
@@ -0,0 +1,24 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { Procaptcha } from '@prosopo/procaptcha-react';
3
+ import { ProcaptchaPlaceholder } from '@prosopo/web-components';
4
+ import { ProcaptchaPow } from '@prosopo/procaptcha-pow';
5
+ import { load } from '@fingerprintjs/botd';
6
+ import { useEffect, useState } from 'react';
7
+ export const ProcaptchaFrictionless = ({ config, callbacks }) => {
8
+ const [componentToRender, setComponentToRender] = useState(_jsx(ProcaptchaPlaceholder, { darkMode: config.theme }));
9
+ useEffect(() => {
10
+ const detectBot = async () => {
11
+ const botd = await load();
12
+ const result = botd.detect();
13
+ if (result.bot) {
14
+ setComponentToRender(_jsx(Procaptcha, { config: config, callbacks: callbacks }));
15
+ }
16
+ else {
17
+ setComponentToRender(_jsx(ProcaptchaPow, { config: config, callbacks: callbacks }));
18
+ }
19
+ };
20
+ detectBot();
21
+ }, [config, callbacks]);
22
+ return componentToRender;
23
+ };
24
+ //# sourceMappingURL=ProcaptchaFrictionless.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ProcaptchaFrictionless.js","sourceRoot":"","sources":["../src/ProcaptchaFrictionless.tsx"],"names":[],"mappings":";AAaA,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAA;AACtD,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAA;AAC/D,OAAO,EAAE,aAAa,EAAmB,MAAM,yBAAyB,CAAA;AACxE,OAAO,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAA;AAC1C,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAE3C,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,EAAE,MAAM,EAAE,SAAS,EAAmB,EAAE,EAAE;IAE7E,MAAM,CAAC,iBAAiB,EAAE,oBAAoB,CAAC,GAAG,QAAQ,CAAC,KAAC,qBAAqB,IAAC,QAAQ,EAAE,MAAM,CAAC,KAAK,GAAI,CAAC,CAAA;IAE7G,SAAS,CAAC,GAAG,EAAE;QACX,MAAM,SAAS,GAAG,KAAK,IAAI,EAAE;YACzB,MAAM,IAAI,GAAG,MAAM,IAAI,EAAE,CAAA;YACzB,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,EAAE,CAAA;YAC5B,IAAI,MAAM,CAAC,GAAG,EAAE;gBACZ,oBAAoB,CAAC,KAAC,UAAU,IAAC,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,SAAS,GAAI,CAAC,CAAA;aAC7E;iBAAM;gBACH,oBAAoB,CAAC,KAAC,aAAa,IAAC,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,SAAS,GAAI,CAAC,CAAA;aAChF;QACL,CAAC,CAAA;QAED,SAAS,EAAE,CAAA;IACf,CAAC,EAAE,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC,CAAA;IAEvB,OAAO,iBAAiB,CAAA;AAC5B,CAAC,CAAA"}
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const jsxRuntime = require("react/jsx-runtime");
4
+ const procaptchaReact = require("@prosopo/procaptcha-react");
5
+ require("./web-components/dist/index.cjs");
6
+ require("./procaptcha-pow/dist/index.cjs");
7
+ const botd = require("@fingerprintjs/botd");
8
+ const react = require("react");
9
+ const CaptchaPlaceholder = require("./web-components/dist/CaptchaPlaceholder.cjs");
10
+ const ProcaptchaPoW = require("./procaptcha-pow/dist/components/ProcaptchaPoW.cjs");
11
+ const ProcaptchaFrictionless = ({ config, callbacks }) => {
12
+ const [componentToRender, setComponentToRender] = react.useState(/* @__PURE__ */ jsxRuntime.jsx(CaptchaPlaceholder.ProcaptchaPlaceholder, { darkMode: config.theme }));
13
+ react.useEffect(() => {
14
+ const detectBot = async () => {
15
+ const botd$1 = await botd.load();
16
+ const result = botd$1.detect();
17
+ if (result.bot) {
18
+ setComponentToRender(/* @__PURE__ */ jsxRuntime.jsx(procaptchaReact.Procaptcha, { config, callbacks }));
19
+ } else {
20
+ setComponentToRender(/* @__PURE__ */ jsxRuntime.jsx(ProcaptchaPoW.ProcaptchaPow, { config, callbacks }));
21
+ }
22
+ };
23
+ detectBot();
24
+ }, [config, callbacks]);
25
+ return componentToRender;
26
+ };
27
+ exports.ProcaptchaFrictionless = ProcaptchaFrictionless;
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ class Extension {
4
+ }
5
+ exports.Extension = Extension;
@@ -0,0 +1,100 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const Api = require("@polkadot/api/promise/Api");
4
+ const Extension = require("./Extension.cjs");
5
+ const keyring = require("@polkadot/keyring");
6
+ const common = require("@prosopo/common");
7
+ const ws = require("@polkadot/rpc-provider/ws");
8
+ const address = require("@polkadot/util-crypto/address");
9
+ const bip39 = require("@polkadot/util-crypto/mnemonic/bip39");
10
+ const fingerprintjs = require("@fingerprintjs/fingerprintjs");
11
+ const util = require("@prosopo/util");
12
+ const string = require("@polkadot/util/string");
13
+ const u8a = require("@polkadot/util/u8a");
14
+ const Signer = require("@polkadot/extension-base/page/Signer");
15
+ class ExtensionWeb2 extends Extension.Extension {
16
+ constructor() {
17
+ super(...arguments);
18
+ this.getNetwork = (config) => {
19
+ const network = config.networks[config.defaultNetwork];
20
+ if (!network) {
21
+ throw new common.ProsopoEnvError("DEVELOPER.NETWORK_NOT_FOUND", {
22
+ context: { error: `No network found for environment ${config.defaultEnvironment}` }
23
+ });
24
+ }
25
+ return network;
26
+ };
27
+ }
28
+ async getAccount(config) {
29
+ const network = this.getNetwork(config);
30
+ const wsProvider = new ws.WsProvider(network.endpoint);
31
+ const account = await this.createAccount(wsProvider);
32
+ const extension = await this.createExtension(account);
33
+ return {
34
+ account,
35
+ extension
36
+ };
37
+ }
38
+ async createExtension(account) {
39
+ const signer = new Signer(async () => {
40
+ return;
41
+ });
42
+ signer.signRaw = async (payload) => {
43
+ const signature = account.keypair.sign(payload.data);
44
+ return {
45
+ id: 1,
46
+ signature: u8a.u8aToHex(signature)
47
+ };
48
+ };
49
+ return {
50
+ accounts: {
51
+ get: async () => {
52
+ return [account];
53
+ },
54
+ subscribe: () => {
55
+ return () => {
56
+ return;
57
+ };
58
+ }
59
+ },
60
+ name: "procaptcha-web2",
61
+ version: "0.1.11",
62
+ signer
63
+ };
64
+ }
65
+ async createAccount(wsProvider) {
66
+ const params = {
67
+ area: { width: 300, height: 300 },
68
+ offsetParameter: 2001000001,
69
+ multiplier: 15e3,
70
+ fontSizeFactor: 1.5,
71
+ maxShadowBlur: 50,
72
+ numberOfRounds: 5,
73
+ seed: 42
74
+ };
75
+ const browserEntropy = await this.getFingerprint();
76
+ const canvasEntropy = util.picassoCanvas(params.numberOfRounds, params.seed, params);
77
+ const entropy = common.hexHash([canvasEntropy, browserEntropy].join(""), 128).slice(2);
78
+ const u8Entropy = string.stringToU8a(entropy);
79
+ const mnemonic = bip39.entropyToMnemonic(u8Entropy);
80
+ const api = await Api.ApiPromise.create({ provider: wsProvider, initWasm: false });
81
+ const type = "ed25519";
82
+ const keyring$1 = new keyring.Keyring({ type, ss58Format: api.registry.chainSS58 });
83
+ const keypair = keyring$1.addFromMnemonic(mnemonic);
84
+ const address$1 = keypair.address.length === 42 ? keypair.address : address.encodeAddress(address.decodeAddress(keypair.address), api.registry.chainSS58);
85
+ return {
86
+ address: address$1,
87
+ type,
88
+ name: address$1,
89
+ keypair
90
+ };
91
+ }
92
+ async getFingerprint() {
93
+ const fpPromise = fingerprintjs.load();
94
+ const fp = await fpPromise;
95
+ const result = await fp.get();
96
+ const { screenFrame, ...componentsReduced } = result.components;
97
+ return fingerprintjs.hashComponents(componentsReduced);
98
+ }
99
+ }
100
+ exports.ExtensionWeb2 = ExtensionWeb2;
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const Extension = require("./Extension.cjs");
4
+ const common = require("@prosopo/common");
5
+ const extensionDapp = require("@polkadot/extension-dapp");
6
+ class ExtensionWeb3 extends Extension.Extension {
7
+ async getAccount(config) {
8
+ const { dappName, userAccountAddress: address } = config;
9
+ if (!address) {
10
+ throw new common.ProsopoError("WIDGET.NO_ACCOUNTS_FOUND", { context: { error: "No account address provided" } });
11
+ }
12
+ const extensions = await extensionDapp.web3Enable(dappName);
13
+ if (extensions.length === 0) {
14
+ throw new common.ProsopoError("WIDGET.NO_EXTENSION_FOUND");
15
+ }
16
+ for (const extension of extensions) {
17
+ const accounts = await extension.accounts.get();
18
+ const account = accounts.find((account2) => account2.address === address);
19
+ if (account) {
20
+ return { account, extension };
21
+ }
22
+ }
23
+ throw new common.ProsopoError("WIDGET.ACCOUNT_NOT_FOUND", {
24
+ context: { error: `No account found matching ${address}` }
25
+ });
26
+ }
27
+ }
28
+ exports.ExtensionWeb3 = ExtensionWeb3;
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const Extension = require("./extension/Extension.cjs");
4
+ const ExtensionWeb2 = require("./extension/ExtensionWeb2.cjs");
5
+ const ExtensionWeb3 = require("./extension/ExtensionWeb3.cjs");
6
+ exports.Extension = Extension.Extension;
7
+ exports.ExtensionWeb2 = ExtensionWeb2.ExtensionWeb2;
8
+ exports.ExtensionWeb3 = ExtensionWeb3.ExtensionWeb3;
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const ProcaptchaFrictionless = require("./ProcaptchaFrictionless.cjs");
4
+ exports.ProcaptchaFrictionless = ProcaptchaFrictionless.ProcaptchaFrictionless;
@@ -0,0 +1,59 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const Api = require("@polkadot/api/promise/Api");
4
+ require("../../../account/dist/index.cjs");
5
+ const keyring = require("@polkadot/keyring");
6
+ const types = require("@prosopo/types");
7
+ const contract = require("@prosopo/contract");
8
+ const common = require("@prosopo/common");
9
+ const api = require("@prosopo/api");
10
+ const ws = require("@polkadot/rpc-provider/ws");
11
+ const contractInfo = require("@prosopo/captcha-contract/contract-info");
12
+ const SolverService = require("./SolverService.cjs");
13
+ const ExtensionWeb2 = require("../../../account/dist/extension/ExtensionWeb2.cjs");
14
+ const Manager = async (configInput) => {
15
+ const getConfig = () => {
16
+ const config2 = {
17
+ userAccountAddress: "",
18
+ ...configInput
19
+ };
20
+ return types.ProcaptchaConfigSchema.parse(config2);
21
+ };
22
+ const getNetwork = (config2) => {
23
+ const network = config2.networks[config2.defaultNetwork];
24
+ if (!network) {
25
+ throw new common.ProsopoEnvError("DEVELOPER.NETWORK_NOT_FOUND", {
26
+ context: { error: `No network found for environment ${config2.defaultEnvironment}` }
27
+ });
28
+ }
29
+ return network;
30
+ };
31
+ const loadContract = async () => {
32
+ const network = getNetwork(getConfig());
33
+ const api2 = await Api.ApiPromise.create({ provider: new ws.WsProvider(network.endpoint), initWasm: false });
34
+ const type = "sr25519";
35
+ const keyring$1 = new keyring.Keyring({ type, ss58Format: api2.registry.chainSS58 });
36
+ return new contract.ProsopoCaptchaContract(api2, JSON.parse(contractInfo.ContractAbi), network.contract.address, "prosopo", 0, keyring$1.addFromAddress(getConfig().account.address || ""));
37
+ };
38
+ const config = getConfig();
39
+ if (!config.web2 && !config.userAccountAddress) {
40
+ throw new common.ProsopoEnvError("GENERAL.ACCOUNT_NOT_FOUND", {
41
+ context: { error: "Account address has not been set for web3 mode" }
42
+ });
43
+ }
44
+ const ext = new ExtensionWeb2.ExtensionWeb2();
45
+ const account = await ext.getAccount(config);
46
+ const contract$1 = await loadContract();
47
+ const getRandomProviderResponse = await contract.wrapQuery(contract$1.query.getRandomActiveProvider, contract$1.query)(account.account.address, configInput.account.address || "");
48
+ const providerUrl = common.trimProviderUrl(getRandomProviderResponse.provider.url.toString());
49
+ const providerApi = new api.ProviderApi(getNetwork(getConfig()), providerUrl, configInput.account.address || "");
50
+ const challenge = await providerApi.getPowCaptchaChallenge(account.account.address, configInput.account.address || "");
51
+ console.log("challenge", challenge);
52
+ console.log("challenge", challenge.challenge);
53
+ console.log("challenge", challenge.difficulty);
54
+ const solution = SolverService.solvePoW(challenge.challenge, challenge.difficulty);
55
+ console.log("solution", solution);
56
+ const verifiedSolution = await providerApi.submitPowCaptchaSolution(challenge, account.account.address, configInput.account.address || "", getRandomProviderResponse, solution);
57
+ return verifiedSolution;
58
+ };
59
+ exports.Manager = Manager;
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const sha256 = require("@noble/hashes/sha256");
4
+ const solvePoW = (data, difficulty) => {
5
+ let nonce = 0;
6
+ const prefix = "0".repeat(difficulty);
7
+ while (true) {
8
+ const message = new TextEncoder().encode(nonce + data);
9
+ const hashHex = bufferToHex(sha256.sha256(message));
10
+ if (hashHex.startsWith(prefix)) {
11
+ return nonce;
12
+ }
13
+ nonce += 1;
14
+ }
15
+ };
16
+ const bufferToHex = (buffer) => Array.from(buffer).map((byte) => byte.toString(16).padStart(2, "0")).join("");
17
+ exports.solvePoW = solvePoW;
@@ -0,0 +1,55 @@
1
+ "use strict";
2
+ const jsxRuntime = require("@emotion/react/jsx-runtime");
3
+ require("../../../web-components/dist/index.cjs");
4
+ const Manager = require("../Services/Manager.cjs");
5
+ const react = require("react");
6
+ const theme = require("../../../web-components/dist/theme.cjs");
7
+ const Containers = require("../../../web-components/dist/Containers.cjs");
8
+ const WidgetConstants = require("../../../web-components/dist/WidgetConstants.cjs");
9
+ const LoadingSpinner = require("../../../web-components/dist/LoadingSpinner.cjs");
10
+ const Checkbox = require("../../../web-components/dist/Checkbox.cjs");
11
+ const Logo = require("../../../web-components/dist/Logo.cjs");
12
+ const Procaptcha = (props) => {
13
+ const [checked, setChecked] = react.useState(false);
14
+ const [loading, setLoading] = react.useState(false);
15
+ const darkMode = props.config.theme;
16
+ const themeColor = darkMode ? "light" : "dark";
17
+ const theme$1 = react.useMemo(() => darkMode === "light" ? theme.lightTheme : theme.darkTheme, [darkMode]);
18
+ const handlePowCaptcha = async () => {
19
+ setLoading(true);
20
+ Manager.Manager(props.config).then((verified) => {
21
+ if (verified.verified) {
22
+ console.log("verified");
23
+ setChecked(true);
24
+ }
25
+ setLoading(false);
26
+ });
27
+ };
28
+ return jsxRuntime.jsx("div", { children: jsxRuntime.jsx("div", { style: { maxWidth: "100%", maxHeight: "100%", overflowX: "auto" }, children: jsxRuntime.jsx(Containers.ContainerDiv, { children: jsxRuntime.jsx(Containers.WidthBasedStylesDiv, { children: jsxRuntime.jsxs("div", { style: WidgetConstants.WIDGET_DIMENSIONS, "data-cy": "button-human", children: [" ", jsxRuntime.jsxs("div", { style: {
29
+ padding: "2px",
30
+ border: "1px solid",
31
+ backgroundColor: theme$1.palette.background.default,
32
+ borderColor: theme$1.palette.grey[300],
33
+ borderRadius: "4px",
34
+ display: "flex",
35
+ alignItems: "center",
36
+ flexWrap: "wrap",
37
+ justifyContent: "space-between",
38
+ minHeight: `${WidgetConstants.WIDGET_INNER_HEIGHT}px`,
39
+ overflow: "hidden"
40
+ }, children: [jsxRuntime.jsx("div", { style: { display: "inline-flex", flexDirection: "column" }, children: jsxRuntime.jsx("div", { style: {
41
+ display: "flex",
42
+ justifyContent: "flex-start",
43
+ alignItems: "center",
44
+ flexWrap: "wrap"
45
+ }, children: jsxRuntime.jsx("div", { style: {
46
+ display: "flex",
47
+ alignItems: "center",
48
+ justifyContent: "center",
49
+ flexDirection: "column",
50
+ verticalAlign: "middle"
51
+ }, children: jsxRuntime.jsx("div", { style: {
52
+ display: "flex"
53
+ }, children: jsxRuntime.jsx("div", { style: { flex: 1 }, children: loading ? jsxRuntime.jsx(LoadingSpinner.LoadingSpinner, { themeColor }) : jsxRuntime.jsx(Checkbox.Checkbox, { checked, onChange: handlePowCaptcha, themeColor, labelText: "I am human" }) }) }) }) }) }), jsxRuntime.jsx("div", { style: { display: "inline-flex", flexDirection: "column" }, children: jsxRuntime.jsx("a", { href: WidgetConstants.WIDGET_URL, target: "_blank", "aria-label": WidgetConstants.WIDGET_URL_TEXT, children: jsxRuntime.jsx("div", { style: { flex: 1 }, children: jsxRuntime.jsx(Logo, { themeColor }) }) }) })] })] }) }) }) }) });
54
+ };
55
+ module.exports = Procaptcha;
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const jsxRuntime = require("@emotion/react/jsx-runtime");
4
+ require("../../../web-components/dist/index.cjs");
5
+ const react = require("react");
6
+ const CaptchaPlaceholder = require("../../../web-components/dist/CaptchaPlaceholder.cjs");
7
+ const _interopNamespaceDefaultOnly = (e) => Object.freeze(Object.defineProperty({ __proto__: null, default: e }, Symbol.toStringTag, { value: "Module" }));
8
+ const ProcaptchaWidget = react.lazy(async () => Promise.resolve().then(() => /* @__PURE__ */ _interopNamespaceDefaultOnly(require("./Captcha.cjs"))));
9
+ const ProcaptchaPow = (props) => jsxRuntime.jsx(react.Suspense, { fallback: jsxRuntime.jsx(CaptchaPlaceholder.ProcaptchaPlaceholder, { darkMode: props.config.theme }), children: jsxRuntime.jsx(ProcaptchaWidget, { config: props.config, callbacks: props.callbacks }) });
10
+ exports.ProcaptchaPow = ProcaptchaPow;
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ require("./components/Captcha.cjs");
4
+ const ProcaptchaPoW = require("./components/ProcaptchaPoW.cjs");
5
+ exports.ProcaptchaPow = ProcaptchaPoW.ProcaptchaPow;
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const jsxRuntime = require("@emotion/react/jsx-runtime");
4
+ const Containers = require("./Containers.cjs");
5
+ const LoadingSpinner = require("./LoadingSpinner.cjs");
6
+ const WidgetConstants = require("./WidgetConstants.cjs");
7
+ const theme = require("./theme.cjs");
8
+ const react = require("react");
9
+ const Logo = require("./Logo.cjs");
10
+ const ProcaptchaPlaceholder = (props) => {
11
+ const darkMode = props.darkMode;
12
+ const themeColor = props.darkMode === "light" ? "light" : "dark";
13
+ const theme$1 = react.useMemo(() => darkMode === "light" ? theme.lightTheme : theme.darkTheme, [darkMode]);
14
+ return jsxRuntime.jsx("div", { children: jsxRuntime.jsx("div", { style: { maxWidth: "100%", maxHeight: "100%", overflowX: "auto" }, children: jsxRuntime.jsx(Containers.ContainerDiv, { children: jsxRuntime.jsx(Containers.WidthBasedStylesDiv, { children: jsxRuntime.jsxs("div", { style: WidgetConstants.WIDGET_DIMENSIONS, "data-cy": "button-human", children: [" ", jsxRuntime.jsxs("div", { style: {
15
+ padding: "2px",
16
+ border: "1px solid",
17
+ backgroundColor: theme$1.palette.background.default,
18
+ borderColor: theme$1.palette.grey[300],
19
+ borderRadius: "8px",
20
+ display: "flex",
21
+ alignItems: "center",
22
+ flexWrap: "wrap",
23
+ justifyContent: "space-between",
24
+ minHeight: `${WidgetConstants.WIDGET_INNER_HEIGHT}px`,
25
+ overflow: "hidden"
26
+ }, children: [jsxRuntime.jsx("div", { style: { display: "flex", flexDirection: "column" }, children: jsxRuntime.jsx("div", { style: {
27
+ alignItems: "center",
28
+ flex: 1
29
+ }, children: jsxRuntime.jsx("div", { style: {
30
+ display: "flex",
31
+ alignItems: "center",
32
+ justifyContent: "center",
33
+ flexDirection: "column",
34
+ verticalAlign: "middle"
35
+ }, children: jsxRuntime.jsx("div", { style: {
36
+ display: "flex"
37
+ }, children: jsxRuntime.jsx("div", { style: { display: "inline-flex" }, children: jsxRuntime.jsx(LoadingSpinner.LoadingSpinner, { themeColor }) }) }) }) }) }), jsxRuntime.jsx("div", { style: { display: "inline-flex", flexDirection: "column" }, children: jsxRuntime.jsx("a", { href: WidgetConstants.WIDGET_URL, target: "_blank", "aria-label": WidgetConstants.WIDGET_URL_TEXT, children: jsxRuntime.jsx("div", { style: { flex: 1 }, children: jsxRuntime.jsx(Logo, { themeColor }) }) }) })] })] }) }) }) }) });
38
+ };
39
+ exports.ProcaptchaPlaceholder = ProcaptchaPlaceholder;
@@ -0,0 +1,55 @@
1
+ "use strict";
2
+ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
3
+ const jsxRuntime = require("@emotion/react/jsx-runtime");
4
+ const react = require("@emotion/react");
5
+ const theme = require("./theme.cjs");
6
+ const react$1 = require("react");
7
+ const checkboxBefore = react.css`{
8
+ &:before {
9
+ content: '""';
10
+ position: absolute;
11
+ height: 100%;
12
+ width: 100%;
13
+ }
14
+ }`;
15
+ const baseStyle = {
16
+ width: "28px",
17
+ height: "28px",
18
+ top: "auto",
19
+ left: "auto",
20
+ opacity: "1",
21
+ borderRadius: "12.5%",
22
+ appearance: "none",
23
+ cursor: "pointer",
24
+ margin: "0",
25
+ borderStyle: "solid",
26
+ borderWidth: "1px"
27
+ };
28
+ const Checkbox = ({ themeColor, onChange, checked, labelText }) => {
29
+ const theme$1 = react$1.useMemo(() => themeColor === "light" ? theme.lightTheme : theme.darkTheme, [themeColor]);
30
+ const checkboxStyleBase = {
31
+ ...baseStyle,
32
+ border: `1px solid ${theme$1.palette.background.contrastText}`
33
+ };
34
+ const [hover, setHover] = react$1.useState(false);
35
+ const checkboxStyle = react$1.useMemo(() => {
36
+ return {
37
+ ...checkboxStyleBase,
38
+ borderColor: hover ? theme$1.palette.background.contrastText : theme$1.palette.grey[400],
39
+ appearance: checked ? "auto" : "none",
40
+ flex: 1,
41
+ margin: "0 15px"
42
+ };
43
+ }, [hover, theme$1, checked]);
44
+ const id = react$1.useId();
45
+ return jsxRuntime.jsxs("span", { style: { display: "inline-flex" }, children: [jsxRuntime.jsx("input", { name: id, onMouseEnter: () => setHover(true), onMouseLeave: () => setHover(false), css: checkboxBefore, type: "checkbox", "aria-live": "assertive", "aria-haspopup": "true", onChange, checked, style: checkboxStyle }), jsxRuntime.jsx("label", { css: {
46
+ color: theme$1.palette.background.contrastText,
47
+ position: "relative",
48
+ display: "flex",
49
+ cursor: "pointer",
50
+ userSelect: "none",
51
+ top: "4px"
52
+ }, htmlFor: id, children: labelText })] });
53
+ };
54
+ exports.Checkbox = Checkbox;
55
+ exports.default = Checkbox;
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const WidgetConstants = require("./WidgetConstants.cjs");
4
+ const styled = require("@emotion/styled");
5
+ const ContainerDiv = styled.div`
6
+ container-type: inline-size;
7
+ `;
8
+ const WidthBasedStylesDiv = styled.div`
9
+ max-width: 100%;
10
+ max-height: 100%;
11
+ overflow: hidden;
12
+ height: ${WidgetConstants.WIDGET_OUTER_HEIGHT}px;
13
+ @container (max-width: 243px) {
14
+ #logo-without-text {
15
+ display: none;
16
+ }
17
+
18
+ #logo-with-text {
19
+ display: none;
20
+ }
21
+ }
22
+ @container (min-width: 244px) and (max-width: 339px) {
23
+ #logo-without-text {
24
+ display: inherit;
25
+ }
26
+
27
+ #logo-with-text {
28
+ display: none;
29
+ }
30
+ }
31
+ @container (min-width: 340px) {
32
+ #logo-without-text {
33
+ display: none;
34
+ }
35
+
36
+ #logo-with-text {
37
+ display: inherit;
38
+ }
39
+ }
40
+ `;
41
+ exports.ContainerDiv = ContainerDiv;
42
+ exports.WidthBasedStylesDiv = WidthBasedStylesDiv;
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
3
+ const jsxRuntime = require("@emotion/react/jsx-runtime");
4
+ const theme = require("./theme.cjs");
5
+ const react = require("react");
6
+ const styled = require("@emotion/styled");
7
+ const LoadingSpinner = ({ themeColor }) => {
8
+ const theme$1 = react.useMemo(() => themeColor === "light" ? theme.lightTheme : theme.darkTheme, [themeColor]);
9
+ const StyledDiv = styled.div`
10
+ margin-top: 0;
11
+ margin-left: 15px;
12
+ margin-right: 15px;
13
+ width: 2em;
14
+ height: 2em;
15
+ border: 4px solid ${theme$1.palette.background.contrastText};
16
+ border-bottom-color: transparent;
17
+ border-radius: 50%;
18
+ display: inherit;
19
+ box-sizing: border-box;
20
+ animation: rotation 1s linear infinite;
21
+
22
+ @keyframes rotation {
23
+ 0% {
24
+ transform: rotate(0deg);
25
+ }
26
+ 100% {
27
+ transform: rotate(360deg);
28
+ }
29
+ }
30
+ `;
31
+ return jsxRuntime.jsx(StyledDiv, {});
32
+ };
33
+ exports.LoadingSpinner = LoadingSpinner;
34
+ exports.default = LoadingSpinner;
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ const jsxRuntime = require("@emotion/react/jsx-runtime");
3
+ const LogoWithText = require("./LogoWithText.cjs");
4
+ const LogoWithoutText = require("./LogoWithoutText.cjs");
5
+ const styled = require("@emotion/styled");
6
+ const LogoContainer = styled.div`
7
+ padding: 8px;
8
+ flex: 1 1 0;
9
+ `;
10
+ const LogoInnerContainer = styled.div`
11
+ padding: 8px;
12
+ `;
13
+ const Logo = ({ themeColor }) => {
14
+ return jsxRuntime.jsx(LogoContainer, { children: jsxRuntime.jsxs(LogoInnerContainer, { children: [jsxRuntime.jsx(LogoWithoutText.LogoWithoutText, { themeColor }), jsxRuntime.jsx(LogoWithText.LogoWithText, { themeColor })] }) });
15
+ };
16
+ module.exports = Logo;
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
3
+ const jsxRuntime = require("@emotion/react/jsx-runtime");
4
+ const react = require("react");
5
+ const LogoWithText = ({ themeColor }) => {
6
+ const fill = react.useMemo(() => themeColor === "light" ? "#1d1d1b" : "#fff", [themeColor]);
7
+ return jsxRuntime.jsxs("svg", { className: "logo", id: "logo-with-text", xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 2062.63 468.67", height: "35px", width: "140px", style: { fill }, children: [jsxRuntime.jsx("title", { children: "Prosopo Logo With Text" }), jsxRuntime.jsx("path", { d: "M335.55,1825.19A147.75,147.75,0,0,1,483.3,1972.94h50.5c0-109.49-88.76-198.25-198.25-198.25v50.5Z", transform: "translate(-215.73 -1774.69)" }), jsxRuntime.jsx("path", { d: "M269.36,1891.39A147.74,147.74,0,0,1,417.1,2039.13h50.5c0-109.49-88.75-198.24-198.24-198.24v50.5Z", transform: "translate(-215.73 -1774.69)" }), jsxRuntime.jsx("path", { d: "M414,2157.17a147.75,147.75,0,0,1-147.74-147.74h-50.5c0,109.49,88.75,198.24,198.24,198.24v-50.5Z", transform: "translate(-215.73 -1774.69)" }), jsxRuntime.jsx("path", { d: "M480.17,2091a147.74,147.74,0,0,1-147.74-147.75H281.92c0,109.49,88.76,198.25,198.25,198.25V2091Z", transform: "translate(-215.73 -1774.69)" }), jsxRuntime.jsx("path", { d: "M862.8,2017.5q-27.39,22.86-78.25,22.86h-65v112.19H654.82v-312h134q46.32,0,73.86,24.13t27.55,74.72Q890.2,1994.64,862.8,2017.5ZM813,1905.1q-12.37-10.36-34.7-10.38H719.59v91.87h58.75q22.32,0,34.7-11.22t12.39-35.56Q825.43,1915.48,813,1905.1Z", transform: "translate(-215.73 -1774.69)" }), jsxRuntime.jsx("path", { d: "M1045.69,1916.42c.78.08,2.51.19,5.19.32v61.81c-3.81-.42-7.2-.71-10.16-.85s-5.36-.21-7.2-.21q-36.4,0-48.89,23.71-7,13.33-7,41.06v110.29H916.89V1921.82h57.58V1962q14-23.07,24.34-31.54,16.94-14.18,44-14.18C1044,1916.32,1044.92,1916.35,1045.69,1916.42Z", transform: "translate(-215.73 -1774.69)" }), jsxRuntime.jsx("path", { d: "M1265.64,2124.32q-29.21,36.06-88.69,36.06t-88.69-36.06Q1059,2088.26,1059,2037.5q0-49.9,29.22-86.5t88.69-36.59q59.47,0,88.69,36.59t29.21,86.5Q1294.85,2088.26,1265.64,2124.32ZM1217.38,2091q14.17-18.81,14.18-53.48t-14.18-53.37q-14.19-18.7-40.64-18.71T1136,1984.13q-14.29,18.72-14.29,53.37T1136,2091q14.28,18.81,40.75,18.81T1217.38,2091Z", transform: "translate(-215.73 -1774.69)" }), jsxRuntime.jsx("path", { d: "M1371.81,2078.88q1.92,16.1,8.29,22.87,11.28,12.06,41.7,12.06,17.85,0,28.39-5.29t10.53-15.88a17.12,17.12,0,0,0-8.48-15.45q-8.49-5.28-63.12-18.2-39.33-9.73-55.41-24.35-16.08-14.39-16.09-41.49,0-32,25.14-54.93t70.75-23q43.26,0,70.53,17.25t31.29,59.59H1455q-1.27-11.64-6.58-18.42-10-12.27-34-12.28-19.74,0-28.13,6.14t-8.38,14.4c0,6.91,3,11.93,8.92,15q8.89,4.89,63,16.73,36,8.46,54.05,25.61,17.77,17.35,17.78,43.39,0,34.3-25.56,56t-79,21.7q-54.51,0-80.49-23t-26-58.53Z", transform: "translate(-215.73 -1774.69)" }), jsxRuntime.jsx("path", { d: "M1745.54,2124.32q-29.22,36.06-88.7,36.06t-88.69-36.06q-29.2-36.06-29.21-86.82,0-49.9,29.21-86.5t88.69-36.59q59.49,0,88.7,36.59t29.21,86.5Q1774.75,2088.26,1745.54,2124.32ZM1697.27,2091q14.19-18.81,14.19-53.48t-14.19-53.37q-14.18-18.7-40.64-18.71t-40.75,18.71q-14.28,18.72-14.28,53.37t14.28,53.48q14.3,18.81,40.75,18.81T1697.27,2091Z", transform: "translate(-215.73 -1774.69)" }), jsxRuntime.jsx("path", { d: "M1992.75,1946.59q28.24,29.84,28.23,87.63,0,61-27.58,92.93t-71.06,32q-27.69,0-46-13.76-10-7.62-19.6-22.23v120.24H1797V1921.82h57.79v34.08q9.79-15,20.88-23.71,20.23-15.43,48.15-15.45Q1964.53,1916.74,1992.75,1946.59Zm-46.3,43.39q-12.3-20.52-39.88-20.53-33.15,0-45.54,31.11-6.43,16.51-6.42,41.92,0,40.21,21.58,56.51,12.82,9.53,30.37,9.53,25.45,0,38.83-19.48t13.36-51.86Q1958.75,2010.51,1946.45,1990Z", transform: "translate(-215.73 -1774.69)" }), jsxRuntime.jsx("path", { d: "M2249.14,2124.32q-29.2,36.06-88.69,36.06t-88.69-36.06q-29.22-36.06-29.21-86.82,0-49.9,29.21-86.5t88.69-36.59q59.49,0,88.69,36.59t29.22,86.5Q2278.36,2088.26,2249.14,2124.32ZM2200.88,2091q14.19-18.81,14.18-53.48t-14.18-53.37q-14.18-18.7-40.64-18.71t-40.75,18.71q-14.28,18.72-14.29,53.37t14.29,53.48q14.3,18.81,40.75,18.81T2200.88,2091Z", transform: "translate(-215.73 -1774.69)" })] });
8
+ };
9
+ exports.LogoWithText = LogoWithText;
10
+ exports.default = LogoWithText;
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
3
+ const jsxRuntime = require("@emotion/react/jsx-runtime");
4
+ const react = require("react");
5
+ const LogoWithoutText = ({ themeColor }) => {
6
+ const fill = react.useMemo(() => themeColor === "light" ? "#1d1d1b" : "#fff", [themeColor]);
7
+ return jsxRuntime.jsxs("svg", { className: "logo", id: "logo-without-text", xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 260 348", height: "35px", style: { fill }, children: [jsxRuntime.jsx("title", { children: "Prosopo Logo Without Text" }), jsxRuntime.jsx("path", { d: "M95.7053 40.2707C127.005 40.2707 157.022 52.6841 179.154 74.78C201.286 96.8759 213.719 126.844 213.719 158.093H254.056C254.056 70.7808 183.16 -4.57764e-05 95.7053 -4.57764e-05V40.2707Z" }), jsxRuntime.jsx("path", { d: "M42.8365 93.0614C58.3333 93.0614 73.6784 96.1087 87.9955 102.029C102.313 107.95 115.322 116.628 126.279 127.568C137.237 138.508 145.93 151.496 151.86 165.79C157.79 180.084 160.843 195.404 160.843 210.875H201.179C201.179 123.564 130.291 52.7906 42.8365 52.7906V93.0614Z" }), jsxRuntime.jsx("path", { d: "M158.367 305.005C127.07 305.003 97.056 292.59 74.926 270.496C52.796 248.402 40.3626 218.437 40.3604 187.191H0.0239563C0.0239563 274.503 70.9123 345.276 158.367 345.276V305.005Z" }), jsxRuntime.jsx("path", { d: "M211.219 252.239C195.722 252.239 180.376 249.191 166.059 243.27C151.741 237.349 138.732 228.67 127.774 217.729C116.816 206.788 108.123 193.799 102.194 179.505C96.2637 165.21 93.2121 149.889 93.2132 134.417H52.8687C52.8687 221.729 123.765 292.509 211.219 292.509V252.239Z" })] });
8
+ };
9
+ exports.LogoWithoutText = LogoWithoutText;
10
+ exports.default = LogoWithoutText;
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const WIDGET_URL = "https://prosopo.io/?ref=accounts.prosopo.io&utm_campaign=widget&utm_medium=checkbox#features";
4
+ const WIDGET_URL_TEXT = "Visit prosopo.io to learn more about the service and its accessibility options.";
5
+ const WIDGET_INNER_HEIGHT = 74;
6
+ const WIDGET_OUTER_HEIGHT = 80;
7
+ const WIDGET_DIMENSIONS = { maxWidth: "400px", minWidth: "200px", minHeight: `${WIDGET_OUTER_HEIGHT}px` };
8
+ exports.WIDGET_DIMENSIONS = WIDGET_DIMENSIONS;
9
+ exports.WIDGET_INNER_HEIGHT = WIDGET_INNER_HEIGHT;
10
+ exports.WIDGET_OUTER_HEIGHT = WIDGET_OUTER_HEIGHT;
11
+ exports.WIDGET_URL = WIDGET_URL;
12
+ exports.WIDGET_URL_TEXT = WIDGET_URL_TEXT;
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const CaptchaPlaceholder = require("./CaptchaPlaceholder.cjs");
4
+ const LoadingSpinner = require("./LoadingSpinner.cjs");
5
+ const theme = require("./theme.cjs");
6
+ const Checkbox = require("./Checkbox.cjs");
7
+ const Logo = require("./Logo.cjs");
8
+ const Containers = require("./Containers.cjs");
9
+ const WidgetConstants = require("./WidgetConstants.cjs");
10
+ exports.ProcaptchaPlaceholder = CaptchaPlaceholder.ProcaptchaPlaceholder;
11
+ exports.LoadingSpinner = LoadingSpinner.LoadingSpinner;
12
+ exports.darkTheme = theme.darkTheme;
13
+ exports.lightTheme = theme.lightTheme;
14
+ exports.Checkbox = Checkbox.Checkbox;
15
+ exports.Logo = Logo;
16
+ exports.ContainerDiv = Containers.ContainerDiv;
17
+ exports.WidthBasedStylesDiv = Containers.WidthBasedStylesDiv;
18
+ exports.WIDGET_DIMENSIONS = WidgetConstants.WIDGET_DIMENSIONS;
19
+ exports.WIDGET_INNER_HEIGHT = WidgetConstants.WIDGET_INNER_HEIGHT;
20
+ exports.WIDGET_OUTER_HEIGHT = WidgetConstants.WIDGET_OUTER_HEIGHT;
21
+ exports.WIDGET_URL = WidgetConstants.WIDGET_URL;
22
+ exports.WIDGET_URL_TEXT = WidgetConstants.WIDGET_URL_TEXT;
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const grey = {
4
+ 0: "#fff",
5
+ 100: "#f5f5f5",
6
+ 200: "#eeeeee",
7
+ 300: "#e0e0e0",
8
+ 400: "#bdbdbd",
9
+ 500: "#9e9e9e",
10
+ 600: "#757575",
11
+ 700: "#616161",
12
+ 800: "#424242",
13
+ 900: "#212121"
14
+ };
15
+ const lightTheme = {
16
+ palette: {
17
+ mode: "light",
18
+ primary: {
19
+ main: "#487DFA",
20
+ contrastText: "#fff"
21
+ },
22
+ background: {
23
+ default: "#fff",
24
+ contrastText: "#000"
25
+ },
26
+ grey
27
+ }
28
+ };
29
+ const darkTheme = {
30
+ palette: {
31
+ mode: "dark",
32
+ primary: {
33
+ main: "#487DFA",
34
+ contrastText: "#fff"
35
+ },
36
+ background: {
37
+ default: "#303030",
38
+ contrastText: "#fff"
39
+ },
40
+ grey
41
+ }
42
+ };
43
+ exports.darkTheme = darkTheme;
44
+ exports.lightTheme = lightTheme;
@@ -0,0 +1,2 @@
1
+ export * from './ProcaptchaFrictionless.js';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAaA,cAAc,6BAA6B,CAAA"}
package/dist/index.js ADDED
@@ -0,0 +1,2 @@
1
+ export * from './ProcaptchaFrictionless.js';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAaA,cAAc,6BAA6B,CAAA"}
package/package.json ADDED
@@ -0,0 +1,58 @@
1
+ {
2
+ "name": "@prosopo/procaptcha-frictionless",
3
+ "version": "0.3.2",
4
+ "author": "PROSOPO LIMITED <info@prosopo.io>",
5
+ "license": "Apache-2.0",
6
+ "main": "./dist/index.js",
7
+ "type": "module",
8
+ "sideEffects": false,
9
+ "engines": {
10
+ "node": ">=18",
11
+ "npm": ">=9"
12
+ },
13
+ "exports": {
14
+ ".": {
15
+ "import": "./dist/index.js",
16
+ "require": "./dist/cjs/index.cjs"
17
+ }
18
+ },
19
+ "types": "./dist/index.d.ts",
20
+ "source": "./src/index.ts",
21
+ "scripts": {
22
+ "clean": "tsc --build --clean",
23
+ "build": "tsc --build --verbose tsconfig.json",
24
+ "build:cjs": "npx vite --config vite.cjs.config.ts build",
25
+ "eslint": "npx eslint . --no-error-on-unmatched-pattern --ignore-path ../../.eslintignore",
26
+ "eslint:fix": "npm run eslint -- --fix",
27
+ "prettier": "npx prettier . --check --no-error-on-unmatched-pattern --ignore-path ../../.eslintignore",
28
+ "prettier:fix": "npm run prettier -- --write",
29
+ "lint": "npm run eslint && npm run prettier",
30
+ "lint:fix": "npm run eslint:fix && npm run prettier:fix"
31
+ },
32
+ "browserslist": [
33
+ "> 0.5%, last 2 versions, not dead"
34
+ ],
35
+ "dependencies": {
36
+ "@fingerprintjs/botd": "^1.9.0",
37
+ "@prosopo/procaptcha-pow": "0.3.2",
38
+ "@prosopo/procaptcha-react": "0.3.2",
39
+ "@prosopo/web-components": "0.3.2",
40
+ "react": "^18.2.0"
41
+ },
42
+ "devDependencies": {
43
+ "tslib": "2.6.2",
44
+ "typescript": "5.1.6"
45
+ },
46
+ "repository": {
47
+ "type": "git",
48
+ "url": "git+https://github.com/prosopo/captcha.git"
49
+ },
50
+ "bugs": {
51
+ "url": "https://github.com/prosopo/captcha/issues"
52
+ },
53
+ "homepage": "https://github.com/prosopo/captcha#readme",
54
+ "description": "",
55
+ "publishConfig": {
56
+ "registry": "https://registry.npmjs.org"
57
+ }
58
+ }
@@ -0,0 +1,19 @@
1
+ // Copyright 2021-2024 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
+ import { ViteCommonJSConfig } from '@prosopo/config'
15
+ import path from 'path'
16
+
17
+ export default function () {
18
+ return ViteCommonJSConfig('procaptcha-frictionless', path.resolve('./tsconfig.cjs.json'))
19
+ }