@doswiftly/storefront-operations 9.1.0 → 11.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +3 -3
- package/CHANGELOG.md +172 -0
- package/README.md +17 -37
- package/fragments.graphql +63 -156
- package/llms-full.txt +204 -480
- package/mutations.graphql +69 -122
- package/operations.json +119 -319
- package/package.json +1 -1
- package/queries.graphql +21 -7
- package/schema.graphql +398 -601
package/mutations.graphql
CHANGED
|
@@ -67,9 +67,9 @@ mutation CartRemoveLines($id: ID!, $lineIds: [ID!]!) {
|
|
|
67
67
|
}
|
|
68
68
|
}
|
|
69
69
|
|
|
70
|
-
# Replaces (NOT appends) the cart's discount codes with the given list. Pass `[]` to clear all codes. Each code is validated against
|
|
71
|
-
mutation
|
|
72
|
-
|
|
70
|
+
# 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.
|
|
71
|
+
mutation CartDiscountCodesUpdate($id: ID!, $discountCodes: [String!]!) {
|
|
72
|
+
cartDiscountCodesUpdate(id: $id, discountCodes: $discountCodes) {
|
|
73
73
|
cart {
|
|
74
74
|
...Cart
|
|
75
75
|
}
|
|
@@ -276,184 +276,131 @@ mutation CustomerResetPassword($token: String!, $newPassword: String!) {
|
|
|
276
276
|
}
|
|
277
277
|
|
|
278
278
|
# ============================================
|
|
279
|
-
#
|
|
279
|
+
# Cart Completion Mutations
|
|
280
280
|
# ============================================
|
|
281
|
-
|
|
282
|
-
#
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
281
|
+
#
|
|
282
|
+
# Phase 3 unify-cart-graphql-surface: wszystkie fulfillment + payment + completion
|
|
283
|
+
# operations teraz na Cart aggregate (zamiast Checkout dual-aggregate). Klient
|
|
284
|
+
# robi typowy checkout flow: cart create/add items → setShipping/Billing/Method
|
|
285
|
+
# → selectPayment → (optional) applyGiftCard → cartComplete → Order created.
|
|
286
|
+
|
|
287
|
+
# 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`.
|
|
288
|
+
mutation CartSetShippingAddress($input: CartSetShippingAddressInput!) {
|
|
289
|
+
cartSetShippingAddress(input: $input) {
|
|
290
|
+
cart {
|
|
291
|
+
...Cart
|
|
287
292
|
}
|
|
288
293
|
userErrors {
|
|
289
294
|
...UserError
|
|
290
295
|
}
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
# Sets the shipping address (full replace, not patch). Triggers cart re-pricing. Address format is NOT validated here — full validation runs at `checkoutComplete`.
|
|
295
|
-
mutation CheckoutUpdateShippingAddress($id: ID!, $shippingAddress: CheckoutAddressInput!) {
|
|
296
|
-
checkoutUpdateShippingAddress(id: $id, shippingAddress: $shippingAddress) {
|
|
297
|
-
checkout {
|
|
298
|
-
...Checkout
|
|
299
|
-
}
|
|
300
|
-
userErrors {
|
|
301
|
-
...UserError
|
|
296
|
+
warnings {
|
|
297
|
+
...CartWarning
|
|
302
298
|
}
|
|
303
299
|
}
|
|
304
300
|
}
|
|
305
301
|
|
|
306
|
-
# Sets the billing address (full replace). Independent of shipping address — pass it explicitly even when "billing same as shipping".
|
|
307
|
-
mutation
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
...
|
|
302
|
+
# 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`.
|
|
303
|
+
mutation CartSetBillingAddress($input: CartSetBillingAddressInput!) {
|
|
304
|
+
cartSetBillingAddress(input: $input) {
|
|
305
|
+
cart {
|
|
306
|
+
...Cart
|
|
311
307
|
}
|
|
312
308
|
userErrors {
|
|
313
309
|
...UserError
|
|
314
310
|
}
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
# Sets or updates the contact email on the checkout (used for guest checkout, order confirmation, and tracking emails). Validated against a regex; returns `INVALID` for malformed format.
|
|
319
|
-
mutation CheckoutUpdateEmail($id: ID!, $email: String!) {
|
|
320
|
-
checkoutUpdateEmail(id: $id, email: $email) {
|
|
321
|
-
checkout {
|
|
322
|
-
...Checkout
|
|
323
|
-
}
|
|
324
|
-
userErrors {
|
|
325
|
-
...UserError
|
|
311
|
+
warnings {
|
|
312
|
+
...CartWarning
|
|
326
313
|
}
|
|
327
314
|
}
|
|
328
315
|
}
|
|
329
316
|
|
|
330
|
-
# Selects a shipping method by `
|
|
331
|
-
mutation
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
...
|
|
317
|
+
# 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`.
|
|
318
|
+
mutation CartSelectShippingMethod($input: CartSelectShippingMethodInput!) {
|
|
319
|
+
cartSelectShippingMethod(input: $input) {
|
|
320
|
+
cart {
|
|
321
|
+
...Cart
|
|
335
322
|
}
|
|
336
323
|
userErrors {
|
|
337
324
|
...UserError
|
|
338
325
|
}
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
# Appends a discount code to the cart's `discount_codes` array. Note: while multiple codes can be stored, the pricing engine currently uses **only the first applied code** — codes do not stack. Validated for existence, active status, and customer usage limits.
|
|
343
|
-
mutation CheckoutApplyDiscountCode($id: ID!, $discountCode: String!) {
|
|
344
|
-
checkoutApplyDiscountCode(id: $id, discountCode: $discountCode) {
|
|
345
|
-
checkout {
|
|
346
|
-
...Checkout
|
|
347
|
-
}
|
|
348
|
-
userErrors {
|
|
349
|
-
...UserError
|
|
326
|
+
warnings {
|
|
327
|
+
...CartWarning
|
|
350
328
|
}
|
|
351
329
|
}
|
|
352
330
|
}
|
|
353
331
|
|
|
354
|
-
#
|
|
355
|
-
mutation
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
...
|
|
332
|
+
# Selects a payment method by `paymentMethodId` (UUID from `availablePaymentMethods` query). Validates existence + active status; no pre-authorization performed here. Errors: `PAYMENT_METHOD_REQUIRED`, `INVALID_PAYMENT`, `CART_NOT_FOUND`.
|
|
333
|
+
mutation CartSelectPaymentMethod($input: CartSelectPaymentMethodInput!) {
|
|
334
|
+
cartSelectPaymentMethod(input: $input) {
|
|
335
|
+
cart {
|
|
336
|
+
...Cart
|
|
359
337
|
}
|
|
360
338
|
userErrors {
|
|
361
339
|
...UserError
|
|
362
340
|
}
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
# READ-ONLY validation of a discount code against the current checkout — does NOT modify state. Returns `{ isValid, discount, error }` for previewing the effect (e.g. inline UI feedback as the user types).
|
|
367
|
-
mutation CheckoutValidateDiscountCode($id: ID!, $discountCode: String!) {
|
|
368
|
-
checkoutValidateDiscountCode(id: $id, discountCode: $discountCode) {
|
|
369
|
-
result {
|
|
370
|
-
isValid
|
|
371
|
-
discount {
|
|
372
|
-
code
|
|
373
|
-
title
|
|
374
|
-
type
|
|
375
|
-
value
|
|
376
|
-
discountAmount {
|
|
377
|
-
amount
|
|
378
|
-
currencyCode
|
|
379
|
-
}
|
|
380
|
-
}
|
|
381
|
-
error {
|
|
382
|
-
code
|
|
383
|
-
message
|
|
384
|
-
}
|
|
385
|
-
}
|
|
386
|
-
userErrors {
|
|
387
|
-
...UserError
|
|
341
|
+
warnings {
|
|
342
|
+
...CartWarning
|
|
388
343
|
}
|
|
389
344
|
}
|
|
390
345
|
}
|
|
391
346
|
|
|
392
|
-
#
|
|
393
|
-
mutation
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
...
|
|
347
|
+
# 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`.
|
|
348
|
+
mutation CartApplyGiftCard($input: CartApplyGiftCardInput!) {
|
|
349
|
+
cartApplyGiftCard(input: $input) {
|
|
350
|
+
cart {
|
|
351
|
+
...Cart
|
|
397
352
|
}
|
|
398
353
|
userErrors {
|
|
399
354
|
...UserError
|
|
400
355
|
}
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
# Finalizes the checkout: creates the `Order`, deducts gift cards, sends order-created confirmation — all atomically. **Idempotent on `idempotencyKey`** (NOT on the checkout `id`); auto-generated if the caller omits it. The `paymentUrl` field is reserved but is NOT populated here — for hosted gateways (PayU, P24) the storefront calls a separate `paymentCreate` mutation after this returns.
|
|
405
|
-
mutation CheckoutComplete($id: ID!, $input: CheckoutCompleteInput) {
|
|
406
|
-
checkoutComplete(id: $id, input: $input) {
|
|
407
|
-
checkout {
|
|
408
|
-
...Checkout
|
|
409
|
-
}
|
|
410
|
-
order {
|
|
411
|
-
...Order
|
|
412
|
-
}
|
|
413
|
-
paymentUrl
|
|
414
|
-
userErrors {
|
|
415
|
-
...UserError
|
|
356
|
+
warnings {
|
|
357
|
+
...CartWarning
|
|
416
358
|
}
|
|
417
359
|
}
|
|
418
360
|
}
|
|
419
361
|
|
|
420
|
-
#
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
mutation CheckoutApplyGiftCard($id: ID!, $giftCardCode: String!) {
|
|
426
|
-
checkoutApplyGiftCard(id: $id, giftCardCode: $giftCardCode) {
|
|
427
|
-
checkout {
|
|
428
|
-
...Checkout
|
|
362
|
+
# 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.
|
|
363
|
+
mutation CartRemoveGiftCard($input: CartRemoveGiftCardInput!) {
|
|
364
|
+
cartRemoveGiftCard(input: $input) {
|
|
365
|
+
cart {
|
|
366
|
+
...Cart
|
|
429
367
|
}
|
|
430
368
|
userErrors {
|
|
431
369
|
...UserError
|
|
432
370
|
}
|
|
371
|
+
warnings {
|
|
372
|
+
...CartWarning
|
|
373
|
+
}
|
|
433
374
|
}
|
|
434
375
|
}
|
|
435
376
|
|
|
436
|
-
#
|
|
437
|
-
mutation
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
...
|
|
377
|
+
# 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.
|
|
378
|
+
mutation CartUpdateGiftCardRecipient($input: CartUpdateGiftCardRecipientInput!) {
|
|
379
|
+
cartUpdateGiftCardRecipient(input: $input) {
|
|
380
|
+
cart {
|
|
381
|
+
...Cart
|
|
441
382
|
}
|
|
442
383
|
userErrors {
|
|
443
384
|
...UserError
|
|
444
385
|
}
|
|
386
|
+
warnings {
|
|
387
|
+
...CartWarning
|
|
388
|
+
}
|
|
445
389
|
}
|
|
446
390
|
}
|
|
447
391
|
|
|
448
|
-
#
|
|
449
|
-
mutation
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
...
|
|
392
|
+
# Finalizes the cart — creates the `Order`, deducts gift cards, sends order-created confirmation — all atomically. **Idempotent on `idempotencyKey`** (auto-generated from cartId + minute timestamp if caller omits it). Returns `order` field after completion. Note: `paymentUrl` is intentionally NOT in payload — for hosted gateways (online providers) the storefront calls a separate `paymentCreate` mutation after this returns (check `order.canCreatePayment` first). Errors: `EMAIL_REQUIRED`, `SHIPPING_ADDRESS_REQUIRED`, `SHIPPING_METHOD_REQUIRED`, `PAYMENT_METHOD_REQUIRED`, `INSUFFICIENT_STOCK`, `ALREADY_COMPLETED`.
|
|
393
|
+
mutation CartComplete($input: CartCompleteInput!) {
|
|
394
|
+
cartComplete(input: $input) {
|
|
395
|
+
order {
|
|
396
|
+
...Order
|
|
453
397
|
}
|
|
454
398
|
userErrors {
|
|
455
399
|
...UserError
|
|
456
400
|
}
|
|
401
|
+
warnings {
|
|
402
|
+
...CartWarning
|
|
403
|
+
}
|
|
457
404
|
}
|
|
458
405
|
}
|
|
459
406
|
|