sdk package
A library for integrating Friendly Captcha into your website. This SDK allows you to create captcha widgets, respond to their changes, and interact with them programmatically.
Classes
Class | Description |
---|---|
FriendlyCaptchaSDK | 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. |
WidgetHandle | This provides an API stub that provides the end-user JS API for a widget. This class is only instantiated by the SDK - do not create a handle yourself. |
Interfaces
Interface | Description |
---|---|
CreateWidgetOptions | Options when creating a widget programmatically. |
FRCEventMap | A DOM event map for all events that can be dispatched by a widget. |
FRCWidgetCompleteEventData | Payload of the "frc:widget.complete" event. |
FRCWidgetErrorEventData | Payload of the "frc:widget.error" event. |
FRCWidgetExpireEventData | Payload of the "frc:widget.expire" event. |
FRCWidgetResetEventData | Payload of the "frc:widget.reset" event. |
FRCWidgetStateChangeEventData | Payload of the "frc:widget.statechange" event. |
FriendlyCaptchaSDKOptions | Options when creating a new SDK instance. |
WidgetErrorData | |
WidgetResetOptions | The options object you can pass to the widget.reset() method. |
Variables
Variable | Description |
---|---|
FRCWidgetCompleteEventName | "frc:widget.complete" |
FRCWidgetErrorEventName | "frc:widget.error" |
FRCWidgetExpireEventName | "frc:widget.expire" |
FRCWidgetResetEventName | "frc:widget.reset" |
FRCWidgetStateChangeEventName | "frc:widget.statechange" |
Type Aliases
Type Alias | Description |
---|---|
FRCEventData | Payloads of any of the events that can be dispatched by a widget. |
FRCEventName | Names of any of the events that can be dispatched by a widget. |
FRCWidgetCompleteEvent | Event that gets dispatched when the widget is completed. This happens when the user's browser has succesfully passed the captcha challenge. |
FRCWidgetStateChangeEvent | Event that gets dispatched when the widget enters a new state. |
FRCWidgetWidgetErrorEvent | Event that gets dispatched when something goes wrong in the widget. |
FRCWidgetWidgetExpireEvent | Event that gets dispatched when the widget expires. This happens when the user takes too long to submit the captcha after it is solved. |
FRCWidgetWidgetResetEvent | Event that gets dispatched when something goes wrong in the widget. |
SentinelResponse | Response values used in the hidden input field when no valid solution is present, these tell you something about the state of the widget. |
StartMode | The start mode of the widget. * |
WidgetErrorCode | Error codes that can be returned by the widget. * In all cases it's the best practice to enable the "submit" button when the widget errors, so that the user can still perform the action despite not having solved the captcha. |
WidgetResetTrigger | What caused the widget to reset. * root : Code on the root page (= your website code or plugin) caused the reset. * widget : The reset came from the widget. The user likely clicked the reset button within the widget. * agent : The reset came from the agent - this currently does not happen but may in the future. |
WidgetState | The state the widget is in. See the [widget lifecycle](../lifecycle) docs for more information. |