chore: update TSDocs + export getTranslatedShippingOptionsStep from core-flows (#14460)
This commit is contained in:
@@ -13,3 +13,4 @@ export * from "./workflows/create-links"
|
||||
export * from "./workflows/dismiss-links"
|
||||
export * from "./workflows/update-links"
|
||||
export * from "./steps/get-translated-line-items"
|
||||
export * from "./steps/get-translated-shipping-option"
|
||||
|
||||
@@ -6,10 +6,34 @@ export const getTranslatedShippingOptionsStepId =
|
||||
"get-translated-shipping-options"
|
||||
|
||||
export interface GetTranslatedShippingOptionsStepInput {
|
||||
/**
|
||||
* The shipping options to be translated.
|
||||
*/
|
||||
shippingOptions: ShippingOptionDTO[]
|
||||
/**
|
||||
* The locale code following the [IETF BCP 47 standard](https://gist.github.com/typpo/b2b828a35e683b9bf8db91b5404f1bd1).
|
||||
*/
|
||||
locale: string
|
||||
}
|
||||
|
||||
/**
|
||||
* This step applies translations to a list of shipping options based on the provided locale.
|
||||
* It modifies the shipping options in place and returns them.
|
||||
*
|
||||
* @since 2.12.4
|
||||
*
|
||||
* @example
|
||||
* const translatedShippingOptions = getTranslatedShippingOptionsStep({
|
||||
* shippingOptions: [
|
||||
* {
|
||||
* id: "so_123",
|
||||
* name: "Standard Shipping",
|
||||
* // ...
|
||||
* }
|
||||
* ],
|
||||
* locale: "fr-FR"
|
||||
* })
|
||||
*/
|
||||
export const getTranslatedShippingOptionsStep = createStep(
|
||||
getTranslatedShippingOptionsStepId,
|
||||
async (data: GetTranslatedShippingOptionsStepInput, { container }) => {
|
||||
|
||||
+20
@@ -14,6 +14,26 @@ export interface UpdateOrderShippingMethodsTranslationsStepInput {
|
||||
locale: string
|
||||
}
|
||||
|
||||
/**
|
||||
* This step updates the names of order shipping methods based on the provided locale.
|
||||
* It fetches the translated names of the shipping option associated with each shipping method
|
||||
* and updates the shipping methods accordingly.
|
||||
*
|
||||
* @since 2.12.4
|
||||
*
|
||||
* @example
|
||||
* const updatedShippingMethods = updateOrderShippingMethodsTranslationsStep({
|
||||
* shippingMethods: [
|
||||
* {
|
||||
* id: "sm_123",
|
||||
* shipping_option_id: "so_123",
|
||||
* name: "Standard Shipping",
|
||||
* // ...
|
||||
* }
|
||||
* ],
|
||||
* locale: "fr-FR"
|
||||
* })
|
||||
*/
|
||||
export const updateOrderShippingMethodsTranslationsStep = createStep(
|
||||
updateOrderShippingMethodsTranslationsStepId,
|
||||
async (
|
||||
|
||||
@@ -165,7 +165,9 @@ export class Translation {
|
||||
* This method retrieves a paginated list of entities for a given entity type with only their
|
||||
* translatable fields.
|
||||
* It sends a request to the
|
||||
* Get Translation Entities API route.
|
||||
* [Get Translation Entities](https://docs.medusajs.com/api/admin#translations_gettranslationentities) API route.
|
||||
*
|
||||
* @since 2.12.4
|
||||
*
|
||||
* @param query - The query parameters including the entity type and pagination configurations.
|
||||
* @param headers - Headers to pass in the request.
|
||||
|
||||
@@ -870,6 +870,8 @@ export const ShippingOptionWorkflowEvents = {
|
||||
/**
|
||||
* Emitted when shipping options are created.
|
||||
*
|
||||
* @since 2.12.4
|
||||
*
|
||||
* @eventPayload
|
||||
* ```ts
|
||||
* {
|
||||
@@ -881,6 +883,8 @@ export const ShippingOptionWorkflowEvents = {
|
||||
/**
|
||||
* Emitted when shipping options are updated.
|
||||
*
|
||||
* @since 2.12.4
|
||||
*
|
||||
* @eventPayload
|
||||
* ```ts
|
||||
* {
|
||||
@@ -892,6 +896,8 @@ export const ShippingOptionWorkflowEvents = {
|
||||
/**
|
||||
* Emitted when shipping options are deleted.
|
||||
*
|
||||
* @since 2.12.4
|
||||
*
|
||||
* @eventPayload
|
||||
* ```ts
|
||||
* {
|
||||
|
||||
Reference in New Issue
Block a user