Skip to content

Commit

Permalink
Merge branch 'develop' into feat/order-events
Browse files Browse the repository at this point in the history
  • Loading branch information
carlos-r-l-rodrigues authored Oct 21, 2024
2 parents dc851f5 + a0668ad commit 2cce855
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 183 deletions.
101 changes: 0 additions & 101 deletions packages/admin/dashboard/src/hooks/api/exchanges.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -118,107 +118,6 @@ export const useCancelExchange = (
})
}

export const useDeleteExchange = (
id: string,
orderId: string,
options?: UseMutationOptions<
HttpTypes.AdminExchangeDeleteResponse,
FetchError
>
) => {
return useMutation({
mutationFn: () => sdk.admin.exchange.delete(id),
onSuccess: (data: any, variables: any, context: any) => {
queryClient.invalidateQueries({
queryKey: ordersQueryKeys.details(),
})

queryClient.invalidateQueries({
queryKey: ordersQueryKeys.preview(orderId),
})

queryClient.invalidateQueries({
queryKey: exchangesQueryKeys.details(),
})
queryClient.invalidateQueries({
queryKey: exchangesQueryKeys.lists(),
})
options?.onSuccess?.(data, variables, context)
},
...options,
})
}

export const useAddExchangeItems = (
id: string,
orderId: string,
options?: UseMutationOptions<
HttpTypes.AdminExchangeResponse,
FetchError,
HttpTypes.AdminAddExchangeItems
>
) => {
return useMutation({
mutationFn: (payload: HttpTypes.AdminAddExchangeItems) =>
sdk.admin.exchange.addItems(id, payload),
onSuccess: (data: any, variables: any, context: any) => {
queryClient.invalidateQueries({
queryKey: ordersQueryKeys.preview(orderId),
})
options?.onSuccess?.(data, variables, context)
},
...options,
})
}

export const useUpdateExchangeItems = (
id: string,
orderId: string,
options?: UseMutationOptions<
HttpTypes.AdminExchangeResponse,
FetchError,
HttpTypes.AdminUpdateExchangeItem & { actionId: string }
>
) => {
return useMutation({
mutationFn: ({
actionId,
...payload
}: HttpTypes.AdminUpdateExchangeItem & { actionId: string }) => {
return sdk.admin.exchange.updateItem(id, actionId, payload)
},
onSuccess: (data: any, variables: any, context: any) => {
queryClient.invalidateQueries({
queryKey: ordersQueryKeys.preview(orderId),
})
options?.onSuccess?.(data, variables, context)
},
...options,
})
}

export const useRemoveExchangeItem = (
id: string,
orderId: string,
options?: UseMutationOptions<
HttpTypes.AdminReturnResponse,
FetchError,
string
>
) => {
return useMutation({
mutationFn: (actionId: string) =>
sdk.admin.return.removeReturnItem(id, actionId),
onSuccess: (data: any, variables: any, context: any) => {
queryClient.invalidateQueries({
queryKey: ordersQueryKeys.preview(orderId),
})
options?.onSuccess?.(data, variables, context)
},
...options,
})
}

export const useAddExchangeInboundItems = (
id: string,
orderId: string,
Expand Down
66 changes: 0 additions & 66 deletions packages/core/js-sdk/src/admin/exchange.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,72 +73,6 @@ export class Exchange {
)
}

async delete(
id: string,
query?: HttpTypes.SelectParams,
headers?: ClientHeaders
) {
return await this.client.fetch<HttpTypes.AdminExchangeDeleteResponse>(
`/admin/exchanges/${id}`,
{
method: "DELETE",
headers,
query,
}
)
}

async addItems(
id: string,
body: HttpTypes.AdminAddExchangeItems,
query?: HttpTypes.SelectParams,
headers?: ClientHeaders
) {
return await this.client.fetch<HttpTypes.AdminExchangeResponse>(
`/admin/exchanges/${id}/exchange-items`,
{
method: "POST",
headers,
body,
query,
}
)
}

async updateItem(
id: string,
actionId: string,
body: HttpTypes.AdminUpdateExchangeItem,
query?: HttpTypes.SelectParams,
headers?: ClientHeaders
) {
return await this.client.fetch<HttpTypes.AdminExchangeResponse>(
`/admin/exchanges/${id}/exchange-items/${actionId}`,
{
method: "POST",
headers,
body,
query,
}
)
}

async removeItem(
id: string,
actionId: string,
query?: HttpTypes.SelectParams,
headers?: ClientHeaders
) {
return await this.client.fetch<HttpTypes.AdminReturnResponse>(
`/admin/exchanges/${id}/exchange-items/${actionId}`,
{
method: "DELETE",
headers,
query,
}
)
}

async addInboundItems(
id: string,
body: HttpTypes.AdminAddExchangeInboundItems,
Expand Down
3 changes: 0 additions & 3 deletions packages/core/types/src/http/exchange/admin/payloads.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,6 @@ export interface AdminCreateExchange {
metadata?: Record<string, unknown> | null
}

export interface AdminAddExchangeItems extends AdminExchangeAddItems {}
export interface AdminUpdateExchangeItem extends AdminExchangeUpdateItem {}

export interface AdminAddExchangeInboundItems extends AdminExchangeAddItems {}
export interface AdminUpdateExchangeInboundItem
extends AdminExchangeUpdateItem {}
Expand Down
27 changes: 14 additions & 13 deletions www/apps/book/app/learn/page.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,17 @@ export const metadata = {

# {pageNumber} Introduction

Medusa is a digital commerce platform with a built-in framework for customizations and integrations.
Medusa is a digital commerce platform with a built-in framework for customization.

Medusa's framework includes two types of tools:
Medusa ships with three main tools:

1. Modules that provide commerce functionalities, such as Product, Order, and Cart modules.
2. Customization tools to build your business features, such as custom data models, business logic, flows, and endpoints.
1. A suite of commerce modules that provide core commerce functionalities, such as tracking inventory, calculating cart totals, accepting payments, managing orders, and much more.
2. A framework to build custom functionalities specific to your business, product, or industry. This includes tools for introducing custom API endpoints, business logic, and data models; building workflows and automations; and integrating with third-party services.
3. A customizable admin dashboard for merchants to configure and operate their store.

With these tools, you save time you would spend with other platforms on maintaining and setting up your customizations. Instead, you rapidly build important features for your business.
When you start Medusa the first time you get a fully fledged commerce platform with all the features you need to get off the ground.

However, unlike other platforms, Medusa is built with customization in mind. You don't need to build hacky workarounds that are difficult to maintain and scale. Instead, you can focus on building features that brings your business's vision to life.

---

Expand Down Expand Up @@ -44,13 +47,11 @@ npx create-medusa-app@rc

---

## Who is Medusa for
## Who should use Medusa

Medusa is for ambitious businesses and developers that are limited by traditional ecommerce solutions:
Medusa is for businesses with unique requirements that other digital commerce platforms can't easily support. Businesses of any size can use Medusa, from small startups to large enterprises - all it takes is a developer to manage and deploy your project.

- You want rich commerce features that are customizable and flexible enough to support your business use case as if you built them from scratch.
- You want your custom requirements built as an integral part of the commerce application’s features and architecture, rather than hacked into it.
- You want to customize your commerce flows by integrating external services without data inconsistency and irregularity.
Below are some stories from companies that use Medusa:

<CardList items={[
{
Expand Down Expand Up @@ -95,14 +96,14 @@ Medusa is for ambitious businesses and developers that are limited by traditiona

## Who is this documentation for

This documentation is for TypeScript or JavaScript developers looking to master Medusa and build their commerce applications. By following this documentation, you’ll learn about Medusas concepts, from basic to advanced, with easy-to-follow examples to assist you along the way.
This documentation is for developers looking to master Medusa. The documentation is structured to gradually introduce Medusa's concepts, from basic to advanced, with easy-to-follow examples to assist you along the way.

By the end of this documentation, you’ll be an expert Medusa developer, leading teams using Medusa from the development till production.
By the end of this documentation, you’ll be able to create custom commerce experiences that would otherwise take large engineering teams months to build.

### How to use the documentation

The documentation for Medusa v2 is split into the following sections:

1. The main documentation, which is the one you're currently viewing. It's highly recommended to follow all the chapters in this documentation before jumping into other documentation sections.
1. The main documentation, which is the one you're currently viewing. It's recommended to follow the chapters in this documentation to understand the core concepts of Medusa and how to use them.
2. The [Development Resources documentation](!resources!) provides guides and resources useful during your development, such as tools, API references, recipes, step-by-step guides and examples, and more.
3. The [Store](!api!/store) and [Admin](!api!/admin) API references provide a reference to the Medusa application's endpoints and instructions related to authentication, parameter types, and more.

0 comments on commit 2cce855

Please sign in to comment.