@konfiqo/storefront-react 0.6.0 → 0.6.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 +6 -2
- package/dist/index.cjs +17 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -1
- package/dist/index.d.ts +4 -1
- package/dist/index.js +17 -0
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -11,7 +11,7 @@ the payment form and the checkout challenge.
|
|
|
11
11
|
"build your own storefront" guide.
|
|
12
12
|
- No styling: components render a plain `<div>` you can give a `className`.
|
|
13
13
|
- No runtime dependencies. Peer dependencies: `@konfiqo/storefront-sdk`
|
|
14
|
-
`^0.6.
|
|
14
|
+
`^0.6.1` and `react` ≥ 18. Install the SDK yourself, so your code and this
|
|
15
15
|
package share one copy (`isStorefrontError` also recognises errors from a
|
|
16
16
|
second copy, but one copy keeps the bundle small).
|
|
17
17
|
- Server-rendering safe: nothing touches `window`, `document` or storage
|
|
@@ -380,7 +380,11 @@ export function Tracking({
|
|
|
380
380
|
variant id). Ids follow the product feed rows: pass `variantId` as soon
|
|
381
381
|
as a variant is chosen; before that, `view_item` names the product as a
|
|
382
382
|
`product_group`. Prices are in minor units, in the `currency` given to
|
|
383
|
-
`AdPixelsLoader` (ISO 4217, default `'TRY'`).
|
|
383
|
+
`AdPixelsLoader` (ISO 4217, default `'TRY'`). Events fired before the
|
|
384
|
+
shopper's choice is read (for example from a mount effect during
|
|
385
|
+
hydration) are held, up to 20. The first configuration sends them if it carries a
|
|
386
|
+
`marketing` grant; otherwise they are dropped, and a later grant does
|
|
387
|
+
not send them.
|
|
384
388
|
- **Which pixels and cookies a host may use.** On a default store domain,
|
|
385
389
|
filter with the SDK's `onDefaultDomain`, `pixelsForHost` and
|
|
386
390
|
`cookiesForHost`. They are server-safe, so call them in server
|
package/dist/index.cjs
CHANGED
|
@@ -1474,12 +1474,17 @@ var pixels;
|
|
|
1474
1474
|
var currency = DEFAULT_CURRENCY;
|
|
1475
1475
|
var granted = false;
|
|
1476
1476
|
var loaded = /* @__PURE__ */ new Set();
|
|
1477
|
+
var configured = false;
|
|
1478
|
+
var MAX_EARLY = 20;
|
|
1479
|
+
var early = [];
|
|
1477
1480
|
function resetPixels() {
|
|
1478
1481
|
pixels = void 0;
|
|
1479
1482
|
currency = DEFAULT_CURRENCY;
|
|
1480
1483
|
granted = false;
|
|
1481
1484
|
optedOut = false;
|
|
1482
1485
|
loaded.clear();
|
|
1486
|
+
configured = false;
|
|
1487
|
+
early.length = 0;
|
|
1483
1488
|
}
|
|
1484
1489
|
var major = (minor) => minor / 100;
|
|
1485
1490
|
function addScript(src) {
|
|
@@ -1699,6 +1704,8 @@ function optIn(p) {
|
|
|
1699
1704
|
}
|
|
1700
1705
|
}
|
|
1701
1706
|
function configurePixels(next, isGranted, opts = {}) {
|
|
1707
|
+
const held = configured ? [] : early.splice(0);
|
|
1708
|
+
configured = true;
|
|
1702
1709
|
try {
|
|
1703
1710
|
pixels = next;
|
|
1704
1711
|
currency = opts.currency ?? DEFAULT_CURRENCY;
|
|
@@ -1715,6 +1722,7 @@ function configurePixels(next, isGranted, opts = {}) {
|
|
|
1715
1722
|
writeMarker(false);
|
|
1716
1723
|
}
|
|
1717
1724
|
}
|
|
1725
|
+
for (const e of held) send2(e);
|
|
1718
1726
|
} catch {
|
|
1719
1727
|
}
|
|
1720
1728
|
}
|
|
@@ -1732,6 +1740,15 @@ function markPurchased(orderId) {
|
|
|
1732
1740
|
}
|
|
1733
1741
|
}
|
|
1734
1742
|
function firePixel(e) {
|
|
1743
|
+
if (!configured) {
|
|
1744
|
+
if (typeof window === "undefined" || onSecretPage()) return;
|
|
1745
|
+
early.push(e);
|
|
1746
|
+
if (early.length > MAX_EARLY) early.shift();
|
|
1747
|
+
return;
|
|
1748
|
+
}
|
|
1749
|
+
send2(e);
|
|
1750
|
+
}
|
|
1751
|
+
function send2(e) {
|
|
1735
1752
|
try {
|
|
1736
1753
|
if (!granted || !pixels || onSecretPage()) return;
|
|
1737
1754
|
loadAll(pixels);
|