@medusajs/types
Version:
Medusa Types definition
250 lines • 7.4 kB
TypeScript
import { RuleOperatorType } from "../../../common";
import { ShippingOptionPriceType } from "../../../fulfillment";
export interface AdminCreateShippingOptionRule {
/**
* The operator of the shipping option rule.
*/
operator: RuleOperatorType;
/**
* The attribute of the shipping option rule.
*
* @example
* `enabled_in_store`
*/
attribute: string;
/**
* The value of the shipping option rule.
*
* @example
* `true`
*/
value: string | string[];
}
export interface AdminCreateShippingOptionType {
/**
* The label of the shipping option type.
*/
label: string;
/**
* The description of the shipping option type.
*/
description: string;
/**
* The code of the shipping option type.
*/
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 {
/**
* The rules of the shipping option price that
* indicate when the price should be applied.
*/
rules?: AdminShippingOptionPriceRulePayload[];
}
export interface AdminCreateShippingOptionPriceWithCurrency extends AdminShippingOptionPriceWithRules {
/**
* The currency code of the shipping option price.
*
* @example
* "usd"
*/
currency_code: string;
/**
* The amount of the shipping option price.
*/
amount: number;
}
export interface AdminCreateShippingOptionPriceWithRegion extends AdminShippingOptionPriceWithRules {
/**
* The ID of the region that the shipping option price belongs to.
*/
region_id: string;
/**
* The amount of the shipping option price.
*/
amount: number;
}
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.
*/
shipping_profile_id: string;
/**
* 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.
*/
data?: Record<string, unknown>;
/**
* The type of shipping option's price.
*/
price_type: ShippingOptionPriceType;
/**
* The ID of the fulfillment provider that the shipping option belongs to.
*/
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.
*/
type: AdminCreateShippingOptionType;
/**
* The prices of the shipping option.
*/
prices: (AdminCreateShippingOptionPriceWithCurrency | AdminCreateShippingOptionPriceWithRegion)[];
/**
* 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[];
}
export interface AdminUpdateShippingOptionRule extends AdminCreateShippingOptionRule {
/**
* The ID of the shipping option rule that is being updated.
*/
id: string;
}
export interface AdminUpdateShippingOptionPriceWithCurrency extends AdminShippingOptionPriceWithRules {
/**
* The ID of the shipping option price that is being updated.
* If not provided, a new shipping option price will be created.
*/
id?: string;
/**
* The currency code of the shipping option price.
*
* @example
* "usd"
*/
currency_code?: string;
/**
* The amount of the shipping option price.
*/
amount?: number;
}
export interface AdminUpdateShippingOptionPriceWithRegion extends AdminShippingOptionPriceWithRules {
/**
* The ID of the shipping option price that is being updated.
* If not provided, a new shipping option price will be created.
*/
id?: string;
/**
* The ID of the region that the shipping option price belongs to.
*/
region_id?: string;
/**
* The amount of the shipping option price.
*/
amount?: number;
}
export interface AdminUpdateShippingOption {
/**
* The name of the shipping option. Customers can
* view this name during checkout.
*
* @example
* "Standard Shipping"
*/
name?: string;
/**
* Additional data that is useful for third-party fulfillment providers
* that process fulfillments for the shipping option.
*/
data?: Record<string, unknown>;
/**
* The type of shipping option's price.
*/
price_type?: ShippingOptionPriceType;
/**
* The ID of the fulfillment provider that the shipping option belongs to.
*/
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.
*/
type?: AdminCreateShippingOptionType;
/**
* The prices of the shipping option.
*/
prices?: (AdminUpdateShippingOptionPriceWithCurrency | AdminUpdateShippingOptionPriceWithRegion)[];
/**
* 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)[];
}
export interface AdminUpdateShippingOptionRules {
/**
* The rules to create.
*/
create?: any[];
/**
* The rules to update.
*/
update?: any[];
/**
* The rules to delete.
*/
delete?: string[];
}
export {};
//# sourceMappingURL=payloads.d.ts.map