@graphcommerce/googlerecaptcha 9.0.0-canary.115 → 9.0.0-canary.117
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
package/index.ts
CHANGED
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": "9.0.0-canary.
|
|
5
|
+
"version": "9.0.0-canary.117",
|
|
6
6
|
"sideEffects": false,
|
|
7
7
|
"prettier": "@graphcommerce/prettier-config-pwa",
|
|
8
8
|
"eslintConfig": {
|
|
@@ -15,11 +15,11 @@
|
|
|
15
15
|
"@types/grecaptcha": "^3.0.9"
|
|
16
16
|
},
|
|
17
17
|
"peerDependencies": {
|
|
18
|
-
"@graphcommerce/eslint-config-pwa": "^9.0.0-canary.
|
|
19
|
-
"@graphcommerce/graphql": "^9.0.0-canary.
|
|
20
|
-
"@graphcommerce/next-ui": "^9.0.0-canary.
|
|
21
|
-
"@graphcommerce/prettier-config-pwa": "^9.0.0-canary.
|
|
22
|
-
"@graphcommerce/typescript-config-pwa": "^9.0.0-canary.
|
|
18
|
+
"@graphcommerce/eslint-config-pwa": "^9.0.0-canary.117",
|
|
19
|
+
"@graphcommerce/graphql": "^9.0.0-canary.117",
|
|
20
|
+
"@graphcommerce/next-ui": "^9.0.0-canary.117",
|
|
21
|
+
"@graphcommerce/prettier-config-pwa": "^9.0.0-canary.117",
|
|
22
|
+
"@graphcommerce/typescript-config-pwa": "^9.0.0-canary.117",
|
|
23
23
|
"@mui/material": "^5.10.16",
|
|
24
24
|
"graphql": "^16.9.0",
|
|
25
25
|
"next": "*",
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import React, { useMemo, useState } from 'react'
|
|
2
|
-
import type { RecaptchaContext } from '../context/recaptchaContext'
|
|
3
|
-
import { recaptchaContext } from '../context/recaptchaContext'
|
|
4
|
-
import { GoogleRecaptchaV3Script } from './GoogleRecaptchaV3Script'
|
|
5
|
-
|
|
6
|
-
export function GoogleRecaptchaProvider(props: { children: React.ReactNode }) {
|
|
7
|
-
const { children } = props
|
|
8
|
-
|
|
9
|
-
const [enabled, setEnabled] = useState(false)
|
|
10
|
-
|
|
11
|
-
const context: RecaptchaContext = useMemo(
|
|
12
|
-
() => ({ enabled, enable: () => setEnabled(true) }),
|
|
13
|
-
[enabled],
|
|
14
|
-
)
|
|
15
|
-
|
|
16
|
-
return (
|
|
17
|
-
<recaptchaContext.Provider value={context}>
|
|
18
|
-
<GoogleRecaptchaV3Script />
|
|
19
|
-
{children}
|
|
20
|
-
</recaptchaContext.Provider>
|
|
21
|
-
)
|
|
22
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { GlobalStyles } from '@mui/material'
|
|
2
|
-
import Script from 'next/script'
|
|
3
|
-
import { useContext } from 'react'
|
|
4
|
-
import { recaptchaContext } from '../context/recaptchaContext'
|
|
5
|
-
import { useGoogleRecaptchaSiteKey } from '../hooks/useGoogleRecaptchaSiteKey'
|
|
6
|
-
|
|
7
|
-
export function GoogleRecaptchaV3Script() {
|
|
8
|
-
const { enabled } = useContext(recaptchaContext)
|
|
9
|
-
|
|
10
|
-
const siteKey = useGoogleRecaptchaSiteKey()
|
|
11
|
-
if (!enabled) return null
|
|
12
|
-
|
|
13
|
-
return (
|
|
14
|
-
<>
|
|
15
|
-
<Script
|
|
16
|
-
key='google-recaptcha-v3'
|
|
17
|
-
strategy='lazyOnload'
|
|
18
|
-
src={`https://www.google.com/recaptcha/api.js?render=${siteKey}`}
|
|
19
|
-
/>
|
|
20
|
-
<GlobalStyles styles={{ '.grecaptcha-badge': { visibility: 'hidden' } }} />
|
|
21
|
-
</>
|
|
22
|
-
)
|
|
23
|
-
}
|