feat(medusa,types,workflows,utils,product): PricingModule Integration of PriceLists into Core (#5536)
This commit is contained in:
1 parent
9c7ac7332a
commit
dc5750dd66
94 files changed
+5697
-880
No files matched your search
@@ -13,7 +13,7 @@ export enum ProductStatus {
|
||||
|
||||
/**
|
||||
* @interface
|
||||
*
|
||||
*
|
||||
* A product's data.
|
||||
*/
|
||||
export interface ProductDTO {
|
||||
@@ -152,7 +152,7 @@ export interface ProductDTO {
|
||||
|
||||
/**
|
||||
* @interface
|
||||
*
|
||||
*
|
||||
* A product variant's data.
|
||||
*/
|
||||
export interface ProductVariantDTO {
|
||||
@@ -264,7 +264,7 @@ export interface ProductVariantDTO {
|
||||
|
||||
/**
|
||||
* @interface
|
||||
*
|
||||
*
|
||||
* A product category's data.
|
||||
*/
|
||||
export interface ProductCategoryDTO {
|
||||
@@ -320,7 +320,7 @@ export interface ProductCategoryDTO {
|
||||
|
||||
/**
|
||||
* @interface
|
||||
*
|
||||
*
|
||||
* A product category to create.
|
||||
*/
|
||||
export interface CreateProductCategoryDTO {
|
||||
@@ -356,7 +356,7 @@ export interface CreateProductCategoryDTO {
|
||||
|
||||
/**
|
||||
* @interface
|
||||
*
|
||||
*
|
||||
* The data to update in a product category.
|
||||
*/
|
||||
export interface UpdateProductCategoryDTO {
|
||||
@@ -392,7 +392,7 @@ export interface UpdateProductCategoryDTO {
|
||||
|
||||
/**
|
||||
* @interface
|
||||
*
|
||||
*
|
||||
* A product tag's data.
|
||||
*/
|
||||
export interface ProductTagDTO {
|
||||
@@ -418,7 +418,7 @@ export interface ProductTagDTO {
|
||||
|
||||
/**
|
||||
* @interface
|
||||
*
|
||||
*
|
||||
* A product collection's data.
|
||||
*/
|
||||
export interface ProductCollectionDTO {
|
||||
@@ -452,7 +452,7 @@ export interface ProductCollectionDTO {
|
||||
|
||||
/**
|
||||
* @interface
|
||||
*
|
||||
*
|
||||
* A product type's data.
|
||||
*/
|
||||
export interface ProductTypeDTO {
|
||||
@@ -476,7 +476,7 @@ export interface ProductTypeDTO {
|
||||
|
||||
/**
|
||||
* @interface
|
||||
*
|
||||
*
|
||||
* A product option's data.
|
||||
*
|
||||
*/
|
||||
@@ -513,8 +513,13 @@ export interface ProductOptionDTO {
|
||||
|
||||
/**
|
||||
* @interface
|
||||
*
|
||||
*
|
||||
* The product image's data.
|
||||
*
|
||||
* @prop id - The ID of the product image.
|
||||
* @prop url - The URL of the product image.
|
||||
* @prop metadata - Holds custom data in key-value pairs.
|
||||
* @prop deleted_at - When the product image was deleted.
|
||||
*/
|
||||
export interface ProductImageDTO {
|
||||
/**
|
||||
@@ -537,8 +542,15 @@ export interface ProductImageDTO {
|
||||
|
||||
/**
|
||||
* @interface
|
||||
*
|
||||
*
|
||||
* The product option value's data.
|
||||
*
|
||||
* @prop id - The ID of the product option value.
|
||||
* @prop value - The value of the product option value.
|
||||
* @prop option - The associated product option. It may only be available if the `option` relation is expanded.
|
||||
* @prop variant - The associated product variant. It may only be available if the `variant` relation is expanded.
|
||||
* @prop metadata - Holds custom data in key-value pairs.
|
||||
* @prop deleted_at - When the product option value was deleted.
|
||||
*/
|
||||
export interface ProductOptionValueDTO {
|
||||
/**
|
||||
@@ -573,8 +585,15 @@ export interface ProductOptionValueDTO {
|
||||
|
||||
/**
|
||||
* @interface
|
||||
*
|
||||
*
|
||||
* The filters to apply on retrieved products.
|
||||
*
|
||||
* @prop q - Search through the products' attributes, such as titles and descriptions, using this search term.
|
||||
* @prop handle - The handles to filter products by.
|
||||
* @prop id - The IDs to filter products by.
|
||||
* @prop tags - Filters on a product's tags.
|
||||
* @prop categories - Filters on a product's categories.
|
||||
* @prop collection_id - Filters a product by its associated collections.
|
||||
*/
|
||||
export interface FilterableProductProps
|
||||
extends BaseFilterable<FilterableProductProps> {
|
||||
@@ -628,8 +647,11 @@ export interface FilterableProductProps
|
||||
|
||||
/**
|
||||
* @interface
|
||||
*
|
||||
*
|
||||
* The filters to apply on retrieved product tags.
|
||||
*
|
||||
* @prop id - The IDs to filter product tags by.
|
||||
* @prop value - The value to filter product tags by.
|
||||
*/
|
||||
export interface FilterableProductTagProps
|
||||
extends BaseFilterable<FilterableProductTagProps> {
|
||||
@@ -645,8 +667,11 @@ export interface FilterableProductTagProps
|
||||
|
||||
/**
|
||||
* @interface
|
||||
*
|
||||
*
|
||||
* The filters to apply on retrieved product types.
|
||||
*
|
||||
* @prop id - The IDs to filter product types by.
|
||||
* @prop value - The value to filter product types by.
|
||||
*/
|
||||
export interface FilterableProductTypeProps
|
||||
extends BaseFilterable<FilterableProductTypeProps> {
|
||||
@@ -662,8 +687,12 @@ export interface FilterableProductTypeProps
|
||||
|
||||
/**
|
||||
* @interface
|
||||
*
|
||||
*
|
||||
* The filters to apply on retrieved product options.
|
||||
*
|
||||
* @prop id - The IDs to filter product options by.
|
||||
* @prop title - The titles to filter product options by.
|
||||
* @prop product_id - Filter the product options by their associated products' IDs.
|
||||
*/
|
||||
export interface FilterableProductOptionProps
|
||||
extends BaseFilterable<FilterableProductOptionProps> {
|
||||
@@ -683,8 +712,11 @@ export interface FilterableProductOptionProps
|
||||
|
||||
/**
|
||||
* @interface
|
||||
*
|
||||
*
|
||||
* The filters to apply on retrieved product collections.
|
||||
*
|
||||
* @prop id - The IDs to filter product collections by.
|
||||
* @prop title - The title to filter product collections by.
|
||||
*/
|
||||
export interface FilterableProductCollectionProps
|
||||
extends BaseFilterable<FilterableProductCollectionProps> {
|
||||
@@ -704,8 +736,13 @@ export interface FilterableProductCollectionProps
|
||||
|
||||
/**
|
||||
* @interface
|
||||
*
|
||||
*
|
||||
* The filters to apply on retrieved product variants.
|
||||
*
|
||||
* @prop id - The IDs to filter product variants by.
|
||||
* @prop sku - The SKUs to filter product variants by.
|
||||
* @prop product_id - Filter the product variants by their associated products' IDs.
|
||||
* @prop options - Filter product variants by their associated options.
|
||||
*/
|
||||
export interface FilterableProductVariantProps
|
||||
extends BaseFilterable<FilterableProductVariantProps> {
|
||||
@@ -734,8 +771,16 @@ export interface FilterableProductVariantProps
|
||||
|
||||
/**
|
||||
* @interface
|
||||
*
|
||||
*
|
||||
* The filters to apply on retrieved product categories.
|
||||
*
|
||||
* @prop id - The IDs to filter product categories by.
|
||||
* @prop name - The names to filter product categories by.
|
||||
* @prop parent_category_id - Filter product categories by their parent category's ID.
|
||||
* @prop handle - The handles to filter product categories by.
|
||||
* @prop is_active - Filter product categories by whether they're active.
|
||||
* @prop is_internal - Filter product categories by whether they're internal.
|
||||
* @prop include_descendants_tree - Whether to include children of retrieved product categories.
|
||||
*/
|
||||
export interface FilterableProductCategoryProps
|
||||
extends BaseFilterable<FilterableProductCategoryProps> {
|
||||
@@ -771,8 +816,13 @@ export interface FilterableProductCategoryProps
|
||||
|
||||
/**
|
||||
* @interface
|
||||
*
|
||||
*
|
||||
* A product collection to create.
|
||||
*
|
||||
* @prop title - The product collection's title.
|
||||
* @prop handle - The product collection's handle. If not provided, the value of this attribute is set to the slug version of the title.
|
||||
* @prop products - The products to associate with the collection.
|
||||
* @prop metadata - Holds custom data in key-value pairs.
|
||||
*/
|
||||
export interface CreateProductCollectionDTO {
|
||||
/**
|
||||
@@ -795,7 +845,7 @@ export interface CreateProductCollectionDTO {
|
||||
|
||||
/**
|
||||
* @interface
|
||||
*
|
||||
*
|
||||
* The data to update in a product collection. The `id` is used to identify which product collection to update.
|
||||
*/
|
||||
export interface UpdateProductCollectionDTO {
|
||||
@@ -827,7 +877,7 @@ export interface UpdateProductCollectionDTO {
|
||||
|
||||
/**
|
||||
* @interface
|
||||
*
|
||||
*
|
||||
* A product type to create.
|
||||
*/
|
||||
export interface CreateProductTypeDTO {
|
||||
@@ -852,7 +902,7 @@ export interface UpsertProductTypeDTO {
|
||||
|
||||
/**
|
||||
* @interface
|
||||
*
|
||||
*
|
||||
* The data to update in a product type. The `id` is used to identify which product type to update.
|
||||
*/
|
||||
export interface UpdateProductTypeDTO {
|
||||
@@ -872,7 +922,7 @@ export interface UpdateProductTypeDTO {
|
||||
|
||||
/**
|
||||
* @interface
|
||||
*
|
||||
*
|
||||
* A product tag to create.
|
||||
*/
|
||||
export interface CreateProductTagDTO {
|
||||
@@ -888,9 +938,9 @@ export interface UpsertProductTagDTO {
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @interface
|
||||
*
|
||||
*
|
||||
* The data to update in a product tag. The `id` is used to identify which product tag to update.
|
||||
*/
|
||||
export interface UpdateProductTagDTO {
|
||||
@@ -906,7 +956,7 @@ export interface UpdateProductTagDTO {
|
||||
|
||||
/**
|
||||
* @interface
|
||||
*
|
||||
*
|
||||
* A product option to create.
|
||||
*/
|
||||
export interface CreateProductOptionDTO {
|
||||
@@ -928,7 +978,7 @@ export interface UpdateProductOptionDTO {
|
||||
|
||||
/**
|
||||
* @interface
|
||||
*
|
||||
*
|
||||
* A product variant option to create.
|
||||
*/
|
||||
export interface CreateProductVariantOptionDTO {
|
||||
@@ -936,14 +986,19 @@ export interface CreateProductVariantOptionDTO {
|
||||
* The value of a product variant option.
|
||||
*/
|
||||
value: string
|
||||
option_id?: string
|
||||
}
|
||||
|
||||
/**
|
||||
* @interface
|
||||
*
|
||||
*
|
||||
* A product variant to create.
|
||||
*/
|
||||
export interface CreateProductVariantDTO {
|
||||
/**
|
||||
* The id of the product
|
||||
*/
|
||||
product_id?: string
|
||||
/**
|
||||
* The tile of the product variant.
|
||||
*/
|
||||
@@ -1020,7 +1075,7 @@ export interface CreateProductVariantDTO {
|
||||
|
||||
/**
|
||||
* @interface
|
||||
*
|
||||
*
|
||||
* The data to update in a product variant. The `id` is used to identify which product variant to update.
|
||||
*/
|
||||
export interface UpdateProductVariantDTO {
|
||||
@@ -1104,7 +1159,7 @@ export interface UpdateProductVariantDTO {
|
||||
|
||||
/**
|
||||
* @interface
|
||||
*
|
||||
*
|
||||
* A product to create.
|
||||
*/
|
||||
export interface CreateProductDTO {
|
||||
@@ -1214,7 +1269,7 @@ export interface CreateProductDTO {
|
||||
|
||||
/**
|
||||
* @interface
|
||||
*
|
||||
*
|
||||
* The data to update in a product. The `id` is used to identify which product to update.
|
||||
*/
|
||||
export interface UpdateProductDTO {
|
||||
@@ -1352,6 +1407,7 @@ export interface CreateProductOnlyDTO {
|
||||
}
|
||||
|
||||
export interface CreateProductVariantOnlyDTO {
|
||||
product_id?: string
|
||||
title: string
|
||||
sku?: string
|
||||
barcode?: string
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -2,3 +2,4 @@ export * as CartWorkflow from "./cart"
|
||||
export * as CommonWorkflow from "./common"
|
||||
export * as ProductWorkflow from "./product"
|
||||
export * as InventoryWorkflow from "./inventory"
|
||||
export * as PriceListWorkflow from "./price-list"
|
||||
@@ -0,0 +1,78 @@
|
||||
import {
|
||||
CreatePriceListRules,
|
||||
PriceListRuleDTO,
|
||||
PriceListStatus,
|
||||
} from "../../pricing"
|
||||
|
||||
export interface CreatePriceListDTO {
|
||||
starts_at?: string
|
||||
ends_at?: string
|
||||
status?: PriceListStatus
|
||||
number_rules?: number
|
||||
rules?: PriceListRuleDTO[]
|
||||
prices?: {
|
||||
amount: number
|
||||
currency_code: string
|
||||
region_id?: string
|
||||
max_quantity?: number
|
||||
min_quantity?: number
|
||||
}[]
|
||||
customer_groups?: {
|
||||
id: string
|
||||
}[]
|
||||
}
|
||||
|
||||
export interface CreatePriceListRuleDTO {
|
||||
rule_attribute: string
|
||||
value: string[]
|
||||
}
|
||||
|
||||
export interface CreatePriceListPriceDTO {
|
||||
amount: number
|
||||
currency_code: string
|
||||
price_set_id: string | null
|
||||
region_id?: string
|
||||
max_quantity?: number
|
||||
min_quantity?: number
|
||||
}
|
||||
|
||||
export interface CreatePriceListWorkflowInputDTO {
|
||||
price_lists: CreatePriceListWorkflowDTO[]
|
||||
}
|
||||
|
||||
export interface RemovePriceListProductsWorkflowInputDTO {
|
||||
product_ids: string[]
|
||||
price_list_id: string
|
||||
}
|
||||
|
||||
export interface RemovePriceListVariantsWorkflowInputDTO {
|
||||
variant_ids: string[]
|
||||
price_list_id: string
|
||||
}
|
||||
|
||||
export interface RemovePriceListPricesWorkflowInputDTO {
|
||||
money_amount_ids: string[]
|
||||
price_list_id: string
|
||||
}
|
||||
|
||||
export interface CreatePriceListWorkflowDTO {
|
||||
title?: string
|
||||
name: string
|
||||
description: string
|
||||
type?: string
|
||||
starts_at?: string
|
||||
ends_at?: string
|
||||
status?: PriceListStatus
|
||||
number_rules?: number
|
||||
prices: InputPrice[]
|
||||
rules?: CreatePriceListRules
|
||||
}
|
||||
|
||||
interface InputPrice {
|
||||
region_id?: string
|
||||
currency_code: string
|
||||
amount: number
|
||||
variant_id: string
|
||||
min_quantity?: number
|
||||
max_quantity?: number
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
export * from "./create-price-list"
|
||||
export * from "./update-price-list"
|
||||
export * from "./remove-price-list"
|
||||
@@ -0,0 +1,3 @@
|
||||
export interface RemovePriceListWorkflowInputDTO {
|
||||
price_lists: string[]
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
import { CreatePriceListRules, PriceListStatus } from "../../pricing"
|
||||
|
||||
import { UpdateProductVariantPricesInputDTO } from "../product"
|
||||
|
||||
export type PriceListVariantPriceDTO = UpdateProductVariantPricesInputDTO & {
|
||||
variant_id?: string
|
||||
price_set_id?: string
|
||||
}
|
||||
|
||||
export interface UpdatePriceListWorkflowDTO {
|
||||
id: string
|
||||
name?: string
|
||||
starts_at?: string
|
||||
ends_at?: string
|
||||
status?: PriceListStatus
|
||||
rules?: CreatePriceListRules
|
||||
prices?: PriceListVariantPriceDTO[]
|
||||
customer_groups?: {
|
||||
id: string
|
||||
}[]
|
||||
}
|
||||
|
||||
export interface UpdatePriceListWorkflowInputDTO {
|
||||
price_lists: UpdatePriceListWorkflowDTO[]
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
import {
|
||||
UpsertProductVariantOptionInputDTO,
|
||||
UpsertProductVariantPricesInputDTO,
|
||||
} from "./update-product-variants"
|
||||
|
||||
export interface CreateProductVariantsInputDTO {
|
||||
product_id?: string
|
||||
title?: string
|
||||
sku?: string
|
||||
ean?: string
|
||||
upc?: string
|
||||
barcode?: string
|
||||
hs_code?: string
|
||||
inventory_quantity?: number
|
||||
allow_backorder?: boolean
|
||||
manage_inventory?: boolean
|
||||
weight?: number
|
||||
length?: number
|
||||
height?: number
|
||||
width?: number
|
||||
origin_country?: string
|
||||
mid_code?: string
|
||||
material?: string
|
||||
metadata?: Record<string, unknown>
|
||||
|
||||
prices?: UpsertProductVariantPricesInputDTO[]
|
||||
options?: UpsertProductVariantOptionInputDTO[]
|
||||
}
|
||||
|
||||
export interface CreateProductVariantsWorkflowInputDTO {
|
||||
productVariants: CreateProductVariantsInputDTO[]
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
export * from "./create-product-variants"
|
||||
export * from "./create-products"
|
||||
export * from "./update-product-variants"
|
||||
export * from "./update-products"
|
||||
Reference in new issue
Block a user