feat(dashboard,js-sdk,types): ability to add refund reason and note (#8466)

what: 

- adds ability to add refund reason and note to a refund

<img width="524" alt="Screenshot 2024-08-06 at 13 06 59" src="https://github.com/user-attachments/assets/51537e9b-170b-4dd6-9de5-6bdea5e26822">

<img width="1090" alt="Screenshot 2024-08-06 at 12 57 18" src="https://github.com/user-attachments/assets/70bc84a4-5ebf-43e9-8416-370fd37ba615">

<img width="247" alt="Screenshot 2024-08-06 at 13 08 46" src="https://github.com/user-attachments/assets/b1dc1d83-7fb8-4af5-9a5b-fddb63ff1812">
This commit is contained in:
Riqwan Thamir
2024-08-08 21:19:08 +00:00
committed by GitHub
parent f9a8fcc0bc
commit a93b025233
10 changed files with 160 additions and 20 deletions
@@ -19,6 +19,7 @@ export * from "./product-types"
export * from "./product-variants"
export * from "./products"
export * from "./promotions"
export * from "./refund-reasons"
export * from "./regions"
export * from "./reservations"
export * from "./sales-channels"
@@ -0,0 +1,28 @@
import { HttpTypes } from "@medusajs/types"
import { QueryKey, useQuery, UseQueryOptions } from "@tanstack/react-query"
import { sdk } from "../../lib/client"
import { queryKeysFactory } from "../../lib/query-key-factory"
const REFUND_REASON_QUERY_KEY = "refund-reason" as const
export const paymentQueryKeys = queryKeysFactory(REFUND_REASON_QUERY_KEY)
export const useRefundReasons = (
query?: HttpTypes.RefundReasonFilters,
options?: Omit<
UseQueryOptions<
HttpTypes.RefundReasonsResponse,
Error,
HttpTypes.RefundReasonsResponse,
QueryKey
>,
"queryKey" | "queryFn"
>
) => {
const { data, ...rest } = useQuery({
queryFn: () => sdk.admin.refundReason.list(query),
queryKey: [],
...options,
})
return { ...data, ...rest }
}