@prosopo/procaptcha 1.0.2 → 2.0.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/dist/cjs/account/dist/extension/ExtensionWeb2.cjs +21 -28
- package/dist/cjs/account/dist/extension/ExtensionWeb3.cjs +5 -3
- package/dist/cjs/detector/src/index.cjs +4586 -0
- package/dist/cjs/modules/Manager.cjs +83 -168
- package/dist/cjs/modules/ProsopoCaptchaApi.cjs +34 -49
- package/dist/cjs/modules/collector.cjs +32 -8
- package/dist/cjs/modules/storage.cjs +8 -3
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/modules/Manager.d.ts +1 -2
- package/dist/modules/Manager.d.ts.map +1 -1
- package/dist/modules/Manager.js +92 -168
- package/dist/modules/Manager.js.map +1 -1
- package/dist/modules/ProsopoCaptchaApi.d.ts +7 -10
- package/dist/modules/ProsopoCaptchaApi.d.ts.map +1 -1
- package/dist/modules/ProsopoCaptchaApi.js +28 -48
- package/dist/modules/ProsopoCaptchaApi.js.map +1 -1
- package/dist/modules/collector.d.ts +1 -1
- package/dist/modules/collector.d.ts.map +1 -1
- package/dist/modules/collector.js +8 -8
- package/dist/modules/collector.js.map +1 -1
- package/dist/modules/index.d.ts +3 -3
- package/dist/modules/index.d.ts.map +1 -1
- package/dist/modules/index.js +3 -3
- package/dist/modules/index.js.map +1 -1
- package/dist/modules/storage.d.ts +1 -1
- package/dist/modules/storage.d.ts.map +1 -1
- package/dist/modules/storage.js +5 -5
- package/dist/modules/storage.js.map +1 -1
- package/dist/tests/modules/storage.test.js +15 -11
- package/dist/tests/modules/storage.test.js.map +1 -1
- package/dist/utils/index.d.ts +1 -1
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +1 -1
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/utils.d.ts.map +1 -1
- package/dist/utils/utils.js.map +1 -1
- package/package.json +77 -85
- package/vite.cjs.config.ts +3 -3
- package/vite.test.config.ts +15 -15
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ProsopoKeyboardEvent, ProsopoMouseEvent, ProsopoTouchEvent } from
|
|
1
|
+
import type { ProsopoKeyboardEvent, ProsopoMouseEvent, ProsopoTouchEvent } from "@prosopo/types";
|
|
2
2
|
type SetStateAction<T> = T | ((prevState: T) => T);
|
|
3
3
|
type SetMouseEvent = (setValueFunc: SetStateAction<ProsopoMouseEvent[]>) => void;
|
|
4
4
|
type SetKeyboardEvent = (setValueFunc: SetStateAction<ProsopoKeyboardEvent[]>) => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"collector.d.ts","sourceRoot":"","sources":["../../src/modules/collector.ts"],"names":[],"mappings":"AAaA,OAAO,
|
|
1
|
+
{"version":3,"file":"collector.d.ts","sourceRoot":"","sources":["../../src/modules/collector.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EACX,oBAAoB,EACpB,iBAAiB,EACjB,iBAAiB,EACjB,MAAM,gBAAgB,CAAC;AAIxB,KAAK,cAAc,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,SAAS,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;AAEnD,KAAK,aAAa,GAAG,CACpB,YAAY,EAAE,cAAc,CAAC,iBAAiB,EAAE,CAAC,KAC7C,IAAI,CAAC;AACV,KAAK,gBAAgB,GAAG,CACvB,YAAY,EAAE,cAAc,CAAC,oBAAoB,EAAE,CAAC,KAChD,IAAI,CAAC;AACV,KAAK,aAAa,GAAG,CACpB,YAAY,EAAE,cAAc,CAAC,iBAAiB,EAAE,CAAC,KAC7C,IAAI,CAAC;AAiDV,eAAO,MAAM,cAAc,yBACJ,aAAa,wBACb,aAAa,2BACV,gBAAgB,eAC5B,cAAc,SA+B3B,CAAC"}
|
|
@@ -33,17 +33,17 @@ const logTouchEvent = (event, setTouchEvent) => {
|
|
|
33
33
|
export const startCollector = (setStoredMouseEvents, setStoredTouchEvents, setStoredKeyboardEvents, rootElement) => {
|
|
34
34
|
const form = findContainingForm(rootElement);
|
|
35
35
|
if (form) {
|
|
36
|
-
form.addEventListener(
|
|
37
|
-
form.addEventListener(
|
|
38
|
-
form.addEventListener(
|
|
39
|
-
form.addEventListener(
|
|
40
|
-
form.addEventListener(
|
|
41
|
-
form.addEventListener(
|
|
42
|
-
form.addEventListener(
|
|
36
|
+
form.addEventListener("mousemove", (e) => logMouseEvent(e, setStoredMouseEvents));
|
|
37
|
+
form.addEventListener("keydown", (e) => logKeyboardEvent(e, setStoredKeyboardEvents));
|
|
38
|
+
form.addEventListener("keyup", (e) => logKeyboardEvent(e, setStoredKeyboardEvents));
|
|
39
|
+
form.addEventListener("touchstart", (e) => logTouchEvent(e, setStoredTouchEvents));
|
|
40
|
+
form.addEventListener("touchend", (e) => logTouchEvent(e, setStoredTouchEvents));
|
|
41
|
+
form.addEventListener("touchcancel", (e) => logTouchEvent(e, setStoredTouchEvents));
|
|
42
|
+
form.addEventListener("touchmove", (e) => logTouchEvent(e, setStoredTouchEvents));
|
|
43
43
|
}
|
|
44
44
|
};
|
|
45
45
|
const findContainingForm = (element) => {
|
|
46
|
-
if (element.tagName ===
|
|
46
|
+
if (element.tagName === "FORM") {
|
|
47
47
|
return element;
|
|
48
48
|
}
|
|
49
49
|
if (element.parentElement) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"collector.js","sourceRoot":"","sources":["../../src/modules/collector.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"collector.js","sourceRoot":"","sources":["../../src/modules/collector.ts"],"names":[],"mappings":"AAmBA,MAAM,eAAe,GAAG,KAAK,CAAC;AAc9B,MAAM,QAAQ,GAAG,CAAI,KAAQ,EAAE,SAA2B,EAAE,EAAE;IAC7D,SAAS,CAAC,CAAC,aAAa,EAAE,EAAE;QAC3B,IAAI,SAAS,GAAG,CAAC,GAAG,aAAa,EAAE,KAAK,CAA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AAC"}
|
package/dist/modules/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export * from
|
|
2
|
-
export * from
|
|
3
|
-
export * from
|
|
1
|
+
export * from "./Manager.js";
|
|
2
|
+
export * from "./ProsopoCaptchaApi.js";
|
|
3
|
+
export * from "./collector.js";
|
|
4
4
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/modules/index.ts"],"names":[],"mappings":"AAaA,cAAc,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/modules/index.ts"],"names":[],"mappings":"AAaA,cAAc,cAAc,CAAC;AAC7B,cAAc,wBAAwB,CAAC;AACvC,cAAc,gBAAgB,CAAC"}
|
package/dist/modules/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export * from
|
|
2
|
-
export * from
|
|
3
|
-
export * from
|
|
1
|
+
export * from "./Manager.js";
|
|
2
|
+
export * from "./ProsopoCaptchaApi.js";
|
|
3
|
+
export * from "./collector.js";
|
|
4
4
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/modules/index.ts"],"names":[],"mappings":"AAaA,cAAc,cAAc,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/modules/index.ts"],"names":[],"mappings":"AAaA,cAAc,cAAc,CAAC;AAC7B,cAAc,wBAAwB,CAAC;AACvC,cAAc,gBAAgB,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ProcaptchaLocalStorage } from
|
|
1
|
+
import { type ProcaptchaLocalStorage } from "@prosopo/types";
|
|
2
2
|
declare function getProcaptchaStorage(): ProcaptchaLocalStorage;
|
|
3
3
|
declare function setProcaptchaStorage(storage: ProcaptchaLocalStorage): void;
|
|
4
4
|
declare function setAccount(account: string): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"storage.d.ts","sourceRoot":"","sources":["../../src/modules/storage.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"storage.d.ts","sourceRoot":"","sources":["../../src/modules/storage.ts"],"names":[],"mappings":"AAeA,OAAO,EACN,KAAK,sBAAsB,EAE3B,MAAM,gBAAgB,CAAC;AAOxB,iBAAS,oBAAoB,IAAI,sBAAsB,CAMtD;AAMD,iBAAS,oBAAoB,CAAC,OAAO,EAAE,sBAAsB,QAK5D;AAKD,iBAAS,UAAU,CAAC,OAAO,EAAE,MAAM,QAElC;AAKD,iBAAS,UAAU,IAAI,MAAM,GAAG,IAAI,CAEnC;;;;;;;AAED,wBAKE"}
|
package/dist/modules/storage.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
const PROCAPTCHA_STORAGE_KEY =
|
|
1
|
+
import { hexToString } from "@polkadot/util";
|
|
2
|
+
import { stringToHex } from "@polkadot/util/string";
|
|
3
|
+
import { ProsopoLocalStorageSchema, } from "@prosopo/types";
|
|
4
|
+
const PROCAPTCHA_STORAGE_KEY = "@prosopo/procaptcha";
|
|
5
5
|
function getProcaptchaStorage() {
|
|
6
|
-
return ProsopoLocalStorageSchema.parse(JSON.parse(hexToString(localStorage.getItem(PROCAPTCHA_STORAGE_KEY) ||
|
|
6
|
+
return ProsopoLocalStorageSchema.parse(JSON.parse(hexToString(localStorage.getItem(PROCAPTCHA_STORAGE_KEY) || "0x7b7d")));
|
|
7
7
|
}
|
|
8
8
|
function setProcaptchaStorage(storage) {
|
|
9
9
|
localStorage.setItem(PROCAPTCHA_STORAGE_KEY, stringToHex(JSON.stringify(ProsopoLocalStorageSchema.parse(storage))));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"storage.js","sourceRoot":"","sources":["../../src/modules/storage.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"storage.js","sourceRoot":"","sources":["../../src/modules/storage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAcpD,OAAO,EAEN,yBAAyB,GACzB,MAAM,gBAAgB,CAAC;AAExB,MAAM,sBAAsB,GAAG,qBAAqB,CAAC;AAKrD,SAAS,oBAAoB;IAC5B,OAAO,yBAAyB,CAAC,KAAK,CACrC,IAAI,CAAC,KAAK,CACT,WAAW,CAAC,YAAY,CAAC,OAAO,CAAC,sBAAsB,CAAC,IAAI,QAAQ,CAAC,CACrE,CACD,CAAC;AACH,CAAC;AAMD,SAAS,oBAAoB,CAAC,OAA+B;IAC5D,YAAY,CAAC,OAAO,CACnB,sBAAsB,EACtB,WAAW,CAAC,IAAI,CAAC,SAAS,CAAC,yBAAyB,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CACrE,CAAC;AACH,CAAC;AAKD,SAAS,UAAU,CAAC,OAAe;IAClC,oBAAoB,CAAC,EAAE,GAAG,oBAAoB,EAAE,EAAE,OAAO,EAAE,CAAC,CAAC;AAC9D,CAAC;AAKD,SAAS,UAAU;IAClB,OAAO,oBAAoB,EAAE,CAAC,OAAO,IAAI,IAAI,CAAC;AAC/C,CAAC;AAED,eAAe;IACd,UAAU;IACV,UAAU;IACV,oBAAoB;IACpB,oBAAoB;CACpB,CAAC"}
|
|
@@ -1,18 +1,22 @@
|
|
|
1
|
-
import { describe, expect, test } from
|
|
2
|
-
import storage from
|
|
1
|
+
import { describe, expect, test } from "vitest";
|
|
2
|
+
import storage from "../../modules/storage.js";
|
|
3
3
|
const { setAccount, getAccount, getProcaptchaStorage, setProcaptchaStorage } = storage;
|
|
4
|
-
describe(
|
|
5
|
-
test(
|
|
6
|
-
setAccount(
|
|
7
|
-
expect(getAccount()).to.equal(
|
|
4
|
+
describe("storage tests", () => {
|
|
5
|
+
test("sets and gets account", async () => {
|
|
6
|
+
setAccount("abc");
|
|
7
|
+
expect(getAccount()).to.equal("abc");
|
|
8
8
|
});
|
|
9
|
-
test(
|
|
10
|
-
setAccount(
|
|
9
|
+
test("sets provider URL and block number", async () => {
|
|
10
|
+
setAccount("abc");
|
|
11
11
|
const procaptchaStorage = getProcaptchaStorage();
|
|
12
|
-
setProcaptchaStorage({
|
|
12
|
+
setProcaptchaStorage({
|
|
13
|
+
...procaptchaStorage,
|
|
14
|
+
providerUrl: "http://localhost:9229",
|
|
15
|
+
blockNumber: 100,
|
|
16
|
+
});
|
|
13
17
|
expect(getProcaptchaStorage()).toMatchObject({
|
|
14
|
-
account:
|
|
15
|
-
providerUrl:
|
|
18
|
+
account: "abc",
|
|
19
|
+
providerUrl: "http://localhost:9229",
|
|
16
20
|
blockNumber: 100,
|
|
17
21
|
});
|
|
18
22
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"storage.test.js","sourceRoot":"","sources":["../../../src/tests/modules/storage.test.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,QAAQ,
|
|
1
|
+
{"version":3,"file":"storage.test.js","sourceRoot":"","sources":["../../../src/tests/modules/storage.test.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAChD,OAAO,OAAO,MAAM,0BAA0B,CAAC;AAE/C,MAAM,EAAE,UAAU,EAAE,UAAU,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,GAC3E,OAAO,CAAC;AAET,QAAQ,CAAC,eAAe,EAAE,GAAG,EAAE;IAC9B,IAAI,CAAC,uBAAuB,EAAE,KAAK,IAAI,EAAE;QACxC,UAAU,CAAC,KAAK,CAAC,CAAC;QAClB,MAAM,CAAC,UAAU,EAAE,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IACtC,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC,oCAAoC,EAAE,KAAK,IAAI,EAAE;QACrD,UAAU,CAAC,KAAK,CAAC,CAAC;QAClB,MAAM,iBAAiB,GAAG,oBAAoB,EAAE,CAAC;QACjD,oBAAoB,CAAC;YACpB,GAAG,iBAAiB;YACpB,WAAW,EAAE,uBAAuB;YACpC,WAAW,EAAE,GAAG;SAChB,CAAC,CAAC;QACH,MAAM,CAAC,oBAAoB,EAAE,CAAC,CAAC,aAAa,CAAC;YAC5C,OAAO,EAAE,KAAK;YACd,WAAW,EAAE,uBAAuB;YACpC,WAAW,EAAE,GAAG;SAChB,CAAC,CAAC;IACJ,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC"}
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from
|
|
1
|
+
export * from "./utils.js";
|
|
2
2
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAaA,cAAc,YAAY,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAaA,cAAc,YAAY,CAAC"}
|
package/dist/utils/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from
|
|
1
|
+
export * from "./utils.js";
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/dist/utils/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAaA,cAAc,YAAY,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAaA,cAAc,YAAY,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/utils/utils.ts"],"names":[],"mappings":"AAaA,eAAO,MAAM,KAAK,OAAQ,MAAM,qBAE/B,
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/utils/utils.ts"],"names":[],"mappings":"AAaA,eAAO,MAAM,KAAK,OAAQ,MAAM,qBAE/B,CAAC"}
|
package/dist/utils/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/utils/utils.ts"],"names":[],"mappings":"AAaA,MAAM,CAAC,MAAM,KAAK,GAAG,CAAC,EAAU,EAAE,EAAE;
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/utils/utils.ts"],"names":[],"mappings":"AAaA,MAAM,CAAC,MAAM,KAAK,GAAG,CAAC,EAAU,EAAE,EAAE;IACnC,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC;AAC1D,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,87 +1,79 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
"url": "https://github.com/prosopo/captcha/issues"
|
|
80
|
-
},
|
|
81
|
-
"homepage": "https://github.com/prosopo/captcha#readme",
|
|
82
|
-
"description": "",
|
|
83
|
-
"publishConfig": {
|
|
84
|
-
"registry": "https://registry.npmjs.org"
|
|
85
|
-
},
|
|
86
|
-
"sideEffects": false
|
|
2
|
+
"name": "@prosopo/procaptcha",
|
|
3
|
+
"version": "2.0.1",
|
|
4
|
+
"author": "PROSOPO LIMITED <info@prosopo.io>",
|
|
5
|
+
"license": "Apache-2.0",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"type": "module",
|
|
8
|
+
"types": "./dist/index.d.ts",
|
|
9
|
+
"engines": {
|
|
10
|
+
"node": ">=20",
|
|
11
|
+
"npm": ">=9"
|
|
12
|
+
},
|
|
13
|
+
"scripts": {
|
|
14
|
+
"clean": "tsc --build --clean",
|
|
15
|
+
"build": "tsc --build --verbose",
|
|
16
|
+
"build:cjs": "npx vite --config vite.cjs.config.ts build",
|
|
17
|
+
"test": "NODE_ENV=${NODE_ENV:-test}; vitest --run --config vite.test.config.ts"
|
|
18
|
+
},
|
|
19
|
+
"exports": {
|
|
20
|
+
".": {
|
|
21
|
+
"import": "./dist/index.js",
|
|
22
|
+
"require": "./dist/cjs/index.cjs"
|
|
23
|
+
},
|
|
24
|
+
"./modules/Manager": {
|
|
25
|
+
"types": "./dist/modules/Manager.d.ts",
|
|
26
|
+
"import": "./dist/modules/Manager.js",
|
|
27
|
+
"require": "./dist/cjs/modules/Manager.cjs",
|
|
28
|
+
"default": "./dist/modules/Manager.js"
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
"dependencies": {
|
|
32
|
+
"@polkadot/api": "10.13.1",
|
|
33
|
+
"@polkadot/api-contract": "10.13.1",
|
|
34
|
+
"@polkadot/util": "12.6.2",
|
|
35
|
+
"@polkadot/util-crypto": "12.6.2",
|
|
36
|
+
"@prosopo/account": "2.0.1",
|
|
37
|
+
"@prosopo/api": "2.0.1",
|
|
38
|
+
"@prosopo/common": "2.0.1",
|
|
39
|
+
"@prosopo/datasets": "2.0.1",
|
|
40
|
+
"@prosopo/load-balancer": "2.0.1",
|
|
41
|
+
"@prosopo/procaptcha-common": "2.0.1",
|
|
42
|
+
"@prosopo/types": "2.0.1",
|
|
43
|
+
"@prosopo/util": "2.0.1",
|
|
44
|
+
"jsdom": "^24.1.0"
|
|
45
|
+
},
|
|
46
|
+
"overrides": {
|
|
47
|
+
"@polkadot/extension-inject": {
|
|
48
|
+
"@polkadot/api": {
|
|
49
|
+
"version": "10.13.1"
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
"@polkadot/extension-dapp": {
|
|
53
|
+
"@polkadot/api": {
|
|
54
|
+
"version": "10.13.1"
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
"devDependencies": {
|
|
59
|
+
"@prosopo/config": "2.0.1",
|
|
60
|
+
"dotenv": "^16.0.1",
|
|
61
|
+
"tslib": "2.6.2",
|
|
62
|
+
"typescript": "5.1.6",
|
|
63
|
+
"vitest": "^1.3.1"
|
|
64
|
+
},
|
|
65
|
+
"keywords": [],
|
|
66
|
+
"repository": {
|
|
67
|
+
"type": "git",
|
|
68
|
+
"url": "git+https://github.com/prosopo/captcha.git"
|
|
69
|
+
},
|
|
70
|
+
"bugs": {
|
|
71
|
+
"url": "https://github.com/prosopo/captcha/issues"
|
|
72
|
+
},
|
|
73
|
+
"homepage": "https://github.com/prosopo/captcha#readme",
|
|
74
|
+
"description": "",
|
|
75
|
+
"publishConfig": {
|
|
76
|
+
"registry": "https://registry.npmjs.org"
|
|
77
|
+
},
|
|
78
|
+
"sideEffects": false
|
|
87
79
|
}
|
package/vite.cjs.config.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import path from "node:path";
|
|
1
2
|
// Copyright 2021-2024 Prosopo (UK) Ltd.
|
|
2
3
|
//
|
|
3
4
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
@@ -11,9 +12,8 @@
|
|
|
11
12
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
13
|
// See the License for the specific language governing permissions and
|
|
13
14
|
// limitations under the License.
|
|
14
|
-
import { ViteCommonJSConfig } from
|
|
15
|
-
import path from 'path'
|
|
15
|
+
import { ViteCommonJSConfig } from "@prosopo/config";
|
|
16
16
|
|
|
17
17
|
export default function () {
|
|
18
|
-
|
|
18
|
+
return ViteCommonJSConfig("procaptcha", path.resolve("./tsconfig.cjs.json"));
|
|
19
19
|
}
|
package/vite.test.config.ts
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import fs from "node:fs";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import dotenv from "dotenv";
|
|
1
4
|
// Copyright 2021-2024 Prosopo (UK) Ltd.
|
|
2
5
|
//
|
|
3
6
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
@@ -11,26 +14,23 @@
|
|
|
11
14
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
15
|
// See the License for the specific language governing permissions and
|
|
13
16
|
// limitations under the License.
|
|
14
|
-
import { defineConfig } from
|
|
15
|
-
|
|
16
|
-
import fs from 'fs'
|
|
17
|
-
import path from 'path'
|
|
18
|
-
process.env.NODE_ENV = 'test'
|
|
17
|
+
import { defineConfig } from "vitest/config";
|
|
18
|
+
process.env.NODE_ENV = "test";
|
|
19
19
|
// if .env.test exists at this level, use it, otherwise use the one at the root
|
|
20
|
-
const envFile = `.env.${process.env.NODE_ENV ||
|
|
21
|
-
let envPath = envFile
|
|
20
|
+
const envFile = `.env.${process.env.NODE_ENV || "development"}`;
|
|
21
|
+
let envPath = envFile;
|
|
22
22
|
if (fs.existsSync(envFile)) {
|
|
23
|
-
|
|
23
|
+
envPath = path.resolve(envFile);
|
|
24
24
|
} else if (fs.existsSync(`../../${envFile}`)) {
|
|
25
|
-
|
|
25
|
+
envPath = path.resolve(`../../${envFile}`);
|
|
26
26
|
} else {
|
|
27
|
-
|
|
27
|
+
throw new Error(`No ${envFile} file found`);
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
dotenv.config({ path: envPath })
|
|
30
|
+
dotenv.config({ path: envPath });
|
|
31
31
|
|
|
32
32
|
export default defineConfig({
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
})
|
|
33
|
+
test: {
|
|
34
|
+
environment: "jsdom",
|
|
35
|
+
},
|
|
36
|
+
});
|