@doswiftly/storefront-sdk 21.0.0 → 22.0.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/CHANGELOG.md +35 -0
- package/README.md +818 -527
- package/dist/core/auth/handlers.d.ts +10 -9
- package/dist/core/auth/handlers.d.ts.map +1 -1
- package/dist/core/auth/handlers.js +10 -9
- package/dist/core/auth/session-events.d.ts +2 -2
- package/dist/core/auth/session-events.js +2 -2
- package/dist/core/cart/cart-client.d.ts +23 -24
- package/dist/core/cart/cart-client.d.ts.map +1 -1
- package/dist/core/cart/cart-client.js +24 -25
- package/dist/core/generated/operation-types.d.ts +52 -52
- package/dist/core/generated/operation-types.d.ts.map +1 -1
- package/dist/core/index.d.ts +1 -0
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +2 -0
- package/dist/core/middleware/session-retry.d.ts +5 -6
- package/dist/core/middleware/session-retry.d.ts.map +1 -1
- package/dist/core/middleware/session-retry.js +7 -8
- package/dist/core/operations/auth.d.ts.map +1 -1
- package/dist/core/operations/auth.js +4 -0
- package/dist/core/operations/cart.d.ts +11 -10
- package/dist/core/operations/cart.d.ts.map +1 -1
- package/dist/core/operations/cart.js +14 -11
- package/dist/core/referral/cookie-config.d.ts +56 -0
- package/dist/core/referral/cookie-config.d.ts.map +1 -0
- package/dist/core/referral/cookie-config.js +83 -0
- package/dist/react/components/PaymentInstrumentSection.d.ts +24 -24
- package/dist/react/components/PaymentInstrumentSection.d.ts.map +1 -1
- package/dist/react/components/PaymentInstrumentSection.js +15 -15
- package/dist/react/components/PaymentInstrumentTile.d.ts +19 -20
- package/dist/react/components/PaymentInstrumentTile.d.ts.map +1 -1
- package/dist/react/components/PaymentInstrumentTile.js +15 -16
- package/dist/react/helpers/browser-data.d.ts +30 -33
- package/dist/react/helpers/browser-data.d.ts.map +1 -1
- package/dist/react/helpers/browser-data.js +26 -29
- package/dist/react/hooks/use-cart-manager.d.ts +1 -1
- package/dist/react/hooks/use-cart-manager.js +1 -1
- package/dist/react/hooks/use-cart.d.ts +2 -2
- package/dist/react/hooks/use-cart.js +3 -3
- package/dist/react/hooks/use-referral-capture.d.ts +9 -0
- package/dist/react/hooks/use-referral-capture.d.ts.map +1 -0
- package/dist/react/hooks/use-referral-capture.js +40 -0
- package/dist/react/hooks/use-session-expired.d.ts +6 -5
- package/dist/react/hooks/use-session-expired.d.ts.map +1 -1
- package/dist/react/hooks/use-session-expired.js +6 -5
- package/dist/react/index.d.ts +2 -0
- package/dist/react/index.d.ts.map +1 -1
- package/dist/react/index.js +5 -1
- package/dist/react/referral.d.ts +53 -0
- package/dist/react/referral.d.ts.map +1 -0
- package/dist/react/referral.js +51 -0
- package/dist/react/server/cookie-readers.d.ts +7 -0
- package/dist/react/server/cookie-readers.d.ts.map +1 -1
- package/dist/react/server/cookie-readers.js +10 -0
- package/dist/react/server/index.d.ts +1 -1
- package/dist/react/server/index.d.ts.map +1 -1
- package/dist/react/server/index.js +2 -2
- package/dist/react/stores/auth.store.d.ts.map +1 -1
- package/dist/react/stores/auth.store.js +13 -10
- package/dist/react/stores/cart.store.d.ts +1 -1
- package/dist/react/stores/cart.store.js +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,40 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 22.0.0
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- 49139e2: Remove the `pendingPoints` field from `LoyaltyPointsSummary` (GraphQL schema, the `LoyaltyPointsSummary` fragment and the generated types). The field was never populated — it always returned `0` — because purchase points are credited directly when the payment is captured, so there is no "pending" state to report.
|
|
8
|
+
|
|
9
|
+
**Migration:** if your storefront reads `points.pendingPoints` (or selects `pendingPoints` in a custom query or fragment), remove that usage and re-run your codegen. No replacement field is needed — `currentPoints` has always been the spendable balance.
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- 49139e2: Referral program signup support — the loyalty referral program now works end-to-end:
|
|
14
|
+
- `customerSignup` accepts an optional `referralCode` in its input. When the shop's referral program is active, a valid code grants the configured bonus points to the new customer and, after their first paid order, rewards the referrer. An invalid, expired or own code is silently ignored — the signup always succeeds.
|
|
15
|
+
- New referral capture helpers in the SDK: `useReferralCapture()` / `captureReferralCode()` persist the `?ref=CODE` parameter from a referral landing link into the readable `referral-code` cookie (30 days by default), and `readReferralCodeCookie()` / `clearReferralCodeCookie()` read and clear it at signup time. A server-side `readReferralCodeCookie()` is available from `@doswiftly/storefront-sdk/react/server` for SSR-rendered signup forms. Core constants and the URL extractor (`REFERRAL_COOKIE_NAME`, `REFERRAL_COOKIE_MAX_AGE`, `extractReferralCodeFromUrl`) are exported from the framework-agnostic core entry.
|
|
16
|
+
|
|
17
|
+
The cookie lifetime is the _landing → signup_ window and is intentionally independent of the shop's referral validity setting, which starts at signup and is enforced by the API.
|
|
18
|
+
|
|
19
|
+
## 21.0.1
|
|
20
|
+
|
|
21
|
+
### Patch Changes
|
|
22
|
+
|
|
23
|
+
- 65c7f72: Fixed: cart, order, and customer address reads now include `buildingNumber` and `flatNumber`. The previous release added both fields to the schema and inputs (you could send them), but the SDK's `MailingAddress` selection did not request them back — they always came back missing on `cart.shippingAddress` / `cart.billingAddress`, order addresses, the saved address book (`getAddresses()`), and `customer.defaultAddress`. The generated types now carry both fields as well.
|
|
24
|
+
|
|
25
|
+
Documentation: rewrote the SDK README to match the current API.
|
|
26
|
+
|
|
27
|
+
The README (shown on npm and GitHub) previously described setup patterns from older releases. It now documents the current surface:
|
|
28
|
+
- **Quick start** based on `createStorefrontAuthRoute` (one route file mounting `login` / `refresh` / `logout` / `whoami`), `getInitialAuth()` server seeding, and `<StorefrontProvider>` with automatic session refresh.
|
|
29
|
+
- **Cart** chapter covering the capability model (composite `cart-id` cookie carrying the cart access secret, `cartSecretMiddleware`), the full `useCartManager` checkout lifecycle (per-operation recovery table, tagged-union `status`, lifecycle callbacks, `initialCartId`), `<CartManagerProvider>` / `useCartManagerContext()`, completion + payment session creation, discovery queries, `merge` / `downgradeOnLogout` / `recoveryRedeem`, and the framework-agnostic recovery runner.
|
|
30
|
+
- **Authentication** chapter documenting the session cookie set, proactive + reactive refresh, the BFF sign-in flow, `AuthClient` methods (including `refreshSession()` and `getAddresses()`), and reverse-proxy origin validators.
|
|
31
|
+
- Reference sections for the middleware pipeline order, debug logging (including the remote debug transport), runtime schema enums, cookie contract constants, format hooks, pre-built components (including payment instrument tiles), and server-side helpers (`readCartCredentials`, `serverCartSecretMiddleware`).
|
|
32
|
+
- A **Deprecated** section listing the legacy cart store (`createCartStore` / `CartProvider` / `useCartStore`), `AuthClient.refreshToken()` / `useRefreshToken`, and `ShopCurrencyData` with their replacements.
|
|
33
|
+
|
|
34
|
+
Also cleaned up developer-facing JSDoc across the package (clients, middleware, stores, hooks, pre-built components): comments and IDE hover text are now plain technical English, and the `getBrowserDataForPayment` example no longer suggests passing browser data to `createPayment` (its input is `{ orderId, returnUrl?, cancelUrl? }`). No runtime changes.
|
|
35
|
+
|
|
36
|
+
`@doswiftly/storefront-operations` is version-synced; no code changes.
|
|
37
|
+
|
|
3
38
|
## 21.0.0
|
|
4
39
|
|
|
5
40
|
### Major Changes
|