@prosopo/procaptcha-frictionless 2.6.32 → 2.8.14
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/CHANGELOG.md +466 -0
- package/coverage/ProcaptchaFrictionless.tsx.html +742 -0
- package/coverage/base.css +224 -0
- package/coverage/block-navigation.js +87 -0
- package/coverage/clover.xml +258 -0
- package/coverage/coverage-final.json +5 -0
- package/coverage/customDetectBot.ts.html +400 -0
- package/coverage/detectorLoader.ts.html +139 -0
- package/coverage/favicon.png +0 -0
- package/coverage/index.html +161 -0
- package/coverage/index.ts.html +127 -0
- package/coverage/prettify.css +1 -0
- package/coverage/prettify.js +2 -0
- package/coverage/sort-arrow-sprite.png +0 -0
- package/coverage/sorter.js +210 -0
- package/dist/ProcaptchaFrictionless.d.ts +3 -0
- package/dist/ProcaptchaFrictionless.d.ts.map +1 -0
- package/dist/ProcaptchaFrictionless.js +4 -3
- package/dist/ProcaptchaFrictionless.js.map +1 -0
- package/dist/cjs/ProcaptchaFrictionless.cjs +4 -3
- package/dist/cjs/customDetectBot.cjs +46 -9
- package/dist/cjs/detectorLoader.cjs +23 -2
- package/dist/customDetectBot.d.ts +5 -0
- package/dist/customDetectBot.d.ts.map +1 -0
- package/dist/customDetectBot.js +46 -10
- package/dist/customDetectBot.js.map +1 -0
- package/dist/detectorLoader.d.ts +4 -0
- package/dist/detectorLoader.d.ts.map +1 -0
- package/dist/detectorLoader.js +1 -1
- package/dist/detectorLoader.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js.map +1 -0
- package/dist/tests/customDetectBot.test.d.ts +2 -0
- package/dist/tests/customDetectBot.test.d.ts.map +1 -0
- package/dist/tests/customDetectBot.test.js +45 -0
- package/dist/tests/customDetectBot.test.js.map +1 -0
- package/package.json +22 -21
- package/vite.test.config.ts +38 -0
- package/dist/cjs/detector/dist/index.cjs +0 -2334
- package/dist/detector/dist/index.js +0 -2335
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
var addSorting = (function() {
|
|
3
|
+
'use strict';
|
|
4
|
+
var cols,
|
|
5
|
+
currentSort = {
|
|
6
|
+
index: 0,
|
|
7
|
+
desc: false
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
// returns the summary table element
|
|
11
|
+
function getTable() {
|
|
12
|
+
return document.querySelector('.coverage-summary');
|
|
13
|
+
}
|
|
14
|
+
// returns the thead element of the summary table
|
|
15
|
+
function getTableHeader() {
|
|
16
|
+
return getTable().querySelector('thead tr');
|
|
17
|
+
}
|
|
18
|
+
// returns the tbody element of the summary table
|
|
19
|
+
function getTableBody() {
|
|
20
|
+
return getTable().querySelector('tbody');
|
|
21
|
+
}
|
|
22
|
+
// returns the th element for nth column
|
|
23
|
+
function getNthColumn(n) {
|
|
24
|
+
return getTableHeader().querySelectorAll('th')[n];
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function onFilterInput() {
|
|
28
|
+
const searchValue = document.getElementById('fileSearch').value;
|
|
29
|
+
const rows = document.getElementsByTagName('tbody')[0].children;
|
|
30
|
+
|
|
31
|
+
// Try to create a RegExp from the searchValue. If it fails (invalid regex),
|
|
32
|
+
// it will be treated as a plain text search
|
|
33
|
+
let searchRegex;
|
|
34
|
+
try {
|
|
35
|
+
searchRegex = new RegExp(searchValue, 'i'); // 'i' for case-insensitive
|
|
36
|
+
} catch (error) {
|
|
37
|
+
searchRegex = null;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
for (let i = 0; i < rows.length; i++) {
|
|
41
|
+
const row = rows[i];
|
|
42
|
+
let isMatch = false;
|
|
43
|
+
|
|
44
|
+
if (searchRegex) {
|
|
45
|
+
// If a valid regex was created, use it for matching
|
|
46
|
+
isMatch = searchRegex.test(row.textContent);
|
|
47
|
+
} else {
|
|
48
|
+
// Otherwise, fall back to the original plain text search
|
|
49
|
+
isMatch = row.textContent
|
|
50
|
+
.toLowerCase()
|
|
51
|
+
.includes(searchValue.toLowerCase());
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
row.style.display = isMatch ? '' : 'none';
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// loads the search box
|
|
59
|
+
function addSearchBox() {
|
|
60
|
+
var template = document.getElementById('filterTemplate');
|
|
61
|
+
var templateClone = template.content.cloneNode(true);
|
|
62
|
+
templateClone.getElementById('fileSearch').oninput = onFilterInput;
|
|
63
|
+
template.parentElement.appendChild(templateClone);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
// loads all columns
|
|
67
|
+
function loadColumns() {
|
|
68
|
+
var colNodes = getTableHeader().querySelectorAll('th'),
|
|
69
|
+
colNode,
|
|
70
|
+
cols = [],
|
|
71
|
+
col,
|
|
72
|
+
i;
|
|
73
|
+
|
|
74
|
+
for (i = 0; i < colNodes.length; i += 1) {
|
|
75
|
+
colNode = colNodes[i];
|
|
76
|
+
col = {
|
|
77
|
+
key: colNode.getAttribute('data-col'),
|
|
78
|
+
sortable: !colNode.getAttribute('data-nosort'),
|
|
79
|
+
type: colNode.getAttribute('data-type') || 'string'
|
|
80
|
+
};
|
|
81
|
+
cols.push(col);
|
|
82
|
+
if (col.sortable) {
|
|
83
|
+
col.defaultDescSort = col.type === 'number';
|
|
84
|
+
colNode.innerHTML =
|
|
85
|
+
colNode.innerHTML + '<span class="sorter"></span>';
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
return cols;
|
|
89
|
+
}
|
|
90
|
+
// attaches a data attribute to every tr element with an object
|
|
91
|
+
// of data values keyed by column name
|
|
92
|
+
function loadRowData(tableRow) {
|
|
93
|
+
var tableCols = tableRow.querySelectorAll('td'),
|
|
94
|
+
colNode,
|
|
95
|
+
col,
|
|
96
|
+
data = {},
|
|
97
|
+
i,
|
|
98
|
+
val;
|
|
99
|
+
for (i = 0; i < tableCols.length; i += 1) {
|
|
100
|
+
colNode = tableCols[i];
|
|
101
|
+
col = cols[i];
|
|
102
|
+
val = colNode.getAttribute('data-value');
|
|
103
|
+
if (col.type === 'number') {
|
|
104
|
+
val = Number(val);
|
|
105
|
+
}
|
|
106
|
+
data[col.key] = val;
|
|
107
|
+
}
|
|
108
|
+
return data;
|
|
109
|
+
}
|
|
110
|
+
// loads all row data
|
|
111
|
+
function loadData() {
|
|
112
|
+
var rows = getTableBody().querySelectorAll('tr'),
|
|
113
|
+
i;
|
|
114
|
+
|
|
115
|
+
for (i = 0; i < rows.length; i += 1) {
|
|
116
|
+
rows[i].data = loadRowData(rows[i]);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
// sorts the table using the data for the ith column
|
|
120
|
+
function sortByIndex(index, desc) {
|
|
121
|
+
var key = cols[index].key,
|
|
122
|
+
sorter = function(a, b) {
|
|
123
|
+
a = a.data[key];
|
|
124
|
+
b = b.data[key];
|
|
125
|
+
return a < b ? -1 : a > b ? 1 : 0;
|
|
126
|
+
},
|
|
127
|
+
finalSorter = sorter,
|
|
128
|
+
tableBody = document.querySelector('.coverage-summary tbody'),
|
|
129
|
+
rowNodes = tableBody.querySelectorAll('tr'),
|
|
130
|
+
rows = [],
|
|
131
|
+
i;
|
|
132
|
+
|
|
133
|
+
if (desc) {
|
|
134
|
+
finalSorter = function(a, b) {
|
|
135
|
+
return -1 * sorter(a, b);
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
for (i = 0; i < rowNodes.length; i += 1) {
|
|
140
|
+
rows.push(rowNodes[i]);
|
|
141
|
+
tableBody.removeChild(rowNodes[i]);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
rows.sort(finalSorter);
|
|
145
|
+
|
|
146
|
+
for (i = 0; i < rows.length; i += 1) {
|
|
147
|
+
tableBody.appendChild(rows[i]);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
// removes sort indicators for current column being sorted
|
|
151
|
+
function removeSortIndicators() {
|
|
152
|
+
var col = getNthColumn(currentSort.index),
|
|
153
|
+
cls = col.className;
|
|
154
|
+
|
|
155
|
+
cls = cls.replace(/ sorted$/, '').replace(/ sorted-desc$/, '');
|
|
156
|
+
col.className = cls;
|
|
157
|
+
}
|
|
158
|
+
// adds sort indicators for current column being sorted
|
|
159
|
+
function addSortIndicators() {
|
|
160
|
+
getNthColumn(currentSort.index).className += currentSort.desc
|
|
161
|
+
? ' sorted-desc'
|
|
162
|
+
: ' sorted';
|
|
163
|
+
}
|
|
164
|
+
// adds event listeners for all sorter widgets
|
|
165
|
+
function enableUI() {
|
|
166
|
+
var i,
|
|
167
|
+
el,
|
|
168
|
+
ithSorter = function ithSorter(i) {
|
|
169
|
+
var col = cols[i];
|
|
170
|
+
|
|
171
|
+
return function() {
|
|
172
|
+
var desc = col.defaultDescSort;
|
|
173
|
+
|
|
174
|
+
if (currentSort.index === i) {
|
|
175
|
+
desc = !currentSort.desc;
|
|
176
|
+
}
|
|
177
|
+
sortByIndex(i, desc);
|
|
178
|
+
removeSortIndicators();
|
|
179
|
+
currentSort.index = i;
|
|
180
|
+
currentSort.desc = desc;
|
|
181
|
+
addSortIndicators();
|
|
182
|
+
};
|
|
183
|
+
};
|
|
184
|
+
for (i = 0; i < cols.length; i += 1) {
|
|
185
|
+
if (cols[i].sortable) {
|
|
186
|
+
// add the click event handler on the th so users
|
|
187
|
+
// dont have to click on those tiny arrows
|
|
188
|
+
el = getNthColumn(i).querySelector('.sorter').parentElement;
|
|
189
|
+
if (el.addEventListener) {
|
|
190
|
+
el.addEventListener('click', ithSorter(i));
|
|
191
|
+
} else {
|
|
192
|
+
el.attachEvent('onclick', ithSorter(i));
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
// adds sorting functionality to the UI
|
|
198
|
+
return function() {
|
|
199
|
+
if (!getTable()) {
|
|
200
|
+
return;
|
|
201
|
+
}
|
|
202
|
+
cols = loadColumns();
|
|
203
|
+
loadData();
|
|
204
|
+
addSearchBox();
|
|
205
|
+
addSortIndicators();
|
|
206
|
+
enableUI();
|
|
207
|
+
};
|
|
208
|
+
})();
|
|
209
|
+
|
|
210
|
+
window.addEventListener('load', addSorting);
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { type ProcaptchaFrictionlessProps } from "@prosopo/types";
|
|
2
|
+
export declare const ProcaptchaFrictionless: ({ config, callbacks, restart, i18n, detectBot, container, }: ProcaptchaFrictionlessProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
3
|
+
//# sourceMappingURL=ProcaptchaFrictionless.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProcaptchaFrictionless.d.ts","sourceRoot":"","sources":["../src/ProcaptchaFrictionless.tsx"],"names":[],"mappings":"AAsBA,OAAO,EAIN,KAAK,2BAA2B,EAChC,MAAM,gBAAgB,CAAC;AA6CxB,eAAO,MAAM,sBAAsB,gEAOhC,2BAA2B,mDA2I7B,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jsx } from "react/jsx-runtime";
|
|
1
|
+
import { jsx } from "@emotion/react/jsx-runtime";
|
|
2
2
|
import { loadI18next } from "@prosopo/locale";
|
|
3
3
|
import { Checkbox, getDefaultEvents, providerRetry } from "@prosopo/procaptcha-common";
|
|
4
4
|
import { ProcaptchaPow } from "@prosopo/procaptcha-pow";
|
|
@@ -35,7 +35,8 @@ const ProcaptchaFrictionless = ({
|
|
|
35
35
|
callbacks,
|
|
36
36
|
restart,
|
|
37
37
|
i18n,
|
|
38
|
-
detectBot = customDetectBot
|
|
38
|
+
detectBot = customDetectBot,
|
|
39
|
+
container
|
|
39
40
|
}) => {
|
|
40
41
|
const stateRef = useRef(defaultLoadingState(0));
|
|
41
42
|
const events = getDefaultEvents(callbacks);
|
|
@@ -97,7 +98,7 @@ const ProcaptchaFrictionless = ({
|
|
|
97
98
|
async () => {
|
|
98
99
|
stateRef.current.attemptCount += 1;
|
|
99
100
|
const configOutput = ProcaptchaConfigSchema.parse(config);
|
|
100
|
-
const result = await detectBot(configOutput);
|
|
101
|
+
const result = await detectBot(configOutput, container, restart);
|
|
101
102
|
if (result.error?.message) {
|
|
102
103
|
stateRef.current = {
|
|
103
104
|
...stateRef.current,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProcaptchaFrictionless.js","sourceRoot":"","sources":["../src/ProcaptchaFrictionless.tsx"],"names":[],"mappings":";AAcA,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EACN,QAAQ,EACR,gBAAgB,EAChB,aAAa,GACb,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AACvD,OAAO,EAGN,sBAAsB,GAEtB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACjE,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACpD,OAAO,eAAe,MAAM,sBAAsB,CAAC;AAEnD,MAAM,iBAAiB,GAAG,CACzB,KAAyB,EACzB,IAAc,EACd,YAAgC,EAChC,mBAA4B,EAC5B,aAAsC,EACtC,OAAgB,EACf,EAAE;IACH,MAAM,aAAa,GAAG,OAAO,KAAK,KAAK,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,SAAS,CAAC;IAEjE,IAAI,IAAI,KAAK,WAAW,EAAE,CAAC;QAC1B,OAAO,IAAI,CAAC;IACb,CAAC;IAED,OAAO,CACN,KAAC,QAAQ,IACR,KAAK,EAAE,aAAa,EACpB,QAAQ,EAAE,KAAK,IAAI,EAAE,GAAE,CAAC,EACxB,OAAO,EAAE,KAAK,EACd,SAAS,EAAE,mBAAmB,CAAC,CAAC,CAAC,aAAa,CAAC,mBAAmB,CAAC,CAAC,CAAC,CAAC,EAAE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AY,EAC7B,CAAC,CACD,CAAC,OAAO,CAAC,GAAG,EAAE;YACd,IAAI,QAAQ,CAAC,OAAO,CAAC,YAAY,IAAI,CAAC,EAAE,CAAC;gBACxC,iBAAiB,EAAE,CAAC;gBACpB,uBAAuB,EAAE,CAAC;YAC3B,CAAC;QACF,CAAC,CAAC,CAAC;IACJ,CAAC,CAAC;IAGF,SAAS,CAAC,GAAG,EAAE;QACd,MAAM,qBAAqB,GAAG,KAAK,IAAI,EAAE;YACxC,MAAM,KAAK,EAAE,CAAC;QACf,CAAC,CAAC;QAEF,qBAAqB,EAAE,CAAC;IACzB,CAAC,EAAE,CAAC,MAAM,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC;IAEpD,OAAO,iBAAiB,CAAC;AAC1B,CAAC,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const jsxRuntime = require("react/jsx-runtime");
|
|
3
|
+
const jsxRuntime = require("@emotion/react/jsx-runtime");
|
|
4
4
|
const locale = require("@prosopo/locale");
|
|
5
5
|
const procaptchaCommon = require("@prosopo/procaptcha-common");
|
|
6
6
|
const procaptchaPow = require("@prosopo/procaptcha-pow");
|
|
@@ -37,7 +37,8 @@ const ProcaptchaFrictionless = ({
|
|
|
37
37
|
callbacks,
|
|
38
38
|
restart,
|
|
39
39
|
i18n,
|
|
40
|
-
detectBot = customDetectBot
|
|
40
|
+
detectBot = customDetectBot.default,
|
|
41
|
+
container
|
|
41
42
|
}) => {
|
|
42
43
|
const stateRef = react.useRef(defaultLoadingState(0));
|
|
43
44
|
const events = procaptchaCommon.getDefaultEvents(callbacks);
|
|
@@ -99,7 +100,7 @@ const ProcaptchaFrictionless = ({
|
|
|
99
100
|
async () => {
|
|
100
101
|
stateRef.current.attemptCount += 1;
|
|
101
102
|
const configOutput = types.ProcaptchaConfigSchema.parse(config);
|
|
102
|
-
const result = await detectBot(configOutput);
|
|
103
|
+
const result = await detectBot(configOutput, container, restart);
|
|
103
104
|
if (result.error?.message) {
|
|
104
105
|
stateRef.current = {
|
|
105
106
|
...stateRef.current,
|
|
@@ -1,25 +1,61 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
2
3
|
const api = require("@prosopo/api");
|
|
3
4
|
const common = require("@prosopo/common");
|
|
5
|
+
const loadBalancer = require("@prosopo/load-balancer");
|
|
4
6
|
const procaptchaCommon = require("@prosopo/procaptcha-common");
|
|
5
7
|
const detectorLoader = require("./detectorLoader.cjs");
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
const
|
|
8
|
+
const withTimeout = async (promise, ms) => {
|
|
9
|
+
let timeoutId;
|
|
10
|
+
const timeoutPromise = new Promise((_, reject) => {
|
|
11
|
+
timeoutId = setTimeout(() => {
|
|
12
|
+
reject(new common.ProsopoEnvError("API.UNKNOWN"));
|
|
13
|
+
}, ms);
|
|
14
|
+
});
|
|
15
|
+
try {
|
|
16
|
+
const result = await Promise.race([promise, timeoutPromise]);
|
|
17
|
+
if (timeoutId) {
|
|
18
|
+
clearTimeout(timeoutId);
|
|
19
|
+
}
|
|
20
|
+
return result;
|
|
21
|
+
} catch (error) {
|
|
22
|
+
if (timeoutId) {
|
|
23
|
+
clearTimeout(timeoutId);
|
|
24
|
+
}
|
|
25
|
+
throw error;
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
const customDetectBot = async (config, container, restartFn) => {
|
|
9
29
|
const ext = new (await procaptchaCommon.ExtensionLoader(config.web2))();
|
|
10
30
|
const userAccount = await ext.getAccount(config);
|
|
31
|
+
const detect = await detectorLoader.DetectorLoader();
|
|
32
|
+
const detectionResult = await detect(
|
|
33
|
+
config.defaultEnvironment,
|
|
34
|
+
loadBalancer.getRandomActiveProvider,
|
|
35
|
+
container,
|
|
36
|
+
restartFn,
|
|
37
|
+
userAccount.account.address
|
|
38
|
+
);
|
|
11
39
|
if (!config.account.address) {
|
|
12
40
|
throw new common.ProsopoEnvError("GENERAL.SITE_KEY_MISSING");
|
|
13
41
|
}
|
|
14
|
-
const provider =
|
|
42
|
+
const provider = detectionResult.provider;
|
|
43
|
+
if (!provider) {
|
|
44
|
+
throw new Error("Provider Selection Failed");
|
|
45
|
+
}
|
|
15
46
|
const providerApi = new api.ProviderApi(
|
|
16
47
|
provider.provider.url,
|
|
17
48
|
config.account.address
|
|
18
49
|
);
|
|
19
|
-
const captcha = await
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
50
|
+
const captcha = await withTimeout(
|
|
51
|
+
providerApi.getFrictionlessCaptcha(
|
|
52
|
+
detectionResult.token,
|
|
53
|
+
detectionResult.encryptHeadHash,
|
|
54
|
+
config.account.address,
|
|
55
|
+
userAccount.account.address
|
|
56
|
+
),
|
|
57
|
+
1e4
|
|
58
|
+
// 10 second timeout
|
|
23
59
|
);
|
|
24
60
|
return {
|
|
25
61
|
captchaType: captcha.captchaType,
|
|
@@ -30,4 +66,5 @@ const customDetectBot = async (config) => {
|
|
|
30
66
|
error: captcha.error
|
|
31
67
|
};
|
|
32
68
|
};
|
|
33
|
-
|
|
69
|
+
exports.default = customDetectBot;
|
|
70
|
+
exports.withTimeout = withTimeout;
|
|
@@ -1,5 +1,26 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __copyProps = (to, from, except, desc) => {
|
|
9
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
10
|
+
for (let key of __getOwnPropNames(from))
|
|
11
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
12
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
13
|
+
}
|
|
14
|
+
return to;
|
|
15
|
+
};
|
|
16
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
17
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
18
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
19
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
20
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
21
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
|
+
mod
|
|
23
|
+
));
|
|
2
24
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const
|
|
4
|
-
const DetectorLoader = async () => (await Promise.resolve().then(() => /* @__PURE__ */ _interopNamespaceDefaultOnly(require("./detector/dist/index.cjs")))).default;
|
|
25
|
+
const DetectorLoader = async () => (await import("@prosopo/detector")).default;
|
|
5
26
|
exports.DetectorLoader = DetectorLoader;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { BotDetectionFunction } from "@prosopo/types";
|
|
2
|
+
export declare const withTimeout: <T>(promise: Promise<T>, ms: number) => Promise<T>;
|
|
3
|
+
declare const customDetectBot: BotDetectionFunction;
|
|
4
|
+
export default customDetectBot;
|
|
5
|
+
//# sourceMappingURL=customDetectBot.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"customDetectBot.d.ts","sourceRoot":"","sources":["../src/customDetectBot.ts"],"names":[],"mappings":"AAkBA,OAAO,KAAK,EACX,oBAAoB,EAGpB,MAAM,gBAAgB,CAAC;AAIxB,eAAO,MAAM,WAAW,GAAU,CAAC,WACzB,OAAO,CAAC,CAAC,CAAC,MACf,MAAM,KACR,OAAO,CAAC,CAAC,CAoBX,CAAC;AAEF,QAAA,MAAM,eAAe,EAAE,oBAoDtB,CAAC;AAEF,eAAe,eAAe,CAAC"}
|
package/dist/customDetectBot.js
CHANGED
|
@@ -1,24 +1,59 @@
|
|
|
1
1
|
import { ProviderApi } from "@prosopo/api";
|
|
2
2
|
import { ProsopoEnvError } from "@prosopo/common";
|
|
3
|
-
import {
|
|
3
|
+
import { getRandomActiveProvider } from "@prosopo/load-balancer";
|
|
4
|
+
import { ExtensionLoader } from "@prosopo/procaptcha-common";
|
|
4
5
|
import { DetectorLoader } from "./detectorLoader.js";
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
const
|
|
6
|
+
const withTimeout = async (promise, ms) => {
|
|
7
|
+
let timeoutId;
|
|
8
|
+
const timeoutPromise = new Promise((_, reject) => {
|
|
9
|
+
timeoutId = setTimeout(() => {
|
|
10
|
+
reject(new ProsopoEnvError("API.UNKNOWN"));
|
|
11
|
+
}, ms);
|
|
12
|
+
});
|
|
13
|
+
try {
|
|
14
|
+
const result = await Promise.race([promise, timeoutPromise]);
|
|
15
|
+
if (timeoutId) {
|
|
16
|
+
clearTimeout(timeoutId);
|
|
17
|
+
}
|
|
18
|
+
return result;
|
|
19
|
+
} catch (error) {
|
|
20
|
+
if (timeoutId) {
|
|
21
|
+
clearTimeout(timeoutId);
|
|
22
|
+
}
|
|
23
|
+
throw error;
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
const customDetectBot = async (config, container, restartFn) => {
|
|
8
27
|
const ext = new (await ExtensionLoader(config.web2))();
|
|
9
28
|
const userAccount = await ext.getAccount(config);
|
|
29
|
+
const detect = await DetectorLoader();
|
|
30
|
+
const detectionResult = await detect(
|
|
31
|
+
config.defaultEnvironment,
|
|
32
|
+
getRandomActiveProvider,
|
|
33
|
+
container,
|
|
34
|
+
restartFn,
|
|
35
|
+
userAccount.account.address
|
|
36
|
+
);
|
|
10
37
|
if (!config.account.address) {
|
|
11
38
|
throw new ProsopoEnvError("GENERAL.SITE_KEY_MISSING");
|
|
12
39
|
}
|
|
13
|
-
const provider =
|
|
40
|
+
const provider = detectionResult.provider;
|
|
41
|
+
if (!provider) {
|
|
42
|
+
throw new Error("Provider Selection Failed");
|
|
43
|
+
}
|
|
14
44
|
const providerApi = new ProviderApi(
|
|
15
45
|
provider.provider.url,
|
|
16
46
|
config.account.address
|
|
17
47
|
);
|
|
18
|
-
const captcha = await
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
48
|
+
const captcha = await withTimeout(
|
|
49
|
+
providerApi.getFrictionlessCaptcha(
|
|
50
|
+
detectionResult.token,
|
|
51
|
+
detectionResult.encryptHeadHash,
|
|
52
|
+
config.account.address,
|
|
53
|
+
userAccount.account.address
|
|
54
|
+
),
|
|
55
|
+
1e4
|
|
56
|
+
// 10 second timeout
|
|
22
57
|
);
|
|
23
58
|
return {
|
|
24
59
|
captchaType: captcha.captchaType,
|
|
@@ -30,5 +65,6 @@ const customDetectBot = async (config) => {
|
|
|
30
65
|
};
|
|
31
66
|
};
|
|
32
67
|
export {
|
|
33
|
-
customDetectBot as default
|
|
68
|
+
customDetectBot as default,
|
|
69
|
+
withTimeout
|
|
34
70
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"customDetectBot.js","sourceRoot":"","sources":["../src/customDetectBot.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AACjE,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAO7D,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAErD,MAAM,CAAC,MAAM,WAAW,GAAG,KAAK,EAC/B,OAAmB,EACnB,EAAU,EACG,EAAE;IACf,IAAI,SAAqC,CAAC;IAC1C,MAAM,cAAc,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,QAAQ,CAAC;IAE1C,IAAI,CAAC,QAAQ,EAAE,CAAC;QACf,MAAM,IAAI,KAAK,CAAC,2BAA2B,CAAC,CAAC;IAC9C,CAAC;IAED,MAAM,WAAW,GAAG,IAAI,WAAW,CAClC,QAAQ,CAAC,QAAQ,CAAC,GAAG,EACrB,MAAM,CAAC,OAAO,CAAC,OAAO,CACtB,CAAC;IAGF,MAAM,OAAO,GAAG,MAAM,WAAW,CAChC,WAAW,CAAC,sBAAsB,CACjC,eAAe,CAAC,KAAK,EACrB,eAAe,CAAC,eAAe,EAC/B,MAAM,CAAC,OAAO,CAAC,OAAO,EACtB,WAAW,CAAC,OAAO,CAAC,OAAO,CAC3B,EACD,KAAK,CACL,CAAC;IAEF,OAAO;QACN,WAAW,EAAE,OAAO,CAAC,WAAW;QAChC,SAAS,EAAE,OAAO,CAAC,SAAS;QAC5B,QAAQ,EAAE,QAAQ;QAClB,MAAM,EAAE,OAAO,CAAC,MAAM;QACtB,WAAW,EAAE,WAAW;QACxB,KAAK,EAAE,OAAO,CAAC,KAAK;KACpB,CAAC;AACH,CAAC,CAAC;AAEF,eAAe,eAAe,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"detectorLoader.d.ts","sourceRoot":"","sources":["../src/detectorLoader.ts"],"names":[],"mappings":"AAcA,KAAK,YAAY,GAAG,cAAc,mBAAmB,EAAE,OAAO,CAAC;AAE/D,eAAO,MAAM,cAAc,QAAa,OAAO,CAAC,YAAY,CAChB,CAAC"}
|
package/dist/detectorLoader.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"detectorLoader.js","sourceRoot":"","sources":["../src/detectorLoader.ts"],"names":[],"mappings":"AAgBA,MAAM,CAAC,MAAM,cAAc,GAAG,KAAK,IAA2B,EAAE,CAC/D,CAAC,MAAM,MAAM,CAAC,mBAAmB,CAAC,CAAC,CAAC,OAAO,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAaA,cAAc,6BAA6B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAaA,cAAc,6BAA6B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"customDetectBot.test.d.ts","sourceRoot":"","sources":["../../src/tests/customDetectBot.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { ProsopoEnvError } from "@prosopo/common";
|
|
2
|
+
import { describe, expect, it, vi } from "vitest";
|
|
3
|
+
import { withTimeout } from "../customDetectBot.js";
|
|
4
|
+
describe("withTimeout", () => {
|
|
5
|
+
it("should resolve with the promise result when promise resolves before timeout", async () => {
|
|
6
|
+
const result = "success";
|
|
7
|
+
const promise = Promise.resolve(result);
|
|
8
|
+
const response = await withTimeout(promise, 1000);
|
|
9
|
+
expect(response).toBe(result);
|
|
10
|
+
});
|
|
11
|
+
it("should reject with original error when promise rejects before timeout", async () => {
|
|
12
|
+
const errorMessage = "Original error";
|
|
13
|
+
const promise = Promise.reject(new Error(errorMessage));
|
|
14
|
+
await expect(withTimeout(promise, 1000)).rejects.toThrow(errorMessage);
|
|
15
|
+
});
|
|
16
|
+
it("should reject with timeout error when promise does not resolve within the timeout", async () => {
|
|
17
|
+
const promise = new Promise((resolve) => {
|
|
18
|
+
setTimeout(resolve, 500);
|
|
19
|
+
});
|
|
20
|
+
vi.useFakeTimers();
|
|
21
|
+
const timeoutPromise = withTimeout(promise, 100);
|
|
22
|
+
vi.advanceTimersByTime(200);
|
|
23
|
+
await expect(timeoutPromise).rejects.toThrow(ProsopoEnvError);
|
|
24
|
+
await expect(timeoutPromise).rejects.toEqual(expect.objectContaining({
|
|
25
|
+
message: "API.UNKNOWN",
|
|
26
|
+
translationKey: "API.UNKNOWN",
|
|
27
|
+
}));
|
|
28
|
+
vi.useRealTimers();
|
|
29
|
+
});
|
|
30
|
+
it("should respect the provided timeout duration", async () => {
|
|
31
|
+
vi.useFakeTimers();
|
|
32
|
+
const fastResolve = Promise.resolve("success");
|
|
33
|
+
const fastResult = withTimeout(fastResolve, 1000);
|
|
34
|
+
const slowPromise = new Promise((resolve) => {
|
|
35
|
+
setTimeout(() => resolve("slow"), 2000);
|
|
36
|
+
});
|
|
37
|
+
const slowWithTimeout = withTimeout(slowPromise, 1000);
|
|
38
|
+
vi.advanceTimersByTime(500);
|
|
39
|
+
expect(await fastResult).toBe("success");
|
|
40
|
+
vi.advanceTimersByTime(600);
|
|
41
|
+
await expect(slowWithTimeout).rejects.toThrow(ProsopoEnvError);
|
|
42
|
+
vi.useRealTimers();
|
|
43
|
+
});
|
|
44
|
+
});
|
|
45
|
+
//# sourceMappingURL=customDetectBot.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"customDetectBot.test.js","sourceRoot":"","sources":["../../src/tests/customDetectBot.test.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAClD,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAEpD,QAAQ,CAAC,aAAa,EAAE,GAAG,EAAE;IAC5B,EAAE,CAAC,6EAA6E,EAAE,KAAK,IAAI,EAAE;QAC5F,MAAM,MAAM,GAAG,SAAS,CAAC;QACzB,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QAExC,MAAM,QAAQ,GAAG,MAAM,WAAW,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;QAElD,MAAM,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAC/B,CAAC,CA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IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;YAC3C,UAAU,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,IAAI,CAAC,CAAC;QACzC,CAAC,CAAC,CAAC;QACH,MAAM,eAAe,GAAG,WAAW,CAAC,WAAW,EAAE,IAAI,CAAC,CAAC;QAEvD,EAAE,CAAC,mBAAmB,CAAC,GAAG,CAAC,CAAC;QAC5B,MAAM,CAAC,MAAM,UAAU,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QAEzC,EAAE,CAAC,mBAAmB,CAAC,GAAG,CAAC,CAAC;QAC5B,MAAM,MAAM,CAAC,eAAe,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC;QAE/D,EAAE,CAAC,aAAa,EAAE,CAAC;IACpB,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prosopo/procaptcha-frictionless",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.8.14",
|
|
4
4
|
"author": "PROSOPO LIMITED <info@prosopo.io>",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"type": "module",
|
|
8
8
|
"sideEffects": false,
|
|
9
9
|
"engines": {
|
|
10
|
-
"node": "
|
|
11
|
-
"npm": "10.
|
|
10
|
+
"node": ">=v20.0.0",
|
|
11
|
+
"npm": ">=10.6.0"
|
|
12
12
|
},
|
|
13
13
|
"exports": {
|
|
14
14
|
".": {
|
|
@@ -21,38 +21,39 @@
|
|
|
21
21
|
"source": "./src/index.ts",
|
|
22
22
|
"scripts": {
|
|
23
23
|
"clean": "del-cli --verbose dist tsconfig.tsbuildinfo",
|
|
24
|
+
"test": "NODE_ENV=${NODE_ENV:-test}; npx vitest run --config ./vite.test.config.ts",
|
|
24
25
|
"build": "NODE_ENV=${NODE_ENV:-development}; vite build --config vite.esm.config.ts --mode $NODE_ENV",
|
|
25
26
|
"build:tsc": "tsc --build --verbose",
|
|
26
27
|
"build:cjs": "NODE_ENV=${NODE_ENV:-development}; vite build --config vite.cjs.config.ts --mode $NODE_ENV",
|
|
27
|
-
"typecheck": "tsc --
|
|
28
|
+
"typecheck": "tsc --project tsconfig.types.json"
|
|
28
29
|
},
|
|
29
30
|
"browserslist": ["> 0.5%, last 2 versions, not dead"],
|
|
30
31
|
"dependencies": {
|
|
31
|
-
"@prosopo/
|
|
32
|
-
"@prosopo/
|
|
33
|
-
"@prosopo/
|
|
34
|
-
"@prosopo/
|
|
35
|
-
"@prosopo/
|
|
36
|
-
"@prosopo/
|
|
37
|
-
"@
|
|
38
|
-
"
|
|
39
|
-
"
|
|
40
|
-
"
|
|
41
|
-
"
|
|
42
|
-
"
|
|
43
|
-
"
|
|
44
|
-
"webpack-dev-server": "5.2.2"
|
|
32
|
+
"@prosopo/api": "3.1.32",
|
|
33
|
+
"@prosopo/common": "3.1.21",
|
|
34
|
+
"@prosopo/config": "3.1.21",
|
|
35
|
+
"@prosopo/detector": "3.3.13",
|
|
36
|
+
"@prosopo/load-balancer": "2.8.8",
|
|
37
|
+
"@prosopo/locale": "3.1.21",
|
|
38
|
+
"@prosopo/procaptcha-common": "2.9.13",
|
|
39
|
+
"@prosopo/procaptcha-pow": "2.8.21",
|
|
40
|
+
"@prosopo/procaptcha-react": "2.9.13",
|
|
41
|
+
"@prosopo/types": "3.5.11",
|
|
42
|
+
"@prosopo/widget-skeleton": "2.7.7",
|
|
43
|
+
"dotenv": "16.4.5",
|
|
44
|
+
"react": "18.3.1"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
|
-
"@
|
|
47
|
+
"@types/node": "22.10.2",
|
|
48
|
+
"@vitest/coverage-v8": "3.2.4",
|
|
48
49
|
"concurrently": "9.0.1",
|
|
49
50
|
"del-cli": "6.0.0",
|
|
50
51
|
"npm-run-all": "4.1.5",
|
|
51
52
|
"tslib": "2.7.0",
|
|
52
53
|
"tsx": "4.20.3",
|
|
53
54
|
"typescript": "5.6.2",
|
|
54
|
-
"vite": "6.
|
|
55
|
-
"vitest": "3.
|
|
55
|
+
"vite": "6.4.1",
|
|
56
|
+
"vitest": "3.2.4"
|
|
56
57
|
},
|
|
57
58
|
"repository": {
|
|
58
59
|
"type": "git",
|