feat(dashboard,js-sdk,medusa): add ability to add outbound items to claim (#8502)

what:

- user can add/remove/update outbound items to a claim
- adds API to query variants

Note: There are several paths that are not implemented yet correctly, but have some code lying around. Those will be tackled in the followup PRs

https://github.com/user-attachments/assets/cadb3f7a-982f-44c7-8d7e-9f4f26949f4f

RESOLVES CC-330
RESOLVES CC-296
This commit is contained in:
Riqwan Thamir
2024-08-08 14:20:13 +02:00
committed by GitHub
parent 9cd66bc842
commit 85ed025705
20 changed files with 1052 additions and 83 deletions
@@ -11,10 +11,12 @@ export * from "./fulfillment-providers"
export * from "./fulfillment-sets"
export * from "./inventory"
export * from "./invites"
export * from "./notification"
export * from "./orders"
export * from "./payments"
export * from "./price-lists"
export * from "./product-types"
export * from "./product-variants"
export * from "./products"
export * from "./promotions"
export * from "./regions"
@@ -29,4 +31,3 @@ export * from "./tax-rates"
export * from "./tax-regions"
export * from "./users"
export * from "./workflow-executions"
export * from "./notification"
@@ -0,0 +1,24 @@
import { QueryKey, useQuery, UseQueryOptions } from "@tanstack/react-query"
import { sdk } from "../../lib/client"
import { queryKeysFactory } from "../../lib/query-key-factory"
const PRODUCT_VARIANT_QUERY_KEY = "product_variant" as const
export const productVariantQueryKeys = queryKeysFactory(
PRODUCT_VARIANT_QUERY_KEY
)
export const useVariants = (
query?: Record<string, any>,
options?: Omit<
UseQueryOptions<any, Error, any, QueryKey>,
"queryFn" | "queryKey"
>
) => {
const { data, ...rest } = useQuery({
queryFn: () => sdk.admin.productVariant.list(query),
queryKey: productVariantQueryKeys.list(query),
...options,
})
return { ...data, ...rest }
}