@recapi/client 0.36.0 → 0.36.1
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 +9 -7
- package/package.json +1 -1
- package/src/cards.js +14 -0
- package/src/magento.js +2 -1
package/README.md
CHANGED
|
@@ -54,7 +54,7 @@ are, gzipped, and browsers cache them:
|
|
|
54
54
|
|
|
55
55
|
```html
|
|
56
56
|
<script type="module">
|
|
57
|
-
import { createClient } from 'https://api.example.com/sdk/0.36.
|
|
57
|
+
import { createClient } from 'https://api.example.com/sdk/0.36.1/index.js';
|
|
58
58
|
|
|
59
59
|
const recapi = createClient({ apiKey: 'rk_pub_…', baseUrl: 'https://api.example.com', consent: false });
|
|
60
60
|
// From your cookie banner, once the visitor agrees: recapi.setConsent(true).
|
|
@@ -947,7 +947,7 @@ row, with nothing to set in the dashboard (`BOUGHT_TOGETHER` is the product
|
|
|
947
947
|
page's second row).
|
|
948
948
|
|
|
949
949
|
```js
|
|
950
|
-
import { RECENTLY_VIEWED } from 'https://api.example.com/sdk/0.36.
|
|
950
|
+
import { RECENTLY_VIEWED } from 'https://api.example.com/sdk/0.36.1/index.js';
|
|
951
951
|
|
|
952
952
|
const [home, recent] = await recapi.recommendLists({
|
|
953
953
|
lists: [{ placement: 'home', count: 4 }, { placement: RECENTLY_VIEWED, count: 4 }]
|
|
@@ -1353,16 +1353,16 @@ key on a format change makes old data invisible.
|
|
|
1353
1353
|
## Size budget
|
|
1354
1354
|
|
|
1355
1355
|
What a first visit downloads before the library runs: each entry is one
|
|
1356
|
-
file, joined and gzipped as the API serves it (library 0.36.
|
|
1356
|
+
file, joined and gzipped as the API serves it (library 0.36.1). A test fails
|
|
1357
1357
|
when an entry passes its budget (`go test ./internal/jssdk -run SizeBudget -v`
|
|
1358
1358
|
in `server/` prints these):
|
|
1359
1359
|
|
|
1360
1360
|
| Entry | Bytes | Gzipped | Budget | Its files as they are |
|
|
1361
1361
|
|---|--:|--:|--:|--:|
|
|
1362
|
-
| `index.js` (the pasted tag) |
|
|
1363
|
-
| `woocommerce.js` | 53,
|
|
1364
|
-
| `shopify.js` | 56,
|
|
1365
|
-
| `magento.js` | 53,
|
|
1362
|
+
| `index.js` (the pasted tag) | 44,075 | 17,672 | 18,000 | 6 files, 39,877 |
|
|
1363
|
+
| `woocommerce.js` | 53,955 | 21,211 | 21,450 | 9 files, 56,688 |
|
|
1364
|
+
| `shopify.js` | 56,665 | 22,269 | 22,550 | 9 files, 59,658 |
|
|
1365
|
+
| `magento.js` | 53,278 | 20,940 | 21,200 | 9 files, 56,320 |
|
|
1366
1366
|
|
|
1367
1367
|
`index.js` holds the row too, which it used to fetch at the first `row()`.
|
|
1368
1368
|
|
|
@@ -1380,6 +1380,8 @@ in `server/` writes the files as served, for `scripts/e2e/chain.mjs /tmp/served`
|
|
|
1380
1380
|
|
|
1381
1381
|
## Changes
|
|
1382
1382
|
|
|
1383
|
+
- 2026-12-04: version 0.36.1. In a marked browser the line under the row
|
|
1384
|
+
goes when its row hides, and comes back with the next row drawn.
|
|
1383
1385
|
- 2026-12-04: version 0.36.0. A visitor without consent can name the
|
|
1384
1386
|
product page they came from (`contextItemId` on `track()`);
|
|
1385
1387
|
`track('view')` and the Shopify snippet read it from the browser.
|
package/package.json
CHANGED
package/src/cards.js
CHANGED
|
@@ -232,10 +232,23 @@ export function carry(url, recommendationId) {
|
|
|
232
232
|
/** The bought-together title only over a real pair: similar products under it would be true cards under a false title. */
|
|
233
233
|
export const paired = (cards) => cards.some(({ why }) => why === 'bought_together');
|
|
234
234
|
|
|
235
|
+
/** The staff line put under a row (ownLine), by row. */
|
|
236
|
+
const lineUnder = new WeakMap();
|
|
237
|
+
|
|
238
|
+
/**
|
|
239
|
+
* The staff line goes with the row it is under, hidden or emptied, or it
|
|
240
|
+
* would stand alone under nothing; the next row drawn puts it back.
|
|
241
|
+
*/
|
|
242
|
+
export function unlined(el) {
|
|
243
|
+
lineUnder.get(el)?.remove();
|
|
244
|
+
lineUnder.delete(el);
|
|
245
|
+
}
|
|
246
|
+
|
|
235
247
|
/** Not only [hidden]: any display rule of the site's beats that one. */
|
|
236
248
|
export function hide(el) {
|
|
237
249
|
el.hidden = true;
|
|
238
250
|
el.style.setProperty('display', 'none', 'important');
|
|
251
|
+
unlined(el);
|
|
239
252
|
}
|
|
240
253
|
|
|
241
254
|
/**
|
|
@@ -273,5 +286,6 @@ export function ownLine(el) {
|
|
|
273
286
|
line.remove();
|
|
274
287
|
});
|
|
275
288
|
line.append(button);
|
|
289
|
+
lineUnder.set(el, line);
|
|
276
290
|
el.insertAdjacentElement('afterend', line);
|
|
277
291
|
}
|
package/src/magento.js
CHANGED
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
*/
|
|
17
17
|
|
|
18
18
|
import { createClient } from './index.js';
|
|
19
|
-
import { GRID, addStyle, blankStyle, blanks, card, cardStyle, carry, escape, headingAbove, idOf, listOf, listStyle, nameOf, nameStyle, near, opened, ownLine, paired, pictureOf, recentlyViewed, region, wasOf, wasStyle, web } from './cards.js';
|
|
19
|
+
import { GRID, addStyle, blankStyle, blanks, card, cardStyle, carry, escape, headingAbove, idOf, listOf, listStyle, nameOf, nameStyle, near, opened, ownLine, paired, pictureOf, recentlyViewed, region, unlined, wasOf, wasStyle, web } from './cards.js';
|
|
20
20
|
import { bought, fillRows, followReturns, landing, onReturn, orderStorage } from './shops.js';
|
|
21
21
|
import { storageKey } from './storage.js';
|
|
22
22
|
// Their own imports, named so the browser asks for all at once (TestEntriesImportTheirWholeGraph).
|
|
@@ -242,6 +242,7 @@ export async function magentoPage(page) {
|
|
|
242
242
|
if (!cards.length) {
|
|
243
243
|
row.slot.innerHTML = '';
|
|
244
244
|
blockOf(row.slot).hidden = true;
|
|
245
|
+
unlined(blockOf(row.slot));
|
|
245
246
|
return;
|
|
246
247
|
}
|
|
247
248
|
if (!styledYet) styled();
|