New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@hcaptcha/react-hcaptcha

Package Overview
Dependencies
Maintainers
4
Versions
51
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@hcaptcha/react-hcaptcha - npm Package Compare versions

Comparing version 0.3.7 to 0.3.8

56

dist/index.js
"use strict";
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2["default"])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2["default"])(this, result); }; }
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
var React = require('react');

@@ -63,3 +61,3 @@

var HCaptcha = /*#__PURE__*/function (_React$Component) {
_inherits(HCaptcha, _React$Component);
(0, _inherits2["default"])(HCaptcha, _React$Component);

@@ -71,14 +69,13 @@ var _super = _createSuper(HCaptcha);

_classCallCheck(this, HCaptcha);
(0, _classCallCheck2["default"])(this, HCaptcha);
_this = _super.call(this, props); // API Methods
_this.renderCaptcha = _this.renderCaptcha.bind(_assertThisInitialized(_this));
_this.resetCaptcha = _this.resetCaptcha.bind(_assertThisInitialized(_this));
_this.removeCaptcha = _this.removeCaptcha.bind(_assertThisInitialized(_this)); // Event Handlers
_this.renderCaptcha = _this.renderCaptcha.bind((0, _assertThisInitialized2["default"])(_this));
_this.resetCaptcha = _this.resetCaptcha.bind((0, _assertThisInitialized2["default"])(_this));
_this.removeCaptcha = _this.removeCaptcha.bind((0, _assertThisInitialized2["default"])(_this)); // Event Handlers
_this.handleOnLoad = _this.handleOnLoad.bind(_assertThisInitialized(_this));
_this.handleSubmit = _this.handleSubmit.bind(_assertThisInitialized(_this));
_this.handleExpire = _this.handleExpire.bind(_assertThisInitialized(_this));
_this.handleError = _this.handleError.bind(_assertThisInitialized(_this));
_this.handleOnLoad = _this.handleOnLoad.bind((0, _assertThisInitialized2["default"])(_this));
_this.handleSubmit = _this.handleSubmit.bind((0, _assertThisInitialized2["default"])(_this));
_this.handleExpire = _this.handleExpire.bind((0, _assertThisInitialized2["default"])(_this));
_this.handleError = _this.handleError.bind((0, _assertThisInitialized2["default"])(_this));
var isApiReady = typeof hcaptcha !== 'undefined';

@@ -95,3 +92,3 @@ _this.ref = React.createRef();

_createClass(HCaptcha, [{
(0, _createClass2["default"])(HCaptcha, [{
key: "componentDidMount",

@@ -277,2 +274,3 @@ value: function componentDidMount() {

value: function execute() {
var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
var _this$state7 = this.state,

@@ -283,3 +281,8 @@ isApiReady = _this$state7.isApiReady,

if (!isApiReady || isRemoved) return;
hcaptcha.execute(captchaId);
if (opts && (0, _typeof2["default"])(opts) !== "object") {
opts = null;
}
return hcaptcha.execute(captchaId, opts);
}

@@ -296,3 +299,2 @@ }, {

}]);
return HCaptcha;

@@ -299,0 +301,0 @@ }(React.Component);

"use strict";
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
function generateQuery(params) {
return Object.entries(params).filter(function (_ref) {
var _ref2 = _slicedToArray(_ref, 2),
var _ref2 = (0, _slicedToArray2["default"])(_ref, 2),
key = _ref2[0],

@@ -23,3 +15,3 @@ value = _ref2[1];

}).map(function (_ref3) {
var _ref4 = _slicedToArray(_ref3, 2),
var _ref4 = (0, _slicedToArray2["default"])(_ref3, 2),
key = _ref4[0],

@@ -26,0 +18,0 @@ value = _ref4[1];

{
"name": "@hcaptcha/react-hcaptcha",
"version": "0.3.7",
"version": "0.3.8",
"types": "types/index.d.ts",

@@ -15,2 +15,3 @@ "main": "dist/index.js",

"test": "jest",
"watch": "babel src -d dist --copy-files --watch",
"transpile": "babel src -d dist --copy-files",

@@ -35,2 +36,3 @@ "build": "npm run transpile",

"@babel/core": "^7.12.10",
"@babel/plugin-transform-runtime": "^7.14.5",
"@babel/preset-env": "^7.12.11",

@@ -37,0 +39,0 @@ "@babel/preset-react": "^7.12.10",

@@ -89,3 +89,3 @@ # React hCaptcha Component Library

|---|---|
|`execute()`|Programmatically trigger a challenge request|
|`execute()`|Programmatically trigger a challenge request. Additionally, this method can be run asynchronously and returns a promise with the `token` and `eKey` when the challenge is completed.|
|`resetCaptcha()`|Reset the current challenge|

@@ -92,0 +92,0 @@

@@ -130,5 +130,5 @@ const React = require('react');

...this.props,
"error-callback" : this.handleError,
"expired-callback": this.handleExpire,
"callback" : this.handleSubmit
"error-callback" : this.handleError,
"expired-callback" : this.handleExpire,
"callback" : this.handleSubmit,
});

@@ -200,8 +200,12 @@

execute () {
execute (opts = null) {
const { isApiReady, isRemoved, captchaId } = this.state;
if (!isApiReady || isRemoved) return
if (!isApiReady || isRemoved) return;
hcaptcha.execute(captchaId)
if (opts && typeof opts !== "object") {
opts = null;
}
return hcaptcha.execute(captchaId, opts);
}

@@ -208,0 +212,0 @@

@@ -30,2 +30,7 @@ // Type definitions for @hcaptcha/react-hcaptcha 0.1

interface ExecuteResponse {
response: string;
key: string;
}
declare class HCaptcha extends React.Component<HCaptchaProps, HCaptchaState> {

@@ -35,5 +40,7 @@ resetCaptcha(): void;

removeCaptcha(): void;
execute(): void;
execute(opts: { async: true }): Promise<ExecuteResponse>
execute(opts?: { async: false }): void;
execute(opts?: { async: boolean }): Promise<ExecuteResponse> | void;
}
export = HCaptcha;
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc