@liquidcommerce/elements-sdk 2.7.24 → 2.7.25
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/dist/index.checkout.esm.js +6861 -6858
- package/dist/index.esm.js +11485 -11482
- package/dist/types/core/google-tag-manager.service.d.ts +1 -0
- package/docs/v1/api/actions/cart-actions.md +9 -2
- package/docs/v1/api/actions/checkout-actions.md +2 -0
- package/docs/v1/api/client.md +84 -6
- package/docs/v1/api/configuration.md +10 -0
- package/docs/v1/api/typescript-types.md +5 -1
- package/docs/v1/getting-started/concepts.md +5 -3
- package/docs/v1/getting-started/installation.md +22 -1
- package/docs/v1/guides/cart-component.md +32 -0
- package/docs/v1/guides/product-component.md +6 -2
- package/docs/v1/guides/product-list-component.md +4 -5
- package/docs/v1/guides/theming.md +10 -0
- package/docs/v1/reference/analytics.md +108 -0
- package/docs/v1/reference/browser-support.md +3 -1
- package/docs/v1/reference/error-handling.md +8 -0
- package/docs/v1/reference/telemetry.md +85 -0
- package/docs/v1/reference/troubleshooting.md +1 -2
- package/package.json +4 -4
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
# Telemetry & Privacy
|
|
2
|
+
|
|
3
|
+
The SDK includes lightweight, privacy-conscious telemetry that reports errors and warnings back to LiquidCommerce so the platform can detect and fix production issues. This page is a full disclosure of **what** is collected, **when**, **where** it is sent, and **how to turn it off**.
|
|
4
|
+
|
|
5
|
+
Telemetry never blocks or breaks your page — capture and sending are wrapped so internal failures are swallowed silently.
|
|
6
|
+
|
|
7
|
+
## When It Is Enabled
|
|
8
|
+
|
|
9
|
+
Telemetry is enabled **only** when both conditions are true:
|
|
10
|
+
|
|
11
|
+
- The SDK is running in the **production** environment (`env === 'production'`), and
|
|
12
|
+
- **No custom API URL is configured** (`hasCustomApiUrl` is `false`).
|
|
13
|
+
|
|
14
|
+
In every other case it is **disabled** and no events are queued or sent:
|
|
15
|
+
|
|
16
|
+
- Non-production environments (e.g. staging/development).
|
|
17
|
+
- A custom API URL / proxy is configured via `development.customApiUrl`.
|
|
18
|
+
- Internal telemetry errors are only logged to the console in non-production or when debugging is enabled — never sent.
|
|
19
|
+
|
|
20
|
+
## What Is Collected
|
|
21
|
+
|
|
22
|
+
Each event carries the message, severity level, and timestamp, plus three context blocks.
|
|
23
|
+
|
|
24
|
+
**Browser context**
|
|
25
|
+
|
|
26
|
+
- `userAgent` — the browser user-agent string
|
|
27
|
+
- `url` — the full current page URL (`window.location.href`)
|
|
28
|
+
- `referrer` — the referring URL, if any
|
|
29
|
+
- `timezone` — the resolved IANA timezone (e.g. `America/New_York`)
|
|
30
|
+
- `deviceType` — device classification (desktop/mobile/tablet)
|
|
31
|
+
|
|
32
|
+
**User context**
|
|
33
|
+
|
|
34
|
+
- `deviceId` — the SDK-generated device id (falls back to `not_defined`)
|
|
35
|
+
- `isLocalStorageAvailable` — whether localStorage is usable
|
|
36
|
+
- `selectedAddress` — the user's currently selected **formatted address string**, if one is set
|
|
37
|
+
|
|
38
|
+
**SDK context**
|
|
39
|
+
|
|
40
|
+
- `version`, `env`, `isBuilder`, and `partnerCode`
|
|
41
|
+
|
|
42
|
+
**Errors** (when the event represents one) include the error `name`, `message`, `code`, and a stack trace **truncated to the first 10 lines**.
|
|
43
|
+
|
|
44
|
+
Only **warnings** and **errors/fatal** events are captured. Debug/log/info events are excluded by default (`includeDebugLogs: false`).
|
|
45
|
+
|
|
46
|
+
## Where It Is Sent
|
|
47
|
+
|
|
48
|
+
Events are **batched** and sent to:
|
|
49
|
+
|
|
50
|
+
```
|
|
51
|
+
<baseUrl>/api/telemetry
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
`baseUrl` is the SDK's configured API host. Because telemetry is disabled whenever a custom API URL is set, events are only ever sent to LiquidCommerce's own endpoint — never to a partner proxy.
|
|
55
|
+
|
|
56
|
+
Batches are delivered with `navigator.sendBeacon`, falling back to a **synchronous `XMLHttpRequest`** if sendBeacon is unavailable or fails. Payloads are sent as `text/plain`.
|
|
57
|
+
|
|
58
|
+
Batches flush:
|
|
59
|
+
|
|
60
|
+
- When the queue reaches the batch size (5 events in production),
|
|
61
|
+
- On a periodic timer (every 5s in production), and
|
|
62
|
+
- On page teardown (`beforeunload` / `pagehide`), so pending events are not lost.
|
|
63
|
+
|
|
64
|
+
The queue is capped (max 50 events); oldest events are dropped first if it overflows.
|
|
65
|
+
|
|
66
|
+
## Disabling Telemetry
|
|
67
|
+
|
|
68
|
+
There is no separate opt-out flag — telemetry follows the two conditions above. To ensure it never runs, do either of the following:
|
|
69
|
+
|
|
70
|
+
- Run the SDK in a **non-production** environment, or
|
|
71
|
+
- Configure a **custom API URL** so events are routed through your own infrastructure and SDK telemetry is switched off:
|
|
72
|
+
|
|
73
|
+
```javascript
|
|
74
|
+
const client = await Elements('YOUR_API_KEY', {
|
|
75
|
+
development: {
|
|
76
|
+
customApiUrl: 'https://your-proxy.example.com'
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
## Related Docs
|
|
82
|
+
|
|
83
|
+
- [Error Handling](./error-handling.md)
|
|
84
|
+
- [Client API](../api/client.md)
|
|
85
|
+
- [Troubleshooting](./troubleshooting.md)
|
|
@@ -105,8 +105,7 @@ This is expected behavior. The SDK ships SSR stubs that are automatically resolv
|
|
|
105
105
|
|
|
106
106
|
**Fixes:**
|
|
107
107
|
- Verify all 5 required fields are set: `promoCode`, `text`, `separator`, `activeFrom`, `activeUntil`.
|
|
108
|
-
- Check that the current time falls between `activeFrom` and `activeUntil` (ISO 8601 UTC format).
|
|
109
|
-
- Ensure `global.layout.allowPromoCodes` is not set to `false`.
|
|
108
|
+
- Check that the current time falls between `activeFrom` and `activeUntil` (ISO 8601 UTC format). The ticker only renders when at least one configured ticker is currently active — the active window is evaluated against the shopper's timezone (derived from the current address state, falling back to the browser timezone), so a ticker with a valid but out-of-window range will not appear.
|
|
110
109
|
|
|
111
110
|
## Ad Blockers Blocking SDK Requests
|
|
112
111
|
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"description": "LiquidCommerce Elements SDK",
|
|
4
4
|
"license": "UNLICENSED",
|
|
5
5
|
"author": "LiquidCommerce Team",
|
|
6
|
-
"version": "2.7.
|
|
6
|
+
"version": "2.7.25",
|
|
7
7
|
"homepage": "https://docs.liquidcommerce.co/elements-sdk",
|
|
8
8
|
"repository": {
|
|
9
9
|
"type": "git",
|
|
@@ -78,8 +78,8 @@
|
|
|
78
78
|
"embeddable commerce"
|
|
79
79
|
],
|
|
80
80
|
"devDependencies": {
|
|
81
|
-
"@biomejs/biome": "^2.5.
|
|
82
|
-
"@commitlint/cli": "^21.2.
|
|
81
|
+
"@biomejs/biome": "^2.5.3",
|
|
82
|
+
"@commitlint/cli": "^21.2.1",
|
|
83
83
|
"@commitlint/config-conventional": "^21.2.0",
|
|
84
84
|
"@rollup/plugin-alias": "^6.0.0",
|
|
85
85
|
"@rollup/plugin-commonjs": "^29.0.3",
|
|
@@ -94,7 +94,7 @@
|
|
|
94
94
|
"@semantic-release/npm": "^13.1.5",
|
|
95
95
|
"@semantic-release/release-notes-generator": "^14.1.1",
|
|
96
96
|
"@types/core-js": "^2.5.8",
|
|
97
|
-
"@types/node": "^26.1.
|
|
97
|
+
"@types/node": "^26.1.1",
|
|
98
98
|
"conventional-changelog": "8.0.1",
|
|
99
99
|
"husky": "^9.1.7",
|
|
100
100
|
"process": "^0.11.10",
|