@adobe-commerce/recaptcha
v1.0.3
Published
Module allows to efficiently verify that users are humans, not bots or spammers
Keywords
Readme
ReCaptcha Module
Purpose
This functionality is designed to prevent CAPTCHAs. It provides methods for detecting and bypassing CAPTCHAs, improving user experience and automating interactions with web services. `
Methods
Private Methods
Private methods are used within the class and are not accessible externally.
_updateBadgePosition(currentForm, config);- Responsible for changing the widget's position if it needs to be placed inline.
_addRecaptchaScript();- Adds a script to the page.
_fetchStoreConfig();- Requests configuration from the backend.
_loadConfig();- Responsible for loading the config from Session Storage.
Public Methods
`import {setEndpoint, setConfig, initReCaptcha, verifyReCaptcha } from "@adobe-commerce/recaptcha"`Public methods are available for use when interacting with the functionality.
setEndpoint(url : string);- It sets the URL from which the reCAPTCHA settings will be fetched.
setConfig(configList : [{ badgeId: 'badgeId'}]);- Initializes the configuration, accepting a URL and a set of parameters. The set of parameters is necessary for customizing form settings. Init on top lvl application.
initReCaptcha();- Initializes reCAPTCHA and adds a script to the website.
verifyReCaptcha();- If the method is present, it returns a token.
Installation
To install this functionality, follow these steps:
npm i:
@adobe-commerce/recaptcha[ setEndpoint ] - Use this function at the top level to pass the backend URL.
[ setConfig ] - Also use this function at the top level to pass your custom configurations if you plan to use your custom form.
[ initReCaptcha ] - Call the function on the page where Dropins is integrated, or immediately after setEndpoint or setConfig. Adds a script to the website.
[ verifyReCaptcha ] This function serves as an example in either the API method or your form submission handler. It returns a token, which can then be initialized in the headers upon receipt.
Summary
This functionality provides methods for preventing and solving CAPTCHAs, enhancing automation and interaction with websites. Using it will help simplify processes related to CAPTCHA.
