Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for Enterprise Action names #289

Open
Miguelii opened this issue Feb 23, 2024 · 1 comment
Open

Support for Enterprise Action names #289

Miguelii opened this issue Feb 23, 2024 · 1 comment

Comments

@Miguelii
Copy link

Miguelii commented Feb 23, 2024

Since enterprise version is supported, how about adding support for the Enterprise Actions ?

Docs: https://cloud.google.com/recaptcha-enterprise/docs/actions-website .

Example (see data-action atribute) : https://developers.google.com/recaptcha/docs/v3.

I've already tested and its a easy change:

/src/recaptcha.js
explicitRender() {
    const render = this.getCaptchaFunction("render");
    if (render && this._widgetId === undefined) {

      const wrapper = document.createElement("div");
      
      wrapper.setAttribute("data-action", this.props.dataAction); // Change: Adding the atribute to the div, a new prop (dataAction) is necessary

      this._widgetId = render(wrapper, {
        sitekey: this.props.sitekey,
        callback: this.handleChange,
        theme: this.props.theme,
        type: this.props.type,
        tabindex: this.props.tabindex,
        "expired-callback": this.handleExpired,
        "error-callback": this.handleErrored,
        size: this.props.size,
        stoken: this.props.stoken,
        hl: this.props.hl,
        badge: this.props.badge,
        isolated: this.props.isolated,
        "data-action": this.props.dataAction, // Change: Pass the action also to the render
      });
      this.captcha.appendChild(wrapper);
    }
    ...
  }

@9swampy
Copy link

9swampy commented Apr 6, 2024

I've pushed a PR based on @Miguelii's suggestion; verbatim it didn't work for me because of the interjected div he had decorated. Even with the decoration it didn't work for me, but without as noted on the PR it works.

Out of interest what's the process for getting @types/react-google-recaptcha updated too this obviously changes the exposed API.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants