fix(types): missing rules in prices types (#13669)
This was missing from the types although they are in validators. https://github.com/medusajs/medusa/blob/bb6cc586f7e883ea2eaa29ef459f8b3dbd3a345b/packages/medusa/src/api/admin/shipping-options/validators.ts#L88-L103 CLOSES #13610 CLOSES #12910
This commit is contained in:
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
"@medusajs/types": patch
|
||||||
|
---
|
||||||
|
|
||||||
|
fix(types): missing rules in prices types
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
import { RuleOperatorType } from "../../../common"
|
import { RuleOperatorType } from "../../../common"
|
||||||
import { ShippingOptionPriceType } from "../../../fulfillment"
|
import { ShippingOptionPriceType } from "../../../fulfillment"
|
||||||
|
import { PriceRule } from "../../../pricing"
|
||||||
|
|
||||||
export interface AdminCreateShippingOptionRule {
|
export interface AdminCreateShippingOptionRule {
|
||||||
/**
|
/**
|
||||||
@@ -52,36 +53,12 @@ export interface AdminUpdateShippingOptionType {
|
|||||||
code?: string
|
code?: string
|
||||||
}
|
}
|
||||||
|
|
||||||
interface AdminShippingOptionPriceRulePayload {
|
|
||||||
/**
|
|
||||||
* The operator of the shipping option price rule.
|
|
||||||
*
|
|
||||||
* @example
|
|
||||||
* "eq"
|
|
||||||
*/
|
|
||||||
operator: string
|
|
||||||
/**
|
|
||||||
* The attribute of the shipping option price rule.
|
|
||||||
*
|
|
||||||
* @example
|
|
||||||
* "region_id"
|
|
||||||
*/
|
|
||||||
attribute: string
|
|
||||||
/**
|
|
||||||
* The value of the shipping option price rule.
|
|
||||||
*
|
|
||||||
* @example
|
|
||||||
* "region_123"
|
|
||||||
*/
|
|
||||||
value: string | string[] | number
|
|
||||||
}
|
|
||||||
|
|
||||||
interface AdminShippingOptionPriceWithRules {
|
interface AdminShippingOptionPriceWithRules {
|
||||||
/**
|
/**
|
||||||
* The rules of the shipping option price that
|
* The rules of the shipping option price that
|
||||||
* indicate when the price should be applied.
|
* indicate when the price should be applied.
|
||||||
*/
|
*/
|
||||||
rules?: AdminShippingOptionPriceRulePayload[]
|
rules?: PriceRule[]
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface AdminCreateShippingOptionPriceWithCurrency
|
export interface AdminCreateShippingOptionPriceWithCurrency
|
||||||
@@ -111,7 +88,10 @@ export interface AdminCreateShippingOptionPriceWithRegion
|
|||||||
amount: number
|
amount: number
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface AdminCreateShippingOption {
|
/**
|
||||||
|
* Common properties for all shipping option create inputs.
|
||||||
|
*/
|
||||||
|
interface AdminCreateShippingOptionBase {
|
||||||
/**
|
/**
|
||||||
* The name of the shipping option. Customers can
|
* The name of the shipping option. Customers can
|
||||||
* view this name during checkout.
|
* view this name during checkout.
|
||||||
@@ -164,13 +144,6 @@ export interface AdminCreateShippingOption {
|
|||||||
* documentation.
|
* documentation.
|
||||||
*/
|
*/
|
||||||
type_id?: string
|
type_id?: string
|
||||||
/**
|
|
||||||
* The prices of the shipping option.
|
|
||||||
*/
|
|
||||||
prices: (
|
|
||||||
| AdminCreateShippingOptionPriceWithCurrency
|
|
||||||
| AdminCreateShippingOptionPriceWithRegion
|
|
||||||
)[]
|
|
||||||
/**
|
/**
|
||||||
* The rules of the shipping option.
|
* The rules of the shipping option.
|
||||||
*
|
*
|
||||||
@@ -184,6 +157,30 @@ export interface AdminCreateShippingOption {
|
|||||||
metadata?: Record<string, unknown>
|
metadata?: Record<string, unknown>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Flat rate shipping option creation input.
|
||||||
|
*/
|
||||||
|
export interface AdminCreateFlatRateShippingOption
|
||||||
|
extends AdminCreateShippingOptionBase {
|
||||||
|
price_type: "flat"
|
||||||
|
prices: (
|
||||||
|
| AdminCreateShippingOptionPriceWithCurrency
|
||||||
|
| AdminCreateShippingOptionPriceWithRegion
|
||||||
|
)[]
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Calculated shipping option creation input.
|
||||||
|
*/
|
||||||
|
export interface AdminCreateCalculatedShippingOption
|
||||||
|
extends AdminCreateShippingOptionBase {
|
||||||
|
price_type: "calculated"
|
||||||
|
}
|
||||||
|
|
||||||
|
export type AdminCreateShippingOption =
|
||||||
|
| AdminCreateFlatRateShippingOption
|
||||||
|
| AdminCreateCalculatedShippingOption
|
||||||
|
|
||||||
export interface AdminUpdateShippingOptionRule
|
export interface AdminUpdateShippingOptionRule
|
||||||
extends AdminCreateShippingOptionRule {
|
extends AdminCreateShippingOptionRule {
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,14 +1,17 @@
|
|||||||
import { ShippingOptionDTO } from "../../fulfillment"
|
import { ShippingOptionDTO } from "../../fulfillment"
|
||||||
import { RuleOperatorType } from "../../common"
|
import { RuleOperatorType } from "../../common"
|
||||||
|
import { PriceRule } from "../../pricing"
|
||||||
|
|
||||||
type CreateFlatRateShippingOptionPriceRecord =
|
type CreateFlatRateShippingOptionPriceRecord =
|
||||||
| {
|
| {
|
||||||
currency_code: string
|
currency_code: string
|
||||||
amount: number
|
amount: number
|
||||||
|
rules?: PriceRule[]
|
||||||
}
|
}
|
||||||
| {
|
| {
|
||||||
region_id: string
|
region_id: string
|
||||||
amount: number
|
amount: number
|
||||||
|
rules?: PriceRule[]
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -69,14 +72,14 @@ type CreateFlatShippingOptionInputBase = {
|
|||||||
attribute: string
|
attribute: string
|
||||||
/**
|
/**
|
||||||
* The operator to use when matching the attribute.
|
* The operator to use when matching the attribute.
|
||||||
*
|
*
|
||||||
* @example
|
* @example
|
||||||
* in
|
* in
|
||||||
*/
|
*/
|
||||||
operator: RuleOperatorType
|
operator: RuleOperatorType
|
||||||
/**
|
/**
|
||||||
* The value to match against.
|
* The value to match against.
|
||||||
*
|
*
|
||||||
* @example
|
* @example
|
||||||
* cusgrp_123
|
* cusgrp_123
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user