@instockng/api-client 1.0.22 → 1.0.25
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/backend-types.d.ts +1 -1
- package/dist/fetchers/brands.d.ts +0 -2
- package/dist/fetchers/brands.js +2 -4
- package/dist/fetchers/carts.d.ts +3667 -759
- package/dist/fetchers/carts.js +11 -13
- package/dist/fetchers/delivery-zones.d.ts +0 -2
- package/dist/fetchers/delivery-zones.js +2 -4
- package/dist/fetchers/orders.d.ts +1130 -259
- package/dist/fetchers/orders.js +4 -6
- package/dist/fetchers/products.d.ts +638 -58
- package/dist/fetchers/products.js +4 -6
- package/dist/hooks/admin/abandoned-carts.d.ts +707 -125
- package/dist/hooks/admin/customers.d.ts +291 -0
- package/dist/hooks/admin/index.d.ts +8 -7
- package/dist/hooks/admin/index.js +8 -7
- package/dist/hooks/admin/media.d.ts +44 -0
- package/dist/hooks/admin/media.js +86 -0
- package/dist/hooks/admin/orders.d.ts +2531 -785
- package/dist/hooks/admin/products.d.ts +615 -33
- package/dist/hooks/admin/stats.d.ts +291 -0
- package/dist/hooks/admin/warehouses.d.ts +291 -0
- package/dist/hooks/public/carts.d.ts +3867 -957
- package/dist/hooks/public/orders.d.ts +930 -57
- package/dist/hooks/public/products.d.ts +627 -45
- package/dist/provider.d.ts +1 -0
- package/dist/provider.js +2 -1
- package/dist/rpc-client.d.ts +15535 -6438
- package/dist/rpc-client.js +1 -0
- package/dist/utils/query-keys.d.ts +4 -0
- package/dist/utils/query-keys.js +4 -0
- package/package.json +8 -7
package/dist/fetchers/orders.js
CHANGED
|
@@ -3,11 +3,9 @@
|
|
|
3
3
|
*
|
|
4
4
|
* These are the actual data-fetching functions used by hooks.
|
|
5
5
|
* They can also be imported directly in Server Components.
|
|
6
|
-
*
|
|
7
|
-
* API URL is hardcoded to https://oms-api.instock.ng
|
|
8
6
|
*/
|
|
9
7
|
import { createRpcClients } from '../rpc-client';
|
|
10
|
-
|
|
8
|
+
import { API_BASE_URL } from '../provider';
|
|
11
9
|
/**
|
|
12
10
|
* Fetch an order by ID and token
|
|
13
11
|
*
|
|
@@ -16,7 +14,7 @@ const API_URL = 'https://oms-api.instock.ng';
|
|
|
16
14
|
* @returns Order with items, delivery zone, and brand
|
|
17
15
|
*/
|
|
18
16
|
export async function fetchOrder(orderId, token) {
|
|
19
|
-
const clients = createRpcClients(
|
|
17
|
+
const clients = createRpcClients(API_BASE_URL);
|
|
20
18
|
const res = await clients.orders[':id'][':token'].$get({
|
|
21
19
|
param: { id: orderId, token },
|
|
22
20
|
});
|
|
@@ -33,7 +31,7 @@ export async function fetchOrder(orderId, token) {
|
|
|
33
31
|
* @returns Confirmed order
|
|
34
32
|
*/
|
|
35
33
|
export async function confirmOrder(orderId, token) {
|
|
36
|
-
const clients = createRpcClients(
|
|
34
|
+
const clients = createRpcClients(API_BASE_URL);
|
|
37
35
|
const res = await clients.orders.confirm.$post({
|
|
38
36
|
json: { orderId, token },
|
|
39
37
|
});
|
|
@@ -51,7 +49,7 @@ export async function confirmOrder(orderId, token) {
|
|
|
51
49
|
* @returns Array of recommended products
|
|
52
50
|
*/
|
|
53
51
|
export async function fetchOrderRecommendations(orderId, token, limit = 4) {
|
|
54
|
-
const clients = createRpcClients(
|
|
52
|
+
const clients = createRpcClients(API_BASE_URL);
|
|
55
53
|
const res = await clients.orders[':id'][':token'].recommendations.$get({
|
|
56
54
|
param: { id: orderId, token },
|
|
57
55
|
// @ts-ignore - Hono RPC type inference issue with query parameters
|