chore(dashboard): Remove v1 code and medusa-react (#7420)
This commit is contained in:
committed by
GitHub
parent
9cbe0085d0
commit
e01472aae6
@@ -1,3 +1,4 @@
|
||||
import { AdminApiKeyListResponse, AdminApiKeyResponse } from "@medusajs/types"
|
||||
import {
|
||||
MutationOptions,
|
||||
QueryKey,
|
||||
@@ -7,11 +8,10 @@ import {
|
||||
useQuery,
|
||||
} from "@tanstack/react-query"
|
||||
import { client } from "../../lib/client"
|
||||
import { queryClient } from "../../lib/medusa"
|
||||
import { queryClient } from "../../lib/query-client"
|
||||
import { queryKeysFactory } from "../../lib/query-key-factory"
|
||||
import { CreateApiKeyReq, UpdateApiKeyReq } from "../../types/api-payloads"
|
||||
import { ApiKeyDeleteRes } from "../../types/api-responses"
|
||||
import { AdminApiKeyResponse, AdminApiKeyListResponse } from "@medusajs/types"
|
||||
import { salesChannelsQueryKeys } from "./sales-channels"
|
||||
|
||||
const API_KEYS_QUERY_KEY = "api_keys" as const
|
||||
|
||||
@@ -11,7 +11,7 @@ import {
|
||||
useQuery,
|
||||
} from "@tanstack/react-query"
|
||||
import { client } from "../../lib/client"
|
||||
import { queryClient } from "../../lib/medusa"
|
||||
import { queryClient } from "../../lib/query-client"
|
||||
import { queryKeysFactory } from "../../lib/query-key-factory"
|
||||
import { CreateCampaignReq, UpdateCampaignReq } from "../../types/api-payloads"
|
||||
import { CampaignDeleteRes } from "../../types/api-responses"
|
||||
|
||||
@@ -6,7 +6,7 @@ import {
|
||||
useQuery,
|
||||
} from "@tanstack/react-query"
|
||||
import { client } from "../../lib/client"
|
||||
import { queryClient } from "../../lib/medusa"
|
||||
import { queryClient } from "../../lib/query-client"
|
||||
import { queryKeysFactory } from "../../lib/query-key-factory"
|
||||
import {
|
||||
CreateProductCollectionReq,
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
import {
|
||||
AdminCustomerGroupListResponse,
|
||||
AdminCustomerGroupResponse,
|
||||
} from "@medusajs/types"
|
||||
import {
|
||||
QueryKey,
|
||||
UseMutationOptions,
|
||||
@@ -5,16 +9,12 @@ import {
|
||||
useMutation,
|
||||
useQuery,
|
||||
} from "@tanstack/react-query"
|
||||
import { client } from "../../lib/client"
|
||||
import { queryKeysFactory } from "../../lib/query-key-factory"
|
||||
import {
|
||||
AdminCustomerGroupListResponse,
|
||||
AdminCustomerGroupResponse,
|
||||
} from "@medusajs/types"
|
||||
import { z } from "zod"
|
||||
import { CreateCustomerGroupSchema } from "../../v2-routes/customer-groups/customer-group-create/components/create-customer-group-form"
|
||||
import { queryClient } from "../../lib/medusa"
|
||||
import { EditCustomerGroupSchema } from "../../v2-routes/customer-groups/customer-group-edit/components/edit-customer-group-form"
|
||||
import { client } from "../../lib/client"
|
||||
import { queryClient } from "../../lib/query-client"
|
||||
import { queryKeysFactory } from "../../lib/query-key-factory"
|
||||
import { CreateCustomerGroupSchema } from "../../routes/customer-groups/customer-group-create/components/create-customer-group-form"
|
||||
import { EditCustomerGroupSchema } from "../../routes/customer-groups/customer-group-edit/components/edit-customer-group-form"
|
||||
import { customersQueryKeys } from "./customers"
|
||||
|
||||
const CUSTOMER_GROUPS_QUERY_KEY = "customer_groups" as const
|
||||
|
||||
@@ -11,7 +11,7 @@ import {
|
||||
useQuery,
|
||||
} from "@tanstack/react-query"
|
||||
import { client } from "../../lib/client"
|
||||
import { queryClient } from "../../lib/medusa"
|
||||
import { queryClient } from "../../lib/query-client"
|
||||
import { queryKeysFactory } from "../../lib/query-key-factory"
|
||||
import { CreateCustomerReq, UpdateCustomerReq } from "../../types/api-payloads"
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ import { useMutation, UseMutationOptions } from "@tanstack/react-query"
|
||||
import { queryKeysFactory } from "../../lib/query-key-factory"
|
||||
|
||||
import { client } from "../../lib/client"
|
||||
import { queryClient } from "../../lib/medusa"
|
||||
import { queryClient } from "../../lib/query-client"
|
||||
import { ordersQueryKeys } from "./orders"
|
||||
|
||||
const FULFILLMENTS_QUERY_KEY = "fulfillments" as const
|
||||
|
||||
@@ -1,15 +1,4 @@
|
||||
import { AdminInventoryItemResponse, InventoryNext } from "@medusajs/types"
|
||||
import {
|
||||
InventoryItemDeleteRes,
|
||||
InventoryItemListRes,
|
||||
InventoryItemLocationLevelsRes,
|
||||
InventoryItemRes,
|
||||
} from "../../types/api-responses"
|
||||
import {
|
||||
InventoryItemLocationBatch,
|
||||
UpdateInventoryItemReq,
|
||||
UpdateInventoryLevelReq,
|
||||
} from "../../types/api-payloads"
|
||||
import {
|
||||
QueryKey,
|
||||
UseMutationOptions,
|
||||
@@ -17,9 +6,20 @@ import {
|
||||
useMutation,
|
||||
useQuery,
|
||||
} from "@tanstack/react-query"
|
||||
import {
|
||||
InventoryItemLocationBatch,
|
||||
UpdateInventoryItemReq,
|
||||
UpdateInventoryLevelReq,
|
||||
} from "../../types/api-payloads"
|
||||
import {
|
||||
InventoryItemDeleteRes,
|
||||
InventoryItemListRes,
|
||||
InventoryItemLocationLevelsRes,
|
||||
InventoryItemRes,
|
||||
} from "../../types/api-responses"
|
||||
|
||||
import { client } from "../../lib/client"
|
||||
import { queryClient } from "../../lib/medusa"
|
||||
import { queryClient } from "../../lib/query-client"
|
||||
import { queryKeysFactory } from "../../lib/query-key-factory"
|
||||
|
||||
const INVENTORY_ITEMS_QUERY_KEY = "inventory_items" as const
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
import {
|
||||
AdminInviteResponse,
|
||||
DeleteResponse,
|
||||
HttpTypes,
|
||||
PaginatedResponse,
|
||||
} from "@medusajs/types"
|
||||
import {
|
||||
QueryKey,
|
||||
UseMutationOptions,
|
||||
@@ -6,14 +12,8 @@ import {
|
||||
useQuery,
|
||||
} from "@tanstack/react-query"
|
||||
import { sdk } from "../../lib/client"
|
||||
import { queryClient } from "../../lib/medusa"
|
||||
import { queryClient } from "../../lib/query-client"
|
||||
import { queryKeysFactory } from "../../lib/query-key-factory"
|
||||
import {
|
||||
AdminInviteResponse,
|
||||
DeleteResponse,
|
||||
HttpTypes,
|
||||
PaginatedResponse,
|
||||
} from "@medusajs/types"
|
||||
|
||||
const INVITES_QUERY_KEY = "invites" as const
|
||||
const invitesQueryKeys = queryKeysFactory(INVITES_QUERY_KEY)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { QueryKey, useQuery, UseQueryOptions } from "@tanstack/react-query"
|
||||
|
||||
import { queryKeysFactory } from "../../lib/query-key-factory"
|
||||
import { client } from "../../lib/client"
|
||||
import { queryKeysFactory } from "../../lib/query-key-factory"
|
||||
|
||||
const ORDERS_QUERY_KEY = "orders" as const
|
||||
export const ordersQueryKeys = queryKeysFactory(ORDERS_QUERY_KEY)
|
||||
@@ -15,7 +15,7 @@ export const useOrder = (
|
||||
>
|
||||
) => {
|
||||
const { data, ...rest } = useQuery({
|
||||
queryFn: () => client.orders.retrieve(id, query),
|
||||
queryFn: async () => client.orders.retrieve(id, query),
|
||||
queryKey: ordersQueryKeys.detail(id, query),
|
||||
...options,
|
||||
})
|
||||
@@ -31,7 +31,7 @@ export const useOrders = (
|
||||
>
|
||||
) => {
|
||||
const { data, ...rest } = useQuery({
|
||||
queryFn: () => client.orders.list(query),
|
||||
queryFn: async () => client.orders.list(query),
|
||||
queryKey: ordersQueryKeys.list(query),
|
||||
...options,
|
||||
})
|
||||
|
||||
@@ -6,7 +6,7 @@ import {
|
||||
useQuery,
|
||||
} from "@tanstack/react-query"
|
||||
import { client } from "../../lib/client"
|
||||
import { queryClient } from "../../lib/medusa"
|
||||
import { queryClient } from "../../lib/query-client"
|
||||
import { queryKeysFactory } from "../../lib/query-key-factory"
|
||||
import {
|
||||
AddPriceListPricesReq,
|
||||
|
||||
@@ -6,9 +6,13 @@ import {
|
||||
useQuery,
|
||||
} from "@tanstack/react-query"
|
||||
import { client } from "../../lib/client"
|
||||
import { queryClient } from "../../lib/query-client"
|
||||
import { queryKeysFactory } from "../../lib/query-key-factory"
|
||||
import { ProductDeleteRes, ProductRes } from "../../types/api-responses"
|
||||
import { queryClient } from "../../lib/medusa"
|
||||
import {
|
||||
ProductDeleteRes,
|
||||
ProductListRes,
|
||||
ProductRes,
|
||||
} from "../../types/api-responses"
|
||||
|
||||
const PRODUCTS_QUERY_KEY = "products" as const
|
||||
export const productsQueryKeys = queryKeysFactory(PRODUCTS_QUERY_KEY)
|
||||
@@ -200,7 +204,7 @@ export const useProduct = (
|
||||
export const useProducts = (
|
||||
query?: Record<string, any>,
|
||||
options?: Omit<
|
||||
UseQueryOptions<any, Error, any, QueryKey>,
|
||||
UseQueryOptions<ProductListRes, Error, ProductListRes, QueryKey>,
|
||||
"queryFn" | "queryKey"
|
||||
>
|
||||
) => {
|
||||
|
||||
@@ -7,7 +7,7 @@ import {
|
||||
UseQueryOptions,
|
||||
} from "@tanstack/react-query"
|
||||
import { client } from "../../lib/client"
|
||||
import { queryClient } from "../../lib/medusa"
|
||||
import { queryClient } from "../../lib/query-client"
|
||||
import { queryKeysFactory } from "../../lib/query-key-factory"
|
||||
import {
|
||||
BatchAddPromotionRulesReq,
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { DeleteResponse, HttpTypes, PaginatedResponse } from "@medusajs/types"
|
||||
import {
|
||||
QueryKey,
|
||||
UseMutationOptions,
|
||||
@@ -6,12 +7,11 @@ import {
|
||||
useQuery,
|
||||
} from "@tanstack/react-query"
|
||||
import { sdk } from "../../lib/client"
|
||||
import { queryClient } from "../../lib/medusa"
|
||||
import { queryClient } from "../../lib/query-client"
|
||||
import { queryKeysFactory } from "../../lib/query-key-factory"
|
||||
import { DeleteResponse, HttpTypes, PaginatedResponse } from "@medusajs/types"
|
||||
|
||||
const REGIONS_QUERY_KEY = "regions" as const
|
||||
const regionsQueryKeys = queryKeysFactory(REGIONS_QUERY_KEY)
|
||||
export const regionsQueryKeys = queryKeysFactory(REGIONS_QUERY_KEY)
|
||||
|
||||
export const useRegion = (
|
||||
id: string,
|
||||
|
||||
@@ -1,7 +1,3 @@
|
||||
import {
|
||||
CreateReservationReq,
|
||||
UpdateReservationReq,
|
||||
} from "../../types/api-payloads"
|
||||
import {
|
||||
QueryKey,
|
||||
UseMutationOptions,
|
||||
@@ -9,6 +5,10 @@ import {
|
||||
useMutation,
|
||||
useQuery,
|
||||
} from "@tanstack/react-query"
|
||||
import {
|
||||
CreateReservationReq,
|
||||
UpdateReservationReq,
|
||||
} from "../../types/api-payloads"
|
||||
import {
|
||||
ReservationItemDeleteRes,
|
||||
ReservationItemListRes,
|
||||
@@ -17,7 +17,7 @@ import {
|
||||
|
||||
import { InventoryNext } from "@medusajs/types"
|
||||
import { client } from "../../lib/client"
|
||||
import { queryClient } from "../../lib/medusa"
|
||||
import { queryClient } from "../../lib/query-client"
|
||||
import { queryKeysFactory } from "../../lib/query-key-factory"
|
||||
|
||||
const RESERVATION_ITEMS_QUERY_KEY = "reservation_items" as const
|
||||
|
||||
@@ -6,8 +6,12 @@ import {
|
||||
useQuery,
|
||||
} from "@tanstack/react-query"
|
||||
|
||||
import {
|
||||
AdminSalesChannelListResponse,
|
||||
AdminSalesChannelResponse,
|
||||
} from "@medusajs/types"
|
||||
import { client } from "../../lib/client"
|
||||
import { queryClient } from "../../lib/medusa"
|
||||
import { queryClient } from "../../lib/query-client"
|
||||
import { queryKeysFactory } from "../../lib/query-key-factory"
|
||||
import {
|
||||
AddProductsSalesChannelReq,
|
||||
@@ -17,10 +21,6 @@ import {
|
||||
} from "../../types/api-payloads"
|
||||
import { SalesChannelDeleteRes } from "../../types/api-responses"
|
||||
import { productsQueryKeys } from "./products"
|
||||
import {
|
||||
AdminSalesChannelListResponse,
|
||||
AdminSalesChannelResponse,
|
||||
} from "@medusajs/types"
|
||||
|
||||
const SALES_CHANNELS_QUERY_KEY = "sales-channels" as const
|
||||
export const salesChannelsQueryKeys = queryKeysFactory(SALES_CHANNELS_QUERY_KEY)
|
||||
|
||||
@@ -6,17 +6,17 @@ import {
|
||||
UseQueryOptions,
|
||||
} from "@tanstack/react-query"
|
||||
|
||||
import {
|
||||
ShippingOptionDeleteRes,
|
||||
ShippingOptionRes,
|
||||
} from "../../types/api-responses"
|
||||
import { client } from "../../lib/client"
|
||||
import { queryClient } from "../../lib/query-client"
|
||||
import {
|
||||
CreateShippingOptionReq,
|
||||
UpdateShippingOptionReq,
|
||||
} from "../../types/api-payloads"
|
||||
import {
|
||||
ShippingOptionDeleteRes,
|
||||
ShippingOptionRes,
|
||||
} from "../../types/api-responses"
|
||||
import { stockLocationsQueryKeys } from "./stock-locations"
|
||||
import { queryClient } from "../../lib/medusa"
|
||||
import { client } from "../../lib/client"
|
||||
|
||||
export const useShippingOptions = (
|
||||
query?: Record<string, any>,
|
||||
|
||||
@@ -13,7 +13,7 @@ import {
|
||||
|
||||
import { DeleteResponse } from "@medusajs/types"
|
||||
import { client } from "../../lib/client"
|
||||
import { queryClient } from "../../lib/medusa"
|
||||
import { queryClient } from "../../lib/query-client"
|
||||
import { queryKeysFactory } from "../../lib/query-key-factory"
|
||||
|
||||
const SHIPPING_PROFILE_QUERY_KEY = "shipping_profile" as const
|
||||
|
||||
@@ -7,7 +7,7 @@ import {
|
||||
} from "@tanstack/react-query"
|
||||
|
||||
import { client } from "../../lib/client"
|
||||
import { queryClient } from "../../lib/medusa"
|
||||
import { queryClient } from "../../lib/query-client"
|
||||
import { queryKeysFactory } from "../../lib/query-key-factory"
|
||||
import {
|
||||
CreateFulfillmentSetReq,
|
||||
@@ -24,7 +24,6 @@ import {
|
||||
StockLocationListRes,
|
||||
StockLocationRes,
|
||||
} from "../../types/api-responses"
|
||||
import { salesChannelsQueryKeys } from "./sales-channels"
|
||||
|
||||
const STOCK_LOCATIONS_QUERY_KEY = "stock_locations" as const
|
||||
export const stockLocationsQueryKeys = queryKeysFactory(
|
||||
|
||||
@@ -7,13 +7,13 @@ import {
|
||||
} from "@tanstack/react-query"
|
||||
|
||||
import { client } from "../../lib/client"
|
||||
import { queryClient } from "../../lib/medusa"
|
||||
import { queryClient } from "../../lib/query-client"
|
||||
import { queryKeysFactory } from "../../lib/query-key-factory"
|
||||
import { UpdateStoreReq } from "../../types/api-payloads"
|
||||
import { StoreRes } from "../../types/api-responses"
|
||||
import { queryKeysFactory } from "../../lib/query-key-factory"
|
||||
|
||||
const STORE_QUERY_KEY = "store" as const
|
||||
const storeQueryKeys = queryKeysFactory(STORE_QUERY_KEY)
|
||||
export const storeQueryKeys = queryKeysFactory(STORE_QUERY_KEY)
|
||||
|
||||
export const useStore = (
|
||||
options?: Omit<
|
||||
|
||||
@@ -5,13 +5,13 @@ import {
|
||||
import { AdminTaxRateListResponse, AdminTaxRateResponse } from "@medusajs/types"
|
||||
import {
|
||||
QueryKey,
|
||||
useMutation,
|
||||
UseMutationOptions,
|
||||
useQuery,
|
||||
UseQueryOptions,
|
||||
useMutation,
|
||||
useQuery,
|
||||
} from "@tanstack/react-query"
|
||||
import { client } from "../../lib/client"
|
||||
import { queryClient } from "../../lib/medusa"
|
||||
import { queryClient } from "../../lib/query-client"
|
||||
import { queryKeysFactory } from "../../lib/query-key-factory"
|
||||
import { TaxRateDeleteRes } from "../../types/api-responses"
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ import {
|
||||
useQuery,
|
||||
} from "@tanstack/react-query"
|
||||
import { client } from "../../lib/client"
|
||||
import { queryClient } from "../../lib/medusa"
|
||||
import { queryClient } from "../../lib/query-client"
|
||||
import { queryKeysFactory } from "../../lib/query-key-factory"
|
||||
import { TaxRegionDeleteRes } from "../../types/api-responses"
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ import {
|
||||
useQuery,
|
||||
} from "@tanstack/react-query"
|
||||
import { client } from "../../lib/client"
|
||||
import { queryClient } from "../../lib/medusa"
|
||||
import { queryClient } from "../../lib/query-client"
|
||||
import { queryKeysFactory } from "../../lib/query-key-factory"
|
||||
import { UpdateUserReq } from "../../types/api-payloads"
|
||||
import { UserDeleteRes, UserListRes, UserRes } from "../../types/api-responses"
|
||||
|
||||
@@ -7,7 +7,7 @@ import {
|
||||
} from "../../types/api-responses"
|
||||
|
||||
const WORKFLOW_EXECUTIONS_QUERY_KEY = "workflow_executions" as const
|
||||
const workflowExecutionsQueryKeys = queryKeysFactory(
|
||||
export const workflowExecutionsQueryKeys = queryKeysFactory(
|
||||
WORKFLOW_EXECUTIONS_QUERY_KEY
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user