chore: update TSDocs + export getTranslatedShippingOptionsStep from core-flows (#14460)

This commit is contained in:
Shahed Nasser
2026-01-06 15:26:23 +02:00
committed by GitHub
parent ab7b04dbc9
commit 60f68ff492
8 changed files with 67 additions and 5 deletions

View File

@@ -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"

View File

@@ -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 }) => {

View File

@@ -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 (