@instockng/api-client 1.0.5 → 1.0.6

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.
Files changed (186) hide show
  1. package/dist/enum-types.d.ts +8 -0
  2. package/dist/enum-types.js +5 -0
  3. package/dist/fetchers/carts.js +5 -0
  4. package/dist/hooks/admin/abandoned-carts.js +12 -8
  5. package/dist/hooks/admin/brands.js +15 -10
  6. package/dist/hooks/admin/customers.js +3 -2
  7. package/dist/hooks/admin/delivery-zones.js +24 -16
  8. package/dist/hooks/admin/discount-codes.js +24 -16
  9. package/dist/hooks/admin/inventory.js +15 -10
  10. package/dist/hooks/admin/orders.js +18 -12
  11. package/dist/hooks/admin/products.js +15 -10
  12. package/dist/hooks/admin/stats.js +3 -2
  13. package/dist/hooks/admin/variants.js +18 -12
  14. package/dist/hooks/admin/warehouses.js +15 -10
  15. package/dist/hooks/useApiConfig.d.ts +2 -1
  16. package/dist/hooks/useApiConfig.js +2 -2
  17. package/dist/provider.d.ts +7 -4
  18. package/dist/provider.js +5 -3
  19. package/dist/types.d.ts +1 -0
  20. package/package.json +1 -1
  21. package/dist/apps/backend/src/generated/zod/index.d.ts +0 -1114
  22. package/dist/apps/backend/src/generated/zod/index.js +0 -670
  23. package/dist/apps/backend/src/http-app.d.ts +0 -40
  24. package/dist/apps/backend/src/http-app.js +0 -106
  25. package/dist/apps/backend/src/lib/brand-response.d.ts +0 -14
  26. package/dist/apps/backend/src/lib/brand-response.js +0 -8
  27. package/dist/apps/backend/src/lib/cart-helpers.d.ts +0 -280
  28. package/dist/apps/backend/src/lib/cart-helpers.js +0 -93
  29. package/dist/apps/backend/src/lib/cart-recovery.d.ts +0 -30
  30. package/dist/apps/backend/src/lib/cart-recovery.js +0 -147
  31. package/dist/apps/backend/src/lib/cart-response.d.ts +0 -121
  32. package/dist/apps/backend/src/lib/cart-response.js +0 -150
  33. package/dist/apps/backend/src/lib/clerk.d.ts +0 -18
  34. package/dist/apps/backend/src/lib/clerk.js +0 -167
  35. package/dist/apps/backend/src/lib/delivery-zone-response.d.ts +0 -62
  36. package/dist/apps/backend/src/lib/delivery-zone-response.js +0 -24
  37. package/dist/apps/backend/src/lib/discount-code-response.d.ts +0 -42
  38. package/dist/apps/backend/src/lib/discount-code-response.js +0 -19
  39. package/dist/apps/backend/src/lib/discount.d.ts +0 -20
  40. package/dist/apps/backend/src/lib/discount.js +0 -35
  41. package/dist/apps/backend/src/lib/inventory.d.ts +0 -26
  42. package/dist/apps/backend/src/lib/inventory.js +0 -160
  43. package/dist/apps/backend/src/lib/meta-capi.d.ts +0 -48
  44. package/dist/apps/backend/src/lib/meta-capi.js +0 -120
  45. package/dist/apps/backend/src/lib/openapi.d.ts +0 -36
  46. package/dist/apps/backend/src/lib/openapi.js +0 -69
  47. package/dist/apps/backend/src/lib/order-recovery.d.ts +0 -367
  48. package/dist/apps/backend/src/lib/order-recovery.js +0 -373
  49. package/dist/apps/backend/src/lib/order-response.d.ts +0 -136
  50. package/dist/apps/backend/src/lib/order-response.js +0 -61
  51. package/dist/apps/backend/src/lib/pricing.d.ts +0 -39
  52. package/dist/apps/backend/src/lib/pricing.js +0 -62
  53. package/dist/apps/backend/src/lib/prisma.d.ts +0 -9
  54. package/dist/apps/backend/src/lib/prisma.js +0 -30
  55. package/dist/apps/backend/src/lib/product-response.d.ts +0 -82
  56. package/dist/apps/backend/src/lib/product-response.js +0 -29
  57. package/dist/apps/backend/src/lib/utils.d.ts +0 -32
  58. package/dist/apps/backend/src/lib/utils.js +0 -63
  59. package/dist/apps/backend/src/middleware/clerk-auth.d.ts +0 -8
  60. package/dist/apps/backend/src/middleware/clerk-auth.js +0 -89
  61. package/dist/apps/backend/src/middleware/cors.d.ts +0 -8
  62. package/dist/apps/backend/src/middleware/cors.js +0 -11
  63. package/dist/apps/backend/src/notifications/producers/meta-capi-producer.d.ts +0 -55
  64. package/dist/apps/backend/src/notifications/producers/meta-capi-producer.js +0 -125
  65. package/dist/apps/backend/src/notifications/producers/order-notification.d.ts +0 -9
  66. package/dist/apps/backend/src/notifications/producers/order-notification.js +0 -18
  67. package/dist/apps/backend/src/notifications/producers/prospect-recovery-notification.d.ts +0 -10
  68. package/dist/apps/backend/src/notifications/producers/prospect-recovery-notification.js +0 -11
  69. package/dist/apps/backend/src/routes/admin/abandoned-carts.d.ts +0 -605
  70. package/dist/apps/backend/src/routes/admin/abandoned-carts.js +0 -194
  71. package/dist/apps/backend/src/routes/admin/brands.d.ts +0 -175
  72. package/dist/apps/backend/src/routes/admin/brands.js +0 -118
  73. package/dist/apps/backend/src/routes/admin/customers.d.ts +0 -306
  74. package/dist/apps/backend/src/routes/admin/customers.js +0 -39
  75. package/dist/apps/backend/src/routes/admin/delivery-zones.d.ts +0 -438
  76. package/dist/apps/backend/src/routes/admin/delivery-zones.js +0 -300
  77. package/dist/apps/backend/src/routes/admin/discount-codes.d.ts +0 -478
  78. package/dist/apps/backend/src/routes/admin/discount-codes.js +0 -418
  79. package/dist/apps/backend/src/routes/admin/inventory.d.ts +0 -273
  80. package/dist/apps/backend/src/routes/admin/inventory.js +0 -189
  81. package/dist/apps/backend/src/routes/admin/orders.d.ts +0 -1478
  82. package/dist/apps/backend/src/routes/admin/orders.js +0 -503
  83. package/dist/apps/backend/src/routes/admin/products.d.ts +0 -860
  84. package/dist/apps/backend/src/routes/admin/products.js +0 -107
  85. package/dist/apps/backend/src/routes/admin/stats.d.ts +0 -288
  86. package/dist/apps/backend/src/routes/admin/stats.js +0 -55
  87. package/dist/apps/backend/src/routes/admin/variants.d.ts +0 -239
  88. package/dist/apps/backend/src/routes/admin/variants.js +0 -173
  89. package/dist/apps/backend/src/routes/admin/warehouses.d.ts +0 -373
  90. package/dist/apps/backend/src/routes/admin/warehouses.js +0 -123
  91. package/dist/apps/backend/src/routes/public/brands.d.ts +0 -40
  92. package/dist/apps/backend/src/routes/public/brands.js +0 -38
  93. package/dist/apps/backend/src/routes/public/carts.d.ts +0 -2655
  94. package/dist/apps/backend/src/routes/public/carts.js +0 -631
  95. package/dist/apps/backend/src/routes/public/delivery-zones.d.ts +0 -35
  96. package/dist/apps/backend/src/routes/public/delivery-zones.js +0 -62
  97. package/dist/apps/backend/src/routes/public/orders.d.ts +0 -323
  98. package/dist/apps/backend/src/routes/public/orders.js +0 -160
  99. package/dist/apps/backend/src/routes/public/products.d.ts +0 -449
  100. package/dist/apps/backend/src/routes/public/products.js +0 -133
  101. package/dist/apps/backend/src/types/index.d.ts +0 -42
  102. package/dist/apps/backend/src/types/index.js +0 -2
  103. package/dist/apps/backend/src/validators/brand.d.ts +0 -17
  104. package/dist/apps/backend/src/validators/brand.js +0 -15
  105. package/dist/apps/backend/src/validators/delivery-zone.d.ts +0 -31
  106. package/dist/apps/backend/src/validators/delivery-zone.js +0 -51
  107. package/dist/apps/backend/src/validators/discount-code.d.ts +0 -74
  108. package/dist/apps/backend/src/validators/discount-code.js +0 -50
  109. package/dist/apps/backend/src/validators/inventory.d.ts +0 -20
  110. package/dist/apps/backend/src/validators/inventory.js +0 -15
  111. package/dist/apps/backend/src/validators/order.d.ts +0 -87
  112. package/dist/apps/backend/src/validators/order.js +0 -61
  113. package/dist/apps/backend/src/validators/product.d.ts +0 -18
  114. package/dist/apps/backend/src/validators/product.js +0 -19
  115. package/dist/apps/backend/src/validators/variant.d.ts +0 -19
  116. package/dist/apps/backend/src/validators/variant.js +0 -19
  117. package/dist/apps/backend/src/validators/warehouse.d.ts +0 -15
  118. package/dist/apps/backend/src/validators/warehouse.js +0 -15
  119. package/dist/packages/api-client/src/backend-types.d.ts +0 -10
  120. package/dist/packages/api-client/src/backend-types.js +0 -10
  121. package/dist/packages/api-client/src/client.d.ts +0 -20
  122. package/dist/packages/api-client/src/client.js +0 -40
  123. package/dist/packages/api-client/src/fetchers/brands.d.ts +0 -25
  124. package/dist/packages/api-client/src/fetchers/brands.js +0 -26
  125. package/dist/packages/api-client/src/fetchers/carts.d.ts +0 -2335
  126. package/dist/packages/api-client/src/fetchers/carts.js +0 -169
  127. package/dist/packages/api-client/src/fetchers/delivery-zones.d.ts +0 -28
  128. package/dist/packages/api-client/src/fetchers/delivery-zones.js +0 -26
  129. package/dist/packages/api-client/src/fetchers/index.d.ts +0 -22
  130. package/dist/packages/api-client/src/fetchers/index.js +0 -22
  131. package/dist/packages/api-client/src/fetchers/orders.d.ts +0 -283
  132. package/dist/packages/api-client/src/fetchers/orders.js +0 -44
  133. package/dist/packages/api-client/src/fetchers/products.d.ts +0 -386
  134. package/dist/packages/api-client/src/fetchers/products.js +0 -42
  135. package/dist/packages/api-client/src/hooks/admin/abandoned-carts.d.ts +0 -535
  136. package/dist/packages/api-client/src/hooks/admin/abandoned-carts.js +0 -83
  137. package/dist/packages/api-client/src/hooks/admin/brands.d.ts +0 -79
  138. package/dist/packages/api-client/src/hooks/admin/brands.js +0 -108
  139. package/dist/packages/api-client/src/hooks/admin/customers.d.ts +0 -278
  140. package/dist/packages/api-client/src/hooks/admin/customers.js +0 -26
  141. package/dist/packages/api-client/src/hooks/admin/delivery-zones.d.ts +0 -270
  142. package/dist/packages/api-client/src/hooks/admin/delivery-zones.js +0 -176
  143. package/dist/packages/api-client/src/hooks/admin/discount-codes.d.ts +0 -299
  144. package/dist/packages/api-client/src/hooks/admin/discount-codes.js +0 -165
  145. package/dist/packages/api-client/src/hooks/admin/index.d.ts +0 -16
  146. package/dist/packages/api-client/src/hooks/admin/index.js +0 -16
  147. package/dist/packages/api-client/src/hooks/admin/inventory.d.ts +0 -224
  148. package/dist/packages/api-client/src/hooks/admin/inventory.js +0 -107
  149. package/dist/packages/api-client/src/hooks/admin/orders.d.ts +0 -1380
  150. package/dist/packages/api-client/src/hooks/admin/orders.js +0 -175
  151. package/dist/packages/api-client/src/hooks/admin/products.d.ts +0 -374
  152. package/dist/packages/api-client/src/hooks/admin/products.js +0 -89
  153. package/dist/packages/api-client/src/hooks/admin/stats.d.ts +0 -277
  154. package/dist/packages/api-client/src/hooks/admin/stats.js +0 -25
  155. package/dist/packages/api-client/src/hooks/admin/variants.d.ts +0 -115
  156. package/dist/packages/api-client/src/hooks/admin/variants.js +0 -127
  157. package/dist/packages/api-client/src/hooks/admin/warehouses.d.ts +0 -277
  158. package/dist/packages/api-client/src/hooks/admin/warehouses.js +0 -108
  159. package/dist/packages/api-client/src/hooks/public/brands.d.ts +0 -33
  160. package/dist/packages/api-client/src/hooks/public/brands.js +0 -30
  161. package/dist/packages/api-client/src/hooks/public/carts.d.ts +0 -2405
  162. package/dist/packages/api-client/src/hooks/public/carts.js +0 -213
  163. package/dist/packages/api-client/src/hooks/public/delivery-zones.d.ts +0 -34
  164. package/dist/packages/api-client/src/hooks/public/delivery-zones.js +0 -28
  165. package/dist/packages/api-client/src/hooks/public/index.d.ts +0 -10
  166. package/dist/packages/api-client/src/hooks/public/index.js +0 -10
  167. package/dist/packages/api-client/src/hooks/public/orders.d.ts +0 -302
  168. package/dist/packages/api-client/src/hooks/public/orders.js +0 -50
  169. package/dist/packages/api-client/src/hooks/public/products.d.ts +0 -398
  170. package/dist/packages/api-client/src/hooks/public/products.js +0 -47
  171. package/dist/packages/api-client/src/hooks/use-query-unwrapped.d.ts +0 -20
  172. package/dist/packages/api-client/src/hooks/use-query-unwrapped.js +0 -22
  173. package/dist/packages/api-client/src/hooks/useApiConfig.d.ts +0 -12
  174. package/dist/packages/api-client/src/hooks/useApiConfig.js +0 -14
  175. package/dist/packages/api-client/src/index.d.ts +0 -20
  176. package/dist/packages/api-client/src/index.js +0 -25
  177. package/dist/packages/api-client/src/provider.d.ts +0 -36
  178. package/dist/packages/api-client/src/provider.js +0 -54
  179. package/dist/packages/api-client/src/rpc-client.d.ts +0 -9035
  180. package/dist/packages/api-client/src/rpc-client.js +0 -78
  181. package/dist/packages/api-client/src/rpc-types.d.ts +0 -76
  182. package/dist/packages/api-client/src/rpc-types.js +0 -7
  183. package/dist/packages/api-client/src/types.d.ts +0 -37
  184. package/dist/packages/api-client/src/types.js +0 -16
  185. package/dist/packages/api-client/src/utils/query-keys.d.ts +0 -106
  186. package/dist/packages/api-client/src/utils/query-keys.js +0 -108
@@ -1,78 +0,0 @@
1
- /**
2
- * Hono RPC client for type-safe API access
3
- *
4
- * This creates typed RPC clients that import backend types directly.
5
- * The clients are used by RPC hooks to provide end-to-end type safety.
6
- */
7
- import { hc } from 'hono/client';
8
- /**
9
- * Create typed RPC clients for all public endpoints
10
- *
11
- * @param baseURL - Base URL for API requests (e.g., 'https://api.example.com')
12
- * @returns Object with typed Hono RPC clients for each endpoint
13
- *
14
- * @example
15
- * ```ts
16
- * const clients = createRpcClients('https://api.example.com');
17
- * const res = await clients.carts[':id'].$get({ param: { id: 'cart-123' } });
18
- * const data = await res.json(); // Fully typed!
19
- * ```
20
- */
21
- export function createRpcClients(baseURL) {
22
- const fullBaseUrl = `${baseURL}/v1`;
23
- return {
24
- carts: hc(`${fullBaseUrl}/carts`),
25
- orders: hc(`${fullBaseUrl}/orders`),
26
- products: hc(`${fullBaseUrl}/products`),
27
- deliveryZones: hc(`${fullBaseUrl}/delivery-zones`),
28
- brands: hc(`${fullBaseUrl}/brands`),
29
- };
30
- }
31
- /**
32
- * Create typed RPC clients for all admin endpoints
33
- *
34
- * @param baseURL - Base URL for API requests (e.g., 'https://api.example.com')
35
- * @returns Object with typed Hono RPC clients for each admin endpoint
36
- *
37
- * @example
38
- * ```ts
39
- * const clients = createAdminRpcClients('https://api.example.com');
40
- * const res = await clients.orders.index.$get({
41
- * headers: { Authorization: `Bearer ${token}` }
42
- * });
43
- * const data = await res.json(); // Fully typed!
44
- * ```
45
- */
46
- export function createAdminRpcClients(baseURL) {
47
- const fullBaseUrl = `${baseURL}/v1/admin`;
48
- return {
49
- orders: hc(`${fullBaseUrl}/orders`),
50
- brands: hc(`${fullBaseUrl}/brands`),
51
- products: hc(`${fullBaseUrl}/products`),
52
- variants: hc(`${fullBaseUrl}/variants`),
53
- warehouses: hc(`${fullBaseUrl}/warehouses`),
54
- inventory: hc(`${fullBaseUrl}/inventory`),
55
- customers: hc(`${fullBaseUrl}/customers`),
56
- stats: hc(`${fullBaseUrl}/stats`),
57
- abandonedCarts: hc(`${fullBaseUrl}/abandoned-carts`),
58
- discountCodes: hc(`${fullBaseUrl}/discount-codes`),
59
- deliveryZones: hc(`${fullBaseUrl}/delivery-zones`),
60
- };
61
- }
62
- /**
63
- * Helper to create auth headers for admin RPC requests
64
- *
65
- * @param authToken - Clerk authentication token
66
- * @returns Headers object with Authorization header
67
- *
68
- * @example
69
- * ```ts
70
- * const res = await client.brands.index.$get(
71
- * {},
72
- * authHeaders(token)
73
- * );
74
- * ```
75
- */
76
- export function authHeaders(authToken) {
77
- return { headers: { Authorization: `Bearer ${authToken}` } };
78
- }
@@ -1,76 +0,0 @@
1
- /**
2
- * Type extraction from React Query hooks
3
- *
4
- * The hooks already have proper Hono RPC type inference built-in.
5
- * We extract the data types from UseQueryResult<T, E> to get the actual response types.
6
- */
7
- import type { UseQueryResult } from '@tanstack/react-query';
8
- type QueryData<T> = T extends UseQueryResult<infer D, any> ? NonNullable<D> : never;
9
- import type { useGetCart, useGetOrder, useGetProducts, useGetDeliveryZones } from './hooks/public';
10
- import type { useListOrders, useGetOrder as useGetAdminOrder, useListBrands, useListProducts, useGetProduct, useSearchVariants, useListWarehouses, useListInventory, useGetCustomerHistory, useGetStats, useListAbandonedCarts, useListDiscountCodes, useGetDiscountCode, useGetDiscountCodeAnalytics, useListDeliveryZones as useListAdminDeliveryZones, useListStates } from './hooks/admin';
11
- export type AdminBrandsResponse = QueryData<ReturnType<typeof useListBrands>>;
12
- export type Brand = AdminBrandsResponse extends Array<infer Item> ? Item : never;
13
- export type AdminProductsResponse = QueryData<ReturnType<typeof useListProducts>>;
14
- export type AdminProduct = AdminProductsResponse extends Array<infer Item> ? Item : never;
15
- export type AdminProductFull = QueryData<ReturnType<typeof useGetProduct>>;
16
- export type AdminOrdersResponse = QueryData<ReturnType<typeof useListOrders>>;
17
- export type AdminOrder = AdminOrdersResponse extends {
18
- data: Array<infer Item>;
19
- } ? Item : never;
20
- export type AdminOrderFull = QueryData<ReturnType<typeof useGetAdminOrder>>;
21
- export type AdminVariantsResponse = QueryData<ReturnType<typeof useSearchVariants>>;
22
- export type Variant = AdminVariantsResponse extends Array<infer Item> ? Item : never;
23
- export type AdminWarehousesResponse = QueryData<ReturnType<typeof useListWarehouses>>;
24
- export type Warehouse = AdminWarehousesResponse extends Array<infer Item> ? Item : never;
25
- export type AdminInventoryResponse = QueryData<ReturnType<typeof useListInventory>>;
26
- export type InventoryItem = AdminInventoryResponse extends Array<infer Item> ? Item : never;
27
- export type AdminCustomerHistoryResponse = QueryData<ReturnType<typeof useGetCustomerHistory>>;
28
- export type Customer = AdminCustomerHistoryResponse extends {
29
- customer: infer C;
30
- } ? C : never;
31
- export type CustomerOrder = AdminCustomerHistoryResponse extends {
32
- orders: Array<infer Item>;
33
- } ? Item : never;
34
- export type AdminStatsResponse = QueryData<ReturnType<typeof useGetStats>>;
35
- export type AdminStatsOverview = AdminStatsResponse extends {
36
- overview: infer O;
37
- } ? O : never;
38
- export type RecentOrder = AdminStatsResponse extends {
39
- recentOrders: Array<infer Item>;
40
- } ? Item : never;
41
- export type AdminAbandonedCartsResponse = QueryData<ReturnType<typeof useListAbandonedCarts>>;
42
- export type AbandonedCart = AdminAbandonedCartsResponse extends {
43
- carts: Array<infer Item>;
44
- } ? Item : never;
45
- export type AdminDiscountCodesResponse = QueryData<ReturnType<typeof useListDiscountCodes>>;
46
- export type DiscountCode = AdminDiscountCodesResponse extends {
47
- data: Array<infer Item>;
48
- } ? Item : never;
49
- export type DiscountCodeFull = QueryData<ReturnType<typeof useGetDiscountCode>>;
50
- export type DiscountCodeAnalytics = QueryData<ReturnType<typeof useGetDiscountCodeAnalytics>>;
51
- export type AdminDeliveryZonesResponse = QueryData<ReturnType<typeof useListAdminDeliveryZones>>;
52
- export type AdminDeliveryZone = AdminDeliveryZonesResponse extends readonly (infer Item)[] ? Item : AdminDeliveryZonesResponse extends (infer Item)[] ? Item : never;
53
- export type AdminStatesResponse = QueryData<ReturnType<typeof useListStates>>;
54
- export type AdminStateWithZones = AdminStatesResponse extends Array<infer Item> ? Item : never;
55
- export type State = Omit<AdminStateWithZones, 'deliveryZones'>;
56
- export type AdminState = State;
57
- export type PublicProductsResponse = QueryData<ReturnType<typeof useGetProducts>>;
58
- export type PublicProduct = PublicProductsResponse extends Array<infer Item> ? Item : never;
59
- export type Product = PublicProduct;
60
- export type PublicDeliveryZonesResponse = QueryData<ReturnType<typeof useGetDeliveryZones>>;
61
- export type PublicDeliveryZoneState = PublicDeliveryZonesResponse extends Array<infer Item> ? Item : never;
62
- export type DeliveryZoneState = PublicDeliveryZoneState;
63
- export type DeliveryZone = PublicDeliveryZoneState extends {
64
- zones: Array<infer Zone>;
65
- } ? Zone : never;
66
- export type PublicCartResponse = QueryData<ReturnType<typeof useGetCart>>;
67
- export type Cart = PublicCartResponse;
68
- export type CartItem = PublicCartResponse extends {
69
- items: Array<infer Item>;
70
- } ? Item : never;
71
- export type PublicOrderResponse = QueryData<ReturnType<typeof useGetOrder>>;
72
- export type Order = PublicOrderResponse;
73
- export type OrderItem = Order extends {
74
- items: Array<infer Item>;
75
- } ? Item : never;
76
- export {};
@@ -1,7 +0,0 @@
1
- /**
2
- * Type extraction from React Query hooks
3
- *
4
- * The hooks already have proper Hono RPC type inference built-in.
5
- * We extract the data types from UseQueryResult<T, E> to get the actual response types.
6
- */
7
- export {};
@@ -1,37 +0,0 @@
1
- /**
2
- * Type exports for API client
3
- *
4
- * These types are derived directly from Hono RPC routes for end-to-end type safety.
5
- *
6
- * Usage in frontend:
7
- * ```ts
8
- * import type { Brand, InventoryItem } from '@oms/api-client'
9
- * const [selectedBrand, setSelectedBrand] = useState<Brand | null>(null)
10
- * ```
11
- */
12
- import type { AdminOrderFull, PublicCartResponse } from './rpc-types';
13
- export * from './hooks/public';
14
- export * as admin from './hooks/admin';
15
- export * from './rpc-types';
16
- export type { PublicProduct as Product } from './rpc-types';
17
- export type { PublicDeliveryZoneState as DeliveryZoneState } from './rpc-types';
18
- export type { PublicCartResponse as CartResponse, PublicCartResponse as Cart } from './rpc-types';
19
- export type { PublicOrderResponse as Order } from './rpc-types';
20
- export type { AdminOrderFull } from './rpc-types';
21
- export type { AdminProductFull } from './rpc-types';
22
- export type { DiscountCodeFull } from './rpc-types';
23
- export type { AdminCustomerHistoryResponse as CustomerHistory } from './rpc-types';
24
- export type { AdminStatsResponse as AdminStats } from './rpc-types';
25
- export type { DiscountCodeAnalytics } from './rpc-types';
26
- export type { CartItem } from './rpc-types';
27
- export type { OrderItem } from './rpc-types';
28
- export type { DeliveryZone } from './rpc-types';
29
- export type { AdminStatsOverview } from './rpc-types';
30
- export type { RecentOrder } from './rpc-types';
31
- export type { Customer } from './rpc-types';
32
- export type { CustomerOrder } from './rpc-types';
33
- export type { AdminDeliveryZone } from './rpc-types';
34
- export type { AdminState } from './rpc-types';
35
- export type OrderStatus = AdminOrderFull['status'];
36
- export type ProspectReason = NonNullable<AdminOrderFull['prospectReason']>;
37
- export type PaymentMethod = PublicCartResponse['availablePaymentMethods'][number];
@@ -1,16 +0,0 @@
1
- /**
2
- * Type exports for API client
3
- *
4
- * These types are derived directly from Hono RPC routes for end-to-end type safety.
5
- *
6
- * Usage in frontend:
7
- * ```ts
8
- * import type { Brand, InventoryItem } from '@oms/api-client'
9
- * const [selectedBrand, setSelectedBrand] = useState<Brand | null>(null)
10
- * ```
11
- */
12
- // Re-export hooks so types and hooks can be imported together
13
- export * from './hooks/public';
14
- export * as admin from './hooks/admin';
15
- // Re-export all RPC-derived types
16
- export * from './rpc-types';
@@ -1,106 +0,0 @@
1
- /**
2
- * Query key factories for React Query
3
- *
4
- * This provides a centralized way to manage query keys,
5
- * making it easier to invalidate and refetch queries.
6
- *
7
- * @see https://tkdodo.eu/blog/effective-react-query-keys
8
- */
9
- export declare const queryKeys: {
10
- public: {
11
- all: readonly ["public"];
12
- carts: {
13
- all: readonly ["public", "carts"];
14
- detail: (id: string) => readonly ["public", "carts", string];
15
- };
16
- orders: {
17
- all: readonly ["public", "orders"];
18
- detail: (id: string, token: string) => readonly ["public", "orders", string, string];
19
- };
20
- products: {
21
- all: readonly ["public", "products"];
22
- list: (brandId: string) => readonly ["public", "products", string];
23
- detail: (productId: string) => readonly ["public", "products", string];
24
- };
25
- deliveryZones: {
26
- all: readonly ["public", "delivery-zones"];
27
- list: (brandId?: string) => readonly ["public", "delivery-zones", string];
28
- };
29
- brands: {
30
- all: readonly ["public", "brands"];
31
- detail: (slug: string) => readonly ["public", "brands", string];
32
- };
33
- };
34
- admin: {
35
- all: readonly ["admin"];
36
- orders: {
37
- all: readonly ["admin", "orders"];
38
- list: () => readonly ["admin", "orders", "list"];
39
- detail: (id: string) => readonly ["admin", "orders", string];
40
- };
41
- brands: {
42
- all: readonly ["admin", "brands"];
43
- list: () => readonly ["admin", "brands", "list"];
44
- detail: (id: string) => readonly ["admin", "brands", string];
45
- };
46
- products: {
47
- all: readonly ["admin", "products"];
48
- list: (brandId?: string) => readonly ["admin", "products", "list", string];
49
- detail: (id: string) => readonly ["admin", "products", string];
50
- };
51
- variants: {
52
- all: readonly ["admin", "variants"];
53
- list: () => readonly ["admin", "variants", "list"];
54
- detail: (id: string) => readonly ["admin", "variants", string];
55
- search: (params?: any) => readonly ["admin", "variants", "search", any];
56
- byProduct: (productId: string) => readonly ["admin", "variants", "product", string];
57
- inventory: (id: string) => readonly ["admin", "variants", string, "inventory"];
58
- };
59
- warehouses: {
60
- all: readonly ["admin", "warehouses"];
61
- list: () => readonly ["admin", "warehouses", "list"];
62
- detail: (id: string) => readonly ["admin", "warehouses", string];
63
- inventory: (id: string) => readonly ["admin", "warehouses", string, "inventory"];
64
- };
65
- inventory: {
66
- all: readonly ["admin", "inventory"];
67
- list: (params?: any) => readonly ["admin", "inventory", "list", any];
68
- transactions: (params?: any) => readonly ["admin", "inventory", "transactions", any];
69
- lowStock: (brandId?: string) => readonly ["admin", "inventory", "low-stock", string];
70
- };
71
- customers: {
72
- all: readonly ["admin", "customers"];
73
- history: (phone: string) => readonly ["admin", "customers", "history", string];
74
- };
75
- stats: {
76
- all: readonly ["admin", "stats"];
77
- overview: (brandId?: string) => readonly ["admin", "stats", "overview", string];
78
- };
79
- abandonedCarts: {
80
- all: readonly ["admin", "abandoned-carts"];
81
- list: (params?: any) => readonly ["admin", "abandoned-carts", "list", any];
82
- detail: (id: string) => readonly ["admin", "abandoned-carts", string];
83
- stats: (brandId?: string) => readonly ["admin", "abandoned-carts", "stats", string];
84
- };
85
- discountCodes: {
86
- all: readonly ["admin", "discount-codes"];
87
- list: (params?: any) => readonly ["admin", "discount-codes", "list", any];
88
- detail: (id: string) => readonly ["admin", "discount-codes", string];
89
- analytics: (id: string) => readonly ["admin", "discount-codes", string, "analytics"];
90
- overviewStats: () => readonly ["admin", "discount-codes", "stats", "overview"];
91
- };
92
- deliveryZones: {
93
- all: readonly ["admin", "delivery-zones"];
94
- states: {
95
- all: readonly ["admin", "delivery-zones", "states"];
96
- list: () => readonly ["admin", "delivery-zones", "states", "list"];
97
- detail: (id: string) => readonly ["admin", "delivery-zones", "states", string];
98
- };
99
- zones: {
100
- all: readonly ["admin", "delivery-zones", "zones"];
101
- list: (params?: any) => readonly ["admin", "delivery-zones", "zones", "list", any];
102
- detail: (id: string) => readonly ["admin", "delivery-zones", "zones", string];
103
- };
104
- };
105
- };
106
- };
@@ -1,108 +0,0 @@
1
- /**
2
- * Query key factories for React Query
3
- *
4
- * This provides a centralized way to manage query keys,
5
- * making it easier to invalidate and refetch queries.
6
- *
7
- * @see https://tkdodo.eu/blog/effective-react-query-keys
8
- */
9
- export const queryKeys = {
10
- // Public API keys (RPC is now the default)
11
- public: {
12
- all: ['public'],
13
- carts: {
14
- all: ['public', 'carts'],
15
- detail: (id) => ['public', 'carts', id],
16
- },
17
- orders: {
18
- all: ['public', 'orders'],
19
- detail: (id, token) => ['public', 'orders', id, token],
20
- },
21
- products: {
22
- all: ['public', 'products'],
23
- list: (brandId) => ['public', 'products', brandId],
24
- detail: (productId) => ['public', 'products', productId],
25
- },
26
- deliveryZones: {
27
- all: ['public', 'delivery-zones'],
28
- list: (brandId) => ['public', 'delivery-zones', brandId],
29
- },
30
- brands: {
31
- all: ['public', 'brands'],
32
- detail: (slug) => ['public', 'brands', slug],
33
- },
34
- },
35
- // Admin API keys (RPC is now the default)
36
- admin: {
37
- all: ['admin'],
38
- orders: {
39
- all: ['admin', 'orders'],
40
- list: () => ['admin', 'orders', 'list'],
41
- detail: (id) => ['admin', 'orders', id],
42
- },
43
- brands: {
44
- all: ['admin', 'brands'],
45
- list: () => ['admin', 'brands', 'list'],
46
- detail: (id) => ['admin', 'brands', id],
47
- },
48
- products: {
49
- all: ['admin', 'products'],
50
- list: (brandId) => ['admin', 'products', 'list', brandId],
51
- detail: (id) => ['admin', 'products', id],
52
- },
53
- variants: {
54
- all: ['admin', 'variants'],
55
- list: () => ['admin', 'variants', 'list'],
56
- detail: (id) => ['admin', 'variants', id],
57
- search: (params) => ['admin', 'variants', 'search', params],
58
- byProduct: (productId) => ['admin', 'variants', 'product', productId],
59
- inventory: (id) => ['admin', 'variants', id, 'inventory'],
60
- },
61
- warehouses: {
62
- all: ['admin', 'warehouses'],
63
- list: () => ['admin', 'warehouses', 'list'],
64
- detail: (id) => ['admin', 'warehouses', id],
65
- inventory: (id) => ['admin', 'warehouses', id, 'inventory'],
66
- },
67
- inventory: {
68
- all: ['admin', 'inventory'],
69
- list: (params) => ['admin', 'inventory', 'list', params],
70
- transactions: (params) => ['admin', 'inventory', 'transactions', params],
71
- lowStock: (brandId) => ['admin', 'inventory', 'low-stock', brandId],
72
- },
73
- customers: {
74
- all: ['admin', 'customers'],
75
- history: (phone) => ['admin', 'customers', 'history', phone],
76
- },
77
- stats: {
78
- all: ['admin', 'stats'],
79
- overview: (brandId) => ['admin', 'stats', 'overview', brandId],
80
- },
81
- abandonedCarts: {
82
- all: ['admin', 'abandoned-carts'],
83
- list: (params) => ['admin', 'abandoned-carts', 'list', params],
84
- detail: (id) => ['admin', 'abandoned-carts', id],
85
- stats: (brandId) => ['admin', 'abandoned-carts', 'stats', brandId],
86
- },
87
- discountCodes: {
88
- all: ['admin', 'discount-codes'],
89
- list: (params) => ['admin', 'discount-codes', 'list', params],
90
- detail: (id) => ['admin', 'discount-codes', id],
91
- analytics: (id) => ['admin', 'discount-codes', id, 'analytics'],
92
- overviewStats: () => ['admin', 'discount-codes', 'stats', 'overview'],
93
- },
94
- deliveryZones: {
95
- all: ['admin', 'delivery-zones'],
96
- states: {
97
- all: ['admin', 'delivery-zones', 'states'],
98
- list: () => ['admin', 'delivery-zones', 'states', 'list'],
99
- detail: (id) => ['admin', 'delivery-zones', 'states', id],
100
- },
101
- zones: {
102
- all: ['admin', 'delivery-zones', 'zones'],
103
- list: (params) => ['admin', 'delivery-zones', 'zones', 'list', params],
104
- detail: (id) => ['admin', 'delivery-zones', 'zones', id],
105
- },
106
- },
107
- },
108
- };