@doswiftly/storefront-sdk 14.0.0 → 16.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.
Files changed (42) hide show
  1. package/CHANGELOG.md +294 -0
  2. package/README.md +28 -0
  3. package/dist/core/auth/auth-client.d.ts +13 -1
  4. package/dist/core/auth/auth-client.d.ts.map +1 -1
  5. package/dist/core/auth/auth-client.js +16 -1
  6. package/dist/core/auth/types.d.ts +18 -52
  7. package/dist/core/auth/types.d.ts.map +1 -1
  8. package/dist/core/auth/types.js +0 -3
  9. package/dist/core/cart/cart-client.d.ts +50 -1
  10. package/dist/core/cart/cart-client.d.ts.map +1 -1
  11. package/dist/core/cart/cart-client.js +63 -1
  12. package/dist/core/cart/types.d.ts +75 -391
  13. package/dist/core/cart/types.d.ts.map +1 -1
  14. package/dist/core/cart/types.js +0 -8
  15. package/dist/core/format.d.ts +81 -46
  16. package/dist/core/format.d.ts.map +1 -1
  17. package/dist/core/format.js +116 -94
  18. package/dist/core/generated/operation-types.d.ts +4486 -0
  19. package/dist/core/generated/operation-types.d.ts.map +1 -0
  20. package/dist/core/generated/operation-types.js +4 -0
  21. package/dist/core/index.d.ts +3 -3
  22. package/dist/core/index.d.ts.map +1 -1
  23. package/dist/core/index.js +1 -1
  24. package/dist/core/operations/auth.d.ts +7 -0
  25. package/dist/core/operations/auth.d.ts.map +1 -1
  26. package/dist/core/operations/auth.js +68 -0
  27. package/dist/core/operations/cart.d.ts +30 -0
  28. package/dist/core/operations/cart.d.ts.map +1 -1
  29. package/dist/core/operations/cart.js +158 -0
  30. package/dist/react/components/Money.d.ts +22 -8
  31. package/dist/react/components/Money.d.ts.map +1 -1
  32. package/dist/react/components/Money.js +16 -9
  33. package/dist/react/hooks/use-cart.d.ts +78 -0
  34. package/dist/react/hooks/use-cart.d.ts.map +1 -0
  35. package/dist/react/hooks/use-cart.js +121 -0
  36. package/dist/react/hooks/use-format.d.ts +85 -0
  37. package/dist/react/hooks/use-format.d.ts.map +1 -0
  38. package/dist/react/hooks/use-format.js +141 -0
  39. package/dist/react/index.d.ts +2 -0
  40. package/dist/react/index.d.ts.map +1 -1
  41. package/dist/react/index.js +3 -0
  42. package/package.json +7 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,299 @@
1
1
  # Changelog
2
2
 
3
+ ## 16.0.0
4
+
5
+ ### Major Changes
6
+
7
+ - ca67b92: **BREAKING** — the formatting utilities switch from a hardcoded 13-currency map to runtime-driven `Intl.NumberFormat` resolution. Every ISO 4217 currency known to the runtime is now supported, with the locale-correct symbol and separators.
8
+
9
+ **API changes**
10
+ - `formatDate(date, locale)` — `locale` is now a required argument. The previous hardcoded `'en-US'` default is gone.
11
+ - `formatDateTime(date, locale)` — `locale` required.
12
+ - `formatNumber(num, locale)` — `locale` required.
13
+ - `formatPrice(price, locale?)` — `locale` is now optional. When omitted, the runtime default (`Intl.NumberFormat().resolvedOptions().locale`) is used. The previous `CURRENCY_LOCALES`-keyed auto-selection is gone.
14
+ - `formatAmount(amount, currencyCode, locale?)` — third argument added (optional).
15
+ - `formatPriceRange(min, max, locale?)` — third argument added (optional).
16
+ - `getCurrencySymbol(code, locale?)` — second argument added (optional). The symbol is derived from `Intl.NumberFormat.formatToParts()`; output depends on the locale (`getCurrencySymbol('PLN', 'pl-PL') === 'zł'`, `getCurrencySymbol('PLN', 'en-US') === 'PLN'`).
17
+
18
+ **Removed exports**
19
+ - `CURRENCY_SYMBOLS` — the 13-entry map is gone. Use `getCurrencySymbol(code, locale)` instead, or read the symbol from `Intl.NumberFormat.formatToParts()` directly.
20
+ - `CURRENCY_LOCALES` — the locale-to-currency map is gone. Pick the locale from the storefront's i18n context (or read `shop.localeToCurrencyMap` from the API for per-shop overrides) and pass it to `formatPrice` / `formatAmount`.
21
+
22
+ **Why**
23
+ - The hardcoded 13-currency map covered ~7% of the ISO 4217 currencies the API now ships in `CurrencyCode` (~180 entries). Every currency outside that list silently fell back to `en-US` formatting — a Brazilian (BRL) or Indian (INR) storefront had to either write its own formatter or accept US-style output.
24
+ - Locale↔currency is a **per-shop** decision (`shop.localeToCurrencyMap` in the schema is explicitly marked SSOT). A globally-hardcoded map in the SDK is the wrong place for that knowledge — it makes Polish customers of a multi-locale shop unable to see PLN in `'en-PL'` even when the merchant configured it.
25
+ - Money precision: `formatPrice` and `formatAmount` no longer apply `parseFloat` to `Money.amount`. Decimal strings are forwarded to `Intl.NumberFormat.format()` verbatim, preserving precision across locales and unusual subunit currencies (JPY/KRW zero-decimal, BHD/JOD/KWD three-decimal, ISK rounding).
26
+
27
+ **Migration**
28
+
29
+ ```ts
30
+ // Before
31
+ import {
32
+ formatDate,
33
+ formatPrice,
34
+ CURRENCY_LOCALES,
35
+ CURRENCY_SYMBOLS,
36
+ } from "@doswiftly/storefront-sdk";
37
+
38
+ formatDate(order.createdAt); // hardcoded "Dec 9, 2025"
39
+ formatPrice({ amount: "12.50", currencyCode: "PLN" }); // auto-picked pl-PL → "12,50 zł"
40
+ CURRENCY_LOCALES.PLN; // "pl-PL"
41
+ CURRENCY_SYMBOLS.PLN; // "zł"
42
+
43
+ // After (Client Components)
44
+ import { useLocale } from "next-intl";
45
+ import {
46
+ formatDate,
47
+ formatPrice,
48
+ getCurrencySymbol,
49
+ } from "@doswiftly/storefront-sdk";
50
+
51
+ const locale = useLocale(); // e.g. "pl-PL"
52
+ formatDate(order.createdAt, locale);
53
+ formatPrice({ amount: "12.50", currencyCode: "PLN" }, locale);
54
+ getCurrencySymbol("PLN", locale); // "zł"
55
+
56
+ // After (Server Components / Route Handlers)
57
+ import { getLocale } from "next-intl/server";
58
+ const locale = await getLocale();
59
+ formatDate(order.createdAt, locale);
60
+ ```
61
+
62
+ For per-shop locale↔currency overrides, read `shop.localeToCurrencyMap` from the Storefront API and resolve the locale yourself before calling `formatPrice` / `formatAmount`.
63
+
64
+ **New: Context-driven format hooks**
65
+
66
+ `@doswiftly/storefront-sdk/react` now ships convenience hooks that pull the active language from `useLanguageStore` (inside `<StorefrontProvider>`) and return a memoised, locale-bound formatter. Use them when you don't want to pass `locale` to every call:
67
+
68
+ ```ts
69
+ import {
70
+ useFormatPrice,
71
+ useFormatAmount,
72
+ useFormatPriceRange,
73
+ useFormatDate,
74
+ useFormatDateTime,
75
+ useFormatNumber,
76
+ useGetCurrencySymbol,
77
+ } from '@doswiftly/storefront-sdk/react';
78
+
79
+ function Cart() {
80
+ const formatPrice = useFormatPrice();
81
+ return <span>{formatPrice(item.price)}</span>;
82
+ }
83
+
84
+ function OrderRow() {
85
+ const formatDate = useFormatDate();
86
+ return <span>{formatDate(order.processedAt)}</span>;
87
+ }
88
+ ```
89
+
90
+ Each hook accepts an optional last `localeOverride` argument that wins over the store value — useful for a "show in US format" toggle on a single element:
91
+
92
+ ```ts
93
+ const formatPrice = useFormatPrice();
94
+ return <span>{formatPrice(item.price, 'en-US')}</span>;
95
+ ```
96
+
97
+ Resolution per call: `localeOverride` → `useLanguageStore().language` → runtime default.
98
+
99
+ Use the vanilla `formatPrice` / `formatDate` / etc. from `@doswiftly/storefront-sdk` (no hook) with an explicit `locale` for server components, e-mail templates, or any code path outside a provider.
100
+
101
+ `formatPercentage` is unchanged.
102
+
103
+ `@doswiftly/storefront-operations` bumped to keep linked parity — no operations changes.
104
+
105
+ ### Minor Changes
106
+
107
+ - 885c011: Re-export checkout types from the public API. `CartClient` methods added in 15.1.0 (`getAvailablePaymentMethods`, `getAvailableShippingMethods`) returned typed payloads, but the named types were not part of the public surface — component props and function signatures touching these payloads required `Awaited<ReturnType<...>>` workarounds. This change closes that gap.
108
+
109
+ **Newly exported types:**
110
+ - `PaymentMethod`, `AvailablePaymentMethods` — shape returned by `CartClient.getAvailablePaymentMethods()`
111
+ - `AvailableShippingMethod`, `AvailableShippingMethodsPayload`, `FreeShippingProgress`, `DeliveryEstimate`, `ShippingCarrier`, `DeliveryType` — shape returned by `CartClient.getAvailableShippingMethods()`
112
+ - `PickupPoint`, `PickupPointInput` — locker / pickup-point delivery (surfaced via `MailingAddress.pickupPoint` and `CartAddressInput.pickupPoint`)
113
+ - `CartAttributeInput` — input shape for `CartClient.updateAttributes()`
114
+ - `ShippingAddressInput` — input shape for the `availableShippingMethods` standalone query
115
+
116
+ **Example:**
117
+
118
+ ```ts
119
+ import type {
120
+ AvailableShippingMethodsPayload,
121
+ AvailableShippingMethod,
122
+ DeliveryType,
123
+ } from "@doswiftly/storefront-sdk";
124
+
125
+ function isPickup(method: AvailableShippingMethod): boolean {
126
+ return method.deliveryType === "PICKUP_POINT";
127
+ }
128
+ ```
129
+
130
+ No runtime changes — types already existed internally; this change only adds them to the published surface.
131
+
132
+ `@doswiftly/storefront-operations` bumped to keep linked parity — no operations changes.
133
+
134
+ - fd3d199: Expose `cart.cost.totalDiscount` and `cart.cost.totalShipping` through the `CartCost` fragment.
135
+
136
+ The schema already exposed `CartCost.totalDiscount: Money!` (aggregate of every entry in `cart.discountAllocations`) and `CartCost.totalShipping: Money` (cost of the currently selected shipping method, `null` until one is selected), but the shared `CartCost` fragment did not select them — so they were not part of the typed `Cart.cost` returned by `CartClient`. Storefronts wanting to render a single "Discounts: -X" row or a shipping summary had to either sum `discountAllocations` client-side (precision-sensitive across currencies) or query the schema directly and bypass the typed surface.
137
+
138
+ After this release, both fields are part of `Cart.cost` returned by every `CartClient` operation — `get`, `create`, `addItems`, `updateItems`, `removeItems`, `setShippingAddress`, `setBillingAddress`, `selectShippingMethod`, `selectPaymentMethod`, `updateBuyerIdentity`, `updateDiscountCodes`, `updateNote`, `updateAttributes`, `applyGiftCard`, `removeGiftCard`, `updateGiftCardRecipient`.
139
+
140
+ **Example:**
141
+
142
+ ```ts
143
+ const cart = await cartClient.get(cartId);
144
+
145
+ const summary = {
146
+ subtotal: cart.cost.subtotal,
147
+ discount: cart.cost.totalDiscount, // Money — defaults to amount 0
148
+ shipping: cart.cost.totalShipping, // Money | null — null until selectShippingMethod()
149
+ tax: cart.cost.totalTax,
150
+ total: cart.cost.total, // grand total — use directly on checkout summary
151
+ };
152
+ ```
153
+
154
+ `totalDiscount` is required (defaults to amount 0 when no discount applies). `totalShipping` is nullable — `null` means no shipping method has been selected yet, an amount of 0 means a free-shipping method was selected.
155
+
156
+ Additive — existing consumers keep every field they had before, no breaking change.
157
+
158
+ `@doswiftly/storefront-operations` bumped to keep linked parity (fragment update).
159
+
160
+ - 51091df: Expose `Cart.status` and `Cart.completedOrder` so storefronts can detect a completed (or expired / abandoned) cart on read, without having to attempt a mutation first and react to its `userErrors[].code`.
161
+
162
+ **New fields**
163
+ - `Cart.status: CartStatus!` — lifecycle status (`ACTIVE`, `ABANDONED`, `CONVERTED`, `RECOVERED`, `EXPIRED`). Only `ACTIVE` carts accept mutations; any other status rejects subsequent mutations with `CartErrorCode.ALREADY_COMPLETED`.
164
+ - `Cart.completedOrder: Order` — the order this cart converted into. Populated only when `status === CONVERTED`; null on every other status.
165
+
166
+ **Why**
167
+
168
+ When a buyer returned to the checkout page after completing their order (SSR re-render, deep link, "back" button after redirect), the SDK could only ask `cart(id)` for the cart and got the full pre-completion state back — every form value still there, the "Pay" button still active. The first mutation then failed with `ALREADY_COMPLETED`, after the buyer had already filled out fields. With `status` exposed, the storefront detects the terminal state on initial render and redirects to the order confirmation directly — using the `accessToken` on `completedOrder` for guest tracking, no extra `orderByToken` round-trip.
169
+
170
+ **Example**
171
+
172
+ ```ts
173
+ const cart = await cartClient.get(cartId);
174
+ if (!cart) {
175
+ // Cart not found — guide the buyer to create a new one
176
+ return redirect("/cart");
177
+ }
178
+ if (cart.status !== "ACTIVE") {
179
+ if (cart.completedOrder) {
180
+ // Render the order confirmation page off the data you already have
181
+ return redirect(`/order/${cart.completedOrder.accessToken}`);
182
+ }
183
+ // Abandoned / expired — start a fresh cart
184
+ return redirect("/cart/new");
185
+ }
186
+ // Render the checkout form normally
187
+ ```
188
+
189
+ Additive — every existing query that selects the shared `Cart` fragment now sees the two new fields automatically. No breaking change.
190
+
191
+ `@doswiftly/storefront-operations` bumped to keep linked parity — schema sync delivers the new fields and the `CartStatus` enum.
192
+
193
+ ### Patch Changes
194
+
195
+ - 7ce8ac4: Clarify how `apiUrl` and `shopSlug` are configured.
196
+
197
+ `createStorefrontClient` and `<StorefrontProvider>` take `apiUrl` and `shopSlug` as **explicit `config`** — the SDK does not read environment variables, sniff hostnames, or inspect request headers. The storefront supplies the values; the SDK uses them verbatim.
198
+
199
+ Scaffolded storefronts ship a config helper (`lib/graphql/config.ts`) that resolves the two values from these sources, in order:
200
+ 1. `doswiftly.config.ts` (preferred — committed file generated at `doswiftly init`)
201
+ 2. `NEXT_PUBLIC_API_URL` + `NEXT_PUBLIC_SHOP_SLUG` (fallback, used for local development)
202
+ 3. `http://localhost:8000` + `demo-shop` (defaults — smoke test only)
203
+
204
+ Scratch-built storefronts can skip the helper and pass values into `config={}` directly.
205
+
206
+ **What's new**
207
+ - `@doswiftly/storefront-sdk` README: new `## Configuration` section between `## Installation` and `## Quick Start`. Documents the explicit-config requirement, the three-source resolver shipped with scaffolded storefronts, and when env-var wiring actually matters.
208
+ - `@doswiftly/storefront-operations` `AGENTS.md`: new `### Configuration sources` convention inside `## Critical conventions — DO NOT hallucinate`. AI assistants now prefer `doswiftly.config.ts` and only fall back to the canonical env-var names.
209
+
210
+ Documentation only — no code change.
211
+
212
+ - f4efab9: Add `ShopConfigFields` fragment + `query ShopConfig` for `<StorefrontProvider>` setup.
213
+
214
+ `<StorefrontProvider shopData={...}>` from `@doswiftly/storefront-sdk/react` expects a `ShopConfig` payload with a specific shape: currency setup (including `localeToCurrencyMap`), language setup, and bot protection. Until now the storefront had to hand-write the field selection, and it was easy to miss `localeToCurrencyMap` (used internally by the SDK for browser-locale-based currency detection) or to add an extra field that didn't match the `ShopConfig` interface.
215
+
216
+ **New**
217
+ - `fragment ShopConfigFields on Shop` — minimal selection that matches the `ShopConfig` interface 1:1.
218
+ - `query ShopConfig { shop { ...ShopConfigFields } }` — ready-to-use query for the provider.
219
+
220
+ **Example**
221
+
222
+ ```ts
223
+ const SHOP_CONFIG_QUERY = /* GraphQL */ `
224
+ query ShopConfig {
225
+ shop {
226
+ ...ShopConfigFields
227
+ }
228
+ }
229
+ `;
230
+
231
+ // In a Server Component:
232
+ const { data } = await execute(SHOP_CONFIG_QUERY);
233
+ return <StorefrontProvider shopData={data.shop}>{children}</StorefrontProvider>;
234
+ ```
235
+
236
+ Use the larger `Shop` fragment + `query Shop` when you also need branding / contact / business hours for your UI; use `ShopConfig` when you only need to bootstrap the provider.
237
+
238
+ Additive — no breaking change.
239
+
240
+ `@doswiftly/storefront-sdk` bumped to keep linked parity — no code change.
241
+
242
+ ## 15.1.0
243
+
244
+ ### Minor Changes
245
+
246
+ - 94c2603: Storefront SDK now covers the full checkout flow end-to-end through typed methods — no more dropping to raw GraphQL for shipping discovery, payment listing, guest order lookup, cart attributes, or saved-address pickers.
247
+
248
+ **New `CartClient` methods**
249
+ - `getAvailableShippingMethods(cartId, address)` — cart-aware shipping discovery. Resolves with `null` when the cart does not exist or has expired (symmetric with `get(cartId)`), otherwise with `AvailableShippingMethodsPayload`: `methods[]` (each carrying `deliveryType` — `HOME`, `PICKUP_POINT`, `LOCKER` — so the storefront picks the pickup / locker UI without inferring from the method name), `freeShippingProgress` (best progress across methods, for the picker banner), and `userErrors[]` populated for business conditions like `DIGITAL_ONLY_NO_SHIPPING` (cart with no shippable lines) or `NO_SHIPPING_METHODS` (unsupported address). Branch on `result.userErrors[0].code`; the `message` is localized per the request's `Accept-Language`.
250
+ - `getAvailablePaymentMethods()` — shop-level list of active payment methods. Returns `AvailablePaymentMethods`: `methods[]` (sorted by merchant position) and `defaultMethod` (merchant-flagged pre-selection). Prefer `result.defaultMethod ?? result.methods.find(m => m.isDefault)` — the merchant may override the default independently of per-method flags.
251
+ - `getOrderByToken(token, email?)` — guest order lookup by opaque access token (returned in `complete().order.accessToken`). Optional `email` adds defense in depth; mismatch returns the same `null` shape as an invalid token. Rate-limited server-side (5 req / min per IP + shop).
252
+ - `updateAttributes(cartId, attributes)` — replace-all of the cart's custom `{ key, value }` pairs (delivery instructions, gift-wrap flags, B2B PO numbers). Pass an empty array to clear.
253
+
254
+ **New `AuthClient` method**
255
+ - `getAddresses()` — saved address book of the authenticated customer (shipping + billing). Resolves with the address list when authenticated, with `null` when no auth context reached the server (symmetric with `getCustomer()`). Each entry carries B2B fields (`taxId`, `vatNumber`) and the `isDefault` flag, so the same list serves both shipping and billing pickers.
256
+
257
+ **Schema additions (operations package)**
258
+ - `MailingAddress` now exposes `taxId`, `vatNumber`, and `pickupPoint`. The new `PickupPoint` type (`provider`, `pointId`, `name?`, `address?`) is returned on shipping addresses delivered to a parcel locker / collection point.
259
+ - `AvailableShippingMethod` gains the declarative `deliveryType` enum.
260
+ - `CartAppliedGiftCard` now exposes `id` — the stable handle to pass to `cartRemoveGiftCard` (no need to keep the raw gift card code on the client).
261
+ - New `CustomerAddresses` query — `customer.addresses(first: 50)` connection returning the address book, normalized to a node list by the SDK wrapper.
262
+
263
+ **SDK fragment changes**
264
+
265
+ The SDK's `MailingAddress` fragment now selects `taxId`, `vatNumber`, and `pickupPoint`. Existing types that include a mailing address (`Cart.shippingAddress`, `Cart.billingAddress`, `Order.shippingAddress`, `Customer.defaultAddress`) get these fields automatically. The `AvailableShippingMethod` fragment selects `deliveryType`. The `CartAppliedGiftCard` fragment selects `id`.
266
+
267
+ **New React hook — server-driven checkout**
268
+ - `useCart(cartId, options?)` — sister of `useCartManager`, bound to an explicit `cartId` instead of the `cart-id` cookie. Use it for SSR-rendered checkout, deep-link order recovery, and admin "view this cart" UIs where the cart id is known up front and the cookie is irrelevant. Returns the loaded cart plus the same mutation surface as the cookie-based hook (`addItems`, `updateItems`, `removeItems`, `updateBuyerIdentity`, `setShippingAddress`, `updateDiscountCodes`, `updateNote`, `updateAttributes` — each resolves with `{ cart, warnings }` so low-stock and partial-availability hints flow through), reactive `isLoading` / `error` / `operation` state, and a `refetch()` callback. `autoFetch: false` + `initialCart` lets you skip the hydration round-trip when the server already resolved the cart.
269
+
270
+ **Field-level descriptions visible in your IDE**
271
+
272
+ Hovering on any cart / order / customer / payment / shipping field in your editor now shows a precise English description of what the field carries — when to use it, what its values mean, what is null vs zero, which enum values are relevant. The descriptions were rewritten across every type selected by the SDK so the storefront-developer audience does not need to look anywhere else for the contract. Codegen is configured (`preResolveTypes: false`) to propagate those descriptions through every generated fragment / query type, so the same hover works on the typed shape your codegen produces.
273
+
274
+ These additions are backward-compatible — existing calls keep their current signatures and return the same fields (plus the new ones). The mailing-address fragment expansion is purely additive.
275
+
276
+ ## 15.0.0
277
+
278
+ ### Major Changes
279
+
280
+ - a11f9e4: GraphQL types are now generated from the storefront schema instead of being hand-written. Every exported cart, order, customer, and payment type is derived directly from the schema, so they can no longer drift out of sync with the API.
281
+
282
+ **Breaking** — the previous hand-written types were inaccurate, and correcting them changes some shapes:
283
+ - `Customer.orderCount` is now `string` (was `number`).
284
+ - `CartLineEdge` and `CartLineConnection.edges` were removed — the cart query never returned edges.
285
+ - Fields previously typed as `string` are now precise string-literal union types: `Order.status`, `Order.paymentStatus`, `Order.fulfillmentStatus`, `PaymentSession.status`, `CartLine.productType`, `Money.currencyCode`, `CartWarning.code`, and the `AttributeSelection` mode fields. Reading these values still works; assigning arbitrary strings into them no longer compiles.
286
+
287
+ **Fixed** — types that were missing fields or had the wrong nullability:
288
+ - `Order` now includes `accessToken`.
289
+ - `Cart` and `CartLine` now include `requiresShipping`.
290
+ - `Customer.displayName`, `Customer.emailMarketing`, and `Customer.totalSpent` are now correctly non-nullable.
291
+ - The duplicated `MailingAddress` definition is collapsed into one.
292
+
293
+ **New** — the schema enum types used by the public types are now exported: `CurrencyCode`, `CountryCode`, `LanguageCode`, `ProductTypeEnum`, `WeightUnit`, `CartWarningCode`, `StorefrontOrderStatus`, `OrderPaymentStatus`, `OrderFulfillmentStatus`, `EmailMarketingState`, `MarketingOptInLevel`, and the attribute enums.
294
+
295
+ These are type-only changes — no runtime behaviour changed.
296
+
3
297
  ## 14.0.0
4
298
 
5
299
  ### Major Changes
package/README.md CHANGED
@@ -24,6 +24,34 @@ Layered runtime SDK for DoSwiftly Commerce storefronts. Framework-agnostic core
24
24
  pnpm add @doswiftly/storefront-sdk
25
25
  ```
26
26
 
27
+ ## Configuration
28
+
29
+ `createStorefrontClient` and `<StorefrontProvider>` take `apiUrl` and `shopSlug` as **explicit `config`** — the SDK does not read environment variables, sniff hostnames, or inspect request headers. The storefront supplies the values; the SDK uses them verbatim.
30
+
31
+ Scaffolded storefronts (`doswiftly init`) ship a `graphqlConfig` helper (`lib/graphql/config.ts`) that resolves both values from three sources in order:
32
+
33
+ | Source | When | What it gives you |
34
+ | --- | --- | --- |
35
+ | **`doswiftly.config.ts`** (preferred) | `doswiftly init` storefronts | A committed config file with both values. No env wiring needed in normal use. |
36
+ | `NEXT_PUBLIC_API_URL` + `NEXT_PUBLIC_SHOP_SLUG` (fallback) | Local development; storefronts scaffolded outside `doswiftly init` | Standard Next.js public env vars. `doswiftly dev` rewrites `NEXT_PUBLIC_API_URL` to a local CORS proxy at runtime so client-side calls don't hit production CORS headers. |
37
+ | `http://localhost:8000` + `demo-shop` (defaults) | Empty smoke test | Last-resort placeholders so the project boots before any config is written. |
38
+
39
+ If you go the env-var route, use **exactly these names** — `doswiftly dev` keys off them when overriding. Inventing `API_URL`, `STOREFRONT_URL`, or `TENANT_SLUG` means the dev proxy starts, but your storefront still calls the production API directly and you only learn about it on the first client-side mutation (build and SSR pass silently).
40
+
41
+ ```ts
42
+ // app/layout.tsx — Next.js App Router, template-generated wiring
43
+ import { graphqlConfig } from '@/lib/graphql/config';
44
+
45
+ <StorefrontProvider
46
+ config={{ apiUrl: graphqlConfig.apiUrl, shopSlug: graphqlConfig.shopSlug }}
47
+ shopData={shopData}
48
+ >
49
+ {children}
50
+ </StorefrontProvider>
51
+ ```
52
+
53
+ Scratch-built storefronts can read `process.env.NEXT_PUBLIC_*` directly and pass the values into `config={}` — the resolution helper is a convenience, not a requirement.
54
+
27
55
  ## Quick Start
28
56
 
29
57
  ### Core (framework-agnostic)
@@ -16,7 +16,7 @@
16
16
  * ```
17
17
  */
18
18
  import type { StorefrontClient } from '../client/types';
19
- import type { AuthResult, Customer, CustomerCreateInput } from './types';
19
+ import type { AuthResult, Customer, CustomerCreateInput, MailingAddress } from './types';
20
20
  export declare class AuthClient {
21
21
  private readonly client;
22
22
  constructor(client: StorefrontClient);
@@ -48,5 +48,17 @@ export declare class AuthClient {
48
48
  * via SDK auth middleware (`setAuthToken`).
49
49
  */
50
50
  getCustomer(): Promise<Customer | null>;
51
+ /**
52
+ * Saved address book of the authenticated customer (shipping + billing).
53
+ * Each entry carries B2B fields (`taxId`, `vatNumber`) and the `isDefault`
54
+ * flag, so the same list serves both pickers on checkout.
55
+ *
56
+ * Resolves with `null` when the request reaches the server without an auth
57
+ * context — symmetric with `getCustomer()` which also returns `null` for
58
+ * the unauthenticated case. Storefront UIs typically already gate access
59
+ * to address-pickers behind their own auth-state (`useAuth`), so `null`
60
+ * here means "no session reached the server" rather than "no addresses".
61
+ */
62
+ getAddresses(): Promise<MailingAddress[] | null>;
51
63
  }
52
64
  //# sourceMappingURL=auth-client.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"auth-client.d.ts","sourceRoot":"","sources":["../../../src/core/auth/auth-client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACxD,OAAO,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAUzE,qBAAa,UAAU;IACT,OAAO,CAAC,QAAQ,CAAC,MAAM;gBAAN,MAAM,EAAE,gBAAgB;IAErD;;;OAGG;IACG,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC;IAiBjE;;;;;OAKG;IACG,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC;IAa7B;;;OAGG;IACG,YAAY,IAAI,OAAO,CAAC,UAAU,CAAC;IAiBzC;;;OAGG;IACG,QAAQ,CAAC,KAAK,EAAE,mBAAmB,GAAG,OAAO,CAAC,UAAU,CAAC;IAmB/D;;;;OAIG;IACG,WAAW,IAAI,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC;CAO9C"}
1
+ {"version":3,"file":"auth-client.d.ts","sourceRoot":"","sources":["../../../src/core/auth/auth-client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACxD,OAAO,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAWzF,qBAAa,UAAU;IACT,OAAO,CAAC,QAAQ,CAAC,MAAM;gBAAN,MAAM,EAAE,gBAAgB;IAErD;;;OAGG;IACG,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC;IAiBjE;;;;;OAKG;IACG,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC;IAa7B;;;OAGG;IACG,YAAY,IAAI,OAAO,CAAC,UAAU,CAAC;IAiBzC;;;OAGG;IACG,QAAQ,CAAC,KAAK,EAAE,mBAAmB,GAAG,OAAO,CAAC,UAAU,CAAC;IAmB/D;;;;OAIG;IACG,WAAW,IAAI,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC;IAQ7C;;;;;;;;;;OAUG;IACG,YAAY,IAAI,OAAO,CAAC,cAAc,EAAE,GAAG,IAAI,CAAC;CAMvD"}
@@ -16,7 +16,7 @@
16
16
  * ```
17
17
  */
18
18
  import { assertNoUserErrors } from '../helpers/assert-no-user-errors';
19
- import { CUSTOMER_LOGIN, CUSTOMER_LOGOUT, CUSTOMER_REFRESH_TOKEN, CUSTOMER_SIGNUP, CUSTOMER_QUERY, } from '../operations/auth';
19
+ import { CUSTOMER_LOGIN, CUSTOMER_LOGOUT, CUSTOMER_REFRESH_TOKEN, CUSTOMER_SIGNUP, CUSTOMER_QUERY, CUSTOMER_ADDRESSES_QUERY, } from '../operations/auth';
20
20
  export class AuthClient {
21
21
  client;
22
22
  constructor(client) {
@@ -85,4 +85,19 @@ export class AuthClient {
85
85
  const data = await this.client.query(CUSTOMER_QUERY);
86
86
  return data.customer;
87
87
  }
88
+ /**
89
+ * Saved address book of the authenticated customer (shipping + billing).
90
+ * Each entry carries B2B fields (`taxId`, `vatNumber`) and the `isDefault`
91
+ * flag, so the same list serves both pickers on checkout.
92
+ *
93
+ * Resolves with `null` when the request reaches the server without an auth
94
+ * context — symmetric with `getCustomer()` which also returns `null` for
95
+ * the unauthenticated case. Storefront UIs typically already gate access
96
+ * to address-pickers behind their own auth-state (`useAuth`), so `null`
97
+ * here means "no session reached the server" rather than "no addresses".
98
+ */
99
+ async getAddresses() {
100
+ const data = await this.client.query(CUSTOMER_ADDRESSES_QUERY);
101
+ return data.customer?.addresses.nodes ?? null;
102
+ }
88
103
  }
@@ -1,60 +1,26 @@
1
1
  /**
2
- * Auth types — manual (no codegen).
2
+ * Auth types — derived from the generated GraphQL operation types.
3
+ *
4
+ * Output types alias the generated `*Fragment` types; the input type and enums
5
+ * re-export the generated schema types. SSOT chain: backend storefront-graphql
6
+ * schema → `core/operations/*.ts` → `src/core/generated/operation-types.ts`
7
+ * (regenerate with `pnpm codegen`).
8
+ */
9
+ import type { CustomerFieldsFragment, CustomerAccessTokenFieldsFragment, MailingAddressFragment } from '../generated/operation-types';
10
+ /** Authenticated customer profile. */
11
+ export type Customer = CustomerFieldsFragment;
12
+ /** Access token pair issued by login / signup / refresh. */
13
+ export type CustomerAccessToken = CustomerAccessTokenFieldsFragment;
14
+ /** Shipping/billing address shape (shared with the cart surface). */
15
+ export type MailingAddress = MailingAddressFragment;
16
+ export type { CustomerCreateInput, EmailMarketingState, MarketingOptInLevel, } from '../generated/operation-types';
17
+ /**
18
+ * Result of a login / signup call — the SDK's composite shape pairing the
19
+ * issued access token with the (optional) customer profile.
3
20
  */
4
- export interface CustomerAccessToken {
5
- accessToken: string;
6
- expiresAt: string;
7
- }
8
- export interface Customer {
9
- id: string;
10
- email: string;
11
- firstName: string | null;
12
- lastName: string | null;
13
- displayName: string | null;
14
- phone: string | null;
15
- isEmailVerified: boolean;
16
- emailMarketing: string | null;
17
- defaultAddress: MailingAddress | null;
18
- orderCount: number;
19
- totalSpent: {
20
- amount: string;
21
- currencyCode: string;
22
- } | null;
23
- createdAt: string;
24
- updatedAt: string;
25
- }
26
- export interface MailingAddress {
27
- id: string;
28
- streetLine1: string | null;
29
- streetLine2: string | null;
30
- city: string | null;
31
- company: string | null;
32
- country: string | null;
33
- countryCode: string | null;
34
- firstName: string | null;
35
- lastName: string | null;
36
- /** Computed full name (`firstName + " " + lastName`). */
37
- name: string | null;
38
- phone: string | null;
39
- state: string | null;
40
- stateCode: string | null;
41
- postalCode: string | null;
42
- isDefault: boolean;
43
- }
44
21
  export interface AuthResult {
45
22
  accessToken: string;
46
23
  expiresAt: string;
47
24
  customer?: Customer;
48
25
  }
49
- export interface CustomerCreateInput {
50
- email: string;
51
- password: string;
52
- firstName?: string;
53
- lastName?: string;
54
- phone?: string;
55
- /** Opt-in to email marketing. `true` → SUBSCRIBED (lub PENDING gdy CONFIRMED_OPT_IN). */
56
- acceptsMarketing?: boolean;
57
- /** Marketing opt-in level — `'SINGLE_OPT_IN'` (default) lub `'CONFIRMED_OPT_IN'` (double opt-in via email). */
58
- marketingOptInLevel?: 'SINGLE_OPT_IN' | 'CONFIRMED_OPT_IN';
59
- }
60
26
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/core/auth/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,WAAW,mBAAmB;IAClC,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAA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,UAAU;IACzB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,QAAQ,CAAC;CACrB;AAED,MAAM,WAAW,mBAAmB;IAClC,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,yFAAyF;IACzF,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,+GAA+G;IAC/G,mBAAmB,CAAC,EAAE,eAAe,GAAG,kBAAkB,CAAC;CAC5D"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/core/auth/types.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,KAAK,EACV,sBAAsB,EACtB,iCAAiC,EACjC,sBAAsB,EACvB,MAAM,8BAA8B,CAAC;AAEtC,sCAAsC;AACtC,MAAM,MAAM,QAAQ,GAAG,sBAAsB,CAAC;AAE9C,4DAA4D;AAC5D,MAAM,MAAM,mBAAmB,GAAG,iCAAiC,CAAC;AAEpE,qEAAqE;AACrE,MAAM,MAAM,cAAc,GAAG,sBAAsB,CAAC;AAEpD,YAAY,EACV,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,GACpB,MAAM,8BAA8B,CAAC;AAEtC;;;GAGG;AACH,MAAM,WAAW,UAAU;IACzB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,QAAQ,CAAC;CACrB"}
@@ -1,4 +1 @@
1
- /**
2
- * Auth types — manual (no codegen).
3
- */
4
1
  export {};
@@ -22,7 +22,7 @@
22
22
  * ```
23
23
  */
24
24
  import type { StorefrontClient } from '../client/types';
25
- import type { Cart, CartCreateInput, CartLineInput, CartLineUpdateInput, CartBuyerIdentityInput, CartSetShippingAddressInput, CartSetBillingAddressInput, CartSelectShippingMethodInput, CartSelectPaymentMethodInput, CartApplyGiftCardInput, CartRemoveGiftCardInput, CartUpdateGiftCardRecipientInput, CartCompleteInput, CartWarning, Order, DiscountValidationResult, PaymentSession, PaymentCreateInput } from './types';
25
+ import type { Cart, CartCreateInput, CartLineInput, CartLineUpdateInput, CartBuyerIdentityInput, CartAttributeInput, CartSetShippingAddressInput, CartSetBillingAddressInput, CartSelectShippingMethodInput, CartSelectPaymentMethodInput, CartApplyGiftCardInput, CartRemoveGiftCardInput, CartUpdateGiftCardRecipientInput, CartCompleteInput, CartWarning, Order, DiscountValidationResult, PaymentSession, PaymentCreateInput, AvailableShippingMethodsPayload, AvailablePaymentMethods, ShippingAddressInput } from './types';
26
26
  /**
27
27
  * Standard mutation return shape — `cart` is non-null on success (userErrors
28
28
  * cause assertNoUserErrors to throw), `warnings` may be empty.
@@ -51,6 +51,47 @@ export declare class CartClient {
51
51
  * Returns null if cart doesn't exist or has expired.
52
52
  */
53
53
  get(cartId: string): Promise<Cart | null>;
54
+ /**
55
+ * Cart-aware list of shipping methods available for the given destination.
56
+ * Resolves with `null` when the cart does not exist or has expired —
57
+ * symmetric with `CartClient.get(cartId)`. Otherwise resolves with
58
+ * `AvailableShippingMethodsPayload`:
59
+ *
60
+ * - `methods[]` — methods available for this cart at the destination, each
61
+ * carrying `deliveryType` (`HOME` / `PICKUP_POINT` / `LOCKER`).
62
+ * - `freeShippingProgress` — best free-shipping progress across all
63
+ * returned methods (use for a single banner above the picker).
64
+ * - `userErrors[]` — populated by the backend for business conditions
65
+ * (e.g. `DIGITAL_ONLY_NO_SHIPPING` for a cart with no shippable lines,
66
+ * `NO_SHIPPING_METHODS` for an unsupported address). Branch on
67
+ * `userErrors[0].code`; the `message` is localized per the request's
68
+ * `Accept-Language` header.
69
+ */
70
+ getAvailableShippingMethods(cartId: string, address: ShippingAddressInput): Promise<AvailableShippingMethodsPayload | null>;
71
+ /**
72
+ * Shop-level list of active payment methods. Returns the raw payload from
73
+ * the backend:
74
+ *
75
+ * - `methods[]` — sorted by the merchant's display position.
76
+ * - `defaultMethod` — the merchant-flagged pre-selection (may be null when
77
+ * none is configured). Prefer this over scanning `methods.find(isDefault)`
78
+ * — the merchant may override the default independently of per-method
79
+ * flags.
80
+ */
81
+ getAvailablePaymentMethods(): Promise<AvailablePaymentMethods>;
82
+ /**
83
+ * Fetch a guest order by its opaque access token (returned in
84
+ * `complete().order.accessToken`). Use on the post-checkout confirmation
85
+ * page when the buyer is not signed in.
86
+ *
87
+ * Optional `email` is matched case-insensitively against the order's buyer
88
+ * email as defense in depth — on mismatch the call returns `null` with the
89
+ * same shape as an invalid token (attackers cannot distinguish the two).
90
+ *
91
+ * Backend rate-limits this query (5 requests / minute per IP + shop) and
92
+ * responses are uncached.
93
+ */
94
+ getOrderByToken(token: string, email?: string): Promise<Order | null>;
54
95
  /**
55
96
  * Create a new cart, optionally with initial lines.
56
97
  */
@@ -76,6 +117,14 @@ export declare class CartClient {
76
117
  * Update cart note / gift message.
77
118
  */
78
119
  updateNote(cartId: string, note: string): Promise<CartMutationOutcome>;
120
+ /**
121
+ * Replace the cart's custom `{ key, value }` attribute pairs — free-form
122
+ * metadata visible to the merchant (delivery instructions, gift-wrap flags,
123
+ * B2B PO numbers). Semantics is REPLACE-ALL (not merge): pass the full set
124
+ * each call, an empty array clears all attributes. Backend rejects oversized
125
+ * sets with `CART_ATTRIBUTES_LIMIT_EXCEEDED` (max 250 pairs, 255-char keys).
126
+ */
127
+ updateAttributes(cartId: string, attributes: CartAttributeInput[]): Promise<CartMutationOutcome>;
79
128
  /**
80
129
  * Update buyer identity (email, phone, country, customer link, languageCode).
81
130
  */
@@ -1 +1 @@
1
- {"version":3,"file":"cart-client.d.ts","sourceRoot":"","sources":["../../../src/core/cart/cart-client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC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