feat(freight): shop freight templates, server-side checkout fees, company dictionary (add-freight-templates)
This commit is contained in:
@@ -45,7 +45,11 @@ import type {
|
||||
ProductStatus,
|
||||
PublicFlashSaleSession,
|
||||
RedeemPointsBody,
|
||||
FreightTemplate,
|
||||
FreightTemplateInput,
|
||||
Shipment,
|
||||
ShippingCompany,
|
||||
ShippingQuote,
|
||||
Shop,
|
||||
ShopFlashSaleSession,
|
||||
ShopProfile,
|
||||
@@ -87,6 +91,7 @@ export interface ProductListQuery {
|
||||
export interface ProductUpsertBody {
|
||||
category_id?: string | null;
|
||||
brand_id?: string | null;
|
||||
freight_template_id?: string | null;
|
||||
slug: string;
|
||||
name: LocalizedText;
|
||||
description?: LocalizedText;
|
||||
@@ -100,6 +105,7 @@ export interface SkuUpsertBody {
|
||||
currency: string;
|
||||
stock: number;
|
||||
active?: boolean;
|
||||
weight_grams?: number | null;
|
||||
}
|
||||
|
||||
export interface ShipmentItemBody {
|
||||
@@ -248,6 +254,10 @@ export interface ApiClient {
|
||||
addAftersaleMessage(id: string, body: AftersaleMessageBody): Promise<AftersaleMessage>;
|
||||
/** Public points catalog: published products only. */
|
||||
listPointsProducts(): Promise<IntegralProduct[]>;
|
||||
/** Server-computed per-shop shipping fees for the current cart + address. */
|
||||
quoteShipping(address: Address, currency: string): Promise<ShippingQuote>;
|
||||
/** Public shipping-company dictionary. */
|
||||
listShippingCompanies(): Promise<ShippingCompany[]>;
|
||||
listMyRedemptions(): Promise<IntegralOrder[]>;
|
||||
redeemPoints(body: RedeemPointsBody): Promise<IntegralOrder>;
|
||||
/** Public: active flash-sale sessions with their purchasable items. */
|
||||
@@ -272,6 +282,7 @@ export interface ApiClient {
|
||||
carrier: string,
|
||||
trackingNo: string,
|
||||
items: ShipmentItemBody[],
|
||||
shippingCompanyCode?: string,
|
||||
): Promise<Shipment>;
|
||||
listShipments(): Promise<Shipment[]>;
|
||||
markShipped(id: string): Promise<Shipment>;
|
||||
@@ -302,6 +313,10 @@ export interface ApiClient {
|
||||
confirmAftersaleReceipt(id: string): Promise<Aftersale>;
|
||||
refundAftersale(id: string): Promise<Aftersale>;
|
||||
addAftersaleMessage(id: string, body: AftersaleMessageBody): Promise<AftersaleMessage>;
|
||||
listFreightTemplates(): Promise<FreightTemplate[]>;
|
||||
createFreightTemplate(body: FreightTemplateInput): Promise<FreightTemplate>;
|
||||
updateFreightTemplate(id: string, body: FreightTemplateInput): Promise<FreightTemplate>;
|
||||
deleteFreightTemplate(id: string): Promise<void>;
|
||||
};
|
||||
admin: {
|
||||
listUsers(page?: number): Promise<Paged<User>>;
|
||||
@@ -359,6 +374,9 @@ export function createApi(opts: ApiClientOptions): ApiClient {
|
||||
payOrder: (id) => r("POST", `/orders/${id}/pay`),
|
||||
confirmDelivered: (shipmentId) => r("POST", `/shipments/${shipmentId}/confirm-delivered`),
|
||||
listMyShipments: () => r("GET", "/shipments"),
|
||||
quoteShipping: (address, currency) =>
|
||||
r("POST", "/orders/shipping-quote", { shipping_address: address, currency }),
|
||||
listShippingCompanies: () => r("GET", "/shipping/companies"),
|
||||
requestInvoice: (orderId, title, taxNo, kind) =>
|
||||
r("POST", `/orders/${orderId}/invoice`, { title, tax_no: taxNo, kind }),
|
||||
listMyInvoices: () => r("GET", "/invoices"),
|
||||
@@ -403,10 +421,11 @@ export function createApi(opts: ApiClientOptions): ApiClient {
|
||||
upsertSku: (productId, body) => r("POST", `/shop/products/${productId}/skus`, body),
|
||||
listOrders: (q = {}) => r("GET", "/shop/orders", undefined, { ...q }),
|
||||
getOrder: (id) => r("GET", `/shop/orders/${id}`),
|
||||
createShipment: (orderId, carrier, trackingNo, items) =>
|
||||
createShipment: (orderId, carrier, trackingNo, items, shippingCompanyCode) =>
|
||||
r("POST", `/shop/orders/${orderId}/shipments`, {
|
||||
carrier,
|
||||
tracking_no: trackingNo,
|
||||
shipping_company_code: shippingCompanyCode ?? null,
|
||||
items,
|
||||
}),
|
||||
listShipments: () => r("GET", "/shop/shipments"),
|
||||
@@ -437,6 +456,10 @@ export function createApi(opts: ApiClientOptions): ApiClient {
|
||||
confirmAftersaleReceipt: (id) => r("POST", `/shop/aftersales/${id}/confirm-receipt`),
|
||||
refundAftersale: (id) => r("POST", `/shop/aftersales/${id}/refund`),
|
||||
addAftersaleMessage: (id, body) => r("POST", `/shop/aftersales/${id}/messages`, body),
|
||||
listFreightTemplates: () => r("GET", "/shop/freight-templates"),
|
||||
createFreightTemplate: (body) => r("POST", "/shop/freight-templates", body),
|
||||
updateFreightTemplate: (id, body) => r("PUT", `/shop/freight-templates/${id}`, body),
|
||||
deleteFreightTemplate: (id) => r("DELETE", `/shop/freight-templates/${id}`),
|
||||
},
|
||||
admin: {
|
||||
listUsers: (page = 1) => r("GET", "/admin/users", undefined, { page }),
|
||||
|
||||
Reference in New Issue
Block a user