feat(dashboard): shipping management (#6995)
**What** - shipping flow - shipping profile pages - delete fulfillment set endpoint - delete shipping profile endpoint
This commit is contained in:
@@ -15,12 +15,14 @@ import { products } from "./products"
|
||||
import { promotions } from "./promotions"
|
||||
import { regions } from "./regions"
|
||||
import { salesChannels } from "./sales-channels"
|
||||
import { shippingOptions } from "./shipping-options"
|
||||
import { stockLocations } from "./stock-locations"
|
||||
import { stores } from "./stores"
|
||||
import { tags } from "./tags"
|
||||
import { taxes } from "./taxes"
|
||||
import { users } from "./users"
|
||||
import { workflowExecutions } from "./workflow-executions"
|
||||
import { shippingProfiles } from "./shipping-profiles"
|
||||
|
||||
export const client = {
|
||||
auth: auth,
|
||||
@@ -35,6 +37,8 @@ export const client = {
|
||||
payments: payments,
|
||||
stores: stores,
|
||||
salesChannels: salesChannels,
|
||||
shippingOptions: shippingOptions,
|
||||
shippingProfiles: shippingProfiles,
|
||||
tags: tags,
|
||||
users: users,
|
||||
regions: regions,
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
import { deleteRequest, postRequest } from "./common"
|
||||
import {
|
||||
ShippingOptionDeleteRes,
|
||||
ShippingOptionRes,
|
||||
} from "../../types/api-responses"
|
||||
import { CreateShippingOptionReq } from "../../types/api-payloads"
|
||||
|
||||
async function createShippingOptions(payload: CreateShippingOptionReq) {
|
||||
return postRequest<ShippingOptionRes>(`/admin/shipping-options`, payload)
|
||||
}
|
||||
|
||||
async function deleteShippingOption(optionId: string) {
|
||||
return deleteRequest<ShippingOptionDeleteRes>(
|
||||
`/admin/shipping-options/${optionId}`
|
||||
)
|
||||
}
|
||||
|
||||
export const shippingOptions = {
|
||||
create: createShippingOptions,
|
||||
delete: deleteShippingOption,
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
import { deleteRequest, getRequest, postRequest } from "./common"
|
||||
import { CreateShippingProfileReq } from "../../types/api-payloads"
|
||||
import {
|
||||
ShippingProfileDeleteRes,
|
||||
ShippingProfileListRes,
|
||||
ShippingProfileRes,
|
||||
} from "../../types/api-responses"
|
||||
|
||||
async function createShippingProfile(payload: CreateShippingProfileReq) {
|
||||
return postRequest<ShippingProfileRes>(`/admin/shipping-profiles`, payload)
|
||||
}
|
||||
|
||||
async function listShippingProfiles(query?: Record<string, any>) {
|
||||
return getRequest<ShippingProfileListRes>(`/admin/shipping-profiles`, query)
|
||||
}
|
||||
|
||||
async function deleteShippingProfile(profileId: string) {
|
||||
return deleteRequest<ShippingProfileDeleteRes>(
|
||||
`/admin/shipping-profiles/${profileId}`
|
||||
)
|
||||
}
|
||||
|
||||
export const shippingProfiles = {
|
||||
create: createShippingProfile,
|
||||
list: listShippingProfiles,
|
||||
delete: deleteShippingProfile,
|
||||
}
|
||||
@@ -1,8 +1,12 @@
|
||||
import {
|
||||
CreateFulfillmentSetReq,
|
||||
CreateServiceZoneReq,
|
||||
CreateStockLocationReq,
|
||||
UpdateStockLocationReq,
|
||||
} from "../../types/api-payloads"
|
||||
import {
|
||||
FulfillmentSetDeleteRes,
|
||||
ServiceZoneDeleteRes,
|
||||
StockLocationDeleteRes,
|
||||
StockLocationListRes,
|
||||
StockLocationRes,
|
||||
@@ -21,6 +25,26 @@ async function createStockLocation(payload: CreateStockLocationReq) {
|
||||
return postRequest<StockLocationRes>(`/admin/stock-locations`, payload)
|
||||
}
|
||||
|
||||
async function createFulfillmentSet(
|
||||
locationId: string,
|
||||
payload: CreateFulfillmentSetReq
|
||||
) {
|
||||
return postRequest<StockLocationRes>(
|
||||
`/admin/stock-locations/${locationId}/fulfillment-sets`,
|
||||
payload
|
||||
)
|
||||
}
|
||||
|
||||
async function createServiceZone(
|
||||
fulfillmentSetId: string,
|
||||
payload: CreateServiceZoneReq
|
||||
) {
|
||||
return postRequest<StockLocationRes>(
|
||||
`/admin/fulfillment-sets/${fulfillmentSetId}/service-zones`,
|
||||
payload
|
||||
)
|
||||
}
|
||||
|
||||
async function updateStockLocation(
|
||||
id: string,
|
||||
payload: UpdateStockLocationReq
|
||||
@@ -32,10 +56,26 @@ async function deleteStockLocation(id: string) {
|
||||
return deleteRequest<StockLocationDeleteRes>(`/admin/stock-locations/${id}`)
|
||||
}
|
||||
|
||||
async function deleteFulfillmentSet(setId: string) {
|
||||
return deleteRequest<FulfillmentSetDeleteRes>(
|
||||
`/admin/fulfillment-sets/${setId}`
|
||||
)
|
||||
}
|
||||
|
||||
async function deleteServiceZone(setId: string, zoneId: string) {
|
||||
return deleteRequest<ServiceZoneDeleteRes>(
|
||||
`/admin/fulfillment-sets/${setId}/service-zones/${zoneId}`
|
||||
)
|
||||
}
|
||||
|
||||
export const stockLocations = {
|
||||
list: listStockLocations,
|
||||
retrieve: retrieveStockLocation,
|
||||
create: createStockLocation,
|
||||
update: updateStockLocation,
|
||||
delete: deleteStockLocation,
|
||||
createFulfillmentSet,
|
||||
deleteFulfillmentSet,
|
||||
createServiceZone,
|
||||
deleteServiceZone,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user