HCaptchaBlockEdit.js
2 years ago
HCaptchaOptions.js
2 years ago
HCaptchaProvider.js
2 years ago
main.js
2 years ago
preview.js
2 years ago
variation.js
2 years ago
HCaptchaOptions.js
81 lines
| 1 | const { |
| 2 | __, |
| 3 | } = wp.i18n; |
| 4 | const { |
| 5 | ToggleControl, |
| 6 | BaseHelp, |
| 7 | } = JetFBComponents; |
| 8 | const { |
| 9 | useCaptchaProvider, |
| 10 | } = JetFBHooks; |
| 11 | let { |
| 12 | TextControl, |
| 13 | NumberControl, |
| 14 | __experimentalNumberControl, |
| 15 | ExternalLink, |
| 16 | } = wp.components; |
| 17 | |
| 18 | NumberControl = NumberControl || __experimentalNumberControl; |
| 19 | |
| 20 | const { globalTab } = JetFBActions; |
| 21 | |
| 22 | const currentTab = globalTab( { |
| 23 | slug: 'captcha-tab', |
| 24 | element: 'hcaptcha', |
| 25 | empty: {}, |
| 26 | } ); |
| 27 | |
| 28 | function HCaptchaOptions() { |
| 29 | const [ providerArgs, setProviderArgs ] = useCaptchaProvider(); |
| 30 | |
| 31 | const currentArgs = providerArgs.use_global |
| 32 | ? currentTab |
| 33 | : providerArgs; |
| 34 | |
| 35 | return <> |
| 36 | <ToggleControl |
| 37 | checked={ providerArgs.use_global } |
| 38 | onChange={ use_global => setProviderArgs( |
| 39 | { use_global } ) } |
| 40 | > |
| 41 | { __( 'Use', 'jet-form-builder' ) + ' ' } |
| 42 | <a href={ JetFormEditorData.global_settings_url + |
| 43 | '#captcha-tab__hcaptcha' }> |
| 44 | { __( 'Global Settings', 'jet-form-builder' ) } |
| 45 | </a> |
| 46 | </ToggleControl> |
| 47 | <TextControl |
| 48 | label={ __( 'Site Key:', 'jet-form-builder' ) } |
| 49 | value={ currentArgs.key } |
| 50 | disabled={ providerArgs.use_global } |
| 51 | onChange={ key => setProviderArgs( { key } ) } |
| 52 | /> |
| 53 | <BaseHelp> |
| 54 | { __( |
| 55 | 'You can find it on this page in the first column of Sitekey.', |
| 56 | 'jet-form-builder', |
| 57 | ) + ' ' } |
| 58 | <ExternalLink href={ 'https://dashboard.hcaptcha.com/sites' }> |
| 59 | { __( 'Go to the dashboard of sites', 'jet-form-builder' ) } |
| 60 | </ExternalLink> |
| 61 | </BaseHelp> |
| 62 | <TextControl |
| 63 | label={ __( 'Secret Key:', 'jet-form-builder' ) } |
| 64 | value={ currentArgs.secret } |
| 65 | disabled={ providerArgs.use_global } |
| 66 | onChange={ secret => setProviderArgs( { secret } ) } |
| 67 | /> |
| 68 | <BaseHelp> |
| 69 | { __( |
| 70 | `You can find it on the settings page, |
| 71 | this will be the first field.`, |
| 72 | 'jet-form-builder', |
| 73 | ) + ' ' } |
| 74 | <ExternalLink href={ 'https://dashboard.hcaptcha.com/settings' }> |
| 75 | { __( 'Go to the Settings page', 'jet-form-builder' ) } |
| 76 | </ExternalLink> |
| 77 | </BaseHelp> |
| 78 | </>; |
| 79 | } |
| 80 | |
| 81 | export default HCaptchaOptions; |