@doswiftly/storefront-operations 18.1.0 → 19.1.0
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/AGENTS.md +1 -1
- package/CHANGELOG.md +70 -0
- package/llms-full.txt +1 -1
- package/operations.json +1 -1
- package/package.json +1 -1
package/AGENTS.md
CHANGED
|
@@ -27,7 +27,7 @@ consumer's `codegen.ts` references this package's `.graphql` files as
|
|
|
27
27
|
live in the consumer's repo.
|
|
28
28
|
|
|
29
29
|
<!-- AUTOGEN:STATS:BEGIN — auto-regenerated, do not edit by hand -->
|
|
30
|
-
- **Schema version**:
|
|
30
|
+
- **Schema version**: 19.1.0
|
|
31
31
|
- **Queries**: 52
|
|
32
32
|
- **Mutations**: 41
|
|
33
33
|
- **Fragments**: 104
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,75 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 19.1.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 868894e: Add remote debug shipping for both GraphQL **and** cookie-lifecycle events, so you can trace a real shopper session end-to-end instead of reproducing it with DevTools open.
|
|
8
|
+
|
|
9
|
+
**Why**: the most useful checkout signal is often "when was the `cart-id` / currency / language cookie set or cleared?" (e.g. `cart-id` cleared by `complete()`), but debug output previously covered only GraphQL request/response. Now both flow through one channel keyed by a single `sessionId`, so one filter in your logs gives the full interleaved timeline.
|
|
10
|
+
|
|
11
|
+
**Additive (backward-compatible)** — everything is opt-in and off by default:
|
|
12
|
+
1. `DebugOptions.remote?: boolean | RemoteDebugOptions | RemoteDebugSink` — ship debug events to a backend ingest endpoint. Pass a pre-built transport (a `RemoteDebugSink`) to share **one** channel/`sessionId` across the client and the cookie stores.
|
|
13
|
+
2. New `createRemoteDebugTransport(...)` factory (+ `RemoteDebugTransport` / `RemoteDebugSink` / `RemoteDebugOptions` types).
|
|
14
|
+
3. Cookie stores emit a new `DebugEvent` with `phase: 'cookie'` (`{ name, action: 'set' | 'clear', value?, maxAge? }`) when wired with a sink:
|
|
15
|
+
- `createBrowserCartCookieStore({ onDebug })` — `cart-id` (when you own the cookie store).
|
|
16
|
+
- `useCartManager({ cookieDebug })` / `<CartManagerProvider cookieDebug={...}>` — `cart-id` when the cart manager owns the cookie store.
|
|
17
|
+
- `createCurrencyStore({ onDebug })` / `createLanguageStore(initial, { onDebug })` — currency / language.
|
|
18
|
+
- `<StorefrontProvider cookieDebug={...}>` forwards the sink to the currency + language stores.
|
|
19
|
+
4. `DebugOptions`, `DebugEvent`, `RemoteDebugOptions`, `RemoteDebugSink` are exported for typing.
|
|
20
|
+
|
|
21
|
+
**Usage example** (one shared channel across GraphQL + cookies):
|
|
22
|
+
|
|
23
|
+
```ts
|
|
24
|
+
import {
|
|
25
|
+
createStorefrontClient,
|
|
26
|
+
createRemoteDebugTransport,
|
|
27
|
+
createBrowserCartCookieStore,
|
|
28
|
+
} from "@doswiftly/storefront-sdk";
|
|
29
|
+
|
|
30
|
+
const debugOn = process.env.NEXT_PUBLIC_SDK_DEBUG_REMOTE === "true";
|
|
31
|
+
const transport = debugOn
|
|
32
|
+
? createRemoteDebugTransport({
|
|
33
|
+
endpoint: `${apiUrl}/storefront/debug-logs`,
|
|
34
|
+
shopSlug,
|
|
35
|
+
fetch: globalThis.fetch,
|
|
36
|
+
})
|
|
37
|
+
: null;
|
|
38
|
+
|
|
39
|
+
const client = createStorefrontClient({
|
|
40
|
+
apiUrl,
|
|
41
|
+
shopSlug,
|
|
42
|
+
debug: transport
|
|
43
|
+
? { userErrors: true, response: true, timing: true, remote: transport }
|
|
44
|
+
: false,
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
// cart-id set/clear on the same channel:
|
|
48
|
+
const cartCookieStore = createBrowserCartCookieStore(
|
|
49
|
+
transport ? { onDebug: (e) => transport.capture(e) } : undefined,
|
|
50
|
+
);
|
|
51
|
+
|
|
52
|
+
// currency + language via the provider:
|
|
53
|
+
// <StorefrontProvider cookieDebug={transport ? (e) => transport.capture(e) : undefined} … />
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Behaviour:
|
|
57
|
+
- **Batched** (default 10 events / 5s); `keepalive` is used on page-hide/unload flushes so trailing events survive a navigation or payment-gateway redirect.
|
|
58
|
+
- **Fire-and-forget**: a failed send is swallowed — telemetry can never break the request that produced it.
|
|
59
|
+
- Cookies are **not** sent (`credentials: 'omit'`); the shop is identified by the `X-Shop-Slug` header.
|
|
60
|
+
- **Redaction**: the SDK masks `Authorization` / `customerAccessToken` in _headers_. It does **not** redact request `variables` or response bodies — the backend ingest endpoint masks emails + credential-named fields. Enable `response` / `headers` only for operations whose payload you're comfortable sending to your backend.
|
|
61
|
+
- Default endpoint is `${apiUrl}/storefront/debug-logs`; override via `RemoteDebugOptions.endpoint`.
|
|
62
|
+
|
|
63
|
+
**Migration checklist for existing storefronts**:
|
|
64
|
+
- [ ] No action required — all of the above is opt-in and defaults to off.
|
|
65
|
+
- [ ] To adopt: build one transport (gated behind an env flag), pass it to `createStorefrontClient`, the cart cookie store, and `<StorefrontProvider cookieDebug>`, then confirm requests to `/storefront/debug-logs`.
|
|
66
|
+
|
|
67
|
+
## 19.0.0
|
|
68
|
+
|
|
69
|
+
### Major Changes
|
|
70
|
+
|
|
71
|
+
- 7ee241f: Version sync with `@doswiftly/storefront-sdk` (linked release group). No code change in this package.
|
|
72
|
+
|
|
3
73
|
## 18.1.0
|
|
4
74
|
|
|
5
75
|
### Minor Changes
|
package/llms-full.txt
CHANGED
package/operations.json
CHANGED