@instockng/api-client 1.0.21 → 1.0.24

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.
@@ -40,3 +40,21 @@ export async function fetchProductBySlug(slug) {
40
40
  }
41
41
  return res.json();
42
42
  }
43
+ /**
44
+ * Fetch product add-ons
45
+ *
46
+ * @param slug - Product slug
47
+ * @param limit - Max number of add-ons to return (default 6)
48
+ * @returns List of add-on products
49
+ */
50
+ export async function fetchProductAddons(slug, limit) {
51
+ const clients = createRpcClients(API_URL);
52
+ const res = await clients.productAddons[':slug'].$get({
53
+ param: { slug },
54
+ query: limit !== undefined ? { limit: String(limit) } : {},
55
+ });
56
+ if (!res.ok) {
57
+ throw new Error(`Failed to fetch product add-ons: ${res.statusText}`);
58
+ }
59
+ return res.json();
60
+ }