feat(dashboard, types, js-sdk): Claims client, hooks and types (#8370)
This commit is contained in:
1 parent
31449972ed
commit
7b86fc2176
13 files changed
+1054
-6
No files matched your search
@@ -0,0 +1,531 @@
|
|||||||
|
import {
|
||||||
|
QueryKey,
|
||||||
|
useMutation,
|
||||||
|
UseMutationOptions,
|
||||||
|
useQuery,
|
||||||
|
UseQueryOptions,
|
||||||
|
} from "@tanstack/react-query"
|
||||||
|
import { HttpTypes } from "@medusajs/types"
|
||||||
|
|
||||||
|
import { sdk } from "../../lib/client"
|
||||||
|
import { queryClient } from "../../lib/query-client"
|
||||||
|
import { ordersQueryKeys } from "./orders"
|
||||||
|
import { queryKeysFactory } from "../../lib/query-key-factory"
|
||||||
|
|
||||||
|
const CLAIMS_QUERY_KEY = "claims" as const
|
||||||
|
export const claimsQueryKeys = queryKeysFactory(CLAIMS_QUERY_KEY)
|
||||||
|
|
||||||
|
export const useClaim = (
|
||||||
|
id: string,
|
||||||
|
query?: Record<string, any>,
|
||||||
|
options?: Omit<
|
||||||
|
UseQueryOptions<any, Error, any, QueryKey>,
|
||||||
|
"queryFn" | "queryKey"
|
||||||
|
>
|
||||||
|
) => {
|
||||||
|
const { data, ...rest } = useQuery({
|
||||||
|
queryFn: async () => sdk.admin.claim.retrieve(id, query),
|
||||||
|
queryKey: claimsQueryKeys.detail(id, query),
|
||||||
|
...options,
|
||||||
|
})
|
||||||
|
|
||||||
|
return { ...data, ...rest }
|
||||||
|
}
|
||||||
|
|
||||||
|
export const useClaims = (
|
||||||
|
query?: HttpTypes.AdminClaimListParams,
|
||||||
|
options?: Omit<
|
||||||
|
UseQueryOptions<
|
||||||
|
HttpTypes.AdminClaimListParams,
|
||||||
|
Error,
|
||||||
|
HttpTypes.AdminClaimListResponse,
|
||||||
|
QueryKey
|
||||||
|
>,
|
||||||
|
"queryFn" | "queryKey"
|
||||||
|
>
|
||||||
|
) => {
|
||||||
|
const { data, ...rest } = useQuery({
|
||||||
|
queryFn: async () => sdk.admin.claim.list(query),
|
||||||
|
queryKey: claimsQueryKeys.list(query),
|
||||||
|
...options,
|
||||||
|
})
|
||||||
|
|
||||||
|
return { ...data, ...rest }
|
||||||
|
}
|
||||||
|
|
||||||
|
export const useCreateClaim = (
|
||||||
|
orderId: string,
|
||||||
|
options?: UseMutationOptions<
|
||||||
|
HttpTypes.AdminClaimResponse,
|
||||||
|
Error,
|
||||||
|
HttpTypes.AdminCreateClaim
|
||||||
|
>
|
||||||
|
) => {
|
||||||
|
return useMutation({
|
||||||
|
mutationFn: (payload: HttpTypes.AdminCreateClaim) =>
|
||||||
|
sdk.admin.claim.create(payload),
|
||||||
|
onSuccess: (data: any, variables: any, context: any) => {
|
||||||
|
queryClient.invalidateQueries({
|
||||||
|
queryKey: ordersQueryKeys.details(),
|
||||||
|
})
|
||||||
|
queryClient.invalidateQueries({
|
||||||
|
queryKey: ordersQueryKeys.lists(),
|
||||||
|
})
|
||||||
|
|
||||||
|
queryClient.invalidateQueries({
|
||||||
|
queryKey: ordersQueryKeys.preview(orderId),
|
||||||
|
})
|
||||||
|
options?.onSuccess?.(data, variables, context)
|
||||||
|
},
|
||||||
|
...options,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export const useCancelClaim = (
|
||||||
|
id: string,
|
||||||
|
orderId: string,
|
||||||
|
options?: UseMutationOptions<HttpTypes.AdminClaimResponse, Error>
|
||||||
|
) => {
|
||||||
|
return useMutation({
|
||||||
|
mutationFn: () => sdk.admin.claim.cancel(id),
|
||||||
|
onSuccess: (data: any, variables: any, context: any) => {
|
||||||
|
queryClient.invalidateQueries({
|
||||||
|
queryKey: ordersQueryKeys.details(),
|
||||||
|
})
|
||||||
|
queryClient.invalidateQueries({
|
||||||
|
queryKey: ordersQueryKeys.lists(),
|
||||||
|
})
|
||||||
|
|
||||||
|
queryClient.invalidateQueries({
|
||||||
|
queryKey: ordersQueryKeys.preview(orderId),
|
||||||
|
})
|
||||||
|
|
||||||
|
queryClient.invalidateQueries({
|
||||||
|
queryKey: claimsQueryKeys.details(),
|
||||||
|
})
|
||||||
|
queryClient.invalidateQueries({
|
||||||
|
queryKey: claimsQueryKeys.lists(),
|
||||||
|
})
|
||||||
|
options?.onSuccess?.(data, variables, context)
|
||||||
|
},
|
||||||
|
...options,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export const useDeleteClaim = (
|
||||||
|
id: string,
|
||||||
|
orderId: string,
|
||||||
|
options?: UseMutationOptions<HttpTypes.AdminClaimDeleteResponse, Error>
|
||||||
|
) => {
|
||||||
|
return useMutation({
|
||||||
|
mutationFn: () => sdk.admin.claim.delete(id),
|
||||||
|
onSuccess: (data: any, variables: any, context: any) => {
|
||||||
|
queryClient.invalidateQueries({
|
||||||
|
queryKey: ordersQueryKeys.details(),
|
||||||
|
})
|
||||||
|
queryClient.invalidateQueries({
|
||||||
|
queryKey: ordersQueryKeys.lists(),
|
||||||
|
})
|
||||||
|
|
||||||
|
queryClient.invalidateQueries({
|
||||||
|
queryKey: ordersQueryKeys.preview(orderId),
|
||||||
|
})
|
||||||
|
|
||||||
|
queryClient.invalidateQueries({
|
||||||
|
queryKey: claimsQueryKeys.details(),
|
||||||
|
})
|
||||||
|
queryClient.invalidateQueries({
|
||||||
|
queryKey: claimsQueryKeys.lists(),
|
||||||
|
})
|
||||||
|
options?.onSuccess?.(data, variables, context)
|
||||||
|
},
|
||||||
|
...options,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export const useAddClaimItems = (
|
||||||
|
id: string,
|
||||||
|
orderId: string,
|
||||||
|
options?: UseMutationOptions<
|
||||||
|
HttpTypes.AdminClaimResponse,
|
||||||
|
Error,
|
||||||
|
HttpTypes.AdminAddClaimItems
|
||||||
|
>
|
||||||
|
) => {
|
||||||
|
return useMutation({
|
||||||
|
mutationFn: (payload: HttpTypes.AdminAddClaimItems) =>
|
||||||
|
sdk.admin.claim.addItems(id, payload),
|
||||||
|
onSuccess: (data: any, variables: any, context: any) => {
|
||||||
|
queryClient.invalidateQueries({
|
||||||
|
queryKey: ordersQueryKeys.preview(orderId),
|
||||||
|
})
|
||||||
|
options?.onSuccess?.(data, variables, context)
|
||||||
|
},
|
||||||
|
...options,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export const useUpdateClaimItems = (
|
||||||
|
id: string,
|
||||||
|
orderId: string,
|
||||||
|
options?: UseMutationOptions<
|
||||||
|
HttpTypes.AdminClaimResponse,
|
||||||
|
Error,
|
||||||
|
HttpTypes.AdminUpdateClaimItem & { actionId: string }
|
||||||
|
>
|
||||||
|
) => {
|
||||||
|
return useMutation({
|
||||||
|
mutationFn: ({
|
||||||
|
actionId,
|
||||||
|
...payload
|
||||||
|
}: HttpTypes.AdminUpdateClaimItem & { actionId: string }) => {
|
||||||
|
return sdk.admin.claim.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 useRemoveClaimItem = (
|
||||||
|
id: string,
|
||||||
|
orderId: string,
|
||||||
|
options?: UseMutationOptions<HttpTypes.AdminReturnResponse, Error, 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 useAddClaimInboundItems = (
|
||||||
|
id: string,
|
||||||
|
orderId: string,
|
||||||
|
options?: UseMutationOptions<
|
||||||
|
HttpTypes.AdminClaimResponse,
|
||||||
|
Error,
|
||||||
|
HttpTypes.AdminAddClaimInboundItems
|
||||||
|
>
|
||||||
|
) => {
|
||||||
|
return useMutation({
|
||||||
|
mutationFn: (payload: HttpTypes.AdminAddClaimInboundItems) =>
|
||||||
|
sdk.admin.claim.addInboundItems(id, payload),
|
||||||
|
onSuccess: (data: any, variables: any, context: any) => {
|
||||||
|
queryClient.invalidateQueries({
|
||||||
|
queryKey: ordersQueryKeys.preview(orderId),
|
||||||
|
})
|
||||||
|
options?.onSuccess?.(data, variables, context)
|
||||||
|
},
|
||||||
|
...options,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export const useUpdateClaimInboundItems = (
|
||||||
|
id: string,
|
||||||
|
orderId: string,
|
||||||
|
options?: UseMutationOptions<
|
||||||
|
HttpTypes.AdminClaimResponse,
|
||||||
|
Error,
|
||||||
|
HttpTypes.AdminUpdateClaimInboundItem & { actionId: string }
|
||||||
|
>
|
||||||
|
) => {
|
||||||
|
return useMutation({
|
||||||
|
mutationFn: ({
|
||||||
|
actionId,
|
||||||
|
...payload
|
||||||
|
}: HttpTypes.AdminUpdateClaimInboundItem & { actionId: string }) => {
|
||||||
|
return sdk.admin.claim.updateInboundItem(id, actionId, payload)
|
||||||
|
},
|
||||||
|
onSuccess: (data: any, variables: any, context: any) => {
|
||||||
|
queryClient.invalidateQueries({
|
||||||
|
queryKey: ordersQueryKeys.preview(orderId),
|
||||||
|
})
|
||||||
|
options?.onSuccess?.(data, variables, context)
|
||||||
|
},
|
||||||
|
...options,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export const useRemoveClaimInboundItem = (
|
||||||
|
id: string,
|
||||||
|
orderId: string,
|
||||||
|
options?: UseMutationOptions<HttpTypes.AdminClaimResponse, Error, string>
|
||||||
|
) => {
|
||||||
|
return useMutation({
|
||||||
|
mutationFn: (actionId: string) =>
|
||||||
|
sdk.admin.claim.removeInboundItem(id, actionId),
|
||||||
|
onSuccess: (data: any, variables: any, context: any) => {
|
||||||
|
queryClient.invalidateQueries({
|
||||||
|
queryKey: ordersQueryKeys.preview(orderId),
|
||||||
|
})
|
||||||
|
options?.onSuccess?.(data, variables, context)
|
||||||
|
},
|
||||||
|
...options,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export const useAddClaimInboundShipping = (
|
||||||
|
id: string,
|
||||||
|
orderId: string,
|
||||||
|
options?: UseMutationOptions<
|
||||||
|
HttpTypes.AdminClaimResponse,
|
||||||
|
Error,
|
||||||
|
HttpTypes.AdminClaimAddInboundShipping
|
||||||
|
>
|
||||||
|
) => {
|
||||||
|
return useMutation({
|
||||||
|
mutationFn: (payload: HttpTypes.AdminClaimAddInboundShipping) =>
|
||||||
|
sdk.admin.claim.addInboundShipping(id, payload),
|
||||||
|
onSuccess: (data: any, variables: any, context: any) => {
|
||||||
|
queryClient.invalidateQueries({
|
||||||
|
queryKey: ordersQueryKeys.preview(orderId),
|
||||||
|
})
|
||||||
|
options?.onSuccess?.(data, variables, context)
|
||||||
|
},
|
||||||
|
...options,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export const useUpdateClaimInboundShipping = (
|
||||||
|
id: string,
|
||||||
|
orderId: string,
|
||||||
|
options?: UseMutationOptions<
|
||||||
|
HttpTypes.AdminClaimResponse,
|
||||||
|
Error,
|
||||||
|
HttpTypes.AdminClaimUpdateInboundShipping
|
||||||
|
>
|
||||||
|
) => {
|
||||||
|
return useMutation({
|
||||||
|
mutationFn: ({
|
||||||
|
actionId,
|
||||||
|
...payload
|
||||||
|
}: HttpTypes.AdminClaimUpdateInboundShipping & { actionId: string }) =>
|
||||||
|
sdk.admin.claim.updateInboundShipping(id, actionId, payload),
|
||||||
|
onSuccess: (data: any, variables: any, context: any) => {
|
||||||
|
queryClient.invalidateQueries({
|
||||||
|
queryKey: ordersQueryKeys.preview(orderId),
|
||||||
|
})
|
||||||
|
options?.onSuccess?.(data, variables, context)
|
||||||
|
},
|
||||||
|
...options,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export const useDeleteClaimInboundShipping = (
|
||||||
|
id: string,
|
||||||
|
orderId: string,
|
||||||
|
options?: UseMutationOptions<HttpTypes.AdminClaimResponse, Error, string>
|
||||||
|
) => {
|
||||||
|
return useMutation({
|
||||||
|
mutationFn: (actionId: string) =>
|
||||||
|
sdk.admin.claim.deleteInboundShipping(id, actionId),
|
||||||
|
onSuccess: (data: any, variables: any, context: any) => {
|
||||||
|
queryClient.invalidateQueries({
|
||||||
|
queryKey: ordersQueryKeys.preview(orderId),
|
||||||
|
})
|
||||||
|
options?.onSuccess?.(data, variables, context)
|
||||||
|
},
|
||||||
|
...options,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export const useAddClaimOutboundItems = (
|
||||||
|
id: string,
|
||||||
|
orderId: string,
|
||||||
|
options?: UseMutationOptions<
|
||||||
|
HttpTypes.AdminClaimResponse,
|
||||||
|
Error,
|
||||||
|
HttpTypes.AdminAddClaimOutboundItems
|
||||||
|
>
|
||||||
|
) => {
|
||||||
|
return useMutation({
|
||||||
|
mutationFn: (payload: HttpTypes.AdminAddClaimOutboundItems) =>
|
||||||
|
sdk.admin.claim.addOutboundItems(id, payload),
|
||||||
|
onSuccess: (data: any, variables: any, context: any) => {
|
||||||
|
queryClient.invalidateQueries({
|
||||||
|
queryKey: ordersQueryKeys.preview(orderId),
|
||||||
|
})
|
||||||
|
options?.onSuccess?.(data, variables, context)
|
||||||
|
},
|
||||||
|
...options,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export const useUpdateClaimOutboundItems = (
|
||||||
|
id: string,
|
||||||
|
orderId: string,
|
||||||
|
options?: UseMutationOptions<
|
||||||
|
HttpTypes.AdminClaimResponse,
|
||||||
|
Error,
|
||||||
|
HttpTypes.AdminUpdateClaimOutboundItem & { actionId: string }
|
||||||
|
>
|
||||||
|
) => {
|
||||||
|
return useMutation({
|
||||||
|
mutationFn: ({
|
||||||
|
actionId,
|
||||||
|
...payload
|
||||||
|
}: HttpTypes.AdminUpdateClaimOutboundItem & { actionId: string }) => {
|
||||||
|
return sdk.admin.claim.updateOutboundItem(id, actionId, payload)
|
||||||
|
},
|
||||||
|
onSuccess: (data: any, variables: any, context: any) => {
|
||||||
|
queryClient.invalidateQueries({
|
||||||
|
queryKey: ordersQueryKeys.preview(orderId),
|
||||||
|
})
|
||||||
|
options?.onSuccess?.(data, variables, context)
|
||||||
|
},
|
||||||
|
...options,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export const useRemoveClaimOutboundItem = (
|
||||||
|
id: string,
|
||||||
|
orderId: string,
|
||||||
|
options?: UseMutationOptions<HttpTypes.AdminClaimResponse, Error, string>
|
||||||
|
) => {
|
||||||
|
return useMutation({
|
||||||
|
mutationFn: (actionId: string) =>
|
||||||
|
sdk.admin.claim.removeOutboundItem(id, actionId),
|
||||||
|
onSuccess: (data: any, variables: any, context: any) => {
|
||||||
|
queryClient.invalidateQueries({
|
||||||
|
queryKey: ordersQueryKeys.preview(orderId),
|
||||||
|
})
|
||||||
|
options?.onSuccess?.(data, variables, context)
|
||||||
|
},
|
||||||
|
...options,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export const useAddClaimOutboundShipping = (
|
||||||
|
id: string,
|
||||||
|
orderId: string,
|
||||||
|
options?: UseMutationOptions<
|
||||||
|
HttpTypes.AdminClaimResponse,
|
||||||
|
Error,
|
||||||
|
HttpTypes.AdminClaimAddOutboundShipping
|
||||||
|
>
|
||||||
|
) => {
|
||||||
|
return useMutation({
|
||||||
|
mutationFn: (payload: HttpTypes.AdminClaimAddOutboundShipping) =>
|
||||||
|
sdk.admin.claim.addOutboundShipping(id, payload),
|
||||||
|
onSuccess: (data: any, variables: any, context: any) => {
|
||||||
|
queryClient.invalidateQueries({
|
||||||
|
queryKey: ordersQueryKeys.preview(orderId),
|
||||||
|
})
|
||||||
|
options?.onSuccess?.(data, variables, context)
|
||||||
|
},
|
||||||
|
...options,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export const useUpdateClaimOutboundShipping = (
|
||||||
|
id: string,
|
||||||
|
orderId: string,
|
||||||
|
options?: UseMutationOptions<
|
||||||
|
HttpTypes.AdminClaimResponse,
|
||||||
|
Error,
|
||||||
|
HttpTypes.AdminClaimUpdateOutboundShipping
|
||||||
|
>
|
||||||
|
) => {
|
||||||
|
return useMutation({
|
||||||
|
mutationFn: ({
|
||||||
|
actionId,
|
||||||
|
...payload
|
||||||
|
}: HttpTypes.AdminClaimUpdateOutboundShipping & { actionId: string }) =>
|
||||||
|
sdk.admin.claim.updateOutboundShipping(id, actionId, payload),
|
||||||
|
onSuccess: (data: any, variables: any, context: any) => {
|
||||||
|
queryClient.invalidateQueries({
|
||||||
|
queryKey: ordersQueryKeys.preview(orderId),
|
||||||
|
})
|
||||||
|
options?.onSuccess?.(data, variables, context)
|
||||||
|
},
|
||||||
|
...options,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export const useDeleteClaimOutboundShipping = (
|
||||||
|
id: string,
|
||||||
|
orderId: string,
|
||||||
|
options?: UseMutationOptions<HttpTypes.AdminClaimResponse, Error, string>
|
||||||
|
) => {
|
||||||
|
return useMutation({
|
||||||
|
mutationFn: (actionId: string) =>
|
||||||
|
sdk.admin.claim.deleteOutboundShipping(id, actionId),
|
||||||
|
onSuccess: (data: any, variables: any, context: any) => {
|
||||||
|
queryClient.invalidateQueries({
|
||||||
|
queryKey: ordersQueryKeys.preview(orderId),
|
||||||
|
})
|
||||||
|
options?.onSuccess?.(data, variables, context)
|
||||||
|
},
|
||||||
|
...options,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export const useRequestClaim = (
|
||||||
|
id: string,
|
||||||
|
options?: UseMutationOptions<
|
||||||
|
HttpTypes.AdminClaimResponse,
|
||||||
|
Error,
|
||||||
|
HttpTypes.AdminRequestClaim
|
||||||
|
>
|
||||||
|
) => {
|
||||||
|
return useMutation({
|
||||||
|
mutationFn: (payload: HttpTypes.AdminRequestClaim) =>
|
||||||
|
sdk.admin.claim.request(id, payload),
|
||||||
|
onSuccess: (data: any, variables: any, context: any) => {
|
||||||
|
queryClient.invalidateQueries({
|
||||||
|
queryKey: ordersQueryKeys.details(),
|
||||||
|
})
|
||||||
|
queryClient.invalidateQueries({
|
||||||
|
queryKey: ordersQueryKeys.lists(),
|
||||||
|
})
|
||||||
|
|
||||||
|
queryClient.invalidateQueries({
|
||||||
|
queryKey: ordersQueryKeys.preview(orderId),
|
||||||
|
})
|
||||||
|
options?.onSuccess?.(data, variables, context)
|
||||||
|
},
|
||||||
|
...options,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export const useCancelClaimRequest = (
|
||||||
|
id: string,
|
||||||
|
orderId: string,
|
||||||
|
options?: UseMutationOptions<HttpTypes.AdminClaimResponse, Error>
|
||||||
|
) => {
|
||||||
|
return useMutation({
|
||||||
|
mutationFn: () => sdk.admin.claim.cancelRequest(id),
|
||||||
|
onSuccess: (data: any, variables: any, context: any) => {
|
||||||
|
queryClient.invalidateQueries({
|
||||||
|
queryKey: ordersQueryKeys.details(),
|
||||||
|
})
|
||||||
|
queryClient.invalidateQueries({
|
||||||
|
queryKey: ordersQueryKeys.lists(),
|
||||||
|
})
|
||||||
|
|
||||||
|
queryClient.invalidateQueries({
|
||||||
|
queryKey: ordersQueryKeys.preview(orderId),
|
||||||
|
})
|
||||||
|
|
||||||
|
queryClient.invalidateQueries({
|
||||||
|
queryKey: claimsQueryKeys.details(),
|
||||||
|
})
|
||||||
|
queryClient.invalidateQueries({
|
||||||
|
queryKey: claimsQueryKeys.lists(),
|
||||||
|
})
|
||||||
|
options?.onSuccess?.(data, variables, context)
|
||||||
|
},
|
||||||
|
...options,
|
||||||
|
})
|
||||||
|
}
|
||||||
@@ -132,11 +132,7 @@ export const useUpdateReturnItem = (
|
|||||||
export const useRemoveReturnItem = (
|
export const useRemoveReturnItem = (
|
||||||
id: string,
|
id: string,
|
||||||
orderId: string,
|
orderId: string,
|
||||||
options?: UseMutationOptions<
|
options?: UseMutationOptions<HttpTypes.AdminReturnResponse, Error, string>
|
||||||
HttpTypes.AdminReturnResponse,
|
|
||||||
Error,
|
|
||||||
HttpTypes.AdminAddReturnItems
|
|
||||||
>
|
|
||||||
) => {
|
) => {
|
||||||
return useMutation({
|
return useMutation({
|
||||||
mutationFn: (actionId: string) =>
|
mutationFn: (actionId: string) =>
|
||||||
|
|||||||
@@ -0,0 +1,368 @@
|
|||||||
|
import { HttpTypes } from "@medusajs/types"
|
||||||
|
|
||||||
|
import { Client } from "../client"
|
||||||
|
import { ClientHeaders } from "../types"
|
||||||
|
|
||||||
|
export class Claim {
|
||||||
|
private client: Client
|
||||||
|
constructor(client: Client) {
|
||||||
|
this.client = client
|
||||||
|
}
|
||||||
|
|
||||||
|
async list(query?: HttpTypes.AdminClaimListParams, headers?: ClientHeaders) {
|
||||||
|
return await this.client.fetch<HttpTypes.AdminClaimListResponse>(
|
||||||
|
`/admin/claims`,
|
||||||
|
{
|
||||||
|
query,
|
||||||
|
headers,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
async retrieve(
|
||||||
|
id: string,
|
||||||
|
query?: HttpTypes.AdminClaimParams,
|
||||||
|
headers?: ClientHeaders
|
||||||
|
) {
|
||||||
|
return await this.client.fetch<HttpTypes.AdminClaimResponse>(
|
||||||
|
`/admin/claims/${id}`,
|
||||||
|
{
|
||||||
|
query,
|
||||||
|
headers,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
async create(
|
||||||
|
body: HttpTypes.AdminCreateClaim,
|
||||||
|
query?: HttpTypes.SelectParams,
|
||||||
|
headers?: ClientHeaders
|
||||||
|
) {
|
||||||
|
return await this.client.fetch<HttpTypes.AdminClaimResponse>(
|
||||||
|
`/admin/claims`,
|
||||||
|
{
|
||||||
|
method: "POST",
|
||||||
|
headers,
|
||||||
|
body,
|
||||||
|
query,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
async cancel(
|
||||||
|
id: string,
|
||||||
|
query?: HttpTypes.SelectParams,
|
||||||
|
headers?: ClientHeaders
|
||||||
|
) {
|
||||||
|
return await this.client.fetch<HttpTypes.AdminClaimResponse>(
|
||||||
|
`/admin/claims/${id}/cancel`,
|
||||||
|
{
|
||||||
|
method: "POST",
|
||||||
|
headers,
|
||||||
|
query,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
async delete(
|
||||||
|
id: string,
|
||||||
|
query?: HttpTypes.SelectParams,
|
||||||
|
headers?: ClientHeaders
|
||||||
|
) {
|
||||||
|
return await this.client.fetch<HttpTypes.AdminClaimDeleteResponse>(
|
||||||
|
`/admin/claims/${id}`,
|
||||||
|
{
|
||||||
|
method: "DELETE",
|
||||||
|
headers,
|
||||||
|
query,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
async addItems(
|
||||||
|
id: string,
|
||||||
|
body: HttpTypes.AdminAddClaimItems,
|
||||||
|
query?: HttpTypes.SelectParams,
|
||||||
|
headers?: ClientHeaders
|
||||||
|
) {
|
||||||
|
return await this.client.fetch<HttpTypes.AdminClaimResponse>(
|
||||||
|
`/admin/claims/${id}/claim-items`,
|
||||||
|
{
|
||||||
|
method: "POST",
|
||||||
|
headers,
|
||||||
|
body,
|
||||||
|
query,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
async updateItem(
|
||||||
|
id: string,
|
||||||
|
actionId: string,
|
||||||
|
body: HttpTypes.AdminUpdateClaimItem,
|
||||||
|
query?: HttpTypes.SelectParams,
|
||||||
|
headers?: ClientHeaders
|
||||||
|
) {
|
||||||
|
return await this.client.fetch<HttpTypes.AdminClaimResponse>(
|
||||||
|
`/admin/claims/${id}/claim-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/claims/${id}/claim-items/${actionId}`,
|
||||||
|
{
|
||||||
|
method: "DELETE",
|
||||||
|
headers,
|
||||||
|
query,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
async addInboundItems(
|
||||||
|
id: string,
|
||||||
|
body: HttpTypes.AdminAddClaimInboundItems,
|
||||||
|
query?: HttpTypes.SelectParams,
|
||||||
|
headers?: ClientHeaders
|
||||||
|
) {
|
||||||
|
return await this.client.fetch<HttpTypes.AdminClaimResponse>(
|
||||||
|
`/admin/claims/${id}/inbound/items`,
|
||||||
|
{
|
||||||
|
method: "POST",
|
||||||
|
headers,
|
||||||
|
body,
|
||||||
|
query,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
async updateInboundItem(
|
||||||
|
id: string,
|
||||||
|
actionId: string,
|
||||||
|
body: HttpTypes.AdminUpdateClaimInboundItem,
|
||||||
|
query?: HttpTypes.SelectParams,
|
||||||
|
headers?: ClientHeaders
|
||||||
|
) {
|
||||||
|
return await this.client.fetch<HttpTypes.AdminClaimResponse>(
|
||||||
|
`/admin/claims/${id}/inbound/items/${actionId}`,
|
||||||
|
{
|
||||||
|
method: "POST",
|
||||||
|
headers,
|
||||||
|
body,
|
||||||
|
query,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
async removeInboundItem(
|
||||||
|
id: string,
|
||||||
|
actionId: string,
|
||||||
|
query?: HttpTypes.SelectParams,
|
||||||
|
headers?: ClientHeaders
|
||||||
|
) {
|
||||||
|
return await this.client.fetch<HttpTypes.AdminClaimResponse>(
|
||||||
|
`/admin/claims/${id}/inbound/items/${actionId}`,
|
||||||
|
{
|
||||||
|
method: "DELETE",
|
||||||
|
headers,
|
||||||
|
query,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
async addInboundShipping(
|
||||||
|
id: string,
|
||||||
|
body: HttpTypes.AdminClaimAddInboundShipping,
|
||||||
|
query?: HttpTypes.SelectParams,
|
||||||
|
headers?: ClientHeaders
|
||||||
|
) {
|
||||||
|
return await this.client.fetch<HttpTypes.AdminClaimResponse>(
|
||||||
|
`/admin/claims/${id}/inbound/shipping-method`,
|
||||||
|
{
|
||||||
|
method: "POST",
|
||||||
|
headers,
|
||||||
|
body,
|
||||||
|
query,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
async updateInboundShipping(
|
||||||
|
id: string,
|
||||||
|
actionId: string,
|
||||||
|
body: HttpTypes.AdminClaimUpdateInboundShipping,
|
||||||
|
query?: HttpTypes.SelectParams,
|
||||||
|
headers?: ClientHeaders
|
||||||
|
) {
|
||||||
|
return await this.client.fetch<HttpTypes.AdminClaimResponse>(
|
||||||
|
`/admin/claims/${id}/inbound/shipping-method/${actionId}`,
|
||||||
|
{
|
||||||
|
method: "POST",
|
||||||
|
headers,
|
||||||
|
body,
|
||||||
|
query,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
async deleteInboundShipping(
|
||||||
|
id: string,
|
||||||
|
actionId: string,
|
||||||
|
query?: HttpTypes.SelectParams,
|
||||||
|
headers?: ClientHeaders
|
||||||
|
) {
|
||||||
|
return await this.client.fetch<HttpTypes.AdminClaimResponse>(
|
||||||
|
`/admin/claims/${id}/inbound/shipping-method/${actionId}`,
|
||||||
|
{
|
||||||
|
method: "DELETE",
|
||||||
|
headers,
|
||||||
|
query,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
async addOutboundItems(
|
||||||
|
id: string,
|
||||||
|
body: HttpTypes.AdminAddClaimOutboundItems,
|
||||||
|
query?: HttpTypes.SelectParams,
|
||||||
|
headers?: ClientHeaders
|
||||||
|
) {
|
||||||
|
return await this.client.fetch<HttpTypes.AdminClaimResponse>(
|
||||||
|
`/admin/claims/${id}/outbound/items`,
|
||||||
|
{
|
||||||
|
method: "POST",
|
||||||
|
headers,
|
||||||
|
body,
|
||||||
|
query,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
async updateOutboundItem(
|
||||||
|
id: string,
|
||||||
|
actionId: string,
|
||||||
|
body: HttpTypes.AdminUpdateClaimOutboundItem,
|
||||||
|
query?: HttpTypes.SelectParams,
|
||||||
|
headers?: ClientHeaders
|
||||||
|
) {
|
||||||
|
return await this.client.fetch<HttpTypes.AdminClaimResponse>(
|
||||||
|
`/admin/claims/${id}/outbound/items/${actionId}`,
|
||||||
|
{
|
||||||
|
method: "POST",
|
||||||
|
headers,
|
||||||
|
body,
|
||||||
|
query,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
async removeOutboundItem(
|
||||||
|
id: string,
|
||||||
|
actionId: string,
|
||||||
|
query?: HttpTypes.SelectParams,
|
||||||
|
headers?: ClientHeaders
|
||||||
|
) {
|
||||||
|
return await this.client.fetch<HttpTypes.AdminClaimResponse>(
|
||||||
|
`/admin/claims/${id}/outbound/items/${actionId}`,
|
||||||
|
{
|
||||||
|
method: "DELETE",
|
||||||
|
headers,
|
||||||
|
query,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
async addOutboundShipping(
|
||||||
|
id: string,
|
||||||
|
body: HttpTypes.AdminClaimAddOutboundShipping,
|
||||||
|
query?: HttpTypes.SelectParams,
|
||||||
|
headers?: ClientHeaders
|
||||||
|
) {
|
||||||
|
return await this.client.fetch<HttpTypes.AdminClaimResponse>(
|
||||||
|
`/admin/claims/${id}/outbound/shipping-method`,
|
||||||
|
{
|
||||||
|
method: "POST",
|
||||||
|
headers,
|
||||||
|
body,
|
||||||
|
query,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
async updateOutboundShipping(
|
||||||
|
id: string,
|
||||||
|
actionId: string,
|
||||||
|
body: HttpTypes.AdminClaimUpdateOutboundShipping,
|
||||||
|
query?: HttpTypes.SelectParams,
|
||||||
|
headers?: ClientHeaders
|
||||||
|
) {
|
||||||
|
return await this.client.fetch<HttpTypes.AdminClaimResponse>(
|
||||||
|
`/admin/claims/${id}/outbound/shipping-method/${actionId}`,
|
||||||
|
{
|
||||||
|
method: "POST",
|
||||||
|
headers,
|
||||||
|
body,
|
||||||
|
query,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
async deleteOutboundShipping(
|
||||||
|
id: string,
|
||||||
|
actionId: string,
|
||||||
|
query?: HttpTypes.SelectParams,
|
||||||
|
headers?: ClientHeaders
|
||||||
|
) {
|
||||||
|
return await this.client.fetch<HttpTypes.AdminClaimResponse>(
|
||||||
|
`/admin/claims/${id}/outbound/shipping-method/${actionId}`,
|
||||||
|
{
|
||||||
|
method: "DELETE",
|
||||||
|
headers,
|
||||||
|
query,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
async request(
|
||||||
|
id: string,
|
||||||
|
body: HttpTypes.AdminRequestClaim,
|
||||||
|
query?: HttpTypes.SelectParams,
|
||||||
|
headers?: ClientHeaders
|
||||||
|
) {
|
||||||
|
return await this.client.fetch<HttpTypes.AdminClaimResponse>(
|
||||||
|
`/admin/claims/${id}/request`,
|
||||||
|
{
|
||||||
|
method: "POST",
|
||||||
|
headers,
|
||||||
|
body,
|
||||||
|
query,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
async cancelRequest(
|
||||||
|
id: string,
|
||||||
|
query?: HttpTypes.SelectParams,
|
||||||
|
headers?: ClientHeaders
|
||||||
|
) {
|
||||||
|
return await this.client.fetch<HttpTypes.AdminClaimResponse>(
|
||||||
|
`/admin/claims/${id}/request`,
|
||||||
|
{
|
||||||
|
method: "DELETE",
|
||||||
|
headers,
|
||||||
|
query,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -27,6 +27,7 @@ import { TaxRate } from "./tax-rate"
|
|||||||
import { TaxRegion } from "./tax-region"
|
import { TaxRegion } from "./tax-region"
|
||||||
import { Upload } from "./upload"
|
import { Upload } from "./upload"
|
||||||
import { User } from "./user"
|
import { User } from "./user"
|
||||||
|
import { Claim } from "./claim"
|
||||||
|
|
||||||
export class Admin {
|
export class Admin {
|
||||||
public invite: Invite
|
public invite: Invite
|
||||||
@@ -51,6 +52,7 @@ export class Admin {
|
|||||||
public notification: Notification
|
public notification: Notification
|
||||||
public order: Order
|
public order: Order
|
||||||
public return: Return
|
public return: Return
|
||||||
|
public claim: Claim
|
||||||
public taxRate: TaxRate
|
public taxRate: TaxRate
|
||||||
public taxRegion: TaxRegion
|
public taxRegion: TaxRegion
|
||||||
public store: Store
|
public store: Store
|
||||||
@@ -81,6 +83,7 @@ export class Admin {
|
|||||||
this.notification = new Notification(client)
|
this.notification = new Notification(client)
|
||||||
this.order = new Order(client)
|
this.order = new Order(client)
|
||||||
this.return = new Return(client)
|
this.return = new Return(client)
|
||||||
|
this.claim = new Claim(client)
|
||||||
this.taxRate = new TaxRate(client)
|
this.taxRate = new TaxRate(client)
|
||||||
this.taxRegion = new TaxRegion(client)
|
this.taxRegion = new TaxRegion(client)
|
||||||
this.store = new Store(client)
|
this.store = new Store(client)
|
||||||
|
|||||||
@@ -0,0 +1,3 @@
|
|||||||
|
import { BaseClaim } from "../common"
|
||||||
|
|
||||||
|
export interface AdminClaim extends BaseClaim {}
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
export * from "./entities"
|
||||||
|
export * from "./payloads"
|
||||||
|
export * from "./queries"
|
||||||
|
export * from "./responses"
|
||||||
@@ -0,0 +1,72 @@
|
|||||||
|
enum ClaimReason {
|
||||||
|
MISSING_ITEM = "missing_item",
|
||||||
|
WRONG_ITEM = "wrong_item",
|
||||||
|
PRODUCTION_FAILURE = "production_failure",
|
||||||
|
OTHER = "other",
|
||||||
|
}
|
||||||
|
|
||||||
|
interface AdminClaimAddItems {
|
||||||
|
items: {
|
||||||
|
id: string
|
||||||
|
quantity: number
|
||||||
|
reason?: ClaimReason
|
||||||
|
description?: string
|
||||||
|
internal_note?: string
|
||||||
|
}[]
|
||||||
|
}
|
||||||
|
|
||||||
|
interface AdminClaimUpdateItem {
|
||||||
|
quantity?: number
|
||||||
|
reason_id?: ClaimReason
|
||||||
|
description?: string
|
||||||
|
internal_note?: string
|
||||||
|
}
|
||||||
|
|
||||||
|
interface AdminClaimAddShippingMethod {
|
||||||
|
shipping_option_id: string
|
||||||
|
custom_price?: number
|
||||||
|
description?: string
|
||||||
|
internal_note?: string
|
||||||
|
metadata?: Record<string, unknown> | null
|
||||||
|
}
|
||||||
|
|
||||||
|
interface AdminClaimUpdateShippingMethod {
|
||||||
|
custom_price?: number
|
||||||
|
internal_note?: string
|
||||||
|
metadata?: Record<string, unknown> | null
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface AdminCreateClaim {
|
||||||
|
type: "refund" | "replace"
|
||||||
|
order_id: string
|
||||||
|
description?: string
|
||||||
|
internal_note?: string
|
||||||
|
metadata?: Record<string, unknown> | null
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface AdminAddClaimItems extends AdminClaimAddItems {}
|
||||||
|
export interface AdminUpdateClaimItem extends AdminClaimUpdateItem {}
|
||||||
|
|
||||||
|
export interface AdminAddClaimInboundItems extends AdminClaimAddItems {}
|
||||||
|
export interface AdminUpdateClaimInboundItem extends AdminClaimUpdateItem {}
|
||||||
|
|
||||||
|
export interface AdminAddClaimOutboundItems extends AdminClaimAddItems {}
|
||||||
|
export interface AdminUpdateClaimOutboundItem extends AdminClaimUpdateItem {}
|
||||||
|
|
||||||
|
export interface AdminClaimAddInboundShipping
|
||||||
|
extends AdminClaimAddShippingMethod {}
|
||||||
|
export interface AdminClaimUpdateInboundShipping
|
||||||
|
extends AdminClaimUpdateShippingMethod {}
|
||||||
|
|
||||||
|
export interface AdminClaimAddOutboundShipping
|
||||||
|
extends AdminClaimAddShippingMethod {}
|
||||||
|
export interface AdminClaimUpdateOutboundShipping
|
||||||
|
extends AdminClaimUpdateShippingMethod {}
|
||||||
|
|
||||||
|
export interface AdminRequestClaim {
|
||||||
|
// no_notification?: boolean // TODO: add in the API
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface AdminCancelClaim {
|
||||||
|
no_notification?: boolean
|
||||||
|
}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
import { BaseFilterable, OperatorMap } from "../../../dal"
|
||||||
|
import { SelectParams } from "../../common"
|
||||||
|
import { BaseClaimListParams } from "../common"
|
||||||
|
|
||||||
|
export interface AdminClaimListParams
|
||||||
|
extends BaseClaimListParams,
|
||||||
|
BaseFilterable<AdminClaimListParams> {
|
||||||
|
deleted_at?: OperatorMap<string>
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface AdminClaimParams extends SelectParams {
|
||||||
|
id?: string | string[]
|
||||||
|
status?: string | string[]
|
||||||
|
created_at?: OperatorMap<string>
|
||||||
|
updated_at?: OperatorMap<string>
|
||||||
|
deleted_at?: OperatorMap<string>
|
||||||
|
}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
import { DeleteResponse, PaginatedResponse } from "../../common"
|
||||||
|
import { AdminClaim } from "./entities"
|
||||||
|
|
||||||
|
export interface AdminClaimResponse {
|
||||||
|
claim: AdminClaim
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface AdminClaimListResponse
|
||||||
|
extends PaginatedResponse<{
|
||||||
|
claims: AdminClaim[]
|
||||||
|
}> {}
|
||||||
|
|
||||||
|
export interface AdminClaimDeleteResponse extends DeleteResponse<"claim"> {}
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
import { OperatorMap } from "../../dal"
|
||||||
|
import { FindParams } from "../common"
|
||||||
|
import { ClaimReason, ReturnDTO } from "../../order"
|
||||||
|
import { BaseOrder } from "../order/common"
|
||||||
|
import { BigNumberRawValue } from "../../totals"
|
||||||
|
|
||||||
|
export interface BaseClaimItem {
|
||||||
|
id: string
|
||||||
|
claim_id: string
|
||||||
|
order_id: string
|
||||||
|
item_id: string
|
||||||
|
quantity: number
|
||||||
|
reason: ClaimReason
|
||||||
|
raw_quantity: BigNumberRawValue
|
||||||
|
metadata?: Record<string, unknown> | null
|
||||||
|
created_at?: Date | string
|
||||||
|
updated_at?: Date | string
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface BaseClaim
|
||||||
|
extends Omit<BaseOrder, "status" | "version" | "items"> {
|
||||||
|
order_id: string
|
||||||
|
claim_items: BaseClaimItem
|
||||||
|
additional_items: any[]
|
||||||
|
return?: ReturnDTO
|
||||||
|
return_id?: string
|
||||||
|
no_notification?: boolean
|
||||||
|
refund_amount?: number
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface BaseClaimListParams extends FindParams {
|
||||||
|
q?: string
|
||||||
|
id?: string | string[]
|
||||||
|
order_id?: string | string[]
|
||||||
|
status?: string | string[]
|
||||||
|
created_at?: OperatorMap<string>
|
||||||
|
updated_at?: OperatorMap<string>
|
||||||
|
deleted_at?: OperatorMap<string>
|
||||||
|
}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
export * from "./admin"
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
export * from "./api-key"
|
export * from "./api-key"
|
||||||
export * from "./campaign"
|
export * from "./campaign"
|
||||||
export * from "./cart"
|
export * from "./cart"
|
||||||
|
export * from "./claim"
|
||||||
export * from "./collection"
|
export * from "./collection"
|
||||||
export * from "./common"
|
export * from "./common"
|
||||||
export * from "./currency"
|
export * from "./currency"
|
||||||
|
|||||||
@@ -162,7 +162,7 @@ export type AdminPostClaimItemsReqSchemaType = z.infer<
|
|||||||
export const AdminPostClaimsRequestItemsActionReqSchema = z.object({
|
export const AdminPostClaimsRequestItemsActionReqSchema = z.object({
|
||||||
quantity: z.number().optional(),
|
quantity: z.number().optional(),
|
||||||
internal_note: z.string().nullish().optional(),
|
internal_note: z.string().nullish().optional(),
|
||||||
reason_id: z.string().nullish().optional(),
|
reason: z.nativeEnum(ClaimReason).nullish().optional(),
|
||||||
metadata: z.record(z.unknown()).nullish().optional(),
|
metadata: z.record(z.unknown()).nullish().optional(),
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user