@oxyhq/services 5.21.6 → 5.21.7

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 (129) hide show
  1. package/lib/commonjs/crypto/keyManager.js +67 -22
  2. package/lib/commonjs/crypto/keyManager.js.map +1 -1
  3. package/lib/commonjs/index.js +66 -0
  4. package/lib/commonjs/index.js.map +1 -1
  5. package/lib/commonjs/ui/components/fileManagement/AnimatedButton.js +57 -0
  6. package/lib/commonjs/ui/components/fileManagement/AnimatedButton.js.map +1 -0
  7. package/lib/commonjs/ui/components/profile/EditBioModal.js +24 -156
  8. package/lib/commonjs/ui/components/profile/EditBioModal.js.map +1 -1
  9. package/lib/commonjs/ui/components/profile/EditDisplayNameModal.js +28 -178
  10. package/lib/commonjs/ui/components/profile/EditDisplayNameModal.js.map +1 -1
  11. package/lib/commonjs/ui/components/profile/EditEmailModal.js +32 -159
  12. package/lib/commonjs/ui/components/profile/EditEmailModal.js.map +1 -1
  13. package/lib/commonjs/ui/components/profile/EditLocationModal.js +45 -227
  14. package/lib/commonjs/ui/components/profile/EditLocationModal.js.map +1 -1
  15. package/lib/commonjs/ui/components/profile/EditUsernameModal.js +30 -155
  16. package/lib/commonjs/ui/components/profile/EditUsernameModal.js.map +1 -1
  17. package/lib/commonjs/ui/hooks/mutations/mutationFactory.js +177 -0
  18. package/lib/commonjs/ui/hooks/mutations/mutationFactory.js.map +1 -0
  19. package/lib/commonjs/ui/hooks/mutations/useAccountMutations.js +10 -123
  20. package/lib/commonjs/ui/hooks/mutations/useAccountMutations.js.map +1 -1
  21. package/lib/commonjs/ui/hooks/queries/useAccountQueries.js +2 -32
  22. package/lib/commonjs/ui/hooks/queries/useAccountQueries.js.map +1 -1
  23. package/lib/commonjs/ui/hooks/queries/useServicesQueries.js +2 -31
  24. package/lib/commonjs/ui/hooks/queries/useServicesQueries.js.map +1 -1
  25. package/lib/commonjs/ui/hooks/useFileFiltering.js +76 -0
  26. package/lib/commonjs/ui/hooks/useFileFiltering.js.map +1 -0
  27. package/lib/commonjs/ui/screens/FileManagementScreen.js +2 -2
  28. package/lib/commonjs/ui/screens/FileManagementScreen.js.map +1 -1
  29. package/lib/commonjs/ui/utils/authHelpers.js +164 -0
  30. package/lib/commonjs/ui/utils/authHelpers.js.map +1 -0
  31. package/lib/commonjs/ui/utils/avatarUtils.js +18 -61
  32. package/lib/commonjs/ui/utils/avatarUtils.js.map +1 -1
  33. package/lib/module/crypto/keyManager.js +67 -22
  34. package/lib/module/crypto/keyManager.js.map +1 -1
  35. package/lib/module/index.js +6 -0
  36. package/lib/module/index.js.map +1 -1
  37. package/lib/module/ui/components/fileManagement/AnimatedButton.js +50 -0
  38. package/lib/module/ui/components/fileManagement/AnimatedButton.js.map +1 -0
  39. package/lib/module/ui/components/profile/EditBioModal.js +24 -156
  40. package/lib/module/ui/components/profile/EditBioModal.js.map +1 -1
  41. package/lib/module/ui/components/profile/EditDisplayNameModal.js +28 -178
  42. package/lib/module/ui/components/profile/EditDisplayNameModal.js.map +1 -1
  43. package/lib/module/ui/components/profile/EditEmailModal.js +32 -159
  44. package/lib/module/ui/components/profile/EditEmailModal.js.map +1 -1
  45. package/lib/module/ui/components/profile/EditLocationModal.js +45 -227
  46. package/lib/module/ui/components/profile/EditLocationModal.js.map +1 -1
  47. package/lib/module/ui/components/profile/EditUsernameModal.js +30 -155
  48. package/lib/module/ui/components/profile/EditUsernameModal.js.map +1 -1
  49. package/lib/module/ui/hooks/mutations/mutationFactory.js +173 -0
  50. package/lib/module/ui/hooks/mutations/mutationFactory.js.map +1 -0
  51. package/lib/module/ui/hooks/mutations/useAccountMutations.js +10 -122
  52. package/lib/module/ui/hooks/mutations/useAccountMutations.js.map +1 -1
  53. package/lib/module/ui/hooks/queries/useAccountQueries.js +2 -32
  54. package/lib/module/ui/hooks/queries/useAccountQueries.js.map +1 -1
  55. package/lib/module/ui/hooks/queries/useServicesQueries.js +2 -31
  56. package/lib/module/ui/hooks/queries/useServicesQueries.js.map +1 -1
  57. package/lib/module/ui/hooks/useFileFiltering.js +72 -0
  58. package/lib/module/ui/hooks/useFileFiltering.js.map +1 -0
  59. package/lib/module/ui/screens/FileManagementScreen.js +2 -2
  60. package/lib/module/ui/screens/FileManagementScreen.js.map +1 -1
  61. package/lib/module/ui/utils/authHelpers.js +154 -0
  62. package/lib/module/ui/utils/authHelpers.js.map +1 -0
  63. package/lib/module/ui/utils/avatarUtils.js +18 -61
  64. package/lib/module/ui/utils/avatarUtils.js.map +1 -1
  65. package/lib/typescript/commonjs/crypto/keyManager.d.ts.map +1 -1
  66. package/lib/typescript/commonjs/index.d.ts +6 -0
  67. package/lib/typescript/commonjs/index.d.ts.map +1 -1
  68. package/lib/typescript/commonjs/ui/components/fileManagement/AnimatedButton.d.ts +16 -0
  69. package/lib/typescript/commonjs/ui/components/fileManagement/AnimatedButton.d.ts.map +1 -0
  70. package/lib/typescript/commonjs/ui/components/profile/EditBioModal.d.ts.map +1 -1
  71. package/lib/typescript/commonjs/ui/components/profile/EditDisplayNameModal.d.ts.map +1 -1
  72. package/lib/typescript/commonjs/ui/components/profile/EditEmailModal.d.ts.map +1 -1
  73. package/lib/typescript/commonjs/ui/components/profile/EditLocationModal.d.ts +1 -0
  74. package/lib/typescript/commonjs/ui/components/profile/EditLocationModal.d.ts.map +1 -1
  75. package/lib/typescript/commonjs/ui/components/profile/EditUsernameModal.d.ts.map +1 -1
  76. package/lib/typescript/commonjs/ui/hooks/mutations/mutationFactory.d.ts +76 -0
  77. package/lib/typescript/commonjs/ui/hooks/mutations/mutationFactory.d.ts.map +1 -0
  78. package/lib/typescript/commonjs/ui/hooks/mutations/useAccountMutations.d.ts +29 -4
  79. package/lib/typescript/commonjs/ui/hooks/mutations/useAccountMutations.d.ts.map +1 -1
  80. package/lib/typescript/commonjs/ui/hooks/queries/useAccountQueries.d.ts +1 -1
  81. package/lib/typescript/commonjs/ui/hooks/queries/useAccountQueries.d.ts.map +1 -1
  82. package/lib/typescript/commonjs/ui/hooks/queries/useServicesQueries.d.ts +1 -1
  83. package/lib/typescript/commonjs/ui/hooks/queries/useServicesQueries.d.ts.map +1 -1
  84. package/lib/typescript/commonjs/ui/hooks/useFileFiltering.d.ts +29 -0
  85. package/lib/typescript/commonjs/ui/hooks/useFileFiltering.d.ts.map +1 -0
  86. package/lib/typescript/commonjs/ui/utils/authHelpers.d.ts +99 -0
  87. package/lib/typescript/commonjs/ui/utils/authHelpers.d.ts.map +1 -0
  88. package/lib/typescript/commonjs/ui/utils/avatarUtils.d.ts.map +1 -1
  89. package/lib/typescript/module/crypto/keyManager.d.ts.map +1 -1
  90. package/lib/typescript/module/index.d.ts +6 -0
  91. package/lib/typescript/module/index.d.ts.map +1 -1
  92. package/lib/typescript/module/ui/components/fileManagement/AnimatedButton.d.ts +16 -0
  93. package/lib/typescript/module/ui/components/fileManagement/AnimatedButton.d.ts.map +1 -0
  94. package/lib/typescript/module/ui/components/profile/EditBioModal.d.ts.map +1 -1
  95. package/lib/typescript/module/ui/components/profile/EditDisplayNameModal.d.ts.map +1 -1
  96. package/lib/typescript/module/ui/components/profile/EditEmailModal.d.ts.map +1 -1
  97. package/lib/typescript/module/ui/components/profile/EditLocationModal.d.ts +1 -0
  98. package/lib/typescript/module/ui/components/profile/EditLocationModal.d.ts.map +1 -1
  99. package/lib/typescript/module/ui/components/profile/EditUsernameModal.d.ts.map +1 -1
  100. package/lib/typescript/module/ui/hooks/mutations/mutationFactory.d.ts +76 -0
  101. package/lib/typescript/module/ui/hooks/mutations/mutationFactory.d.ts.map +1 -0
  102. package/lib/typescript/module/ui/hooks/mutations/useAccountMutations.d.ts +29 -4
  103. package/lib/typescript/module/ui/hooks/mutations/useAccountMutations.d.ts.map +1 -1
  104. package/lib/typescript/module/ui/hooks/queries/useAccountQueries.d.ts +1 -1
  105. package/lib/typescript/module/ui/hooks/queries/useAccountQueries.d.ts.map +1 -1
  106. package/lib/typescript/module/ui/hooks/queries/useServicesQueries.d.ts +1 -1
  107. package/lib/typescript/module/ui/hooks/queries/useServicesQueries.d.ts.map +1 -1
  108. package/lib/typescript/module/ui/hooks/useFileFiltering.d.ts +29 -0
  109. package/lib/typescript/module/ui/hooks/useFileFiltering.d.ts.map +1 -0
  110. package/lib/typescript/module/ui/utils/authHelpers.d.ts +99 -0
  111. package/lib/typescript/module/ui/utils/authHelpers.d.ts.map +1 -0
  112. package/lib/typescript/module/ui/utils/avatarUtils.d.ts.map +1 -1
  113. package/package.json +1 -1
  114. package/src/crypto/keyManager.ts +23 -22
  115. package/src/index.ts +25 -0
  116. package/src/ui/components/fileManagement/AnimatedButton.tsx +56 -0
  117. package/src/ui/components/profile/EditBioModal.tsx +38 -176
  118. package/src/ui/components/profile/EditDisplayNameModal.tsx +48 -195
  119. package/src/ui/components/profile/EditEmailModal.tsx +49 -180
  120. package/src/ui/components/profile/EditLocationModal.tsx +76 -263
  121. package/src/ui/components/profile/EditUsernameModal.tsx +47 -175
  122. package/src/ui/hooks/mutations/mutationFactory.ts +215 -0
  123. package/src/ui/hooks/mutations/useAccountMutations.ts +48 -136
  124. package/src/ui/hooks/queries/useAccountQueries.ts +6 -33
  125. package/src/ui/hooks/queries/useServicesQueries.ts +6 -32
  126. package/src/ui/hooks/useFileFiltering.ts +115 -0
  127. package/src/ui/screens/FileManagementScreen.tsx +2 -2
  128. package/src/ui/utils/authHelpers.ts +183 -0
  129. package/src/ui/utils/avatarUtils.ts +25 -65
@@ -0,0 +1,16 @@
1
+ import React from 'react';
2
+ interface AnimatedButtonProps {
3
+ isSelected: boolean;
4
+ onPress: () => void;
5
+ icon: string;
6
+ primaryColor: string;
7
+ textColor: string;
8
+ style: any;
9
+ }
10
+ /**
11
+ * Animated button component for smooth selection transitions
12
+ * Used in file management views for view mode toggles
13
+ */
14
+ export declare const AnimatedButton: React.FC<AnimatedButtonProps>;
15
+ export {};
16
+ //# sourceMappingURL=AnimatedButton.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AnimatedButton.d.ts","sourceRoot":"","sources":["../../../../../../src/ui/components/fileManagement/AnimatedButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA4B,MAAM,OAAO,CAAC;AAKjD,UAAU,mBAAmB;IAC3B,UAAU,EAAE,OAAO,CAAC;IACpB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,GAAG,CAAC;CACZ;AAED;;;GAGG;AACH,eAAO,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC,mBAAmB,CAqCxD,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"EditBioModal.d.ts","sourceRoot":"","sources":["../../../../../../src/ui/components/profile/EditBioModal.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAiBnD,UAAU,iBAAiB;IACvB,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,KAAK,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;IACzB,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;CACvB;AAED,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,iBAAiB,CAsFpD,CAAC"}
1
+ {"version":3,"file":"EditBioModal.d.ts","sourceRoot":"","sources":["../../../../../../src/ui/components/profile/EditBioModal.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAK1B,UAAU,iBAAiB;IACzB,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,KAAK,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;IACzB,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;CACrB;AAED,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,iBAAiB,CAgCpD,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"EditDisplayNameModal.d.ts","sourceRoot":"","sources":["../../../../../../src/ui/components/profile/EditDisplayNameModal.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAiBnD,UAAU,yBAAyB;IAC/B,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,KAAK,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;IACzB,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;CACvB;AAED,eAAO,MAAM,oBAAoB,EAAE,KAAK,CAAC,EAAE,CAAC,yBAAyB,CA+GpE,CAAC"}
1
+ {"version":3,"file":"EditDisplayNameModal.d.ts","sourceRoot":"","sources":["../../../../../../src/ui/components/profile/EditDisplayNameModal.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAK1B,UAAU,yBAAyB;IACjC,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,KAAK,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;IACzB,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;CACrB;AAED,eAAO,MAAM,oBAAoB,EAAE,KAAK,CAAC,EAAE,CAAC,yBAAyB,CAyCpE,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"EditEmailModal.d.ts","sourceRoot":"","sources":["../../../../../../src/ui/components/profile/EditEmailModal.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAiBnD,UAAU,mBAAmB;IACzB,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,KAAK,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;IACzB,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;CACvB;AAED,eAAO,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC,mBAAmB,CA0FxD,CAAC"}
1
+ {"version":3,"file":"EditEmailModal.d.ts","sourceRoot":"","sources":["../../../../../../src/ui/components/profile/EditEmailModal.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAM1B,UAAU,mBAAmB;IAC3B,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,KAAK,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;IACzB,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;CACrB;AAED,eAAO,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC,mBAAmB,CA0CxD,CAAC"}
@@ -7,6 +7,7 @@ interface Location {
7
7
  lat: number;
8
8
  lon: number;
9
9
  };
10
+ [key: string]: unknown;
10
11
  }
11
12
  interface EditLocationModalProps {
12
13
  visible: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"EditLocationModal.d.ts","sourceRoot":"","sources":["../../../../../../src/ui/components/profile/EditLocationModal.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAkBnD,UAAU,QAAQ;IACd,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE,CAAC;CAC9C;AAED,UAAU,sBAAsB;IAC5B,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,gBAAgB,CAAC,EAAE,QAAQ,EAAE,CAAC;IAC9B,KAAK,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;IACzB,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;CACvB;AAED,eAAO,MAAM,iBAAiB,EAAE,KAAK,CAAC,EAAE,CAAC,sBAAsB,CAwI9D,CAAC"}
1
+ {"version":3,"file":"EditLocationModal.d.ts","sourceRoot":"","sources":["../../../../../../src/ui/components/profile/EditLocationModal.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAO1B,UAAU,QAAQ;IAChB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE,CAAC;IAC3C,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED,UAAU,sBAAsB;IAC9B,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,gBAAgB,CAAC,EAAE,QAAQ,EAAE,CAAC;IAC9B,KAAK,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;IACzB,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;CACrB;AAED,eAAO,MAAM,iBAAiB,EAAE,KAAK,CAAC,EAAE,CAAC,sBAAsB,CAgD9D,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"EditUsernameModal.d.ts","sourceRoot":"","sources":["../../../../../../src/ui/components/profile/EditUsernameModal.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAiBnD,UAAU,sBAAsB;IAC5B,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,KAAK,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;IACzB,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;CACvB;AAED,eAAO,MAAM,iBAAiB,EAAE,KAAK,CAAC,EAAE,CAAC,sBAAsB,CAqF9D,CAAC"}
1
+ {"version":3,"file":"EditUsernameModal.d.ts","sourceRoot":"","sources":["../../../../../../src/ui/components/profile/EditUsernameModal.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAK1B,UAAU,sBAAsB;IAC9B,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,KAAK,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;IACzB,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;CACrB;AAED,eAAO,MAAM,iBAAiB,EAAE,KAAK,CAAC,EAAE,CAAC,sBAAsB,CAyC9D,CAAC"}
@@ -0,0 +1,76 @@
1
+ /**
2
+ * Mutation Factory - Creates standardized mutations with optimistic updates
3
+ *
4
+ * This factory reduces boilerplate code for mutations that follow the common pattern:
5
+ * 1. Cancel outgoing queries
6
+ * 2. Snapshot previous data
7
+ * 3. Apply optimistic update
8
+ * 4. On error: rollback and show toast
9
+ * 5. On success: update cache, stores, and invalidate queries
10
+ */
11
+ import { QueryClient, UseMutationOptions } from '@tanstack/react-query';
12
+ import type { User } from '../../../models/interfaces';
13
+ /**
14
+ * Configuration for creating a standard profile mutation
15
+ */
16
+ export interface ProfileMutationConfig<TData, TVariables> {
17
+ /** The mutation function that makes the API call */
18
+ mutationFn: (variables: TVariables) => Promise<TData>;
19
+ /** Query keys to cancel before mutation */
20
+ cancelQueryKeys?: unknown[][];
21
+ /** Function to apply optimistic update to the user data */
22
+ optimisticUpdate?: (previousUser: User, variables: TVariables) => Partial<User>;
23
+ /** Error message to show on failure */
24
+ errorMessage?: string | ((error: Error) => string);
25
+ /** Success message to show (optional) */
26
+ successMessage?: string;
27
+ /** Whether to update authStore on success (default: true) */
28
+ updateAuthStore?: boolean;
29
+ /** Whether to invalidate user queries on success (default: true) */
30
+ invalidateUserQueries?: boolean;
31
+ /** Whether to invalidate account queries on success (default: true) */
32
+ invalidateAccountQueries?: boolean;
33
+ /** Custom onSuccess handler */
34
+ onSuccess?: (data: TData, variables: TVariables, queryClient: QueryClient) => void;
35
+ }
36
+ /**
37
+ * Creates a standard profile mutation with optimistic updates
38
+ *
39
+ * @example
40
+ * ```ts
41
+ * const updateProfile = createProfileMutation({
42
+ * mutationFn: (updates) => oxyServices.updateProfile(updates),
43
+ * optimisticUpdate: (user, updates) => updates,
44
+ * errorMessage: 'Failed to update profile',
45
+ * });
46
+ * ```
47
+ */
48
+ export declare function createProfileMutation<TVariables>(config: ProfileMutationConfig<User, TVariables>, queryClient: QueryClient, activeSessionId: string | null): UseMutationOptions<User, Error, TVariables, {
49
+ previousUser?: User;
50
+ }>;
51
+ /**
52
+ * Configuration for creating a generic mutation (non-profile)
53
+ */
54
+ export interface GenericMutationConfig<TData, TVariables, TContext> {
55
+ /** The mutation function */
56
+ mutationFn: (variables: TVariables) => Promise<TData>;
57
+ /** Query key for optimistic data */
58
+ queryKey: unknown[];
59
+ /** Function to create optimistic data */
60
+ optimisticData?: (previous: TData | undefined, variables: TVariables) => TData;
61
+ /** Error message */
62
+ errorMessage?: string;
63
+ /** Success message */
64
+ successMessage?: string;
65
+ /** Additional queries to invalidate on success */
66
+ invalidateQueries?: unknown[][];
67
+ }
68
+ /**
69
+ * Creates a generic mutation with optimistic updates
70
+ */
71
+ export declare function createGenericMutation<TData, TVariables>(config: GenericMutationConfig<TData, TVariables, {
72
+ previous?: TData;
73
+ }>, queryClient: QueryClient): UseMutationOptions<TData, Error, TVariables, {
74
+ previous?: TData;
75
+ }>;
76
+ //# sourceMappingURL=mutationFactory.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mutationFactory.d.ts","sourceRoot":"","sources":["../../../../../../src/ui/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,IAAI,CAAA;CAAE,CAAC,CAwFtE;AAED;;GAEG;AACH,MAAM,WAAW,qBAAqB,CAAC,KAAK,EAAE,UAAU,EAAE,QAAQ;IAChE,4BAA4B;IAC5B,UAAU,EAAE,CAAC,SAAS,EAAE,UAAU,KAAK,OAAO,CAAC,KAAK,CAAC,CAAC;IACtD,oCAAoC;IACpC,QAAQ,EAAE,OAAO,EAAE,CAAC;IACpB,yCAAyC;IACzC,cAAc,CAAC,EAAE,CAAC,QAAQ,EAAE,KAAK,GAAG,SAAS,EAAE,SAAS,EAAE,UAAU,KAAK,KAAK,CAAC;IAC/E,oBAAoB;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,sBAAsB;IACtB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,kDAAkD;IAClD,iBAAiB,CAAC,EAAE,OAAO,EAAE,EAAE,CAAC;CACjC;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,UAAU,EACrD,MAAM,EAAE,qBAAqB,CAAC,KAAK,EAAE,UAAU,EAAE;IAAE,QAAQ,CAAC,EAAE,KAAK,CAAA;CAAE,CAAC,EACtE,WAAW,EAAE,WAAW,GACvB,kBAAkB,CAAC,KAAK,EAAE,KAAK,EAAE,UAAU,EAAE;IAAE,QAAQ,CAAC,EAAE,KAAK,CAAA;CAAE,CAAC,CA2CpE"}
@@ -2,13 +2,13 @@ import type { User } from '../../../models/interfaces';
2
2
  /**
3
3
  * Update user profile with optimistic updates and offline queue support
4
4
  */
5
- export declare const useUpdateProfile: () => import("@tanstack/react-query").UseMutationResult<any, Error, Partial<User>, {
5
+ export declare const useUpdateProfile: () => import("@tanstack/react-query").UseMutationResult<User, Error, Partial<User>, {
6
6
  previousUser: User | undefined;
7
7
  }>;
8
8
  /**
9
9
  * Upload avatar with progress tracking and offline queue support
10
10
  */
11
- export declare const useUploadAvatar: () => import("@tanstack/react-query").UseMutationResult<any, Error, {
11
+ export declare const useUploadAvatar: () => import("@tanstack/react-query").UseMutationResult<User, Error, {
12
12
  uri: string;
13
13
  type?: string;
14
14
  name?: string;
@@ -25,20 +25,45 @@ export declare const useUpdateAccountSettings: () => import("@tanstack/react-que
25
25
  /**
26
26
  * Update privacy settings with optimistic updates and authentication handling
27
27
  */
28
- export declare const useUpdatePrivacySettings: () => import("@tanstack/react-query").UseMutationResult<any, Error, {
28
+ export declare const useUpdatePrivacySettings: () => import("@tanstack/react-query").UseMutationResult<Record<string, unknown>, Error, {
29
29
  settings: Record<string, any>;
30
30
  userId?: string;
31
31
  }, {
32
32
  previousPrivacySettings: unknown;
33
33
  previousUser: User | undefined;
34
34
  } | undefined>;
35
+ /** Uploaded file data structure from API */
36
+ interface UploadedFile {
37
+ id: string;
38
+ originalName?: string;
39
+ sha256?: string;
40
+ mime?: string;
41
+ size?: number;
42
+ createdAt?: string;
43
+ metadata?: Record<string, unknown>;
44
+ variants?: Array<{
45
+ type: string;
46
+ key: string;
47
+ width?: number;
48
+ height?: number;
49
+ readyAt?: string;
50
+ metadata?: Record<string, unknown>;
51
+ }>;
52
+ }
53
+ /** Upload result type that supports both single file and batch responses */
54
+ interface UploadResult {
55
+ file?: UploadedFile;
56
+ files?: UploadedFile[];
57
+ id?: string;
58
+ }
35
59
  /**
36
60
  * Upload file with authentication handling and progress tracking
37
61
  */
38
- export declare const useUploadFile: () => import("@tanstack/react-query").UseMutationResult<any, Error, {
62
+ export declare const useUploadFile: () => import("@tanstack/react-query").UseMutationResult<UploadResult, Error, {
39
63
  file: File;
40
64
  visibility?: "private" | "public" | "unlisted";
41
65
  metadata?: Record<string, any>;
42
66
  onProgress?: (progress: number) => void;
43
67
  }, unknown>;
68
+ export {};
44
69
  //# sourceMappingURL=useAccountMutations.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useAccountMutations.d.ts","sourceRoot":"","sources":["../../../../../../src/ui/hooks/mutations/useAccountMutations.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,4BAA4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,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACnC,QAAQ,CAAC,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;KAAE,CAAC,CAAC;CACxI;AAED,4EAA4E;AAC5E,UAAU,YAAY;IACpB,IAAI,CAAC,EAAE,YAAY,CAAC;IACpB,KAAK,CAAC,EAAE,YAAY,EAAE,CAAC;IACvB,EAAE,CAAC,EAAE,MAAM,CAAC;CACb;AAED;;GAEG;AACH,eAAO,MAAM,aAAa;UAUd,IAAI;iBACG,SAAS,GAAG,QAAQ,GAAG,UAAU;eACnC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;iBACjB,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI;WAS5C,CAAC"}
@@ -39,5 +39,5 @@ export declare const useUsersBySessions: (sessionIds: string[], options?: {
39
39
  */
40
40
  export declare const usePrivacySettings: (userId?: string, options?: {
41
41
  enabled?: boolean;
42
- }) => import("@tanstack/react-query").UseQueryResult<any, Error>;
42
+ }) => import("@tanstack/react-query").UseQueryResult<unknown, Error>;
43
43
  //# sourceMappingURL=useAccountQueries.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useAccountQueries.d.ts","sourceRoot":"","sources":["../../../../../../src/ui/hooks/queries/useAccountQueries.ts"],"names":[],"mappings":"AAMA;;GAEG;AACH,eAAO,MAAM,cAAc,GAAI,WAAW,MAAM,GAAG,IAAI,EAAE,UAAU;IAAE,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,+DAevF,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,eAAe,GAAI,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MAAM,GAAG,IAAI,EAAE,UAAU;IAAE,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,+DAejF,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,iBAAiB,GAAI,UAAU,MAAM,GAAG,IAAI,EAAE,UAAU;IAAE,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,+DAezF,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,kBAAkB,GAAI,YAAY,MAAM,EAAE,EAAE,UAAU;IAAE,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,+DAevF,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,kBAAkB,GAAI,SAAS,MAAM,EAAE,UAAU;IAAE,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,mEAqBlF,CAAC"}
@@ -22,7 +22,7 @@ export declare const useDeviceSessions: (options?: {
22
22
  */
23
23
  export declare const useUserDevices: (options?: {
24
24
  enabled?: boolean;
25
- }) => import("@tanstack/react-query").UseQueryResult<any, Error>;
25
+ }) => import("@tanstack/react-query").UseQueryResult<unknown, Error>;
26
26
  /**
27
27
  * Get security information
28
28
  */
@@ -1 +1 @@
1
- {"version":3,"file":"useServicesQueries.d.ts","sourceRoot":"","sources":["../../../../../../src/ui/hooks/queries/useServicesQueries.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAK7D;;GAEG;AACH,eAAO,MAAM,WAAW,GAAI,SAAS,MAAM,EAAE,UAAU;IAAE,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,2EAqB3E,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,UAAU,GAAI,WAAW,MAAM,GAAG,IAAI,EAAE,UAAU;IAAE,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,yEA6BnF,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,iBAAiB,GAAI,UAAU;IAAE,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,+DAgBhE,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,cAAc,GAAI,UAAU;IAAE,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,+DA2C7D,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,eAAe,GAAI,UAAU;IAAE,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,+DAY9D,CAAC"}
1
+ {"version":3,"file":"useServicesQueries.d.ts","sourceRoot":"","sources":["../../../../../../src/ui/hooks/queries/useServicesQueries.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAM7D;;GAEG;AACH,eAAO,MAAM,WAAW,GAAI,SAAS,MAAM,EAAE,UAAU;IAAE,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,2EAqB3E,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,UAAU,GAAI,WAAW,MAAM,GAAG,IAAI,EAAE,UAAU;IAAE,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,yEA6BnF,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,iBAAiB,GAAI,UAAU;IAAE,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,+DAgBhE,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,cAAc,GAAI,UAAU;IAAE,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,mEAgB7D,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,eAAe,GAAI,UAAU;IAAE,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,+DAY9D,CAAC"}
@@ -0,0 +1,29 @@
1
+ import type { FileMetadata } from '../../models/interfaces';
2
+ export type ViewMode = 'all' | 'photos' | 'videos' | 'documents' | 'audio';
3
+ export type SortBy = 'date' | 'size' | 'name' | 'type';
4
+ export type SortOrder = 'asc' | 'desc';
5
+ interface UseFileFilteringOptions {
6
+ files: FileMetadata[];
7
+ initialViewMode?: ViewMode;
8
+ initialSortBy?: SortBy;
9
+ initialSortOrder?: SortOrder;
10
+ }
11
+ interface UseFileFilteringReturn {
12
+ filteredFiles: FileMetadata[];
13
+ viewMode: ViewMode;
14
+ setViewMode: (mode: ViewMode) => void;
15
+ searchQuery: string;
16
+ setSearchQuery: (query: string) => void;
17
+ sortBy: SortBy;
18
+ setSortBy: (sort: SortBy) => void;
19
+ sortOrder: SortOrder;
20
+ setSortOrder: (order: SortOrder) => void;
21
+ toggleSortOrder: () => void;
22
+ }
23
+ /**
24
+ * Hook for file filtering, sorting, and search functionality
25
+ * Extracts common file management logic for reuse across components
26
+ */
27
+ export declare function useFileFiltering({ files, initialViewMode, initialSortBy, initialSortOrder, }: UseFileFilteringOptions): UseFileFilteringReturn;
28
+ export {};
29
+ //# sourceMappingURL=useFileFiltering.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useFileFiltering.d.ts","sourceRoot":"","sources":["../../../../../src/ui/hooks/useFileFiltering.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAE5D,MAAM,MAAM,QAAQ,GAAG,KAAK,GAAG,QAAQ,GAAG,QAAQ,GAAG,WAAW,GAAG,OAAO,CAAC;AAC3E,MAAM,MAAM,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,CAAC;AACvD,MAAM,MAAM,SAAS,GAAG,KAAK,GAAG,MAAM,CAAC;AAEvC,UAAU,uBAAuB;IAC/B,KAAK,EAAE,YAAY,EAAE,CAAC;IACtB,eAAe,CAAC,EAAE,QAAQ,CAAC;IAC3B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,gBAAgB,CAAC,EAAE,SAAS,CAAC;CAC9B;AAED,UAAU,sBAAsB;IAC9B,aAAa,EAAE,YAAY,EAAE,CAAC;IAC9B,QAAQ,EAAE,QAAQ,CAAC;IACnB,WAAW,EAAE,CAAC,IAAI,EAAE,QAAQ,KAAK,IAAI,CAAC;IACtC,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACxC,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,SAAS,EAAE,SAAS,CAAC;IACrB,YAAY,EAAE,CAAC,KAAK,EAAE,SAAS,KAAK,IAAI,CAAC;IACzC,eAAe,EAAE,MAAM,IAAI,CAAC;CAC7B;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,EAC/B,KAAK,EACL,eAAuB,EACvB,aAAsB,EACtB,gBAAyB,GAC1B,EAAE,uBAAuB,GAAG,sBAAsB,CA8ElD"}
@@ -0,0 +1,99 @@
1
+ /**
2
+ * Authentication helper utilities to reduce code duplication across hooks and utilities.
3
+ * These functions handle common token validation and authentication error patterns.
4
+ */
5
+ import type { OxyServices } from '../../core';
6
+ /**
7
+ * Error thrown when session sync is required
8
+ */
9
+ export declare class SessionSyncRequiredError extends Error {
10
+ constructor(message?: string);
11
+ }
12
+ /**
13
+ * Error thrown when authentication fails
14
+ */
15
+ export declare class AuthenticationFailedError extends Error {
16
+ constructor(message?: string);
17
+ }
18
+ /**
19
+ * Ensures a valid token exists before making authenticated API calls.
20
+ * If no valid token exists and an active session ID is available,
21
+ * attempts to refresh the token using the session.
22
+ *
23
+ * @param oxyServices - The OxyServices instance
24
+ * @param activeSessionId - The active session ID (if available)
25
+ * @throws {SessionSyncRequiredError} If the session needs to be synced (offline session)
26
+ * @throws {Error} If token refresh fails for other reasons
27
+ *
28
+ * @example
29
+ * ```ts
30
+ * // In a mutation or query function:
31
+ * await ensureValidToken(oxyServices, activeSessionId);
32
+ * return await oxyServices.updateProfile(updates);
33
+ * ```
34
+ */
35
+ export declare function ensureValidToken(oxyServices: OxyServices, activeSessionId: string | null | undefined): Promise<void>;
36
+ /**
37
+ * Options for handling API authentication errors
38
+ */
39
+ export interface HandleApiErrorOptions {
40
+ /** Optional callback to attempt session sync and retry */
41
+ syncSession?: () => Promise<unknown>;
42
+ /** The active session ID for retry attempts */
43
+ activeSessionId?: string | null;
44
+ /** The OxyServices instance for retry attempts */
45
+ oxyServices?: OxyServices;
46
+ }
47
+ /**
48
+ * Checks if an error is an authentication error (401 or auth-related message)
49
+ *
50
+ * @param error - The error to check
51
+ * @returns True if the error is an authentication error
52
+ */
53
+ export declare function isAuthenticationError(error: unknown): boolean;
54
+ /**
55
+ * Wraps an API call with authentication error handling.
56
+ * If an authentication error occurs, it can optionally attempt to sync the session and retry.
57
+ *
58
+ * @param apiCall - The API call function to execute
59
+ * @param options - Optional error handling configuration
60
+ * @returns The result of the API call
61
+ * @throws {AuthenticationFailedError} If authentication fails and cannot be recovered
62
+ * @throws {Error} If the API call fails for non-auth reasons
63
+ *
64
+ * @example
65
+ * ```ts
66
+ * // Simple usage:
67
+ * const result = await withAuthErrorHandling(
68
+ * () => oxyServices.updateProfile(updates)
69
+ * );
70
+ *
71
+ * // With retry on auth failure:
72
+ * const result = await withAuthErrorHandling(
73
+ * () => oxyServices.updateProfile(updates),
74
+ * { syncSession, activeSessionId, oxyServices }
75
+ * );
76
+ * ```
77
+ */
78
+ export declare function withAuthErrorHandling<T>(apiCall: () => Promise<T>, options?: HandleApiErrorOptions): Promise<T>;
79
+ /**
80
+ * Combines token validation and auth error handling for a complete authenticated API call.
81
+ * This is the recommended helper for most authenticated API operations.
82
+ *
83
+ * @param oxyServices - The OxyServices instance
84
+ * @param activeSessionId - The active session ID
85
+ * @param apiCall - The API call function to execute
86
+ * @param syncSession - Optional callback to sync session on auth failure
87
+ * @returns The result of the API call
88
+ *
89
+ * @example
90
+ * ```ts
91
+ * return await authenticatedApiCall(
92
+ * oxyServices,
93
+ * activeSessionId,
94
+ * () => oxyServices.updateProfile(updates)
95
+ * );
96
+ * ```
97
+ */
98
+ export declare function authenticatedApiCall<T>(oxyServices: OxyServices, activeSessionId: string | null | undefined, apiCall: () => Promise<T>, syncSession?: () => Promise<unknown>): Promise<T>;
99
+ //# sourceMappingURL=authHelpers.d.ts.map
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,GACnC,OAAO,CAAC,CAAC,CAAC,CAQZ"}
@@ -1 +1 @@
1
- {"version":3,"file":"avatarUtils.d.ts","sourceRoot":"","sources":["../../../../../src/ui/utils/avatarUtils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAC;AAGpD,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAGpD;;;;;;;;GAQG;AACH,wBAAsB,sBAAsB,CAC1C,MAAM,EAAE,MAAM,GAAG,SAAS,EAC1B,WAAW,EAAE,WAAW,EACxB,WAAW,GAAE,MAAsB,GAClC,OAAO,CAAC,IAAI,CAAC,CAcf;AAED;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAClC,SAAS,EAAE,MAAM,EACjB,YAAY,EAAE,MAAM,EACpB,WAAW,EAAE,WAAW,GACvB,IAAI,CAON;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,uBAAuB,CAC3C,OAAO,EAAE,OAAO,CAAC,IAAI,CAAC,EACtB,WAAW,EAAE,WAAW,EACxB,eAAe,EAAE,MAAM,GAAG,IAAI,EAC9B,WAAW,EAAE,WAAW,EACxB,WAAW,CAAC,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,GAChC,OAAO,CAAC,IAAI,CAAC,CAoEf"}
1
+ {"version":3,"file":"avatarUtils.d.ts","sourceRoot":"","sources":["../../../../../src/ui/utils/avatarUtils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAC;AAGpD,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAIpD;;;;;;;;GAQG;AACH,wBAAsB,sBAAsB,CAC1C,MAAM,EAAE,MAAM,GAAG,SAAS,EAC1B,WAAW,EAAE,WAAW,EACxB,WAAW,GAAE,MAAsB,GAClC,OAAO,CAAC,IAAI,CAAC,CAcf;AAED;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAClC,SAAS,EAAE,MAAM,EACjB,YAAY,EAAE,MAAM,EACpB,WAAW,EAAE,WAAW,GACvB,IAAI,CAON;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,uBAAuB,CAC3C,OAAO,EAAE,OAAO,CAAC,IAAI,CAAC,EACtB,WAAW,EAAE,WAAW,EACxB,eAAe,EAAE,MAAM,GAAG,IAAI,EAC9B,WAAW,EAAE,WAAW,EACxB,WAAW,CAAC,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,GAChC,OAAO,CAAC,IAAI,CAAC,CA2Bf"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oxyhq/services",
3
- "version": "5.21.6",
3
+ "version": "5.21.7",
4
4
  "description": "Reusable OxyHQ module to handle authentication, user management, karma system, device-based session management and more 🚀",
5
5
  "main": "lib/commonjs/index.js",
6
6
  "module": "lib/module/index.js",
@@ -8,6 +8,7 @@
8
8
  import { ec as EC } from 'elliptic';
9
9
  import type { ECKeyPair } from 'elliptic';
10
10
  import { Platform } from 'react-native';
11
+ import { logger } from '../utils/loggerUtils';
11
12
 
12
13
  // Lazy imports for React Native specific modules
13
14
  let SecureStore: typeof import('expo-secure-store') | null = null;
@@ -243,7 +244,7 @@ export class KeyManager {
243
244
  KeyManager.cachedHasSharedIdentity = true;
244
245
 
245
246
  if (__DEV__) {
246
- console.log('[KeyManager] Shared identity created successfully');
247
+ logger.debug('Shared identity created successfully', { component: 'KeyManager' });
247
248
  }
248
249
 
249
250
  return publicKey;
@@ -282,7 +283,7 @@ export class KeyManager {
282
283
  return publicKey;
283
284
  } catch (error) {
284
285
  if (__DEV__) {
285
- console.warn('[KeyManager] Failed to get shared public key:', error);
286
+ logger.warn('Failed to get shared public key', { component: 'KeyManager' }, error);
286
287
  }
287
288
  KeyManager.cachedSharedPublicKey = null;
288
289
  return null;
@@ -317,7 +318,7 @@ export class KeyManager {
317
318
  return privateKey;
318
319
  } catch (error) {
319
320
  if (__DEV__) {
320
- console.warn('[KeyManager] Failed to get shared private key:', error);
321
+ logger.warn('Failed to get shared private key', { component: 'KeyManager' }, error);
321
322
  }
322
323
  return null;
323
324
  }
@@ -348,7 +349,7 @@ export class KeyManager {
348
349
  return hasShared;
349
350
  } catch (error) {
350
351
  if (__DEV__) {
351
- console.warn('[KeyManager] Failed to check shared identity:', error);
352
+ logger.warn('Failed to check shared identity', { component: 'KeyManager' }, error);
352
353
  }
353
354
  KeyManager.cachedHasSharedIdentity = false;
354
355
  return false;
@@ -397,7 +398,7 @@ export class KeyManager {
397
398
  KeyManager.cachedHasSharedIdentity = true;
398
399
 
399
400
  if (__DEV__) {
400
- console.log('[KeyManager] Shared identity imported successfully');
401
+ logger.debug('Shared identity imported successfully', { component: 'KeyManager' });
401
402
  }
402
403
 
403
404
  return publicKey;
@@ -436,11 +437,11 @@ export class KeyManager {
436
437
  }
437
438
 
438
439
  if (__DEV__) {
439
- console.log('[KeyManager] Shared session stored successfully');
440
+ logger.debug('Shared session stored successfully', { component: 'KeyManager' });
440
441
  }
441
442
  } catch (error) {
442
443
  if (__DEV__) {
443
- console.error('[KeyManager] Failed to store shared session:', error);
444
+ logger.error('Failed to store shared session', error, { component: 'KeyManager' });
444
445
  }
445
446
  throw error;
446
447
  }
@@ -484,7 +485,7 @@ export class KeyManager {
484
485
  return { sessionId, accessToken };
485
486
  } catch (error) {
486
487
  if (__DEV__) {
487
- console.warn('[KeyManager] Failed to get shared session:', error);
488
+ logger.warn('Failed to get shared session', { component: 'KeyManager' }, error);
488
489
  }
489
490
  return null;
490
491
  }
@@ -517,11 +518,11 @@ export class KeyManager {
517
518
  }
518
519
 
519
520
  if (__DEV__) {
520
- console.log('[KeyManager] Shared session cleared successfully');
521
+ logger.debug('Shared session cleared successfully', { component: 'KeyManager' });
521
522
  }
522
523
  } catch (error) {
523
524
  if (__DEV__) {
524
- console.error('[KeyManager] Failed to clear shared session:', error);
525
+ logger.error('Failed to clear shared session', error, { component: 'KeyManager' });
525
526
  }
526
527
  }
527
528
  }
@@ -545,7 +546,7 @@ export class KeyManager {
545
546
  const hasShared = await KeyManager.hasSharedIdentity();
546
547
  if (hasShared) {
547
548
  if (__DEV__) {
548
- console.log('[KeyManager] Shared identity already exists, skipping migration');
549
+ logger.debug('Shared identity already exists, skipping migration', { component: 'KeyManager' });
549
550
  }
550
551
  return true;
551
552
  }
@@ -554,7 +555,7 @@ export class KeyManager {
554
555
  const privateKey = await KeyManager.getPrivateKey();
555
556
  if (!privateKey) {
556
557
  if (__DEV__) {
557
- console.log('[KeyManager] No local identity to migrate');
558
+ logger.debug('No local identity to migrate', { component: 'KeyManager' });
558
559
  }
559
560
  return false;
560
561
  }
@@ -563,13 +564,13 @@ export class KeyManager {
563
564
  await KeyManager.importSharedIdentity(privateKey);
564
565
 
565
566
  if (__DEV__) {
566
- console.log('[KeyManager] Successfully migrated local identity to shared identity');
567
+ logger.debug('Successfully migrated local identity to shared identity', { component: 'KeyManager' });
567
568
  }
568
569
 
569
570
  return true;
570
571
  } catch (error) {
571
572
  if (__DEV__) {
572
- console.error('[KeyManager] Failed to migrate to shared identity:', error);
573
+ logger.error('Failed to migrate to shared identity', error, { component: 'KeyManager' });
573
574
  }
574
575
  return false;
575
576
  }
@@ -640,7 +641,7 @@ export class KeyManager {
640
641
  // If secure store is not available, return null (no identity)
641
642
  // This allows the app to continue functioning even if secure store fails to load
642
643
  if (__DEV__) {
643
- console.warn('[KeyManager] Failed to access secure store:', error);
644
+ logger.warn('Failed to access secure store', { component: 'KeyManager' }, error);
644
645
  }
645
646
  return null;
646
647
  }
@@ -670,7 +671,7 @@ export class KeyManager {
670
671
  // Cache null to avoid repeated failed attempts
671
672
  KeyManager.cachedPublicKey = null;
672
673
  if (__DEV__) {
673
- console.warn('[KeyManager] Failed to access secure store:', error);
674
+ logger.warn('Failed to access secure store', { component: 'KeyManager' }, error);
674
675
  }
675
676
  return null;
676
677
  }
@@ -700,7 +701,7 @@ export class KeyManager {
700
701
  // Cache false to avoid repeated failed attempts
701
702
  KeyManager.cachedHasIdentity = false;
702
703
  if (__DEV__) {
703
- console.warn('[KeyManager] Failed to check identity:', error);
704
+ logger.warn('Failed to check identity', { component: 'KeyManager' }, error);
704
705
  }
705
706
  return false;
706
707
  }
@@ -741,11 +742,11 @@ export class KeyManager {
741
742
  try {
742
743
  const backupSuccess = await KeyManager.backupIdentity();
743
744
  if (!backupSuccess && typeof __DEV__ !== 'undefined' && __DEV__) {
744
- console.warn('[KeyManager] Failed to backup identity before deletion - proceeding anyway');
745
+ logger.warn('Failed to backup identity before deletion - proceeding anyway', { component: 'KeyManager' });
745
746
  }
746
747
  } catch (backupError) {
747
748
  if (typeof __DEV__ !== 'undefined' && __DEV__) {
748
- console.warn('[KeyManager] Failed to backup identity before deletion:', backupError);
749
+ logger.warn('Failed to backup identity before deletion', { component: 'KeyManager' }, backupError);
749
750
  }
750
751
  }
751
752
  }
@@ -795,7 +796,7 @@ export class KeyManager {
795
796
  return true;
796
797
  } catch (error) {
797
798
  if (typeof __DEV__ !== 'undefined' && __DEV__) {
798
- console.error('[KeyManager] Failed to backup identity:', error);
799
+ logger.error('Failed to backup identity', error, { component: 'KeyManager' });
799
800
  }
800
801
  return false;
801
802
  }
@@ -841,7 +842,7 @@ export class KeyManager {
841
842
  return true;
842
843
  } catch (error) {
843
844
  if (typeof __DEV__ !== 'undefined' && __DEV__) {
844
- console.error('[KeyManager] Identity integrity check failed:', error);
845
+ logger.error('Identity integrity check failed', error, { component: 'KeyManager' });
845
846
  }
846
847
  return false;
847
848
  }
@@ -898,7 +899,7 @@ export class KeyManager {
898
899
  return false;
899
900
  } catch (error) {
900
901
  if (typeof __DEV__ !== 'undefined' && __DEV__) {
901
- console.error('[KeyManager] Failed to restore identity from backup:', error);
902
+ logger.error('Failed to restore identity from backup', error, { component: 'KeyManager' });
902
903
  }
903
904
  return false;
904
905
  }
package/src/index.ts CHANGED
@@ -183,6 +183,31 @@ export {
183
183
  useRemoveDevice,
184
184
  } from './ui/hooks/mutations';
185
185
 
186
+ // Mutation factory utilities
187
+ export {
188
+ createProfileMutation,
189
+ createGenericMutation,
190
+ } from './ui/hooks/mutations/mutationFactory';
191
+ export type {
192
+ ProfileMutationConfig,
193
+ GenericMutationConfig,
194
+ } from './ui/hooks/mutations/mutationFactory';
195
+
196
+ // Authentication helpers
197
+ export {
198
+ ensureValidToken,
199
+ withAuthErrorHandling,
200
+ authenticatedApiCall,
201
+ isAuthenticationError,
202
+ SessionSyncRequiredError,
203
+ AuthenticationFailedError,
204
+ } from './ui/utils/authHelpers';
205
+ export type { HandleApiErrorOptions } from './ui/utils/authHelpers';
206
+
207
+ // File filtering hook
208
+ export { useFileFiltering } from './ui/hooks/useFileFiltering';
209
+ export type { ViewMode, SortBy, SortOrder } from './ui/hooks/useFileFiltering';
210
+
186
211
  // UI components
187
212
  export { OxySignInButton } from './ui/components/OxySignInButton';
188
213
  export { OxyLogo, FollowButton } from './ui';