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 }) => {
|
||||
|
||||
@@ -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
|
||||
* {
|
||||
|
||||
@@ -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<HttpTypes.AdminTranslationEntitiesResponse>
|
||||
) => {
|
||||
const query = req.scope.resolve(ContainerRegistrationKeys.QUERY)
|
||||
|
||||
@@ -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(),
|
||||
|
||||
Reference in New Issue
Block a user