@instockng/api-client 1.0.33 → 1.0.35

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.
@@ -7,4 +7,4 @@
7
7
  * These types provide end-to-end type safety between the backend API
8
8
  * and the frontend hooks/fetchers.
9
9
  */
10
- export type { CartsRPC, OrdersRPC, ProductsRPC, DeliveryZonesRPC, BrandsRPC, AdminOrdersRPC, AdminBrandsRPC, AdminProductsRPC, AdminVariantsRPC, AdminWarehousesRPC, AdminInventoryRPC, AdminCustomersRPC, AdminStatsRPC, AdminAbandonedCartsRPC, AdminDiscountCodesRPC, AdminDeliveryZonesRPC, ProductAddonsRPC, AdminProductAddonsRPC, AdminMediaRPC, } from '../../../apps/backend/src/http-app';
10
+ export type { CartsRPC, OrdersRPC, ProductsRPC, DeliveryZonesRPC, BrandsRPC, AdminOrdersRPC, AdminBrandsRPC, AdminProductsRPC, AdminVariantsRPC, AdminWarehousesRPC, AdminInventoryRPC, AdminCustomersRPC, AdminStatsRPC, AdminAbandonedCartsRPC, AdminDiscountCodesRPC, AdminDeliveryZonesRPC, ProductAddonsRPC, AdminProductAddonsRPC, AdminMediaRPC, AdminSalesRPC, } from '../../../apps/backend/src/http-app';
@@ -62,7 +62,6 @@ export declare function fetchCart(cartId: string): Promise<{
62
62
  items: {
63
63
  id: string;
64
64
  variant: {
65
- price: number;
66
65
  product: {
67
66
  id: string;
68
67
  name: string;
@@ -511,16 +510,18 @@ export declare function fetchCart(cartId: string): Promise<{
511
510
  };
512
511
  };
513
512
  };
514
- id: string;
515
- name: string | null;
516
513
  createdAt: string;
517
514
  updatedAt: string;
515
+ price: number;
516
+ compareAtPrice: number;
518
517
  deletedAt: string;
518
+ thumbnailUrl: string;
519
+ originalPrice: number;
520
+ id: string;
521
+ name: string | null;
519
522
  isActive: boolean;
520
- thumbnailUrl: string | null;
521
523
  productId: string;
522
524
  sku: string;
523
- compareAtPrice: string;
524
525
  trackInventory: boolean;
525
526
  lowStockThreshold: number | null;
526
527
  };
@@ -613,7 +614,6 @@ export declare function createCart(brandSlug: string): Promise<{
613
614
  items: {
614
615
  id: string;
615
616
  variant: {
616
- price: number;
617
617
  product: {
618
618
  id: string;
619
619
  name: string;
@@ -1062,16 +1062,18 @@ export declare function createCart(brandSlug: string): Promise<{
1062
1062
  };
1063
1063
  };
1064
1064
  };
1065
- id: string;
1066
- name: string | null;
1067
1065
  createdAt: string;
1068
1066
  updatedAt: string;
1067
+ price: number;
1068
+ compareAtPrice: number;
1069
1069
  deletedAt: string;
1070
+ thumbnailUrl: string;
1071
+ originalPrice: number;
1072
+ id: string;
1073
+ name: string | null;
1070
1074
  isActive: boolean;
1071
- thumbnailUrl: string | null;
1072
1075
  productId: string;
1073
1076
  sku: string;
1074
- compareAtPrice: string;
1075
1077
  trackInventory: boolean;
1076
1078
  lowStockThreshold: number | null;
1077
1079
  };
@@ -1167,7 +1169,6 @@ export declare function updateCart(cartId: string, data: {
1167
1169
  items: {
1168
1170
  id: string;
1169
1171
  variant: {
1170
- price: number;
1171
1172
  product: {
1172
1173
  id: string;
1173
1174
  name: string;
@@ -1616,16 +1617,18 @@ export declare function updateCart(cartId: string, data: {
1616
1617
  };
1617
1618
  };
1618
1619
  };
1619
- id: string;
1620
- name: string | null;
1621
1620
  createdAt: string;
1622
1621
  updatedAt: string;
1622
+ price: number;
1623
+ compareAtPrice: number;
1623
1624
  deletedAt: string;
1625
+ thumbnailUrl: string;
1626
+ originalPrice: number;
1627
+ id: string;
1628
+ name: string | null;
1624
1629
  isActive: boolean;
1625
- thumbnailUrl: string | null;
1626
1630
  productId: string;
1627
1631
  sku: string;
1628
- compareAtPrice: string;
1629
1632
  trackInventory: boolean;
1630
1633
  lowStockThreshold: number | null;
1631
1634
  };
@@ -1724,7 +1727,6 @@ export declare function addCartItem(cartId: string, sku: string, quantity: numbe
1724
1727
  items: {
1725
1728
  id: string;
1726
1729
  variant: {
1727
- price: number;
1728
1730
  product: {
1729
1731
  id: string;
1730
1732
  name: string;
@@ -2173,16 +2175,18 @@ export declare function addCartItem(cartId: string, sku: string, quantity: numbe
2173
2175
  };
2174
2176
  };
2175
2177
  };
2176
- id: string;
2177
- name: string | null;
2178
2178
  createdAt: string;
2179
2179
  updatedAt: string;
2180
+ price: number;
2181
+ compareAtPrice: number;
2180
2182
  deletedAt: string;
2183
+ thumbnailUrl: string;
2184
+ originalPrice: number;
2185
+ id: string;
2186
+ name: string | null;
2181
2187
  isActive: boolean;
2182
- thumbnailUrl: string | null;
2183
2188
  productId: string;
2184
2189
  sku: string;
2185
- compareAtPrice: string;
2186
2190
  trackInventory: boolean;
2187
2191
  lowStockThreshold: number | null;
2188
2192
  };
@@ -2277,7 +2281,6 @@ export declare function updateCartItem(cartId: string, itemId: string, quantity:
2277
2281
  items: {
2278
2282
  id: string;
2279
2283
  variant: {
2280
- price: number;
2281
2284
  product: {
2282
2285
  id: string;
2283
2286
  name: string;
@@ -2726,16 +2729,18 @@ export declare function updateCartItem(cartId: string, itemId: string, quantity:
2726
2729
  };
2727
2730
  };
2728
2731
  };
2729
- id: string;
2730
- name: string | null;
2731
2732
  createdAt: string;
2732
2733
  updatedAt: string;
2734
+ price: number;
2735
+ compareAtPrice: number;
2733
2736
  deletedAt: string;
2737
+ thumbnailUrl: string;
2738
+ originalPrice: number;
2739
+ id: string;
2740
+ name: string | null;
2734
2741
  isActive: boolean;
2735
- thumbnailUrl: string | null;
2736
2742
  productId: string;
2737
2743
  sku: string;
2738
- compareAtPrice: string;
2739
2744
  trackInventory: boolean;
2740
2745
  lowStockThreshold: number | null;
2741
2746
  };
@@ -2824,7 +2829,6 @@ export declare function removeCartItem(cartId: string, itemId: string): Promise<
2824
2829
  items: {
2825
2830
  id: string;
2826
2831
  variant: {
2827
- price: number;
2828
2832
  product: {
2829
2833
  id: string;
2830
2834
  name: string;
@@ -3273,16 +3277,18 @@ export declare function removeCartItem(cartId: string, itemId: string): Promise<
3273
3277
  };
3274
3278
  };
3275
3279
  };
3276
- id: string;
3277
- name: string | null;
3278
3280
  createdAt: string;
3279
3281
  updatedAt: string;
3282
+ price: number;
3283
+ compareAtPrice: number;
3280
3284
  deletedAt: string;
3285
+ thumbnailUrl: string;
3286
+ originalPrice: number;
3287
+ id: string;
3288
+ name: string | null;
3281
3289
  isActive: boolean;
3282
- thumbnailUrl: string | null;
3283
3290
  productId: string;
3284
3291
  sku: string;
3285
- compareAtPrice: string;
3286
3292
  trackInventory: boolean;
3287
3293
  lowStockThreshold: number | null;
3288
3294
  };
@@ -3371,7 +3377,6 @@ export declare function applyDiscount(cartId: string, code: string): Promise<{
3371
3377
  items: {
3372
3378
  id: string;
3373
3379
  variant: {
3374
- price: number;
3375
3380
  product: {
3376
3381
  id: string;
3377
3382
  name: string;
@@ -3820,16 +3825,18 @@ export declare function applyDiscount(cartId: string, code: string): Promise<{
3820
3825
  };
3821
3826
  };
3822
3827
  };
3823
- id: string;
3824
- name: string | null;
3825
3828
  createdAt: string;
3826
3829
  updatedAt: string;
3830
+ price: number;
3831
+ compareAtPrice: number;
3827
3832
  deletedAt: string;
3833
+ thumbnailUrl: string;
3834
+ originalPrice: number;
3835
+ id: string;
3836
+ name: string | null;
3828
3837
  isActive: boolean;
3829
- thumbnailUrl: string | null;
3830
3838
  productId: string;
3831
3839
  sku: string;
3832
- compareAtPrice: string;
3833
3840
  trackInventory: boolean;
3834
3841
  lowStockThreshold: number | null;
3835
3842
  };
@@ -3922,7 +3929,6 @@ export declare function removeDiscount(cartId: string): Promise<{
3922
3929
  items: {
3923
3930
  id: string;
3924
3931
  variant: {
3925
- price: number;
3926
3932
  product: {
3927
3933
  id: string;
3928
3934
  name: string;
@@ -4371,16 +4377,18 @@ export declare function removeDiscount(cartId: string): Promise<{
4371
4377
  };
4372
4378
  };
4373
4379
  };
4374
- id: string;
4375
- name: string | null;
4376
4380
  createdAt: string;
4377
4381
  updatedAt: string;
4382
+ price: number;
4383
+ compareAtPrice: number;
4378
4384
  deletedAt: string;
4385
+ thumbnailUrl: string;
4386
+ originalPrice: number;
4387
+ id: string;
4388
+ name: string | null;
4379
4389
  isActive: boolean;
4380
- thumbnailUrl: string | null;
4381
4390
  productId: string;
4382
4391
  sku: string;
4383
- compareAtPrice: string;
4384
4392
  trackInventory: boolean;
4385
4393
  lowStockThreshold: number | null;
4386
4394
  };
@@ -5016,6 +5024,10 @@ export declare function initiateCheckout(cartId: string, data: {
5016
5024
  * @returns Array of recommended products from the same brand
5017
5025
  */
5018
5026
  export declare function fetchCartRecommendations(cartId: string, limit: number): Promise<{
5027
+ isOnSale: boolean;
5028
+ saleId: string;
5029
+ saleName: string;
5030
+ saleEndsAt: string;
5019
5031
  id: string;
5020
5032
  name: string;
5021
5033
  slug: string;
@@ -5186,10 +5198,11 @@ export declare function fetchCartRecommendations(cartId: string, limit: number):
5186
5198
  price: number;
5187
5199
  compareAtPrice: number;
5188
5200
  deletedAt: string;
5201
+ thumbnailUrl: string;
5202
+ originalPrice: number;
5189
5203
  id: string;
5190
5204
  name: string | null;
5191
5205
  isActive: boolean;
5192
- thumbnailUrl: string | null;
5193
5206
  productId: string;
5194
5207
  sku: string;
5195
5208
  trackInventory: boolean;
@@ -5486,6 +5499,25 @@ export declare function fetchCartRecommendations(cartId: string, limit: number):
5486
5499
  flat?: boolean;
5487
5500
  };
5488
5501
  };
5502
+ sales: {
5503
+ sale: {
5504
+ id: string;
5505
+ name: string;
5506
+ createdAt: string;
5507
+ updatedAt: string;
5508
+ deletedAt: string;
5509
+ brandId: string;
5510
+ isActive: boolean;
5511
+ discountType: import("@prisma/client").$Enums.DiscountType;
5512
+ discountValue: string;
5513
+ startDate: string;
5514
+ endDate: string;
5515
+ };
5516
+ id: string;
5517
+ createdAt: string;
5518
+ productId: string;
5519
+ saleId: string;
5520
+ }[];
5489
5521
  createdAt: string;
5490
5522
  updatedAt: string;
5491
5523
  deletedAt: string;
@@ -1139,6 +1139,10 @@ export declare function confirmOrder(orderId: string, token: string): Promise<{
1139
1139
  * @returns Array of recommended products
1140
1140
  */
1141
1141
  export declare function fetchOrderRecommendations(orderId: string, token: string, limit?: number): Promise<{
1142
+ isOnSale: boolean;
1143
+ saleId: string;
1144
+ saleName: string;
1145
+ saleEndsAt: string;
1142
1146
  id: string;
1143
1147
  name: string;
1144
1148
  slug: string;
@@ -1309,10 +1313,11 @@ export declare function fetchOrderRecommendations(orderId: string, token: string
1309
1313
  price: number;
1310
1314
  compareAtPrice: number;
1311
1315
  deletedAt: string;
1316
+ thumbnailUrl: string;
1317
+ originalPrice: number;
1312
1318
  id: string;
1313
1319
  name: string | null;
1314
1320
  isActive: boolean;
1315
- thumbnailUrl: string | null;
1316
1321
  productId: string;
1317
1322
  sku: string;
1318
1323
  trackInventory: boolean;
@@ -1609,6 +1614,25 @@ export declare function fetchOrderRecommendations(orderId: string, token: string
1609
1614
  flat?: boolean;
1610
1615
  };
1611
1616
  };
1617
+ sales: {
1618
+ sale: {
1619
+ id: string;
1620
+ name: string;
1621
+ createdAt: string;
1622
+ updatedAt: string;
1623
+ deletedAt: string;
1624
+ brandId: string;
1625
+ isActive: boolean;
1626
+ discountType: import("@prisma/client").$Enums.DiscountType;
1627
+ discountValue: string;
1628
+ startDate: string;
1629
+ endDate: string;
1630
+ };
1631
+ id: string;
1632
+ createdAt: string;
1633
+ productId: string;
1634
+ saleId: string;
1635
+ }[];
1612
1636
  createdAt: string;
1613
1637
  updatedAt: string;
1614
1638
  deletedAt: string;
@@ -63,7 +63,6 @@ export declare function useListAbandonedCarts(params?: {
63
63
  items: {
64
64
  id: string;
65
65
  variant: {
66
- price: number;
67
66
  product: {
68
67
  id: string;
69
68
  name: string;
@@ -512,16 +511,18 @@ export declare function useListAbandonedCarts(params?: {
512
511
  };
513
512
  };
514
513
  };
515
- id: string;
516
- name: string | null;
517
514
  createdAt: string;
518
515
  updatedAt: string;
516
+ price: number;
517
+ compareAtPrice: number;
519
518
  deletedAt: string;
519
+ thumbnailUrl: string;
520
+ originalPrice: number;
521
+ id: string;
522
+ name: string | null;
520
523
  isActive: boolean;
521
- thumbnailUrl: string | null;
522
524
  productId: string;
523
525
  sku: string;
524
- compareAtPrice: string;
525
526
  trackInventory: boolean;
526
527
  lowStockThreshold: number | null;
527
528
  };
@@ -624,7 +625,6 @@ export declare function useGetAbandonedCart(cartId: string, options?: Omit<UseQu
624
625
  items: {
625
626
  id: string;
626
627
  variant: {
627
- price: number;
628
628
  product: {
629
629
  id: string;
630
630
  name: string;
@@ -1073,16 +1073,18 @@ export declare function useGetAbandonedCart(cartId: string, options?: Omit<UseQu
1073
1073
  };
1074
1074
  };
1075
1075
  };
1076
- id: string;
1077
- name: string | null;
1078
1076
  createdAt: string;
1079
1077
  updatedAt: string;
1078
+ price: number;
1079
+ compareAtPrice: number;
1080
1080
  deletedAt: string;
1081
+ thumbnailUrl: string;
1082
+ originalPrice: number;
1083
+ id: string;
1084
+ name: string | null;
1081
1085
  isActive: boolean;
1082
- thumbnailUrl: string | null;
1083
1086
  productId: string;
1084
1087
  sku: string;
1085
- compareAtPrice: string;
1086
1088
  trackInventory: boolean;
1087
1089
  lowStockThreshold: number | null;
1088
1090
  };
@@ -15,3 +15,4 @@ export * from './variants';
15
15
  export * from './warehouses';
16
16
  export * from './abandoned-carts';
17
17
  export * from './media';
18
+ export * from './sales';
@@ -15,3 +15,4 @@ export * from './variants';
15
15
  export * from './warehouses';
16
16
  export * from './abandoned-carts';
17
17
  export * from './media';
18
+ export * from './sales';
@@ -4,6 +4,10 @@
4
4
  import { UseQueryOptions, UseMutationOptions } from '@tanstack/react-query';
5
5
  import { createAdminRpcClients } from '../../rpc-client';
6
6
  export declare function useListProducts(brandId?: string, options?: Omit<UseQueryOptions<Awaited<ReturnType<Awaited<ReturnType<ReturnType<typeof createAdminRpcClients>['products']['index']['$get']>>['json']>>, Error>, 'queryKey' | 'queryFn'>): import("@tanstack/react-query").UseQueryResult<{
7
+ isOnSale: boolean;
8
+ saleId: string;
9
+ saleName: string;
10
+ saleEndsAt: string;
7
11
  id: string;
8
12
  name: string;
9
13
  slug: string;
@@ -174,10 +178,11 @@ export declare function useListProducts(brandId?: string, options?: Omit<UseQuer
174
178
  price: number;
175
179
  compareAtPrice: number;
176
180
  deletedAt: string;
181
+ thumbnailUrl: string;
182
+ originalPrice: number;
177
183
  id: string;
178
184
  name: string | null;
179
185
  isActive: boolean;
180
- thumbnailUrl: string | null;
181
186
  productId: string;
182
187
  sku: string;
183
188
  trackInventory: boolean;
@@ -474,6 +479,25 @@ export declare function useListProducts(brandId?: string, options?: Omit<UseQuer
474
479
  flat?: boolean;
475
480
  };
476
481
  };
482
+ sales: {
483
+ sale: {
484
+ id: string;
485
+ name: string;
486
+ createdAt: string;
487
+ updatedAt: string;
488
+ deletedAt: string;
489
+ brandId: string;
490
+ isActive: boolean;
491
+ discountType: import("@prisma/client").$Enums.DiscountType;
492
+ discountValue: string;
493
+ startDate: string;
494
+ endDate: string;
495
+ };
496
+ id: string;
497
+ createdAt: string;
498
+ productId: string;
499
+ saleId: string;
500
+ }[];
477
501
  createdAt: string;
478
502
  updatedAt: string;
479
503
  deletedAt: string;
@@ -481,6 +505,10 @@ export declare function useListProducts(brandId?: string, options?: Omit<UseQuer
481
505
  isActive: boolean;
482
506
  }[], Error>;
483
507
  export declare function useGetProduct(productId: string, options?: Omit<UseQueryOptions<Awaited<ReturnType<Awaited<ReturnType<ReturnType<typeof createAdminRpcClients>['products'][':id']['$get']>>['json']>>, Error>, 'queryKey' | 'queryFn'>): import("@tanstack/react-query").UseQueryResult<{
508
+ isOnSale: boolean;
509
+ saleId: string;
510
+ saleName: string;
511
+ saleEndsAt: string;
484
512
  id: string;
485
513
  name: string;
486
514
  slug: string;
@@ -651,10 +679,11 @@ export declare function useGetProduct(productId: string, options?: Omit<UseQuery
651
679
  price: number;
652
680
  compareAtPrice: number;
653
681
  deletedAt: string;
682
+ thumbnailUrl: string;
683
+ originalPrice: number;
654
684
  id: string;
655
685
  name: string | null;
656
686
  isActive: boolean;
657
- thumbnailUrl: string | null;
658
687
  productId: string;
659
688
  sku: string;
660
689
  trackInventory: boolean;
@@ -951,6 +980,25 @@ export declare function useGetProduct(productId: string, options?: Omit<UseQuery
951
980
  flat?: boolean;
952
981
  };
953
982
  };
983
+ sales: {
984
+ sale: {
985
+ id: string;
986
+ name: string;
987
+ createdAt: string;
988
+ updatedAt: string;
989
+ deletedAt: string;
990
+ brandId: string;
991
+ isActive: boolean;
992
+ discountType: import("@prisma/client").$Enums.DiscountType;
993
+ discountValue: string;
994
+ startDate: string;
995
+ endDate: string;
996
+ };
997
+ id: string;
998
+ createdAt: string;
999
+ productId: string;
1000
+ saleId: string;
1001
+ }[];
954
1002
  createdAt: string;
955
1003
  updatedAt: string;
956
1004
  deletedAt: string;
@@ -0,0 +1,46 @@
1
+ /**
2
+ * Type-safe admin RPC hooks for sales management
3
+ */
4
+ import { UseQueryOptions, UseMutationOptions } from '@tanstack/react-query';
5
+ /**
6
+ * Hook to list sales using admin RPC
7
+ */
8
+ export declare function useListSales(params?: {
9
+ page?: number;
10
+ limit?: number;
11
+ brandId?: string;
12
+ status?: 'active' | 'scheduled' | 'ended' | 'inactive';
13
+ search?: string;
14
+ }, options?: Omit<UseQueryOptions<any, Error>, 'queryKey' | 'queryFn'>): import("@tanstack/react-query").UseQueryResult<any, Error>;
15
+ /**
16
+ * Hook to get sale by ID using admin RPC
17
+ */
18
+ export declare function useGetSale(saleId: string, options?: Omit<UseQueryOptions<any, Error>, 'queryKey' | 'queryFn'>): import("@tanstack/react-query").UseQueryResult<any, Error>;
19
+ /**
20
+ * Hook to create a sale using admin RPC
21
+ */
22
+ export declare function useCreateSale(options?: UseMutationOptions<any, Error, any>): import("@tanstack/react-query").UseMutationResult<any, Error, any, unknown>;
23
+ /**
24
+ * Hook to update a sale using admin RPC
25
+ */
26
+ export declare function useUpdateSale(saleId: string, options?: UseMutationOptions<any, Error, any>): import("@tanstack/react-query").UseMutationResult<any, Error, any, unknown>;
27
+ /**
28
+ * Hook to delete a sale using admin RPC
29
+ */
30
+ export declare function useDeleteSale(saleId: string, options?: UseMutationOptions<void, Error, void>): import("@tanstack/react-query").UseMutationResult<void, Error, void, unknown>;
31
+ /**
32
+ * Hook to add products to a sale using admin RPC
33
+ */
34
+ export declare function useAddProductsToSale(saleId: string, options?: UseMutationOptions<any, Error, {
35
+ productIds: string[];
36
+ }>): import("@tanstack/react-query").UseMutationResult<any, Error, {
37
+ productIds: string[];
38
+ }, unknown>;
39
+ /**
40
+ * Hook to remove a product from a sale using admin RPC
41
+ */
42
+ export declare function useRemoveProductFromSale(saleId: string, options?: UseMutationOptions<void, Error, string>): import("@tanstack/react-query").UseMutationResult<void, Error, string, unknown>;
43
+ /**
44
+ * Hook to get sales overview stats using admin RPC
45
+ */
46
+ export declare function useGetSalesOverviewStats(options?: Omit<UseQueryOptions<any, Error>, 'queryKey' | 'queryFn'>): import("@tanstack/react-query").UseQueryResult<any, Error>;