@instockng/api-client 1.0.32 → 1.0.33
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.
|
@@ -4,20 +4,21 @@
|
|
|
4
4
|
* These are the actual data-fetching functions used by hooks.
|
|
5
5
|
* They can also be imported directly in Server Components.
|
|
6
6
|
*/
|
|
7
|
+
import type { PublicProduct } from '../rpc-types';
|
|
7
8
|
/**
|
|
8
9
|
* Fetch products by brand slug
|
|
9
10
|
*
|
|
10
11
|
* @param brandSlug - Brand slug (e.g., 'toyland')
|
|
11
12
|
* @returns Products for the brand with variants and availability
|
|
12
13
|
*/
|
|
13
|
-
export declare function fetchProductsByBrand(brandSlug: string): Promise<
|
|
14
|
+
export declare function fetchProductsByBrand(brandSlug: string): Promise<PublicProduct[]>;
|
|
14
15
|
/**
|
|
15
16
|
* Fetch a single product by slug
|
|
16
17
|
*
|
|
17
18
|
* @param slug - Product slug (e.g., 'cotton-t-shirt')
|
|
18
19
|
* @returns Product with variants and availability
|
|
19
20
|
*/
|
|
20
|
-
export declare function fetchProductBySlug(slug: string): Promise<
|
|
21
|
+
export declare function fetchProductBySlug(slug: string): Promise<PublicProduct>;
|
|
21
22
|
/**
|
|
22
23
|
* Fetch product add-ons
|
|
23
24
|
*
|
|
@@ -25,7 +26,7 @@ export declare function fetchProductBySlug(slug: string): Promise<never>;
|
|
|
25
26
|
* @param limit - Max number of add-ons to return (default 6)
|
|
26
27
|
* @returns List of add-on products
|
|
27
28
|
*/
|
|
28
|
-
export declare function fetchProductAddons(slug: string, limit?: number): Promise<
|
|
29
|
+
export declare function fetchProductAddons(slug: string, limit?: number): Promise<PublicProduct[]>;
|
|
29
30
|
/**
|
|
30
31
|
* Fetch product recommendations (other products from same brand)
|
|
31
32
|
*
|
|
@@ -33,4 +34,4 @@ export declare function fetchProductAddons(slug: string, limit?: number): Promis
|
|
|
33
34
|
* @param limit - Max number of recommendations to return (default 4)
|
|
34
35
|
* @returns List of recommended products
|
|
35
36
|
*/
|
|
36
|
-
export declare function fetchProductRecommendations(slug: string, limit?: number): Promise<
|
|
37
|
+
export declare function fetchProductRecommendations(slug: string, limit?: number): Promise<PublicProduct[]>;
|
|
@@ -18,7 +18,7 @@ import { fetchProductsByBrand, fetchProductBySlug, fetchProductAddons, fetchProd
|
|
|
18
18
|
* console.log(products?.data[0].name); // Fully typed!
|
|
19
19
|
* ```
|
|
20
20
|
*/
|
|
21
|
-
export declare function useGetProducts(brandSlug: string, options?: Omit<UseQueryOptions<Awaited<ReturnType<typeof fetchProductsByBrand>>, Error>, 'queryKey' | 'queryFn'>): import("@tanstack/react-query").UseQueryResult<
|
|
21
|
+
export declare function useGetProducts(brandSlug: string, options?: Omit<UseQueryOptions<Awaited<ReturnType<typeof fetchProductsByBrand>>, Error>, 'queryKey' | 'queryFn'>): import("@tanstack/react-query").UseQueryResult<import("../..").Product[], Error>;
|
|
22
22
|
/**
|
|
23
23
|
* Hook to get a single product by slug using RPC
|
|
24
24
|
*
|
|
@@ -31,18 +31,18 @@ export declare function useGetProducts(brandSlug: string, options?: Omit<UseQuer
|
|
|
31
31
|
* console.log(product?.name); // Fully typed!
|
|
32
32
|
* ```
|
|
33
33
|
*/
|
|
34
|
-
export declare function useGetProduct(slug: string, options?: Omit<UseQueryOptions<Awaited<ReturnType<typeof fetchProductBySlug>>, Error>, 'queryKey' | 'queryFn'>): import("@tanstack/react-query").UseQueryResult<
|
|
34
|
+
export declare function useGetProduct(slug: string, options?: Omit<UseQueryOptions<Awaited<ReturnType<typeof fetchProductBySlug>>, Error>, 'queryKey' | 'queryFn'>): import("@tanstack/react-query").UseQueryResult<import("../..").Product, Error>;
|
|
35
35
|
/**
|
|
36
36
|
* Hook to get product add-ons
|
|
37
37
|
*
|
|
38
38
|
* @param slug - Product slug
|
|
39
39
|
* @param limit - Max number of add-ons
|
|
40
40
|
*/
|
|
41
|
-
export declare function useGetProductAddOns(slug: string, limit?: number, options?: Omit<UseQueryOptions<Awaited<ReturnType<typeof fetchProductAddons>>, Error>, 'queryKey' | 'queryFn'>): import("@tanstack/react-query").UseQueryResult<
|
|
41
|
+
export declare function useGetProductAddOns(slug: string, limit?: number, options?: Omit<UseQueryOptions<Awaited<ReturnType<typeof fetchProductAddons>>, Error>, 'queryKey' | 'queryFn'>): import("@tanstack/react-query").UseQueryResult<import("../..").Product[], Error>;
|
|
42
42
|
/**
|
|
43
43
|
* Hook to get product recommendations (other products from same brand)
|
|
44
44
|
*
|
|
45
45
|
* @param slug - Product slug
|
|
46
46
|
* @param limit - Max number of recommendations (default 4)
|
|
47
47
|
*/
|
|
48
|
-
export declare function useGetProductRecommendations(slug: string, limit?: number, options?: Omit<UseQueryOptions<Awaited<ReturnType<typeof fetchProductRecommendations>>, Error>, 'queryKey' | 'queryFn'>): import("@tanstack/react-query").UseQueryResult<
|
|
48
|
+
export declare function useGetProductRecommendations(slug: string, limit?: number, options?: Omit<UseQueryOptions<Awaited<ReturnType<typeof fetchProductRecommendations>>, Error>, 'queryKey' | 'queryFn'>): import("@tanstack/react-query").UseQueryResult<import("../..").Product[], Error>;
|
package/dist/rpc-types.d.ts
CHANGED
|
@@ -1614,7 +1614,7 @@ declare const dummyClient: {
|
|
|
1614
1614
|
}>;
|
|
1615
1615
|
};
|
|
1616
1616
|
export type PublicProductsResponse = InferResponseType<typeof dummyClient[':brandSlug']['$get']>;
|
|
1617
|
-
export type PublicProduct = (PublicProductsResponse
|
|
1617
|
+
export type PublicProduct = (Extract<PublicProductsResponse, Array<any>>[number]) & {
|
|
1618
1618
|
media?: {
|
|
1619
1619
|
type: 'image' | 'video';
|
|
1620
1620
|
url: string;
|