@graphcommerce/googlerecaptcha 2.1.5 → 2.1.8
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 +25 -0
- package/hooks/useGoogleRecaptcha.tsx +8 -2
- package/link/recaptchaLink.ts +2 -2
- package/package.json +7 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,30 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
+
## 2.1.8
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#1490](https://github.com/graphcommerce-org/graphcommerce/pull/1490) [`d311ef48b`](https://github.com/graphcommerce-org/graphcommerce/commit/d311ef48bb3e97806d992af5516d6b7f183ec9cb) Thanks [@paales](https://github.com/paales)! - upgraded packages
|
|
8
|
+
|
|
9
|
+
- Updated dependencies [[`d311ef48b`](https://github.com/graphcommerce-org/graphcommerce/commit/d311ef48bb3e97806d992af5516d6b7f183ec9cb)]:
|
|
10
|
+
- @graphcommerce/graphql@3.2.1
|
|
11
|
+
|
|
12
|
+
## 2.1.7
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- [#1495](https://github.com/graphcommerce-org/graphcommerce/pull/1495) [`d6d3a750e`](https://github.com/graphcommerce-org/graphcommerce/commit/d6d3a750ee15c40ba022f29b923a1b872a4796ea) Thanks [@paales](https://github.com/paales)! - Solve updating state in render
|
|
17
|
+
|
|
18
|
+
- Updated dependencies [[`bed806ddd`](https://github.com/graphcommerce-org/graphcommerce/commit/bed806dddd7e025806a69798ef9587aa165d392f)]:
|
|
19
|
+
- @graphcommerce/graphql@3.2.0
|
|
20
|
+
|
|
21
|
+
## 2.1.6
|
|
22
|
+
|
|
23
|
+
### Patch Changes
|
|
24
|
+
|
|
25
|
+
- Updated dependencies []:
|
|
26
|
+
- @graphcommerce/graphql@3.1.3
|
|
27
|
+
|
|
3
28
|
## 2.1.5
|
|
4
29
|
|
|
5
30
|
### Patch Changes
|
|
@@ -1,4 +1,10 @@
|
|
|
1
|
-
import { useContext } from 'react'
|
|
1
|
+
import { useContext, useEffect } from 'react'
|
|
2
2
|
import { recaptchaContext } from '../context/recaptchaContext'
|
|
3
3
|
|
|
4
|
-
export const useGoogleRecaptcha = () =>
|
|
4
|
+
export const useGoogleRecaptcha = () => {
|
|
5
|
+
const context = useContext(recaptchaContext)
|
|
6
|
+
|
|
7
|
+
useEffect(() => {
|
|
8
|
+
if (context.enabled) context.enable?.()
|
|
9
|
+
}, [context])
|
|
10
|
+
}
|
package/link/recaptchaLink.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { GraphQLRequest, setContext } from '@graphcommerce/graphql'
|
|
1
|
+
import { ClientContext, GraphQLRequest, setContext } from '@graphcommerce/graphql'
|
|
2
2
|
|
|
3
3
|
const isMutation = (operation: GraphQLRequest) =>
|
|
4
4
|
operation.query.definitions.some(
|
|
@@ -7,7 +7,7 @@ const isMutation = (operation: GraphQLRequest) =>
|
|
|
7
7
|
)
|
|
8
8
|
|
|
9
9
|
/** Apollo link that adds the Google reCAPTCHA token to the request context. */
|
|
10
|
-
export const recaptchaLink = setContext(async (operation, context) => {
|
|
10
|
+
export const recaptchaLink = setContext(async (operation, context: ClientContext) => {
|
|
11
11
|
const recaptchaKey = process.env.NEXT_PUBLIC_GOOGLE_RECAPTCHA_V3_SITE_KEY
|
|
12
12
|
if (!recaptchaKey || !globalThis.grecaptcha || !isMutation(operation)) return context
|
|
13
13
|
|
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": "2.1.
|
|
5
|
+
"version": "2.1.8",
|
|
6
6
|
"sideEffects": false,
|
|
7
7
|
"prettier": "@graphcommerce/prettier-config-pwa",
|
|
8
8
|
"eslintConfig": {
|
|
@@ -12,19 +12,19 @@
|
|
|
12
12
|
}
|
|
13
13
|
},
|
|
14
14
|
"devDependencies": {
|
|
15
|
-
"@graphcommerce/eslint-config-pwa": "^4.1.
|
|
15
|
+
"@graphcommerce/eslint-config-pwa": "^4.1.8",
|
|
16
16
|
"@graphcommerce/prettier-config-pwa": "^4.0.6",
|
|
17
|
-
"@graphcommerce/typescript-config-pwa": "^4.0.
|
|
17
|
+
"@graphcommerce/typescript-config-pwa": "^4.0.3",
|
|
18
18
|
"@playwright/test": "^1.21.1",
|
|
19
19
|
"@types/grecaptcha": "^3.0.4"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@graphcommerce/graphql": "3.1
|
|
22
|
+
"@graphcommerce/graphql": "3.2.1"
|
|
23
23
|
},
|
|
24
24
|
"peerDependencies": {
|
|
25
|
-
"next": "12.1.2",
|
|
26
|
-
"react": "^
|
|
27
|
-
"react-dom": "^
|
|
25
|
+
"next": "^12.1.2",
|
|
26
|
+
"react": "^18.0.0",
|
|
27
|
+
"react-dom": "^18.0.0",
|
|
28
28
|
"@mui/material": "5.5.3"
|
|
29
29
|
}
|
|
30
30
|
}
|