@doswiftly/storefront-operations 19.2.0 → 20.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 +2 -2
- package/CHANGELOG.md +53 -0
- package/README.md +7 -4
- package/fragments.graphql +2 -1
- package/llms-full.txt +93 -6
- package/mutations.graphql +50 -3
- package/operations.json +64 -7
- package/package.json +1 -1
- package/schema.graphql +94 -7
package/AGENTS.md
CHANGED
|
@@ -27,9 +27,9 @@ 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**: 20.1.0
|
|
31
31
|
- **Queries**: 52
|
|
32
|
-
- **Mutations**:
|
|
32
|
+
- **Mutations**: 44
|
|
33
33
|
- **Fragments**: 104
|
|
34
34
|
<!-- AUTOGEN:STATS:END -->
|
|
35
35
|
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,58 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 20.1.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- e1bda76: Cart addresses now carry full B2B invoice identity end to end. `cartSetShippingAddress` and `cartSetBillingAddress` accept an EU VAT number (`vatNumber`, e.g. `PL1234567890`) alongside the existing tax ID and business registry number, and the cart address now returns all three (`taxId`, `vatNumber`, `regon`) — so a storefront can display and re-confirm exactly what the buyer entered. These values are carried onto the resulting order at checkout, ready for reverse-charge and cross-border B2B invoices.
|
|
8
|
+
|
|
9
|
+
Signed-in shoppers also get their saved default shipping and billing address — including those B2B fields — prefilled into the cart automatically when they create a cart or log in. Anything the shopper has already typed is never overwritten.
|
|
10
|
+
|
|
11
|
+
## 20.0.0
|
|
12
|
+
|
|
13
|
+
### Major Changes
|
|
14
|
+
|
|
15
|
+
- 486afc8: Cart access is now capability-based: a cart is reached with its id **and** a one-time secret instead of being tied to the signed-in customer. This fixes two long-standing cart bugs — a guest inheriting a previous visitor's cart id getting "cart not found", and a signed-in buyer being told to sign in again on their own cart — and aligns the cart contract with the industry norm.
|
|
16
|
+
|
|
17
|
+
**Why**: the `cart-id` cookie outlives the auth session and is shared across tabs and workers, so gating cart writes on the customer made carts brittle. The cart token is now a bearer capability; the customer link is enrichment only. There are no more "unauthenticated"/"forbidden" cart errors — a missing or expired cart, or a missing or wrong secret, returns a single `CART_NOT_FOUND`, which the SDK already auto-recovers from by creating a fresh cart.
|
|
18
|
+
|
|
19
|
+
**The SDK handles the secret for you.** `useCartManager`, the browser cart cookie store, and the client/server middleware read and persist it automatically. The breaking points below matter only if you read the `cart-id` cookie yourself, run server-side cart reads, or built on the removed session-error path.
|
|
20
|
+
|
|
21
|
+
**Breaking**
|
|
22
|
+
1. **Composite cart cookie.** The `cart-id` cookie value is now `"<cartId>.<secret>"`. If you read it directly (for example in a Server Component), parse it with the new `parseCartCookieValue()` / `readCartCredentials()` instead of treating the raw value as the cart id. A legacy plain-id cookie still parses (with `cartSecret: null`) and degrades to a fresh cart on the next write.
|
|
23
|
+
2. **Server-side cart reads must forward the secret.** SSR / edge cart reads now need the secret header or they come back empty. Add `serverCartSecretMiddleware(await readCartCredentials())` to your server client middleware (next to your currency / language middleware).
|
|
24
|
+
3. **The cart session-error path is removed.** `CART_UNAUTHENTICATED` no longer exists in the contract, and with it the recovery runner's `onSessionExpired` listener, the `CartSessionRequiredError` class, the `isCartSessionError` predicate and the `CART_SESSION_ERROR_CODES` constant. If you handled a "cart needs sign-in" signal, remove it — a stale or unreachable cart now flows through the normal `CART_NOT_FOUND` recovery you already have. (The auth-level session refresh — `sessionRetryMiddleware`, `useSessionExpired`, `createSessionExpiredEmitter` — is unchanged; it handles the customer token, not the cart.)
|
|
25
|
+
4. **`ensureCart` shape.** A custom `ensureCart` passed to `createCartRecoveryRunner` must now return `{ cart, secret }` (the create outcome) rather than just the cart, so the runner can persist the secret.
|
|
26
|
+
|
|
27
|
+
**New**
|
|
28
|
+
- `CartClient.create()` now returns the one-time `secret` alongside the cart.
|
|
29
|
+
- `CartClient.merge(guestCartId)` — on login, fold the customer's prior cart into the guest cart (quantities sum per variant, guest checkout fields win, the guest cart id and secret are kept so the stored cookie stays valid). Requires an authenticated request.
|
|
30
|
+
- `CartClient.downgradeOnLogout(cartId)` — on logout, clear the customer link, contact details, addresses and saved-payment selection while keeping items, coupons, shipping method, currency, notes and the secret. `useLogout` now calls this automatically before signing out, so customer details do not linger in the cart on a shared device.
|
|
31
|
+
- `CartClient.recoveryRedeem(token)` — redeem a signed cart-recovery link; the cart secret is rotated and the new one is revealed once (persist it into the cookie).
|
|
32
|
+
- `cartSecretMiddleware`, `serverCartSecretMiddleware`, `readCartCredentials`, `parseCartCookieValue`, `formatCartCookieValue` and the `CartCredentials` type for working with the secret directly.
|
|
33
|
+
|
|
34
|
+
### Patch Changes
|
|
35
|
+
|
|
36
|
+
- 17f4832: Two cart-cookie robustness fixes for capability-based carts:
|
|
37
|
+
- **A malformed `cart-id` cookie no longer breaks the GraphQL client.** A corrupt cookie value (for example a stray `%` left by another tool, or a hand-crafted bad value) made `getCookie` throw while reading the cart secret on every request, taking down the whole request pipeline for that browser until the cookie was cleared. The cookie is now treated as absent when it can't be decoded, so a fresh cart is created as intended.
|
|
38
|
+
- **A server-known cart seed can now carry the cart secret.** When you seed a cart id from the server (via `useCartManager({ initialCartId })`, `<CartManagerProvider initialCartId>`, or `createCartRecoveryRunner({ initialCartId })`), you can pass the composite `"<cartId>.<secret>"` value — the same value stored in the `cart-id` cookie — instead of a bare id. The seed is persisted as a composite cookie so reads and writes send the secret and reach the seeded cart. This unblocks magic-link checkout, embedded-iframe, customer-service "view this cart", and server-side dev-seed flows where the cart id is known up front.
|
|
39
|
+
|
|
40
|
+
Migration: no changes required for existing code. A bare-id seed keeps its previous behaviour (it degrades to a fresh cart on the first write, since the secret is required to reach an existing cart). To make a seeded cart reachable, read the raw `cart-id` cookie server-side and pass it through unchanged, or build the value with `formatCartCookieValue({ cartId, cartSecret })`.
|
|
41
|
+
|
|
42
|
+
- 933492b: Deprecate the `createCartStore` cart-state system in favour of `useCartManager`.
|
|
43
|
+
|
|
44
|
+
`createCartStore` — and its `CartProvider` / `useCartStore` / `useCartStoreApi`
|
|
45
|
+
helpers — predate capability-based carts: the store does not carry the cart secret,
|
|
46
|
+
so mutations against a capability cart fail. These exports are now marked
|
|
47
|
+
`@deprecated` and will be removed in a future major release.
|
|
48
|
+
|
|
49
|
+
Migration: switch to `useCartManager` (React), which manages the cart secret, the
|
|
50
|
+
`cart-id` cookie, and stale-cart recovery automatically and exposes the full cart +
|
|
51
|
+
checkout lifecycle. For a framework-agnostic core, use `createCartRecoveryRunner`.
|
|
52
|
+
No runtime behaviour changes in this release — the deprecation only adds IDE hints.
|
|
53
|
+
|
|
54
|
+
- 486afc8: `Order` now actually returns the `discountAllocations` breakdown it documents. The per-code discount allocations were added to the order contract previously, but the SDK's `Order` selection did not request the field, so it always came back empty. The order confirmation page can now render the same per-code discount rows the buyer saw on the cart.
|
|
55
|
+
|
|
3
56
|
## 19.2.0
|
|
4
57
|
|
|
5
58
|
### Minor Changes
|
package/README.md
CHANGED
|
@@ -333,12 +333,15 @@ full executable body of each operation.
|
|
|
333
333
|
|
|
334
334
|
| Operation | Description |
|
|
335
335
|
| --- | --- |
|
|
336
|
-
| `CartCreate` | Creates a new cart and optionally pre-populates it with line items.
|
|
336
|
+
| `CartCreate` | Creates a new cart and optionally pre-populates it with line items. Returns a one-time `secret` (the cart access capability) alongside the cart — the SDK persists it in the `cart-id` cookie and sends it as the `x-cart-secret` header on later cart operations; a direct API caller must store it immediately, as it cannot be retrieved again. The cart ID is a UUID; the cart expires server-side after 72 hours of inactivity. The `warnings` field is reserved for non-blocking issues — current implementation returns it empty in this path. |
|
|
337
337
|
| `CartAddLines` | Adds line items to a cart. Each line is `{ merchandiseId, quantity, attributes?, attributeSelections? }`. If the same variant + identical attributes are added twice, quantities merge into one row instead of duplicating. Validates stock (`INSUFFICIENT_STOCK`) and configurator attributes (`ATTRIBUTE_REQUIRED`, `ATTRIBUTE_OPTION_INVALID`). Triggers cart re-pricing including discount recalculation. |
|
|
338
338
|
| `CartUpdateLines` | Updates quantity and/or attributes of existing cart lines by `id`. Setting `quantity: 0` auto-deletes the line. Passing `attributes: []` clears them; omitting the field preserves existing values. Re-validates stock and re-prices the cart after each update. |
|
|
339
339
|
| `CartRemoveLines` | Removes specific lines from cart by `lineIds[]`. Internally delegates to `cartUpdateLines` with `quantity: 0` — both endpoints are functionally equivalent; this one exists for API ergonomics when intent is explicit removal. Triggers cart re-pricing. |
|
|
340
340
|
| `CartDiscountCodesUpdate` | Replaces (NOT appends) the cart's discount codes with the given list. Pass `[]` to clear all codes. Each code is validated against the discounts table (existence, active status); invalid codes appear in `userErrors[]` as `DISCOUNT_CODE_INVALID`. Triggers cart re-pricing — discount allocations are recomputed and stored in `cart.discountAmount`. Single canonical replace-all entry point — prior append/single-remove variants were removed in favor of this explicit caller-controlled list semantics. |
|
|
341
|
-
| `CartUpdateBuyerIdentity` |
|
|
341
|
+
| `CartUpdateBuyerIdentity` | Set the buyer's email and phone on the cart (guest checkout contact details). The cart is bound to a customer automatically from the authenticated session — there is no `customerId` input, so a guest cannot claim another shopper's account. Sign in and the cart attaches to that customer (re-binding overwrites, last-write-wins); the `customerId` is then readable on `cart.buyerIdentity`. Use during guest checkout to capture contact info and after login to attach the buyer. Does not trigger tax / shipping recalculation. |
|
|
342
|
+
| `CartMerge` | Merge a guest cart into the signed-in customer's existing cart right after login. Pass the guest cart id; its secret travels in the cart credential header and the customer is taken from the authenticated session (never the client). Line quantities are summed per variant, the buyer's in-session checkout fields win, and the prior customer cart is discarded. The returned cart keeps the SAME id and secret as the guest cart, so the stored cart-id stays valid — no cookie re-issue. Requires authentication (returns `CART_MERGE_REQUIRES_AUTH` otherwise) and refuses carts held in different currencies (`CART_CURRENCY_MISMATCH`). |
|
|
343
|
+
| `CartDowngradeOnLogout` | Downgrade a cart to guest on logout. Pass the cart id (its secret travels in the cart credential header). Clears the customer association, contact details, addresses and payment selection, but keeps line items, discount codes, the selected shipping method, currency and notes. The cart id and secret are unchanged (no rotation), so the stored cart-id stays valid and the buyer keeps their items as a guest. Call from the logout flow before tearing down the auth session so the next person on a shared device sees none of the previous buyer's data. Gated by the cart secret only (no auth) — a missing/wrong secret returns `CART_NOT_FOUND`. |
|
|
344
|
+
| `CartRecoveryRedeem` | Redeem a signed cart recovery link (from an abandoned-cart email). Pass the token taken from the link's query parameter. On success the cart is recovered (made active again) and its access secret is ROTATED — the NEW secret is returned once in `secret` (persist it immediately; the previous secret stops working), and the SDK sets the cart-id cookie to the recovered cart. Buyer self-service: the merchant only sends the link, never takes over the cart. A bad link returns `CART_RECOVERY_LINK_EXPIRED` or `CART_RECOVERY_LINK_INVALID` without exposing any cart content; `CART_NOT_FOUND` if the cart no longer exists. |
|
|
342
345
|
| `CartUpdateNote` | Sets a free-text note on the cart (gift message, special instructions). Pass empty string to clear. Stored on the `Cart` row, propagated to the `Order` at checkout completion, visible to merchant in admin. |
|
|
343
346
|
|
|
344
347
|
#### Customer Auth Mutations
|
|
@@ -380,7 +383,7 @@ full executable body of each operation.
|
|
|
380
383
|
| `CartSetShippingAddress` | Phase 3 unify-cart-graphql-surface: wszystkie fulfillment + payment + completion operations teraz na Cart aggregate (zamiast Checkout dual-aggregate). Klient robi typowy checkout flow: cart create/add items → setShipping/Billing/Method → selectPayment → (optional) applyGiftCard → cartComplete → Order created. Sets the shipping address on the cart (full replace, not patch). Triggers cart re-pricing (tax recalculation per address country/region). Address format validated against `CartAddressInput` constraints (firstName/lastName/streetLine1/city/country/postalCode required). Errors: `INVALID_ADDRESS`, `CART_NOT_FOUND`. |
|
|
381
384
|
| `CartSetBillingAddress` | Sets the billing address on the cart (full replace). Independent of shipping address — pass it explicitly even when "billing same as shipping". Errors: `INVALID_ADDRESS`, `CART_NOT_FOUND`. |
|
|
382
385
|
| `CartSelectShippingMethod` | Selects a shipping method by `shippingMethodId` (typed `ID!`, a stable shipping-method UUID — NOT a per-request token). The id comes from a list of methods available for the current address + cart subtotal (queryable separately). Errors: `SHIPPING_METHOD_REQUIRED`, `ZIP_CODE_NOT_SUPPORTED`, `CART_NOT_FOUND`. |
|
|
383
|
-
| `CartSelectPaymentMethod` | Selects a payment method on the cart by category (`methodType` — BLIK, CARD, BANK_TRANSFER, ...). Optional `preferredProvider` overrides the merchant priority when the buyer explicitly picks a gateway from `PaymentMethod.providersAvailable`. The backend resolves the gateway routing from `MerchantPaymentConfig` at `cartComplete`; the selection persisted here is the category. Errors: `PAYMENT_METHOD_REQUIRED`, `CART_NOT_FOUND
|
|
386
|
+
| `CartSelectPaymentMethod` | Selects a payment method on the cart by category (`methodType` — BLIK, CARD, BANK_TRANSFER, ...). Optional `preferredProvider` overrides the merchant priority when the buyer explicitly picks a gateway from `PaymentMethod.providersAvailable`. The backend resolves the gateway routing from `MerchantPaymentConfig` at `cartComplete`; the selection persisted here is the category. Errors: `PAYMENT_METHOD_REQUIRED`, `CART_NOT_FOUND`. |
|
|
384
387
|
| `CartApplyGiftCard` | Applies a gift card to the cart, stackable with discount codes. Consumption is FIFO: each card consumes `min(remainingBalance, paymentDue)` against the current cart total in the order they were applied. The gift card balance is NOT debited yet — actual deduction happens atomically at `cartComplete`. Errors: `GIFT_CARD_NOT_FOUND`, `GIFT_CARD_DEPLETED`, `GIFT_CARD_UNUSABLE`. |
|
|
385
388
|
| `CartRemoveGiftCard` | Removes a gift card from the applied list and recalculates FIFO `appliedAmount` for the remaining cards. Since gift card balances are only debited at `cartComplete`, removing before completion has no effect on the underlying gift card balance. |
|
|
386
389
|
| `CartUpdateGiftCardRecipient` | Sets per-line-item recipient details (name, email, message) for digital gift card products in the cart (line items where the variant represents a gift-card SKU). Required before `cartComplete` for any line item with a gift-card variant. Recipient details propagated to the resulting order. |
|
|
@@ -469,7 +472,7 @@ full executable body of each operation.
|
|
|
469
472
|
| Fragment | On Type | Description |
|
|
470
473
|
| --- | --- | --- |
|
|
471
474
|
| `PickupPoint` | `PickupPoint` | Selected pickup point (parcel locker or collection point) attached to a delivery address. Returned on `MailingAddress.pickupPoint` when the buyer chose a non-home delivery method (`deliveryType` other than `HOME`). Null for home delivery. |
|
|
472
|
-
| `MailingAddress` | `MailingAddress` | Customer mailing address — full street/city/state/country/postal code with names and phone. `isDefault` flips when this address is the default for shipping. Carries B2B invoicing fields (`taxId`, `vatNumber`) and the selected `pickupPoint` for parcel locker / collection point deliveries. Spread on the address book UI, checkout shipping/billing forms, and order summaries. |
|
|
475
|
+
| `MailingAddress` | `MailingAddress` | Customer mailing address — full street/city/state/country/postal code with names and phone. `isDefault` flips when this address is the default for shipping. Carries B2B invoicing fields (`taxId`, `vatNumber`, `regon`) and the selected `pickupPoint` for parcel locker / collection point deliveries. Spread on the address book UI, checkout shipping/billing forms, and order summaries. |
|
|
473
476
|
| `CustomerAccessToken` | `CustomerAccessToken` | Customer access token returned by `customerLogin` / `customerSignup` / `customerActivate` / `customerResetPassword` / `customerRefreshToken`. The token's JWT TTL is 24h; cookie max-age is 30d. |
|
|
474
477
|
| `Customer` | `Customer` | Customer profile — basic info plus B2B fields (`taxId`, `vatNumber`, `regon`, `companyName`), default address, lifetime stats (`orderCount`, `totalSpent`), marketing preferences. Use on profile / settings pages. |
|
|
475
478
|
| `Order` | `Order` | Order summary — number, totals (cost / tax / shipping), payment + fulfillment status, shipping address, item count, lifecycle timestamps, plus payment capability signal (`canCreatePayment` + `paymentMethodType`) the storefront uses to decide post-completion payment flow without hard-coded provider checks. Spread on the order list, order detail, and the `cartComplete` mutation result. Line items are not included here. |
|
package/fragments.graphql
CHANGED
|
@@ -252,7 +252,7 @@ fragment PickupPoint on PickupPoint {
|
|
|
252
252
|
address
|
|
253
253
|
}
|
|
254
254
|
|
|
255
|
-
# Customer mailing address — full street/city/state/country/postal code with names and phone. `isDefault` flips when this address is the default for shipping. Carries B2B invoicing fields (`taxId`, `vatNumber`) and the selected `pickupPoint` for parcel locker / collection point deliveries. Spread on the address book UI, checkout shipping/billing forms, and order summaries.
|
|
255
|
+
# Customer mailing address — full street/city/state/country/postal code with names and phone. `isDefault` flips when this address is the default for shipping. Carries B2B invoicing fields (`taxId`, `vatNumber`, `regon`) and the selected `pickupPoint` for parcel locker / collection point deliveries. Spread on the address book UI, checkout shipping/billing forms, and order summaries.
|
|
256
256
|
fragment MailingAddress on MailingAddress {
|
|
257
257
|
id
|
|
258
258
|
streetLine1
|
|
@@ -271,6 +271,7 @@ fragment MailingAddress on MailingAddress {
|
|
|
271
271
|
isDefault
|
|
272
272
|
taxId
|
|
273
273
|
vatNumber
|
|
274
|
+
regon
|
|
274
275
|
pickupPoint {
|
|
275
276
|
...PickupPoint
|
|
276
277
|
}
|
package/llms-full.txt
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# DoSwiftly Storefront Operations — Full Reference
|
|
2
2
|
|
|
3
|
-
> Schema version: **
|
|
4
|
-
> 52 queries ·
|
|
3
|
+
> Schema version: **20.1.0**
|
|
4
|
+
> 52 queries · 44 mutations · 104 fragments
|
|
5
5
|
|
|
6
6
|
Auto-generated from `.graphql` source files. Do not edit by hand — this file is
|
|
7
7
|
regenerated on every release to match the published schema.
|
|
@@ -1385,7 +1385,7 @@ query Location($id: ID!) {
|
|
|
1385
1385
|
|
|
1386
1386
|
**Section**: Cart Mutations
|
|
1387
1387
|
|
|
1388
|
-
**Description**: Creates a new cart and optionally pre-populates it with line items.
|
|
1388
|
+
**Description**: Creates a new cart and optionally pre-populates it with line items. Returns a one-time `secret` (the cart access capability) alongside the cart — the SDK persists it in the `cart-id` cookie and sends it as the `x-cart-secret` header on later cart operations; a direct API caller must store it immediately, as it cannot be retrieved again. The cart ID is a UUID; the cart expires server-side after 72 hours of inactivity. The `warnings` field is reserved for non-blocking issues — current implementation returns it empty in this path.
|
|
1389
1389
|
|
|
1390
1390
|
**Variables**:
|
|
1391
1391
|
- `$input`: `CartCreateInput`
|
|
@@ -1399,6 +1399,7 @@ mutation CartCreate($input: CartCreateInput) {
|
|
|
1399
1399
|
cart {
|
|
1400
1400
|
...Cart
|
|
1401
1401
|
}
|
|
1402
|
+
secret
|
|
1402
1403
|
userErrors {
|
|
1403
1404
|
...UserError
|
|
1404
1405
|
}
|
|
@@ -1529,7 +1530,7 @@ mutation CartDiscountCodesUpdate($id: ID!, $discountCodes: [String!]!) {
|
|
|
1529
1530
|
|
|
1530
1531
|
**Section**: Cart Mutations
|
|
1531
1532
|
|
|
1532
|
-
**Description**:
|
|
1533
|
+
**Description**: Set the buyer's email and phone on the cart (guest checkout contact details). The cart is bound to a customer automatically from the authenticated session — there is no `customerId` input, so a guest cannot claim another shopper's account. Sign in and the cart attaches to that customer (re-binding overwrites, last-write-wins); the `customerId` is then readable on `cart.buyerIdentity`. Use during guest checkout to capture contact info and after login to attach the buyer. Does not trigger tax / shipping recalculation.
|
|
1533
1534
|
|
|
1534
1535
|
**Variables**:
|
|
1535
1536
|
- `$id`: `ID!`
|
|
@@ -1554,6 +1555,91 @@ mutation CartUpdateBuyerIdentity($id: ID!, $buyerIdentity: CartBuyerIdentityInpu
|
|
|
1554
1555
|
}
|
|
1555
1556
|
```
|
|
1556
1557
|
|
|
1558
|
+
### Mutation: `CartMerge`
|
|
1559
|
+
|
|
1560
|
+
**Section**: Cart Mutations
|
|
1561
|
+
|
|
1562
|
+
**Description**: Merge a guest cart into the signed-in customer's existing cart right after login. Pass the guest cart id; its secret travels in the cart credential header and the customer is taken from the authenticated session (never the client). Line quantities are summed per variant, the buyer's in-session checkout fields win, and the prior customer cart is discarded. The returned cart keeps the SAME id and secret as the guest cart, so the stored cart-id stays valid — no cookie re-issue. Requires authentication (returns `CART_MERGE_REQUIRES_AUTH` otherwise) and refuses carts held in different currencies (`CART_CURRENCY_MISMATCH`).
|
|
1563
|
+
|
|
1564
|
+
**Variables**:
|
|
1565
|
+
- `$guestCartId`: `ID!`
|
|
1566
|
+
|
|
1567
|
+
**Fragments used**: `Cart`, `CartWarning`, `UserError`
|
|
1568
|
+
|
|
1569
|
+
**GraphQL**:
|
|
1570
|
+
```graphql
|
|
1571
|
+
mutation CartMerge($guestCartId: ID!) {
|
|
1572
|
+
cartMerge(guestCartId: $guestCartId) {
|
|
1573
|
+
cart {
|
|
1574
|
+
...Cart
|
|
1575
|
+
}
|
|
1576
|
+
userErrors {
|
|
1577
|
+
...UserError
|
|
1578
|
+
}
|
|
1579
|
+
warnings {
|
|
1580
|
+
...CartWarning
|
|
1581
|
+
}
|
|
1582
|
+
}
|
|
1583
|
+
}
|
|
1584
|
+
```
|
|
1585
|
+
|
|
1586
|
+
### Mutation: `CartDowngradeOnLogout`
|
|
1587
|
+
|
|
1588
|
+
**Section**: Cart Mutations
|
|
1589
|
+
|
|
1590
|
+
**Description**: Downgrade a cart to guest on logout. Pass the cart id (its secret travels in the cart credential header). Clears the customer association, contact details, addresses and payment selection, but keeps line items, discount codes, the selected shipping method, currency and notes. The cart id and secret are unchanged (no rotation), so the stored cart-id stays valid and the buyer keeps their items as a guest. Call from the logout flow before tearing down the auth session so the next person on a shared device sees none of the previous buyer's data. Gated by the cart secret only (no auth) — a missing/wrong secret returns `CART_NOT_FOUND`.
|
|
1591
|
+
|
|
1592
|
+
**Variables**:
|
|
1593
|
+
- `$cartId`: `ID!`
|
|
1594
|
+
|
|
1595
|
+
**Fragments used**: `Cart`, `CartWarning`, `UserError`
|
|
1596
|
+
|
|
1597
|
+
**GraphQL**:
|
|
1598
|
+
```graphql
|
|
1599
|
+
mutation CartDowngradeOnLogout($cartId: ID!) {
|
|
1600
|
+
cartDowngradeOnLogout(cartId: $cartId) {
|
|
1601
|
+
cart {
|
|
1602
|
+
...Cart
|
|
1603
|
+
}
|
|
1604
|
+
userErrors {
|
|
1605
|
+
...UserError
|
|
1606
|
+
}
|
|
1607
|
+
warnings {
|
|
1608
|
+
...CartWarning
|
|
1609
|
+
}
|
|
1610
|
+
}
|
|
1611
|
+
}
|
|
1612
|
+
```
|
|
1613
|
+
|
|
1614
|
+
### Mutation: `CartRecoveryRedeem`
|
|
1615
|
+
|
|
1616
|
+
**Section**: Cart Mutations
|
|
1617
|
+
|
|
1618
|
+
**Description**: Redeem a signed cart recovery link (from an abandoned-cart email). Pass the token taken from the link's query parameter. On success the cart is recovered (made active again) and its access secret is ROTATED — the NEW secret is returned once in `secret` (persist it immediately; the previous secret stops working), and the SDK sets the cart-id cookie to the recovered cart. Buyer self-service: the merchant only sends the link, never takes over the cart. A bad link returns `CART_RECOVERY_LINK_EXPIRED` or `CART_RECOVERY_LINK_INVALID` without exposing any cart content; `CART_NOT_FOUND` if the cart no longer exists.
|
|
1619
|
+
|
|
1620
|
+
**Variables**:
|
|
1621
|
+
- `$token`: `String!`
|
|
1622
|
+
|
|
1623
|
+
**Fragments used**: `Cart`, `CartWarning`, `UserError`
|
|
1624
|
+
|
|
1625
|
+
**GraphQL**:
|
|
1626
|
+
```graphql
|
|
1627
|
+
mutation CartRecoveryRedeem($token: String!) {
|
|
1628
|
+
cartRecoveryRedeem(token: $token) {
|
|
1629
|
+
cart {
|
|
1630
|
+
...Cart
|
|
1631
|
+
}
|
|
1632
|
+
secret
|
|
1633
|
+
userErrors {
|
|
1634
|
+
...UserError
|
|
1635
|
+
}
|
|
1636
|
+
warnings {
|
|
1637
|
+
...CartWarning
|
|
1638
|
+
}
|
|
1639
|
+
}
|
|
1640
|
+
}
|
|
1641
|
+
```
|
|
1642
|
+
|
|
1557
1643
|
### Mutation: `CartUpdateNote`
|
|
1558
1644
|
|
|
1559
1645
|
**Section**: Cart Mutations
|
|
@@ -1975,7 +2061,7 @@ mutation CartSelectShippingMethod($input: CartSelectShippingMethodInput!) {
|
|
|
1975
2061
|
|
|
1976
2062
|
**Section**: Cart Completion Mutations
|
|
1977
2063
|
|
|
1978
|
-
**Description**: Selects a payment method on the cart by category (`methodType` — BLIK, CARD, BANK_TRANSFER, ...). Optional `preferredProvider` overrides the merchant priority when the buyer explicitly picks a gateway from `PaymentMethod.providersAvailable`. The backend resolves the gateway routing from `MerchantPaymentConfig` at `cartComplete`; the selection persisted here is the category. Errors: `PAYMENT_METHOD_REQUIRED`, `CART_NOT_FOUND
|
|
2064
|
+
**Description**: Selects a payment method on the cart by category (`methodType` — BLIK, CARD, BANK_TRANSFER, ...). Optional `preferredProvider` overrides the merchant priority when the buyer explicitly picks a gateway from `PaymentMethod.providersAvailable`. The backend resolves the gateway routing from `MerchantPaymentConfig` at `cartComplete`; the selection persisted here is the category. Errors: `PAYMENT_METHOD_REQUIRED`, `CART_NOT_FOUND`.
|
|
1979
2065
|
|
|
1980
2066
|
**Variables**:
|
|
1981
2067
|
- `$input`: `CartSelectPaymentMethodInput!`
|
|
@@ -2841,7 +2927,7 @@ fragment PickupPoint on PickupPoint {
|
|
|
2841
2927
|
|
|
2842
2928
|
**Section**: Customer
|
|
2843
2929
|
|
|
2844
|
-
**Description**: Customer mailing address — full street/city/state/country/postal code with names and phone. `isDefault` flips when this address is the default for shipping. Carries B2B invoicing fields (`taxId`, `vatNumber`) and the selected `pickupPoint` for parcel locker / collection point deliveries. Spread on the address book UI, checkout shipping/billing forms, and order summaries.
|
|
2930
|
+
**Description**: Customer mailing address — full street/city/state/country/postal code with names and phone. `isDefault` flips when this address is the default for shipping. Carries B2B invoicing fields (`taxId`, `vatNumber`, `regon`) and the selected `pickupPoint` for parcel locker / collection point deliveries. Spread on the address book UI, checkout shipping/billing forms, and order summaries.
|
|
2845
2931
|
|
|
2846
2932
|
**Uses fragments**: `PickupPoint`
|
|
2847
2933
|
|
|
@@ -2865,6 +2951,7 @@ fragment MailingAddress on MailingAddress {
|
|
|
2865
2951
|
isDefault
|
|
2866
2952
|
taxId
|
|
2867
2953
|
vatNumber
|
|
2954
|
+
regon
|
|
2868
2955
|
pickupPoint {
|
|
2869
2956
|
...PickupPoint
|
|
2870
2957
|
}
|
package/mutations.graphql
CHANGED
|
@@ -7,12 +7,13 @@
|
|
|
7
7
|
# Cart Mutations
|
|
8
8
|
# ============================================
|
|
9
9
|
|
|
10
|
-
# Creates a new cart and optionally pre-populates it with line items.
|
|
10
|
+
# Creates a new cart and optionally pre-populates it with line items. Returns a one-time `secret` (the cart access capability) alongside the cart — the SDK persists it in the `cart-id` cookie and sends it as the `x-cart-secret` header on later cart operations; a direct API caller must store it immediately, as it cannot be retrieved again. The cart ID is a UUID; the cart expires server-side after 72 hours of inactivity. The `warnings` field is reserved for non-blocking issues — current implementation returns it empty in this path.
|
|
11
11
|
mutation CartCreate($input: CartCreateInput) {
|
|
12
12
|
cartCreate(input: $input) {
|
|
13
13
|
cart {
|
|
14
14
|
...Cart
|
|
15
15
|
}
|
|
16
|
+
secret
|
|
16
17
|
userErrors {
|
|
17
18
|
...UserError
|
|
18
19
|
}
|
|
@@ -82,7 +83,7 @@ mutation CartDiscountCodesUpdate($id: ID!, $discountCodes: [String!]!) {
|
|
|
82
83
|
}
|
|
83
84
|
}
|
|
84
85
|
|
|
85
|
-
#
|
|
86
|
+
# Set the buyer's email and phone on the cart (guest checkout contact details). The cart is bound to a customer automatically from the authenticated session — there is no `customerId` input, so a guest cannot claim another shopper's account. Sign in and the cart attaches to that customer (re-binding overwrites, last-write-wins); the `customerId` is then readable on `cart.buyerIdentity`. Use during guest checkout to capture contact info and after login to attach the buyer. Does not trigger tax / shipping recalculation.
|
|
86
87
|
mutation CartUpdateBuyerIdentity($id: ID!, $buyerIdentity: CartBuyerIdentityInput!) {
|
|
87
88
|
cartUpdateBuyerIdentity(id: $id, buyerIdentity: $buyerIdentity) {
|
|
88
89
|
cart {
|
|
@@ -97,6 +98,52 @@ mutation CartUpdateBuyerIdentity($id: ID!, $buyerIdentity: CartBuyerIdentityInpu
|
|
|
97
98
|
}
|
|
98
99
|
}
|
|
99
100
|
|
|
101
|
+
# Merge a guest cart into the signed-in customer's existing cart right after login. Pass the guest cart id; its secret travels in the cart credential header and the customer is taken from the authenticated session (never the client). Line quantities are summed per variant, the buyer's in-session checkout fields win, and the prior customer cart is discarded. The returned cart keeps the SAME id and secret as the guest cart, so the stored cart-id stays valid — no cookie re-issue. Requires authentication (returns `CART_MERGE_REQUIRES_AUTH` otherwise) and refuses carts held in different currencies (`CART_CURRENCY_MISMATCH`).
|
|
102
|
+
mutation CartMerge($guestCartId: ID!) {
|
|
103
|
+
cartMerge(guestCartId: $guestCartId) {
|
|
104
|
+
cart {
|
|
105
|
+
...Cart
|
|
106
|
+
}
|
|
107
|
+
userErrors {
|
|
108
|
+
...UserError
|
|
109
|
+
}
|
|
110
|
+
warnings {
|
|
111
|
+
...CartWarning
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
# Downgrade a cart to guest on logout. Pass the cart id (its secret travels in the cart credential header). Clears the customer association, contact details, addresses and payment selection, but keeps line items, discount codes, the selected shipping method, currency and notes. The cart id and secret are unchanged (no rotation), so the stored cart-id stays valid and the buyer keeps their items as a guest. Call from the logout flow before tearing down the auth session so the next person on a shared device sees none of the previous buyer's data. Gated by the cart secret only (no auth) — a missing/wrong secret returns `CART_NOT_FOUND`.
|
|
117
|
+
mutation CartDowngradeOnLogout($cartId: ID!) {
|
|
118
|
+
cartDowngradeOnLogout(cartId: $cartId) {
|
|
119
|
+
cart {
|
|
120
|
+
...Cart
|
|
121
|
+
}
|
|
122
|
+
userErrors {
|
|
123
|
+
...UserError
|
|
124
|
+
}
|
|
125
|
+
warnings {
|
|
126
|
+
...CartWarning
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
# Redeem a signed cart recovery link (from an abandoned-cart email). Pass the token taken from the link's query parameter. On success the cart is recovered (made active again) and its access secret is ROTATED — the NEW secret is returned once in `secret` (persist it immediately; the previous secret stops working), and the SDK sets the cart-id cookie to the recovered cart. Buyer self-service: the merchant only sends the link, never takes over the cart. A bad link returns `CART_RECOVERY_LINK_EXPIRED` or `CART_RECOVERY_LINK_INVALID` without exposing any cart content; `CART_NOT_FOUND` if the cart no longer exists.
|
|
132
|
+
mutation CartRecoveryRedeem($token: String!) {
|
|
133
|
+
cartRecoveryRedeem(token: $token) {
|
|
134
|
+
cart {
|
|
135
|
+
...Cart
|
|
136
|
+
}
|
|
137
|
+
secret
|
|
138
|
+
userErrors {
|
|
139
|
+
...UserError
|
|
140
|
+
}
|
|
141
|
+
warnings {
|
|
142
|
+
...CartWarning
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
|
|
100
147
|
# Sets a free-text note on the cart (gift message, special instructions). Pass empty string to clear. Stored on the `Cart` row, propagated to the `Order` at checkout completion, visible to merchant in admin.
|
|
101
148
|
mutation CartUpdateNote($id: ID!, $note: String!) {
|
|
102
149
|
cartUpdateNote(id: $id, note: $note) {
|
|
@@ -333,7 +380,7 @@ mutation CartSelectShippingMethod($input: CartSelectShippingMethodInput!) {
|
|
|
333
380
|
# Optional `preferredProvider` overrides the merchant priority when the buyer explicitly picks
|
|
334
381
|
# a gateway from `PaymentMethod.providersAvailable`. The backend resolves the gateway routing
|
|
335
382
|
# from `MerchantPaymentConfig` at `cartComplete`; the selection persisted here is the category.
|
|
336
|
-
# Errors: `PAYMENT_METHOD_REQUIRED`, `CART_NOT_FOUND
|
|
383
|
+
# Errors: `PAYMENT_METHOD_REQUIRED`, `CART_NOT_FOUND`.
|
|
337
384
|
mutation CartSelectPaymentMethod($input: CartSelectPaymentMethodInput!) {
|
|
338
385
|
cartSelectPaymentMethod(input: $input) {
|
|
339
386
|
cart {
|
package/operations.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"schemaVersion": "
|
|
2
|
+
"schemaVersion": "20.1.0",
|
|
3
3
|
"queries": [
|
|
4
4
|
{
|
|
5
5
|
"name": "Shop",
|
|
@@ -1079,7 +1079,7 @@
|
|
|
1079
1079
|
"name": "CartCreate",
|
|
1080
1080
|
"kind": "mutation",
|
|
1081
1081
|
"section": "Cart Mutations",
|
|
1082
|
-
"description": "Creates a new cart and optionally pre-populates it with line items.
|
|
1082
|
+
"description": "Creates a new cart and optionally pre-populates it with line items. Returns a one-time `secret` (the cart access capability) alongside the cart — the SDK persists it in the `cart-id` cookie and sends it as the `x-cart-secret` header on later cart operations; a direct API caller must store it immediately, as it cannot be retrieved again. The cart ID is a UUID; the cart expires server-side after 72 hours of inactivity. The `warnings` field is reserved for non-blocking issues — current implementation returns it empty in this path.",
|
|
1083
1083
|
"variables": [
|
|
1084
1084
|
{
|
|
1085
1085
|
"name": "input",
|
|
@@ -1092,7 +1092,7 @@
|
|
|
1092
1092
|
"CartWarning",
|
|
1093
1093
|
"UserError"
|
|
1094
1094
|
],
|
|
1095
|
-
"body": "mutation CartCreate($input: CartCreateInput) {\n cartCreate(input: $input) {\n cart {\n ...Cart\n }\n userErrors {\n ...UserError\n }\n warnings {\n ...CartWarning\n }\n }\n}"
|
|
1095
|
+
"body": "mutation CartCreate($input: CartCreateInput) {\n cartCreate(input: $input) {\n cart {\n ...Cart\n }\n secret\n userErrors {\n ...UserError\n }\n warnings {\n ...CartWarning\n }\n }\n}"
|
|
1096
1096
|
},
|
|
1097
1097
|
{
|
|
1098
1098
|
"name": "CartAddLines",
|
|
@@ -1194,7 +1194,7 @@
|
|
|
1194
1194
|
"name": "CartUpdateBuyerIdentity",
|
|
1195
1195
|
"kind": "mutation",
|
|
1196
1196
|
"section": "Cart Mutations",
|
|
1197
|
-
"description": "
|
|
1197
|
+
"description": "Set the buyer's email and phone on the cart (guest checkout contact details). The cart is bound to a customer automatically from the authenticated session — there is no `customerId` input, so a guest cannot claim another shopper's account. Sign in and the cart attaches to that customer (re-binding overwrites, last-write-wins); the `customerId` is then readable on `cart.buyerIdentity`. Use during guest checkout to capture contact info and after login to attach the buyer. Does not trigger tax / shipping recalculation.",
|
|
1198
1198
|
"variables": [
|
|
1199
1199
|
{
|
|
1200
1200
|
"name": "id",
|
|
@@ -1214,6 +1214,63 @@
|
|
|
1214
1214
|
],
|
|
1215
1215
|
"body": "mutation CartUpdateBuyerIdentity($id: ID!, $buyerIdentity: CartBuyerIdentityInput!) {\n cartUpdateBuyerIdentity(id: $id, buyerIdentity: $buyerIdentity) {\n cart {\n ...Cart\n }\n userErrors {\n ...UserError\n }\n warnings {\n ...CartWarning\n }\n }\n}"
|
|
1216
1216
|
},
|
|
1217
|
+
{
|
|
1218
|
+
"name": "CartMerge",
|
|
1219
|
+
"kind": "mutation",
|
|
1220
|
+
"section": "Cart Mutations",
|
|
1221
|
+
"description": "Merge a guest cart into the signed-in customer's existing cart right after login. Pass the guest cart id; its secret travels in the cart credential header and the customer is taken from the authenticated session (never the client). Line quantities are summed per variant, the buyer's in-session checkout fields win, and the prior customer cart is discarded. The returned cart keeps the SAME id and secret as the guest cart, so the stored cart-id stays valid — no cookie re-issue. Requires authentication (returns `CART_MERGE_REQUIRES_AUTH` otherwise) and refuses carts held in different currencies (`CART_CURRENCY_MISMATCH`).",
|
|
1222
|
+
"variables": [
|
|
1223
|
+
{
|
|
1224
|
+
"name": "guestCartId",
|
|
1225
|
+
"type": "ID!",
|
|
1226
|
+
"defaultValue": null
|
|
1227
|
+
}
|
|
1228
|
+
],
|
|
1229
|
+
"fragmentRefs": [
|
|
1230
|
+
"Cart",
|
|
1231
|
+
"CartWarning",
|
|
1232
|
+
"UserError"
|
|
1233
|
+
],
|
|
1234
|
+
"body": "mutation CartMerge($guestCartId: ID!) {\n cartMerge(guestCartId: $guestCartId) {\n cart {\n ...Cart\n }\n userErrors {\n ...UserError\n }\n warnings {\n ...CartWarning\n }\n }\n}"
|
|
1235
|
+
},
|
|
1236
|
+
{
|
|
1237
|
+
"name": "CartDowngradeOnLogout",
|
|
1238
|
+
"kind": "mutation",
|
|
1239
|
+
"section": "Cart Mutations",
|
|
1240
|
+
"description": "Downgrade a cart to guest on logout. Pass the cart id (its secret travels in the cart credential header). Clears the customer association, contact details, addresses and payment selection, but keeps line items, discount codes, the selected shipping method, currency and notes. The cart id and secret are unchanged (no rotation), so the stored cart-id stays valid and the buyer keeps their items as a guest. Call from the logout flow before tearing down the auth session so the next person on a shared device sees none of the previous buyer's data. Gated by the cart secret only (no auth) — a missing/wrong secret returns `CART_NOT_FOUND`.",
|
|
1241
|
+
"variables": [
|
|
1242
|
+
{
|
|
1243
|
+
"name": "cartId",
|
|
1244
|
+
"type": "ID!",
|
|
1245
|
+
"defaultValue": null
|
|
1246
|
+
}
|
|
1247
|
+
],
|
|
1248
|
+
"fragmentRefs": [
|
|
1249
|
+
"Cart",
|
|
1250
|
+
"CartWarning",
|
|
1251
|
+
"UserError"
|
|
1252
|
+
],
|
|
1253
|
+
"body": "mutation CartDowngradeOnLogout($cartId: ID!) {\n cartDowngradeOnLogout(cartId: $cartId) {\n cart {\n ...Cart\n }\n userErrors {\n ...UserError\n }\n warnings {\n ...CartWarning\n }\n }\n}"
|
|
1254
|
+
},
|
|
1255
|
+
{
|
|
1256
|
+
"name": "CartRecoveryRedeem",
|
|
1257
|
+
"kind": "mutation",
|
|
1258
|
+
"section": "Cart Mutations",
|
|
1259
|
+
"description": "Redeem a signed cart recovery link (from an abandoned-cart email). Pass the token taken from the link's query parameter. On success the cart is recovered (made active again) and its access secret is ROTATED — the NEW secret is returned once in `secret` (persist it immediately; the previous secret stops working), and the SDK sets the cart-id cookie to the recovered cart. Buyer self-service: the merchant only sends the link, never takes over the cart. A bad link returns `CART_RECOVERY_LINK_EXPIRED` or `CART_RECOVERY_LINK_INVALID` without exposing any cart content; `CART_NOT_FOUND` if the cart no longer exists.",
|
|
1260
|
+
"variables": [
|
|
1261
|
+
{
|
|
1262
|
+
"name": "token",
|
|
1263
|
+
"type": "String!",
|
|
1264
|
+
"defaultValue": null
|
|
1265
|
+
}
|
|
1266
|
+
],
|
|
1267
|
+
"fragmentRefs": [
|
|
1268
|
+
"Cart",
|
|
1269
|
+
"CartWarning",
|
|
1270
|
+
"UserError"
|
|
1271
|
+
],
|
|
1272
|
+
"body": "mutation CartRecoveryRedeem($token: String!) {\n cartRecoveryRedeem(token: $token) {\n cart {\n ...Cart\n }\n secret\n userErrors {\n ...UserError\n }\n warnings {\n ...CartWarning\n }\n }\n}"
|
|
1273
|
+
},
|
|
1217
1274
|
{
|
|
1218
1275
|
"name": "CartUpdateNote",
|
|
1219
1276
|
"kind": "mutation",
|
|
@@ -1518,7 +1575,7 @@
|
|
|
1518
1575
|
"name": "CartSelectPaymentMethod",
|
|
1519
1576
|
"kind": "mutation",
|
|
1520
1577
|
"section": "Cart Completion Mutations",
|
|
1521
|
-
"description": "Selects a payment method on the cart by category (`methodType` — BLIK, CARD, BANK_TRANSFER, ...). Optional `preferredProvider` overrides the merchant priority when the buyer explicitly picks a gateway from `PaymentMethod.providersAvailable`. The backend resolves the gateway routing from `MerchantPaymentConfig` at `cartComplete`; the selection persisted here is the category. Errors: `PAYMENT_METHOD_REQUIRED`, `CART_NOT_FOUND
|
|
1578
|
+
"description": "Selects a payment method on the cart by category (`methodType` — BLIK, CARD, BANK_TRANSFER, ...). Optional `preferredProvider` overrides the merchant priority when the buyer explicitly picks a gateway from `PaymentMethod.providersAvailable`. The backend resolves the gateway routing from `MerchantPaymentConfig` at `cartComplete`; the selection persisted here is the category. Errors: `PAYMENT_METHOD_REQUIRED`, `CART_NOT_FOUND`.",
|
|
1522
1579
|
"variables": [
|
|
1523
1580
|
{
|
|
1524
1581
|
"name": "input",
|
|
@@ -2055,12 +2112,12 @@
|
|
|
2055
2112
|
"name": "MailingAddress",
|
|
2056
2113
|
"kind": "fragment",
|
|
2057
2114
|
"section": "Customer",
|
|
2058
|
-
"description": "Customer mailing address — full street/city/state/country/postal code with names and phone. `isDefault` flips when this address is the default for shipping. Carries B2B invoicing fields (`taxId`, `vatNumber`) and the selected `pickupPoint` for parcel locker / collection point deliveries. Spread on the address book UI, checkout shipping/billing forms, and order summaries.",
|
|
2115
|
+
"description": "Customer mailing address — full street/city/state/country/postal code with names and phone. `isDefault` flips when this address is the default for shipping. Carries B2B invoicing fields (`taxId`, `vatNumber`, `regon`) and the selected `pickupPoint` for parcel locker / collection point deliveries. Spread on the address book UI, checkout shipping/billing forms, and order summaries.",
|
|
2059
2116
|
"variables": [],
|
|
2060
2117
|
"fragmentRefs": [
|
|
2061
2118
|
"PickupPoint"
|
|
2062
2119
|
],
|
|
2063
|
-
"body": "fragment MailingAddress on MailingAddress {\n id\n streetLine1\n streetLine2\n city\n company\n country\n countryCode\n firstName\n lastName\n name\n phone\n state\n stateCode\n postalCode\n isDefault\n taxId\n vatNumber\n pickupPoint {\n ...PickupPoint\n }\n}",
|
|
2120
|
+
"body": "fragment MailingAddress on MailingAddress {\n id\n streetLine1\n streetLine2\n city\n company\n country\n countryCode\n firstName\n lastName\n name\n phone\n state\n stateCode\n postalCode\n isDefault\n taxId\n vatNumber\n regon\n pickupPoint {\n ...PickupPoint\n }\n}",
|
|
2064
2121
|
"onType": "MailingAddress"
|
|
2065
2122
|
},
|
|
2066
2123
|
{
|
package/package.json
CHANGED
package/schema.graphql
CHANGED
|
@@ -1046,7 +1046,7 @@ type CartAddLinesPayload {
|
|
|
1046
1046
|
}
|
|
1047
1047
|
|
|
1048
1048
|
"""
|
|
1049
|
-
Mailing address used as the shipping or billing address on a cart. Carries an optional pickup point (for parcel locker / collection-point delivery) and optional B2B fields (`taxId`, `regon`).
|
|
1049
|
+
Mailing address used as the shipping or billing address on a cart. Carries an optional pickup point (for parcel locker / collection-point delivery) and optional B2B fields (`taxId`, `vatNumber`, `regon`).
|
|
1050
1050
|
"""
|
|
1051
1051
|
input CartAddressInput {
|
|
1052
1052
|
"""City"""
|
|
@@ -1093,6 +1093,11 @@ input CartAddressInput {
|
|
|
1093
1093
|
Buyer tax ID for B2B invoicing (Polish NIP). Persisted on the resulting order at checkout completion.
|
|
1094
1094
|
"""
|
|
1095
1095
|
taxId: String
|
|
1096
|
+
|
|
1097
|
+
"""
|
|
1098
|
+
Buyer EU VAT number for cross-border B2B invoicing (e.g. PL1234567890). Persisted on the resulting order at checkout completion.
|
|
1099
|
+
"""
|
|
1100
|
+
vatNumber: String
|
|
1096
1101
|
}
|
|
1097
1102
|
|
|
1098
1103
|
"""
|
|
@@ -1201,11 +1206,6 @@ input CartBuyerIdentityInput {
|
|
|
1201
1206
|
"""
|
|
1202
1207
|
countryCode: CountryCode
|
|
1203
1208
|
|
|
1204
|
-
"""
|
|
1205
|
-
ID of a signed-in customer that owns this cart. Pass to bind a guest cart to a customer record.
|
|
1206
|
-
"""
|
|
1207
|
-
customerId: ID
|
|
1208
|
-
|
|
1209
1209
|
"""Buyer email address. Persisted to the order at checkout completion."""
|
|
1210
1210
|
email: String
|
|
1211
1211
|
|
|
@@ -1365,6 +1365,11 @@ type CartCreatePayload {
|
|
|
1365
1365
|
"""The created cart on success; null when `userErrors` is non-empty."""
|
|
1366
1366
|
cart: Cart
|
|
1367
1367
|
|
|
1368
|
+
"""
|
|
1369
|
+
One-time cart access secret, returned only here on creation. The SDK persists it for you; if you call the API directly, store it immediately — it cannot be retrieved again.
|
|
1370
|
+
"""
|
|
1371
|
+
secret: String
|
|
1372
|
+
|
|
1368
1373
|
"""
|
|
1369
1374
|
Business / validation errors. Each entry carries a stable `code` (e.g. `CART_NOT_FOUND`, `NOT_ENOUGH_IN_STOCK`, `INVALID_MERCHANDISE_LINE`) — branch on `code`, never on `message`.
|
|
1370
1375
|
"""
|
|
@@ -1412,6 +1417,22 @@ type CartDiscountCodesUpdatePayload {
|
|
|
1412
1417
|
warnings: [CartWarning!]!
|
|
1413
1418
|
}
|
|
1414
1419
|
|
|
1420
|
+
"""Result of `cartDowngradeOnLogout`."""
|
|
1421
|
+
type CartDowngradeOnLogoutPayload {
|
|
1422
|
+
"""
|
|
1423
|
+
The downgraded cart on success — same id and secret (no rotation), with the customer association, contact details, addresses and payment selection cleared but line items kept. Null when `userErrors` is non-empty.
|
|
1424
|
+
"""
|
|
1425
|
+
cart: Cart
|
|
1426
|
+
|
|
1427
|
+
"""
|
|
1428
|
+
Business / validation errors carrying a stable `CartErrorCode` in `code` (e.g. `CART_NOT_FOUND`).
|
|
1429
|
+
"""
|
|
1430
|
+
userErrors: [UserError!]!
|
|
1431
|
+
|
|
1432
|
+
"""Non-fatal advisories — the mutation itself succeeded."""
|
|
1433
|
+
warnings: [CartWarning!]!
|
|
1434
|
+
}
|
|
1435
|
+
|
|
1415
1436
|
"""
|
|
1416
1437
|
A single line item in the cart — one variant, a quantity and the data attached to it (cost, attributes, configurator selections).
|
|
1417
1438
|
"""
|
|
@@ -1574,6 +1595,22 @@ input CartLineUpdateInput {
|
|
|
1574
1595
|
quantity: Int!
|
|
1575
1596
|
}
|
|
1576
1597
|
|
|
1598
|
+
"""Result of `cartMerge`."""
|
|
1599
|
+
type CartMergePayload {
|
|
1600
|
+
"""
|
|
1601
|
+
The merged cart on success — it keeps the same id and secret as the guest cart passed in, so the stored cart-id cookie stays valid. Null when `userErrors` is non-empty.
|
|
1602
|
+
"""
|
|
1603
|
+
cart: Cart
|
|
1604
|
+
|
|
1605
|
+
"""
|
|
1606
|
+
Business / validation errors carrying a stable `CartErrorCode` in `code` — e.g. `CART_NOT_FOUND`, `CART_CURRENCY_MISMATCH`, `CART_MERGE_REQUIRES_AUTH`.
|
|
1607
|
+
"""
|
|
1608
|
+
userErrors: [UserError!]!
|
|
1609
|
+
|
|
1610
|
+
"""Non-fatal advisories — the mutation itself succeeded."""
|
|
1611
|
+
warnings: [CartWarning!]!
|
|
1612
|
+
}
|
|
1613
|
+
|
|
1577
1614
|
"""Recommendations based on cart contents"""
|
|
1578
1615
|
type CartRecommendations {
|
|
1579
1616
|
"""Products frequently bought together with cart items"""
|
|
@@ -1583,6 +1620,27 @@ type CartRecommendations {
|
|
|
1583
1620
|
youMayAlsoLike: [ProductRecommendation!]!
|
|
1584
1621
|
}
|
|
1585
1622
|
|
|
1623
|
+
"""Result of `cartRecoveryRedeem`."""
|
|
1624
|
+
type CartRecoveryRedeemPayload {
|
|
1625
|
+
"""
|
|
1626
|
+
The recovered cart on success. Null when `userErrors` is non-empty (invalid / expired link).
|
|
1627
|
+
"""
|
|
1628
|
+
cart: Cart
|
|
1629
|
+
|
|
1630
|
+
"""
|
|
1631
|
+
The NEW cart access secret, returned only here on a successful redemption (the link rotates the secret). Persist it immediately — it cannot be retrieved again; the previous secret no longer works.
|
|
1632
|
+
"""
|
|
1633
|
+
secret: String
|
|
1634
|
+
|
|
1635
|
+
"""
|
|
1636
|
+
Business / validation errors carrying a stable `CartErrorCode` in `code` — `CART_RECOVERY_LINK_EXPIRED` / `CART_RECOVERY_LINK_INVALID` (bad or expired link), `CART_NOT_FOUND` (the cart is gone or already completed — create a fresh one) or `CART_RECOVERY_REDEEM_FAILED` (unexpected failure). No cart content is exposed on failure.
|
|
1637
|
+
"""
|
|
1638
|
+
userErrors: [UserError!]!
|
|
1639
|
+
|
|
1640
|
+
"""Non-fatal advisories — the mutation itself succeeded."""
|
|
1641
|
+
warnings: [CartWarning!]!
|
|
1642
|
+
}
|
|
1643
|
+
|
|
1586
1644
|
"""Input for `cartRemoveGiftCard`."""
|
|
1587
1645
|
input CartRemoveGiftCardInput {
|
|
1588
1646
|
"""ID of the cart to update."""
|
|
@@ -3775,7 +3833,7 @@ enum LoyaltyTransactionType {
|
|
|
3775
3833
|
}
|
|
3776
3834
|
|
|
3777
3835
|
"""
|
|
3778
|
-
A mailing address — shipping or billing — used on a cart, on the resulting order, or saved in a customer address book. Carries optional B2B fields (`taxId`, `vatNumber`) and an optional `pickupPoint` for parcel locker / collection-point delivery.
|
|
3836
|
+
A mailing address — shipping or billing — used on a cart, on the resulting order, or saved in a customer address book. Carries optional B2B fields (`taxId`, `vatNumber`, `regon`) and an optional `pickupPoint` for parcel locker / collection-point delivery.
|
|
3779
3837
|
"""
|
|
3780
3838
|
type MailingAddress implements Node {
|
|
3781
3839
|
"""City / town."""
|
|
@@ -3828,6 +3886,11 @@ type MailingAddress implements Node {
|
|
|
3828
3886
|
"""Postal / ZIP code."""
|
|
3829
3887
|
postalCode: String
|
|
3830
3888
|
|
|
3889
|
+
"""
|
|
3890
|
+
Buyer business registry number (Polish REGON) carried on a cart address for B2B invoicing. Populated on cart shipping/billing addresses; null on customer address-book entries (REGON is customer-level).
|
|
3891
|
+
"""
|
|
3892
|
+
regon: String
|
|
3893
|
+
|
|
3831
3894
|
"""State / province / region name."""
|
|
3832
3895
|
state: String
|
|
3833
3896
|
|
|
@@ -4067,6 +4130,30 @@ type Mutation {
|
|
|
4067
4130
|
id: ID!
|
|
4068
4131
|
): CartDiscountCodesUpdatePayload!
|
|
4069
4132
|
|
|
4133
|
+
"""
|
|
4134
|
+
Downgrade a cart to guest on logout — clears the customer association, contact details, addresses and payment selection, but keeps the line items, discount codes, selected shipping method, currency and notes. The cart id and secret are unchanged (no rotation), so the stored cart-id stays valid and the buyer keeps their items as a guest. Call from the logout flow (with the cart secret) before tearing down the auth session; the next person on a shared device then sees none of the previous buyer's data.
|
|
4135
|
+
"""
|
|
4136
|
+
cartDowngradeOnLogout(
|
|
4137
|
+
"""UUID of the cart to downgrade to guest."""
|
|
4138
|
+
cartId: ID!
|
|
4139
|
+
): CartDowngradeOnLogoutPayload!
|
|
4140
|
+
|
|
4141
|
+
"""
|
|
4142
|
+
Merge a guest cart into the signed-in customer's existing cart on login. Call right after authenticating, passing the guest cart id (its secret travels in the cart credential header). Line quantities are summed per variant and the buyer's in-session checkout fields win. The returned cart keeps the SAME id and secret as the guest cart, so the stored cart-id stays valid. Requires authentication (`CART_MERGE_REQUIRES_AUTH` otherwise); refuses carts in different currencies (`CART_CURRENCY_MISMATCH`).
|
|
4143
|
+
"""
|
|
4144
|
+
cartMerge(
|
|
4145
|
+
"""UUID of the guest cart to merge from and keep (the survivor)."""
|
|
4146
|
+
guestCartId: ID!
|
|
4147
|
+
): CartMergePayload!
|
|
4148
|
+
|
|
4149
|
+
"""
|
|
4150
|
+
Redeem a signed cart recovery link (from an abandoned-cart email). Pass the token from the link; on success the cart is recovered and its access secret is ROTATED — the NEW secret is returned once in `secret` (persist it; the previous one no longer works), and the SDK sets the cart-id cookie to the recovered cart. Buyer self-service: the merchant sends the link, never takes over the cart. Returns `CART_RECOVERY_LINK_EXPIRED` / `CART_RECOVERY_LINK_INVALID` for a bad link (no cart content is exposed) and `CART_NOT_FOUND` when the cart no longer exists.
|
|
4151
|
+
"""
|
|
4152
|
+
cartRecoveryRedeem(
|
|
4153
|
+
"""The signed recovery token taken from the recovery link."""
|
|
4154
|
+
token: String!
|
|
4155
|
+
): CartRecoveryRedeemPayload!
|
|
4156
|
+
|
|
4070
4157
|
"""
|
|
4071
4158
|
Remove a previously applied gift card from the cart by its `CartAppliedGiftCard.id`. The storefront never has to handle the full gift card code on the client.
|
|
4072
4159
|
"""
|