altcha 2.0.0-beta.1 → 2.0.0-beta.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (123) hide show
  1. package/README.md +10 -8
  2. package/dist/altcha.d.ts +5 -1
  3. package/dist/altcha.js +1476 -1476
  4. package/dist/altcha.umd.cjs +4 -14
  5. package/dist_external/altcha.css +1 -253
  6. package/dist_external/altcha.d.ts +5 -1
  7. package/dist_external/altcha.js +1345 -1352
  8. package/dist_external/altcha.umd.cjs +3 -13
  9. package/dist_i18n/af.js +21 -0
  10. package/dist_i18n/af.umd.cjs +1 -0
  11. package/dist_i18n/all.js +197 -133
  12. package/dist_i18n/all.umd.cjs +1 -1
  13. package/dist_i18n/americas.js +5 -8
  14. package/dist_i18n/americas.umd.cjs +1 -1
  15. package/dist_i18n/ar.js +3 -4
  16. package/dist_i18n/ar.umd.cjs +1 -1
  17. package/dist_i18n/asia.js +28 -44
  18. package/dist_i18n/asia.umd.cjs +1 -1
  19. package/dist_i18n/bg.js +3 -4
  20. package/dist_i18n/bg.umd.cjs +1 -1
  21. package/dist_i18n/bn.js +3 -4
  22. package/dist_i18n/bn.umd.cjs +1 -1
  23. package/dist_i18n/bs.js +21 -0
  24. package/dist_i18n/bs.umd.cjs +1 -0
  25. package/dist_i18n/ca.js +21 -0
  26. package/dist_i18n/ca.umd.cjs +1 -0
  27. package/dist_i18n/cs.js +1 -2
  28. package/dist_i18n/cs.umd.cjs +1 -1
  29. package/dist_i18n/da.js +1 -2
  30. package/dist_i18n/da.umd.cjs +1 -1
  31. package/dist_i18n/de.js +1 -2
  32. package/dist_i18n/de.umd.cjs +1 -1
  33. package/dist_i18n/el.js +1 -2
  34. package/dist_i18n/el.umd.cjs +1 -1
  35. package/dist_i18n/en.js +1 -2
  36. package/dist_i18n/en.umd.cjs +1 -1
  37. package/dist_i18n/es-419.js +3 -4
  38. package/dist_i18n/es-419.umd.cjs +1 -1
  39. package/dist_i18n/es-es.js +1 -2
  40. package/dist_i18n/es-es.umd.cjs +1 -1
  41. package/dist_i18n/et.js +3 -4
  42. package/dist_i18n/et.umd.cjs +1 -1
  43. package/dist_i18n/eu.js +1 -2
  44. package/dist_i18n/eu.umd.cjs +1 -1
  45. package/dist_i18n/europe.js +159 -76
  46. package/dist_i18n/europe.umd.cjs +1 -1
  47. package/dist_i18n/fi.js +1 -2
  48. package/dist_i18n/fi.umd.cjs +1 -1
  49. package/dist_i18n/fr-ca.js +1 -2
  50. package/dist_i18n/fr-ca.umd.cjs +1 -1
  51. package/dist_i18n/fr-fr.js +1 -2
  52. package/dist_i18n/fr-fr.umd.cjs +1 -1
  53. package/dist_i18n/ga.js +1 -2
  54. package/dist_i18n/ga.umd.cjs +1 -1
  55. package/dist_i18n/he.js +1 -2
  56. package/dist_i18n/he.umd.cjs +1 -1
  57. package/dist_i18n/hi.js +3 -4
  58. package/dist_i18n/hi.umd.cjs +1 -1
  59. package/dist_i18n/hr.js +1 -2
  60. package/dist_i18n/hr.umd.cjs +1 -1
  61. package/dist_i18n/hu.js +3 -4
  62. package/dist_i18n/hu.umd.cjs +1 -1
  63. package/dist_i18n/id.js +1 -2
  64. package/dist_i18n/id.umd.cjs +1 -1
  65. package/dist_i18n/is.js +21 -0
  66. package/dist_i18n/is.umd.cjs +1 -0
  67. package/dist_i18n/it.js +1 -2
  68. package/dist_i18n/it.umd.cjs +1 -1
  69. package/dist_i18n/ja.js +3 -4
  70. package/dist_i18n/ja.umd.cjs +1 -1
  71. package/dist_i18n/ko.js +3 -4
  72. package/dist_i18n/ko.umd.cjs +1 -1
  73. package/dist_i18n/lt.js +1 -2
  74. package/dist_i18n/lt.umd.cjs +1 -1
  75. package/dist_i18n/lv.js +1 -2
  76. package/dist_i18n/lv.umd.cjs +1 -1
  77. package/dist_i18n/mr.js +3 -4
  78. package/dist_i18n/mr.umd.cjs +1 -1
  79. package/dist_i18n/mt.js +1 -2
  80. package/dist_i18n/mt.umd.cjs +1 -1
  81. package/dist_i18n/nb.js +22 -0
  82. package/dist_i18n/nb.umd.cjs +1 -0
  83. package/dist_i18n/nl.js +1 -2
  84. package/dist_i18n/nl.umd.cjs +1 -1
  85. package/dist_i18n/pl.js +3 -4
  86. package/dist_i18n/pl.umd.cjs +1 -1
  87. package/dist_i18n/pt-br.js +1 -2
  88. package/dist_i18n/pt-br.umd.cjs +1 -1
  89. package/dist_i18n/pt-pt.js +3 -4
  90. package/dist_i18n/pt-pt.umd.cjs +1 -1
  91. package/dist_i18n/ro.js +1 -2
  92. package/dist_i18n/ro.umd.cjs +1 -1
  93. package/dist_i18n/ru.js +3 -4
  94. package/dist_i18n/ru.umd.cjs +1 -1
  95. package/dist_i18n/sk.js +3 -4
  96. package/dist_i18n/sk.umd.cjs +1 -1
  97. package/dist_i18n/sl.js +1 -2
  98. package/dist_i18n/sl.umd.cjs +1 -1
  99. package/dist_i18n/sr.js +21 -0
  100. package/dist_i18n/sr.umd.cjs +1 -0
  101. package/dist_i18n/sv.js +1 -2
  102. package/dist_i18n/sv.umd.cjs +1 -1
  103. package/dist_i18n/ta.js +3 -4
  104. package/dist_i18n/ta.umd.cjs +1 -1
  105. package/dist_i18n/te.js +1 -2
  106. package/dist_i18n/te.umd.cjs +1 -1
  107. package/dist_i18n/th.js +3 -4
  108. package/dist_i18n/th.umd.cjs +1 -1
  109. package/dist_i18n/tr.js +1 -2
  110. package/dist_i18n/tr.umd.cjs +1 -1
  111. package/dist_i18n/uk.js +3 -4
  112. package/dist_i18n/uk.umd.cjs +1 -1
  113. package/dist_i18n/ur.js +3 -4
  114. package/dist_i18n/ur.umd.cjs +1 -1
  115. package/dist_i18n/vi.js +3 -4
  116. package/dist_i18n/vi.umd.cjs +1 -1
  117. package/dist_i18n/zh-cn.js +3 -4
  118. package/dist_i18n/zh-cn.umd.cjs +1 -1
  119. package/dist_i18n/zh-tw.js +3 -4
  120. package/dist_i18n/zh-tw.umd.cjs +1 -1
  121. package/dist_plugins/upload.js +145 -133
  122. package/dist_plugins/upload.umd.cjs +4 -4
  123. package/package.json +4 -3
package/README.md CHANGED
@@ -4,7 +4,7 @@ ALTCHA is a self-hosted, privacy-first security solution that protects your webs
4
4
 
5
5
  ALTCHA is fully compliant with:
6
6
 
7
- - **Global privacy regulations**: GDPR, HIPAA, CCPA, LGPD, and PIPL
7
+ - **Global privacy regulations**: GDPR, HIPAA, CCPA, PIPEDA/CPPA, LGPD, and PIPL
8
8
  - **Accessibility standards**: [WCAG 2.2 AA-level](https://altcha.org/docs/wcag/) and the [European Accessibility Act](https://altcha.org/docs/european-accessibility-act-2025/)
9
9
 
10
10
  For more details, visit [altcha.org](https://altcha.org).
@@ -20,11 +20,11 @@ For more details, visit [altcha.org](https://altcha.org).
20
20
 
21
21
  ## What’s New in v2
22
22
 
23
- Version 2 introduces enhanced accessibility, expanded language support (42+ languages), and integration with **ALTCHA Sentinel**—a self-hosted anti-spam solution for websites, apps, and services.
23
+ Version 2 introduces enhanced accessibility, expanded language support, and integration with **ALTCHA Sentinel**—a self-hosted anti-spam solution for websites, apps, and services.
24
24
 
25
25
  ### Key Improvements in v2
26
26
 
27
- - **Built-in Internationalization (i18n)** for 42+ languages
27
+ - **Built-in Internationalization (i18n)** for 48+ languages
28
28
  - **Improved RTL (right-to-left) language support**
29
29
  - **Enhanced WCAG accessibility**
30
30
  - **Support for accessible code challenges** (image + audio options)
@@ -117,11 +117,11 @@ ALTCHA is optimized for performance:
117
117
 
118
118
  | Distribution | Size (GZIPped) |
119
119
  |-------------------|----------------|
120
- | ALTCHA (v2.x) | 26 kB |
120
+ | ALTCHA (v2.x) | 28+ kB |
121
121
  | hCaptcha | 48+ kB |
122
122
  | reCAPTCHA | 270+ kB |
123
123
 
124
- When GZIPped, it totals about 26 kB, making ALTCHA’s widget about 90% smaller than reCAPTCHA.
124
+ When GZIPped, it totals about 28 kB, making ALTCHA’s widget about 90% smaller than reCAPTCHA.
125
125
 
126
126
  ## Content Security Policy (CSP)
127
127
 
@@ -141,6 +141,7 @@ Additional options:
141
141
  - **customfetch**: A custom `fetch` function for retrieving the challenge.
142
142
  Accepts `url: string` and `init: RequestInit` as arguments and must return a [`Response`](https://developer.mozilla.org/en-US/docs/Web/API/Response).
143
143
  - **delay**: Artificial delay in milliseconds before verification (defaults to 0).
144
+ - **disableautofocus**: If true, prevents the code-challenge input from automatically receiving focus on render (defaults to `false`).
144
145
  - **expire**: Challenge expiration duration in milliseconds.
145
146
  - **floating**: Enable floating UI (possible values: `auto`, `top`, `bottom`).
146
147
  - **floatinganchor**: CSS selector of the "anchor" to which the floating UI will be attached (defaults to the `button[type="submit"]` in the related form).
@@ -169,14 +170,14 @@ Development / Testing options:
169
170
 
170
171
  ## Internationalization (i18n)
171
172
 
172
- ALTCHA supports **42+ languages**. Import translations from `altcha/i18n/*`:
173
+ ALTCHA supports **48+ languages**. Import translations from `altcha/i18n/*`:
173
174
 
174
175
  ```js
175
176
  import 'altcha';
176
177
  import 'altcha/i18n/all'; // All languages
177
178
  // Or import specific languages:
178
179
  import 'altcha/i18n/de';
179
- import 'altcha/i18n/fr';
180
+ import 'altcha/i18n/fr-fr';
180
181
  ```
181
182
 
182
183
  The widget auto-detects language from `<html lang="...">` or `navigator.languages`. Override with the `language` attribute:
@@ -208,7 +209,7 @@ Enable plugins per widget:
208
209
  ### Available Plugins
209
210
 
210
211
  - **obfuscation**: Secure sensitive data (emails, phone numbers).
211
- - **upload**: File uploads.
212
+ - **upload**: File uploads with ALTCHA Sentinel or a custom backend.
212
213
 
213
214
  ## Programmatic Configuration
214
215
 
@@ -250,6 +251,7 @@ export interface Configure {
250
251
  customfetch?: string | ((url: string, init?: RequestInit) => Promise<Response>);
251
252
  debug?: boolean;
252
253
  delay?: number;
254
+ disableautofocus?: boolean;
253
255
  expire?: number;
254
256
  floating?: 'auto' | 'top' | 'bottom';
255
257
  floatinganchor?: string;
package/dist/altcha.d.ts CHANGED
@@ -5,7 +5,9 @@ declare module 'altcha';
5
5
  declare global {
6
6
  var altchaCreateWorker: (url?: string) => Worker;
7
7
  var altchaPlugins: any[];
8
- var altchaI18n: Record<string, any>;
8
+ var altchaI18n: Record<string, any> & {
9
+ register: (language: string, translation: Record<string, string>) => void;
10
+ };
9
11
 
10
12
  type AltchaState = 'error' | 'expired' | 'verified' | 'verifying' | 'unverified';
11
13
 
@@ -22,6 +24,7 @@ declare global {
22
24
 
23
25
  interface AltchaWidgetOptions {
24
26
  auto?: 'off' | 'onfocus' | 'onload' | 'onsubmit';
27
+ /** @deprecated */
25
28
  blockspam?: boolean;
26
29
  challengeurl?: string;
27
30
  challengejson?: string;
@@ -29,6 +32,7 @@ declare global {
29
32
  customfetch?: string | ((url: string, init?: RequestInit) => Promise<Response>);
30
33
  debug?: boolean;
31
34
  delay?: number;
35
+ disableautofocus?: boolean;
32
36
  expire?: number;
33
37
  floating?: 'auto' | 'top' | 'bottom' | 'false' | '' | boolean;
34
38
  floatinganchor?: string;