@usethrottle/cart 3.20.1 → 3.22.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/dist/index.cjs CHANGED
@@ -654,8 +654,8 @@ var CartSessionClient = class _CartSessionClient {
654
654
  }
655
655
  /**
656
656
  * Ask the app that prices a resolved cart to re-check every line it owns.
657
- * `changed` is true when a price, name or refusal changed. An unresolved
658
- * cart comes back unchanged. Throws `LineResolverUnavailableError` (nothing
657
+ * `changed` is true when a price, name, refusal or a catalog weight or
658
+ * dimension on a line changed. An unresolved cart comes back unchanged. Throws `LineResolverUnavailableError` (nothing
659
659
  * changed) when the app does not answer.
660
660
  */
661
661
  async refresh() {
package/dist/index.d.cts CHANGED
@@ -49,6 +49,10 @@ interface Cart {
49
49
  shippingTotal: number;
50
50
  /** What a free-shipping code took off shipping, in minor units (0 when none). Original shipping is `shippingTotal + shippingDiscountTotal`. */
51
51
  shippingDiscountTotal?: number;
52
+ /** Order fees in `total`, in minor units (0 when none). Absent from servers that predate fees. */
53
+ feeTotal?: number;
54
+ /** The fee rows behind `feeTotal` a buyer sees: only rows that charge something. Render after shipping, before tax. */
55
+ fees?: CartFee[];
52
56
  total: number;
53
57
  netN: number | null;
54
58
  billingAddress: CartAddress | null;
@@ -87,6 +91,11 @@ interface Cart {
87
91
  * compatibility with `@usethrottle/cart`'s original (order-snapshot-shaped)
88
92
  * cart-session response.
89
93
  */
94
+ /** One order fee as a buyer sees it: a server-built label (`Processing fee (2.5%)`) and its amount in minor units. */
95
+ interface CartFee {
96
+ label: string;
97
+ amount: number;
98
+ }
90
99
  interface CartSessionCart extends Omit<Cart, 'workspaceId'> {
91
100
  cartId: string;
92
101
  /**
@@ -216,6 +225,13 @@ interface LineResolution {
216
225
  code: string | null;
217
226
  maxQuantity: number | null;
218
227
  minQuantity: number | null;
228
+ /**
229
+ * Present only while the line's price is a volume (bulk) tier price:
230
+ * `minQuantity` is the quantity that tier starts at. Absent otherwise.
231
+ */
232
+ bulk?: {
233
+ minQuantity: number;
234
+ };
219
235
  }
220
236
  /**
221
237
  * A line of a resolved cart: the app sets its name, price and image, so the
@@ -582,7 +598,11 @@ interface ShippingTaxCalculationResponse {
582
598
  total: number;
583
599
  /** What a free-shipping code took off shipping; present only on a cart holding one. */
584
600
  shippingDiscountTotal?: number;
601
+ /** Order fees in `total` (0 when none); absent from servers that predate fees. */
602
+ feeTotal?: number;
585
603
  };
604
+ /** The fee rows behind `totals.feeTotal` a buyer sees (amount above 0); absent from servers that predate fees. */
605
+ fees?: CartFee[];
586
606
  /** The cart's free-shipping code and how it stands; absent on a cart holding none. */
587
607
  appliedShippingDiscount?: AppliedShippingDiscount | null;
588
608
  /**
@@ -864,8 +884,8 @@ declare class CartSessionClient {
864
884
  addResolvedItem(input: AddResolvedLineItemInput): Promise<CartSessionCart>;
865
885
  /**
866
886
  * Ask the app that prices a resolved cart to re-check every line it owns.
867
- * `changed` is true when a price, name or refusal changed. An unresolved
868
- * cart comes back unchanged. Throws `LineResolverUnavailableError` (nothing
887
+ * `changed` is true when a price, name, refusal or a catalog weight or
888
+ * dimension on a line changed. An unresolved cart comes back unchanged. Throws `LineResolverUnavailableError` (nothing
869
889
  * changed) when the app does not answer.
870
890
  */
871
891
  refresh(): Promise<CartSessionCart & {
@@ -1222,4 +1242,4 @@ declare function cartErrorFromResponse(args: {
1222
1242
  responseHeaders?: ThrottleErrorArgs['responseHeaders'];
1223
1243
  }): ThrottleApiError;
1224
1244
 
1225
- export { type AddLineItemInput, type AddResolvedLineItemInput, AmountTooLargeError, type AppliedDiscount, type AppliedShippingDiscount, type AppliedShippingDiscountStatus, type Cart, type CartAddress, type CartBranding, CartChangedError, CartClient, type CartErrorArgs, type CartEvent, CartNotFoundError, CartNotOpenError, type CartPricesChangedDetails, CartPricesChangedError, type CartSession, type CartSessionCart, CartSessionClient, type CartSessionClientOptions, type CartSessionSummary, type CartShippingChange, CartTimeoutError, type CheckoutHandoff, type CheckoutHandoffInput, type CheckoutInput, type CreateCartInput, type CreateCartSessionInput, CurrencyLockedError, CurrencyNotAvailableInProductionError, type CurrencyNotEnabledDetails, CurrencyNotEnabledError, CurrencyNotPayableError, CurrencyNotSupportedError, DiscountCurrencyUnsupportedError, type ExternalShippingTaxSnapshotInput, type LegacyLineRecurring, type LineItem, type LineLimitReachedDetails, LineLimitReachedError, type LineNotPurchasableDetails, LineNotPurchasableError, type LineRecurringInput, type LineResolution, type LineResolverNotAvailableDetails, LineResolverNotAvailableError, type LineResolverUnavailableDetails, LineResolverUnavailableError, type Order, type PriceLockedDetails, PriceLockedError, type QuantityUnavailableDetails, QuantityUnavailableError, QuoteAmountsNeedReviewError, type RefusedCartLine, type RemoveDiscountOptions, ResolvedLinesRequiredError, type SelectShippingInput, type SelectShippingMethodInput, type SelectedShipping, ShippingCurrencyUnsupportedError, ShippingMethodUnavailableError, ShippingQuoteUnavailableError, type ShippingTarget, type ShippingTaxAddress, type ShippingTaxCalculationResponse, type ShippingTaxCartCalculateInput, type ShippingTaxMethod, type ShippingTaxQuoteInput, type ShippingTaxQuoteItem, type StoredLineRecurring, StorefrontQuoteClient, type SubscriptionInterval, type SubscriptionIntervalUnit, type TaxLine, type TaxLineInput, ThrottleApiError, type UpdateCartInput, type UpdateCartSessionInput, type UpdateLineItemInput, cartErrorFromResponse };
1245
+ export { type AddLineItemInput, type AddResolvedLineItemInput, AmountTooLargeError, type AppliedDiscount, type AppliedShippingDiscount, type AppliedShippingDiscountStatus, type Cart, type CartAddress, type CartBranding, CartChangedError, CartClient, type CartErrorArgs, type CartEvent, type CartFee, CartNotFoundError, CartNotOpenError, type CartPricesChangedDetails, CartPricesChangedError, type CartSession, type CartSessionCart, CartSessionClient, type CartSessionClientOptions, type CartSessionSummary, type CartShippingChange, CartTimeoutError, type CheckoutHandoff, type CheckoutHandoffInput, type CheckoutInput, type CreateCartInput, type CreateCartSessionInput, CurrencyLockedError, CurrencyNotAvailableInProductionError, type CurrencyNotEnabledDetails, CurrencyNotEnabledError, CurrencyNotPayableError, CurrencyNotSupportedError, DiscountCurrencyUnsupportedError, type ExternalShippingTaxSnapshotInput, type LegacyLineRecurring, type LineItem, type LineLimitReachedDetails, LineLimitReachedError, type LineNotPurchasableDetails, LineNotPurchasableError, type LineRecurringInput, type LineResolution, type LineResolverNotAvailableDetails, LineResolverNotAvailableError, type LineResolverUnavailableDetails, LineResolverUnavailableError, type Order, type PriceLockedDetails, PriceLockedError, type QuantityUnavailableDetails, QuantityUnavailableError, QuoteAmountsNeedReviewError, type RefusedCartLine, type RemoveDiscountOptions, ResolvedLinesRequiredError, type SelectShippingInput, type SelectShippingMethodInput, type SelectedShipping, ShippingCurrencyUnsupportedError, ShippingMethodUnavailableError, ShippingQuoteUnavailableError, type ShippingTarget, type ShippingTaxAddress, type ShippingTaxCalculationResponse, type ShippingTaxCartCalculateInput, type ShippingTaxMethod, type ShippingTaxQuoteInput, type ShippingTaxQuoteItem, type StoredLineRecurring, StorefrontQuoteClient, type SubscriptionInterval, type SubscriptionIntervalUnit, type TaxLine, type TaxLineInput, ThrottleApiError, type UpdateCartInput, type UpdateCartSessionInput, type UpdateLineItemInput, cartErrorFromResponse };
package/dist/index.d.ts CHANGED
@@ -49,6 +49,10 @@ interface Cart {
49
49
  shippingTotal: number;
50
50
  /** What a free-shipping code took off shipping, in minor units (0 when none). Original shipping is `shippingTotal + shippingDiscountTotal`. */
51
51
  shippingDiscountTotal?: number;
52
+ /** Order fees in `total`, in minor units (0 when none). Absent from servers that predate fees. */
53
+ feeTotal?: number;
54
+ /** The fee rows behind `feeTotal` a buyer sees: only rows that charge something. Render after shipping, before tax. */
55
+ fees?: CartFee[];
52
56
  total: number;
53
57
  netN: number | null;
54
58
  billingAddress: CartAddress | null;
@@ -87,6 +91,11 @@ interface Cart {
87
91
  * compatibility with `@usethrottle/cart`'s original (order-snapshot-shaped)
88
92
  * cart-session response.
89
93
  */
94
+ /** One order fee as a buyer sees it: a server-built label (`Processing fee (2.5%)`) and its amount in minor units. */
95
+ interface CartFee {
96
+ label: string;
97
+ amount: number;
98
+ }
90
99
  interface CartSessionCart extends Omit<Cart, 'workspaceId'> {
91
100
  cartId: string;
92
101
  /**
@@ -216,6 +225,13 @@ interface LineResolution {
216
225
  code: string | null;
217
226
  maxQuantity: number | null;
218
227
  minQuantity: number | null;
228
+ /**
229
+ * Present only while the line's price is a volume (bulk) tier price:
230
+ * `minQuantity` is the quantity that tier starts at. Absent otherwise.
231
+ */
232
+ bulk?: {
233
+ minQuantity: number;
234
+ };
219
235
  }
220
236
  /**
221
237
  * A line of a resolved cart: the app sets its name, price and image, so the
@@ -582,7 +598,11 @@ interface ShippingTaxCalculationResponse {
582
598
  total: number;
583
599
  /** What a free-shipping code took off shipping; present only on a cart holding one. */
584
600
  shippingDiscountTotal?: number;
601
+ /** Order fees in `total` (0 when none); absent from servers that predate fees. */
602
+ feeTotal?: number;
585
603
  };
604
+ /** The fee rows behind `totals.feeTotal` a buyer sees (amount above 0); absent from servers that predate fees. */
605
+ fees?: CartFee[];
586
606
  /** The cart's free-shipping code and how it stands; absent on a cart holding none. */
587
607
  appliedShippingDiscount?: AppliedShippingDiscount | null;
588
608
  /**
@@ -864,8 +884,8 @@ declare class CartSessionClient {
864
884
  addResolvedItem(input: AddResolvedLineItemInput): Promise<CartSessionCart>;
865
885
  /**
866
886
  * Ask the app that prices a resolved cart to re-check every line it owns.
867
- * `changed` is true when a price, name or refusal changed. An unresolved
868
- * cart comes back unchanged. Throws `LineResolverUnavailableError` (nothing
887
+ * `changed` is true when a price, name, refusal or a catalog weight or
888
+ * dimension on a line changed. An unresolved cart comes back unchanged. Throws `LineResolverUnavailableError` (nothing
869
889
  * changed) when the app does not answer.
870
890
  */
871
891
  refresh(): Promise<CartSessionCart & {
@@ -1222,4 +1242,4 @@ declare function cartErrorFromResponse(args: {
1222
1242
  responseHeaders?: ThrottleErrorArgs['responseHeaders'];
1223
1243
  }): ThrottleApiError;
1224
1244
 
1225
- export { type AddLineItemInput, type AddResolvedLineItemInput, AmountTooLargeError, type AppliedDiscount, type AppliedShippingDiscount, type AppliedShippingDiscountStatus, type Cart, type CartAddress, type CartBranding, CartChangedError, CartClient, type CartErrorArgs, type CartEvent, CartNotFoundError, CartNotOpenError, type CartPricesChangedDetails, CartPricesChangedError, type CartSession, type CartSessionCart, CartSessionClient, type CartSessionClientOptions, type CartSessionSummary, type CartShippingChange, CartTimeoutError, type CheckoutHandoff, type CheckoutHandoffInput, type CheckoutInput, type CreateCartInput, type CreateCartSessionInput, CurrencyLockedError, CurrencyNotAvailableInProductionError, type CurrencyNotEnabledDetails, CurrencyNotEnabledError, CurrencyNotPayableError, CurrencyNotSupportedError, DiscountCurrencyUnsupportedError, type ExternalShippingTaxSnapshotInput, type LegacyLineRecurring, type LineItem, type LineLimitReachedDetails, LineLimitReachedError, type LineNotPurchasableDetails, LineNotPurchasableError, type LineRecurringInput, type LineResolution, type LineResolverNotAvailableDetails, LineResolverNotAvailableError, type LineResolverUnavailableDetails, LineResolverUnavailableError, type Order, type PriceLockedDetails, PriceLockedError, type QuantityUnavailableDetails, QuantityUnavailableError, QuoteAmountsNeedReviewError, type RefusedCartLine, type RemoveDiscountOptions, ResolvedLinesRequiredError, type SelectShippingInput, type SelectShippingMethodInput, type SelectedShipping, ShippingCurrencyUnsupportedError, ShippingMethodUnavailableError, ShippingQuoteUnavailableError, type ShippingTarget, type ShippingTaxAddress, type ShippingTaxCalculationResponse, type ShippingTaxCartCalculateInput, type ShippingTaxMethod, type ShippingTaxQuoteInput, type ShippingTaxQuoteItem, type StoredLineRecurring, StorefrontQuoteClient, type SubscriptionInterval, type SubscriptionIntervalUnit, type TaxLine, type TaxLineInput, ThrottleApiError, type UpdateCartInput, type UpdateCartSessionInput, type UpdateLineItemInput, cartErrorFromResponse };
1245
+ export { type AddLineItemInput, type AddResolvedLineItemInput, AmountTooLargeError, type AppliedDiscount, type AppliedShippingDiscount, type AppliedShippingDiscountStatus, type Cart, type CartAddress, type CartBranding, CartChangedError, CartClient, type CartErrorArgs, type CartEvent, type CartFee, CartNotFoundError, CartNotOpenError, type CartPricesChangedDetails, CartPricesChangedError, type CartSession, type CartSessionCart, CartSessionClient, type CartSessionClientOptions, type CartSessionSummary, type CartShippingChange, CartTimeoutError, type CheckoutHandoff, type CheckoutHandoffInput, type CheckoutInput, type CreateCartInput, type CreateCartSessionInput, CurrencyLockedError, CurrencyNotAvailableInProductionError, type CurrencyNotEnabledDetails, CurrencyNotEnabledError, CurrencyNotPayableError, CurrencyNotSupportedError, DiscountCurrencyUnsupportedError, type ExternalShippingTaxSnapshotInput, type LegacyLineRecurring, type LineItem, type LineLimitReachedDetails, LineLimitReachedError, type LineNotPurchasableDetails, LineNotPurchasableError, type LineRecurringInput, type LineResolution, type LineResolverNotAvailableDetails, LineResolverNotAvailableError, type LineResolverUnavailableDetails, LineResolverUnavailableError, type Order, type PriceLockedDetails, PriceLockedError, type QuantityUnavailableDetails, QuantityUnavailableError, QuoteAmountsNeedReviewError, type RefusedCartLine, type RemoveDiscountOptions, ResolvedLinesRequiredError, type SelectShippingInput, type SelectShippingMethodInput, type SelectedShipping, ShippingCurrencyUnsupportedError, ShippingMethodUnavailableError, ShippingQuoteUnavailableError, type ShippingTarget, type ShippingTaxAddress, type ShippingTaxCalculationResponse, type ShippingTaxCartCalculateInput, type ShippingTaxMethod, type ShippingTaxQuoteInput, type ShippingTaxQuoteItem, type StoredLineRecurring, StorefrontQuoteClient, type SubscriptionInterval, type SubscriptionIntervalUnit, type TaxLine, type TaxLineInput, ThrottleApiError, type UpdateCartInput, type UpdateCartSessionInput, type UpdateLineItemInput, cartErrorFromResponse };
package/dist/index.js CHANGED
@@ -578,8 +578,8 @@ var CartSessionClient = class _CartSessionClient {
578
578
  }
579
579
  /**
580
580
  * Ask the app that prices a resolved cart to re-check every line it owns.
581
- * `changed` is true when a price, name or refusal changed. An unresolved
582
- * cart comes back unchanged. Throws `LineResolverUnavailableError` (nothing
581
+ * `changed` is true when a price, name, refusal or a catalog weight or
582
+ * dimension on a line changed. An unresolved cart comes back unchanged. Throws `LineResolverUnavailableError` (nothing
583
583
  * changed) when the app does not answer.
584
584
  */
585
585
  async refresh() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@usethrottle/cart",
3
- "version": "3.20.1",
3
+ "version": "3.22.0",
4
4
  "description": "Typed REST client for the Throttle Cart API.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",