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. |
| RiskIntelligenceHandle | This provides a handle for configuring and managing a Risk Intelligence request via an HTML element. This class is only instantiated by the SDK - do not create a handle yourself. |
| 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. |
| FRCRiskIntelligenceCompleteEventData | Payload of the "frc:riskintelligence.complete" event. |
| FRCRiskIntelligenceErrorEventData | Payload of the "frc:riskintelligence.error" event. |
| FRCRiskIntelligenceExpireEventData | Payload of the "frc:riskintelligence.expire" event. |
| 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. |
| RiskIntelligenceClearOptions | Options for clearing cached Risk Intelligence tokens. |
| RiskIntelligenceErrorData | Error data returned by a failed Risk Intelligence request. |
| RiskIntelligenceGenerateData | Data returned by the Risk Intelligence API request. |
| RiskIntelligenceOptions | Options for configuring a Risk Intelligence request. |
| WidgetErrorData | |
| WidgetResetOptions | The options object you can pass to the widget.reset() method. |
Variables
| Variable | Description |
|---|---|
| FRCRiskIntelligenceCompleteEventName | "frc:riskintelligence.complete" |
| FRCRiskIntelligenceErrorEventName | "frc:riskintelligence.error" |
| FRCRiskIntelligenceExpireEventName | "frc:riskintelligence.expire" |
| 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 |
|---|---|
| APIEndpoint | Which API endpoint to use for the SDK. Typically "eu" or "global", but a URL can be used to specify a custom endpoint. Defaults to "global". |
| 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. |
| FRCRiskIntelligenceCompleteEvent | Event that gets dispatched when a Risk Intelligence token has been successfully generated. |
| FRCRiskIntelligenceErrorEvent | Event that gets dispatched when the Risk Intelligence request fails. |
| FRCRiskIntelligenceExpireEvent | Event that gets dispatched when a Risk Intelligence token expires. |
| 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. |
| RiskIntelligenceErrorCode | Error codes that can be returned by the Risk Intelligence request. See WidgetErrorCode for the list of possible error codes. |
| 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. |
| WidgetMode | The mode of the widget. * "interactive" (default): the widget is interactive: the user needs to click the checkbox to finalize the captcha. This mode offers the best anti-bot protection. * "noninteractive": the widget is non-interactive: the captcha is solved without any user interaction required. |
| 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 docs for more information. |