@usethrottle/cart 3.13.0 → 3.15.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/README.md CHANGED
@@ -366,8 +366,10 @@ await client.items.add(cart.id, {
366
366
  to 1 year.
367
367
  - `totalPayments` (2–60) makes an installment plan; `trialDays` (0–365) a free
368
368
  trial. They cannot be combined (`400 invalid_combination`).
369
- - `type` is forced to `subscription`, and the line never ships:
370
- `requiresShipping: true` is rejected with `400 validation_error`.
369
+ - `type` is forced to `subscription`, and the line is never charged shipping.
370
+ It ships only with `deliveryMethod: 'shipment'`, which makes a physical
371
+ subscription: every renewal order owes a box. `requiresShipping: true` is
372
+ rejected with `400 validation_error`.
371
373
  - A free-trial line is stored with `unitPrice: 0` and your price on
372
374
  `recurring.amount`, and its name gets a "— 14-day free trial" suffix.
373
375
  - `PATCH` may change `quantity` (seats) and `metadata` only. Changing
package/dist/index.cjs CHANGED
@@ -29,6 +29,7 @@ __export(index_exports, {
29
29
  CartSessionClient: () => CartSessionClient,
30
30
  CartTimeoutError: () => CartTimeoutError,
31
31
  CurrencyNotEnabledError: () => CurrencyNotEnabledError,
32
+ DiscountCurrencyUnsupportedError: () => DiscountCurrencyUnsupportedError,
32
33
  LineLimitReachedError: () => LineLimitReachedError,
33
34
  LineNotPurchasableError: () => LineNotPurchasableError,
34
35
  LineResolverNotAvailableError: () => LineResolverNotAvailableError,
@@ -36,6 +37,7 @@ __export(index_exports, {
36
37
  PriceLockedError: () => PriceLockedError,
37
38
  QuantityUnavailableError: () => QuantityUnavailableError,
38
39
  ResolvedLinesRequiredError: () => ResolvedLinesRequiredError,
40
+ ShippingCurrencyUnsupportedError: () => ShippingCurrencyUnsupportedError,
39
41
  ShippingMethodUnavailableError: () => ShippingMethodUnavailableError,
40
42
  ShippingQuoteUnavailableError: () => ShippingQuoteUnavailableError,
41
43
  StorefrontQuoteClient: () => StorefrontQuoteClient,
@@ -199,6 +201,21 @@ var CartChangedError = class extends ThrottleApiError {
199
201
  this.name = "CartChangedError";
200
202
  }
201
203
  };
204
+ var DiscountCurrencyUnsupportedError = class extends ThrottleApiError {
205
+ constructor(args) {
206
+ super(coded("discount_currency_unsupported", 422, args));
207
+ this.name = "DiscountCurrencyUnsupportedError";
208
+ }
209
+ };
210
+ var ShippingCurrencyUnsupportedError = class extends ThrottleApiError {
211
+ shipping;
212
+ constructor(args) {
213
+ super(coded("shipping_currency_unsupported", 422, args));
214
+ this.name = "ShippingCurrencyUnsupportedError";
215
+ const d = args.details;
216
+ this.shipping = d?.shipping && typeof d.shipping === "object" ? d.shipping : null;
217
+ }
218
+ };
202
219
  var RESOLVED_CART_ERRORS = {
203
220
  price_locked: PriceLockedError,
204
221
  quantity_unavailable: QuantityUnavailableError,
@@ -212,7 +229,9 @@ var RESOLVED_CART_ERRORS = {
212
229
  shipping_method_unavailable: ShippingMethodUnavailableError,
213
230
  shipping_quote_unavailable: ShippingQuoteUnavailableError,
214
231
  amount_too_large: AmountTooLargeError,
215
- cart_changed: CartChangedError
232
+ cart_changed: CartChangedError,
233
+ discount_currency_unsupported: DiscountCurrencyUnsupportedError,
234
+ shipping_currency_unsupported: ShippingCurrencyUnsupportedError
216
235
  };
217
236
  function cartErrorFromResponse(args) {
218
237
  if (args.statusCode === 409 && args.code === "cart_not_open") {
@@ -627,6 +646,7 @@ var CartSessionClient = class _CartSessionClient {
627
646
  CartSessionClient,
628
647
  CartTimeoutError,
629
648
  CurrencyNotEnabledError,
649
+ DiscountCurrencyUnsupportedError,
630
650
  LineLimitReachedError,
631
651
  LineNotPurchasableError,
632
652
  LineResolverNotAvailableError,
@@ -634,6 +654,7 @@ var CartSessionClient = class _CartSessionClient {
634
654
  PriceLockedError,
635
655
  QuantityUnavailableError,
636
656
  ResolvedLinesRequiredError,
657
+ ShippingCurrencyUnsupportedError,
637
658
  ShippingMethodUnavailableError,
638
659
  ShippingQuoteUnavailableError,
639
660
  StorefrontQuoteClient,
package/dist/index.d.cts CHANGED
@@ -279,7 +279,8 @@ interface CreateCartInput {
279
279
  /**
280
280
  * Make this a resolved cart: the installed app with this extension id
281
281
  * prices its lines (add them with `items.addResolvedItem()`). Requires
282
- * `currency`, which must be the environment's currency.
282
+ * `currency`: the environment's currency or one of its extra cart
283
+ * currencies (`cartCurrencies`).
283
284
  */
284
285
  lineResolver?: {
285
286
  extensionId: string;
@@ -315,12 +316,20 @@ interface AddLineItemInput {
315
316
  taxAmount?: number;
316
317
  discountAmount?: number;
317
318
  /**
318
- * Makes this line a subscription: `type` is forced to `subscription`, and it
319
- * never ships (`requiresShipping: true` is rejected with it). A free-trial
320
- * line is stored with `unitPrice` 0 and your price on `recurring.amount`.
321
- * Terms cannot change later: remove the line and add it again.
319
+ * Makes this line a subscription: `type` is forced to `subscription`. It
320
+ * ships only with `deliveryMethod: 'shipment'` (a physical subscription: a
321
+ * box every cycle, no shipping charge); `requiresShipping: true` is
322
+ * rejected with it. A free-trial line is stored with `unitPrice` 0 and your
323
+ * price on `recurring.amount`. Terms cannot change later: remove the line
324
+ * and add it again.
322
325
  */
323
326
  recurring?: LineRecurringInput;
327
+ /**
328
+ * What the item needs before it counts as delivered. Omit to infer it from
329
+ * `type` and `metadata`. `digital` and `access_grant` deliver themselves on
330
+ * payment; `none` means nothing to deliver.
331
+ */
332
+ deliveryMethod?: 'shipment' | 'digital' | 'access_grant' | 'service' | 'in_person' | 'custom' | 'none';
324
333
  imageUrl?: string;
325
334
  /**
326
335
  * Whether this item is physically shippable. For external/ad-hoc catalogs
@@ -651,7 +660,8 @@ interface CreateCartSessionInput {
651
660
  /**
652
661
  * Make this a resolved cart: the installed app with this extension id
653
662
  * prices its lines (add them with `addResolvedItem()`). Requires
654
- * `currency`, which must be the environment's currency.
663
+ * `currency`: the environment's currency or one of its extra cart
664
+ * currencies (`cartCurrencies`).
655
665
  */
656
666
  lineResolver?: {
657
667
  extensionId: string;
@@ -973,7 +983,10 @@ type CurrencyNotEnabledDetails = {
973
983
  currency: string;
974
984
  enabledCurrencies: string[];
975
985
  };
976
- /** `422 currency_not_enabled`: a resolved cart must use the environment's currency. */
986
+ /**
987
+ * `422 currency_not_enabled`: a resolved cart must use the environment's
988
+ * currency or one of its extra cart currencies (`enabledCurrencies` lists them).
989
+ */
977
990
  declare class CurrencyNotEnabledError extends ThrottleApiError {
978
991
  readonly details?: CurrencyNotEnabledDetails;
979
992
  constructor(args: CartErrorArgs);
@@ -997,14 +1010,16 @@ declare class LineLimitReachedError extends ThrottleApiError {
997
1010
  /**
998
1011
  * The stored shipping selection after the checkout hand-off re-quoted it.
999
1012
  * `amount` is the new quote, or null with a `reason`: `method_unavailable`
1000
- * (no longer offered, so cleared) or `quote_unavailable` (could not be
1001
- * quoted now; kept for the next hand-off).
1013
+ * (no longer offered, so cleared), `quote_unavailable` (could not be
1014
+ * quoted now; kept for the next hand-off) or `shipping_currency_unsupported`
1015
+ * (on a cart in an extra currency, its rate is a non-zero amount in another
1016
+ * currency; kept, and the buyer must choose another method).
1002
1017
  */
1003
1018
  type CartShippingChange = {
1004
1019
  methodId: string;
1005
1020
  previousAmount: number;
1006
1021
  amount: number | null;
1007
- reason?: 'method_unavailable' | 'quote_unavailable';
1022
+ reason?: 'method_unavailable' | 'quote_unavailable' | 'shipping_currency_unsupported';
1008
1023
  };
1009
1024
  /** `details` of `409 cart_prices_changed`. */
1010
1025
  type CartPricesChangedDetails = {
@@ -1041,6 +1056,27 @@ declare class AmountTooLargeError extends ThrottleApiError {
1041
1056
  declare class CartChangedError extends ThrottleApiError {
1042
1057
  constructor(args: CartErrorArgs);
1043
1058
  }
1059
+ /**
1060
+ * `422 discount_currency_unsupported`: a fixed-amount discount can't be used
1061
+ * on a resolved cart in an extra currency. Nothing is applied; a percentage
1062
+ * discount works.
1063
+ */
1064
+ declare class DiscountCurrencyUnsupportedError extends ThrottleApiError {
1065
+ constructor(args: CartErrorArgs);
1066
+ }
1067
+ /**
1068
+ * `422 shipping_currency_unsupported`: on a resolved cart in an extra
1069
+ * currency, a non-zero shipping rate in another currency. Nothing new is
1070
+ * selected; choose a zero-rate method. At the checkout hand-off, `shipping`
1071
+ * is the kept selection.
1072
+ */
1073
+ declare class ShippingCurrencyUnsupportedError extends ThrottleApiError {
1074
+ readonly details?: {
1075
+ shipping?: CartShippingChange;
1076
+ };
1077
+ readonly shipping: CartShippingChange | null;
1078
+ constructor(args: CartErrorArgs);
1079
+ }
1044
1080
  /**
1045
1081
  * Map a raw API error envelope to the most specific Cart SDK error class.
1046
1082
  * Falls back to {@link ThrottleApiError} for everything unrecognised.
@@ -1053,4 +1089,4 @@ declare function cartErrorFromResponse(args: {
1053
1089
  responseHeaders?: ThrottleErrorArgs['responseHeaders'];
1054
1090
  }): ThrottleApiError;
1055
1091
 
1056
- export { type AddLineItemInput, type AddResolvedLineItemInput, AmountTooLargeError, type AppliedDiscount, 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, type CurrencyNotEnabledDetails, CurrencyNotEnabledError, 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, type RefusedCartLine, ResolvedLinesRequiredError, type SelectShippingInput, type SelectShippingMethodInput, type SelectedShipping, ShippingMethodUnavailableError, ShippingQuoteUnavailableError, 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 };
1092
+ export { type AddLineItemInput, type AddResolvedLineItemInput, AmountTooLargeError, type AppliedDiscount, 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, type CurrencyNotEnabledDetails, CurrencyNotEnabledError, 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, type RefusedCartLine, ResolvedLinesRequiredError, type SelectShippingInput, type SelectShippingMethodInput, type SelectedShipping, ShippingCurrencyUnsupportedError, ShippingMethodUnavailableError, ShippingQuoteUnavailableError, 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
@@ -279,7 +279,8 @@ interface CreateCartInput {
279
279
  /**
280
280
  * Make this a resolved cart: the installed app with this extension id
281
281
  * prices its lines (add them with `items.addResolvedItem()`). Requires
282
- * `currency`, which must be the environment's currency.
282
+ * `currency`: the environment's currency or one of its extra cart
283
+ * currencies (`cartCurrencies`).
283
284
  */
284
285
  lineResolver?: {
285
286
  extensionId: string;
@@ -315,12 +316,20 @@ interface AddLineItemInput {
315
316
  taxAmount?: number;
316
317
  discountAmount?: number;
317
318
  /**
318
- * Makes this line a subscription: `type` is forced to `subscription`, and it
319
- * never ships (`requiresShipping: true` is rejected with it). A free-trial
320
- * line is stored with `unitPrice` 0 and your price on `recurring.amount`.
321
- * Terms cannot change later: remove the line and add it again.
319
+ * Makes this line a subscription: `type` is forced to `subscription`. It
320
+ * ships only with `deliveryMethod: 'shipment'` (a physical subscription: a
321
+ * box every cycle, no shipping charge); `requiresShipping: true` is
322
+ * rejected with it. A free-trial line is stored with `unitPrice` 0 and your
323
+ * price on `recurring.amount`. Terms cannot change later: remove the line
324
+ * and add it again.
322
325
  */
323
326
  recurring?: LineRecurringInput;
327
+ /**
328
+ * What the item needs before it counts as delivered. Omit to infer it from
329
+ * `type` and `metadata`. `digital` and `access_grant` deliver themselves on
330
+ * payment; `none` means nothing to deliver.
331
+ */
332
+ deliveryMethod?: 'shipment' | 'digital' | 'access_grant' | 'service' | 'in_person' | 'custom' | 'none';
324
333
  imageUrl?: string;
325
334
  /**
326
335
  * Whether this item is physically shippable. For external/ad-hoc catalogs
@@ -651,7 +660,8 @@ interface CreateCartSessionInput {
651
660
  /**
652
661
  * Make this a resolved cart: the installed app with this extension id
653
662
  * prices its lines (add them with `addResolvedItem()`). Requires
654
- * `currency`, which must be the environment's currency.
663
+ * `currency`: the environment's currency or one of its extra cart
664
+ * currencies (`cartCurrencies`).
655
665
  */
656
666
  lineResolver?: {
657
667
  extensionId: string;
@@ -973,7 +983,10 @@ type CurrencyNotEnabledDetails = {
973
983
  currency: string;
974
984
  enabledCurrencies: string[];
975
985
  };
976
- /** `422 currency_not_enabled`: a resolved cart must use the environment's currency. */
986
+ /**
987
+ * `422 currency_not_enabled`: a resolved cart must use the environment's
988
+ * currency or one of its extra cart currencies (`enabledCurrencies` lists them).
989
+ */
977
990
  declare class CurrencyNotEnabledError extends ThrottleApiError {
978
991
  readonly details?: CurrencyNotEnabledDetails;
979
992
  constructor(args: CartErrorArgs);
@@ -997,14 +1010,16 @@ declare class LineLimitReachedError extends ThrottleApiError {
997
1010
  /**
998
1011
  * The stored shipping selection after the checkout hand-off re-quoted it.
999
1012
  * `amount` is the new quote, or null with a `reason`: `method_unavailable`
1000
- * (no longer offered, so cleared) or `quote_unavailable` (could not be
1001
- * quoted now; kept for the next hand-off).
1013
+ * (no longer offered, so cleared), `quote_unavailable` (could not be
1014
+ * quoted now; kept for the next hand-off) or `shipping_currency_unsupported`
1015
+ * (on a cart in an extra currency, its rate is a non-zero amount in another
1016
+ * currency; kept, and the buyer must choose another method).
1002
1017
  */
1003
1018
  type CartShippingChange = {
1004
1019
  methodId: string;
1005
1020
  previousAmount: number;
1006
1021
  amount: number | null;
1007
- reason?: 'method_unavailable' | 'quote_unavailable';
1022
+ reason?: 'method_unavailable' | 'quote_unavailable' | 'shipping_currency_unsupported';
1008
1023
  };
1009
1024
  /** `details` of `409 cart_prices_changed`. */
1010
1025
  type CartPricesChangedDetails = {
@@ -1041,6 +1056,27 @@ declare class AmountTooLargeError extends ThrottleApiError {
1041
1056
  declare class CartChangedError extends ThrottleApiError {
1042
1057
  constructor(args: CartErrorArgs);
1043
1058
  }
1059
+ /**
1060
+ * `422 discount_currency_unsupported`: a fixed-amount discount can't be used
1061
+ * on a resolved cart in an extra currency. Nothing is applied; a percentage
1062
+ * discount works.
1063
+ */
1064
+ declare class DiscountCurrencyUnsupportedError extends ThrottleApiError {
1065
+ constructor(args: CartErrorArgs);
1066
+ }
1067
+ /**
1068
+ * `422 shipping_currency_unsupported`: on a resolved cart in an extra
1069
+ * currency, a non-zero shipping rate in another currency. Nothing new is
1070
+ * selected; choose a zero-rate method. At the checkout hand-off, `shipping`
1071
+ * is the kept selection.
1072
+ */
1073
+ declare class ShippingCurrencyUnsupportedError extends ThrottleApiError {
1074
+ readonly details?: {
1075
+ shipping?: CartShippingChange;
1076
+ };
1077
+ readonly shipping: CartShippingChange | null;
1078
+ constructor(args: CartErrorArgs);
1079
+ }
1044
1080
  /**
1045
1081
  * Map a raw API error envelope to the most specific Cart SDK error class.
1046
1082
  * Falls back to {@link ThrottleApiError} for everything unrecognised.
@@ -1053,4 +1089,4 @@ declare function cartErrorFromResponse(args: {
1053
1089
  responseHeaders?: ThrottleErrorArgs['responseHeaders'];
1054
1090
  }): ThrottleApiError;
1055
1091
 
1056
- export { type AddLineItemInput, type AddResolvedLineItemInput, AmountTooLargeError, type AppliedDiscount, 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, type CurrencyNotEnabledDetails, CurrencyNotEnabledError, 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, type RefusedCartLine, ResolvedLinesRequiredError, type SelectShippingInput, type SelectShippingMethodInput, type SelectedShipping, ShippingMethodUnavailableError, ShippingQuoteUnavailableError, 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 };
1092
+ export { type AddLineItemInput, type AddResolvedLineItemInput, AmountTooLargeError, type AppliedDiscount, 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, type CurrencyNotEnabledDetails, CurrencyNotEnabledError, 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, type RefusedCartLine, ResolvedLinesRequiredError, type SelectShippingInput, type SelectShippingMethodInput, type SelectedShipping, ShippingCurrencyUnsupportedError, ShippingMethodUnavailableError, ShippingQuoteUnavailableError, 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
@@ -151,6 +151,21 @@ var CartChangedError = class extends ThrottleApiError {
151
151
  this.name = "CartChangedError";
152
152
  }
153
153
  };
154
+ var DiscountCurrencyUnsupportedError = class extends ThrottleApiError {
155
+ constructor(args) {
156
+ super(coded("discount_currency_unsupported", 422, args));
157
+ this.name = "DiscountCurrencyUnsupportedError";
158
+ }
159
+ };
160
+ var ShippingCurrencyUnsupportedError = class extends ThrottleApiError {
161
+ shipping;
162
+ constructor(args) {
163
+ super(coded("shipping_currency_unsupported", 422, args));
164
+ this.name = "ShippingCurrencyUnsupportedError";
165
+ const d = args.details;
166
+ this.shipping = d?.shipping && typeof d.shipping === "object" ? d.shipping : null;
167
+ }
168
+ };
154
169
  var RESOLVED_CART_ERRORS = {
155
170
  price_locked: PriceLockedError,
156
171
  quantity_unavailable: QuantityUnavailableError,
@@ -164,7 +179,9 @@ var RESOLVED_CART_ERRORS = {
164
179
  shipping_method_unavailable: ShippingMethodUnavailableError,
165
180
  shipping_quote_unavailable: ShippingQuoteUnavailableError,
166
181
  amount_too_large: AmountTooLargeError,
167
- cart_changed: CartChangedError
182
+ cart_changed: CartChangedError,
183
+ discount_currency_unsupported: DiscountCurrencyUnsupportedError,
184
+ shipping_currency_unsupported: ShippingCurrencyUnsupportedError
168
185
  };
169
186
  function cartErrorFromResponse(args) {
170
187
  if (args.statusCode === 409 && args.code === "cart_not_open") {
@@ -578,6 +595,7 @@ export {
578
595
  CartSessionClient,
579
596
  CartTimeoutError,
580
597
  CurrencyNotEnabledError,
598
+ DiscountCurrencyUnsupportedError,
581
599
  LineLimitReachedError,
582
600
  LineNotPurchasableError,
583
601
  LineResolverNotAvailableError,
@@ -585,6 +603,7 @@ export {
585
603
  PriceLockedError,
586
604
  QuantityUnavailableError,
587
605
  ResolvedLinesRequiredError,
606
+ ShippingCurrencyUnsupportedError,
588
607
  ShippingMethodUnavailableError,
589
608
  ShippingQuoteUnavailableError,
590
609
  StorefrontQuoteClient,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@usethrottle/cart",
3
- "version": "3.13.0",
3
+ "version": "3.15.0",
4
4
  "description": "Typed REST client for the Throttle Cart API.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",