@react-pakistan/util-functions 1.25.9 → 1.25.11

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 (57) hide show
  1. package/api/stellar-solutions/bank/cache.d.ts +0 -104
  2. package/api/stellar-solutions/bank/cache.js +237 -296
  3. package/api/stellar-solutions/bank/index.d.ts +1 -1
  4. package/api/stellar-solutions/bank/index.js +0 -15
  5. package/api/stellar-solutions/branch/cache.d.ts +0 -102
  6. package/api/stellar-solutions/branch/cache.js +241 -296
  7. package/api/stellar-solutions/branch/index.d.ts +1 -1
  8. package/api/stellar-solutions/branch/index.js +0 -15
  9. package/api/stellar-solutions/company/cache.d.ts +0 -106
  10. package/api/stellar-solutions/company/cache.js +247 -308
  11. package/api/stellar-solutions/company/index.d.ts +1 -1
  12. package/api/stellar-solutions/company/index.js +0 -15
  13. package/api/stellar-solutions/contact/cache.d.ts +0 -108
  14. package/api/stellar-solutions/contact/cache.js +247 -308
  15. package/api/stellar-solutions/contact/index.d.ts +1 -1
  16. package/api/stellar-solutions/contact/index.js +0 -15
  17. package/api/stellar-solutions/currency/cache.d.ts +0 -104
  18. package/api/stellar-solutions/currency/cache.js +243 -296
  19. package/api/stellar-solutions/currency/index.d.ts +1 -1
  20. package/api/stellar-solutions/currency/index.js +0 -15
  21. package/api/stellar-solutions/customer/cache.d.ts +0 -108
  22. package/api/stellar-solutions/customer/cache.js +249 -308
  23. package/api/stellar-solutions/customer/index.d.ts +1 -1
  24. package/api/stellar-solutions/customer/index.js +0 -15
  25. package/api/stellar-solutions/expense/cache.d.ts +0 -106
  26. package/api/stellar-solutions/expense/cache.js +247 -308
  27. package/api/stellar-solutions/expense/index.d.ts +1 -1
  28. package/api/stellar-solutions/expense/index.js +0 -15
  29. package/api/stellar-solutions/expense-category/cache.d.ts +0 -94
  30. package/api/stellar-solutions/expense-category/cache.js +224 -281
  31. package/api/stellar-solutions/expense-category/index.d.ts +1 -1
  32. package/api/stellar-solutions/expense-category/index.js +0 -15
  33. package/api/stellar-solutions/payment-mode/cache.d.ts +0 -102
  34. package/api/stellar-solutions/payment-mode/cache.js +245 -296
  35. package/api/stellar-solutions/payment-mode/index.d.ts +1 -1
  36. package/api/stellar-solutions/payment-mode/index.js +0 -15
  37. package/api/stellar-solutions/preference/cache.d.ts +0 -90
  38. package/api/stellar-solutions/preference/cache.js +218 -269
  39. package/api/stellar-solutions/preference/index.d.ts +1 -1
  40. package/api/stellar-solutions/preference/index.js +0 -15
  41. package/api/stellar-solutions/product/cache.d.ts +0 -94
  42. package/api/stellar-solutions/product/cache.js +222 -281
  43. package/api/stellar-solutions/product/index.d.ts +1 -1
  44. package/api/stellar-solutions/product/index.js +0 -15
  45. package/api/stellar-solutions/product-category/cache.d.ts +0 -94
  46. package/api/stellar-solutions/product-category/cache.js +224 -281
  47. package/api/stellar-solutions/product-category/index.d.ts +1 -1
  48. package/api/stellar-solutions/product-category/index.js +0 -15
  49. package/api/stellar-solutions/tax/cache.d.ts +0 -102
  50. package/api/stellar-solutions/tax/cache.js +235 -296
  51. package/api/stellar-solutions/tax/index.d.ts +1 -1
  52. package/api/stellar-solutions/tax/index.js +0 -15
  53. package/general/format-secs.d.ts +1 -0
  54. package/general/format-secs.js +21 -0
  55. package/general/index.d.ts +1 -0
  56. package/general/index.js +1 -0
  57. package/package.json +1 -1
@@ -1,108 +0,0 @@
1
- import { ContactBE } from '../type';
2
- /**
3
- * Synchronous utility function to get contacts from cache only
4
- * Returns cached data immediately if available and fresh, otherwise returns empty array
5
- * Does not trigger any API calls
6
- *
7
- * @returns ContactBE[] - Array of cached contacts or empty array wrapper ({count, items})
8
- *
9
- * @example
10
- * const contacts = getCachedContactsSync();
11
- * if (contacts.items.length > 0) {
12
- * console.log(contacts.items[0].firstName);
13
- * }
14
- */
15
- export declare const getCachedContactsSync: () => {
16
- count: number;
17
- items: ContactBE[];
18
- };
19
- /**
20
- * Utility function to get contacts from cache or fetch from API
21
- *
22
- * This function manages a localStorage cache of contacts with the following logic:
23
- * - If contacts exist in cache and are less than 1 day old, return cached version
24
- * - If contacts exist but are older than 1 day, fetch fresh data and update cache
25
- * - If contacts don't exist in cache, fetch from API and cache them
26
- *
27
- * @param searchQuery - Optional search query to filter contacts
28
- * @param filters - Optional filters object to apply additional filtering (bypasses cache)
29
- * @param pageLimit - Number of contacts to fetch (default: 100)
30
- * @returns Promise<{count:number, items: ContactBE[]}> - Paged contacts
31
- *
32
- * @example
33
- * const contacts = await getCachedContacts();
34
- * console.log(contacts.items[0].firstName);
35
- *
36
- * // With search
37
- * const filtered = await getCachedContacts('John');
38
- *
39
- * // With filters
40
- * const filteredByCompany = await getCachedContacts(undefined, { companyId: 'company-123' });
41
- */
42
- export declare const getCachedContacts: (searchQuery?: string, filters?: Record<string, unknown>, pageLimit?: number) => Promise<{
43
- count: number;
44
- items: ContactBE[];
45
- }>;
46
- /**
47
- * Utility function to get a specific contact by ID from cache
48
- * If not found in cache, returns null (does not trigger API call)
49
- *
50
- * @param contactId - The ID of the contact to retrieve
51
- * @returns ContactBE | null - The contact or null if not found
52
- *
53
- * @example
54
- * const contact = getCachedContactById('contact-123');
55
- * if (contact) {
56
- * console.log(contact.firstName);
57
- * }
58
- */
59
- export declare const getCachedContactById: (contactId: string) => ContactBE | null;
60
- /**
61
- * Utility function to get contacts by email from cache
62
- * If not found in cache, returns null (does not trigger API call)
63
- *
64
- * @param email - The email of the contact to search for
65
- * @returns ContactBE | null - The contact or null if not found
66
- *
67
- * @example
68
- * const contact = getCachedContactByEmail('john@example.com');
69
- * if (contact) {
70
- * console.log(contact.firstName);
71
- * }
72
- */
73
- export declare const getCachedContactByEmail: (email: string) => ContactBE | null;
74
- /**
75
- * Utility function to invalidate (remove) contacts from cache
76
- * Useful when contacts have been updated and you want to force a refresh
77
- *
78
- * @example
79
- * invalidateContactsCache();
80
- * const freshContacts = await getCachedContacts();
81
- */
82
- export declare const invalidateContactsCache: () => void;
83
- /**
84
- * Utility function to preload contacts into cache
85
- * Useful to call on app initialization or login
86
- *
87
- * @returns Promise<{count:number, items: ContactBE[]}> - Array of preloaded contacts
88
- *
89
- * @example
90
- * // On app initialization
91
- * await preloadContacts();
92
- */
93
- export declare const preloadContacts: () => Promise<{
94
- count: number;
95
- items: ContactBE[];
96
- }>;
97
- /**
98
- * Utility function to check if contacts cache is stale
99
- * Returns true if cache is older than 1 day or doesn't exist
100
- *
101
- * @returns boolean - True if cache is stale or doesn't exist
102
- *
103
- * @example
104
- * if (isContactsCacheStale()) {
105
- * await getCachedContacts(); // This will fetch fresh data
106
- * }
107
- */
108
- export declare const isContactsCacheStale: () => boolean;