docs: fix imports + file names (#13264)

This commit is contained in:
Shahed Nasser
2025-08-21 12:51:05 +03:00
committed by GitHub
parent 6602e893b8
commit 37f372ccf7
7 changed files with 82 additions and 76 deletions
+35 -36
View File
@@ -37796,7 +37796,7 @@ You'll first create a [workflow](https://docs.medusajs.com/docs/learn/fundamenta
For example, create a workflow at `src/workflows/track-order-placed.ts` with the following content:
```ts title="src/workflows/track-order-created.ts" highlights={workflowHighlights}
```ts title="src/workflows/track-order-placed.ts" highlights={workflowHighlights}
import { createWorkflow } from "@medusajs/framework/workflows-sdk"
import { createStep } from "@medusajs/framework/workflows-sdk"
import { useQueryGraphStep } from "@medusajs/medusa/core-flows"
@@ -37807,13 +37807,13 @@ type StepInput = {
order: OrderDTO
}
const trackOrderCreatedStep = createStep(
"track-order-created-step",
const trackOrderPlacedStep = createStep(
"track-order-placed-step",
async ({ order }: StepInput, { container }) => {
const analyticsModuleService = container.resolve(Modules.ANALYTICS)
await analyticsModuleService.track({
event: "order_created",
event: "order_placed",
actor_id: order.customer_id,
properties: {
order_id: order.id,
@@ -37833,8 +37833,8 @@ type WorkflowInput = {
order_id: string
}
export const trackOrderCreatedWorkflow = createWorkflow(
"track-order-created-workflow",
export const trackOrderPlacedWorkflow = createWorkflow(
"track-order-placed-workflow",
({ order_id }: WorkflowInput) => {
const { data: orders } = useQueryGraphStep({
entity: "order",
@@ -37854,7 +37854,7 @@ export const trackOrderCreatedWorkflow = createWorkflow(
)
```
This workflow retrieves the order details using the `useQueryGraphStep` and then tracks the order creation event using the `trackOrderCreatedStep`.
This workflow retrieves the order details using the `useQueryGraphStep` and then tracks the order placement event using the `trackOrderPlacedStep`.
In the step, you resolve the service of the Analytics Module from the [Medusa container](https://docs.medusajs.com/docs/learn/fundamentals/medusa-container/index.html.md) and use its `track` method to track the event. This method will use the underlying provider configured (which is the Local Analytics Module Provider, in this case) to track the event.
@@ -37865,13 +37865,13 @@ import type {
SubscriberArgs,
SubscriberConfig,
} from "@medusajs/framework"
import { trackOrderCreatedWorkflow } from "../workflows/track-order-created"
import { trackOrderPlacedWorkflow } from "../workflows/track-order-placed"
export default async function orderPlacedHandler({
event: { data },
container,
}: SubscriberArgs<{ id: string }>) {
await trackOrderCreatedWorkflow(container).run({
await trackOrderPlacedWorkflow(container).run({
input: {
order_id: data.id,
},
@@ -37883,9 +37883,9 @@ export const config: SubscriberConfig = {
}
```
This subscriber listens to the `order.placed` event and executes the `trackOrderCreatedWorkflow` workflow, passing the order ID as input.
This subscriber listens to the `order.placed` event and executes the `trackOrderPlacedWorkflow` workflow, passing the order ID as input.
You'll now track the order creation event whenever an order is placed in your Medusa application. You can test this out by placing an order and checking the server's logs for the tracked event.
You'll now track the order placement event whenever an order is placed in your Medusa application. You can test this out by placing an order and checking the server's logs for the tracked event.
***
@@ -37958,7 +37958,7 @@ In a step of your workflow, you can resolve the Analytics Module's service and u
For example, create a workflow at `src/workflows/track-order-placed.ts` with the following content:
```ts title="src/workflows/track-order-created.ts" highlights={workflowHighlights}
```ts title="src/workflows/track-order-placed.ts" highlights={workflowHighlights}
import { createWorkflow } from "@medusajs/framework/workflows-sdk"
import { createStep } from "@medusajs/framework/workflows-sdk"
import { useQueryGraphStep } from "@medusajs/medusa/core-flows"
@@ -37969,13 +37969,13 @@ type StepInput = {
order: OrderDTO
}
const trackOrderCreatedStep = createStep(
"track-order-created-step",
const trackOrderPlacedStep = createStep(
"track-order-placed-step",
async ({ order }: StepInput, { container }) => {
const analyticsModuleService = container.resolve(Modules.ANALYTICS)
await analyticsModuleService.track({
event: "order_created",
event: "order_placed",
actor_id: order.customer_id,
properties: {
order_id: order.id,
@@ -37995,8 +37995,8 @@ type WorkflowInput = {
order_id: string
}
export const trackOrderCreatedWorkflow = createWorkflow(
"track-order-created-workflow",
export const trackOrderPlacedWorkflow = createWorkflow(
"track-order-placed-workflow",
({ order_id }: WorkflowInput) => {
const { data: orders } = useQueryGraphStep({
entity: "order",
@@ -38016,7 +38016,7 @@ export const trackOrderCreatedWorkflow = createWorkflow(
)
```
This workflow retrieves the order details using the `useQueryGraphStep` and then tracks the order creation event using the `trackOrderCreatedStep`.
This workflow retrieves the order details using the `useQueryGraphStep` and then tracks the order placement event using the `trackOrderPlacedStep`.
In the step, you resolve the service of the Analytics Module from the [Medusa container](https://docs.medusajs.com/docs/learn/fundamentals/medusa-container/index.html.md) and use its `track` method to track the event. This method will use the underlying provider configured in `medusa-config.ts` to track the event.
@@ -38031,13 +38031,13 @@ import type {
SubscriberArgs,
SubscriberConfig,
} from "@medusajs/framework"
import { trackOrderCreatedWorkflow } from "../workflows/track-order-created"
import { trackOrderPlacedWorkflow } from "../workflows/track-order-placed"
export default async function orderPlacedHandler({
event: { data },
container,
}: SubscriberArgs<{ id: string }>) {
await trackOrderCreatedWorkflow(container).run({
await trackOrderPlacedWorkflow(container).run({
input: {
order_id: data.id,
},
@@ -38049,9 +38049,9 @@ export const config: SubscriberConfig = {
}
```
This subscriber listens to the `order.placed` event and executes the `trackOrderCreatedWorkflow` workflow, passing the order ID as input.
This subscriber listens to the `order.placed` event and executes the `trackOrderPlacedWorkflow` workflow, passing the order ID as input.
You'll now track the order creation event whenever an order is placed in your Medusa application. You can test this out by placing an order and checking the provider you integrated with (for example, PostHog) for the tracked event.
You'll now track the order placement event whenever an order is placed in your Medusa application. You can test this out by placing an order and checking the provider you integrated with (for example, PostHog) for the tracked event.
# PostHog Analytics Module Provider
@@ -38126,7 +38126,7 @@ You'll first create a [workflow](https://docs.medusajs.com/docs/learn/fundamenta
For example, create a workflow at `src/workflows/track-order-placed.ts` with the following content:
```ts title="src/workflows/track-order-created.ts" highlights={workflowHighlights}
```ts title="src/workflows/track-order-placed.ts" highlights={workflowHighlights}
import { createWorkflow } from "@medusajs/framework/workflows-sdk"
import { createStep } from "@medusajs/framework/workflows-sdk"
import { useQueryGraphStep } from "@medusajs/medusa/core-flows"
@@ -38137,13 +38137,13 @@ type StepInput = {
order: OrderDTO
}
const trackOrderCreatedStep = createStep(
"track-order-created-step",
const trackOrderPlacedStep = createStep(
"track-order-placed-step",
async ({ order }: StepInput, { container }) => {
const analyticsModuleService = container.resolve(Modules.ANALYTICS)
await analyticsModuleService.track({
event: "order_created",
event: "order_placed",
actor_id: order.customer_id,
properties: {
order_id: order.id,
@@ -38163,8 +38163,8 @@ type WorkflowInput = {
order_id: string
}
export const trackOrderCreatedWorkflow = createWorkflow(
"track-order-created-workflow",
export const trackOrderPlacedWorkflow = createWorkflow(
"track-order-placed-workflow",
({ order_id }: WorkflowInput) => {
const { data: orders } = useQueryGraphStep({
entity: "order",
@@ -38184,7 +38184,7 @@ export const trackOrderCreatedWorkflow = createWorkflow(
)
```
This workflow retrieves the order details using the `useQueryGraphStep` and then tracks the order creation event using the `trackOrderCreatedStep`.
This workflow retrieves the order details using the `useQueryGraphStep` and then tracks the order placement event using the `trackOrderPlacedStep`.
In the step, you resolve the service of the Analytics Module from the [Medusa container](https://docs.medusajs.com/docs/learn/fundamentals/medusa-container/index.html.md) and use its `track` method to track the event. This method will use the underlying provider configured (which is the PostHog Analytics Module Provider, in this case) to track the event.
@@ -38195,13 +38195,13 @@ import type {
SubscriberArgs,
SubscriberConfig,
} from "@medusajs/framework"
import { trackOrderCreatedWorkflow } from "../workflows/track-order-created"
import { trackOrderPlacedWorkflow } from "../workflows/track-order-placed"
export default async function orderPlacedHandler({
event: { data },
container,
}: SubscriberArgs<{ id: string }>) {
await trackOrderCreatedWorkflow(container).run({
await trackOrderPlacedWorkflow(container).run({
input: {
order_id: data.id,
},
@@ -38213,9 +38213,9 @@ export const config: SubscriberConfig = {
}
```
This subscriber listens to the `order.placed` event and executes the `trackOrderCreatedWorkflow` workflow, passing the order ID as input.
This subscriber listens to the `order.placed` event and executes the `trackOrderPlacedWorkflow` workflow, passing the order ID as input.
You'll now track the order creation event whenever an order is placed in your Medusa application. You can test this out by placing an order and checking your PostHog dashboard for the tracked event.
You'll now track the order placement event whenever an order is placed in your Medusa application. You can test this out by placing an order and checking your PostHog dashboard for the tracked event.
***
@@ -73841,7 +73841,6 @@ Create the file `src/collections/Products.ts` with the following content:
```ts title="src/collections/Products.ts" badgeLabel="Storefront" badgeColor="blue" highlights={productCollectionHighlights}
import { CollectionConfig } from "payload"
import { payloadMedusaSdk } from "../lib/payload-sdk"
export const Products: CollectionConfig = {
slug: "products",
@@ -75381,11 +75380,11 @@ In this step, you'll customize the Next.js Starter Storefront to view the produc
When you fetch product data in the Next.js Starter Storefront from the Medusa server, you can also retrieve the linked product data from Payload.
To do this, go to `src/lib/products.ts` in your Next.js Starter Storefront. You'll find a `listProducts` function that uses the JS SDK to fetch products from the Medusa server.
To do this, go to `src/lib/data/products.ts` in your Next.js Starter Storefront. You'll find a `listProducts` function that uses the JS SDK to fetch products from the Medusa server.
Find the `sdk.client.fetch` call and add `*payload_product` to the `fields` query parameter:
```ts title="src/lib/products.ts" badgeLabel="Storefront" badgeColor="blue" highlights={[["19"]]}
```ts title="src/lib/data/products.ts" badgeLabel="Storefront" badgeColor="blue" highlights={[["19"]]}
export const listProducts = async ({
// ...
}: {
@@ -76,7 +76,7 @@ export const workflowHighlights = [
["16", "track", "Track the event in the installed Analytics Module Provider"]
]
```ts title="src/workflows/track-order-created.ts" highlights={workflowHighlights}
```ts title="src/workflows/track-order-placed.ts" highlights={workflowHighlights}
import { createWorkflow } from "@medusajs/framework/workflows-sdk"
import { createStep } from "@medusajs/framework/workflows-sdk"
import { useQueryGraphStep } from "@medusajs/medusa/core-flows"
@@ -87,13 +87,13 @@ type StepInput = {
order: OrderDTO
}
const trackOrderCreatedStep = createStep(
"track-order-created-step",
const trackOrderPlacedStep = createStep(
"track-order-placed-step",
async ({ order }: StepInput, { container }) => {
const analyticsModuleService = container.resolve(Modules.ANALYTICS)
await analyticsModuleService.track({
event: "order_created",
event: "order_placed",
actor_id: order.customer_id,
properties: {
order_id: order.id,
@@ -113,8 +113,8 @@ type WorkflowInput = {
order_id: string
}
export const trackOrderCreatedWorkflow = createWorkflow(
"track-order-created-workflow",
export const trackOrderPlacedWorkflow = createWorkflow(
"track-order-placed-workflow",
({ order_id }: WorkflowInput) => {
const { data: orders } = useQueryGraphStep({
entity: "order",
@@ -134,7 +134,7 @@ export const trackOrderCreatedWorkflow = createWorkflow(
)
```
This workflow retrieves the order details using the `useQueryGraphStep` and then tracks the order creation event using the `trackOrderCreatedStep`.
This workflow retrieves the order details using the `useQueryGraphStep` and then tracks the order placement event using the `trackOrderPlacedStep`.
In the step, you resolve the service of the Analytics Module from the [Medusa container](!docs!/learn/fundamentals/medusa-container) and use its `track` method to track the event. This method will use the underlying provider configured (which is the Local Analytics Module Provider, in this case) to track the event.
@@ -145,13 +145,13 @@ import type {
SubscriberArgs,
SubscriberConfig,
} from "@medusajs/framework"
import { trackOrderCreatedWorkflow } from "../workflows/track-order-created"
import { trackOrderPlacedWorkflow } from "../workflows/track-order-placed"
export default async function orderPlacedHandler({
event: { data },
container,
}: SubscriberArgs<{ id: string }>) {
await trackOrderCreatedWorkflow(container).run({
await trackOrderPlacedWorkflow(container).run({
input: {
order_id: data.id,
},
@@ -163,9 +163,9 @@ export const config: SubscriberConfig = {
}
```
This subscriber listens to the `order.placed` event and executes the `trackOrderCreatedWorkflow` workflow, passing the order ID as input.
This subscriber listens to the `order.placed` event and executes the `trackOrderPlacedWorkflow` workflow, passing the order ID as input.
You'll now track the order creation event whenever an order is placed in your Medusa application. You can test this out by placing an order and checking the server's logs for the tracked event.
You'll now track the order placement event whenever an order is placed in your Medusa application. You can test this out by placing an order and checking the server's logs for the tracked event.
---
@@ -103,7 +103,7 @@ export const workflowHighlights = [
["16", "track", "Track the event in the installed Analytics Module Provider"]
]
```ts title="src/workflows/track-order-created.ts" highlights={workflowHighlights}
```ts title="src/workflows/track-order-placed.ts" highlights={workflowHighlights}
import { createWorkflow } from "@medusajs/framework/workflows-sdk"
import { createStep } from "@medusajs/framework/workflows-sdk"
import { useQueryGraphStep } from "@medusajs/medusa/core-flows"
@@ -114,13 +114,13 @@ type StepInput = {
order: OrderDTO
}
const trackOrderCreatedStep = createStep(
"track-order-created-step",
const trackOrderPlacedStep = createStep(
"track-order-placed-step",
async ({ order }: StepInput, { container }) => {
const analyticsModuleService = container.resolve(Modules.ANALYTICS)
await analyticsModuleService.track({
event: "order_created",
event: "order_placed",
actor_id: order.customer_id,
properties: {
order_id: order.id,
@@ -140,8 +140,8 @@ type WorkflowInput = {
order_id: string
}
export const trackOrderCreatedWorkflow = createWorkflow(
"track-order-created-workflow",
export const trackOrderPlacedWorkflow = createWorkflow(
"track-order-placed-workflow",
({ order_id }: WorkflowInput) => {
const { data: orders } = useQueryGraphStep({
entity: "order",
@@ -161,7 +161,7 @@ export const trackOrderCreatedWorkflow = createWorkflow(
)
```
This workflow retrieves the order details using the `useQueryGraphStep` and then tracks the order creation event using the `trackOrderCreatedStep`.
This workflow retrieves the order details using the `useQueryGraphStep` and then tracks the order placement event using the `trackOrderPlacedStep`.
In the step, you resolve the service of the Analytics Module from the [Medusa container](!docs!/learn/fundamentals/medusa-container) and use its `track` method to track the event. This method will use the underlying provider configured in `medusa-config.ts` to track the event.
@@ -176,13 +176,13 @@ import type {
SubscriberArgs,
SubscriberConfig,
} from "@medusajs/framework"
import { trackOrderCreatedWorkflow } from "../workflows/track-order-created"
import { trackOrderPlacedWorkflow } from "../workflows/track-order-placed"
export default async function orderPlacedHandler({
event: { data },
container,
}: SubscriberArgs<{ id: string }>) {
await trackOrderCreatedWorkflow(container).run({
await trackOrderPlacedWorkflow(container).run({
input: {
order_id: data.id,
},
@@ -194,6 +194,6 @@ export const config: SubscriberConfig = {
}
```
This subscriber listens to the `order.placed` event and executes the `trackOrderCreatedWorkflow` workflow, passing the order ID as input.
This subscriber listens to the `order.placed` event and executes the `trackOrderPlacedWorkflow` workflow, passing the order ID as input.
You'll now track the order creation event whenever an order is placed in your Medusa application. You can test this out by placing an order and checking the provider you integrated with (for example, PostHog) for the tracked event.
You'll now track the order placement event whenever an order is placed in your Medusa application. You can test this out by placing an order and checking the provider you integrated with (for example, PostHog) for the tracked event.
@@ -132,7 +132,7 @@ export const workflowHighlights = [
["16", "track", "Track the event in the installed Analytics Module Provider"]
]
```ts title="src/workflows/track-order-created.ts" highlights={workflowHighlights}
```ts title="src/workflows/track-order-placed.ts" highlights={workflowHighlights}
import { createWorkflow } from "@medusajs/framework/workflows-sdk"
import { createStep } from "@medusajs/framework/workflows-sdk"
import { useQueryGraphStep } from "@medusajs/medusa/core-flows"
@@ -143,13 +143,13 @@ type StepInput = {
order: OrderDTO
}
const trackOrderCreatedStep = createStep(
"track-order-created-step",
const trackOrderPlacedStep = createStep(
"track-order-placed-step",
async ({ order }: StepInput, { container }) => {
const analyticsModuleService = container.resolve(Modules.ANALYTICS)
await analyticsModuleService.track({
event: "order_created",
event: "order_placed",
actor_id: order.customer_id,
properties: {
order_id: order.id,
@@ -169,8 +169,8 @@ type WorkflowInput = {
order_id: string
}
export const trackOrderCreatedWorkflow = createWorkflow(
"track-order-created-workflow",
export const trackOrderPlacedWorkflow = createWorkflow(
"track-order-placed-workflow",
({ order_id }: WorkflowInput) => {
const { data: orders } = useQueryGraphStep({
entity: "order",
@@ -190,7 +190,7 @@ export const trackOrderCreatedWorkflow = createWorkflow(
)
```
This workflow retrieves the order details using the `useQueryGraphStep` and then tracks the order creation event using the `trackOrderCreatedStep`.
This workflow retrieves the order details using the `useQueryGraphStep` and then tracks the order placement event using the `trackOrderPlacedStep`.
In the step, you resolve the service of the Analytics Module from the [Medusa container](!docs!/learn/fundamentals/medusa-container) and use its `track` method to track the event. This method will use the underlying provider configured (which is the PostHog Analytics Module Provider, in this case) to track the event.
@@ -201,13 +201,13 @@ import type {
SubscriberArgs,
SubscriberConfig,
} from "@medusajs/framework"
import { trackOrderCreatedWorkflow } from "../workflows/track-order-created"
import { trackOrderPlacedWorkflow } from "../workflows/track-order-placed"
export default async function orderPlacedHandler({
event: { data },
container,
}: SubscriberArgs<{ id: string }>) {
await trackOrderCreatedWorkflow(container).run({
await trackOrderPlacedWorkflow(container).run({
input: {
order_id: data.id,
},
@@ -219,9 +219,9 @@ export const config: SubscriberConfig = {
}
```
This subscriber listens to the `order.placed` event and executes the `trackOrderCreatedWorkflow` workflow, passing the order ID as input.
This subscriber listens to the `order.placed` event and executes the `trackOrderPlacedWorkflow` workflow, passing the order ID as input.
You'll now track the order creation event whenever an order is placed in your Medusa application. You can test this out by placing an order and checking your PostHog dashboard for the tracked event.
You'll now track the order placement event whenever an order is placed in your Medusa application. You can test this out by placing an order and checking your PostHog dashboard for the tracked event.
---
@@ -362,7 +362,6 @@ export const productCollectionHighlights = [
```ts title="src/collections/Products.ts" badgeLabel="Storefront" badgeColor="blue" highlights={productCollectionHighlights}
import { CollectionConfig } from "payload"
import { payloadMedusaSdk } from "../lib/payload-sdk"
export const Products: CollectionConfig = {
slug: "products",
@@ -1972,11 +1971,11 @@ In this step, you'll customize the Next.js Starter Storefront to view the produc
When you fetch product data in the Next.js Starter Storefront from the Medusa server, you can also retrieve the linked product data from Payload.
To do this, go to `src/lib/products.ts` in your Next.js Starter Storefront. You'll find a `listProducts` function that uses the JS SDK to fetch products from the Medusa server.
To do this, go to `src/lib/data/products.ts` in your Next.js Starter Storefront. You'll find a `listProducts` function that uses the JS SDK to fetch products from the Medusa server.
Find the `sdk.client.fetch` call and add `*payload_product` to the `fields` query parameter:
```ts title="src/lib/products.ts" badgeLabel="Storefront" badgeColor="blue" highlights={[["19"]]}
```ts title="src/lib/data/products.ts" badgeLabel="Storefront" badgeColor="blue" highlights={[["19"]]}
export const listProducts = async ({
// ...
}: {
+4 -4
View File
@@ -6484,9 +6484,9 @@ export const generatedEditDates = {
"app/commerce-modules/tax/tax-provider/page.mdx": "2025-05-20T07:51:40.711Z",
"app/recipes/bundled-products/examples/standard/page.mdx": "2025-06-26T11:52:18.819Z",
"app/recipes/bundled-products/page.mdx": "2025-05-20T07:51:40.718Z",
"app/infrastructure-modules/analytics/local/page.mdx": "2025-08-20T14:28:29.274Z",
"app/infrastructure-modules/analytics/page.mdx": "2025-08-20T14:25:57.537Z",
"app/infrastructure-modules/analytics/posthog/page.mdx": "2025-08-20T14:25:41.471Z",
"app/infrastructure-modules/analytics/local/page.mdx": "2025-08-21T05:30:26.867Z",
"app/infrastructure-modules/analytics/page.mdx": "2025-08-21T05:31:17.953Z",
"app/infrastructure-modules/analytics/posthog/page.mdx": "2025-08-21T05:30:12.983Z",
"references/analytics/interfaces/analytics.IAnalyticsModuleService/page.mdx": "2025-06-05T19:05:43.239Z",
"references/analytics_provider/classes/analytics_provider.AbstractAnalyticsProviderService/page.mdx": "2025-05-21T14:22:04.267Z",
"references/modules/analytics/page.mdx": "2025-05-21T14:21:59.323Z",
@@ -6566,6 +6566,6 @@ export const generatedEditDates = {
"app/commerce-modules/order/order-totals/page.mdx": "2025-07-31T15:12:10.633Z",
"app/commerce-modules/user/invite-user-subscriber/page.mdx": "2025-08-01T12:01:54.551Z",
"app/how-to-tutorials/tutorials/invoice-generator/page.mdx": "2025-08-04T00:00:00.000Z",
"app/integrations/guides/payload/page.mdx": "2025-08-20T14:48:19.359Z",
"app/integrations/guides/payload/page.mdx": "2025-08-21T05:24:11.537Z",
"references/js_sdk/admin/Client/methods/js_sdk.admin.Client.getToken/page.mdx": "2025-08-14T12:59:55.678Z"
}
@@ -11517,6 +11517,14 @@ const generatedgeneratedCommerceModulesSidebarSidebar = {
"path": "https://docs.medusajs.com/resources/how-to-tutorials/tutorials/product-reviews",
"children": []
},
{
"loaded": true,
"isPathHref": true,
"type": "ref",
"title": "Integrate Payload",
"path": "https://docs.medusajs.com/resources/integrations/guides/payload",
"children": []
},
{
"loaded": true,
"isPathHref": true,