@graphcommerce/googlerecaptcha 8.0.6-canary.4 → 8.1.0-canary.10
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 +17 -0
- package/link/recaptchaLink.ts +16 -1
- package/package.json +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
+
## 8.1.0-canary.10
|
|
4
|
+
|
|
5
|
+
## 8.1.0-canary.9
|
|
6
|
+
|
|
7
|
+
## 8.1.0-canary.8
|
|
8
|
+
|
|
9
|
+
## 8.1.0-canary.7
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [#2245](https://github.com/graphcommerce-org/graphcommerce/pull/2245) [`898224c`](https://github.com/graphcommerce-org/graphcommerce/commit/898224c0343dd195ab2574218475834469182315) - Solve an issue where the grecaptcha.execute method would throw ‘null’ causing the checkout to break in unexpected ways.
|
|
14
|
+
([@paales](https://github.com/paales))
|
|
15
|
+
|
|
16
|
+
## 8.1.0-canary.6
|
|
17
|
+
|
|
18
|
+
## 8.1.0-canary.5
|
|
19
|
+
|
|
3
20
|
## 8.0.6-canary.4
|
|
4
21
|
|
|
5
22
|
## 8.0.6-canary.3
|
package/link/recaptchaLink.ts
CHANGED
|
@@ -16,7 +16,22 @@ export const recaptchaLink = setContext(async (operation, context) => {
|
|
|
16
16
|
globalThis.grecaptcha?.ready(resolve)
|
|
17
17
|
})
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
let token: string | null = null
|
|
20
|
+
let failure = 0
|
|
21
|
+
while (failure < 5) {
|
|
22
|
+
try {
|
|
23
|
+
// eslint-disable-next-line no-await-in-loop
|
|
24
|
+
token = await globalThis.grecaptcha.execute(recaptchaKey, { action: 'submit' })
|
|
25
|
+
break
|
|
26
|
+
} catch {
|
|
27
|
+
failure++
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
if (!token) {
|
|
32
|
+
console.error('Failed to get reCAPTCHA token after 5 attempts')
|
|
33
|
+
return context
|
|
34
|
+
}
|
|
20
35
|
|
|
21
36
|
if (!context.headers) context.headers = {}
|
|
22
37
|
context.headers['X-ReCaptcha'] = token
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@graphcommerce/googlerecaptcha",
|
|
3
3
|
"homepage": "https://www.graphcommerce.org/",
|
|
4
4
|
"repository": "github:graphcommerce-org/graphcommerce",
|
|
5
|
-
"version": "8.0
|
|
5
|
+
"version": "8.1.0-canary.10",
|
|
6
6
|
"sideEffects": false,
|
|
7
7
|
"prettier": "@graphcommerce/prettier-config-pwa",
|
|
8
8
|
"eslintConfig": {
|
|
@@ -15,11 +15,11 @@
|
|
|
15
15
|
"@types/grecaptcha": "^3.0.7"
|
|
16
16
|
},
|
|
17
17
|
"peerDependencies": {
|
|
18
|
-
"@graphcommerce/eslint-config-pwa": "^8.0
|
|
19
|
-
"@graphcommerce/graphql": "^8.0
|
|
20
|
-
"@graphcommerce/next-ui": "^8.0
|
|
21
|
-
"@graphcommerce/prettier-config-pwa": "^8.0
|
|
22
|
-
"@graphcommerce/typescript-config-pwa": "^8.0
|
|
18
|
+
"@graphcommerce/eslint-config-pwa": "^8.1.0-canary.10",
|
|
19
|
+
"@graphcommerce/graphql": "^8.1.0-canary.10",
|
|
20
|
+
"@graphcommerce/next-ui": "^8.1.0-canary.10",
|
|
21
|
+
"@graphcommerce/prettier-config-pwa": "^8.1.0-canary.10",
|
|
22
|
+
"@graphcommerce/typescript-config-pwa": "^8.1.0-canary.10",
|
|
23
23
|
"@mui/material": "^5.10.16",
|
|
24
24
|
"next": "*",
|
|
25
25
|
"react": "^18.2.0",
|