feat: Add metadata to shipping options endpoints (#13554)
This commit is contained in:
@@ -55,21 +55,21 @@ export interface AdminUpdateShippingOptionType {
|
||||
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"
|
||||
*/
|
||||
@@ -88,7 +88,7 @@ export interface AdminCreateShippingOptionPriceWithCurrency
|
||||
extends AdminShippingOptionPriceWithRules {
|
||||
/**
|
||||
* The currency code of the shipping option price.
|
||||
*
|
||||
*
|
||||
* @example
|
||||
* "usd"
|
||||
*/
|
||||
@@ -115,21 +115,21 @@ export interface AdminCreateShippingOption {
|
||||
/**
|
||||
* The name of the shipping option. Customers can
|
||||
* view this name during checkout.
|
||||
*
|
||||
*
|
||||
* @example
|
||||
* "Standard Shipping"
|
||||
*/
|
||||
name: string
|
||||
/**
|
||||
* The ID of the service zone that the shipping option belongs to.
|
||||
*
|
||||
*
|
||||
* Learn more in the [Shipping Options](https://docs.medusajs.com/resources/commerce-modules/fulfillment/shipping-option#service-zone-restrictions)
|
||||
* documentation.
|
||||
*/
|
||||
service_zone_id: string
|
||||
/**
|
||||
* The ID of the shipping profile that the shipping option belongs to.
|
||||
*
|
||||
*
|
||||
* Learn more in the [Shipping Options](https://docs.medusajs.com/resources/commerce-modules/fulfillment/shipping-option#shipping-profile-and-types)
|
||||
* documentation.
|
||||
*/
|
||||
@@ -137,7 +137,7 @@ export interface AdminCreateShippingOption {
|
||||
/**
|
||||
* Additional data that is useful for third-party fulfillment providers
|
||||
* that process fulfillments for the shipping option.
|
||||
*
|
||||
*
|
||||
* Learn more in the [Shipping Options](https://docs.medusajs.com/resources/commerce-modules/fulfillment/shipping-option#data-property)
|
||||
* documentation.
|
||||
*/
|
||||
@@ -152,7 +152,7 @@ export interface AdminCreateShippingOption {
|
||||
provider_id: string
|
||||
/**
|
||||
* The type of shipping option.
|
||||
*
|
||||
*
|
||||
* Learn more in the [Shipping Option](https://docs.medusajs.com/resources/commerce-modules/fulfillment/shipping-option#shipping-profile-and-types)
|
||||
* documentation.
|
||||
*/
|
||||
@@ -173,11 +173,15 @@ export interface AdminCreateShippingOption {
|
||||
)[]
|
||||
/**
|
||||
* The rules of the shipping option.
|
||||
*
|
||||
*
|
||||
* Learn more in the [Shipping Option Rules](https://docs.medusajs.com/resources/commerce-modules/fulfillment/shipping-option#shipping-option-rules)
|
||||
* documentation.
|
||||
*/
|
||||
rules?: AdminCreateShippingOptionRule[]
|
||||
/**
|
||||
* Custom key-value pairs that can be added to the shipping option.
|
||||
*/
|
||||
metadata?: Record<string, unknown>
|
||||
}
|
||||
|
||||
export interface AdminUpdateShippingOptionRule
|
||||
@@ -197,7 +201,7 @@ export interface AdminUpdateShippingOptionPriceWithCurrency
|
||||
id?: string
|
||||
/**
|
||||
* The currency code of the shipping option price.
|
||||
*
|
||||
*
|
||||
* @example
|
||||
* "usd"
|
||||
*/
|
||||
@@ -229,7 +233,7 @@ export interface AdminUpdateShippingOption {
|
||||
/**
|
||||
* The name of the shipping option. Customers can
|
||||
* view this name during checkout.
|
||||
*
|
||||
*
|
||||
* @example
|
||||
* "Standard Shipping"
|
||||
*/
|
||||
@@ -249,14 +253,14 @@ export interface AdminUpdateShippingOption {
|
||||
provider_id?: string
|
||||
/**
|
||||
* The ID of the shipping profile that the shipping option belongs to.
|
||||
*
|
||||
*
|
||||
* Learn more in the [Shipping Options](https://docs.medusajs.com/resources/commerce-modules/fulfillment/shipping-option#shipping-profile-and-types)
|
||||
* documentation.
|
||||
*/
|
||||
shipping_profile_id?: string
|
||||
/**
|
||||
* The type of shipping option.
|
||||
*
|
||||
*
|
||||
* Learn more in the [Shipping Options](https://docs.medusajs.com/resources/commerce-modules/fulfillment/shipping-option#shipping-profile-and-types)
|
||||
* documentation.
|
||||
*/
|
||||
@@ -277,11 +281,15 @@ export interface AdminUpdateShippingOption {
|
||||
)[]
|
||||
/**
|
||||
* The rules of the shipping option.
|
||||
*
|
||||
*
|
||||
* Learn more in the [Shipping Option Rules](https://docs.medusajs.com/resources/commerce-modules/fulfillment/shipping-option#shipping-option-rules)
|
||||
* documentation.
|
||||
*/
|
||||
rules?: (AdminUpdateShippingOptionRule | AdminCreateShippingOptionRule)[]
|
||||
/**
|
||||
* Custom key-value pairs that can be added to the shipping option.
|
||||
*/
|
||||
metadata?: Record<string, unknown>
|
||||
}
|
||||
|
||||
export interface AdminUpdateShippingOptionRules {
|
||||
|
||||
@@ -142,6 +142,7 @@ export const AdminCreateShippingOption = z
|
||||
AdminCreateShippingOptionPriceWithRegion
|
||||
).array(),
|
||||
rules: AdminCreateShippingOptionRule.array().optional(),
|
||||
metadata: z.record(z.unknown()).optional(),
|
||||
})
|
||||
.strict()
|
||||
.refine((data) => isDefined(data.type_id) !== isDefined(data.type), {
|
||||
@@ -170,6 +171,7 @@ export const AdminUpdateShippingOption = z
|
||||
rules: AdminUpdateShippingOptionRule.or(AdminCreateShippingOptionRule)
|
||||
.array()
|
||||
.optional(),
|
||||
metadata: z.record(z.unknown()).optional(),
|
||||
})
|
||||
.strict()
|
||||
.refine(
|
||||
|
||||
@@ -6,6 +6,7 @@ export const defaultStoreShippingOptionsFields = [
|
||||
"shipping_profile_id",
|
||||
"fulfillment_provider_id",
|
||||
"shipping_option_type_id",
|
||||
"metadata",
|
||||
]
|
||||
|
||||
export const listTransformQueryConfig = {
|
||||
|
||||
Reference in New Issue
Block a user