@doswiftly/storefront-sdk 4.7.1 → 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.
- package/CHANGELOG.md +788 -0
- package/dist/core/auth/auth-client.d.ts +15 -8
- package/dist/core/auth/auth-client.d.ts.map +1 -1
- package/dist/core/auth/auth-client.js +18 -11
- package/dist/core/auth/handlers.d.ts +31 -0
- package/dist/core/auth/handlers.d.ts.map +1 -1
- package/dist/core/auth/handlers.js +69 -0
- package/dist/core/auth/types.d.ts +5 -5
- package/dist/core/auth/types.d.ts.map +1 -1
- package/dist/core/cache.d.ts +1 -1
- package/dist/core/cache.js +1 -1
- package/dist/core/cart/types.d.ts +1 -1
- package/dist/core/cart/types.d.ts.map +1 -1
- package/dist/core/client/compose.d.ts +1 -1
- package/dist/core/client/compose.js +1 -1
- package/dist/core/client/create-client.d.ts +2 -2
- package/dist/core/client/create-client.js +2 -2
- package/dist/core/client/execute.d.ts.map +1 -1
- package/dist/core/client/execute.js +6 -0
- package/dist/core/client/types.js +1 -1
- package/dist/core/index.d.ts +1 -1
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +1 -1
- package/dist/core/language/cookie-config.d.ts +7 -2
- package/dist/core/language/cookie-config.d.ts.map +1 -1
- package/dist/core/language/cookie-config.js +7 -2
- package/dist/core/operations/auth.d.ts +4 -4
- package/dist/core/operations/auth.d.ts.map +1 -1
- package/dist/core/operations/auth.js +11 -11
- package/dist/core/operations/cart.d.ts +8 -8
- package/dist/core/operations/cart.d.ts.map +1 -1
- package/dist/core/operations/cart.js +9 -9
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/react/hooks/use-auth.d.ts.map +1 -1
- package/dist/react/hooks/use-auth.js +6 -13
- package/dist/react/stores/auth.store.d.ts +0 -2
- package/dist/react/stores/auth.store.d.ts.map +1 -1
- package/dist/react/stores/auth.store.js +10 -7
- package/package.json +4 -4
|
@@ -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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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,
|
|
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
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
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
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
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
|
-
|
|
101
|
+
variant { ...ProductVariant }
|
|
102
102
|
cost { ...CartLineCost }
|
|
103
103
|
attributes { key value }
|
|
104
104
|
productId
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -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;
|
|
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(
|
|
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
|
-
|
|
91
|
-
|
|
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
|
-
|
|
117
|
-
|
|
118
|
-
|
|
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;;;;;
|
|
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:
|
|
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
|
-
|
|
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 <
|
|
61
|
-
//
|
|
62
|
-
//
|
|
63
|
-
|
|
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,11 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@doswiftly/storefront-sdk",
|
|
3
|
-
"version": "
|
|
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": [
|
|
7
7
|
"dist",
|
|
8
|
-
"README.md"
|
|
8
|
+
"README.md",
|
|
9
|
+
"CHANGELOG.md"
|
|
9
10
|
],
|
|
10
11
|
"types": "dist/core/index.d.ts",
|
|
11
12
|
"exports": {
|
|
@@ -34,8 +35,7 @@
|
|
|
34
35
|
"graphql",
|
|
35
36
|
"react",
|
|
36
37
|
"zustand",
|
|
37
|
-
"middleware"
|
|
38
|
-
"hydrogen"
|
|
38
|
+
"middleware"
|
|
39
39
|
],
|
|
40
40
|
"author": "DoSwiftly Team",
|
|
41
41
|
"license": "MIT",
|