@stacksjs/commerce 0.70.88 → 0.70.91
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/coupons/destroy.d.ts +17 -0
- package/dist/coupons/fetch.d.ts +59 -0
- package/dist/coupons/index.d.ts +27 -0
- package/dist/coupons/store.d.ts +9 -0
- package/dist/coupons/update.d.ts +46 -0
- package/dist/customers/destroy.d.ts +14 -0
- package/dist/customers/fetch.d.ts +9 -0
- package/dist/customers/index.d.ts +14 -0
- package/dist/customers/store.d.ts +9 -0
- package/dist/customers/update.d.ts +10 -0
- package/dist/devices/destroy.d.ts +14 -0
- package/dist/devices/export.d.ts +35 -0
- package/dist/devices/fetch.d.ts +38 -0
- package/dist/devices/index.d.ts +27 -0
- package/dist/devices/store.d.ts +16 -0
- package/dist/devices/update.d.ts +26 -0
- package/dist/errors/destroy.d.ts +12 -0
- package/dist/errors/fetch.d.ts +54 -0
- package/dist/errors/index.d.ts +25 -0
- package/dist/errors/update.d.ts +24 -0
- package/dist/gift-cards/destroy.d.ts +23 -0
- package/dist/gift-cards/fetch.d.ts +88 -0
- package/dist/gift-cards/index.d.ts +23 -0
- package/dist/gift-cards/store.d.ts +9 -0
- package/dist/gift-cards/update.d.ts +30 -0
- package/dist/index.d.ts +58 -0
- package/dist/index.js +2 -0
- package/dist/orders/destroy.d.ts +28 -0
- package/dist/orders/events.d.ts +46 -0
- package/dist/orders/export.d.ts +32 -0
- package/dist/orders/fetch.d.ts +76 -0
- package/dist/orders/guards.d.ts +93 -0
- package/dist/orders/index.d.ts +82 -0
- package/dist/orders/place-order.d.ts +18 -0
- package/dist/orders/store.d.ts +9 -0
- package/dist/orders/totals.d.ts +24 -0
- package/dist/orders/update.d.ts +28 -0
- package/dist/orders/webhook.d.ts +31 -0
- package/dist/payments/destroy.d.ts +14 -0
- package/dist/payments/fetch.d.ts +55 -0
- package/dist/payments/index.d.ts +13 -0
- package/dist/payments/store.d.ts +9 -0
- package/dist/payments/update.d.ts +18 -0
- package/dist/products/categories/destroy.d.ts +30 -0
- package/dist/products/categories/fetch.d.ts +49 -0
- package/dist/products/categories/index.d.ts +33 -0
- package/dist/products/categories/store.d.ts +21 -0
- package/dist/products/categories/update.d.ts +33 -0
- package/dist/products/index.d.ts +24 -0
- package/dist/products/items/destroy.d.ts +14 -0
- package/dist/products/items/fetch.d.ts +66 -0
- package/dist/products/items/index.d.ts +23 -0
- package/dist/products/items/store.d.ts +16 -0
- package/dist/products/items/update.d.ts +82 -0
- package/dist/products/manufacturers/destroy.d.ts +14 -0
- package/dist/products/manufacturers/fetch.d.ts +23 -0
- package/dist/products/manufacturers/index.d.ts +21 -0
- package/dist/products/manufacturers/store.d.ts +16 -0
- package/dist/products/manufacturers/update.d.ts +26 -0
- package/dist/products/reviews/destroy.d.ts +14 -0
- package/dist/products/reviews/fetch.d.ts +22 -0
- package/dist/products/reviews/index.d.ts +22 -0
- package/dist/products/reviews/store.d.ts +16 -0
- package/dist/products/reviews/update.d.ts +19 -0
- package/dist/products/units/destroy.d.ts +14 -0
- package/dist/products/units/fetch.d.ts +9 -0
- package/dist/products/units/index.d.ts +9 -0
- package/dist/products/units/store.d.ts +31 -0
- package/dist/products/units/update.d.ts +25 -0
- package/dist/products/variants/destroy.d.ts +14 -0
- package/dist/products/variants/fetch.d.ts +9 -0
- package/dist/products/variants/index.d.ts +18 -0
- package/dist/products/variants/store.d.ts +43 -0
- package/dist/products/variants/update.d.ts +25 -0
- package/dist/receipts/destroy.d.ts +14 -0
- package/dist/receipts/fetch.d.ts +80 -0
- package/dist/receipts/index.d.ts +21 -0
- package/dist/receipts/store.d.ts +16 -0
- package/dist/receipts/update.d.ts +28 -0
- package/dist/shippings/delivery-routes/destroy.d.ts +14 -0
- package/dist/shippings/delivery-routes/fetch.d.ts +17 -0
- package/dist/shippings/delivery-routes/index.d.ts +23 -0
- package/dist/shippings/delivery-routes/store.d.ts +16 -0
- package/dist/shippings/delivery-routes/update.d.ts +27 -0
- package/dist/shippings/digital-deliveries/destroy.d.ts +28 -0
- package/dist/shippings/digital-deliveries/fetch.d.ts +9 -0
- package/dist/shippings/digital-deliveries/index.d.ts +23 -0
- package/dist/shippings/digital-deliveries/store.d.ts +16 -0
- package/dist/shippings/digital-deliveries/update.d.ts +29 -0
- package/dist/shippings/drivers/destroy.d.ts +16 -0
- package/dist/shippings/drivers/fetch.d.ts +9 -0
- package/dist/shippings/drivers/index.d.ts +21 -0
- package/dist/shippings/drivers/store.d.ts +16 -0
- package/dist/shippings/drivers/update.d.ts +26 -0
- package/dist/shippings/index.d.ts +27 -0
- package/dist/shippings/license-keys/destroy.d.ts +28 -0
- package/dist/shippings/license-keys/fetch.d.ts +9 -0
- package/dist/shippings/license-keys/index.d.ts +23 -0
- package/dist/shippings/license-keys/store.d.ts +17 -0
- package/dist/shippings/license-keys/update.d.ts +26 -0
- package/dist/shippings/shipping-methods/destroy.d.ts +28 -0
- package/dist/shippings/shipping-methods/fetch.d.ts +9 -0
- package/dist/shippings/shipping-methods/index.d.ts +25 -0
- package/dist/shippings/shipping-methods/store.d.ts +28 -0
- package/dist/shippings/shipping-methods/update.d.ts +27 -0
- package/dist/shippings/shipping-rates/destroy.d.ts +28 -0
- package/dist/shippings/shipping-rates/fetch.d.ts +98 -0
- package/dist/shippings/shipping-rates/index.d.ts +33 -0
- package/dist/shippings/shipping-rates/store.d.ts +17 -0
- package/dist/shippings/shipping-rates/update.d.ts +36 -0
- package/dist/shippings/shipping-zones/destroy.d.ts +28 -0
- package/dist/shippings/shipping-zones/fetch.d.ts +28 -0
- package/dist/shippings/shipping-zones/index.d.ts +23 -0
- package/dist/shippings/shipping-zones/store.d.ts +17 -0
- package/dist/shippings/shipping-zones/update.d.ts +35 -0
- package/dist/tax/destroy.d.ts +14 -0
- package/dist/tax/fetch.d.ts +9 -0
- package/dist/tax/index.d.ts +21 -0
- package/dist/tax/store.d.ts +16 -0
- package/dist/tax/update.d.ts +26 -0
- package/dist/types.d.ts +265 -0
- package/dist/utils/typed-stats.d.ts +23 -0
- package/dist/waitlists/index.d.ts +12 -0
- package/dist/waitlists/products/destroy.d.ts +15 -0
- package/dist/waitlists/products/fetch.d.ts +100 -0
- package/dist/waitlists/products/index.d.ts +30 -0
- package/dist/waitlists/products/store.d.ts +16 -0
- package/dist/waitlists/products/update.d.ts +26 -0
- package/dist/waitlists/restaurant/destroy.d.ts +15 -0
- package/dist/waitlists/restaurant/fetch.d.ts +149 -0
- package/dist/waitlists/restaurant/index.d.ts +40 -0
- package/dist/waitlists/restaurant/store.d.ts +16 -0
- package/dist/waitlists/restaurant/update.d.ts +43 -0
- package/package.json +1 -1
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Create a new shipping method
|
|
3
|
+
*
|
|
4
|
+
* @param data The shipping method data to store
|
|
5
|
+
* @returns The newly created shipping method record
|
|
6
|
+
*/
|
|
7
|
+
export declare function store(data: NewShippingMethod): Promise<ShippingMethodJsonResponse>;
|
|
8
|
+
/**
|
|
9
|
+
* Create multiple shipping methods at once
|
|
10
|
+
*
|
|
11
|
+
* @param data Array of shipping method data to store
|
|
12
|
+
* @returns Number of shipping methods created
|
|
13
|
+
*/
|
|
14
|
+
export declare function bulkStore(data: NewShippingMethod[]): Promise<number>;
|
|
15
|
+
/**
|
|
16
|
+
* Format shipping method options for dropdown menus or selectors
|
|
17
|
+
*
|
|
18
|
+
* @returns Array of formatted shipping method options with id, name, and status
|
|
19
|
+
*/
|
|
20
|
+
export declare function formatShippingOptions(): Promise<{ id: number, name: string, status: string | string[], base_rate: number }[]>;
|
|
21
|
+
/**
|
|
22
|
+
* Get active shipping methods
|
|
23
|
+
*
|
|
24
|
+
* @returns List of active shipping methods
|
|
25
|
+
*/
|
|
26
|
+
export declare function getActiveShippingMethods(): Promise<ShippingMethodJsonResponse[]>;
|
|
27
|
+
declare type ShippingMethodJsonResponse = ModelRow<typeof ShippingMethod>;
|
|
28
|
+
declare type NewShippingMethod = NewModelData<typeof ShippingMethod>;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Update a shipping method
|
|
3
|
+
*
|
|
4
|
+
* @param id The ID of the shipping method
|
|
5
|
+
* @param data The shipping method data to update
|
|
6
|
+
* @returns The updated shipping method record
|
|
7
|
+
*/
|
|
8
|
+
export declare function update(id: number, data: ShippingMethodUpdate): Promise<ShippingMethodJsonResponse>;
|
|
9
|
+
/**
|
|
10
|
+
* Update a shipping method's status
|
|
11
|
+
*
|
|
12
|
+
* @param id The ID of the shipping method
|
|
13
|
+
* @param status The new status
|
|
14
|
+
* @returns The updated shipping method with the new status
|
|
15
|
+
*/
|
|
16
|
+
export declare function updateStatus(id: number, status: string | string[]): Promise<ShippingMethodJsonResponse>;
|
|
17
|
+
/**
|
|
18
|
+
* Update pricing information for a shipping method
|
|
19
|
+
*
|
|
20
|
+
* @param id The ID of the shipping method
|
|
21
|
+
* @param base_rate Optional updated base rate
|
|
22
|
+
* @param free_shipping Optional updated free shipping threshold
|
|
23
|
+
* @returns The updated shipping method
|
|
24
|
+
*/
|
|
25
|
+
export declare function updatePricing(id: number, base_rate?: number, free_shipping?: number): Promise<ShippingMethodJsonResponse>;
|
|
26
|
+
declare type ShippingMethodJsonResponse = ModelRow<typeof ShippingMethod>;
|
|
27
|
+
declare type ShippingMethodUpdate = UpdateModelData<typeof ShippingMethod>;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Delete a shipping rate by ID
|
|
3
|
+
*
|
|
4
|
+
* @param id The ID of the shipping rate to delete
|
|
5
|
+
* @returns True if the shipping rate was deleted, false otherwise
|
|
6
|
+
*/
|
|
7
|
+
export declare function destroy(id: number): Promise<boolean>;
|
|
8
|
+
/**
|
|
9
|
+
* Delete multiple shipping rates by ID
|
|
10
|
+
*
|
|
11
|
+
* @param ids Array of shipping rate IDs to delete
|
|
12
|
+
* @returns Number of shipping rates deleted
|
|
13
|
+
*/
|
|
14
|
+
export declare function bulkDestroy(ids: number[]): Promise<number>;
|
|
15
|
+
/**
|
|
16
|
+
* Delete shipping rates by zone
|
|
17
|
+
*
|
|
18
|
+
* @param zone The zone to delete shipping rates for
|
|
19
|
+
* @returns Number of shipping rates deleted
|
|
20
|
+
*/
|
|
21
|
+
export declare function destroyByZone(zone: string): Promise<number>;
|
|
22
|
+
/**
|
|
23
|
+
* Delete shipping rates by method
|
|
24
|
+
*
|
|
25
|
+
* @param method The shipping method to delete rates for
|
|
26
|
+
* @returns Number of shipping rates deleted
|
|
27
|
+
*/
|
|
28
|
+
export declare function destroyByMethod(method: string): Promise<number>;
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Fetch a shipping rate by ID
|
|
3
|
+
*/
|
|
4
|
+
export declare function fetchById(id: number): Promise<ShippingRateJsonResponse | undefined>;
|
|
5
|
+
/**
|
|
6
|
+
* Fetch all shipping rates with their shipping zones and methods
|
|
7
|
+
*/
|
|
8
|
+
export declare function fetchAll(): Promise<ShippingRateJsonResponse[]>;
|
|
9
|
+
/**
|
|
10
|
+
* Get shipping rates by zone
|
|
11
|
+
*
|
|
12
|
+
* @param zoneId Shipping zone identifier
|
|
13
|
+
* @returns List of shipping rates for the specified zone
|
|
14
|
+
*/
|
|
15
|
+
export declare function getRatesByZone(zoneId: number): Promise<ShippingRateJsonResponse[]>;
|
|
16
|
+
/**
|
|
17
|
+
* Get shipping rate based on weight and zone.
|
|
18
|
+
*
|
|
19
|
+
* **⚠️ Caller-trusted zone (stacksjs/stacks#1879 Co-11).** This
|
|
20
|
+
* function does NOT verify that the `zoneId` actually serves the
|
|
21
|
+
* customer's declared address. A user in NYC can pass a Texas
|
|
22
|
+
* `zoneId` and get cheaper shipping. Use `getRateByWeightAndAddress`
|
|
23
|
+
* below when the request boundary involves untrusted input — it
|
|
24
|
+
* resolves the zone server-side from the address.
|
|
25
|
+
*
|
|
26
|
+
* Kept for back-compat with internal callers that have already
|
|
27
|
+
* resolved the zone (admin tooling, scheduled fulfillment jobs).
|
|
28
|
+
*
|
|
29
|
+
* @param weight Weight in the appropriate unit
|
|
30
|
+
* @param zoneId Shipping zone identifier (caller-trusted)
|
|
31
|
+
* @returns Matching shipping rate or undefined
|
|
32
|
+
*/
|
|
33
|
+
export declare function getRateByWeightAndZone(weight: number, zoneId: number): Promise<ShippingRateJsonResponse | undefined>;
|
|
34
|
+
/**
|
|
35
|
+
* Resolve the canonical shipping zone for a delivery address
|
|
36
|
+
* (stacksjs/stacks#1879 Co-11). Walks the zones table looking for
|
|
37
|
+
* the most specific match: postal-code → region → country-only.
|
|
38
|
+
* Returns null when no zone covers the address.
|
|
39
|
+
*
|
|
40
|
+
* The current zones schema stores `countries` as a comma-separated
|
|
41
|
+
* string (per `getZonesByCountry`'s LIKE-query); we use the same
|
|
42
|
+
* convention here. Apps with a normalized zone-country join table
|
|
43
|
+
* can override by replacing this function via the package facade.
|
|
44
|
+
*/
|
|
45
|
+
export declare function resolveZoneForAddress(address: ShippingAddress): Promise<number | null>;
|
|
46
|
+
/**
|
|
47
|
+
* Safer counterpart to `getRateByWeightAndZone`. Resolves the zone
|
|
48
|
+
* server-side from the delivery address, then fetches the rate
|
|
49
|
+
* for that zone. Throws when the address doesn't match any active
|
|
50
|
+
* zone — caller surfaces "we don't ship to your area" to the user.
|
|
51
|
+
*
|
|
52
|
+
* Use this from any HTTP/API boundary where the address is
|
|
53
|
+
* caller-controlled. Internal callers that already have a verified
|
|
54
|
+
* zone can stay on `getRateByWeightAndZone`.
|
|
55
|
+
*
|
|
56
|
+
* @example
|
|
57
|
+
* ```ts
|
|
58
|
+
* const rate = await getRateByWeightAndAddress(2.5, {
|
|
59
|
+
* countryCode: 'US',
|
|
60
|
+
* region: 'NY',
|
|
61
|
+
* postalCode: '10001',
|
|
62
|
+
* })
|
|
63
|
+
* if (!rate) throw new HttpError(404, 'No shipping rate for this address')
|
|
64
|
+
* ```
|
|
65
|
+
*/
|
|
66
|
+
export declare function getRateByWeightAndAddress(weight: number, address: ShippingAddress): Promise<ShippingRateJsonResponse | undefined>;
|
|
67
|
+
/**
|
|
68
|
+
* Verify that a caller-supplied `zoneId` actually serves the given
|
|
69
|
+
* address. Returns true when the address resolves to the same zone.
|
|
70
|
+
* Use when a flow already has a `zoneId` from earlier and just
|
|
71
|
+
* wants to confirm it wasn't tampered with mid-checkout.
|
|
72
|
+
*/
|
|
73
|
+
export declare function validateZoneMatchesAddress(zoneId: number, address: ShippingAddress): Promise<boolean>;
|
|
74
|
+
/**
|
|
75
|
+
* Format shipping rate options for dropdown menus or selectors
|
|
76
|
+
*
|
|
77
|
+
* @returns Array of formatted shipping rate options with id, method, zone, and rate
|
|
78
|
+
*/
|
|
79
|
+
export declare function formatShippingRateOptions(): Promise<{ id: number, shipping_method_id: number, shipping_zone_id: number, rate: number }[]>;
|
|
80
|
+
/**
|
|
81
|
+
* Get shipping rates for a specific method
|
|
82
|
+
*
|
|
83
|
+
* @param methodId The shipping method to filter by
|
|
84
|
+
* @returns List of shipping rates for the specified method
|
|
85
|
+
*/
|
|
86
|
+
export declare function getShippingRatesByMethod(methodId: number): Promise<ShippingRateJsonResponse[]>;
|
|
87
|
+
/**
|
|
88
|
+
* Shipping address shape used by the safe-by-default lookup helpers
|
|
89
|
+
* (stacksjs/stacks#1879 Co-11). All fields except `countryCode` are
|
|
90
|
+
* optional — zone matching tries them in order of specificity
|
|
91
|
+
* (postal → region → country) and returns the most specific match.
|
|
92
|
+
*/
|
|
93
|
+
export declare interface ShippingAddress {
|
|
94
|
+
countryCode: string
|
|
95
|
+
region?: string
|
|
96
|
+
postalCode?: string
|
|
97
|
+
}
|
|
98
|
+
declare type ShippingRateJsonResponse = ModelRow<typeof ShippingRate>;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export type { ShippingAddress } from './fetch';
|
|
2
|
+
export {
|
|
3
|
+
bulkDestroy,
|
|
4
|
+
destroy,
|
|
5
|
+
destroyByMethod,
|
|
6
|
+
destroyByZone,
|
|
7
|
+
} from './destroy';
|
|
8
|
+
// Functions from fetch.ts
|
|
9
|
+
export {
|
|
10
|
+
fetchAll,
|
|
11
|
+
fetchById,
|
|
12
|
+
formatShippingRateOptions,
|
|
13
|
+
// Safe-by-default address-based lookups (stacksjs/stacks#1879 Co-11).
|
|
14
|
+
// Use these from request handlers where the address is caller-controlled.
|
|
15
|
+
getRateByWeightAndAddress,
|
|
16
|
+
getRateByWeightAndZone,
|
|
17
|
+
getRatesByZone,
|
|
18
|
+
getShippingRatesByMethod,
|
|
19
|
+
resolveZoneForAddress,
|
|
20
|
+
validateZoneMatchesAddress,
|
|
21
|
+
} from './fetch';
|
|
22
|
+
// Functions from store.ts
|
|
23
|
+
export {
|
|
24
|
+
bulkStore,
|
|
25
|
+
store,
|
|
26
|
+
} from './store';
|
|
27
|
+
// Functions from update.ts
|
|
28
|
+
export {
|
|
29
|
+
bulkUpdate,
|
|
30
|
+
update,
|
|
31
|
+
updateByMethod,
|
|
32
|
+
updateByZone,
|
|
33
|
+
} from './update';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Create a new shipping rate
|
|
3
|
+
*
|
|
4
|
+
* @param data The shipping rate data to store
|
|
5
|
+
* @returns The newly created shipping rate record
|
|
6
|
+
*/
|
|
7
|
+
export declare function store(data: NewShippingRate): Promise<ShippingRateJsonResponse>;
|
|
8
|
+
/**
|
|
9
|
+
* Create multiple shipping rates at once
|
|
10
|
+
*
|
|
11
|
+
* @param data Array of shipping rate data to store
|
|
12
|
+
* @returns Number of shipping rates created
|
|
13
|
+
*/
|
|
14
|
+
export declare function bulkStore(data: NewShippingRate[]): Promise<number>;
|
|
15
|
+
// Import dependencies
|
|
16
|
+
declare type ShippingRateJsonResponse = ModelRow<typeof ShippingRate>;
|
|
17
|
+
declare type NewShippingRate = NewModelData<typeof ShippingRate>;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Update a shipping rate
|
|
3
|
+
*
|
|
4
|
+
* @param id The shipping rate ID to update
|
|
5
|
+
* @param data The shipping rate data to update
|
|
6
|
+
* @returns The updated shipping rate record
|
|
7
|
+
*/
|
|
8
|
+
export declare function update(id: number, data: ShippingRateUpdate): Promise<ShippingRateJsonResponse>;
|
|
9
|
+
/**
|
|
10
|
+
* Update multiple shipping rates at once
|
|
11
|
+
*
|
|
12
|
+
* @param updates Array of objects containing rate ID and update data
|
|
13
|
+
* @returns Number of shipping rates updated
|
|
14
|
+
*/
|
|
15
|
+
export declare function bulkUpdate(updates: Array<{
|
|
16
|
+
id: number
|
|
17
|
+
data: ShippingRateUpdate
|
|
18
|
+
}>): Promise<number>;
|
|
19
|
+
/**
|
|
20
|
+
* Update shipping rates by zone
|
|
21
|
+
*
|
|
22
|
+
* @param zone The zone to update rates for
|
|
23
|
+
* @param data The update data to apply
|
|
24
|
+
* @returns Number of shipping rates updated
|
|
25
|
+
*/
|
|
26
|
+
export declare function updateByZone(zone: number, data: ShippingRateUpdate): Promise<number>;
|
|
27
|
+
/**
|
|
28
|
+
* Update shipping rates by method
|
|
29
|
+
*
|
|
30
|
+
* @param method The shipping method to update rates for
|
|
31
|
+
* @param data The update data to apply
|
|
32
|
+
* @returns Number of shipping rates updated
|
|
33
|
+
*/
|
|
34
|
+
export declare function updateByMethod(method: string, data: ShippingRateUpdate): Promise<number>;
|
|
35
|
+
declare type ShippingRateJsonResponse = ModelRow<typeof ShippingRate>;
|
|
36
|
+
declare type ShippingRateUpdate = UpdateModelData<typeof ShippingRate>;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Delete a shipping zone by ID
|
|
3
|
+
*
|
|
4
|
+
* @param id The ID of the shipping zone to delete
|
|
5
|
+
* @returns True if the shipping zone was deleted, false otherwise
|
|
6
|
+
*/
|
|
7
|
+
export declare function destroy(id: number): Promise<boolean>;
|
|
8
|
+
/**
|
|
9
|
+
* Soft delete a shipping zone by ID (updates status to 'inactive')
|
|
10
|
+
*
|
|
11
|
+
* @param id The ID of the shipping zone to soft delete
|
|
12
|
+
* @returns True if the shipping zone was soft deleted, false otherwise
|
|
13
|
+
*/
|
|
14
|
+
export declare function softDelete(id: number): Promise<boolean>;
|
|
15
|
+
/**
|
|
16
|
+
* Delete multiple shipping zones by ID
|
|
17
|
+
*
|
|
18
|
+
* @param ids Array of shipping zone IDs to delete
|
|
19
|
+
* @returns Number of shipping zones deleted
|
|
20
|
+
*/
|
|
21
|
+
export declare function bulkDestroy(ids: number[]): Promise<number>;
|
|
22
|
+
/**
|
|
23
|
+
* Soft delete multiple shipping zones by ID (updates status to 'inactive')
|
|
24
|
+
*
|
|
25
|
+
* @param ids Array of shipping zone IDs to soft delete
|
|
26
|
+
* @returns Number of shipping zones soft deleted
|
|
27
|
+
*/
|
|
28
|
+
export declare function bulkSoftDelete(ids: number[]): Promise<number>;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Fetch all shipping zones
|
|
3
|
+
*/
|
|
4
|
+
export declare function fetchAll(): Promise<ShippingZoneJsonResponse[]>;
|
|
5
|
+
/**
|
|
6
|
+
* Fetch a shipping zone by ID
|
|
7
|
+
*/
|
|
8
|
+
export declare function fetchById(id: number): Promise<ShippingZoneJsonResponse | undefined>;
|
|
9
|
+
/**
|
|
10
|
+
* Format shipping zone options for dropdown menus or selectors
|
|
11
|
+
*
|
|
12
|
+
* @returns Array of formatted shipping zone options with id, name, and status
|
|
13
|
+
*/
|
|
14
|
+
export declare function formatZoneOptions(): Promise<{ id: number, name: string, status: string | string[], countries: string | undefined }[]>;
|
|
15
|
+
/**
|
|
16
|
+
* Get active shipping zones
|
|
17
|
+
*
|
|
18
|
+
* @returns List of active shipping zones
|
|
19
|
+
*/
|
|
20
|
+
export declare function getActiveShippingZones(): Promise<ShippingZoneJsonResponse[]>;
|
|
21
|
+
/**
|
|
22
|
+
* Get shipping zones by country code
|
|
23
|
+
*
|
|
24
|
+
* @param countryCode ISO country code
|
|
25
|
+
* @returns List of shipping zones covering the specified country
|
|
26
|
+
*/
|
|
27
|
+
export declare function getZonesByCountry(countryCode: string): Promise<ShippingZoneJsonResponse[]>;
|
|
28
|
+
declare type ShippingZoneJsonResponse = ModelRow<typeof ShippingZone>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export {
|
|
2
|
+
bulkDestroy,
|
|
3
|
+
bulkSoftDelete,
|
|
4
|
+
destroy,
|
|
5
|
+
softDelete,
|
|
6
|
+
} from './destroy';
|
|
7
|
+
export {
|
|
8
|
+
fetchAll,
|
|
9
|
+
fetchById,
|
|
10
|
+
formatZoneOptions,
|
|
11
|
+
getActiveShippingZones,
|
|
12
|
+
getZonesByCountry,
|
|
13
|
+
} from './fetch';
|
|
14
|
+
export {
|
|
15
|
+
bulkStore,
|
|
16
|
+
store,
|
|
17
|
+
} from './store';
|
|
18
|
+
export {
|
|
19
|
+
update,
|
|
20
|
+
updateCountries,
|
|
21
|
+
updateRegionsAndPostalCodes,
|
|
22
|
+
updateStatus,
|
|
23
|
+
} from './update';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Create a new shipping zone
|
|
3
|
+
*
|
|
4
|
+
* @param data The shipping zone data to store
|
|
5
|
+
* @returns The newly created shipping zone record
|
|
6
|
+
*/
|
|
7
|
+
export declare function store(data: NewShippingZone): Promise<ShippingZoneJsonResponse>;
|
|
8
|
+
/**
|
|
9
|
+
* Create multiple shipping zones at once
|
|
10
|
+
*
|
|
11
|
+
* @param data Array of shipping zone data to store
|
|
12
|
+
* @returns Number of shipping zones created
|
|
13
|
+
*/
|
|
14
|
+
export declare function bulkStore(data: NewShippingZone[]): Promise<number>;
|
|
15
|
+
// Import dependencies
|
|
16
|
+
declare type ShippingZoneJsonResponse = ModelRow<typeof ShippingZone>;
|
|
17
|
+
declare type NewShippingZone = NewModelData<typeof ShippingZone>;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Update a shipping zone
|
|
3
|
+
*
|
|
4
|
+
* @param id The ID of the shipping zone
|
|
5
|
+
* @param data The shipping zone data to update
|
|
6
|
+
* @returns The updated shipping zone record
|
|
7
|
+
*/
|
|
8
|
+
export declare function update(id: number, data: ShippingZoneUpdate): Promise<ShippingZoneJsonResponse>;
|
|
9
|
+
/**
|
|
10
|
+
* Update a shipping zone's status
|
|
11
|
+
*
|
|
12
|
+
* @param id The ID of the shipping zone
|
|
13
|
+
* @param status The new status
|
|
14
|
+
* @returns The updated shipping zone with the new status
|
|
15
|
+
*/
|
|
16
|
+
export declare function updateStatus(id: number, status: string | string[]): Promise<ShippingZoneJsonResponse>;
|
|
17
|
+
/**
|
|
18
|
+
* Update countries for a shipping zone
|
|
19
|
+
*
|
|
20
|
+
* @param id The ID of the shipping zone
|
|
21
|
+
* @param countries The updated countries JSON string
|
|
22
|
+
* @returns The updated shipping zone
|
|
23
|
+
*/
|
|
24
|
+
export declare function updateCountries(id: number, countries: string): Promise<ShippingZoneJsonResponse>;
|
|
25
|
+
/**
|
|
26
|
+
* Update regions and/or postal codes for a shipping zone
|
|
27
|
+
*
|
|
28
|
+
* @param id The ID of the shipping zone
|
|
29
|
+
* @param regions Optional updated regions JSON string
|
|
30
|
+
* @param postal_codes Optional updated postal codes JSON string
|
|
31
|
+
* @returns The updated shipping zone
|
|
32
|
+
*/
|
|
33
|
+
export declare function updateRegionsAndPostalCodes(id: number, regions?: string, postal_codes?: string): Promise<ShippingZoneJsonResponse>;
|
|
34
|
+
declare type ShippingZoneJsonResponse = ModelRow<typeof ShippingZone>;
|
|
35
|
+
declare type ShippingZoneUpdate = UpdateModelData<typeof ShippingZone>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Delete a tax rate by ID
|
|
3
|
+
*
|
|
4
|
+
* @param id The ID of the tax rate to delete
|
|
5
|
+
* @returns True if the tax rate was deleted, false otherwise
|
|
6
|
+
*/
|
|
7
|
+
export declare function destroy(id: number): Promise<boolean>;
|
|
8
|
+
/**
|
|
9
|
+
* Delete multiple tax rates by ID
|
|
10
|
+
*
|
|
11
|
+
* @param ids Array of tax rate IDs to delete
|
|
12
|
+
* @returns Number of tax rates deleted
|
|
13
|
+
*/
|
|
14
|
+
export declare function bulkDestroy(ids: number[]): Promise<number>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Fetch a tax rate by ID
|
|
3
|
+
*/
|
|
4
|
+
export declare function fetchById(id: number): Promise<TaxRateJsonResponse | undefined>;
|
|
5
|
+
/**
|
|
6
|
+
* Fetch all tax rates
|
|
7
|
+
*/
|
|
8
|
+
export declare function fetchAll(): Promise<TaxRateJsonResponse[]>;
|
|
9
|
+
declare type TaxRateJsonResponse = ModelRow<typeof TaxRate>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// Functions from destroy.ts
|
|
2
|
+
export {
|
|
3
|
+
bulkDestroy,
|
|
4
|
+
destroy,
|
|
5
|
+
} from './destroy';
|
|
6
|
+
// Functions from fetch.ts
|
|
7
|
+
export {
|
|
8
|
+
fetchAll,
|
|
9
|
+
fetchById,
|
|
10
|
+
} from './fetch';
|
|
11
|
+
// Functions from store.ts
|
|
12
|
+
export {
|
|
13
|
+
bulkStore,
|
|
14
|
+
store,
|
|
15
|
+
} from './store';
|
|
16
|
+
// Functions from update.ts
|
|
17
|
+
export {
|
|
18
|
+
update,
|
|
19
|
+
updateRate,
|
|
20
|
+
updateStatus,
|
|
21
|
+
} from './update';
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Create a new tax rate
|
|
3
|
+
*
|
|
4
|
+
* @param data Tax rate data to store
|
|
5
|
+
* @returns The newly created tax rate record
|
|
6
|
+
*/
|
|
7
|
+
export declare function store(data: NewTaxRate): Promise<TaxRateJsonResponse>;
|
|
8
|
+
/**
|
|
9
|
+
* Create multiple tax rates at once
|
|
10
|
+
*
|
|
11
|
+
* @param data Array of tax rate data to store
|
|
12
|
+
* @returns Number of tax rates created
|
|
13
|
+
*/
|
|
14
|
+
export declare function bulkStore(data: NewTaxRate[]): Promise<number>;
|
|
15
|
+
declare type TaxRateJsonResponse = ModelRow<typeof TaxRate>;
|
|
16
|
+
declare type NewTaxRate = NewModelData<typeof TaxRate>;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Update a tax rate
|
|
3
|
+
*
|
|
4
|
+
* @param id The id of the tax rate to update
|
|
5
|
+
* @param data The tax rate data to update
|
|
6
|
+
* @returns The updated tax rate record
|
|
7
|
+
*/
|
|
8
|
+
export declare function update(id: number, data: TaxRateUpdate): Promise<TaxRateJsonResponse>;
|
|
9
|
+
/**
|
|
10
|
+
* Update a tax rate's status
|
|
11
|
+
*
|
|
12
|
+
* @param id The ID of the tax rate
|
|
13
|
+
* @param status The new status
|
|
14
|
+
* @returns The updated tax rate with the new status
|
|
15
|
+
*/
|
|
16
|
+
export declare function updateStatus(id: number, status: 'active' | 'inactive'): Promise<TaxRateJsonResponse>;
|
|
17
|
+
/**
|
|
18
|
+
* Update rate information for a tax rate
|
|
19
|
+
*
|
|
20
|
+
* @param id The ID of the tax rate
|
|
21
|
+
* @param rate The updated rate value
|
|
22
|
+
* @returns The updated tax rate
|
|
23
|
+
*/
|
|
24
|
+
export declare function updateRate(id: number, rate: number): Promise<TaxRateJsonResponse>;
|
|
25
|
+
declare type TaxRateJsonResponse = ModelRow<typeof TaxRate>;
|
|
26
|
+
declare type TaxRateUpdate = UpdateModelData<typeof TaxRate>;
|