@htlkg/data 0.0.21 → 0.0.23
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/hooks/index.d.ts +702 -94
- package/dist/hooks/index.js +793 -56
- package/dist/hooks/index.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +802 -65
- package/dist/index.js.map +1 -1
- package/dist/mutations/index.js +4 -4
- package/dist/mutations/index.js.map +1 -1
- package/dist/queries/index.js +5 -5
- package/dist/queries/index.js.map +1 -1
- package/package.json +11 -12
- package/src/hooks/accounts/index.ts +2 -0
- package/src/hooks/{useAccounts.ts → accounts/useAccounts.ts} +48 -5
- package/src/hooks/accounts/usePaginatedAccounts.ts +166 -0
- package/src/hooks/brands/index.ts +2 -0
- package/src/hooks/{useBrands.ts → brands/useBrands.ts} +1 -1
- package/src/hooks/brands/usePaginatedBrands.ts +206 -0
- package/src/hooks/contacts/index.ts +2 -0
- package/src/hooks/contacts/useContacts.ts +176 -0
- package/src/hooks/contacts/usePaginatedContacts.ts +268 -0
- package/src/hooks/createPaginatedDataHook.ts +359 -0
- package/src/hooks/data-hook-errors.property.test.ts +4 -4
- package/src/hooks/data-hook-filters.property.test.ts +4 -4
- package/src/hooks/data-hooks.property.test.ts +4 -4
- package/src/hooks/index.ts +101 -8
- package/src/hooks/productInstances/index.ts +1 -0
- package/src/hooks/{useProductInstances.ts → productInstances/useProductInstances.ts} +9 -6
- package/src/hooks/products/index.ts +1 -0
- package/src/hooks/{useProducts.ts → products/useProducts.ts} +4 -5
- package/src/hooks/reservations/index.ts +2 -0
- package/src/hooks/reservations/usePaginatedReservations.ts +258 -0
- package/src/hooks/{useReservations.ts → reservations/useReservations.ts} +65 -10
- package/src/hooks/users/index.ts +2 -0
- package/src/hooks/users/usePaginatedUsers.ts +213 -0
- package/src/hooks/{useUsers.ts → users/useUsers.ts} +1 -1
- package/src/mutations/accounts/accounts.test.ts +287 -0
- package/src/mutations/{accounts.ts → accounts/accounts.ts} +2 -2
- package/src/mutations/accounts/index.ts +1 -0
- package/src/mutations/brands/brands.test.ts +292 -0
- package/src/mutations/{brands.ts → brands/brands.ts} +2 -2
- package/src/mutations/brands/index.ts +1 -0
- package/src/mutations/reservations/index.ts +1 -0
- package/src/mutations/{reservations.test.ts → reservations/reservations.test.ts} +1 -1
- package/src/mutations/{reservations.ts → reservations/reservations.ts} +2 -2
- package/src/mutations/users/index.ts +1 -0
- package/src/mutations/users/users.test.ts +289 -0
- package/src/mutations/{users.ts → users/users.ts} +2 -2
- package/src/queries/accounts/accounts.test.ts +228 -0
- package/src/queries/accounts/index.ts +1 -0
- package/src/queries/brands/brands.test.ts +288 -0
- package/src/queries/brands/index.ts +1 -0
- package/src/queries/products/index.ts +1 -0
- package/src/queries/products/products.test.ts +347 -0
- package/src/queries/reservations/index.ts +1 -0
- package/src/queries/users/index.ts +1 -0
- package/src/queries/users/users.test.ts +301 -0
- /package/src/queries/{accounts.ts → accounts/accounts.ts} +0 -0
- /package/src/queries/{brands.ts → brands/brands.ts} +0 -0
- /package/src/queries/{products.ts → products/products.ts} +0 -0
- /package/src/queries/{reservations.test.ts → reservations/reservations.test.ts} +0 -0
- /package/src/queries/{reservations.ts → reservations/reservations.ts} +0 -0
- /package/src/queries/{users.ts → users/users.ts} +0 -0
package/dist/hooks/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Ref, ComputedRef } from 'vue';
|
|
2
|
-
import { Brand,
|
|
3
|
-
import { C as CreateProductInstanceInput, U as UpdateProductInstanceInput } from '../productInstances-BpQv1oLS.js';
|
|
2
|
+
import { Brand, User, Account, Product, ProductInstance, Contact } from '@htlkg/core/types';
|
|
4
3
|
import { R as Reservation } from '../reservations-C0FNm__0.js';
|
|
4
|
+
import { C as CreateProductInstanceInput, U as UpdateProductInstanceInput } from '../productInstances-BpQv1oLS.js';
|
|
5
5
|
import '../common-DSxswsZ3.js';
|
|
6
6
|
|
|
7
7
|
/**
|
|
@@ -107,6 +107,162 @@ declare function createDataHook<T, TOptions extends BaseHookOptions = BaseHookOp
|
|
|
107
107
|
*/
|
|
108
108
|
type InferHookReturn<THook extends (...args: any[]) => any> = ReturnType<THook>;
|
|
109
109
|
|
|
110
|
+
/**
|
|
111
|
+
* Paginated Data Hook Factory
|
|
112
|
+
*
|
|
113
|
+
* Creates reusable Vue composables for fetching paginated data from GraphQL models.
|
|
114
|
+
* Supports cursor-based pagination (nextToken) for efficient handling of large datasets.
|
|
115
|
+
*
|
|
116
|
+
* Key features:
|
|
117
|
+
* - Server-side pagination with nextToken
|
|
118
|
+
* - loadMore() for infinite scroll/pagination
|
|
119
|
+
* - hasMore indicator
|
|
120
|
+
* - Independent pagination state per hook instance
|
|
121
|
+
* - Built-in support for active/deleted filtering
|
|
122
|
+
*/
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* Filter for active items (not deleted)
|
|
126
|
+
* Uses OR condition because deletedAt can be:
|
|
127
|
+
* - Missing (attributeExists: false)
|
|
128
|
+
* - Explicitly null (eq: null)
|
|
129
|
+
*/
|
|
130
|
+
declare const ACTIVE_FILTER: {
|
|
131
|
+
or: ({
|
|
132
|
+
deletedAt: {
|
|
133
|
+
attributeExists: boolean;
|
|
134
|
+
eq?: undefined;
|
|
135
|
+
};
|
|
136
|
+
} | {
|
|
137
|
+
deletedAt: {
|
|
138
|
+
eq: null;
|
|
139
|
+
attributeExists?: undefined;
|
|
140
|
+
};
|
|
141
|
+
})[];
|
|
142
|
+
};
|
|
143
|
+
/**
|
|
144
|
+
* Filter for deleted items
|
|
145
|
+
* Uses gt: "" to match only actual timestamp strings (not null or missing)
|
|
146
|
+
*/
|
|
147
|
+
declare const DELETED_FILTER: {
|
|
148
|
+
deletedAt: {
|
|
149
|
+
gt: string;
|
|
150
|
+
};
|
|
151
|
+
};
|
|
152
|
+
/**
|
|
153
|
+
* Configuration options for creating a paginated data hook
|
|
154
|
+
*/
|
|
155
|
+
interface CreatePaginatedDataHookOptions<T, TOptions extends PaginatedHookOptions = PaginatedHookOptions> {
|
|
156
|
+
/** The GraphQL model name (e.g., 'Account', 'User', 'Brand') */
|
|
157
|
+
model: string;
|
|
158
|
+
/** Default page size */
|
|
159
|
+
defaultPageSize?: number;
|
|
160
|
+
/** Selection set for the query (fields to fetch) */
|
|
161
|
+
selectionSet?: string[];
|
|
162
|
+
/** Transform function to apply to fetched data */
|
|
163
|
+
transform?: (item: any) => T;
|
|
164
|
+
/** Build filter from hook options */
|
|
165
|
+
buildFilter?: (options: TOptions) => any;
|
|
166
|
+
/** Plural name for the data property (e.g., 'accounts', 'users') */
|
|
167
|
+
dataPropertyName?: string;
|
|
168
|
+
/** Base filter to always apply (e.g., for active/deleted variants) */
|
|
169
|
+
baseFilter?: any;
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* Base options available to paginated hooks
|
|
173
|
+
*/
|
|
174
|
+
interface PaginatedHookOptions {
|
|
175
|
+
/** Additional filter criteria (merged with baseFilter) */
|
|
176
|
+
filter?: any;
|
|
177
|
+
/** Page size (default: 25) */
|
|
178
|
+
pageSize?: number;
|
|
179
|
+
/** Auto-fetch on mount (default: true) */
|
|
180
|
+
autoFetch?: boolean;
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* Pagination state
|
|
184
|
+
*/
|
|
185
|
+
interface PaginationState {
|
|
186
|
+
/** Current nextToken for fetching next page */
|
|
187
|
+
nextToken: string | null;
|
|
188
|
+
/** Whether there are more items to load */
|
|
189
|
+
hasMore: boolean;
|
|
190
|
+
/** Total items loaded so far */
|
|
191
|
+
loadedCount: number;
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* Return type for paginated data hooks
|
|
195
|
+
*/
|
|
196
|
+
interface PaginatedDataHookReturn<T> {
|
|
197
|
+
/** Reactive array of data (accumulated across pages) */
|
|
198
|
+
data: Ref<T[]>;
|
|
199
|
+
/** Loading state (true during any fetch) */
|
|
200
|
+
loading: Ref<boolean>;
|
|
201
|
+
/** Loading state for initial fetch */
|
|
202
|
+
initialLoading: Ref<boolean>;
|
|
203
|
+
/** Loading state for loadMore */
|
|
204
|
+
loadingMore: Ref<boolean>;
|
|
205
|
+
/** Error state */
|
|
206
|
+
error: Ref<Error | null>;
|
|
207
|
+
/** Pagination state */
|
|
208
|
+
pagination: Ref<PaginationState>;
|
|
209
|
+
/** Whether there are more items to load */
|
|
210
|
+
hasMore: ComputedRef<boolean>;
|
|
211
|
+
/** Load next page of data */
|
|
212
|
+
loadMore: () => Promise<void>;
|
|
213
|
+
/** Refetch data (resets to first page) */
|
|
214
|
+
refetch: () => Promise<void>;
|
|
215
|
+
/** Reset data and pagination state */
|
|
216
|
+
reset: () => void;
|
|
217
|
+
/** Update search filter and refetch from server (searches ALL data) */
|
|
218
|
+
setSearchFilter: (filter: any) => Promise<void>;
|
|
219
|
+
/** Current search filter */
|
|
220
|
+
searchFilter: Ref<any>;
|
|
221
|
+
}
|
|
222
|
+
/**
|
|
223
|
+
* Creates a reusable paginated data hook for a specific model
|
|
224
|
+
*
|
|
225
|
+
* @example
|
|
226
|
+
* ```typescript
|
|
227
|
+
* // Create a hook for active brands
|
|
228
|
+
* export const useActiveBrands = createPaginatedDataHook<Brand>({
|
|
229
|
+
* model: 'Brand',
|
|
230
|
+
* dataPropertyName: 'brands',
|
|
231
|
+
* baseFilter: ACTIVE_FILTER,
|
|
232
|
+
* selectionSet: ['id', 'name', 'status', 'accountId', 'account.name'],
|
|
233
|
+
* });
|
|
234
|
+
*
|
|
235
|
+
* // Usage in component
|
|
236
|
+
* const { brands, loading, hasMore, loadMore, refetch } = useActiveBrands({
|
|
237
|
+
* pageSize: 25,
|
|
238
|
+
* });
|
|
239
|
+
* ```
|
|
240
|
+
*
|
|
241
|
+
* @example With custom filter builder
|
|
242
|
+
* ```typescript
|
|
243
|
+
* interface UseBrandsOptions extends PaginatedHookOptions {
|
|
244
|
+
* accountId?: string;
|
|
245
|
+
* }
|
|
246
|
+
*
|
|
247
|
+
* export const useActiveBrands = createPaginatedDataHook<Brand, UseBrandsOptions>({
|
|
248
|
+
* model: 'Brand',
|
|
249
|
+
* dataPropertyName: 'brands',
|
|
250
|
+
* baseFilter: ACTIVE_FILTER,
|
|
251
|
+
* buildFilter: (options) => {
|
|
252
|
+
* if (options.accountId) {
|
|
253
|
+
* return { accountId: { eq: options.accountId } };
|
|
254
|
+
* }
|
|
255
|
+
* return undefined;
|
|
256
|
+
* },
|
|
257
|
+
* });
|
|
258
|
+
* ```
|
|
259
|
+
*/
|
|
260
|
+
declare function createPaginatedDataHook<T, TOptions extends PaginatedHookOptions = PaginatedHookOptions>(config: CreatePaginatedDataHookOptions<T, TOptions>): (options?: TOptions) => PaginatedDataHookReturn<T> & Record<string, any>;
|
|
261
|
+
/**
|
|
262
|
+
* Type helper to extract the return type of a created paginated hook
|
|
263
|
+
*/
|
|
264
|
+
type InferPaginatedHookReturn<THook extends (...args: any[]) => any> = ReturnType<THook>;
|
|
265
|
+
|
|
110
266
|
/**
|
|
111
267
|
* useBrands Hook
|
|
112
268
|
*
|
|
@@ -160,49 +316,90 @@ interface UseBrandsReturn {
|
|
|
160
316
|
declare function useBrands(options?: UseBrandsOptions): UseBrandsReturn;
|
|
161
317
|
|
|
162
318
|
/**
|
|
163
|
-
*
|
|
319
|
+
* Paginated Brands Hooks
|
|
164
320
|
*
|
|
165
|
-
* Vue
|
|
166
|
-
* Provides
|
|
321
|
+
* Vue composables for fetching brands with server-side pagination.
|
|
322
|
+
* Provides separate hooks for active and deleted brands to enable
|
|
323
|
+
* efficient tab-based filtering in large datasets.
|
|
167
324
|
*/
|
|
168
325
|
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
326
|
+
/** Extended Brand type with computed fields */
|
|
327
|
+
type BrandWithCounts = Brand & {
|
|
328
|
+
accountName?: string;
|
|
329
|
+
enabledProductCount?: number;
|
|
330
|
+
totalProductCount?: number;
|
|
331
|
+
deletedAt?: string;
|
|
332
|
+
deletedBy?: string;
|
|
333
|
+
};
|
|
334
|
+
interface UsePaginatedBrandsOptions extends PaginatedHookOptions {
|
|
335
|
+
/** Filter by account ID */
|
|
336
|
+
accountId?: string;
|
|
176
337
|
}
|
|
177
|
-
interface
|
|
178
|
-
/** Reactive array of
|
|
179
|
-
|
|
180
|
-
/** Loading state */
|
|
338
|
+
interface UsePaginatedBrandsReturn {
|
|
339
|
+
/** Reactive array of brands */
|
|
340
|
+
brands: Ref<BrandWithCounts[]>;
|
|
341
|
+
/** Loading state (true during any fetch) */
|
|
181
342
|
loading: Ref<boolean>;
|
|
343
|
+
/** Loading state for initial fetch */
|
|
344
|
+
initialLoading: Ref<boolean>;
|
|
345
|
+
/** Loading state for loadMore */
|
|
346
|
+
loadingMore: Ref<boolean>;
|
|
182
347
|
/** Error state */
|
|
183
348
|
error: Ref<Error | null>;
|
|
184
|
-
/**
|
|
349
|
+
/** Pagination state */
|
|
350
|
+
pagination: Ref<PaginationState>;
|
|
351
|
+
/** Whether there are more items to load */
|
|
352
|
+
hasMore: ComputedRef<boolean>;
|
|
353
|
+
/** Load next page of data */
|
|
354
|
+
loadMore: () => Promise<void>;
|
|
355
|
+
/** Refetch data (resets to first page) */
|
|
185
356
|
refetch: () => Promise<void>;
|
|
357
|
+
/** Reset data and pagination state */
|
|
358
|
+
reset: () => void;
|
|
359
|
+
/** Update search filter and refetch from server (searches ALL data) */
|
|
360
|
+
setSearchFilter: (filter: any) => Promise<void>;
|
|
361
|
+
/** Current search filter */
|
|
362
|
+
searchFilter: Ref<any>;
|
|
186
363
|
}
|
|
187
364
|
/**
|
|
188
|
-
* Composable for fetching
|
|
365
|
+
* Composable for fetching active (non-deleted) brands with pagination
|
|
189
366
|
*
|
|
190
367
|
* @example
|
|
191
368
|
* ```typescript
|
|
192
|
-
* import {
|
|
369
|
+
* import { useActiveBrands } from '@htlkg/data/hooks';
|
|
193
370
|
*
|
|
194
|
-
* const {
|
|
371
|
+
* const { brands, loading, hasMore, loadMore, refetch } = useActiveBrands({
|
|
372
|
+
* pageSize: 25,
|
|
373
|
+
* });
|
|
374
|
+
*
|
|
375
|
+
* // Load more when user scrolls or clicks "Load More"
|
|
376
|
+
* async function onLoadMore() {
|
|
377
|
+
* await loadMore();
|
|
378
|
+
* }
|
|
195
379
|
* ```
|
|
196
380
|
*
|
|
197
|
-
* @example With
|
|
381
|
+
* @example With account filter
|
|
198
382
|
* ```typescript
|
|
199
|
-
* const {
|
|
200
|
-
*
|
|
201
|
-
*
|
|
383
|
+
* const { brands, loading } = useActiveBrands({
|
|
384
|
+
* accountId: 'account-123',
|
|
385
|
+
* pageSize: 50
|
|
202
386
|
* });
|
|
203
387
|
* ```
|
|
204
388
|
*/
|
|
205
|
-
declare function
|
|
389
|
+
declare function useActiveBrands(options?: UsePaginatedBrandsOptions): UsePaginatedBrandsReturn;
|
|
390
|
+
/**
|
|
391
|
+
* Composable for fetching deleted brands with pagination
|
|
392
|
+
*
|
|
393
|
+
* @example
|
|
394
|
+
* ```typescript
|
|
395
|
+
* import { useDeletedBrands } from '@htlkg/data/hooks';
|
|
396
|
+
*
|
|
397
|
+
* const { brands, loading, hasMore, loadMore, refetch } = useDeletedBrands({
|
|
398
|
+
* pageSize: 25,
|
|
399
|
+
* });
|
|
400
|
+
* ```
|
|
401
|
+
*/
|
|
402
|
+
declare function useDeletedBrands(options?: UsePaginatedBrandsOptions): UsePaginatedBrandsReturn;
|
|
206
403
|
|
|
207
404
|
/**
|
|
208
405
|
* useUsers Hook
|
|
@@ -255,125 +452,219 @@ interface UseUsersReturn {
|
|
|
255
452
|
declare function useUsers(options?: UseUsersOptions): UseUsersReturn;
|
|
256
453
|
|
|
257
454
|
/**
|
|
258
|
-
*
|
|
455
|
+
* Paginated Users Hooks
|
|
259
456
|
*
|
|
260
|
-
* Vue
|
|
261
|
-
* Provides
|
|
457
|
+
* Vue composables for fetching users with server-side pagination.
|
|
458
|
+
* Provides separate hooks for active and deleted users to enable
|
|
459
|
+
* efficient tab-based filtering in large datasets.
|
|
262
460
|
*/
|
|
263
461
|
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
462
|
+
/** Extended User type with computed fields */
|
|
463
|
+
type UserWithRelations = User & {
|
|
464
|
+
accountName?: string;
|
|
465
|
+
brandNames?: string[];
|
|
466
|
+
deletedAt?: string;
|
|
467
|
+
deletedBy?: string;
|
|
468
|
+
};
|
|
469
|
+
interface UsePaginatedUsersOptions extends PaginatedHookOptions {
|
|
470
|
+
/** Filter by brand ID */
|
|
471
|
+
brandId?: string;
|
|
472
|
+
/** Filter by account ID */
|
|
473
|
+
accountId?: string;
|
|
273
474
|
}
|
|
274
|
-
interface
|
|
275
|
-
/** Reactive array of
|
|
276
|
-
|
|
277
|
-
/**
|
|
278
|
-
activeProducts: ComputedRef<Product[]>;
|
|
279
|
-
/** Loading state */
|
|
475
|
+
interface UsePaginatedUsersReturn {
|
|
476
|
+
/** Reactive array of users */
|
|
477
|
+
users: Ref<UserWithRelations[]>;
|
|
478
|
+
/** Loading state (true during any fetch) */
|
|
280
479
|
loading: Ref<boolean>;
|
|
480
|
+
/** Loading state for initial fetch */
|
|
481
|
+
initialLoading: Ref<boolean>;
|
|
482
|
+
/** Loading state for loadMore */
|
|
483
|
+
loadingMore: Ref<boolean>;
|
|
281
484
|
/** Error state */
|
|
282
485
|
error: Ref<Error | null>;
|
|
283
|
-
/**
|
|
486
|
+
/** Pagination state */
|
|
487
|
+
pagination: Ref<PaginationState>;
|
|
488
|
+
/** Whether there are more items to load */
|
|
489
|
+
hasMore: ComputedRef<boolean>;
|
|
490
|
+
/** Load next page of data */
|
|
491
|
+
loadMore: () => Promise<void>;
|
|
492
|
+
/** Refetch data (resets to first page) */
|
|
284
493
|
refetch: () => Promise<void>;
|
|
494
|
+
/** Reset data and pagination state */
|
|
495
|
+
reset: () => void;
|
|
496
|
+
/** Update search filter and refetch from server (searches ALL data) */
|
|
497
|
+
setSearchFilter: (filter: any) => Promise<void>;
|
|
498
|
+
/** Current search filter */
|
|
499
|
+
searchFilter: Ref<any>;
|
|
285
500
|
}
|
|
286
501
|
/**
|
|
287
|
-
* Composable for fetching
|
|
502
|
+
* Composable for fetching active (non-deleted) users with pagination
|
|
288
503
|
*
|
|
289
504
|
* @example
|
|
290
505
|
* ```typescript
|
|
291
|
-
* import {
|
|
506
|
+
* import { useActiveUsers } from '@htlkg/data/hooks';
|
|
292
507
|
*
|
|
293
|
-
* const {
|
|
508
|
+
* const { users, loading, hasMore, loadMore, refetch } = useActiveUsers({
|
|
509
|
+
* pageSize: 25,
|
|
510
|
+
* });
|
|
511
|
+
*
|
|
512
|
+
* // Load more when user scrolls or clicks "Load More"
|
|
513
|
+
* async function onLoadMore() {
|
|
514
|
+
* await loadMore();
|
|
515
|
+
* }
|
|
294
516
|
* ```
|
|
295
517
|
*
|
|
296
518
|
* @example With filters
|
|
297
519
|
* ```typescript
|
|
298
|
-
* const {
|
|
299
|
-
*
|
|
300
|
-
*
|
|
520
|
+
* const { users, loading } = useActiveUsers({
|
|
521
|
+
* accountId: 'account-123',
|
|
522
|
+
* brandId: 'brand-456',
|
|
523
|
+
* pageSize: 50
|
|
301
524
|
* });
|
|
302
525
|
* ```
|
|
303
526
|
*/
|
|
304
|
-
declare function
|
|
527
|
+
declare function useActiveUsers(options?: UsePaginatedUsersOptions): UsePaginatedUsersReturn;
|
|
528
|
+
/**
|
|
529
|
+
* Composable for fetching deleted users with pagination
|
|
530
|
+
*
|
|
531
|
+
* @example
|
|
532
|
+
* ```typescript
|
|
533
|
+
* import { useDeletedUsers } from '@htlkg/data/hooks';
|
|
534
|
+
*
|
|
535
|
+
* const { users, loading, hasMore, loadMore, refetch } = useDeletedUsers({
|
|
536
|
+
* pageSize: 25,
|
|
537
|
+
* });
|
|
538
|
+
* ```
|
|
539
|
+
*/
|
|
540
|
+
declare function useDeletedUsers(options?: UsePaginatedUsersOptions): UsePaginatedUsersReturn;
|
|
305
541
|
|
|
306
542
|
/**
|
|
307
|
-
*
|
|
543
|
+
* useAccounts Hook
|
|
308
544
|
*
|
|
309
|
-
* Vue composable for fetching and managing
|
|
310
|
-
* Provides loading states, error handling, refetch capabilities
|
|
545
|
+
* Vue composable for fetching and managing account data with reactive state.
|
|
546
|
+
* Provides loading states, error handling, and refetch capabilities.
|
|
547
|
+
* Includes brands relationship data for displaying brand info without separate queries.
|
|
311
548
|
*/
|
|
312
549
|
|
|
313
|
-
interface
|
|
314
|
-
/** Filter criteria for
|
|
550
|
+
interface UseAccountsOptions extends BaseHookOptions {
|
|
551
|
+
/** Filter criteria for accounts */
|
|
315
552
|
filter?: any;
|
|
316
553
|
/** Limit number of results */
|
|
317
554
|
limit?: number;
|
|
318
555
|
/** Auto-fetch on mount (default: true) */
|
|
319
556
|
autoFetch?: boolean;
|
|
320
|
-
/** Filter by brand ID */
|
|
321
|
-
brandId?: string;
|
|
322
|
-
/** Filter by account ID */
|
|
323
|
-
accountId?: string;
|
|
324
|
-
/** Filter by product ID */
|
|
325
|
-
productId?: string;
|
|
326
|
-
/** Only enabled instances */
|
|
327
|
-
enabledOnly?: boolean;
|
|
328
557
|
}
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
558
|
+
/** Brand info included with account */
|
|
559
|
+
interface AccountBrand {
|
|
560
|
+
id: string;
|
|
561
|
+
name: string;
|
|
562
|
+
status?: string;
|
|
563
|
+
}
|
|
564
|
+
/** Extended account type with brands relationship */
|
|
565
|
+
type AccountWithBrands = Account & {
|
|
566
|
+
brands: AccountBrand[];
|
|
567
|
+
brandCount: number;
|
|
568
|
+
deletedAt?: string;
|
|
569
|
+
deletedBy?: string;
|
|
570
|
+
};
|
|
571
|
+
interface UseAccountsReturn {
|
|
572
|
+
/** Reactive array of accounts with brands */
|
|
573
|
+
accounts: Ref<AccountWithBrands[]>;
|
|
334
574
|
/** Loading state */
|
|
335
575
|
loading: Ref<boolean>;
|
|
336
576
|
/** Error state */
|
|
337
577
|
error: Ref<Error | null>;
|
|
338
|
-
/** Refetch
|
|
578
|
+
/** Refetch accounts */
|
|
339
579
|
refetch: () => Promise<void>;
|
|
340
|
-
/** Create a new product instance */
|
|
341
|
-
createInstance: (input: CreateProductInstanceInput) => Promise<ProductInstance>;
|
|
342
|
-
/** Update an existing product instance */
|
|
343
|
-
updateInstance: (input: UpdateProductInstanceInput) => Promise<ProductInstance>;
|
|
344
|
-
/** Delete a product instance */
|
|
345
|
-
deleteInstance: (id: string) => Promise<boolean>;
|
|
346
|
-
/** Toggle the enabled status of a product instance */
|
|
347
|
-
toggleEnabled: (id: string, enabled: boolean) => Promise<ProductInstance>;
|
|
348
580
|
}
|
|
349
581
|
/**
|
|
350
|
-
* Composable for fetching and managing
|
|
582
|
+
* Composable for fetching and managing accounts
|
|
351
583
|
*
|
|
352
584
|
* @example
|
|
353
585
|
* ```typescript
|
|
354
|
-
* import {
|
|
586
|
+
* import { useAccounts } from '@htlkg/data/hooks';
|
|
355
587
|
*
|
|
356
|
-
* const {
|
|
588
|
+
* const { accounts, loading, error, refetch } = useAccounts();
|
|
357
589
|
* ```
|
|
358
590
|
*
|
|
359
591
|
* @example With filters
|
|
360
592
|
* ```typescript
|
|
361
|
-
* const {
|
|
362
|
-
*
|
|
363
|
-
* enabledOnly: true,
|
|
593
|
+
* const { accounts, loading } = useAccounts({
|
|
594
|
+
* filter: { status: { eq: 'active' } },
|
|
364
595
|
* limit: 50
|
|
365
596
|
* });
|
|
366
597
|
* ```
|
|
598
|
+
*/
|
|
599
|
+
declare function useAccounts(options?: UseAccountsOptions): UseAccountsReturn;
|
|
600
|
+
|
|
601
|
+
/**
|
|
602
|
+
* Paginated Accounts Hooks
|
|
367
603
|
*
|
|
368
|
-
*
|
|
604
|
+
* Vue composables for fetching accounts with server-side pagination.
|
|
605
|
+
* Provides separate hooks for active and deleted accounts to enable
|
|
606
|
+
* efficient tab-based filtering in large datasets.
|
|
607
|
+
*/
|
|
608
|
+
|
|
609
|
+
interface UsePaginatedAccountsOptions extends PaginatedHookOptions {
|
|
610
|
+
}
|
|
611
|
+
interface UsePaginatedAccountsReturn {
|
|
612
|
+
/** Reactive array of accounts with brands */
|
|
613
|
+
accounts: Ref<AccountWithBrands[]>;
|
|
614
|
+
/** Loading state (true during any fetch) */
|
|
615
|
+
loading: Ref<boolean>;
|
|
616
|
+
/** Loading state for initial fetch */
|
|
617
|
+
initialLoading: Ref<boolean>;
|
|
618
|
+
/** Loading state for loadMore */
|
|
619
|
+
loadingMore: Ref<boolean>;
|
|
620
|
+
/** Error state */
|
|
621
|
+
error: Ref<Error | null>;
|
|
622
|
+
/** Pagination state */
|
|
623
|
+
pagination: Ref<PaginationState>;
|
|
624
|
+
/** Whether there are more items to load */
|
|
625
|
+
hasMore: ComputedRef<boolean>;
|
|
626
|
+
/** Load next page of data */
|
|
627
|
+
loadMore: () => Promise<void>;
|
|
628
|
+
/** Refetch data (resets to first page) */
|
|
629
|
+
refetch: () => Promise<void>;
|
|
630
|
+
/** Reset data and pagination state */
|
|
631
|
+
reset: () => void;
|
|
632
|
+
/** Update search filter and refetch from server (searches ALL data) */
|
|
633
|
+
setSearchFilter: (filter: any) => Promise<void>;
|
|
634
|
+
/** Current search filter */
|
|
635
|
+
searchFilter: Ref<any>;
|
|
636
|
+
}
|
|
637
|
+
/**
|
|
638
|
+
* Composable for fetching active (non-deleted) accounts with pagination
|
|
639
|
+
*
|
|
640
|
+
* @example
|
|
369
641
|
* ```typescript
|
|
370
|
-
*
|
|
371
|
-
*
|
|
372
|
-
*
|
|
642
|
+
* import { useActiveAccounts } from '@htlkg/data/hooks';
|
|
643
|
+
*
|
|
644
|
+
* const { accounts, loading, hasMore, loadMore, refetch } = useActiveAccounts({
|
|
645
|
+
* pageSize: 25,
|
|
373
646
|
* });
|
|
647
|
+
*
|
|
648
|
+
* // Load more when user scrolls or clicks "Load More"
|
|
649
|
+
* async function onLoadMore() {
|
|
650
|
+
* await loadMore();
|
|
651
|
+
* }
|
|
374
652
|
* ```
|
|
375
653
|
*/
|
|
376
|
-
declare function
|
|
654
|
+
declare function useActiveAccounts(options?: UsePaginatedAccountsOptions): UsePaginatedAccountsReturn;
|
|
655
|
+
/**
|
|
656
|
+
* Composable for fetching deleted accounts with pagination
|
|
657
|
+
*
|
|
658
|
+
* @example
|
|
659
|
+
* ```typescript
|
|
660
|
+
* import { useDeletedAccounts } from '@htlkg/data/hooks';
|
|
661
|
+
*
|
|
662
|
+
* const { accounts, loading, hasMore, loadMore, refetch } = useDeletedAccounts({
|
|
663
|
+
* pageSize: 25,
|
|
664
|
+
* });
|
|
665
|
+
* ```
|
|
666
|
+
*/
|
|
667
|
+
declare function useDeletedAccounts(options?: UsePaginatedAccountsOptions): UsePaginatedAccountsReturn;
|
|
377
668
|
|
|
378
669
|
/**
|
|
379
670
|
* useReservations Hook
|
|
@@ -396,13 +687,20 @@ interface UseReservationsOptions extends BaseHookOptions {
|
|
|
396
687
|
/** Pagination token for fetching next page */
|
|
397
688
|
nextToken?: string;
|
|
398
689
|
}
|
|
690
|
+
/** Extended reservation type with related data */
|
|
691
|
+
type ReservationWithRelations = Reservation & {
|
|
692
|
+
brandName: string;
|
|
693
|
+
guestName: string;
|
|
694
|
+
guestEmail: string;
|
|
695
|
+
guestPhone: string;
|
|
696
|
+
};
|
|
399
697
|
interface UseReservationsReturn {
|
|
400
|
-
/** Reactive array of reservations */
|
|
401
|
-
reservations: Ref<
|
|
698
|
+
/** Reactive array of reservations with brand and guest info */
|
|
699
|
+
reservations: Ref<ReservationWithRelations[]>;
|
|
402
700
|
/** Computed array of confirmed reservations */
|
|
403
|
-
confirmedReservations: ComputedRef<
|
|
701
|
+
confirmedReservations: ComputedRef<ReservationWithRelations[]>;
|
|
404
702
|
/** Computed array of active reservations (confirmed or checked_in) */
|
|
405
|
-
activeReservations: ComputedRef<
|
|
703
|
+
activeReservations: ComputedRef<ReservationWithRelations[]>;
|
|
406
704
|
/** Loading state */
|
|
407
705
|
loading: Ref<boolean>;
|
|
408
706
|
/** Error state */
|
|
@@ -445,6 +743,215 @@ interface UseReservationsReturn {
|
|
|
445
743
|
*/
|
|
446
744
|
declare function useReservations(options?: UseReservationsOptions): UseReservationsReturn;
|
|
447
745
|
|
|
746
|
+
/**
|
|
747
|
+
* Paginated Reservations Hooks
|
|
748
|
+
*
|
|
749
|
+
* Vue composables for fetching reservations with server-side pagination.
|
|
750
|
+
* Provides separate hooks for active and deleted reservations to enable
|
|
751
|
+
* efficient tab-based filtering in large datasets.
|
|
752
|
+
*/
|
|
753
|
+
|
|
754
|
+
interface UsePaginatedReservationsOptions extends PaginatedHookOptions {
|
|
755
|
+
/** Filter by brand ID */
|
|
756
|
+
brandId?: string;
|
|
757
|
+
/** Filter by start date (check-in date >= startDate) */
|
|
758
|
+
startDate?: string;
|
|
759
|
+
/** Filter by end date (check-in date <= endDate) */
|
|
760
|
+
endDate?: string;
|
|
761
|
+
/** Filter by reservation status */
|
|
762
|
+
status?: Reservation["status"];
|
|
763
|
+
/** Filter by contact/visit ID */
|
|
764
|
+
contactId?: string;
|
|
765
|
+
}
|
|
766
|
+
interface UsePaginatedReservationsReturn {
|
|
767
|
+
/** Reactive array of reservations with brand and guest info */
|
|
768
|
+
reservations: Ref<ReservationWithRelations[]>;
|
|
769
|
+
/** Loading state (true during any fetch) */
|
|
770
|
+
loading: Ref<boolean>;
|
|
771
|
+
/** Loading state for initial fetch */
|
|
772
|
+
initialLoading: Ref<boolean>;
|
|
773
|
+
/** Loading state for loadMore */
|
|
774
|
+
loadingMore: Ref<boolean>;
|
|
775
|
+
/** Error state */
|
|
776
|
+
error: Ref<Error | null>;
|
|
777
|
+
/** Pagination state */
|
|
778
|
+
pagination: Ref<PaginationState>;
|
|
779
|
+
/** Whether there are more items to load */
|
|
780
|
+
hasMore: ComputedRef<boolean>;
|
|
781
|
+
/** Load next page of data */
|
|
782
|
+
loadMore: () => Promise<void>;
|
|
783
|
+
/** Refetch data (resets to first page) */
|
|
784
|
+
refetch: () => Promise<void>;
|
|
785
|
+
/** Reset data and pagination state */
|
|
786
|
+
reset: () => void;
|
|
787
|
+
/** Update search filter and refetch from server (searches ALL data) */
|
|
788
|
+
setSearchFilter: (filter: any) => Promise<void>;
|
|
789
|
+
/** Current search filter */
|
|
790
|
+
searchFilter: Ref<any>;
|
|
791
|
+
}
|
|
792
|
+
/**
|
|
793
|
+
* Composable for fetching active (non-deleted) reservations with pagination
|
|
794
|
+
*
|
|
795
|
+
* @example
|
|
796
|
+
* ```typescript
|
|
797
|
+
* import { useActiveReservations } from '@htlkg/data/hooks';
|
|
798
|
+
*
|
|
799
|
+
* const { reservations, loading, hasMore, loadMore, refetch } = useActiveReservations({
|
|
800
|
+
* pageSize: 25,
|
|
801
|
+
* brandId: 'brand-123',
|
|
802
|
+
* });
|
|
803
|
+
*
|
|
804
|
+
* // Load more when user scrolls or clicks "Load More"
|
|
805
|
+
* async function onLoadMore() {
|
|
806
|
+
* await loadMore();
|
|
807
|
+
* }
|
|
808
|
+
* ```
|
|
809
|
+
*
|
|
810
|
+
* @example With date filters
|
|
811
|
+
* ```typescript
|
|
812
|
+
* const { reservations, loading } = useActiveReservations({
|
|
813
|
+
* brandId: 'brand-123',
|
|
814
|
+
* startDate: '2026-01-01',
|
|
815
|
+
* endDate: '2026-01-31',
|
|
816
|
+
* status: 'confirmed'
|
|
817
|
+
* });
|
|
818
|
+
* ```
|
|
819
|
+
*/
|
|
820
|
+
declare function useActiveReservations(options?: UsePaginatedReservationsOptions): UsePaginatedReservationsReturn;
|
|
821
|
+
/**
|
|
822
|
+
* Composable for fetching deleted reservations with pagination
|
|
823
|
+
*
|
|
824
|
+
* @example
|
|
825
|
+
* ```typescript
|
|
826
|
+
* import { useDeletedReservations } from '@htlkg/data/hooks';
|
|
827
|
+
*
|
|
828
|
+
* const { reservations, loading, hasMore, loadMore, refetch } = useDeletedReservations({
|
|
829
|
+
* pageSize: 25,
|
|
830
|
+
* });
|
|
831
|
+
* ```
|
|
832
|
+
*/
|
|
833
|
+
declare function useDeletedReservations(options?: UsePaginatedReservationsOptions): UsePaginatedReservationsReturn;
|
|
834
|
+
|
|
835
|
+
/**
|
|
836
|
+
* Product Hooks
|
|
837
|
+
*
|
|
838
|
+
* Vue composables for fetching and managing product data with reactive state.
|
|
839
|
+
*/
|
|
840
|
+
|
|
841
|
+
interface UseProductsOptions extends BaseHookOptions {
|
|
842
|
+
/** Filter criteria for products */
|
|
843
|
+
filter?: any;
|
|
844
|
+
/** Limit number of results */
|
|
845
|
+
limit?: number;
|
|
846
|
+
/** Auto-fetch on mount (default: true) */
|
|
847
|
+
autoFetch?: boolean;
|
|
848
|
+
/** Only active products */
|
|
849
|
+
activeOnly?: boolean;
|
|
850
|
+
}
|
|
851
|
+
interface UseProductsReturn {
|
|
852
|
+
/** Reactive array of products */
|
|
853
|
+
products: Ref<Product[]>;
|
|
854
|
+
/** Computed array of active products only */
|
|
855
|
+
activeProducts: ComputedRef<Product[]>;
|
|
856
|
+
/** Loading state */
|
|
857
|
+
loading: Ref<boolean>;
|
|
858
|
+
/** Error state */
|
|
859
|
+
error: Ref<Error | null>;
|
|
860
|
+
/** Refetch products */
|
|
861
|
+
refetch: () => Promise<void>;
|
|
862
|
+
}
|
|
863
|
+
/**
|
|
864
|
+
* Composable for fetching and managing products
|
|
865
|
+
*
|
|
866
|
+
* @example
|
|
867
|
+
* ```typescript
|
|
868
|
+
* import { useProducts } from '@htlkg/data/hooks/products';
|
|
869
|
+
*
|
|
870
|
+
* const { products, loading, error, refetch } = useProducts();
|
|
871
|
+
* ```
|
|
872
|
+
*
|
|
873
|
+
* @example With filters
|
|
874
|
+
* ```typescript
|
|
875
|
+
* const { products, loading } = useProducts({
|
|
876
|
+
* activeOnly: true,
|
|
877
|
+
* limit: 50
|
|
878
|
+
* });
|
|
879
|
+
* ```
|
|
880
|
+
*/
|
|
881
|
+
declare function useProducts(options?: UseProductsOptions): UseProductsReturn;
|
|
882
|
+
|
|
883
|
+
/**
|
|
884
|
+
* ProductInstance Hooks
|
|
885
|
+
*
|
|
886
|
+
* Vue composables for fetching and managing product instance data with reactive state.
|
|
887
|
+
* Provides loading states, error handling, refetch capabilities, and CRUD operations.
|
|
888
|
+
*/
|
|
889
|
+
|
|
890
|
+
interface UseProductInstancesOptions extends BaseHookOptions {
|
|
891
|
+
/** Filter criteria for product instances */
|
|
892
|
+
filter?: any;
|
|
893
|
+
/** Limit number of results */
|
|
894
|
+
limit?: number;
|
|
895
|
+
/** Auto-fetch on mount (default: true) */
|
|
896
|
+
autoFetch?: boolean;
|
|
897
|
+
/** Filter by brand ID */
|
|
898
|
+
brandId?: string;
|
|
899
|
+
/** Filter by account ID */
|
|
900
|
+
accountId?: string;
|
|
901
|
+
/** Filter by product ID */
|
|
902
|
+
productId?: string;
|
|
903
|
+
/** Only enabled instances */
|
|
904
|
+
enabledOnly?: boolean;
|
|
905
|
+
}
|
|
906
|
+
interface UseProductInstancesReturn {
|
|
907
|
+
/** Reactive array of product instances */
|
|
908
|
+
instances: Ref<ProductInstance[]>;
|
|
909
|
+
/** Computed array of enabled instances only */
|
|
910
|
+
enabledInstances: ComputedRef<ProductInstance[]>;
|
|
911
|
+
/** Loading state */
|
|
912
|
+
loading: Ref<boolean>;
|
|
913
|
+
/** Error state */
|
|
914
|
+
error: Ref<Error | null>;
|
|
915
|
+
/** Refetch product instances */
|
|
916
|
+
refetch: () => Promise<void>;
|
|
917
|
+
/** Create a new product instance */
|
|
918
|
+
createInstance: (input: CreateProductInstanceInput) => Promise<ProductInstance>;
|
|
919
|
+
/** Update an existing product instance */
|
|
920
|
+
updateInstance: (input: UpdateProductInstanceInput) => Promise<ProductInstance>;
|
|
921
|
+
/** Delete a product instance */
|
|
922
|
+
deleteInstance: (id: string) => Promise<boolean>;
|
|
923
|
+
/** Toggle the enabled status of a product instance */
|
|
924
|
+
toggleEnabled: (id: string, enabled: boolean) => Promise<ProductInstance>;
|
|
925
|
+
}
|
|
926
|
+
/**
|
|
927
|
+
* Composable for fetching and managing product instances
|
|
928
|
+
*
|
|
929
|
+
* @example
|
|
930
|
+
* ```typescript
|
|
931
|
+
* import { useProductInstances } from '@htlkg/data/hooks/productInstances';
|
|
932
|
+
*
|
|
933
|
+
* const { instances, loading, error, refetch } = useProductInstances();
|
|
934
|
+
* ```
|
|
935
|
+
*
|
|
936
|
+
* @example With filters
|
|
937
|
+
* ```typescript
|
|
938
|
+
* const { instances, enabledInstances, loading } = useProductInstances({
|
|
939
|
+
* brandId: 'brand-123',
|
|
940
|
+
* enabledOnly: true,
|
|
941
|
+
* limit: 50
|
|
942
|
+
* });
|
|
943
|
+
* ```
|
|
944
|
+
*
|
|
945
|
+
* @example For a specific account
|
|
946
|
+
* ```typescript
|
|
947
|
+
* const { instances, loading } = useProductInstances({
|
|
948
|
+
* accountId: 'account-456',
|
|
949
|
+
* autoFetch: true
|
|
950
|
+
* });
|
|
951
|
+
* ```
|
|
952
|
+
*/
|
|
953
|
+
declare function useProductInstances(options?: UseProductInstancesOptions): UseProductInstancesReturn;
|
|
954
|
+
|
|
448
955
|
/**
|
|
449
956
|
* useContacts Hook
|
|
450
957
|
*
|
|
@@ -531,4 +1038,105 @@ interface UseContactsReturn {
|
|
|
531
1038
|
*/
|
|
532
1039
|
declare function useContacts(options?: UseContactsOptions): UseContactsReturn;
|
|
533
1040
|
|
|
534
|
-
|
|
1041
|
+
/**
|
|
1042
|
+
* Paginated Contacts Hooks
|
|
1043
|
+
*
|
|
1044
|
+
* Vue composables for fetching contacts with server-side pagination.
|
|
1045
|
+
* Provides separate hooks for active and deleted contacts to enable
|
|
1046
|
+
* efficient tab-based filtering in large datasets.
|
|
1047
|
+
*/
|
|
1048
|
+
|
|
1049
|
+
/** Extended Contact type with computed fields */
|
|
1050
|
+
type ContactWithRelations = Contact & {
|
|
1051
|
+
brandName?: string;
|
|
1052
|
+
name?: string;
|
|
1053
|
+
deletedAt?: string;
|
|
1054
|
+
deletedBy?: string;
|
|
1055
|
+
};
|
|
1056
|
+
interface UsePaginatedContactsOptions extends PaginatedHookOptions {
|
|
1057
|
+
/** Filter by brand ID */
|
|
1058
|
+
brandId?: string;
|
|
1059
|
+
/** Filter by account ID */
|
|
1060
|
+
accountId?: string;
|
|
1061
|
+
/** Search query (searches email, firstName, lastName) */
|
|
1062
|
+
search?: string;
|
|
1063
|
+
/** Filter by GDPR consent */
|
|
1064
|
+
gdprConsent?: boolean;
|
|
1065
|
+
/** Filter by marketing opt-in */
|
|
1066
|
+
marketingOptIn?: boolean;
|
|
1067
|
+
/** Filter by tags (contact must have at least one of these tags) */
|
|
1068
|
+
tags?: string[];
|
|
1069
|
+
}
|
|
1070
|
+
interface UsePaginatedContactsReturn {
|
|
1071
|
+
/** Reactive array of contacts */
|
|
1072
|
+
contacts: Ref<ContactWithRelations[]>;
|
|
1073
|
+
/** Loading state (true during any fetch) */
|
|
1074
|
+
loading: Ref<boolean>;
|
|
1075
|
+
/** Loading state for initial fetch */
|
|
1076
|
+
initialLoading: Ref<boolean>;
|
|
1077
|
+
/** Loading state for loadMore */
|
|
1078
|
+
loadingMore: Ref<boolean>;
|
|
1079
|
+
/** Error state */
|
|
1080
|
+
error: Ref<Error | null>;
|
|
1081
|
+
/** Pagination state */
|
|
1082
|
+
pagination: Ref<PaginationState>;
|
|
1083
|
+
/** Whether there are more items to load */
|
|
1084
|
+
hasMore: ComputedRef<boolean>;
|
|
1085
|
+
/** Load next page of data */
|
|
1086
|
+
loadMore: () => Promise<void>;
|
|
1087
|
+
/** Refetch data (resets to first page) */
|
|
1088
|
+
refetch: () => Promise<void>;
|
|
1089
|
+
/** Reset data and pagination state */
|
|
1090
|
+
reset: () => void;
|
|
1091
|
+
/** Update search filter and refetch from server (searches ALL data) */
|
|
1092
|
+
setSearchFilter: (filter: any) => Promise<void>;
|
|
1093
|
+
/** Current search filter */
|
|
1094
|
+
searchFilter: Ref<any>;
|
|
1095
|
+
}
|
|
1096
|
+
/**
|
|
1097
|
+
* Composable for fetching active (non-deleted) contacts with pagination
|
|
1098
|
+
*
|
|
1099
|
+
* @example
|
|
1100
|
+
* ```typescript
|
|
1101
|
+
* import { useActiveContacts } from '@htlkg/data/hooks';
|
|
1102
|
+
*
|
|
1103
|
+
* const { contacts, loading, hasMore, loadMore, refetch, setSearchFilter } = useActiveContacts({
|
|
1104
|
+
* pageSize: 25,
|
|
1105
|
+
* });
|
|
1106
|
+
*
|
|
1107
|
+
* // Load more when user scrolls or clicks "Load More"
|
|
1108
|
+
* async function onLoadMore() {
|
|
1109
|
+
* await loadMore();
|
|
1110
|
+
* }
|
|
1111
|
+
*
|
|
1112
|
+
* // Server-side search (searches ALL contacts in database)
|
|
1113
|
+
* async function onSearch(filter: any) {
|
|
1114
|
+
* await setSearchFilter(filter);
|
|
1115
|
+
* }
|
|
1116
|
+
* ```
|
|
1117
|
+
*
|
|
1118
|
+
* @example With filters
|
|
1119
|
+
* ```typescript
|
|
1120
|
+
* const { contacts, loading } = useActiveContacts({
|
|
1121
|
+
* brandId: 'brand-123',
|
|
1122
|
+
* gdprConsent: true,
|
|
1123
|
+
* pageSize: 50
|
|
1124
|
+
* });
|
|
1125
|
+
* ```
|
|
1126
|
+
*/
|
|
1127
|
+
declare function useActiveContacts(options?: UsePaginatedContactsOptions): UsePaginatedContactsReturn;
|
|
1128
|
+
/**
|
|
1129
|
+
* Composable for fetching deleted contacts with pagination
|
|
1130
|
+
*
|
|
1131
|
+
* @example
|
|
1132
|
+
* ```typescript
|
|
1133
|
+
* import { useDeletedContacts } from '@htlkg/data/hooks';
|
|
1134
|
+
*
|
|
1135
|
+
* const { contacts, loading, hasMore, loadMore, refetch } = useDeletedContacts({
|
|
1136
|
+
* pageSize: 25,
|
|
1137
|
+
* });
|
|
1138
|
+
* ```
|
|
1139
|
+
*/
|
|
1140
|
+
declare function useDeletedContacts(options?: UsePaginatedContactsOptions): UsePaginatedContactsReturn;
|
|
1141
|
+
|
|
1142
|
+
export { ACTIVE_FILTER, type AccountWithBrands, type BaseHookOptions, type BrandWithCounts, type ContactWithRelations, type CreateDataHookOptions, type CreatePaginatedDataHookOptions, DELETED_FILTER, type DataHookReturn, type InferHookReturn, type InferPaginatedHookReturn, type AccountWithBrands as PaginatedAccountWithBrands, type PaginatedDataHookReturn, type PaginatedHookOptions, type PaginationState, type ReservationWithRelations, type UseAccountsOptions, type UseAccountsReturn, type UseBrandsOptions, type UseBrandsReturn, type UseContactsOptions, type UseContactsReturn, type UsePaginatedAccountsOptions, type UsePaginatedAccountsReturn, type UsePaginatedBrandsOptions, type UsePaginatedBrandsReturn, type UsePaginatedContactsOptions, type UsePaginatedContactsReturn, type UsePaginatedReservationsOptions, type UsePaginatedReservationsReturn, type UsePaginatedUsersOptions, type UsePaginatedUsersReturn, type UseProductInstancesOptions, type UseProductInstancesReturn, type UseProductsOptions, type UseProductsReturn, type UseReservationsOptions, type UseReservationsReturn, type UseUsersOptions, type UseUsersReturn, type UserWithRelations, createDataHook, createPaginatedDataHook, resetClientInstance, useAccounts, useActiveAccounts, useActiveBrands, useActiveContacts, useActiveReservations, useActiveUsers, useBrands, useContacts, useDeletedAccounts, useDeletedBrands, useDeletedContacts, useDeletedReservations, useDeletedUsers, useProductInstances, useProducts, useReservations, useUsers };
|