Repository navigation
Expand file tree
/
Copy pathHcaptcha.d.ts
More file actions
136 lines (132 loc) · 4.01 KB
/
Copy pathHcaptcha.d.ts
File metadata and controls
136 lines (132 loc) · 4.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
import React from 'react';
import { StyleProp, ViewStyle } from 'react-native';
import { WebViewMessageEvent } from 'react-native-webview';
export type HCaptchaVerifyParams = {
rqdata?: string;
phonePrefix?: string;
phoneNumber?: string;
};
export type HcaptchaProps = {
/**
* The callback function that runs after receiving a response, error, or when user cancels.
*/
onMessage: (event: CustomWebViewMessageEvent) => void;
/**
* The size of the checkbox.
*/
size: 'invisible' | 'normal' | 'compact';
/**
* The hCaptcha siteKey
*/
siteKey: string;
/**
* The webview style
*/
style?: StyleProp<ViewStyle>
/**
* The url domain defined on your hCaptcha. You generally will not need to change this.
*/
url?: string;
/**
* Default language for hCaptcha; overrides phone defaults.
* A complete list of supported languages and their codes can be found [here](https://docs.hcaptcha.com/languages/)
*/
languageCode?: string;
/**
* Whether to show a loading indicator while the hCaptcha web content loads
*/
showLoading?: boolean;
/**
* Load the SDK on mount without fetching a token. Call execute() to verify.
* Default: false.
*/
prewarm?: boolean;
/**
* Allow user to cancel hcaptcha during loading by touch loader overlay
*/
closableLoading?: boolean;
/**
* Color of the ActivityIndicator
*/
loadingIndicatorColor?: string;
/**
* The background color code that will be applied to the main HTML element
*/
backgroundColor?: string;
/**
* The theme can be 'light', 'dark', 'contrast' or a custom theme object (see Enterprise docs)
*/
theme?: 'light' | 'dark' | 'contrast' | Object;
/**
* Hcaptcha execution options (see Enterprise docs)
*/
rqdata?: string;
/**
* Verification payload overrides. Values here take precedence over deprecated top-level fields.
*/
verifyParams?: HCaptchaVerifyParams;
/**
* Enable / Disable sentry error reporting.
*/
sentry?: boolean;
/**
* The url of api.js
* Default: https://js.hcaptcha.com/1/api.js (Override only if using first-party hosting feature.)
*/
jsSrc?: string;
/**
* Point hCaptcha JS Ajax Requests to alternative API Endpoint.
* Default: https://api.hcaptcha.com (Override only if using first-party hosting feature.)
*/
endpoint?: string;
/**
* Point hCaptcha Bug Reporting Request to alternative API Endpoint.
* Default: https://accounts.hcaptcha.com (Override only if using first-party hosting feature.)
*/
reportapi?: string;
/**
* Points loaded hCaptcha assets to a user defined asset location, used for proxies.
* Default: https://newassets.hcaptcha.com (Override only if using first-party hosting feature.)
*/
assethost?: string;
/**
* Points loaded hCaptcha challenge images to a user defined image location, used for proxies.
* Default: https://imgs.hcaptcha.com (Override only if using first-party hosting feature.)
*/
imghost?: string;
/**
* hCaptcha SDK host identifier. null value means that it will be generated by SDK
*/
host?: string;
/**
* The orientation of the challenge.
* Default: portrait
*/
orientation?: 'portrait' | 'landscape';
/**
* Optional phone country calling code (without '+'), e.g., "44".
* Used in MFA flows.
*/
phonePrefix?: string;
/**
* Optional full phone number in E.164 format ("+44123..."), for use in MFA.
*/
phoneNumber?: string;
/**
* Enable automatic user journey injection.
*/
userJourney?: boolean;
}
interface CustomWebViewMessageEvent extends WebViewMessageEvent {
success: boolean;
reset: () => void;
/** Releases the WebView and cancels verification/timers. execute() recreates it. Retained event.reset() hooks become inert. */
destroy: () => void;
markUsed?: () => void;
}
export default class Hcaptcha extends React.Component<HcaptchaProps> {
/** Queues verification until the SDK is ready. */
execute: () => void;
/** Cancels pending verification and resets the widget without executing. */
reset: () => void;
}