@prosopo/procaptcha-frictionless 2.6.32 → 2.8.6
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 +360 -0
- package/dist/ProcaptchaFrictionless.js +4 -3
- package/dist/cjs/ProcaptchaFrictionless.cjs +4 -3
- package/dist/cjs/customDetectBot.cjs +45 -9
- package/dist/cjs/detectorLoader.cjs +23 -2
- package/dist/customDetectBot.js +45 -10
- package/dist/detectorLoader.js +1 -1
- package/package.json +17 -16
- package/vite.test.config.ts +38 -0
- package/dist/cjs/detector/dist/index.cjs +0 -2334
- package/dist/detector/dist/index.js +0 -2335
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,365 @@
|
|
|
1
1
|
# @prosopo/procaptcha-frictionless
|
|
2
2
|
|
|
3
|
+
## 2.8.6
|
|
4
|
+
### Patch Changes
|
|
5
|
+
|
|
6
|
+
- Updated dependencies [04d0f1a]
|
|
7
|
+
- Updated dependencies [1e3a838]
|
|
8
|
+
- @prosopo/load-balancer@2.8.0
|
|
9
|
+
- @prosopo/detector@3.3.5
|
|
10
|
+
- @prosopo/config@3.1.20
|
|
11
|
+
- @prosopo/procaptcha-common@2.9.5
|
|
12
|
+
- @prosopo/api@3.1.24
|
|
13
|
+
- @prosopo/common@3.1.20
|
|
14
|
+
- @prosopo/locale@3.1.20
|
|
15
|
+
- @prosopo/procaptcha-pow@2.8.13
|
|
16
|
+
- @prosopo/procaptcha-react@2.9.5
|
|
17
|
+
- @prosopo/types@3.5.3
|
|
18
|
+
- @prosopo/widget-skeleton@2.7.6
|
|
19
|
+
|
|
20
|
+
## 2.8.5
|
|
21
|
+
### Patch Changes
|
|
22
|
+
|
|
23
|
+
- 5659b24: Release 3.4.4
|
|
24
|
+
- Updated dependencies [f912439]
|
|
25
|
+
- Updated dependencies [5659b24]
|
|
26
|
+
- @prosopo/common@3.1.19
|
|
27
|
+
- @prosopo/procaptcha-common@2.9.4
|
|
28
|
+
- @prosopo/procaptcha-react@2.9.4
|
|
29
|
+
- @prosopo/widget-skeleton@2.7.5
|
|
30
|
+
- @prosopo/procaptcha-pow@2.8.12
|
|
31
|
+
- @prosopo/load-balancer@2.7.12
|
|
32
|
+
- @prosopo/detector@3.3.4
|
|
33
|
+
- @prosopo/locale@3.1.19
|
|
34
|
+
- @prosopo/types@3.5.2
|
|
35
|
+
- @prosopo/api@3.1.23
|
|
36
|
+
- @prosopo/config@3.1.19
|
|
37
|
+
|
|
38
|
+
## 2.8.4
|
|
39
|
+
### Patch Changes
|
|
40
|
+
|
|
41
|
+
- 52cd544: Integrity checks
|
|
42
|
+
- 50c4120: Release 3.4.3
|
|
43
|
+
- Updated dependencies [52cd544]
|
|
44
|
+
- Updated dependencies [b8cc590]
|
|
45
|
+
- Updated dependencies [b117ba3]
|
|
46
|
+
- Updated dependencies [50c4120]
|
|
47
|
+
- @prosopo/detector@3.3.3
|
|
48
|
+
- @prosopo/types@3.5.1
|
|
49
|
+
- @prosopo/procaptcha-common@2.9.3
|
|
50
|
+
- @prosopo/procaptcha-react@2.9.3
|
|
51
|
+
- @prosopo/widget-skeleton@2.7.4
|
|
52
|
+
- @prosopo/procaptcha-pow@2.8.11
|
|
53
|
+
- @prosopo/load-balancer@2.7.11
|
|
54
|
+
- @prosopo/common@3.1.18
|
|
55
|
+
- @prosopo/locale@3.1.18
|
|
56
|
+
- @prosopo/api@3.1.22
|
|
57
|
+
- @prosopo/config@3.1.18
|
|
58
|
+
|
|
59
|
+
## 2.8.3
|
|
60
|
+
### Patch Changes
|
|
61
|
+
|
|
62
|
+
- 618703f: Release 3.4.2
|
|
63
|
+
- Updated dependencies [618703f]
|
|
64
|
+
- Updated dependencies [e20ad6b]
|
|
65
|
+
- @prosopo/procaptcha-common@2.9.2
|
|
66
|
+
- @prosopo/procaptcha-react@2.9.2
|
|
67
|
+
- @prosopo/widget-skeleton@2.7.3
|
|
68
|
+
- @prosopo/procaptcha-pow@2.8.10
|
|
69
|
+
- @prosopo/load-balancer@2.7.10
|
|
70
|
+
- @prosopo/detector@3.3.2
|
|
71
|
+
- @prosopo/common@3.1.17
|
|
72
|
+
- @prosopo/locale@3.1.17
|
|
73
|
+
- @prosopo/types@3.5.0
|
|
74
|
+
- @prosopo/api@3.1.21
|
|
75
|
+
- @prosopo/config@3.1.17
|
|
76
|
+
|
|
77
|
+
## 2.8.2
|
|
78
|
+
### Patch Changes
|
|
79
|
+
|
|
80
|
+
- 11303d9: Release 3.4.0
|
|
81
|
+
- 18cb28b: Release 3.4.1
|
|
82
|
+
- Updated dependencies [11303d9]
|
|
83
|
+
- Updated dependencies [18cb28b]
|
|
84
|
+
- Updated dependencies [11303d9]
|
|
85
|
+
- @prosopo/procaptcha-common@2.9.1
|
|
86
|
+
- @prosopo/procaptcha-react@2.9.1
|
|
87
|
+
- @prosopo/widget-skeleton@2.7.2
|
|
88
|
+
- @prosopo/procaptcha-pow@2.8.9
|
|
89
|
+
- @prosopo/load-balancer@2.7.9
|
|
90
|
+
- @prosopo/detector@3.3.1
|
|
91
|
+
- @prosopo/common@3.1.16
|
|
92
|
+
- @prosopo/locale@3.1.16
|
|
93
|
+
- @prosopo/types@3.4.1
|
|
94
|
+
- @prosopo/api@3.1.20
|
|
95
|
+
- @prosopo/config@3.1.16
|
|
96
|
+
|
|
97
|
+
## 2.8.1
|
|
98
|
+
### Patch Changes
|
|
99
|
+
|
|
100
|
+
- f3f7aec: Release 3.4.0
|
|
101
|
+
- Updated dependencies [f3f7aec]
|
|
102
|
+
- Updated dependencies [6768f14]
|
|
103
|
+
- @prosopo/procaptcha-common@2.9.0
|
|
104
|
+
- @prosopo/procaptcha-react@2.9.0
|
|
105
|
+
- @prosopo/widget-skeleton@2.7.1
|
|
106
|
+
- @prosopo/procaptcha-pow@2.8.8
|
|
107
|
+
- @prosopo/load-balancer@2.7.8
|
|
108
|
+
- @prosopo/detector@3.3.0
|
|
109
|
+
- @prosopo/common@3.1.15
|
|
110
|
+
- @prosopo/locale@3.1.15
|
|
111
|
+
- @prosopo/types@3.4.0
|
|
112
|
+
- @prosopo/api@3.1.19
|
|
113
|
+
- @prosopo/config@3.1.15
|
|
114
|
+
|
|
115
|
+
## 2.8.0
|
|
116
|
+
### Minor Changes
|
|
117
|
+
|
|
118
|
+
- 97edf3f: Adding dom manip checks
|
|
119
|
+
|
|
120
|
+
### Patch Changes
|
|
121
|
+
|
|
122
|
+
- Release 3.3.1
|
|
123
|
+
- 0824221: Release 3.2.4
|
|
124
|
+
- Updated dependencies [97edf3f]
|
|
125
|
+
- Updated dependencies
|
|
126
|
+
- Updated dependencies [0824221]
|
|
127
|
+
- Updated dependencies [72810f4]
|
|
128
|
+
- @prosopo/widget-skeleton@2.7.0
|
|
129
|
+
- @prosopo/detector@3.2.0
|
|
130
|
+
- @prosopo/types@3.3.0
|
|
131
|
+
- @prosopo/procaptcha-common@2.8.7
|
|
132
|
+
- @prosopo/procaptcha-react@2.8.7
|
|
133
|
+
- @prosopo/procaptcha-pow@2.8.7
|
|
134
|
+
- @prosopo/load-balancer@2.7.7
|
|
135
|
+
- @prosopo/common@3.1.14
|
|
136
|
+
- @prosopo/locale@3.1.14
|
|
137
|
+
- @prosopo/api@3.1.18
|
|
138
|
+
- @prosopo/config@3.1.14
|
|
139
|
+
|
|
140
|
+
## 2.7.6
|
|
141
|
+
### Patch Changes
|
|
142
|
+
|
|
143
|
+
- 008d112: Release 3.3.0
|
|
144
|
+
- Updated dependencies [5137f01]
|
|
145
|
+
- Updated dependencies [0555cd8]
|
|
146
|
+
- Updated dependencies [509be28]
|
|
147
|
+
- Updated dependencies [008d112]
|
|
148
|
+
- @prosopo/detector@3.1.6
|
|
149
|
+
- @prosopo/types@3.2.1
|
|
150
|
+
- @prosopo/procaptcha-common@2.8.6
|
|
151
|
+
- @prosopo/procaptcha-react@2.8.6
|
|
152
|
+
- @prosopo/widget-skeleton@2.6.14
|
|
153
|
+
- @prosopo/procaptcha-pow@2.8.6
|
|
154
|
+
- @prosopo/load-balancer@2.7.6
|
|
155
|
+
- @prosopo/common@3.1.13
|
|
156
|
+
- @prosopo/locale@3.1.13
|
|
157
|
+
- @prosopo/api@3.1.17
|
|
158
|
+
- @prosopo/config@3.1.13
|
|
159
|
+
|
|
160
|
+
## 2.7.5
|
|
161
|
+
### Patch Changes
|
|
162
|
+
|
|
163
|
+
- 0824221: Release 3.2.4
|
|
164
|
+
- Updated dependencies [cf48565]
|
|
165
|
+
- Updated dependencies [0824221]
|
|
166
|
+
- Updated dependencies [72810f4]
|
|
167
|
+
- @prosopo/types@3.2.0
|
|
168
|
+
- @prosopo/procaptcha-common@2.8.5
|
|
169
|
+
- @prosopo/procaptcha-react@2.8.5
|
|
170
|
+
- @prosopo/widget-skeleton@2.6.13
|
|
171
|
+
- @prosopo/procaptcha-pow@2.8.5
|
|
172
|
+
- @prosopo/load-balancer@2.7.5
|
|
173
|
+
- @prosopo/detector@3.1.5
|
|
174
|
+
- @prosopo/common@3.1.12
|
|
175
|
+
- @prosopo/locale@3.1.12
|
|
176
|
+
- @prosopo/api@3.1.16
|
|
177
|
+
- @prosopo/config@3.1.12
|
|
178
|
+
|
|
179
|
+
## 2.7.4
|
|
180
|
+
### Patch Changes
|
|
181
|
+
|
|
182
|
+
- 1a23649: Release 3.2.3
|
|
183
|
+
- Updated dependencies [0d1a33e]
|
|
184
|
+
- Updated dependencies [0d1a33e]
|
|
185
|
+
- Updated dependencies [1a23649]
|
|
186
|
+
- @prosopo/locale@3.1.11
|
|
187
|
+
- @prosopo/types@3.1.4
|
|
188
|
+
- @prosopo/procaptcha-common@2.8.4
|
|
189
|
+
- @prosopo/procaptcha-react@2.8.4
|
|
190
|
+
- @prosopo/widget-skeleton@2.6.12
|
|
191
|
+
- @prosopo/procaptcha-pow@2.8.4
|
|
192
|
+
- @prosopo/load-balancer@2.7.4
|
|
193
|
+
- @prosopo/detector@3.1.4
|
|
194
|
+
- @prosopo/common@3.1.11
|
|
195
|
+
- @prosopo/api@3.1.15
|
|
196
|
+
- @prosopo/config@3.1.11
|
|
197
|
+
|
|
198
|
+
## 2.7.3
|
|
199
|
+
### Patch Changes
|
|
200
|
+
|
|
201
|
+
- 657a827: Release 3.2.2
|
|
202
|
+
- Updated dependencies [36b23e0]
|
|
203
|
+
- Updated dependencies [657a827]
|
|
204
|
+
- @prosopo/api@3.1.14
|
|
205
|
+
- @prosopo/procaptcha-common@2.8.3
|
|
206
|
+
- @prosopo/procaptcha-react@2.8.3
|
|
207
|
+
- @prosopo/widget-skeleton@2.6.11
|
|
208
|
+
- @prosopo/procaptcha-pow@2.8.3
|
|
209
|
+
- @prosopo/load-balancer@2.7.3
|
|
210
|
+
- @prosopo/detector@3.1.3
|
|
211
|
+
- @prosopo/common@3.1.10
|
|
212
|
+
- @prosopo/locale@3.1.10
|
|
213
|
+
- @prosopo/types@3.1.3
|
|
214
|
+
- @prosopo/config@3.1.10
|
|
215
|
+
|
|
216
|
+
## 2.7.2
|
|
217
|
+
### Patch Changes
|
|
218
|
+
|
|
219
|
+
- 4440947: fix type-only tsc compilation
|
|
220
|
+
- 7bdaca6: Release 3.2.1
|
|
221
|
+
- Updated dependencies [4440947]
|
|
222
|
+
- Updated dependencies [7bdaca6]
|
|
223
|
+
- Updated dependencies [809b984]
|
|
224
|
+
- Updated dependencies [1249ce0]
|
|
225
|
+
- Updated dependencies [809b984]
|
|
226
|
+
- @prosopo/procaptcha-common@2.8.2
|
|
227
|
+
- @prosopo/procaptcha-react@2.8.2
|
|
228
|
+
- @prosopo/widget-skeleton@2.6.10
|
|
229
|
+
- @prosopo/procaptcha-pow@2.8.2
|
|
230
|
+
- @prosopo/load-balancer@2.7.2
|
|
231
|
+
- @prosopo/detector@3.1.2
|
|
232
|
+
- @prosopo/common@3.1.9
|
|
233
|
+
- @prosopo/locale@3.1.9
|
|
234
|
+
- @prosopo/types@3.1.2
|
|
235
|
+
- @prosopo/api@3.1.13
|
|
236
|
+
- @prosopo/config@3.1.9
|
|
237
|
+
|
|
238
|
+
## 2.7.1
|
|
239
|
+
### Patch Changes
|
|
240
|
+
|
|
241
|
+
- 6fe8570: Release 3.2.0
|
|
242
|
+
- Updated dependencies [1f980c4]
|
|
243
|
+
- Updated dependencies [6fe8570]
|
|
244
|
+
- @prosopo/load-balancer@2.7.1
|
|
245
|
+
- @prosopo/detector@3.1.1
|
|
246
|
+
- @prosopo/types@3.1.1
|
|
247
|
+
- @prosopo/procaptcha-common@2.8.1
|
|
248
|
+
- @prosopo/procaptcha-react@2.8.1
|
|
249
|
+
- @prosopo/widget-skeleton@2.6.9
|
|
250
|
+
- @prosopo/procaptcha-pow@2.8.1
|
|
251
|
+
- @prosopo/common@3.1.8
|
|
252
|
+
- @prosopo/locale@3.1.8
|
|
253
|
+
- @prosopo/api@3.1.12
|
|
254
|
+
- @prosopo/config@3.1.8
|
|
255
|
+
|
|
256
|
+
## 2.7.0
|
|
257
|
+
### Minor Changes
|
|
258
|
+
|
|
259
|
+
- 8bdc7f0: Using detector to select provider
|
|
260
|
+
|
|
261
|
+
### Patch Changes
|
|
262
|
+
|
|
263
|
+
- f304be9: Release 3.1.13
|
|
264
|
+
- Updated dependencies [f304be9]
|
|
265
|
+
- Updated dependencies [8bdc7f0]
|
|
266
|
+
- @prosopo/procaptcha-common@2.8.0
|
|
267
|
+
- @prosopo/procaptcha-react@2.8.0
|
|
268
|
+
- @prosopo/widget-skeleton@2.6.8
|
|
269
|
+
- @prosopo/procaptcha-pow@2.8.0
|
|
270
|
+
- @prosopo/load-balancer@2.7.0
|
|
271
|
+
- @prosopo/detector@3.1.0
|
|
272
|
+
- @prosopo/common@3.1.7
|
|
273
|
+
- @prosopo/locale@3.1.7
|
|
274
|
+
- @prosopo/types@3.1.0
|
|
275
|
+
- @prosopo/api@3.1.11
|
|
276
|
+
- @prosopo/config@3.1.7
|
|
277
|
+
|
|
278
|
+
## 2.6.39
|
|
279
|
+
### Patch Changes
|
|
280
|
+
|
|
281
|
+
- 9eed772: Release 3.1.12
|
|
282
|
+
- a07db04: Release 3.1.12
|
|
283
|
+
- Updated dependencies [b4442f0]
|
|
284
|
+
- Updated dependencies [9eed772]
|
|
285
|
+
- Updated dependencies [a07db04]
|
|
286
|
+
- @prosopo/procaptcha-react@2.7.0
|
|
287
|
+
- @prosopo/procaptcha-pow@2.7.25
|
|
288
|
+
- @prosopo/config@3.1.6
|
|
289
|
+
- @prosopo/api@3.1.10
|
|
290
|
+
- @prosopo/common@3.1.6
|
|
291
|
+
- @prosopo/detector@3.0.7
|
|
292
|
+
- @prosopo/locale@3.1.6
|
|
293
|
+
- @prosopo/procaptcha-common@2.7.18
|
|
294
|
+
- @prosopo/types@3.0.10
|
|
295
|
+
- @prosopo/widget-skeleton@2.6.7
|
|
296
|
+
|
|
297
|
+
## 2.6.38
|
|
298
|
+
### Patch Changes
|
|
299
|
+
|
|
300
|
+
- @prosopo/api@3.1.9
|
|
301
|
+
- @prosopo/procaptcha-pow@2.7.24
|
|
302
|
+
- @prosopo/procaptcha-react@2.6.38
|
|
303
|
+
|
|
304
|
+
## 2.6.37
|
|
305
|
+
### Patch Changes
|
|
306
|
+
|
|
307
|
+
- 6960643: lint detect missing and unneccessary imports
|
|
308
|
+
- Updated dependencies [d8e855c]
|
|
309
|
+
- Updated dependencies [6960643]
|
|
310
|
+
- @prosopo/locale@3.1.5
|
|
311
|
+
- @prosopo/procaptcha-common@2.7.17
|
|
312
|
+
- @prosopo/procaptcha-react@2.6.37
|
|
313
|
+
- @prosopo/widget-skeleton@2.6.6
|
|
314
|
+
- @prosopo/procaptcha-pow@2.7.23
|
|
315
|
+
- @prosopo/detector@3.0.6
|
|
316
|
+
- @prosopo/common@3.1.5
|
|
317
|
+
- @prosopo/types@3.0.9
|
|
318
|
+
- @prosopo/api@3.1.8
|
|
319
|
+
|
|
320
|
+
## 2.6.36
|
|
321
|
+
### Patch Changes
|
|
322
|
+
|
|
323
|
+
- 30e7d4d: Fixing coverage report and more damn linting
|
|
324
|
+
- 857c614: Adding timeouts to frictionless requests to providers to stop hangs
|
|
325
|
+
- Updated dependencies [30e7d4d]
|
|
326
|
+
- @prosopo/procaptcha-react@2.6.36
|
|
327
|
+
- @prosopo/procaptcha-pow@2.7.22
|
|
328
|
+
- @prosopo/config@3.1.5
|
|
329
|
+
- @prosopo/detector@3.0.5
|
|
330
|
+
- @prosopo/locale@3.1.4
|
|
331
|
+
- @prosopo/types@3.0.8
|
|
332
|
+
- @prosopo/widget-skeleton@2.6.5
|
|
333
|
+
|
|
334
|
+
## 2.6.35
|
|
335
|
+
### Patch Changes
|
|
336
|
+
|
|
337
|
+
- 1f3a02f: Release 3.1.8
|
|
338
|
+
- Updated dependencies [1f3a02f]
|
|
339
|
+
- @prosopo/procaptcha-react@2.6.35
|
|
340
|
+
- @prosopo/procaptcha-pow@2.7.21
|
|
341
|
+
|
|
342
|
+
## 2.6.34
|
|
343
|
+
### Patch Changes
|
|
344
|
+
|
|
345
|
+
- 926df8a: lint
|
|
346
|
+
- Updated dependencies [926df8a]
|
|
347
|
+
- @prosopo/procaptcha-react@2.6.34
|
|
348
|
+
- @prosopo/procaptcha-pow@2.7.20
|
|
349
|
+
|
|
350
|
+
## 2.6.33
|
|
351
|
+
### Patch Changes
|
|
352
|
+
|
|
353
|
+
- Updated dependencies [44ffda2]
|
|
354
|
+
- Updated dependencies [a49b538]
|
|
355
|
+
- @prosopo/config@3.1.4
|
|
356
|
+
- @prosopo/detector@3.0.4
|
|
357
|
+
- @prosopo/locale@3.1.3
|
|
358
|
+
- @prosopo/procaptcha-pow@2.7.19
|
|
359
|
+
- @prosopo/procaptcha-react@2.6.33
|
|
360
|
+
- @prosopo/types@3.0.7
|
|
361
|
+
- @prosopo/widget-skeleton@2.6.4
|
|
362
|
+
|
|
3
363
|
## 2.6.32
|
|
4
364
|
### Patch Changes
|
|
5
365
|
|
|
@@ -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,
|
|
@@ -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,60 @@
|
|
|
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 botScore = 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 = botScore.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
|
+
botScore.token,
|
|
53
|
+
config.account.address,
|
|
54
|
+
userAccount.account.address
|
|
55
|
+
),
|
|
56
|
+
1e4
|
|
57
|
+
// 10 second timeout
|
|
23
58
|
);
|
|
24
59
|
return {
|
|
25
60
|
captchaType: captcha.captchaType,
|
|
@@ -30,4 +65,5 @@ const customDetectBot = async (config) => {
|
|
|
30
65
|
error: captcha.error
|
|
31
66
|
};
|
|
32
67
|
};
|
|
33
|
-
|
|
68
|
+
exports.default = customDetectBot;
|
|
69
|
+
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;
|
package/dist/customDetectBot.js
CHANGED
|
@@ -1,24 +1,58 @@
|
|
|
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 botScore = 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 = botScore.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
|
+
botScore.token,
|
|
51
|
+
config.account.address,
|
|
52
|
+
userAccount.account.address
|
|
53
|
+
),
|
|
54
|
+
1e4
|
|
55
|
+
// 10 second timeout
|
|
22
56
|
);
|
|
23
57
|
return {
|
|
24
58
|
captchaType: captcha.captchaType,
|
|
@@ -30,5 +64,6 @@ const customDetectBot = async (config) => {
|
|
|
30
64
|
};
|
|
31
65
|
};
|
|
32
66
|
export {
|
|
33
|
-
customDetectBot as default
|
|
67
|
+
customDetectBot as default,
|
|
68
|
+
withTimeout
|
|
34
69
|
};
|
package/dist/detectorLoader.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prosopo/procaptcha-frictionless",
|
|
3
|
-
"version": "2.6
|
|
3
|
+
"version": "2.8.6",
|
|
4
4
|
"author": "PROSOPO LIMITED <info@prosopo.io>",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -21,29 +21,30 @@
|
|
|
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.24",
|
|
33
|
+
"@prosopo/common": "3.1.20",
|
|
34
|
+
"@prosopo/config": "3.1.20",
|
|
35
|
+
"@prosopo/detector": "3.3.5",
|
|
36
|
+
"@prosopo/load-balancer": "2.8.0",
|
|
37
|
+
"@prosopo/locale": "3.1.20",
|
|
38
|
+
"@prosopo/procaptcha-common": "2.9.5",
|
|
39
|
+
"@prosopo/procaptcha-pow": "2.8.13",
|
|
40
|
+
"@prosopo/procaptcha-react": "2.9.5",
|
|
41
|
+
"@prosopo/types": "3.5.3",
|
|
42
|
+
"@prosopo/widget-skeleton": "2.7.6",
|
|
43
|
+
"dotenv": "16.4.5",
|
|
44
|
+
"react": "18.3.1"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
|
+
"@types/node": "22.10.2",
|
|
47
48
|
"@vitest/coverage-v8": "3.0.9",
|
|
48
49
|
"concurrently": "9.0.1",
|
|
49
50
|
"del-cli": "6.0.0",
|