chore: update TSDocs + export getTranslatedShippingOptionsStep from core-flows (#14460)
This commit is contained in:
5
.changeset/clear-tables-judge.md
Normal file
5
.changeset/clear-tables-judge.md
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
"@medusajs/core-flows": patch
|
||||||
|
---
|
||||||
|
|
||||||
|
fix(core-flows): export getTranslatedShippingOptionsStep
|
||||||
@@ -13,3 +13,4 @@ export * from "./workflows/create-links"
|
|||||||
export * from "./workflows/dismiss-links"
|
export * from "./workflows/dismiss-links"
|
||||||
export * from "./workflows/update-links"
|
export * from "./workflows/update-links"
|
||||||
export * from "./steps/get-translated-line-items"
|
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"
|
"get-translated-shipping-options"
|
||||||
|
|
||||||
export interface GetTranslatedShippingOptionsStepInput {
|
export interface GetTranslatedShippingOptionsStepInput {
|
||||||
|
/**
|
||||||
|
* The shipping options to be translated.
|
||||||
|
*/
|
||||||
shippingOptions: ShippingOptionDTO[]
|
shippingOptions: ShippingOptionDTO[]
|
||||||
|
/**
|
||||||
|
* The locale code following the [IETF BCP 47 standard](https://gist.github.com/typpo/b2b828a35e683b9bf8db91b5404f1bd1).
|
||||||
|
*/
|
||||||
locale: string
|
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(
|
export const getTranslatedShippingOptionsStep = createStep(
|
||||||
getTranslatedShippingOptionsStepId,
|
getTranslatedShippingOptionsStepId,
|
||||||
async (data: GetTranslatedShippingOptionsStepInput, { container }) => {
|
async (data: GetTranslatedShippingOptionsStepInput, { container }) => {
|
||||||
|
|||||||
@@ -14,6 +14,26 @@ export interface UpdateOrderShippingMethodsTranslationsStepInput {
|
|||||||
locale: string
|
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(
|
export const updateOrderShippingMethodsTranslationsStep = createStep(
|
||||||
updateOrderShippingMethodsTranslationsStepId,
|
updateOrderShippingMethodsTranslationsStepId,
|
||||||
async (
|
async (
|
||||||
|
|||||||
@@ -165,7 +165,9 @@ export class Translation {
|
|||||||
* This method retrieves a paginated list of entities for a given entity type with only their
|
* This method retrieves a paginated list of entities for a given entity type with only their
|
||||||
* translatable fields.
|
* translatable fields.
|
||||||
* It sends a request to the
|
* 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 query - The query parameters including the entity type and pagination configurations.
|
||||||
* @param headers - Headers to pass in the request.
|
* @param headers - Headers to pass in the request.
|
||||||
|
|||||||
@@ -870,6 +870,8 @@ export const ShippingOptionWorkflowEvents = {
|
|||||||
/**
|
/**
|
||||||
* Emitted when shipping options are created.
|
* Emitted when shipping options are created.
|
||||||
*
|
*
|
||||||
|
* @since 2.12.4
|
||||||
|
*
|
||||||
* @eventPayload
|
* @eventPayload
|
||||||
* ```ts
|
* ```ts
|
||||||
* {
|
* {
|
||||||
@@ -881,6 +883,8 @@ export const ShippingOptionWorkflowEvents = {
|
|||||||
/**
|
/**
|
||||||
* Emitted when shipping options are updated.
|
* Emitted when shipping options are updated.
|
||||||
*
|
*
|
||||||
|
* @since 2.12.4
|
||||||
|
*
|
||||||
* @eventPayload
|
* @eventPayload
|
||||||
* ```ts
|
* ```ts
|
||||||
* {
|
* {
|
||||||
@@ -892,6 +896,8 @@ export const ShippingOptionWorkflowEvents = {
|
|||||||
/**
|
/**
|
||||||
* Emitted when shipping options are deleted.
|
* Emitted when shipping options are deleted.
|
||||||
*
|
*
|
||||||
|
* @since 2.12.4
|
||||||
|
*
|
||||||
* @eventPayload
|
* @eventPayload
|
||||||
* ```ts
|
* ```ts
|
||||||
* {
|
* {
|
||||||
|
|||||||
@@ -5,11 +5,12 @@ import {
|
|||||||
import { ContainerRegistrationKeys } from "@medusajs/framework/utils"
|
import { ContainerRegistrationKeys } from "@medusajs/framework/utils"
|
||||||
import { HttpTypes } from "@medusajs/types"
|
import { HttpTypes } from "@medusajs/types"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @since 2.12.4
|
||||||
|
* @featureFlag translation
|
||||||
|
*/
|
||||||
export const GET = async (
|
export const GET = async (
|
||||||
req: AuthenticatedMedusaRequest<
|
req: AuthenticatedMedusaRequest<{}, HttpTypes.AdminTranslationEntitiesParams>,
|
||||||
undefined,
|
|
||||||
HttpTypes.AdminTranslationEntitiesParams
|
|
||||||
>,
|
|
||||||
res: MedusaResponse<HttpTypes.AdminTranslationEntitiesResponse>
|
res: MedusaResponse<HttpTypes.AdminTranslationEntitiesResponse>
|
||||||
) => {
|
) => {
|
||||||
const query = req.scope.resolve(ContainerRegistrationKeys.QUERY)
|
const query = req.scope.resolve(ContainerRegistrationKeys.QUERY)
|
||||||
|
|||||||
@@ -1,5 +1,8 @@
|
|||||||
import { model } from "@medusajs/framework/utils"
|
import { model } from "@medusajs/framework/utils"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @since 2.12.4
|
||||||
|
*/
|
||||||
const Settings = model
|
const Settings = model
|
||||||
.define("translation_settings", {
|
.define("translation_settings", {
|
||||||
id: model.id({ prefix: "trset" }).primaryKey(),
|
id: model.id({ prefix: "trset" }).primaryKey(),
|
||||||
|
|||||||
Reference in New Issue
Block a user