@gahojin-inc/react-google-recaptcha 2025.9.1 → 2025.10.1

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/README.md ADDED
@@ -0,0 +1,54 @@
1
+ # react-google-recaptcha
2
+
3
+ [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
4
+ [![NPM Version](https://img.shields.io/npm/v/%40gahojin-inc%2Freact-google-recaptcha?activeTab=versions)](https://www.npmjs.com/package/@gahojin-inc/react-google-recaptcha)
5
+
6
+ Google ReCaptcha V2/V3をReact Hooksとして提供するライブラリ
7
+
8
+ ## 使い方
9
+
10
+ ```javascript
11
+ import { GoogleReCaptchaProvider } from '@gahojin-inc/react-google-recaptcha'
12
+
13
+ const App = () => {
14
+ return (
15
+ <GoogleReCaptchaProvider siteKey={siteKey} language="ja">
16
+ <Example />
17
+ </GoogleReCaptchaProvider>
18
+ )
19
+ }
20
+ ```
21
+
22
+ ```javascript
23
+ import { useGoogleRecaptcha } from '@gahojin-inc/react-google-recaptcha'
24
+
25
+ const Example = () => {
26
+ const { isLoading, execute } = useGoogleRecaptcha()
27
+
28
+ const handleClick = useCallback(async () => {
29
+ const token = await execute('action')
30
+ console.log(token)
31
+ }, [execute])
32
+ }
33
+ ```
34
+
35
+
36
+ ## ライセンス
37
+
38
+ [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0)
39
+
40
+ ```
41
+ Copyright 2025, GAHOJIN, Inc.
42
+
43
+ Licensed under the Apache License, Version 2.0 (the "License");
44
+ you may not use this file except in compliance with the License.
45
+ You may obtain a copy of the License at
46
+
47
+ http://www.apache.org/licenses/LICENSE-2.0
48
+
49
+ Unless required by applicable law or agreed to in writing, software
50
+ distributed under the License is distributed on an "AS IS" BASIS,
51
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
52
+ See the License for the specific language governing permissions and
53
+ limitations under the License.
54
+ ```
package/dist/index.mjs CHANGED
@@ -3,9 +3,7 @@ import { jsx, jsxs } from "react/jsx-runtime";
3
3
 
4
4
  //#region src/utils.ts
5
5
  const getRecaptchaScriptSrc = (render, language, useRecaptchaNet, useEnterprise) => {
6
- const hostName = useRecaptchaNet ? "recaptcha.net" : "google.com";
7
- const script = useEnterprise ? "enterprise.js" : "api.js";
8
- return `https://${hostName}/recaptcha/${script}?render=${render}${language ? `&hl=${language}` : ""}`;
6
+ return `https://${useRecaptchaNet ? "recaptcha.net" : "google.com"}/recaptcha/${useEnterprise ? "enterprise.js" : "api.js"}?render=${render}${language ? `&hl=${language}` : ""}`;
9
7
  };
10
8
  const injectScriptTag = (scriptId, language, useRecaptchaNet, useEnterprise, onLoad) => {
11
9
  const script = document.createElement("script");
@@ -106,7 +104,7 @@ const GoogleReCaptchaProvider = ({ siteKey, language, useRecaptchaNet, useEnterp
106
104
  successHandler.current = resolve;
107
105
  errorHandler.current = reject;
108
106
  });
109
- return instance.execute(widgetId.current, action ? { action } : void 0).then((token) => {
107
+ return Promise.resolve(instance.execute(widgetId.current, action ? { action } : void 0)).then((token) => {
110
108
  if (token) handleSuccess(token);
111
109
  return promise;
112
110
  });
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":["GoogleReCaptchaContext: Context<GoogleReCaptchaContextType>","value: GoogleReCaptchaContextType"],"sources":["../src/utils.ts","../src/context.tsx","../src/hooks.ts"],"sourcesContent":["export const getRecaptchaScriptSrc = (\n render: string,\n language: string | null | undefined,\n useRecaptchaNet: boolean | undefined,\n useEnterprise: boolean | undefined,\n): string => {\n const hostName = useRecaptchaNet ? 'recaptcha.net' : 'google.com'\n const script = useEnterprise ? 'enterprise.js' : 'api.js'\n\n return `https://${hostName}/recaptcha/${script}?render=${render}${language ? `&hl=${language}` : ''}`\n}\n\nexport const injectScriptTag = (\n scriptId: string,\n language: string | null | undefined,\n useRecaptchaNet: boolean | undefined,\n useEnterprise: boolean | undefined,\n onLoad: () => void,\n): (() => void) => {\n const script = document.createElement('script')\n script.type = 'text/javascript'\n script.id = scriptId\n script.src = getRecaptchaScriptSrc('explicit', language, useRecaptchaNet, useEnterprise)\n script.async = true\n script.defer = true\n script.onload = onLoad\n\n document.head.appendChild(script)\n return () => {\n document.head.removeChild(script)\n }\n}\n\nexport const removeScriptTag = (): void => {\n removeRecaptchBadge()\n\n const script = document.querySelector('script[src^=\"https://www.gstatic.com/recaptcha/releases\"]')\n if (script) {\n script.remove()\n }\n}\n\nexport const removeRecaptchBadge = (): void => {\n const nodeBadge = document.querySelector('.grecaptcha-badge')\n if (nodeBadge?.parentNode) {\n document.body.removeChild(nodeBadge.parentNode)\n }\n}\n","import { type Context, createContext, type JSX, useCallback, useEffect, useId, useMemo, useRef, useState } from 'react'\nimport type { GoogleReCaptchaContextType, GoogleReCaptchaProviderProps, Grecaptcha } from './types'\nimport { injectScriptTag, removeScriptTag } from './utils.ts'\n\nconst GoogleReCaptchaContext: Context<GoogleReCaptchaContextType> = createContext<GoogleReCaptchaContextType>({\n isLoading: true,\n error: null,\n execute: () => Promise.reject('useGoogleRecaptcha must be used within an GoogleReCaptchaProvider'),\n reset: () => [],\n})\n\ntype State = {\n isLoading: boolean\n error?: Error | null\n}\n\nconst GoogleReCaptchaProvider = ({\n siteKey,\n language,\n useRecaptchaNet,\n useEnterprise,\n container,\n badge,\n theme,\n children,\n}: GoogleReCaptchaProviderProps): JSX.Element => {\n const id = useId()\n const containerId = useMemo(() => (container ? container : `${id}-container`), [id, container])\n const [state, setState] = useState<State>({ isLoading: true })\n\n const widgetId = useRef<string>(siteKey)\n const grecaptcha = useRef<Grecaptcha>(null)\n const scriptLoaded = useRef(false)\n const successHandler = useRef<(token: string) => void>(null)\n const errorHandler = useRef<(error: Error | undefined) => void>(null)\n\n const handleSuccess = useCallback((token: string) => {\n if (successHandler.current) {\n successHandler.current?.(token)\n // トークンを再度取得できるよう、リセットする\n grecaptcha.current?.reset(widgetId.current)\n successHandler.current = null\n errorHandler.current = null\n }\n }, [])\n\n const handleError = useCallback((error: Error | undefined) => {\n if (errorHandler.current) {\n errorHandler.current?.(error)\n successHandler.current = null\n errorHandler.current = null\n }\n }, [])\n\n // ReCaptcha初期化\n const onLoad = useCallback(() => {\n const instance = window.grecaptcha?.enterprise ?? window.grecaptcha\n if (!instance) {\n setState({\n isLoading: false,\n error: new Error('reCaptcha is not available'),\n })\n return\n }\n\n // 二重にrender実行されることを抑止\n if (scriptLoaded.current) {\n return\n }\n scriptLoaded.current = true\n\n instance.ready(() => {\n widgetId.current = instance.render(containerId, {\n sitekey: siteKey,\n badge,\n theme,\n size: 'invisible',\n callback: handleSuccess,\n 'error-callback': handleError,\n })\n grecaptcha.current = instance\n setState({\n error: null,\n isLoading: false,\n })\n })\n }, [siteKey, containerId, badge, theme, handleSuccess, handleError])\n\n const reset = useCallback(() => {\n grecaptcha.current?.reset(widgetId.current)\n }, [])\n\n const execute = useCallback(\n (action?: string) => {\n const instance = grecaptcha.current\n if (instance?.execute) {\n const promise = new Promise<string>((resolve, reject) => {\n successHandler.current = resolve\n errorHandler.current = reject\n })\n return instance.execute(widgetId.current, action ? { action } : undefined).then((token) => {\n if (token) {\n handleSuccess(token)\n }\n // token = nullの場合、v2動作\n return promise\n })\n }\n return Promise.reject('ReCaptcha is not available')\n },\n [handleSuccess],\n )\n\n // scriptタグを追加/削除する\n useEffect(() => {\n const removeScript = injectScriptTag(id, language, useRecaptchaNet, useEnterprise, onLoad)\n return () => {\n removeScript()\n removeScriptTag()\n scriptLoaded.current = false\n }\n }, [id, language, useRecaptchaNet, useEnterprise, onLoad])\n\n const value: GoogleReCaptchaContextType = useMemo(\n () => ({\n isLoading: state.isLoading,\n error: state.error ?? null,\n execute,\n reset,\n }),\n [state, execute, reset],\n )\n\n return (\n <GoogleReCaptchaContext.Provider value={value}>\n {children}\n {container ? null : <div id={`${id}-container`} />}\n </GoogleReCaptchaContext.Provider>\n )\n}\n\nexport { GoogleReCaptchaProvider, GoogleReCaptchaContext }\nexport type { GoogleReCaptchaContextType, GoogleReCaptchaProviderProps }\n","import { useContext } from 'react'\nimport { GoogleReCaptchaContext, type GoogleReCaptchaContextType } from './context'\n\nconst useGoogleRecaptcha = (): GoogleReCaptchaContextType => {\n return useContext(GoogleReCaptchaContext)\n}\n\nexport { useGoogleRecaptcha }\n"],"mappings":";;;;AAAA,MAAa,yBACX,QACA,UACA,iBACA,kBACW;CACX,MAAM,WAAW,kBAAkB,kBAAkB;CACrD,MAAM,SAAS,gBAAgB,kBAAkB;AAEjD,QAAO,WAAW,SAAS,aAAa,OAAO,UAAU,SAAS,WAAW,OAAO,aAAa;;AAGnG,MAAa,mBACX,UACA,UACA,iBACA,eACA,WACiB;CACjB,MAAM,SAAS,SAAS,cAAc;AACtC,QAAO,OAAO;AACd,QAAO,KAAK;AACZ,QAAO,MAAM,sBAAsB,YAAY,UAAU,iBAAiB;AAC1E,QAAO,QAAQ;AACf,QAAO,QAAQ;AACf,QAAO,SAAS;AAEhB,UAAS,KAAK,YAAY;AAC1B,cAAa;AACX,WAAS,KAAK,YAAY;;;AAI9B,MAAa,wBAA8B;AACzC;CAEA,MAAM,SAAS,SAAS,cAAc;AACtC,KAAI,OACF,QAAO;;AAIX,MAAa,4BAAkC;CAC7C,MAAM,YAAY,SAAS,cAAc;AACzC,KAAI,WAAW,WACb,UAAS,KAAK,YAAY,UAAU;;;;;ACzCxC,MAAMA,yBAA8D,cAA0C;CAC5G,WAAW;CACX,OAAO;CACP,eAAe,QAAQ,OAAO;CAC9B,aAAa;;AAQf,MAAM,2BAA2B,EAC/B,SACA,UACA,iBACA,eACA,WACA,OACA,OACA,eAC+C;CAC/C,MAAM,KAAK;CACX,MAAM,cAAc,cAAe,YAAY,YAAY,GAAG,GAAG,aAAc,CAAC,IAAI;CACpF,MAAM,CAAC,OAAO,YAAY,SAAgB,EAAE,WAAW;CAEvD,MAAM,WAAW,OAAe;CAChC,MAAM,aAAa,OAAmB;CACtC,MAAM,eAAe,OAAO;CAC5B,MAAM,iBAAiB,OAAg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;CAElD,MAAMC,QAAoC,eACjC;EACL,WAAW,MAAM;EACjB,OAAO,MAAM,SAAS;EACtB;EACA;KAEF;EAAC;EAAO;EAAS;;AAGnB,QACE,qBAAC,uBAAuB;EAAgB;aACrC,UACA,YAAY,OAAO,oBAAC,SAAI,IAAI,GAAG,GAAG;;;;;;ACrIzC,MAAM,2BAAuD;AAC3D,QAAO,WAAW"}
1
+ {"version":3,"file":"index.mjs","names":["GoogleReCaptchaContext: Context<GoogleReCaptchaContextType>","value: GoogleReCaptchaContextType"],"sources":["../src/utils.ts","../src/context.tsx","../src/hooks.ts"],"sourcesContent":["export const getRecaptchaScriptSrc = (\n render: string,\n language: string | null | undefined,\n useRecaptchaNet: boolean | undefined,\n useEnterprise: boolean | undefined,\n): string => {\n const hostName = useRecaptchaNet ? 'recaptcha.net' : 'google.com'\n const script = useEnterprise ? 'enterprise.js' : 'api.js'\n\n return `https://${hostName}/recaptcha/${script}?render=${render}${language ? `&hl=${language}` : ''}`\n}\n\nexport const injectScriptTag = (\n scriptId: string,\n language: string | null | undefined,\n useRecaptchaNet: boolean | undefined,\n useEnterprise: boolean | undefined,\n onLoad: () => void,\n): (() => void) => {\n const script = document.createElement('script')\n script.type = 'text/javascript'\n script.id = scriptId\n script.src = getRecaptchaScriptSrc('explicit', language, useRecaptchaNet, useEnterprise)\n script.async = true\n script.defer = true\n script.onload = onLoad\n\n document.head.appendChild(script)\n return () => {\n document.head.removeChild(script)\n }\n}\n\nexport const removeScriptTag = (): void => {\n removeRecaptchBadge()\n\n const script = document.querySelector('script[src^=\"https://www.gstatic.com/recaptcha/releases\"]')\n if (script) {\n script.remove()\n }\n}\n\nexport const removeRecaptchBadge = (): void => {\n const nodeBadge = document.querySelector('.grecaptcha-badge')\n if (nodeBadge?.parentNode) {\n document.body.removeChild(nodeBadge.parentNode)\n }\n}\n","import { type Context, createContext, type JSX, useCallback, useEffect, useId, useMemo, useRef, useState } from 'react'\nimport type { GoogleReCaptchaContextType, GoogleReCaptchaProviderProps, Grecaptcha } from './types'\nimport { injectScriptTag, removeScriptTag } from './utils.ts'\n\nconst GoogleReCaptchaContext: Context<GoogleReCaptchaContextType> = createContext<GoogleReCaptchaContextType>({\n isLoading: true,\n error: null,\n execute: () => Promise.reject('useGoogleRecaptcha must be used within an GoogleReCaptchaProvider'),\n reset: () => [],\n})\n\ntype State = {\n isLoading: boolean\n error?: Error | null\n}\n\nconst GoogleReCaptchaProvider = ({\n siteKey,\n language,\n useRecaptchaNet,\n useEnterprise,\n container,\n badge,\n theme,\n children,\n}: GoogleReCaptchaProviderProps): JSX.Element => {\n const id = useId()\n const containerId = useMemo(() => (container ? container : `${id}-container`), [id, container])\n const [state, setState] = useState<State>({ isLoading: true })\n\n const widgetId = useRef<string>(siteKey)\n const grecaptcha = useRef<Grecaptcha>(null)\n const scriptLoaded = useRef(false)\n const successHandler = useRef<(token: string) => void>(null)\n const errorHandler = useRef<(error: Error | undefined) => void>(null)\n\n const handleSuccess = useCallback((token: string) => {\n if (successHandler.current) {\n successHandler.current?.(token)\n // トークンを再度取得できるよう、リセットする\n grecaptcha.current?.reset(widgetId.current)\n successHandler.current = null\n errorHandler.current = null\n }\n }, [])\n\n const handleError = useCallback((error: Error | undefined) => {\n if (errorHandler.current) {\n errorHandler.current?.(error)\n successHandler.current = null\n errorHandler.current = null\n }\n }, [])\n\n // ReCaptcha初期化\n const onLoad = useCallback(() => {\n const instance = window.grecaptcha?.enterprise ?? window.grecaptcha\n if (!instance) {\n setState({\n isLoading: false,\n error: new Error('reCaptcha is not available'),\n })\n return\n }\n\n // 二重にrender実行されることを抑止\n if (scriptLoaded.current) {\n return\n }\n scriptLoaded.current = true\n\n instance.ready(() => {\n widgetId.current = instance.render(containerId, {\n sitekey: siteKey,\n badge,\n theme,\n size: 'invisible',\n callback: handleSuccess,\n 'error-callback': handleError,\n })\n grecaptcha.current = instance\n setState({\n error: null,\n isLoading: false,\n })\n })\n }, [siteKey, containerId, badge, theme, handleSuccess, handleError])\n\n const reset = useCallback(() => {\n grecaptcha.current?.reset(widgetId.current)\n }, [])\n\n const execute = useCallback(\n (action?: string) => {\n const instance = grecaptcha.current\n if (instance?.execute) {\n const promise = new Promise<string>((resolve, reject) => {\n successHandler.current = resolve\n errorHandler.current = reject\n })\n return Promise.resolve(instance.execute(widgetId.current, action ? { action } : undefined)).then((token) => {\n if (token) {\n handleSuccess(token)\n }\n // token = nullの場合、v2動作\n return promise\n })\n }\n return Promise.reject('ReCaptcha is not available')\n },\n [handleSuccess],\n )\n\n // scriptタグを追加/削除する\n useEffect(() => {\n const removeScript = injectScriptTag(id, language, useRecaptchaNet, useEnterprise, onLoad)\n return () => {\n removeScript()\n removeScriptTag()\n scriptLoaded.current = false\n }\n }, [id, language, useRecaptchaNet, useEnterprise, onLoad])\n\n const value: GoogleReCaptchaContextType = useMemo(\n () => ({\n isLoading: state.isLoading,\n error: state.error ?? null,\n execute,\n reset,\n }),\n [state, execute, reset],\n )\n\n return (\n <GoogleReCaptchaContext.Provider value={value}>\n {children}\n {container ? null : <div id={`${id}-container`} />}\n </GoogleReCaptchaContext.Provider>\n )\n}\n\nexport { GoogleReCaptchaProvider, GoogleReCaptchaContext }\nexport type { GoogleReCaptchaContextType, GoogleReCaptchaProviderProps }\n","import { useContext } from 'react'\nimport { GoogleReCaptchaContext, type GoogleReCaptchaContextType } from './context'\n\nconst useGoogleRecaptcha = (): GoogleReCaptchaContextType => {\n return useContext(GoogleReCaptchaContext)\n}\n\nexport { useGoogleRecaptcha }\n"],"mappings":";;;;AAAA,MAAa,yBACX,QACA,UACA,iBACA,kBACW;AAIX,QAAO,WAHU,kBAAkB,kBAAkB,aAG1B,aAFZ,gBAAgB,kBAAkB,SAEF,UAAU,SAAS,WAAW,OAAO,aAAa;;AAGnG,MAAa,mBACX,UACA,UACA,iBACA,eACA,WACiB;CACjB,MAAM,SAAS,SAAS,cAAc,SAAS;AAC/C,QAAO,OAAO;AACd,QAAO,KAAK;AACZ,QAAO,MAAM,sBAAsB,YAAY,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;aACrC,UACA,YAAY,OAAO,oBAAC,SAAI,IAAI,GAAG,GAAG,cAAe;GAClB;;;;;ACtItC,MAAM,2BAAuD;AAC3D,QAAO,WAAW,uBAAuB"}
package/dist/types.d.mts CHANGED
@@ -26,7 +26,7 @@ export type Action = {
26
26
  export type Grecaptcha = {
27
27
  ready: (onReady: () => void) => void;
28
28
  render: (container: string | HTMLElement, params: Parameters) => string;
29
- execute: (widgetId: string, params?: Action) => Promise<string | null>;
29
+ execute: (widgetId: string, params?: Action) => PromiseLike<string | null>;
30
30
  reset: (widgetId: string) => void;
31
31
  };
32
32
  export type GoogleReCaptchaContextType = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gahojin-inc/react-google-recaptcha",
3
- "version": "2025.9.1",
3
+ "version": "2025.10.1",
4
4
  "description": "Hooks for Google ReCaptcha V3",
5
5
  "author": "GAHOJIN, Inc.",
6
6
  "license": "Apache-2.0",
@@ -36,7 +36,7 @@
36
36
  },
37
37
  "dependencies": {},
38
38
  "devDependencies": {
39
- "react": "19.1.1"
39
+ "react": "19.2.0"
40
40
  },
41
41
  "peerDependencies": {
42
42
  "react": "^18 || ^19"
@@ -45,7 +45,6 @@
45
45
  "clean": "rimraf dist .turbo *.log",
46
46
  "prebuild": "rimraf dist",
47
47
  "build": "rolldown -c",
48
- "prepublish": "pnpm run build",
49
48
  "lint": "biome check --write src",
50
49
  "check": "tsc --noEmit",
51
50
  "check:packagejson": "attw --pack --profile esm-only .",