Skip to content

Commit

Permalink
feat: match upstream
Browse files Browse the repository at this point in the history
  • Loading branch information
Vexcited committed Oct 12, 2024
1 parent 2d3c41c commit b67c398
Show file tree
Hide file tree
Showing 8 changed files with 994 additions and 367 deletions.
43 changes: 22 additions & 21 deletions package/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,27 +103,23 @@ export default App;
| ---- | ----------- | -------- | ------- | ----------- |
| `sitekey` | `string` | **Yes** | `-` | This is your sitekey, this allows you to load captcha. If you need a sitekey, please visit hCaptcha, and sign up to get your sitekey. |
| `size` | `"normal" \| "compact" \| "invisible"` | No | `"normal"` | This specifies the "size" of the component. hCaptcha allows you to decide how big the component will appear on render, this always defaults to normal. |
| `theme` | `"light" \| "dark"` | No | `"light"` | hCaptcha supports both a light and dark theme. If no theme is inherently set, the captcha will always default to light. |
| `theme` | `"light" \| "dark" \| "constrast"` or `object` | No | `"light"` | hCaptcha supports both a light and dark theme. If no theme is inherently set, the captcha will always default to light. Takes `object` if custom theme is used. |
| `tabindex` | `number` | No | `0` | Set the tabindex of the widget and popup. When appropriate, this can make navigation of your site more intuitive. |
| `id` | `string` | No | `-` | Set an ID to the hCaptcha widget. Make sure each hCaptcha component generated on a single page has its own unique ID when using this prop. |
| `config` | [`HCaptchaConfig`](#advanced-configuration-hcaptchaconfig) | No | `{}` | Advanced configuration for the hCaptcha component. |

### Advanced Configuration (`HCaptchaConfig`)

All the parameters are optional.

| Name | Values/Type | Default | Description |
| ---- | ----------- | ------- | ----------- |
| `recaptchacompat` | `boolean` | `true` | Disable drop-in replacement for reCAPTCHA with `false` to prevent hCaptcha from injecting into `window.grecaptcha`. |
| `hl` | `string` (ISO 639-2 code) | `auto` | hCaptcha auto-detects language via the user's browser. This overrides that to set a default UI language. See [language codes](https://hcaptcha.com/docs/languages). |
| `apihost` | `string` | `-` | See enterprise docs. |
| `assethost` | `string` | `-` | See enterprise docs. |
| `endpoint` | `string` | `-` | See enterprise docs. |
| `host` | `string` | `-` | See enterprise docs. |
| `imghost` | `string` | `-` | See enterprise docs. |
| `reportapi` | `string` | `-` | See enterprise docs. |
| `sentry` | `string` | `-` | See enterprise docs. |
| `custom` | `boolean` |`-` | See enterprise docs. |
| `reCaptchaCompat` | `boolean` | No | `true` | Disable drop-in replacement for reCAPTCHA with `false` to prevent hCaptcha from injecting into `window.grecaptcha`. |
| `languageOverride` | `string` (ISO 639-2 code) | No | `auto` | hCaptcha auto-detects language via the user's browser. This overrides that to set a default UI language. See [language codes](https://hcaptcha.com/docs/languages). |
| `apihost` | `string` | No | `-` | See enterprise docs. |
| `assethost` | `string` | No | `-` | See enterprise docs. |
| `endpoint` | `string` | No | `-` | See enterprise docs. |
| `host` | `string` | No | `-` | See enterprise docs. |
| `imghost` | `string` | No | `-` | See enterprise docs. |
| `reportapi` | `string` | No | `-` | See enterprise docs. |
| `secureApi` | `boolean` | No |`-`| See enterprise docs. |
| `scriptSource` | `string` | No |`-`| See enterprise docs. |
| `sentry` | `boolean` | **Yes** | `-` | Should enable Sentry reporting for hCaptcha. |
| `custom` | `boolean` | No | `-` | Custom theme: see enterprise docs. |
| `cleanup` | `boolean` | No | `true` | Remove script tag after setup. |
| `loadAsync` | `boolean` | No | `true` | Set if the script should be loaded asynchronously. |

### Events Props

Expand Down Expand Up @@ -161,6 +157,11 @@ Please note that "invisible" simply means that no hCaptcha button will be render

Importing the JS SDK twice can cause unpredictable behavior, so don't do a direct import separately if you are using solid-hcaptcha.

### Make sure you are using `recaptchacompat: false` if you have the reCAPTCHA JS loaded on the same page
### Make sure you are using `reCaptchaCompat={false}` if you have the reCAPTCHA JS loaded on the same page

The hCaptcha "compatibility mode" will interfere with reCAPTCHA, as it adds properties with the same name. If for any reason you are running both hCaptcha and reCAPTCHA in parallel (we recommend only running hCaptcha) then please disable our compatibility mode.

### Avoid conflicts with legacy Sentry package usage on solid-hcaptcha 1.0.0+

parallel (they recommend only running hCaptcha) then please disable their compatibility mode.
If you are using Sentry 7.x in your SolidJS app, this can conflict with the upstream `hcaptcha-loader` package's Sentry error tracing.
You can avoid this issue by setting the `sentry` prop to `false`.
20 changes: 10 additions & 10 deletions package/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@
},
"author": {
"url": "https://github.com/Vexcited",
"email": "mikkel@milescode.dev",
"name": "Mikkel RINGAUD"
"email": "vexitofficial@gmail.com",
"name": "Mikkel ALMONTE--RINGAUD"
},
"repository": {
"type": "git",
Expand All @@ -45,22 +45,22 @@
"devDependencies": {
"@typescript-eslint/eslint-plugin": "^6.7.4",
"@typescript-eslint/parser": "^6.7.4",
"eslint": "^8.50.0",
"eslint-plugin-solid": "^0.13.0",
"eslint": "^8.57.1",
"eslint-plugin-solid": "^0.14.3",
"release-it": "^16.2.1",
"rimraf": "^5.0.5",
"solid-js": "^1.7.12",
"solid-js": "^1.9.2",
"terser": "^5.21.0",
"tsup": "^7.2.0",
"tsup-preset-solid": "^2.1.0",
"tsup": "^8.3.0",
"tsup-preset-solid": "^2.2.0",
"typescript": "^5.2.2"
},
"peerDependencies": {
"solid-js": "^1.6.15 || ^1.7.12"
"solid-js": "^1.6.0 || ^1.7.0 || ^1.8.0 || ^1.9.0"
},
"dependencies": {
"@hcaptcha/types": "^1.0.3",
"@solid-primitives/script-loader": "^2.0.2"
"@hcaptcha/loader": "^1.2.4",
"@hcaptcha/types": "^1.0.4"
},
"browser": {},
"typesVersions": {}
Expand Down
12 changes: 12 additions & 0 deletions package/src/constants.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
export const scopeTag = {
key: "source",
value: "solid-hcaptcha"
};

export const breadcrumbMessages = {
mounted: "hCaptcha component mounted",
expired: "hCaptcha expired",
unmounted: "hCaptcha component unmounted",
reset: "hCaptcha reset",
removed: "hCaptcha removed"
};
Loading

0 comments on commit b67c398

Please sign in to comment.