feat(dashboard): restructure create product flow (#7374)
This commit is contained in:
1 parent
76ec10f375
commit
6117af2704
46 files changed
+3161
-395
No files matched your search
@@ -20,7 +20,7 @@ export class Admin {
|
||||
query?: SelectParams,
|
||||
headers?: ClientHeaders
|
||||
) => {
|
||||
return this.client.fetch<{ region: HttpTypes.AdminRegion }>(
|
||||
return await this.client.fetch<{ region: HttpTypes.AdminRegion }>(
|
||||
`/admin/regions`,
|
||||
{
|
||||
method: "POST",
|
||||
@@ -36,7 +36,7 @@ export class Admin {
|
||||
query?: SelectParams,
|
||||
headers?: ClientHeaders
|
||||
) => {
|
||||
return this.client.fetch<{ region: HttpTypes.AdminRegion }>(
|
||||
return await this.client.fetch<{ region: HttpTypes.AdminRegion }>(
|
||||
`/admin/regions/${id}`,
|
||||
{
|
||||
method: "POST",
|
||||
@@ -50,7 +50,7 @@ export class Admin {
|
||||
queryParams?: FindParams & HttpTypes.AdminRegionFilters,
|
||||
headers?: ClientHeaders
|
||||
) => {
|
||||
return this.client.fetch<
|
||||
return await this.client.fetch<
|
||||
PaginatedResponse<{ regions: HttpTypes.AdminRegion[] }>
|
||||
>(`/admin/regions`, {
|
||||
query: queryParams,
|
||||
@@ -62,7 +62,7 @@ export class Admin {
|
||||
query?: SelectParams,
|
||||
headers?: ClientHeaders
|
||||
) => {
|
||||
return this.client.fetch<{ region: HttpTypes.AdminRegion }>(
|
||||
return await this.client.fetch<{ region: HttpTypes.AdminRegion }>(
|
||||
`/admin/regions/${id}`,
|
||||
{
|
||||
query,
|
||||
@@ -71,7 +71,7 @@ export class Admin {
|
||||
)
|
||||
},
|
||||
delete: async (id: string, headers?: ClientHeaders) => {
|
||||
return this.client.fetch<DeleteResponse<"region">>(
|
||||
return await this.client.fetch<DeleteResponse<"region">>(
|
||||
`/admin/regions/${id}`,
|
||||
{
|
||||
method: "DELETE",
|
||||
@@ -88,7 +88,7 @@ export class Admin {
|
||||
headers?: ClientHeaders
|
||||
) => {
|
||||
const { invite_token, ...rest } = input
|
||||
return this.client.fetch<{ user: HttpTypes.AdminUserResponse }>(
|
||||
return await this.client.fetch<{ user: HttpTypes.AdminUserResponse }>(
|
||||
`/admin/invites/accept?token=${input.invite_token}`,
|
||||
{
|
||||
method: "POST",
|
||||
@@ -103,7 +103,7 @@ export class Admin {
|
||||
query?: SelectParams,
|
||||
headers?: ClientHeaders
|
||||
) => {
|
||||
return this.client.fetch<{ invite: HttpTypes.AdminInviteResponse }>(
|
||||
return await this.client.fetch<{ invite: HttpTypes.AdminInviteResponse }>(
|
||||
`/admin/invites`,
|
||||
{
|
||||
method: "POST",
|
||||
@@ -118,7 +118,7 @@ export class Admin {
|
||||
query?: SelectParams,
|
||||
headers?: ClientHeaders
|
||||
) => {
|
||||
return this.client.fetch<{ invite: HttpTypes.AdminInviteResponse }>(
|
||||
return await this.client.fetch<{ invite: HttpTypes.AdminInviteResponse }>(
|
||||
`/admin/invites/${id}`,
|
||||
{
|
||||
headers,
|
||||
@@ -127,7 +127,7 @@ export class Admin {
|
||||
)
|
||||
},
|
||||
list: async (queryParams?: FindParams, headers?: ClientHeaders) => {
|
||||
return this.client.fetch<
|
||||
return await this.client.fetch<
|
||||
PaginatedResponse<{ invites: HttpTypes.AdminInviteResponse[] }>
|
||||
>(`/admin/invites`, {
|
||||
headers,
|
||||
@@ -135,7 +135,7 @@ export class Admin {
|
||||
})
|
||||
},
|
||||
resend: async (id: string, headers?: ClientHeaders) => {
|
||||
return this.client.fetch<{ invite: HttpTypes.AdminInviteResponse }>(
|
||||
return await this.client.fetch<{ invite: HttpTypes.AdminInviteResponse }>(
|
||||
`/admin/invites/${id}/resend`,
|
||||
{
|
||||
headers,
|
||||
@@ -143,7 +143,7 @@ export class Admin {
|
||||
)
|
||||
},
|
||||
delete: async (id: string, headers?: ClientHeaders) => {
|
||||
return this.client.fetch<DeleteResponse<"invite">>(
|
||||
return await this.client.fetch<DeleteResponse<"invite">>(
|
||||
`/admin/invites/${id}`,
|
||||
{
|
||||
method: "DELETE",
|
||||
@@ -153,6 +153,24 @@ export class Admin {
|
||||
},
|
||||
}
|
||||
|
||||
public products = {
|
||||
create: async (
|
||||
body: HttpTypes.AdminCreateProduct,
|
||||
query?: SelectParams,
|
||||
headers?: ClientHeaders
|
||||
) => {
|
||||
return await this.client.fetch<{ product: HttpTypes.AdminProduct }>(
|
||||
`/admin/products`,
|
||||
{
|
||||
method: "POST",
|
||||
headers,
|
||||
body,
|
||||
query,
|
||||
}
|
||||
)
|
||||
},
|
||||
}
|
||||
|
||||
public customer = {
|
||||
create: async (
|
||||
body: HttpTypes.AdminCreateCustomer,
|
||||
|
||||
@@ -37,3 +37,60 @@ export interface AdminProductOptionFilters extends BaseProductOptionFilters {}
|
||||
export interface AdminProductVariantFilters extends BaseProductVariantFilters {}
|
||||
export interface AdminProductCategoryFilters
|
||||
extends BaseProductCategoryFilters {}
|
||||
|
||||
export interface AdminCreateProductVariantPrice {
|
||||
currency_code: string
|
||||
amount: number
|
||||
min_quantity?: number
|
||||
max_quantity?: number
|
||||
}
|
||||
|
||||
export interface AdminCreateProductVariant {
|
||||
title: string
|
||||
sku?: string
|
||||
ean?: string
|
||||
upc?: string
|
||||
barcode?: string
|
||||
hs_code?: string
|
||||
mid_code?: string
|
||||
allow_backorder?: boolean
|
||||
manage_inventory?: boolean
|
||||
variant_rank?: number
|
||||
weight?: number
|
||||
length?: number
|
||||
height?: number
|
||||
width?: number
|
||||
origin_country?: string
|
||||
material?: string
|
||||
metadata?: Record<string, any>
|
||||
prices: AdminCreateProductVariantPrice[]
|
||||
options?: Record<string, any>
|
||||
}
|
||||
|
||||
export interface AdminCreateProduct {
|
||||
title: string
|
||||
subtitle?: string
|
||||
description?: string
|
||||
is_giftcard?: boolean
|
||||
discountable?: boolean
|
||||
images?: { url: string }[]
|
||||
thumbnail?: string
|
||||
handle?: string
|
||||
status?: string
|
||||
type_id?: string | null
|
||||
collection_id?: string | null
|
||||
categories?: { id: string }[]
|
||||
tags?: { id?: string; value?: string }[]
|
||||
options?: { title?: string; values?: string[] }[]
|
||||
variants?: AdminCreateProductVariant[]
|
||||
sales_channels?: { id: string }[]
|
||||
weight?: number
|
||||
length?: number
|
||||
height?: number
|
||||
width?: number
|
||||
hs_code?: string
|
||||
mid_code?: string
|
||||
origin_country?: string
|
||||
material?: string
|
||||
metadata?: Record<string, any>
|
||||
}
|
||||
Reference in new issue
Block a user