feat(dashboard,types,js-sdk,ui): Tax Regions UI (#7935)

This commit is contained in:
Kasper Fabricius Kristensen
2024-07-10 11:26:43 +02:00
committed by GitHub
parent 75e7047243
commit 046a34bdfc
232 changed files with 7555 additions and 3818 deletions
+1 -1
View File
@@ -47,7 +47,7 @@ export class Customer {
}
async list(
queryParams?: FindParams & HttpTypes.AdminCollectionFilters,
queryParams?: FindParams & HttpTypes.AdminCustomerFilters,
headers?: ClientHeaders
) {
return this.client.fetch<
+3
View File
@@ -11,6 +11,7 @@ import { PricePreference } from "./price-preference"
import { Product } from "./product"
import { ProductCategory } from "./product-category"
import { ProductCollection } from "./product-collection"
import { ProductTag } from "./product-tag"
import { ProductType } from "./product-type"
import { Region } from "./region"
import { SalesChannel } from "./sales-channel"
@@ -45,6 +46,7 @@ export class Admin {
public taxRate: TaxRate
public taxRegion: TaxRegion
public store: Store
public productTag: ProductTag
constructor(client: Client) {
this.invite = new Invite(client)
@@ -69,5 +71,6 @@ export class Admin {
this.taxRate = new TaxRate(client)
this.taxRegion = new TaxRegion(client)
this.store = new Store(client)
this.productTag = new ProductTag(client)
}
}
@@ -1,10 +1,4 @@
import {
DeleteResponse,
FindParams,
HttpTypes,
PaginatedResponse,
SelectParams,
} from "@medusajs/types"
import { HttpTypes } from "@medusajs/types"
import { Client } from "../client"
import { ClientHeaders } from "../types"
@@ -16,10 +10,10 @@ export class ProductCollection {
async create(
body: HttpTypes.AdminCreateCollection,
query?: SelectParams,
query?: HttpTypes.AdminCollectionParams,
headers?: ClientHeaders
) {
return this.client.fetch<{ collection: HttpTypes.AdminCollection }>(
return this.client.fetch<HttpTypes.AdminCollectionResponse>(
`/admin/collections`,
{
method: "POST",
@@ -32,10 +26,10 @@ export class ProductCollection {
async update(
id: string,
body: HttpTypes.AdminUpdateCollection,
query?: SelectParams,
query?: HttpTypes.AdminCollectionParams,
headers?: ClientHeaders
) {
return this.client.fetch<{ collection: HttpTypes.AdminCollection }>(
return this.client.fetch<HttpTypes.AdminCollectionResponse>(
`/admin/collections/${id}`,
{
method: "POST",
@@ -46,17 +40,25 @@ export class ProductCollection {
)
}
async list(queryParams?: FindParams, headers?: ClientHeaders) {
return this.client.fetch<
PaginatedResponse<{ collections: HttpTypes.AdminCollection[] }>
>(`/admin/collections`, {
headers,
query: queryParams,
})
async list(
queryParams?: HttpTypes.AdminCollectionListParams,
headers?: ClientHeaders
) {
return this.client.fetch<HttpTypes.AdminCollectionListResponse>(
`/admin/collections`,
{
headers,
query: queryParams,
}
)
}
async retrieve(id: string, query?: SelectParams, headers?: ClientHeaders) {
return this.client.fetch<{ collection: HttpTypes.AdminCollection }>(
async retrieve(
id: string,
query?: HttpTypes.AdminCollectionParams,
headers?: ClientHeaders
) {
return this.client.fetch<HttpTypes.AdminCollectionResponse>(
`/admin/collections/${id}`,
{
query,
@@ -66,7 +68,7 @@ export class ProductCollection {
}
async delete(id: string, headers?: ClientHeaders) {
return this.client.fetch<DeleteResponse<"collection">>(
return this.client.fetch<HttpTypes.AdminCollectionDeleteResponse>(
`/admin/collections/${id}`,
{
method: "DELETE",
@@ -80,7 +82,7 @@ export class ProductCollection {
body: HttpTypes.AdminUpdateCollectionProducts,
headers?: ClientHeaders
) {
return this.client.fetch<{ collection: HttpTypes.AdminCollection }>(
return this.client.fetch<HttpTypes.AdminCollectionResponse>(
`/admin/collections/${id}/products`,
{
method: "POST",
@@ -0,0 +1,80 @@
import { HttpTypes } from "@medusajs/types"
import { Client } from "../client"
import { ClientHeaders } from "../types"
export class ProductTag {
private client: Client
constructor(client: Client) {
this.client = client
}
async create(
body: HttpTypes.AdminCreateProductTag,
query?: HttpTypes.AdminProductTagParams,
headers?: ClientHeaders
) {
return this.client.fetch<HttpTypes.AdminProductTagResponse>(
`/admin/product-tags`,
{
method: "POST",
headers,
body,
query,
}
)
}
async update(
id: string,
body: HttpTypes.AdminUpdateProductTag,
query?: HttpTypes.AdminProductTagParams,
headers?: ClientHeaders
) {
return this.client.fetch<HttpTypes.AdminProductTagResponse>(
`/admin/product-tags/${id}`,
{
method: "POST",
headers,
body,
query,
}
)
}
async list(
query?: HttpTypes.AdminProductTagListParams,
headers?: ClientHeaders
) {
return this.client.fetch<HttpTypes.AdminProductTagListResponse>(
`/admin/product-tags`,
{
headers,
query: query,
}
)
}
async retrieve(
id: string,
query?: HttpTypes.AdminProductTagParams,
headers?: ClientHeaders
) {
return this.client.fetch<HttpTypes.AdminProductTagResponse>(
`/admin/product-tags/${id}`,
{
query,
headers,
}
)
}
async delete(id: string, headers?: ClientHeaders) {
return this.client.fetch<HttpTypes.AdminProductTagDeleteResponse>(
`/admin/product-tags/${id}`,
{
method: "DELETE",
headers,
}
)
}
}