@fingerly/svelte 0.1.0 → 0.1.2

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.
package/README.md CHANGED
@@ -4,7 +4,7 @@ Svelte bindings for the Fingerly SDK. One state per app, held in Svelte's
4
4
  context, read as plain reactive properties.
5
5
 
6
6
  Requires Svelte **5**. The state is built with runes, which is what lets a
7
- component read `fingerly.verdicts` and re-render with no store, no subscription
7
+ component read `fingerly.suspectLevel` and re-render with no store, no subscription
8
8
  and no `$` prefix at the call site.
9
9
 
10
10
  ```
@@ -18,21 +18,47 @@ pnpm add @fingerly/svelte
18
18
  <script lang="ts">
19
19
  import { setupFingerly } from '@fingerly/svelte'
20
20
 
21
+ let { children } = $props()
22
+
21
23
  // consent: 'granted' only once you have consent (or another lawful basis)
22
- setupFingerly({ apiKey: 'fly_pk_production_…', consent: 'granted' })
24
+ setupFingerly({ apiKey: 'fly_pk_production_…', endpoints: '/k7x2qm4a', consent: 'granted' })
23
25
  </script>
24
26
 
25
- <slot />
27
+ {@render children()}
26
28
  ```
27
29
 
28
- The key is a **public** SDK key from the dashboard, and it belongs in the page —
30
+ `endpoints` is the path of your first-party proxy, the one the dashboard
31
+ issued. With `@fingerly/node` it is a SvelteKit endpoint at that path:
32
+
33
+ ```js
34
+ // src/routes/k7x2qm4a/+server.js
35
+ import { Fingerly } from '@fingerly/node'
36
+
37
+ // Built on the first request rather than at import: the build imports this
38
+ // module, and the proxy key is a runtime secret.
39
+ let proxy
40
+ const addresses = new WeakMap()
41
+
42
+ export function POST(event) {
43
+ proxy ??= Fingerly.createProxy({
44
+ proxyKey: process.env.FINGERLY_PROXY_KEY,
45
+ clientIp: (request) => addresses.get(request) ?? '',
46
+ })
47
+ // The connection's peer address, which adapter-node takes from its
48
+ // ADDRESS_HEADER setting when the app runs behind a trusted proxy.
49
+ addresses.set(event.request, event.getClientAddress())
50
+ return proxy(event.request)
51
+ }
52
+ ```
53
+
54
+ The key is a **public** SDK key from the dashboard, and it belongs in the page:
29
55
  it is scoped to the origins you list, which is what makes it safe there. A
30
56
  **secret** key is refused if it arrives with an `Origin`, so pasting one here
31
57
  does not work by design.
32
58
 
33
59
  Setting up collects nothing. It makes the client reachable and no more; when to
34
60
  identify is the page's decision. Like every Svelte context call it has to run
35
- during component initialisation — a `<script>` block, not an event handler and
61
+ during component initialisation: a `<script>` block, not an event handler and
36
62
  not an `$effect`.
37
63
 
38
64
  Consent defaults to `pending`, and nothing is collected or sent until it is
@@ -64,10 +90,10 @@ Consent defaults to `pending`, and nothing is collected or sent until it is
64
90
  {#if fingerly.error}<p>{fingerly.error.message}</p>{/if}
65
91
  ```
66
92
 
67
- `identify()` collects, scores locally, and submits. It resolves as soon as the
68
- server has a receipt — IP geolocation and the velocity windows are computed
69
- after the response, so what comes back is a `requestId` rather than a finished
70
- event.
93
+ `identify()` collects and submits, and resolves with the server's answer in the
94
+ same round trip: the `requestId`, who the visitor is (`visitorId`), and the
95
+ `suspectScore` and `suspectLevel`, unless the key hides them. Nothing is decided
96
+ in the page: scoring lives on the server, under the weights you set.
71
97
 
72
98
  ### On mount instead
73
99
 
@@ -77,7 +103,7 @@ event.
77
103
  </script>
78
104
  ```
79
105
 
80
- `immediate` runs in an `$effect`, which is what makes it **safe under SSR** —
106
+ `immediate` runs in an `$effect`, which is what makes it **safe under SSR**:
81
107
  effects do not run during a server render, so a SvelteKit page using this
82
108
  renders on the server and collects on the client with no guard of its own.
83
109
 
@@ -92,7 +118,7 @@ asking whether the visitor is suspicious produce **one** submission, one
92
118
  `requestId`, and one line on your bill:
93
119
 
94
120
  ```svelte
95
- <!-- Header.svelte, CheckoutForm.svelte, RiskBanner.svelte — all three: -->
121
+ <!-- All three of Header.svelte, CheckoutForm.svelte, RiskBanner.svelte: -->
96
122
  const fingerly = useIdentify({ immediate: true })
97
123
  <!-- → one network request, one shared answer -->
98
124
  ```
@@ -101,48 +127,22 @@ Context rather than a module-level singleton, and the reason is the server: a
101
127
  module-level state on a SvelteKit server is shared by every request the process
102
128
  renders. Context is per component tree, and a component tree is per request.
103
129
 
104
- To deliberately identify again — a long-lived app reaching a second checkout:
130
+ To deliberately identify again (a long-lived app reaching a second checkout):
105
131
 
106
132
  ```svelte
107
133
  await fingerly.refresh() // ignores the cached result and collects afresh
108
134
  ```
109
135
 
110
- ## A single verdict
111
-
112
- ```svelte
113
- <script lang="ts">
114
- import { useVerdict } from '@fingerly/svelte'
136
+ ## Reading the answer
115
137
 
116
- const automation = useVerdict('automation')
117
- </script>
118
-
119
- {#if automation.matched}
120
- <aside>
121
- Automated access suspected ({automation.confidence})
122
- <ul>{#each automation.reasons as reason (reason)}<li>{reason}</li>{/each}</ul>
123
- </aside>
124
- {/if}
125
- ```
138
+ `suspectLevel` is the server's band for this submission, under the weights you
139
+ set. `isSuspicious` is `true` for `medium` or `high`, `false` for `low`, and
140
+ `null` when the level is absent: no server has answered yet, the submission went
141
+ unscored, or the SDK key hides the score from the page, which cannot tell those
142
+ apart. Null is not a clean result.
126
143
 
127
- Names: `incognito` · `tor` · `emulator` · `automation` · `farm`.
128
-
129
- `matched` requires **medium confidence or better** by default. A
130
- `low`-confidence verdict is a single weak tell — one removable flag, or one
131
- countermeasure a privacy-conscious real user might equally be running — and
132
- acting on it would generate false positives. Raise or lower it explicitly:
133
-
134
- ```ts
135
- const tor = useVerdict('tor', { min: 'high' }) // block only when certain
136
- const tor = useVerdict('tor', { min: 'low' }) // observe everything
137
- ```
138
-
139
- Both arguments accept a getter as well as a value, because this is called once
140
- when the component initialises and its arguments may be props that change after
141
- that:
142
-
143
- ```svelte
144
- const verdict = useVerdict(() => name, { min: () => threshold })
145
- ```
144
+ Signals are read on your backend, by `requestId`, never in the page: which check
145
+ tripped is what a fraudster wants to learn.
146
146
 
147
147
  ## A correlation tag
148
148
 
@@ -156,16 +156,16 @@ const fingerly = useIdentify({ tag: () => `checkout:${page.params.orderId}` })
156
156
 
157
157
  ## Collect without submitting
158
158
 
159
- For a page that wants the local verdicts and nothing else:
159
+ For a debug page that wants the raw report and nothing else:
160
160
 
161
161
  ```ts
162
162
  setupFingerly({ apiKey: 'fly_pk_production_…', submit: false })
163
163
  ```
164
164
 
165
165
  Everything the server decides comes back empty: no `requestId`, no `visitorId`,
166
- and `suspectScore` is `null` rather than `0`. That is the honest answer rather
167
- than a gap — nothing was sent, so nobody scored it, and a `0` would read as
168
- "scored, found nothing".
166
+ `suspectScore` is `null` rather than `0`, and `isSuspicious` is
167
+ `null` rather than `false`. That is the honest answer rather than a gap: nothing
168
+ was sent, so nobody scored it, and this SDK decides nothing on its own.
169
169
 
170
170
  ## Waiting for consent
171
171
 
@@ -202,24 +202,21 @@ running stops it before it submits, and it fails with a `ConsentError`.
202
202
  ```ts
203
203
  const fingerly = useIdentify()
204
204
 
205
- fingerly.requestId // string | null — identifies this submission
206
- fingerly.visitorId // string | null — who the server decided this is
207
- fingerly.visitorIsNew // boolean — never seen before
208
- fingerly.visitorConfidence // number — 0 to 100
209
- fingerly.identifiable // boolean — false when the signals were too thin
210
- fingerly.duplicate // boolean — answered before; this is the first answer
211
- fingerly.state // string | null — the server's disposition
212
- fingerly.reason // string | null — why, when state needs explaining
213
- fingerly.suspectScore // number | null — null when nothing scored it
214
- fingerly.suspectLevel // string | null — low, medium, high
215
- fingerly.triggers // IdentifyTrigger[] — what the server scored on
216
- fingerly.verdicts // Verdicts | null — the five local verdicts
217
- fingerly.report // SignalReport | null — every source, with status and timing
205
+ fingerly.requestId // string | null: identifies this submission
206
+ fingerly.visitorId // string | null: who the server decided this is
207
+ fingerly.visitorIsNew // boolean: never seen before
208
+ fingerly.visitorConfidence // number: 0 to 100
209
+ fingerly.identifiable // boolean: false when the signals were too thin
210
+ fingerly.duplicate // boolean: answered before; this is the first answer
211
+ fingerly.state // string | null: the server's disposition
212
+ fingerly.suspectScore // number | null: null when nothing scored it
213
+ fingerly.suspectLevel // string | null: low, medium, high
214
+ fingerly.report // SignalReport | null: every source, with status and timing
218
215
  fingerly.error // Error | null
219
216
  fingerly.consent // ConsentState (granted, pending or denied)
220
217
  fingerly.isLoading // boolean
221
- fingerly.isReady // boolean — finished, successfully or not
222
- fingerly.isSuspicious // boolean — any verdict at medium+
218
+ fingerly.isReady // boolean: finished, successfully or not
219
+ fingerly.isSuspicious // boolean | null: true for medium or high; null when the level is absent
223
220
  fingerly.identify() // Promise<IdentifyResult>
224
221
  fingerly.refresh() // Promise<IdentifyResult>
225
222
  fingerly.setConsent('granted')
@@ -230,21 +227,19 @@ it and reading one in an event handler gets the current value. None of them is
230
227
  settable: the state is shared, so a component that could assign to it would be
231
228
  changing what every other component sees.
232
229
 
233
- A verdict is `{ value, confidence, reasons }` — `reasons` is ordered strongest
234
- first, and exists because a boolean that cannot say why it is true is not
235
- something you can defend to a customer whose user you blocked.
230
+ Weights and signal names never reach the browser: your backend reads them on the
231
+ server-side event read.
236
232
 
237
- These verdicts are **advisory**. The same detectors run again server-side over
238
- the stored report, where the rules improve without every integration
239
- redeploying. Treat the client's answer as a hint for the UI and the server's as
240
- the decision.
233
+ The detectors run on the server, over the report this package sends, so rules
234
+ improve without every integration redeploying. Everything here that says
235
+ anything about a visitor came from the server.
241
236
 
242
237
  ## The visitor is never asked for anything
243
238
 
244
239
  No permission prompt, no picker, no dialog, on any browser. Reading a
245
240
  permission's *state* prompts nobody and is used freely; requesting is banned
246
241
  outright and enforced by a test in `@fingerly/web-js`. The one API that prompts on
247
- some browsers — canvas readback, which raises a doorhanger in Tor Browser — is
242
+ some browsers (canvas readback, which raises a doorhanger in Tor Browser) is
248
243
  skipped when the SDK measures a clamped clock.
249
244
 
250
245
  You can drop this into a checkout without it ever interrupting the checkout.
@@ -265,12 +260,18 @@ try {
265
260
  {#if fingerly.error}<p>{fingerly.error.message}</p>{/if}
266
261
  ```
267
262
 
268
- A failed identification is forgotten rather than remembered, so the next call
269
- tries again instead of being handed the same rejection.
263
+ A failed identification is not repeated behind your back. When the server
264
+ answers `429` with `Retry-After`, every call, `refresh()` included, gets the
265
+ same error until that time has passed; the error carries it as
266
+ `retryAfterMs`. After a transient failure without one (a `5xx`, a network
267
+ error), components that identify automatically wait 5 seconds, doubling per
268
+ consecutive failure up to a minute, so route changes during an outage send
269
+ nothing; a call you make yourself, such as on a click, still tries at once.
270
+ Any other failure, such as a wrong key, is tried again on the next call.
270
271
 
271
272
  `TransportError` carries a `status`. The two worth branching on are `401` (the
272
273
  key is wrong, or was used from an origin it does not list) and `402` (the
273
- organisation is not accepting traffic) — both are your configuration rather than
274
+ organisation is not accepting traffic). Both are your configuration rather than
274
275
  the visitor's.
275
276
 
276
277
  `ConsentError` means consent is not `granted`. It carries `code:
@@ -284,20 +285,19 @@ the client.
284
285
 
285
286
  ## Running the playground
286
287
 
287
- `playground/` is this package's own state and hooks driving the real SDK — no
288
- mocks — with a `useVerdict()` card per verdict, all sharing one identification.
288
+ `playground/` is this package's own state and hooks driving the real SDK (no
289
+ mocks), showing `suspectScore` and `suspectLevel` beside the raw
290
+ report, all sharing one identification. It uses `submit: false`, so no server
291
+ answers: the raw report fills in, and the score and level read hidden.
289
292
 
290
293
  ```
291
294
  pnpm --filter @fingerly/svelte playground # http://localhost:4176
292
295
  ```
293
296
 
294
- Open it twice — an ordinary window and a private one — and watch the incognito
295
- card change. That pair is the only real test that verdict gets.
296
-
297
297
  ## A note on the build
298
298
 
299
299
  The package is emitted by `tsc`, not bundled, and that is a requirement rather
300
300
  than a preference. The runes in `*.svelte.js` are compiled by the *app's*
301
- Svelte plugin, which decides what to compile by the file name — bundling them
301
+ Svelte plugin, which decides what to compile by the file name. Bundling them
302
302
  into an `index.js` would hand the app a file full of `$state(…)` that nothing
303
303
  compiles, and `$state is not defined` at runtime.
package/dist/context.d.ts CHANGED
@@ -40,4 +40,3 @@ export declare function setupFingerly(options: FingerlyOptions): Fingerly;
40
40
  * write, and the fix - one call in a layout - is not guessable from that.
41
41
  */
42
42
  export declare function useFingerly(): Fingerly;
43
- //# sourceMappingURL=context.d.ts.map
package/dist/context.js CHANGED
@@ -54,4 +54,3 @@ export function useFingerly() {
54
54
  }
55
55
  return getContext(FINGERLY_KEY);
56
56
  }
57
- //# sourceMappingURL=context.js.map
@@ -1,16 +1,14 @@
1
1
  /**
2
- * The two things a component asks for: the identification, and one verdict.
2
+ * What a component asks for: the identification.
3
3
  *
4
- * Named `useIdentify` and `useVerdict` to match the Vue, React and Next
4
+ * Named `useIdentify` to match the Vue, React and Next
5
5
  * bindings rather than to follow any Svelte convention. An SDK whose four
6
6
  * bindings answer the same question under four different names makes its own
7
7
  * documentation harder to read than the code it documents. What is Svelte's
8
8
  * here is the *shape*: reactive objects read as plain properties, no refs, no
9
9
  * `$` prefix, no subscription.
10
10
  */
11
- import type { Confidence, Verdict, Verdicts } from '@fingerly/web-js';
12
11
  import type { Fingerly } from './state.svelte.js';
13
- export type VerdictName = keyof Verdicts;
14
12
  export interface UseIdentifyOptions {
15
13
  /**
16
14
  * Identify as soon as the component mounts.
@@ -50,37 +48,7 @@ export interface UseIdentifyOptions {
50
48
  * {/if}
51
49
  * ```
52
50
  *
53
- * Returns the same object `setupFingerly()` created, so `fingerly.verdicts` in a
54
- * template re-renders when the answer arrives.
51
+ * Returns the same object `setupFingerly()` created, so `fingerly.suspectLevel`
52
+ * in a template re-renders when the answer arrives.
55
53
  */
56
54
  export declare function useIdentify(options?: UseIdentifyOptions): Fingerly;
57
- export interface UseVerdictReturn {
58
- /** True only when the verdict fired *and* met the confidence floor. */
59
- readonly matched: boolean;
60
- /** The verdict itself, or null before the first identification. */
61
- readonly verdict: Verdict | null;
62
- readonly confidence: Confidence | null;
63
- /** Why, strongest first. Empty before identification, never null. */
64
- readonly reasons: readonly string[];
65
- }
66
- /**
67
- * Watch one verdict.
68
- *
69
- * ```svelte
70
- * <script lang="ts">
71
- * const incognito = useVerdict('incognito')
72
- * </script>
73
- *
74
- * {#if incognito.matched}Private window ({incognito.confidence}){/if}
75
- * ```
76
- *
77
- * `min` defaults to `medium`. A `low`-confidence verdict is a single weak tell
78
- * - one removable flag, or one countermeasure a privacy-conscious real user
79
- * might equally be running - and defaulting to acting on it would make this a
80
- * false-positive generator. Pass `min: 'low'` deliberately if the intent is to
81
- * observe rather than to block.
82
- */
83
- export declare function useVerdict(name: VerdictName | (() => VerdictName), options?: {
84
- min?: Confidence | (() => Confidence);
85
- }): UseVerdictReturn;
86
- //# sourceMappingURL=hooks.svelte.d.ts.map
@@ -1,7 +1,7 @@
1
1
  /**
2
- * The two things a component asks for: the identification, and one verdict.
2
+ * What a component asks for: the identification.
3
3
  *
4
- * Named `useIdentify` and `useVerdict` to match the Vue, React and Next
4
+ * Named `useIdentify` to match the Vue, React and Next
5
5
  * bindings rather than to follow any Svelte convention. An SDK whose four
6
6
  * bindings answer the same question under four different names makes its own
7
7
  * documentation harder to read than the code it documents. What is Svelte's
@@ -23,8 +23,8 @@ import { useFingerly } from './context.js';
23
23
  * {/if}
24
24
  * ```
25
25
  *
26
- * Returns the same object `setupFingerly()` created, so `fingerly.verdicts` in a
27
- * template re-renders when the answer arrives.
26
+ * Returns the same object `setupFingerly()` created, so `fingerly.suspectLevel`
27
+ * in a template re-renders when the answer arrives.
28
28
  */
29
29
  export function useIdentify(options = {}) {
30
30
  const fingerly = useFingerly();
@@ -52,7 +52,10 @@ export function useIdentify(options = {}) {
52
52
  // one: the failure is already in `fingerly.error`, which is where a
53
53
  // component that opted into `immediate` will look for it. A caller who
54
54
  // wants to await the outcome calls identify() themselves.
55
- void identify().catch(() => undefined);
55
+ // Marked automatic, so a failure's hold applies: a remount while the
56
+ // API is refusing must not send another identification.
57
+ const tag = resolveTag();
58
+ void fingerly.identify({ ...(tag === undefined ? {} : { tag }), automatic: true }).catch(() => undefined);
56
59
  });
57
60
  }
58
61
  return {
@@ -77,21 +80,12 @@ export function useIdentify(options = {}) {
77
80
  get state() {
78
81
  return fingerly.state;
79
82
  },
80
- get reason() {
81
- return fingerly.reason;
82
- },
83
83
  get suspectScore() {
84
84
  return fingerly.suspectScore;
85
85
  },
86
86
  get suspectLevel() {
87
87
  return fingerly.suspectLevel;
88
88
  },
89
- get triggers() {
90
- return fingerly.triggers;
91
- },
92
- get verdicts() {
93
- return fingerly.verdicts;
94
- },
95
89
  get report() {
96
90
  return fingerly.report;
97
91
  },
@@ -116,49 +110,3 @@ export function useIdentify(options = {}) {
116
110
  client: fingerly.client,
117
111
  };
118
112
  }
119
- const RANK = { low: 0, medium: 1, high: 2 };
120
- /** One array for every un-identified verdict, rather than one per read. */
121
- const NO_REASONS = Object.freeze([]);
122
- /**
123
- * Watch one verdict.
124
- *
125
- * ```svelte
126
- * <script lang="ts">
127
- * const incognito = useVerdict('incognito')
128
- * </script>
129
- *
130
- * {#if incognito.matched}Private window ({incognito.confidence}){/if}
131
- * ```
132
- *
133
- * `min` defaults to `medium`. A `low`-confidence verdict is a single weak tell
134
- * - one removable flag, or one countermeasure a privacy-conscious real user
135
- * might equally be running - and defaulting to acting on it would make this a
136
- * false-positive generator. Pass `min: 'low'` deliberately if the intent is to
137
- * observe rather than to block.
138
- */
139
- export function useVerdict(name, options = {}) {
140
- const fingerly = useFingerly();
141
- // Getters accepted as well as values, because this is called once when the
142
- // component initialises and its arguments may be props that change after
143
- // that. A plain value read here would be the value that prop had at
144
- // initialisation, forever.
145
- const which = $derived(typeof name === 'function' ? name() : name);
146
- const floor = $derived((typeof options.min === 'function' ? options.min() : options.min) ?? 'medium');
147
- const verdict = $derived(fingerly.verdicts ? fingerly.verdicts[which] : null);
148
- const matched = $derived(verdict !== null && verdict.value && RANK[verdict.confidence] >= RANK[floor]);
149
- return {
150
- get verdict() {
151
- return verdict;
152
- },
153
- get confidence() {
154
- return verdict?.confidence ?? null;
155
- },
156
- get reasons() {
157
- return verdict?.reasons ?? NO_REASONS;
158
- },
159
- get matched() {
160
- return matched;
161
- },
162
- };
163
- }
164
- //# sourceMappingURL=hooks.svelte.js.map
package/dist/index.d.ts CHANGED
@@ -5,14 +5,13 @@
5
5
  * properties. See the README for the whole surface with examples.
6
6
  *
7
7
  * Requires Svelte 5: the state is built with runes, which is what lets a
8
- * component read `fingerly.verdicts` and re-render, with no store and no `$`
8
+ * component read `fingerly.suspectLevel` and re-render, with no store and no `$`
9
9
  * prefix at the call site.
10
10
  */
11
11
  export { FINGERLY_KEY, setupFingerly, useFingerly } from './context.js';
12
12
  export { createFingerly, FingerlyServerError } from './state.svelte.js';
13
13
  export type { Fingerly, FingerlyOptions } from './state.svelte.js';
14
- export { useIdentify, useVerdict } from './hooks.svelte.js';
15
- export type { UseIdentifyOptions, UseVerdictReturn, VerdictName } from './hooks.svelte.js';
16
- export type { FingerlyWebEvent, Confidence, ConsentState, IdentifyResult, IntegrityReport, Lie, SignalOutcome, SignalReport, SignalStatus, Verdict, Verdicts, } from '@fingerly/web-js';
14
+ export { useIdentify } from './hooks.svelte.js';
15
+ export type { UseIdentifyOptions } from './hooks.svelte.js';
16
+ export type { FingerlyWebEvent, Confidence, ConsentState, IdentifyResult, IntegrityReport, Lie, SignalOutcome, SignalReport, SignalStatus, } from '@fingerly/web-js';
17
17
  export { ConsentError, TransportError } from '@fingerly/web-js';
18
- //# sourceMappingURL=index.d.ts.map
package/dist/index.js CHANGED
@@ -5,11 +5,10 @@
5
5
  * properties. See the README for the whole surface with examples.
6
6
  *
7
7
  * Requires Svelte 5: the state is built with runes, which is what lets a
8
- * component read `fingerly.verdicts` and re-render, with no store and no `$`
8
+ * component read `fingerly.suspectLevel` and re-render, with no store and no `$`
9
9
  * prefix at the call site.
10
10
  */
11
11
  export { FINGERLY_KEY, setupFingerly, useFingerly } from './context.js';
12
12
  export { createFingerly, FingerlyServerError } from './state.svelte.js';
13
- export { useIdentify, useVerdict } from './hooks.svelte.js';
13
+ export { useIdentify } from './hooks.svelte.js';
14
14
  export { ConsentError, TransportError } from '@fingerly/web-js';
15
- //# sourceMappingURL=index.js.map
@@ -5,7 +5,7 @@
5
5
  * live outside a component: the file is compiled by the Svelte compiler in the
6
6
  * consuming app, so the fields below are reactive wherever they are read.
7
7
  * That is the whole reason this binding needs no store, no subscription and no
8
- * `$` prefix at the call site - a component reads `fingerly.verdicts` and
8
+ * `$` prefix at the call site - a component reads `fingerly.suspectLevel` and
9
9
  * re-renders when it changes.
10
10
  *
11
11
  * One state per app, not one per component. Identification is a *page-level*
@@ -14,25 +14,23 @@
14
14
  * bill the customer three times for one page load and hand the three
15
15
  * components three different `requestId`s for one visitor.
16
16
  */
17
- import { type ConsentState, type FingerlyClient, type IdentifyResult, type IdentifyTrigger, type SignalReport, type Verdicts } from '@fingerly/web-js';
17
+ import { type ConsentState, type FingerlyClient, type IdentifyResult, type SignalReport } from '@fingerly/web-js';
18
18
  /** Options for [[createFingerly]] and [[setupFingerly]]. */
19
19
  export interface FingerlyOptions {
20
20
  /** The SDK key from the dashboard. A public key is safe in a page. */
21
21
  apiKey: string;
22
- /** Origin of the API. Defaults to production. */
23
22
  /** API route version. Defaults to v1. */
24
23
  apiVersion?: string;
25
- endpoint?: string;
24
+ /** Ordered first-party ingestion endpoints. */
26
25
  endpoints?: string | readonly string[];
27
26
  fallbackToDefaultEndpoint?: boolean;
28
27
  /**
29
- * Collect and score without submitting anything.
28
+ * Collect without submitting anything.
30
29
  *
31
- * For a page that wants the local verdicts and nothing else. Everything
32
- * the server decides comes back empty: no `requestId`, no `visitorId` and
33
- * no `suspectScore`. That is the honest answer rather than a gap - nothing
34
- * was sent, so nobody scored it, and a zero here would read as "scored,
35
- * found nothing".
30
+ * Everything the server decides comes back empty: no `requestId`, no
31
+ * `visitorId`, no `suspectScore`, no `suspectLevel`. That is the honest
32
+ * answer rather than a gap - nothing was sent, so nobody scored it, and
33
+ * this SDK decides nothing on its own.
36
34
  */
37
35
  submit?: boolean;
38
36
  /**
@@ -65,8 +63,6 @@ export interface Fingerly {
65
63
  readonly duplicate: boolean;
66
64
  /** The server's disposition of the check. */
67
65
  readonly state: string | null;
68
- /** Why, when `state` needs explaining. */
69
- readonly reason: string | null;
70
66
  /**
71
67
  * The server's score, 0-100, or null when it did not score.
72
68
  *
@@ -76,23 +72,19 @@ export interface Fingerly {
76
72
  readonly suspectScore: number | null;
77
73
  /** The score as a band - `low`, `medium`, `high`. Null when unscored. */
78
74
  readonly suspectLevel: string | null;
79
- /** What the server scored on. Empty when it found nothing. */
80
- readonly triggers: readonly IdentifyTrigger[];
81
- readonly verdicts: Verdicts | null;
82
75
  readonly report: SignalReport | null;
83
76
  readonly error: Error | null;
84
77
  readonly isLoading: boolean;
85
78
  /** True once an identification has completed, successfully or not. */
86
79
  readonly isReady: boolean;
87
80
  /**
88
- * True when the verdicts contain anything worth acting on.
89
- *
90
- * Deliberately conservative: it requires `medium` confidence or better,
91
- * because a `low`-confidence verdict is one weak tell and blocking on it
92
- * would be blocking real users. Anything more nuanced should read `verdicts`
93
- * directly - this is the "should I even look?" flag, not a policy.
81
+ * True when the server scored this `medium` or `high` under the weights you
82
+ * set: the "should I even look?" flag, and not a policy. `null` when no
83
+ * server has answered or the level is absent (not identified yet, `submit:
84
+ * false`, unscored, or hidden by the key), which is not a clean result.
85
+ * Anything more nuanced reads `suspectLevel`, or your backend reads the signals.
94
86
  */
95
- readonly isSuspicious: boolean;
87
+ readonly isSuspicious: boolean | null;
96
88
  /**
97
89
  * Whether the visitor has agreed to be identified, as last set here or on
98
90
  * the client. Automatic identification waits for `granted`.
@@ -111,6 +103,7 @@ export interface Fingerly {
111
103
  identify(options?: {
112
104
  tag?: string;
113
105
  force?: boolean;
106
+ automatic?: boolean;
114
107
  }): Promise<IdentifyResult>;
115
108
  /** Identify again from scratch, ignoring any previous result. */
116
109
  refresh(options?: {
@@ -131,5 +124,19 @@ export declare class FingerlyServerError extends Error {
131
124
  * factory that fingerprinted as it ran would collect during a server render
132
125
  * and take the choice of *when* away from the page that knows.
133
126
  */
127
+ /**
128
+ * How long a failed identification holds off the next one.
129
+ *
130
+ * Without this a failure was forgotten at once, and every component mounting
131
+ * with `immediate` started another identification - three requests per route
132
+ * change while the API was answering 429. A `Retry-After` the server sent
133
+ * holds every call, forced or not, until it passes. A transient failure
134
+ * without one (a 5xx, a network error) holds automatic calls only, for 5 s
135
+ * doubling per consecutive failure up to a minute; a click still tries at
136
+ * once. Anything else holds nothing.
137
+ */
138
+ export declare function failureHold(error: unknown, consecutive: number, now: number): {
139
+ until: number;
140
+ automaticUntil: number;
141
+ };
134
142
  export declare function createFingerly(options: FingerlyOptions): Fingerly;
135
- //# sourceMappingURL=state.svelte.d.ts.map
@@ -5,7 +5,7 @@
5
5
  * live outside a component: the file is compiled by the Svelte compiler in the
6
6
  * consuming app, so the fields below are reactive wherever they are read.
7
7
  * That is the whole reason this binding needs no store, no subscription and no
8
- * `$` prefix at the call site - a component reads `fingerly.verdicts` and
8
+ * `$` prefix at the call site - a component reads `fingerly.suspectLevel` and
9
9
  * re-renders when it changes.
10
10
  *
11
11
  * One state per app, not one per component. Identification is a *page-level*
@@ -14,7 +14,7 @@
14
14
  * bill the customer three times for one page load and hand the three
15
15
  * components three different `requestId`s for one visitor.
16
16
  */
17
- import { load, } from '@fingerly/web-js';
17
+ import { isSuspiciousLevel, load, } from '@fingerly/web-js';
18
18
  /** Thrown when the SDK is asked to collect somewhere there is no browser. */
19
19
  export class FingerlyServerError extends Error {
20
20
  name = 'FingerlyServerError';
@@ -31,6 +31,23 @@ export class FingerlyServerError extends Error {
31
31
  * factory that fingerprinted as it ran would collect during a server render
32
32
  * and take the choice of *when* away from the page that knows.
33
33
  */
34
+ /**
35
+ * How long a failed identification holds off the next one.
36
+ *
37
+ * Without this a failure was forgotten at once, and every component mounting
38
+ * with `immediate` started another identification - three requests per route
39
+ * change while the API was answering 429. A `Retry-After` the server sent
40
+ * holds every call, forced or not, until it passes. A transient failure
41
+ * without one (a 5xx, a network error) holds automatic calls only, for 5 s
42
+ * doubling per consecutive failure up to a minute; a click still tries at
43
+ * once. Anything else holds nothing.
44
+ */
45
+ export function failureHold(error, consecutive, now) {
46
+ const failure = error;
47
+ const retryAfter = typeof failure?.retryAfterMs === 'number' && failure.retryAfterMs > 0 ? failure.retryAfterMs : 0;
48
+ const backoff = failure?.retryable === true ? Math.min(60_000, 5_000 * 2 ** Math.max(0, consecutive - 1)) : 0;
49
+ return { until: now + retryAfter, automaticUntil: now + Math.max(retryAfter, backoff) };
50
+ }
34
51
  export function createFingerly(options) {
35
52
  let requestId = $state(null);
36
53
  let visitorId = $state(null);
@@ -39,22 +56,19 @@ export function createFingerly(options) {
39
56
  let identifiable = $state(false);
40
57
  let duplicate = $state(false);
41
58
  let checkState = $state(null);
42
- let reason = $state(null);
43
59
  let suspectScore = $state(null);
44
60
  let suspectLevel = $state(null);
45
- let triggers = $state([]);
46
- let verdicts = $state(null);
47
61
  let report = $state(null);
48
62
  let error = $state(null);
49
63
  let isLoading = $state(false);
50
64
  let consent = $state(options.consent ?? 'pending');
51
65
  const isReady = $derived(report !== null || error !== null);
52
- const isSuspicious = $derived(verdicts === null
53
- ? false
54
- : Object.values(verdicts).some((verdict) => verdict.value && verdict.confidence !== 'low'));
66
+ const isSuspicious = $derived(isSuspiciousLevel(suspectLevel));
55
67
  let clientPromise;
56
68
  let loaded;
57
69
  let current;
70
+ let held;
71
+ let consecutiveFailures = 0;
58
72
  const mirrorConsent = (next) => {
59
73
  consent = next;
60
74
  };
@@ -64,9 +78,10 @@ export function createFingerly(options) {
64
78
  // Built once and memoised. `load()` is cheap today but is the documented
65
79
  // place for future warm-up work, and warming up per component would undo
66
80
  // it.
67
- clientPromise ??= load({
81
+ // Through a promise even though load() returns one: a synchronous throw
82
+ // here would escape every caller's .catch and leave isLoading stuck.
83
+ clientPromise ??= Promise.resolve().then(() => load({
68
84
  apiKey: options.apiKey,
69
- ...(options.endpoint === undefined ? {} : { endpoint: options.endpoint }),
70
85
  ...(options.apiVersion === undefined ? {} : { apiVersion: options.apiVersion }),
71
86
  ...(options.endpoints === undefined ? {} : { endpoints: options.endpoints }),
72
87
  ...(options.fallbackToDefaultEndpoint === undefined ? {} : { fallbackToDefaultEndpoint: options.fallbackToDefaultEndpoint }),
@@ -81,7 +96,7 @@ export function createFingerly(options) {
81
96
  fingerly.onConsentChange(mirrorConsent);
82
97
  loaded = fingerly;
83
98
  return fingerly;
84
- });
99
+ }));
85
100
  return clientPromise;
86
101
  };
87
102
  const setConsent = (next) => {
@@ -103,6 +118,11 @@ export function createFingerly(options) {
103
118
  // whole fingerprint. A promise has an identity either way.
104
119
  if (current && !identifyOptions.force)
105
120
  return current;
121
+ // Holding off after a failure; see failureHold.
122
+ const now = Date.now();
123
+ if (held && (now < held.until || (identifyOptions.automatic && now < held.automaticUntil))) {
124
+ return Promise.reject(held.error);
125
+ }
106
126
  isLoading = true;
107
127
  error = null;
108
128
  const run = client()
@@ -118,16 +138,18 @@ export function createFingerly(options) {
118
138
  identifiable = result.identifiable;
119
139
  duplicate = result.duplicate;
120
140
  checkState = result.state === '' ? null : result.state;
121
- reason = result.reason === '' ? null : result.reason;
122
- suspectScore = result.suspectScore;
123
- suspectLevel = result.suspectLevel;
124
- triggers = result.triggers;
125
- verdicts = result.verdicts;
141
+ suspectScore = result.suspectScore ?? null;
142
+ suspectLevel = result.suspectLevel ?? null;
126
143
  report = result.report;
144
+ held = undefined;
145
+ consecutiveFailures = 0;
127
146
  return result;
128
147
  })
129
148
  .catch((cause) => {
130
- error = cause instanceof Error ? cause : new Error(String(cause));
149
+ const failure = cause instanceof Error ? cause : new Error(String(cause));
150
+ error = failure;
151
+ consecutiveFailures += 1;
152
+ held = { error: failure, ...failureHold(failure, consecutiveFailures, Date.now()) };
131
153
  // Forgotten, so the next caller retries rather than being handed a
132
154
  // rejected promise forever.
133
155
  if (current === run)
@@ -135,7 +157,7 @@ export function createFingerly(options) {
135
157
  // Rethrown as well as stored: a caller that awaited identify() should
136
158
  // be able to try/catch it, and a component that only reads `error`
137
159
  // should not have to.
138
- throw error;
160
+ throw failure;
139
161
  })
140
162
  .finally(() => {
141
163
  isLoading = false;
@@ -169,21 +191,12 @@ export function createFingerly(options) {
169
191
  get state() {
170
192
  return checkState;
171
193
  },
172
- get reason() {
173
- return reason;
174
- },
175
194
  get suspectScore() {
176
195
  return suspectScore;
177
196
  },
178
197
  get suspectLevel() {
179
198
  return suspectLevel;
180
199
  },
181
- get triggers() {
182
- return triggers;
183
- },
184
- get verdicts() {
185
- return verdicts;
186
- },
187
200
  get report() {
188
201
  return report;
189
202
  },
@@ -208,4 +221,3 @@ export function createFingerly(options) {
208
221
  client,
209
222
  };
210
223
  }
211
- //# sourceMappingURL=state.svelte.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fingerly/svelte",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -26,7 +26,7 @@
26
26
  ],
27
27
  "sideEffects": false,
28
28
  "dependencies": {
29
- "@fingerly/web-js": "0.1.0"
29
+ "@fingerly/web-js": "0.1.2"
30
30
  },
31
31
  "peerDependencies": {
32
32
  "svelte": ">=5"
@@ -1 +0,0 @@
1
- {"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,OAAO,EAAkB,KAAK,QAAQ,EAAE,KAAK,eAAe,EAAE,MAAM,mBAAmB,CAAA;AAEvF;;;;;GAKG;AACH,eAAO,MAAM,YAAY,EAAE,OAAO,MAA2B,CAAA;AAE7D;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,eAAe,GAAG,QAAQ,CAIhE;AAED;;;;;;GAMG;AACH,wBAAgB,WAAW,IAAI,QAAQ,CAYtC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"context.js","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAA;AAE3D,OAAO,EAAE,cAAc,EAAuC,MAAM,mBAAmB,CAAA;AAEvF;;;;;GAKG;AACH,MAAM,CAAC,MAAM,YAAY,GAAkB,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AmB,CAAA;AAI1F,YAAY,EACV,gBAAgB,EAChB,UAAU,EACV,YAAY,EACZ,cAAc,EACd,eAAe,EACf,GAAG,EACH,aAAa,EACb,YAAY,EACZ,YAAY,EACZ,OAAO,EACP,QAAQ,GACT,MAAM,kBAAkB,CAAA;AACzB,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA"}
package/dist/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAEvE,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAA;AAGvE,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAkB3D,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"state.svelte.d.ts","sourceRoot":"","sources":["../src/state.svelte.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAEL,KAAK,YAAY,EACjB,KAAK,cAAc,EACnB,KAAK,cAAc,EACnB,KAAK,eAAe,EACpB,KAAK,YAAY,EACjB,KAAK,QAAQ,EACd,MAAM,kBAAkB,CAAA;AAEzB,4DAA4D;AAC5D,MAAM,WAAW,eAAe;IAC9B,sEAAsE;IACtE,MAAM,EAAE,MAAM,CAAA;IACd,iDAAiD;IACjD,yCAAyC;IACzC,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,MAAM,EAAE,CAAA;IACtC,yBAAyB,CAAC,EAAE,OAAO,CAAA;IACnC;;;;;;;;OAQG;IACH,MAAM,CAAC,EAAE,OAAO,CAA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