Skip to main content
Version: v2

@friendlycaptcha/sdk > FriendlyCaptchaSDK

FriendlyCaptchaSDK class

Main entry point for V2 of the Friendly Captcha SDK. This class keeps track of widgets and allows you to create widgets programmatically.

Generally there should only be one instance of this SDK in your website.

Signature:

export declare class FriendlyCaptchaSDK 

Constructors

ConstructorModifiersDescription
(constructor)(opts)Constructs a new instance of the FriendlyCaptchaSDK class

Properties

PropertyModifiersTypeDescription
attachedPromise<WidgetHandle[]>A promise that resolves to all the widgets that are currently attached.

Methods

MethodModifiersDescription
attach(elements)

Attaches a widget to given element or elements if they are not attached to yet.

You can pass one or more HTML elements to attach to, or undefined. If undefined is passed, the HTML page is scanned for unattached widget elements (= elements with the frc-captcha class).

Returns handles to the newly-attached elements.

clear()Completely remove all widgets and background agents related to the SDK on this page.
clearRiskIntelligence(opts)Clears cached Risk Intelligence tokens. Cached tokens for a given sitekey can be cleared by specifying it; if a sitekey is not specified, all tokens will be cleared from the cache.
createWidget(opts)Creates a Friendly Captcha widget with given options under given HTML element.
getAllRiskIntelligenceHandles()Returns all current Risk Intelligence handles known about (in an unspecified order).
getAllWidgets()Returns all current widgets known about (in an unspecified order).
getWidgetById(id)Retrieves a widget by its widget ID.
riskIntelligence(opts)Creates a Risk Intelligence token generation request, returning a Promise that resolves to the generated token.