feat(types, js-sdk): add updateCustomer to js-sdk (#10158)

what:

- adds new `POST /store/cart/:id/customer` endpoint to js sdk
This commit is contained in:
Riqwan Thamir
2024-11-19 19:32:49 +01:00
committed by GitHub
parent 79088c8a3b
commit 495c381709
2 changed files with 33 additions and 1 deletions

View File

@@ -941,6 +941,36 @@ export class Store {
}
)
},
/**
* This method updates the customer of a cart.
*
* @param id - The cart's ID.
* @param body - The data to update in the cart.
* @param query - Configure the fields to retrieve in the cart.
* @param headers - Headers to pass in the request.
* @returns The updated cart.
*
* @example
* sdk.store.cart.transferCart("cart_123")
* .then(({ cart }) => {
* console.log(cart)
* })
*/
transferCart: async (
id: string,
query?: SelectParams,
headers?: ClientHeaders
) => {
return this.client.fetch<HttpTypes.StoreCartResponse>(
`/store/carts/${id}/customer`,
{
method: "POST",
headers,
query,
}
)
},
}
public order = {

View File

@@ -71,6 +71,8 @@ export interface StoreUpdateCart {
promo_codes?: string[]
}
export interface StoreUpdateCartCustomer {}
export interface StoreAddCartLineItem {
/**
* The ID of the product variant to add to the cart.
@@ -104,7 +106,7 @@ export interface StoreAddCartShippingMethods {
option_id: string
/**
* Data useful for the associated fulfillment provider.
*
*
* Learn more in [this documentation](https://docs.medusajs.com/resources/commerce-modules/fulfillment/shipping-option#data-property).
*/
data?: Record<string, unknown>