@faable/challenge 1.0.0 → 1.2.0

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.
@@ -53,6 +53,12 @@ export type ChallengeWidgetDriver = {
53
53
  onMount?: () => void;
54
54
  /** The product the mark names (default `auth`, as auth-js has always shown). */
55
55
  product?: WidgetProduct;
56
+ /**
57
+ * A click (or Enter/Space) anywhere on the idle badge starts the check:
58
+ * the widget emits `faable-challenge:activate`. Faable Challenge sites turn
59
+ * it on; auth-js solves on submit, so its badge stays passive when idle.
60
+ */
61
+ activateOnClick?: boolean;
56
62
  };
57
63
  /** Texts for a BCP 47 tag: exact or aliased variant → base language → English. */
58
64
  export declare const textsFor: (locale: string | undefined | null) => ChallengeTexts;
@@ -64,6 +70,7 @@ export declare const optionsFromClasses: (el: Element) => Partial<Required<Chall
64
70
  */
65
71
  export declare const availableWidth: (el: Element) => number;
66
72
  export type WidgetProduct = 'auth' | 'challenge';
73
+ export declare const MIN_SOLVING_MS = 1200;
67
74
  export type ChallengeWidget = {
68
75
  setState: (state: WidgetState) => void;
69
76
  /** Back to `idle`, for a form that can be sent again. */
@@ -77,10 +84,13 @@ export declare const mountChallengeWidget: (el: Element, opts?: ChallengeWidgetO
77
84
  * for a form that stays on the page and can be sent again.
78
85
  */
79
86
  export declare const resetChallengeWidgets: (root?: ParentNode | Element) => void;
80
- /** Mounts a widget in every `[data-faable-challenge]` of the page. */
81
- export declare const mountChallengeWidgets: (root?: ParentNode) => void;
87
+ /**
88
+ * Mounts a widget in every `[data-faable-challenge]` of the page. `driver`
89
+ * goes to each mount (auth-js passes its `onMount`).
90
+ */
91
+ export declare const mountChallengeWidgets: (root?: ParentNode, driver?: ChallengeWidgetDriver) => void;
82
92
  /**
83
93
  * Mounts the widgets on the page now and any added later (a React form that
84
94
  * renders after `createClient`). Idempotent; a no-op outside a browser.
85
95
  */
86
- export declare const watchChallengeWidgets: () => void;
96
+ export declare const watchChallengeWidgets: (driver?: ChallengeWidgetDriver) => void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@faable/challenge",
3
- "version": "1.0.0",
3
+ "version": "1.2.0",
4
4
  "description": "Faable Challenge: proof-of-work bot protection for any form — the browser widget and solver",
5
5
  "author": "Marc Pomar <marc@faable.com>",
6
6
  "license": "MIT",