Skip to content

Support for Enterprise Action names #289

@Miguelii

Description

@Miguelii

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);
    }
    ...
  }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions