From 60f68ff492bc98013fc2f6e0b0b252182a1ee59c Mon Sep 17 00:00:00 2001 From: Shahed Nasser Date: Tue, 6 Jan 2026 15:26:23 +0200 Subject: [PATCH] chore: update TSDocs + export getTranslatedShippingOptionsStep from core-flows (#14460) --- .changeset/clear-tables-judge.md | 5 ++++ packages/core/core-flows/src/common/index.ts | 1 + .../steps/get-translated-shipping-option.ts | 24 +++++++++++++++++++ ...ate-order-shipping-methods-translations.ts | 20 ++++++++++++++++ packages/core/js-sdk/src/admin/translation.ts | 4 +++- packages/core/utils/src/core-flows/events.ts | 6 +++++ .../api/admin/translations/entities/route.ts | 9 +++---- .../translation/src/models/settings.ts | 3 +++ 8 files changed, 67 insertions(+), 5 deletions(-) create mode 100644 .changeset/clear-tables-judge.md diff --git a/.changeset/clear-tables-judge.md b/.changeset/clear-tables-judge.md new file mode 100644 index 0000000000..f3207826a3 --- /dev/null +++ b/.changeset/clear-tables-judge.md @@ -0,0 +1,5 @@ +--- +"@medusajs/core-flows": patch +--- + +fix(core-flows): export getTranslatedShippingOptionsStep diff --git a/packages/core/core-flows/src/common/index.ts b/packages/core/core-flows/src/common/index.ts index 24d158ebc7..3ce6ceca1c 100644 --- a/packages/core/core-flows/src/common/index.ts +++ b/packages/core/core-flows/src/common/index.ts @@ -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" diff --git a/packages/core/core-flows/src/common/steps/get-translated-shipping-option.ts b/packages/core/core-flows/src/common/steps/get-translated-shipping-option.ts index 1af0cc61b3..3b3b82b0ae 100644 --- a/packages/core/core-flows/src/common/steps/get-translated-shipping-option.ts +++ b/packages/core/core-flows/src/common/steps/get-translated-shipping-option.ts @@ -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 }) => { diff --git a/packages/core/core-flows/src/order/steps/update-order-shipping-methods-translations.ts b/packages/core/core-flows/src/order/steps/update-order-shipping-methods-translations.ts index 923abf9f86..c5225fafb1 100644 --- a/packages/core/core-flows/src/order/steps/update-order-shipping-methods-translations.ts +++ b/packages/core/core-flows/src/order/steps/update-order-shipping-methods-translations.ts @@ -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 ( diff --git a/packages/core/js-sdk/src/admin/translation.ts b/packages/core/js-sdk/src/admin/translation.ts index ce1b85c2c6..882ba5ab34 100644 --- a/packages/core/js-sdk/src/admin/translation.ts +++ b/packages/core/js-sdk/src/admin/translation.ts @@ -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. diff --git a/packages/core/utils/src/core-flows/events.ts b/packages/core/utils/src/core-flows/events.ts index a4d416ef37..e011982e96 100644 --- a/packages/core/utils/src/core-flows/events.ts +++ b/packages/core/utils/src/core-flows/events.ts @@ -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 * { diff --git a/packages/medusa/src/api/admin/translations/entities/route.ts b/packages/medusa/src/api/admin/translations/entities/route.ts index e74045f4c9..37b42a127c 100644 --- a/packages/medusa/src/api/admin/translations/entities/route.ts +++ b/packages/medusa/src/api/admin/translations/entities/route.ts @@ -5,11 +5,12 @@ import { import { ContainerRegistrationKeys } from "@medusajs/framework/utils" import { HttpTypes } from "@medusajs/types" +/** + * @since 2.12.4 + * @featureFlag translation + */ export const GET = async ( - req: AuthenticatedMedusaRequest< - undefined, - HttpTypes.AdminTranslationEntitiesParams - >, + req: AuthenticatedMedusaRequest<{}, HttpTypes.AdminTranslationEntitiesParams>, res: MedusaResponse ) => { const query = req.scope.resolve(ContainerRegistrationKeys.QUERY) diff --git a/packages/modules/translation/src/models/settings.ts b/packages/modules/translation/src/models/settings.ts index 2dd2394e5d..f3e06d9e35 100644 --- a/packages/modules/translation/src/models/settings.ts +++ b/packages/modules/translation/src/models/settings.ts @@ -1,5 +1,8 @@ import { model } from "@medusajs/framework/utils" +/** + * @since 2.12.4 + */ const Settings = model .define("translation_settings", { id: model.id({ prefix: "trset" }).primaryKey(),