next-recaptcha-v3 1.2.0 → 1.4.0

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/lib/ReCaptcha.js CHANGED
@@ -1,4 +1,4 @@
1
- 'use client';
1
+ "use client";
2
2
  import { useEffect } from 'react';
3
3
  import { useReCaptcha } from './useReCaptcha.js';
4
4
 
@@ -1,4 +1,4 @@
1
- 'use client';
1
+ "use client";
2
2
  import React, { createContext, useContext, useDebugValue, useState, useRef, useEffect, useCallback, useMemo } from 'react';
3
3
  import Script from 'next/script.js';
4
4
  import { getRecaptchaScriptSrc } from './utils.js';
@@ -1,4 +1,4 @@
1
- 'use client';
1
+ "use client";
2
2
  import { useRef, useCallback } from 'react';
3
3
  import { useReCaptchaContext } from './ReCaptchaProvider.js';
4
4
  import { useIsomorphicLayoutEffect } from './utils.js';
@@ -19,6 +19,9 @@ const useReCaptcha = (reCaptchaKey) => {
19
19
  if (typeof executeCaptchaRef.current !== "function") {
20
20
  throw new Error("Recaptcha has not been loaded");
21
21
  }
22
+ if (!siteKey) {
23
+ throw new Error("ReCaptcha sitekey is not defined");
24
+ }
22
25
  const result = await executeCaptchaRef.current(siteKey, { action });
23
26
  return result;
24
27
  }, [siteKey]);
package/lib/utils.d.ts CHANGED
@@ -4,8 +4,8 @@ import { useLayoutEffect } from "react";
4
4
  * Refs: https://developers.google.com/recaptcha/docs/loading
5
5
  */
6
6
  export declare const getRecaptchaScriptSrc: ({ reCaptchaKey, language, useRecaptchaNet, useEnterprise, }?: {
7
- reCaptchaKey?: string;
8
- language?: string;
7
+ reCaptchaKey?: string | null;
8
+ language?: string | null;
9
9
  useRecaptchaNet?: boolean;
10
10
  useEnterprise?: boolean;
11
11
  }) => string;
package/lib/utils.js CHANGED
@@ -1,4 +1,4 @@
1
- 'use client';
1
+ "use client";
2
2
  import { useLayoutEffect, useEffect } from 'react';
3
3
 
4
4
  /**
@@ -1,4 +1,4 @@
1
- 'use client';
1
+ "use client";
2
2
  import React from 'react';
3
3
  import { useReCaptcha } from './useReCaptcha.js';
4
4
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "next-recaptcha-v3",
3
- "version": "1.2.0",
3
+ "version": "1.4.0",
4
4
  "description": "🤖 Next.js hook to add Google ReCaptcha to your application",
5
5
  "license": "MIT",
6
6
  "author": "Roman Zhuravlov",
@@ -31,7 +31,7 @@
31
31
  "prepublishOnly": "npm run rollup"
32
32
  },
33
33
  "peerDependencies": {
34
- "next": ">=13.0.0",
34
+ "next": "^13.0.0 || ^14.0.0",
35
35
  "react": ">=18.0.0",
36
36
  "react-dom": ">=18.0.0"
37
37
  },
@@ -44,27 +44,27 @@
44
44
  "node": ">=18.0.0"
45
45
  },
46
46
  "devDependencies": {
47
- "@rollup/plugin-node-resolve": "^15.1.0",
48
- "@rollup/plugin-typescript": "^11.1.2",
49
- "@types/node": "^20.3.3",
50
- "@types/react": "^18.2.14",
51
- "@types/react-dom": "^18.2.6",
52
- "@typescript-eslint/eslint-plugin": "^5.60.1",
53
- "@typescript-eslint/parser": "^5.60.1",
54
- "eslint": "^8.44.0",
55
- "eslint-config-next": "^13.4.7",
56
- "eslint-config-prettier": "^8.8.0",
47
+ "@rollup/plugin-node-resolve": "^15.2.3",
48
+ "@rollup/plugin-typescript": "^11.1.6",
49
+ "@types/node": "^20.11.6",
50
+ "@types/react": "^18.2.48",
51
+ "@types/react-dom": "^18.2.18",
52
+ "@typescript-eslint/eslint-plugin": "^6.19.1",
53
+ "@typescript-eslint/parser": "^6.19.1",
54
+ "eslint": "^8.56.0",
55
+ "eslint-config-next": "^14.1.0",
56
+ "eslint-config-prettier": "^9.1.0",
57
57
  "husky": "^8.0.3",
58
- "lint-staged": "^13.2.3",
59
- "next": "^13.4.7",
60
- "prettier": "^2.8.8",
61
- "pretty-quick": "^3.1.3",
58
+ "lint-staged": "^15.2.0",
59
+ "next": "^14.1.0",
60
+ "prettier": "4.0.0-alpha.8",
61
+ "pretty-quick": "^4.0.0",
62
62
  "react": "^18.2.0",
63
63
  "react-dom": "^18.2.0",
64
- "rollup": "^3.26.0",
65
- "rollup-plugin-node-externals": "^6.1.1",
66
- "rollup-plugin-preserve-directives": "^0.2.0",
67
- "typescript": "^5.1.6"
64
+ "rollup": "^4.9.6",
65
+ "rollup-plugin-node-externals": "^6.1.2",
66
+ "rollup-plugin-preserve-directives": "^0.3.1",
67
+ "typescript": "^5.3.3"
68
68
  },
69
69
  "lint-staged": {
70
70
  "**/*.{js,jsx,ts,tsx}": [