@recapi/client 0.6.6 → 0.6.7
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 +4 -1
- package/package.json +1 -1
- package/src/client.js +6 -6
package/README.md
CHANGED
|
@@ -35,7 +35,7 @@ are, gzipped, and browsers cache them:
|
|
|
35
35
|
|
|
36
36
|
```html
|
|
37
37
|
<script type="module">
|
|
38
|
-
import { createClient } from 'https://api.example.com/sdk/0.6.
|
|
38
|
+
import { createClient } from 'https://api.example.com/sdk/0.6.7/index.js';
|
|
39
39
|
|
|
40
40
|
const recapi = createClient({ apiKey: 'rk_pub_…', baseUrl: 'https://api.example.com' });
|
|
41
41
|
recapi.track('item-42', 'view'); // and the calls of the quick start below
|
|
@@ -876,6 +876,9 @@ minifier, to keep zero dev dependencies.
|
|
|
876
876
|
|
|
877
877
|
## Changes
|
|
878
878
|
|
|
879
|
+
- 2026-11-07: version 0.6.7. One damaged shown entry in the browser's storage
|
|
880
|
+
costs that item's click credit; it used to lose the visitor's id and history.
|
|
881
|
+
An entry whose time isn't a whole number is now damaged too.
|
|
879
882
|
- 2026-11-07: version 0.6.6. With a public key, `recommend()` and the event
|
|
880
883
|
batches go out with `?key=` and `Content-Type: text/plain`, no `Authorization`,
|
|
881
884
|
so a browser skips the permission request before them: a visit's first list
|
package/package.json
CHANGED
package/src/client.js
CHANGED
|
@@ -785,13 +785,13 @@ function decodePersisted(raw) {
|
|
|
785
785
|
if (raw.userId !== null && typeof raw.userId !== 'string') return null;
|
|
786
786
|
const shown = [];
|
|
787
787
|
for (const entry of raw.shown) {
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
788
|
+
// A bad entry costs that item's click credit, not the visitor's id and
|
|
789
|
+
// history. Entries without a click time are also the format of SDKs before
|
|
790
|
+
// the click window, so their storage keeps working.
|
|
791
|
+
if (Array.isArray(entry) && entry.length >= 3 && entry.length <= 4 && isId(entry[0]) && typeof entry[1] === 'string' &&
|
|
792
|
+
Number.isSafeInteger(entry[2]) && (entry.length === 3 || Number.isSafeInteger(entry[3]))) {
|
|
793
|
+
shown.push(/** @type {[string, [string, number, number?]]} */ ([entry[0], entry.slice(1)]));
|
|
791
794
|
}
|
|
792
|
-
// Entries without a click time are also the format of SDKs before the
|
|
793
|
-
// click window, so their storage keeps working.
|
|
794
|
-
if (isId(entry[0])) shown.push(/** @type {[string, [string, number, number?]]} */ ([entry[0], entry.slice(1, 4)]));
|
|
795
795
|
}
|
|
796
796
|
// Like the history's entries, a user id earlier SDKs let through but the
|
|
797
797
|
// API refuses is dropped, so requests work again (anonymously).
|