fix(dashboard,types,js-sdk): Locations & Shipping fixes and cleanup (#7715)

This commit is contained in:
Kasper Fabricius Kristensen
2024-06-17 16:10:39 +02:00
committed by GitHub
parent bc0c65c6b3
commit 2e8e7b27b6
116 changed files with 3512 additions and 3288 deletions
@@ -24,7 +24,7 @@ export class FulfillmentSet {
query?: HttpTypes.SelectParams,
headers?: ClientHeaders
) {
return await this.client.fetch<HttpTypes.AdminFulfillmentResponse>(
return await this.client.fetch<HttpTypes.AdminFulfillmentSetResponse>(
`/admin/fulfillment-sets/${id}/service-zones`,
{
method: "POST",
@@ -35,7 +35,7 @@ export class FulfillmentSet {
)
}
async retrieveServiceZones(
async retrieveServiceZone(
fulfillmentSetId: string,
serviceZoneId: string,
query?: HttpTypes.SelectParams,
@@ -58,7 +58,7 @@ export class FulfillmentSet {
query?: HttpTypes.SelectParams,
headers?: ClientHeaders
) {
return await this.client.fetch<HttpTypes.AdminFulfillmentResponse>(
return await this.client.fetch<HttpTypes.AdminFulfillmentSetResponse>(
`/admin/fulfillment-sets/${fulfillmentSetId}/service-zones/${serviceZoneId}`,
{
method: "POST",
+3
View File
@@ -1,6 +1,7 @@
import { Client } from "../client"
import { Customer } from "./customer"
import { Fulfillment } from "./fulfillment"
import { FulfillmentProvider } from "./fulfillment-provider"
import { FulfillmentSet } from "./fulfillment-set"
import { InventoryItem } from "./inventory-item"
import { Invite } from "./invite"
@@ -31,6 +32,7 @@ export class Admin {
public salesChannel: SalesChannel
public fulfillmentSet: FulfillmentSet
public fulfillment: Fulfillment
public fulfillmentProvider: FulfillmentProvider
public shippingOption: ShippingOption
public shippingProfile: ShippingProfile
public inventoryItem: InventoryItem
@@ -51,6 +53,7 @@ export class Admin {
this.salesChannel = new SalesChannel(client)
this.fulfillmentSet = new FulfillmentSet(client)
this.fulfillment = new Fulfillment(client)
this.fulfillmentProvider = new FulfillmentProvider(client)
this.shippingOption = new ShippingOption(client)
this.shippingProfile = new ShippingProfile(client)
this.inventoryItem = new InventoryItem(client)
@@ -1,8 +1,4 @@
export interface AdminFulfillmentProvider {
id: string
name: string
metadata: Record<string, unknown> | null
created_at: string
updated_at: string
deleted_at: string | null
is_enabled: boolean
}
@@ -1,4 +1,5 @@
import { GeoZoneType } from "../../../fulfillment"
import { AdminShippingOption } from "../../shipping-option"
export interface AdminGeoZone {
id: string
@@ -14,9 +15,10 @@ export interface AdminGeoZone {
export interface AdminServiceZone {
id: string
name: string
fulfillment_set_id: string
geo_zones: AdminGeoZone[]
shipping_options: any[]
shipping_options: AdminShippingOption[]
created_at: string
updated_at: string
deleted_at: string | null
@@ -26,6 +26,17 @@ export interface AdminShippingOptionRule {
deleted_at: string | null
}
// TODO: This type is complete, but it's not clear what the `rules` field is supposed to return in all cases.
export interface AdminShippingOptionPriceRule {
id: string
value: string
}
export interface AdminShippingOptionPrice extends AdminPrice {
price_rules: AdminShippingOptionPriceRule[]
rules_count: number
}
export interface AdminShippingOption {
id: string
name: string
@@ -39,7 +50,7 @@ export interface AdminShippingOption {
shipping_profile_id: string
shipping_profile: AdminShippingProfile
rules: AdminShippingOptionRule[]
prices: AdminPrice[]
prices: AdminShippingOptionPrice[]
data: Record<string, unknown> | null
metadata: Record<string, unknown> | null
created_at: Date
@@ -1,24 +1,24 @@
import { RuleOperatorType } from "../../../common"
import { ShippingOptionPriceType } from "../../../fulfillment"
interface AdminCreateShippingOptionRule {
export interface AdminCreateShippingOptionRule {
operator: RuleOperatorType
attribute: string
value: string | string[]
}
interface AdminCreateShippingOptionType {
export interface AdminCreateShippingOptionType {
label: string
description: string
code: string
}
interface AdminCreateShippingOptionPriceWithCurrency {
export interface AdminCreateShippingOptionPriceWithCurrency {
currency_code: string
amount: number
}
interface AdminCreateShippingOptionPriceWithRegion {
export interface AdminCreateShippingOptionPriceWithRegion {
region_id: string
amount: number
}
@@ -38,17 +38,18 @@ export interface AdminCreateShippingOption {
rules?: AdminCreateShippingOptionRule[]
}
interface AdminUpdateShippingOptionRule extends AdminCreateShippingOptionRule {
id: string
export interface AdminUpdateShippingOptionRule
extends AdminCreateShippingOptionRule {
id?: string
}
interface AdminUpdateShippingOptionPriceWithCurrency {
export interface AdminUpdateShippingOptionPriceWithCurrency {
id?: string
currency_code?: string
amount?: number
}
interface AdminUpdateShippingOptionPriceWithRegion {
export interface AdminUpdateShippingOptionPriceWithRegion {
id?: string
region_id?: string
amount?: number
@@ -1,3 +1,4 @@
import { AdminFulfillmentSet } from "../../fulfillment-set"
import { AdminSalesChannel } from "../../sales-channel"
export interface AdminStockLocationAddress {
@@ -18,5 +19,5 @@ export interface AdminStockLocation {
address_id: string
address?: AdminStockLocationAddress
sales_channels?: AdminSalesChannel[]
fulfillment_sets?: any[]
fulfillment_sets?: AdminFulfillmentSet[]
}