@usethrottle/cart 3.14.0 → 3.16.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.d.cts CHANGED
@@ -297,7 +297,8 @@ interface CreateCartInput {
297
297
  }>;
298
298
  }
299
299
  interface UpdateCartInput {
300
- customerId?: string;
300
+ /** Send `null` to detach the customer; omit to keep it. Detaching does not clear `customerEmail`. */
301
+ customerId?: string | null;
301
302
  /** Lightweight email capture; `null` clears a previously-set value. */
302
303
  customerEmail?: string | null;
303
304
  billingAddress?: CartAddress;
@@ -316,12 +317,20 @@ interface AddLineItemInput {
316
317
  taxAmount?: number;
317
318
  discountAmount?: number;
318
319
  /**
319
- * Makes this line a subscription: `type` is forced to `subscription`, and it
320
- * never ships (`requiresShipping: true` is rejected with it). A free-trial
321
- * line is stored with `unitPrice` 0 and your price on `recurring.amount`.
322
- * Terms cannot change later: remove the line and add it again.
320
+ * Makes this line a subscription: `type` is forced to `subscription`. It
321
+ * ships only with `deliveryMethod: 'shipment'` (a physical subscription: a
322
+ * box every cycle, no shipping charge); `requiresShipping: true` is
323
+ * rejected with it. A free-trial line is stored with `unitPrice` 0 and your
324
+ * price on `recurring.amount`. Terms cannot change later: remove the line
325
+ * and add it again.
323
326
  */
324
327
  recurring?: LineRecurringInput;
328
+ /**
329
+ * What the item needs before it counts as delivered. Omit to infer it from
330
+ * `type` and `metadata`. `digital` and `access_grant` deliver themselves on
331
+ * payment; `none` means nothing to deliver.
332
+ */
333
+ deliveryMethod?: 'shipment' | 'digital' | 'access_grant' | 'service' | 'in_person' | 'custom' | 'none';
325
334
  imageUrl?: string;
326
335
  /**
327
336
  * Whether this item is physically shippable. For external/ad-hoc catalogs
package/dist/index.d.ts CHANGED
@@ -297,7 +297,8 @@ interface CreateCartInput {
297
297
  }>;
298
298
  }
299
299
  interface UpdateCartInput {
300
- customerId?: string;
300
+ /** Send `null` to detach the customer; omit to keep it. Detaching does not clear `customerEmail`. */
301
+ customerId?: string | null;
301
302
  /** Lightweight email capture; `null` clears a previously-set value. */
302
303
  customerEmail?: string | null;
303
304
  billingAddress?: CartAddress;
@@ -316,12 +317,20 @@ interface AddLineItemInput {
316
317
  taxAmount?: number;
317
318
  discountAmount?: number;
318
319
  /**
319
- * Makes this line a subscription: `type` is forced to `subscription`, and it
320
- * never ships (`requiresShipping: true` is rejected with it). A free-trial
321
- * line is stored with `unitPrice` 0 and your price on `recurring.amount`.
322
- * Terms cannot change later: remove the line and add it again.
320
+ * Makes this line a subscription: `type` is forced to `subscription`. It
321
+ * ships only with `deliveryMethod: 'shipment'` (a physical subscription: a
322
+ * box every cycle, no shipping charge); `requiresShipping: true` is
323
+ * rejected with it. A free-trial line is stored with `unitPrice` 0 and your
324
+ * price on `recurring.amount`. Terms cannot change later: remove the line
325
+ * and add it again.
323
326
  */
324
327
  recurring?: LineRecurringInput;
328
+ /**
329
+ * What the item needs before it counts as delivered. Omit to infer it from
330
+ * `type` and `metadata`. `digital` and `access_grant` deliver themselves on
331
+ * payment; `none` means nothing to deliver.
332
+ */
333
+ deliveryMethod?: 'shipment' | 'digital' | 'access_grant' | 'service' | 'in_person' | 'custom' | 'none';
325
334
  imageUrl?: string;
326
335
  /**
327
336
  * Whether this item is physically shippable. For external/ad-hoc catalogs
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@usethrottle/cart",
3
- "version": "3.14.0",
3
+ "version": "3.16.0",
4
4
  "description": "Typed REST client for the Throttle Cart API.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -30,7 +30,7 @@
30
30
  },
31
31
  "scripts": {
32
32
  "build": "tsup",
33
- "test": "tsc --noEmit --strict --skipLibCheck --target es2022 --lib es2022,dom --module esnext --moduleResolution bundler __tests__/recurring-types.check.ts && vitest run",
33
+ "test": "tsc --noEmit --strict --skipLibCheck --target es2022 --lib es2022,dom --module esnext --moduleResolution bundler __tests__/recurring-types.check.ts __tests__/cart-customer-detach.check.ts && vitest run",
34
34
  "typecheck": "tsc --noEmit"
35
35
  }
36
36
  }