@oxyhq/services 6.10.3 → 6.10.4

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 (62) hide show
  1. package/lib/commonjs/index.js +32 -0
  2. package/lib/commonjs/index.js.map +1 -1
  3. package/lib/commonjs/ui/hooks/queries/index.js +31 -0
  4. package/lib/commonjs/ui/hooks/queries/index.js.map +1 -1
  5. package/lib/commonjs/ui/hooks/queries/paymentTypes.js +2 -0
  6. package/lib/commonjs/ui/hooks/queries/paymentTypes.js.map +1 -0
  7. package/lib/commonjs/ui/hooks/queries/queryKeys.js +13 -0
  8. package/lib/commonjs/ui/hooks/queries/queryKeys.js.map +1 -1
  9. package/lib/commonjs/ui/hooks/queries/usePaymentQueries.js +140 -0
  10. package/lib/commonjs/ui/hooks/queries/usePaymentQueries.js.map +1 -0
  11. package/lib/commonjs/ui/hooks/queries/useServicesQueries.js +26 -1
  12. package/lib/commonjs/ui/hooks/queries/useServicesQueries.js.map +1 -1
  13. package/lib/commonjs/ui/hooks/queryClient.js +1 -1
  14. package/lib/commonjs/ui/hooks/queryClient.js.map +1 -1
  15. package/lib/module/index.js +3 -1
  16. package/lib/module/index.js.map +1 -1
  17. package/lib/module/ui/hooks/queries/index.js +7 -2
  18. package/lib/module/ui/hooks/queries/index.js.map +1 -1
  19. package/lib/module/ui/hooks/queries/paymentTypes.js +2 -0
  20. package/lib/module/ui/hooks/queries/paymentTypes.js.map +1 -0
  21. package/lib/module/ui/hooks/queries/queryKeys.js +13 -0
  22. package/lib/module/ui/hooks/queries/queryKeys.js.map +1 -1
  23. package/lib/module/ui/hooks/queries/usePaymentQueries.js +132 -0
  24. package/lib/module/ui/hooks/queries/usePaymentQueries.js.map +1 -0
  25. package/lib/module/ui/hooks/queries/useServicesQueries.js +24 -0
  26. package/lib/module/ui/hooks/queries/useServicesQueries.js.map +1 -1
  27. package/lib/module/ui/hooks/queryClient.js +1 -1
  28. package/lib/module/ui/hooks/queryClient.js.map +1 -1
  29. package/lib/typescript/commonjs/index.d.ts +2 -1
  30. package/lib/typescript/commonjs/index.d.ts.map +1 -1
  31. package/lib/typescript/commonjs/ui/hooks/queries/index.d.ts +3 -1
  32. package/lib/typescript/commonjs/ui/hooks/queries/index.d.ts.map +1 -1
  33. package/lib/typescript/commonjs/ui/hooks/queries/paymentTypes.d.ts +137 -0
  34. package/lib/typescript/commonjs/ui/hooks/queries/paymentTypes.d.ts.map +1 -0
  35. package/lib/typescript/commonjs/ui/hooks/queries/queryKeys.d.ts +11 -0
  36. package/lib/typescript/commonjs/ui/hooks/queries/queryKeys.d.ts.map +1 -1
  37. package/lib/typescript/commonjs/ui/hooks/queries/usePaymentQueries.d.ts +63 -0
  38. package/lib/typescript/commonjs/ui/hooks/queries/usePaymentQueries.d.ts.map +1 -0
  39. package/lib/typescript/commonjs/ui/hooks/queries/useServicesQueries.d.ts +11 -1
  40. package/lib/typescript/commonjs/ui/hooks/queries/useServicesQueries.d.ts.map +1 -1
  41. package/lib/typescript/commonjs/ui/hooks/queryClient.d.ts.map +1 -1
  42. package/lib/typescript/module/index.d.ts +2 -1
  43. package/lib/typescript/module/index.d.ts.map +1 -1
  44. package/lib/typescript/module/ui/hooks/queries/index.d.ts +3 -1
  45. package/lib/typescript/module/ui/hooks/queries/index.d.ts.map +1 -1
  46. package/lib/typescript/module/ui/hooks/queries/paymentTypes.d.ts +137 -0
  47. package/lib/typescript/module/ui/hooks/queries/paymentTypes.d.ts.map +1 -0
  48. package/lib/typescript/module/ui/hooks/queries/queryKeys.d.ts +11 -0
  49. package/lib/typescript/module/ui/hooks/queries/queryKeys.d.ts.map +1 -1
  50. package/lib/typescript/module/ui/hooks/queries/usePaymentQueries.d.ts +63 -0
  51. package/lib/typescript/module/ui/hooks/queries/usePaymentQueries.d.ts.map +1 -0
  52. package/lib/typescript/module/ui/hooks/queries/useServicesQueries.d.ts +11 -1
  53. package/lib/typescript/module/ui/hooks/queries/useServicesQueries.d.ts.map +1 -1
  54. package/lib/typescript/module/ui/hooks/queryClient.d.ts.map +1 -1
  55. package/package.json +1 -1
  56. package/src/index.ts +9 -0
  57. package/src/ui/hooks/queries/index.ts +25 -1
  58. package/src/ui/hooks/queries/paymentTypes.ts +141 -0
  59. package/src/ui/hooks/queries/queryKeys.ts +26 -0
  60. package/src/ui/hooks/queries/usePaymentQueries.ts +136 -0
  61. package/src/ui/hooks/queries/useServicesQueries.ts +26 -1
  62. package/src/ui/hooks/queryClient.ts +1 -0
@@ -1,6 +1,6 @@
1
1
  import { useQuery } from '@tanstack/react-query';
2
2
  import { authenticatedApiCall } from '@oxyhq/core';
3
- import type { ClientSession } from '@oxyhq/core';
3
+ import type { AccountStorageUsageResponse, ClientSession } from '@oxyhq/core';
4
4
  import { queryKeys } from './queryKeys';
5
5
  import { useOxy } from '../../context/OxyContext';
6
6
  import { fetchSessionsWithFallback, mapSessionsToClient } from '../../utils/sessionHelpers';
@@ -124,3 +124,28 @@ export const useSecurityInfo = (options?: { enabled?: boolean }) => {
124
124
  });
125
125
  };
126
126
 
127
+ /**
128
+ * Get account storage usage (server-aggregated usage across assets, mail,
129
+ * recordings, etc.). Wraps `oxyServices.getAccountStorageUsage()` in a
130
+ * TanStack query so consumers get caching, background refetch, and a
131
+ * consistent `isLoading` / `refetch` surface instead of hand-rolled
132
+ * `useEffect` fetches.
133
+ */
134
+ export const useAccountStorageUsage = (options?: { enabled?: boolean }) => {
135
+ const { oxyServices, isAuthenticated, activeSessionId } = useOxy();
136
+
137
+ return useQuery<AccountStorageUsageResponse>({
138
+ queryKey: queryKeys.storage.usage(),
139
+ queryFn: async () => {
140
+ return authenticatedApiCall(
141
+ oxyServices,
142
+ activeSessionId,
143
+ () => oxyServices.getAccountStorageUsage()
144
+ );
145
+ },
146
+ enabled: (options?.enabled !== false) && isAuthenticated,
147
+ staleTime: 5 * 60 * 1000,
148
+ gcTime: 30 * 60 * 1000,
149
+ });
150
+ };
151
+
@@ -50,6 +50,7 @@ const PERSISTED_QUERY_PREFIXES: ReadonlyArray<string> = [
50
50
  'sessions',
51
51
  'devices',
52
52
  'privacy',
53
+ 'payments',
53
54
  ];
54
55
 
55
56
  /**