@prosopo/procaptcha-react 2.6.32 → 2.9.5

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 CHANGED
@@ -1,5 +1,316 @@
1
1
  # @prosopo/procaptcha-react
2
2
 
3
+ ## 2.9.5
4
+ ### Patch Changes
5
+
6
+ - Updated dependencies [1e3a838]
7
+ - @prosopo/config@3.1.20
8
+ - @prosopo/procaptcha-common@2.9.5
9
+ - @prosopo/common@3.1.20
10
+ - @prosopo/locale@3.1.20
11
+ - @prosopo/procaptcha@2.9.5
12
+ - @prosopo/types@3.5.3
13
+ - @prosopo/util@3.1.5
14
+ - @prosopo/widget-skeleton@2.7.6
15
+
16
+ ## 2.9.4
17
+ ### Patch Changes
18
+
19
+ - 5659b24: Release 3.4.4
20
+ - Updated dependencies [f912439]
21
+ - Updated dependencies [5659b24]
22
+ - @prosopo/common@3.1.19
23
+ - @prosopo/procaptcha-common@2.9.4
24
+ - @prosopo/widget-skeleton@2.7.5
25
+ - @prosopo/procaptcha@2.9.4
26
+ - @prosopo/locale@3.1.19
27
+ - @prosopo/types@3.5.2
28
+ - @prosopo/util@3.1.4
29
+ - @prosopo/config@3.1.19
30
+
31
+ ## 2.9.3
32
+ ### Patch Changes
33
+
34
+ - 50c4120: Release 3.4.3
35
+ - Updated dependencies [52cd544]
36
+ - Updated dependencies [b117ba3]
37
+ - Updated dependencies [50c4120]
38
+ - @prosopo/types@3.5.1
39
+ - @prosopo/procaptcha-common@2.9.3
40
+ - @prosopo/widget-skeleton@2.7.4
41
+ - @prosopo/procaptcha@2.9.3
42
+ - @prosopo/common@3.1.18
43
+ - @prosopo/locale@3.1.18
44
+ - @prosopo/util@3.1.3
45
+ - @prosopo/config@3.1.18
46
+
47
+ ## 2.9.2
48
+ ### Patch Changes
49
+
50
+ - 618703f: Release 3.4.2
51
+ - Updated dependencies [618703f]
52
+ - Updated dependencies [e20ad6b]
53
+ - @prosopo/procaptcha-common@2.9.2
54
+ - @prosopo/widget-skeleton@2.7.3
55
+ - @prosopo/procaptcha@2.9.2
56
+ - @prosopo/common@3.1.17
57
+ - @prosopo/locale@3.1.17
58
+ - @prosopo/types@3.5.0
59
+ - @prosopo/util@3.1.2
60
+ - @prosopo/config@3.1.17
61
+
62
+ ## 2.9.1
63
+ ### Patch Changes
64
+
65
+ - 11303d9: Release 3.4.0
66
+ - 18cb28b: Release 3.4.1
67
+ - Updated dependencies [11303d9]
68
+ - Updated dependencies [18cb28b]
69
+ - Updated dependencies [11303d9]
70
+ - @prosopo/procaptcha-common@2.9.1
71
+ - @prosopo/widget-skeleton@2.7.2
72
+ - @prosopo/procaptcha@2.9.1
73
+ - @prosopo/common@3.1.16
74
+ - @prosopo/locale@3.1.16
75
+ - @prosopo/types@3.4.1
76
+ - @prosopo/util@3.1.1
77
+ - @prosopo/config@3.1.16
78
+
79
+ ## 2.9.0
80
+ ### Minor Changes
81
+
82
+ - 6768f14: Update salt
83
+
84
+ ### Patch Changes
85
+
86
+ - f3f7aec: Release 3.4.0
87
+ - Updated dependencies [f3f7aec]
88
+ - Updated dependencies [6768f14]
89
+ - @prosopo/procaptcha-common@2.9.0
90
+ - @prosopo/widget-skeleton@2.7.1
91
+ - @prosopo/procaptcha@2.9.0
92
+ - @prosopo/common@3.1.15
93
+ - @prosopo/locale@3.1.15
94
+ - @prosopo/types@3.4.0
95
+ - @prosopo/util@3.1.0
96
+ - @prosopo/config@3.1.15
97
+
98
+ ## 2.8.7
99
+ ### Patch Changes
100
+
101
+ - Release 3.3.1
102
+ - 0824221: Release 3.2.4
103
+ - Updated dependencies [97edf3f]
104
+ - Updated dependencies
105
+ - Updated dependencies [0824221]
106
+ - Updated dependencies [72810f4]
107
+ - @prosopo/widget-skeleton@2.7.0
108
+ - @prosopo/types@3.3.0
109
+ - @prosopo/procaptcha-common@2.8.7
110
+ - @prosopo/procaptcha@2.8.7
111
+ - @prosopo/common@3.1.14
112
+ - @prosopo/locale@3.1.14
113
+ - @prosopo/util@3.0.17
114
+ - @prosopo/config@3.1.14
115
+
116
+ ## 2.8.6
117
+ ### Patch Changes
118
+
119
+ - 008d112: Release 3.3.0
120
+ - Updated dependencies [509be28]
121
+ - Updated dependencies [008d112]
122
+ - @prosopo/types@3.2.1
123
+ - @prosopo/procaptcha-common@2.8.6
124
+ - @prosopo/widget-skeleton@2.6.14
125
+ - @prosopo/procaptcha@2.8.6
126
+ - @prosopo/common@3.1.13
127
+ - @prosopo/locale@3.1.13
128
+ - @prosopo/util@3.0.16
129
+ - @prosopo/config@3.1.13
130
+
131
+ ## 2.8.5
132
+ ### Patch Changes
133
+
134
+ - 0824221: Release 3.2.4
135
+ - Updated dependencies [cf48565]
136
+ - Updated dependencies [0824221]
137
+ - Updated dependencies [72810f4]
138
+ - @prosopo/types@3.2.0
139
+ - @prosopo/procaptcha-common@2.8.5
140
+ - @prosopo/widget-skeleton@2.6.13
141
+ - @prosopo/procaptcha@2.8.5
142
+ - @prosopo/common@3.1.12
143
+ - @prosopo/locale@3.1.12
144
+ - @prosopo/util@3.0.15
145
+ - @prosopo/config@3.1.12
146
+
147
+ ## 2.8.4
148
+ ### Patch Changes
149
+
150
+ - 1a23649: Release 3.2.3
151
+ - Updated dependencies [0d1a33e]
152
+ - Updated dependencies [0d1a33e]
153
+ - Updated dependencies [1a23649]
154
+ - @prosopo/locale@3.1.11
155
+ - @prosopo/types@3.1.4
156
+ - @prosopo/procaptcha-common@2.8.4
157
+ - @prosopo/widget-skeleton@2.6.12
158
+ - @prosopo/procaptcha@2.8.4
159
+ - @prosopo/common@3.1.11
160
+ - @prosopo/util@3.0.14
161
+ - @prosopo/config@3.1.11
162
+
163
+ ## 2.8.3
164
+ ### Patch Changes
165
+
166
+ - 657a827: Release 3.2.2
167
+ - Updated dependencies [657a827]
168
+ - @prosopo/procaptcha-common@2.8.3
169
+ - @prosopo/widget-skeleton@2.6.11
170
+ - @prosopo/procaptcha@2.8.3
171
+ - @prosopo/common@3.1.10
172
+ - @prosopo/locale@3.1.10
173
+ - @prosopo/types@3.1.3
174
+ - @prosopo/util@3.0.13
175
+ - @prosopo/config@3.1.10
176
+
177
+ ## 2.8.2
178
+ ### Patch Changes
179
+
180
+ - 4440947: fix type-only tsc compilation
181
+ - 7bdaca6: Release 3.2.1
182
+ - Updated dependencies [4440947]
183
+ - Updated dependencies [7bdaca6]
184
+ - Updated dependencies [809b984]
185
+ - Updated dependencies [1249ce0]
186
+ - Updated dependencies [809b984]
187
+ - @prosopo/procaptcha-common@2.8.2
188
+ - @prosopo/widget-skeleton@2.6.10
189
+ - @prosopo/procaptcha@2.8.2
190
+ - @prosopo/common@3.1.9
191
+ - @prosopo/locale@3.1.9
192
+ - @prosopo/types@3.1.2
193
+ - @prosopo/util@3.0.12
194
+ - @prosopo/config@3.1.9
195
+
196
+ ## 2.8.1
197
+ ### Patch Changes
198
+
199
+ - 6fe8570: Release 3.2.0
200
+ - Updated dependencies [1f980c4]
201
+ - Updated dependencies [6fe8570]
202
+ - @prosopo/types@3.1.1
203
+ - @prosopo/procaptcha-common@2.8.1
204
+ - @prosopo/widget-skeleton@2.6.9
205
+ - @prosopo/procaptcha@2.8.1
206
+ - @prosopo/common@3.1.8
207
+ - @prosopo/locale@3.1.8
208
+ - @prosopo/util@3.0.11
209
+ - @prosopo/config@3.1.8
210
+
211
+ ## 2.8.0
212
+ ### Minor Changes
213
+
214
+ - 8bdc7f0: Using detector to select provider
215
+
216
+ ### Patch Changes
217
+
218
+ - f304be9: Release 3.1.13
219
+ - Updated dependencies [f304be9]
220
+ - Updated dependencies [8bdc7f0]
221
+ - @prosopo/procaptcha-common@2.8.0
222
+ - @prosopo/widget-skeleton@2.6.8
223
+ - @prosopo/procaptcha@2.8.0
224
+ - @prosopo/common@3.1.7
225
+ - @prosopo/locale@3.1.7
226
+ - @prosopo/types@3.1.0
227
+ - @prosopo/util@3.0.10
228
+ - @prosopo/config@3.1.7
229
+
230
+ ## 2.7.0
231
+ ### Minor Changes
232
+
233
+ - b4442f0: Add image retry mechanism
234
+
235
+ ### Patch Changes
236
+
237
+ - 9eed772: Release 3.1.12
238
+ - a07db04: Release 3.1.12
239
+ - Updated dependencies [9eed772]
240
+ - Updated dependencies [a07db04]
241
+ - Updated dependencies [ebb0168]
242
+ - @prosopo/config@3.1.6
243
+ - @prosopo/procaptcha@2.7.25
244
+ - @prosopo/util@3.0.9
245
+ - @prosopo/common@3.1.6
246
+ - @prosopo/locale@3.1.6
247
+ - @prosopo/procaptcha-common@2.7.18
248
+ - @prosopo/types@3.0.10
249
+ - @prosopo/widget-skeleton@2.6.7
250
+
251
+ ## 2.6.38
252
+ ### Patch Changes
253
+
254
+ - @prosopo/procaptcha@2.7.24
255
+
256
+ ## 2.6.37
257
+ ### Patch Changes
258
+
259
+ - 6960643: lint detect missing and unneccessary imports
260
+ - Updated dependencies [d8e855c]
261
+ - Updated dependencies [6960643]
262
+ - @prosopo/locale@3.1.5
263
+ - @prosopo/procaptcha-common@2.7.17
264
+ - @prosopo/widget-skeleton@2.6.6
265
+ - @prosopo/procaptcha@2.7.23
266
+ - @prosopo/common@3.1.5
267
+ - @prosopo/types@3.0.9
268
+ - @prosopo/util@3.0.8
269
+
270
+ ## 2.6.36
271
+ ### Patch Changes
272
+
273
+ - 30e7d4d: Fixing coverage report and more damn linting
274
+ - Updated dependencies [30e7d4d]
275
+ - @prosopo/procaptcha-common@2.7.16
276
+ - @prosopo/config@3.1.5
277
+ - @prosopo/procaptcha@2.7.22
278
+ - @prosopo/common@3.1.4
279
+ - @prosopo/locale@3.1.4
280
+ - @prosopo/types@3.0.8
281
+ - @prosopo/util@3.0.7
282
+ - @prosopo/widget-skeleton@2.6.5
283
+
284
+ ## 2.6.35
285
+ ### Patch Changes
286
+
287
+ - 1f3a02f: Release 3.1.8
288
+ - Updated dependencies [1f3a02f]
289
+ - @prosopo/procaptcha-common@2.7.15
290
+ - @prosopo/procaptcha@2.7.21
291
+
292
+ ## 2.6.34
293
+ ### Patch Changes
294
+
295
+ - 926df8a: lint
296
+ - Updated dependencies [926df8a]
297
+ - @prosopo/procaptcha-common@2.7.14
298
+ - @prosopo/procaptcha@2.7.20
299
+
300
+ ## 2.6.33
301
+ ### Patch Changes
302
+
303
+ - Updated dependencies [44ffda2]
304
+ - Updated dependencies [a49b538]
305
+ - @prosopo/config@3.1.4
306
+ - @prosopo/common@3.1.3
307
+ - @prosopo/locale@3.1.3
308
+ - @prosopo/procaptcha@2.7.19
309
+ - @prosopo/procaptcha-common@2.7.13
310
+ - @prosopo/types@3.0.7
311
+ - @prosopo/util@3.0.6
312
+ - @prosopo/widget-skeleton@2.6.4
313
+
3
314
  ## 2.6.32
4
315
  ### Patch Changes
5
316
 
@@ -66,6 +66,9 @@ const Button = ({
66
66
  onMouseLeave: () => setHover(false),
67
67
  style: buttonStyle,
68
68
  onClick: (e) => {
69
+ if (!e.isTrusted) {
70
+ return;
71
+ }
69
72
  e.preventDefault();
70
73
  onClick();
71
74
  },
@@ -153,10 +153,9 @@ const CaptchaComponent = ({
153
153
  // expand to full height / width of parent
154
154
  width: "100%",
155
155
  height: "100%",
156
- // display children in flex, spreading them evenly and wrapping when row length exceeded
156
+ // display children in flex, spreading them evenly
157
157
  display: "flex",
158
158
  flexDirection: "row",
159
- flexWrap: "wrap",
160
159
  justifyContent: "space-between",
161
160
  gap: "10px"
162
161
  },
@@ -62,7 +62,20 @@ const CaptchaWidget = ({
62
62
  padding: 0,
63
63
  margin: 0
64
64
  },
65
- onClick: () => onClick(hash),
65
+ onClick: (e) => {
66
+ if (!e.isTrusted) {
67
+ return;
68
+ }
69
+ if ("touches" in e && e.touches.length > 0 && e.touches[0]) {
70
+ onClick(hash, e.touches[0].clientX, e.touches[0].clientY);
71
+ return;
72
+ }
73
+ if ("clientX" in e && "clientY" in e) {
74
+ onClick(hash, e.clientX, e.clientY);
75
+ return;
76
+ }
77
+ onClick(hash, 0, 0);
78
+ },
66
79
  children: [
67
80
  /* @__PURE__ */ jsxRuntime.jsx(
68
81
  "img",
@@ -84,7 +97,14 @@ const CaptchaWidget = ({
84
97
  borderColor: theme.palette.grey[300]
85
98
  },
86
99
  src: item.data,
87
- alt: `Captcha image ${index + 1}`
100
+ alt: `Captcha image ${index + 1}`,
101
+ onError: (e) => {
102
+ const target = e.currentTarget;
103
+ target._retryCount = (target._retryCount || 0) + 1;
104
+ if (target._retryCount <= 3) {
105
+ target.src = `${item.data}?retry=${Date.now()}`;
106
+ }
107
+ }
88
108
  }
89
109
  ),
90
110
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -104,7 +124,7 @@ const CaptchaWidget = ({
104
124
  justifyContent: "center",
105
125
  // make bg half opacity, i.e. shadowing the item's img
106
126
  backgroundColor: "rgba(0,0,0,0.5)",
107
- visibility: solution.includes(hash) ? "visible" : "hidden"
127
+ visibility: solution.some((s) => s[0] === hash) ? "visible" : "hidden"
108
128
  },
109
129
  children: /* @__PURE__ */ jsxRuntime.jsx(
110
130
  "svg",
@@ -106,7 +106,10 @@ const ProcaptchaWidget = (props) => {
106
106
  procaptchaCommon.Checkbox,
107
107
  {
108
108
  theme,
109
- onChange: async () => {
109
+ onChange: async (e) => {
110
+ if (!e.isTrusted) {
111
+ return;
112
+ }
110
113
  if (loading) {
111
114
  return;
112
115
  }
@@ -65,6 +65,9 @@ const Button = ({
65
65
  onMouseLeave: () => setHover(false),
66
66
  style: buttonStyle,
67
67
  onClick: (e) => {
68
+ if (!e.isTrusted) {
69
+ return;
70
+ }
68
71
  e.preventDefault();
69
72
  onClick();
70
73
  },
@@ -152,10 +152,9 @@ const CaptchaComponent = ({
152
152
  // expand to full height / width of parent
153
153
  width: "100%",
154
154
  height: "100%",
155
- // display children in flex, spreading them evenly and wrapping when row length exceeded
155
+ // display children in flex, spreading them evenly
156
156
  display: "flex",
157
157
  flexDirection: "row",
158
- flexWrap: "wrap",
159
158
  justifyContent: "space-between",
160
159
  gap: "10px"
161
160
  },
@@ -60,7 +60,20 @@ const CaptchaWidget = ({
60
60
  padding: 0,
61
61
  margin: 0
62
62
  },
63
- onClick: () => onClick(hash),
63
+ onClick: (e) => {
64
+ if (!e.isTrusted) {
65
+ return;
66
+ }
67
+ if ("touches" in e && e.touches.length > 0 && e.touches[0]) {
68
+ onClick(hash, e.touches[0].clientX, e.touches[0].clientY);
69
+ return;
70
+ }
71
+ if ("clientX" in e && "clientY" in e) {
72
+ onClick(hash, e.clientX, e.clientY);
73
+ return;
74
+ }
75
+ onClick(hash, 0, 0);
76
+ },
64
77
  children: [
65
78
  /* @__PURE__ */ jsx(
66
79
  "img",
@@ -82,7 +95,14 @@ const CaptchaWidget = ({
82
95
  borderColor: theme.palette.grey[300]
83
96
  },
84
97
  src: item.data,
85
- alt: `Captcha image ${index + 1}`
98
+ alt: `Captcha image ${index + 1}`,
99
+ onError: (e) => {
100
+ const target = e.currentTarget;
101
+ target._retryCount = (target._retryCount || 0) + 1;
102
+ if (target._retryCount <= 3) {
103
+ target.src = `${item.data}?retry=${Date.now()}`;
104
+ }
105
+ }
86
106
  }
87
107
  ),
88
108
  /* @__PURE__ */ jsx(
@@ -102,7 +122,7 @@ const CaptchaWidget = ({
102
122
  justifyContent: "center",
103
123
  // make bg half opacity, i.e. shadowing the item's img
104
124
  backgroundColor: "rgba(0,0,0,0.5)",
105
- visibility: solution.includes(hash) ? "visible" : "hidden"
125
+ visibility: solution.some((s) => s[0] === hash) ? "visible" : "hidden"
106
126
  },
107
127
  children: /* @__PURE__ */ jsx(
108
128
  "svg",
@@ -105,7 +105,10 @@ const ProcaptchaWidget = (props) => {
105
105
  Checkbox,
106
106
  {
107
107
  theme,
108
- onChange: async () => {
108
+ onChange: async (e) => {
109
+ if (!e.isTrusted) {
110
+ return;
111
+ }
109
112
  if (loading) {
110
113
  return;
111
114
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prosopo/procaptcha-react",
3
- "version": "2.6.32",
3
+ "version": "2.9.5",
4
4
  "author": "PROSOPO LIMITED <info@prosopo.io>",
5
5
  "license": "Apache-2.0",
6
6
  "main": "dist/index.js",
@@ -24,26 +24,21 @@
24
24
  "build": "NODE_ENV=${NODE_ENV:-development}; vite build --config vite.esm.config.ts --mode $NODE_ENV",
25
25
  "build:tsc": "tsc --build --verbose",
26
26
  "build:cjs": "NODE_ENV=${NODE_ENV:-development}; vite build --config vite.cjs.config.ts --mode $NODE_ENV",
27
- "typecheck": "tsc --build --declaration --emitDeclarationOnly"
27
+ "typecheck": "tsc --project tsconfig.types.json"
28
28
  },
29
29
  "browserslist": ["> 0.5%, last 2 versions, not dead"],
30
30
  "dependencies": {
31
- "@prosopo/common": "3.1.2",
32
- "@prosopo/locale": "3.1.2",
33
- "@prosopo/procaptcha": "2.7.18",
34
- "@prosopo/procaptcha-common": "2.7.12",
35
- "@prosopo/types": "3.0.6",
36
- "@prosopo/util": "3.0.5",
37
- "@prosopo/widget-skeleton": "2.6.3",
38
- "@typegoose/auto-increment": "4.13.0",
39
- "axios": "1.10.0",
31
+ "@prosopo/common": "3.1.20",
32
+ "@prosopo/config": "3.1.20",
33
+ "@prosopo/locale": "3.1.20",
34
+ "@prosopo/procaptcha": "2.9.5",
35
+ "@prosopo/procaptcha-common": "2.9.5",
36
+ "@prosopo/types": "3.5.3",
37
+ "@prosopo/util": "3.1.5",
38
+ "@prosopo/widget-skeleton": "2.7.6",
40
39
  "csstype": "3.1.3",
41
- "esbuild": "0.25.6",
42
- "express": "4.21.2",
43
- "@prosopo/config": "3.1.3",
44
- "openpgp": "5.11.3",
45
40
  "react": "18.3.1",
46
- "webpack-dev-server": "5.2.2"
41
+ "react-dom": "18.3.1"
47
42
  },
48
43
  "overrides": {
49
44
  "@polkadot/extension-inject": {
@@ -58,6 +53,9 @@
58
53
  }
59
54
  },
60
55
  "devDependencies": {
56
+ "@emotion/react": "11.11.1",
57
+ "@types/node": "22.10.2",
58
+ "@types/react-dom": "18.3.1",
61
59
  "@vitest/coverage-v8": "3.0.9",
62
60
  "concurrently": "9.0.1",
63
61
  "del-cli": "6.0.0",