fix(types, medusa): http types fixes (#9334)
* fix(types, medusa): http types fixes * fix build error * remove return fields * more fixes * fix cart payload types
This commit is contained in:
1 parent
8686ca9d12
commit
7bc7c50eef
22 files changed
+141
-54
No files matched your search
@@ -6,6 +6,10 @@ import {
|
||||
BaseCartAddress,
|
||||
BaseCartLineItem,
|
||||
BaseCartShippingMethod,
|
||||
BaseLineItemAdjustment,
|
||||
BaseLineItemTaxLine,
|
||||
BaseShippingMethodAdjustment,
|
||||
BaseShippingMethodTaxLine,
|
||||
} from "../common"
|
||||
|
||||
export interface StoreCart extends Omit<BaseCart, "items"> {
|
||||
@@ -20,6 +24,19 @@ export interface StoreCartLineItem extends Omit<BaseCartLineItem, "product" | "v
|
||||
product?: StoreProduct
|
||||
variant?: StoreProductVariant
|
||||
cart: StoreCart
|
||||
tax_lines?: (BaseLineItemTaxLine & {
|
||||
item: StoreCartLineItem
|
||||
})[]
|
||||
adjustments?: (BaseLineItemAdjustment & {
|
||||
item: StoreCartLineItem
|
||||
})[]
|
||||
}
|
||||
export interface StoreCartAddress extends BaseCartAddress {}
|
||||
export interface StoreCartShippingMethod extends BaseCartShippingMethod {}
|
||||
export interface StoreCartShippingMethod extends BaseCartShippingMethod {
|
||||
tax_lines?: (BaseShippingMethodTaxLine & {
|
||||
shipping_method: StoreCartShippingMethod
|
||||
})[]
|
||||
adjustments?: (BaseShippingMethodAdjustment & {
|
||||
shipping_method: StoreCartShippingMethod
|
||||
})[]
|
||||
}
|
||||
@@ -1,20 +1,18 @@
|
||||
import { StoreCartAddress, StoreCartLineItem } from "./entities"
|
||||
|
||||
export interface StoreCreateCart {
|
||||
region_id?: string
|
||||
shipping_address?: StoreCartAddress
|
||||
billing_address?: StoreCartAddress
|
||||
shipping_address?: StoreAddAddress
|
||||
billing_address?: StoreAddAddress
|
||||
email?: string
|
||||
currency_code?: string
|
||||
items?: StoreCartLineItem[]
|
||||
items?: StoreAddCartLineItem[]
|
||||
sales_channel_id?: string
|
||||
metadata?: Record<string, unknown>
|
||||
}
|
||||
|
||||
export interface StoreUpdateCart {
|
||||
region_id?: string
|
||||
shipping_address?: StoreCartAddress
|
||||
billing_address?: StoreCartAddress
|
||||
shipping_address?: StoreAddAddress | string
|
||||
billing_address?: StoreAddAddress | string
|
||||
email?: string
|
||||
sales_channel_id?: string
|
||||
metadata?: Record<string, unknown>
|
||||
@@ -40,3 +38,60 @@ export interface StoreAddCartShippingMethods {
|
||||
export interface StoreCompleteCart {
|
||||
idempotency_key?: string
|
||||
}
|
||||
|
||||
export interface StoreAddAddress {
|
||||
/**
|
||||
* The first name of the address.
|
||||
*/
|
||||
first_name?: string
|
||||
|
||||
/**
|
||||
* The last name of the address.
|
||||
*/
|
||||
last_name?: string
|
||||
|
||||
/**
|
||||
* The phone number of the address.
|
||||
*/
|
||||
phone?: string
|
||||
|
||||
/**
|
||||
* The company of the address.
|
||||
*/
|
||||
company?: string
|
||||
|
||||
/**
|
||||
* The first address line of the address.
|
||||
*/
|
||||
address_1?: string
|
||||
|
||||
/**
|
||||
* The second address line of the address.
|
||||
*/
|
||||
address_2?: string
|
||||
|
||||
/**
|
||||
* The city of the address.
|
||||
*/
|
||||
city?: string
|
||||
|
||||
/**
|
||||
* The country code of the address.
|
||||
*/
|
||||
country_code?: string
|
||||
|
||||
/**
|
||||
* The province/state of the address.
|
||||
*/
|
||||
province?: string
|
||||
|
||||
/**
|
||||
* The postal code of the address.
|
||||
*/
|
||||
postal_code?: string
|
||||
|
||||
/**
|
||||
* Holds custom data in key-value pairs.
|
||||
*/
|
||||
metadata?: Record<string, unknown> | null
|
||||
}
|
||||
@@ -1,3 +1,6 @@
|
||||
import { StoreProduct } from "../../product"
|
||||
import { BaseCollection } from "../common"
|
||||
|
||||
export interface StoreCollection extends BaseCollection {}
|
||||
export interface StoreCollection extends Omit<BaseCollection, "products"> {
|
||||
products?: StoreProduct[]
|
||||
}
|
||||
@@ -1,3 +1,6 @@
|
||||
import { AdminCustomer } from "../../customer/admin"
|
||||
import { BaseCustomerGroup } from "../common"
|
||||
|
||||
export interface AdminCustomerGroup extends BaseCustomerGroup {}
|
||||
export interface AdminCustomerGroup extends BaseCustomerGroup {
|
||||
customers: AdminCustomer[]
|
||||
}
|
||||
@@ -4,5 +4,6 @@ import { BaseCustomer, BaseCustomerAddress } from "../common"
|
||||
export interface AdminCustomer extends BaseCustomer {
|
||||
has_account: boolean
|
||||
groups?: AdminCustomerGroup[]
|
||||
addresses: AdminCustomerAddress[]
|
||||
}
|
||||
export interface AdminCustomerAddress extends BaseCustomerAddress {}
|
||||
@@ -3,5 +3,7 @@ import {
|
||||
BaseCustomerAddress,
|
||||
} from "../common"
|
||||
|
||||
export interface StoreCustomer extends BaseCustomer {}
|
||||
export interface StoreCustomer extends Omit<BaseCustomer, "created_by"> {
|
||||
addresses: StoreCustomerAddress[]
|
||||
}
|
||||
export interface StoreCustomerAddress extends BaseCustomerAddress {}
|
||||
@@ -22,5 +22,5 @@ export interface AdminDraftOrderResponse {
|
||||
}
|
||||
|
||||
export type AdminDraftOrderListResponse = PaginatedResponse<{
|
||||
draft_orders: AdminOrder
|
||||
draft_orders: AdminOrder[]
|
||||
}>
|
||||
@@ -6,11 +6,17 @@ import {
|
||||
BaseOrder,
|
||||
BaseOrderAddress,
|
||||
BaseOrderFulfillment,
|
||||
BaseOrderItemDetail,
|
||||
BaseOrderLineItem,
|
||||
BaseOrderLineItemAdjustment,
|
||||
BaseOrderLineItemTaxLine,
|
||||
BaseOrderShippingDetail,
|
||||
BaseOrderShippingMethod,
|
||||
BaseOrderShippingMethodAdjustment,
|
||||
BaseOrderShippingMethodTaxLine,
|
||||
} from "../common"
|
||||
|
||||
export interface StoreOrder extends Omit<BaseOrder, "items"> {
|
||||
export interface StoreOrder extends Omit<BaseOrder, "items" | "version" | "transations"> {
|
||||
shipping_address?: StoreOrderAddress | null
|
||||
billing_address?: StoreOrderAddress | null
|
||||
items: StoreOrderLineItem[] | null
|
||||
@@ -22,9 +28,28 @@ export interface StoreOrder extends Omit<BaseOrder, "items"> {
|
||||
export interface StoreOrderLineItem extends Omit<BaseOrderLineItem, "product" | "variant"> {
|
||||
variant?: StoreProductVariant
|
||||
product?: StoreProduct
|
||||
tax_lines?: (BaseOrderLineItemTaxLine & {
|
||||
item: StoreOrderLineItem
|
||||
})[]
|
||||
adjustments?: (BaseOrderLineItemAdjustment & {
|
||||
item: StoreOrderLineItem
|
||||
})[]
|
||||
detail: BaseOrderItemDetail & {
|
||||
item: StoreOrderLineItem
|
||||
}
|
||||
}
|
||||
export interface StoreOrderAddress extends BaseOrderAddress {
|
||||
country?: StoreRegionCountry
|
||||
}
|
||||
export interface StoreOrderShippingMethod extends BaseOrderShippingMethod {}
|
||||
export interface StoreOrderShippingMethod extends BaseOrderShippingMethod {
|
||||
tax_lines?: (BaseOrderShippingMethodTaxLine & {
|
||||
shipping_method: StoreOrderShippingMethod
|
||||
})[]
|
||||
adjustments?: (BaseOrderShippingMethodAdjustment & {
|
||||
shipping_method: StoreOrderShippingMethod
|
||||
})[]
|
||||
detail?: BaseOrderShippingDetail & {
|
||||
shipping_method: StoreOrderShippingMethod
|
||||
}
|
||||
}
|
||||
export interface StoreOrderFulfillment extends BaseOrderFulfillment {}
|
||||
@@ -136,7 +136,11 @@ export interface BaseProductVariantParams
|
||||
BaseFilterable<BaseProductVariantParams> {
|
||||
q?: string
|
||||
id?: string | string[]
|
||||
sku?: string | string[]
|
||||
product_id?: string | string[]
|
||||
options?: Record<string, string>
|
||||
options?: {
|
||||
value: string
|
||||
option_id: string
|
||||
}
|
||||
created_at?: OperatorMap<string>
|
||||
updated_at?: OperatorMap<string>
|
||||
deleted_at?: OperatorMap<string>
|
||||
}
|
||||
@@ -11,7 +11,7 @@ import {
|
||||
ProductStatus,
|
||||
} from "../common"
|
||||
|
||||
export interface StoreProduct extends Omit<BaseProduct, "categories" | "sales_channels" | "variants" | "options"> {
|
||||
export interface StoreProduct extends Omit<BaseProduct, "categories" | "sales_channels" | "variants" | "options" | "collection"> {
|
||||
collection?: StoreCollection | null
|
||||
categories?: StoreProductCategory[] | null
|
||||
variants: StoreProductVariant[] | null
|
||||
|
||||
@@ -11,6 +11,6 @@ export interface StoreProductParams extends Omit<BaseProductListParams, "tags" |
|
||||
// The region ID and currency_code are not params, but are used for the pricing context. Maybe move to separate type definition.
|
||||
region_id?: string
|
||||
currency_code?: string
|
||||
variants?: StoreProductVariantParams
|
||||
variants?: Pick<StoreProductVariantParams, "options">
|
||||
province?: string
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
import { BaseReturn, BaseReturnItem } from "../common";
|
||||
|
||||
export interface StoreReturn extends BaseReturn {
|
||||
export interface StoreReturn extends Omit<BaseReturn, "no_notification" | "order_version"> {
|
||||
items: StoreReturnItem[]
|
||||
}
|
||||
export interface StoreReturnItem extends BaseReturnItem {}
|
||||
@@ -40,7 +40,7 @@ export interface AdminCreateShippingOption {
|
||||
|
||||
export interface AdminUpdateShippingOptionRule
|
||||
extends AdminCreateShippingOptionRule {
|
||||
id?: string
|
||||
id: string
|
||||
}
|
||||
|
||||
export interface AdminUpdateShippingOptionPriceWithCurrency {
|
||||
|
||||
Reference in new issue
Block a user