@doswiftly/storefront-operations 7.1.0 → 9.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/mutations.graphql CHANGED
@@ -291,9 +291,9 @@ mutation CheckoutCreate($input: CheckoutCreateInput!) {
291
291
  }
292
292
  }
293
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` (`validateOrderReadiness`).
295
- mutation CheckoutShippingAddressUpdate($checkoutId: ID!, $shippingAddress: CheckoutAddressInput!) {
296
- checkoutShippingAddressUpdate(checkoutId: $checkoutId, shippingAddress: $shippingAddress) {
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
297
  checkout {
298
298
  ...Checkout
299
299
  }
@@ -304,8 +304,8 @@ mutation CheckoutShippingAddressUpdate($checkoutId: ID!, $shippingAddress: Check
304
304
  }
305
305
 
306
306
  # Sets the billing address (full replace). Independent of shipping address — pass it explicitly even when "billing same as shipping".
307
- mutation CheckoutBillingAddressUpdate($checkoutId: ID!, $billingAddress: CheckoutAddressInput!) {
308
- checkoutBillingAddressUpdate(checkoutId: $checkoutId, billingAddress: $billingAddress) {
307
+ mutation CheckoutUpdateBillingAddress($id: ID!, $billingAddress: CheckoutAddressInput!) {
308
+ checkoutUpdateBillingAddress(id: $id, billingAddress: $billingAddress) {
309
309
  checkout {
310
310
  ...Checkout
311
311
  }
@@ -316,8 +316,8 @@ mutation CheckoutBillingAddressUpdate($checkoutId: ID!, $billingAddress: Checkou
316
316
  }
317
317
 
318
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 CheckoutEmailUpdate($checkoutId: ID!, $email: String!) {
320
- checkoutEmailUpdate(checkoutId: $checkoutId, email: $email) {
319
+ mutation CheckoutUpdateEmail($id: ID!, $email: String!) {
320
+ checkoutUpdateEmail(id: $id, email: $email) {
321
321
  checkout {
322
322
  ...Checkout
323
323
  }
@@ -327,9 +327,9 @@ mutation CheckoutEmailUpdate($checkoutId: ID!, $email: String!) {
327
327
  }
328
328
  }
329
329
 
330
- # Selects a shipping method by `shippingRateHandle` (a stable shipping-method UUID, NOT an opaque per-request token). The id comes from `availableShippingMethods` query, computed for the current address + cart subtotal at request time.
331
- mutation CheckoutShippingLineUpdate($checkoutId: ID!, $shippingRateHandle: String!) {
332
- checkoutShippingLineUpdate(checkoutId: $checkoutId, shippingRateHandle: $shippingRateHandle) {
330
+ # Selects a shipping method by `rateId` (a stable shipping-method UUID, NOT an opaque per-request token). The id comes from `availableShippingMethods` query, computed for the current address + cart subtotal at request time.
331
+ mutation CheckoutSelectShippingRate($id: ID!, $rateId: String!) {
332
+ checkoutSelectShippingRate(id: $id, rateId: $rateId) {
333
333
  checkout {
334
334
  ...Checkout
335
335
  }
@@ -339,9 +339,9 @@ mutation CheckoutShippingLineUpdate($checkoutId: ID!, $shippingRateHandle: Strin
339
339
  }
340
340
  }
341
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 via `discountService.validateDiscount`.
343
- mutation CheckoutDiscountCodeApply($checkoutId: ID!, $discountCode: String!) {
344
- checkoutDiscountCodeApply(checkoutId: $checkoutId, discountCode: $discountCode) {
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
345
  checkout {
346
346
  ...Checkout
347
347
  }
@@ -352,8 +352,8 @@ mutation CheckoutDiscountCodeApply($checkoutId: ID!, $discountCode: String!) {
352
352
  }
353
353
 
354
354
  # Removes a code from the cart's `discount_codes` array (filters by exact match). Triggers re-pricing.
355
- mutation CheckoutDiscountCodeRemove($checkoutId: ID!, $discountCode: String!) {
356
- checkoutDiscountCodeRemove(checkoutId: $checkoutId, discountCode: $discountCode) {
355
+ mutation CheckoutRemoveDiscountCode($id: ID!, $discountCode: String!) {
356
+ checkoutRemoveDiscountCode(id: $id, discountCode: $discountCode) {
357
357
  checkout {
358
358
  ...Checkout
359
359
  }
@@ -364,8 +364,8 @@ mutation CheckoutDiscountCodeRemove($checkoutId: ID!, $discountCode: String!) {
364
364
  }
365
365
 
366
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 CheckoutDiscountCodeValidate($checkoutId: ID!, $discountCode: String!) {
368
- checkoutDiscountCodeValidate(checkoutId: $checkoutId, discountCode: $discountCode) {
367
+ mutation CheckoutValidateDiscountCode($id: ID!, $discountCode: String!) {
368
+ checkoutValidateDiscountCode(id: $id, discountCode: $discountCode) {
369
369
  result {
370
370
  isValid
371
371
  discount {
@@ -390,8 +390,8 @@ mutation CheckoutDiscountCodeValidate($checkoutId: ID!, $discountCode: String!)
390
390
  }
391
391
 
392
392
  # Selects a payment method by `paymentMethodId` (UUID from `availablePaymentMethods` query). Validates existence and active status; no pre-authorization is performed here.
393
- mutation CheckoutPaymentMethodUpdate($checkoutId: ID!, $paymentMethodId: ID!) {
394
- checkoutPaymentMethodUpdate(checkoutId: $checkoutId, paymentMethodId: $paymentMethodId) {
393
+ mutation CheckoutSelectPaymentMethod($id: ID!, $paymentMethodId: ID!) {
394
+ checkoutSelectPaymentMethod(id: $id, paymentMethodId: $paymentMethodId) {
395
395
  checkout {
396
396
  ...Checkout
397
397
  }
@@ -401,9 +401,9 @@ mutation CheckoutPaymentMethodUpdate($checkoutId: ID!, $paymentMethodId: ID!) {
401
401
  }
402
402
  }
403
403
 
404
- # Finalizes the checkout: creates the `Order`, marks the cart `CONVERTED`, deducts gift cards, emits `ORDER_CREATED` (and `ORDER_CONFIRMED` for COD) — all in a single serializable transaction. **Idempotent on `idempotencyKey`** (NOT on `checkoutId`); auto-generated from `cartId + timestamp` 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($checkoutId: ID!, $input: CheckoutCompleteInput) {
406
- checkoutComplete(checkoutId: $checkoutId, input: $input) {
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
407
  checkout {
408
408
  ...Checkout
409
409
  }
@@ -421,9 +421,9 @@ mutation CheckoutComplete($checkoutId: ID!, $input: CheckoutCompleteInput) {
421
421
  # Gift Card Checkout Mutations
422
422
  # ============================================
423
423
 
424
- # 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 inside the `checkoutComplete` transaction. Errors: `GIFT_CARD_NOT_FOUND`, `GIFT_CARD_DEPLETED`, `GIFT_CARD_UNUSABLE`, `GIFT_CARD_ALREADY_APPLIED`.
425
- mutation CheckoutGiftCardApply($checkoutId: ID!, $giftCardCode: String!) {
426
- checkoutGiftCardApply(checkoutId: $checkoutId, giftCardCode: $giftCardCode) {
424
+ # 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 `checkoutComplete`. Errors: `GIFT_CARD_NOT_FOUND`, `GIFT_CARD_DEPLETED`, `GIFT_CARD_UNUSABLE`, `GIFT_CARD_ALREADY_APPLIED`.
425
+ mutation CheckoutApplyGiftCard($id: ID!, $giftCardCode: String!) {
426
+ checkoutApplyGiftCard(id: $id, giftCardCode: $giftCardCode) {
427
427
  checkout {
428
428
  ...Checkout
429
429
  }
@@ -434,8 +434,8 @@ mutation CheckoutGiftCardApply($checkoutId: ID!, $giftCardCode: String!) {
434
434
  }
435
435
 
436
436
  # Removes a gift card from the applied list and recalculates FIFO `appliedAmount` for the remaining cards. Since gift card balances are only debited at `checkoutComplete`, removing before completion has no effect on the underlying gift card balance.
437
- mutation CheckoutGiftCardRemove($checkoutId: ID!, $giftCardCode: String!) {
438
- checkoutGiftCardRemove(checkoutId: $checkoutId, giftCardCode: $giftCardCode) {
437
+ mutation CheckoutRemoveGiftCard($id: ID!, $giftCardCode: String!) {
438
+ checkoutRemoveGiftCard(id: $id, giftCardCode: $giftCardCode) {
439
439
  checkout {
440
440
  ...Checkout
441
441
  }
@@ -446,8 +446,8 @@ mutation CheckoutGiftCardRemove($checkoutId: ID!, $giftCardCode: String!) {
446
446
  }
447
447
 
448
448
  # Sets per-line-item recipient details (name, email, message, delivery date) for digital gift card products in the cart (variants with `type: GIFT_CARD`). Required before `checkoutComplete` for any line item with a gift-card variant. Recipient details are associated with each gift-card line item and propagated to the resulting order.
449
- mutation CheckoutGiftCardRecipientUpdate($input: CheckoutGiftCardRecipientInput!) {
450
- checkoutGiftCardRecipientUpdate(input: $input) {
449
+ mutation CheckoutUpdateGiftCardRecipient($input: CheckoutGiftCardRecipientInput!) {
450
+ checkoutUpdateGiftCardRecipient(input: $input) {
451
451
  checkout {
452
452
  ...Checkout
453
453
  }
@@ -491,14 +491,14 @@ mutation ReturnCancel($id: ID!) {
491
491
 
492
492
  # Redeems a loyalty reward by `rewardId`. Three reward types are supported, distinguished by which output field is populated: `discountCode` (issues a `LOYALTY-XXXX` code with 30-day expiry), `productDiscountCode` (issues a single-use 100%-off code for a specific product), or `giftCardCode` (creates a new gift card for the customer). Points are deducted atomically inside a transaction — if external creation (e.g. gift card service) fails after deduction, points are reversed.
493
493
  mutation RedeemLoyaltyReward($input: RedeemRewardInput!) {
494
- redeemLoyaltyReward(input: $input) {
494
+ loyaltyRedeemReward(input: $input) {
495
495
  ...RedeemRewardPayload
496
496
  }
497
497
  }
498
498
 
499
499
  # Returns the customer's referral code, generating one on first call. Idempotent UPSERT — subsequent calls return the existing code from `customers.referral_code`. Format: `REF-XXXXXXXX` (8 random alphanumeric chars). Output also includes a `shareUrl` built from the shop's domain.
500
500
  mutation GenerateReferralCode {
501
- generateReferralCode {
501
+ loyaltyGenerateReferralCode {
502
502
  ...GenerateReferralCodePayload
503
503
  }
504
504
  }
@@ -553,37 +553,45 @@ mutation WishlistCreate($input: WishlistCreateInput!) {
553
553
  wishlist {
554
554
  ...Wishlist
555
555
  }
556
- userErrors
556
+ userErrors {
557
+ ...UserError
558
+ }
557
559
  }
558
560
  }
559
561
 
560
- # Adds an item by `productId` (and optional `variantId`) to a wishlist. Idempotent on the `(wishlist_id, product_id, variant_id)` unique constraint — adding an already-present item is a silent no-op (`ON CONFLICT DO NOTHING`). Captures `priceAtAdd` for price-drop notifications.
561
- mutation WishlistAddItem($wishlistId: ID!, $input: WishlistItemInput!) {
562
- wishlistAddItem(wishlistId: $wishlistId, input: $input) {
562
+ # Adds an item by `productId` (and optional `variantId`) to a wishlist. Idempotent on the `(wishlist_id, product_id, variant_id)` unique constraint — adding an already-present item is a silent no-op. Captures `priceAtAdd` for price-drop notifications.
563
+ mutation WishlistAddItem($id: ID!, $input: WishlistItemInput!) {
564
+ wishlistAddItem(id: $id, input: $input) {
563
565
  wishlist {
564
566
  ...Wishlist
565
567
  }
566
- userErrors
568
+ userErrors {
569
+ ...UserError
570
+ }
567
571
  }
568
572
  }
569
573
 
570
574
  # Hard-deletes a wishlist item by `itemId` (the `WishlistItem` row id, NOT the product id).
571
- mutation WishlistRemoveItem($wishlistId: ID!, $itemId: ID!) {
572
- wishlistRemoveItem(wishlistId: $wishlistId, itemId: $itemId) {
575
+ mutation WishlistRemoveItem($id: ID!, $itemId: ID!) {
576
+ wishlistRemoveItem(id: $id, itemId: $itemId) {
573
577
  wishlist {
574
578
  ...Wishlist
575
579
  }
576
- userErrors
580
+ userErrors {
581
+ ...UserError
582
+ }
577
583
  }
578
584
  }
579
585
 
580
- # Hard-deletes the wishlist row. All `WishlistItem` rows are removed via FK cascade. No soft-delete; cannot be undone.
581
- mutation WishlistDelete($wishlistId: ID!) {
582
- wishlistDelete(wishlistId: $wishlistId) {
586
+ # Hard-deletes the wishlist row. All wishlist items are removed via cascade. No soft-delete; cannot be undone.
587
+ mutation WishlistDelete($id: ID!) {
588
+ wishlistDelete(id: $id) {
583
589
  wishlist {
584
590
  ...Wishlist
585
591
  }
586
- userErrors
592
+ userErrors {
593
+ ...UserError
594
+ }
587
595
  }
588
596
  }
589
597