feat(dashboard): Initial pricing domain (#6996)
**What** - Sets up the initial work for Pricing domain - Fixes Store domain **Todo in follow up PR** - Translations - Add status when creating the Price List and allow updating it - Improve DataGrid component - Add missing functionality once backend support is added (customer_groups, region prices and update prices) CLOSES CORE-1931
This commit is contained in:
@@ -8,6 +8,7 @@ import { customerGroups } from "./customer-groups"
|
||||
import { customers } from "./customers"
|
||||
import { invites } from "./invites"
|
||||
import { payments } from "./payments"
|
||||
import { priceLists } from "./price-lists"
|
||||
import { productTypes } from "./product-types"
|
||||
import { products } from "./products"
|
||||
import { promotions } from "./promotions"
|
||||
@@ -40,6 +41,7 @@ export const client = {
|
||||
invites: invites,
|
||||
products: products,
|
||||
productTypes: productTypes,
|
||||
priceLists: priceLists,
|
||||
stockLocations: stockLocations,
|
||||
workflowExecutions: workflowExecutions,
|
||||
}
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
import {
|
||||
AddPriceListPricesReq,
|
||||
CreatePriceListReq,
|
||||
DeletePriceListPricesReq,
|
||||
UpdatePriceListReq,
|
||||
} from "../../types/api-payloads"
|
||||
import {
|
||||
PriceListDeleteRes,
|
||||
PriceListListRes,
|
||||
PriceListRes,
|
||||
} from "../../types/api-responses"
|
||||
import { getRequest, postRequest } from "./common"
|
||||
|
||||
async function retrievePriceLists(id: string, query?: Record<string, any>) {
|
||||
return getRequest<PriceListRes>(`/admin/price-lists/${id}`, query)
|
||||
}
|
||||
|
||||
async function listPriceLists(query?: Record<string, any>) {
|
||||
return getRequest<PriceListListRes>(`/admin/price-lists`, query)
|
||||
}
|
||||
|
||||
async function createPriceList(payload: CreatePriceListReq) {
|
||||
return postRequest<PriceListRes>(`/admin/price-lists`, payload)
|
||||
}
|
||||
|
||||
async function updatePriceList(id: string, payload: UpdatePriceListReq) {
|
||||
return postRequest<PriceListRes>(`/admin/price-lists/${id}`, payload)
|
||||
}
|
||||
|
||||
async function deletePriceList(id: string) {
|
||||
return postRequest<PriceListDeleteRes>(`/admin/price-lists/${id}/delete`)
|
||||
}
|
||||
|
||||
async function addPriceListPrices(id: string, payload: AddPriceListPricesReq) {
|
||||
return postRequest<PriceListRes>(
|
||||
`/admin/price-lists/${id}/prices/batch/add`,
|
||||
payload
|
||||
)
|
||||
}
|
||||
|
||||
async function removePriceListPrices(
|
||||
id: string,
|
||||
payload: DeletePriceListPricesReq
|
||||
) {
|
||||
return postRequest<PriceListRes>(
|
||||
`/admin/price-lists/${id}/prices/batch/remove`,
|
||||
payload
|
||||
)
|
||||
}
|
||||
|
||||
export const priceLists = {
|
||||
retrieve: retrievePriceLists,
|
||||
list: listPriceLists,
|
||||
create: createPriceList,
|
||||
update: updatePriceList,
|
||||
delete: deletePriceList,
|
||||
addPrices: addPriceListPrices,
|
||||
removePrices: removePriceListPrices,
|
||||
}
|
||||
Reference in New Issue
Block a user