@doswiftly/storefront-sdk 4.7.2 → 5.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 (40) hide show
  1. package/CHANGELOG.md +639 -0
  2. package/dist/core/auth/auth-client.d.ts +15 -8
  3. package/dist/core/auth/auth-client.d.ts.map +1 -1
  4. package/dist/core/auth/auth-client.js +18 -11
  5. package/dist/core/auth/handlers.d.ts +31 -0
  6. package/dist/core/auth/handlers.d.ts.map +1 -1
  7. package/dist/core/auth/handlers.js +69 -0
  8. package/dist/core/auth/types.d.ts +5 -5
  9. package/dist/core/auth/types.d.ts.map +1 -1
  10. package/dist/core/cache.d.ts +1 -1
  11. package/dist/core/cache.js +1 -1
  12. package/dist/core/cart/types.d.ts +1 -1
  13. package/dist/core/cart/types.d.ts.map +1 -1
  14. package/dist/core/client/compose.d.ts +1 -1
  15. package/dist/core/client/compose.js +1 -1
  16. package/dist/core/client/create-client.d.ts +2 -2
  17. package/dist/core/client/create-client.js +2 -2
  18. package/dist/core/client/execute.d.ts.map +1 -1
  19. package/dist/core/client/execute.js +6 -0
  20. package/dist/core/client/types.js +1 -1
  21. package/dist/core/index.d.ts +1 -1
  22. package/dist/core/index.d.ts.map +1 -1
  23. package/dist/core/index.js +1 -1
  24. package/dist/core/language/cookie-config.d.ts +7 -2
  25. package/dist/core/language/cookie-config.d.ts.map +1 -1
  26. package/dist/core/language/cookie-config.js +7 -2
  27. package/dist/core/operations/auth.d.ts +4 -4
  28. package/dist/core/operations/auth.d.ts.map +1 -1
  29. package/dist/core/operations/auth.js +11 -11
  30. package/dist/core/operations/cart.d.ts +8 -8
  31. package/dist/core/operations/cart.d.ts.map +1 -1
  32. package/dist/core/operations/cart.js +9 -9
  33. package/dist/index.d.ts +1 -1
  34. package/dist/index.js +1 -1
  35. package/dist/react/hooks/use-auth.d.ts.map +1 -1
  36. package/dist/react/hooks/use-auth.js +6 -13
  37. package/dist/react/stores/auth.store.d.ts +0 -2
  38. package/dist/react/stores/auth.store.d.ts.map +1 -1
  39. package/dist/react/stores/auth.store.js +10 -7
  40. package/package.json +2 -3
@@ -10,12 +10,12 @@
10
10
  *
11
11
  * Cart mutations always return full Cart + userErrors.
12
12
  */
13
- export declare const CART_QUERY = "\n query Cart($id: ID!) {\n cart(id: $id) {\n ...Cart\n }\n }\n \n fragment Cart on Cart {\n id\n checkoutUrl\n totalQuantity\n cost { ...CartCost }\n lines(first: 100) { ...CartLine }\n buyerIdentity { ...CartBuyerIdentity }\n discountCodes { ...CartDiscountCode }\n discountAllocations { ...CartDiscountAllocation }\n note\n attributes { key value }\n createdAt\n updatedAt\n }\n \n fragment CartCost on CartCost {\n totalAmount { ...PriceMoney }\n subtotalAmount { ...PriceMoney }\n totalTaxAmount { ...PriceMoney }\n totalDutyAmount { ...PriceMoney }\n }\n\n \n fragment CartLine on CartLine {\n id\n quantity\n merchandise { ...ProductVariant }\n cost { ...CartLineCost }\n attributes { key value }\n productId\n productTitle\n productHandle\n productType\n }\n \n fragment CartLineCost on CartLineCost {\n amountPerQuantity { ...PriceMoney }\n subtotalAmount { ...PriceMoney }\n totalAmount { ...PriceMoney }\n compareAtAmountPerQuantity { ...PriceMoney }\n }\n\n \n fragment ProductVariant on ProductVariant {\n id\n title\n sku\n price { ...PriceMoney }\n originalPrice { ...Money }\n compareAtPrice { ...PriceMoney }\n originalCompareAtPrice { ...Money }\n available\n quantityAvailable\n image { ...Image }\n selectedOptions { ...SelectedOption }\n barcode\n weight\n position\n }\n \n fragment PriceMoney on PriceMoney {\n ...Price\n baseAmount\n baseCurrencyCode\n exchangeRate\n marginApplied\n rateTimestamp\n isConverted\n }\n \n fragment Price on PriceMoney {\n amount\n currencyCode\n }\n\n\n \n fragment Money on Money {\n amount\n currencyCode\n }\n\n \n fragment Image on Image {\n id\n url(transform: { maxWidth: 300 })\n altText\n width\n height\n thumbhash\n }\n\n \n fragment SelectedOption on SelectedOption {\n name\n value\n }\n\n\n\n \n fragment CartBuyerIdentity on CartBuyerIdentity {\n email\n phone\n countryCode\n }\n\n \n fragment CartDiscountCode on CartDiscountCode {\n code\n applicable\n }\n\n \n fragment CartDiscountAllocation on CartDiscountAllocation {\n discountCode\n amount { ...Money }\n }\n\n\n";
14
- export declare const CART_CREATE = "\n mutation CartCreate($input: CartCreateInput) {\n cartCreate(input: $input) {\n cart { ...Cart }\n userErrors { ...UserError }\n }\n }\n \n fragment Cart on Cart {\n id\n checkoutUrl\n totalQuantity\n cost { ...CartCost }\n lines(first: 100) { ...CartLine }\n buyerIdentity { ...CartBuyerIdentity }\n discountCodes { ...CartDiscountCode }\n discountAllocations { ...CartDiscountAllocation }\n note\n attributes { key value }\n createdAt\n updatedAt\n }\n \n fragment CartCost on CartCost {\n totalAmount { ...PriceMoney }\n subtotalAmount { ...PriceMoney }\n totalTaxAmount { ...PriceMoney }\n totalDutyAmount { ...PriceMoney }\n }\n\n \n fragment CartLine on CartLine {\n id\n quantity\n merchandise { ...ProductVariant }\n cost { ...CartLineCost }\n attributes { key value }\n productId\n productTitle\n productHandle\n productType\n }\n \n fragment CartLineCost on CartLineCost {\n amountPerQuantity { ...PriceMoney }\n subtotalAmount { ...PriceMoney }\n totalAmount { ...PriceMoney }\n compareAtAmountPerQuantity { ...PriceMoney }\n }\n\n \n fragment ProductVariant on ProductVariant {\n id\n title\n sku\n price { ...PriceMoney }\n originalPrice { ...Money }\n compareAtPrice { ...PriceMoney }\n originalCompareAtPrice { ...Money }\n available\n quantityAvailable\n image { ...Image }\n selectedOptions { ...SelectedOption }\n barcode\n weight\n position\n }\n \n fragment PriceMoney on PriceMoney {\n ...Price\n baseAmount\n baseCurrencyCode\n exchangeRate\n marginApplied\n rateTimestamp\n isConverted\n }\n \n fragment Price on PriceMoney {\n amount\n currencyCode\n }\n\n\n \n fragment Money on Money {\n amount\n currencyCode\n }\n\n \n fragment Image on Image {\n id\n url(transform: { maxWidth: 300 })\n altText\n width\n height\n thumbhash\n }\n\n \n fragment SelectedOption on SelectedOption {\n name\n value\n }\n\n\n\n \n fragment CartBuyerIdentity on CartBuyerIdentity {\n email\n phone\n countryCode\n }\n\n \n fragment CartDiscountCode on CartDiscountCode {\n code\n applicable\n }\n\n \n fragment CartDiscountAllocation on CartDiscountAllocation {\n discountCode\n amount { ...Money }\n }\n\n\n \n fragment UserError on UserError {\n message\n code\n field\n }\n\n";
15
- export declare const CART_LINES_ADD = "\n mutation CartLinesAdd($cartId: ID!, $lines: [CartLineInput!]!) {\n cartLinesAdd(cartId: $cartId, lines: $lines) {\n cart { ...Cart }\n userErrors { ...UserError }\n }\n }\n \n fragment Cart on Cart {\n id\n checkoutUrl\n totalQuantity\n cost { ...CartCost }\n lines(first: 100) { ...CartLine }\n buyerIdentity { ...CartBuyerIdentity }\n discountCodes { ...CartDiscountCode }\n discountAllocations { ...CartDiscountAllocation }\n note\n attributes { key value }\n createdAt\n updatedAt\n }\n \n fragment CartCost on CartCost {\n totalAmount { ...PriceMoney }\n subtotalAmount { ...PriceMoney }\n totalTaxAmount { ...PriceMoney }\n totalDutyAmount { ...PriceMoney }\n }\n\n \n fragment CartLine on CartLine {\n id\n quantity\n merchandise { ...ProductVariant }\n cost { ...CartLineCost }\n attributes { key value }\n productId\n productTitle\n productHandle\n productType\n }\n \n fragment CartLineCost on CartLineCost {\n amountPerQuantity { ...PriceMoney }\n subtotalAmount { ...PriceMoney }\n totalAmount { ...PriceMoney }\n compareAtAmountPerQuantity { ...PriceMoney }\n }\n\n \n fragment ProductVariant on ProductVariant {\n id\n title\n sku\n price { ...PriceMoney }\n originalPrice { ...Money }\n compareAtPrice { ...PriceMoney }\n originalCompareAtPrice { ...Money }\n available\n quantityAvailable\n image { ...Image }\n selectedOptions { ...SelectedOption }\n barcode\n weight\n position\n }\n \n fragment PriceMoney on PriceMoney {\n ...Price\n baseAmount\n baseCurrencyCode\n exchangeRate\n marginApplied\n rateTimestamp\n isConverted\n }\n \n fragment Price on PriceMoney {\n amount\n currencyCode\n }\n\n\n \n fragment Money on Money {\n amount\n currencyCode\n }\n\n \n fragment Image on Image {\n id\n url(transform: { maxWidth: 300 })\n altText\n width\n height\n thumbhash\n }\n\n \n fragment SelectedOption on SelectedOption {\n name\n value\n }\n\n\n\n \n fragment CartBuyerIdentity on CartBuyerIdentity {\n email\n phone\n countryCode\n }\n\n \n fragment CartDiscountCode on CartDiscountCode {\n code\n applicable\n }\n\n \n fragment CartDiscountAllocation on CartDiscountAllocation {\n discountCode\n amount { ...Money }\n }\n\n\n \n fragment UserError on UserError {\n message\n code\n field\n }\n\n";
16
- export declare const CART_LINES_UPDATE = "\n mutation CartLinesUpdate($cartId: ID!, $lines: [CartLineUpdateInput!]!) {\n cartLinesUpdate(cartId: $cartId, lines: $lines) {\n cart { ...Cart }\n userErrors { ...UserError }\n }\n }\n \n fragment Cart on Cart {\n id\n checkoutUrl\n totalQuantity\n cost { ...CartCost }\n lines(first: 100) { ...CartLine }\n buyerIdentity { ...CartBuyerIdentity }\n discountCodes { ...CartDiscountCode }\n discountAllocations { ...CartDiscountAllocation }\n note\n attributes { key value }\n createdAt\n updatedAt\n }\n \n fragment CartCost on CartCost {\n totalAmount { ...PriceMoney }\n subtotalAmount { ...PriceMoney }\n totalTaxAmount { ...PriceMoney }\n totalDutyAmount { ...PriceMoney }\n }\n\n \n fragment CartLine on CartLine {\n id\n quantity\n merchandise { ...ProductVariant }\n cost { ...CartLineCost }\n attributes { key value }\n productId\n productTitle\n productHandle\n productType\n }\n \n fragment CartLineCost on CartLineCost {\n amountPerQuantity { ...PriceMoney }\n subtotalAmount { ...PriceMoney }\n totalAmount { ...PriceMoney }\n compareAtAmountPerQuantity { ...PriceMoney }\n }\n\n \n fragment ProductVariant on ProductVariant {\n id\n title\n sku\n price { ...PriceMoney }\n originalPrice { ...Money }\n compareAtPrice { ...PriceMoney }\n originalCompareAtPrice { ...Money }\n available\n quantityAvailable\n image { ...Image }\n selectedOptions { ...SelectedOption }\n barcode\n weight\n position\n }\n \n fragment PriceMoney on PriceMoney {\n ...Price\n baseAmount\n baseCurrencyCode\n exchangeRate\n marginApplied\n rateTimestamp\n isConverted\n }\n \n fragment Price on PriceMoney {\n amount\n currencyCode\n }\n\n\n \n fragment Money on Money {\n amount\n currencyCode\n }\n\n \n fragment Image on Image {\n id\n url(transform: { maxWidth: 300 })\n altText\n width\n height\n thumbhash\n }\n\n \n fragment SelectedOption on SelectedOption {\n name\n value\n }\n\n\n\n \n fragment CartBuyerIdentity on CartBuyerIdentity {\n email\n phone\n countryCode\n }\n\n \n fragment CartDiscountCode on CartDiscountCode {\n code\n applicable\n }\n\n \n fragment CartDiscountAllocation on CartDiscountAllocation {\n discountCode\n amount { ...Money }\n }\n\n\n \n fragment UserError on UserError {\n message\n code\n field\n }\n\n";
17
- export declare const CART_LINES_REMOVE = "\n mutation CartLinesRemove($cartId: ID!, $lineIds: [ID!]!) {\n cartLinesRemove(cartId: $cartId, lineIds: $lineIds) {\n cart { ...Cart }\n userErrors { ...UserError }\n }\n }\n \n fragment Cart on Cart {\n id\n checkoutUrl\n totalQuantity\n cost { ...CartCost }\n lines(first: 100) { ...CartLine }\n buyerIdentity { ...CartBuyerIdentity }\n discountCodes { ...CartDiscountCode }\n discountAllocations { ...CartDiscountAllocation }\n note\n attributes { key value }\n createdAt\n updatedAt\n }\n \n fragment CartCost on CartCost {\n totalAmount { ...PriceMoney }\n subtotalAmount { ...PriceMoney }\n totalTaxAmount { ...PriceMoney }\n totalDutyAmount { ...PriceMoney }\n }\n\n \n fragment CartLine on CartLine {\n id\n quantity\n merchandise { ...ProductVariant }\n cost { ...CartLineCost }\n attributes { key value }\n productId\n productTitle\n productHandle\n productType\n }\n \n fragment CartLineCost on CartLineCost {\n amountPerQuantity { ...PriceMoney }\n subtotalAmount { ...PriceMoney }\n totalAmount { ...PriceMoney }\n compareAtAmountPerQuantity { ...PriceMoney }\n }\n\n \n fragment ProductVariant on ProductVariant {\n id\n title\n sku\n price { ...PriceMoney }\n originalPrice { ...Money }\n compareAtPrice { ...PriceMoney }\n originalCompareAtPrice { ...Money }\n available\n quantityAvailable\n image { ...Image }\n selectedOptions { ...SelectedOption }\n barcode\n weight\n position\n }\n \n fragment PriceMoney on PriceMoney {\n ...Price\n baseAmount\n baseCurrencyCode\n exchangeRate\n marginApplied\n rateTimestamp\n isConverted\n }\n \n fragment Price on PriceMoney {\n amount\n currencyCode\n }\n\n\n \n fragment Money on Money {\n amount\n currencyCode\n }\n\n \n fragment Image on Image {\n id\n url(transform: { maxWidth: 300 })\n altText\n width\n height\n thumbhash\n }\n\n \n fragment SelectedOption on SelectedOption {\n name\n value\n }\n\n\n\n \n fragment CartBuyerIdentity on CartBuyerIdentity {\n email\n phone\n countryCode\n }\n\n \n fragment CartDiscountCode on CartDiscountCode {\n code\n applicable\n }\n\n \n fragment CartDiscountAllocation on CartDiscountAllocation {\n discountCode\n amount { ...Money }\n }\n\n\n \n fragment UserError on UserError {\n message\n code\n field\n }\n\n";
18
- export declare const CART_DISCOUNT_CODES_UPDATE = "\n mutation CartDiscountCodesUpdate($cartId: ID!, $discountCodes: [String!]!) {\n cartDiscountCodesUpdate(cartId: $cartId, discountCodes: $discountCodes) {\n cart { ...Cart }\n userErrors { ...UserError }\n }\n }\n \n fragment Cart on Cart {\n id\n checkoutUrl\n totalQuantity\n cost { ...CartCost }\n lines(first: 100) { ...CartLine }\n buyerIdentity { ...CartBuyerIdentity }\n discountCodes { ...CartDiscountCode }\n discountAllocations { ...CartDiscountAllocation }\n note\n attributes { key value }\n createdAt\n updatedAt\n }\n \n fragment CartCost on CartCost {\n totalAmount { ...PriceMoney }\n subtotalAmount { ...PriceMoney }\n totalTaxAmount { ...PriceMoney }\n totalDutyAmount { ...PriceMoney }\n }\n\n \n fragment CartLine on CartLine {\n id\n quantity\n merchandise { ...ProductVariant }\n cost { ...CartLineCost }\n attributes { key value }\n productId\n productTitle\n productHandle\n productType\n }\n \n fragment CartLineCost on CartLineCost {\n amountPerQuantity { ...PriceMoney }\n subtotalAmount { ...PriceMoney }\n totalAmount { ...PriceMoney }\n compareAtAmountPerQuantity { ...PriceMoney }\n }\n\n \n fragment ProductVariant on ProductVariant {\n id\n title\n sku\n price { ...PriceMoney }\n originalPrice { ...Money }\n compareAtPrice { ...PriceMoney }\n originalCompareAtPrice { ...Money }\n available\n quantityAvailable\n image { ...Image }\n selectedOptions { ...SelectedOption }\n barcode\n weight\n position\n }\n \n fragment PriceMoney on PriceMoney {\n ...Price\n baseAmount\n baseCurrencyCode\n exchangeRate\n marginApplied\n rateTimestamp\n isConverted\n }\n \n fragment Price on PriceMoney {\n amount\n currencyCode\n }\n\n\n \n fragment Money on Money {\n amount\n currencyCode\n }\n\n \n fragment Image on Image {\n id\n url(transform: { maxWidth: 300 })\n altText\n width\n height\n thumbhash\n }\n\n \n fragment SelectedOption on SelectedOption {\n name\n value\n }\n\n\n\n \n fragment CartBuyerIdentity on CartBuyerIdentity {\n email\n phone\n countryCode\n }\n\n \n fragment CartDiscountCode on CartDiscountCode {\n code\n applicable\n }\n\n \n fragment CartDiscountAllocation on CartDiscountAllocation {\n discountCode\n amount { ...Money }\n }\n\n\n \n fragment UserError on UserError {\n message\n code\n field\n }\n\n";
19
- export declare const CART_NOTE_UPDATE = "\n mutation CartNoteUpdate($cartId: ID!, $note: String!) {\n cartNoteUpdate(cartId: $cartId, note: $note) {\n cart { ...Cart }\n userErrors { ...UserError }\n }\n }\n \n fragment Cart on Cart {\n id\n checkoutUrl\n totalQuantity\n cost { ...CartCost }\n lines(first: 100) { ...CartLine }\n buyerIdentity { ...CartBuyerIdentity }\n discountCodes { ...CartDiscountCode }\n discountAllocations { ...CartDiscountAllocation }\n note\n attributes { key value }\n createdAt\n updatedAt\n }\n \n fragment CartCost on CartCost {\n totalAmount { ...PriceMoney }\n subtotalAmount { ...PriceMoney }\n totalTaxAmount { ...PriceMoney }\n totalDutyAmount { ...PriceMoney }\n }\n\n \n fragment CartLine on CartLine {\n id\n quantity\n merchandise { ...ProductVariant }\n cost { ...CartLineCost }\n attributes { key value }\n productId\n productTitle\n productHandle\n productType\n }\n \n fragment CartLineCost on CartLineCost {\n amountPerQuantity { ...PriceMoney }\n subtotalAmount { ...PriceMoney }\n totalAmount { ...PriceMoney }\n compareAtAmountPerQuantity { ...PriceMoney }\n }\n\n \n fragment ProductVariant on ProductVariant {\n id\n title\n sku\n price { ...PriceMoney }\n originalPrice { ...Money }\n compareAtPrice { ...PriceMoney }\n originalCompareAtPrice { ...Money }\n available\n quantityAvailable\n image { ...Image }\n selectedOptions { ...SelectedOption }\n barcode\n weight\n position\n }\n \n fragment PriceMoney on PriceMoney {\n ...Price\n baseAmount\n baseCurrencyCode\n exchangeRate\n marginApplied\n rateTimestamp\n isConverted\n }\n \n fragment Price on PriceMoney {\n amount\n currencyCode\n }\n\n\n \n fragment Money on Money {\n amount\n currencyCode\n }\n\n \n fragment Image on Image {\n id\n url(transform: { maxWidth: 300 })\n altText\n width\n height\n thumbhash\n }\n\n \n fragment SelectedOption on SelectedOption {\n name\n value\n }\n\n\n\n \n fragment CartBuyerIdentity on CartBuyerIdentity {\n email\n phone\n countryCode\n }\n\n \n fragment CartDiscountCode on CartDiscountCode {\n code\n applicable\n }\n\n \n fragment CartDiscountAllocation on CartDiscountAllocation {\n discountCode\n amount { ...Money }\n }\n\n\n \n fragment UserError on UserError {\n message\n code\n field\n }\n\n";
20
- export declare const CART_BUYER_IDENTITY_UPDATE = "\n mutation CartBuyerIdentityUpdate($cartId: ID!, $buyerIdentity: CartBuyerIdentityInput!) {\n cartBuyerIdentityUpdate(cartId: $cartId, buyerIdentity: $buyerIdentity) {\n cart { ...Cart }\n userErrors { ...UserError }\n }\n }\n \n fragment Cart on Cart {\n id\n checkoutUrl\n totalQuantity\n cost { ...CartCost }\n lines(first: 100) { ...CartLine }\n buyerIdentity { ...CartBuyerIdentity }\n discountCodes { ...CartDiscountCode }\n discountAllocations { ...CartDiscountAllocation }\n note\n attributes { key value }\n createdAt\n updatedAt\n }\n \n fragment CartCost on CartCost {\n totalAmount { ...PriceMoney }\n subtotalAmount { ...PriceMoney }\n totalTaxAmount { ...PriceMoney }\n totalDutyAmount { ...PriceMoney }\n }\n\n \n fragment CartLine on CartLine {\n id\n quantity\n merchandise { ...ProductVariant }\n cost { ...CartLineCost }\n attributes { key value }\n productId\n productTitle\n productHandle\n productType\n }\n \n fragment CartLineCost on CartLineCost {\n amountPerQuantity { ...PriceMoney }\n subtotalAmount { ...PriceMoney }\n totalAmount { ...PriceMoney }\n compareAtAmountPerQuantity { ...PriceMoney }\n }\n\n \n fragment ProductVariant on ProductVariant {\n id\n title\n sku\n price { ...PriceMoney }\n originalPrice { ...Money }\n compareAtPrice { ...PriceMoney }\n originalCompareAtPrice { ...Money }\n available\n quantityAvailable\n image { ...Image }\n selectedOptions { ...SelectedOption }\n barcode\n weight\n position\n }\n \n fragment PriceMoney on PriceMoney {\n ...Price\n baseAmount\n baseCurrencyCode\n exchangeRate\n marginApplied\n rateTimestamp\n isConverted\n }\n \n fragment Price on PriceMoney {\n amount\n currencyCode\n }\n\n\n \n fragment Money on Money {\n amount\n currencyCode\n }\n\n \n fragment Image on Image {\n id\n url(transform: { maxWidth: 300 })\n altText\n width\n height\n thumbhash\n }\n\n \n fragment SelectedOption on SelectedOption {\n name\n value\n }\n\n\n\n \n fragment CartBuyerIdentity on CartBuyerIdentity {\n email\n phone\n countryCode\n }\n\n \n fragment CartDiscountCode on CartDiscountCode {\n code\n applicable\n }\n\n \n fragment CartDiscountAllocation on CartDiscountAllocation {\n discountCode\n amount { ...Money }\n }\n\n\n \n fragment UserError on UserError {\n message\n code\n field\n }\n\n";
13
+ export declare const CART_QUERY = "\n query Cart($id: ID!) {\n cart(id: $id) {\n ...Cart\n }\n }\n \n fragment Cart on Cart {\n id\n checkoutUrl\n totalQuantity\n cost { ...CartCost }\n lines(first: 100) { ...CartLine }\n buyerIdentity { ...CartBuyerIdentity }\n discountCodes { ...CartDiscountCode }\n discountAllocations { ...CartDiscountAllocation }\n note\n attributes { key value }\n createdAt\n updatedAt\n }\n \n fragment CartCost on CartCost {\n total { ...PriceMoney }\n subtotal { ...PriceMoney }\n totalTax { ...PriceMoney }\n totalDuty { ...PriceMoney }\n }\n\n \n fragment CartLine on CartLine {\n id\n quantity\n variant { ...ProductVariant }\n cost { ...CartLineCost }\n attributes { key value }\n productId\n productTitle\n productHandle\n productType\n }\n \n fragment CartLineCost on CartLineCost {\n pricePerUnit { ...PriceMoney }\n subtotal { ...PriceMoney }\n total { ...PriceMoney }\n compareAtPricePerUnit { ...PriceMoney }\n }\n\n \n fragment ProductVariant on ProductVariant {\n id\n title\n sku\n price { ...PriceMoney }\n originalPrice { ...Money }\n compareAtPrice { ...PriceMoney }\n originalCompareAtPrice { ...Money }\n available\n quantityAvailable\n image { ...Image }\n selectedOptions { ...SelectedOption }\n barcode\n weight\n position\n }\n \n fragment PriceMoney on PriceMoney {\n ...Price\n baseAmount\n baseCurrencyCode\n exchangeRate\n marginApplied\n rateTimestamp\n isConverted\n }\n \n fragment Price on PriceMoney {\n amount\n currencyCode\n }\n\n\n \n fragment Money on Money {\n amount\n currencyCode\n }\n\n \n fragment Image on Image {\n id\n url(transform: { maxWidth: 300 })\n altText\n width\n height\n thumbhash\n }\n\n \n fragment SelectedOption on SelectedOption {\n name\n value\n }\n\n\n\n \n fragment CartBuyerIdentity on CartBuyerIdentity {\n email\n phone\n countryCode\n }\n\n \n fragment CartDiscountCode on CartDiscountCode {\n code\n applicable\n }\n\n \n fragment CartDiscountAllocation on CartDiscountAllocation {\n discountCode\n amount { ...Money }\n }\n\n\n";
14
+ export declare const CART_CREATE = "\n mutation CartCreate($input: CartCreateInput) {\n cartCreate(input: $input) {\n cart { ...Cart }\n userErrors { ...UserError }\n }\n }\n \n fragment Cart on Cart {\n id\n checkoutUrl\n totalQuantity\n cost { ...CartCost }\n lines(first: 100) { ...CartLine }\n buyerIdentity { ...CartBuyerIdentity }\n discountCodes { ...CartDiscountCode }\n discountAllocations { ...CartDiscountAllocation }\n note\n attributes { key value }\n createdAt\n updatedAt\n }\n \n fragment CartCost on CartCost {\n total { ...PriceMoney }\n subtotal { ...PriceMoney }\n totalTax { ...PriceMoney }\n totalDuty { ...PriceMoney }\n }\n\n \n fragment CartLine on CartLine {\n id\n quantity\n variant { ...ProductVariant }\n cost { ...CartLineCost }\n attributes { key value }\n productId\n productTitle\n productHandle\n productType\n }\n \n fragment CartLineCost on CartLineCost {\n pricePerUnit { ...PriceMoney }\n subtotal { ...PriceMoney }\n total { ...PriceMoney }\n compareAtPricePerUnit { ...PriceMoney }\n }\n\n \n fragment ProductVariant on ProductVariant {\n id\n title\n sku\n price { ...PriceMoney }\n originalPrice { ...Money }\n compareAtPrice { ...PriceMoney }\n originalCompareAtPrice { ...Money }\n available\n quantityAvailable\n image { ...Image }\n selectedOptions { ...SelectedOption }\n barcode\n weight\n position\n }\n \n fragment PriceMoney on PriceMoney {\n ...Price\n baseAmount\n baseCurrencyCode\n exchangeRate\n marginApplied\n rateTimestamp\n isConverted\n }\n \n fragment Price on PriceMoney {\n amount\n currencyCode\n }\n\n\n \n fragment Money on Money {\n amount\n currencyCode\n }\n\n \n fragment Image on Image {\n id\n url(transform: { maxWidth: 300 })\n altText\n width\n height\n thumbhash\n }\n\n \n fragment SelectedOption on SelectedOption {\n name\n value\n }\n\n\n\n \n fragment CartBuyerIdentity on CartBuyerIdentity {\n email\n phone\n countryCode\n }\n\n \n fragment CartDiscountCode on CartDiscountCode {\n code\n applicable\n }\n\n \n fragment CartDiscountAllocation on CartDiscountAllocation {\n discountCode\n amount { ...Money }\n }\n\n\n \n fragment UserError on UserError {\n message\n code\n field\n }\n\n";
15
+ export declare const CART_LINES_ADD = "\n mutation CartLinesAdd($cartId: ID!, $lines: [CartLineInput!]!) {\n cartLinesAdd(cartId: $cartId, lines: $lines) {\n cart { ...Cart }\n userErrors { ...UserError }\n }\n }\n \n fragment Cart on Cart {\n id\n checkoutUrl\n totalQuantity\n cost { ...CartCost }\n lines(first: 100) { ...CartLine }\n buyerIdentity { ...CartBuyerIdentity }\n discountCodes { ...CartDiscountCode }\n discountAllocations { ...CartDiscountAllocation }\n note\n attributes { key value }\n createdAt\n updatedAt\n }\n \n fragment CartCost on CartCost {\n total { ...PriceMoney }\n subtotal { ...PriceMoney }\n totalTax { ...PriceMoney }\n totalDuty { ...PriceMoney }\n }\n\n \n fragment CartLine on CartLine {\n id\n quantity\n variant { ...ProductVariant }\n cost { ...CartLineCost }\n attributes { key value }\n productId\n productTitle\n productHandle\n productType\n }\n \n fragment CartLineCost on CartLineCost {\n pricePerUnit { ...PriceMoney }\n subtotal { ...PriceMoney }\n total { ...PriceMoney }\n compareAtPricePerUnit { ...PriceMoney }\n }\n\n \n fragment ProductVariant on ProductVariant {\n id\n title\n sku\n price { ...PriceMoney }\n originalPrice { ...Money }\n compareAtPrice { ...PriceMoney }\n originalCompareAtPrice { ...Money }\n available\n quantityAvailable\n image { ...Image }\n selectedOptions { ...SelectedOption }\n barcode\n weight\n position\n }\n \n fragment PriceMoney on PriceMoney {\n ...Price\n baseAmount\n baseCurrencyCode\n exchangeRate\n marginApplied\n rateTimestamp\n isConverted\n }\n \n fragment Price on PriceMoney {\n amount\n currencyCode\n }\n\n\n \n fragment Money on Money {\n amount\n currencyCode\n }\n\n \n fragment Image on Image {\n id\n url(transform: { maxWidth: 300 })\n altText\n width\n height\n thumbhash\n }\n\n \n fragment SelectedOption on SelectedOption {\n name\n value\n }\n\n\n\n \n fragment CartBuyerIdentity on CartBuyerIdentity {\n email\n phone\n countryCode\n }\n\n \n fragment CartDiscountCode on CartDiscountCode {\n code\n applicable\n }\n\n \n fragment CartDiscountAllocation on CartDiscountAllocation {\n discountCode\n amount { ...Money }\n }\n\n\n \n fragment UserError on UserError {\n message\n code\n field\n }\n\n";
16
+ export declare const CART_LINES_UPDATE = "\n mutation CartLinesUpdate($cartId: ID!, $lines: [CartLineUpdateInput!]!) {\n cartLinesUpdate(cartId: $cartId, lines: $lines) {\n cart { ...Cart }\n userErrors { ...UserError }\n }\n }\n \n fragment Cart on Cart {\n id\n checkoutUrl\n totalQuantity\n cost { ...CartCost }\n lines(first: 100) { ...CartLine }\n buyerIdentity { ...CartBuyerIdentity }\n discountCodes { ...CartDiscountCode }\n discountAllocations { ...CartDiscountAllocation }\n note\n attributes { key value }\n createdAt\n updatedAt\n }\n \n fragment CartCost on CartCost {\n total { ...PriceMoney }\n subtotal { ...PriceMoney }\n totalTax { ...PriceMoney }\n totalDuty { ...PriceMoney }\n }\n\n \n fragment CartLine on CartLine {\n id\n quantity\n variant { ...ProductVariant }\n cost { ...CartLineCost }\n attributes { key value }\n productId\n productTitle\n productHandle\n productType\n }\n \n fragment CartLineCost on CartLineCost {\n pricePerUnit { ...PriceMoney }\n subtotal { ...PriceMoney }\n total { ...PriceMoney }\n compareAtPricePerUnit { ...PriceMoney }\n }\n\n \n fragment ProductVariant on ProductVariant {\n id\n title\n sku\n price { ...PriceMoney }\n originalPrice { ...Money }\n compareAtPrice { ...PriceMoney }\n originalCompareAtPrice { ...Money }\n available\n quantityAvailable\n image { ...Image }\n selectedOptions { ...SelectedOption }\n barcode\n weight\n position\n }\n \n fragment PriceMoney on PriceMoney {\n ...Price\n baseAmount\n baseCurrencyCode\n exchangeRate\n marginApplied\n rateTimestamp\n isConverted\n }\n \n fragment Price on PriceMoney {\n amount\n currencyCode\n }\n\n\n \n fragment Money on Money {\n amount\n currencyCode\n }\n\n \n fragment Image on Image {\n id\n url(transform: { maxWidth: 300 })\n altText\n width\n height\n thumbhash\n }\n\n \n fragment SelectedOption on SelectedOption {\n name\n value\n }\n\n\n\n \n fragment CartBuyerIdentity on CartBuyerIdentity {\n email\n phone\n countryCode\n }\n\n \n fragment CartDiscountCode on CartDiscountCode {\n code\n applicable\n }\n\n \n fragment CartDiscountAllocation on CartDiscountAllocation {\n discountCode\n amount { ...Money }\n }\n\n\n \n fragment UserError on UserError {\n message\n code\n field\n }\n\n";
17
+ export declare const CART_LINES_REMOVE = "\n mutation CartLinesRemove($cartId: ID!, $lineIds: [ID!]!) {\n cartLinesRemove(cartId: $cartId, lineIds: $lineIds) {\n cart { ...Cart }\n userErrors { ...UserError }\n }\n }\n \n fragment Cart on Cart {\n id\n checkoutUrl\n totalQuantity\n cost { ...CartCost }\n lines(first: 100) { ...CartLine }\n buyerIdentity { ...CartBuyerIdentity }\n discountCodes { ...CartDiscountCode }\n discountAllocations { ...CartDiscountAllocation }\n note\n attributes { key value }\n createdAt\n updatedAt\n }\n \n fragment CartCost on CartCost {\n total { ...PriceMoney }\n subtotal { ...PriceMoney }\n totalTax { ...PriceMoney }\n totalDuty { ...PriceMoney }\n }\n\n \n fragment CartLine on CartLine {\n id\n quantity\n variant { ...ProductVariant }\n cost { ...CartLineCost }\n attributes { key value }\n productId\n productTitle\n productHandle\n productType\n }\n \n fragment CartLineCost on CartLineCost {\n pricePerUnit { ...PriceMoney }\n subtotal { ...PriceMoney }\n total { ...PriceMoney }\n compareAtPricePerUnit { ...PriceMoney }\n }\n\n \n fragment ProductVariant on ProductVariant {\n id\n title\n sku\n price { ...PriceMoney }\n originalPrice { ...Money }\n compareAtPrice { ...PriceMoney }\n originalCompareAtPrice { ...Money }\n available\n quantityAvailable\n image { ...Image }\n selectedOptions { ...SelectedOption }\n barcode\n weight\n position\n }\n \n fragment PriceMoney on PriceMoney {\n ...Price\n baseAmount\n baseCurrencyCode\n exchangeRate\n marginApplied\n rateTimestamp\n isConverted\n }\n \n fragment Price on PriceMoney {\n amount\n currencyCode\n }\n\n\n \n fragment Money on Money {\n amount\n currencyCode\n }\n\n \n fragment Image on Image {\n id\n url(transform: { maxWidth: 300 })\n altText\n width\n height\n thumbhash\n }\n\n \n fragment SelectedOption on SelectedOption {\n name\n value\n }\n\n\n\n \n fragment CartBuyerIdentity on CartBuyerIdentity {\n email\n phone\n countryCode\n }\n\n \n fragment CartDiscountCode on CartDiscountCode {\n code\n applicable\n }\n\n \n fragment CartDiscountAllocation on CartDiscountAllocation {\n discountCode\n amount { ...Money }\n }\n\n\n \n fragment UserError on UserError {\n message\n code\n field\n }\n\n";
18
+ export declare const CART_DISCOUNT_CODES_UPDATE = "\n mutation CartDiscountCodesUpdate($cartId: ID!, $discountCodes: [String!]!) {\n cartDiscountCodesUpdate(cartId: $cartId, discountCodes: $discountCodes) {\n cart { ...Cart }\n userErrors { ...UserError }\n }\n }\n \n fragment Cart on Cart {\n id\n checkoutUrl\n totalQuantity\n cost { ...CartCost }\n lines(first: 100) { ...CartLine }\n buyerIdentity { ...CartBuyerIdentity }\n discountCodes { ...CartDiscountCode }\n discountAllocations { ...CartDiscountAllocation }\n note\n attributes { key value }\n createdAt\n updatedAt\n }\n \n fragment CartCost on CartCost {\n total { ...PriceMoney }\n subtotal { ...PriceMoney }\n totalTax { ...PriceMoney }\n totalDuty { ...PriceMoney }\n }\n\n \n fragment CartLine on CartLine {\n id\n quantity\n variant { ...ProductVariant }\n cost { ...CartLineCost }\n attributes { key value }\n productId\n productTitle\n productHandle\n productType\n }\n \n fragment CartLineCost on CartLineCost {\n pricePerUnit { ...PriceMoney }\n subtotal { ...PriceMoney }\n total { ...PriceMoney }\n compareAtPricePerUnit { ...PriceMoney }\n }\n\n \n fragment ProductVariant on ProductVariant {\n id\n title\n sku\n price { ...PriceMoney }\n originalPrice { ...Money }\n compareAtPrice { ...PriceMoney }\n originalCompareAtPrice { ...Money }\n available\n quantityAvailable\n image { ...Image }\n selectedOptions { ...SelectedOption }\n barcode\n weight\n position\n }\n \n fragment PriceMoney on PriceMoney {\n ...Price\n baseAmount\n baseCurrencyCode\n exchangeRate\n marginApplied\n rateTimestamp\n isConverted\n }\n \n fragment Price on PriceMoney {\n amount\n currencyCode\n }\n\n\n \n fragment Money on Money {\n amount\n currencyCode\n }\n\n \n fragment Image on Image {\n id\n url(transform: { maxWidth: 300 })\n altText\n width\n height\n thumbhash\n }\n\n \n fragment SelectedOption on SelectedOption {\n name\n value\n }\n\n\n\n \n fragment CartBuyerIdentity on CartBuyerIdentity {\n email\n phone\n countryCode\n }\n\n \n fragment CartDiscountCode on CartDiscountCode {\n code\n applicable\n }\n\n \n fragment CartDiscountAllocation on CartDiscountAllocation {\n discountCode\n amount { ...Money }\n }\n\n\n \n fragment UserError on UserError {\n message\n code\n field\n }\n\n";
19
+ export declare const CART_NOTE_UPDATE = "\n mutation CartNoteUpdate($cartId: ID!, $note: String!) {\n cartNoteUpdate(cartId: $cartId, note: $note) {\n cart { ...Cart }\n userErrors { ...UserError }\n }\n }\n \n fragment Cart on Cart {\n id\n checkoutUrl\n totalQuantity\n cost { ...CartCost }\n lines(first: 100) { ...CartLine }\n buyerIdentity { ...CartBuyerIdentity }\n discountCodes { ...CartDiscountCode }\n discountAllocations { ...CartDiscountAllocation }\n note\n attributes { key value }\n createdAt\n updatedAt\n }\n \n fragment CartCost on CartCost {\n total { ...PriceMoney }\n subtotal { ...PriceMoney }\n totalTax { ...PriceMoney }\n totalDuty { ...PriceMoney }\n }\n\n \n fragment CartLine on CartLine {\n id\n quantity\n variant { ...ProductVariant }\n cost { ...CartLineCost }\n attributes { key value }\n productId\n productTitle\n productHandle\n productType\n }\n \n fragment CartLineCost on CartLineCost {\n pricePerUnit { ...PriceMoney }\n subtotal { ...PriceMoney }\n total { ...PriceMoney }\n compareAtPricePerUnit { ...PriceMoney }\n }\n\n \n fragment ProductVariant on ProductVariant {\n id\n title\n sku\n price { ...PriceMoney }\n originalPrice { ...Money }\n compareAtPrice { ...PriceMoney }\n originalCompareAtPrice { ...Money }\n available\n quantityAvailable\n image { ...Image }\n selectedOptions { ...SelectedOption }\n barcode\n weight\n position\n }\n \n fragment PriceMoney on PriceMoney {\n ...Price\n baseAmount\n baseCurrencyCode\n exchangeRate\n marginApplied\n rateTimestamp\n isConverted\n }\n \n fragment Price on PriceMoney {\n amount\n currencyCode\n }\n\n\n \n fragment Money on Money {\n amount\n currencyCode\n }\n\n \n fragment Image on Image {\n id\n url(transform: { maxWidth: 300 })\n altText\n width\n height\n thumbhash\n }\n\n \n fragment SelectedOption on SelectedOption {\n name\n value\n }\n\n\n\n \n fragment CartBuyerIdentity on CartBuyerIdentity {\n email\n phone\n countryCode\n }\n\n \n fragment CartDiscountCode on CartDiscountCode {\n code\n applicable\n }\n\n \n fragment CartDiscountAllocation on CartDiscountAllocation {\n discountCode\n amount { ...Money }\n }\n\n\n \n fragment UserError on UserError {\n message\n code\n field\n }\n\n";
20
+ export declare const CART_BUYER_IDENTITY_UPDATE = "\n mutation CartBuyerIdentityUpdate($cartId: ID!, $buyerIdentity: CartBuyerIdentityInput!) {\n cartBuyerIdentityUpdate(cartId: $cartId, buyerIdentity: $buyerIdentity) {\n cart { ...Cart }\n userErrors { ...UserError }\n }\n }\n \n fragment Cart on Cart {\n id\n checkoutUrl\n totalQuantity\n cost { ...CartCost }\n lines(first: 100) { ...CartLine }\n buyerIdentity { ...CartBuyerIdentity }\n discountCodes { ...CartDiscountCode }\n discountAllocations { ...CartDiscountAllocation }\n note\n attributes { key value }\n createdAt\n updatedAt\n }\n \n fragment CartCost on CartCost {\n total { ...PriceMoney }\n subtotal { ...PriceMoney }\n totalTax { ...PriceMoney }\n totalDuty { ...PriceMoney }\n }\n\n \n fragment CartLine on CartLine {\n id\n quantity\n variant { ...ProductVariant }\n cost { ...CartLineCost }\n attributes { key value }\n productId\n productTitle\n productHandle\n productType\n }\n \n fragment CartLineCost on CartLineCost {\n pricePerUnit { ...PriceMoney }\n subtotal { ...PriceMoney }\n total { ...PriceMoney }\n compareAtPricePerUnit { ...PriceMoney }\n }\n\n \n fragment ProductVariant on ProductVariant {\n id\n title\n sku\n price { ...PriceMoney }\n originalPrice { ...Money }\n compareAtPrice { ...PriceMoney }\n originalCompareAtPrice { ...Money }\n available\n quantityAvailable\n image { ...Image }\n selectedOptions { ...SelectedOption }\n barcode\n weight\n position\n }\n \n fragment PriceMoney on PriceMoney {\n ...Price\n baseAmount\n baseCurrencyCode\n exchangeRate\n marginApplied\n rateTimestamp\n isConverted\n }\n \n fragment Price on PriceMoney {\n amount\n currencyCode\n }\n\n\n \n fragment Money on Money {\n amount\n currencyCode\n }\n\n \n fragment Image on Image {\n id\n url(transform: { maxWidth: 300 })\n altText\n width\n height\n thumbhash\n }\n\n \n fragment SelectedOption on SelectedOption {\n name\n value\n }\n\n\n\n \n fragment CartBuyerIdentity on CartBuyerIdentity {\n email\n phone\n countryCode\n }\n\n \n fragment CartDiscountCode on CartDiscountCode {\n code\n applicable\n }\n\n \n fragment CartDiscountAllocation on CartDiscountAllocation {\n discountCode\n amount { ...Money }\n }\n\n\n \n fragment UserError on UserError {\n message\n code\n field\n }\n\n";
21
21
  //# sourceMappingURL=cart.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"cart.d.ts","sourceRoot":"","sources":["../../../src/core/operations/cart.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAwKH,eAAO,MAAM,UAAU,iwEAOtB,CAAC;AAMF,eAAO,MAAM,WAAW,m6EASvB,CAAC;AAEF,eAAO,MAAM,cAAc,w8EAS1B,CAAC;AAEF,eAAO,MAAM,iBAAiB,o9EAS7B,CAAC;AAEF,eAAO,MAAM,iBAAiB,y8EAS7B,CAAC;AAEF,eAAO,MAAM,0BAA0B,++EAStC,CAAC;AAEF,eAAO,MAAM,gBAAgB,+7EAS5B,CAAC;AAEF,eAAO,MAAM,0BAA0B,4/EAStC,CAAC"}
1
+ {"version":3,"file":"cart.d.ts","sourceRoot":"","sources":["../../../src/core/operations/cart.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAwKH,eAAO,MAAM,UAAU,+sEAOtB,CAAC;AAMF,eAAO,MAAM,WAAW,i3EASvB,CAAC;AAEF,eAAO,MAAM,cAAc,s5EAS1B,CAAC;AAEF,eAAO,MAAM,iBAAiB,k6EAS7B,CAAC;AAEF,eAAO,MAAM,iBAAiB,u5EAS7B,CAAC;AAEF,eAAO,MAAM,0BAA0B,67EAStC,CAAC;AAEF,eAAO,MAAM,gBAAgB,64EAS5B,CAAC;AAEF,eAAO,MAAM,0BAA0B,08EAStC,CAAC"}
@@ -80,25 +80,25 @@ const PRODUCT_VARIANT_FRAGMENT = `
80
80
  `;
81
81
  const CART_COST_FRAGMENT = `
82
82
  fragment CartCost on CartCost {
83
- totalAmount { ...PriceMoney }
84
- subtotalAmount { ...PriceMoney }
85
- totalTaxAmount { ...PriceMoney }
86
- totalDutyAmount { ...PriceMoney }
83
+ total { ...PriceMoney }
84
+ subtotal { ...PriceMoney }
85
+ totalTax { ...PriceMoney }
86
+ totalDuty { ...PriceMoney }
87
87
  }
88
88
  `;
89
89
  const CART_LINE_COST_FRAGMENT = `
90
90
  fragment CartLineCost on CartLineCost {
91
- amountPerQuantity { ...PriceMoney }
92
- subtotalAmount { ...PriceMoney }
93
- totalAmount { ...PriceMoney }
94
- compareAtAmountPerQuantity { ...PriceMoney }
91
+ pricePerUnit { ...PriceMoney }
92
+ subtotal { ...PriceMoney }
93
+ total { ...PriceMoney }
94
+ compareAtPricePerUnit { ...PriceMoney }
95
95
  }
96
96
  `;
97
97
  const CART_LINE_FRAGMENT = `
98
98
  fragment CartLine on CartLine {
99
99
  id
100
100
  quantity
101
- merchandise { ...ProductVariant }
101
+ variant { ...ProductVariant }
102
102
  cost { ...CartLineCost }
103
103
  attributes { key value }
104
104
  productId
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * @doswiftly/storefront-sdk v4.4.0
3
3
  *
4
- * Layered SDK — Hydrogen-aligned architecture.
4
+ * Layered SDK — agnostic core + framework adapter.
5
5
  *
6
6
  * Entry points:
7
7
  * "." → Core (framework-agnostic, 0 deps)
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * @doswiftly/storefront-sdk v4.4.0
3
3
  *
4
- * Layered SDK — Hydrogen-aligned architecture.
4
+ * Layered SDK — agnostic core + framework adapter.
5
5
  *
6
6
  * Entry points:
7
7
  * "." → Core (framework-agnostic, 0 deps)
@@ -1 +1 @@
1
- {"version":3,"file":"use-auth.d.ts","sourceRoot":"","sources":["../../../src/react/hooks/use-auth.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AASH,MAAM,WAAW,cAAc;IAC7B;;;OAGG;IACH,UAAU,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAC9C;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CACpC;AAED,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,OAAO,CAAC;IACjB,UAAU,EAAE,KAAK,CAAC;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,EAAE,CAAA;KAAE,CAAC,CAAC;IACzD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,OAAO,CAAC;IACjB,UAAU,EAAE,KAAK,CAAC;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,EAAE,CAAA;KAAE,CAAC,CAAC;CAC1D;AAED,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,OAAO,CAAC;IACjB,UAAU,EAAE,KAAK,CAAC;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,EAAE,CAAA;KAAE,CAAC,CAAC;IACzD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,wBAAgB,OAAO,CAAC,OAAO,GAAE,cAAmB;mBAUV,MAAM,YAAY,MAAM,KAAG,OAAO,CAAC,WAAW,CAAC;kBA2DlD,OAAO,CAAC,YAAY,CAAC;sBA6BjB,OAAO,CAAC,gBAAgB,CAAC;;;;;;EA8DnE"}
1
+ {"version":3,"file":"use-auth.d.ts","sourceRoot":"","sources":["../../../src/react/hooks/use-auth.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AASH,MAAM,WAAW,cAAc;IAC7B;;;OAGG;IACH,UAAU,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAC9C;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CACpC;AAED,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,OAAO,CAAC;IACjB,UAAU,EAAE,KAAK,CAAC;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,EAAE,CAAA;KAAE,CAAC,CAAC;IACzD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,OAAO,CAAC;IACjB,UAAU,EAAE,KAAK,CAAC;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,EAAE,CAAA;KAAE,CAAC,CAAC;CAC1D;AAED,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,OAAO,CAAC;IACjB,UAAU,EAAE,KAAK,CAAC;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,EAAE,CAAA;KAAE,CAAC,CAAC;IACzD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,wBAAgB,OAAO,CAAC,OAAO,GAAE,cAAmB;mBAUV,MAAM,YAAY,MAAM,KAAG,OAAO,CAAC,WAAW,CAAC;kBA2DlD,OAAO,CAAC,YAAY,CAAC;sBA2BjB,OAAO,CAAC,gBAAgB,CAAC;;;;;;EAwDnE"}
@@ -40,7 +40,7 @@ export function useAuth(options = {}) {
40
40
  }
41
41
  // Fetch customer data and set store
42
42
  try {
43
- const customer = await authClient.getCustomer(result.accessToken);
43
+ const customer = await authClient.getCustomer();
44
44
  if (customer) {
45
45
  setAuth({
46
46
  id: customer.id,
@@ -87,10 +87,8 @@ export function useAuth(options = {}) {
87
87
  setError(null);
88
88
  setIsLoggingOut(true);
89
89
  try {
90
- const token = authStore.getState().accessToken;
91
- if (token) {
92
- await authClient.logout(token);
93
- }
90
+ // Auth context resolved server-side from cookie/Bearer — no token arg needed
91
+ await authClient.logout();
94
92
  // Clear httpOnly cookie
95
93
  if (options.onClearToken) {
96
94
  await options.onClearToken();
@@ -113,14 +111,9 @@ export function useAuth(options = {}) {
113
111
  setError(null);
114
112
  setIsRenewingToken(true);
115
113
  try {
116
- const token = authStore.getState().accessToken;
117
- if (!token) {
118
- return {
119
- success: false,
120
- userErrors: [{ message: 'No token to renew' }],
121
- };
122
- }
123
- const result = await authClient.renewToken(token);
114
+ // Auth context resolved server-side from cookie/Bearer — no token arg needed.
115
+ // If no active session, backend will return 401 and renewToken throws.
116
+ const result = await authClient.renewToken();
124
117
  // Update httpOnly cookie
125
118
  if (options.onSetToken) {
126
119
  await options.onSetToken(result.accessToken);
@@ -30,7 +30,6 @@ export declare const createAuthStore: (initialIsAuthenticated?: boolean) => Omit
30
30
  persist: {
31
31
  setOptions: (options: Partial<import("zustand/middleware").PersistOptions<AuthStore, {
32
32
  customer: CustomerInfo | null;
33
- accessToken: string | null;
34
33
  isAuthenticated: boolean;
35
34
  }, unknown>>) => void;
36
35
  clearStorage: () => void;
@@ -40,7 +39,6 @@ export declare const createAuthStore: (initialIsAuthenticated?: boolean) => Omit
40
39
  onFinishHydration: (fn: (state: AuthStore) => void) => () => void;
41
40
  getOptions: () => Partial<import("zustand/middleware").PersistOptions<AuthStore, {
42
41
  customer: CustomerInfo | null;
43
- accessToken: string | null;
44
42
  isAuthenticated: boolean;
45
43
  }, unknown>>;
46
44
  };
@@ -1 +1 @@
1
- {"version":3,"file":"auth.store.d.ts","sourceRoot":"","sources":["../../../src/react/stores/auth.store.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAKH,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,SAAS;IAExB,QAAQ,EAAE,YAAY,GAAG,IAAI,CAAC;IAC9B,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,eAAe,EAAE,OAAO,CAAC;IACzB,SAAS,EAAE,OAAO,CAAC;IAGnB,OAAO,EAAE,CAAC,QAAQ,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,KAAK,IAAI,CAAC;IAC/D,SAAS,EAAE,MAAM,IAAI,CAAC;IACtB,cAAc,EAAE,CAAC,OAAO,EAAE,OAAO,CAAC,YAAY,CAAC,KAAK,IAAI,CAAC;IACzD,UAAU,EAAE,CAAC,SAAS,EAAE,OAAO,KAAK,IAAI,CAAC;CAC1C;AAED,eAAO,MAAM,eAAe,GAAI,gCAA8B;;;;;sBA+DtC,YAAY,GAAG,IAAI;yBAChB,MAAM,GAAG,IAAI;6BACT,OAAO;;;;;;;;sBAFd,YAAY,GAAG,IAAI;yBAChB,MAAM,GAAG,IAAI;6BACT,OAAO;;;CAWnC,CAAC"}
1
+ {"version":3,"file":"auth.store.d.ts","sourceRoot":"","sources":["../../../src/react/stores/auth.store.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAKH,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,SAAS;IAExB,QAAQ,EAAE,YAAY,GAAG,IAAI,CAAC;IAC9B,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,eAAe,EAAE,OAAO,CAAC;IACzB,SAAS,EAAE,OAAO,CAAC;IAGnB,OAAO,EAAE,CAAC,QAAQ,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,KAAK,IAAI,CAAC;IAC/D,SAAS,EAAE,MAAM,IAAI,CAAC;IACtB,cAAc,EAAE,CAAC,OAAO,EAAE,OAAO,CAAC,YAAY,CAAC,KAAK,IAAI,CAAC;IACzD,UAAU,EAAE,CAAC,SAAS,EAAE,OAAO,KAAK,IAAI,CAAC;CAC1C;AAED,eAAO,MAAM,eAAe,GAAI,gCAA8B;;;;;sBAkEtC,YAAY,GAAG,IAAI;6BACZ,OAAO;;;;;;;;sBADd,YAAY,GAAG,IAAI;6BACZ,OAAO;;;CAUnC,CAAC"}
@@ -32,10 +32,12 @@ export const createAuthStore = (initialIsAuthenticated = false) => createStore()
32
32
  setLoading: (isLoading) => set({ isLoading }),
33
33
  }), {
34
34
  name: 'auth-storage',
35
- version: 2, // Invalidate stale data from old module-level store era
35
+ version: 3, // v3 (Iteracja 2 XSS fix): accessToken DROP'owany z localStorage
36
+ // persistence. Token żyje tylko w-memory + httpOnly cookie (browser auto-sent).
37
+ // Non-browser klienci (mobile native, server-to-server) ustawiają token explicit
38
+ // przez setAuth() — nigdy nie persistowany w localStorage SDK.
36
39
  partialize: (state) => ({
37
40
  customer: state.customer,
38
- accessToken: state.accessToken,
39
41
  isAuthenticated: state.isAuthenticated,
40
42
  }),
41
43
  /**
@@ -51,16 +53,17 @@ export const createAuthStore = (initialIsAuthenticated = false) => createStore()
51
53
  return {
52
54
  ...currentState,
53
55
  customer: persisted.customer ?? currentState.customer,
54
- accessToken: persisted.accessToken ?? currentState.accessToken,
56
+ // accessToken NIE persistowany — initialize zawsze na null (in-memory only)
55
57
  // Server cookie is the authority — never let stale localStorage override it
56
58
  isAuthenticated: currentState.isAuthenticated,
57
59
  };
58
60
  },
59
61
  migrate: (persistedState, version) => {
60
- if (version < 2) {
61
- // Data from old module-level store may be unreliable (Turbopack duplication)
62
- // Clear it user will re-authenticate via cookie or login
63
- return { customer: null, accessToken: null, isAuthenticated: false };
62
+ if (version < 3) {
63
+ // v1→v2: Turbopack duplication cleanup; v2→v3: XSS fix accessToken usunięty
64
+ // z localStorage. Po migracji store start fresh, użytkownik re-auth przez
65
+ // cookie hydration (BFF /api/auth/whoami) lub login flow.
66
+ return { customer: null, isAuthenticated: false };
64
67
  }
65
68
  return persistedState;
66
69
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@doswiftly/storefront-sdk",
3
- "version": "4.7.2",
3
+ "version": "5.0.0",
4
4
  "description": "Storefront runtime SDK for DoSwiftly Commerce — layered transport, middleware pipeline, React providers, Zustand stores, cache strategies. 0 runtime dependencies in core.",
5
5
  "type": "module",
6
6
  "files": [
@@ -35,8 +35,7 @@
35
35
  "graphql",
36
36
  "react",
37
37
  "zustand",
38
- "middleware",
39
- "hydrogen"
38
+ "middleware"
40
39
  ],
41
40
  "author": "DoSwiftly Team",
42
41
  "license": "MIT",