docs: update imports and package names across docs (#9375)
* docs: update imports and package names across docs + reference configs * generate files * fix import * change preview to rc
This commit is contained in:
@@ -15,8 +15,8 @@ In this guide, you’ll find common examples of how you can use the Cart Module
|
||||
|
||||
```ts
|
||||
import { MedusaRequest, MedusaResponse } from "@medusajs/medusa"
|
||||
import { ICartModuleService } from "@medusajs/types"
|
||||
import { Modules } from "@medusajs/utils"
|
||||
import { ICartModuleService } from "@medusajs/framework/types"
|
||||
import { Modules } from "@medusajs/framework/utils"
|
||||
|
||||
export async function POST(
|
||||
req: MedusaRequest,
|
||||
@@ -51,7 +51,7 @@ export async function POST(
|
||||
```ts
|
||||
import { NextResponse } from "next/server"
|
||||
|
||||
import { initialize as initializeCartModule } from "@medusajs/cart"
|
||||
import { initialize as initializeCartModule } from "@medusajs/medusa/cart"
|
||||
|
||||
export async function POST(request: Request) {
|
||||
const cartModuleService = await initializeCartModule()
|
||||
@@ -89,8 +89,8 @@ export async function POST(request: Request) {
|
||||
|
||||
```ts
|
||||
import { MedusaRequest, MedusaResponse } from "@medusajs/medusa"
|
||||
import { ICartModuleService } from "@medusajs/types"
|
||||
import { Modules } from "@medusajs/utils"
|
||||
import { ICartModuleService } from "@medusajs/framework/types"
|
||||
import { Modules } from "@medusajs/framework/utils"
|
||||
|
||||
export async function GET(
|
||||
req: MedusaRequest,
|
||||
@@ -112,7 +112,7 @@ export async function GET(
|
||||
```ts
|
||||
import { NextResponse } from "next/server"
|
||||
|
||||
import { initialize as initializeCartModule } from "@medusajs/cart"
|
||||
import { initialize as initializeCartModule } from "@medusajs/medusa/cart"
|
||||
|
||||
export async function GET(request: Request) {
|
||||
const cartModuleService = await initializeCartModule()
|
||||
@@ -137,8 +137,8 @@ export async function GET(request: Request) {
|
||||
|
||||
```ts
|
||||
import { MedusaRequest, MedusaResponse } from "@medusajs/medusa"
|
||||
import { ICartModuleService } from "@medusajs/types"
|
||||
import { Modules } from "@medusajs/utils"
|
||||
import { ICartModuleService } from "@medusajs/framework/types"
|
||||
import { Modules } from "@medusajs/framework/utils"
|
||||
|
||||
export async function POST(
|
||||
req: MedusaRequest,
|
||||
@@ -167,7 +167,7 @@ export async function POST(
|
||||
```ts
|
||||
import { NextResponse } from "next/server"
|
||||
|
||||
import { initialize as initializeCartModule } from "@medusajs/cart"
|
||||
import { initialize as initializeCartModule } from "@medusajs/medusa/cart"
|
||||
|
||||
export async function POST(request: Request) {
|
||||
const cartModuleService = await initializeCartModule()
|
||||
@@ -197,8 +197,8 @@ export async function POST(request: Request) {
|
||||
|
||||
```ts
|
||||
import { MedusaRequest, MedusaResponse } from "@medusajs/medusa"
|
||||
import { ICartModuleService } from "@medusajs/types"
|
||||
import { Modules } from "@medusajs/utils"
|
||||
import { ICartModuleService } from "@medusajs/framework/types"
|
||||
import { Modules } from "@medusajs/framework/utils"
|
||||
|
||||
export async function POST(
|
||||
req: MedusaRequest,
|
||||
@@ -226,7 +226,7 @@ export async function POST(
|
||||
```ts
|
||||
import { NextResponse } from "next/server"
|
||||
|
||||
import { initialize as initializeCartModule } from "@medusajs/cart"
|
||||
import { initialize as initializeCartModule } from "@medusajs/medusa/cart"
|
||||
|
||||
export async function POST(request: Request) {
|
||||
const cartModuleService = await initializeCartModule()
|
||||
@@ -255,8 +255,8 @@ export async function POST(request: Request) {
|
||||
|
||||
```ts
|
||||
import { MedusaRequest, MedusaResponse } from "@medusajs/medusa"
|
||||
import { ICartModuleService } from "@medusajs/types"
|
||||
import { Modules } from "@medusajs/utils"
|
||||
import { ICartModuleService } from "@medusajs/framework/types"
|
||||
import { Modules } from "@medusajs/framework/utils"
|
||||
|
||||
export async function POST(
|
||||
req: MedusaRequest,
|
||||
@@ -284,7 +284,7 @@ export async function POST(
|
||||
```ts
|
||||
import { NextResponse } from "next/server"
|
||||
|
||||
import { initialize as initializeCartModule } from "@medusajs/cart"
|
||||
import { initialize as initializeCartModule } from "@medusajs/medusa/cart"
|
||||
|
||||
export async function POST(request: Request) {
|
||||
const cartModuleService = await initializeCartModule()
|
||||
@@ -313,8 +313,8 @@ export async function POST(request: Request) {
|
||||
|
||||
```ts
|
||||
import { MedusaRequest, MedusaResponse } from "@medusajs/medusa"
|
||||
import { ICartModuleService } from "@medusajs/types"
|
||||
import { Modules } from "@medusajs/utils"
|
||||
import { ICartModuleService } from "@medusajs/framework/types"
|
||||
import { Modules } from "@medusajs/framework/utils"
|
||||
|
||||
export async function POST(
|
||||
req: MedusaRequest,
|
||||
@@ -343,7 +343,7 @@ export async function POST(
|
||||
```ts
|
||||
import { NextResponse } from "next/server"
|
||||
|
||||
import { initialize as initializeCartModule } from "@medusajs/cart"
|
||||
import { initialize as initializeCartModule } from "@medusajs/medusa/cart"
|
||||
|
||||
export async function POST(request: Request) {
|
||||
const cartModuleService = await initializeCartModule()
|
||||
@@ -373,8 +373,8 @@ export async function POST(request: Request) {
|
||||
|
||||
```ts
|
||||
import { MedusaRequest, MedusaResponse } from "@medusajs/medusa"
|
||||
import { ICartModuleService } from "@medusajs/types"
|
||||
import { Modules } from "@medusajs/utils"
|
||||
import { ICartModuleService } from "@medusajs/framework/types"
|
||||
import { Modules } from "@medusajs/framework/utils"
|
||||
|
||||
export async function DELETE(
|
||||
req: MedusaRequest,
|
||||
@@ -396,7 +396,7 @@ export async function DELETE(
|
||||
```ts
|
||||
import { NextResponse } from "next/server"
|
||||
|
||||
import { initialize as initializeCartModule } from "@medusajs/cart"
|
||||
import { initialize as initializeCartModule } from "@medusajs/medusa/cart"
|
||||
|
||||
export async function DELETE(request: Request) {
|
||||
const cartModuleService = await initializeCartModule()
|
||||
@@ -417,8 +417,8 @@ export async function DELETE(request: Request) {
|
||||
|
||||
```ts
|
||||
import { MedusaRequest, MedusaResponse } from "@medusajs/medusa"
|
||||
import { ICartModuleService } from "@medusajs/types"
|
||||
import { Modules } from "@medusajs/utils"
|
||||
import { ICartModuleService } from "@medusajs/framework/types"
|
||||
import { Modules } from "@medusajs/framework/utils"
|
||||
|
||||
export async function DELETE(
|
||||
req: MedusaRequest,
|
||||
@@ -439,8 +439,8 @@ export async function DELETE(
|
||||
|
||||
```ts
|
||||
import { MedusaRequest, MedusaResponse } from "@medusajs/medusa"
|
||||
import { ICartModuleService } from "@medusajs/types"
|
||||
import { Modules } from "@medusajs/utils"
|
||||
import { ICartModuleService } from "@medusajs/framework/types"
|
||||
import { Modules } from "@medusajs/framework/utils"
|
||||
|
||||
export async function DELETE(
|
||||
req: MedusaRequest,
|
||||
|
||||
@@ -6,11 +6,11 @@ export const metadata = {
|
||||
|
||||
# {metadata.title}
|
||||
|
||||
The Cart Module is the `@medusajs/cart` NPM package that provides cart-related features in your Medusa and Node.js applications.
|
||||
The Cart Module is the `@medusajs/medusa/cart` NPM package that provides cart-related features in your Medusa and Node.js applications.
|
||||
|
||||
## How to Use Cart Module's Service
|
||||
|
||||
You can use the Cart Module's main service by resolving from the Medusa container the resource `Modules.CART` imported from `@medusajs/utils`.
|
||||
You can use the Cart Module's main service by resolving from the Medusa container the resource `Modules.CART` imported from `@medusajs/framework/utils`.
|
||||
|
||||
For example:
|
||||
|
||||
@@ -19,8 +19,8 @@ For example:
|
||||
|
||||
```ts title="src/api/store/custom/route.ts"
|
||||
import { MedusaRequest, MedusaResponse } from "@medusajs/medusa"
|
||||
import { ICartModuleService } from "@medusajs/types"
|
||||
import { Modules } from "@medusajs/utils"
|
||||
import { ICartModuleService } from "@medusajs/framework/types"
|
||||
import { Modules } from "@medusajs/framework/utils"
|
||||
|
||||
export async function GET(
|
||||
req: MedusaRequest,
|
||||
@@ -41,8 +41,8 @@ export async function GET(
|
||||
|
||||
```ts title="src/subscribers/custom-handler.ts"
|
||||
import { SubscriberArgs } from "@medusajs/medusa"
|
||||
import { ICartModuleService } from "@medusajs/types"
|
||||
import { Modules } from "@medusajs/utils"
|
||||
import { ICartModuleService } from "@medusajs/framework/types"
|
||||
import { Modules } from "@medusajs/framework/utils"
|
||||
|
||||
export default async function subscriberHandler({ container }: SubscriberArgs) {
|
||||
const cartModuleService: ICartModuleService = container.resolve(
|
||||
@@ -57,9 +57,9 @@ export default async function subscriberHandler({ container }: SubscriberArgs) {
|
||||
<CodeTab label="Workflow Step" value="workflow-step">
|
||||
|
||||
```ts title="src/workflows/hello-world/step1.ts"
|
||||
import { createStep } from "@medusajs/workflows-sdk"
|
||||
import { ICartModuleService } from "@medusajs/types"
|
||||
import { Modules } from "@medusajs/utils"
|
||||
import { createStep } from "@medusajs/framework/workflows-sdk"
|
||||
import { ICartModuleService } from "@medusajs/framework/types"
|
||||
import { Modules } from "@medusajs/framework/utils"
|
||||
|
||||
const step1 = createStep("step-1", async (_, { container }) => {
|
||||
const cartModuleService: ICartModuleService = container.resolve(
|
||||
|
||||
@@ -47,7 +47,7 @@ import {
|
||||
ComputeActionItemLine,
|
||||
ComputeActionShippingLine,
|
||||
// ...
|
||||
} from "@medusajs/types"
|
||||
} from "@medusajs/framework/types"
|
||||
|
||||
// retrieve the cart
|
||||
const cart = await cartModuleService.retrieveCart("cart_123", {
|
||||
@@ -106,7 +106,7 @@ import {
|
||||
AddItemAdjustmentAction,
|
||||
AddShippingMethodAdjustment,
|
||||
// ...
|
||||
} from "@medusajs/types"
|
||||
} from "@medusajs/framework/types"
|
||||
|
||||
// ...
|
||||
|
||||
|
||||
Reference in New Issue
Block a user